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gICB9CkBAIC00MjQsNiArNDI2LDI4IEBACiAgICAgICAgIH0KICAgICB9CiAKKyAgICBwcml2YXRlIHZvaWQgcnVuRHVtcEhlYXAoKSB0aHJvd3MgRXhjZXB0aW9uIHsKKyAgICAgICAgYm9vbGVhbiBtYW5hZ2VkID0gISItbiIuZXF1YWxzKG5leHRPcHRpb24oKSk7CisgICAgICAgIFN0cmluZyBwcm9jZXNzID0gbmV4dEFyZ1JlcXVpcmVkKCk7CisgICAgICAgIFN0cmluZyBoZWFwRmlsZSA9IG5leHRBcmdSZXF1aXJlZCgpOworICAgICAgICBQYXJjZWxGaWxlRGVzY3JpcHRvciBmZCA9IG51bGw7CisKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIGZkID0gUGFyY2VsRmlsZURlc2NyaXB0b3Iub3BlbigKKyAgICAgICAgICAgICAgICAgICAgbmV3IEZpbGUoaGVhcEZpbGUpLAorICAgICAgICAgICAgICAgICAgICBQYXJjZWxGaWxlRGVzY3JpcHRvci5NT0RFX0NSRUFURSB8CisgICAgICAgICAgICAgICAgICAgIFBhcmNlbEZpbGVEZXNjcmlwdG9yLk1PREVfVFJVTkNBVEUgfAorICAgICAgICAgICAgICAgICAgICBQYXJjZWxGaWxlRGVzY3JpcHRvci5NT0RFX1JFQURfV1JJVEUpOworICAgICAgICB9IGNhdGNoIChGaWxlTm90Rm91bmRFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgU3lzdGVtLmVyci5wcmludGxuKCJFcnJvcjogVW5hYmxlIHRvIG9wZW4gZmlsZTogIiArIGhlYXBGaWxlKTsKKyAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfQorCisgICAgICAgIGlmICghbUFtLmR1bXBIZWFwKHByb2Nlc3MsIG1hbmFnZWQsIGhlYXBGaWxlLCBmZCkpIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBBbmRyb2lkRXhjZXB0aW9uKCJIRUFQIERVTVAgRkFJTEVEIG9uIHByb2Nlc3MgIiArIHByb2Nlc3MpOworICAgICAgICB9CisgICAgfQorCiAgICAgcHJpdmF0ZSBjbGFzcyBJbnRlbnRSZWNlaXZlciBleHRlbmRzIElJbnRlbnRSZWNlaXZlci5TdHViIHsKICAgICAgICAgcHJpdmF0ZSBib29sZWFuIG1GaW5pc2hlZCA9IGZhbHNlOwogCkBAIC01OTMsNiArNjE3LDggQEAKICAgICAgICAgICAgICAgICAiXG4iICsKICAgICAgICAgICAgICAgICAiICAgIHN0YXJ0IHByb2ZpbGluZzogYW0gcHJvZmlsZSA8UFJPQ0VTUz4gc3RhcnQgPEZJTEU+XG4iICsKICAgICAgICAgICAgICAgICAiICAgIHN0b3AgcHJvZmlsaW5nOiBhbSBwcm9maWxlIDxQUk9DRVNTPiBzdG9wXG4iICsKKyAgICAgICAgICAgICAgICAiICAgIGR1bXAgaGVhcDogYW0gZHVtcGhlYXAgW2ZsYWdzXSA8UFJPQ0VTUz4gPEZJTEU+XG4iICsKKyAgICAgICAgICAgICAgICAiICAgICAgICAtbjogZHVtcCBuYXRpdmUgaGVhcCBpbnN0ZWFkIG9mIG1hbmFnZWQgaGVhcFxuIiArCiAgICAgICAgICAgICAgICAgIlxuIiArCiAgICAgICAgICAgICAgICAgIiAgICA8SU5URU5UPiBzcGVjaWZpY2F0aW9ucyBpbmNsdWRlIHRoZXNlIGZsYWdzOlxuIiArCiAgICAgICAgICAgICAgICAgIiAgICAgICAgWy1hIDxBQ1RJT04+XSBbLWQgPERBVEFfVVJJPl0gWy10IDxNSU1FX1RZUEU+XVxuIiArCkBAIC02MDAsNyArNjI2LDcgQEAKICAgICAgICAgICAgICAgICAiICAgICAgICBbLWV8LS1lcyA8RVhUUkFfS0VZPiA8RVhUUkFfU1RSSU5HX1ZBTFVFPiAuLi5dXG4iICsKICAgICAgICAgICAgICAgICAiICAgICAgICBbLS1lc24gPEVYVFJBX0tFWT4gLi4uXVxuIiArCiAgICAgICAgICAgICAgICAgIiAgICAgICAgWy0tZXogPEVYVFJBX0tFWT4gPEV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B9CiAKIGludCBtYWluKGludCBhcmdjLCBjaGFyICphcmd2W10pIHsKICAgICBpbnQgZG9fYWRkX2RhdGUgPSAwOwogICAgIGludCBkb19jb21wcmVzcyA9IDA7CiAgICAgY2hhciogdXNlX291dGZpbGUgPSAwOworICAgIGNoYXIqIGJlZ2luX3NvdW5kID0gMDsKKyAgICBjaGFyKiBlbmRfc291bmQgPSAwOwogICAgIGludCB1c2Vfc29ja2V0ID0gMDsKKyAgICBpbnQgZG9fZmIgPSAwOwogCiAgICAgTE9HSSgiYmVnaW5cbiIpOwogCkBAIC0xOTEsMTMgKzIwOSwxNiBAQAogICAgIGR1bXBfdHJhY2VzX3BhdGggPSBkdW1wX3ZtX3RyYWNlcygpOwogCiAgICAgaW50IGM7Ci0gICAgd2hpbGUgKChjID0gZ2V0b3B0KGFyZ2MsIGFyZ3YsICJkaG86c3Z6IikpICE9IC0xKSB7CisgICAgd2hpbGUgKChjID0gZ2V0b3B0KGFyZ2MsIGFyZ3YsICJiOmRlOmhvOnN2enAiKSkgIT0gLTEpIHsKICAgICAgICAgc3dpdGNoIChjKSB7CisgICAgICAgICAgICBjYXNlICdiJzogYmVnaW5fc291bmQgPSBvcHRhcmc7ICBicmVhazsKICAgICAgICAgICAgIGNhc2UgJ2QnOiBkb19hZGRfZGF0ZSA9IDE7ICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSAnZSc6IGVuZF9zb3VuZCA9IG9wdGFyZzsgICAgYnJlYWs7CiAgICAgICAgICAgICBjYXNlICdvJzogdXNlX291dGZpbGUgPSBvcHRhcmc7ICBicmVhazsKICAgICAgICAgICAgIGNhc2UgJ3MnOiB1c2Vfc29ja2V0ID0gMTsgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgY2FzZSAndic6IGJyZWFrOyAgLy8gY29tcGF0aWJpbGl0eSBuby1vcAogICAgICAgICAgICAgY2FzZSAneic6IGRvX2NvbXByZXNzID0gNjsgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXN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HZpbmZvLmJpdHNfcGVyX3BpeGVsIC8gNCwgCisgICAgICAgIFBOR19DT0xPUl9UWVBFX1JHQl9BTFBIQSwgUE5HX0lOVEVSTEFDRV9OT05FLAorICAgICAgICBQTkdfQ09NUFJFU1NJT05fVFlQRV9CQVNFLCBQTkdfRklMVEVSX1RZUEVfQkFTRSk7CisgICAgcG5nX3dyaXRlX2luZm8ocG5nLCBpbmZvKTsKKworICAgIHJvd2xlbj12aW5mby54cmVzICogYnl0ZXNwcDsKKyAgICBpZiAocm93bGVuID4gc2l6ZW9mKGltZ2J1ZikpIHsKKyAgICAgICAgTE9HRSgiY3Jhenkgcm93bGVuOiAlZFxuIiwgcm93bGVuKTsKKyAgICAgICAgcG5nX2Rlc3Ryb3lfd3JpdGVfc3RydWN0KCZwbmcsIE5VTEwpOworICAgICAgICBmY2xvc2UoZmJfaW4pOworICAgICAgICByZXR1cm47CisgICAgfQorCisgICAgb2Zmc2V0ID0gdmluZm8ueG9mZnNldCAqIGJ5dGVzcHAgKyB2aW5mby54cmVzICogdmluZm8ueW9mZnNldCAqIGJ5dGVzcHA7CisgICAgZnNlZWsoZmJfaW4sIG9mZnNldCwgU0VFS19TRVQpOworCisgICAgZm9yKHI9MDsgcjx2aW5mby55cmVzOyByKyspIHsKKyAgICAgICAgaW50IGxlbiA9IGZyZWFkKGltZ2J1ZiwgMSwgcm93bGVuLCBmYl9pbik7CisgICAgICAgIGlmIChsZW4gPD0gMCkgYnJlYWs7CisgICAgICAgIHBuZ193cml0ZV9yb3cocG5nLCAocG5nX2J5dGVwKWltZ2J1Zik7CisgICAgfQorCisgICAgcG5nX3dyaXRlX2VuZChwbmcsIGluZm8pOworICAgIGZjbG9zZShmYl9pbik7CisgICAgcG5nX2Rlc3Ryb3lfd3JpdGVfc3RydWN0KCZwbmcsIE5VTEwpOworfQorCitpbnQgbWFpbihpbnQgYXJnYywgY2hhcioqYXJndikgeworICAgIEZJTEUgKnBuZyA9IE5VTEw7CisgICAgRklMRSAqZm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FzLnJlbW92ZShOT19CUk9BRENBU1RfRkxBRyk7CisgICAgICAgIH0KICAgICAgICAgZGIuYmVnaW5UcmFuc2FjdGlvbigpOwogICAgICAgICB0cnkgewotICAgICAgICAgICAgaWYgKGFjY291bnQgPT0gbnVsbCkgewotICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGJvb2xlYW4gbm9Ccm9hZGNhc3QgPSBmYWxzZTsKLSAgICAgICAgICAgIGlmIChhY2NvdW50LnR5cGUuZXF1YWxzKEdPT0dMRV9BQ0NPVU5UX1RZUEUpKSB7Ci0gICAgICAgICAgICAgICAgLy8gTG9vayBmb3IgdGhlICdub2Jyb2FkY2FzdCcgZmxhZyBhbmQgcmVtb3ZlIGl0IHNpbmNlIHdlIGRvbid0IHdhbnQgaXQgdG8gcGVyc2lzdAotICAgICAgICAgICAgICAgIC8vIGluIHRoZSBkYi4KLSAgICAgICAgICAgICAgICBub0Jyb2FkY2FzdCA9IGV4dHJhcy5nZXRCb29sZWFuKE5PX0JST0FEQ0FTVF9GTEFHLCBmYWxzZSk7Ci0gICAgICAgICAgICAgICAgZXh0cmFzLnJlbW92ZShOT19CUk9BRENBU1RfRkxBRyk7Ci0gICAgICAgICAgICB9Ci0KICAgICAgICAgICAgIGxvbmcgbnVtTWF0Y2hlcyA9IERhdGFiYXNlVXRpbHMubG9uZ0ZvclF1ZXJ5KGRiLAogICAgICAgICAgICAgICAgICAgICAic2VsZWN0IGNvdW50KCopIGZyb20gIiArIFRBQkxFX0FDQ09VTlRTCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyAiIFdIRVJFICIgKyBBQ0NPVU5UU19OQU1FICsgIj0/IEFORCAiICsgQUNDT1VOVFNfVFlQRSsgIj0/IiwKQEAgLTQzNiwxMyArNDM2LDEzIEBACiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogICAgICAgICAgICAgZGIuc2V0VHJhbnNhY3Rpb25TdWNjZXNzZnVsKCk7Ci0gICAgICAgICAgICBpZiAoIW5vQnJvYWRjYXN0KSB7Ci0gICAgICAgICAgICAgICAgc2VuZEFjY291bnRzQ2hhbmdlZEJyb2FkY2FzdCgpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICBkYi5lbmRUcmFuc2FjdGlvbigpOwogICAgICAgICB9CisgICAgICAgIGlmICghbm9Ccm9hZGNhc3QpIHsKKyAgICAgICAgICAgIHNlbmRBY2NvdW50c0NoYW5nZWRCcm9hZGNhc3QoKTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICB9CiAKICAgICBwcml2YXRlIGxvbmcgaW5zZXJ0RXh0cmEoU1FMaXRlRGF0YWJhc2UgZGIsIGxvbmcgYWNjb3VudElkLCBTdHJpbmcga2V5LCBTdHJpbmcgdmFsdWUpIHsKQEAgLTE2NTcsNyArMTY1Nyw3IEBACiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIGJvb2xlYW4gbmVlZHNQcm92aXNpb25pbmc7CiAgICAgICAgICAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgICAgICAgICAgbmVlZHNQcm92aXNpb25pbmcgPSB0ZWxlcGhvbnkuZ2V0Q2RtYU5lZWRzUHJvdmlzaW9uaW5nKCk7CisgICAgICAgICAgICAgICAgICAgIG5lZWRzUHJvdmlzaW9uaW5nID0gdGVsZXBob255Lm5lZWRzT3RhU2VydmljZVByb3Zpc2lvbmluZygpOwogICAgICAgICAgICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBlKSB7CiAgICAgICAgICAgICAgICAgICAgIExvZy53KFRBRywgImV4Y2VwdGlvbiB3aGlsZSBjaGVja2luZyBwcm92aXNpb25pbmciLCBlKTsKICAgICAgICAgICAgICAgICAgICAgLy8gZGVmYXVsdCB0byBOT1Qgd2lwaW5nIG91dCB0aGUgcGFzc3dvcmRzCkBAIC0xNjgxLDExICsxNjgxLDExIEBACiAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgZGIuZXhlY1NRTCgiREVMRVRFIGZyb20gIiArIFRBQkxFX0FVVEhUT0tFTlMpOwogICAgICAgICAgICAgICAgICAgICBkYi5leGVjU1FMKCJVUERBVEUgIiArIFRBQkxFX0FDQ09VTlRTICsgIiBTRVQgIiArIEFDQ09VTlRTX1BBU1NXT1JEICsgIiA9ICcnIik7Ci0gICAgICAgICAgICAgICAgICAgIHNlbmRBY2NvdW50c0NoYW5nZWRCcm9hZGNhc3QoKTsKICAgICAgICAgICAgICAgICAgICAgZGIuc2V0VHJhbnNhY3Rpb25TdWNjZXNzZnVsKCk7CiAgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgICAgICAgZGIuZW5kVHJhbnNhY3Rpb24oKTsKICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgc2VuZEFjY291bnRzQ2hhbmdlZEJyb2FkY2FzdCgpOwogICAgICAgICAgICAgfQogICAgICAgICAgICAgc2V0TWV0YVZhbHVlKCJpbXNpIiwgaW1zaSk7CiAgICAgICAgIH0KZGlmZiAtLWdpdCBhL2NvcmUvamF2YS9hbmRyb2lkL2FuaW1hdGlvbi9BbmltYXRhYmxlLmphdmEgYi9jb3JlL2phdmEvYW5kcm9pZC9hbmltYXRpb24vQW5pbWF0YWJsZS5qYXZhCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLjY4NDE1ZjAKLS0tIC9kZXYvbnVsbAorKysgYi9jb3JlL2phdmEvYW5kcm9pZC9hbmltYXRpb24vQW5pbWF0YWJsZS5qYXZhCkBAIC0wLDAgKzEsMTQ2IEBACisvKgorICogQ29weXJpZ2h0IChDKSAyMDEwIFRoZSBBbmRyb2lkIE9wZW4gU291cmNlIFByb2plY3QKKyAqCisgKiBMaWNlbnNlZCB1b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EFuaW1hdGFibGVMaXN0ZW5lciBsaXN0ZW5lcikgeworICAgICAgICBpZiAobUxpc3RlbmVycyA9PSBudWxsKSB7CisgICAgICAgICAgICBtTGlzdGVuZXJzID0gbmV3IEFycmF5TGlzdDxBbmltYXRhYmxlTGlzdGVuZXI+KCk7CisgICAgICAgIH0KKyAgICAgICAgbUxpc3RlbmVycy5hZGQobGlzdGVuZXIpOworICAgIH0KKworICAgIC8qKgorICAgICAqIFJlbW92ZXMgYSBsaXN0ZW5lciBmcm9tIHRoZSBzZXQgbGlzdGVuaW5nIHRvIHRoaXMgYW5pbWF0aW9uLgorICAgICAqCisgICAgICogQHBhcmFtIGxpc3RlbmVyIHRoZSBsaXN0ZW5lciB0byBiZSByZW1vdmVkIGZyb20gdGhlIGN1cnJlbnQgc2V0IG9mIGxpc3RlbmVycyBmb3IgdGhpcworICAgICAqICAgICAgICAgICAgICAgICBhbmltYXRpb24uCisgICAgICovCisgICAgcHVibGljIHZvaWQgcmVtb3ZlTGlzdGVuZXIoQW5pbWF0YWJsZUxpc3RlbmVyIGxpc3RlbmVyKSB7CisgICAgICAgIGlmIChtTGlzdGVuZXJzID09IG51bGwpIHsKKyAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfQorICAgICAgICBtTGlzdGVuZXJzLnJlbW92ZShsaXN0ZW5lcik7CisgICAgICAgIGlmIChtTGlzdGVuZXJzLnNpemUoKSA9PSAwKSB7CisgICAgICAgICAgICBtTGlzdGVuZXJzID0gbnVsbDsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIEdldHMgdGhlIHNldCBvZiB7QGxpbmsgQW5pbWF0YWJsZUxpc3RlbmVyfSBvYmplY3RzIHRoYXQgYXJlIGN1cnJlbnRseQorICAgICAqIGxpc3RlbmluZyBmb3IgZXZlbnRzIG9uIHRoaXMgPGNvZGU+QW5pbWF0YWJsZTwvY29kZT4gb2JqZWN0LgorICAgICAqCisgICAgICogQHJldHVybiBBcnJheUxpc3Q8QW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gc3RhcnQgb2YgdGhlIGFuaW1hdGlvbi48L3A+CisgICAgICAgICAqCisgICAgICAgICAqIEBwYXJhbSBhbmltYXRpb24gVGhlIHN0YXJ0ZWQgYW5pbWF0aW9uLgorICAgICAgICAgKi8KKyAgICAgICAgdm9pZCBvbkFuaW1hdGlvblN0YXJ0KEFuaW1hdGFibGUgYW5pbWF0aW9uKTsKKworICAgICAgICAvKioKKyAgICAgICAgICogPHA+Tm90aWZpZXMgdGhlIGVuZCBvZiB0aGUgYW5pbWF0aW9uLiBUaGlzIGNhbGxiYWNrIGlzIG5vdCBpbnZva2VkCisgICAgICAgICAqIGZvciBhbmltYXRpb25zIHdpdGggcmVwZWF0IGNvdW50IHNldCB0byBJTkZJTklURS48L3A+CisgICAgICAgICAqCisgICAgICAgICAqIEBwYXJhbSBhbmltYXRpb24gVGhlIGFuaW1hdGlvbiB3aGljaCByZWFjaGVkIGl0cyBlbmQuCisgICAgICAgICAqLworICAgICAgICB2b2lkIG9uQW5pbWF0aW9uRW5kKEFuaW1hdGFibGUgYW5pbWF0aW9uKTsKKworICAgICAgICAvKioKKyAgICAgICAgICogPHA+Tm90aWZpZXMgdGhlIGNhbmNlbGxhdGlvbiBvZiB0aGUgYW5pbWF0aW9uLiBUaGlzIGNhbGxiYWNrIGlzIG5vdCBpbnZva2VkCisgICAgICAgICAqIGZvciBhbmltYXRpb25zIHdpdGggcmVwZWF0IGNvdW50IHNldCB0byBJTkZJTklURS48L3A+CisgICAgICAgICAqCisgICAgICAgICAqIEBwYXJhbSBhbmltYXRpb24gVGhlIGFuaW1hdGlvbiB3aGljaCB3YXMgY2FuY2VsZWQuCisgICAgICAgICAqLworICAgICAgICB2b2lkIG9uQW5pbWF0aW9uQ2FuY2VsKEFuaW1hdGFibGUgYW5pbWF0aW9uKTsKKworICAgICAgICAvKioKKyAgICAgICAgICogPHA+Tm90aWZpZXMgdGhlIHJlcGV0aXRpb24gb2YgdGhlIGFuaW1hdGlvbi48L3A+CisgICAgICAgICA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aW5nIHRoZSBhbmltYXRpb24gcGFyYW1ldGVycworICAgICAqLworICAgIHB1YmxpYyBBbmltYXRvcihDb250ZXh0IGNvbnRleHQsIEF0dHJpYnV0ZVNldCBhdHRycykgeworICAgICAgICBUeXBlZEFycmF5IGEgPQorICAgICAgICAgICAgICAgIGNvbnRleHQub2J0YWluU3R5bGVkQXR0cmlidXRlcyhhdHRycywgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHlsZWFibGUuQW5pbWF0b3IpOworCisgICAgICAgIG1EdXJhdGlvbiA9IChsb25nKSBhLmdldEludChjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0eWxlYWJsZS5BbmltYXRvcl9kdXJhdGlvbiwgMCk7CisKKyAgICAgICAgbVN0YXJ0RGVsYXkgPSAobG9uZykgYS5nZXRJbnQoY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHlsZWFibGUuQW5pbWF0b3Jfc3RhcnRPZmZzZXQsIDApOworCisgICAgICAgIGZpbmFsIGludCByZXNJRCA9CisgICAgICAgICAgICAgICAgYS5nZXRSZXNvdXJjZUlkKGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3R5bGVhYmxlLkFuaW1hdG9yX2ludGVycG9sYXRvciwgMCk7CisgICAgICAgIGlmIChyZXNJRCA+IDApIHsKKyAgICAgICAgICAgIHNldEludGVycG9sYXRvcihBbmltYXRpb25VdGlscy5sb2FkSW50ZXJwb2xhdG9yKGNvbnRleHQsIHJlc0lEKSk7CisgICAgICAgIH0KKyAgICAgICAgaW50IHZhbHVlVHlwZSA9IGEuZ2V0SW50KGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3R5bGVhYmxlLkFuaW1hdG9yX3ZhbHVlVHlwZSwKKyAgICAgICAgICAgICAgICBWQUxVRV9UWVBFX0ZMT0FUKTsKKworICAgICAgICBPYmplY3QgdmFsdWVGcm9tID0gbnVsbDsKKyAgICAgICAgT2JqZWN0IHZhbHVlVG8gPSBudWxsOworCisgICAgICAgIHN3aXRjaCAodmFsdWVUeXBlKSB7CisgICAgICAgICAgICBjYXNlIFZBTFVFX1RZUEVfRkxPQVQ6CisgICAgICAgICAgICAgICAgdmFsdWVGcm9tID0gYS5nZXRGbG9hdChjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0eWxlYWJsZS5BbmltYXRvcl92YWx1ZUZyb20sIDBmKTsKKyAgICAgICAgICAgICAgICB2YWx1ZVRvID0gYS5nZXRGbG9hdChjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0eWxlYWJsZS5BbmltYXRvcl92YWx1ZVRvLCAwZik7CisgICAgICAgICAgICAgICAgbVZhbHVlVHlwZSA9IGZsb2F0LmNsYXNzOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBWQUxVRV9UWVBFX0lOVDoKKyAgICAgICAgICAgICAgICB2YWx1ZUZyb20gPSBhLmdldEludChjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0eWxlYWJsZS5BbmltYXRvcl92YWx1ZUZyb20sIDApOworICAgICAgICAgICAgICAgIHZhbHVlVG8gPSBhLmdldEludChjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0eWxlYWJsZS5BbmltYXRvcl92YWx1ZVRvLCAwKTsKKyAgICAgICAgICAgICAgICBtVmFsdWVUeXBlID0gaW50LmNsYXNzOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBWQUxVRV9UWVBFX0RPVUJMRToKKyAgICAgICAgICAgICAgICB2YWx1ZUZyb20gPSAoZG91YmxlKQorICAgICAgICAgICAgICAgICAgICAgICAgYS5nZXRGbG9hdChjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0eWxlYWJsZS5BbmltYXRvcl92YWx1ZUZyb20sIDBmKTsKKyAgICAgICAgICAgICAgICB2YWx1ZVRvID0gKGRvdWJsZSkKKyAgICAgICAgICAgICAgICAgICAgICAgIGEuZ2V0RmxvYXQoY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHlsZWFibGUuQW5pbWF0b3JfdmFsdWVUbywgMGYpOworICAgICAgICAgICAgICAgIG1WYWx1ZVR5cGUgPSBkb3VibGUuY2xhc3M7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIFZBTFVFX1RZUEVfQ09MT1I6CisgICAgICAgICAgICAgICAgdmFsdWVGcm9tID0gYS5nZXRJbnQoY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHlsZWFibGUuQW5pbWF0b3JfdmFsdWVGcm9tLCAwKTsKKyAgICAgICAgICAgICAgICB2YWx1ZVRvID0gYS5nZXRJbnQoY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHlsZWFibGUuQW5pbWF0b3JfdmFsdWVUbywgMCk7CisgICAgICAgICAgICAgICAgc2V0RXZhbHVhdG9yKG5ldyBSR0JFdmFsdWF0b3IoKSk7CisgICAgICAgICAgICAgICAgbVZhbHVlVHlwZSA9IGludC5jbGFzczsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgVkFMVUVfVFlQRV9DVVNUT006CisgICAgICAgICAgICAgICAgLy8gVE9ETzogSG93IHRvIGdldCBhbiAnT2JqZWN0JyB2YWx1ZT8KKyAgICAgICAgICAgICAgICB2YWx1ZUZyb20gPSBhLmdldEZsb2F0KGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3R5bGVhYmxlLkFuaW1hdG9yX3ZhbHVlRnJvbSwgMGYpOworICAgICAgICAgICAgICAgIHZhbHVlVG8gPSBhLmdldEZsb2F0KGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3R5bGVhYmxlLkFuaW1hdG9yX3ZhbHVlVG8sIDBmKTsKKyAgICAgICAgICAgICAgICBtVmFsdWVUeXBlID0gT2JqZWN0LmNsYXNzOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisKKyAgICAgICAgbVZhbHVlcyA9IG5ldyBIYXNoTWFwPFN0cmluZywgUHJvcG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AgICAgKgorICAgICAqIEBwYXJhbSBwbGF5VGltZSBUaGUgdGltZSwgaW4gbWlsbGlzZWNvbmRzLCB0byB3aGljaCB0aGUgYW5pbWF0aW9uIGlzIGFkdmFuY2VkIG9yIHJld291bmQuCisgICAgICovCisgICAgcHVibGljIHZvaWQgc2V0Q3VycmVudFBsYXlUaW1lKGxvbmcgcGxheVRpbWUpIHsKKyAgICAgICAgaWYgKCFtSW5pdGlhbGl6ZWQpIHsKKyAgICAgICAgICAgIGluaXRBbmltYXRpb24oKTsKKyAgICAgICAgfQorICAgICAgICBsb25nIGN1cnJlbnRUaW1lID0gQW5pbWF0aW9uVXRpbHMuY3VycmVudEFuaW1hdGlvblRpbWVNaWxsaXMoKTsKKyAgICAgICAgaWYgKG1QbGF5aW5nU3RhdGUgIT0gUlVOTklORykgeworICAgICAgICAgICAgbVNlZWtUaW1lID0gcGxheVRpbWU7CisgICAgICAgICAgICBtUGxheWluZ1N0YXRlID0gU0VFS0VEOworICAgICAgICB9CisgICAgICAgIG1TdGFydFRpbWUgPSBjdXJyZW50VGltZSAtIHBsYXlUaW1lOworICAgICAgICBhbmltYXRpb25GcmFtZShjdXJyZW50VGltZSk7CisgICAgfQorCisgICAgLyoqCisgICAgICogR2V0cyB0aGUgY3VycmVudCBwb3NpdGlvbiBvZiB0aGUgYW5pbWF0aW9uIGluIHRpbWUsIHdoaWNoIGlzIGVxdWFsIHRvIHRoZSBjdXJyZW50CisgICAgICogdGltZSBtaW51cyB0aGUgdGltZSB0aGF0IHRoZSBhbmltYXRpb24gc3RhcnRlZC4gQW4gYW5pbWF0aW9uIHRoYXQgaXMgbm90IHlldCBzdGFydGVkIHdpbGwKKyAgICAgKiByZXR1cm4gYSB2YWx1ZSBvZiB6ZXJvLgorICAgICAqCisgICAgICogQHJldHVybiBUaGUgY3VycmVudCBwb3NpdGlvbiBpbiB0aW1lIG9mIHRoZSBhbmltYXRpb24uCisgICAgICovCisgICAgcHVibGljIGxvbmcgZ2V0Q3VycmV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cmUgYWxyZWFkeSBydW5uaW5nPworICAgICAgICAgICAgICAgIGNhc2UgQU5JTUFUSU9OX1NUQVJUOgorICAgICAgICAgICAgICAgICAgICBpZiAoc0FuaW1hdGlvbnMuc2l6ZSgpID4gMCB8fCBzRGVsYXllZEFuaW1zLnNpemUoKSA+IDApIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNhbGxBZ2FpbiA9IGZhbHNlOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIC8vIHBlbmRpbmdBbmltcyBob2xkcyBhbnkgYW5pbWF0aW9ucyB0aGF0IGhhdmUgcmVxdWVzdGVkIHRvIGJlIHN0YXJ0ZWQKKyAgICAgICAgICAgICAgICAgICAgLy8gV2UncmUgZ29pbmcgdG8gY2xlYXIgc1BlbmRpbmdBbmltYXRpb25zLCBidXQgc3RhcnRpbmcgYW5pbWF0aW9uIG1heQorICAgICAgICAgICAgICAgICAgICAvLyBjYXVzZSBtb3JlIHRvIGJlIGFkZGVkIHRvIHRoZSBwZW5kaW5nIGxpc3QgKGZvciBleGFtcGxlLCBpZiBvbmUgYW5pbWF0aW9uCisgICAgICAgICAgICAgICAgICAgIC8vIHN0YXJ0aW5nIHRyaWdnZXJzIGFub3RoZXIgc3RhcnRpbmcpLiBTbyB3ZSBsb29wIHVudGlsIHNQZW5kaW5nQW5pbWF0aW9ucworICAgICAgICAgICAgICAgICAgICAvLyBpcyBlbXB0eS4KKyAgICAgICAgICAgICAgICAgICAgd2hpbGUgKHNQZW5kaW5nQW5pbWF0aW9ucy5zaXplKCkgPiAwKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBBcnJheUxpc3Q8QW5pbWF0b3I+IHBlbmRpbmdDb3B5ID0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKEFycmF5TGlzdDxBbmltYXRvcj4pIHNQZW5kaW5nQW5pbWF0aW9ucy5jbG9uZSgpOworICAgICAgICAgICAgICAgICAgICAgICAgc1BlbmRpbmdBbmltYXRpb25zLmNsZWFyKCk7CisgICAgICAgICAgICAgICAgICAgICAgICBpbnQgY291bnQgPSBwZW5kaW5nQ29weS5zaXplKCk7CisgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGNvdW50OyArK2kpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBBbmltYXRvciBhbmltID0gcGVuZGluZ0NvcHkuZ2V0KGkpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIElmIHRoZSBhbmltYXRpb24gaGFzIGEgc3RhcnREZWxheSwgcGxhY2UgaXQgb24gdGhlIGRlbGF5ZWQgbGlzdAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhbmltLm1TdGFydERlbGF5ID09IDApIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYW5pbS5zdGFydEFuaW1hdGlvbigpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNEZWxheWVkQW5pbXMuYWRkKGFuaW0pOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAvLyBmYWxsIHRocm91Z2ggdG8gcHJvY2VzcyBmaXJzdCBmcmFtZSBvZiBuZXcgYW5pbWF0aW9ucworICAgICAgICAgICAgICAgIGNhc2UgQU5JTUFUSU9OX0ZSQU1FOgorICAgICAgICAgICAgICAgICAgICAvLyBjdXJyZW50VGltZSBob2xkcyB0aGUgY29tbW9uIHRpbWUgZm9yIGFsbCBhbmltYXRpb25zIHByb2Nlc3NlZAorICAgICAgICAgICAgICAgICAgICAvLyBkdXJpbmcgdGhpcyBmcmFtZQorICAgICAgICAgICAgICAgICAgICBsb25nIGN1cnJlbnRUaW1lID0gQW5pbWF0aW9uVXRpbHMuY3VycmVudEFuaW1hdGlvblRpbWVNaWxsaXMoKTsKKworICAgICAgICAgICAgICAgICAgICAvLyBGaXJzdCwgcHJvY2VzcyBhbmltYXRpb25zIGN1cnJlbnRseSBzaXR0aW5nIG9uIHRoZSBkZWxheWVkIHF1ZXVlLCBhZGRpbmcKKyAgICAgICAgICAgICAgICAgICAgLy8gdGhlbSB0byB0aGUgYWN0aXZlIGFuaW1hdGlvbnMgaWYgdGhleSBhcmUgcmVhZHkKKyAgICAgICAgICAgICAgICAgICAgaW50IG51bURlbGF5ZWRBbmltcyA9IHNEZWxheWVkQW5pbXMuc2l6ZSgpOworICAgICAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IG51bURlbGF5ZWRBbmltczsgKytpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBBbmltYXRvciBhbmltID0gc0RlbGF5ZWRBbmltcy5nZXQoaSk7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYW5pbS5kZWxheWVkQW5pbWF0aW9uRnJhbWUoY3VycmVudFRpbWUpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgc1JlYWR5QW5pbXMuYWRkKGFuaW0pOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGludCBudW1SZWFkeUFuaW1zID0gc1JlYWR5QW5pbXMuc2l6ZSgpOworICAgICAgICAgICAgICAgICAgICBpZiAobnVtUmVhZHlBbmltcyA+IDApIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbnVtUmVhZHlBbmltczsgKytpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgQW5pbWF0b3IgYW5pbSA9IHNSZWFkeUFuaW1zLmdldChpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBhbmltLnN0YXJ0QW5pbWF0aW9uKCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgc0RlbGF5ZWRBbmltcy5yZW1vdmUoYW5pbSk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBzUmVhZHlBbmltcy5jbGVhcigpOworICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgICAgLy8gTm93IHByb2Nlc3MgYWxsIGFjdGl2ZSBhbmltYXRpb25zLiBUaGUgcmV0dXJuIHZhbHVlIGZyb20gYW5pbWF0aW9uRnJhbWUoKQorICAgICAgICAgICAgICAgICAgICAvLyB0ZWxscyB0aGUgaGFuZGxlciB3aGV0aGVyIGl0IHNob3VsZCBub3cgYmUgZW5kZWQKKyAgICAgICAgICAgICAgICAgICAgaW50IG51bUFuaW1zID0gc0FuaW1hdGlvbnMuc2l6ZSgpOworICAgICAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IG51bUFuaW1zOyArK2kpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIEFuaW1hdG9yIGFuaW0gPSBzQW5pbWF0aW9ucy5nZXQoaSk7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYW5pbS5hbmltYXRpb25GcmFtZShjdXJyZW50VGltZSkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBzRW5kaW5nQW5pbXMuYWRkKGFuaW0pOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGlmIChzRW5kaW5nQW5pbXMuc2l6ZSgpID4gMCkgeworICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBzRW5kaW5nQW5pbXMuc2l6ZSgpOyArK2kpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBzRW5kaW5nQW5pbXMuZ2V0KGkpLmVuZEFuaW1hdGlvbigpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgc0VuZGluZ0FuaW1zLmNsZWFyKCk7CisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICAvLyBJZiB0aGVyZSBhcmUgc3RpbGwgYWN0aXZlIG9yIGRlbGF5ZWQgYW5pbWF0aW9ucywgY2FsbCB0aGUgaGFuZGxlciBhZ2FpbgorICAgICAgICAgICAgICAgICAgICAvLyBhZnRlciB0aGUgZnJhbWVEZWxheQorICAgICAgICAgICAgICAgICAgICBpZiAoY2FsbEFnYWluICYmICghc0FuaW1hdGlvbnMuaXNFbXB0eSgpIHx8ICFzRGVsYXllZEFuaW1zLmlzRW1wdHkoKSkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHNlbmRFbXB0eU1lc3NhZ2VEZWxheWVkKEFOSU1BVElPTl9GUkFNRSwgc0ZyYW1lRGVsYXkpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogVGhlIGFtb3VudCBvZiB0aW1lLCBpbiBtaWxsaXNlY29uZHMsIHRvIGRlbGF5IHN0YXJ0aW5nIHRoZSBhbmltYXRpb24gYWZ0ZXIKKyAgICAgKiB7QGxpbmsgI3N0YXJ0KCl9IGlzIGNhbGxlZC4KKyAgICAgKgorICAgICAqIEByZXR1cm4gdGhlIG51bWJlciBvZiBtaWxsaXNlY29uZHMgdG8gZGVsYXkgcnVubmluZyB0aGUgYW5pbWF0aW9uCisgICAgICovCisgICAgcHVibGljIGxvbmcgZ2V0U3RhcnREZWxheSgpIHsKKyAgICAgICAgcmV0dXJuIG1TdGFydERlbGF5OworICAgIH0KKworICAgIC8qKgorICAgICAqIFRoZSBhbW91bnQgb2YgdGltZSwgaW4gbWlsbGlzZWNvbmRzLCB0byBkZWxheSBzdGFydGluZyB0aGUgYW5pbWF0aW9uIGFmdGVyCisgICAgICoge0BsaW5rICNzdGFydCgpfSBpcyBjYWxsZWQuCisKKyAgICAgKiBAcGFyYW0gc3RhcnREZWxheSB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BUaGUgcmVwZWF0IGNvdW50IGlzIDAgYnkgZGVmYXVsdC4KKyAgICAgKgorICAgICAqIEBwYXJhbSB2YWx1ZSB0aGUgbnVtYmVyIG9mIHRpbWVzIHRoZSBhbmltYXRpb24gc2hvdWxkIGJlIHJlcGVhdGVkCisgICAgICovCisgICAgcHVibGljIHZvaWQgc2V0UmVwZWF0Q291bnQoaW50IHZhbHVlKSB7CisgICAgICAgIG1SZXBlYXRDb3VudCA9IHZhbHVlOworICAgIH0KKyAgICAvKioKKyAgICAgKiBEZWZpbmVzIGhvdyBtYW55IHRpbWVzIHRoZSBhbmltYXRpb24gc2hvdWxkIHJlcGVhdC4gVGhlIGRlZmF1bHQgdmFsdWUKKyAgICAgKiBpcyAwLgorICAgICAqCisgICAgICogQHJldHVybiB0aGUgbnVtYmVyIG9mIHRpbWVzIHRoZSBhbmltYXRpb24gc2hvdWxkIHJlcGVhdCwgb3Ige0BsaW5rICNJTkZJTklURX0KKyAgICAgKi8KKyAgICBwdWJsaWMgaW50IGdldFJlcGVhdENvdW50KCkgeworICAgICAgICByZXR1cm4gbVJlcGVhdENvdW50OworICAgIH0KKworICAgIC8qKgorICAgICAqIERlZmluZXMgd2hhdCB0aGlzIGFuaW1hdGlvbiBzaG91bGQgZG8gd2hlbiBpdCByZWFjaGVzIHRoZSBlbmQuIFRoaXMKKyAgICAgKiBzZXR0aW5nIGlzIGFwcGxpZWQgb25seSB3aGVuIHRoZSByZXBlYXQgY291bnQgaXMgZWl0aGVyIGdyZWF0ZXIgdGhhbgorICAgICAqIDAgb3Ige0BsaW5rICNJTkZJTklURX0uIERlZmF1bHRzIHRvIHtAbGluayAjUkVTVEFSVH0uCisgICAgICoKKyAgICAgKiBAcGFyYW0gdmFsdWUge0BsaW5rICNSRVNUQVJUfSBvciB7QGxpbmsgI1JFVkVSU0V9CisgICAgICovCisgICAgcHVibGljIHZvaWQgc2V0UmVwZWF0TW9kZShpbnQgdmFsdWUpIHsKKyAgICAgICAgbVJlcGVhd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yZW50UGxheVRpbWUgPSBjdXJyZW50VGltZSAtIG1TdGFydFRpbWU7CisgICAgICAgICAgICBsb25nIHRpbWVMZWZ0ID0gbUR1cmF0aW9uIC0gY3VycmVudFBsYXlUaW1lOworICAgICAgICAgICAgbVN0YXJ0VGltZSA9IGN1cnJlbnRUaW1lIC0gdGltZUxlZnQ7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBzdGFydCh0cnVlKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIENhbGxlZCBpbnRlcm5hbGx5IHRvIGVuZCBhbiBhbmltYXRpb24gYnkgcmVtb3ZpbmcgaXQgZnJvbSB0aGUgYW5pbWF0aW9ucyBsaXN0LiBNdXN0IGJlCisgICAgICogY2FsbGVkIG9uIHRoZSBVSSB0aHJlYWQuCisgICAgICovCisgICAgcHJpdmF0ZSB2b2lkIGVuZEFuaW1hdGlvbigpIHsKKyAgICAgICAgc0FuaW1hdGlvbnMucmVtb3ZlKHRoaXMpOworICAgICAgICBpZiAobUxpc3RlbmVycyAhPSBudWxsKSB7CisgICAgICAgICAgICBBcnJheUxpc3Q8QW5pbWF0YWJsZUxpc3RlbmVyPiB0bXBMaXN0ZW5lcnMgPQorICAgICAgICAgICAgICAgICAgICAoQXJyYXlMaXN0PEFuaW1hdGFibGVMaXN0ZW5lcj4pIG1MaXN0ZW5lcnMuY2xvbmUoKTsKKyAgICAgICAgICAgIGZvciAoQW5pbWF0YWJsZUxpc3RlbmVyIGxpc3RlbmVyIDogdG1wTGlzdGVuZXJzKSB7CisgICAgICAgICAgICAgICAgbGlzdGVuZXIub25BbmltYXRpb25FbmQodGhpcyk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgbVBsYXlpbmdTdGF0ZSA9IFNUT1BQRUQ7CisgICAgfQorCisgICAgLyoqCisgICAgICogQ2FsbGVkIGludGVybmFsbHkgdG8gc3RhcnQgYW4gYW5pbWF0aW9uIGJ5IGFkZGluZyBpdCB0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YW1lKGxvbmcgY3VycmVudFRpbWUpIHsKKyAgICAgICAgYm9vbGVhbiBkb25lID0gZmFsc2U7CisKKyAgICAgICAgaWYgKG1QbGF5aW5nU3RhdGUgPT0gU1RPUFBFRCkgeworICAgICAgICAgICAgbVBsYXlpbmdTdGF0ZSA9IFJVTk5JTkc7CisgICAgICAgICAgICBpZiAobVNlZWtUaW1lIDwgMCkgeworICAgICAgICAgICAgICAgIG1TdGFydFRpbWUgPSBjdXJyZW50VGltZTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgbVN0YXJ0VGltZSA9IGN1cnJlbnRUaW1lIC0gbVNlZWtUaW1lOworICAgICAgICAgICAgICAgIC8vIE5vdyB0aGF0IHdlJ3JlIHBsYXlpbmcsIHJlc2V0IHRoZSBzZWVrIHRpbWUKKyAgICAgICAgICAgICAgICBtU2Vla1RpbWUgPSAtMTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICBzd2l0Y2ggKG1QbGF5aW5nU3RhdGUpIHsKKyAgICAgICAgY2FzZSBSVU5OSU5HOgorICAgICAgICBjYXNlIFNFRUtFRDoKKyAgICAgICAgICAgIGZsb2F0IGZyYWN0aW9uID0gKGZsb2F0KShjdXJyZW50VGltZSAtIG1TdGFydFRpbWUpIC8gbUR1cmF0aW9uOworICAgICAgICAgICAgaWYgKGZyYWN0aW9uID49IDFmKSB7CisgICAgICAgICAgICAgICAgaWYgKG1DdXJyZW50SXRlcmF0aW9uIDwgbVJlcGVhdENvdW50IHx8IG1SZXBlYXRDb3VudCA9PSBJTkZJTklURSkgeworICAgICAgICAgICAgICAgICAgICAvLyBUaW1lIHRvIHJlcGVhdAorICAgICAgICAgICAgICAgICAgICBpZiAobUxpc3RlbmVycyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKEFuaW1hdGFibGVMaXN0ZW5lciBsaXN0ZW5lciA6IG1MaXN0ZW5lcnMpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaXN0ZW5lci5vbkFuaW1hdGlvblJlcGVhdCh0aGlzKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICArK21DdXJyZW50SXRlcmF0aW9uOworICAgICAgICAgICAgICAgICAgICBpZiAobVJlcGVhdE1vZGUgPT0gUkVWRVJTRSkgeworICAgICAgICAgICAgICAgICAgICAgICAgbVBsYXlpbmdCYWNrd2FyZHMgPSBtUGxheWluZ0JhY2t3YXJkcyA/IGZhbHNlIDogdHJ1ZTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAvLyBUT0RPOiBkb2Vzbid0IGFjY291bnQgZm9yIGZyYWN0aW9uIGdvaW5nIFdheXl5eXkgb3ZlciAxLCBsaWtlIDIrCisgICAgICAgICAgICAgICAgICAgIGZyYWN0aW9uID0gZnJhY3Rpb24gLSAxZjsKKyAgICAgICAgICAgICAgICAgICAgbVN0YXJ0VGltZSArPSBtRHVyYXRpb247CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgZG9uZSA9IHRydWU7CisgICAgICAgICAgICAgICAgICAgIGZyYWN0aW9uID0gTWF0aC5taW4oZnJhY3Rpb24sIDEuMGYpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmIChtUGxheWluZ0JhY2t3YXJkcykgeworICAgICAgICAgICAgICAgIGZyYWN0aW9uID0gMWYgLSBmcmFjdGlvbjsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGFuaW1hdGVWYWx1ZShmcmFjdGlvbik7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBFTkRFRDoKKyAgICAgICAgICAgIC8vIFRoZSBmaW5hbCB2YWx1ZSBzZXQgb24gdGhlIHRhcmdldCB2YXJpZXMsIGRlcGVuZGluZyBvbiB3aGV0aGVy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jdGlvbiA8PSAwZikgeworICAgICAgICAgICAgZmluYWwgS2V5ZnJhbWUgcHJldktleWZyYW1lID0gbUtleWZyYW1lcy5nZXQoMCk7CisgICAgICAgICAgICBmaW5hbCBLZXlmcmFtZSBuZXh0S2V5ZnJhbWUgPSBtS2V5ZnJhbWVzLmdldCgxKTsKKyAgICAgICAgICAgIGZpbmFsIEludGVycG9sYXRvciBpbnRlcnBvbGF0b3IgPSBuZXh0S2V5ZnJhbWUuZ2V0SW50ZXJwb2xhdG9yKCk7CisgICAgICAgICAgICBpZiAoaW50ZXJwb2xhdG9yICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBmcmFjdGlvbiA9IGludGVycG9sYXRvci5nZXRJbnRlcnBvbGF0aW9uKGZyYWN0aW9uKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGZsb2F0IGludGVydmFsRnJhY3Rpb24gPSAoZnJhY3Rpb24gLSBwcmV2S2V5ZnJhbWUuZ2V0RnJhY3Rpb24oKSkgLworICAgICAgICAgICAgICAgIChuZXh0S2V5ZnJhbWUuZ2V0RnJhY3Rpb24oKSAtIHByZXZLZXlmcmFtZS5nZXRGcmFjdGlvbigpKTsKKyAgICAgICAgICAgIHJldHVybiBldmFsdWF0b3IuZXZhbHVhdGUoaW50ZXJ2YWxGcmFjdGlvbiwgcHJldktleWZyYW1lLmdldFZhbHVlKCksCisgICAgICAgICAgICAgICAgICAgIG5leHRLZXlmcmFtZS5nZXRWYWx1ZSgpKTsKKyAgICAgICAgfSBlbHNlIGlmIChmcmFjdGlvbiA+PSAxZikgeworICAgICAgICAgICAgZmluYWwgS2V5ZnJhbWUgcHJldktleWZyYW1lID0gbUtleWZyYW1lcy5nZXQobU51bUtleWZyYW1lcyAtIDIpOworICAgICAgICAgICAgZmluYWwgS2V5ZnJhbWUgbmV4dEtleWZyYW1lID0gbUtleWZyYW1lcy5nZXQobU51bUtleWZyYW1lcyAtIDEpOworICAgICAgICAgICAgZmluYWwgSW50ZXJwb2xhdG9yIGludGVycG9sYXRvciA9IG5leHRLZXlmcmFtZS5nZXRJbnRlcnBvbGF0b3IoKTsKKyAgICAgICAgICAgIGlmIChpbnRlcnBvbGF0b3IgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIGZyYWN0aW9uID0gaW50ZXJwb2xhdG9yLmdldEludGVycG9sYXRpb24oZnJhY3Rpb24pOworICAgICAgICAgICAgfQorICAgICAgICAgICAgZmxvYXQgaW50ZXJ2YWxGcmFjdGlvbiA9IChmcmFjdGlvbiAtIHByZXZLZXlmcmFtZS5nZXRGcmFjdGlvbigpKSAvCisgICAgICAgICAgICAgICAgKG5leHRLZXlmcmFtZS5nZXRGcmFjdGlvbigpIC0gcHJldktleWZyYW1lLmdldEZyYWN0aW9uKCkpOworICAgICAgICAgICAgcmV0dXJuIGV2YWx1YXRvci5ldmFsdWF0ZShpbnRlcnZhbEZyYWN0aW9uLCBwcmV2S2V5ZnJhbWUuZ2V0VmFsdWUoKSwKKyAgICAgICAgICAgICAgICAgICAgbmV4dEtleWZyYW1lLmdldFZhbHVlKCkpOworICAgICAgICB9CisgICAgICAgIEtleWZyYW1lIHByZXZLZXlmcmFtZSA9IG1LZXlmcmFtZXMuZ2V0KDApOworICAgICAgICBmb3IgKGludCBpID0gMTsgaSA8IG1OdW1LZXlmcmFtZXM7ICsraSkgeworICAgICAgICAgICAgS2V5ZnJhbWUgbmV4dEtleWZyYW1lID0gbUtleWZyYW1lcy5nZXQoaSk7CisgICAgICAgICAgICBpZiAoZnJhY3Rpb24gPCBuZXh0S2V5ZnJhbWUuZ2V0RnJhY3Rpb24oKSkgeworICAgICAgICAgICAgICAgIGZpbmFsIEludGVycG9sYXRvciBpbnRlcnBvbGF0b3IgPSBuZXh0S2V5ZnJhbWUuZ2V0SW50ZXJwb2xhdG9yKCk7CisgICAgICAgICAgICAgICAgaWYgKGludGVycG9sYXRvciAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIGZyYWN0aW9uID0gaW50ZXJ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YWxsIHRvIHRoZSBmdW5jdGlvbiA8Y29kZT5zZXRGb28oKTwvY29kZT4gb24gdGhlIHRhcmdldCBvYmplY3QuIElmIGVpdGhlcgorICAgICAqIDxjb2RlPnZhbHVlRnJvbTwvY29kZT4gb3IgPGNvZGU+dmFsdWVUbzwvY29kZT4gaXMgbnVsbCwgdGhlbiBhIGdldHRlciBmdW5jdGlvbiB3aWxsCisgICAgICogYWxzbyBiZSBkZXJpdmVkIGFuZCBjYWxsZWQuCisgICAgICovCisgICAgcHVibGljIFN0cmluZyBnZXRQcm9wZXJ0eU5hbWUoKSB7CisgICAgICAgIHJldHVybiBtUHJvcGVydHlOYW1lOworICAgIH0KKworICAgIC8qKgorICAgICAqIENyZWF0ZXMgYSBuZXcgYW5pbWF0aW9uIHdob3NlIHBhcmFtZXRlcnMgY29tZSBmcm9tIHRoZSBzcGVjaWZpZWQgY29udGV4dCBhbmQKKyAgICAgKiBhdHRyaWJ1dGVzIHNldC4KKyAgICAgKgorICAgICAqIEBwYXJhbSBjb250ZXh0IHRoZSBhcHBsaWNhdGlvbiBlbnZpcm9ubWVudAorICAgICAqIEBwYXJhbSBhdHRycyB0aGUgc2V0IG9mIGF0dHJpYnV0ZXMgaG9sZGluZyB0aGUgYW5pbWF0aW9uIHBhcmFtZXRlcnMKKyAgICAgKi8KKyAgICBwdWJsaWMgUHJvcGVydHlBbmltYXRvcihDb250ZXh0IGNvbnRleHQsIEF0dHJpYnV0ZVNldCBhdHRycykgeworICAgICAgICBzdXBlcihjb250ZXh0LCBhdHRycyk7CisKKyAgICAgICAgVHlwZWRBcnJheSBhID0gY29udGV4dC5vYnRhaW5TdHlsZWRBdHRyaWJ1dGVzKGF0dHJzLAorICAgICAgICAgICAgICAgIGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3R5bGVhYmxlLlByb3BlcnR5QW5pbWF0b3IpOworCisgICAgICAgIHNldFByb3BlcnR5TmFtZShhLmdldFN0cmluZygKKyAgICAgICAgICAgICAgICBjb20uY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OworICAgICAgICBmb3IgKFByb3BlcnR5VmFsdWVzSG9sZGVyIHZhbHVlc0hvbGRlciA6IG1WYWx1ZXMudmFsdWVzKCkpIHsKKyAgICAgICAgICAgIHZhbHVlc0hvbGRlci5zZXR1cFNldHRlckFuZEdldHRlcihtVGFyZ2V0KTsKKyAgICAgICAgfQorICAgIH0KKworCisgICAgLyoqCisgICAgICogVGhlIHRhcmdldCBvYmplY3Qgd2hvc2UgcHJvcGVydHkgd2lsbCBiZSBhbmltYXRlZCBieSB0aGlzIGFuaW1hdGlvbgorICAgICAqCisgICAgICogQHJldHVybiBUaGUgb2JqZWN0IGJlaW5nIGFuaW1hdGVkCisgICAgICovCisgICAgcHVibGljIE9iamVjdCBnZXRUYXJnZXQoKSB7CisgICAgICAgIHJldHVybiBtVGFyZ2V0OworICAgIH0KKworICAgIC8qKgorICAgICAqIFNldHMgdGhlIHRhcmdldCBvYmplY3Qgd2hvc2UgcHJvcGVydHkgd2lsbCBiZSBhbmltYXRlZCBieSB0aGlzIGFuaW1hdGlvbgorICAgICAqCisgICAgICogQHBhcmFtIHRhcmdldCBUaGUgb2JqZWN0IGJlaW5nIGFuaW1hdGVkCisgICAgICovCisgICAgcHVibGljIHZvaWQgc2V0VGFyZ2V0KE9iamVjdCB0YXJnZXQpIHsKKyAgICAgICAgbVRhcmdldCA9IHRhcmdldDsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBUaGlzIG1ldGhvZCBpcyBjYWxsZWQgd2l0aCB0aGUgZWxhcHNlZCBmcmFjdGlvbiBvZiB0aGUgYW5pbWF0aW9uIGR1cmluZyBldmVyeQorICAgICAqIGFuaW1hdGlvbiBmcmFtZS4gVGhpcyBmdW5jdGlvbiB0dXJucyB0aGUgZWxhcHNlZCBmcmFjdGlvbiBpbnRvIGFuIGludGVycG9sYXRlZCBmcmFjdGlvbgorICAgICAqIGFuZCB0aGVuIGludG8gYW4gYW5pbWF0ZWQgdmFsdWUgKGZyb20gdGhlIGV2YWx1YXRvci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Wx1ZVR5cGUgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICBtVmFsdWVUeXBlID0gdGhpc1ZhbHVlVHlwZTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICBpZiAodGhpc1ZhbHVlVHlwZSAhPSBtVmFsdWVUeXBlKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAobVZhbHVlVHlwZSA9PSBJbnRlZ2VyLmNsYXNzICYmCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh0aGlzVmFsdWVUeXBlID09IEZsb2F0LmNsYXNzIHx8IHRoaXNWYWx1ZVR5cGUgPT0gRG91YmxlLmNsYXNzKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1WYWx1ZVR5cGUgPSB0aGlzVmFsdWVUeXBlOworICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChtVmFsdWVUeXBlID09IEZsb2F0LmNsYXNzICYmIHRoaXNWYWx1ZVR5cGUgPT0gRG91YmxlLmNsYXNzKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVZhbHVlVHlwZSA9IHRoaXNWYWx1ZVR5cGU7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgS2V5ZnJhbWUga2V5ZnJhbWVzW10gPSBuZXcgS2V5ZnJhbWVbTWF0aC5tYXgobnVtS2V5ZnJhbWVzLDIpXTsKKyAgICAgICAgaWYgKG1WYWx1ZVR5cGUuZXF1YWxzKEtleWZyYW1lLmNsYXNzKSkgeworICAgICAgICAgICAgbVZhbHVlVHlwZSA9ICgoS2V5ZnJhbWUpdmFsdWVzWzBdKS5nZXRUeXBlKCk7CisgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IG51bUtleWZyYW1lczsgKytpKSB7CisgICAgICAgICAgICAgICA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W9uKENsYXNzIHRhcmdldENsYXNzLCBTdHJpbmcgcHJlZml4LCBDbGFzcyB2YWx1ZVR5cGUpIHsKKyAgICAgICAgLy8gVE9ETzogZmFzdGVyIGltcGxlbWVudGF0aW9uLi4uCisgICAgICAgIE1ldGhvZCByZXR1cm5WYWwgPSBudWxsOworICAgICAgICBTdHJpbmcgZmlyc3RMZXR0ZXIgPSBtUHJvcGVydHlOYW1lLnN1YnN0cmluZygwLCAxKTsKKyAgICAgICAgU3RyaW5nIHRoZVJlc3QgPSBtUHJvcGVydHlOYW1lLnN1YnN0cmluZygxKTsKKyAgICAgICAgZmlyc3RMZXR0ZXIgPSBmaXJzdExldHRlci50b1VwcGVyQ2FzZSgpOworICAgICAgICBTdHJpbmcgbWV0aG9kTmFtZSA9IHByZWZpeCArIGZpcnN0TGV0dGVyICsgdGhlUmVzdDsKKyAgICAgICAgQ2xhc3MgYXJnc1tdID0gbnVsbDsKKyAgICAgICAgaWYgKHZhbHVlVHlwZSA9PSBudWxsKSB7CisgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIHJldHVyblZhbCA9IHRhcmdldENsYXNzLmdldE1ldGhvZChtZXRob2ROYW1lLCBhcmdzKTsKKyAgICAgICAgICAgIH0gY2F0Y2ggKE5vU3VjaE1ldGhvZEV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgTG9nLmUoIlByb3BlcnR5VmFsdWVzSG9sZGVyIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICJDb3VsZG4ndCBmaW5kIG5vLWFyZyBtZXRob2QgZm9yIHByb3BlcnR5ICIgKyBtUHJvcGVydHlOYW1lICsgIjogIiArIGUpOworICAgICAgICAgICAgfQorICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgYXJncyA9IG5ldyBDbGFzc1sxXTsKKyAgICAgICAgICAgIENsYXNzIHR5cGVWYXJpYW50c1tdOworICAgICAgICAgICAgaWYgKG1WYWx1ZVR5cGUuZXF1YWxzKEZsb2F0LmNsYXNzKSkgeworICAgICAgICAgICAgICAgIHR5cGVWYXJpYW50cyA9IEZMT0FUX1ZBUklBTlRTOworICAgICAgICAgICAgfSBlbHNlIGlmIChtVmFsdWVUeXBlLmVxdWFscyhJbnRlZ2VyLmNsYXNzKSkgeworICAgICAgICAgICAgICAgIHR5cGVWYXJpYW50cyA9IElOVEVHRVJfVkFSSUFOVFM7CisgICAgICAgICAgICB9IGVsc2UgaWYgKG1WYWx1ZVR5cGUuZXF1YWxzKERvdWJsZS5jbGFzcykpIHsKKyAgICAgICAgICAgICAgICB0eXBlVmFyaWFudHMgPSBET1VCTEVfVkFSSUFOVFM7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIHR5cGVWYXJpYW50cyA9IG5ldyBDbGFzc1sxXTsKKyAgICAgICAgICAgICAgICB0eXBlVmFyaWFudHNbMF0gPSBtVmFsdWVUeXBlOworICAgICAgICAgICAgfQorICAgICAgICAgICAgZm9yIChDbGFzcyB0eXBlVmFyaWFudCA6IHR5cGVWYXJpYW50cykgeworICAgICAgICAgICAgICAgIGFyZ3NbMF0gPSB0eXBlVmFyaWFudDsKKyAgICAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgICAgICByZXR1cm5WYWwgPSB0YXJnZXRDbGFzcy5nZXRNZXRob2QobWV0aG9kTmFtZSwgYXJncyk7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiByZXR1cm5WYWw7CisgICAgICAgICAgICAgICAgfSBjYXRjaCAoTm9TdWNoTWV0aG9kRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gU3dhbGxvdyB0aGUgZXJyb3IgYW5kIGtlZXAgdHJ5aW5nIG90aGVyIHZhcmlhbnRzCisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIC8vIElmIHdlIGdvdCBoZXJlLCB0aGVuIG5vIGFwcHJvcHJpYXRlIGZ1bmN0aW9uIHdhcyBmb3V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0YXJnZXQgVGhlIG9iamVjdCBvbiB3aGljaCB0aGUgc2V0dGVyIChhbmQgcG9zc2libHkgZ2V0dGVyKSBleGlzdC4KKyAgICAgKi8KKyAgICB2b2lkIHNldHVwU2V0dGVyQW5kR2V0dGVyKE9iamVjdCB0YXJnZXQpIHsKKyAgICAgICAgQ2xhc3MgdGFyZ2V0Q2xhc3MgPSB0YXJnZXQuZ2V0Q2xhc3MoKTsKKyAgICAgICAgaWYgKG1TZXR0ZXIgPT0gbnVsbCkgeworICAgICAgICAgICAgc2V0dXBTZXR0ZXIodGFyZ2V0Q2xhc3MpOworICAgICAgICB9CisgICAgICAgIGZvciAoS2V5ZnJhbWUga2YgOiBtS2V5ZnJhbWVTZXQubUtleWZyYW1lcykgeworICAgICAgICAgICAgaWYgKGtmLmdldFZhbHVlKCkgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgIGlmIChtR2V0dGVyID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgc2V0dXBHZXR0ZXIodGFyZ2V0Q2xhc3MpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgICAgICBrZi5zZXRWYWx1ZSgoVCkgbUdldHRlci5pbnZva2UodGFyZ2V0KSk7CisgICAgICAgICAgICAgICAgfSBjYXRjaCAoSW52b2NhdGlvblRhcmdldEV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgICAgIExvZy5lKCJQcm9wZXJ0eVZhbHVlc0hvbGRlciIsIGUudG9TdHJpbmcoKSk7CisgICAgICAgICAgICAgICAgfSBjYXRjaCAoSWxsZWdhbEFjY2Vzc0V4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgICAgIExvZy5lKCJQcm9wZXJ0eVZhbHVlc0hvbGRlciIsIGUudG9TdHJpbmcoKSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogSW50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gIHB1YmxpYyBCdWlsZGVyIHBsYXkoQW5pbWF0YWJsZSBhbmltKSB7CisgICAgICAgIGlmIChhbmltICE9IG51bGwpIHsKKyAgICAgICAgICAgIG1OZWVkc1NvcnQgPSB0cnVlOworICAgICAgICAgICAgcmV0dXJuIG5ldyBCdWlsZGVyKGFuaW0pOworICAgICAgICB9CisgICAgICAgIHJldHVybiBudWxsOworICAgIH0KKworICAgIC8qKgorICAgICAqIHtAaW5oZXJpdERvY30KKyAgICAgKgorICAgICAqIDxwPk5vdGUgdGhhdCBjYW5jZWxpbmcgYSA8Y29kZT5TZXF1ZW5jZXI8L2NvZGU+IGFsc28gY2FuY2VscyBhbGwgb2YgdGhlIGFuaW1hdGlvbnMgdGhhdCBpdCBpcworICAgICAqIHJlc3BvbnNpYmxlIGZvci48L3A+CisgICAgICovCisgICAgQFN1cHByZXNzV2FybmluZ3MoInVuY2hlY2tlZCIpCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgY2FuY2VsKCkgeworICAgICAgICBtQ2FuY2VsZWQgPSB0cnVlOworICAgICAgICBpZiAobUxpc3RlbmVycyAhPSBudWxsKSB7CisgICAgICAgICAgICBBcnJheUxpc3Q8QW5pbWF0YWJsZUxpc3RlbmVyPiB0bXBMaXN0ZW5lcnMgPQorICAgICAgICAgICAgICAgICAgICAoQXJyYXlMaXN0PEFuaW1hdGFibGVMaXN0ZW5lcj4pIG1MaXN0ZW5lcnMuY2xvbmUoKTsKKyAgICAgICAgICAgIGZvciAoQW5pbWF0YWJsZUxpc3RlbmVyIGxpc3RlbmVyIDogdG1wTGlzdGVuZXJzKSB7CisgICAgICAgICAgICAgICAgbGlzdGVuZXIub25BbmltYXRpb25DYW5jZWwodGhpcyk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgaWYgKG1Tb3J0ZWROb2Rlcy5zaXplKCkgPiAwKSB7CisgICAgICAgICAgICBmb3IgKE5vZGUgbm9kZSA6IG1Tb3J0ZWROb2RlcykgeworICAgICAgICAgICAgICAgIG5vZGUuYW5pbWF0aW9uLmNhbmNlbCgpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICoge0Bpbmhlcml0RG9jfQorICAgICAqCisgICAgICogPHA+Tm90ZSB0aGF0IGVuZGluZyBhIDxjb2RlPlNlcXVlbmNlcjwvY29kZT4gYWxzbyBlbmRzIGFsbCBvZiB0aGUgYW5pbWF0aW9ucyB0aGF0IGl0IGlzCisgICAgICogcmVzcG9uc2libGUgZm9yLjwvcD4KKyAgICAgKi8KKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgdm9pZCBlbmQoKSB7CisgICAgICAgIG1DYW5jZWxlZCA9IHRydWU7CisgICAgICAgIGlmIChtU29ydGVkTm9kZXMuc2l6ZSgpID4gMCkgeworICAgICAgICAgICAgZm9yIChOb2RlIG5vZGUgOiBtU29ydGVkTm9kZXMpIHsKKyAgICAgICAgICAgICAgICBub2RlLmFuaW1hdGlvbi5lbmQoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIHtAaW5oZXJpdERvY30KKyAgICAgKgorICAgICAqIDxwPlN0YXJ0aW5nIHRoaXMgPGNvZGU+U2VxdWVuY2VyPC9jb2RlPiB3aWxsLCBpbiB0dXJuLCBzdGFydCB0aGUgYW5pbWF0aW9ucyBmb3Igd2hpY2gKKyAgICAgKiBpdCBpcyByZXNwb25zaWJsZS4gVGhlIGRldGFpbHMgb2Ygd2hlbiBleGFjdGx5IHRob3NlIGFuaW1hdGlvbnMgYXJlIHN0YXJ0ZWQgZGVwZW5kcyBvbgorICAgICAqIHRoZSBkZXBlbmRlbmN5IHJlbGF0aW9uc2hpcHMgdGhhdCBoYXZlIGJlZW4gc2V0IHVwIGJldHdlZW4gdGhlIGFuaW1hdGlvbnMuCisgICAgICovCisgICAgQFN1cHByZXNzV2FybmluZ3MoInVuY2hlY2tlZCIpCisgICAgQE92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mVyKHRoaXMpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKG5vZGUuZGVwZW5kZW5jaWVzID09IG51bGwgfHwgbm9kZS5kZXBlbmRlbmNpZXMuc2l6ZSgpID09IDApIHsKKyAgICAgICAgICAgICAgICBub2Rlc1RvU3RhcnQuYWRkKG5vZGUpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBmb3IgKERlcGVuZGVuY3kgZGVwZW5kZW5jeSA6IG5vZGUuZGVwZW5kZW5jaWVzKSB7CisgICAgICAgICAgICAgICAgICAgIGRlcGVuZGVuY3kubm9kZS5hbmltYXRpb24uYWRkTGlzdGVuZXIoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV3IERlcGVuZGVuY3lMaXN0ZW5lcih0aGlzLCBub2RlLCBkZXBlbmRlbmN5LnJ1bGUpKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgbm9kZS50bXBEZXBlbmRlbmNpZXMgPSAoQXJyYXlMaXN0PERlcGVuZGVuY3k+KSBub2RlLmRlcGVuZGVuY2llcy5jbG9uZSgpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgbm9kZS5hbmltYXRpb24uYWRkTGlzdGVuZXIobVNlcXVlbmNlTGlzdGVuZXIpOworICAgICAgICB9CisgICAgICAgIC8vIE5vdyB0aGF0IGFsbCBkZXBlbmRlbmNpZXMgYXJlIHNldCB1cCwgc3RhcnQgdGhlIGFuaW1hdGlvbnMgdGhhdCBzaG91bGQgYmUgc3RhcnRlZC4KKyAgICAgICAgZm9yIChOb2RlIG5vZGUgOiBub2Rlc1RvU3RhcnQpIHsKKyAgICAgICAgICAgIG5vZGUuYW5pbWF0aW9uLnN0YXJ0KCk7CisgICAgICAgICAgICBtUGxheWluZ1NldC5hZGQobm9kZS5hbmltYXRpb24pOworICAgICAgICB9CisgICAgICAgIGlmIChtTGlzdGVuZXJzICE9IG51bGwpIHsKKyAgICAgICAgICAgIEFycmF5TGlz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bgorICAgICAgICAvLyB0aGUgbm9kZQorICAgICAgICBwcml2YXRlIGludCBtUnVsZTsKKworICAgICAgICBwdWJsaWMgRGVwZW5kZW5jeUxpc3RlbmVyKFNlcXVlbmNlciBzZXF1ZW5jZXIsIE5vZGUgbm9kZSwgaW50IHJ1bGUpIHsKKyAgICAgICAgICAgIHRoaXMubVNlcXVlbmNlciA9IHNlcXVlbmNlcjsKKyAgICAgICAgICAgIHRoaXMubU5vZGUgPSBub2RlOworICAgICAgICAgICAgdGhpcy5tUnVsZSA9IHJ1bGU7CisgICAgICAgIH0KKworICAgICAgICAvKioKKyAgICAgICAgICogSWdub3JlIGNhbmNlbCBldmVudHMgZm9yIG5vdy4gV2UgbWF5IHdhbnQgdG8gaGFuZGxlIHRoaXMgZXZlbnR1YWxseSwKKyAgICAgICAgICogdG8gcHJldmVudCBmb2xsb3ctb24gYW5pbWF0aW9ucyBmcm9tIHJ1bm5pbmcgd2hlbiBzb21lIGRlcGVuZGVuY3kKKyAgICAgICAgICogYW5pbWF0aW9uIGlzIGNhbmNlbGVkLgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHZvaWQgb25BbmltYXRpb25DYW5jZWwoQW5pbWF0YWJsZSBhbmltYXRpb24pIHsKKyAgICAgICAgfQorCisgICAgICAgIC8qKgorICAgICAgICAgKiBBbiBlbmQgZXZlbnQgaXMgcmVjZWl2ZWQgLSBzZWUgaWYgdGhpcyBpcyBhbiBldmVudCB3ZSBhcmUgbGlzdGVuaW5nIGZvcgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHZvaWQgb25BbmltYXRpb25FbmQoQW5pbWF0YWJsZSBhbmltYXRpb24pIHsKKyAgICAgICAgICAgIGlmIChtUnVsZSA9PSBEZXBlbmRlbmN5LkFGVEVSKSB7CisgICAgICAgICAgICAgICAgc3RhcnRJZlJlYWR5KGFuaW1hdGlvbik7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICAvKioKKyAgICAgICAgICogSWdub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BjYW5jZWxlZCwgdGhlbiBkb24ndCBzdGFydCBhbnkgZGVwZW5kZW50IGFuaW1zCisgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgfQorICAgICAgICAgICAgRGVwZW5kZW5jeSBkZXBlbmRlbmN5VG9SZW1vdmUgPSBudWxsOworICAgICAgICAgICAgZm9yIChEZXBlbmRlbmN5IGRlcGVuZGVuY3kgOiBtTm9kZS50bXBEZXBlbmRlbmNpZXMpIHsKKyAgICAgICAgICAgICAgICBpZiAoZGVwZW5kZW5jeS5ydWxlID09IG1SdWxlICYmCisgICAgICAgICAgICAgICAgICAgICAgICBkZXBlbmRlbmN5Lm5vZGUuYW5pbWF0aW9uID09IGRlcGVuZGVuY3lBbmltYXRpb24pIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gcnVsZSBmaXJlZCAtIHJlbW92ZSB0aGUgZGVwZW5kZW5jeSBhbmQgbGlzdGVuZXIgYW5kIGNoZWNrIHRvCisgICAgICAgICAgICAgICAgICAgIC8vIHNlZSB3aGV0aGVyIGl0J3MgdGltZSB0byBzdGFydCB0aGUgYW5pbWF0aW9uCisgICAgICAgICAgICAgICAgICAgIGRlcGVuZGVuY3lUb1JlbW92ZSA9IGRlcGVuZGVuY3k7CisgICAgICAgICAgICAgICAgICAgIGRlcGVuZGVuY3lBbmltYXRpb24ucmVtb3ZlTGlzdGVuZXIodGhpcyk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1Ob2RlLnRtcERlcGVuZGVuY2llcy5yZW1vdmUoZGVwZW5kZW5jeVRvUmVtb3ZlKTsKKyAgICAgICAgICAgIGlmIChtTm9kZS50bXBEZXBlbmRlbmNpZXMuc2l6ZSgpID09IDApIHsKKyAgICAgICAgICAgICAgICAvLyBhbGwgZGVwZW5kZW5jaWVzIHNhdGlzZmllZDogc3RhcnQgdGhlIGFuaW1hdGlvbgorICAgICAgICAgICAgICAgIG1Ob2RlLmFuaW1hdGlvbi5zdGFydCgpOworICAgICAgICAgICAgICAgIG1TZXF1ZW5jZXIubVBsYXlpbmdTZXQuYWRkKG1Ob2RlLmFuaW1hdGlvbik7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgIH0KKworICAgIHByaXZhdGUgY2xhc3MgU2VxdWVuY2VyQW5pbWF0YWJsZUxpc3RlbmVyIGltcGxlbWVudHMgQW5pbWF0YWJsZUxpc3RlbmVyIHsKKworICAgICAgICBwcml2YXRlIFNlcXVlbmNlciBtU2VxdWVuY2VyOworCisgICAgICAgIFNlcXVlbmNlckFuaW1hdGFibGVMaXN0ZW5lcihTZXF1ZW5jZXIgc2VxdWVuY2VyKSB7CisgICAgICAgICAgICBtU2VxdWVuY2VyID0gc2VxdWVuY2VyOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgb25BbmltYXRpb25DYW5jZWwoQW5pbWF0YWJsZSBhbmltYXRpb24pIHsKKyAgICAgICAgICAgIGlmIChtUGxheWluZ1NldC5zaXplKCkgPT0gMCkgeworICAgICAgICAgICAgICAgIGlmIChtTGlzdGVuZXJzICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgZm9yIChBbmltYXRhYmxlTGlzdGVuZXIgbGlzdGVuZXIgOiBtTGlzdGVuZXJzKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBsaXN0ZW5lci5vbkFuaW1hdGlvbkNhbmNlbChtU2VxdWVuY2VyKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIEBTdXBwcmVzc1dhcm5pbmdzKCJ1bmNoZWNrZWQiKQorICAgICAgICBwdWJsaWMgdm9pZCBvbkFuaW1hdGlvbkVuZChBbmltYXRhYmxlIGFuaW1hdGlvbikgeworICAgICAgICAgICAgYW5pbWF0aW9uLnJlbW92ZUxpc3RlbmVyKHRoaXMpOworICAgICAgICAgICAgbVBsYXlpbmdTZXQucmVtb3ZlKGFuaW1hdGlvbik7CisgICAgICAgICAgICBOb2RlIGFuaW1Ob2RlID0gbVNlcXVlbmNlci5tTm9kZU1hcC5nZXQoYW5pbWF0aW9uKTsKKyAgICAgICAgICAgIGFuaW1Ob2RlLmRvbmUgPSB0cnVlOworICAgICAgICAgICAgQXJyYXlMaXN0PE5vZGU+IHNvcnRlZE5vZGVzID0gbVNlcXVlbmNlci5tU29ydGVkTm9kZXM7CisgICAgICAgICAgICBpbnQgbnVtTm9kZXMgPSBzb3J0ZWROb2Rlcy5zaXplKCk7CisgICAgICAgICAgICBpbnQgbm9kZUluZGV4ID0gc29ydGVkTm9kZXMuaW5kZXhPZihhbmltTm9kZSk7CisgICAgICAgICAgICBib29sZWFuIGFsbERvbmUgPSB0cnVlOworICAgICAgICAgICAgZm9yIChpbnQgaSA9IG5vZGVJbmRleCArIDE7IGkgPCBudW1Ob2RlczsgKytpKSB7CisgICAgICAgICAgICAgICAgaWYgKCFzb3J0ZWROb2Rlcy5nZXQoaSkuZG9uZSkgeworICAgICAgICAgICAgICAgICAgICBhbGxEb25lID0gZmFsc2U7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmIChhbGxEb25lKSB7CisgICAgICAgICAgICAgICAgLy8gSWYgdGhpcyB3YXMgdGhlIGxhc3QgY2hpbGQgYW5pbWF0aW9uIHRvIGVuZCwgdGhlbiBub3RpZnkgbGlzdGVuZXJzIHRoYXQgdGhpcworICAgICAgICAgICAgICAgIC8vIHNlcXVlbmNlciBoYXMgZW5kZWQKKyAgICAgICAgICAgICAgICBpZiAobUxpc3RlbmVycyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIEFycmF5TGlzdDxBbmltYXRhYmxlTGlzdGVuZXI+IHRtcExpc3RlbmVycyA9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgKEFycmF5TGlzdDxBbmltYXRhYmxlTGlzdGVuZXI+KSBtTGlzdGVuZXJzLmNsb25lKCk7CisgICAgICAgICAgICAgICAgICAgIGZvciAoQW5pbWF0YWJsZUxpc3RlbmVyIGxpc3RlbmVyIDogdG1wTGlzdGVuZXJzKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBsaXN0ZW5lci5vbkFuaW1hdGlvbkVuZChtU2VxdWVuY2VyKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIC8vIE5vdGhpbmcgdG8gZG8KKyAgICAgICAgcHVibGljIHZvaWQgb25BbmltYXRpb25SZXBlYXQoQW5pbWF0YWJsZSBhbmltYXRpb24pIHsKKyAgICAgICAgfQorCisgICAgICAgIC8vIE5vdGhpbmcgdG8gZG8KKyAgICAgICAgcHVibGljIHZvaWQgb25BbmltYXRpb25TdGFydChBbmltYXRhYmxlIGFuaW1hdGlvbikgeworICAgICAgICB9CisKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBUaGlzIG1ldGhvZCBzb3J0cyB0aGUgY3VycmVudCBzZXQgb2Ygbm9kZXMsIGlmIG5lZWRlZC4gVGhlIHNvcnQgaXMgYSBzaW1wbGUKKyAgICAgKiBEZXBlbmRlbmN5R3JhcGggc29ydCwgd2hpY2ggZ29lcyBsaWtlIHRoaXM6CisgICAgICogLSBBbGwgbm9kZXMgd2l0aG91dCBkZXBlbmRlbmNpZXMgYmVjb21lICdyb290cycKKyAgICAgKiAtIHdoaWxlIHJvb3RzIGxpc3QgaXMgbm90IG51bGwKKyAgICAgKiAtICAgZm9yIGVhY2ggcm9vdCByCisgICAgICogLSAgICAgYWRkIHIgdG8gc29ydGVkIGxpc3QKKyAgICAgKiAtICAgICByZW1vdmUgciBhcyBhIGRlcGVuZGVuY3kgZnJvbSBhbnkgb3RoZXIgbm9kZQorICAgICAqIC0gICBhbnkgbm9kZXMgd2l0aCBubyBkZXBlbmRlbmNpZXMgYXJlIGFkZGVkIHRvIHRoZSByb290cyBsaXN0CisgICAgICovCisgICAgcHJpdmF0ZSB2b2lkIHNvcnROb2RlcygpIHsKKyAgICAgICAgaWYgKG1OZWVkc1NvcnQpIHsKKyAgICAgICAgICAgIG1Tb3J0ZWROb2Rlcy5jbGVhcigpOworICAgICAgICAgICAgQXJyYXlMaXN0PE5vZGU+IHJvb3RzID0gbmV3IEFycmF5TGlzdDxOb2RlPigpOworICAgICAgICAgICAgZm9yIChOb2RlIG5vZGUgOiBtTm9kZXMpIHsKKyAgICAgICAgICAgICAgICBpZiAobm9kZS5kZXBlbmRlbmNpZXMgPT0gbnVsbCB8fCBub2RlLmRlcGVuZGVuY2llcy5zaXplKCkgPT0gMCkgeworICAgICAgICAgICAgICAgICAgICByb290cy5hZGQobm9kZSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgQXJyYXlMaXN0PE5vZGU+IHRtcFJvb3RzID0gbmV3IEFycmF5TGlzdDxOb2RlPigpOworICAgICAgICAgICAgd2hpbGUgKHJvb3RzLnNpemUoKSA+IDApIHsKKyAgICAgICAgICAgICAgICBmb3IgKE5vZGUgcm9vdCA6IHJvb3RzKSB7CisgICAgICAgICAgICAgICAgICAgIG1Tb3J0ZWROb2Rlcy5hZGQocm9vdCk7CisgICAgICAgICAgICAgICAgICAgIGlmIChyb290Lm5vZGVEZXBlbmRlbnRzICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoTm9kZSBub2RlIDogcm9vdC5ub2RlRGVwZW5kZW50cykgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5vZGUubm9kZURlcGVuZGVuY2llcy5yZW1vdmUocm9vdCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG5vZGUubm9kZURlcGVuZGVuY2llcy5zaXplKCkgPT0gMCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0bXBSb290cy5hZGQobm9kZSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHJvb3RzLmNsZWFyKCk7CisgICAgICAgICAgICAgICAgcm9vdHMuYWRkQWxsKHRtcFJvb3RzKTsKKyAgICAgICAgICAgICAgICB0bXBSb290cy5jbGVhcigpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgbU5lZWRzU29ydCA9IGZhbHNlOworICAgICAgICAgICAgaWYgKG1Tb3J0ZWROb2Rlcy5zaXplKCkgIT0gbU5vZGVzLnNpemUoKSkgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oIkNpcmN1bGFyIGRlcGVuZGVuY2llcyBjYW5ub3QgZXhpc3QiCisgICAgICAgICAgICAgICAgICAgICAgICArICIgaW4gU2VxdWVuY2VyIik7CisgICAgICAgICAgICB9CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAvLyBEb2Vzbid0IG5lZWQgc29ydGluZywgYnV0IHN0aWxsIG5lZWQgdG8gYWRkIGluIHRoZSBub2RlRGVwZW5kZW5jaWVzIGxpc3QKKyAgICAgICAgICAgIC8vIGJlY2F1c2UgdGhlc2UgZ2V0IHJlbW92ZWQgYXMgdGhlIGV2ZW50IGxpc3RlbmVycyBmaXJlIGFuZCB0aGUgZGVwZW5kZW5jaWVzCisgICAgICAgICAgICAvLyBhcmUgc2F0aXNmaWVkCisgICAgICAgICAgICBmb3IgKE5vZGUgbm9kZSA6IG1Ob2RlcykgeworICAgICAgICAgICAgICAgIGlmIChub2RlLmRlcGVuZGVuY2llcyAhPSBudWxsICYmIG5vZGUuZGVwZW5kZW5jaWVzLnNpemUoKSA+IDApIHsKKyAgICAgICAgICAgICAgICAgICAgZm9yIChEZXBlbmRlbmN5IGRlcGVuZGVuY3kgOiBub2RlLmRlcGVuZGVuY2llcykgeworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG5vZGUubm9kZURlcGVuZGVuY2llcyA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbm9kZS5ub2RlRGVwZW5kZW5jaWVzID0gbmV3IEFycmF5TGlzdDxOb2RlPigpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFub2RlLm5vZGVEZXBlbmRlbmNpZXMuY29udGFpbnMoZGVwZW5kZW5jeS5ub2RlKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5vZGUubm9kZURlcGVuZGVuY2llcy5hZGQoZGVwZW5kZW5jeS5ub2RlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBub2RlLmRvbmUgPSBmYWxzZTsgLy8gYWxzbyByZXNldCBkb25lIGZsYWcKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIERlcGVuZGVuY3kgaG9sZHMgaW5mb3JtYXRpb24gYWJvdXQgdGhlIG5vZGUgdGhhdCBzb21lIG90aGVyIG5vZGUgaXMKKyAgICAgKiBkZXBlbmRlbnQgdXBvbiBhbmQgdGhlIG5hdHVyZSBvZiB0aGF0IGRlcGVuZGVuY3kuCisgICAgICoKKyAgICAgKi8KKyAgICBwcml2YXRlIHN0YXRpYyBjbGFzcyBEZXBlbmRlbmN5IHsKKyAgICAgICAgc3RhdGljIGZpbmFsIGludCBXSVRIID0gMDsgLy8gZGVwZW5kZW50IG5vZGUgbXVzdCBzdGFydCB3aXRoIHRoaXMgZGVwZW5kZW5jeSBub2RlCisgICAgICAgIHN0YXRpYyBmaW5hbCBpbnQgQUZURVIgPSAxOyAvLyBkZXBlbmRlbnQgbm9kZSBtdXN0IHN0YXJ0IHdoZW4gd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GRlcGVuZGVuY3kuCisgICAgICAgICAqIEBwYXJhbSBkZXBlbmRlbmN5CisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgdm9pZCBhZGREZXBlbmRlbmN5KERlcGVuZGVuY3kgZGVwZW5kZW5jeSkgeworICAgICAgICAgICAgaWYgKGRlcGVuZGVuY2llcyA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgZGVwZW5kZW5jaWVzID0gbmV3IEFycmF5TGlzdDxEZXBlbmRlbmN5PigpOworICAgICAgICAgICAgICAgIG5vZGVEZXBlbmRlbmNpZXMgPSBuZXcgQXJyYXlMaXN0PE5vZGU+KCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBkZXBlbmRlbmNpZXMuYWRkKGRlcGVuZGVuY3kpOworICAgICAgICAgICAgaWYgKCFub2RlRGVwZW5kZW5jaWVzLmNvbnRhaW5zKGRlcGVuZGVuY3kubm9kZSkpIHsKKyAgICAgICAgICAgICAgICBub2RlRGVwZW5kZW5jaWVzLmFkZChkZXBlbmRlbmN5Lm5vZGUpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgTm9kZSBkZXBlbmRlbmN5Tm9kZSA9IGRlcGVuZGVuY3kubm9kZTsKKyAgICAgICAgICAgIGlmIChkZXBlbmRlbmN5Tm9kZS5ub2RlRGVwZW5kZW50cyA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgZGVwZW5kZW5jeU5vZGUubm9kZURlcGVuZGVudHMgPSBuZXcgQXJyYXlMaXN0PE5vZGU+KCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBkZXBlbmRlbmN5Tm9kZS5ub2RlRGVwZW5kZW50cy5hZGQodGhpcyk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBUaGUgPGNvZGU+QnVpbGRlcjwvY29kZT4gb2JqZWN0IGlzIGEgdXRpbGl0eSBjbGFzcyB0byBmYWNpbGl0YXRlIGFkZGluZyBhbmltYXRpb25zIHRvIGEKKyAgICAgKi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LworICAgICAgICBwcml2YXRlIE5vZGUgbUN1cnJlbnROb2RlOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBwYWNrYWdlLXByaXZhdGUgY29uc3RydWN0b3IuIEJ1aWxkZXJzIGFyZSBvbmx5IGNvbnN0cnVjdGVkIGJ5IFNlcXVlbmNlciwgd2hlbiB0aGUKKyAgICAgICAgICogcGxheSgpIG1ldGhvZCBpcyBjYWxsZWQuCisgICAgICAgICAqCisgICAgICAgICAqIEBwYXJhbSBhbmltIFRoZSBhbmltYXRpb24gdGhhdCBpcyB0aGUgZGVwZW5kZW5jeSBmb3IgdGhlIG90aGVyIGFuaW1hdGlvbnMgcGFzc2VkIGludG8KKyAgICAgICAgICogdGhlIG90aGVyIG1ldGhvZHMgb2YgdGhpcyBCdWlsZGVyIG9iamVjdC4KKyAgICAgICAgICovCisgICAgICAgIEJ1aWxkZXIoQW5pbWF0YWJsZSBhbmltKSB7CisgICAgICAgICAgICBtQ3VycmVudE5vZGUgPSBtTm9kZU1hcC5nZXQoYW5pbSk7CisgICAgICAgICAgICBpZiAobUN1cnJlbnROb2RlID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICBtQ3VycmVudE5vZGUgPSBuZXcgTm9kZShhbmltKTsKKyAgICAgICAgICAgICAgICBtTm9kZU1hcC5wdXQoYW5pbSwgbUN1cnJlbnROb2RlKTsKKyAgICAgICAgICAgICAgICBtTm9kZXMuYWRkKG1DdXJyZW50Tm9kZSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICAvKioKKyAgICAgICAgICogU2V0cyB1cCB0aGUgZ2l2ZW4gYW5pbWF0aW9uIHRvIHBsYXkgYXQgdGhlIHNhbWUgdGltZSBhcyB0aGUgYW5pbWF0aW9uIHN1cHBsaWVkIGluIHRoZQorICAgICAgICAgKiB7QGxpbmsgU2VxdWVuY2VyI3BsYXkoQW5pbWF0YWJsZSl9IGNhbGwgdGhhdCBjcmVhdGVkIHRoaXMgPGNvZGU+QnVpbGRlcjwvY29kZT4gb2JqZWN0LgorICAgICAgICAgKgorICAgICAgICAgKiBAcGFyYW0gYW5pbSBUaGUgYW5pbWF0aW9uIHRoYXQgd2lsbCBwbGF5IHdoZW4gdGhlIGFuaW1hdGlvbiBzdXBwbGllZCB0byB0aGUKKyAgICAgICAgICoge0BsaW5rIFNlcXVlbmNlciNwbGF5KEFuaW1hdGFibGUpfSBtZXRob2Qgc3RhcnRzLgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHZvaWQgd2l0aChBbmltYXRhYmxlIGFuaW0pIHsKKyAgICAgICAgICAgIE5vZGUgbm9kZSA9IG1Ob2RlTWFwLmdldChhbmltKTsKKyAgICAgICAgICAgIGlmIChub2RlID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICBub2RlID0gbmV3IE5vZGUoYW5pbSk7CisgICAgICAgICAgICAgICAgbU5vZGVNYXAucHV0KGFuaW0sIG5vZGUpOworICAgICAgICAgICAgICAgIG1Ob2Rlcy5hZGQobm9kZSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBEZXBlbmRlbmN5IGRlcGVuZGVuY3kgPSBuZXcgRGVwZW5kZW5jeShtQ3VycmVudE5vZGUsIERlcGVuZGVuY3kuV0lUSCk7CisgICAgICAgICAgICBub2RlLmFkZERlcGVuZGVuY3koZGVwZW5kZW5jeSk7CisgICAgICAgIH0KKworICAgICAgICAvKioKKyAgICAgICAgICogU2V0cyB1cCB0aGUgZ2l2ZW4gYW5pbWF0aW9uIHRvIHBsYXkgd2hlbiB0aGUgYW5pbWF0aW9uIHN1cHBsaWVkIGluIHRoZQorICAgICAgICAgKiB7QGxpbmsgU2VxdWVuY2VyI3BsYXkoQW5pbWF0YWJsZSl9IGNhbGwgdGhhdCBjcmVhdGVkIHRoaXMgPGNvZGU+QnVpbGRlcjwvY29kZT4gb2JqZWN0CisgICAgICAgICAqIGVuZHMuCisgICAgICAgICAqCisgICAgICAgICAqIEBwYXJhbSBhbmltIFRoZSBhbmltYXRpb24g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IHNldFN0YW5kYXJkTmF2aWdhdGlvbk1vZGUoKTsKKworICAgIC8qKgorICAgICAqIFNldCB0aGUgYWN0aW9uIGJhcidzIHRpdGxlLiBUaGlzIHdpbGwgb25seSBiZSBkaXNwbGF5ZWQgaW4gc3RhbmRhcmQgbmF2aWdhdGlvbiBtb2RlLgorICAgICAqCisgICAgICogQHBhcmFtIHRpdGxlIFRpdGxlIHRvIHNldAorICAgICAqCisgICAgICogQHNlZSAjc2V0VGl0bGUoaW50KQorICAgICAqLworICAgIHB1YmxpYyBhYnN0cmFjdCB2b2lkIHNldFRpdGxlKENoYXJTZXF1ZW5jZSB0aXRsZSk7CisKKyAgICAvKioKKyAgICAgKiBTZXQgdGhlIGFjdGlvbiBiYXIncyB0aXRsZS4gVGhpcyB3aWxsIG9ubHkgYmUgZGlzcGxheWVkIGluIHN0YW5kYXJkIG5hdmlnYXRpb24gbW9kZS4KKyAgICAgKgorICAgICAqIEBwYXJhbSByZXNJZCBSZXNvdXJjZSBJRCBvZiB0aXRsZSBzdHJpbmcgdG8gc2V0CisgICAgICoKKyAgICAgKiBAc2VlICNzZXRUaXRsZShDaGFyU2VxdWVuY2UpCisgICAgICovCisgICAgcHVibGljIGFic3RyYWN0IHZvaWQgc2V0VGl0bGUoaW50IHJlc0lkKTsKKworICAgIC8qKgorICAgICAqIFNldCB0aGUgYWN0aW9uIGJhcidzIHN1YnRpdGxlLiBUaGlzIHdpbGwgb25seSBiZSBkaXNwbGF5ZWQgaW4gc3RhbmRhcmQgbmF2aWdhdGlvbiBtb2RlLgorICAgICAqIFNldCB0byBudWxsIHRvIGRpc2FibGUgdGhlIHN1YnRpdGxlIGVudGlyZWx5LgorICAgICAqCisgICAgICogQHBhcmFtIHN1YnRpdGxlIFN1YnRpdGxlIHRvIHNldAorICAgICAqCisgICAgICogQHNlZSAjc2V0U3VidGl0bGUoaW50KQorICAgICAqLworICAgIHB1YmxpYyBhYnN0cmFjdCB2b2lkIHNldFN1YnRpdGxlKENoYXJT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B0aW9uIGJpdHMgYXQgb25jZSwgc2VlIHtAbGluayAjc2V0RGlzcGxheU9wdGlvbnMoaW50KX0uCisgICAgICogCisgICAgICogPHA+RXhhbXBsZTogc2V0RGlzcGxheU9wdGlvbnMoMCwgRElTUExBWV9ISURFX0hPTUUpIHdpbGwgZGlzYWJsZSB0aGUKKyAgICAgKiB7QGxpbmsgI0RJU1BMQVlfSElERV9IT01FfSBvcHRpb24uCisgICAgICogc2V0RGlzcGxheU9wdGlvbnMoRElTUExBWV9ISURFX0hPTUUsIERJU1BMQVlfSElERV9IT01FIHwgRElTUExBWV9VU0VfTE9HTykKKyAgICAgKiB3aWxsIGVuYWJsZSB7QGxpbmsgI0RJU1BMQVlfSElERV9IT01FfSBhbmQgZGlzYWJsZSB7QGxpbmsgI0RJU1BMQVlfVVNFX0xPR099LgorICAgICAqIAorICAgICAqIEBwYXJhbSBvcHRpb25zIEEgY29tYmluYXRpb24gb2YgdGhlIGJpdHMgZGVmaW5lZCBieSB0aGUgRElTUExBWV8gY29uc3RhbnRzCisgICAgICogICAgICAgICAgICAgICAgZGVmaW5lZCBpbiBBY3Rpb25CYXIuCisgICAgICogQHBhcmFtIG1hc2sgQSBiaXQgbWFzayBkZWNsYXJpbmcgd2hpY2ggZGlzcGxheSBvcHRpb25zIHNob3VsZCBiZSBjaGFuZ2VkLgorICAgICAqLworICAgIHB1YmxpYyBhYnN0cmFjdCB2b2lkIHNldERpc3BsYXlPcHRpb25zKGludCBvcHRpb25zLCBpbnQgbWFzayk7CisgICAgCisgICAgLyoqCisgICAgICogU2V0IHRoZSBBY3Rpb25CYXIncyBiYWNrZ3JvdW5kLgorICAgICAqIAorICAgICAqIEBwYXJhbSBkIEJhY2tncm91bmQgZHJhd2FibGUKKyAgICAgKi8KKyAgICBwdWJsaWMgYWJzdHJhY3Qgdm9pZCBzZXRCYWNrZ3JvdW5kRHJhd2FibGUoRHJhd2FibGUgZCk7CisgICAgCisgICAgLyoqCisgICAgICogQHJldHVybiBUaGUgY3VycmVudCBjdXN0b20gbmF2aWdhdGlvbiB2aWV3LgorICAgICAqLworICAgIHB1YmxpYyBhYnN0cmFjdCBWaWV3IGdldEN1c3RvbU5hdmlnYXRpb25WaWV3KCk7CisgICAgCisgICAgLyoqCisgICAgICogUmV0dXJucyB0aGUgY3VycmVudCBBY3Rpb25CYXIgdGl0bGUgaW4gc3RhbmRhcmQgbW9kZS4KKyAgICAgKiBSZXR1cm5zIG51bGwgaWYge0BsaW5rICNnZXROYXZpZ2F0aW9uTW9kZSgpfSB3b3VsZCBub3QgcmV0dXJuCisgICAgICoge0BsaW5rICNOQVZJR0FUSU9OX01PREVfU1RBTkRBUkR9LiAKKyAgICAgKgorICAgICAqIEByZXR1cm4gVGhlIGN1cnJlbnQgQWN0aW9uQmFyIHRpdGxlIG9yIG51bGwuCisgICAgICovCisgICAgcHVibGljIGFic3RyYWN0IENoYXJTZXF1ZW5jZSBnZXRUaXRsZSgpOworICAgIAorICAgIC8qKgorICAgICAqIFJldHVybnMgdGhlIGN1cnJlbnQgQWN0aW9uQmFyIHN1YnRpdGxlIGluIHN0YW5kYXJkIG1vZGUuCisgICAgICogUmV0dXJucyBudWxsIGlmIHtAbGluayAjZ2V0TmF2aWdhdGlvbk1vZGUoKX0gd291bGQgbm90IHJldHVybgorICAgICAqIHtAbGluayAjTkFWSUdBVElPTl9NT0RFX1NUQU5EQVJEfS4gCisgICAgICoKKyAgICAgKiBAcmV0dXJuIFRoZSBjdXJyZW50IEFjdGlvbkJhciBzdWJ0aXRsZSBvciBudWxsLgorICAgICAqLworICAgIHB1YmxpYyBhYnN0cmFjdCBDaGFyU2VxdWVuY2UgZ2V0U3VidGl0bGUoKTsKKyAgICAKKyAgICAvKioKKyAgICAgKiBSZXR1cm5zIHRoZSBjdXJyZW50IG5hdmlnYXRpb24gbW9kZS4gVGhlIHJlc3VsdCB3aWxsIGJlIG9uZSBvZjoKKyAgICAgKiA8dWw+CisgICAgICogPGxpPntAbGluayAjTkFWSUdBVElP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ub3QgYSBjaGlsZCBvZiB0aGlzIGFjdGlvbiBiYXIgaXQgd2lsbCBiZSBhZGRlZC4KKyAgICAgKgorICAgICAqIEBwYXJhbSB0YWIgVGFiIHRvIHNlbGVjdAorICAgICAqLworICAgIHB1YmxpYyBhYnN0cmFjdCB2b2lkIHNlbGVjdFRhYihUYWIgdGFiKTsKKworICAgIC8qKgorICAgICAqIFJldHJpZXZlIHRoZSBjdXJyZW50IGhlaWdodCBvZiB0aGUgQWN0aW9uQmFyLgorICAgICAqCisgICAgICogQHJldHVybiBUaGUgQWN0aW9uQmFyJ3MgaGVpZ2h0CisgICAgICovCisgICAgcHVibGljIGFic3RyYWN0IGludCBnZXRIZWlnaHQoKTsKKworICAgIC8qKgorICAgICAqIFNob3cgdGhlIEFjdGlvbkJhciBpZiBpdCBpcyBub3QgY3VycmVudGx5IHNob3dpbmcuCisgICAgICogSWYgdGhlIHdpbmRvdyBob3N0aW5nIHRoZSBBY3Rpb25CYXIgZG9lcyBub3QgaGF2ZSB0aGUgZmVhdHVyZQorICAgICAqIHtAbGluayBXaW5kb3cjRkVBVFVSRV9BQ1RJT05fQkFSX09WRVJMQVl9IGl0IHdpbGwgcmVzaXplIGFwcGxpY2F0aW9uCisgICAgICogY29udGVudCB0byBmaXQgdGhlIG5ldyBzcGFjZSBhdmFpbGFibGUuCisgICAgICovCisgICAgcHVibGljIGFic3RyYWN0IHZvaWQgc2hvdygpOworCisgICAgLyoqCisgICAgICogSGlkZSB0aGUgQWN0aW9uQmFyIGlmIGl0IGlzIG5vdCBjdXJyZW50bHkgc2hvd2luZy4KKyAgICAgKiBJZiB0aGUgd2luZG93IGhvc3RpbmcgdGhlIEFjdGlvbkJhciBkb2VzIG5vdCBoYXZlIHRoZSBmZWF0dXJlCisgICAgICoge0BsaW5rIFdpbmRvdyNGRUFUVVJFX0FDVElPTl9CQVJfT1ZFUkxBWX0gaXQgd2lsbCByZXNpemUgYXBwbGljYXRpb24KKyAgICAgKiBjb250ZW50IHRvIG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gKiA8cD5UYWJzIG1hbmFnZSB0aGUgaGlkaW5nIGFuZCBzaG93aW5nIG9mIHtAbGluayBGcmFnbWVudH1zLgorICAgICAqLworICAgIHB1YmxpYyBzdGF0aWMgYWJzdHJhY3QgY2xhc3MgVGFiIHsKKyAgICAgICAgLyoqCisgICAgICAgICAqIEFuIGludmFsaWQgcG9zaXRpb24gZm9yIGEgdGFiLgorICAgICAgICAgKgorICAgICAgICAgKiBAc2VlICNnZXRQb3NpdGlvbigpCisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGludCBJTlZBTElEX1BPU0lUSU9OID0gLTE7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFJldHVybiB0aGUgY3VycmVudCBwb3NpdGlvbiBvZiB0aGlzIHRhYiBpbiB0aGUgYWN0aW9uIGJhci4KKyAgICAgICAgICoKKyAgICAgICAgICogQHJldHVybiBDdXJyZW50IHBvc2l0aW9uLCBvciB7QGxpbmsgI0lOVkFMSURfUE9TSVRJT059IGlmIHRoaXMgdGFiIGlzIG5vdCBjdXJyZW50bHkgaW4KKyAgICAgICAgICogICAgICAgICB0aGUgYWN0aW9uIGJhci4KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBhYnN0cmFjdCBpbnQgZ2V0UG9zaXRpb24oKTsKKworICAgICAgICAvKioKKyAgICAgICAgICogUmV0dXJuIHRoZSBpY29uIGFzc29jaWF0ZWQgd2l0aCB0aGlzIHRhYi4KKyAgICAgICAgICoKKyAgICAgICAgICogQHJldHVybiBUaGUgdGFiJ3MgaWNvbgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIGFic3RyYWN0IERyYXdhYmxlIGdldEljb24oKTsKKworICAgICAgICAvKioKKyAgICAgICAgICogUmV0dXJuIHRoZSB0ZXh0IG9mIHRoaXMgdGFiLgorICAgICAgICAgKgorICAgICAgICAgKiBAcmV0dXJuIFRoZSB0YWIncyB0ZXh0CisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgYWJzdHJhY3QgQ2hhclNlcXVlbmNlIGdldFRleHQoKTsKKworICAgICAgICAvKioKKyAgICAgICAgICogU2V0IHRoZSBpY29uIGRpc3BsYXllZCBvbiB0aGlzIHRhYi4KKyAgICAgICAgICoKKyAgICAgICAgICogQHBhcmFtIGljb24gVGhlIGRyYXdhYmxlIHRvIHVzZSBhcyBhbiBpY29uCisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgYWJzdHJhY3Qgdm9pZCBzZXRJY29uKERyYXdhYmxlIGljb24pOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBTZXQgdGhlIHRleHQgZGlzcGxheWVkIG9uIHRoaXMgdGFiLiBUZXh0IG1heSBiZSB0cnVuY2F0ZWQgaWYgdGhlcmUgaXMgbm90CisgICAgICAgICAqIHJvb20gdG8gZGlzcGxheSB0aGUgZW50aXJlIHN0cmluZy4KKyAgICAgICAgICoKKyAgICAgICAgICogQHBhcmFtIHRleHQgVGhlIHRleHQgdG8gZGlzcGxheQorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIGFic3RyYWN0IHZvaWQgc2V0VGV4dChDaGFyU2VxdWVuY2UgdGV4dCk7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFJldHVybnMgdGhlIGZyYWdtZW50IHRoYXQgd2lsbCBiZSBzaG93biB3aGVuIHRoaXMgdGFiIGlzIHNlbGVjdGVkLgorICAgICAgICAgKgorICAgICAgICAgKiBAcmV0dXJuIEZyYWdtZW50IGFzc29jaWF0ZWQgd2l0aCB0aGlzIHRhYgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIGFic3RyYWN0IEZyYWdtZW50IGdldEZyYWdtZW50KCk7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFNldCB0aGUgZnJhZ21lbnQgdGhhdCB3aWxsIGJlIHNob3duIHdoZW4gdGhpcyB0YWIgaXMgc2VsZWN0ZWQuCisgICAgICAgICAqCisgICAgICAgICAqIEBwYXJhbSBmcmFnbWVudCBGcmFnb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ygpIHsKKyAgICAgICAgT2JqZWN0IGFjdGl2aXR5ID0gb25SZXRhaW5Ob25Db25maWd1cmF0aW9uSW5zdGFuY2UoKTsKKyAgICAgICAgSGFzaE1hcDxTdHJpbmcsIE9iamVjdD4gY2hpbGRyZW4gPSBvblJldGFpbk5vbkNvbmZpZ3VyYXRpb25DaGlsZEluc3RhbmNlcygpOworICAgICAgICBBcnJheUxpc3Q8RnJhZ21lbnQ+IGZyYWdtZW50cyA9IG1GcmFnbWVudHMucmV0YWluTm9uQ29uZmlnKCk7CisgICAgICAgIGJvb2xlYW4gcmV0YWluTG9hZGVycyA9IGZhbHNlOworICAgICAgICBpZiAobUFsbExvYWRlck1hbmFnZXJzICE9IG51bGwpIHsKKyAgICAgICAgICAgIC8vIHBydW5lIG91dCBhbnkgbG9hZGVyIG1hbmFnZXJzIHRoYXQgd2VyZSBhbHJlYWR5IHN0b3BwZWQgYW5kIHNvCisgICAgICAgICAgICAvLyBoYXZlIG5vdGhpbmcgdXNlZnVsIHRvIHJldGFpbi4KKyAgICAgICAgICAgIGZvciAoaW50IGk9bUFsbExvYWRlck1hbmFnZXJzLnNpemUoKS0xOyBpPj0wOyBpLS0pIHsKKyAgICAgICAgICAgICAgICBMb2FkZXJNYW5hZ2VySW1wbCBsbSA9IG1BbGxMb2FkZXJNYW5hZ2Vycy52YWx1ZUF0KGkpOworICAgICAgICAgICAgICAgIGlmIChsbS5tUmV0YWluaW5nKSB7CisgICAgICAgICAgICAgICAgICAgIHJldGFpbkxvYWRlcnMgPSB0cnVlOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIGxtLmRvRGVzdHJveSgpOworICAgICAgICAgICAgICAgICAgICBtQWxsTG9hZGVyTWFuYWdlcnMucmVtb3ZlQXQoaSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIGlmIChhY3Rpdml0eSA9PSBudWxsICYmIGNoaWxkcmVuID09IG51bGwgJiYgZnJhZ21lbnRzID09IG51bGwgJiYgIXJldGFpbkxvYWRlcnMpIHsKKyAgICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICB9CisgICAgICAgIAorICAgICAgICBOb25Db25maWd1cmF0aW9uSW5zdGFuY2VzIG5jaSA9IG5ldyBOb25Db25maWd1cmF0aW9uSW5zdGFuY2VzKCk7CisgICAgICAgIG5jaS5hY3Rpdml0eSA9IGFjdGl2aXR5OworICAgICAgICBuY2kuY2hpbGRyZW4gPSBjaGlsZHJlbjsKKyAgICAgICAgbmNpLmZyYWdtZW50cyA9IGZyYWdtZW50czsKKyAgICAgICAgbmNpLmxvYWRlcnMgPSBtQWxsTG9hZGVyTWFuYWdlcnM7CisgICAgICAgIHJldHVybiBuY2k7CisgICAgfQorICAgIAogICAgIHB1YmxpYyB2b2lkIG9uTG93TWVtb3J5KCkgewogICAgICAgICBtQ2FsbGVkID0gdHJ1ZTsKICAgICB9CiAgICAgCiAgICAgLyoqCisgICAgICogUmV0dXJuIHRoZSBGcmFnbWVudE1hbmFnZXIgZm9yIGludGVyYWN0aW5nIHdpdGggZnJhZ21lbnRzIGFzc29jaWF0ZWQKKyAgICAgKiB3aXRoIHRoaXMgYWN0aXZpdHkuCisgICAgICovCisgICAgcHVibGljIEZyYWdtZW50TWFuYWdlciBnZXRGcmFnbWVudE1hbmFnZXIoKSB7CisgICAgICAgIHJldHVybiBtRnJhZ21lbnRzOworICAgIH0KKworICAgIC8qKgorICAgICAqIFN0YXJ0IGEgc2VyaWVzIG9mIGVkaXQgb3BlcmF0aW9ucyBvbiB0aGUgRnJhZ21lbnRzIGFzc29jaWF0ZWQgd2l0aAorICAgICAqIHRoaXMgYWN0aXZpdHkuCisgICAgICogQGRlcHJlY2F0ZWQgdXNlIHtAbGluayAjZ2V0RnJhZ21lbnRNYW5hZ2VyfS4KKyAgICAgKi8KKyAgICBARGVwcmVjYXRlZAorICAgIHB1YmxpYyBGcmFnbWVudFRyYW5zYWN0aW9uIG9w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FtIHNlbGVjdGlvbiBTUUwgV0hFUkUgY2xhdXNlLgpAQCAtMTUzMCwxMiArMTY4Miw4IEBACiAgICAgICogQHNlZSBDb250ZW50UmVzb2x2ZXIjcXVlcnkoYW5kcm9pZC5uZXQuVXJpICwgU3RyaW5nW10sIFN0cmluZywgU3RyaW5nW10sIFN0cmluZykKICAgICAgKiBAc2VlICNzdGFydE1hbmFnaW5nQ3Vyc29yCiAgICAgICovCi0gICAgcHVibGljIGZpbmFsIEN1cnNvciBtYW5hZ2VkUXVlcnkoVXJpIHVyaSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTdHJpbmdbXSBwcm9qZWN0aW9uLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFN0cmluZyBzZWxlY3Rpb24sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgU3RyaW5nW10gc2VsZWN0aW9uQXJncywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTdHJpbmcgc29ydE9yZGVyKQotICAgIHsKKyAgICBwdWJsaWMgZmluYWwgQ3Vyc29yIG1hbmFnZWRRdWVyeShVcmkgdXJpLCBTdHJpbmdbXSBwcm9qZWN0aW9uLCBTdHJpbmcgc2VsZWN0aW9uLAorICAgICAgICAgICAgU3RyaW5nW10gc2VsZWN0aW9uQXJncywgU3RyaW5nIHNvcnRPcmRlcikgewogICAgICAgICBDdXJzb3IgYyA9IGdldENvbnRlbnRSZXNvbHZlcigpLnF1ZXJ5KHVyaSwgcHJvamVjdGlvbiwgc2VsZWN0aW9uLCBzZWxlY3Rpb25BcmdzLCBzb3J0T3JkZXIpOwogICAgICAgICBpZiAoYyAhPSBudWxsKSB7CiAgICAgICAgICAgICBzdGFydE1hbmFnaW5nQ3Vyc29yKGMpOwpAQCAtMTU0NCw0MCArMTY5Miw2IEBACiAgICAgfQogCiAgICAgLyoqCi0gICAgICogV3JhcHBlciBhcm91bmQge0BsaW5rIEN1cn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bkJhcigpOwogICAgIH0KIAogICAgIC8qKgpAQCAtMTY3NSw2ICsxODQxLDcgQEAKICAgICAgKi8KICAgICBwdWJsaWMgdm9pZCBzZXRDb250ZW50VmlldyhWaWV3IHZpZXcpIHsKICAgICAgICAgZ2V0V2luZG93KCkuc2V0Q29udGVudFZpZXcodmlldyk7CisgICAgICAgIGluaXRBY3Rpb25CYXIoKTsKICAgICB9CiAKICAgICAvKioKQEAgLTE2ODcsNiArMTg1NCw3IEBACiAgICAgICovCiAgICAgcHVibGljIHZvaWQgc2V0Q29udGVudFZpZXcoVmlldyB2aWV3LCBWaWV3R3JvdXAuTGF5b3V0UGFyYW1zIHBhcmFtcykgewogICAgICAgICBnZXRXaW5kb3coKS5zZXRDb250ZW50Vmlldyh2aWV3LCBwYXJhbXMpOworICAgICAgICBpbml0QWN0aW9uQmFyKCk7CiAgICAgfQogCiAgICAgLyoqCkBAIC0xNjk4LDYgKzE4NjYsNyBAQAogICAgICAqLwogICAgIHB1YmxpYyB2b2lkIGFkZENvbnRlbnRWaWV3KFZpZXcgdmlldywgVmlld0dyb3VwLkxheW91dFBhcmFtcyBwYXJhbXMpIHsKICAgICAgICAgZ2V0V2luZG93KCkuYWRkQ29udGVudFZpZXcodmlldywgcGFyYW1zKTsKKyAgICAgICAgaW5pdEFjdGlvbkJhcigpOwogICAgIH0KIAogICAgIC8qKgpAQCAtMTkyMSwxMiArMjA5MCw2NSBAQAogICAgIH0KICAgICAKICAgICAvKioKKyAgICAgKiBGbGFnIGZvciB7QGxpbmsgI3BvcEJhY2tTdGFjayhTdHJpbmcsIGludCl9CisgICAgICogYW5kIHtAbGluayAjcG9wQmFja1N0YWNrKGludCwgaW50KX06IElmIHNldCwgYW5kIHRoZSBuYW1lIG9yIElEIG9mCisgICAgICogYSBiYWNrIHN0YWNrIGVudHJ5IGhhcyBiZWVuIHN1cHBsaWVkLCB0aGVuIGFsbCBtYXRjaGluZyBlbnRyaWVzIHdpbGwKKyAgICAgKiBiZSBjb25z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JZCA9PSBXaW5kb3cuRkVBVFVSRV9PUFRJT05TX1BBTkVMKSB7Ci0gICAgICAgICAgICByZXR1cm4gb25DcmVhdGVPcHRpb25zTWVudShtZW51KTsKKyAgICAgICAgICAgIGJvb2xlYW4gc2hvdyA9IG9uQ3JlYXRlT3B0aW9uc01lbnUobWVudSk7CisgICAgICAgICAgICBzaG93IHw9IG1GcmFnbWVudHMuZGlzcGF0Y2hDcmVhdGVPcHRpb25zTWVudShtZW51LCBnZXRNZW51SW5mbGF0ZXIoKSk7CisgICAgICAgICAgICByZXR1cm4gc2hvdzsKICAgICAgICAgfQogICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgfQpAQCAtMjE4MSw2ICsyNDA1LDcgQEAKICAgICBwdWJsaWMgYm9vbGVhbiBvblByZXBhcmVQYW5lbChpbnQgZmVhdHVyZUlkLCBWaWV3IHZpZXcsIE1lbnUgbWVudSkgewogICAgICAgICBpZiAoZmVhdHVyZUlkID09IFdpbmRvdy5GRUFUVVJFX09QVElPTlNfUEFORUwgJiYgbWVudSAhPSBudWxsKSB7CiAgICAgICAgICAgICBib29sZWFuIGdvZm9yaXQgPSBvblByZXBhcmVPcHRpb25zTWVudShtZW51KTsKKyAgICAgICAgICAgIGdvZm9yaXQgfD0gbUZyYWdtZW50cy5kaXNwYXRjaFByZXBhcmVPcHRpb25zTWVudShtZW51KTsKICAgICAgICAgICAgIHJldHVybiBnb2Zvcml0ICYmIG1lbnUuaGFzVmlzaWJsZUl0ZW1zKCk7CiAgICAgICAgIH0KICAgICAgICAgcmV0dXJuIHRydWU7CkBAIC0yMjExLDExICsyNDM2LDE3IEBACiAgICAgICAgICAgICAgICAgLy8gZG9lc24ndCBjYWxsIHRocm91Z2ggdG8gc3VwZXJjbGFzcydzIGltcGxtZWVudGF0aW9uIG9mIGVhY2gKICAgICAgICAgICAgICAgICAvLyBvZiB0aGVzZSBtZXRob2RzIGJlbG93CiAgICAgICAgICAgICAgICAgRXZlbnRMb2cud3JpdGVFdmVudCg1MDAwMCwgMCwgaXRlbS5nZXRUaXRsZUNvbmRlbnNlZCgpKTsKLSAgICAgICAgICAgICAgICByZXR1cm4gb25PcHRpb25zSXRlbVNlbGVjdGVkKGl0ZW0pOworICAgICAgICAgICAgICAgIGlmIChvbk9wdGlvbnNJdGVtU2VsZWN0ZWQoaXRlbSkpIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHJldHVybiBtRnJhZ21lbnRzLmRpc3BhdGNoT3B0aW9uc0l0ZW1TZWxlY3RlZChpdGVtKTsKICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgIGNhc2UgV2luZG93LkZFQVRVUkVfQ09OVEVYVF9NRU5VOgogICAgICAgICAgICAgICAgIEV2ZW50TG9nLndyaXRlRXZlbnQoNTAwMDAsIDEsIGl0ZW0uZ2V0VGl0bGVDb25kZW5zZWQoKSk7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIG9uQ29udGV4dEl0ZW1TZWxlY3RlZChpdGVtKTsKKyAgICAgICAgICAgICAgICBpZiAob25Db250ZXh0SXRlbVNlbGVjdGVkKGl0ZW0pKSB7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICByZXR1cm4gbUZyYWdtZW50cy5kaXNwYXRjaENvbnRleHRJdGVtU2VsZWN0ZWQoaXRlbSk7CiAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKQEAgLTIyMzQsNiArMjQ2NSw3IEBACiAgICAgcHVibGljIHZvaWQgb25QYW5lbENsb3NlZChpbnQgZmVhdHVyZUlkLCBNZW51IG1lbnUpIHsKICAgICAgICAgc3dpdGNoIChmZWF0dXJlSWQpIHsKICAgICAgICAgICAgIGNhc2UgV2luZG93LkZFQVRVUkVfT1BUSU9OU19QQU5FTDoKKyAgICAgICAgICAgICAgICBtRnJhZ21lbnRzLmRpc3BhdGNoT3B0aW9uc01lbnVDbG9zZWQobWVudSk7CiAgICAgICAgICAgICAgICAgb25PcHRpb25zTWVudUNsb3NlZChtZW51KTsKICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAKQEAgLTIyNDQsNiArMjQ3NiwxNSBAQAogICAgIH0KIAogICAgIC8qKgorICAgICAqIERlY2xhcmUgdGhhdCB0aGUgb3B0aW9ucyBtZW51IGhhcyBjaGFuZ2VkLCBzbyBzaG91bGQgYmUgcmVjcmVhdGVkLgorICAgICAqIFRoZSB7QGxpbmsgI29uQ3JlYXRlT3B0aW9uc01lbnUoTWVudSl9IG1ldGhvZCB3aWxsIGJlIGNhbGxlZCB0aGUgbmV4dAorICAgICAqIHRpbWUgaXQgbmVlZHMgdG8gYmUgZGlzcGxheWVkLgorICAgICAqLworICAgIHB1YmxpYyB2b2lkIGludmFsaWRhdGVPcHRpb25zTWVudSgpIHsKKyAgICAgICAgbVdpbmRvdy5pbnZhbGlkYXRlUGFuZWxNZW51KFdpbmRvdy5GRUFUVVJFX09QVElPTlNfUEFORUwpOworICAgIH0KKyAgICAKKyAgICAvKioKICAgICAgKiBJbml0aWFsaXplIHRoZSBjb250ZW50cyBvZiB0aGUgQWN0aXZpdHkncyBzdGFuZGFyZCBvcHRpb25zIG1lbnUuICBZb3UKICAgICAgKiBzaG91bGQgcGxhY2UgeW91ciBtZW51IGl0ZW1zIGluIHRvIDx2YXI+bWVudTwvdmFyPi4KICAgICAgKiAKQEAgLTI0NjYsNiArMjcwNyw5IEBACiAgICAgICogYnkgdGhlIGFjdGl2aXR5LiAgVGhlIGRlZmF1bHQgaW1wbGVtZW50YXRpb24gY2FsbHMgdGhyb3VnaCB0bwogICAgICAqIHtAbGluayAjb25DcmVhdGVEaWFsb2coaW50KX0gZm9yIGNvbXBhdGliaWxpdHkuCiAgICAgICoKKyAgICAgKiA8ZW0+SWYgeW91IGF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BwdWJsaWMgdm9pZCBzdGFydEFjdGl2aXR5RnJvbUZyYWdtZW50KEZyYWdtZW50IGZyYWdtZW50LCBJbnRlbnQgaW50ZW50LCAKKyAgICAgICAgICAgIGludCByZXF1ZXN0Q29kZSkgeworICAgICAgICBJbnN0cnVtZW50YXRpb24uQWN0aXZpdHlSZXN1bHQgYXIgPQorICAgICAgICAgICAgbUluc3RydW1lbnRhdGlvbi5leGVjU3RhcnRBY3Rpdml0eSgKKyAgICAgICAgICAgICAgICB0aGlzLCBtTWFpblRocmVhZC5nZXRBcHBsaWNhdGlvblRocmVhZCgpLCBtVG9rZW4sIGZyYWdtZW50LAorICAgICAgICAgICAgICAgIGludGVudCwgcmVxdWVzdENvZGUpOworICAgICAgICBpZiAoYXIgIT0gbnVsbCkgeworICAgICAgICAgICAgbU1haW5UaHJlYWQuc2VuZEFjdGl2aXR5UmVzdWx0KAorICAgICAgICAgICAgICAgIG1Ub2tlbiwgZnJhZ21lbnQubVdobywgcmVxdWVzdENvZGUsCisgICAgICAgICAgICAgICAgYXIuZ2V0UmVzdWx0Q29kZSgpLCBhci5nZXRSZXN1bHREYXRhKCkpOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqCiAgICAgICogTGlrZSB7QGxpbmsgI3N0YXJ0QWN0aXZpdHlGcm9tQ2hpbGQoQWN0aXZpdHksIEludGVudCwgaW50KX0sIGJ1dAogICAgICAqIHRha2luZyBhIEludGVudFNlbmRlcjsgc2VlCiAgICAgICoge0BsaW5rICNzdGFydEludGVudFNlbmRlckZvclJlc3VsdChJbnRlbnRTZW5kZXIsIGludCwgSW50ZW50LCBpbnQsIGludCwgaW50KX0KQEAgLTMyNDMsNiArMzUyMCwxOSBAQAogICAgIH0KIAogICAgIC8qKgorICAgICAqIENoZWNrIHRvIHNlZSB3aGV0aGVyIHRoaXMgYWN0aXZpdHkgaXMgaW4gdGhlIHByb2Nlc3Mgb2YgYmVpbmcgZGVzdHJveWVkIGluIG9yZGVyIHRvIGJlCisgICA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cuV2luZG93I2dldExheW91dEluZmxhdGVyCiAgICAgICovCiAgICAgcHVibGljIFZpZXcgb25DcmVhdGVWaWV3KFN0cmluZyBuYW1lLCBDb250ZXh0IGNvbnRleHQsIEF0dHJpYnV0ZVNldCBhdHRycykgewotICAgICAgICByZXR1cm4gbnVsbDsKKyAgICAgICAgaWYgKCEiZnJhZ21lbnQiLmVxdWFscyhuYW1lKSkgeworICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIFN0cmluZyBmbmFtZSA9IGF0dHJzLmdldEF0dHJpYnV0ZVZhbHVlKG51bGwsICJjbGFzcyIpOworICAgICAgICBUeXBlZEFycmF5IGEgPSAKKyAgICAgICAgICAgIGNvbnRleHQub2J0YWluU3R5bGVkQXR0cmlidXRlcyhhdHRycywgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHlsZWFibGUuRnJhZ21lbnQpOworICAgICAgICBpZiAoZm5hbWUgPT0gbnVsbCkgeworICAgICAgICAgICAgZm5hbWUgPSBhLmdldFN0cmluZyhjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0eWxlYWJsZS5GcmFnbWVudF9uYW1lKTsKKyAgICAgICAgfQorICAgICAgICBpbnQgaWQgPSBhLmdldFJlc291cmNlSWQoY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHlsZWFibGUuRnJhZ21lbnRfaWQsIDApOworICAgICAgICBTdHJpbmcgdGFnID0gYS5nZXRTdHJpbmcoY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHlsZWFibGUuRnJhZ21lbnRfdGFnKTsKKyAgICAgICAgYS5yZWN5Y2xlKCk7CisgICAgICAgIAorICAgICAgICBpZiAoaWQgPT0gMCkgeworICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbihhdHRycy5nZXRQb3NpdGlvbkRlc2NyaXB0aW9uKCkKKyAgICAgICAgICAgICAgICAgICAgKyAiOiBNdXN0IHNwZWNpZnkgdW5pcXVlIGFuZHJvaWQ6aWQgZm9yICIgKyBmbmFtZSk7CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIC8vIElmIHdlIHJlc3RvcmVkIGZyb20gYSBwcmV2aW91cyBzdGF0ZSwgd2UgbWF5IGFscmVhZHkgaGF2ZQorICAgICAgICAvLyBpbnN0YW50aWF0ZWQgdGhpcyBmcmFnbWVudCBmcm9tIHRoZSBzdGF0ZSBhbmQgc2hvdWxkIHVzZQorICAgICAgICAvLyB0aGF0IGluc3RhbmNlIGluc3RlYWQgb2YgbWFraW5nIGEgbmV3IG9uZS4KKyAgICAgICAgRnJhZ21lbnQgZnJhZ21lbnQgPSBtRnJhZ21lbnRzLmZpbmRGcmFnbWVudEJ5SWQoaWQpOworICAgICAgICBpZiAoRnJhZ21lbnRNYW5hZ2VySW1wbC5ERUJVRykgTG9nLnYoVEFHLCAib25DcmVhdGVWaWV3OiBpZD0weCIKKyAgICAgICAgICAgICAgICArIEludGVnZXIudG9IZXhTdHJpbmcoaWQpICsgIiBmbmFtZT0iICsgZm5hbWUKKyAgICAgICAgICAgICAgICArICIgZXhpc3Rpbmc9IiArIGZyYWdtZW50KTsKKyAgICAgICAgaWYgKGZyYWdtZW50ID09IG51bGwpIHsKKyAgICAgICAgICAgIGZyYWdtZW50ID0gRnJhZ21lbnQuaW5zdGFudGlhdGUodGhpcywgZm5hbWUpOworICAgICAgICAgICAgZnJhZ21lbnQubUZyb21MYXlvdXQgPSB0cnVlOworICAgICAgICAgICAgZnJhZ21lbnQubUZyYWdtZW50SWQgPSBpZDsKKyAgICAgICAgICAgIGZyYWdtZW50Lm1UYWcgPSB0YWc7CisgICAgICAgICAgICBmcmFnbWVudC5tSW1tZWRpYXRlQWN0aXZpdHkgPSB0aGlzOworICAgICAgICAgICAgLy8gSWYgdGhpcyBmcmFnbWVudCBpcyBuZXdseSBpbnN0YW50aWF0ZWQgKGVpdGhlciByaWdodCBub3csIG9yCisgICAgICAgICAgICAvLyBmcm9tIGxhc3Qgc2F2ZWQgc3RhdGUpLCB0aGVuIGdpdmUgaXQgdGhlIGF0dHJpYnV0ZXMgdG8KKyAgICAgICAgICAgIC8vIGluaXRpYWxpemUgaXRzZWxmLgorICAgICAgICAgICAgaWYgKCFmcmFnbWVudC5tUmV0YWluaW5nKSB7CisgICAgICAgICAgICAgICAgZnJhZ21lbnQub25JbmZsYXRlKGF0dHJzLCBmcmFnbWVudC5tU2F2ZWRGcmFnbWVudFN0YXRlKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1GcmFnbWVudHMuYWRkRnJhZ21lbnQoZnJhZ21lbnQsIHRydWUpOworICAgICAgICB9CisgICAgICAgIGlmIChmcmFnbWVudC5tVmlldyA9PSBudWxsKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJGcmFnbWVudCAiICsgZm5hbWUKKyAgICAgICAgICAgICAgICAgICAgKyAiIGRpZCBub3QgY3JlYXRlIGEgdmlldy4iKTsKKyAgICAgICAgfQorICAgICAgICBmcmFnbWVudC5tVmlldy5zZXRJZChpZCk7CisgICAgICAgIGlmIChmcmFnbWVudC5tVmlldy5nZXRUYWcoKSA9PSBudWxsKSB7CisgICAgICAgICAgICBmcmFnbWVudC5tVmlldy5zZXRUYWcodGFnKTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gZnJhZ21lbnQubVZpZXc7CiAgICAgfQogCiAgICAgLyoqCkBAIC0zNzc5LDYgKzQxMTgsMjYgQEAKICAgICAgICAgfQogICAgIH0KIAorICAgIC8qKgorICAgICAqIFN0YXJ0IGEgY29udGV4dCBtb2RlLgorICAgICAqCisgICAgICogQHBhcmFtIGNhbGxiYWNrIENhbGxiYWNrIHRoYXQgd2lsbCBtYW5hZ2UgbGlmZWN5Y2xlIGV2ZW50cyBmb3IgdGhpcyBjb250ZXh0IG1vZGUKKyAgICAgKiBAcmV0dXJuIFRoZSBDb250Z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hc3ROb25Db25maWd1cmF0aW9uQ2hpbGRJbnN0YW5jZXM7CisgICAgICAgIG1MYXN0Tm9uQ29uZmlndXJhdGlvbkluc3RhbmNlcyA9IGxhc3ROb25Db25maWd1cmF0aW9uSW5zdGFuY2VzOwogCi0gICAgICAgIG1XaW5kb3cuc2V0V2luZG93TWFuYWdlcihudWxsLCBtVG9rZW4sIG1Db21wb25lbnQuZmxhdHRlblRvU3RyaW5nKCkpOworICAgICAgICBtV2luZG93LnNldFdpbmRvd01hbmFnZXIobnVsbCwgbVRva2VuLCBtQ29tcG9uZW50LmZsYXR0ZW5Ub1N0cmluZygpLAorICAgICAgICAgICAgICAgIChpbmZvLmZsYWdzICYgQWN0aXZpdHlJbmZvLkZMQUdfSEFSRFdBUkVfQUNDRUxFUkFURUQpICE9IDApOwogICAgICAgICBpZiAobVBhcmVudCAhPSBudWxsKSB7CiAgICAgICAgICAgICBtV2luZG93LnNldENvbnRhaW5lcihtUGFyZW50LmdldFdpbmRvdygpKTsKICAgICAgICAgfQpAQCAtMzgzNSwxNCArNDE5NiwyNiBAQAogICAgICAgICByZXR1cm4gbVBhcmVudCAhPSBudWxsID8gbVBhcmVudC5nZXRBY3Rpdml0eVRva2VuKCkgOiBtVG9rZW47CiAgICAgfQogCisgICAgZmluYWwgdm9pZCBwZXJmb3JtQ3JlYXRlKEJ1bmRsZSBpY2ljbGUpIHsKKyAgICAgICAgb25DcmVhdGUoaWNpY2xlKTsKKyAgICAgICAgbUZyYWdtZW50cy5kaXNwYXRjaEFjdGl2aXR5Q3JlYXRlZCgpOworICAgIH0KKyAgICAKICAgICBmaW5hbCB2b2lkIHBlcmZvcm1TdGFydCgpIHsKICAgICAgICAgbUNhbGxlZCA9IGZhbHNlOworICAgICAgICBtRnJhZ21lbnRzLmV4ZWNQZW5kaW5nQWN0aW9ucygpOwogICAgICAgICBtSW5zdHJ1bWVudGF0aW9uLmNhbGxBY3Rpdml0eU9uU3RhcnQodGhpcyk7CiAgICAgICAgIGlmICghbUNhbGxlZCkgewogICAgICAgICAgICAgdGhyb3cgbmV3IFN1cGVyTm90Q2FsbGVkRXhjZXB0aW9uKAogICAgICAgICAgICAgICAgICJBY3Rpdml0eSAiICsgbUNvbXBvbmVudC50b1Nob3J0U3RyaW5nKCkgKwogICAgICAgICAgICAgICAgICIgZGlkIG5vdCBjYWxsIHRocm91Z2ggdG8gc3VwZXIub25TdGFydCgpIik7CiAgICAgICAgIH0KKyAgICAgICAgbUZyYWdtZW50cy5kaXNwYXRjaFN0YXJ0KCk7CisgICAgICAgIGlmIChtQWxsTG9hZGVyTWFuYWdlcnMgIT0gbnVsbCkgeworICAgICAgICAgICAgZm9yIChpbnQgaT1tQWxsTG9hZGVyTWFuYWdlcnMuc2l6ZSgpLTE7IGk+PTA7IGktLSkgeworICAgICAgICAgICAgICAgIG1BbGxMb2FkZXJNYW5hZ2Vycy52YWx1ZUF0KGkpLmZpbmlzaFJldGFpbigpOworICAgICAgICAgICAgfQorICAgICAgICB9CiAgICAgfQogICAgIAogICAgIGZpbmFsIHZvaWQgcGVyZm9ybVJlc3RhcnQoKSB7CkBAIC0zODUxLDcgKzQyMjQsMTAgQEAKICAgICAgICAgICAgIGZvciAoaW50IGk9MDsgaTxOOyBpKyspIHsKICAgICAgICAgICAgICAgICBNYW5hZ2VkQ3Vyc29yIG1jID0gbU1hbmFnZWRDdXJzb3JzLmdldChpKTsKICAgICAgICAgICAgICAgICBpZiAobWMubVJlbGVhc2VkIHx8IG1jLm1VcGRhdGVkKSB7Ci0gICAgICAgICAgICAgICAgICAgIG1jLm1DdXJzb3IucmVxdWVyeSgpOworICAgICAgICAgICAgICAgICAgICBpZiAoIW1jLm1DdXJzb3IucmVxdWVyeSgpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAidHJ5aW5nIHRvIHJlcXVlcnkgYW4gYWxyZWFkeSBjbG9zZWQgY3Vyc29yIik7CisgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgbWMubVJlbGVhc2VkID0gZmFsc2U7CiAgICAgICAgICAgICAgICAgICAgIG1jLm1VcGRhdGVkID0gZmFsc2U7CiAgICAgICAgICAgICAgICAgfQpAQCAtMzg3NCw3ICs0MjUwLDkgQEAKICAgICBmaW5hbCB2b2lkIHBlcmZvcm1SZXN1bWUoKSB7CiAgICAgICAgIHBlcmZvcm1SZXN0YXJ0KCk7CiAgICAgICAgIAotICAgICAgICBtTGFzdE5vbkNvbmZpZ3VyYXRpb25JbnN0YW5jZSA9IG51bGw7CisgICAgICAgIG1GcmFnbWVudHMuZXhlY1BlbmRpbmdBY3Rpb25zKCk7CisgICAgICAgIAorICAgICAgICBtTGFzdE5vbkNvbmZpZ3VyYXRpb25JbnN0YW5jZXMgPSBudWxsOwogICAgICAgICAKICAgICAgICAgLy8gRmlyc3QgY2FsbCBvblJlc3VtZSgpIC1iZWZvcmUtIHNldHRpbmcgbVJlc3VtZWQsIHNvIHdlIGRvbid0CiAgICAgICAgIC8vIHNlbmQgb3V0IGFueSBzdGF0dXMgYmFyIC8gbWVudSBub3RpZmljYXRpb25zIHRoZSBjbGllbnQgbWFrZXMuCkBAIC0zODg5LDYgKzQyNjcsMTAgQEAKICAgICAgICAgLy8gTm93IHJlYWxseSByZXN1bWUsIGFuZCBpbnN0YWxsIHRoZSBjdXJyZW50IHN0YXR1cyBiYXIgYW5kIG1lbnUuCiAgICAgICAgIG1SZXN1bWVkID0gdHJ1ZTsKICAgICAgICAgbUNhbGxlZCA9IGZhbHNlOworICAgICAgICAKKyAgICAgICAgbUZyYWdtZW50cy5kaXNwYXRjaFJlc3VtZSgpOworICAgICAgICBtRnJhZ21lbnRzLmV4ZWNQZW5kaW5nQWN0aW9ucygpOworICAgICAgICAKICAgICAgICAgb25Qb3N0UmVzdW1lKCk7CiAgICAgICAgIGlmICghbUNhbGxlZCkgewogICAgICAgICAgICAgdGhyb3cgbmV3IFN1cGVyTm90Q2FsbGVkRXhjZXB0aW9uKApAQCAtMzg5OCw2ICs0MjgwLDcgQEAKICAgICB9CiAKICAgICBmaW5hbCB2b2lkIHBlcmZvcm1QYXVzZSgpIHsKKyAgICAgICAgbUZyYWdtZW50cy5kaXNwYXRjaFBhdXNlKCk7CiAgICAgICAgIG9uUGF1c2UoKTsKICAgICB9CiAgICAgCkBAIC0zOTA3LDExICs0MjkwLDI0IEBACiAgICAgfQogICAgIAogICAgIGZpbmFsIHZvaWQgcGVyZm9ybVN0b3AoKSB7CisgICAgICAgIGlmIChtU3RhcnRlZCkgeworICAgICAgICAgICAgbVN0YXJ0ZWQgPSBmYWxzZTsKKyAgICAgICAgICAgIGlmIChtTG9hZGVyTWFuYWdlciAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgaWYgKCFtQ2hhbmdpbmdDb25maWd1cmF0aW9ucykgeworICAgICAgICAgICAgICAgICAgICBtTG9hZGVyTWFuYWdlci5kb1N0b3AoKTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICBtTG9hZGVyTWFuYWdlci5kb1JldGFpbigpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICAKICAgICAgICAgaWYgKCFtU3RvcHBlZCkgewogICAgICAgICAgICAgaWYgKG1XaW5kb3cgIT0gbnVsbCkgewogICAgICAgICAgICAgICAgIG1XaW5kb3cuY2xvc2VBbGxQYW5lbHMoKTsKICAgICAgICAgICAgIH0KIAorICAgICAgICAgICAgbUZyYWdtZW50cy5kaXNwYXRjaFN0b3AoKTsKKyAgICAgICAgICAgIAogICAgICAgICAgICAgbUNhbGxlZCA9IGZhbHNlOwogICAgICAgICAgICAgbUluc3RydW1lbnRhdGlvbi5jYWxsQWN0aXZpdHlPblN0b3AodGhpcyk7CiAgICAgICAgICAgICBpZiAoIW1DYWxsZWQpIHsKQEAgLTM5MzYsNi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JOYXRpdmUuamF2YQppbmRleCA5YTU1YTZmLi5hOTMxODRkIDEwMDY0NAotLS0gYS9jb3JlL2phdmEvYW5kcm9pZC9hcHAvQWN0aXZpdHlNYW5hZ2VyTmF0aXZlLmphdmEKKysrIGIvY29yZS9qYXZhL2FuZHJvaWQvYXBwL0FjdGl2aXR5TWFuYWdlck5hdGl2ZS5qYXZhCkBAIC0xMjk1LDYgKzEyOTUsMTkgQEAKICAgICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgICB9CiAKKyAgICAgICAgY2FzZSBEVU1QX0hFQVBfVFJBTlNBQ1RJT046IHsKKyAgICAgICAgICAgIGRhdGEuZW5mb3JjZUludGVyZmFjZShJQWN0aXZpdHlNYW5hZ2VyLmRlc2NyaXB0b3IpOworICAgICAgICAgICAgU3RyaW5nIHByb2Nlc3MgPSBkYXRhLnJlYWRTdHJpbmcoKTsKKyAgICAgICAgICAgIGJvb2xlYW4gbWFuYWdlZCA9IGRhdGEucmVhZEludCgpICE9IDA7CisgICAgICAgICAgICBTdHJpbmcgcGF0aCA9IGRhdGEucmVhZFN0cmluZygpOworICAgICAgICAgICAgUGFyY2VsRmlsZURlc2NyaXB0b3IgZmQgPSBkYXRhLnJlYWRJbnQoKSAhPSAwCisgICAgICAgICAgICAgICAgICAgID8gZGF0YS5yZWFkRmlsZURlc2NyaXB0b3IoKSA6IG51bGw7CisgICAgICAgICAgICBib29sZWFuIHJlcyA9IGR1bXBIZWFwKHByb2Nlc3MsIG1hbmFnZWQsIHBhdGgsIGZkKTsKKyAgICAgICAgICAgIHJlcGx5LndyaXRlTm9FeGNlcHRpb24oKTsKKyAgICAgICAgICAgIHJlcGx5LndyaXRlSW50KHJlcyA/IDEgOiAwKTsKKyAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICB9CisKICAgICAgICAgfQogICAgICAgICAKICAgICAgICAgcmV0dXJuIHN1cGVyLm9uVHJhbnNhY3QoY29kZSwgZGF0YSwgcmVwbHksIGZsYWdzKTsKQEAgLTI4NzUsNiArMjg4OCwyOCBAQAogICAgICAgICBkYXRhLnJlY3ljbGUoKTsKICAgICAgICAgcmVwbHkucmVjeWNsZSgpOwogICAgIH0KLSAgICAKKworICAgIHB1YmxpYyBib29sZWFuIGR1bXBIZWFwKFN0cmluZyBwcm9jZXNzLCBib29sZWFuIG1hbmFnZWQsCisgICAgICAgICAgICBTdHJpbmcgcGF0aCwgUGFyY2VsRmlsZURlc2NyaXB0b3IgZmQpIHRocm93cyBSZW1vdGVFeGNlcHRpb24geworICAgICAgICBQYXJjZWwgZGF0YSA9IFBhcmNlbC5vYnRhaW4oKTsKKyAgICAgICAgUGFyY2VsIHJlcGx5ID0gUGFyY2VsLm9idGFpbigpOworICAgICAgICBkYXRhLndyaXRlSW50ZXJmYWNlVG9rZW4oSUFjdGl2aXR5TWFuYWdlci5kZXNjcmlwdG9yKTsKKyAgICAgICAgZGF0YS53cml0ZVN0cmluZyhwcm9jZXNzKTsKKyAgICAgICAgZGF0YS53cml0ZUludChtYW5hZ2VkID8gMSA6IDApOworICAgICAgICBkYXRhLndyaXRlU3RyaW5nKHBhdGgpOworICAgICAgICBpZiAoZmQgIT0gbnVsbCkgeworICAgICAgICAgICAgZGF0YS53cml0ZUludCgxKTsKKyAgICAgICAgICAgIGZkLndyaXRlVG9QYXJjZWwoZGF0YSwgUGFyY2VsYWJsZS5QQVJDRUxBQkxFX1dSSVRFX1JFVFVSTl9WQUxVRSk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBkYXRhLndyaXRlSW50KDApOworICAgICAgICB9CisgICAgICAgIG1SZW1vdGUudHJhbnNhY3QoRFVNUF9IRUFQX1RSQU5TQUNUSU9OLCBkYXRhLCByZXBseSwgMCk7CisgICAgICAgIHJlcGx5LnJlYWRFeGNlcHRpb24oKTsKKyAgICAgICAgYm9vbGVhbiByZXMgPSByZXBseS5yZWFkSW50KCkgIT0gMDsKKyAgICAgICAgcmVwbHkucmVjeWNsZSgpOworICAgICAgICB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TsgaSsrKSB7CiAgICAgICAgICAgICAgICAgICAgIERiU3RhdHMgZGJTdGF0cyA9IHN0YXRzLmRiU3RhdHMuZ2V0KGkpOwogICAgICAgICAgICAgICAgICAgICBwcmludFJvdyhwdywgREJfSU5GT19GT1JNQVQsIGRiU3RhdHMucGFnZVNpemUsIGRiU3RhdHMuZGJTaXplLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRiU3RhdHMubG9va2FzaWRlLCBkYlN0YXRzLmRiTmFtZSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGJTdGF0cy5sb29rYXNpZGUsIGRiU3RhdHMuY2FjaGUsIGRiU3RhdHMuZGJOYW1lKTsKICAgICAgICAgICAgICAgICAgICAgcHcucHJpbnQoJywnKTsKICAgICAgICAgICAgICAgICB9CiAKQEAgLTgxMiwxMSArODI0LDEyIEBACiAgICAgICAgICAgICBpbnQgTiA9IHN0YXRzLmRiU3RhdHMuc2l6ZSgpOwogICAgICAgICAgICAgaWYgKE4gPiAwKSB7CiAgICAgICAgICAgICAgICAgcHcucHJpbnRsbigiIERBVEFCQVNFUyIpOwotICAgICAgICAgICAgICAgIHByaW50Um93KHB3LCAiICAlOHMgJThzICUxMHMgICVzIiwgIlBhZ2VzaXplIiwgIkRic2l6ZSIsICJMb29rYXNpZGUiLCAiRGJuYW1lIik7CisgICAgICAgICAgICAgICAgcHJpbnRSb3cocHcsICIgICU0cyAlNnMgJThzICUxNHMgICVzIiwgInBnc3oiLCAiZGJzeiIsICJsa2FzaWRlIiwgImNhY2hlIiwKKyAgICAgICAgICAgICAgICAgICAgIkRibmFtZSIpOwogICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgTjsgaSsrKSB7CiAgICAgICAgICAgICAgICAgICAgIERiU3RhdHMgZGJTdGF0cyA9IHN0YXRzLmRiU3RhdHMuZ2V0KGkpOwogICAgICAgICAgICAgICAgICAgICBwcmludFJvdyhwdywgREJfSU5GT19GT1JNQVQsIGRiU3RhdHMucGFnZVNpemUsIGRiU3RhdHMuZGJTaXplLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRiU3RhdHMubG9va2FzaWRlLCBkYlN0YXRzLmRiTmFtZSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGJTdGF0cy5sb29rYXNpZGUsIGRiU3RhdHMuY2FjaGUsIGRiU3RhdHMuZGJOYW1lKTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CiAKQEAgLTg3NCw2ICs4ODcsNyBAQAogICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGludCBFTkFCTEVfSklUICAgICAgICAgICAgICA9IDEzMjsKICAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBpbnQgRElTUEFUQ0hfUEFDS0FHRV9CUk9BRENBU1QgPSAxMzM7CiAgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgaW50IFNDSEVEVUxFX0NSQVNIICAgICAgICAgID0gMTM0OworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGludCBEVU1QX0hFQVAgICAgICAgICAgICAgICA9IDEzNTsKICAgICAgICAgU3RyaW5nIGNvZGVUb1N0cmluZyhpbnQgY29kZSkgewogICAgICAgICAgICAgaWYgKGxvY2FsTE9HVikgewogICAgICAgICAgICAgICAgIHN3aXRjaCAoY29kZSkgewpAQCAtOTEyLDYgKzkyNiw3IEBACiAgICAgICAgICAgICAgICAgICAgIGNhc2UgRU5BQkxFX0pJVDogcmV0dXJuICJFTkFCTEVfSklUIjsKICAgICAgICAgICAgICAgICAgICAgY2FzZSBESVNQQVRDSF9QQUNLQUdFX0JST0FEQ0FTVDogcmV0dXJuICJESVNQQVRDSF9QQUNLQUdFX0JST0FEQ0FTVCI7CiAgICAgICAgICAgICAgICAgICAgIGNhc2UgU0NIRURVTEVfQ1JBU0g6IHJldHVybiAiU0NIRURVTEVfQ1JBU0giOworICAgICAgICAgICAgICAgICAgICBjYXNlIERVTVBfSEVBUDogcmV0dXJuICJEVU1QX0hFQVAiOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KICAgICAgICAgICAgIHJldHVybiAiKHVua25vd24pIjsKQEAgLTEwMzcsMTMgKzEwNTIsMzUgQEAKICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgY2FzZSBTQ0hFRFVMRV9DUkFTSDoKICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFJlbW90ZVNlcnZpY2VFeGNlcHRpb24oKFN0cmluZyltc2cub2JqKTsKKyAgICAgICAgICAgICAgICBjYXNlIERVTVBfSEVBUDoKKyAgICAgICAgICAgICAgICAgICAgaGFuZGxlRHVtcEhlYXAobXNnLmFyZzEgIT0gMCwgKER1bXBIZWFwRGF0YSltc2cub2JqKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KIAogICAgICAgICB2b2lkIG1heWJlU25hcHNob3QoKSB7CiAgICAgICAgICAgICBpZiAobUJvdW5kQXBwbGljYXRpb24gIT0gbnVsbCkgewotICAgICAgICAgICAgICAgIFNhbXBsaW5nUHJvZmlsZXJJbnRlZ3JhdGlvbi53cml0ZVNuYXBzaG90KAotICAgICAgICAgICAgICAgICAgICAgICAgbUJvdW5kQXBwbGljYXRpb24ucHJvY2Vzc05hbWUpOworICAgICAgICAgICAgICAgIC8vIGNvbnZlcnQgdGhlICpwcml2YXRlKiBBY3Rpdml0eVRocmVhZC5QYWNrYWdlSW5mbyB0byAqcHVibGljKiBrbm93bgorICAgICAgICAgICAgICAgIC8vIGFuZHJvaWQuY29udGVudC5wbS5QYWNrYWdlSW5mbworICAgICAgICAgICAgICAgIFN0cmluZyBwYWNrYWdlTmFtZSA9IG1Cb3VuZEFwcGxpY2F0aW9uLmluZm8ubVBhY2thZ2VOYW1lOworICAgICAgICAgICAgICAgIGFuZHJvaWQuY29udGVudC5wbS5QYWNrYWdlSW5mbyBwYWNrYWdlSW5mbyA9IG51bGw7CisgICAgICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICAgICAgQ29udGV4dCBjb250ZXh0ID0gZ2V0U3lzdGVtQ29udGV4dCgpOworICAgICAgICAgICAgICAgICAgICBpZihjb250ZXh0ID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIExvZy5lKFRBRywgImNhbm5vdCBnZXQgYSB2YWxpZCBjb250ZXh0Iik7CisgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgUGFja2FnZU1hbmFnZXIgcG0gPSBjb250ZXh0LmdldFBhY2thZ2VNYW5hZ2VyKCk7CisgICAgICAgICAgICAgICAgICAgIGlmKHBtID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIExvZy5lKFRBRywgImNhbm5vdCBnZXQgYSB2YWxpZCBQYWNrYWdlTWFuYWdlciIpOworICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIHBhY2thZ2VJbmZvID0gcG0uZ2V0UGFja2FnZUluZm8oCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFja2FnZU5hbWUsIFBhY2thZ2VNYW5hZ2VyLkdFVF9BQ1RJVklUSUVTKTsKKyAgICAgICAgICAgICAgICB9IGNhdGNoIChOYW1lTm90Rm91bmRFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgICAgICBMb2cuZShUQUcsICJjYW5ub3QgZ2V0IHBhY2thZ2UgaW5mbyBmb3IgIiArIHBhY2thZ2VOYW1lLCBlKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgU2FtcGxpbmdQcm9maWxlckludGVncmF0aW9uLndyaXRlU25hcHNob3QobUJvdW5kQXBwbGljYXRpb24ucHJvY2Vzc05hbWUsIHBhY2thZ2VJbmZvKTsKICAgICAgICAgICAgIH0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1NjUsMTQgKzE2MDIsMTIgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICsgci5hY3Rpdml0eUluZm8ubmFtZSArICIgd2l0aCBjb25maWcgIiArIGNvbmZpZyk7CiAgICAgICAgICAgICAgICAgYWN0aXZpdHkuYXR0YWNoKGFwcENvbnRleHQsIHRoaXMsIGdldEluc3RydW1lbnRhdGlvbigpLCByLnRva2VuLAogICAgICAgICAgICAgICAgICAgICAgICAgci5pZGVudCwgYXBwLCByLmludGVudCwgci5hY3Rpdml0eUluZm8sIHRpdGxlLCByLnBhcmVudCwKLSAgICAgICAgICAgICAgICAgICAgICAgIHIuZW1iZWRkZWRJRCwgci5sYXN0Tm9uQ29uZmlndXJhdGlvbkluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgci5sYXN0Tm9uQ29uZmlndXJhdGlvbkNoaWxkSW5zdGFuY2VzLCBjb25maWcpOworICAgICAgICAgICAgICAgICAgICAgICAgci5lbWJlZGRlZElELCByLmxhc3ROb25Db25maWd1cmF0aW9uSW5zdGFuY2VzLCBjb25maWcpOwogCiAgICAgICAgICAgICAgICAgaWYgKGN1c3RvbUludGVudCAhPSBudWxsKSB7CiAgICAgICAgICAgICAgICAgICAgIGFjdGl2aXR5Lm1JbnRlbnQgPSBjdXN0b21JbnRlbnQ7CiAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIHIubGFzdE5vbkNvbmZpZ3VyYXRpb25JbnN0YW5jZSA9IG51bGw7Ci0gICAgICAgICAgICAgICAgci5sYXN0Tm9uQ29uZmlndXJhdGlvbkNoaWxkSW5zdGFuY2VzID0gbnVsbDsKKyAgICAgICAgICAgICAgICByLmxhc3ROb25Db25maWd1cmF0aW9uSW5zdGFuY2VzID0gbnVsbDsKICAgICAgICAgICAgICAgICBhY3Rpdml0eS5tU3RhcnRlZEFjdGl2aXR5ID0gZmFsc2U7CiAgICAgICAgICAgICAgICAgaW50IHRoZW1lID0gci5hY3Rpdml0eUluZm8uZ2V0VGhlbWVSZXNvdXJjZSgpOwogICAgICAgICAgICAgICAgIGlmICh0aGVtZSAhPSAwKSB7CkBAIC0yNTQxLDYgKzI1NzYsOSBAQAogICAgICAgICAgICAgaWYgKGZpbmlzaGluZykgewogICAgICAgICAgICAgICAgIHIuYWN0aXZpdHkubUZpbmlzaGVkID0gdHJ1ZTsKICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmIChnZXROb25Db25maWdJbnN0YW5jZSkgeworICAgICAgICAgICAgICAgIHIuYWN0aXZpdHkubUNoYW5naW5nQ29uZmlndXJhdGlvbnMgPSB0cnVlOworICAgICAgICAgICAgfQogICAgICAgICAgICAgaWYgKCFyLnBhdXNlZCkgewogICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgIHIuYWN0aXZpdHkubUNhbGxlZCA9IGZhbHNlOwpAQCAtMjU4MSw4ICsyNjE5LDggQEAKICAgICAgICAgICAgIH0KICAgICAgICAgICAgIGlmIChnZXROb25Db25maWdJbnN0YW5jZSkgewogICAgICAgICAgICAgICAgIHRyeSB7Ci0gICAgICAgICAgICAgICAgICAgIHIubGFzdE5vbkNvbmZpZ3VyYXRpb25JbnN0YW5jZQotICAgICAgICAgICAgICAgICAgICAgICAgICAgID0gci5hY3Rpdml0eS5vblJldGFpbk5vbkNvbmZpZ3VyYXRpb25JbnN0YW5jZSgpOworICAgICAgICAgICAgICAgICAgICByLmxhc3ROb25Db25maWd1cmF0aW9uSW5zdGFuY2VzCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgPSByLmFjdGl2aXR5LnJldGFpbk5vbkNvbmZpZ3VyYXRpb25JbnN0YW5jZXMoKTsKICAgICAgICAgICAgICAgICB9IGNhdGNoIChFeGNlcHRpb24gZSkgewogICAgICAgICAgICAgICAgICAgICBpZiAoIW1JbnN0cnVtZW50YXRpb24ub25FeGNlcHRpb24oci5hY3Rpdml0eSwgZSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBSdW50aW1lRXhjZXB0aW9uKApAQCAtMjU5MSwyMiArMjYyOSwxMCBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArICI6ICIgKyBlLnRvU3RyaW5nKCksIGUpOwogICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIHRyeSB7Ci0gICAgICAgICAgICAgICAgICAgIHIubGFzdE5vbkNvbmZpZ3VyYXRpb25DaGlsZEluc3RhbmNlcwotICAgICAgICAgICAgICAgICAgICAgICAgICAgID0gci5hY3Rpdml0eS5vblJldGFpbk5vbkNvbmZpZ3VyYXRpb25DaGlsZEluc3RhbmNlcygpOwotICAgICAgICAgICAgICAgIH0gY2F0Y2ggKEV4Y2VwdGlvbiBlKSB7Ci0gICAgICAgICAgICAgICAgICAgIGlmICghbUluc3RydW1lbnRhdGlvbi5vbkV4Y2VwdGlvbihyLmFjdGl2aXR5LCBlKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFJ1bnRpbWVFeGNlcHRpb24oCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJVbmFibGUgdG8gcmV0YWluIGNoaWxkIGFjdGl2aXRpZXMgIgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIHNhZmVUb0NvbXBvbmVudFNob3J0U3RyaW5nKHIuaW50ZW50KQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArICI6ICIgKyBlLnRvU3RyaW5nKCksIGUpOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfQotCiAgICAgICAgICAgICB9CiAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgIHIuYWN0aXZpdHkubUNhbGxlZCA9IGZhbHNlOwotICAgICAgICAgICAgICAgIHIuYWN0aXZpdHkub25EZXN0cm95KCk7CisgICAgICAgICAgICAgICAgbUluc3RydW1lbnRhdGlvbi5jYWxsQWN0aXZpdHlPbkRlc3Ryb3koci5hY3Rpdml0eSk7CiAgICAgICAgICAgICAgICAgaWYgKCFyLmFjdGl2aXR5Lm1DYWxsZWQpIHsKICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFN1cGVyTm90Q2FsbGVkRXhjZXB0aW9uKAogICAgICAgICAgICAgICAgICAgICAgICAgIkFjdGl2aXR5ICIgKyBzYWZlVG9Db21wb25lbnRTaG9ydFN0cmluZyhyLmludGVudCkgKwpAQCAtMzAxOCw2ICszMDQ0LDI1IEBACiAgICAgICAgIH0KICAgICB9CiAKKyAgICBmaW5hbCB2b2lkIGhhbmRsZUR1bXBIZWFwKGJvb2xlYW4gbWFuYWdlZCwgRHVtcEhlYXBEYXRhIGRoZCkgeworICAgICAgICBpZiAobWFuYWdlZCkgeworICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICBEZWJ1Zy5kdW1wSHByb2ZEYXRhKGRoZC5wYXRoLCBkaGQuZmQuZ2V0RmlsZURlc2NyaXB0b3IoKSk7CisgICAgICAgICAgICB9IGNhdGNoIChJT0V4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgU2xvZy53KFRBRywgIk1hbmFnZWQgaGVhcCBkdW1wIGZhaWxlZCBvbiBwYXRoICIgKyBkaGQucGF0aAorICAgICAgICAgICAgICAgICAgICAgICAgKyAiIC0tIGNhbiB0aGUgcHJvY2VzcyBhY2Nlc3MgdGhpcyBwYXRoPyIpOworICAgICAgICAgICAgfSBmaW5hbGx5IHsKKyAgICAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgICAgICBkaGQuZmQuY2xvc2UoKTsKKyAgICAgICAgICAgICAgICB9IGNhdGNoIChJT0V4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgICAgIFNsb2cudyhUQUcsICJGYWlsdXJlIGNsb3NpbmcgcHJvZmlsZSBmZCIsIGUpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfSBlbHNlIHsKKyAg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AgIGJhdHRlcnlJbmZvLmR1bXAocHcsIHByZWZpeCk7CiAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIFRZUEVfUlVOTklOR19TRVJWSUNFOgorICAgICAgICAgICAgICAgIHJ1bm5pbmdTZXJ2aWNlSW5mby5kdW1wKHB3LCBwcmVmaXgpOworICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICB9CiAgICAgfQogfQpkaWZmIC0tZ2l0IGEvY29yZS9qYXZhL2FuZHJvaWQvYXBwL0FwcGxpY2F0aW9uVGhyZWFkTmF0aXZlLmphdmEgYi9jb3JlL2phdmEvYW5kcm9pZC9hcHAvQXBwbGljYXRpb25UaHJlYWROYXRpdmUuamF2YQppbmRleCAxYzIwMDYyLi5kYzIxNDVmIDEwMDY0NAotLS0gYS9jb3JlL2phdmEvYW5kcm9pZC9hcHAvQXBwbGljYXRpb25UaHJlYWROYXRpdmUuamF2YQorKysgYi9jb3JlL2phdmEvYW5kcm9pZC9hcHAvQXBwbGljYXRpb25UaHJlYWROYXRpdmUuamF2YQpAQCAtNDAzLDYgKzQwMywxNyBAQAogICAgICAgICAgICAgc2NoZWR1bGVDcmFzaChtc2cpOwogICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgIH0KKworICAgICAgICBjYXNlIERVTVBfSEVBUF9UUkFOU0FDVElPTjoKKyAgICAgICAgeworICAgICAgICAgICAgZGF0YS5lbmZvcmNlSW50ZXJmYWNlKElBcHBsaWNhdGlvblRocmVhZC5kZXNjcmlwdG9yKTsKKyAgICAgICAgICAgIGJvb2xlYW4gbWFuYWdlZCA9IGRhdGEucmVhZEludCgpICE9IDA7CisgICAgICAgICAgICBTdHJpbmcgcGF0aCA9IGRhdGEucmVhZFN0cmluZygpOworICAgICAgICAgICAgUGFyY2VsRmlsZURlc2NyaXB0b3IgZmQgPSBkYXRhLnJlYWRJbnQoKSAhPSAwCisgICAgICAgICAgICAgICAgICAgID8gZGF0YS5yZWFkRmlsZURlc2NyaXB0b3IoKSA6IG51bGw7CisgICAgICAgICAgICBkdW1wSGVhcChtYW5hZ2VkLCBwYXRoLCBmZCk7CisgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgfQogICAgICAgICB9CiAKICAgICAgICAgcmV0dXJuIHN1cGVyLm9uVHJhbnNhY3QoY29kZSwgZGF0YSwgcmVwbHksIGZsYWdzKTsKQEAgLTgyOSw1ICs4NDAsMjIgQEAKICAgICAgICAgZGF0YS5yZWN5Y2xlKCk7CiAgICAgICAgIAogICAgIH0KKworICAgIHB1YmxpYyB2b2lkIGR1bXBIZWFwKGJvb2xlYW4gbWFuYWdlZCwgU3RyaW5nIHBhdGgsCisgICAgICAgICAgICBQYXJjZWxGaWxlRGVzY3JpcHRvciBmZCkgdGhyb3dzIFJlbW90ZUV4Y2VwdGlvbiB7CisgICAgICAgIFBhcmNlbCBkYXRhID0gUGFyY2VsLm9idGFpbigpOworICAgICAgICBkYXRhLndyaXRlSW50ZXJmYWNlVG9rZW4oSUFwcGxpY2F0aW9uVGhyZWFkLmRlc2NyaXB0b3IpOworICAgICAgICBkYXRhLndyaXRlSW50KG1hbmFnZWQgPyAxIDogMCk7CisgICAgICAgIGRhdGEud3JpdGVTdHJpbmcocGF0aCk7CisgICAgICAgIGlmIChmZCAhPSBudWxsKSB7CisgICAgICAgICAgICBkYXRhLndyaXRlSW50KDEpOworICAgICAgICAgICAgZmQud3JpdGVUb1BhcmNlbChkYXRhLCBQYXJjZWxhYmxlLlBBUkNFTEFCTEVfV1JJVEVfUkVUVVJOX1ZBTFVFKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIGRhdGEud3JpdGVJbnQoMCk7CisgICAgICAgIH0KKyAgICAgICAgbVJlbW90ZS50cmFuc2FjdChEVU1QX0hFQVBfVFJBTlNBQ1RJT04sIGRhdGEsIG51bGwsCisgICAgICAgICAgICAgICAgSUJpbmRlci5GTEFHX09ORVdBWSk7CisgICAgICAgIGR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iYWNrIHN0YWNrIik7CisgICAgICAgIH0KKworICAgICAgICBvcCA9IGJzZS5tSGVhZDsKKyAgICAgICAgaW50IHBvcyA9IDA7CisgICAgICAgIHdoaWxlIChvcCAhPSBudWxsKSB7CisgICAgICAgICAgICBtT3BzW3BvcysrXSA9IG9wLmNtZDsKKyAgICAgICAgICAgIG1PcHNbcG9zKytdID0gb3AuZnJhZ21lbnQubUluZGV4OworICAgICAgICAgICAgbU9wc1twb3MrK10gPSBvcC5lbnRlckFuaW07CisgICAgICAgICAgICBtT3BzW3BvcysrXSA9IG9wLmV4aXRBbmltOworICAgICAgICAgICAgaWYgKG9wLnJlbW92ZWQgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIGZpbmFsIGludCBOID0gb3AucmVtb3ZlZC5zaXplKCk7CisgICAgICAgICAgICAgICAgbU9wc1twb3MrK10gPSBOOworICAgICAgICAgICAgICAgIGZvciAoaW50IGk9MDsgaTxOOyBpKyspIHsKKyAgICAgICAgICAgICAgICAgICAgbU9wc1twb3MrK10gPSBvcC5yZW1vdmVkLmdldChpKS5tSW5kZXg7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBtT3BzW3BvcysrXSA9IDA7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBvcCA9IG9wLm5leHQ7CisgICAgICAgIH0KKyAgICAgICAgbVRyYW5zaXRpb24gPSBic2UubVRyYW5zaXRpb247CisgICAgICAgIG1UcmFuc2l0aW9uU3R5bGUgPSBic2UubVRyYW5zaXRpb25TdHlsZTsKKyAgICAgICAgbU5hbWUgPSBic2UubU5hbWU7CisgICAgICAgIG1JbmRleCA9IGJzZS5tSW5kZXg7CisgICAgfQorICAgIAorICAgIHB1YmxpYyBCYWNrU3RhY2tTdGF0ZShQYXJjZWwgaW4pIHsKKyAgICAgICAgbU9wcyA9IGluLmNyZWF0ZUludEFycmF5KCk7CisgICAgICAgIG1UcmFuc2l0aW9uID0gaW4ucmVhZEludCgpOworICAgICAgICBtVHJhbnNpdGlvblN0eWxlID0gaW4ucmVhZEludCgpOworICAgICAgICBtTmFtZSA9IGluLnJlYWRTdHJpbmcoKTsKKyAgICAgICAgbUluZGV4ID0gaW4ucmVhZEludCgpOworICAgIH0KKyAgICAKKyAgICBwdWJsaWMgQmFja1N0YWNrRW50cnkgaW5zdGFudGlhdGUoRnJhZ21lbnRNYW5hZ2VySW1wbCBmbSkgeworICAgICAgICBCYWNrU3RhY2tFbnRyeSBic2UgPSBuZXcgQmFja1N0YWNrRW50cnkoZm0pOworICAgICAgICBpbnQgcG9zID0gMDsKKyAgICAgICAgd2hpbGUgKHBvcyA8IG1PcHMubGVuZ3RoKSB7CisgICAgICAgICAgICBCYWNrU3RhY2tFbnRyeS5PcCBvcCA9IG5ldyBCYWNrU3RhY2tFbnRyeS5PcCgpOworICAgICAgICAgICAgb3AuY21kID0gbU9wc1twb3MrK107CisgICAgICAgICAgICBpZiAoRnJhZ21lbnRNYW5hZ2VySW1wbC5ERUJVRykgTG9nLnYoRnJhZ21lbnRNYW5hZ2VySW1wbC5UQUcsCisgICAgICAgICAgICAgICAgICAgICJCU0UgIiArIGJzZSArICIgc2V0IGJhc2UgZnJhZ21lbnQgIyIgKyBtT3BzW3Bvc10pOworICAgICAgICAgICAgRnJhZ21lbnQgZiA9IGZtLm1BY3RpdmUuZ2V0KG1PcHNbcG9zKytdKTsKKyAgICAgICAgICAgIG9wLmZyYWdtZW50ID0gZjsKKyAgICAgICAgICAgIG9wLmVudGVyQW5pbSA9IG1PcHNbcG9zKytdOworICAgICAgICAgICAgb3AuZXhpdEFuaW0gPSBtT3BzW3BvcysrXTsKKyAgICAgICAgICAgIGZpbmFsIGludCBOID0gbU9wc1twb3MrK107CisgICAgICAgICAgICBpZiAoTiA+IDApIHsKKyAgICAgICAgICAgICAgICBvcC5yZW1vdmVkID0gbmV3IEFycmF5TGlzdDxGcmFnbWVudD4oTik7CisgICAgICAgICAgICAgICAgZm9yIChpbnQgaT0wOyBpPE47IGkrKykgeworICAgICAgICAgICAgICAgICAgICBpZiAoRnJhZ21lbnRNYW5hZ2VySW1wbC5ERUJVRykgTG9nLnYoRnJhZ21lbnRNYW5hZ2VySW1wbC5UQUcsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIkJTRSAiICsgYnNlICsgIiBzZXQgcmVtb3ZlIGZyYWdtZW50ICMiICsgbU9wc1twb3NdKTsKKyAgICAgICAgICAgICAgICAgICAgRnJhZ21lbnQgciA9IGZtLm1BY3RpdmUuZ2V0KG1PcHNbcG9zKytdKTsKKyAgICAgICAgICAgICAgICAgICAgb3AucmVtb3ZlZC5hZGQocik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgYnNlLmFkZE9wKG9wKTsKKyAgICAgICAgfQorICAgICAgICBic2UubVRyYW5zaXRpb24gPSBtVHJhbnNpdGlvbjsKKyAgICAgICAgYnNlLm1UcmFuc2l0aW9uU3R5bGUgPSBtVHJhbnNpdGlvblN0eWxlOworICAgICAgICBic2UubU5hbWUgPSBtTmFtZTsKKyAgICAgICAgYnNlLm1JbmRleCA9IG1JbmRleDsKKyAgICAgICAgYnNlLm1BZGRUb0JhY2tTdGFjayA9IHRydWU7CisgICAgICAgIGJzZS5idW1wQmFja1N0YWNrTmVzdGluZygxKTsKKyAgICAgICAgcmV0dXJuIGJzZTsKKyAgICB9CisgICAgCisgICAgcHVibGljIGludCBkZXNjcmliZUNvbnRlbnRzKCkgeworICAgICAgICByZXR1cm4gMDsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCB3cml0ZVRvUGFyY2VsKFBhcmNlbCBkZXN0LCBpbnQgZmxhZ3MpIHsKKyAgICAgICAgZGVzdC53cml0ZUludEFycmF5KG1PcHMpOworICAgICAgICBkZXN0LndyaXRlSW50KG1UcmFuc2l0aW9uKTsKKyAgICAgICAgZGVzdC53cml0ZUludChtVHJhbnNpdGlvblN0eWxlKTsKKyAgICAgICAgZGVzdC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maW5hbCBpbnQgT1BfSElERSA9IDQ7CisgICAgc3RhdGljIGZpbmFsIGludCBPUF9TSE9XID0gNTsKKyAgICAKKyAgICBzdGF0aWMgZmluYWwgY2xhc3MgT3AgeworICAgICAgICBPcCBuZXh0OworICAgICAgICBPcCBwcmV2OworICAgICAgICBpbnQgY21kOworICAgICAgICBGcmFnbWVudCBmcmFnbWVudDsKKyAgICAgICAgaW50IGVudGVyQW5pbTsKKyAgICAgICAgaW50IGV4aXRBbmltOworICAgICAgICBBcnJheUxpc3Q8RnJhZ21lbnQ+IHJlbW92ZWQ7CisgICAgfQorICAgIAorICAgIE9wIG1IZWFkOworICAgIE9wIG1UYWlsOworICAgIGludCBtTnVtT3A7CisgICAgaW50IG1FbnRlckFuaW07CisgICAgaW50IG1FeGl0QW5pbTsKKyAgICBpbnQgbVRyYW5zaXRpb247CisgICAgaW50IG1UcmFuc2l0aW9uU3R5bGU7CisgICAgYm9vbGVhbiBtQWRkVG9CYWNrU3RhY2s7CisgICAgU3RyaW5nIG1OYW1lOworICAgIGJvb2xlYW4gbUNvbW1pdHRlZDsKKyAgICBpbnQgbUluZGV4OworICAgIAorICAgIHB1YmxpYyBCYWNrU3RhY2tFbnRyeShGcmFnbWVudE1hbmFnZXJJbXBsIG1hbmFnZXIpIHsKKyAgICAgICAgbU1hbmFnZXIgPSBtYW5hZ2VyOworICAgIH0KKyAgICAKKyAgICB2b2lkIGFkZE9wKE9wIG9wKSB7CisgICAgICAgIGlmIChtSGVhZCA9PSBudWxsKSB7CisgICAgICAgICAgICBtSGVhZCA9IG1UYWlsID0gb3A7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBvcC5wcmV2ID0gbVRhaWw7CisgICAgICAgICAgICBtVGFpbC5uZXh0ID0gb3A7CisgICAgICAgICAgICBtVGFpbCA9IG9wOworICAgICAgICB9CisgICAgICAgIG9wLmVudGVyQW5pbSA9IG1FbnRlckFuaW07CisgICAgICAgIG9wLmV4aXRBbmltID0gbUV4aXRBbmltOworICAgICAgICBtTnVtT3ArKzsKKyAgICB9CisgICAgICAgIAorICAgIHB1YmxpYyBGcmFnbWVudFRyYW5zYWN0aW9uIGFkZChGcmFnbWVudCBmcmFnbWVudCwgU3RyaW5nIHRhZykgeworICAgICAgICBkb0FkZE9wKDAsIGZyYWdtZW50LCB0YWcsIE9QX0FERCk7CisgICAgICAgIHJldHVybiB0aGlzOworICAgIH0KKworICAgIHB1YmxpYyBGcmFnbWVudFRyYW5zYWN0aW9uIGFkZChpbnQgY29udGFpbmVyVmlld0lkLCBGcmFnbWVudCBmcmFnbWVudCkgeworICAgICAgICBkb0FkZE9wKGNvbnRhaW5lclZpZXdJZCwgZnJhZ21lbnQsIG51bGwsIE9QX0FERCk7CisgICAgICAgIHJldHVybiB0aGlzOworICAgIH0KKworICAgIHB1YmxpYyBGcmFnbWVudFRyYW5zYWN0aW9uIGFkZChpbnQgY29udGFpbmVyVmlld0lkLCBGcmFnbWVudCBmcmFnbWVudCwgU3RyaW5nIHRhZykgeworICAgICAgICBkb0FkZE9wKGNvbnRhaW5lclZpZXdJZCwgZnJhZ21lbnQsIHRhZywgT1BfQUREKTsKKyAgICAgICAgcmV0dXJuIHRoaXM7CisgICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIGRvQWRkT3AoaW50IGNvbnRhaW5lclZpZXdJZCwgRnJhZ21lbnQgZnJhZ21lbnQsIFN0cmluZyB0YWcsIGludCBvcGNtZCkgeworICAgICAgICBpZiAoZnJhZ21lbnQubUltbWVkaWF0ZUFjdGl2aXR5ICE9IG51bGwpIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oIkZyYWdtZW50IGFscmVhZHkgYWRkZWQ6ICIgKyBmcmFnbWVudCk7CisgICAgICAgIH0KKyAgICAgICAgZnJhZ21lbnQubUltbWVkaWF0ZUFjdGl2aXR5ID0gbU1hbmFnZXIubUFjdGl2aXR5OworICAgICAgICAKKyAgICAgICAgaWYgKHRhZyAhPSBudWxsKSB7CisgICAgICAgICAgICBpZiAoZnJhZ21lbnQubVRhZyAhPSBudWxsICYmICF0YWcuZXF1YWxzKGZyYWdtZW50Lm1UYWcpKSB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigiQ2FuJ3QgY2hhbmdlIHRhZyBvZiBmcmFnbWVudCAiCisgICAgICAgICAgICAgICAgICAgICAgICArIGZyYWdtZW50ICsgIjogd2FzICIgKyBmcmFnbWVudC5tVGFnCisgICAgICAgICAgICAgICAgICAgICAgICArICIgbm93ICIgKyB0YWcpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgZnJhZ21lbnQubVRhZyA9IHRhZzsKKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgaWYgKGNvbnRhaW5lclZpZXdJZCAhPSAwKSB7CisgICAgICAgICAgICBpZiAoZnJhZ21lbnQubUZyYWdtZW50SWQgIT0gMCAmJiBmcmFnbWVudC5tRnJhZ21lbnRJZCAhPSBjb250YWluZXJWaWV3SWQpIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJDYW4ndCBjaGFuZ2UgY29udGFpbmVyIElEIG9mIGZyYWdtZW50ICIKKyAgICAgICAgICAgICAgICAgICAgICAgICsgZnJhZ21lbnQgKyAiOiB3YXMgIiArIGZyYWdtZW50Lm1GcmFnbWVudElkCisgICAgICAgICAgICAgICAgICAgICAgICArICIgbm93ICIgKyBjb250YWluZXJWaWV3SWQpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgZnJhZ21lbnQubUNvbnRhaW5lcklkID0gZnJhZ21lbnQubUZyYWdtZW50SWQgPSBjb250YWluZXJWaWV3SWQ7CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIE9wIG9wID0gbmV3IE9wKCk7CisgICAgICAgIG9wLmNtZCA9IG9wY21kOworICAgICAgICBvcC5mcmFnbWVudCA9IGZyYWdtZW50OworICAgICAgICBhZGRPcChvcCk7CisgICAgfQorCisgICAgcHVibGljIEZyYWdtZW50VHJhbnNhY3Rpb24gcmVwbGFjZShpbnQgY29udGFpbmVyVmlld0lkLCBGcmFnbWVudCBmcmFnbWVudCkgeworICAgICAgICByZXR1cm4gcmVwbGFjZShjb250YWluZXJWaWV3SWQsIGZyYWdtZW50LCBudWxsKTsKKyAgICB9CisgICAgCisgICAgcHVibGljIEZyYWdtZW50VHJhbnNhY3Rpb24gcmVwbGFjZShpbnQgY29udGFpbmVyVmlld0lkLCBGcmFnbWVudCBmcmFnbWVudCwgU3RyaW5nIHRhZykgeworICAgICAgICBpZiAoY29udGFpbmVyVmlld0lkID09IDApIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oIk11c3QgdXNlIG5vbi16ZXJvIGNvbnRhaW5lclZpZXdJZCIpOworICAgICAgICB9CisgICAgICAgIAorICAgICAgICBkb0FkZE9wKGNvbnRhaW5lclZpZXdJZCwgZnJhZ21lbnQsIHRhZywgT1BfUkVQTEFDRSk7CisgICAgICAgIHJldHVybiB0aGlzOworICAgIH0KKyAgICAKKyAgICBwdWJsaWMgRnJhZ21lbnRUcmFuc2FjdGlvbiByZW1vdmUoRnJhZ21lbnQgZnJhZ21lbnQpIHsKKyAgICAgICAgaWYgKGZyYWdtZW50Lm1JbW1lZGlhdGVBY3Rpdml0eSA9PSBudWxsKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJGcmFnbWVudCBub3QgYWRkZWQ6ICIgKyBmcmFnbWVudCk7CisgICAgICAgIH0KKyAgICAgICAgZnJhZ21lbnQubUltbWVkaWF0ZUFjdGl2aXR5ID0gbnVsbDsKKyAgICAgICAgCisgICAgICAgIE9wIG9wID0gbmV3IE9wKCk7CisgICAgICAgIG9wLmNtZCA9IE9QX1JFTU9WRTsKKyAgICAgICAgb3AuZnJhZ21lbnQgPSBmcmFnbWVudDsKKyAgICAgICAgYWRkT3Aob3ApOworICAgICAgICAKKyAgICAgICAgcmV0dXJuIHRoaXM7CisgICAgfQorCisgICAgcHVibGljIEZyYWdtZW50VHJhbnNhY3Rpb24gaGlkZShGcmFnbWVudCBmcmFnbWVudCkgeworICAgICAgICBpZiAoZnJhZ21lbnQubUltbWVkaWF0ZUFjdGl2aXR5ID09IG51bGwpIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oIkZyYWdtZW50IG5vdCBhZGRlZDogIiArIGZyYWdtZW50KTsKKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgT3Agb3AgPSBuZXcgT3AoKTsKKyAgICAgICAgb3AuY21kID0gT1BfSElERTsKKyAgICAgICAgb3AuZnJhZ21lbnQgPSBmcmFnbWVudDsKKyAgICAgICAgYWRkT3Aob3ApOworICAgICAgICAKKyAgICAgICAgcmV0dXJuIHRoaXM7CisgICAgfQorICAgIAorICAgIHB1YmxpYyBGcmFnbWVudFRyYW5zYWN0aW9uIHNob3coRnJhZ21lbnQgZnJhZ21lbnQpIHsKKyAgICAgICAgaWYgKGZyYWdtZW50Lm1JbW1lZGlhdGVBY3Rpdml0eSA9PSBudWxsKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJGcmFnbWVudCBub3QgYWRkZWQ6ICIgKyBmcmFnbWVudCk7CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIE9wIG9wID0gbmV3IE9wKCk7CisgICAgICAgIG9wLmNtZCA9IE9QX1NIT1c7CisgICAgICAgIG9wLmZyYWdtZW50ID0gZnJhZ21lbnQ7CisgICAgICAgIGFkZE9wKG9wKTsKKyAgICAgICAgCisgICAgICAgIHJldHVybiB0aGlzOworICAgIH0KKyAgICAKKyAgICBwdWJsaWMgRnJhZ21lbnRUcmFuc2FjdGlvbiBzZXRDdXN0b21BbmltYXRpb25zKGludCBlbnRlciwgaW50IGV4aXQpIHsKKyAgICAgICAgbUVudGVyQW5pbSA9IGVudGVyOworICAgICAgICBtRXhpdEFuaW0gPSBleGl0OworICAgICAgICByZXR1cm4gdGhpczsKKyAgICB9CisgICAgCisgICAgcHVibGljIEZyYWdtZW50VHJhbnNhY3Rpb24gc2V0VHJhbnNpdGlvbihpbnQgdHJhbnNpdGlvbikgeworICAgICAgICBtVHJhbnNpdGlvbiA9IHRyYW5zaXRpb247CisgICAgICAgIHJldHVybiB0aGlzOworICAgIH0KKyAgICAKKyAgICBwdWJsaWMgRnJhZ21lbnRUcmFuc2FjdGlvbiBzZXRUcmFuc2l0aW9uU3R5bGUoaW50IHN0eWxlUmVzKSB7CisgICAgICAgIG1UcmFuc2l0aW9uU3R5bGUgPSBzdHlsZVJlczsKKyAgICAgICAgcmV0dXJuIHRoaXM7CisgICAgfQorICAgIAorICAgIHB1YmxpYyBGcmFnbWVudFRyYW5zYWN0aW9uIGFkZFRvQmFja1N0YWNrKFN0cmluZyBuYW1lKSB7CisgICAgICAgIG1BZGRUb0JhY2tTdGFjayA9IHRydWU7CisgICAgICAgIG1OYW1lID0gbmFtZTsKKyAgICAgICAgcmV0dXJuIHRoaXM7CisgICAgfQorCisgICAgdm9pZCBidW1wQmFja1N0YWNrTmVzdGluZyhpbnQgYW10KSB7CisgICAgICAgIGlmICghbUFkZFRvQmFja1N0YWNrKSB7CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKyAgICAgICAgaWYgKEZyYWdtZW50TWFuYWdlckltcGwuREVCVUcpIExvZy52KFRBRywgIkJ1bXAgbmVzdGluZyBpbiAiICsgdGhpcworICAgICAgICAgICAgICAgICsgIiBieSAiICsgYW10KTsKKyAgICAgICAgT3Agb3AgPSBtSGVhZDsKKyAgICAgICAgd2hpbGUgKG9wICE9IG51bGwpIHsKKyAgICAgICAgICAgIG9wLmZyYWdtZW50Lm1CYWNrU3RhY2tOZXN0aW5nICs9IGFtdDsKKyAgICAgICAgICAgIGlmIChGcmFnbWVudE1hbmFnZXJJbXBsLkRFQlVHKSBMb2cudihUQUcsICJCdW1wIG5lc3Rpbmcgb2YgIgorICAgICAgICAgICAgICAgICAgICArIG9wLmZyYWdtZW50ICsgIiB0byAiICsgb3AuZnJhZ21lbnQubUJhY2tTdGFja05lc3RpbmcpOworICAgICAgICAgICAgaWYgKG9wLnJlbW92ZWQgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIGZvciAoaW50IGk9b3AucmVtb3ZlZC5zaXplKCktMTsgaT49MDsgaS0tKSB7CisgICAgICAgICAgICAgICAgICAgIEZyYWdtZW50IHIgPSBvcC5yZW1vdmVkLmdldChpKTsKKyAgICAgICAgICAgICAgICAgICAgci5tQmFja1N0YWNrTmVzdGluZyArPSBhbXQ7CisgICAgICAgICAgICAgICAgICAgIGlmIChGcmFnbWVudE1hbmFnZXJJbXBsLkRFQlVHKSBMb2cudihUQUcsICJCdW1wIG5lc3Rpbmcgb2YgIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgciArICIgdG8gIiArIHIubUJhY2tTdGFja05lc3RpbmcpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG9wID0gb3AubmV4dDsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyBpbnQgY29tbWl0KCkgeworICAgICAgICBpZiAobUNvbW1pdHRlZCkgdGhyb3cgbmV3IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigiY29tbWl0IGFscmVhZHkgY2FsbGVkIik7CisgICAgICAgIGlmIChGcmFnbWVudE1hbmFnZXJJbXBsLkRFQlVHKSBMb2cudihUQUcsICJDb21taXQ6ICIgKyB0aGlzKTsKKyAgICAgICAgbUNvbW1pdHRlZCA9IHRydWU7CisgICAgICAgIGlmIChtQWRkVG9CYWNrU3RhY2spIHsKKyAgICAgICAgICAgIG1JbmRleCA9IG1NYW5hZ2VyLmFsbG9jQmFja1N0YWNrSW5kZXgodGhpcyk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBtSW5kZXggPSAtMTsKKyAgICAgICAgfQorICAgICAgICBtTWFuYWdlci5lbnF1ZXVlQWN0aW9uKHRoaXMpOworICAgICAgICByZXR1cm4gbUluZGV4OworICAgIH0KKyAgICAKKyAgICBwdWJsaWMgdm9pZCBydW4oKSB7CisgICAgICAgIGlmIChGcmFnbWVudE1hbmFnZXJJbXBsLkRFQlVHKSBMb2cudihUQUcsICJSdW46ICIgKyB0aGlzKTsKKyAgICAgICAgCisgICAgICAgIGlmIChtQWRkVG9CYWNrU3RhY2spIHsKKyAgICAgICAgICAgIGlmIChtSW5kZXggPCAwKSB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigiYWRkVG9CYWNrU3RhY2soKSBjYWxsZWQgYWZ0ZXIgY29tbWl0KCkiKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIGJ1bXBCYWNrU3RhY2tOZXN0aW5nKDEpOworCisgICAgICAgIE9wIG9wID0gbUhlYWQ7CisgICAgICAgIHdoaWxlIChvcCAhPSBudWxsKSB7CisgICAgICAgICAgICBzd2l0Y2ggKG9wLmNtZCkgeworICAgICAgICAgICAgICAgIGNhc2UgT1BfQUREOiB7CisgICAgICAgICAgICAgICAgICAgIEZyYWdtZW50IGYgPSBvcC5mcmFnbWVudDsKKyAgICAgICAgICAgICAgICAgICAgZi5tTmV4dEFuaW0gPSBvcC5lbnRlckFuaW07CisgICAgICAgICAgICAgICAgICAgIG1NYW5hZ2VyLmFkZEZyYWdtZW50KGYsIGZhbHNlKTsKKyAgICAgICAgICAgICAgICB9IGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgT1BfUkVQTEFDRTogeworICAgICAgICAgICAgICAgICAgICBGcmFnbWVudCBmID0gb3AuZnJhZ21lbnQ7CisgICAgICAgICAgICAgICAgICAgIGlmIChtTWFuYWdlci5tQWRkZWQgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChpbnQgaT0wOyBpPG1NYW5hZ2VyLm1BZGRlZC5zaXplKCk7IGkrKykgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIEZyYWdtZW50IG9sZCA9IG1NYW5hZ2VyLm1BZGRlZC5nZXQoaSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEZyYWdtZW50TWFuYWdlckltcGwuREVCVUcpIExvZy52KFRBRywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJPUF9SRVBMQUNFOiBhZGRpbmc9IiArIGYgKyAiIG9sZD0iICsgb2xkKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAob2xkLm1Db250YWluZXJJZCA9PSBmLm1Db250YWluZXJJZCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAob3AucmVtb3ZlZCA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcC5yZW1vdmVkID0gbmV3IEFycmF5TGlzdDxGcmFnbWVudD4oKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcC5yZW1vdmVkLmFkZChvbGQpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvbGQubU5leHRBbmltID0gb3AuZXhpdEFuaW07CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtQWRkVG9CYWNrU3RhY2spIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9sZC5tQmFja1N0YWNrTmVzdGluZyArPSAxOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEZyYWdtZW50TWFuYWdlckltcGwuREVCVUcpIExvZy52KFRBRywgIkJ1bXAgbmVzdGluZyBvZiAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgb2xkICsgIiB0byAiICsgb2xkLm1CYWNrU3RhY2tOZXN0aW5nKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtTWFuYWdlci5yZW1vdmVGcmFnbWVudChvbGQsIG1UcmFuc2l0aW9uLCBtVHJhbnNpdGlvblN0eWxlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgZi5tTmV4dEFuaW0gPSBvcC5lbnRlckFuaW07CisgICAgICAgICAgICAgICAgICAgIG1NYW5hZ2VyLmFkZEZyYWdtZW50KGYsIGZhbHNlKTsKKyAgICAgICAgICAgICAgICB9IGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgT1BfUkVNT1ZFOiB7CisgICAgICAgICAgICAgICAgICAgIEZyYWdtZW50IGYgPSBvcC5mcmFnbWVudDsKKyAgICAgICAgICAgICAgICAgICAgZi5tTmV4dEFuaW0gPSBvcC5leGl0QW5pbTsKKyAgICAgICAgICAgICAgICAgICAgbU1hbmFnZXIucmVtb3ZlRnJhZ21lbnQoZiwgbVRyYW5zaXRpb24sIG1UcmFuc2l0aW9uU3R5bGUpOworICAgICAgICAgICAgICAgIH0gYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBPUF9ISURFOiB7CisgICAgICAgICAgICAgICAgICAgIEZyYWdtZW50IGYgPSBvcC5mcmFnbWVudDsKKyAgICAgICAgICAgICAgICAgICAgZi5tTmV4dEFuaW0gPSBvcC5leGl0QW5pbTsKKyAgICAgICAgICAgICAgICAgICAgbU1hbmFnZXIuaGlkZUZyYWdtZW50KGYsIG1UcmFuc2l0aW9uLCBtVHJhbnNpdGlvblN0eWxlKTsKKyAgICAgICAgICAgICAgICB9IGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgT1BfU0hPVzogeworICAgICAgICAgICAgICAgICAgICBGcmFnbWVudCBmID0gb3AuZnJhZ21lbnQ7CisgICAgICAgICAgICAgICAgICAgIGYubU5leHRBbmltID0gb3AuZW50ZXJBbmltOworICAgICAgICAgICAgICAgICAgICBtTWFuYWdlci5zaG93RnJhZ21lbnQoZiwgbVRyYW5zaXRpb24sIG1UcmFuc2l0aW9uU3R5bGUpOworICAgICAgICAgICAgICAgIH0gYnJlYWs7CisgICAgICAgICAgICAgICAgZGVmYXVsdDogeworICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCJVbmtub3duIGNtZDogIiArIG9wLmNtZCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgCisgICAgICAgICAgICBvcCA9IG9wLm5leHQ7CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIG1NYW5hZ2VyLm1vdmVUb1N0YXRlKG1NYW5hZ2VyLm1DdXJTdGF0ZSwgbVRyYW5zaXRpb24sCisgICAgICAgICAgICAgICAgbVRyYW5zaXRpb25TdHlsZSwgdHJ1ZSk7CisgICAgICAgIGlmIChtTWFuYWdlci5tTmVlZE1lbnVJbnZhbGlkYXRlICYmIG1NYW5hZ2VyLm1BY3Rpdml0eSAhPSBudWxsKSB7CisgICAgICAgICAgICBtTWFuYWdlci5tQWN0aXZpdHkuaW52YWxpZGF0ZU9wdGlvbnNNZW51KCk7CisgICAgICAgICAgICBtTWFuYWdlci5tTmVlZE1lbnVJbnZhbGlkYXRlID0gZmFsc2U7CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIGlmIChtQWRkVG9CYWNrU3RhY2spIHsKKyAgICAgICAgICAgIG1NYW5hZ2VyLmFkZEJhY2tTdGFja1N0YXRlKHRoaXMpOworICAgICAgICB9CisgICAgfQorICAgIAorICAgIHB1YmxpYyB2b2lkIHBvcEZyb21CYWNrU3RhY2soKSB7CisgICAgICAgIGlmIChGcmFnbWVudE1hbmFnZXJJbXBsLkRFQlVHKSBMb2cudihUQUcsICJwb3BGcm9tQmFja1N0YWNrOiAiICsgdGhpcyk7CisKKyAgICAgICAgYnVtcEJhY2tTdGFja05lc3RpbmcoLTEpOworICAgICAgICAKKyAgICAgICAgT3Agb3AgPSBtVGFpbDsKKyAgICAgICAgd2hpbGUgKG9wICE9IG51bGwpIHsKKyAgICAgICAgICAgIHN3aXRjaCAob3AuY21kKSB7CisgICAgICAgICAgICAgICAgY2FzZSBPUF9BREQ6IHsKKyAgICAgICAgICAgICAgICAgICAgRnJhZ21lbnQgZiA9IG9wLmZyYWdtZW50OworICAgICAgICAgICAgICAgICAgICBmLm1JbW1lZGlhdGVBY3Rpdml0eSA9IG51bGw7CisgICAgICAgICAgICAgICAgICAgIG1NYW5hZ2VyLnJlbW92ZUZyYWdtZW50KGYsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgRnJhZ21lbnRNYW5hZ2VySW1wbC5yZXZlcnNlVHJhbnNpdChtVHJhbnNpdGlvbiksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVRyYW5zaXRpb25TdHlsZSk7CisgICAgICAgICAgICAgICAgfSBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIE9QX1JFUExBQ0U6IHsKKyAgICAgICAgICAgICAgICAgICAgRnJhZ21lbnQgZiA9IG9wLmZyYWdtZW50OworICAgICAgICAgICAgICAgICAgICBmLm1JbW1lZGlhdGVBY3Rpdml0eSA9IG51bGw7CisgICAgICAgICAgICAgICAgICAgIG1NYW5hZ2VyLnJlbW92ZUZyYWdtZW50KGYsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgRnJhZ21lbnRNYW5hZ2VySW1wbC5yZXZlcnNlVHJhbnNpdChtVHJhbnNpdGlvbiksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVRyYW5zaXRpb25TdHlsZSk7CisgICAgICAgICAgICAgICAgICAgIGlmIChvcC5yZW1vdmVkICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoaW50IGk9MDsgaTxvcC5yZW1vdmVkLnNpemUoKTsgaSsrKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgRnJhZ21lbnQgb2xkID0gb3AucmVtb3ZlZC5nZXQoaSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZi5tSW1tZWRpYXRlQWN0aXZpdHkgPSBtTWFuYWdlci5tQWN0aXZpdHk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbU1hbmFnZXIuYWRkRnJhZ21lbnQob2xkLCBmYWxzZSk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9IGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgT1BfUkVNT1ZFOiB7CisgICAgICAgICAgICAgICAgICAgIEZyYWdtZW50IGYgPSBvcC5mcmFnbWVudDsKKyAgICAgICAgICAgICAgICAgICAgZi5tSW1tZWRpYXRlQWN0aXZpdHkgPSBtTWFuYWdlci5tQWN0aXZpdHk7CisgICAgICAgICAgICAgICAgICAgIG1NYW5hZ2VyLmFkZEZyYWdtZW50KGYsIGZhbHNlKTsKKyAgICAgICAgICAgICAgICB9IGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgT1BfSElERTogeworICAgICAgICAgICAgICAgICAgICBGcmFnbWVudCBmID0gb3AuZnJhZ21lbnQ7CisgICAgICAgICAgICAgICAgICAgIG1NYW5hZ2VyLnNob3dGcmFnbWVudChmLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIEZyYWdtZW50TWFuYWdlckltcGwucmV2ZXJzZVRyYW5zaXQobVRyYW5zaXRpb24pLCBtVHJhbnNpdGlvblN0eWxlKTsKKyAgICAgICAgICAgICAgICB9IGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgT1BfU0hPVzogeworICAgICAgICAgICAgICAgICAgICBGcmFnbWVudCBmID0gb3AuZnJhZ21lbnQ7CisgICAgICAgICAgICAgICAgICAgIG1NYW5hZ2VyLmhpZGVGcmFnbWVudChmLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIEZyYWdtZW50TWFuYWdlckltcGwucmV2ZXJzZVRyYW5zaXQobVRyYW5zaXRpb24pLCBtVHJhbnNpdGlvblN0eWxlKTsKKyAgICAgICAgICAgICAgICB9IGJyZWFrOworICAgICAgICAgICAgICAgIGRlZmF1bHQ6IHsKKyAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigiVW5rbm93biBjbWQ6ICIgKyBvcC5jbWQpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIAorICAgICAgICAgICAgb3AgPSBvcC5wcmV2OworICAgICAgICB9CisgICAgICAgIAorICAgICAgICBtTWFuYWdlci5tb3ZlVG9TdGF0ZShtTWFuYWdlci5tQ3VyU3RhdGUsCisgICAgICAgICAgICAgICAgRnJhZ21lbnRNYW5hZ2VySW1wbC5yZXZlcnNlVHJhbnNpdChtVHJhbnNpdGlvbiksIG1UcmFuc2l0aW9uU3R5bGUsIHRydWUpOworICAgICAgICBpZiAobU1hbmFnZXIubU5lZWRNZW51SW52YWxpZGF0ZSAmJiBtTWFuYWdlci5tQWN0aXZpdHkgIT0gbnVsbCkgeworICAgICAgICAgICAgbU1hbmFnZXIubUFjdGl2aXR5LmludmFsaWRhdGVPcHRpb25zTWVudSgpOworICAgICAgICAgICAgbU1hbmFnZXIubU5lZWRNZW51SW52YWxpZGF0ZSA9IGZhbHNlOworICAgICAgICB9CisKKyAgICAgICAgaWYgKG1JbmRleCA+PSAwKSB7CisgICAgICAgICAgICBtTWFuYWdlci5mcmVlQmFja1N0YWNrSW5kZXgobUluZGV4KTsKKyAgICAgICAgICAgIG1JbmRleCA9IC0xOworICAgICAgICB9CisgICAgfQorICAgIAorICAgIHB1YmxpYyBTdHJpbmcgZ2V0TmFtZSgpIHsKKyAgICAgICA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ciA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgSUJpbmRlciBiID0gU2VydmljZU1hbmFnZXIuZ2V0U2VydmljZShDT1VOVFJZX0RFVEVDVE9SKTsKKyAgICAgICAgICAgICAgICBJQ291bnRyeURldGVjdG9yIHNlcnZpY2UgPSBJQ291bnRyeURldGVjdG9yLlN0dWIuYXNJbnRlcmZhY2UoYik7CisgICAgICAgICAgICAgICAgc0NvdW50cnlEZXRlY3RvciA9IG5ldyBDb3VudHJ5RGV0ZWN0b3Ioc2VydmljZSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIHNDb3VudHJ5RGV0ZWN0b3I7CisgICAgfQorCiAgICAgcHJpdmF0ZSBTZWFyY2hNYW5hZ2VyIGdldFNlYXJjaE1hbmFnZXIoKSB7CiAgICAgICAgIHN5bmNocm9uaXplZCAobVN5bmMpIHsKICAgICAgICAgICAgIGlmIChtU2VhcmNoTWFuYWdlciA9PSBudWxsKSB7CkBAIC0yNzU3LDYgKzI3ODQsMTMgQEAKICAgICAgICAgICAgICAgICByZXR1cm4gdiAhPSBudWxsID8gdiA6IGRlZlZhbHVlOwogICAgICAgICAgICAgfQogICAgICAgICB9CisgICAgICAgIAorICAgICAgICBwdWJsaWMgU2V0PFN0cmluZz4gZ2V0U3RyaW5nU2V0KFN0cmluZyBrZXksIFNldDxTdHJpbmc+IGRlZlZhbHVlcykgeworICAgICAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CisgICAgICAgICAgICAgICAgU2V0PFN0cmluZz4gdiA9IChTZXQ8U3RyaW5nPikgbU1hcC5nZXQoa2V5KTsKKyAgICAgICAgICAgICAgICByZXR1cm4gdiAhPSBudWxsID8gdiA6IGRlZlZhbHVlczsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQogCiAgICAgICAgIHB1YmxpYyBpbnQgZ2V0SW50KFN0cmluZyBrZXksIGludCBkZWZWYWx1ZSkgewogICAgICAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CkBAIC0yNzk5LDYgKzI4MzMsMTIgQEAKICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQorICAgICAgICAgICAgcHVibGljIEVkaXRvciBwdXRTdHJpbmdTZXQoU3RyaW5nIGtleSwgU2V0PFN0cmluZz4gdmFsdWVzKSB7CisgICAgICAgICAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CisgICAgICAgICAgICAgICAgICAgIG1Nb2RpZmllZC5wdXQoa2V5LCB2YWx1ZXMpOworICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpczsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CiAgICAgICAgICAgICBwdWJsaWMgRWRpdG9yIHB1dEludChTdHJpbmcga2V5LCBpbnQgdmFsdWUpIHsKICAgICAgICAgICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKICAgICAgICAgICAgICAgICAgICAgbU1vZGlmaWVkLnB1dChrZXksIHZhbHVlKTsKZGlmZiAtLWdpdCBhL2NvcmUvamF2YS9hbmRyb2lkL2FwcC9EaWFsb2cuamF2YSBiL2NvcmUvamF2YS9hbmRyb2lkL2FwcC9EaWFsb2cuamF2YQppbmRleCBkYThjOWU1Li4yNzRhMjY2IDEwMDY0NAotLS0gYS9jb3JlL2phdmEvYW5kcm9pZC9hcHAvRGlhbG9nLmphdmEKKysrIGIvY29yZS9qYXZhL2FuZHJvaWQvYXBwL0RpYWxvZy5qYXZhCkBAIC0xNiwxOCArMTYsMjEgQEAKIAogcGFja2FnZSBhbmRyb2lkLmFwcDsKIAoraW1wb3J0IGNvbS5hbmRyb2lkLmludGVybmFsLmFwcC5BY3Rpb25CYXJJbXBsOwogaW1wb3J0IGNvbS5hbmRyb2lkLmludGVybmFsLnBvbGljeS5Qb2xpY3lNYW5hZ2VyOwogCi1pbXBvcnQgYW5kcm9pZC5jb250ZW50LkNvbnRleHQ7Ci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pYyBBY3Rpb25CYXIgZ2V0QWN0aW9uQmFyKCkgeworICAgICAgICByZXR1cm4gbUFjdGlvbkJhcjsKKyAgICB9CisKKyAgICAvKioKICAgICAgKiBTZXRzIHRoZSBBY3Rpdml0eSB0aGF0IG93bnMgdGhpcyBkaWFsb2cuIEFuIGV4YW1wbGUgdXNlOiBUaGlzIERpYWxvZyB3aWxsCiAgICAgICogdXNlIHRoZSBzdWdnZXN0ZWQgdm9sdW1lIGNvbnRyb2wgc3RyZWFtIG9mIHRoZSBBY3Rpdml0eS4KICAgICAgKiAKQEAgLTIxNiw2ICsyMjgsOSBAQAogICAgIHB1YmxpYyB2b2lkIHNob3coKSB7CiAgICAgICAgIGlmIChtU2hvd2luZykgewogICAgICAgICAgICAgaWYgKG1EZWNvciAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgaWYgKG1XaW5kb3cuaGFzRmVhdHVyZShXaW5kb3cuRkVBVFVSRV9BQ1RJT05fQkFSKSkgeworICAgICAgICAgICAgICAgICAgICBtV2luZG93LmludmFsaWRhdGVQYW5lbE1lbnUoV2luZG93LkZFQVRVUkVfQUNUSU9OX0JBUik7CisgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIG1EZWNvci5zZXRWaXNpYmlsaXR5KFZpZXcuVklTSUJMRSk7CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICByZXR1cm47CkBAIC0yMjcsNiArMjQyLDExIEBACiAKICAgICAgICAgb25TdGFydCgpOwogICAgICAgICBtRGVjb3IgPSBtV2luZG93LmdldERlY29yVmlldygpOworCisgICAgICAgIGlmIChtQWN0aW9uQmFyID09IG51bGwgJiYgbVdpbmRvdy5oYXNGZWF0dXJlKFdpbmRvdy5GRUFUVVJFX0FDVElPTl9CQVIpKSB7CisgICAgICAgICAgICBtQWN0aW9uQmFyID0gbmV3IEFjdGlvbkJhckltcGwodGhpcyk7CisgICAgICAgIH0KKwogICAgICAgICBXaW5kb3dNYW5hZ2VyLkxheW91dFBhcmFtcy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S9hbmRyb2lkL2FwaXMvYXBwL0ZyYWdtZW50RGlhbG9nT3JBY3Rpdml0eS5qYXZhCisgKiAgICAgIGVtYmVkfQorICovCitwdWJsaWMgY2xhc3MgRGlhbG9nRnJhZ21lbnQgZXh0ZW5kcyBGcmFnbWVudAorICAgICAgICBpbXBsZW1lbnRzIERpYWxvZ0ludGVyZmFjZS5PbkNhbmNlbExpc3RlbmVyLCBEaWFsb2dJbnRlcmZhY2UuT25EaXNtaXNzTGlzdGVuZXIgeworCisgICAgLyoqCisgICAgICogU3R5bGUgZm9yIHtAbGluayAjc2V0U3R5bGUoaW50LCBpbnQpfTogYSBiYXNpYywKKyAgICAgKiBub3JtYWwgZGlhbG9nLgorICAgICAqLworICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgaW50IFNUWUxFX05PUk1BTCA9IDA7CisKKyAgICAvKioKKyAgICAgKiBTdHlsZSBmb3Ige0BsaW5rICNzZXRTdHlsZShpbnQsIGludCl9OiBkb24ndCBpbmNsdWRlCisgICAgICogYSB0aXRsZSBhcmVhLgorICAgICAqLworICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgaW50IFNUWUxFX05PX1RJVExFID0gMTsKKworICAgIC8qKgorICAgICAqIFN0eWxlIGZvciB7QGxpbmsgI3NldFN0eWxlKGludCwgaW50KX06IGRvbid0IGRyYXcKKyAgICAgKiBhbnkgZnJhbWUgYXQgYWxsOyB0aGUgdmlldyBoaWVyYXJjaHkgcmV0dXJuZWQgYnkge0BsaW5rICNvbkNyZWF0ZVZpZXd9CisgICAgICogaXMgZW50aXJlbHkgcmVzcG9uc2libGUgZm9yIGRyYXdpbmcgdGhlIGRpYWxvZy4KKyAgICAgKi8KKyAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGludCBTVFlMRV9OT19GUkFNRSA9IDI7CisKKyAgICAvKioKKyAgICAgKiBTdHlsZSBmb3Ige0BsaW5rICNzZXRTdHlsZShpbnQsIGludCl9OiBsaWtlCisgICAgICoge0BsaW5rICNT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aXNtaXNzKCk7CisgICAgICAgICAgICBtRGlhbG9nID0gbnVsbDsKKyAgICAgICAgfQorICAgICAgICBtUmVtb3ZlZCA9IHRydWU7CisgICAgICAgIGlmIChtQmFja1N0YWNrSWQgPj0gMCkgeworICAgICAgICAgICAgZ2V0RnJhZ21lbnRNYW5hZ2VyKCkucG9wQmFja1N0YWNrKG1CYWNrU3RhY2tJZCwKKyAgICAgICAgICAgICAgICAgICAgRnJhZ21lbnRNYW5hZ2VyLlBPUF9CQUNLX1NUQUNLX0lOQ0xVU0lWRSk7CisgICAgICAgICAgICBtQmFja1N0YWNrSWQgPSAtMTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIEZyYWdtZW50VHJhbnNhY3Rpb24gZnQgPSBnZXRGcmFnbWVudE1hbmFnZXIoKS5vcGVuVHJhbnNhY3Rpb24oKTsKKyAgICAgICAgICAgIGZ0LnJlbW92ZSh0aGlzKTsKKyAgICAgICAgICAgIGZ0LmNvbW1pdCgpOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIERpYWxvZyBnZXREaWFsb2coKSB7CisgICAgICAgIHJldHVybiBtRGlhbG9nOworICAgIH0KKworICAgIHB1YmxpYyBpbnQgZ2V0VGhlbWUoKSB7CisgICAgICAgIHJldHVybiBtVGhlbWU7CisgICAgfQorCisgICAgLyoqCisgICAgICogQ29udHJvbCB3aGV0aGVyIHRoZSBzaG93biBEaWFsb2cgaXMgY2FuY2VsYWJsZS4gIFVzZSB0aGlzIGluc3RlYWQgb2YKKyAgICAgKiBkaXJlY3RseSBjYWxsaW5nIHtAbGluayBEaWFsb2cjc2V0Q2FuY2VsYWJsZShib29sZWFuKQorICAgICAqIERpYWxvZy5zZXRDYW5jZWxhYmxlKGJvb2xlYW4pfSwgYmVjYXVzZSBEaWFsb2dGcmFnbWVudCBuZWVkcyB0byBjaGFuZ2UKKyAgICAgKiBpdHMgYmVoYXZpb3IgYmFzZWQgb24gdGhpcy4KKyAgICAgKgorICAgICAq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AgICAgICAgICAgZGlzbWlzcygpOworICAgICAgICB9CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgb25BY3Rpdml0eUNyZWF0ZWQoQnVuZGxlIHNhdmVkSW5zdGFuY2VTdGF0ZSkgeworICAgICAgICBzdXBlci5vbkFjdGl2aXR5Q3JlYXRlZChzYXZlZEluc3RhbmNlU3RhdGUpOworCisgICAgICAgIGlmICghbVNob3dzRGlhbG9nKSB7CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKworICAgICAgICBtRGlhbG9nID0gb25DcmVhdGVEaWFsb2coc2F2ZWRJbnN0YW5jZVN0YXRlKTsKKyAgICAgICAgbURlc3Ryb3llZCA9IGZhbHNlOworICAgICAgICBzd2l0Y2ggKG1TdHlsZSkgeworICAgICAgICAgICAgY2FzZSBTVFlMRV9OT19JTlBVVDoKKyAgICAgICAgICAgICAgICBtRGlhbG9nLmdldFdpbmRvdygpLmFkZEZsYWdzKAorICAgICAgICAgICAgICAgICAgICAgICAgV2luZG93TWFuYWdlci5MYXlvdXRQYXJhbXMuRkxBR19OT1RfRk9DVVNBQkxFIHwKKyAgICAgICAgICAgICAgICAgICAgICAgIFdpbmRvd01hbmFnZXIuTGF5b3V0UGFyYW1zLkZMQUdfTk9UX1RPVUNIQUJMRSk7CisgICAgICAgICAgICAgICAgLy8gZmFsbCB0aHJvdWdoLi4uCisgICAgICAgICAgICBjYXNlIFNUWUxFX05PX0ZSQU1FOgorICAgICAgICAgICAgY2FzZSBTVFlMRV9OT19USVRMRToKKyAgICAgICAgICAgICAgICBtRGlhbG9nLnJlcXVlc3RXaW5kb3dGZWF0dXJlKFdpbmRvdy5GRUFUVVJFX05PX1RJVExFKTsKKyAgICAgICAgfQorICAgICAgICBWaWV3IHZpZXcgPSBnZXRWaWV3KCk7CisgICAgICAgIGlmICh2aWV3ICE9IG51bGwpIHsKKyAgICAgICAgICAgIGlmICh2aWV3LmdldFBhcmVudCgpICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJEaWFsb2dGcmFnbWVudCBjYW4gbm90IGJlIGF0dGFjaGVkIHRvIGEgY29udGFpbmVyIHZpZXciKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1EaWFsb2cuc2V0Q29udGVudFZpZXcodmlldyk7CisgICAgICAgIH0KKyAgICAgICAgbURpYWxvZy5zZXRPd25lckFjdGl2aXR5KGdldEFjdGl2aXR5KCkpOworICAgICAgICBtRGlhbG9nLnNldENhbmNlbGFibGUobUNhbmNlbGFibGUpOworICAgICAgICBtRGlhbG9nLnNldE9uQ2FuY2VsTGlzdGVuZXIodGhpcyk7CisgICAgICAgIG1EaWFsb2cuc2V0T25EaXNtaXNzTGlzdGVuZXIodGhpcyk7CisgICAgICAgIGlmIChzYXZlZEluc3RhbmNlU3RhdGUgIT0gbnVsbCkgeworICAgICAgICAgICAgQnVuZGxlIGRpYWxvZ1N0YXRlID0gc2F2ZWRJbnN0YW5jZVN0YXRlLmdldEJ1bmRsZShTQVZFRF9ESUFMT0dfU1RBVEVfVEFHKTsKKyAgICAgICAgICAgIGlmIChkaWFsb2dTdGF0ZSAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgbURpYWxvZy5vblJlc3RvcmVJbnN0YW5jZVN0YXRlKGRpYWxvZ1N0YXRlKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIG9uU3RhcnQoKSB7CisgICAgICAgIHN1cGVyLm9uU3RhcnQoKTsKKyAgICAgICAgaWYgKG1EaWFsb2cgIT0gbnVsbCkgeworICAgICAgICAgICAgbVJlbW92ZWQgPSBmYWxzZTsKKyAgICAgICAgICAgIG1EaWFsb2cuc2hvdygpOworICAgICAgICB9CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgb25TYXZlSW5zdGFuY2VTdGF0ZShCdW5kbGUgb3V0U3RhdGUpIHsKKyAgICAgICAgc3VwZXIub25TYXZlSW5zdGFuY2VTdGF0ZShvdXRTdGF0ZSk7CisgICAgICAgIGlmIChtRGlhbG9nICE9IG51bGwpIHsKKyAgICAgICAgICAgIEJ1bmRsZSBkaWFsb2dTdGF0ZSA9IG1EaWFsb2cub25TYXZlSW5zdGFuY2VTdGF0ZSgpOworICAgICAgICAgICAgaWYgKGRpYWxvZ1N0YXRlICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBvdXRTdGF0ZS5wdXRCdW5kbGUoU0FWRURfRElBTE9HX1NUQVRFX1RBRywgZGlhbG9nU3RhdGUpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIGlmIChtU3R5bGUgIT0gU1RZTEVfTk9STUFMKSB7CisgICAgICAgICAgICBvdXRTdGF0ZS5wdXRJbnQoU0FWRURfU1RZTEUsIG1TdHlsZSk7CisgICAgICAgIH0KKyAgICAgICAgaWYgKG1UaGVtZSAhPSAwKSB7CisgICAgICAgICAgICBvdXRTdGF0ZS5wdXRJbnQoU0FWRURfVEhFTUUsIG1UaGVtZSk7CisgICAgICAgIH0KKyAgICAgICAgaWYgKCFtQ2FuY2VsYWJsZSkgeworICAgICAgICAgICAgb3V0U3RhdGUucHV0Qm9vbGVhbihTQVZFRF9DQU5DRUxBQkxFLCBtQ2FuY2VsYWJsZSk7CisgICAgICAgIH0KKyAgICAgICAgaWYgKCFtU2hvd3NEaWFsb2cpIHsKKyAgICAgICAgICAgIG91dFN0YXRlLnB1dEJvb2xlYW4oU0FWRURfU0hPV1NfRElBTE9HLCBtU2hvd3NEaWFsb2cpOworICAgICAgICB9CisgICAgICAgIGlmIChtQmFja1N0YWNrSWQgIT0gLTEpIHsKKyAgICAgICAgICAgIG91dFN0YXRlLnB1dEludChTQVZFRF9CQUNLX1NUQUNLX0lELCBtQmFja1N0YWNrSWQpOworICAgICAgICB9CisgICAgfQorCisgICAgQE92ZX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sKKyAgICBmaW5hbCBTdHJpbmcgbVRhZzsKKyAgICBmaW5hbCBib29sZWFuIG1SZXRhaW5JbnN0YW5jZTsKKyAgICBmaW5hbCBCdW5kbGUgbUFyZ3VtZW50czsKKyAgICAKKyAgICBCdW5kbGUgbVNhdmVkRnJhZ21lbnRTdGF0ZTsKKyAgICAKKyAgICBGcmFnbWVudCBtSW5zdGFuY2U7CisgICAgCisgICAgcHVibGljIEZyYWdtZW50U3RhdGUoRnJhZ21lbnQgZnJhZykgeworICAgICAgICBtQ2xhc3NOYW1lID0gZnJhZy5nZXRDbGFzcygpLmdldE5hbWUoKTsKKyAgICAgICAgbUluZGV4ID0gZnJhZy5tSW5kZXg7CisgICAgICAgIG1Gcm9tTGF5b3V0ID0gZnJhZy5tRnJvbUxheW91dDsKKyAgICAgICAgbUZyYWdtZW50SWQgPSBmcmFnLm1GcmFnbWVudElkOworICAgICAgICBtQ29udGFpbmVySWQgPSBmcmFnLm1Db250YWluZXJJZDsKKyAgICAgICAgbVRhZyA9IGZyYWcubVRhZzsKKyAgICAgICAgbVJldGFpbkluc3RhbmNlID0gZnJhZy5tUmV0YWluSW5zdGFuY2U7CisgICAgICAgIG1Bcmd1bWVudHMgPSBmcmFnLm1Bcmd1bWVudHM7CisgICAgfQorICAgIAorICAgIHB1YmxpYyBGcmFnbWVudFN0YXRlKFBhcmNlbCBpbikgeworICAgICAgICBtQ2xhc3NOYW1lID0gaW4ucmVhZFN0cmluZygpOworICAgICAgICBtSW5kZXggPSBpbi5yZWFkSW50KCk7CisgICAgICAgIG1Gcm9tTGF5b3V0ID0gaW4ucmVhZEludCgpICE9IDA7CisgICAgICAgIG1GcmFnbWVudElkID0gaW4ucmVhZEludCgpOworICAgICAgICBtQ29udGFpbmVySWQgPSBpbi5yZWFkSW50KCk7CisgICAgICAgIG1UYWcgPSBpbi5yZWFkU3RyaW5nKCk7CisgICAgICAgIG1SZXRhaW5JbnN0YW5jZSA9IGluLnJlYWRJbnQoKSAhPSAwOworICAgICAgICBtQXJndW1lbnRzID0gaW4ucmVhZEJ1bmRsZSgpOworICAgICAgICBtU2F2ZWRGcmFnbWVudFN0YXRlID0gaW4ucmVhZEJ1bmRsZSgpOworICAgIH0KKyAgICAKKyAgICBwdWJsaWMgRnJhZ21lbnQgaW5zdGFudGlhdGUoQWN0aXZpdHkgYWN0aXZpdHkpIHsKKyAgICAgICAgaWYgKG1JbnN0YW5jZSAhPSBudWxsKSB7CisgICAgICAgICAgICByZXR1cm4gbUluc3RhbmNlOworICAgICAgICB9CisgICAgICAgIAorICAgICAgICBtSW5zdGFuY2UgPSBGcmFnbWVudC5pbnN0YW50aWF0ZShhY3Rpdml0eSwgbUNsYXNzTmFtZSwgbUFyZ3VtZW50cyk7CisgICAgICAgIAorICAgICAgICBpZiAobVNhdmVkRnJhZ21lbnRTdGF0ZSAhPSBudWxsKSB7CisgICAgICAgICAgICBtU2F2ZWRGcmFnbWVudFN0YXRlLnNldENsYXNzTG9hZGVyKGFjdGl2aXR5LmdldENsYXNzTG9hZGVyKCkpOworICAgICAgICAgICAgbUluc3RhbmNlLm1TYXZlZEZyYWdtZW50U3RhdGUgPSBtU2F2ZWRGcmFnbWVudFN0YXRlOworICAgICAgICB9CisgICAgICAgIG1JbnN0YW5jZS5zZXRJbmRleChtSW5kZXgpOworICAgICAgICBtSW5zdGFuY2UubUZyb21MYXlvdXQgPSBtRnJvbUxheW91dDsKKyAgICAgICAgbUluc3RhbmNlLm1GcmFnbWVudElkID0gbUZyYWdtZW50SWQ7CisgICAgICAgIG1JbnN0YW5jZS5tQ29udGFpbmVySWQgPSBtQ29udGFpbmVySWQ7CisgICAgICAgIG1JbnN0YW5jZS5tVGFnID0gbVRhZzsKKyAgICAgICAgbUluc3RhbmNlLm1SZXRhaW5JbnN0YW5jZSA9IG1SZXRhaW5JbnN0YW5jZTsKKyAgICAgICAgCisgICAgICAgIHJldHVybiBtSW5zdGFuY2U7CisgICAgfQorICAgIAorICAgIHB1YmxpYyBpbnQgZGVzY3JpYmVDb250ZW50cygpIHsKKyAgICAgICAgcmV0dXJuIDA7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgd3JpdGVUb1BhcmNlbChQYXJjZWwgZGVzdCwgaW50IGZsYWdzKSB7CisgICAgICAgIGRlc3Qud3JpdGVTdHJpbmcobUNsYXNzTmFtZSk7CisgICAgICAgIGRlc3Qud3JpdGVJbnQobUluZGV4KTsKKyAgICAgICAgZGVzdC53cml0ZUludChtRnJvbUxheW91dCA/IDEgOiAwKTsKKyAgICAgICAgZGVzdC53cml0ZUludChtRnJhZ21lbnRJZCk7CisgICAgICAgIGRlc3Qud3JpdGVJbnQobUNvbnRhaW5lcklkKTsKKyAgICAgICAgZGVzdC53cml0ZVN0cmluZyhtVGFnKTsKKyAgICAgICAgZGVzdC53cml0ZUludChtUmV0YWluSW5zdGFuY2UgPyAxIDogMCk7CisgICAgICAgIGRlc3Qud3JpdGVCdW5kbGUobUFyZ3VtZW50cyk7CisgICAgICAgIGRlc3Qud3JpdGVCdW5kbGUobVNhdmVkRnJhZ21lbnRTdGF0ZSk7CisgICAgfQorICAgIAorICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgUGFyY2VsYWJsZS5DcmVhdG9yPEZyYWdtZW50U3RhdGU+IENSRUFUT1IKKyAgICAgICAgICAgID0gbmV3IFBhcmNlbGFibGUuQ3JlYXRvcjxGcmFnbWVudFN0YXRlPigpIHsKKyAgICAgICAgcHVibGljIEZyYWdtZW50U3RhdGUgY3JlYXRlRnJvbVBhcmNlbChQYXJjZWwgaW4pIHsKKyAgICAgICAgICAgIHJldHVybiBuZXcgRnJhZ21lbnRTdGF0ZShpbik7CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIHB1YmxpYyBGcmFnbWVudFN0YXRlW10gbmV3QXJyYXkoaW50IHNpemUpIHsKKyAgICAgICAgICAgIHJldHVybiBuZXcgRnJhZ21lbnRTdGF0ZVtzaXplXTsKKyAgICAgICAgfQorICAgIH07Cit9CisKKy8qKgor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YXNzTWFwLnB1dChmbmFtZSwgY2xhenopOworICAgICAgICAgICAgfQorICAgICAgICAgICAgRnJhZ21lbnQgZiA9IChGcmFnbWVudCljbGF6ei5uZXdJbnN0YW5jZSgpOworICAgICAgICAgICAgaWYgKGFyZ3MgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIGFyZ3Muc2V0Q2xhc3NMb2FkZXIoZi5nZXRDbGFzcygpLmdldENsYXNzTG9hZGVyKCkpOworICAgICAgICAgICAgICAgIGYubUFyZ3VtZW50cyA9IGFyZ3M7CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gZjsKKyAgICAgICAgfSBjYXRjaCAoQ2xhc3NOb3RGb3VuZEV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgSW5zdGFudGlhdGlvbkV4Y2VwdGlvbigiVW5hYmxlIHRvIGluc3RhbnRpYXRlIGZyYWdtZW50ICIgKyBmbmFtZQorICAgICAgICAgICAgICAgICAgICArICI6IG1ha2Ugc3VyZSBjbGFzcyBuYW1lIGV4aXN0cywgaXMgcHVibGljLCBhbmQgaGFzIGFuIgorICAgICAgICAgICAgICAgICAgICArICIgZW1wdHkgY29uc3RydWN0b3IgdGhhdCBpcyBwdWJsaWMiLCBlKTsKKyAgICAgICAgfSBjYXRjaCAoamF2YS5sYW5nLkluc3RhbnRpYXRpb25FeGNlcHRpb24gZSkgeworICAgICAgICAgICAgdGhyb3cgbmV3IEluc3RhbnRpYXRpb25FeGNlcHRpb24oIlVuYWJsZSB0byBpbnN0YW50aWF0ZSBmcmFnbWVudCAiICsgZm5hbWUKKyAgICAgICAgICAgICAgICAgICAgKyAiOiBtYWtlIHN1cmUgY2xhc3MgbmFtZSBleGlzdHMsIGlzIHB1YmxpYywgYW5kIGhhcyBhbiIKKyAgICAgICAgICAgICAgICAgICAgKyAiIGVtcHR5IGNvbnN0cnVjdG9yIHRoYXQgaXMgcHVibGljIiwgZSk7CisgICAgICAgIH0gY2F0Y2ggKElsbGVnYWxBY2Nlc3NFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgdGhyb3cgbmV3IEluc3RhbnRpYXRpb25FeGNlcHRpb24oIlVuYWJsZSB0byBpbnN0YW50aWF0ZSBmcmFnbWVudCAiICsgZm5hbWUKKyAgICAgICAgICAgICAgICAgICAgKyAiOiBtYWtlIHN1cmUgY2xhc3MgbmFtZSBleGlzdHMsIGlzIHB1YmxpYywgYW5kIGhhcyBhbiIKKyAgICAgICAgICAgICAgICAgICAgKyAiIGVtcHR5IGNvbnN0cnVjdG9yIHRoYXQgaXMgcHVibGljIiwgZSk7CisgICAgICAgIH0KKyAgICB9CisgICAgCisgICAgdm9pZCByZXN0b3JlVmlld1N0YXRlKCkgeworICAgICAgICBpZiAobVNhdmVkVmlld1N0YXRlICE9IG51bGwpIHsKKyAgICAgICAgICAgIG1WaWV3LnJlc3RvcmVIaWVyYXJjaHlTdGF0ZShtU2F2ZWRWaWV3U3RhdGUpOworICAgICAgICAgICAgbVNhdmVkVmlld1N0YXRlID0gbnVsbDsKKyAgICAgICAgfQorICAgIH0KKyAgICAKKyAgICB2b2lkIHNldEluZGV4KGludCBpbmRleCkgeworICAgICAgICBtSW5kZXggPSBpbmRleDsKKyAgICAgICAgbVdobyA9ICJhbmRyb2lkOmZyYWdtZW50OiIgKyBtSW5kZXg7CisgICB9CisgICAgCisgICAgdm9pZCBjbGVhckluZGV4KCkgeworICAgICAgICBtSW5kZXggPSAtMTsKKyAgICAgICAgbVdobyA9IG51bGw7CisgICAgfQorICAgIAorICAgIC8qKgorICAgICAqIFN1YmNsYXNzZXMgY2FuIG5vdCBvdmVycmlkZSBlcXVhbHMoKS4KKyAgICAgKi8KKyAgICBAT3ZlcnJpZGUgZmluYWwgcHVibGljIGJvb2xlYW4gZXF1YWxzKE9iamVjdCBvKSB7CisgICAgICAgIHJldHVybiBzdXBlci5lcXVhbHMobyk7CisgICAgfQorCisgICAgLyoqCisgICAgICogU3ViY2xhc3NlcyBjYW4gbm90IG92ZXJyaWRlIGhhc2hDb2RlKCkuCisgICAgICovCisgICAgQE92ZXJyaWRlIGZpbmFsIHB1YmxpYyBpbnQgaGFzaENvZGUoKSB7CisgICAgICAgIHJldHVybiBzdXBlci5oYXNoQ29kZSgpOworICAgIH0KKyAgICAKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgU3RyaW5nIHRvU3RyaW5nKCkgeworICAgICAgICBTdHJpbmdCdWlsZGVyIHNiID0gbmV3IFN0cmluZ0J1aWxkZXIoMTI4KTsKKyAgICAgICAgc2IuYXBwZW5kKCJGcmFnbWVudHsiKTsKKyAgICAgICAgc2IuYXBwZW5kKEludGVnZXIudG9IZXhTdHJpbmcoU3lzdGVtLmlkZW50aXR5SGFzaENvZGUodGhpcykpKTsKKyAgICAgICAgaWYgKG1JbmRleCA+PSAwKSB7CisgICAgICAgICAgICBzYi5hcHBlbmQoIiAjIik7CisgICAgICAgICAgICBzYi5hcHBlbmQobUluZGV4KTsKKyAgICAgICAgfQorICAgICAgICBpZiAobUZyYWdtZW50SWQgIT0gMCkgeworICAgICAgICAgICAgc2IuYXBwZW5kKCIgaWQ9MHgiKTsKKyAgICAgICAgICAgIHNiLmFwcGVuZChJbnRlZ2VyLnRvSGV4U3RyaW5nKG1GcmFnbWVudElkKSk7CisgICAgICAgIH0KKyAgICAgICAgaWYgKG1UYWcgIT0gbnVsbCkgeworICAgICAgICAgICAgc2IuYXBwZW5kKCIgIik7CisgICAgICAgICAgICBzYi5hcHBlbmQobVRhZyk7CisgICAgICAgIH0KKyAgICAgICAgc2IuYXBwZW5kKCd9Jyk7CisgICAgICAgIHJldHVybiBzYi50b1N0cmluZygpOworICAgIH0KKyAgICAKKyAgICAvKioKKyAgICAgKiBSZXR1cm4gdGhlIGlkZW50aWZpZXIgdGhpcyBmcmFnbWVudCBpcyBrbm93biBieS4gIFRoaXMgaXMgZWl0aGVyCisgICAgICogdGhlIGFuZHJvaWQ6aWQgdmFsdWUgc3VwcGxpZWQga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cmVxdWVzdENvZGUpIHsKKyAgICAgICAgbVRhcmdldCA9IGZyYWdtZW50OworICAgICAgICBtVGFyZ2V0UmVxdWVzdENvZGUgPSByZXF1ZXN0Q29kZTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBSZXR1cm4gdGhlIHRhcmdldCBmcmFnbWVudCBzZXQgYnkge0BsaW5rICNzZXRUYXJnZXRGcmFnbWVudH0uCisgICAgICovCisgICAgZmluYWwgcHVibGljIEZyYWdtZW50IGdldFRhcmdldEZyYWdtZW50KCkgeworICAgICAgICByZXR1cm4gbVRhcmdldDsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBSZXR1cm4gdGhlIHRhcmdldCByZXF1ZXN0IGNvZGUgc2V0IGJ5IHtAbGluayAjc2V0VGFyZ2V0RnJhZ21lbnR9LgorICAgICAqLworICAgIGZpbmFsIHB1YmxpYyBpbnQgZ2V0VGFyZ2V0UmVxdWVzdENvZGUoKSB7CisgICAgICAgIHJldHVybiBtVGFyZ2V0UmVxdWVzdENvZGU7CisgICAgfQorCisgICAgLyoqCisgICAgICogUmV0dXJuIHRoZSBBY3Rpdml0eSB0aGlzIGZyYWdtZW50IGlzIGN1cnJlbnRseSBhc3NvY2lhdGVkIHdpdGguCisgICAgICovCisgICAgZmluYWwgcHVibGljIEFjdGl2aXR5IGdldEFjdGl2aXR5KCkgeworICAgICAgICByZXR1cm4gbUFjdGl2aXR5OworICAgIH0KKyAgICAKKyAgICAvKioKKyAgICAgKiBSZXR1cm4gdGhlIEZyYWdtZW50TWFuYWdlciBmb3IgaW50ZXJhY3Rpbmcgd2l0aCBmcmFnbWVudHMgYXNzb2NpYXRlZAorICAgICAqIHdpdGggdGhpcyBmcmFnbWVudCdzIGFjdGl2aXR5LgorICAgICAqLworICAgIGZpbmFsIHB1YmxpYyBGcmFnbWVudE1hbmFnZXIgZ2V0RnJhZ21lbnRNYW5hZ2VyKCkgeworICAgICAgICByZXR1cm4gbUFjdGl2aXR5Lm1GcmFnbWVud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aW5JbnN0YW5jZShib29sZWFuIHJldGFpbikgeworICAgICAgICBtUmV0YWluSW5zdGFuY2UgPSByZXRhaW47CisgICAgfQorICAgIAorICAgIGZpbmFsIHB1YmxpYyBib29sZWFuIGdldFJldGFpbkluc3RhbmNlKCkgeworICAgICAgICByZXR1cm4gbVJldGFpbkluc3RhbmNlOworICAgIH0KKyAgICAKKyAgICAvKioKKyAgICAgKiBSZXBvcnQgdGhhdCB0aGlzIGZyYWdtZW50IHdvdWxkIGxpa2UgdG8gcGFydGljaXBhdGUgaW4gcG9wdWxhdGluZworICAgICAqIHRoZSBvcHRpb25zIG1lbnUgYnkgcmVjZWl2aW5nIGEgY2FsbCB0byB7QGxpbmsgI29uQ3JlYXRlT3B0aW9uc01lbnV9CisgICAgICogYW5kIHJlbGF0ZWQgbWV0aG9kcy4KKyAgICAgKiAKKyAgICAgKiBAcGFyYW0gaGFzTWVudSBJZiB0cnVlLCB0aGUgZnJhZ21lbnQgaGFzIG1lbnUgaXRlbXMgdG8gY29udHJpYnV0ZS4KKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBzZXRIYXNPcHRpb25zTWVudShib29sZWFuIGhhc01lbnUpIHsKKyAgICAgICAgaWYgKG1IYXNNZW51ICE9IGhhc01lbnUpIHsKKyAgICAgICAgICAgIG1IYXNNZW51ID0gaGFzTWVudTsKKyAgICAgICAgICAgIGlmIChpc0FkZGVkKCkgJiYgIWlzSGlkZGVuKCkpIHsKKyAgICAgICAgICAgICAgICBtQWN0aXZpdHkuaW52YWxpZGF0ZU9wdGlvbnNNZW51KCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisgICAgCisgICAgLyoqCisgICAgICogUmV0dXJuIHRoZSBMb2FkZXJNYW5hZ2VyIGZvciB0aGlzIGZyYWdtZW50LCBjcmVhdGluZyBpdCBpZiBuZWVkZWQuCisgICAgICovCisgICAgcHVibGljIExvYWRlck1hbmFnZXIgZ2V0TG9hZGVyTWFuYWdlcigpIHsKKyAgICAgICAgaWYgKG1Mb2FkZXJNYW5hZ2VyICE9IG51bGwpIHsKKyAgICAgICAgICAgIHJldHVybiBtTG9hZGVyTWFuYWdlcjsKKyAgICAgICAgfQorICAgICAgICBtQ2hlY2tlZEZvckxvYWRlck1hbmFnZXIgPSB0cnVlOworICAgICAgICBtTG9hZGVyTWFuYWdlciA9IG1BY3Rpdml0eS5nZXRMb2FkZXJNYW5hZ2VyKG1JbmRleCwgbVN0YXJ0ZWQsIHRydWUpOworICAgICAgICByZXR1cm4gbUxvYWRlck1hbmFnZXI7CisgICAgfQorICAgIAorICAgIC8qKgorICAgICAqIENhbGwge0BsaW5rIEFjdGl2aXR5I3N0YXJ0QWN0aXZpdHkoSW50ZW50KX0gb24gdGhlIGZyYWdtZW50J3MKKyAgICAgKiBjb250YWluaW5nIEFjdGl2aXR5LgorICAgICAqLworICAgIHB1YmxpYyB2b2lkIHN0YXJ0QWN0aXZpdHkoSW50ZW50IGludGVudCkgeworICAgICAgICBtQWN0aXZpdHkuc3RhcnRBY3Rpdml0eUZyb21GcmFnbWVudCh0aGlzLCBpbnRlbnQsIC0xKTsKKyAgICB9CisgICAgCisgICAgLyoqCisgICAgICogQ2FsbCB7QGxpbmsgQWN0aXZpdHkjc3RhcnRBY3Rpdml0eUZvclJlc3VsdChJbnRlbnQsIGludCl9IG9uIHRoZSBmcmFnbWVudCdzCisgICAgICogY29udGFpbmluZyBBY3Rpdml0eS4KKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBzdGFydEFjdGl2aXR5Rm9yUmVzdWx0KEludGVudCBpbnRlbnQsIGludCByZXF1ZXN0Q29kZSkgeworICAgICAgICBtQWN0aXZpdHkuc3RhcnRBY3Rpdml0eUZyb21GcmFnbWVudCh0aGlzLCBpbnRlbnQsIHJlcXVlc3RDb2RlKTsKKyAgICB9CisgICAgCisgICAgLyoqCisgICAgICogUmVjZWl2ZSB0aGUgcmVzdWx0IGZyb20gYSBwcmV2aW91cyBjYWxsIHRvCisgICAgICoge0BsaW5rICNzdGFydEFjdGl2aXR5Rm9yUmVzdWx0KEludGVudCwgaW50KX0uICBUaGlzIGZvbGxvd3MgdGhlCisgICAgICogcmVsYXRlZCBBY3Rpdml0eSBBUEkgYXMgZGVzY3JpYmVkIHRoZXJlIGluCisgICAgICoge0BsaW5rIEFjdGl2aXR5I29uQWN0aXZpdHlSZXN1bHQoaW50LCBpbnQsIEludGVudCl9LgorICAgICAqIAorICAgICAqIEBwYXJhbSByZXF1ZXN0Q29kZSBUaGUgaW50ZWdlciByZXF1ZXN0IGNvZGUgb3JpZ2luYWxseSBzdXBwbGllZCB0bworICAgICAqICAgICAgICAgICAgICAgICAgICBzdGFydEFjdGl2aXR5Rm9yUmVzdWx0KCksIGFsbG93aW5nIHlvdSB0byBpZGVudGlmeSB3aG8gdGhpcworICAgICAqICAgICAgICAgICAgICAgICAgICByZXN1bHQgY2FtZSBmcm9tLgorICAgICAqIEBwYXJhbSByZXN1bHRDb2RlIFRoZSBpbnRlZ2VyIHJlc3VsdCBjb2RlIHJldHVybmVkIGJ5IHRoZSBjaGlsZCBhY3Rpdml0eQorICAgICAqICAgICAgICAgICAgICAgICAgIHRocm91Z2ggaXRzIHNldFJlc3VsdCgpLgorICAgICAqIEBwYXJhbSBkYXRhIEFuIEludGVudCwgd2hpY2ggY2FuIHJldHVybiByZXN1bHQgZGF0YSB0byB0aGUgY2FsbGVyCisgICAgICogICAgICAgICAgICAgICAodmFyaW91cyBkYXRhIGNhbiBiZSBhdHRhY2hlZCB0byBJbnRlbnQgImV4dHJhcyIpLgorICAgICAqLworICAgIHB1YmxpYyB2b2lkIG9uQWN0aXZpdHlSZXN1bHQoaW50IHJlcXVlc3RDb2RlLCBpbnQgcmVzdWx0Q29kZSwgSW50ZW50IGRhdGEpIHsKKyAgICB9CisgICAgCisgICAgLyoqCisgICAgICogQ2FsbGVkIHdoZW4gYSBmcmFnbWVudCBpcyBiZWluZyBjcmVhdGVkIGFzIHBhcnQgb2YgYSB2aWV3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laGF2aW9yLgorICAgICAqIDxwPgorICAgICAqIEl0IGlzIG5vdCBzYWZlIHRvIGhvbGQgb250byB0aGUgY29udGV4dCBtZW51IGFmdGVyIHRoaXMgbWV0aG9kIHJldHVybnMuCisgICAgICoge0Bpbmhlcml0RG9jfQorICAgICAqLworICAgIHB1YmxpYyB2b2lkIG9uQ3JlYXRlQ29udGV4dE1lbnUoQ29udGV4dE1lbnUgbWVudSwgVmlldyB2LCBDb250ZXh0TWVudUluZm8gbWVudUluZm8pIHsKKyAgICAgICAgZ2V0QWN0aXZpdHkoKS5vbkNyZWF0ZUNvbnRleHRNZW51KG1lbnUsIHYsIG1lbnVJbmZvKTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBSZWdpc3RlcnMgYSBjb250ZXh0IG1lbnUgdG8gYmUgc2hvd24gZm9yIHRoZSBnaXZlbiB2aWV3IChtdWx0aXBsZSB2aWV3cworICAgICAqIGNhbiBzaG93IHRoZSBjb250ZXh0IG1lbnUpLiBUaGlzIG1ldGhvZCB3aWxsIHNldCB0aGUKKyAgICAgKiB7QGxpbmsgT25DcmVhdGVDb250ZXh0TWVudUxpc3RlbmVyfSBvbiB0aGUgdmlldyB0byB0aGlzIGZyYWdtZW50LCBzbworICAgICAqIHtAbGluayAjb25DcmVhdGVDb250ZXh0TWVudShDb250ZXh0TWVudSwgVmlldywgQ29udGV4dE1lbnVJbmZvKX0gd2lsbCBiZQorICAgICAqIGNhbGxlZCB3aGVuIGl0IGlzIHRpbWUgdG8gc2hvdyB0aGUgY29udGV4dCBtZW51LgorICAgICAqIAorICAgICAqIEBzZWUgI3VucmVnaXN0ZXJGb3JDb250ZXh0TWVudShWaWV3KQorICAgICAqIEBwYXJhbSB2aWV3IFRoZSB2aWV3IHRoYXQgc2hvdWxkIHNob3cgYSBjb250ZXh0IG1lbnUuCisgICAgICovCisgICAgcHVibGljIHZvaWQgcmVnaXN0ZXJGb3JDb250ZXh0TWVudShWaWV3IHZpZXcpIHsKKyAgICAgIC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RoZSBlbnRyeSBpbiB0aGUgYnVuZGxlLgorICAgICAqIEByZXR1cm4gUmV0dXJucyB0aGUgY3VycmVudCBGcmFnbWVudCBpbnN0YW5jZSB0aGF0IGlzIGFzc29jaWF0ZWQgd2l0aAorICAgICAqIHRoZSBnaXZlbiByZWZlcmVuY2UuCisgICAgICovCisgICAgcHVibGljIEZyYWdtZW50IGdldEZyYWdtZW50KEJ1bmRsZSBidW5kbGUsIFN0cmluZyBrZXkpOworfQorCitmaW5hbCBjbGFzcyBGcmFnbWVudE1hbmFnZXJTdGF0ZSBpbXBsZW1lbnRzIFBhcmNlbGFibGUgeworICAgIEZyYWdtZW50U3RhdGVbXSBtQWN0aXZlOworICAgIGludFtdIG1BZGRlZDsKKyAgICBCYWNrU3RhY2tTdGF0ZVtdIG1CYWNrU3RhY2s7CisgICAgCisgICAgcHVibGljIEZyYWdtZW50TWFuYWdlclN0YXRlKCkgeworICAgIH0KKyAgICAKKyAgICBwdWJsaWMgRnJhZ21lbnRNYW5hZ2VyU3RhdGUoUGFyY2VsIGluKSB7CisgICAgICAgIG1BY3RpdmUgPSBpbi5jcmVhdGVUeXBlZEFycmF5KEZyYWdtZW50U3RhdGUuQ1JFQVRPUik7CisgICAgICAgIG1BZGRlZCA9IGluLmNyZWF0ZUludEFycmF5KCk7CisgICAgICAgIG1CYWNrU3RhY2sgPSBpbi5jcmVhdGVUeXBlZEFycmF5KEJhY2tTdGFja1N0YXRlLkNSRUFUT1IpOworICAgIH0KKyAgICAKKyAgICBwdWJsaWMgaW50IGRlc2NyaWJlQ29udGVudHMoKSB7CisgICAgICAgIHJldHVybiAwOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHdyaXRlVG9QYXJjZWwoUGFyY2VsIGRlc3QsIGludCBmbGFncykgeworICAgICAgICBkZXN0LndyaXRlVHlwZWRBcnJheShtQWN0aXZlLCBmbGFncyk7CisgICAgICAgIGRlc3Qud3JpdGVJbnRBcnJheShtQWRkZWQpOworICAgICAgICBkZXN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AgICAgICAgICAgICAgICAgICArICIgaXMgbm90IGN1cnJlbnRseSBpbiB0aGUgRnJhZ21lbnRNYW5hZ2VyIik7CisgICAgICAgIH0KKyAgICAgICAgYnVuZGxlLnB1dEludChrZXksIGZyYWdtZW50Lm1JbmRleCk7CisgICAgfQorCisgICAgcHVibGljIEZyYWdtZW50IGdldEZyYWdtZW50KEJ1bmRsZSBidW5kbGUsIFN0cmluZyBrZXkpIHsKKyAgICAgICAgaW50IGluZGV4ID0gYnVuZGxlLmdldEludChrZXksIC0xKTsKKyAgICAgICAgaWYgKGluZGV4ID09IC0xKSB7CisgICAgICAgICAgICByZXR1cm4gbnVsbDsKKyAgICAgICAgfQorICAgICAgICBpZiAoaW5kZXggPj0gbUFjdGl2ZS5zaXplKCkpIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oIkZyYWdlbWVudCBubyBsb25nZXIgZXhpc3RzIGZvciBrZXkgIgorICAgICAgICAgICAgICAgICAgICArIGtleSArICI6IGluZGV4ICIgKyBpbmRleCk7CisgICAgICAgIH0KKyAgICAgICAgRnJhZ21lbnQgZiA9IG1BY3RpdmUuZ2V0KGluZGV4KTsKKyAgICAgICAgaWYgKGYgPT0gbnVsbCkgeworICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigiRnJhZ2VtZW50IG5vIGxvbmdlciBleGlzdHMgZm9yIGtleSAiCisgICAgICAgICAgICAgICAgICAgICsga2V5ICsgIjogaW5kZXggIiArIGluZGV4KTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gZjsKKyAgICB9CisKKyAgICBBbmltYXRhYmxlIGxvYWRBbmltYXRhYmxlKEZyYWdtZW50IGZyYWdtZW50LCBpbnQgdHJhbnNpdCwgYm9vbGVhbiBlbnRlciwKKyAgICAgICAgICAgIGludCB0cmFuc2l0aW9uU3R5bGUpIHsKKyAgICAgICAgQW5pbWF0YWJsZSBhbmltT2JqID0gZnJhZ21lbnQub25DcmVhdGVBbmltYXRhYmxlKHRyYW5zaXQsIGVudGVyLAorICAgICAgICAgICAgICAgIGZyYWdtZW50Lm1OZXh0QW5pbSk7CisgICAgICAgIGlmIChhbmltT2JqICE9IG51bGwpIHsKKyAgICAgICAgICAgIHJldHVybiBhbmltT2JqOworICAgICAgICB9CisgICAgICAgIAorICAgICAgICBpZiAoZnJhZ21lbnQubU5leHRBbmltICE9IDApIHsKKyAgICAgICAgICAgIEFuaW1hdGFibGUgYW5pbSA9IEFuaW1hdGlvblV0aWxzLmxvYWRBbmltYXRvcihtQWN0aXZpdHksIGZyYWdtZW50Lm1OZXh0QW5pbSk7CisgICAgICAgICAgICBpZiAoYW5pbSAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIGFuaW07CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIGlmICh0cmFuc2l0ID09IDApIHsKKyAgICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICB9CisgICAgICAgIAorICAgICAgICBpbnQgc3R5bGVJbmRleCA9IHRyYW5zaXRUb1N0eWxlSW5kZXgodHJhbnNpdCwgZW50ZXIpOworICAgICAgICBpZiAoc3R5bGVJbmRleCA8IDApIHsKKyAgICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICB9CisgICAgICAgIAorICAgICAgICBpZiAodHJhbnNpdGlvblN0eWxlID09IDAgJiYgbUFjdGl2aXR5LmdldFdpbmRvdygpICE9IG51bGwpIHsKKyAgICAgICAgICAgIHRyYW5zaXRpb25TdHlsZSA9IG1BY3Rpdml0eS5nZXRXaW5kb3coKS5nZXRBdHRyaWJ1dGVzKCkud2luZG93QW5pbWF0aW9uczsKKyAgICAgICAgfQorICAgICAgICBpZiAodHJhbnNpdGlvblN0eWxlID09IDApIHsKKyAgICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICB9CisgICAgICAgIAorICAgICAgICBUeXBlZEFycmF5IGF0dHJzID0gbUFjdGl2aXR5Lm9idGFpblN0eWxlZEF0dHJpYnV0ZXModHJhbnNpdGlvblN0eWxlLAorICAgICAgICAgICAgICAgIGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3R5bGVhYmxlLkZyYWdtZW50QW5pbWF0aW9uKTsKKyAgICAgICAgaW50IGFuaW0gPSBhdHRycy5nZXRSZXNvdXJjZUlkKHN0eWxlSW5kZXgsIDApOworICAgICAgICBhdHRycy5yZWN5Y2xlKCk7CisgICAgICAgIAorICAgICAgICBpZiAoYW5pbSA9PSAwKSB7CisgICAgICAgICAgICByZXR1cm4gbnVsbDsKKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgcmV0dXJuIEFuaW1hdGlvblV0aWxzLmxvYWRBbmltYXRvcihtQWN0aXZpdHksIGFuaW0pOworICAgIH0KKyAgICAKKyAgICB2b2lkIG1vdmVUb1N0YXRlKEZyYWdtZW50IGYsIGludCBuZXdTdGF0ZSwgaW50IHRyYW5zaXQsIGludCB0cmFuc2l0aW9uU3R5bGUpIHsKKyAgICAgICAgLy8gRnJhZ21lbnRzIHRoYXQgYXJlIG5vdCBjdXJyZW50bHkgYWRkZWQgd2lsbCBzaXQgaW4gdGhlIG9uQ3JlYXRlKCkgc3RhdGUuCisgICAgICAgIGlmICghZi5tQWRkZWQgJiYgbmV3U3RhdGUgPiBGcmFnbWVudC5DUkVBVEVEKSB7CisgICAgICAgICAgICBuZXdTdGF0ZSA9IEZyYWdtZW50LkNSRUFURUQ7CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIGlmIChmLm1TdGF0ZSA8IG5ld1N0YXRlKSB7CisgICAgICAgICAgICBzd2l0Y2ggKGYubVN0YXRlKSB7CisgICAgICAgICAgICAgICAgY2FzZSBGcmFnbWVudC5JTklUSUFMSVpJTkc6CisgICAgICAgICAgICAgICAgICAgIGlmIChERUJVRykgTG9nLnYoVEFHLCAibW92ZXRvIENSRUFURUQ6ICIgKyBmKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGYubVNhdmVkRnJhZ21lbnRTdGF0ZSAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBmLm1TYXZlZFZpZXdTdGF0ZSA9IGYubVNhdmVkRnJhZ21lbnRTdGF0ZS5nZXRTcGFyc2VQYXJjZWxhYmxlQXJyYXkoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEZyYWdtZW50TWFuYWdlckltcGwuVklFV19TVEFURV9UQUcpOworICAgICAgICAgICAgICAgICAgICAgICAgZi5tVGFyZ2V0ID0gZ2V0RnJhZ21lbnQoZi5tU2F2ZWRGcmFnbWVudFN0YXRlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBGcmFnbWVudE1hbmFnZXJJbXBsLlRBUkdFVF9TVEFURV9UQUcpOworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGYubVRhcmdldCAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZi5tVGFyZ2V0UmVxdWVzdENvZGUgPSBmLm1TYXZlZEZyYWdtZW50U3RhdGUuZ2V0SW50KAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRnJhZ21lbnRNYW5hZ2VySW1wbC5UQVJHRVRfUkVRVUVTVF9DT0RFX1NUQVRFX1RBRywgMCk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgZi5tQWN0aXZpdHkgPSBtQWN0aXZpdHk7CisgICAgICAgICAgICAgICAgICAgIGYubUNhbGxlZCA9IGZhbHNlOworICAgICAgICAgICAgICAgICAgICBmLm9uQXR0YWNoKG1BY3Rpdml0eSk7CisgICAgICAgICAgICAgICAgICAgIGlmICghZi5tQ2FsbGVkKSB7CisgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgU3VwZXJOb3RDYWxsZWRFeGNlcHRpb24oIkZyYWdtZW50ICIgKyBmCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgIiBkaWQgbm90IGNhbGwgdGhyb3VnaCB0byBzdXBlci5vbkF0dGFjaCgpIik7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgbUFjdGl2aXR5Lm9uQXR0YWNoRnJhZ21lbnQoZik7CisgICAgICAgICAgICAgICAgICAgIAorICAgICAgICAgICAgICAgICAgICBpZiAoIWYubVJldGFpbmluZykgeworICAgICAgICAgICAgICAgICAgICAgICAgZi5tQ2FsbGVkID0gZmFsc2U7CisgICAgICAgICAgICAgICAgICAgICAgICBmLm9uQ3JlYXRlKGYubVNhdmVkRnJhZ21lbnRTdGF0ZSk7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWYubUNhbGxlZCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBTdXBlck5vdENhbGxlZEV4Y2VwdGlvbigiRnJhZ21lbnQgIiArIGYKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgIiBkaWQgbm90IGNhbGwgdGhyb3VnaCB0byBzdXBlci5vbkNyZWF0ZSgpIik7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgZi5tUmV0YWluaW5nID0gZmFsc2U7CisgICAgICAgICAgICAgICAgICAgIGlmIChmLm1Gcm9tTGF5b3V0KSB7CisgICAgICAgICAgICAgICAgICAgICAgICAvLyBGb3IgZnJhZ21lbnRzIHRoYXQgYXJlIHBhcnQgb2YgdGhlIGNvbnRlbnQgdmlldworICAgICAgICAgICAgICAgICAgICAgICAgLy8gbGF5b3V0LCB3ZSBuZWVkIHRvIGluc3RhbnRpYXRlIHRoZSB2aWV3IGltbWVkaWF0ZWx5CisgICAgICAgICAgICAgICAgICAgICAgICAvLyBhbmQgdGhlIGluZmxhdGVyIHdpbGwgdGFrZSBjYXJlIG9mIGFkZGluZyBpdC4KKyAgICAgICAgICAgICAgICAgICAgICAgIGYubVZpZXcgPSBmLm9uQ3JlYXRlVmlldyhtQWN0aXZpdHkuZ2V0TGF5b3V0SW5mbGF0ZXIoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwgZi5tU2F2ZWRGcmFnbWVudFN0YXRlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChmLm1WaWV3ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBmLm1WaWV3LnNldFNhdmVGcm9tUGFyZW50RW5hYmxlZChmYWxzZSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZi5yZXN0b3JlVmlld1N0YXRlKCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGYubUhpZGRlbikgZi5tVmlldy5zZXRWaXNpYmlsaXR5KFZpZXcuR09ORSk7IAorICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgY2FzZSBGcmFnbWVudC5DUkVBVEVEOgorICAgICAgICAgICAgICAgICAgICBpZiAobmV3U3RhdGUgPiBGcmFnbWVudC5DUkVBVEVEKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoREVCVUcpIExvZy52KFRBRywgIm1vdmV0byBDT05URU5UOiAiICsgZik7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWYubUZyb21MYXlvdXQpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBWaWV3R3JvdXAgY29udGFpbmVyID0gbnVsbDsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZi5tQ29udGFpbmVySWQgIT0gMCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250YWluZXIgPSAoVmlld0dyb3VwKW1BY3Rpdml0eS5maW5kVmlld0J5SWQoZi5tQ29udGFpbmVySWQpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoY29udGFpbmVyID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oIk5ldyB2aWV3IGZvdW5kIGZvciBpZCAweCIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyBJbnRlZ2VyLnRvSGV4U3RyaW5nKGYubUNvbnRhaW5lcklkKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArICIgZm9yIGZyYWdtZW50ICIgKyBmKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBmLm1Db250YWluZXIgPSBjb250YWluZXI7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZi5tVmlldyA9IGYub25DcmVhdGVWaWV3KG1BY3Rpdml0eS5nZXRMYXlvdXRJbmZsYXRlcigpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGFpbmVyLCBmLm1TYXZlZEZyYWdtZW50U3RhdGUpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChmLm1WaWV3ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZi5tVmlldy5zZXRTYXZlRnJvbVBhcmVudEVuYWJsZWQoZmFsc2UpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoY29udGFpbmVyICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFuaW1hdGFibGUgYW5pbSA9IGxvYWRBbmltYXRhYmxlKGYsIHRyYW5zaXQsIHRydWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYW5zaXRpb25TdHlsZSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYW5pbSAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGFuaW0gaW5zdGFuY2VvZiBTZXF1ZW5jZXIpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKChTZXF1ZW5jZXIpYW5pbSkuc2V0VGFyZ2V0KGYubVZpZXcpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoYW5pbSBpbnN0YW5jZW9mIFByb3BlcnR5QW5pbWF0b3IpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKChQcm9wZXJ0eUFuaW1hdG9yKWFuaW0pLnNldFRhcmdldChmLm1WaWV3KTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYW5pbS5zdGFydCgpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGFpbmVyLmFkZFZpZXcoZi5tVmlldyk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmLnJlc3RvcmVWaWV3U3RhdGUoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZi5tSGlkZGVuKSBmLm1WaWV3LnNldFZpc2liaWxpdHkoVmlldy5HT05FKTsgCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgCisgICAgICAgICAgICAgICAgICAgICAgICBmLm1DYWxsZWQgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGYub25BY3Rpdml0eUNyZWF0ZWQoZi5tU2F2ZWRGcmFnbWVudFN0YXRlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZi5tQ2FsbGVkKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFN1cGVyTm90Q2FsbGVkRXhjZXB0aW9uKCJGcmFnbWVudCAiICsgZgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyAiIGRpZCBub3QgY2FsbCB0aHJvdWdoIHRvIHN1cGVyLm9uUmVhZHkoKSIpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgZi5tU2F2ZWRGcmFnbWVudFN0YXRlID0gbnVsbDsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGNhc2UgRnJhZ21lbnQuQUNUSVZJVFlfQ1JFQVRFRDoKKyAgICAgICAgICAgICAgICAgICAgaWYgKG5ld1N0YXRlID4gRnJhZ21lbnQuQUNUSVZJVFlfQ1JFQVRFRCkgeworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKERFQlVHKSBMb2cudihUQUcsICJtb3ZldG8gU1RBUlRFRDogIiArIGYpOworICAgICAgICAgICAgICAgICAgICAgICAgZi5tQ2FsbGVkID0gZmFsc2U7CisgICAgICAgICAgICAgICAgICAgICAgICBmLm9uU3RhcnQoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZi5tQ2FsbGVkKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFN1cGVyTm90Q2FsbGVkRXhjZXB0aW9uKCJGcmFnbWVudCAiICsgZgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyAiIGRpZCBub3QgY2FsbCB0aHJvdWdoIHRvIHN1cGVyLm9uU3RhcnQoKSIpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgY2FzZSBGcmFnbWVudC5TVEFSVEVEOgorICAgICAgICAgICAgICAgICAgICBpZiAobmV3U3RhdGUgPiBGcmFnbWVudC5TVEFSVEVEKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoREVCVUcpIExvZy52KFRBRywgIm1vdmV0byBSRVNVTUVEOiAiICsgZik7CisgICAgICAgICAgICAgICAgICAgICAgICBmLm1DYWxsZWQgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGYubVJlc3VtZWQgPSB0cnVlOworICAgICAgICAgICAgICAgICAgICAgICAgZi5vblJlc3VtZSgpOworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFmLm1DYWxsZWQpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgU3VwZXJOb3RDYWxsZWRFeGNlcHRpb24oIkZyYWdtZW50ICIgKyBmCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArICIgZGlkIG5vdCBjYWxsIHRocm91Z2ggdG8gc3VwZXIub25SZXN1bWUoKSIpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0gZWxzZSBpZiAoZi5tU3RhdGUgPiBuZXdTdGF0ZSkgeworICAgICAgICAgICAgc3dpdGNoIChmLm1TdGF0ZSkgeworICAgICAgICAgICAgICAgIGNhc2UgRnJhZ21lbnQuUkVTVU1FRDoKKyAgICAgICAgICAgICAgICAgICAgaWYgKG5ld1N0YXRlIDwgRnJhZ21lbnQuUkVTVU1FRCkgeworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKERFQlVHKSBMb2cudihUQUcsICJtb3ZlZnJvbSBSRVNVTUVEOiAiICsgZik7CisgICAgICAgICAgICAgICAgICAgICAgICBmLm1DYWxsZWQgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGYub25QYXVzZSgpOworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFmLm1DYWxsZWQpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgU3VwZXJOb3RDYWxsZWRFeGNlcHRpb24oIkZyYWdtZW50ICIgKyBmCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArICIgZGlkIG5vdCBjYWxsIHRocm91Z2ggdG8gc3VwZXIub25QYXVzZSgpIik7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBmLm1SZXN1bWVkID0gZmFsc2U7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBjYXNlIEZyYWdtZW50LlNUQVJURUQ6CisgICAgICAgICAgICAgICAgICAgIGlmIChuZXdTdGF0ZSA8IEZyYWdtZW50LlNUQVJURUQpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChERUJVRykgTG9nLnYoVEFHLCAibW92ZWZyb20gU1RBUlRFRDogIiArIGYpOworICAgICAgICAgICAgICAgICAgICAgICAgZi5tQ2FsbGVkID0gZmFsc2U7CisgICAgICAgICAgICAgICAgICAgICAgICBmLnBlcmZvcm1TdG9wKCk7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWYubUNhbGxlZCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBTdXBlck5vdENhbGxlZEV4Y2VwdGlvbigiRnJhZ21lbnQgIiArIGYKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgIiBkaWQgbm90IGNhbGwgdGhyb3VnaCB0byBzdXBlci5vblN0b3AoKSIpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgY2FzZSBGcmFnbWVudC5BQ1RJVklUWV9DUkVBVEVEOgorICAgICAgICAgICAgICAgICAgICBpZiAobmV3U3RhdGUgPCBGcmFnbWVudC5BQ1RJVklUWV9DUkVBVEVEKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoREVCVUcpIExvZy52KFRBRywgIm1vdmVmcm9tIENPTlRFTlQ6ICIgKyBmKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChmLm1WaWV3ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBOZWVkIHRvIHNhdmUgdGhlIGN1cnJlbnQgdmlldyBzdGF0ZSBpZiBub3QKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBkb25lIGFscmVhZHkuCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFtQWN0aXZpdHkuaXNGaW5pc2hpbmcoKSAmJiBmLm1TYXZlZEZyYWdtZW50U3RhdGUgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzYXZlRnJhZ21lbnRWaWV3U3RhdGUoZik7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgZi5tQ2FsbGVkID0gZmFsc2U7CisgICAgICAgICAgICAgICAgICAgICAgICBmLm9uRGVzdHJveVZpZXcoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZi5tQ2FsbGVkKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFN1cGVyTm90Q2FsbGVkRXhjZXB0aW9uKCJGcmFnbWVudCAiICsgZgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyAiIGRpZCBub3QgY2FsbCB0aHJvdWdoIHRvIHN1cGVyLm9uRGVzdHJveWVkVmlldygpIik7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZi5tVmlldyAhPSBudWxsICYmIGYubUNvbnRhaW5lciAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1DdXJTdGF0ZSA+IEZyYWdtZW50LklOSVRJQUxJWklORykgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBbmltYXRhYmxlIGFuaW0gPSBsb2FkQW5pbWF0YWJsZShmLCB0cmFuc2l0LCB0cnVlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYW5zaXRpb25TdHlsZSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhbmltICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhbmltIGluc3RhbmNlb2YgU2VxdWVuY2VyKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKChTZXF1ZW5jZXIpYW5pbSkuc2V0VGFyZ2V0KGYubVZpZXcpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChhbmltIGluc3RhbmNlb2YgUHJvcGVydHlBbmltYXRvcikgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICgoUHJvcGVydHlBbmltYXRvcilhbmltKS5zZXRUYXJnZXQoZi5tVmlldyk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhbmltLnN0YXJ0KCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZi5tQ29udGFpbmVyLnJlbW92ZVZpZXcoZi5tVmlldyk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBmLm1Db250YWluZXIgPSBudWxsOworICAgICAgICAgICAgICAgICAgICAgICAgZi5tVmlldyA9IG51bGw7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBjYXNlIEZyYWdtZW50LkNSRUFURUQ6CisgICAgICAgICAgICAgICAgICAgIGlmIChuZXdTdGF0ZSA8IEZyYWdtZW50LkNSRUFURUQpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChERUJVRykgTG9nLnYoVEFHLCAibW92ZWZyb20gQ1JFQVRFRDogIiArIGYpOworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFmLm1SZXRhaW5pbmcpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBmLm1DYWxsZWQgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBmLm9uRGVzdHJveSgpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZi5tQ2FsbGVkKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBTdXBlck5vdENhbGxlZEV4Y2VwdGlvbigiRnJhZ21lbnQgIiArIGYKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArICIgZGlkIG5vdCBjYWxsIHRocm91Z2ggdG8gc3VwZXIub25EZXN0cm95KCkiKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICAKKyAgICAgICAgICAgICAgICAgICAgICAgIGYubUNhbGxlZCA9IGZhbHNlOworICAgICAgICAgICAgICAgICAgICAgICAgZi5vbkRldGFjaCgpOworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFmLm1DYWxsZWQpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgU3VwZXJOb3RDYWxsZWRFeGNlcHRpb24oIkZyYWdtZW50ICIgKyBmCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArICIgZGlkIG5vdCBjYWxsIHRocm91Z2ggdG8gc3VwZXIub25EZXRhY2goKSIpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgZi5tQWN0aXZpdHkgPSBudWxsOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIGYubVN0YXRlID0gbmV3U3RhdGU7CisgICAgfQorICAgIAorICAgIHZvaWQgbW92ZVRvU3RhdGUoaW50IG5ld1N0YXRlLCBib29sZWFuIGFsd2F5cykgeworICAgICAgICBtb3ZlVG9TdGF0ZShuZXdTdGF0ZSwgMCwgMCwgYWx3YXlzKTsKKyAgICB9CisgICAgCisgICAgdm9pZCBtb3ZlVG9TdGF0ZShpbnQgbmV3U3RhdGUsIGludCB0cmFuc2l0LCBpbnQgdHJhbnNpdFN0eWxlLCBib29sZWFuIGFsd2F5cykgeworICAgICAgICBpZiAobUFjdGl2aXR5ID09IG51bGwgJiYgbmV3U3RhdGUgIT0gRnJhZ21lbnQuSU5JVElBTElaSU5HKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJObyBhY3Rpdml0eSIpOworICAgICAgICB9CisgICAgICAgIAorICAgICAgICBpZiAoIWFsd2F5cyAmJiBtQ3VyU3RhdGUgPT0gbmV3U3RhdGUpIHsKKyAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgbUN1clN0YXRlID0gbmV3U3RhdGU7CisgICAgICAgIGlmIChtQWN0aXZlICE9IG51bGwpIHsKKyAgICAgICAgICAgIGZvciAoaW50IGk9MDsgaTxtQWN0aXZlLnNpemUoKTsgaSsrKSB7CisgICAgICAgICAgICAgICAgRnJhZ21lbnQgZiA9IG1BY3RpdmUuZ2V0KGkpOworICAgICAgICAgICAgICAgIGlmIChmICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgbW92ZVRvU3RhdGUoZiwgbmV3U3RhdGUsIHRyYW5zaXQsIHRyYW5zaXRTdHlsZSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorICAgIAorICAgIHZvaWQgbWFrZUFjdGl2ZShGcmFnbWVudCBmKSB7CisgICAgICAgIGlmIChmLm1JbmRleCA+PSAwKSB7CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIGlmIChtQXZhaWxJbmRpY2VzID09IG51bGwgfHwgbUF2YWlsSW5kaWNlcy5zaXplKCkgPD0gMCkgeworICAgICAgICAgICAgaWYgKG1BY3RpdmUgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgIG1BY3RpdmUgPSBuZXcgQXJyYXlMaXN0PEZyYWdtZW50PigpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgZi5zZXRJbmRleChtQWN0aXZlLnNpemUoKSk7CisgICAgICAgICAgICBtQWN0aXZlLmFkZChmKTsKKyAgICAgICAgICAgIAorICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgZi5zZXRJbmRleChtQXZhaWxJbmRpY2VzLnJlbW92ZShtQXZhaWxJbmRpY2VzLnNpemUoKS0xKSk7CisgICAgICAgICAgICBtQWN0aXZlLnNldChmLm1JbmRleCwgZik7CisgICAgICAgIH0KKyAgICB9CisgICAgCisgICAgdm9pZCBtYWtlSW5hY3RpdmUoRnJhZ21lbnQgZikgeworICAgICAgICBpZiAoZi5tSW5kZXggPCAwKSB7CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIGlmIChERUJVRykgTG9nLnYoVEFHLCAiRnJlZWluZyBmcmFnbWVudCBpbmRleCAiICsgZi5tSW5kZXgpOworICAgICAgICBtQWN0aXZlLnNldChmLm1JbmRleCwgbnVsbCk7CisgICAgICAgIGlmIChtQXZhaWxJbmRpY2VzID09IG51bGwpIHsKKyAgICAgICAgICAgIG1BdmFpbEluZGljZXMgPSBuZXcgQXJyYXlMaXN0PEludGVnZXI+KCk7CisgICAgICAgIH0KKyAgICAgICAgbUF2YWlsSW5kaWNlcy5hZGQoZi5tSW5kZXgpOworICAgICAgICBtQWN0aXZpdHkuaW52YWxpZGF0ZUZyYWdtZW50SW5kZXgoZi5tSW5kZXgpOworICAgICAgICBmLmNsZWFySW5kZXgoKTsKKyAgICB9CisgICAgCisgICAgcHVibGljIHZvaWQgYWRkRnJhZ21lbnQoRnJhZ21lbnQgZnJhZ21lbnQsIGJvb2xlYW4gbW92ZVRvU3RhdGVOb3cpIHsKKyAgICAgICAgaWYgKG1BZGRlZCA9PSBudWxsKSB7CisgICAgICAgICAgICBtQWRkZWQgPSBuZXcgQXJyYXlMaXN0PEZyYWdtZW50PigpOworICAgICAgICB9CisgICAgICAgIG1BZGRlZC5hZGQoZnJhZ21lbnQpOworICAgICAgICBtYWtlQWN0aXZlKGZyYWdtZW50KTsKKyAgICAgICAgaWYgKERFQlVHKSBMb2cudihUQUcsICJhZGQ6ICIgKyBmcmFnbWVudCk7CisgICAgICAgIGZyYWdtZW50Lm1BZGRlZCA9IHRydWU7CisgICAgICAgIGlmIChmcmFnbWVudC5tSGFzTWVudSkgeworICAgICAgICAgICAgbU5lZWRNZW51SW52YWxpZGF0ZSA9IHRydWU7CisgICAgICAgIH0KKyAgICAgICAgaWYgKG1vdmVUb1N0YXRlTm93KSB7CisgICAgICAgICAgICBtb3ZlVG9TdGF0ZShmcmFnbWVudCwgbUN1clN0YXRlLCAwLCAwKTsKKyAgICAgICAgfQorICAgIH0KKyAgICAKKyAgICBwdWJsaWMgdm9pZCByZW1vdmVGcmFnbWVudChGcmFnbWVudCBmcmFnbWVudCwgaW50IHRyYW5zaXRpb24sIGludCB0cmFuc2l0aW9uU3R5bGUpIHsKKyAgICAgICAgaWYgKERFQlVHKSBMb2cudihUQUcsICJyZW1vdmU6ICIgKyBmcmFnbWVudCArICIgbmVzdGluZz0iICsgZnJhZ21lbnQubUJhY2tTdGFja05lc3RpbmcpOworICAgICAgICBtQWRkZWQucmVtb3ZlKGZyYWdtZW50KTsKKyAgICAgICAgZmluYWwgYm9vbGVhbiBpbmFjdGl2ZSA9IGZyYWdtZW50Lm1CYWNrU3RhY2tOZXN0aW5nIDw9IDA7CisgICAgICAgIGlmIChmcmFnbWVudC5tSGFzTWVudSkgeworICAgICAgICAgICAgbU5lZWRNZW51SW52YWxpZGF0ZSA9IHRydWU7CisgICAgICAgIH0KKyAgICAgICAgZnJhZ21lbnQubUFkZGVkID0gZmFsc2U7CisgICAgICAgIG1vdmVUb1N0YXRlKGZyYWdtZW50LCBpbmFjdGl2ZSA/IEZyYWdtZW50LklOSVRJQUxJWklORyA6IEZyYWdtZW50LkNSRUFURUQsCisgICAgICAgICAgICAgICAgdHJhbnNpdGlvbiwgdHJhbnNpdGlvblN0eWxlKTsKKyAgICAgICAgaWYgKGluYWN0aXZlKSB7CisgICAgICAgICAgICBtYWtlSW5hY3RpdmUoZnJhZ21lbnQpOworICAgICAgICB9CisgICAgfQorICAgIAorICAgIHB1YmxpYyB2b2lkIGhpZGVGcmFnbWVudChGcmFnbWVudCBmcmFnbWVudCwgaW50IHRyYW5zaXRpb24sIGludCB0cmFuc2l0aW9uU3R5bGUpIHsKKyAgICAgICAgaWYgKERFQlVHKSBMb2cudihUQUcsICJoaWRlOiAiICsgZnJhZ21lbnQpOworICAgICAgICBpZiAoIWZyYWdtZW50Lm1IaWRkZW4pIHsKKyAgICAgICAgICAgIGZyYWdtZW50Lm1IaWRkZW4gPSB0cnVlOworICAgICAgICAgICAgaWYgKGZyYWdtZW50Lm1WaWV3ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBBbmltYXRhYmxlIGFuaW0gPSBsb2FkQW5pbWF0YWJsZShmcmFnbWVudCwgdHJhbnNpdGlvbiwgdHJ1ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgIHRyYW5zaXRpb25TdHlsZSk7CisgICAgICAgICAgICAgICAgaWYgKGFuaW0gIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICBpZiAoYW5pbSBpbnN0YW5jZW9mIFNlcXVlbmNlcikgeworICAgICAgICAgICAgICAgICAgICAgICAgKChTZXF1ZW5jZXIpYW5pbSkuc2V0VGFyZ2V0KGZyYWdtZW50Lm1WaWV3KTsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChhbmltIGluc3RhbmNlb2YgUHJvcGVydHlBbmltYXRvcikgeworICAgICAgICAgICAgICAgICAgICAgICAgKChQcm9wZXJ0eUFuaW1hdG9yKWFuaW0pLnNldFRhcmdldChmcmFnbWVudC5tVmlldyk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgYW5pbS5zdGFydCgpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBmcmFnbWVudC5tVmlldy5zZXRWaXNpYmlsaXR5KFZpZXcuR09ORSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoZnJhZ21lbnQubUFkZGVkICYmIGZyYWdtZW50Lm1IYXNNZW51KSB7CisgICAgICAgICAgICAgICAgbU5lZWRNZW51SW52YWxpZGF0ZSA9IHRydWU7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBmcmFnbWVudC5vbkhpZGRlbkNoYW5nZWQodHJ1ZSk7CisgICAgICAgIH0KKyAgICB9CisgICAgCisgICAgcHVibGljIHZvaWQgc2hvd0ZyYWdtZW50KEZyYWdtZW50IGZyYWdtZW50LCBpbnQgdHJhbnNpdGlvbiwgaW50IHRyYW5zaXRpb25TdHlsZSkgeworICAgICAgICBpZiAoREVCVUcpIExvZy52KFRBRywgInNob3c6ICIgKyBmcmFnbWVudCk7CisgICAgICAgIGlmIChmcmFnbWVudC5tSGlkZGVuKSB7CisgICAgICAgICAgICBmcmFnbWVudC5tSGlkZGVuID0gZmFsc2U7CisgICAgICAgICAgICBpZiAoZnJhZ21lbnQubVZpZXcgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIEFuaW1hdGFibGUgYW5pbSA9IGxvYWRBbmltYXRhYmxlKGZyYWdtZW50LCB0cmFuc2l0aW9uLCB0cnVlLAorICAgICAgICAgICAgICAgICAgICAgICAgdHJhbnNpdGlvblN0eWxlKTsKKyAgICAgICAgICAgICAgICBpZiAoYW5pbSAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIGlmIChhbmltIGluc3RhbmNlb2YgU2VxdWVuY2VyKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAoKFNlcXVlbmNlcilhbmltKS5zZXRUYXJnZXQoZnJhZ21lbnQubVZpZXcpOworICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGFuaW0gaW5zdGFuY2VvZiBQcm9wZXJ0eUFuaW1hdG9yKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAoKFByb3BlcnR5QW5pbWF0b3IpYW5pbSkuc2V0VGFyZ2V0KGZyYWdtZW50Lm1WaWV3KTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBhbmltLnN0YXJ0KCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGZyYWdtZW50Lm1WaWV3LnNldFZpc2liaWxpdHkoVmlldy5WSVNJQkxFKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmIChmcmFnbWVudC5tQWRkZWQgJiYgZnJhZ21lbnQubUhhc01lbnUpIHsKKyAgICAgICAgICAgICAgICBtTmVlZE1lbnVJbnZhbGlkYXRlID0gdHJ1ZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGZyYWdtZW50Lm9uSGlkZGVuQ2hhbmdlZChmYWxzZSk7CisgICAgICAgIH0KKyAgICB9CisgICAgCisgICAgcHVibGljIEZyYWdtZW50IGZpbmRGcmFnbWVudEJ5SWQoaW50IGlkKSB7CisgICAgICAgIGlmIChtQWN0aXZlICE9IG51bGwpIHsKKyAgICAgICAgICAgIC8vIEZpcnN0IGxvb2sgdGhyb3VnaCBhZGRlZCBmcmFnbWVudHMuCisgICAgICAgICAgICBmb3IgKGludCBpPW1BZGRlZC5zaXplKCktMTsgaT49MDsgaS0tKSB7CisgICAgICAgICAgICAgICAgRnJhZ21lbnQgZiA9IG1BZGRlZC5nZXQoaSk7CisgICAgICAgICAgICAgICAgaWYgKGYgIT0gbnVsbCAmJiBmLm1GcmFnbWVudElkID09IGlkKSB7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBmOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIC8vIE5vdyBmb3IgYW55IGtub3duIGZyYWdtZW50LgorICAgICAgICAgICAgZm9yIChpbnQgaT1tQWN0aXZlLnNpemUoKS0xOyBpPj0wOyBpLS0pIHsKKyAgICAgICAgICAgICAgICBGcmFnbWVudCBmID0gbUFjdGl2ZS5nZXQoaSk7CisgICAgICAgICAgICAgICAgaWYgKGYgIT0gbnVsbCAmJiBmLm1GcmFnbWVudElkID09IGlkKSB7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBmOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICByZXR1cm4gbnVsbDsKKyAgICB9CisgICAgCisgICAgcHVibGljIEZyYWdtZW50IGZpbmRGcmFnbWVudEJ5VGFnKFN0cmluZyB0YWcpIHsKKyAgICAgICAgaWYgKG1BY3RpdmUgIT0gbnVsbCAmJiB0YWcgIT0gbnVsbCkgeworICAgICAgICAgICAgLy8gRmlyc3QgbG9vayB0aHJvdWdoIGFkZGVkIGZyYWdtZW50cy4KKyAgICAgICAgICAgIGZvciAoaW50IGk9bUFkZGVkLnNpemUoKS0xOyBpPj0wOyBpLS0pIHsKKyAgICAgICAgICAgICAgICBGcmFnbWVudCBmID0gbUFkZGVkLmdldChpKTsKKyAgICAgICAgICAgICAgICBpZiAoZiAhPSBudWxsICYmIHRhZy5lcXVhbHMoZi5tVGFnKSkgeworICAgICAgICAgICAgICAgICAgICByZXR1cm4gZjsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICAvLyBOb3cgZm9yIGFueSBrbm93biBmcmFnbWVudC4KKyAgICAgICAgICAgIGZvciAoaW50IGk9bUFjdGl2ZS5zaXplKCktMTsgaT49MDsgaS0tKSB7CisgICAgICAgICAgICAgICAgRnJhZ21lbnQgZiA9IG1BY3RpdmUuZ2V0KGkpOworICAgICAgICAgICAgICAgIGlmIChmICE9IG51bGwgJiYgdGFnLmVxdWFscyhmLm1UYWcpKSB7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBmOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICByZXR1cm4gbnVsbDsKKyAgICB9CisgICAgCisgICAgcHVibGljIEZyYWdtZW50IGZpbmRGcmFnbWVudEJ5V2hvKFN0cmluZyB3aG8pIHsKKyAgICAgICAgaWYgKG1BY3RpdmUgIT0gbnVsbCAmJiB3aG8gIT0gbnVsbCkgeworICAgICAgICAgICAgZm9yIChpbnQgaT1tQWN0aXZlLnNpemUoKS0xOyBpPj0wOyBpLS0pIHsKKyAgICAgICAgICAgICAgICBGcmFnbWVudCBmID0gbUFjdGl2ZS5nZXQoaSk7CisgICAgICAgICAgICAgICAgaWYgKGYgIT0gbnVsbCAmJiB3aG8uZXF1YWxzKGYubVdobykpIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGY7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHJldHVybiBudWxsOworICAgIH0KKyAgICAKKyAgICBwdWJsaWMgdm9pZCBlbnF1ZXVlQWN0aW9uKFJ1bm5hYmxlIGFjdGlvbikgeworICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKKyAgICAgICAgICAgIGlmIChtUGVuZGluZ0FjdGlvbnMgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgIG1QZW5kaW5nQWN0aW9ucyA9IG5ldyBBcnJheUxpc3Q8UnVubmFibGU+KCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBtUGVuZGluZ0FjdGlvbnMuYWRkKGFjdGlvbik7CisgICAgICAgICAgICBpZiAobVBlbmRpbmdBY3Rpb25zLnNpemUoKSA9PSAxKSB7CisgICAgICAgICAgICAgICAgbUFjdGl2aXR5Lm1IYW5kbGVyLnJlbW92ZUNhbGxiYWNrcyhtRXhlY0NvbW1pdCk7CisgICAgICAgICAgICAgICAgbUFjdGl2aXR5Lm1IYW5kbGVyLnBvc3QobUV4ZWNDb21taXQpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorICAgIAorICAgIHB1YmxpYyBpbnQgYWxsb2NCYWNrU3RhY2tJbmRleChCYWNrU3RhY2tFbnRyeSBic2UpIHsKKyAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CisgICAgICAgICAgICBpZiAobUF2YWlsQmFja1N0YWNrSW5kaWNlcyA9PSBudWxsIHx8IG1BdmFpbEJhY2tTdGFja0luZGljZXMuc2l6ZSgpIDw9IDApIHsKKyAgICAgICAgICAgICAgICBpZiAobUJhY2tTdGFja0luZGljZXMgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICBtQmFja1N0YWNrSW5kaWNlcyA9IG5ldyBBcnJheUxpc3Q8QmFja1N0YWNrRW50cnk+KCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGludCBpbmRleCA9IG1CYWNrU3RhY2tJbmRpY2VzLnNpemUoKTsKKyAgICAgICAgICAgICAgICBpZiAoREVCVUcpIExvZy52KFRBRywgIlNldHRpbmcgYmFjayBzdGFjayBpbmRleCAiICsgaW5kZXggKyAiIHRvICIgKyBic2UpOworICAgICAgICAgICAgICAgIG1CYWNrU3RhY2tJbmRpY2VzLmFkZChic2UpOworICAgICAgICAgICAgICAgIHJldHVybiBpbmRleDsKKworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBpbnQgaW5kZXggPSBtQXZhaWxCYWNrU3RhY2tJbmRpY2VzLnJlbW92ZShtQXZhaWxCYWNrU3RhY2tJbmRpY2VzLnNpemUoKS0xKTsKKyAgICAgICAgICAgICAgICBpZiAoREVCVUcpIExvZy52KFRBRywgIkFkZGluZyBiYWNrIHN0YWNrIGluZGV4ICIgKyBpbmRleCArICIgd2l0aCAiICsgYnNlKTsKKyAgICAgICAgICAgICAgICBtQmFja1N0YWNrSW5kaWNlcy5zZXQoaW5kZXgsIGJzZSk7CisgICAgICAgICAgICAgICAgcmV0dXJuIGluZGV4OworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHZvaWQgc2V0QmFja1N0YWNrSW5kZXgoaW50IGluZGV4LCBCYWNrU3RhY2tFbnRyeSBic2UpIHsKKyAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CisgICAgICAgICAgICBpZiAobUJhY2tTdGFja0luZGljZXMgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgIG1CYWNrU3RhY2tJbmRpY2VzID0gbmV3IEFycmF5TGlzdDxCYWNrU3RhY2tFbnRyeT4oKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGludCBOID0gbUJhY2tTdGFja0luZGljZXMuc2l6ZSgpOworICAgICAgICAgICAgaWYgKGluZGV4IDwgTikgeworICAgICAgICAgICAgICAgIGlmIChERUJVRykgTG9nLnYoVEFHLCAiU2V0dGluZyBiYWNrIHN0YWNrIGluZGV4ICIgKyBpbmRleCArICIgdG8gIiArIGJzZSk7CisgICAgICAgICAgICAgICAgbUJhY2tTdGFja0luZGljZXMuc2V0KGluZGV4LCBic2UpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICB3aGlsZSAoTiA8IGluZGV4KSB7CisgICAgICAgICAgICAgICAgICAgIG1CYWNrU3RhY2tJbmRpY2VzLmFkZChudWxsKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKG1BdmFpbEJhY2tTdGFja0luZGljZXMgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgbUF2YWlsQmFja1N0YWNrSW5kaWNlcyA9IG5ldyBBcnJheUxpc3Q8SW50ZWdlcj4oKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBpZiAoREVCVUcpIExvZy52KFRBRywgIkFkZGluZyBhdmFpbGFibGUgYmFjayBzdGFjayBpbmRleCAiICsgTik7CisgICAgICAgICAgICAgICAgICAgIG1BdmFpbEJhY2tTdGFja0luZGljZXMuYWRkKE4pOworICAgICAgICAgICAgICAgICAgICBOKys7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGlmIChERUJVRykgTG9nLnYoVEFHLCAiQWRkaW5nIGJhY2sgc3RhY2sgaW5kZXggIiArIGluZGV4ICsgIiB3aXRoICIgKyBic2UpOworICAgICAgICAgICAgICAgIG1CYWNrU3RhY2tJbmRpY2VzLmFkZChic2UpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHZvaWQgZnJlZUJhY2tTdGFja0luZGV4KGludCBpbmRleCkgeworICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKKyAgICAgICAgICAgIG1CYWNrU3RhY2tJbmRpY2VzLnNldChpbmRleCwgbnVsbCk7CisgICAgICAgICAgICBpZiAobUF2YWlsQmFja1N0YWNrSW5kaWNlcyA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgbUF2YWlsQmFja1N0YWNrSW5kaWNlcyA9IG5ldyBBcnJheUxpc3Q8SW50ZWdlcj4oKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmIChERUJVRykgTG9nLnYoVEFHLCAiRnJlZWluZyBiYWNrIHN0YWNrIGluZGV4ICIgKyBpbmRleCk7CisgICAgICAgICAgICBtQXZhaWxCYWNrU3RhY2tJbmRpY2VzLmFkZChpbmRleCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBPbmx5IGNhbGwgZnJvbSBtYWluIHRocmVhZCEKKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBleGVjUGVuZGluZ0FjdGlvbnMoKSB7CisgICAgICAgIGlmIChtRXhlY3V0aW5nQWN0aW9ucykgeworICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigiUmVjdXJzaXZlIGVudHJ5IHRvIGV4ZWNQZW5kaW5nQWN0aW9ucyIpOworICAgICAgICB9CisgICAgICAgIAorICAgICAgICB3aGlsZSAodHJ1ZSkgeworICAgICAgICAgICAgaW50IG51bUFjdGlvbnM7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgeworICAgICAgICAgICAgICAgIGlmIChtUGVuZGluZ0FjdGlvbnMgPT0gbnVsbCB8fCBtUGVuZGluZ0FjdGlvbnMuc2l6ZSgpID09IDApIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAKKyAgICAgICAgICAgICAgICBudW1BY3Rpb25zID0gbVBlbmRpbmdBY3Rpb25zLnNpemUoKTsKKyAgICAgICAgICAgICAgICBpZiAobVRtcEFjdGlvbnMgPT0gbnVsbCB8fCBtVG1wQWN0aW9ucy5sZW5ndGggPCBudW1BY3Rpb25zKSB7CisgICAgICAgICAgICAgICAgICAgIG1UbXBBY3Rpb25zID0gbmV3IFJ1bm5hYmxlW251bUFjdGlvbnNdOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBtUGVuZGluZ0FjdGlvbnMudG9BcnJheShtVG1wQWN0aW9ucyk7CisgICAgICAgICAgICAgICAgbVBlbmRpbmdBY3Rpb25zLmNsZWFyKCk7CisgICAgICAgICAgICAgICAgbUFjdGl2aXR5Lm1IYW5kbGVyLnJlbW92ZUNhbGxiYWNrcyhtRXhlY0NvbW1pdCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICAKKyAgICAgICAgICAgIG1FeGVjdXRpbmdBY3Rpb25zID0gdHJ1ZTsKKyAgICAgICAgICAgIGZvciAoaW50IGk9MDsgaTxudW1BY3Rpb25zOyBpKyspIHsKKyAgICAgICAgICAgICAgICBtVG1wQWN0aW9uc1tpXS5ydW4oKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1FeGVjdXRpbmdBY3Rpb25zID0gZmFsc2U7CisgICAgICAgIH0KKyAgICB9CisgICAgCisgICAgcHVibGljIHZvaWQgYWRkQmFja1N0YWNrU3RhdGUoQmFja1N0YWNrRW50cnkgc3RhdGUpIHsKKyAgICAgICAgaWYgKG1CYWNrU3RhY2sgPT0gbnVsbCkgeworICAgICAgICAgICAgbUJhY2tTdGFjayA9IG5ldyBBcnJheUxpc3Q8QmFja1N0YWNrRW50cnk+KCk7CisgICAgICAgIH0KKyAgICAgICAgbUJhY2tTdGFjay5hZGQoc3RhdGUpOworICAgIH0KKyAgICAKKyAgICBib29sZWFuIHBvcEJhY2tTdGFja1N0YXRlKEhhbmRsZXIgaGFuZGxlciwgU3RyaW5nIG5hbWUsIGludCBpZCwgaW50IGZsYWdzKSB7CisgICAgICAgIGlmIChtQmFja1N0YWNrID09IG51bGwpIHsKKyAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgfQorICAgICAgICBpZiAobmFtZSA9PSBudWxsICYmIGlkIDwgMCAmJiAoZmxhZ3MmQWN0aXZpdHkuUE9QX0JBQ0tfU1RBQ0tfSU5DTFVTSVZFKSA9PSAwKSB7CisgICAgICAgICAgICBpbnQgbGFzdCA9IG1CYWNrU3RhY2suc2l6ZSgpLTE7CisgICAgICAgICAgICBpZiAobGFzdCA8IDApIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBmaW5hbCBCYWNrU3RhY2tFbnRyeSBic3MgPSBtQmFja1N0YWNrLnJlbW92ZShsYXN0KTsKKyAgICAgICAgICAgIGVucXVldWVBY3Rpb24obmV3IFJ1bm5hYmxlKCkgeworICAgICAgICAgICAgICAgIHB1YmxpYyB2b2lkIHJ1bigpIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKERFQlVHKSBMb2cudihUQUcsICJQb3BwaW5nIGJhY2sgc3RhY2sgc3RhdGU6ICIgKyBic3MpOworICAgICAgICAgICAgICAgICAgICBic3MucG9wRnJvbUJhY2tTdGFjaygpOworICAgICAgICAgICAgICAgICAgICBtb3ZlVG9TdGF0ZShtQ3VyU3RhdGUsIHJldmVyc2VUcmFuc2l0KGJzcy5nZXRUcmFuc2l0aW9uKCkpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJzcy5nZXRUcmFuc2l0aW9uU3R5bGUoKSwgdHJ1ZSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBpbnQgaW5kZXggPSAtMTsKKyAgICAgICAgICAgIGlmIChuYW1lICE9IG51bGwgfHwgaWQgPj0gMCkgeworICAgICAgICAgICAgICAgIC8vIElmIGEgbmFtZSBvciBJRCBpcyBzcGVjaWZpZWQsIGxvb2sgZm9yIHRoYXQgcGxhY2UgaW4KKyAgICAgICAgICAgICAgICAvLyB0aGUgc3RhY2suCisgICAgICAgICAgICAgICAgaW5kZXggPSBtQmFja1N0YWNrLnNpemUoKS0xOworICAgICAgICAgICAgICAgIHdoaWxlIChpbmRleCA+PSAwKSB7CisgICAgICAgICAgICAgICAgICAgIEJhY2tTdGFja0VudHJ5IGJzcyA9IG1CYWNrU3RhY2suZ2V0KGluZGV4KTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKG5hbWUgIT0gbnVsbCAmJiBuYW1lLmVxdWFscyhic3MuZ2V0TmFtZSgpKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgaWYgKGlkID49IDAgJiYgaWQgPT0gYnNzLm1JbmRleCkgeworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgaW5kZXgtLTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaWYgKGluZGV4IDwgMCkgeworICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGlmICgoZmxhZ3MmQWN0aXZpdHkuUE9QX0JBQ0tfU1RBQ0tfSU5DTFVTSVZFKSAhPSAwKSB7CisgICAgICAgICAgICAgICAgICAgIGluZGV4LS07CisgICAgICAgICAgICAgICAgICAgIC8vIENvbnN1bWUgYWxsIGZvbGxvd2luZyBlbnRyaWVzIHRoYXQgbWF0Y2guCisgICAgICAgICAgICAgICAgICAgIHdoaWxlIChpbmRleCA+PSAwKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBCYWNrU3RhY2tFbnRyeSBic3MgPSBtQmFja1N0YWNrLmdldChpbmRleCk7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoKG5hbWUgIT0gbnVsbCAmJiBuYW1lLmVxdWFscyhic3MuZ2V0TmFtZSgpKSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfHwgKGlkID49IDAgJiYgaWQgPT0gYnNzLm1JbmRleCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbmRleC0tOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoaW5kZXggPT0gbUJhY2tTdGFjay5zaXplKCktMSkgeworICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGZpbmFsIEFycmF5TGlzdDxCYWNrU3RhY2tFbnRyeT4gc3RhdGVzCisgICAgICAgICAgICAgICAgICAgID0gbmV3IEFycmF5TGlzdDxCYWNrU3RhY2tFbnRyeT4oKTsKKyAgICAgICAgICAgIGZvciAoaW50IGk9bUJhY2tTdGFjay5zaXplKCktMTsgaT5pbmRleDsgaS0tKSB7CisgICAgICAgICAgICAgICAgc3RhdGVzLmFkZChtQmFja1N0YWNrLnJlbW92ZShpKSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBlbnF1ZXVlQWN0aW9uKG5ldyBSdW5uYWJsZSgpIHsKKyAgICAgICAgICAgICAgICBwdWJsaWMgdm9pZCBydW4oKSB7CisgICAgICAgICAgICAgICAgICAgIGZvciAoaW50IGk9MDsgaTxzdGF0ZXMuc2l6ZSgpOyBpKyspIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChERUJVRykgTG9nLnYoVEFHLCAiUG9wcGluZyBiYWNrIHN0YWNrIHN0YXRlOiAiICsgc3RhdGVzLmdldChpKSk7CisgICAgICAgICAgICAgICAgICAgICAgICBzdGF0ZXMuZ2V0KGkpLnBvcEZyb21CYWNrU3RhY2soKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBtb3ZlVG9TdGF0ZShtQ3VyU3RhdGUsIHRydWUpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0pOworICAgICAgICB9CisgICAgICAgIHJldHVybiB0cnVlOworICAgIH0KKyAgICAKKyAgICBBcnJheUxpc3Q8RnJhZ21lbnQ+IHJldGFpbk5vbkNvbmZpZygpIHsKKyAgICAgICAgQXJyYXlMaXN0PEZyYWdtZW50PiBmcmFnbWVudHMgPSBudWxsOworICAgICAgICBpZiAobUFjdGl2ZSAhPSBudWxsKSB7CisgICAgICAgICAgICBmb3IgKGludCBpPTA7IGk8bUFjdGl2ZS5zaXplKCk7IGkrKykgeworICAgICAgICAgICAgICAgIEZyYWdtZW50IGYgPSBtQWN0aXZlLmdldChpKTsKKyAgICAgICAgICAgICAgICBpZiAoZiAhPSBudWxsICYmIGYubVJldGFpbkluc3RhbmNlKSB7CisgICAgICAgICAgICAgICAgICAgIGlmIChmcmFnbWVudHMgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgZnJhZ21lbnRzID0gbmV3IEFycmF5TGlzdDxGcmFnbWVudD4oKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBmcmFnbWVudHMuYWRkKGYpOworICAgICAgICAgICAgICAgICAgICBmLm1SZXRhaW5pbmcgPSB0cnVlOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICByZXR1cm4gZnJhZ21lbnRzOworICAgIH0KKyAgICAKKyAgICB2b2lkIHNhdmVGcmFnbWVudFZpZXdTdGF0ZShGcmFnbWVudCBmKSB7CisgICAgICAgIGlmIChmLm1WaWV3ID09IG51bGwpIHsKKyAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfQorICAgICAgICBpZiAobVN0YXRlQXJyYXkgPT0gbnVsbCkgeworICAgICAgICAgICAgbVN0YXRlQXJyYXkgPSBuZXcgU3BhcnNlQXJyYXk8UGFyY2VsYWJsZT4oKTsKKyAgICAgICAgfQorICAgICAgICBmLm1WaWV3LnNhdmVIaWVyYXJjaHlTdGF0ZShtU3RhdGVBcnJheSk7CisgICAgICAgIGlmIChtU3RhdGVBcnJheS5zaXplKCkgPiAwKSB7CisgICAgICAgICAgICBmLm1TYXZlZFZpZXdTdGF0ZSA9IG1TdGF0ZUFycmF5OworICAgICAgICAgICAgbVN0YXRlQXJyYXkgPSBudWxsOworICAgICAgICB9CisgICAgfQorICAgIAorICAgIFBhcmNlbGFibGUgc2F2ZUFsbFN0YXRlKCkgeworICAgICAgICBpZiAobUFjdGl2ZSA9PSBudWxsIHx8IG1BY3RpdmUuc2l6ZSgpIDw9IDApIHsKKyAgICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICB9CisgICAgICAgIAorICAgICAgICAvLyBGaXJzdCBjb2xsZWN0IGFsbCBhY3RpdmUgZnJhZ21lbnRzLgorICAgICAgICBpbnQgTiA9IG1BY3RpdmUuc2l6ZSgpOworICAgICAgICBGcmFnbWVudFN0YXRlW10gYWN0aXZlID0gbmV3IEZyYWdtZW50U3RhdGVbTl07CisgICAgICAgIGJvb2xlYW4gaGF2ZUZyYWdtZW50cyA9IGZhbHNlOworICAgICAgICBmb3IgKGludCBpPTA7IGk8TjsgaSsrKSB7CisgICAgICAgICAgICBGcmFnbWVudCBmID0gbUFjdGl2ZS5nZXQoaSk7CisgICAgICAgICAgICBpZiAoZiAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgaGF2ZUZyYWdtZW50cyA9IHRydWU7CisgICAgICAgICAgICAgICAgCisgICAgICAgICAgICAgICAgRnJhZ21lbnRTdGF0ZSBmcyA9IG5ldyBGcmFnbWVudFN0YXRlKGYpOworICAgICAgICAgICAgICAgIGFjdGl2ZVtpXSA9IGZzOworICAgICAgICAgICAgICAgIAorICAgICAgICAgICAgICAgIGlmIChtU3RhdGVCdW5kbGUgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICBtU3RhdGVCdW5kbGUgPSBuZXcgQnVuZGxlKCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGYub25TYXZlSW5zdGFuY2VTdGF0ZShtU3RhdGVCdW5kbGUpOworICAgICAgICAgICAgICAgIGlmICghbVN0YXRlQnVuZGxlLmlzRW1wdHkoKSkgeworICAgICAgICAgICAgICAgICAgICBmcy5tU2F2ZWRGcmFnbWVudFN0YXRlID0gbVN0YXRlQnVuZGxlOworICAgICAgICAgICAgICAgICAgICBtU3RhdGVCdW5kbGUgPSBudWxsOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAKKyAgICAgICAgICAgICAgICBpZiAoZi5tVmlldyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIHNhdmVGcmFnbWVudFZpZXdTdGF0ZShmKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGYubVNhdmVkVmlld1N0YXRlICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChmcy5tU2F2ZWRGcmFnbWVudFN0YXRlID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBmcy5tU2F2ZWRGcmFnbWVudFN0YXRlID0gbmV3IEJ1bmRsZSgpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgZnMubVNhdmVkRnJhZ21lbnRTdGF0ZS5wdXRTcGFyc2VQYXJjZWxhYmxlQXJyYXkoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEZyYWdtZW50TWFuYWdlckltcGwuVklFV19TVEFURV9UQUcsIGYubVNhdmVkVmlld1N0YXRlKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIGlmIChmLm1UYXJnZXQgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICBpZiAoZnMubVNhdmVkRnJhZ21lbnRTdGF0ZSA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBmcy5tU2F2ZWRGcmFnbWVudFN0YXRlID0gbmV3IEJ1bmRsZSgpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIHB1dEZyYWdtZW50KGZzLm1TYXZlZEZyYWdtZW50U3RhdGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgRnJhZ21lbnRNYW5hZ2VySW1wbC5UQVJHRVRfU1RBVEVfVEFHLCBmLm1UYXJnZXQpOworICAgICAgICAgICAgICAgICAgICBpZiAoZi5tVGFyZ2V0UmVxdWVzdENvZGUgIT0gMCkgeworICAgICAgICAgICAgICAgICAgICAgICAgZnMubVNhdmVkRnJhZ21lbnRTdGF0ZS5wdXRJbnQoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEZyYWdtZW50TWFuYWdlckltcGwuVEFSR0VUX1JFUVVFU1RfQ09ERV9TVEFURV9UQUcsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYubVRhcmdldFJlcXVlc3RDb2RlKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAKKyAgICAgICAgICAgICAgICBpZiAoREVCVUcpIExvZy52KFRBRywgIlNhdmVkIHN0YXRlIG9mICIgKyBmICsgIjogIgorICAgICAgICAgICAgICAgICAgICAgICAgKyBmcy5tU2F2ZWRGcmFnbWVudFN0YXRlKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgaWYgKCFoYXZlRnJhZ21lbnRzKSB7CisgICAgICAgICAgICBpZiAoREVCVUcpIExvZy52KFRBRywgInNhdmVBbGxTdGF0ZTogbm8gZnJhZ21lbnRzISIpOworICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIGludFtdIGFkZGVkID0gbnVsbDsKKyAgICAgICAgQmFja1N0YWNrU3RhdGVbXSBiYWNrU3RhY2sgPSBudWxsOworICAgICAgICAKKyAgICAgICAgLy8gQnVpbGQgbGlzdCBvZiBjdXJyZW50bHkgYWRkZWQgZnJhZ21lbnRzLgorICAgICAgICBOID0gbUFkZGVkLnNpemUoKTsKKyAgICAgICAgaWYgKE4gPiAwKSB7CisgICAgICAgICAgICBhZGRlZCA9IG5ldyBpbnRbTl07CisgICAgICAgICAgICBmb3IgKGludCBpPTA7IGk8TjsgaSsrKSB7CisgICAgICAgICAgICAgICAgYWRkZWRbaV0gPSBtQWRkZWQuZ2V0KGkpLm1JbmRleDsKKyAgICAgICAgICAgICAgICBpZiAoREVCVUcpIExvZy52KFRBRywgInNhdmVBbGxTdGF0ZTogYWRkaW5nIGZyYWdtZW50ICMiICsgaQorICAgICAgICAgICAgICAgICAgICAgICAgKyAiOiAiICsgbUFkZGVkLmdldChpKSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIC8vIE5vdyBzYXZlIGJhY2sgc3RhY2suCisgICAgICAgIGlmIChtQmFja1N0YWNrICE9IG51bGwpIHsKKyAgICAgICAgICAgIE4gPSBtQmFja1N0YWNrLnNpemUoKTsKKyAgICAgICAgICAgIGlmIChOID4gMCkgeworICAgICAgICAgICAgICAgIGJhY2tTdGFjayA9IG5ldyBCYWNrU3RhY2tTdGF0ZVtOXTsKKyAgICAgICAgICAgICAgICBmb3IgKGludCBpPTA7IGk8TjsgaSsrKSB7CisgICAgICAgICAgICAgICAgICAgIGJhY2tTdGFja1tpXSA9IG5ldyBCYWNrU3RhY2tTdGF0ZSh0aGlzLCBtQmFja1N0YWNrLmdldChpKSk7CisgICAgICAgICAgICAgICAgICAgIGlmIChERUJVRykgTG9nLnYoVEFHLCAic2F2ZUFsbFN0YXRlOiBhZGRpbmcgYmFjayBzdGFjayAjIiArIGkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICArICI6ICIgKyBtQmFja1N0YWNrLmdldChpKSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIAorICAgICAgICBGcmFnbWVudE1hbmFnZXJTdGF0ZSBmbXMgPSBuZXcgRnJhZ21lbnRNYW5hZ2VyU3RhdGUoKTsKKyAgICAgICAgZm1zLm1BY3RpdmUgPSBhY3RpdmU7CisgICAgICAgIGZtcy5tQWRkZWQgPSBhZGRlZDsKKyAgICAgICAgZm1zLm1CYWNrU3RhY2sgPSBiYWNrU3RhY2s7CisgICAgICAgIHJldHVybiBmbXM7CisgICAgfQorICAgIAorICAgIHZvaWQgcmVzdG9yZUFsbFN0YXRlKFBhcmNlbGFibGUgc3RhdGUsIEFycmF5TGlzdDxGcmFnbWVudD4gbm9uQ29uZmlnKSB7CisgICAgICAgIC8vIElmIHRoZXJlIGlzIG5vIHNhdmVkIHN0YXRlIGF0IGFsbCwgdGhlbiB0aGVyZSBjYW4gbm90IGJlCisgICAgICAgIC8vIGFueSBub25Db25maWcgZnJhZ21lbnRzIGVpdGhlciwgc28gdGhhdCBpcyB0aGF0LgorICAgICAgICBpZiAoc3RhdGUgPT0gbnVsbCkgcmV0dXJuOworICAgICAgICBGcmFnbWVudE1hbmFnZXJTdGF0ZSBmbXMgPSAoRnJhZ21lbnRNYW5hZ2VyU3RhdGUpc3RhdGU7CisgICAgICAgIGlmIChmbXMubUFjdGl2ZSA9PSBudWxsKSByZXR1cm47CisgICAgICAgIAorICAgICAgICAvLyBGaXJzdCByZS1hdHRhY2ggYW55IG5vbi1jb25maWcgaW5zdGFuY2VzIHdlIGFyZSByZXRhaW5pbmcgYmFjaworICAgICAgICAvLyB0byB0aGVpciBzYXZlZCBzdGF0ZSwgc28gd2UgZG9uJ3QgdHJ5IHRvIGluc3RhbnRpYXRlIHRoZW0gYWdhaW4uCisgICAgICAgIGlmIChub25Db25maWcgIT0gbnVsbCkgeworICAgICAgICAgICAgZm9yIChpbnQgaT0wOyBpPG5vbkNvbmZpZy5zaXplKCk7IGkrKykgeworICAgICAgICAgICAgICAgIEZyYWdtZW50IGYgPSBub25Db25maWcuZ2V0KGkpOworICAgICAgICAgICAgICAgIGlmIChERUJVRykgTG9nLnYoVEFHLCAicmVzdG9yZUFsbFN0YXRlOiByZS1hdHRhY2hpbmcgcmV0YWluZWQgIiArIGYpOworICAgICAgICAgICAgICAgIEZyYWdtZW50U3RhdGUgZnMgPSBmbXMubUFjdGl2ZVtmLm1JbmRleF07CisgICAgICAgICAgICAgICAgZnMubUluc3RhbmNlID0gZjsKKyAgICAgICAgICAgICAgICBmLm1TYXZlZFZpZXdTdGF0ZSA9IG51bGw7CisgICAgICAgICAgICAgICAgZi5tQmFja1N0YWNrTmVzdGluZyA9IDA7CisgICAgICAgICAgICAgICAgZi5tQWRkZWQgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICBpZiAoZnMubVNhdmVkRnJhZ21lbnRTdGF0ZSAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIGYubVNhdmVkVmlld1N0YXRlID0gZnMubVNhdmVkRnJhZ21lbnRTdGF0ZS5nZXRTcGFyc2VQYXJjZWxhYmxlQXJyYXkoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgRnJhZ21lbnRNYW5hZ2VySW1wbC5WSUVXX1NUQVRFX1RBRyk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIAorICAgICAgICAvLyBCdWlsZCB0aGUgZnVsbCBsaXN0IG9mIGFjdGl2ZSBmcmFnbWVudHMsIGluc3RhbnRpYXRpbmcgdGhlbSBmcm9tCisgICAgICAgIC8vIHRoZWlyIHNhdmVkIHN0YXRlLgorICAgICAgICBtQWN0aXZlID0gbmV3IEFycmF5TGlzdDxGcmFnbWVudD4oZm1zLm1BY3RpdmUubGVuZ3RoKTsKKyAgICAgICAgaWYgKG1BdmFpbEluZGljZXMgIT0gbnVsbCkgeworICAgICAgICAgICAgbUF2YWlsSW5kaWNlcy5jbGVhcigpOworICAgICAgICB9CisgICAgICAgIGZvciAoaW50IGk9MDsgaTxmbXMubUFjdGl2ZS5sZW5ndGg7IGkrKykgeworICAgICAgICAgICAgRnJhZ21lbnRTdGF0ZSBmcyA9IGZtcy5tQWN0aXZlW2ldOworICAgICAgICAgICAgaWYgKGZzICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBGcmFnbWVudCBmID0gZnMuaW5zdGFudGlhdGUobUFjdGl2aXR5KTsKKyAgICAgICAgICAgICAgICBpZiAoREVCVUcpIExvZy52KFRBRywgInJlc3RvcmVBbGxTdGF0ZTogYWRkaW5nICMiICsgaSArICI6ICIgKyBmKTsKKyAgICAgICAgICAgICAgICBtQWN0aXZlLmFkZChmKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgaWYgKERFQlVHKSBMb2cudihUQUcsICJyZXN0b3JlQWxsU3RhdGU6IGFkZGluZyAjIiArIGkgKyAiOiAobnVsbCkiKTsKKyAgICAgICAgICAgICAgICBtQWN0aXZlLmFkZChudWxsKTsKKyAgICAgICAgICAgICAgICBpZiAobUF2YWlsSW5kaWNlcyA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIG1BdmFpbEluZGljZXMgPSBuZXcgQXJyYXlMaXN0PEludGVnZXI+KCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGlmIChERUJVRykgTG9nLnYoVEFHLCAicmVzdG9yZUFsbFN0YXRlOiBhZGRpbmcgYXZhaWwgIyIgKyBpKTsKKyAgICAgICAgICAgICAgICBtQXZhaWxJbmRpY2VzLmFkZChpKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgLy8gQnVpbGQgdGhlIGxpc3Qgb2YgY3VycmVudGx5IGFkZGVkIGZyYWdtZW50cy4KKyAgICAgICAgaWYgKGZtcy5tQWRkZWQgIT0gbnVsbCkgeworICAgICAgICAgICAgbUFkZGVkID0gbmV3IEFycmF5TGlzdDxGcmFnbWVudD4oZm1zLm1BZGRlZC5sZW5ndGgpOworICAgICAgICAgICAgZm9yIChpbnQgaT0wOyBpPGZtcy5tQWRkZWQubGVuZ3RoOyBpKyspIHsKKyAgICAgICAgICAgICAgICBGcmFnbWVudCBmID0gbUFjdGl2ZS5nZXQoZm1zLm1BZGRlZFtpXSk7CisgICAgICAgICAgICAgICAgaWYgKGYgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICJObyBpbnN0YW50aWF0ZWQgZnJhZ21lbnQgZm9yIGluZGV4ICMiICsgZm1zLm1BZGRlZFtpXSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGYubUFkZGVkID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICBmLm1JbW1lZGlhdGVBY3Rpdml0eSA9IG1BY3Rpdml0eTsKKyAgICAgICAgICAgICAgICBpZiAoREVCVUcpIExvZy52KFRBRywgInJlc3RvcmVBbGxTdGF0ZTogbWFraW5nIGFkZGVkICMiICsgaSArICI6ICIgKyBmKTsKKyAgICAgICAgICAgICAgICBtQWRkZWQuYWRkKGYpOworICAgICAgICAgICAgfQorICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgbUFkZGVkID0gbnVsbDsKKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgLy8gQnVpbGQgdGhlIGJhY2sgc3RhY2suCisgICAgICAgIGlmIChmbXMubUJhY2tTdGFjayAhPSBudWxsKSB7CisgICAgICAgICAgICBtQmFja1N0YWNrID0gbmV3IEFycmF5TGlzdDxCYWNrU3RhY2tFbnRyeT4oZm1zLm1CYWNrU3RhY2subGVuZ3RoKTsKKyAgICAgICAgICAgIGZvciAoaW50IGk9MDsgaTxmbXMubUJhY2tTdGFjay5sZW5ndGg7IGkrKykgeworICAgICAgICAgICAgICAgIEJhY2tTdGFja0VudHJ5IGJzZSA9IGZtcy5tQmFja1N0YWNrW2ldLmluc3RhbnRpYXRlKHRoaXMpOworICAgICAgICAgICAgICAgIGlmIChERUJVRykgTG9nLnYoVEFHLCAicmVzdG9yZUFsbFN0YXRlOiBhZGRpbmcgYnNlICMiICsgaQorICAgICAgICAgICAgICAgICAgICAgICAgKyAiIChpbmRleCAiICsgYnNlLm1JbmRleCArICIpOiAiICsgYnNlKTsKKyAgICAgICAgICAgICAgICBtQmFja1N0YWNrLmFkZChic2UpOworICAgICAgICAgICAgICAgIGlmIChic2UubUluZGV4ID49IDApIHsKKyAgICAgICAgICAgICAgICAgICAgc2V0QmFja1N0YWNrSW5kZXgoYnNlLm1JbmRleCwgYnNlKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBtQmFja1N0YWNrID0gbnVsbDsKKyAgICAgICAgfQorICAgIH0KKyAgICAKKyAgICBwdWJsaWMgdm9pZCBhdHRhY2hBY3Rpdml0eShBY3Rpdml0eSBhY3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KKyAgICB9CisgICAgCisgICAgcHVibGljIGJvb2xlYW4gZGlzcGF0Y2hDcmVhdGVPcHRpb25zTWVudShNZW51IG1lbnUsIE1lbnVJbmZsYXRlciBpbmZsYXRlcikgeworICAgICAgICBib29sZWFuIHNob3cgPSBmYWxzZTsKKyAgICAgICAgaWYgKG1BY3RpdmUgIT0gbnVsbCkgeworICAgICAgICAgICAgZm9yIChpbnQgaT0wOyBpPG1BZGRlZC5zaXplKCk7IGkrKykgeworICAgICAgICAgICAgICAgIEZyYWdtZW50IGYgPSBtQWRkZWQuZ2V0KGkpOworICAgICAgICAgICAgICAgIGlmIChmICE9IG51bGwgJiYgIWYubUhpZGRlbiAmJiBmLm1IYXNNZW51KSB7CisgICAgICAgICAgICAgICAgICAgIHNob3cgPSB0cnVlOworICAgICAgICAgICAgICAgICAgICBmLm9uQ3JlYXRlT3B0aW9uc01lbnUobWVudSwgaW5mbGF0ZXIpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICByZXR1cm4gc2hvdzsKKyAgICB9CisgICAgCisgICAgcHVibGljIGJvb2xlYW4gZGlzcGF0Y2hQcmVwYXJlT3B0aW9uc01lbnUoTWVudSBtZW51KSB7CisgICAgICAgIGJvb2xlYW4gc2hvdyA9IGZhbHNlOworICAgICAgICBpZiAobUFjdGl2ZSAhPSBudWxsKSB7CisgICAgICAgICAgICBmb3IgKGludCBpPTA7IGk8bUFkZGVkLnNpemUoKTsgaSsrKSB7CisgICAgICAgICAgICAgICAgRnJhZ21lbnQgZiA9IG1BZGRlZC5nZXQoaSk7CisgICAgICAgICAgICAgICAgaWYgKGYgIT0gbnVsbCAmJiAhZi5tSGlkZGVuICYmIGYubUhhc01lbnUpIHsKKyAgICAgICAgICAgICAgICAgICAgc2hvdyA9IHRydWU7CisgICAgICAgICAgICAgICAgICAgIGYub25QcmVwYXJlT3B0aW9uc01lbnUobWVudSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHJldHVybiBzaG93OworICAgIH0KKyAgICAKKyAgICBwdWJsaWMgYm9vbGVhbiBkaXNwYXRjaE9wdGlvbnNJdGVtU2VsZWN0ZWQoTWVudUl0ZW0gaXRlbSkgeworICAgICAgICBpZiAobUFjdGl2ZSAhPSBudWxsKSB7CisgICAgICAgICAgICBmb3IgKGludCBpPTA7IGk8bUFkZGVkLnNpemUoKTsgaSsrKSB7CisgICAgICAgICAgICAgICAgRnJhZ21lbnQgZiA9IG1BZGRlZC5nZXQoaSk7CisgICAgICAgICAgICAgICAgaWYgKGYgIT0gbnVsbCAmJiAhZi5tSGlkZGVuICYmIGYubUhhc01lbnUpIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGYub25PcHRpb25zSXRlbVNlbGVjdGVkKGl0ZW0pKSB7CisgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorICAgIAorICAgIHB1YmxpYyBib29sZWFuIGRpc3BhdGNoQ29udGV4dEl0ZW1TZWxlY3RlZChNZW51SXRlbSBpdGVtKSB7CisgICAgICAgIGlmIChtQWN0aXZlICE9IG51bGwpIHsKKyAgICAgICAgICAgIGZvciAoaW50IGk9MDsgaTxtQWRkZWQuc2l6ZSgpOyBpKyspIHsKKyAgICAgICAgICAgICAgICBGcmFnbWVudCBmID0gbUFkZGVkLmdldChpKTsKKyAgICAgICAgICAgICAgICBpZiAoZiAhPSBudWxsICYmICFmLm1IaWRkZW4pIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGYub25Db250ZXh0SXRlbVNlbGVjdGVkKGl0ZW0pKSB7CisgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorICAgIAorICAgIHB1YmxpYyB2b2lkIGRpc3BhdGNoT3B0aW9uc01lbnVDbG9zZWQoTWVudSBtZW51KSB7CisgICAgICAgIGlmIChtQWN0aXZlICE9IG51bGwpIHsKKyAgICAgICAgICAgIGZvciAoaW50IGk9MDsgaTxtQWRkZWQuc2l6ZSgpOyBpKyspIHsKKyAgICAgICAgICAgICAgICBGcmFnbWVudCBmID0gbUFkZGVkLmdldChpKTsKKyAgICAgICAgICAgICAgICBpZiAoZiAhPSBudWxsICYmICFmLm1IaWRkZW4gJiYgZi5tSGFzTWVudSkgeworICAgICAgICAgICAgICAgICAgICBmLm9uT3B0aW9uc01lbnVDbG9zZWQobWVudSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorICAgIAorICAgIHB1YmxpYyBzdGF0aWMgaW50IHJldmVyc2VUcmFuc2l0KGludCB0cmFuc2l0KSB7CisgICAgICAgIGludCByZXYgPSAwOworICAgICAgICBzd2l0Y2ggKHRyYW5zaXQpIHsKKyAgICAgICAgICAgIGNhc2UgRnJhZ21lbnRUcmFuc2FjdGlvbi5UUkFOU0lUX0ZSQUdNRU5UX09QRU46CisgICAgICAgICAgICAgICAgcmV2ID0gRnJhZ21lbnRUcmFuc2FjdGlvbi5UUkFOU0lUX0ZSQUdNRU5UX0NMT1NFOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBGcmFnbWVudFRyYW5zYWN0aW9uLlRSQU5TSVRfRlJBR01FTlRfQ0xPU0U6CisgICAgICAgICAgICAgICAgcmV2ID0gRnJhZ21lbnRUcmFuc2FjdGlvbi5UUkFOU0lUX0ZSQUdNRU5UX09QRU47CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIHJldjsKKyAgICAgICAgCisgICAgfQorICAgIAorICAgIHB1YmxpYyBzdGF0aWMgaW50IHRyYW5zaXRUb1N0eWxlSW5kZXgoaW50IHRyYW5zaXQsIGJvb2xlYW4gZW50ZXIpIHsKKyAgICAgICAgaW50IGFuaW1BdHRyID0gLTE7CisgICAgICAgIHN3aXRjaCAodHJhbnNpdCkgeworICAgICAgICAgICAgY2FzZSBGcmFnbWVudFRyYW5zYWN0aW9uLlRSQU5TSVRfRlJBR01FTlRfT1BFTjoKKyAgICAgICAgICAgICAgICBhbmltQXR0ciA9IGVudGVyCisgICAgICAgICAgICAgICAgICAgID8gY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHlsZWFibGUuRnJhZ21lbnRBbmltYXRpb25fZnJhZ21lbnRPcGVuRW50ZXJBbmltYXRpb24KKyAgICAgICAgICAgICAgICAgICAgOiBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0eWxlYWJsZS5GcmFnbWVudEFuaW1hdGlvbl9mcmFnbWVudE9wZW5FeGl0QW5pbWF0aW9uOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBGcmFnbWVudFRyYW5zYWN0aW9uLlRSQU5TSVRfRlJBR01FTlRfQ0xPU0U6CisgICAgICAgICAgICAgICAgYW5pbUF0dHIgPSBlbnRlcgorICAgICAgICAgICAgICAgICAgICA/IGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3R5bGVhYmxlLkZyYWdtZW50QW5pbWF0aW9uX2ZyYWdtZW50Q2xvc2VFbnRlckFuaW1hdGlvbgorICAgICAgICAgICAgICAgICAgICA6IGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3R5bGVhYmxlLkZyYWdtZW50QW5pbWF0aW9uX2ZyYWdtZW50Q2xvc2VFeGl0QW5pbWF0aW9uOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgICAgIHJldHVybiBhbmltQXR0cjsKKyAgICB9Cit9CmRpZmYgLS1naXQgYS9jb3JlL2phdmE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WdtZW50IGZyYWdtZW50KTsKKyAgICAKKyAgICAvKioKKyAgICAgKiBIaWRlcyBhIHByZXZpb3VzbHkgaGlkZGVuIGZyYWdtZW50LiAgVGhpcyBpcyBvbmx5IHJlbGV2YW50IGZvciBmcmFnbWVudHMgd2hvc2UKKyAgICAgKiB2aWV3cyBoYXZlIGJlZW4gYWRkZWQgdG8gYSBjb250YWluZXIsIGFzIHRoaXMgd2lsbCBjYXVzZSB0aGUgdmlldyB0bworICAgICAqIGJlIHNob3duLgorICAgICAqIAorICAgICAqIEBwYXJhbSBmcmFnbWVudCBUaGUgZnJhZ21lbnQgdG8gYmUgc2hvd24uCisgICAgICogCisgICAgICogQHJldHVybiBSZXR1cm5zIHRoZSBzYW1lIEZyYWdtZW50VHJhbnNhY3Rpb24gaW5zdGFuY2UuCisgICAgICovCisgICAgcHVibGljIEZyYWdtZW50VHJhbnNhY3Rpb24gc2hvdyhGcmFnbWVudCBmcmFnbWVudCk7CisgICAgCisgICAgLyoqCisgICAgICogQml0IG1hc2sgdGhhdCBpcyBzZXQgZm9yIGFsbCBlbnRlciB0cmFuc2l0aW9ucy4KKyAgICAgKi8KKyAgICBwdWJsaWMgZmluYWwgaW50IFRSQU5TSVRfRU5URVJfTUFTSyA9IDB4MTAwMDsKKyAgICAKKyAgICAvKioKKyAgICAgKiBCaXQgbWFzayB0aGF0IGlzIHNldCBmb3IgYWxsIGV4aXQgdHJhbnNpdGlvbnMuCisgICAgICovCisgICAgcHVibGljIGZpbmFsIGludCBUUkFOU0lUX0VYSVRfTUFTSyA9IDB4MjAwMDsKKyAgICAKKyAgICAvKiogTm90IHNldCB1cCBmb3IgYSB0cmFuc2l0aW9uLiAqLworICAgIHB1YmxpYyBmaW5hbCBpbnQgVFJBTlNJVF9VTlNFVCA9IC0xOworICAgIC8qKiBObyBhbmltYXRpb24gZm9yIHRyYW5zaXRpb24uICovCisgICAgcHVibGljIGZpbmFsIGludCBUUkFOU0lUX05PTkUgPSAwOworICAgIC8qKiB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gICAgICAgICAgZmluYWwgQWN0aXZpdHlXYWl0ZXIgYXcgPSBtV2FpdGluZ0FjdGl2aXRpZXMuZ2V0KGkpOwotICAgICAgICAgICAgICAgICAgZmluYWwgSW50ZW50IGludGVudCA9IGF3LmludGVudDsKLSAgICAgICAgICAgICAgICAgIGlmIChpbnRlbnQuZmlsdGVyRXF1YWxzKGFjdGl2aXR5LmdldEludGVudCgpKSkgewotICAgICAgICAgICAgICAgICAgICAgIGF3LmFjdGl2aXR5ID0gYWN0aXZpdHk7Ci0gICAgICAgICAgICAgICAgICAgICAgbU1lc3NhZ2VRdWV1ZS5hZGRJZGxlSGFuZGxlcihuZXcgQWN0aXZpdHlHb2luZyhhdykpOwotICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICB9Ci0gICAgICAgICAgfQotICAgICAgfQorICAgICAgLy8gVE9ETzogdGhlIGZvbGxvd2luZyBibG9jayBjYXVzZXMgaW50ZXJtaXR0ZW50IGhhbmdzIHdoZW4gdXNpbmcgc3RhcnRBY3Rpdml0eQorICAgICAgLy8gdGVtcG9yYXJpbHkgY29tbWVudCBvdXQgdW50aWwgcm9vdCBjYXVzZSBpcyBmaXhlZCAoYnVnIDI2MzA2ODMpCisvLyAgICAgIGlmIChtV2FpdGluZ0FjdGl2aXRpZXMgIT0gbnVsbCkgeworLy8gICAgICAgICAgc3luY2hyb25pemVkIChtU3luYykgeworLy8gICAgICAgICAgICAgIGZpbmFsIGludCBOID0gbVdhaXRpbmdBY3Rpdml0aWVzLnNpemUoKTsKKy8vICAgICAgICAgICAgICBmb3IgKGludCBpPTA7IGk8TjsgaSsrKSB7CisvLyAgICAgICAgICAgICAgICAgIGZpbmFsIEFjdGl2aXR5V2FpdGVyIGF3ID0gbVdhaXRpbmdBY3Rpdml0aWVzLmdldChpKTsKKy8vICAgICAgICAgICAgICAgICAgZmluYWwgSW50ZW50IGludGVudCA9IGF3LmludGVudDsKKy8vICAgICAgICAgICAgICAgICAgaWYgKGludGVudC5maWx0ZXJFcXVhbHMoYWN0aXZpdHkuZ2V0SW50ZW50KCkpKSB7CisvLyAgICAgICAgICAgICAgICAgICAgICBhdy5hY3Rpdml0eSA9IGFjdGl2aXR5OworLy8gICAgICAgICAgICAgICAgICAgICAgbU1lc3NhZ2VRdWV1ZS5hZGRJZGxlSGFuZGxlcihuZXcgQWN0aXZpdHlHb2luZyhhdykpOworLy8gICAgICAgICAgICAgICAgICB9CisvLyAgICAgICAgICAgICAgfQorLy8gICAgICAgICAgfQorLy8gICAgICB9CiAgICAgICAKLSAgICAgIGFjdGl2aXR5Lm9uRGVzdHJveSgpOworICAgICAgYWN0aXZpdHkucGVyZm9ybURlc3Ryb3koKTsKICAgICAgIAogICAgICAgaWYgKG1BY3Rpdml0eU1vbml0b3JzICE9IG51bGwpIHsKICAgICAgICAgICBzeW5jaHJvbml6ZWQgKG1TeW5jKSB7CkBAIC0xMzMxLDcgKzEzMzUsNyBAQAogICAgICAqICAgICAgICAgICAgICAgICAgICAgIGlzIGJlaW5nIHN0YXJ0ZWQuCiAgICAgICogQHBhcmFtIHRva2VuIEludGVybmFsIHRva2VuIGlkZW50aWZ5aW5nIHRvIHRoZSBzeXN0ZW0gd2hvIGlzIHN0YXJ0aW5nIAogICAgICAqICAgICAgICAgICAgICB0aGUgYWN0aXZpdHk7IG1heSBiZSBudWxsLgotICAgICAqIEBwYXJhbSB0YXJnZXQgV2hpY2ggYWN0aXZpdHkgaXMgcGVyZm9ybSB0aGUgc3RhcnQgKGFuZCB0aHVzIHJlY2VpdmluZyAKKyAgICAgKiBAcGFyYW0gdGFyZ2V0IFdoaWNoIGFjdGl2aXR5IGlzIHBlcmZvcm1pbmcgdGhlIHN0YXJ0IChhbmQgdGh1cyByZWNlaXZpbmcgCiAgICAgICogICAgICAgICAgICAgICBhbnkgcmVzdWx0KTsgbWF5IGJlIG51bGwgaWYgdGhpcyBjYWxsIGlzIG5vdCBiZWluZyBtYWRlCiAgICAgICogICAgICAgICAgICAgICBmcm9tIGFuI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ml0b3JzICE9IG51bGwpIHsKKyAgICAgICAgICAgIHN5bmNocm9uaXplZCAobVN5bmMpIHsKKyAgICAgICAgICAgICAgICBmaW5hbCBpbnQgTiA9IG1BY3Rpdml0eU1vbml0b3JzLnNpemUoKTsKKyAgICAgICAgICAgICAgICBmb3IgKGludCBpPTA7IGk8TjsgaSsrKSB7CisgICAgICAgICAgICAgICAgICAgIGZpbmFsIEFjdGl2aXR5TW9uaXRvciBhbSA9IG1BY3Rpdml0eU1vbml0b3JzLmdldChpKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGFtLm1hdGNoKHdobywgbnVsbCwgaW50ZW50KSkgeworICAgICAgICAgICAgICAgICAgICAgICAgYW0ubUhpdHMrKzsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhbS5pc0Jsb2NraW5nKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcmVxdWVzdENvZGUgPj0gMCA/IGFtLmdldFJlc3VsdCgpIDogbnVsbDsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBpbnQgcmVzdWx0ID0gQWN0aXZpdHlNYW5hZ2VyTmF0aXZlLmdldERlZmF1bHQoKQorICAgICAgICAgICAgICAgIC5zdGFydEFjdGl2aXR5KHdob1RocmVhZCwgaW50ZW50LAorICAgICAgICAgICAgICAgICAgICAgICAgaW50ZW50LnJlc29sdmVUeXBlSWZOZWVkZWQod2hvLmdldENvbnRlbnRSZXNvbHZlcigpKSwKKyAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsIDAsIHRva2VuLCB0YXJnZXQgIT0gbnVsbCA/IHRhcmdldC5tV2hvIDogbnVsbCwKKyAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVlc3RDb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B1YmxpYyBWaWV3IG9uQ3JlYXRlVmlldyhMYXlvdXRJbmZsYXRlciBpbmZsYXRlciwgVmlld0dyb3VwIGNvbnRhaW5lciwKKyAgICAgICAgICAgIEJ1bmRsZSBzYXZlZEluc3RhbmNlU3RhdGUpIHsKKyAgICAgICAgcmV0dXJuIGluZmxhdGVyLmluZmxhdGUoY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5sYXlvdXQubGlzdF9jb250ZW50LAorICAgICAgICAgICAgICAgIGNvbnRhaW5lciwgZmFsc2UpOworICAgIH0KKworICAgIC8qKgorICAgICAqIEF0dGFjaCB0byBsaXN0IHZpZXcgb25jZSBGcmFnbWVudCBpcyByZWFkeSB0byBydW4uCisgICAgICovCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgb25BY3Rpdml0eUNyZWF0ZWQoQnVuZGxlIHNhdmVkSW5zdGFuY2VTdGF0ZSkgeworICAgICAgICBzdXBlci5vbkFjdGl2aXR5Q3JlYXRlZChzYXZlZEluc3RhbmNlU3RhdGUpOworICAgICAgICBlbnN1cmVMaXN0KCk7CisgICAgfQorCisgICAgLyoqCisgICAgICogRGV0YWNoIGZyb20gbGlzdCB2aWV3LgorICAgICAqLworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIG9uRGVzdHJveVZpZXcoKSB7CisgICAgICAgIG1IYW5kbGVyLnJlbW92ZUNhbGxiYWNrcyhtUmVxdWVzdEZvY3VzKTsKKyAgICAgICAgbUxpc3QgPSBudWxsOworICAgICAgICBzdXBlci5vbkRlc3Ryb3lWaWV3KCk7CisgICAgfQorCisgICAgLyoqCisgICAgICogVGhpcyBtZXRob2Qgd2lsbCBiZSBjYWxsZWQgd2hlbiBhbiBpdGVtIGluIHRoZSBsaXN0IGlzIHNlbGVjdGVkLgorICAgICAqIFN1YmNsYXNzZXMgc2hvdWxkIG92ZXJyaWRlLiBTdWJjbGFzc2VzIGNhbiBjYWxsCisgICAgICogZ2V0TGlzdFZpZXc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3QgaGF2ZSBhbgorICAgICAgICAgICAgICAgIC8vIGFkYXB0ZXIuICBJdCBpcyBub3cgdGltZSB0byBzaG93IGl0LgorICAgICAgICAgICAgICAgIHNldExpc3RTaG93bih0cnVlLCBnZXRWaWV3KCkuZ2V0V2luZG93VG9rZW4oKSAhPSBudWxsKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIFNldCB0aGUgY3VycmVudGx5IHNlbGVjdGVkIGxpc3QgaXRlbSB0byB0aGUgc3BlY2lmaWVkCisgICAgICogcG9zaXRpb24gd2l0aCB0aGUgYWRhcHRlcidzIGRhdGEKKyAgICAgKgorICAgICAqIEBwYXJhbSBwb3NpdGlvbgorICAgICAqLworICAgIHB1YmxpYyB2b2lkIHNldFNlbGVjdGlvbihpbnQgcG9zaXRpb24pIHsKKyAgICAgICAgZW5zdXJlTGlzdCgpOworICAgICAgICBtTGlzdC5zZXRTZWxlY3Rpb24ocG9zaXRpb24pOworICAgIH0KKworICAgIC8qKgorICAgICAqIEdldCB0aGUgcG9zaXRpb24gb2YgdGhlIGN1cnJlbnRseSBzZWxlY3RlZCBsaXN0IGl0ZW0uCisgICAgICovCisgICAgcHVibGljIGludCBnZXRTZWxlY3RlZEl0ZW1Qb3NpdGlvbigpIHsKKyAgICAgICAgZW5zdXJlTGlzdCgpOworICAgICAgICByZXR1cm4gbUxpc3QuZ2V0U2VsZWN0ZWRJdGVtUG9zaXRpb24oKTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBHZXQgdGhlIGN1cnNvciByb3cgSUQgb2YgdGhlIGN1cnJlbnRseSBzZWxlY3RlZCBsaXN0IGl0ZW0uCisgICAgICovCisgICAgcHVibGljIGxvbmcgZ2V0U2VsZWN0ZWRJdGVtSWQoKSB7CisgICAgICAgIGVuc3VyZUxpc3QoKTsKKyAgICAgICAgcmV0dXJuIG1MaXN0LmdldFNlbGVjdGVkSXRlbUlkKCk7CisgICAgfQorCisgICAgLyoqCisgICAgICogR2V0IHRoZSBhY3Rpdml0eSdzIGxpc3QgdmlldyB3aWRnZXQuCisgICAgICovCisgICAgcHVibGljIExpc3RWaWV3IGdldExpc3RWaWV3KCkgeworICAgICAgICBlbnN1cmVMaXN0KCk7CisgICAgICAgIHJldHVybiBtTGlzdDsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBUaGUgZGVmYXVsdCBjb250ZW50IGZvciBhIExpc3RGcmFnbWVudCBoYXMgYSBUZXh0VmlldyB0aGF0IGNhbgorICAgICAqIGJlIHNob3duIHdoZW4gdGhlIGxpc3QgaXMgZW1wdHkuICBJZiB5b3Ugd291bGQgbGlrZSB0byBoYXZlIGl0CisgICAgICogc2hvd24sIGNhbGwgdGhpcyBtZXRob2QgdG8gc3VwcGx5IHRoZSB0ZXh0IGl0IHNob3VsZCB1c2UuCisgICAgICovCisgICAgcHVibGljIHZvaWQgc2V0RW1wdHlUZXh0KENoYXJTZXF1ZW5jZSB0ZXh0KSB7CisgICAgICAgIGVuc3VyZUxpc3QoKTsKKyAgICAgICAgaWYgKG1TdGFuZGFyZEVtcHR5VmlldyA9PSBudWxsKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJDYW4ndCBiZSB1c2VkIHdpdGggYSBjdXN0b20gY29udGVudCB2aWV3Iik7CisgICAgICAgIH0KKyAgICAgICAgbVN0YW5kYXJkRW1wdHlWaWV3LnNldFRleHQodGV4dCk7CisgICAgICAgIGlmICghbVNldEVtcHR5VGV4dCkgeworICAgICAgICAgICAgbUxpc3Quc2V0RW1wdHlWaWV3KG1TdGFuZGFyZEVtcHR5Vmlldyk7CisgICAgICAgICAgICBtU2V0RW1wdHlUZXh0ID0gdHJ1ZTsKKyAgICAgICAgfQorICAgIH0KKyAgICAKKyAgICAvKioKKyAgICAgKiBDb250cm9sIHdoZXRoZXIgdGhlIGxpc3QgaXMgYmVpbmcgZGlzcGxheWVkLiAgWW91IGNhbiBtYWtlIGl0IG5vdAorICAgICAqIGRpc3BsYXllZCBpZiB5b3UgYXJlIHdhaXRpbmcgZm9yIHRoZSBpbml0aWFsIGRhdGEgdG8gc2hvdyBpbiBpdC4gIER1cmluZworICAgICAqIHRoaXMgdGltZSBhbiBpbmRldGVybWluYW50IHByb2dyZXNzIGluZGljYXRvciB3aWxsIGJlIHNob3duIGluc3RlYWQuCisgICAgICogCisgICAgICogPHA+QXBwbGljYXRpb25zIGRvIG5vdCBub3JtYWxseSBuZWVkIHRvIHVzZSB0aGlzIHRoZW1zZWx2ZXMuICBUaGUgZGVmYXVsdAorICAgICAqIGJlaGF2aW9yIG9mIExpc3RGcmFnbWVudCBpcyB0byBzdGFydCB3aXRoIHRoZSBsaXN0IG5vdCBiZWluZyBzaG93biwgb25seQorICAgICAqIHNob3dpbmcgaXQgb25jZSBhbiBhZGFwdGVyIGlzIGdpdmVuIHdpdGgge0BsaW5rICNzZXRMaXN0QWRhcHRlcihMaXN0QWRhcHRlcil9LgorICAgICAqIElmIHRoZSBsaXN0IGF0IHRoYXQgcG9pbnQgaGFkIG5vdCBiZWVuIHNob3duLCB3aGVuIGl0IGRvZXMgZ2V0IHNob3duCisgICAgICogaXQgd2lsbCBiZSBkbyB3aXRob3V0IHRoZSB1c2VyIGV2ZXIgc2VlaW5nIHRoZSBoaWRkZW4gc3RhdGUuCisgICAgICogCisgICAgICogQHBhcmFtIHNob3duIElmIHRydWUsIHRoZSBsaXN0IHZpZXcgaXMgc2hvd247IGlmIGZhbHNlLCB0aGUgcHJvZ3Jlc3MKKyAgICAgKiBpbmRpY2F0b3IuICBUaGUgaW5pdGlhbCB2YWx1ZSBpcyB0cnVlLgorICAgICAqLworICAgIHB1YmxpYyB2b2lkIHNldExpc3RTaG93bihib29sZWFuIHNob3duKSB7CisgICAgICAgIHNldExpc3RTaG93bihzaG93biwgdHJ1ZSk7CisgICAgfQorICAgIAorICAgIC8qKgorICAgICAqIExpa2Uge0BsaW5rICNzZXRMaXN0U2h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JvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJDYW4ndCBiZSB1c2VkIHdpdGggYSBjdXN0b20gY29udGVudCB2aWV3Iik7CisgICAgICAgIH0KKyAgICAgICAgaWYgKG1MaXN0U2hvd24gPT0gc2hvd24pIHsKKyAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfQorICAgICAgICBtTGlzdFNob3duID0gc2hvd247CisgICAgICAgIGlmIChzaG93bikgeworICAgICAgICAgICAgaWYgKGFuaW1hdGUpIHsKKyAgICAgICAgICAgICAgICBtUHJvZ3Jlc3NDb250YWluZXIuc3RhcnRBbmltYXRpb24oQW5pbWF0aW9uVXRpbHMubG9hZEFuaW1hdGlvbigKKyAgICAgICAgICAgICAgICAgICAgICAgIGdldEFjdGl2aXR5KCksIGFuZHJvaWQuUi5hbmltLmZhZGVfb3V0KSk7CisgICAgICAgICAgICAgICAgbUxpc3RDb250YWluZXIuc3RhcnRBbmltYXRpb24oQW5pbWF0aW9uVXRpbHMubG9hZEFuaW1hdGlvbigKKyAgICAgICAgICAgICAgICAgICAgICAgIGdldEFjdGl2aXR5KCksIGFuZHJvaWQuUi5hbmltLmZhZGVfaW4pKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1Qcm9ncmVzc0NvbnRhaW5lci5zZXRWaXNpYmlsaXR5KFZpZXcuR09ORSk7CisgICAgICAgICAgICBtTGlzdENvbnRhaW5lci5zZXRWaXNpYmlsaXR5KFZpZXcuVklTSUJMRSk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBpZiAoYW5pbWF0ZSkgeworICAgICAgICAgICAgICAgIG1Qcm9ncmVzc0NvbnRhaW5lci5zdGFydEFuaW1hdGlvbihBbmltYXRpb25VdGlscy5sb2FkQW5pbWF0aW9uKAorICAgICAgICAgICAgICAgICAgICAgICAgZ2V0QWN0aXZpdHkoKSwgYW5kcm9pZC5SLmFuaW0uZmFkZV9pbikpOworICAgICAgICAgICAgICAgIG1MaXN0Q29udGFpbmVyLnN0YXJ0QW5pbWF0aW9uKEFuaW1hdGlvblV0aWxzLmxvYWRBbmltYXRpb24oCisgICAgICAgICAgICAgICAgICAgICAgICBnZXRBY3Rpdml0eSgpLCBhbmRyb2lkLlIuYW5pbS5mYWRlX291dCkpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgbVByb2dyZXNzQ29udGFpbmVyLnNldFZpc2liaWxpdHkoVmlldy5WSVNJQkxFKTsKKyAgICAgICAgICAgIG1MaXN0Q29udGFpbmVyLnNldFZpc2liaWxpdHkoVmlldy5HT05FKTsKKyAgICAgICAgfQorICAgIH0KKyAgICAKKyAgICAvKioKKyAgICAgKiBHZXQgdGhlIExpc3RBZGFwdGVyIGFzc29jaWF0ZWQgd2l0aCB0aGlzIGFjdGl2aXR5J3MgTGlzdFZpZXcuCisgICAgICovCisgICAgcHVibGljIExpc3RBZGFwdGVyIGdldExpc3RBZGFwdGVyKCkgeworICAgICAgICByZXR1cm4gbUFkYXB0ZXI7CisgICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIGVuc3VyZUxpc3QoKSB7CisgICAgICAgIGlmIChtTGlzdCAhPSBudWxsKSB7CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKyAgICAgICAgVmlldyByb290ID0gZ2V0VmlldygpOworICAgICAgICBpZiAocm9vdCA9PSBudWxsKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJDb250ZW50IHZpZXcgbm90IHlldCBjcmVhdGVkIik7CisgICAgICAgIH0KKyAgICAgICAgaWYgKHJvb3QgaW5zdGFuY2VvZiBMaXN0VmlldykgeworICAgICAgICAgICAgbUxpc3QgPSAoTGlzdFZpZXcpcm9vdDsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIG1TdGFuZGFyZEVtcHR5VmlldyA9IChUZXh0Vmlldylyb290LmZpbmRWaWV3QnlJZCgKKyAgICAgICAgICAgICAgICAgICAgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5pZC5pbnRlcm5hbEVtcHR5KTsKKyAgICAgICAgICAgIGlmIChtU3RhbmRhcmRFbXB0eVZpZXcgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgIG1FbXB0eVZpZXcgPSByb290LmZpbmRWaWV3QnlJZChhbmRyb2lkLlIuaWQuZW1wdHkpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgbVByb2dyZXNzQ29udGFpbmVyID0gcm9vdC5maW5kVmlld0J5SWQoY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5pZC5wcm9ncmVzc0NvbnRhaW5lcik7CisgICAgICAgICAgICBtTGlzdENvbnRhaW5lciA9IHJvb3QuZmluZFZpZXdCeUlkKGNvbS5hbmRyb2lkLmludGVybmFsLlIuaWQubGlzdENvbnRhaW5lcik7CisgICAgICAgICAgICBWaWV3IHJhd0xpc3RWaWV3ID0gcm9vdC5maW5kVmlld0J5SWQoYW5kcm9pZC5SLmlkLmxpc3QpOworICAgICAgICAgICAgaWYgKCEocmF3TGlzdFZpZXcgaW5zdGFuY2VvZiBMaXN0VmlldykpIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgUnVudGltZUV4Y2VwdGlvbigKKyAgICAgICAgICAgICAgICAgICAgICAgICJDb250ZW50IGhhcyB2aWV3IHdpdGggaWQgYXR0cmlidXRlICdhbmRyb2lkLlIuaWQubGlzdCcgIgorICAgICAgICAgICAgICAgICAgICAgICAgKyAidGhhdCBpcyBub3QgYSBMaXN0VmlldyBjbGFzcyIpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgbUxpc3QgPSAoTGlzdFZpZXcpcmF3TGlzdFZpZXc7CisgICAgICAgICAgICBpZiAobUxpc3QgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBSdW50aW1lRXhjZXB0aW9uKAorICAgICAgICAgICAgICAgICAgICAgICAgIllvdXIgY29udGVudCBtdXN0IGhhdmUgYSBMaXN0VmlldyB3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dzID0gYXJnczsKKyAgICAgICAgICAgIG1DYWxsYmFja3MgPSBjYWxsYmFja3M7CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIHZvaWQgc3RhcnQoKSB7CisgICAgICAgICAgICBpZiAobVJldGFpbmluZyAmJiBtUmV0YWluaW5nU3RhcnRlZCkgeworICAgICAgICAgICAgICAgIC8vIE91ciBvd25lciBpcyBzdGFydGVkLCBidXQgd2Ugd2VyZSBiZWluZyByZXRhaW5lZCBmcm9tIGEKKyAgICAgICAgICAgICAgICAvLyBwcmV2aW91cyBpbnN0YW5jZSBpbiB0aGUgc3RhcnRlZCBzdGF0ZS4uLiAgc28gdGhlcmUgaXMgcmVhbGx5CisgICAgICAgICAgICAgICAgLy8gbm90aGluZyB0byBkbyBoZXJlLCBzaW5jZSB0aGUgbG9hZGVycyBhcmUgc3RpbGwgc3RhcnRlZC4KKyAgICAgICAgICAgICAgICBtU3RhcnRlZCA9IHRydWU7CisgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpZiAobVN0YXJ0ZWQpIHsKKyAgICAgICAgICAgICAgICAvLyBJZiBsb2FkZXIgYWxyZWFkeSBzdGFydGVkLCBkb24ndCByZXN0YXJ0LgorICAgICAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKERFQlVHKSBMb2cudihUQUcsICIgIFN0YXJ0aW5nOiAiICsgdGhpcyk7CisgICAgICAgICAgICBpZiAobUxvYWRlciA9PSBudWxsICYmIG1DYWxsYmFja3MgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgbUxvYWRlciA9IG1DYWxsYmFja3Mub25DcmVhdGVMb2FkZXIobUlkLCBtQXJncyk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAobUxvYWRlciAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgaWYgKCFtTGlzdGVuZXJSZWdpc3RlcmVkKSB7CisgICAgICAgICAgICAgICAgICAgIG1Mb2FkZXIucmVnaXN0ZXJMaXN0ZW5lcihtSWQsIHRoaXMpOworICAgICAgICAgICAgICAgICAgICBtTGlzdGVuZXJSZWdpc3RlcmVkID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgbUxvYWRlci5zdGFydExvYWRpbmcoKTsKKyAgICAgICAgICAgICAgICBtU3RhcnRlZCA9IHRydWU7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIHZvaWQgcmV0YWluKCkgeworICAgICAgICAgICAgaWYgKERFQlVHKSBMb2cudihUQUcsICIgIFJldGFpbmluZzogIiArIHRoaXMpOworICAgICAgICAgICAgbVJldGFpbmluZyA9IHRydWU7CisgICAgICAgICAgICBtUmV0YWluaW5nU3RhcnRlZCA9IG1TdGFydGVkOworICAgICAgICAgICAgbVN0YXJ0ZWQgPSBmYWxzZTsKKyAgICAgICAgICAgIG1DYWxsYmFja3MgPSBudWxsOworICAgICAgICB9CisgICAgICAgIAorICAgICAgICB2b2lkIGZpbmlzaFJldGFpbigpIHsKKyAgICAgICAgICAgIGlmIChtUmV0YWluaW5nKSB7CisgICAgICAgICAgICAgICAgaWYgKERFQlVHKSBMb2cudihUQUcsICIgIEZpbmlzaGVkIFJldGFpbmluZzogIiArIHRoaXMpOworICAgICAgICAgICAgICAgIG1SZXRhaW5pbmcgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICBpZiAobVN0YXJ0ZWQgIT0gbVJldGFpbmluZ1N0YXJ0ZWQpIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKCFtU3RhcnRlZCkgeworICAgICAgICAgICAgICAgICAgICAgICAgLy8gVGhpcyBsb2FkZXIgd2FzIHJldGFpbmVkIGluIGEgc3RhcnRlZCBzdGF0ZSwgYnV0CisgICAgICAgICAgICAgICAgICAgICAgICAvLyBhdCB0aGUgZW5kIG9mIHJldGFpbmluZyBldmVyeXRoaW5nIG91ciBvd25lciBpcworICAgICAgICAgICAgICAgICAgICAgICAgLy8gbm8gbG9uZ2VyIHN0YXJ0ZWQuLi4gIHNvIG1ha2UgaXQgc3RvcC4KKyAgICAgICAgICAgICAgICAgICAgICAgIHN0b3AoKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBpZiAobVN0YXJ0ZWQgJiYgbURhdGEgIT0gbnVsbCAmJiBtQ2FsbGJhY2tzICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gVGhpcyBsb2FkZXIgd2FzIHJldGFpbmVkLCBhbmQgbm93IGF0IHRoZSBwb2ludCBvZgorICAgICAgICAgICAgICAgICAgICAvLyBmaW5pc2hpbmcgdGhlIHJldGFpbiB3ZSBmaW5kIHdlIHJlbWFpbiBzdGFydGVkLCBoYXZlCisgICAgICAgICAgICAgICAgICAgIC8vIG91ciBkYXRhLCBhbmQgdGhlIG93bmVyIGhhcyBhIG5ldyBjYWxsYmFjay4uLiAgc28KKyAgICAgICAgICAgICAgICAgICAgLy8gbGV0J3MgZGVsaXZlciB0aGUgZGF0YSBub3cuCisgICAgICAgICAgICAgICAgICAgIG1DYWxsYmFja3Mub25Mb2FkRmluaXNoZWQobUxvYWRlciwgbURhdGEpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgdm9pZCBzdG9wKCkgeworICAgICAgICAgICAgaWYgKERFQlVHKSBMb2cudihUQUcsICIgIFN0b3BwaW5nOiAiICsgdGhpcyk7CisgICAgICAgICAgICBtU3RhcnRlZCA9IGZhbHNlOworICAgICAgICAgICAgaWYgKCFtUmV0YWluaW5nKSB7CisgICAgICAgICAgICAgICAgaWYgKG1Mb2FkZXIgIT0gbnVsbCAmJiBtTGlzdGVuZXJSZWdpc3RlcmVkKSB7CisgICAgICAgICAgICAgICAgICAgIC8vIExldCB0aGUgbG9hZGVyIGtub3cgd2UncmUgZG9uZSB3aXRoIGl0CisgICAgICAgICAgICAgICAgICAgIG1MaXN0ZW5lclJlZ2lzdGVyZWQgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICAgICAgbUxvYWRlci51bnJlZ2lzdGVyTGlzdGVuZXIodGhpcyk7CisgICAgICAgICAgICAgICAgICAgIG1Mb2FkZXIuc3RvcExvYWRpbmcoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgbURhdGEgPSBudWxsOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIAorICAgICAgICB2b2lkIGRlc3Ryb3koKSB7CisgICAgICAgICAgICBpZiAoREVCVUcpIExvZy52KFRBRywgIiAgRGVzdHJveWluZzogIiArIHRoaXMpOworICAgICAgICAgICAgbURlc3Ryb3llZCA9IHRydWU7CisgICAgICAgICAgICBtQ2FsbGJhY2tzID0gbnVsbDsKKyAgICAgICAgICAgIGlmIChtTG9hZGVyICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBpZiAobUxpc3RlbmVyUmVnaXN0ZXJlZCkgeworICAgICAgICAgICAgICAgICAgICBtTGlzdGVuZXJSZWdpc3RlcmVkID0gZmFsc2U7CisgICAgICAgICAgICAgICAgICAgIG1Mb2FkZXIudW5yZWdpc3Rlckxpc3RlbmVyKHRoaXMpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBtTG9hZGVyLmRlc3Ryb3koKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgQE92ZXJyaWRlIHB1YmxpYyB2b2lkIG9uTG9hZENvbXBsZXRlKExvYWRlcjxPYmplY3Q+IGxvYWRlciwgT2JqZWN0IGRhdGEpIHsKKyAgICAgICAgICAgIGlmIChERUJVRykgTG9nLnYoVEFHLCAib25Mb2FkQ29tcGxldGU6ICIgKyB0aGlzICsgIiBtRGVzdHJveWVkPSIgKyBtRGVzdHJveWVkKTsKKworICAgICAgICAgICAgaWYgKG1EZXN0cm95ZWQpIHsKKyAgICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgICAgICB9CisgICAgICAgICAgICAKKyAgICAgICAgICAgIC8vIE5vdGlmeSBvZiB0aGUgbmV3IGRhdGEgc28gdGhlIGFwcCBjYW4gc3dpdGNoIG91dCB0aGUgb2xkIGRhdGEgYmVmb3JlCisgICAgICAgICAgICAvLyB3ZSB0cnkgdG8gZGVzdHJveSBpdC4KKyAgICAgICAgICAgIG1EYXRhID0gZGF0YTsKKyAgICAgICAgICAgIGlmIChtQ2FsbGJhY2tzICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBtQ2FsbGJhY2tzLm9uTG9hZEZpbmlzaGVkKGxvYWRlciwgZGF0YSk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmIChERUJVRykgTG9nLnYoVEFHLCAib25Mb2FkRmluaXNoZWQgcmV0dXJuZWQ6ICIgKyB0aGlzKTsKKworICAgICAgICAgICAgLy8gV2UgaGF2ZSBub3cgZ2l2ZW4gdGhlIGFwcGxpY2F0aW9uIHRoZSBuZXcgbG9hZGVyIHdpdGggaXRzCisgICAgICAgICAgICAvLyBsb2FkZWQgZGF0YSwgc28gaXQgc2hvdWxkIGhhdmUgc3RvcHBlZCB1c2luZyB0aGUgcHJldmlvdXMKKyAgICAgICAgICAgIC8vIGxvYWRlci4gIElmIHRoZXJlIGlzIGEgcHJldmlvdXMgbG9hZGVyIG9uIHRoZSBpbmFjdGl2ZSBsaXN0LAorICAgICAgICAgICAgLy8gY2xlYW4gaXQgdXAuCisgICAgICAgICAgICBMb2FkZXJJbmZvIGluZm8gPSBtSW5hY3RpdmVMb2FkZXJzLmdldChtSWQpOworICAgICAgICAgICAgaWYgKGluZm8gIT0gbnVsbCAmJiBpbmZvICE9IHRoaXMpIHsKKyAgICAgICAgICAgICAgICBpbmZvLmRlc3Ryb3koKTsKKyAgICAgICAgICAgICAgICBtSW5hY3RpdmVMb2FkZXJzLnJlbW92ZShtSWQpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyBTdHJpbmcgdG9TdHJpbmcoKSB7CisgICAgICAgICAgICBTdHJpbmdCdWlsZGVyIHNiID0gbmV3IFN0cmluZ0J1aWxkZXIoNjQpOworICAgICAgICAgICAgc2IuYXBwZW5kKCJMb2FkZXJJbmZveyIpOworICAgICAgICAgICAgc2IuYXBwZW5kKEludGVnZXIudG9IZXhTdHJpbmcoU3lzdGVtLmlkZW50aXR5SGFzaENvZGUodGhpcykpKTsKKyAgICAgICAgICAgIHNiLmFwcGVuZCgiICMiKTsKKyAgICAgICAgICAgIHNiLmFwcGVuZChtSWQpOworICAgICAgICAgICAgaWYgKG1BcmdzICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBzYi5hcHBlbmQoIiAiKTsKKyAgICAgICAgICAgICAgICBzYi5hcHBlbmQobUFyZ3MudG9TdHJpbmcoKSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBzYi5hcHBlbmQoIn0iKTsKKyAgICAgICAgICAgIHJldHVybiBzYi50b1N0cmluZygpOworICAgICAgICB9CisgICAgfQorICAgIAorICAgIExvYWRlck1hbmFnZXJJbXBsKGJvb2xlYW4gc3RhcnRlZCkgeworICAgICAgICBtU3RhcnRlZCA9IHN0YXJ0ZWQ7CisgICAgfQorICAgIAorICAgIHByaXZhdGUgTG9hZGVySW5mbyBjcmVhdGVMb2FkZXIoaW50IGlkLCBCdW5kbGUgYXJncywKKyAgICAgICAgICAgIExvYWRlck1hbmFnZXIuTG9hZGVyQ2FsbGJhY2tzPE9iamVjdD4gY2FsbGJhY2spIHsKKyAgICAgICAgTG9hZGVySW5mbyBpbmZvID0gbmV3IExvYWRlckluZm8oaWQsIGFyZ3MsICAoTG9hZGVyTWFuYWdlci5Mb2FkZXJDYWxsYmFja3M8T2JqZWN0PiljYWxsYmFjayk7CisgICAgICAgIG1Mb2FkZXJzLnB1dChpZCwgaW5mbyk7CisgICAgICAgIExvYWR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2spOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgaW5mby5tQ2FsbGJhY2tzID0gKExvYWRlck1hbmFnZXIuTG9hZGVyQ2FsbGJhY2tzPE9iamVjdD4pY2FsbGJhY2s7CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIGlmIChpbmZvLm1EYXRhICE9IG51bGwgJiYgbVN0YXJ0ZWQpIHsKKyAgICAgICAgICAgIC8vIElmIHRoZSBsb2FkZXIgaGFzIGFscmVhZHkgZ2VuZXJhdGVkIGl0cyBkYXRhLCByZXBvcnQgaXQgbm93LgorICAgICAgICAgICAgaW5mby5tQ2FsbGJhY2tzLm9uTG9hZEZpbmlzaGVkKGluZm8ubUxvYWRlciwgaW5mby5tRGF0YSk7CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIHJldHVybiAoTG9hZGVyPEQ+KWluZm8ubUxvYWRlcjsKKyAgICB9CisgICAgCisgICAgQFN1cHByZXNzV2FybmluZ3MoInVuY2hlY2tlZCIpCisgICAgcHVibGljIDxEPiBMb2FkZXI8RD4gcmVzdGFydExvYWRlcihpbnQgaWQsIEJ1bmRsZSBhcmdzLCBMb2FkZXJNYW5hZ2VyLkxvYWRlckNhbGxiYWNrczxEPiBjYWxsYmFjaykgeworICAgICAgICBMb2FkZXJJbmZvIGluZm8gPSBtTG9hZGVycy5nZXQoaWQpOworICAgICAgICBpZiAoREVCVUcpIExvZy52KFRBRywgInJlc3RhcnRMb2FkZXIgaW4gIiArIHRoaXMgKyAiOiBjdXI9IiArIGluZm8pOworICAgICAgICBpZiAoaW5mbyAhPSBudWxsKSB7CisgICAgICAgICAgICBMb2FkZXJJbmZvIGluYWN0aXZlID0gbUluYWN0aXZlTG9hZGVycy5nZXQoaWQpOworICAgICAgICAgICAgaWYgKGluYWN0aXZlICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBpZiAoaW5mby5tRGF0YSAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIC8vIFRoaXMgbG9hZGVyIG5vdyBoYXMgZGF0YS4uLiAgd2UgYXJlIHByb2JhYmx5IGJlaW5nCisgICAgICAgICAgICAgICAgICAgIC8vIGNhbGxlZCBmcm9tIHdpdGhpbiBvbkxvYWRDb21wbGV0ZSwgd2hlcmUgd2UgaGF2ZW4ndAorICAgICAgICAgICAgICAgICAgICAvLyB5ZXQgZGVzdHJveWVkIHRoZSBsYXN0IGluYWN0aXZlIGxvYWRlci4gIFNvIGp1c3QgZG8KKyAgICAgICAgICAgICAgICAgICAgLy8gdGhhdCBub3cuCisgICAgICAgICAgICAgICAgICAgIGlmIChERUJVRykgTG9nLnYoVEFHLCAiICBSZW1vdmluZyBsYXN0IGluYWN0aXZlIGxvYWRlciBpbiAiICsgdGhpcyk7CisgICAgICAgICAgICAgICAgICAgIGluYWN0aXZlLmRlc3Ryb3koKTsKKyAgICAgICAgICAgICAgICAgICAgbUluYWN0aXZlTG9hZGVycy5wdXQoaWQsIGluZm8pOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIC8vIFdlIGFscmVhZHkgaGF2ZSBhbiBpbmFjdGl2ZSBsb2FkZXIgZm9yIHRoaXMgSUQgdGhhdCB3ZSBhcmUKKyAgICAgICAgICAgICAgICAgICAgLy8gd2FpdGluZyBmb3IhICBOb3cgd2UgaGF2ZSB0aHJlZSBhY3RpdmUgbG9hZGVycy4uLiBsZXQncyBqdXN0CisgICAgICAgICAgICAgICAgICAgIC8vIGRyb3AgdGhlIG9uZSBpbiB0aGUgbWlkZGxlLCBzaW5jZSB3ZSBhcmUgc3RpbGwgd2FpdGluZyBmb3IKKyAgICAgICAgICAgICAgICAgICAgLy8gaXRzIHJlc3VsdCBidXQgdGhhdCByZXN1bHQgaXMgYWxyZWFkeSBvdXQgb2YgZGF0ZS4KKyAgICAgICAgICAgICAgICAgICAgaWYgKERFQlVHKSBMb2cudihUQUcsICIgIFJlbW92aW5nIGludGVybWVkaWF0ZSBsb2FkZXIgaW4gIiArIHRoaXMpOworICAgICAgICAgICAgICAgICAgICBpbmZvLmRlc3Ryb3koKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIC8vIEtlZXAgdHJhY2sgb2YgdGhlIHByZXZpb3VzIGluc3RhbmNlIG9mIHRoaXMgbG9hZGVyIHNvIHdlIGNhbiBkZXN0cm95CisgICAgICAgICAgICAgICAgLy8gaXQgd2hlbiB0aGUgbmV3IG9uZSBjb21wbGV0ZXMuCisgICAgICAgICAgICAgICAgaWYgKERFQlVHKSBMb2cudihUQUcsICIgIE1ha2luZyBpbmFjdGl2ZTogIiArIGluZm8pOworICAgICAgICAgICAgICAgIG1JbmFjdGl2ZUxvYWRlcnMucHV0KGlkLCBpbmZvKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgaW5mbyA9IGNyZWF0ZUxvYWRlcihpZCwgYXJncywgIChMb2FkZXJNYW5hZ2VyLkxvYWRlckNhbGxiYWNrczxPYmplY3Q+KWNhbGxiYWNrKTsKKyAgICAgICAgcmV0dXJuIChMb2FkZXI8RD4paW5mby5tTG9hZGVyOworICAgIH0KKyAgICAKKyAgICBwdWJsaWMgdm9pZCBzdG9wTG9hZGVyKGludCBpZCkgeworICAgICAgICBpZiAoREVCVUcpIExvZy52KFRBRywgInN0b3BMb2FkZXIgaW4gIiArIHRoaXMgKyAiIG9mICIgKyBpZCk7CisgICAgICAgIGludCBpZHggPSBtTG9hZGVycy5pbmRleE9mS2V5KGlkKTsKKyAgICAgICAgaWYgKGlkeCA+PSAwKSB7CisgICAgICAgICAgICBMb2FkZXJJbmZvIGluZm8gPSBtTG9hZGVycy52YWx1ZUF0KGlkeCk7CisgICAgICAgICAgICBtTG9hZGVycy5yZW1vdmVBdChpZHgpOworICAgICAgICAgICAgaW5mby5kZXN0cm95KCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBAU3VwcHJlc3NXYXJuaW5ncygidW5jaGVja2VkIikKKyAgICBwdWJsaWMgPEQ+IExvYWRlcjxEPiBnZXRMb2FkZXIoaW50IGlkKSB7CisgICAgICAgIExvYWRlckluZm8gbG9hZGVySW5mbyA9IG1Mb2FkZXJzLmdldChpZCk7CisgICAgICAgIGlmIChsb2FkZXJJbmZvICE9IG51bGwpIHsKKyAgICAgICAgICAgIHJldHVybiAoTG9hZGVyPEQ+KW1Mb2FkZXJzLmdldChpZCkubUxvYWRlcjsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gbnVsbDsKKyAgICB9CisgCisgICAgdm9pZCBkb1N0YXJ0KCkgeworICAgICAgICBpZiAoREVCVUcpIExvZy52KFRBRywgIlN0YXJ0aW5nOiAiICsgdGhpcyk7CisKKyAgICAgICAgLy8gQ2FsbCBvdXQgdG8gc3ViIGNsYXNzZXMgc28gdGhleSBjYW4gc3RhcnQgdGhlaXIgbG9hZGVycworICAgICAgICAvLyBMZXQgdGhlIGV4aXN0aW5nIGxvYWRlcnMga25vdyB0aGF0IHdlIHdhbnQgdG8gYmUgbm90aWZpZWQgd2hlbiBhIGxvYWQgaXMgY29tcGxldGUKKyAgICAgICAgZm9yIChpbnQgaSA9IG1Mb2FkZXJzLnNpemUoKS0xOyBpID49IDA7IGktLSkgeworICAgICAgICAgICAgbUxvYWRlcnMudmFsdWVBdChpKS5zdGFydCgpOworICAgICAgICB9CisgICAgICAgIG1TdGFydGVkID0gdHJ1ZTsKKyAgICB9CisgICAgCisgICAgdm9pZCBkb1N0b3AoKSB7CisgICAgICAgIGlmIChERUJVRykgTG9nLnYoVEFHLCAiU3RvcHBpbmc6ICIgKyB0aGlzKTsKKworICAgICAgICBmb3IgKGludCBpID0gbUxvYWRlcnMuc2l6ZSgpLTE7IGkgPj0gMDsgaS0tKSB7CisgICAgICAgICAgICBtTG9hZGVycy52YWx1ZUF0KGkpLnN0b3AoKTsKKyAgICAgICAgfQorICAgICAgICBtU3RhcnRlZCA9IGZhbHNlOworICAgIH0KKyAgICAKKyAgICB2b2lkIGRvUmV0YWluKCkgeworICAgICAgICBpZiAoREVCVUcpIExvZy52KFRBRywgIlJldGFpbmluZzogIiArIHRoaXMpOworCisgICAgICAgIG1SZXRhaW5pbmcgPSB0cnVlOworICAgICAgICBtU3RhcnRlZCA9IGZhbHNlOworICAgICAgICBmb3IgKGludCBpID0gbUxvYWRlcnMuc2l6ZSgpLTE7IGkgPj0gMDsgaS0tKSB7CisgICAgICAgICAgICBtTG9hZGVycy52YWx1ZUF0KGkpLnJldGFpbigpOworICAgICAgICB9CisgICAgfQorICAgIAorICAgIHZvaWQgZmluaXNoUmV0YWluKCkgeworICAgICAgICBpZiAoREVCVUcpIExvZy52KFRBRywgIkZpbmlzaGVkIFJldGFpbmluZzogIiArIHRoaXMpOworCisgICAgICAgIG1SZXRhaW5pbmcgPSBmYWxzZTsKKyAgICAgICAgZm9yIChpbnQgaSA9IG1Mb2FkZXJzLnNpemUoKS0xOyBpID49IDA7IGktLSkgeworICAgICAgICAgICAgbUxvYWRlcnMudmFsdWVBdChpKS5maW5pc2hSZXRhaW4oKTsKKyAgICAgICAgfQorICAgIH0KKyAgICAKKyAgICB2b2lkIGRvRGVzdHJveSgpIHsKKyAgICAgICAgaWYgKCFtUmV0YWluaW5nKSB7CisgICAgICAgICAgICBpZiAoREVCVUcpIExvZy52KFRBRywgIkRlc3Ryb3lpbmcgQWN0aXZlOiAiICsgdGhpcyk7CisgICAgICAgICAgICBmb3IgKGludCBpID0gbUxvYWRlcnMuc2l6ZSgpLTE7IGkgPj0gMDsgaS0tKSB7CisgICAgICAgICAgICAgICAgbUxvYWRlcnMudmFsdWVBdChpKS5kZXN0cm95KCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIGlmIChERUJVRykgTG9nLnYoVEFHLCAiRGVzdHJveWluZyBJbmFjdGl2ZTogIiArIHRoaXMpOworICAgICAgICBmb3IgKGludCBpID0gbUluYWN0aXZlTG9hZGVycy5zaXplKCktMTsga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pZ3VyYXRpb25JbnN0YW5jZSgpOworICAgICAgICAgICAgaWYgKG1Mb2FkZXJzID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICBtTG9hZGVycyA9IG5ldyBIYXNoTWFwPEludGVnZXIsIExvYWRlckluZm88RD4+KCk7CisgICAgICAgICAgICAgICAgb25Jbml0aWFsaXplTG9hZGVycygpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIGlmIChtSW5hY3RpdmVMb2FkZXJzID09IG51bGwpIHsKKyAgICAgICAgICAgIG1JbmFjdGl2ZUxvYWRlcnMgPSBuZXcgSGFzaE1hcDxJbnRlZ2VyLCBMb2FkZXJJbmZvPEQ+PigpOworICAgICAgICB9CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgb25TdGFydCgpIHsKKyAgICAgICAgc3VwZXIub25TdGFydCgpOworCisgICAgICAgIC8vIENhbGwgb3V0IHRvIHN1YiBjbGFzc2VzIHNvIHRoZXkgY2FuIHN0YXJ0IHRoZWlyIGxvYWRlcnMKKyAgICAgICAgLy8gTGV0IHRoZSBleGlzdGluZyBsb2FkZXJzIGtub3cgdGhhdCB3ZSB3YW50IHRvIGJlIG5vdGlmaWVkIHdoZW4gYSBsb2FkIGlzIGNvbXBsZXRlCisgICAgICAgIGZvciAoSGFzaE1hcC5FbnRyeTxJbnRlZ2VyLCBMb2FkZXJJbmZvPEQ+PiBlbnRyeSA6IG1Mb2FkZXJzLmVudHJ5U2V0KCkpIHsKKyAgICAgICAgICAgIExvYWRlckluZm88RD4gaW5mbyA9IGVudHJ5LmdldFZhbHVlKCk7CisgICAgICAgICAgICBMb2FkZXI8RD4gbG9hZGVyID0gaW5mby5sb2FkZXI7CisgICAgICAgICAgICBpbnQgaWQgPSBlbnRyeS5nZXRLZXkoKTsKKyAgICAgICAgICAgIGlmIChsb2FkZXIgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgbG9hZGVyID0gb25DcmVhdGVMb2FkZXIoaWQsIGluZm8uYXJncyk7CisgICAgICAgICAgICAgICBpbmZvLmxvYWRlciA9IGxvYWRlcjsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGxvYWRlci5yZWdpc3Rlckxpc3RlbmVyKGlkLCB0aGlzKTsKKyAgICAgICAgICAgIGxvYWRlci5zdGFydExvYWRpbmcoKTsKKyAgICAgICAgfQorCisgICAgICAgIG1TdGFydGVkID0gdHJ1ZTsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgdm9pZCBvblN0b3AoKSB7CisgICAgICAgIHN1cGVyLm9uU3RvcCgpOworCisgICAgICAgIGZvciAoSGFzaE1hcC5FbnRyeTxJbnRlZ2VyLCBMb2FkZXJJbmZvPEQ+PiBlbnRyeSA6IG1Mb2FkZXJzLmVudHJ5U2V0KCkpIHsKKyAgICAgICAgICAgIExvYWRlckluZm88RD4gaW5mbyA9IGVudHJ5LmdldFZhbHVlKCk7CisgICAgICAgICAgICBMb2FkZXI8RD4gbG9hZGVyID0gaW5mby5sb2FkZXI7CisgICAgICAgICAgICBpZiAobG9hZGVyID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgLy8gTGV0IHRoZSBsb2FkZXIga25vdyB3ZSdyZSBkb25lIHdpdGggaXQKKyAgICAgICAgICAgIGxvYWRlci51bnJlZ2lzdGVyTGlzdGVuZXIodGhpcyk7CisKKyAgICAgICAgICAgIC8vIFRoZSBsb2FkZXIgaXNuJ3QgZ2V0dGluZyBwYXNzZWQgYWxvbmcgdG8gdGhlIG5leHQgaW5zdGFuY2Ugc28gYXNrIGl0IHRvIHN0b3AgbG9hZGluZworICAgICAgICAgICAgaWYgKCFnZXRBY3Rpdml0eSgpLmlzQ2hhbmdpbmdDb25maWd1cmF0aW9ucygpKSB7CisgICAgICAgICAgICAgICAgbG9hZGVyLnN0b3BMb2FkaW5nKCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBtU3RhcnRlZCA9IGZhbHNlOworICAgIH0KKworICAgIC8qKiBUTyBETzogVGhpcyBuZWVkcyB0byBiZSB0dXJuZWQgaW50byBhIHJldGFpbmVkIGZyYWdtZW50LgorICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyBPYmplY3Qgb25SZXRhaW5Ob25Db25maWd1cmF0aW9uSW5zdGFuY2UoKSB7CisgICAgICAgIC8vIFBhc3MgdGhlIGxvYWRlciBhbG9uZyB0byB0aGUgbmV4dCBndXkKKyAgICAgICAgT2JqZWN0IHJlc3VsdCA9IG1Mb2FkZXJzOworICAgICAgICBtTG9hZGVycyA9IG51bGw7CisgICAgICAgIHJldHVybiByZXN1bHQ7CisgICAgfQorICAgICoqLworCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgb25EZXN0cm95KCkgeworICAgICAgICBzdXBlci5vbkRlc3Ryb3koKTsKKworICAgICAgICBpZiAobUxvYWRlcnMgIT0gbnVsbCkgeworICAgICAgICAgICAgZm9yIChIYXNoTWFwLkVudHJ5PEludGVnZXIsIExvYWRlckluZm88RD4+IGVudHJ5IDogbUxvYWRlcnMuZW50cnlTZXQoKSkgeworICAgICAgICAgICAgICAgIExvYWRlckluZm88RD4gaW5mbyA9IGVudHJ5LmdldFZhbHVlKCk7CisgICAgICAgICAgICAgICAgTG9hZGVyPEQ+IGxvYWRlciA9IGluZm8ubG9hZGVyOworICAgICAgICAgICAgICAgIGlmIChsb2FkZXIgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgbG9hZGVyLmRlc3Ryb3koKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIFN0b3BzIGFuZCByZW1vdmVzIHRoZSBsb2FkZXIgd2l0aCB0aGUgZ2l2ZW4gSUQuCisgICAgICovCisgICAgcHVibGljIHZvaWQgc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mluZGVyIHsKQEAgLTExMiwxMSArMTEwLDE2IEBACiAgICAgICAgIAogICAgICAgICBpZiAoci5jdXJTdGF0ZSA9PSBJTklUSUFMSVpJTkcpIHsKICAgICAgICAgICAgIC8vIEdldCB0aGUgbGFzdE5vbkNvbmZpZ3VyYXRpb25JbnN0YW5jZSBmb3IgdGhlIGFjdGl2aXR5Ci0gICAgICAgICAgICBIYXNoTWFwPFN0cmluZyxPYmplY3Q+IGxhc3ROb25Db25maWd1cmF0aW9uSW5zdGFuY2VzID0KLSAgICAgICAgICAgICAgICBtUGFyZW50LmdldExhc3ROb25Db25maWd1cmF0aW9uQ2hpbGRJbnN0YW5jZXMoKTsKLSAgICAgICAgICAgIE9iamVjdCBpbnN0YW5jZSA9IG51bGw7CisgICAgICAgICAgICBIYXNoTWFwPFN0cmluZywgT2JqZWN0PiBsYXN0Tm9uQ29uZmlndXJhdGlvbkluc3RhbmNlcyA9CisgICAgICAgICAgICAgICAgICAgIG1QYXJlbnQuZ2V0TGFzdE5vbkNvbmZpZ3VyYXRpb25DaGlsZEluc3RhbmNlcygpOworICAgICAgICAgICAgT2JqZWN0IGluc3RhbmNlT2JqID0gbnVsbDsKICAgICAgICAgICAgIGlmIChsYXN0Tm9uQ29uZmlndXJhdGlvbkluc3RhbmNlcyAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgaW5zdGFuY2UgPSBsYXN0Tm9uQ29uZmlndXJhdGlvbkluc3RhbmNlcy5nZXQoci5pZCk7CisgICAgICAgICAgICAgICAgaW5zdGFuY2VPYmogPSBsYXN0Tm9uQ29uZmlndXJhdGlvbkluc3RhbmNlcy5nZXQoci5pZCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBBY3Rpdml0eS5Ob25Db25maWd1cmF0aW9uSW5zdGFuY2VzIGluc3RhbmNlID0gbnVsbDsKKyAgICAgICAgICAgIGlmIChpbnN0YW5jZU9iaiAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgaW5zdGFuY2UgPSBuZXcgQWN0aXZpdHkuTm9uQ29uZmlndXJhdGlvbkluc3RhbmNlcygpOworICAgICAgICAgICAgICAgIGluc3RhbmNlLmFjdGl2aXR5ID0gaW5zdGFuY2VPYmo7CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICAKICAgICAgICAgICAgIC8vIFdlIG5lZWQgdG8gaGF2ZSBhbHdheXMgY3JlYXRlZCB0aGUgYWN0aXZpdHkuCkBAIC0zNDYsNyArMzQ5LDcgQEAKICAgICB9CiAKICAgICBwcml2YXRlIFdpbmRvdyBwZXJmb3JtRGVzdHJveShMb2NhbEFjdGl2aXR5UmVjb3JkIHIsIGJvb2xlYW4gZmluaXNoKSB7Ci0gICAgICAgIFdpbmRvdyB3aW4gPSBudWxsOworICAgICAgICBXaW5kb3cgd2luOwogICAgICAgICB3aW4gPSByLndpbmRvdzsKICAgICAgICAgaWYgKHIuY3VyU3RhdGUgPT0gUkVTVU1FRCAmJiAhZmluaXNoKSB7CiAgICAgICAgICAgICBwZXJmb3JtUGF1c2UociwgZmluaXNoKTsKQEAgLTM4MCw3ICszODMsOCBAQAogICAgICAgICBpZiAociAhPSBudWxsKSB7CiAgICAgICAgICAgICB3aW4gPSBwZXJmb3JtRGVzdHJveShyLCBmaW5pc2gpOwogICAgICAgICAgICAgaWYgKGZpbmlzaCkgewotICAgICAgICAgICAgICAgIG1BY3Rpdml0aWVzLnJlbW92ZShyKTsKKyAgICAgICAgICAgICAgICBtQWN0aXZpdGllcy5yZW1vdmUoaWQpOworICAgICAgICAgICAgICAgIG1BY3Rpdml0eUFycmF5LnJlbW92ZShyKTsKICAgICAgICAgICAgIH0KICAgICAgICAgfQogICAgICAgICByZXR1cm4gd2luOwpAQCAtNDQxLDEwICs0NDUsOCBAQAogICAgICAqLwogICAgIHB1YmxpYyB2b2lkIGRpc3BhdGNoQ3JlYXRlKEJ1bmRsZSBzdGF0ZSkgewogICAgICAgICBpZiAoc3RhdGUgIT0gbnVsbCkgewotICAgICAgICAgICAgZmluYWwgSXRlcmF0b3I8U3RyaW5nPiBpID0gc3RhdGUua2V5U2V0KCkuaXRlcmF0b3IoKTsKLSAgICAgICAgICAgIHdoaWxlIChpLmhhc05leHQoKSkgeworICAgICAgICAgICAgZm9yIChTdHJpbmcgaWQgOiBzdGF0ZS5rZXlTZXQoKSkgewogICAgICAgICAgICAgICAgIHRyeSB7Ci0gICAgICAgICAgICAgICAgICAgIGZpbmFsIFN0cmluZyBpZCA9IGkubmV4dCgpOwogICAgICAgICAgICAgICAgICAgICBmaW5hbCBCdW5kbGUgYXN0YXRlID0gc3RhdGUuZ2V0QnVuZGxlKGlkKTsKICAgICAgICAgICAgICAgICAgICAgTG9jYWxBY3Rpdml0eVJlY29yZCByID0gbUFjdGl2aXRpZXMuZ2V0KGlkKTsKICAgICAgICAgICAgICAgICAgICAgaWYgKHIgIT0gbnVsbCkgewpAQCAtNDU3LDkgKzQ1OSw3IEBACiAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICB9IGNhdGNoIChFeGNlcHRpb24gZSkgewogICAgICAgICAgICAgICAgICAgICAvLyBSZWNvdmVyIGZyb20gLWFsbC0gYXBwIGVycm9ycy4KLSAgICAgICAgICAgICAgICAgICAgTG9nLmUoVEFHLAotICAgICAgICAgICAgICAgICAgICAgICAgICAiRXhjZXB0aW9uIHRocm93biB3aGVuIHJlc3RvcmluZyBMb2NhbEFjdGl2aXR5TWFuYWdlciBzdGF0ZSIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgIGUpOworICAgICAgICAgICAgICAgICAgICBMb2cuZShUQUcsICJFeGNlcHRpb24gdGhyb3duIHdoZW4gcmVzdG9yaW5nIExvY2FsQWN0aXZpdHlNYW5hZ2VyIHN0YXRlIiwgZSk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogICAgICAgICB9CmRpZmYgLS1naXQgYS9jb3JlL2phdmEvYW5kcm9pZC9hcHAvYWRtaW4vRGV2aWNlQWRtaW5JbmZvLmphdmEgYi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YWxsaW5nIGRldmljZSBhZG1pbiBtdXN0IGhhdmUgcmVxdWVzdGVkCisgICAgICoge0BsaW5rIERldmljZUFkbWluSW5mbyNVU0VTX1BPTElDWV9MSU1JVF9QQVNTV09SRH0gdG8gYmUgYWJsZSB0byBjYWxsCisgICAgICogdGhpcyBtZXRob2Q7IGlmIGl0IGhhcyBub3QsIGEgc2VjdXJpdHkgZXhjZXB0aW9uIHdpbGwgYmUgdGhyb3duLgorICAgICAqCisgICAgICogQHBhcmFtIGFkbWluIFdoaWNoIHtAbGluayBEZXZpY2VBZG1pblJlY2VpdmVyfSB0aGlzIHJlcXVlc3QgaXMgYXNzb2NpYXRlZAorICAgICAqICAgICAgICAgICAgd2l0aC4KKyAgICAgKiBAcGFyYW0gbGVuZ3RoIFRoZSBuZXcgZGVzaXJlZCBtaW5pbXVtIG51bWJlciBvZiB1cHBlciBjYXNlIGxldHRlcnMKKyAgICAgKiAgICAgICAgICAgIHJlcXVpcmVkIGluIHRoZSBwYXNzd29yZC4gQSB2YWx1ZSBvZiAwIG1lYW5zIHRoZXJlIGlzIG5vCisgICAgICogICAgICAgICAgICByZXN0cmljdGlvbi4KKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBzZXRQYXNzd29yZE1pbmltdW1VcHBlckNhc2UoQ29tcG9uZW50TmFtZSBhZG1pbiwgaW50IGxlbmd0aCkgeworICAgICAgICBpZiAobVNlcnZpY2UgIT0gbnVsbCkgeworICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICBtU2VydmljZS5zZXRQYXNzd29yZE1pbmltdW1VcHBlckNhc2UoYWRtaW4sIGxlbmd0aCk7CisgICAgICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgIExvZy53KFRBRywgIkZhaWxlZCB0YWxraW5nIHdpdGggZGV2aWNlIHBvbGljeSBzZXJ2aWNlIiwgZSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9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x1ZSBpcyAwLgorICAgICAqIDxwPgorICAgICAqIFRoZSBjYWxsaW5nIGRldmljZSBhZG1pbiBtdXN0IGhhdmUgcmVxdWVzdGVkCisgICAgICoge0BsaW5rIERldmljZUFkbWluSW5mbyNVU0VTX1BPTElDWV9MSU1JVF9QQVNTV09SRH0gdG8gYmUgYWJsZSB0byBjYWxsCisgICAgICogdGhpcyBtZXRob2Q7IGlmIGl0IGhhcyBub3QsIGEgc2VjdXJpdHkgZXhjZXB0aW9uIHdpbGwgYmUgdGhyb3duLgorICAgICAqCisgICAgICogQHBhcmFtIGFkbWluIFdoaWNoIHtAbGluayBEZXZpY2VBZG1pblJlY2VpdmVyfSB0aGlzIHJlcXVlc3QgaXMgYXNzb2NpYXRlZAorICAgICAqICAgICAgICAgICAgd2l0aC4KKyAgICAgKiBAcGFyYW0gbGVuZ3RoIFRoZSBuZXcgZGVzaXJlZCBtaW5pbXVtIG51bWJlciBvZiBsb3dlciBjYXNlIGxldHRlcnMKKyAgICAgKiAgICAgICAgICAgIHJlcXVpcmVkIGluIHRoZSBwYXNzd29yZC4gQSB2YWx1ZSBvZiAwIG1lYW5zIHRoZXJlIGlzIG5vCisgICAgICogICAgICAgICAgICByZXN0cmljdGlvbi4KKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBzZXRQYXNzd29yZE1pbmltdW1Mb3dlckNhc2UoQ29tcG9uZW50TmFtZSBhZG1pbiwgaW50IGxlbmd0aCkgeworICAgICAgICBpZiAobVNlcnZpY2UgIT0gbnVsbCkgeworICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICBtU2VydmljZS5zZXRQYXNzd29yZE1pbmltdW1Mb3dlckNhc2UoYWRtaW4sIGxlbmd0aCk7CisgICAgICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgIExvZy53KFRBRywgIkZhaWxlZCB0YWxraW5nIHdpdGggZGV2aWNlIHBvbGljeSBzZXJ2aWNl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IHBvbGljeSBzZXJ2aWNlIiwgZSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBSZXRyaWV2ZSB0aGUgY3VycmVudCBudW1iZXIgb2YgbGV0dGVycyByZXF1aXJlZCBpbiB0aGUgcGFzc3dvcmQgZm9yIGFsbAorICAgICAqIGFkbWlucyBvciBhIHBhcnRpY3VsYXIgb25lLiBUaGlzIGlzIHRoZSBzYW1lIHZhbHVlIGFzCisgICAgICogc2V0IGJ5IHsjbGluayB7QGxpbmsgI3NldFBhc3N3b3JkTWluaW11bUxldHRlcnMoQ29tcG9uZW50TmFtZSwgaW50KX0KKyAgICAgKiBhbmQgb25seSBhcHBsaWVzIHdoZW4gdGhlIHBhc3N3b3JkIHF1YWxpdHkgaXMKKyAgICAgKiB7QGxpbmsgI1BBU1NXT1JEX1FVQUxJVFlfQ09NUExFWH0uCisgICAgICoKKyAgICAgKiBAcGFyYW0gYWRtaW4gVGhlIG5hbWUgb2YgdGhlIGFkbWluIGNvbXBvbmVudCB0byBjaGVjaywgb3IgbnVsbCB0bworICAgICAqICAgICAgICAgICAgYWdncmVnYXRlIGFsbCBhZG1pbnMuCisgICAgICogQHJldHVybiBUaGUgbWluaW11bSBudW1iZXIgb2YgbGV0dGVycyByZXF1aXJlZCBpbiB0aGUgcGFzc3dvcmQuCisgICAgICovCisgICAgcHVibGljIGludCBnZXRQYXNzd29yZE1pbmltdW1MZXR0ZXJzKENvbXBvbmVudE5hbWUgYWRtaW4pIHsKKyAgICAgICAgaWYgKG1TZXJ2aWNlICE9IG51bGwpIHsKKyAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIG1TZXJ2aWNlLmdldFBhc3N3b3JkTWluaW11bUxldHRlcnMoYWRtaW4pOworICAgICAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICBMb2cudyhUQUcsICJGYWlsZWQg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ICogPHA+CisgICAgICogVGhlIGNhbGxpbmcgZGV2aWNlIGFkbWluIG11c3QgaGF2ZSByZXF1ZXN0ZWQKKyAgICAgKiB7QGxpbmsgRGV2aWNlQWRtaW5JbmZvI1VTRVNfUE9MSUNZX0xJTUlUX1BBU1NXT1JEfSB0byBiZSBhYmxlIHRvIGNhbGwKKyAgICAgKiB0aGlzIG1ldGhvZDsgaWYgaXQgaGFzIG5vdCwgYSBzZWN1cml0eSBleGNlcHRpb24gd2lsbCBiZSB0aHJvd24uCisgICAgICoKKyAgICAgKiBAcGFyYW0gYWRtaW4gV2hpY2gge0BsaW5rIERldmljZUFkbWluUmVjZWl2ZXJ9IHRoaXMgcmVxdWVzdCBpcyBhc3NvY2lhdGVkCisgICAgICogICAgICAgICAgICB3aXRoLgorICAgICAqIEBwYXJhbSBsZW5ndGggVGhlIG5ldyBkZXNpcmVkIG1pbmltdW0gbnVtYmVyIG9mIG51bWVyaWNhbCBkaWdpdHMgcmVxdWlyZWQKKyAgICAgKiAgICAgICAgICAgIGluIHRoZSBwYXNzd29yZC4gQSB2YWx1ZSBvZiAwIG1lYW5zIHRoZXJlIGlzIG5vIHJlc3RyaWN0aW9uLgorICAgICAqLworICAgIHB1YmxpYyB2b2lkIHNldFBhc3N3b3JkTWluaW11bU51bWVyaWMoQ29tcG9uZW50TmFtZSBhZG1pbiwgaW50IGxlbmd0aCkgeworICAgICAgICBpZiAobVNlcnZpY2UgIT0gbnVsbCkgeworICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICBtU2VydmljZS5zZXRQYXNzd29yZE1pbmltdW1OdW1lcmljKGFkbWluLCBsZW5ndGgpOworICAgICAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICBMb2cudyhUQUcsICJGYWlsZWQgdGFsa2luZyB3aXRoIGRldmljZSBwb2xpY3kgc2VydmljZSIsIGUpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICA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ZXZlIHRoZSBjdXJyZW50IG51bWJlciBvZiBzeW1ib2xzIHJlcXVpcmVkIGluIHRoZSBwYXNzd29yZCBmb3IgYWxsCisgICAgICogYWRtaW5zIG9yIGEgcGFydGljdWxhciBvbmUuIFRoaXMgaXMgdGhlIHNhbWUgdmFsdWUgYXMKKyAgICAgKiBzZXQgYnkgeyNsaW5rIHtAbGluayAjc2V0UGFzc3dvcmRNaW5pbXVtU3ltYm9scyhDb21wb25lbnROYW1lLCBpbnQpfQorICAgICAqIGFuZCBvbmx5IGFwcGxpZXMgd2hlbiB0aGUgcGFzc3dvcmQgcXVhbGl0eSBpcworICAgICAqIHtAbGluayAjUEFTU1dPUkRfUVVBTElUWV9DT01QTEVYfS4KKyAgICAgKgorICAgICAqIEBwYXJhbSBhZG1pbiBUaGUgbmFtZSBvZiB0aGUgYWRtaW4gY29tcG9uZW50IHRvIGNoZWNrLCBvciBudWxsIHRvCisgICAgICogICAgICAgICAgICBhZ2dyZWdhdGUgYWxsIGFkbWlucy4KKyAgICAgKiBAcmV0dXJuIFRoZSBtaW5pbXVtIG51bWJlciBvZiBzeW1ib2xzIHJlcXVpcmVkIGluIHRoZSBwYXNzd29yZC4KKyAgICAgKi8KKyAgICBwdWJsaWMgaW50IGdldFBhc3N3b3JkTWluaW11bVN5bWJvbHMoQ29tcG9uZW50TmFtZSBhZG1pbikgeworICAgICAgICBpZiAobVNlcnZpY2UgIT0gbnVsbCkgeworICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICByZXR1cm4gbVNlcnZpY2UuZ2V0UGFzc3dvcmRNaW5pbXVtU3ltYm9scyhhZG1pbik7CisgICAgICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgIExvZy53KFRBRywgIkZhaWxlZCB0YWxraW5nIHdpdGggZGV2aWNlIHBvbGljeSBzZXJ2aWNlIiwgZSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgcm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ljZSBhZG1pbiBtdXN0IGhhdmUgcmVxdWVzdGVkCisgICAgICoge0BsaW5rIERldmljZUFkbWluSW5mbyNVU0VTX1BPTElDWV9MSU1JVF9QQVNTV09SRH0gdG8gYmUgYWJsZSB0byBjYWxsCisgICAgICogdGhpcyBtZXRob2Q7IGlmIGl0IGhhcyBub3QsIGEgc2VjdXJpdHkgZXhjZXB0aW9uIHdpbGwgYmUgdGhyb3duLgorICAgICAqCisgICAgICogQHBhcmFtIGFkbWluIFdoaWNoIHtAbGluayBEZXZpY2VBZG1pblJlY2VpdmVyfSB0aGlzIHJlcXVlc3QgaXMgYXNzb2NpYXRlZAorICAgICAqICAgICAgICAgICAgd2l0aC4KKyAgICAgKiBAcGFyYW0gbGVuZ3RoIFRoZSBuZXcgZGVzaXJlZCBtaW5pbXVtIG51bWJlciBvZiBsZXR0ZXJzIHJlcXVpcmVkIGluIHRoZQorICAgICAqICAgICAgICAgICAgcGFzc3dvcmQuIEEgdmFsdWUgb2YgMCBtZWFucyB0aGVyZSBpcyBubyByZXN0cmljdGlvbi4KKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBzZXRQYXNzd29yZE1pbmltdW1Ob25MZXR0ZXIoQ29tcG9uZW50TmFtZSBhZG1pbiwgaW50IGxlbmd0aCkgeworICAgICAgICBpZiAobVNlcnZpY2UgIT0gbnVsbCkgeworICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICBtU2VydmljZS5zZXRQYXNzd29yZE1pbmltdW1Ob25MZXR0ZXIoYWRtaW4sIGxlbmd0aCk7CisgICAgICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgIExvZy53KFRBRywgIkZhaWxlZCB0YWxraW5nIHdpdGggZGV2aWNlIHBvbGljeSBzZXJ2aWNlIiwgZSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBSZXRyaWV2ZSB0aGUgY3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ob2QgY2FuIGJlIGNhbGxlZCByZXBlYXRlZGx5IGJ5IHRoZSBkZXZpY2UgYWRtaW4gYWxyYWR5IHNldHRpbmcgdGhlCisgICAgICogcHJveHkgdG8gdXBkYXRlIHRoZSBwcm94eSBhbmQgZXhjbHVzaW9uIGxpc3QuCisgICAgICoKKyAgICAgKiBAcGFyYW0gYWRtaW4gV2hpY2gge0BsaW5rIERldmljZUFkbWluUmVjZWl2ZXJ9IHRoaXMgcmVxdWVzdCBpcyBhc3NvY2lhdGVkCisgICAgICogICAgICAgICAgICB3aXRoLgorICAgICAqIEBwYXJhbSBwcm94eVNwZWMgdGhlIGdsb2JhbCBwcm94eSBkZXNpcmVkLiBNdXN0IGJlIGFuIEhUVFAgUHJveHkuCisgICAgICogICAgICAgICAgICBQYXNzIFByb3h5Lk5PX1BST1hZIHRvIHJlc2V0IHRoZSBwcm94eS4KKyAgICAgKiBAcGFyYW0gZXhjbHVzaW9uTGlzdCBhIGxpc3Qgb2YgZG9tYWlucyB0byBiZSBleGNsdWRlZCBmcm9tIHRoZSBnbG9iYWwgcHJveHkuCisgICAgICogQHJldHVybiByZXR1cm5zIG51bGwgaWYgdGhlIHByb3h5IHdhcyBzdWNjZXNzZnVsbHkgc2V0LCBvciBhIHtAbGluayBDb21wb25lbnROYW1lfQorICAgICAqICAgICAgICAgICAgb2YgdGhlIGRldmljZSBhZG1pbiB0aGF0IHNldHMgdGhldyBwcm94eSBvdGhlcndpc2UuCisgICAgICovCisgICAgcHVibGljIENvbXBvbmVudE5hbWUgc2V0R2xvYmFsUHJveHkoQ29tcG9uZW50TmFtZSBhZG1pbiwgUHJveHkgcHJveHlTcGVjLAorICAgICAgICAgICAgTGlzdDxTdHJpbmc+IGV4Y2x1c2lvbkxpc3QgKSB7CisgICAgICAgIGlmIChwcm94eVNwZWMgPT0gbnVsbCkgeworICAgICAgICAgICAgdGhyb3cgbmV3IE51bGxQb2ludGVyRXhjZXB0aW9uKCk7CisgICAgICAgIH0KKyAgICAgICAgaWYgKG1TZXJ2aWNlICE9IG51bGwpIHsKKyAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgU3RyaW5nIGhvc3RTcGVjOworICAgICAgICAgICAgICAgIFN0cmluZyBleGNsU3BlYzsKKyAgICAgICAgICAgICAgICBpZiAocHJveHlTcGVjLmVxdWFscyhQcm94eS5OT19QUk9YWSkpIHsKKyAgICAgICAgICAgICAgICAgICAgaG9zdFNwZWMgPSBudWxsOworICAgICAgICAgICAgICAgICAgICBleGNsU3BlYyA9IG51bGw7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKCFwcm94eVNwZWMudHlwZSgpLmVxdWFscyhQcm94eS5UeXBlLkhUVFApKSB7CisgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgSW5ldFNvY2tldEFkZHJlc3Mgc2EgPSAoSW5ldFNvY2tldEFkZHJlc3MpcHJveHlTcGVjLmFkZHJlc3MoKTsKKyAgICAgICAgICAgICAgICAgICAgU3RyaW5nIGhvc3ROYW1lID0gc2EuZ2V0SG9zdE5hbWUoKTsKKyAgICAgICAgICAgICAgICAgICAgaW50IHBvcnQgPSBzYS5nZXRQb3J0KCk7CisgICAgICAgICAgICAgICAgICAgIFN0cmluZ0J1aWxkZXIgaG9zdEJ1aWxkZXIgPSBuZXcgU3RyaW5nQnVpbGRlcigpOworICAgICAgICAgICAgICAgICAgICBob3N0U3BlYyA9IGhvc3RCdWlsZGVyLmFwcGVuZChob3N0TmFtZSkKKyAgICAgICAgICAgICAgICAgICAgICAgIC5hcHBlbmQoIjoiKS5hcHBlbmQoSW50ZWdlci50b1N0cmluZyhwb3J0KSkudG9TdHJpbmcoKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGV4Y2x1c2lvbkxpc3QgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgZXhjbFNwZWMgPSAiIjsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIFN0cmluZ0J1aWxkZXIgbGlzdEJ1aWxkZXIgPSBuZXcgU3RyaW5nQnVpbGRlcigpOworICAgICAgICAgICAgICAgICAgICAgICAgYm9vbGVhbiBmaXJzdERvbWFpbiA9IHRydWU7CisgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKFN0cmluZyBleGNsRG9tYWluIDogZXhjbHVzaW9uTGlzdCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZmlyc3REb21haW4pIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlzdEJ1aWxkZXIgPSBsaXN0QnVpbGRlci5hcHBlbmQoIiwiKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaXJzdERvbWFpbiA9IGZhbHNlOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaXN0QnVpbGRlciA9IGxpc3RCdWlsZGVyLmFwcGVuZChleGNsRG9tYWluLnRyaW0oKSk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBleGNsU3BlYyA9IGxpc3RCdWlsZGVyLnRvU3RyaW5nKCk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgYW5kcm9pZC5uZXQuUHJveHkudmFsaWRhdGUoaG9zdE5hbWUsIEludGVnZXIudG9TdHJpbmcocG9ydCksIGV4Y2xTcGVjKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgcmV0dXJuIG1TZXJ2aWNlLnNldEdsb2JhbFByb3h5KGFkbWluLCBob3N0U3BlYywgZXhjbFNwZWMpOworICAgICAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICBMb2cudyhUQUcsICJGYWlsZWQgdGFsa2luZyB3aXRoIGRldmljZSBwb2xpY3kgc2VydmljZSIsIGUpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHJldHVybiBudWxsOworICAgIH0KKworICAgIC8qKgorICAgICAqIFJldHVybnMgdGhlIGNvbXBvbmVudCBuYW1lIHNldHRpbmcgdGhlIGdsb2JhbCBwcm94eS4KKyAgICAgKiBAcmV0dXJuIENvbXBvbmVudE5hbWUgb2JqZWN0IG9mIHRoZSBkZXZpY2UgYWRtaW4gdGhhdCBzZXQgdGhlIGdsb2JhbCBwcm94eSwgb3IKKyAgICAgKiAgICAgICAgICAgIG51bGwgaWYgbm8gYWRtaW4gaGFzIHNldCB0aGUgcHJveHkuCisgICAgICovCisgICAgcHVibGljIENvbXBvbmVudE5hbWUgZ2V0R2xvYmFsUHJveHlBZG1pbigpIHsKKyAgICAgICAgaWYgKG1TZXJ2aWNlICE9IG51bGwpIHsKKyAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIG1TZXJ2aWNlLmdldEdsb2JhbFByb3h5QWRtaW4oKTsKKyAgICAgICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgTG9nLncoVEFHLCAiRmFpbGVkIHRhbGtpbmcgd2l0aCBkZXZpY2UgcG9saWN5IHNlcnZpY2UiLCBlKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICByZXR1cm4gbnVsbDsKKyAgICB9CisKICAgICAvKioKICAgICAgKiBAaGlkZQogICAgICAqLwpAQCAtNTQzLDcgKzEwMTMsNyBAQAogICAgICAgICAgICAgfQogICAgICAgICB9CiAgICAgfQotICAgIAorCiAgICAgLyoqCiAgICAgICogQGhpZGUKICAgICAgKi8KQEAgLTU1NiwxMCArMTAyNiwxMCBAQAogICAgICAgICAgICAgTG9nLncoVEFHLCAiVW5hYmxlIHRvIHJldHJpZXZlIGRldmljZSBwb2xpY3kgIiArIGNuLCBlKTsKICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICB9Ci0gICAgICAgIAorCiAgICAgICAgIFJlc29sdmVJbmZvIHJpID0gbmV3IFJlc29sdmVJbmZvKCk7CiAgICAgICAgIHJpLmFjdGl2aXR5SW5mbyA9IGFpOwotICAgICAgICAKKwogICAgICAgICB0cnkgewogICAgICAgICAgICAgcmV0dXJuIG5ldyBEZXZpY2VBZG1pbkluZm8obUNvbnRleHQsIHJpKTsKICAgICAgICAgfSBjYXRjaCAoWG1sUHVsbFBhcnNlckV4Y2VwdGlvbiBlKSB7CkBAIC01NzAsNyArMTA0MCw3IEBACiAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgfQogICAgIH0KLSAgICAKKwogICAgIC8qKgogICAgICAqIEBoaWRlCiAgICAgICovCkBAIC01ODcsMTYgKzEwNTcsMTggQEAKICAgICAvKioKICAgICAgKiBAaGlkZQogICAgICAqLwotICAgIHB1YmxpYyB2b2lkIHNldEFjdGl2ZVBhc3N3b3JkU3RhdGUoaW50IHF1YWxpdHksIGludCBsZW5ndGgpIHsKKyAgICBwdWJsaWMgdm9pZCBzZXRBY3RpdmVQYXNzd29yZFN0YXRlKGludCBxdWFsaXR5LCBpbnQgbGVuZ3RoLCBpbnQgbGV0dGVycywgaW50IHVwcGVyY2FzZSwKKyAgICAgICAgICAgIGludCBsb3dlcmNhc2UsIGludCBudW1iZXJzLCBpbnQgc3ltYm9scywgaW50IG5vbmxldHRlcikgewogICAgICAgICBpZiAobVNlcnZpY2UgIT0gbnVsbCkgewogICAgICAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgICAgICBtU2VydmljZS5zZXRBY3RpdmVQYXNzd29yZFN0YXRlKHF1YWxpdHksIGxlbmd0aCk7CisgICAgICAgICAgICAgICAgbVNlcnZpY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maW5hbCBzdGF0aWMgT2JqZWN0IHNTZXJ2aWNlTG9jayA9IG5ldyBPYmplY3QoKTsKICAgICBzdGF0aWMgSUFwcFdpZGdldFNlcnZpY2Ugc1NlcnZpY2U7CkBAIC02MCw2ICs2MSwxMyBAQAogICAgICAgICAgICAgbXNnLm9iaiA9IGluZm87CiAgICAgICAgICAgICBtc2cuc2VuZFRvVGFyZ2V0KCk7CiAgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCB2aWV3RGF0YUNoYW5nZWQoaW50IGFwcFdpZGdldElkLCBpbnQgdmlld0lkKSB7CisgICAgICAgICAgICBNZXNzYWdlIG1zZyA9IG1IYW5kbGVyLm9idGFpbk1lc3NhZ2UoSEFORExFX1ZJRVdfREFUQV9DSEFOR0VEKTsKKyAgICAgICAgICAgIG1zZy5hcmcxID0gYXBwV2lkZ2V0SWQ7CisgICAgICAgICAgICBtc2cuYXJnMiA9IHZpZXdJZDsKKyAgICAgICAgICAgIG1zZy5zZW5kVG9UYXJnZXQoKTsKKyAgICAgICAgfQogICAgIH0KIAogICAgIGNsYXNzIFVwZGF0ZUhhbmRsZXIgZXh0ZW5kcyBIYW5kbGVyIHsKQEAgLTc3LDYgKzg1LDEwIEBACiAgICAgICAgICAgICAgICAgICAgIG9uUHJvdmlkZXJDaGFuZ2VkKG1zZy5hcmcxLCAoQXBwV2lkZ2V0UHJvdmlkZXJJbmZvKW1zZy5vYmopOwogICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgY2FzZSBIQU5ETEVfVklFV19EQVRBX0NIQU5HRUQ6IHsKKyAgICAgICAgICAgICAgICAgICAgdmlld0RhdGFDaGFuZ2VkKG1zZy5hcmcxLCBtc2cuYXJnMik7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KICAgICAgICAgfQogICAgIH0KQEAgLTI1MCw2ICsyNjIsMTYg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dzIGN1cnJlbnRseSBkYXRhLgorICAgICAqCisgICAgICogQHBhcmFtIGFwcFdpZGdldElkICBUaGUgQXBwV2lkZ2V0IGluc3RhbmNlIGZvciB3aGljaCB0byBub3RpZnkgb2YgdmlldyBkYXRhIGNoYW5nZXMuCisgICAgICogQHBhcmFtIHZpZXdJZCAgICAgICAgVGhlIGNvbGxlY3Rpb24gdmlldyBpZC4KKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBub3RpZnlBcHBXaWRnZXRWaWV3RGF0YUNoYW5nZWQoaW50IGFwcFdpZGdldElkLCBpbnQgdmlld0lkKSB7CisgICAgICAgIG5vdGlmeUFwcFdpZGdldFZpZXdEYXRhQ2hhbmdlZChuZXcgaW50W10geyBhcHBXaWRnZXRJZCB9LCB2aWV3SWQpOworICAgIH0KKworICAgIC8qKgogICAgICAqIFJldHVybiBhIGxpc3Qgb2YgdGhlIEFwcFdpZGdldCBwcm92aWRlcnMgdGhhdCBhcmUgY3VycmVudGx5IGluc3RhbGxlZC4KICAgICAgKi8KICAgICBwdWJsaWMgTGlzdDxBcHBXaWRnZXRQcm92aWRlckluZm8+IGdldEluc3RhbGxlZFByb3ZpZGVycygpIHsKICAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgIHJldHVybiBzU2VydmljZS5nZXRJbnN0YWxsZWRQcm92aWRlcnMoKTsKKyAgICAgICAgICAgIExpc3Q8QXBwV2lkZ2V0UHJvdmlkZXJJbmZvPiBwcm92aWRlcnMgPSBzU2VydmljZS5nZXRJbnN0YWxsZWRQcm92aWRlcnMoKTsKKyAgICAgICAgICAgIGZvciAoQXBwV2lkZ2V0UHJvdmlkZXJJbmZvIGluZm8gOiBwcm92aWRlcnMpIHsKKyAgICAgICAgICAgICAgICAvLyBDb252ZXJ0aW5nIGNvbXBsZXggdG8gZHAuCisgICAgICAgICAgICAgICAgaW5mby5taW5XaWR0aCA9CisgICAgICAgICAgICAgICAgICAgICAgICBUeXBlZFZhbHVlLmNvbXBsZXhUb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pOwogICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0gZWxzZSBpZiAoYWN0aW9uLmVxdWFscyhCbHVldG9vdGhJbnB1dERldmljZS5BQ1RJT05fSU5QVVRfREVWSUNFX1NUQVRFX0NIQU5HRUQpKSB7CisgICAgICAgICAgICAgICAgaW50IG5ld1N0YXRlID0gaW50ZW50LmdldEludEV4dHJhKEJsdWV0b290aElucHV0RGV2aWNlLkVYVFJBX0lOUFVUX0RFVklDRV9TVEFURSwgMCk7CisgICAgICAgICAgICAgICAgaW50IG9sZFN0YXRlID0KKyAgICAgICAgICAgICAgICAgICAgaW50ZW50LmdldEludEV4dHJhKEJsdWV0b290aElucHV0RGV2aWNlLkVYVFJBX1BSRVZJT1VTX0lOUFVUX0RFVklDRV9TVEFURSwgMCk7CisgICAgICAgICAgICAgICAgbUhpZFN0YXRlID0gbmV3U3RhdGU7CisgICAgICAgICAgICAgICAgaWYgKG9sZFN0YXRlID09IEJsdWV0b290aElucHV0RGV2aWNlLlNUQVRFX0NPTk5FQ1RFRCAmJgorICAgICAgICAgICAgICAgICAgICBuZXdTdGF0ZSA9PSBCbHVldG9vdGhJbnB1dERldmljZS5TVEFURV9ESVNDT05ORUNURUQpIHsKKyAgICAgICAgICAgICAgICAgICAgc2VuZE1lc3NhZ2UoRElTQ09OTkVDVF9ISURfSU5DT01JTkcpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBpZiAobmV3U3RhdGUgPT0gQmx1ZXRvb3RoSW5wdXREZXZpY2UuU1RBVEVfQ09OTkVDVEVEIHx8CisgICAgICAgICAgICAgICAgICAgIG5ld1N0YXRlID09IEJsdWV0b290aElucHV0RGV2aWNlLlNUQVRFX0RJU0NPTk5FQ1RFRCkgeworICAgICAgICAgICAgICAgICAgICBzZW5kTWVzc2FnZShUUkFOU0lUSU9OX1RPX1NUQUJMRSk7CisgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfSBlbHNlIGlmIChhY3Rpb24uZXF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KQEAgLTIyNCw2ICsyNDgsMTQgQEAKICAgICAgICAgICAgICAgICBjYXNlIERJU0NPTk5FQ1RfQTJEUF9JTkNPTUlORzoKICAgICAgICAgICAgICAgICAgICAgdHJhbnNpdGlvblRvKG1JbmNvbWluZ0EyZHApOwogICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIENPTk5FQ1RfSElEX09VVEdPSU5HOgorICAgICAgICAgICAgICAgIGNhc2UgRElTQ09OTkVDVF9ISURfT1VUR09JTkc6CisgICAgICAgICAgICAgICAgICAgIHRyYW5zaXRpb25UbyhtT3V0Z29pbmdIaWQpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIENPTk5FQ1RfSElEX0lOQ09NSU5HOgorICAgICAgICAgICAgICAgIGNhc2UgRElTQ09OTkVDVF9ISURfSU5DT01JTkc6CisgICAgICAgICAgICAgICAgICAgIHRyYW5zaXRpb25UbyhtSW5jb21pbmdIaWQpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICBjYXNlIFVOUEFJUjoKICAgICAgICAgICAgICAgICAgICAgaWYgKG1IZWFkc2V0U3RhdGUgIT0gQmx1ZXRvb3RoSGVhZHNldC5TVEFURV9ESVNDT05ORUNURUQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgIHNlbmRNZXNzYWdlKERJU0NPTk5FQ1RfSEZQX09VVEdPSU5HKTsKQEAgLTIzMyw2ICsyNjUsMTAgQEAKICAgICAgICAgICAgICAgICAgICAgICAgIHNlbmRNZXNzYWdlKERJU0NPTk5FQ1RfQTJEUF9PVVRHT0lORyk7CiAgICAgICAgICAgICAgICAgICAgICAgICBkZWZlck1lc3NhZ2UobWVzc2FnZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChtSGlkU3RhdGUgIT0gQmx1ZXRvb3RoSW5wdXREZXZpY2UuU1RBVEVfRElTQ09OTkVDVEVEKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBzZW5kTWVzc2FnZShESVNDT05ORUNUX0hJRF9PVVRHT0lORyk7CisgICAgICAgICAgICAgICAgICAgICAgICBkZWZlck1lc3NhZ2UobWVzc2FnZSk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICBwcm9jZXNzQ29tbWFuZChVTlBBSVIpOwogICAgICAgICAgICAgICAgICAgICBicmVhazsKQEAgLTI1NCw2ICsyOTAsMTAgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1BMmRwU2VydmljZS5nZXRDb25uZWN0ZWRTaW5rcygpLmxlbmd0aCA9PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUEyZHBTZXJ2aWNlLmNvbm5lY3RTaW5rKG1EZXZpY2UpOwogICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1TZXJ2aWNlLmdldElucHV0RGV2aWNlUHJpb3JpdHkobURldmljZSkgPT0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEJsdWV0b290aElucHV0RGV2aWNlLlBSSU9SSVRZX0FVVE9fQ09OTkVDVCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1TZXJ2aWNlLmNvbm5lY3RJbnB1dERldmljZShtRGV2aWNlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICBjYXNlIFRSQU5TSVRJT05fVE9fU1RBQkxFOgpAQCAtMzQyLDYgKzM4MiwyMyBAQAogICAgICAgICAgICAgICAgICAgICAgICBkZWZlck1lc3NhZ2UoZGVmZXJNc2cpOwogICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgQ09OTkVDVF9ISURfT1VUR09JTkc6CisgICAgICAgICAgICAgICAgY2FzZSBESVNDT05ORUNUX0hJRF9PVVRHT0lORzoKKyAgICAgICAgICAgICAgICAgICAgZGVmZXJNZXNzYWdlKG1lc3NhZ2UpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIENPTk5FQ1RfSElEX0lOQ09NSU5HOgorICAgICAgICAgICAgICAgICAgICB0cmFuc2l0aW9uVG8obUluY29taW5nSGlkKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKG1TdGF0dXMpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGRlZmVyTXNnLndoYXQgPSBtQ29tbWFuZDsKKyAgICAgICAgICAgICAgICAgICAgICAgIGRlZmVyTWVzc2FnZShkZWZlck1zZyk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBESVNDT05ORUNUX0hJRF9JTkNPTUlORzoKKyAgICAgICAgICAgICAgICAgICAgaWYgKG1TdGF0dXMpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGRlZmVyTXNnLndoYXQgPSBtQ29tbWFuZDsKKyAgICAgICAgICAgICAgICAgICAgICAgIGRlZmVyTWVzc2FnZShkZWZlck1zZyk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7IC8vIGlnbm9yZQogICAgICAgICAgICAgICAgIGNhc2UgVU5QQUlSOgogICAgICAgICAgICAgICAgIGNhc2UgQVVUT19DT05ORUNUX1BST0ZJTEVTOgogICAgICAgICAgICAgICAgICAgICBkZWZlck1lc3NhZ2UobWVzc2FnZSk7CkBAIC00MDksNiArNDY2LDEzIEBACiAgICAgICAgICAgICAgICAgICAgIC8vIElmIHRoaXMgY2F1c2VzIGluY29taW5nIEhGUCB0byBmYWlsLCBpdCBpcyBtb3JlIG9mIGEgaGVhZHNldCBwcm9ibGVtCiAgICAgICAgICAgICAgICAgICAgIC8vIHNpbmNlIGJvdGggY29ubmVjdGlvbnMgYXJlIGluY29taW5nIG9uZXMuCiAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgQ09OTkVDVF9ISURfT1VUR09JTkc6CisgICAgICAgICAgICAgICAgY2FzZSBESVNDT05ORUNUX0hJRF9PVVRHT0lORzoKKyAgICAgICAgICAgICAgICAgICAgZGVmZXJNZXNzYWdlKG1lc3NhZ2UpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIENPTk5FQ1RfSElEX0lOQ09NSU5HOgorICAgICAgICAgICAgICAgIGNhc2UgRElTQ09OTkVDVF9ISURfSU5DT01JTkc6CisgICAgICAgICAgICAgICAgICAgICBicmVhazsgLy8gaWdub3JlCiAgICAgICAgICAgICAgICAgY2FzZSBVTlBBSVI6CiAgICAgICAgICAgICAgICAgY2FzZSBBVVRPX0NPTk5FQ1RfUFJPRklMRVM6CiAgICAgICAgICAgICAgICAgICAgIGRlZmVyTWVzc2FnZShtZXNzYWdlKTsKQEAgLTQ5Niw2ICs1NjAsMjMgQEAKICAgICAgICAgICAgICAgICBjYXNlIERJU0NPTk5FQ1RfQTJEUF9JTkNPTUlORzoKICAgICAgICAgICAgICAgICAgICAgLy8gSWdub3JlLCB3aWxsIGJlIGhhbmRsZWQgYnkgQmx1ZXoKICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBDT05ORUNUX0hJRF9PVVRHT0lORzoKKyAgICAgICAgICAgICAgICBjYXNlIERJU0NPTk5FQ1RfSElEX09VVEdPSU5HOgorICAgICAgICAgICAgICAgICAgICBkZWZlck1lc3NhZ2UobWVzc2FnZSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgQ09OTkVDVF9ISURfSU5DT01JTkc6CisgICAgICAgICAgICAgICAgICAgIHRyYW5zaXRpb25UbyhtSW5jb21pbmdIaWQpOworICAgICAgICAgICAgICAgICAgICBpZiAobVN0YXR1cykgeworICAgICAgICAgICAgICAgICAgICAgICAgZGVmZXJNc2cud2hhdCA9IG1Db21tYW5kOworICAgICAgICAgICAgICAgICAgICAgICAgZGVmZXJNZXNzYWdlKGRlZmVyTXNnKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIERJU0NPTk5FQ1RfSElEX0lOQ09NSU5HOgorICAgICAgICAgICAgICAgICAgICBpZiAobVN0YXR1cykgeworICAgICAgICAgICAgICAgICAgICAgICAgZGVmZXJNc2cud2hhdCA9IG1Db21tYW5kOworICAgICAgICAgICAgICAgICAgICAgICAgZGVmZXJNZXNzYWdlKGRlZmVyTXNnKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBicmVhazsgLy8gaWdub3JlCiAgICAgICAgICAgICAgICAgY2FzZSBVTlBBSVI6CiAgICAgICAgICAgICAgICAgY2FzZSBBVVRPX0NPTk5FQ1RfUFJPRklMRVM6CiAgICAgICAgICAgICAgICAgICAgIGRlZmVyTWVzc2FnZShtZXNzYWdlKTsKQEAgLTU2MSw2ICs2NDIsMTMgQEAKICAgICAgICAgICAgICAgICBjYXNlIERJU0NPTk5FQ1RfQTJEUF9JTkNPTUlORzoKICAgICAgICAgICAgICAgICAgICAgLy8gSWdub3JlLCB3aWxsIGJlIGhhbmRsZWQgYnkgQmx1ZXoKICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBDT05ORUNUX0hJRF9PVVRHT0lORzoKKyAgICAgICAgICAgICAgICBjYXNlIERJU0NPTk5FQ1RfSElEX09VVEdPSU5HOgorICAgICAgICAgICAgICAgICAgICBkZWZlck1lc3NhZ2UobWVzc2FnZSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgQ09OTkVDVF9ISURfSU5DT01JTkc6CisgICAgICAgICAgICAgICAgY2FzZSBESVNDT05ORUNUX0hJRF9JTkNPTUlORzoKKyAgICAgICAgICAgICAgICAgICAgIGJyZWFrOyAvLyBpZ25vcmUKICAgICAgICAgICAgICAgICBjYXNlIFVOUEFJUjoKICAgICAgICAgICAgICAgICBjYXNlIEFVVE9fQ09OTkVDVF9QUk9GSUxFUzoKICAgICAgICAgICAgICAgICAgICAgZGVmZXJNZXNzYWdlKG1lc3NhZ2UpOwpAQCAtNTc2LDYgKzY2NCwxNDMgQEAKICAgICB9CiAKIAorICAgIHByaXZhdGUgY2xhc3MgT3V0Z29pbmdIaWQgZXh0ZW5kcyBIaWVyYXJjaGljYWxTdGF0ZSB7CisgICAgICAgIHByaXZhdGUgYm9vbGVhbiBtU3RhdHVzID0gZmFsc2U7CisgICAgICAgIHByaXZhdGUgaW50IG1Db21tYW5kOworCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwcm90ZWN0ZWQgdm9pZCBlbnRlcigpIHsKKyAgICAgICAgICAgIGxvZygiRW50ZXJpbmcgT3V0Z29pbmdIaWQgc3RhdGUgd2l0aDogIiArIGdldEN1cnJlbnRNZXNzYWdlKCkud2hhdCk7CisgICAgICAgICAgICBtQ29tbWFuZCA9IGdldEN1cnJlbnRNZXNzYWdlKCkud2hhdDsKKyAgICAgICAgICAgIGlmIChtQ29tbWFuZCAhPSBDT05ORUNUX0hJRF9PVVRHT0lORyAmJgorICAgICAgICAgICAgICAgIG1Db21tYW5kICE9IERJU0NPTk5FQ1RfSElEX09VVEdPSU5HKSB7CisgICAgICAgICAgICAgICAgTG9nLmUoVEFHLCAiRXJyb3I6IE91dGdvaW5nSGlkIHN0YXRlIHdpdGggY29tbWFuZDoiICsgbUNvbW1hbmQpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgbVN0YXR1cyA9IHByb2Nlc3NDb21tYW5kKG1Db21tYW5kKTsKKyAgICAgICAgICAgIGlmICghbVN0YXR1cykgc2VuZE1lc3NhZ2UoVFJBTlNJVElPTl9UT19TVEFCTEUpOworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHByb3RlY3RlZCBib29sZWFuIHByb2Nlc3NNZXNzYWdlKE1lc3NhZ2UgbWVzc2FnZSkgeworICAgICAgICAgICAgbG9nKCJPdXRnb2luZ0hpZCBTdGF0ZS0+UHJvY2Vzc2luZyBNZXNzYWdlOiAiICsgbWVzc2FnZS53aGF0KTsKKyAgICAgICAgICAgIE1lc3NhZ2UgZGVmZXJNc2cgPSBuZXcgTWVzc2FnZSgpOworICAgICAgICAgICAgc3dpdGNoKG1lc3NhZ2Uud2hhdCkgeworICAgICAgICAgICAgICAgIC8vIGRlZmVyIGFsbCBvdXRnb2luZyBtZXNzYWdlcworICAgICAgICAgICAgICAgIGNhc2UgQ09OTkVDVF9IRlBfT1VUR09JTkc6CisgICAgICAgICAgICAgICAgY2FzZSBDT05ORUNUX0EyRFBfT1VUR09JTkc6CisgICAgICAgICAgICAgICAgY2FzZSBDT05ORUNUX0hJRF9PVVRHT0lORzoKKyAgICAgICAgICAgICAgICBjYXNlIERJU0NPTk5FQ1RfSEZQX09VVEdPSU5HOgorICAgICAgICAgICAgICAgIGNhc2UgRElTQ09OTkVDVF9BMkRQX09VVEdPSU5HOgorICAgICAgICAgICAgICAgIGNhc2UgRElTQ09OTkVDVF9ISURfT1VUR09JTkc6CisgICAgICAgICAgICAgICAgICAgIGRlZmVyTWVzc2FnZShtZXNzYWdlKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICAgICAgICBjYXNlIENPTk5FQ1RfSEZQX0lOQ09NSU5HOgorICAgICAgICAgICAgICAgICAgICB0cmFuc2l0aW9uVG8obUluY29taW5nSGFuZHNmcmVlKTsKKyAgICAgICAgICAgICAgICBjYXNlIENPTk5FQ1RfQTJEUF9JTkNPTUlORzoKKyAgICAgICAgICAgICAgICAgICAgdHJhbnNpdGlvblRvKG1JbmNvbWluZ0EyZHApOworCisgICAgICAgICAgICAgICAgICAgIC8vIERvbid0IGNhbmNlbCBISUQgb3V0Z29pbmcgYXMgdGhlcmUgaXMgbm8gZ3VhcmFudGVlIGl0CisgICAgICAgICAgICAgICAgICAgIC8vIHdpbGwgZ2V0IGNhbmNlbGVkLgorICAgICAgICAgICAgICAgICAgICAvLyBJdCBtaWdodCBhbHJlYWR5IGJlIGNvbm5lY3RlZCBidXQgd2UgbWlnaHQgbm90IGhhdmUgZ290IHRoZQorICAgICAgICAgICAgICAgICAgICAvLyBJTlBVVF9ERVZJQ0VfU1RBVEVfQ0hBTkdFLiBIZW5jZSwgbm8gcG9pbnQgZGlzY29ubmVjdGluZyBoZXJlLgorICAgICAgICAgICAgICAgICAgICAvLyBUaGUgd29yc3QgY2FzZSwgdGhlIGNvbm5lY3Rpb24gd2lsbCBmYWlsLCByZXRyeS4KKyAgICAgICAgICAgICAgICAgICAgaWYgKG1TdGF0dXMpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGRlZmVyTXNnLndoYXQgPSBtQ29tbWFuZDsKKyAgICAgICAgICAgICAgICAgICAgICAgIGRlZmVyTWVzc2FnZShkZWZlck1zZyk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBDT05ORUNUX0hJRF9JTkNPTUlORzoKKyAgICAgICAgICAgICAgICAgIC8vIEJsdWV6IHdpbGwgdGFrZSBjYXJlIG9mIHRoZSBjb25mbGljdHMKKyAgICAgICAgICAgICAgICAgICAgdHJhbnNpdGlvblRvKG1JbmNvbWluZ0hpZCk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICAgICAgY2FzZSBESVNDT05ORUNUX0hGUF9JTkNPTUlORzoKKyAgICAgICAgICAgICAgICBjYXNlIERJU0NPTk5FQ1RfQTJEUF9JTkNPTUlORzoKKyAgICAgICAgICAgICAgICAgICAgLy8gQXQgdGhpcyBwb2ludCwgd2UgYXJlIGFscmVhZHkgZGlzY29ubmVjdGVkCisgICAgICAgICAgICAgICAgICAgIC8vIHdpdGggSEZQLiBTb21ldGltZXMgSElEIGNvbm5lY3Rpb24gY2FuCisgICAgICAgICAgICAgICAgICAgIC8vIGZhaWwgZHVlIHRvIHRoZSBkaXNjb25uZWN0aW9uIG9mIEhGUC4gU28gYWRkIGEgcmV0cnkKKyAgICAgICAgICAgICAgICAgICAgLy8gZm9yIHRoZSBISUQuCisgICAgICAgICAgICAgICAgICAgIGlmIChtU3RhdHVzKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBkZWZlck1zZy53aGF0ID0gbUNvbW1hbmQ7CisgICAgICAgICAgICAgICAgICAgICAgICBkZWZlck1lc3NhZ2UoZGVmZXJNc2cpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgRElTQ09OTkVDVF9ISURfSU5DT01JTkc6CisgICAgICAgICAgICAgICAgICAgIC8vIElnbm9yZSwgd2lsbCBiZSBoYW5kbGVkIGJ5IEJsdWV6CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICAgICAgY2FzZSBVTlBBSVI6CisgICAgICAgICAgICAgICAgY2FzZSBBVVRPX0NPTk5FQ1RfUFJPRklMRVM6CisgICAgICAgICAgICAgICAgICAgIGRlZmVyTWVzc2FnZShtZXNzYWdlKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBUUkFOU0lUSU9OX1RPX1NUQUJMRToKKyAgICAgICAgICAgICAgICAgICAgdHJhbnNpdGlvblRvKG1Cb25kZWREZXZpY2UpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgICAgICByZXR1cm4gTk9UX0hBTkRMRUQ7CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gSEFORExFRDsKKyAgICAgICAgfQorICAgIH0KKworICBwcml2YXRlIGNsYXNzIEluY29taW5nSGlkIGV4dGVuZHMgSGllcmFyY2hpY2FsU3RhdGUgeworICAgICAgcHJpdmF0ZSBib29sZWFuIG1TdGF0dXMgPSBmYWxzZTsKKyAgICAgIHByaXZhdGUgaW50IG1Db21tYW5kOworCisgICAgICBAT3ZlcnJpZGUKKyAgICAgIHByb3RlY3RlZCB2b2lkIGVudGVyKCkgeworICAgICAgICAgIGxvZygiRW50ZXJpbmcgSW5jb21pbmdIaWQgc3RhdGUgd2l0aDogIiArIGdldEN1cnJlbnRNZXNzYWdlKCkud2hhdCk7CisgICAgICAgICAgbUNvbW1hbmQgPSBnZXRDdXJyZW50TWVzc2FnZSgpLndoYXQ7CisgICAgICAgICAgaWYgKG1Db21tYW5kICE9IENPTk5FQ1RfSElEX0lOQ09NSU5HICYmCisgICAgICAgICAgICAgIG1Db21tYW5kICE9IERJU0NPTk5FQ1RfSElEX0lOQ09NSU5HKSB7CisgICAgICAgICAgICAgIExvZy5lKFRBRywgIkVycm9yOiBJbmNvbWluZ0hpZCBzdGF0ZSB3aXRoIGNvbW1hbmQ6IiArIG1Db21tYW5kKTsKKyAgICAgICAgICB9CisgICAgICAgICAgbVN0YXR1cyA9IHByb2Nlc3NDb21tYW5kKG1Db21tYW5kKTsKKyAgICAgICAgICBpZiAoIW1TdGF0dXMpIHNlbmRNZXNzYWdlKFRSQU5TSVRJT05fVE9fU1RBQkxFKTsKKyAgICAgIH0KKworICAgICAgQE92ZXJyaWRlCisgICAgICBwcm90ZWN0ZWQgYm9vbGVhbiBwcm9jZXNzTWVzc2FnZShNZXNzYWdlIG1lc3NhZ2UpIHsKKyAgICAgICAgICBsb2coIkluY29taW5nSGlkIFN0YXRlLT5Qcm9jZXNzaW5nIE1lc3NhZ2U6ICIgKyBtZXNzYWdlLndoYXQpOworICAgICAgICAgIE1lc3NhZ2UgZGVmZXJNc2cgPSBuZXcgTWVzc2FnZSgpOworICAgICAgICAgIHN3aXRjaChtZXNzYWdlLndoYXQpIHsKKyAgICAgICAgICAgICAgY2FzZSBDT05ORUNUX0hGUF9PVVRHT0lORzoKKyAgICAgICAgICAgICAgY2FzZSBDT05ORUNUX0hGUF9JTkNPTUlORzoKKyAgICAgICAgICAgICAgY2FzZSBESVNDT05ORUNUX0hGUF9PVVRHT0lORzoKKyAgICAgICAgICAgICAgY2FzZSBDT05ORUNUX0EyRFBfSU5DT01JTkc6CisgICAgICAgICAgICAgIGNhc2UgQ09OTkVDVF9BMkRQX09VVEdPSU5HOgorICAgICAgICAgICAgICBjYXNlIERJU0NPTk5FQ1RfQTJEUF9PVVRHT0lORzoKKyAgICAgICAgICAgICAgY2FzZSBDT05ORUNUX0hJRF9PVVRHT0lORzoKKyAgICAgICAgICAgICAgY2FzZSBDT05ORUNUX0hJRF9JTkNPTUlORzoKKyAgICAgICAgICAgICAgY2FzZSBESVNDT05ORUNUX0hJRF9PVVRHT0lORzoKKyAgICAgICAgICAgICAgICAgIGRlZmVyTWVzc2FnZShtZXNzYWdlKTsKKyAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICBjYXNlIERJU0NPTk5FQ1RfSEZQX0lOQ09NSU5HOgorICAgICAgICAgICAgICAgICAgLy8gU2hvdWxkbid0IGhhcHBlbiBidXQgaWYgZG9lcywgd2UgY2FuIGhhbmRsZSBpdC4KKyAgICAgICAgICAgICAgICAgIC8vIERlcGVuZHMgaWYgdGhlIGhlYWRzZXQgY2FuIGhhbmRsZSBpdC4KKyAgICAgICAgICAgICAgICAgIC8vIEluY29taW5nIEhJRCB3aWxsIGJlIGhhbmRsZWQgYnkgQmx1ZXosIERpc2Nvbm5lY3QgSEZQCisgICAgICAgICAgICAgICAgICAvLyB0aGUgc29ja2V0IHdvdWxkIGhhdmUgYWxyZWFkeSBiZWVuIGNsb3NlZC4KKyAgICAgICAgICAgICAgICAgIC8vIGlnbm9yZQorICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgIGNhc2UgRElTQ09OTkVDVF9ISURfSU5DT01JTkc6CisgICAgICAgICAgICAgIGNhc2UgRElTQ09OTkVDVF9BMkRQX0lOQ09NSU5HOgorICAgICAgICAgICAgICAgICAgLy8gSWdub3JlLCB3aWxsIGJlIGhhbmRsZWQgYnkgQmx1ZXoKKyAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICBjYXNlIFVOUEFJUjoKKyAgICAgICAgICAgICAgY2FzZSBBVVRPX0NPTk5FQ1RfUFJPRklMRVM6CisgICAgICAgICAgICAgICAgICBkZWZlck1lc3NhZ2UobWVzc2FnZSk7CisgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgY2FzZSBUUkFOU0lUSU9OX1RPX1NUQUJMRToKKyAgICAgICAgICAgICAgICAgIHRyYW5zaXRpb25UbyhtQm9uZGVkRGV2aWNlKTsKKyAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgICAgcmV0dXJuIE5PVF9IQU5ETEVEOworICAgICAgICAgIH0KKyAgICAgICAgICByZXR1cm4gSEFORExFRDsKKyAgICAgIH0KKyAgfQorCiAKICAgICBzeW5jaHJvbml6ZWQgdm9pZCBjYW5jZWxDb21tYW5kKGludCBjb21tYW5kKSB7CiAgICAgICAgIGlmIChjb21tYW5kID09IENPTk5FQ1RfSEZQX09VVEdPSU5HICkgewpAQCAtNjE5LDYgKzg0NCwxMCBAQAogICAgICAgICAgICAgY2FzZSBDT05ORUNUX0EyRFBfSU5DT01JTkc6CiAgICAgICAgICAgICAgICAgLy8gaWdub3JlLCBCbHVleiB0YWtlcyBjYXJlCiAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICBjYXNlIENPTk5FQ1RfSElEX09VVEdPSU5HOgorICAgICAgICAgICAgICAgIHJldHVybiBtU2VydmljZS5jb25uZWN0SW5wdXREZXZpY2VJbnRlcm5hbChtRGV2aWNlKTsKKyAgICAgICAgICAgIGNhc2UgQ09OTkVDVF9ISURfSU5DT01JTkc6CisgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICAgICBjYXNlIERJU0NPTk5FQ1RfSEZQX09VVEdPSU5HOgogICAgICAgICAgICAgICAgIGlmICghbUhlYWRzZXRTZXJ2aWNlQ29ubmVjdGVkKSB7CiAgICAgICAgICAgICAgICAgICAgIGRlZmVySGVhZHNldE1lc3NhZ2UoY29tbWFuZCk7CkBAIC02NDUsNiArODc0LDE1IEBACiAgICAgICAgICAgICAgICAgICAgIHJldHVybiBtQTJkcFNlcnZpY2UuZGlzY29ubmVjdFNpbmtJbnRlcm5hbChtRGV2aWNlKTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIERJU0NPTk5FQ1RfSElEX0lOQ09NSU5HOgorICAgICAgICAgICAgICAgIC8vIGlnbm9yZQorICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICAgICAgY2FzZSBESVNDT05ORUNUX0hJRF9PVVRHT0lORzoKKyAgICAgICAgICAgICAgICBpZiAobVNlcnZpY2UuZ2V0SW5wdXREZXZpY2VQcmlvcml0eShtRGV2aWNlKSA9PQorICAgICAgICAgICAgICAgICAgICBCbHVldG9vdGhJbnB1dERldmljZS5QUklPUklUWV9BVVRPX0NPTk5FQ1QpIHsKKyAgICAgICAgICAgICAgICAgICAgbVNlcnZpY2Uuc2V0SW5wdXREZXZpY2VQcmlvcml0eShtRGV2aWNlLCBCbHVldG9vdGhJbnB1dERldmljZS5QUklPUklUWV9PTik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHJldHVybiBtU2VydmljZS5kaXNjb25uZWN0SW5wdXREZXZpY2VJbnR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hBTkdFRF9BQ1RJT04gdG8gZmluZCBvdXQgd2hlbiB0aGUKKyAgICAgKiAgY29ubmVjdGlvbiBpcyBjb21wbGV0ZWQuCisgICAgICogIEBwYXJhbSBkZXZpY2UgUmVtb3RlIEJUIGRldmljZS4KKyAgICAgKiAgQHJldHVybiBmYWxzZSBvbiBpbW1lZGlhdGUgZXJyb3IsIHRydWUgb3RoZXJ3aXNlCisgICAgICogIEBoaWRlCisgICAgICovCisgICAgcHVibGljIGJvb2xlYW4gY29ubmVjdElucHV0RGV2aWNlKEJsdWV0b290aERldmljZSBkZXZpY2UpIHsKKyAgICAgICAgaWYgKERCRykgbG9nKCJjb25uZWN0SW5wdXREZXZpY2UoIiArIGRldmljZSArICIpIik7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICByZXR1cm4gbVNlcnZpY2UuY29ubmVjdElucHV0RGV2aWNlKGRldmljZSk7CisgICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICBMb2cuZShUQUcsICIiLCBlKTsKKyAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKiBJbml0aWF0ZSBkaXNjb25uZWN0IGZyb20gYW4gSW5wdXQgRGV2aWNlLgorICAgICAqICBUaGlzIGZ1bmN0aW9uIHJldHVybiBmYWxzZSBvbiBlcnJvciBhbmQgdHJ1ZSBpZiB0aGUgZGlzY29ubmVjdGlvbgorICAgICAqICBhdHRlbXB0IGlzIGJlaW5nIG1hZGUuCisgICAgICoKKyAgICAgKiAgTGlzdGVuIGZvciBJTlBVVF9ERVZJQ0VfU1RBVEVfQ0hBTkdFRF9BQ1RJT04gdG8gZmluZCBvdXQgd2hlbgorICAgICAqICBkaXNjb25uZWN0IGlzIGNvbXBsZXRlZC4KKyAgICAgKgorICAgICAqICBAcGFyYW0gZGV2aWNlIFJlbW90ZSBCVCBkZXZpY2UuCisgICAgICogIEByZXR1cm4gZmFsc2Ugb24gaW1tZWRpYXRlIGVycm9yLCB0cnVlIG90aGVyd2lzZQorICAgICAqICBAaGlkZQorICAgICAqLworICAgIHB1YmxpYyBib29sZWFuIGRpc2Nvbm5lY3RJbnB1dERldmljZShCbHVldG9vdGhEZXZpY2UgZGV2aWNlKSB7CisgICAgICAgIGlmIChEQkcpIGxvZygiZGlzY29ubmVjdElucHV0RGV2aWNlKCIgKyBkZXZpY2UgKyAiKSIpOworICAgICAgICB0cnkgeworICAgICAgICAgICAgcmV0dXJuIG1TZXJ2aWNlLmRpc2Nvbm5lY3RJbnB1dERldmljZShkZXZpY2UpOworICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgTG9nLmUoVEFHLCAiIiwgZSk7CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKiogQ2hlY2sgaWYgYSBzcGVjaWZpZWQgSW5wdXREZXZpY2UgaXMgY29ubmVjdGVkLgorICAgICAqCisgICAgICogIEBwYXJhbSBkZXZpY2UgUmVtb3RlIEJUIGRldmljZS4KKyAgICAgKiAgQHJldHVybiBUcnVlIGlmIGNvbm5lY3RlZCAsIGZhbHNlIG90aGVyd2lzZSBhbmQgb24gZXJyb3IuCisgICAgICogIEBoaWRlCisgICAgICovCisgICAgcHVibGljIGJvb2xlYW4gaXNJbnB1dERldmljZUNvbm5lY3RlZChCbHVldG9vdGhEZXZpY2UgZGV2aWNlKSB7CisgICAgICAgIGlmIChEQkcpIGxvZygiaXNJbnB1dERldmljZUNvbm5lY3RlZCgiICsgZGV2aWNlICsgIikiKTsKKyAgICAgICAgaW50IHN0YXRlID0gZ2V0SW5wdXREZXZpY2VTdGF0ZShkZXZpY2UpOworICAgICAgICBpZiAoc3RhdGUgPT0gU1RBVEVfQ09OTkVDVEVEKSByZXR1cm4gdHJ1ZTsKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIC8qKiBDaGVjayBpZiBhbnkgSW5wdXQgRGV2aWNlIGlzIGNvbm5lY3RlZC4KKyAgICAgKgorICAgICAqIEByZXR1cm4gYSB1bm1vZGlmaWFibGUgc2V0IG9mIGNvbm5lY3RlZCBJbnB1dCBEZXZpY2VzLCBvciBudWxsIG9uIGVycm9yLgorICAgICAqIEBoaWRlCisgICAgICovCisgICAgcHVibGljIFNldDxCbHVldG9vdGhEZXZpY2U+IGdldENvbm5lY3RlZElucHV0RGV2aWNlcygpIHsKKyAgICAgICAgaWYgKERCRykgbG9nKCJnZXRDb25uZWN0ZWRJbnB1dERldmljZXMoKSIpOworICAgICAgICB0cnkgeworICAgICAgICAgICAgcmV0dXJuIENvbGxlY3Rpb25zLnVubW9kaWZpYWJsZVNldCgKKyAgICAgICAgICAgICAgICAgICAgbmV3IEhhc2hTZXQ8Qmx1ZXRvb3RoRGV2aWNlPigKKyAgICAgICAgICAgICAgICAgICAgICAgIEFycmF5cy5hc0xpc3QobVNlcnZpY2UuZ2V0Q29ubmVjdGVkSW5wdXREZXZpY2VzKCkpKSk7CisgICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICBMb2cuZShUQUcsICIiLCBlKTsKKyAgICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqIEdldCB0aGUgc3RhdGUgb2YgYW4gSW5wdXQgRGV2aWNlLgorICAgICAqCisgICAgICogIEBwYXJhbSBkZXZpY2UgUmVtb3RlIEJUIGRldmljZS4KKyAgICAgKiAgQHJldHVybiBUaGUgY3VycmVudCBzdGF0ZSBvZiB0aGUgSW5wdXQgRGV2aWNlCisgICAgICogIEBoaWRlCisgICAgICovCisgICAgcHVibGljIGludCBnZXRJbnB1dERldmljZVN0YXRlKEJsdWV0b290aERldmljZSBkZXZpY2UpIHsKKyAgICAgICAgaWYgKERCRykgbG9nKCJnZXRJbnB1dERldmljZVN0YXRlKCIgKyBkZXZpY2UgKyAiKSIpOworICAgICAgICB0cnkgeworICAgICAgICAgICAgcmV0dXJuIG1TZXJ2aWNlLmdldElucHV0RGV2aWNlU3RhdGUoZGV2aWNlKTsKKyAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgIExvZy5lKFRBRywgIiIsIGUpOworICAgICAgICAgICAgcmV0dXJuIFNUQVRFX0RJU0NPTk5FQ1RFRDsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIFNldCBwcmlvcml0eSBvZiBhbiBpbnB1dCBkZXZpY2UuCisgICAgICoKKyAgICAgKiBQcmlvcml0eSBpcyBhIG5vbi1uZWdhdGl2ZSBpbnRlZ2VyLiBQcmlvcml0eSBjYW4gdGFrZSB0aGUgZm9sbG93aW5nCisgICAgICogdmFsdWVzOgorICAgICAqIHtAbGluayBQUklPUklUWV9PTn0sIHtAbGluayBQUklPUklUWV9PRkZ9LCB7QGxpbmsgUFJJT1JJVFlfQVVUT19DT05ORUNUfQorICAgICAqCisgICAgICogQHBhcmFtIGRldmljZSBQYWlyZWQgZGV2aWNlLgorICAgICAqIEBwYXJhbSBwcmlvcml0eSBJbnRlZ2VyIHByaW9yaXR5CisgICAgICogQHJldHVybiB0cnVlIGlmIHByaW9yaXR5IGlzIHNldCwgZmFsc2Ugb24gZXJyb3IKKyAgICAgKi8KKyAgICBwdWJsaWMgYm9vbGVhbiBzZXRJbnB1dERldmljZVByaW9yaXR5KEJsdWV0b290aERldmljZSBkZXZpY2UsIGludCBwcmlvcml0eSkgeworICAgICAgICBpZiAoREJHKSBsb2coInNldElucHV0RGV2aWNlUHJpb3JpdHkoIiArIGRldmljZSArICIsICIgKyBwcmlvcml0eSArICIpIik7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICByZXR1cm4gbVNlcnZpY2Uuc2V0SW5wdXREZXZpY2VQcmlvcml0eShkZXZpY2UsIHByaW9yaXR5KTsKKyAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgIExvZy5lKFRBRywgIiIsIGUpOworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogR2V0IHRoZSBwcmlvcml0eSBhc3NvY2lhdGVkIHdpdGggYW4gSW5wdXQgRGV2aWNlLgorICAgICAqCisgICAgICogQHBhcmFtIGRldmljZSBJbnB1dCBEZXZpY2UKKyAgICAgKiBAcmV0dXJuIG5vbi1uZWdhdGl2ZSBwcmlvcml0eSwgb3IgbmVnYXRpdmUgZXJyb3IgY29kZSBvbiBlcnJvci4KKyAgICAgKi8KKyAgICBwdWJsaWMgaW50IGdldElucHV0RGV2aWNlUHJpb3JpdHkoQmx1ZXRvb3RoRGV2aWNlIGRldmljZSkgeworICAgICAgICBpZiAoREJHKSBsb2coImdldElucHV0RGV2aWNlUHJpb3JpdHkoIiArIGRldmljZSArICIpIik7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICByZXR1cm4gbVNlcnZpY2UuZ2V0SW5wdXREZXZpY2VQcmlvcml0eShkZXZpY2UpOworICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgTG9nLmUoVEFHLCAiIiwgZSk7CisgICAgICAgICAgICByZXR1cm4gUFJJT1JJVFlfT0ZGOworICAgICAgICB9CisgICAgfQorCisgICAgcHJpdmF0ZSBzdGF0aWMgdm9pZCBsb2coU3RyaW5nIG1zZykgeworICAgICAgICBMb2cuZChUQUcsIG1zZyk7CisgICAgfQorfQpkaWZmIC0tZ2l0IGEvY29yZS9qYXZhL2FuZHJvaWQvYmx1ZXRvb3RoL0JsdWV0b290aFBhbi5qYXZhIGIvY29yZS9qYXZhL2FuZHJvaWQvYmx1ZXRvb3RoL0JsdWV0b290aFBhbi5qYXZhCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLjk1Mjc2NWQKLS0tI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50ZXJhY3Rpbmcgd2l0aCB0aGUgbG9jYWwKKyAgICAgKiBCbHVldG9vdGggUGFuIHNlcnZpY2UuCisgICAgICogQHBhcmFtIGMgQ29udGV4dAorICAgICAqLworICAgIHB1YmxpYyBCbHVldG9vdGhQYW4oQ29udGV4dCBjKSB7CisgICAgICAgIG1Db250ZXh0ID0gYzsKKworICAgICAgICBJQmluZGVyIGIgPSBTZXJ2aWNlTWFuYWdlci5nZXRTZXJ2aWNlKEJsdWV0b290aEFkYXB0ZXIuQkxVRVRPT1RIX1NFUlZJQ0UpOworICAgICAgICBpZiAoYiAhPSBudWxsKSB7CisgICAgICAgICAgICBtU2VydmljZSA9IElCbHVldG9vdGguU3R1Yi5hc0ludGVyZmFjZShiKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIExvZy53KFRBRywgIkJsdWV0b290aCBTZXJ2aWNlIG5vdCBhdmFpbGFibGUhIik7CisKKyAgICAgICAgICAgIC8vIEluc3RlYWQgb2YgdGhyb3dpbmcgYW4gZXhjZXB0aW9uIHdoaWNoIHByZXZlbnRzIHBlb3BsZSBmcm9tIGdvaW5nCisgICAgICAgICAgICAvLyBpbnRvIFdpcmVsZXNzIHNldHRpbmdzIGluIHRoZSBlbXVsYXRvci4gTGV0IGl0IGNyYXNoIGxhdGVyCisgICAgICAgICAgICAvLyB3aGVuIGl0IGlzIGFjdHVhbGx5IHVzZWQuCisgICAgICAgICAgICBtU2VydmljZSA9IG51bGw7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBJbml0aWF0ZSBhIFBBTiBjb25uZWN0aW9uLgorICAgICAqCisgICAgICogVGhpcyBmdW5jdGlvbiByZXR1cm5zIGZhbHNlIG9uIGVycm9yIGFuZCB0cnVlIGlmIHRoZSBjb25uZWN0aW9uCisgICAgICogYXR0ZW1wdCBpcyBiZWluZyBtYWRlLgorICAgICAqCisgICAgICogTGlzdGVuIGZvciB7QGxpbmsgI0FDVElPTl9QQU5fU1RBVEVfQ0hBTkdFRH0gdG8gZmluZCBvdXQgd2hlbiB0aGUKKyAgICAgKiBjb25uZWN0aW9uIGlzIGNvbXBsZXRlZC4KKyAgICAgKgorICAgICAqIEBwYXJhbSBkZXZpY2UgUmVtb3RlIEJUIGRldmljZS4KKyAgICAgKiBAcmV0dXJuIGZhbHNlIG9uIGltbWVkaWF0ZSBlcnJvciwgdHJ1ZSBvdGhlcndpc2UKKyAgICAgKiBAaGlkZQorICAgICAqLworICAgIHB1YmxpYyBib29sZWFuIGNvbm5lY3QoQmx1ZXRvb3RoRGV2aWNlIGRldmljZSkgeworICAgICAgICBpZiAoREJHKSBsb2coImNvbm5lY3QoIiArIGRldmljZSArICIpIik7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICByZXR1cm4gbVNlcnZpY2UuY29ubmVjdFBhbkRldmljZShkZXZpY2UpOworICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgTG9nLmUoVEFHLCAiIiwgZSk7CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBJbml0aWF0ZSBkaXNjb25uZWN0IGZyb20gUEFOLgorICAgICAqCisgICAgICogVGhpcyBmdW5jdGlvbiByZXR1cm4gZmFsc2Ugb24gZXJyb3IgYW5kIHRydWUgaWYgdGhlIGRpc2Nvbm5lY3Rpb24KKyAgICAgKiBhdHRlbXB0IGlzIGJlaW5nIG1hZGUuCisgICAgICoKKyAgICAgKiBMaXN0ZW4gZm9yIHtAbGluayAjQUNUSU9OX1BBTl9TVEFURV9DSEFOR0VEfSB0byBmaW5kIG91dCB3aGVuCisgICAgICogZGlzY29ubmVjdCBpcyBjb21wbGV0ZWQuCisgICAgICoKKyAgICAgKiBAcGFyYW0gZGV2aWNlIFJlbW90ZSBCVCBkZXZpY2UuCisgICAgICogQHJldHVybiBmYWxzZSBvbiBpbW1lZGlhdGUgZXJyb3IsIHRydWUgb3RoZXJ3aXNlCisgICAgICogQGhpZGUKKyAgICAgKi8KKyAgICBwdWJsaWMgYm9vbGVhbiBkaXNjb25uZWN0KEJsdWV0b290aERldmljZSBkZXZpY2UpIHsKKyAgICAgICAgaWYgKERCRykgbG9nKCJkaXNjb25uZWN0KCIgKyBkZXZpY2UgKyAiKSIpOworICAgICAgICB0cnkgeworICAgICAgICAgICAgcmV0dXJuIG1TZXJ2aWNlLmRpc2Nvbm5lY3RQYW5EZXZpY2UoZGV2aWNlKTsKKyAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgIExvZy5lKFRBRywgIiIsIGUpOworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqIEdldCB0aGUgc3RhdGUgb2YgYSBQQU4gRGV2aWNlLgorICAgICoKKyAgICAqIFRoaXMgZnVuY3Rpb24gcmV0dXJucyBhbiBpbnQgcmVwcmVzZW50aW5nIHRoZSBzdGF0ZSBvZiB0aGUgUEFOIGNvbm5lY3Rpb24KKyAgICAqCisgICAgKiAgQHBhcmFtIGRldmljZSBSZW1vdGUgQlQgZGV2aWNlLgorICAgICogIEByZXR1cm4gVGhlIGN1cnJlbnQgc3RhdGUgb2YgdGhlIFBBTiBEZXZpY2UKKyAgICAqICBAaGlkZQorICAgICovCisgICBwdWJsaWMgaW50IGdldFBhbkRldmljZVN0YXRlKEJsdWV0b290aERldmljZSBkZXZpY2UpIHsKKyAgICAgICBpZiAoREJHKSBsb2coImdldFBhbkRldmljZVN0YXRlKCIgKyBkZXZpY2UgKyAiKSIpOworICAgICAgIHRyeSB7CisgICAgICAgICAgIHJldHVybiBtU2VydmljZS5nZXRQYW5EZXZpY2VTdGF0ZShkZXZpY2UpOworICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgIExvZy5lKFRBRywgIiIsIGUpOworICAgICAgICAgICByZXR1cm4gU1RBVEVfRElTQ09OTkVDVEVEOworICAgICAgIH0KKyAgIH0KKworICAgLyoqIFJldHVybnMgYSBzZXQgb2YgYWxsIHRoZSBjb25uZWN0ZWQgUEFOIERldmljZXMKKyAgICoKKyAgICogRG9lcyBub3QgaW5jbHVkZSBkZXZpY2VzIHRoYXQgYXJlIGN1cnJlbnRseSBjb25uZWN0aW5nIG9yIGRpc2Nvbm5lY3RpbmcKKyAgICoKKyAgICogQHJldHVybiBhIHVubW9kaWZpYWJsZSBzZXQgb2YgY29ubmVjdGVkIFBBTiBEZXZpY2VzLCBvciBudWxsIG9uIGVycm9yLgorICAgKiBAaGlkZQorICAgKi8KKyAgIHB1YmxpYyBTZXQ8Qmx1ZXRvb3RoRGV2aWNlPiBnZXRDb25uZWN0ZWREZXZpY2VzKCkgeworICAgICAgaWYgKERCRykgbG9nKCJnZXRDb25uZWN0ZWREZXZpY2VzIik7CisgICAgICB0cnkgeworICAgICAgICAgIHJldHVybiBDb2xsZWN0aW9ucy51bm1vZGlmaWFibGVTZXQoCisgICAgICAgICAgICAgICAgICBuZXcgSGFzaFNldDxCbHVldG9vdGhEZXZpY2U+KAorICAgICAgICAgICAgICAgICAgICAgIEFycmF5cy5hc0xpc3QobVNlcnZpY2UuZ2V0Q29ubmVjdGVkUGFuRGV2aWNlcygpKSkpOworICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICBMb2cuZShUQUcsICIiLCBlKTsKKyAgICAgICAgICByZXR1cm4gbnVsbDsKKyAgICAgIH0KKyAgIH0KKworICAgIHByaXZhdGUgc3RhdGljIHZvaWQgbG9nKFN0cmluZyBtc2cpIHsKKyAgICAgICAgTG9nLmQoVEFHLCBtc2cpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHNldEJsdWV0b290aFRldGhlcmluZyhib29sZWFuIHZhbHVlLCBTdHJpbmcgdXVpZCwgU3RyaW5nIGJyaWRnZSkgeworICAgICAgIC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pYyBzdGF0aWMgaW50IEhGUCA9IDA7Ci0gICAgcHVibGljIHN0YXRpYyBpbnQgQTJEUCA9IDE7CisgICAgcHVibGljIHN0YXRpYyBmaW5hbCBpbnQgSEZQID0gMDsKKyAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGludCBBMkRQID0gMTsKKyAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGludCBISUQgPSAyOwogCiAgICAgcHJpdmF0ZSBzdGF0aWMgaW50IFRSQU5TSVRJT05fVE9fU1RBQkxFID0gMTAwOwogCkBAIC03MCw2ICs3MSwxMiBAQAogICAgICAgICAgICAgICAgICAgICBuZXdTdGF0ZSA9PSBCbHVldG9vdGhBMmRwLlNUQVRFX0RJU0NPTk5FQ1RFRCkpIHsKICAgICAgICAgICAgICAgICAgICAgc2VuZE1lc3NhZ2UoVFJBTlNJVElPTl9UT19TVEFCTEUpOwogICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0gZWxzZSBpZiAoYWN0aW9uLmVxdWFscyhCbHVldG9vdGhJbnB1dERldmljZS5BQ1RJT05fSU5QVVRfREVWSUNFX1NUQVRFX0NIQU5HRUQpKSB7CisgICAgICAgICAgICAgICAgaW50IG5ld1N0YXRlID0gaW50ZW50LmdldEludEV4dHJhKEJsdWV0b290aElucHV0RGV2aWNlLkVYVFJBX0lOUFVUX0RFVklDRV9TVEFURSwgMCk7CisgICAgICAgICAgICAgICAgaWYgKG1Qcm9maWxlID09IEhJRCAmJiAobmV3U3RhdGUgPT0gQmx1ZXRvb3RoSW5wdXREZXZpY2UuU1RBVEVfQ09OTkVDVEVEIHx8CisgICAgICAgICAgICAgICAgICAgIG5ld1N0YXRlID09IEJsdWV0b290aElucHV0RGV2aWNlLlNUQVRFX0RJU0NPTk5FQ1RFRCkpIHsKKyAgICAgICAgICAgICAgICAgICAgc2VuZE1lc3NhZ2UoVFJBTlNJVElPTl9UT19TVEFCTEUpOworICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KICA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UoKTsKLSAgICAgICAgfQotICAgIH0KLSAgICBwcml2YXRlIG5hdGl2ZSB2b2lkIGRlc3Ryb3lOYXRpdmUoKTsKLQotICAgIC8qKiBDb25uZWN0IHRoaXMgU0NPIHNvY2tldCB0byB0aGUgZ2l2ZW4gQlQgYWRkcmVzcy4KLSAgICAgKiAgRG9lcyBub3QgYmxvY2suCi0gICAgICovCi0gICAgcHVibGljIHN5bmNocm9uaXplZCBib29sZWFuIGNvbm5lY3QoU3RyaW5nIGFkZHJlc3MsIFN0cmluZyBuYW1lKSB7Ci0gICAgICAgIGlmIChEQkcpIGxvZygiY29ubmVjdCgpICIgKyB0aGlzKTsKLSAgICAgICAgaWYgKG1TdGF0ZSAhPSBTVEFURV9SRUFEWSkgewotICAgICAgICAgICAgaWYgKERCRykgbG9nKCJjb25uZWN0KCk6IEJhZCBzdGF0ZSIpOwotICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwotICAgICAgICB9Ci0gICAgICAgIGFjcXVpcmVXYWtlTG9jaygpOwotICAgICAgICBpZiAoY29ubmVjdE5hdGl2ZShhZGRyZXNzLCBuYW1lKSkgewotICAgICAgICAgICAgbVN0YXRlID0gU1RBVEVfQ09OTkVDVElORzsKLSAgICAgICAgICAgIHJldHVybiB0cnVlOwotICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgbVN0YXRlID0gU1RBVEVfQ0xPU0VEOwotICAgICAgICAgICAgcmVsZWFzZVdha2VMb2NrTm93KCk7Ci0gICAgICAgICAgICByZXR1cm4gZmFsc2U7Ci0gICAgICAgIH0KLSAgICB9Ci0gICAgcHJpdmF0ZSBuYXRpdmUgYm9vbGVhbiBjb25uZWN0TmF0aXZlKFN0cmluZyBhZGRyZXNzLCBTdHJpbmcgbmFtZSk7Ci0KLSAgICAvKiogQWNjZXB0IGluY29taW5nIFNDTyBjb25uZWN0aW9ucy4KLSAgICAgKiAgRG9lcyBub3QgYmxvY2suCi0gICAgICovCi0gICAgcHVibGljIHN5bmNocm9uaXpl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rTG9hZGVyPEQ+IGV4dGVuZHMgTG9hZGVyPEQ+IHsKKyAgICBmaW5hbCBjbGFzcyBMb2FkVGFzayBleHRlbmRzIEFzeW5jVGFzazxWb2lkLCBWb2lkLCBEPiB7CisKKyAgICAgICAgcHJpdmF0ZSBEIHJlc3VsdDsKKworICAgICAgICAvKiBSdW5zIG9uIGEgd29ya2VyIHRocmVhZCAqLworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHJvdGVjdGVkIEQgZG9JbkJhY2tncm91bmQoVm9pZC4uLiBwYXJhbXMpIHsKKyAgICAgICAgICAgIHJlc3VsdCA9IEFzeW5jVGFza0xvYWRlci50aGlzLmxvYWRJbkJhY2tncm91bmQoKTsKKyAgICAgICAgICAgIHJldHVybiByZXN1bHQ7CisgICAgICAgIH0KKworICAgICAgICAvKiBSdW5zIG9uIHRoZSBVSSB0aHJlYWQgKi8KKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHByb3RlY3RlZCB2b2lkIG9uUG9zdEV4ZWN1dGUoRCBkYXRhKSB7CisgICAgICAgICAgICBBc3luY1Rhc2tMb2FkZXIudGhpcy5kaXNwYXRjaE9uTG9hZENvbXBsZXRlKGRhdGEpOworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHByb3RlY3RlZCB2b2lkIG9uQ2FuY2VsbGVkKCkgeworICAgICAgICAgICAgQXN5bmNUYXNrTG9hZGVyLnRoaXMub25DYW5jZWxsZWQocmVzdWx0KTsKKyAgICAgICAgfQorICAgIH0KKworICAgIExvYWRUYXNrIG1UYXNrOworCisgICAgcHVibGljIEFzeW5jVGFza0xvYWRlcihDb250ZXh0IGNvbnRleHQpIHsKKyAgICAgICAgc3VwZXIoY29udGV4dCk7CisgICAgfQorCisgICAgLyoqCisgICAgICogRm9yY2UgYW4gYXN5bmNocm9ub3VzIGxvYWQuIFVubGlrZSB7QGxpbmsgI3N0YXJ0TG9hZGluZygpfSB0aGlzIHdpbGwgaWdub3JlIGEgcHJldmlvdXNseQorICAgICAqIGxvYWRlZCBkYXRhIHNldCBhbmQgbG9hZCBhIG5ldyBvbmUuCisgICAgICovCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgZm9yY2VMb2FkKCkgeworICAgICAgICBjYW5jZWxMb2FkKCk7CisgICAgICAgIG1UYXNrID0gbmV3IExvYWRUYXNrKCk7CisgICAgICAgIG1UYXNrLmV4ZWN1dGUoKFZvaWRbXSkgbnVsbCk7CisgICAgfQorCisgICAgLyoqCisgICAgICogQXR0ZW1wdCB0byBjYW5jZWwgdGhlIGN1cnJlbnQgbG9hZCB0YXNrLiBTZWUge0BsaW5rIEFzeW5jVGFzayNjYW5jZWwoYm9vbGVhbil9CisgICAgICogZm9yIG1vcmUgaW5mby4KKyAgICAgKgorICAgICAqIEByZXR1cm4gPHR0PmZhbHNlPC90dD4gaWYgdGhlIHRhc2sgY291bGQgbm90IGJlIGNhbmNlbGVkLAorICAgICAqICAgICAgICAgdHlwaWNhbGx5IGJlY2F1c2UgaXQgaGFzIGFscmVhZHkgY29tcGxldGVkIG5vcm1hbGx5LCBvcgorICAgICAqICAgICAgICAgYmVjYXVzZSB7QGxpbmsgI3N0YXJ0TG9hZGluZygpfSBoYXNuJ3QgYmVlbiBjYWxsZWQsIGFuZAorICAgICAqICAgICAgICAgPHR0PnRydWU8L3R0PiBvdGhlcndpc2UKKyAgICAgKi8KKyAgICBwdWJsaWMgYm9vbGVhbiBjYW5jZWxMb2FkKCkgeworICAgICAgICBpZiAobVRhc2sgIT0gbnVsbCkgeworICAgICAgICAgICAgYm9vbGVhbiBjYW5jZWxsZWQgPSBtVGFzay5jYW5jZWwoZmFsc2UpOworICAgICAgICAgICAgbVRhc2sgPSBudWxsOworICAgICAgICAgICAgcmV0dXJuIGNhbmNlbGxlZDsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgLyoqCisgICAgICogQ2FsbGVkIGlmIHRoZSB0YX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bGVyID0gbmV3IEhhbmRsZXIoKSB7CisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgdm9pZCBoYW5kbGVNZXNzYWdlKE1lc3NhZ2UgbXNnKSB7CisgICAgICAgICAgICBzd2l0Y2ggKG1zZy53aGF0KSB7CisgICAgICAgICAgICAgICAgY2FzZSBNU0dfUkVQT1JUX1BSSU1BUllfQ0xJUF9DSEFOR0VEOgorICAgICAgICAgICAgICAgICAgICByZXBvcnRQcmltYXJ5Q2xpcENoYW5nZWQoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH07CisKKyAgICBwdWJsaWMgaW50ZXJmYWNlIE9uUHJpbWFyeUNsaXBDaGFuZ2VkTGlzdGVuZXIgeworICAgICAgICB2b2lkIG9uUHJpbWFyeUNsaXBDaGFuZ2VkKCk7CisgICAgfQorCisgICAgc3RhdGljIHByaXZhdGUgSUNsaXBib2FyZCBnZXRTZXJ2aWNlKCkgeworICAgICAgICBzeW5jaHJvbml6ZWQgKHNTdGF0aWNMb2NrKSB7CisgICAgICAgICAgICBpZiAoc1NlcnZpY2UgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIHJldHVybiBzU2VydmljZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIElCaW5kZXIgYiA9IFNlcnZpY2VNYW5hZ2VyLmdldFNlcnZpY2UoImNsaXBib2FyZCIpOworICAgICAgICAgICAgc1NlcnZpY2UgPSBJQ2xpcGJvYXJkLlN0dWIuYXNJbnRlcmZhY2UoYik7CisgICAgICAgICAgICByZXR1cm4gc1NlcnZpY2U7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioge0BoaWRlfSAqLworICAgIHB1YmxpYyBDbGlwYm9hcmRNYW5hZ2VyKENvbnRleHQgY29udGV4dCwgSGFuZGxlciBoYW5kbGVyKSB7CisgICAgICAgIG1Db250ZXh0ID0gY29udGV4dDsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBTZXRzIHRoZSBj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SB7CisgICAgICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICAgICAgZ2V0U2VydmljZSgpLnJlbW92ZVByaW1hcnlDbGlwQ2hhbmdlZExpc3RlbmVyKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1QcmltYXJ5Q2xpcENoYW5nZWRTZXJ2aWNlTGlzdGVuZXIpOworICAgICAgICAgICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogQGRlcHJlY2F0ZWQgVXNlIHtAbGluayAjZ2V0UHJpbWFyeUNsaXAoKX0gaW5zdGVhZC4gIFRoaXMgcmV0cmlldmVzCisgICAgICogdGhlIHByaW1hcnkgY2xpcCBhbmQgdHJpZXMgdG8gY29lcmNlIGl0IHRvIGEgc3RyaW5nLgorICAgICAqLworICAgIHB1YmxpYyBDaGFyU2VxdWVuY2UgZ2V0VGV4dCgpIHsKKyAgICAgICAgQ2xpcHBlZERhdGEgY2xpcCA9IGdldFByaW1hcnlDbGlwKCk7CisgICAgICAgIGlmIChjbGlwICE9IG51bGwgJiYgY2xpcC5nZXRJdGVtQ291bnQoKSA+IDApIHsKKyAgICAgICAgICAgIHJldHVybiBjbGlwLmdldEl0ZW0oMCkuY29lcmNlVG9UZXh0KG1Db250ZXh0KTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gbnVsbDsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBAZGVwcmVjYXRlZCBVc2Uge0BsaW5rICNzZXRQcmltYXJ5Q2xpcChDbGlwcGVkRGF0YSl9IGluc3RlYWQuICBUaGlzCisgICAgICogY3JlYXRlcyBhIENsaXBwZWRJdGVtIGhvbGRpbmcgdGhlIGdpdmVuIHRleHQgYW5kIHNldHMgaXQgYXMgdGhlCisgICAgICogcHJpbWFyeSBjbGlwLiAgSXQgaGFzIG5vIGxhYmVsIG9yIGljb24uCisgICAgICovCisgICAgcHVibGljIHZvaWQgc2V0VGV4dChDaGFyU2VxdWVuY2UgdGV4dCkgeworICAgICAgICBzZXRQcmltYXJ5Q2xpcChuZXcgQ2xpcHBlZERhdGEobnVsbCwgbnVsbCwgbmV3IENsaXBwZWREYXRhLkl0ZW0odGV4dCkpKTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBAZGVwcmVjYXRlZCBVc2Uge0BsaW5rICNoYXNQcmltYXJ5Q2xpcCgpfSBpbnN0ZWFkLgorICAgICAqLworICAgIHB1YmxpYyBib29sZWFuIGhhc1RleHQoKSB7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICByZXR1cm4gZ2V0U2VydmljZSgpLmhhc1ByaW1hcnlDbGlwKCk7CisgICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKyAgICB9CisKKyAgICB2b2lkIHJlcG9ydFByaW1hcnlDbGlwQ2hhbmdlZCgpIHsKKyAgICAgICAgT2JqZWN0W10gbGlzdGVuZXJzOworCisgICAgICAgIHN5bmNocm9uaXplZCAobVByaW1hcnlDbGlwQ2hhbmdlZExpc3RlbmVycykgeworICAgICAgICAgICAgZmluYWwgaW50IE4gPSBtUHJpbWFyeUNsaXBDaGFuZ2VkTGlzdGVuZXJzLnNpemUoKTsKKyAgICAgICAgICAgIGlmIChOIDw9IDApIHsKKyAgICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgICAgICB9CisgICAgICAgICAgICBsaXN0ZW5lcnMgPSBtUHJpbWFyeUNsaXBDaGFuZ2VkTGlzdGVuZXJzLnRvQXJyYXkoKTsKKyAgICAgICAgfQorCisgICAgICAgIGZvciAoaW50IGk9MDsgaTxsaXN0ZW5lcnMubGVuZ3RoOyBpKyspIHsKKyAgICAgICAgICAgICgoT25QcmltYXJ5Q2xpcENoYW5nZWRMaXN0ZW5lcilsaXN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BjbGlwcyB0aHJvdWdoIHRoZSBzdGFuZGFyZCBjb250ZW50IHByb3ZpZGVyCisgICAgICogZmFjaWxpdGllcy4KKyAgICAgKiA8L3VsPgorICAgICAqLworICAgIHB1YmxpYyBzdGF0aWMgY2xhc3MgSXRlbSB7CisgICAgICAgIENoYXJTZXF1ZW5jZSBtVGV4dDsKKyAgICAgICAgSW50ZW50IG1JbnRlbnQ7CisgICAgICAgIFVyaSBtVXJpOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBDcmVhdGUgYW4gSXRlbSBjb25zaXN0aW5nIG9mIGEgc2luZ2xlIGJsb2NrIG9mIChwb3NzaWJseSBzdHlsZWQpIHRleHQuCisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgSXRlbShDaGFyU2VxdWVuY2UgdGV4dCkgeworICAgICAgICAgICAgbVRleHQgPSB0ZXh0OworICAgICAgICB9CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIENyZWF0ZSBhbiBJdGVtIGNvbnNpc3Rpbmcgb2YgYW4gYXJiaXRyYXJ5IEludGVudC4KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBJdGVtKEludGVudCBpbnRlbnQpIHsKKyAgICAgICAgICAgIG1JbnRlbnQgPSBpbnRlbnQ7CisgICAgICAgIH0KKworICAgICAgICAvKioKKyAgICAgICAgICogQ3JlYXRlIGFuIEl0ZW0gY29uc2lzdGluZyBvZiBhbiBhcmJpdHJhcnkgVVJJLgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIEl0ZW0oVXJpIHVyaSkgeworICAgICAgICAgICAgbVVyaSA9IHVyaTsKKyAgICAgICAgfQorCisgICAgICAgIC8qKgorICAgICAgICAgKiBDcmVhdGUgYSBjb21wbGV4IEl0ZW0sIGNvbnRhaW5pbmcgbXVsdGlwbGUgcmVwcmVzZW50YXRpb25zIG9mCisgICAgICAgICAqIHRleHQsIGludGVudCwgYW5kL29yIFVSSS4KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBJdGVtKENoYXJTZXF1ZW5jZSB0ZXh0LCBJbnRlbnQgaW50ZW50LCBVcmkgdXJpKSB7CisgICAgICAgICAgICBtVGV4dCA9IHRleHQ7CisgICAgICAgICAgICBtSW50ZW50ID0gaW50ZW50OworICAgICAgICAgICAgbVVyaSA9IHVyaTsKKyAgICAgICAgfQorCisgICAgICAgIC8qKgorICAgICAgICAgKiBSZXRyaWV2ZSB0aGUgcmF3IHRleHQgY29udGFpbmVkIGluIHRoaXMgSXRlbS4KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBDaGFyU2VxdWVuY2UgZ2V0VGV4dCgpIHsKKyAgICAgICAgICAgIHJldHVybiBtVGV4dDsKKyAgICAgICAgfQorCisgICAgICAgIC8qKgorICAgICAgICAgKiBSZXRyaWV2ZSB0aGUgcmF3IEludGVudCBjb250YWluZWQgaW4gdGhpcyBJdGVtLgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIEludGVudCBnZXRJbnRlbnQoKSB7CisgICAgICAgICAgICByZXR1cm4gbUludGVudDsKKyAgICAgICAgfQorCisgICAgICAgIC8qKgorICAgICAgICAgKiBSZXRyaWV2ZSB0aGUgcmF3IFVSSSBjb250YWluZWQgaW4gdGhpcyBJdGVtLgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIFVyaSBnZXRVcmkoKSB7CisgICAgICAgICAgICByZXR1cm4gbVVyaTsKKyAgICAgICAgfQorCisgICAgICAgIC8qKgorICAgICAgICAgKiBUdXJuIHRoaXMgaXRlbSBpbnRvIHRleHQsIHJlZ2FyZGxlc3Mgb2YgdGhlIHR5cGUgb2YgZGF0YSBpdAorICAgICAgICAgKiBhY3R1YWxseSBjb250YWlucy4KKyAgICAgICAgICoKKyAgICAgICAgICogPHA+VGhlIGFsZ29yaXRobSBmb3IgZGVjaWRpbmcgd2hhdCB0ZXh0IHRvIHJldHVybiBpczoKKyAgICAgICAgICogPHVsPgorICAgICAgICAgKiA8bGk+IElmIHtAbGluayAjZ2V0VGV4dH0gaXMgbm9uLW51bGwsIHJldHVybiB0aGF0LgorICAgICAgICAgKiA8bGk+IElmIHtAbGluayAjZ2V0VXJpfSBpcyBub24tbnVsbCwgdHJ5IHRvIHJldHJpZXZlIGl0cyBkYXRhCisgICAgICAgICAqIGFzIGEgdGV4dCBzdHJlYW0gZnJvbSBpdHMgY29udGVudCBwcm92aWRlci4gIElmIHRoaXMgc3VjY2VlZHMsIGNvcHkKKyAgICAgICAgICogdGhlIHRleHQgaW50byBhIFN0cmluZyBhbmQgcmV0dXJuIGl0LiAgSWYgaXQgaXMgbm90IGEgY29udGVudDogVVJJIG9yCisgICAgICAgICAqIHRoZSBjb250ZW50IHByb3ZpZGVyIGRvZXMgbm90IHN1cHBseSBhIHRleHQgcmVwcmVzZW50YXRpb24sIHJldHVybgorICAgICAgICAgKiB0aGUgcmF3IFVSSSBhcyBhIHN0cmluZy4KKyAgICAgICAgICogPGxpPiBJZiB7QGxpbmsgI2dldEludGVudH0gaXMgbm9uLW51bGwsIGNvbnZlcnQgdGhhdCB0byBhbiBpbnRlbnQ6CisgICAgICAgICAqIFVSSSBhbmQgcmV0dXJuaXQuCisgICAgICAgICAqIDxsaT4gT3RoZXJ3aXNlLCByZXR1cm4gYW4gZW1wdHkgc3RyaW5nLgorICAgICAgICAgKiA8L3VsPgorICAgICAgICAgKgorICAgICAgICAgKiBAcGFyYW0gY29udGV4dCBUaGUgY2FsbGVyJ3MgQ29udGV4dCwgZnJvbSB3aGljaCBpdHMgQ29udGVudFJlc29sdmVyCisgICAgICAgICAqIGFuZCBvdGhlciB0aGluZ3MgY2FuIGJlIHJldHJpZXZlZC4KKyAgICAgICAgICogQHJldHVybiBSZXR1cm5zIHRoZSBpdGVtJ3MgdGV4dHVhbCByZXByZXNlbnRhdGlvbi4KKyAgICAgICAgICovCisvL0JFR0lOX0lOQ0xVREUoY29lcmNlVG9UZXh0KQorICAgICAgICBwdWJsaWMgQ2hhclNlcXVlbmNlIGNvZXJjZVRvVGV4dChDb250ZXh0IGNvbnRleHQpIHsKKyAgICAgICAgICAgIC8vIElmIHRoaXMgSXRlbSBoYXMgYW4gZXhwbGljaXQgdGV4dHVhbCB2YWx1ZSwgc2ltcGx5IHJldHVybiB0aGF0LgorICAgICAgICAgICAgaWYgKG1UZXh0ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gbVRleHQ7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIC8vIElmIHRoaXMgSXRlbSBoYXMgYSBVUkkgdmFsdWUsIHRyeSB1c2luZyB0aGF0LgorICAgICAgICAgICAgaWYgKG1VcmkgIT0gbnVsbCkgeworCisgICAgICAgICAgICAgICAgLy8gRmlyc3Qgc2VlIGlmIHRoZSBVUkkgY2FuIGJlIG9wZW5lZCBhcyBhIHBsYWluIHRleHQgc3RyZWFtCisgICAgICAgICAgICAgICAgLy8gKG9mIGFueSBzdWItdHlwZSkuICBJZiBzbywgdGhpcyBpcyB0aGUgYmVzdCB0ZXh0dWFsCisgICAgICAgICAgICAgICAgLy8gcmVwcmVzZW50YXRpb24gZm9yIGl0LgorICAgICAgICAgICAgICAgIEZpbGVJbnB1dFN0cmVhbSBzdHJlYW0gPSBudWxsOworICAgICAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgICAgIC8vIEFzayBmb3IgYSBzdHJlYW0gb2YgdGhlIGRlc2lyZWQgdHlwZS4KKyAgICAgICAgICAgICAgICAgICAgQXNzZXRGaWxlRGVzY3JpcHRvciBkZXNjciA9IGNvbnRleHQuZ2V0Q29udGVudFJlc29sdmVyKCkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAub3BlblR5cGVkQXNzZXRGaWxlRGVzY3JpcHRvcihtVXJpLCAidGV4dC8qIiwgbnVsbCk7CisgICAgICAgICAgICAgICAgICAgIHN0cmVhbSA9IGRlc2NyLmNyZWF0ZUlucHV0U3RyZWFtKCk7CisgICAgICAgICAgICAgICAgICAgIElucHV0U3RyZWFtUmVhZGVyIHJlYWRlciA9IG5ldyBJbnB1dFN0cmVhbVJlYWRlcihzdHJlYW0sICJVVEYtOCIpOworCisgICAgICAgICAgICAgICAgICAgIC8vIEdvdCBpdC4uLiAgY29weSB0aGUgc3RyZWFtIGludG8gYSBsb2NhbCBzdHJpbmcgYW5kIHJldHVybiBpdC4KKyAgICAgICAgICAgICAgICAgICAgU3RyaW5nQnVpbGRlciBidWlsZGVyID0gbmV3IFN0cmluZ0J1aWxkZXIoMTI4KTsKKyAgICAgICAgICAgICAgICAgICAgY2hhcltdIGJ1ZmZlciA9IG5ldyBjaGFyWzgxOTJdOworICAgICAgICAgICAgICAgICAgICBpbnQgbGVuOworICAgICAgICAgICAgICAgICAgICB3aGlsZSAoKGxlbj1yZWFkZXIucmVhZChidWZmZXIpKSA+IDApIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJ1aWxkZXIuYXBwZW5kKGJ1ZmZlciwgMCwgbGVuKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICByZXR1cm4gYnVpbGRlci50b1N0cmluZygpOworCisgICAgICAgICAgICAgICAgfSBjYXRjaCAoRmlsZU5vdEZvdW5kRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gVW5hYmxlIHRvIG9wZW4gY29udGVudCBVUkkgYXMgdGV4dC4uLiAgbm90IHJlYWxseSBhbgorICAgICAgICAgICAgICAgICAgICAvLyBlcnJvciwganVzdCBzb21ldGhpbmcgdG8gaWdub3JlLgorCisgICAgICAgICAgICAgICAgfSBjYXRjaCAoSU9FeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgICAgICAvLyBTb21ldGhpbmcgYmFkIGhhcyBoYXBwZW5lZC4KKyAgICAgICAgICAgICAgICAgICAgTG9nLncoIkNsaXBwZWREYXRhIiwgIkZhaWx1cmUgbG9hZGluZyB0ZXh0IiwgZSk7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnRvU3RyaW5nKCk7CisKKyAgICAgICAgICAgICAgICB9IGZpbmFsbHkgeworICAgICAgICAgICAgICAgICAgICBpZiAoc3RyZWFtICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyZWFtLmNsb3NlKCk7CisgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChJT0V4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAvLyBJZiB3ZSBjb3VsZG4ndCBvcGVuIHRoZSBVUkkgYXMgYSBzdHJlYW0sIHRoZW4gdGhlIFVSSSBpdHNlbGYKKyAgICAgICAgICAgICAgICAvLyBwcm9iYWJseSBzZXJ2ZXMgZmFpcmx5IHdlbGwgYXMgYSB0ZXh0dWFsIHJlcHJlc2VudGF0aW9uLgorICAgICAgICAgICAgICAgIHJldHVybiBtVXJpLnRvU3RyaW5nKCk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIC8vIEZpbmFsbHksIGlmIGFsbCB3ZSBoYXZlIGlzIGFuIEludGVudCwgdGhlbiB3ZSBjYW4ganVzdCB0dXJuIHRoYXQKKyAgICAgICAgICAgIC8vIGludG8gdGV4dC4gIE5vdCB0aGUgbW9zdCB1c2VyLWZyaWVuZGx5IHRoaW5nLCBidXQgaXQncyBzb21ldGhpbmcuCisgICAgICAgICAgICBpZiAobUludGVudCAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIG1JbnRlbnQudG9VcmkoSW50ZW50LlVSSV9JTlRFTlRfU0NIRU1FKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgLy8gU2hvdWxkbid0IGdldCBoZXJlLCBidXQganVzdCBpbiBjYXNlLi4uCisgICAgICAgICAgICByZXR1cm4gIiI7CisgICAgICAgIH0KKy8vRU5EX0lOQ0xVREUoY29lcmNlVG9UZXh0KQorICAgIH0KKworICAgIC8qKgorICAgICAqIENyZWF0ZSBhIG5ldyBjbGlwLgorICAgICAqCisgICAgICogQHBhcmFtIGxhYmVsIExhYmVsIHRvIHNob3cgdG8gdGhlIHVzZXIgZGVzY3JpYmluZyB0aGlzIGNsaXAuCisgICAgICogQHBhcmFtIGljb24gQml0bWFwIHByb3ZpZGluZyB0aGUgdXNlciB3aXRoIGFuIGljb25pbmcgcmVwcmVzZW50YXRpb24gb2YKKyAgICAgKiB0aGUgY2xpcC4KKyAgICAgKiBAcGFyYW0gaXRlbSBUaGUgY29udGVudHMgb2YgdGhlIGZpcnN0IGl0ZW0gaW4gdGhlIGNsaXAuCisgICAgICovCisgICAgcHVibGljIENsaXBwZWREYXRhKENoYXJTZXF1ZW5jZSBsYWJlbCwgQml0bWFwIGljb24sIEl0ZW0gaXRlbSkgeworICAgICAgICBpZiAoaXRlbSA9PSBudWxsKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgTnVsbFBvaW50ZXJFeGNlcHRpb24oIml0ZW0gaXMgbnVsbCIpOworICAgICAgICB9CisgICAgICAgIG1MYWJlbCA9IGxhYmVsOworICAgICAgICBtSWNvbiA9IGljb247CisgICAgICAgIG1JdGVtcy5hZGQoaXRlbSk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgYWRkSXRlbShJdGVtIGl0ZW0pIHsKKyAgICAgICAgaWYgKGl0ZW0gPT0gbnVsbCkgeworICAgICAgICAgICAgdGhyb3cgbmV3IE51bGxQb2ludGVyRXhjZXB0aW9uKCJpdGVtIGlzIG51bGwiKTsKKyAgICAgICAgfQorICAgICAgICBtSXRlbXMuYWRkKGl0ZW0pOworICAgIH0KKworICAgIHB1YmxpYyBDaGFyU2VxdWVuY2UgZ2V0TGFiZWwoKSB7CisgICAgICAgIHJldHVybiBtTGFiZWw7CisgICAgfQorCisgICAgcHVibGljIEJpdG1hcCBnZXRJY29uKCkgeworICAgICAgICByZXR1cm4gbUljb247CisgICAgfQorCisgICAgcHVibGljIGludCBnZXRJdGVtQ291bnQoKSB7CisgICAgICAgIHJldHVybiBtSXRlbXMuc2l6ZSgpOworICAgIH0KKworICAgIHB1YmxpYyBJdGVtIGdldEl0ZW0oaW50IGluZGV4KSB7CisgICAgICAgIHJldHVybiBtSXRlbXMuZ2V0KGluZGV4KTsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgaW50IGRlc2NyaWJlQ29udGVudHMoKSB7CisgICAgICAgIHJldHVybiAwOworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIHdyaXRlVG9QYXJjZWwoUGFyY2VsIGRlc3QsIGludCBmbGFncykgeworICAgICAgICBUZXh0VXRpbHMud3JpdGVUb1BhcmNlbChtTGFiZWwsIGRlc3QsIGZsYWdzKTsKKyAgICAgICAgaWYgKG1JY29uICE9IG51bGwpIHsKKyAgICAgICAgICAgIGRlc3Qud3JpdGVJbnQoMSk7CisgICAgICAgICAgICBtSWNvbi53cml0ZVRvUGFyY2VsKGRlc3QsIGZsYWdzKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIGRlc3Qud3JpdGVJbnQoMCk7CisgICAgICAgIH0KKyAgICAgICAgZmluYWwgaW50IE4gPSBtSXRlbXMuc2l6ZSgpOworICAgICAgICBkZXN0LndyaXRlSW50KE4pOworICAgICAgICBmb3IgKGludCBpPTA7IGk8TjsgaSsrKSB7CisgICAgICAgICAgICBJdGVtIGl0ZW0gPSBtSXRlbXMuZ2V0KGkpOworICAgICAgICAgICAgVGV4dFV0aWxzLndyaXRlVG9QYXJjZWwoaXRlbS5tVGV4dCwgZGVzdCwgZmxhZ3MpOworICAgICAgICAgICAgaWYgKGl0ZW0ubUludGVudCAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgZGVzdC53cml0ZUludCgxKTsKKyAgICAgICAgICAgICAgICBpdGVtLm1JbnRlbnQud3JpdGVUb1BhcmNlbChkZXN0LCBmbGFncyk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIGRlc3Qud3JpdGVJbnQoMCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoaXRlbS5tVXJpICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBkZXN0LndyaXRlSW50KDEpOworICAgICAgICAgICAgICAgIGl0ZW0ubVVyaS53cml0ZVRvUGFyY2VsKGRlc3QsIGZsYWdzKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgZGVzdC53cml0ZUludCgwKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIENsaXBwZWREYXRhKFBhcmNlbCBpbikgeworICAgICAgICBtTGFiZWwgPSBUZXh0VXRpbHMuQ0hBUl9TRVFVRU5DRV9DUkVBVE9SLmNyZWF0ZUZyb21QYXJjZWwoaW4pOworICAgICAgICBpZiAoaW4ucmVhZEludCgpICE9IDApIHsKKyAgICAgICAgICAgIG1JY29uID0gQml0bWFwLkNSRUFUT1IuY3JlYXRlRnJvbVBhcmNlbChpbik7CisgICAgICAgIH0KKyAgICAgICAgZmluYWwgaW50IE4gPSBpbi5yZWFkSW50KCk7CisgICAgICAgIGZvciAoaW50IGk9MDsgaTxOOyBpKyspIHsKKyAgICAgICAgICAgIENoYXJTZXF1ZW5jZSB0ZXh0ID0gVGV4dFV0aWxzLkNIQVJfU0VRVUVOQ0VfQ1JFQVRPUi5jcmVhdGVGcm9tUGFyY2VsKGluKTsKKyAgICAgICAgICAgIEludGVudCBpbnRlbnQgPSBpbi5yZWFkSW50KCkgIT0gMCA/IEludGVudC5DUkVBVE9SLmNyZWF0ZUZyb21QYXJjZWwoaW4pIDogbnVsbDsKKyAgICAgICAgICAgIFVyaSB1cmkgPSBpbi5yZWFkSW50KCkgIT0gMCA/IFVyaS5DUkVBVE9SLmNyZWF0ZUZyb21QYXJjZWwoaW4pIDogbnVsbDsKKyAgICAgICAgICAgIG1JdGVtcy5hZ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yZU1pbWVUeXBlcyhTdHJpbmcgY29uY3JldGVUeXBlLCBTdHJpbmcgZGVzaXJlZFR5cGUpIHsKKyAgICAgICAgZmluYWwgaW50IHR5cGVMZW5ndGggPSBkZXNpcmVkVHlwZS5sZW5ndGgoKTsKKyAgICAgICAgaWYgKHR5cGVMZW5ndGggPT0gMyAmJiBkZXNpcmVkVHlwZS5lcXVhbHMoIiovKiIpKSB7CisgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgfQorCisgICAgICAgIGZpbmFsIGludCBzbGFzaHBvcyA9IGRlc2lyZWRUeXBlLmluZGV4T2YoJy8nKTsKKyAgICAgICAgaWYgKHNsYXNocG9zID4gMCkgeworICAgICAgICAgICAgaWYgKHR5cGVMZW5ndGggPT0gc2xhc2hwb3MrMiAmJiBkZXNpcmVkVHlwZS5jaGFyQXQoc2xhc2hwb3MrMSkgPT0gJyonKSB7CisgICAgICAgICAgICAgICAgaWYgKGRlc2lyZWRUeXBlLnJlZ2lvbk1hdGNoZXMoMCwgY29uY3JldGVUeXBlLCAwLCBzbGFzaHBvcysxKSkgeworICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9IGVsc2UgaWYgKGRlc2lyZWRUeXBlLmVxdWFscyhjb25jcmV0ZVR5cGUpKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgLyoqCisgICAgICogQ2FsbGVkIGJ5IGEgY2xpZW50IHRvIGRldGVybWluZSB0aGUgdHlwZXMgb2YgZGF0YSBzdHJlYW1zIHRoYXQgdGhpcworICAgICAqIGNvbnRlbnQgcHJvdmlkZXIgc3VwcG9ydHMgZm9yIHRoZSBnaXZlbiBVUkkuICBUaGUgZGVmYXVsdCBpbXBsZW1lbnRhdGlvbgorICAgICAqIHJldHVybnMg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luQmFja2dyb3VuZChPYmplY3QuLi4gcGFyYW1zKSB7CisgICAgICAgICAgICAgICAgICAgIGZ1bmMud3JpdGVEYXRhVG9QaXBlKGZkc1sxXSwgdXJpLCBtaW1lVHlwZSwgb3B0cywgYXJncyk7CisgICAgICAgICAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgICAgICAgICBmZHNbMV0uY2xvc2UoKTsKKyAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoSU9FeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgICAgICAgICAgTG9nLncoVEFHLCAiRmFpbHVyZSBjbG9zaW5nIHBpcGUiLCBlKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9OworICAgICAgICAgICAgdGFzay5leGVjdXRlKChPYmplY3RbXSludWxsKTsKKworICAgICAgICAgICAgcmV0dXJuIGZkc1swXTsKKyAgICAgICAgfSBjYXRjaCAoSU9FeGNlcHRpb24gZSkgeworICAgICAgICAgICAgdGhyb3cgbmV3IEZpbGVOb3RGb3VuZEV4Y2VwdGlvbigiZmFpbHVyZSBtYWtpbmcgcGlwZSIpOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqCiAgICAgICogUmV0dXJucyB0cnVlIGlmIHRoaXMgaW5zdGFuY2UgaXMgYSB0ZW1wb3JhcnkgY29udGVudCBwcm92aWRlci4KICAgICAgKiBAcmV0dXJuIHRydWUgaWYgdGhpcyBpbnN0YW5jZSBpcyBhIHRlbXBvcmFyeSBjb250ZW50IHByb3ZpZGVyCiAgICAgICovCkBAIC03NzUsNiArOTU2LDExIEBACiAgICAgICogQHBhcmFtIGluZm8gUmVnaXN0ZXJlZCBpbmZvcm1hdGlvbiBhYm91dCB0aGlzIGNvbnRlbnQgcHJvdmlkZXIKICAgICAgKi8KICAgICBwdWJsaWMgdm9pZCBhdHRhY2hJbmZvKENvbnRleH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mUvamF2YS9hbmRyb2lkL2NvbnRlbnQvQ29udGVudFByb3ZpZGVyTmF0aXZlLmphdmEgYi9jb3JlL2phdmEvYW5kcm9pZC9jb250ZW50L0NvbnRlbnRQcm92aWRlck5hdGl2ZS5qYXZhCmluZGV4IGZkYjNkMjAuLmQxYWI4ZDUgMTAwNjQ0Ci0tLSBhL2NvcmUvamF2YS9hbmRyb2lkL2NvbnRlbnQvQ29udGVudFByb3ZpZGVyTmF0aXZlLmphdmEKKysrIGIvY29yZS9qYXZhL2FuZHJvaWQvY29udGVudC9Db250ZW50UHJvdmlkZXJOYXRpdmUuamF2YQpAQCAtMjU3LDYgKzI1NywzOCBAQAogICAgICAgICAgICAgICAgICAgICByZXBseS53cml0ZUJ1bmRsZShyZXNwb25zZUJ1bmRsZSk7CiAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIGNhc2UgR0VUX1NUUkVBTV9UWVBFU19UUkFOU0FDVElPTjoKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIGRhdGEuZW5mb3JjZUludGVyZmFjZShJQ29udGVudFByb3ZpZGVyLmRlc2NyaXB0b3IpOworICAgICAgICAgICAgICAgICAgICBVcmkgdXJsID0gVXJpLkNSRUFUT1IuY3JlYXRlRnJvbVBhcmNlbChkYXRhKTsKKyAgICAgICAgICAgICAgICAgICAgU3RyaW5nIG1pbWVUeXBlRmlsdGVyID0gZGF0YS5yZWFkU3RyaW5nKCk7CisgICAgICAgICAgICAgICAgICAgIFN0cmluZ1tdIHR5cGVzID0gZ2V0U3RyZWFtVHlwZXModXJsLCBtaW1lVHlwZUZpbHRlcik7CisgICAgICAgICAgICAgICAgICAgIHJlcGx5LndyaXRlTm9FeGNlcHRpb24oKTsKKyAgICAgICAgICAgICAgICAgICAgcmVwbHkud3JpdGVTdHJpbmdBcnJheSh0eXBlcyk7CisKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgY2FzZSBPUEVOX1RZUEVEX0FTU0VUX0ZJTEVfVFJBTlNBQ1RJT046CisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBkYXRhLmVuZm9yY2VJbnRlcmZhY2UoSUNvbnRlbnRQcm92aWRlci5kZXNjcmlwdG9yKTsKKyAgICAgICAgICAgICAgICAgICAgVXJpIHVybCA9IFVyaS5DUkVBVE9SLmNyZWF0ZUZyb21QYXJjZWwoZGF0YSk7CisgICAgICAgICAgICAgICAgICAgIFN0cmluZyBtaW1lVHlwZSA9IGRhdGEucmVhZFN0cmluZygpOworICAgICAgICAgICAgICAgICAgICBCdW5kbGUgb3B0cyA9IGRhdGEucmVhZEJ1bmRsZSgpOworCisgICAgICAgICAgICAgICAgICAgIEFzc2V0RmlsZURlc2NyaXB0b3IgZmQ7CisgICAgICAgICAgICAgICAgICAgIGZkID0gb3BlblR5cGVkQXNzZXRGaWxlKHVybCwgbWltZVR5cGUsIG9wdHMpOworICAgICAgICAgICAgICAgICAgICByZXBseS53cml0ZU5vRXhjZXB0aW9uKCk7CisgICAgICAgICAgICAgICAgICAgIGlmIChmZCAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICByZXBseS53cml0ZUludCgxKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGZkLndyaXRlVG9QYXJjZWwocmVwbHksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBhcmNlbGFibGUuUEFSQ0VMQUJMRV9XUklURV9SRVRVUk5fVkFMVUUpOworICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAgICAgcmVwbHkud3JpdGVJbnQoMCk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogICAgICAgICB9IGNhdGNoIChFeGNlcHRpb24gZSkgewogICAgICAgICAgICAgRGF0YWJhc2VVdGlscy53cml0ZUV4Y2VwdGlvblRvUGFyY2VsKHJlcGx5LCBlKTsKQEAgLTU2OCw1ICs2MDAsNTAgQEAKICAgICAgICAgcmV0dXJuIGJ1bmRsZTsKICAgICB9CiAKKyAgICBwdWJsaWMgU3RyaW5nW10gZ2V0U3RyZWFtVHlwZXMoVXJpIHVybCwgU3RyaW5nIG1pbWVUeXBlRmlsdGVyKSB0aHJvd3MgUmVtb3RlRXhjZXB0aW9uCisgICAgeworICAgICAgICBQYXJjZWwgZGF0YSA9IFBhcmNlbC5vYnRhaW4oKTsKKyAgICAgICAgUGFyY2VsIHJlcGx5ID0gUGFyY2VsLm9idGFpbigpOworCisgICAgICAgIGRhdGEud3JpdGVJbnRlcmZhY2VUb2tlbihJQ29udGVudFByb3ZpZGVyLmRlc2NyaXB0b3IpOworCisgICAgICAgIHVybC53cml0ZVRvUGFyY2VsKGRhdGEsIDApOworICAgICAgICBkYXRhLndyaXRlU3RyaW5nKG1pbWVUeXBlRmlsdGVyKTsKKworICAgICAgICBtUmVtb3RlLnRyYW5zYWN0KElDb250ZW50UHJvdmlkZXIuR0VUX1NUUkVBTV9UWVBFU19UUkFOU0FDVElPTiwgZGF0YSwgcmVwbHksIDApOworCisgICAgICAgIERhdGFiYXNlVXRpbHMucmVhZEV4Y2VwdGlvbkZyb21QYXJjZWwocmVwbHkpOworICAgICAgICBTdHJpbmdbXSBvdXQgPSByZXBseS5jcmVhdGVTdHJpbmdBcnJheSgpOworCisgICAgICAgIGRhdGEucmVjeWNsZSgpOworICAgICAgICByZXBseS5yZWN5Y2xlKCk7CisKKyAgICAgICAgcmV0dXJuIG91dDsKKyAgICB9CisKKyAgICBwdWJsaWMgQXNzZXRGaWxlRGVzY3JpcHRvciBvcGVuVHlwZWRBc3NldEZpbGUoVXJpIHVybCwgU3RyaW5nIG1pbWVUeXBlLCBCdW5kbGUgb3B0cykKKyAgICAgICAgICAgIHRocm93cyBSZW1vdGVFeGNlcHRpb24sIEZpbGVOb3RGb3VuZEV4Y2VwdGlvbiB7CisgICAgICAgIFBhcmNlbCBkYXRhID0gUGFyY2VsLm9idGFpbigpOworICAgICAgICBQYXJjZWwgcmVwbHkgPSBQYXJjZWwub2J0YWluKCk7CisKKyAgICAgICAgZGF0YS53cml0ZUludGVyZmFjZVRva2VuKElDb250ZW50UHJvdmlkZXIuZGVzY3JpcHRvcik7CisKKyAgICAgICAgdXJsLndyaXRlVG9QYXJjZWwoZGF0YSwgMCk7CisgICAgICAgIGRhdGEud3JpdGVTdHJpbmcobWltZVR5cGUpOworICAgICAgICBkYXRhLndyaXRlQnVuZGxlKG9wdHMpOworCisgICAgICAgIG1SZW1vdGUudHJhbnNhY3QoSUNvbnRlbnRQcm92aWRlci5PUEVOX1RZUEVEX0FTU0VUX0ZJTEVfVFJBTlNBQ1RJT04sIGRhdGEsIHJlcGx5LCAwKTsKKworICAgICAgICBEYXRhYmFzZVV0aWxzLnJlYWRFeGNlcHRpb25XaXRoRmlsZU5vdEZvdW5kRXhjZXB0aW9uRnJvbVBhcmNlbChyZXBseSk7CisgICAgICAgIGludCBoYXMgPSByZXBseS5yZWFkSW50KCk7CisgICAgICAgIEFzc2V0RmlsZURlc2NyaXB0b3IgZmQgPSBoYXMgIT0gMAorICAgICAgICAgICAgICAgID8gQXNzZXRGaWxlRGVzY3JpcHRvci5DUkVBVE9SLmNyZWF0ZUZyb21QYXJjZWwocmVwbHkpIDogbnVsbDsKKworICAgICAgICBkYXRhLnJlY3ljbGUoKTsKKyAgICAgICAgcmVwbHkucmVjeWNsZSgpOworCisgICAgICAgIHJldHVybiBmZDsKKyAgICB9CisKICAgICBwcml2YXRlIElCaW5kZXIgbVJlbW90ZTsKIH0KZGlmZiAtLWdpdCBhL2NvcmUvamF2YS9hbmRyb2lkL2NvbnRlbnQvQ29udGVudFF1ZXJ5TWFwLmphdmEgYi9jb3JlL2phdmEvYW5kcm9pZC9jb250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ICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICAgICAgaWYgKCJyIi5lcXVhbHMobW9kZSkpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gb3BlblR5cGVkQXNzZXRGaWxlRGVzY3JpcHRvcih1cmksICIqLyoiLCBudWxsKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgSUNvbnRlbnRQcm92aWRlciBwcm92aWRlciA9IGFjcXVpcmVQcm92aWRlcih1cmkpOworICAgICAgICAgICAgICAgIGlmIChwcm92aWRlciA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBGaWxlTm90Rm91bmRFeGNlcHRpb24oIk5vIGNvbnRlbnQgcHJvdmlkZXI6ICIgKyB1cmkpOwogICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBQYXJjZWxGaWxlRGVzY3JpcHRvciBwZmQgPSBuZXcgUGFyY2VsRmlsZURlc2NyaXB0b3JJbm5lcigKLSAgICAgICAgICAgICAgICAgICAgICAgIGZkLmdldFBhcmNlbEZpbGVEZXNjcmlwdG9yKCksIHByb3ZpZGVyKTsKLSAgICAgICAgICAgICAgICByZXR1cm4gbmV3IEFzc2V0RmlsZURlc2NyaXB0b3IocGZkLCBmZC5nZXRTdGFydE9mZnNldCgpLAotICAgICAgICAgICAgICAgICAgICAgICAgZmQuZ2V0RGVjbGFyZWRMZW5ndGgoKSk7Ci0gICAgICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgICAgIEFzc2V0RmlsZURlc2NyaXB0b3IgZmQgPSBwcm92aWRlci5vcGVuQXNzZXRGaWxlKHVyaSwgbW9kZSk7CisgICAgICAgICAgICAgICAgICAgIGlmKGZkID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJlbGVhc2VQcm92aWRlcihwcm92aWRlcik7CisgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBQYXJjZWxGaWxlRGVzY3JpcHRvciBwZmQgPSBuZXcgUGFyY2VsRmlsZURlc2NyaXB0b3JJbm5lcigKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBmZC5nZXRQYXJjZWxGaWxlRGVzY3JpcHRvcigpLCBwcm92aWRlcik7CisKKyAgICAgICAgICAgICAgICAgICAgLy8gU3VjY2VzcyEgIERvbid0IHJlbGVhc2UgdGhlIHByb3ZpZGVyIHdoZW4gZXhpdGluZywgbGV0CisgICAgICAgICAgICAgICAgICAgIC8vIFBhcmNlbEZpbGVEZXNjcmlwdG9ySW5uZXIgZG8gdGhhdCB3aGVuIGl0IGlzIGNsb3NlZC4KKyAgICAgICAgICAgICAgICAgICAgcHJvdmlkZXIgPSBudWxsOworCisgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgQXNzZXRGaWxlRGVzY3JpcHRvcihwZmQsIGZkLmdldFN0YXJ0T2Zmc2V0KCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmQuZ2V0RGVjbGFyZWRMZW5ndGgoKSk7CisgICAgICAgICAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEZpbGVOb3RGb3VuZEV4Y2VwdGlvbigiRGVhZCBjb250ZW50IHByb3ZpZGVyOiAiICsgdXJpKTsKKyAgICAgICAgICAgICAgICB9IGNhdGNoIChGaWxlTm90Rm91bmRFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgICAgICB0aHJvdyBlOworICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICAgICAgICAgIGlmIChwcm92aWRlciAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICByZWxlYXNlUHJvdmlkZXIocHJvdmlkZXIpOworICAgICAgIC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hICBEb24ndCByZWxlYXNlIHRoZSBwcm92aWRlciB3aGVuIGV4aXRpbmcsIGxldAorICAgICAgICAgICAgLy8gUGFyY2VsRmlsZURlc2NyaXB0b3JJbm5lciBkbyB0aGF0IHdoZW4gaXQgaXMgY2xvc2VkLgorICAgICAgICAgICAgcHJvdmlkZXIgPSBudWxsOworCisgICAgICAgICAgICByZXR1cm4gbmV3IEFzc2V0RmlsZURlc2NyaXB0b3IocGZkLCBmZC5nZXRTdGFydE9mZnNldCgpLAorICAgICAgICAgICAgICAgICAgICBmZC5nZXREZWNsYXJlZExlbmd0aCgpKTsKKyAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBGaWxlTm90Rm91bmRFeGNlcHRpb24oIkRlYWQgY29udGVudCBwcm92aWRlcjogIiArIHVyaSk7CisgICAgICAgIH0gY2F0Y2ggKEZpbGVOb3RGb3VuZEV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICB0aHJvdyBlOworICAgICAgICB9IGZpbmFsbHkgeworICAgICAgICAgICAgaWYgKHByb3ZpZGVyICE9IG51bGwpIHsKICAgICAgICAgICAgICAgICByZWxlYXNlUHJvdmlkZXIocHJvdmlkZXIpOwotICAgICAgICAgICAgICAgIHRocm93IGU7Ci0gICAgICAgICAgICB9IGNhdGNoIChSdW50aW1lRXhjZXB0aW9uIGUpIHsKLSAgICAgICAgICAgICAgICByZWxlYXNlUHJvdmlkZXIocHJvdmlkZXIpOwotICAgICAgICAgICAgICAgIHRocm93IGU7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KICAgICB9CkBAIC0xMzQyLDcgKzE0NDYsNyBAQAogICAgIH0KIAogICAgIHByaXZhdGUgZmluYWwgY2xhc3MgQ3Vyc29yV3JhcHBlcklubmVyIGV4dGVuZHMgQ3Vyc29yV3JhcHBlciB7Ci0gICAgICAgIHByaXZhdGUgSUNvbnRlbnRQcm92aWRlciBtQ29udGVudFBy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1VcmksIG1Qcm9qZWN0aW9uLCBtU2VsZWN0aW9uLAorICAgICAgICAgICAgICAgIG1TZWxlY3Rpb25BcmdzLCBtU29ydE9yZGVyKTsKKyAgICAgICAgLy8gRW5zdXJlIHRoZSBjdXJzb3Igd2luZG93IGlzIGZpbGxlZAorICAgICAgICBpZiAoY3Vyc29yICE9IG51bGwpIHsKKyAgICAgICAgICAgIGN1cnNvci5nZXRDb3VudCgpOworICAgICAgICAgICAgY3Vyc29yLnJlZ2lzdGVyQ29udGVudE9ic2VydmVyKG1PYnNlcnZlcik7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIGN1cnNvcjsKKyAgICB9CisKKyAgICAvKiBSdW5zIG9uIHRoZSBVSSB0aHJlYWQgKi8KKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgdm9pZCBkZWxpdmVyUmVzdWx0KEN1cnNvciBjdXJzb3IpIHsKKyAgICAgICAgaWYgKG1TdG9wcGVkKSB7CisgICAgICAgICAgICAvLyBBbiBhc3luYyBxdWVyeSBjYW1lIGluIHdoaWxlIHRoZSBsb2FkZXIgaXMgc3RvcHBlZAorICAgICAgICAgICAgaWYgKGN1cnNvciAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgY3Vyc29yLmNsb3NlKCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKyAgICAgICAgQ3Vyc29yIG9sZEN1cnNvciA9IG1DdXJzb3I7CisgICAgICAgIG1DdXJzb3IgPSBjdXJzb3I7CisgICAgICAgIHN1cGVyLmRlbGl2ZXJSZXN1bHQoY3Vyc29yKTsKKworICAgICAgICBpZiAob2xkQ3Vyc29yICE9IG51bGwgJiYgIW9sZEN1cnNvci5pc0Nsb3NlZCgpKSB7CisgICAgICAgICAgICBvbGRDdXJzb3IuY2xvc2UoKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyBDdXJzb3JMb2FkZXIoQ29udGV4dCBjb250ZXh0LCBV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xzZSB7CisgICAgICAgICAgICBmb3JjZUxvYWQoKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIE11c3QgYmUgY2FsbGVkIGZyb20gdGhlIFVJIHRocmVhZAorICAgICAqLworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIHN0b3BMb2FkaW5nKCkgeworICAgICAgICBpZiAobUN1cnNvciAhPSBudWxsICYmICFtQ3Vyc29yLmlzQ2xvc2VkKCkpIHsKKyAgICAgICAgICAgIG1DdXJzb3IuY2xvc2UoKTsKKyAgICAgICAgfQorICAgICAgICBtQ3Vyc29yID0gbnVsbDsKKworICAgICAgICAvLyBBdHRlbXB0IHRvIGNhbmNlbCB0aGUgY3VycmVudCBsb2FkIHRhc2sgaWYgcG9zc2libGUuCisgICAgICAgIGNhbmNlbExvYWQoKTsKKworICAgICAgICAvLyBNYWtlIHN1cmUgdGhhdCBhbnkgb3V0c3RhbmRpbmcgbG9hZHMgY2xlYW4gdGhlbXNlbHZlcyB1cCBwcm9wZXJseQorICAgICAgICBtU3RvcHBlZCA9IHRydWU7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgb25DYW5jZWxsZWQoQ3Vyc29yIGN1cnNvcikgeworICAgICAgICBpZiAoY3Vyc29yICE9IG51bGwgJiYgIWN1cnNvci5pc0Nsb3NlZCgpKSB7CisgICAgICAgICAgICBjdXJzb3IuY2xvc2UoKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIGRlc3Ryb3koKSB7CisgICAgICAgIC8vIEVuc3VyZSB0aGUgbG9hZGVyIGlzIHN0b3BwZWQKKyAgICAgICAgc3RvcExvYWRpbmcoKTsKKyAgICB9CisKKyAgICBwdWJsaWMgVXJpIGdldFVyaSgpIHsKKyAgICAgICAgcmV0dXJuIG1Vcmk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgc2V0VXJpKFVyaSB1cmkpIHsKKyAgICAgICAgbVVyaSA9IHVyaTsKKyAgICB9CisKKyAgICBwdWJsaWMgU3RyaW5nW10gZ2V0UHJvamVjdGlvbigpIHsKKyAgICAgICAgcmV0dXJuIG1Qcm9qZWN0aW9uOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHNldFByb2plY3Rpb24oU3RyaW5nW10gcHJvamVjdGlvbikgeworICAgICAgICBtUHJvamVjdGlvbiA9IHByb2plY3Rpb247CisgICAgfQorCisgICAgcHVibGljIFN0cmluZyBnZXRTZWxlY3Rpb24oKSB7CisgICAgICAgIHJldHVybiBtU2VsZWN0aW9uOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHNldFNlbGVjdGlvbihTdHJpbmcgc2VsZWN0aW9uKSB7CisgICAgICAgIG1TZWxlY3Rpb24gPSBzZWxlY3Rpb247CisgICAgfQorCisgICAgcHVibGljIFN0cmluZ1tdIGdldFNlbGVjdGlvbkFyZ3MoKSB7CisgICAgICAgIHJldHVybiBtU2VsZWN0aW9uQXJnczsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBzZXRTZWxlY3Rpb25BcmdzKFN0cmluZ1tdIHNlbGVjdGlvbkFyZ3MpIHsKKyAgICAgICAgbVNlbGVjdGlvbkFyZ3MgPSBzZWxlY3Rpb25BcmdzOworICAgIH0KKworICAgIHB1YmxpYyBTdHJpbmcgZ2V0U29ydE9yZGVyKCkgeworICAgICAgICByZXR1cm4gbVNvcnRPcmRlcjsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBzZXRTb3J0T3JkZXIoU3RyaW5nIHNvcnRPcmRlcikgeworICAgICAgICBtU29ydE9yZGVyID0gc29ydE9yZGVyOworICAgIH0KK30KZGlmZiAtLWdpdCBhL2NvcmUvamF2YS9hbmRyb2lkL2NvbnRlbnQvSUNsaXBib2FyZC5haWRsIGIvY29yZS9qYXZhL2FuZHJvaWQvY29udGVudC9JQ2xpcGJvYXJkLmFpZGwKbmV3IGZpbGUgbW9kZSAx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h0LmdldEFwcGxpY2F0aW9uQ29udGV4dCgpOworICAgIH0KKworICAgIC8qKgorICAgICAqIFNlbmRzIHRoZSByZXN1bHQgb2YgdGhlIGxvYWQgdG8gdGhlIHJlZ2lzdGVyZWQgbGlzdGVuZXIuIFNob3VsZCBvbmx5IGJlIGNhbGxlZCBieSBzdWJjbGFzc2VzLgorICAgICAqCisgICAgICogTXVzdCBiZSBjYWxsZWQgZnJvbSB0aGUgVUkgdGhyZWFkLgorICAgICAqCisgICAgICogQHBhcmFtIGRhdGEgdGhlIHJlc3VsdCBvZiB0aGUgbG9hZAorICAgICAqLworICAgIHB1YmxpYyB2b2lkIGRlbGl2ZXJSZXN1bHQoRCBkYXRhKSB7CisgICAgICAgIGlmIChtTGlzdGVuZXIgIT0gbnVsbCkgeworICAgICAgICAgICAgbUxpc3RlbmVyLm9uTG9hZENvbXBsZXRlKHRoaXMsIGRhdGEpOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogQHJldHVybiBhbiBhcHBsaWNhdGlvbiBjb250ZXh0IHJldHJpZXZlZCBmcm9tIHRoZSBDb250ZXh0IHBhc3NlZCB0byB0aGUgY29uc3RydWN0b3IuCisgICAgICovCisgICAgcHVibGljIENvbnRleHQgZ2V0Q29udGV4dCgpIHsKKyAgICAgICAgcmV0dXJuIG1Db250ZXh0OworICAgIH0KKworICAgIC8qKgorICAgICAqIEByZXR1cm4gdGhlIElEIG9mIHRoaXMgbG9hZGVyCisgICAgICovCisgICAgcHVibGljIGludCBnZXRJZCgpIHsKKyAgICAgICAgcmV0dXJuIG1JZDsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBSZWdpc3RlcnMgYSBjbGFzcyB0aGF0IHdpbGwgcmVjZWl2ZSBjYWxsYmFja3Mgd2hlbiBhIGxvYWQgaXMgY29tcGxldGUuIFRoZSBjYWxsYmFja3Mgd2lsbAorICAgICAqIGJlIGNhbGxlZCBvbiB0aGUgVUkgdGhyZWFkIHNvIGl0J3Mgc2F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VMb2NrIGdldFN5bmNXYWtlTG9jayhTdHJpbmcgYWNjb3VudFR5cGUsIFN0cmluZyBhdXRob3JpdHkpIHsKKyAgICAgICAgICAgIGZpbmFsIFBhaXI8U3RyaW5nLCBTdHJpbmc+IHdha2VMb2NrS2V5ID0gUGFpci5jcmVhdGUoYWNjb3VudFR5cGUsIGF1dGhvcml0eSk7CisgICAgICAgICAgICBQb3dlck1hbmFnZXIuV2FrZUxvY2sgd2FrZUxvY2sgPSBtV2FrZUxvY2tzLmdldCh3YWtlTG9ja0tleSk7CisgICAgICAgICAgICBpZiAod2FrZUxvY2sgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgIGZpbmFsIFN0cmluZyBuYW1lID0gU1lOQ19XQUtFX0xPQ0tfUFJFRklYICsgIl8iICsgYXV0aG9yaXR5ICsgIl8iICsgYWNjb3VudFR5cGU7CisgICAgICAgICAgICAgICAgd2FrZUxvY2sgPSBtUG93ZXJNYW5hZ2VyLm5ld1dha2VMb2NrKFBvd2VyTWFuYWdlci5QQVJUSUFMX1dBS0VfTE9DSywgbmFtZSk7CisgICAgICAgICAgICAgICAgd2FrZUxvY2suc2V0UmVmZXJlbmNlQ291bnRlZChmYWxzZSk7CisgICAgICAgICAgICAgICAgbVdha2VMb2Nrcy5wdXQod2FrZUxvY2tLZXksIHdha2VMb2NrKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHJldHVybiB3YWtlTG9jazsKKyAgICAgICAgfQorCiAgICAgICAgIHByaXZhdGUgdm9pZCB3YWl0VW50aWxSZWFkeVRvUnVuKCkgewogICAgICAgICAgICAgQ291bnREb3duTGF0Y2ggbGF0Y2ggPSBtUmVhZHlUb1J1bkxhdGNoOwogICAgICAgICAgICAgaWYgKGxhdGNoICE9IG51bGwpIHsKQEAgLTE0NzcsOCArMTQ5NCw5IEBACiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgICBmaW5hbCBib29sZWFuIGlzU3luY0luUHJvZ3Jlc3MgPSBtQWN0aXZlU3luY0NvbnRleHQgIT0gbnVsbDsKLSAgICAgICAgICAgICAgICBpZiAoIWlzU3luY0luUHJvZ3Jlc3MpIHsKKyAgICAgICAgICAgICAgICBpZiAoIWlzU3luY0luUHJvZ3Jlc3MgJiYgbVN5bmNXYWtlTG9jayAhPSBudWxsKSB7CiAgICAgICAgICAgICAgICAgICAgIG1TeW5jV2FrZUxvY2sucmVsZWFzZSgpOworICAgICAgICAgICAgICAgICAgICBtU3luY1dha2VMb2NrID0gbnVsbDsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgbWFuYWdlU3luY05vdGlmaWNhdGlvbigpOwogICAgICAgICAgICAgICAgIG1hbmFnZUVycm9yTm90aWZpY2F0aW9uKCk7CkBAIC0xNzA0LDcgKzE3MjIsMjYgQEAKICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICB9CiAKLSAgICAgICAgICAgIG1TeW5jV2FrZUxvY2suYWNxdWlyZSgpOworICAgICAgICAgICAgLy8gRmluZCB0aGUgd2FrZWxvY2sgZm9yIHRoaXMgYWNjb3VudCBhbmQgYXV0aG9yaXR5IGFuZCBzdG9yZSBpdCBpbiBtU3luY1dha2VMb2NrLgorICAgICAgICAgICAgLy8gQmUgc3VyZSB0byByZWxlYXNlIHRoZSBwcmV2aW91cyB3YWtlbG9jayBzbyB0aGF0IHdlIGRvbid0IGVuZCB1cCB3aXRoIGl0IGJlaW5nCisgICAgICAgICAgICAvLyBoZWxkIHVudGlsIGl0IGlzIHVzZWQgYWdhaW4uCisgICAgICAgICAgICAvLyBUaGVyZSBhcmUgYSBjb3VwbGUgdHJpY2t5IHRoaW5ncyBhYm91dCB0aGlzIGNvZGU6CisgICAgICAgICAgICAvLyAtIG1ha2Ugc3VyZSB0aGF0IHdlIGFjcXVpcmUgdGhlIG5ldyB3YWtlbG9jayBiZWZvcmUgcmVsZWFzaW5nIHRoZSBvbGQgb25lLAorICAgICAgICAgICAgLy8gICBvdGhlcndpc2UgdGhlIGRldmljZSBtaWdodCBnbyB0byBzbGVlcCBhcyBzb29uIGFzIHdlIHJlbGVhc2UgaXQuCisgICAgICAgICAgICAvLyAtIHNpbmNlIHdlIHVzZSBub24tcmVmZXJlbmNlIGNvdW50ZWQgd2FrZWxvY2tzIHdlIGhhdmUgdG8gYmUgc3VyZSBub3QgdG8gZG8KKyAgICAgICAgICAgIC8vICAgdGhlIHJlbGVhc2UgaWYgdGhlIHdha2Vsb2NrIGRpZG4ndCBjaGFuZ2UuIE90aGV3aXNlIHdlIHdvdWxkIGRvIGFuCisgICAgICAgICAgICAvLyAgIGFjcXVpcmUgZm9sbG93ZWQgYnkgYSByZWxlYXNlIG9uIHRoZSBzYW1lIGxvY2ssIHJlc3VsdGluZyBpbiBubyBsb2NrCisgICAgICAgICAgICAvLyAgIGJlaW5nIGhlbGQuCisgICAgICAgICAgICBQb3dlck1hbmFnZXIuV2FrZUxvY2sgb2xkV2FrZUxvY2sgPSBtU3luY1dha2VMb2NrOworICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICBtU3luY1dha2VMb2NrID0gZ2V0U3luY1dha2VMb2NrKG9wLmFjY291bnQudHlwZSwgb3AuYXV0aG9yaXR5KTsKKyAgICAgICAgICAgICAgICBtU3luY1dha2VMb2NrLmFjcXVpcmUoKTsKKyAgICAgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICAgICAgaWYgKG9sZFdha2VMb2NrICE9IG51bGwgJiYgb2xkV2FrZUxvY2sgIT0gbVN5bmNXYWtlTG9jaykgeworICAgICAgICAgICAgICAgICAgICBvbGRXYWtlTG9jay5yZWxlYXNlKCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorCiAgICAgICAgICAgICAvLyBubyBuZWVkIHRvIHNjaGVkdWxlIGFuIGFsYXJtLCBhcyB0aGF0IHdpbGwgYmUgZG9uZSBieSBvdXIgY2FsbGVyLgogCiAgICAgICAg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5nIHVybCA9IHVyaS5nZXRRdWVyeVBhcmFtZXRlcigidXJsIik7CisgICAgICAgIGlmICh1cmwgIT0gbnVsbCkgeworICAgICAgICAgICAgcGFyc2VyID0gZ2V0VXJpWG1sUHVsbFBhcnNlcih1cmwpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgZmluYWwgU3RyaW5nIHJlc291cmNlID0gdXJpLmdldFF1ZXJ5UGFyYW1ldGVyKCJyZXNvdXJjZSIpOworICAgICAgICAgICAgaWYgKHJlc291cmNlICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBVcmkgcmVzb3VyY2VVcmkgPSBVcmkucGFyc2UoQ29udGVudFJlc29sdmVyLlNDSEVNRV9BTkRST0lEX1JFU09VUkNFICsgIjovLyIgKworICAgICAgICAgICAgICAgICAgICAgICAgZ2V0Q29udGV4dCgpLmdldFBhY2thZ2VOYW1lKCkgKyAiLyIgKyByZXNvdXJjZSk7CisgICAgICAgICAgICAgICAgcGFyc2VyID0gZ2V0UmVzb3VyY2VYbWxQdWxsUGFyc2VyKHJlc291cmNlVXJpKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIGlmIChwYXJzZXIgIT0gbnVsbCkgeworICAgICAgICAgICAgWE1MQ3Vyc29yIHhtbEN1cnNvciA9IG5ldyBYTUxDdXJzb3Ioc2VsZWN0aW9uLCBwcm9qZWN0aW9uKTsKKyAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgeG1sQ3Vyc29yLnBhcnNlV2l0aChwYXJzZXIpOworICAgICAgICAgICAgICAgIHJldHVybiB4bWxDdXJzb3I7CisgICAgICAgICAgICB9IGNhdGNoIChJT0V4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgTG9nLncoTE9HX1RBRywgIkkvTyBlcnJvciB3aGlsZSBwYXJzaW5nIFhNTCAiICsgdXJpLCBlKTsKKyAgICAgICAgICAgIH0gY2F0Y2ggKFhtbFB1bGxQYXJzZXJFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgIExvZy53KExPR19UQUcsICJFcnJvciB3aGlsZSBwYXJzaW5nIFhNTCAiICsgdXJpLCBlKTsKKyAgICAgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICAgICAgaWYgKG1IdHRwQ2xpZW50ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgbUh0dHBDbGllbnQuY2xvc2UoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gbnVsbDsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBDcmVhdGVzIGFuIFhtbFB1bGxQYXJzZXIgZm9yIHRoZSBwcm92aWRlZCBVUkwuIENhbiBiZSBvdmVybG9hZGVkIHRvIHByb3ZpZGUgeW91ciBvd24gcGFyc2VyLgorICAgICAqIEBwYXJhbSB1cmwgVGhlIFVSTCBvZiB0aGUgWE1MIGRvY3VtZW50IHRoYXQgaXMgdG8gYmUgcGFyc2VkLgorICAgICAqIEByZXR1cm4gQW4gWG1sUHVsbFBhcnNlciBvbiB0aGlzIGRvY3VtZW50LgorICAgICAqLworICAgIHByb3RlY3RlZCBYbWxQdWxsUGFyc2VyIGdldFVyaVhtbFB1bGxQYXJzZXIoU3RyaW5nIHVybCkgeworICAgICAgICBYbWxQdWxsUGFyc2VyIHBhcnNlciA9IG51bGw7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBYbWxQdWxsUGFyc2VyRmFjdG9yeSBmYWN0b3J5ID0gWG1sUHVsbFBhcnNlckZhY3RvcnkubmV3SW5zdGFuY2UoKTsKKyAgICAgICAgICAgIGZhY3Rvcnkuc2V0TmFtZXNwYWNlQXdhcmUodHJ1ZSk7CisgICAgICAgICAgICBwYXJzZXIgPSBmYWN0b3J5Lm5ld1B1bGxQYXJzZXIoKTsKKyAgICAgICAgfSBjYXRjaCAoWG1sUHVsbFBhcnNlckV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICBMb2cuZShMT0dfVEFHLCAiVW5hYmxlIHRvIGNyZWF0ZSBYbWxQdWxsUGFyc2VyIiwgZSk7CisgICAgICAgICAgICByZXR1cm4gbnVsbDsKKyAgICAgICAgfQorCisgICAgICAgIElucHV0U3RyZWFtIGlucHV0U3RyZWFtID0gbnVsbDsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIGZpbmFsIEh0dHBHZXQgZ2V0ID0gbmV3IEh0dHBHZXQodXJsKTsKKyAgICAgICAgICAgIG1IdHRwQ2xpZW50ID0gQW5kcm9pZEh0dHBDbGllbnQubmV3SW5zdGFuY2UoIkFuZHJvaWQiKTsKKyAgICAgICAgICAgIEh0dHBSZXNwb25zZSByZXNwb25zZSA9IG1IdHRwQ2xpZW50LmV4ZWN1dGUoZ2V0KTsKKyAgICAgICAgICAgIGlmIChyZXNwb25zZS5nZXRTdGF0dXNMaW5lKCkuZ2V0U3RhdHVzQ29kZSgpID09IEh0dHBTdGF0dXMuU0NfT0spIHsKKyAgICAgICAgICAgICAgICBmaW5hbCBIdHRwRW50aXR5IGVudGl0eSA9IHJlc3BvbnNlLmdldEVudGl0eSgpOworICAgICAgICAgICAgICAgIGlmIChlbnRpdHkgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICBpbnB1dFN0cmVhbSA9IGVudGl0eS5nZXRDb250ZW50KCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9IGNhdGNoIChJT0V4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICBMb2cudyhMT0dfVEFHLCAiRXJyb3Igd2hpbGUgcmV0cmlldmluZyBYTUwgZmlsZSAiICsgdXJsLCBlKTsKKyAgICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICB9CisKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIHBhcnNlci5zZXRJbnB1dChpbnB1dFN0cmVhbSwgbnVsbCk7CisgICAgICAgIH0gY2F0Y2ggKFhtbFB1bGxQ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gICAgY3JlYXRlUHJvamVjdGlvblBhdHRlcm4ocHJvamVjdGlvbnMpOworICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSBQYXR0ZXJuIGNyZWF0ZVBhdHRlcm4oU3RyaW5nIGlucHV0KSB7CisgICAgICAgICAgICBTdHJpbmcgcGF0dGVybiA9IGlucHV0LnJlcGxhY2VBbGwoIi8vIiwgIi8oLiovfCkiKS5yZXBsYWNlQWxsKCJeLyIsICJeLyIpICsgIiQiOworICAgICAgICAgICAgcmV0dXJuIFBhdHRlcm4uY29tcGlsZShwYXR0ZXJuKTsKKyAgICAgICAgfQorCisgICAgICAgIHByaXZhdGUgdm9pZCBjcmVhdGVQcm9qZWN0aW9uUGF0dGVybihTdHJpbmdbXSBwcm9qZWN0aW9ucykgeworICAgICAgICAgICAgbVByb2plY3Rpb25QYXR0ZXJucyA9IG5ldyBQYXR0ZXJuW21OdW1iZXJPZlByb2plY3Rpb25zXTsKKyAgICAgICAgICAgIG1BdHRyaWJ1dGVOYW1lcyA9IG5ldyBTdHJpbmdbbU51bWJlck9mUHJvamVjdGlvbnNdOworICAgICAgICAgICAgbUFjdGl2ZVRleHREZXB0aE1hc2sgPSBuZXcgQml0U2V0W21OdW1iZXJPZlByb2plY3Rpb25zXTsKKyAgICAgICAgICAgIC8vIEFkZCBhIGNvbHVtbiB0byBzdG9yZSBfSUQKKyAgICAgICAgICAgIG1DdXJyZW50VmFsdWVzID0gbmV3IFN0cmluZ1ttTnVtYmVyT2ZQcm9qZWN0aW9ucyArIDFdOworCisgICAgICAgICAgICBmb3IgKGludCBpPTA7IGk8bU51bWJlck9mUHJvamVjdGlvbnM7IGkrKykgeworICAgICAgICAgICAgICAgIG1BY3RpdmVUZXh0RGVwdGhNYXNrW2ldID0gbmV3IEJpdFNldCgpOworICAgICAgICAgICAgICAgIFN0cmluZyBwcm9qZWN0aW9uID0gcHJvamVjdGlvbnNbaSArIDFdOyAvLyArMSB0byBza2lwIHRoZSBfSUQgY29sdW1uCisgICAgICAgICAgICAgICAgaW50IGF0SW5kZXggPSBwcm9qZWN0aW9uLmxhc3RJbmRleE9mKCdAJywgcHJvamVjdGlvbi5sZW5ndGgoKSk7CisgICAgICAgICAgICAgICAgaWYgKGF0SW5kZXggPj0gMCkgeworICAgICAgICAgICAgICAgICAgICBtQXR0cmlidXRlTmFtZXNbaV0gPSBwcm9qZWN0aW9uLnN1YnN0cmluZyhhdEluZGV4KzEpOworICAgICAgICAgICAgICAgICAgICBwcm9qZWN0aW9uID0gcHJvamVjdGlvbi5zdWJzdHJpbmcoMCwgYXRJbmRleCk7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgbUF0dHJpYnV0ZU5hbWVzW2ldID0gbnVsbDsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAvLyBDb25mb3JtcyB0byBYUGF0aCBzdGFuZGFyZDogcmVmZXJlbmNlIHRvIGxvY2FsIGNvbnRleHQgc3RhcnRzIHdpdGggYSAuCisgICAgICAgICAgICAgICAgaWYgKHByb2plY3Rpb24uY2hhckF0KDApID09ICcuJykgeworICAgICAgICAgICAgICAgICAgICBwcm9qZWN0aW9uID0gcHJvamVjdGlvbi5zdWJzdHJpbmcoMSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIG1Qcm9qZWN0aW9uUGF0dGVybnNbaV0gPSBjcmVhdGVQYXR0ZXJuKHByb2plY3Rpb24pOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgcGFyc2VXaXRoKFhtbFB1bGxQYXJzZXIgcGFyc2VyKSB0aHJvd3MgSU9FeGNlcHRpb24sIFhtbFB1bGxQYXJzZXJFeGNlcHRpb24geworICAgICAgICAgICAgU3RyaW5nQnVpbGRlciBwYXRoID0gbmV3IFN0cmluZ0J1aWxkZXIoKTsKKyAgICAgICAgICAgIFN0YWNrPEludGVnZXI+IHBhdGhMZW5ndGhTdGFjayA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pOworICAgICAgICAgICAgICAgICAgICBwYXRoLmFwcGVuZCgnLycpOworICAgICAgICAgICAgICAgICAgICBTdHJpbmcgcHJlZml4ID0gbnVsbDsKKyAgICAgICAgICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIGdldFByZWZpeCBpcyBub3Qgc3VwcG9ydGVkIGJ5IGxvY2FsIFhtbCByZXNvdXJjZSBwYXJzZXIKKyAgICAgICAgICAgICAgICAgICAgICAgIHByZWZpeCA9IHBhcnNlci5nZXRQcmVmaXgoKTsKKyAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoUnVudGltZUV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBwcmVmaXggPSBudWxsOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGlmIChwcmVmaXggIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgcGF0aC5hcHBlbmQocHJlZml4KTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHBhdGguYXBwZW5kKCc6Jyk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgcGF0aC5hcHBlbmQocGFyc2VyLmdldE5hbWUoKSk7CisKKyAgICAgICAgICAgICAgICAgICAgaWYgKGN1cnJlbnROb2RlRGVwdGggPj0gMCkgeworICAgICAgICAgICAgICAgICAgICAgICAgY3VycmVudE5vZGVEZXB0aCsrOworICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAgICAgLy8gQSBub2RlIG1hdGNoaW5nIHNlbGVjdGlvbiBpcyBmb3VuZDogaW5pdGlhbGl6ZSBjaGlsZCBwYXJzaW5nIG1vZGUKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtU2VsZWN0aW9uUGF0dGVybi5tYXRjaGVyKHBhdGgudG9TdHJpbmcoKSkubWF0Y2hlcygpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VycmVudE5vZGVEZXB0aCA9IDA7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VycmVudE5vZGVQYXRoU3RhcnRJbmRleCA9IHBhdGgubGVuZ3RoKCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUN1cnJlbnRWYWx1ZXNbMF0gPSBJbnRlZ2VyLnRvU3RyaW5nKGdldENvdW50KCkpOyAvLyBfSUQKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IG1OdW1iZXJPZlByb2plY3Rpb25zOyBpKyspIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gUmVzZXQgdmFsdWVzIHRvIGRlZmF1bHQgKGVtcHR5IHN0cmluZykKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUN1cnJlbnRWYWx1ZXNbaSArIDFdID0gIiI7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1BY3RpdmVUZXh0RGVwdGhNYXNrW2ldLmNsZWFyKCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgICAgLy8gVGhpcyB0ZXN0IGhhcyB0byBiZSBzZXBhcmF0ZWQgZnJvbSB0aGUgcHJldmlvdXMgb25lIGFzIGN1cnJlbnROb2RlRGVwdGggY2FuCisgICAgICAgICAgICAgICAgICAgIC8vIGJlIG1vZGlmaWVkIGFib3ZlICh3aGVuIGEgbm9kZSBtYXRjaGluZyBzZWxlY3Rpb24gaXMgZm91bmQpLgorICAgICAgICAgICAgICAgICAgICBpZiAoY3VycmVudE5vZGVEZXB0aCA+PSAwKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBmaW5hbCBTdHJpbmcgbG9jYWxOb2RlUGF0aCA9IHBhdGguc3Vic3RyaW5nKGN1cnJlbnROb2RlUGF0aFN0YXJ0SW5kZXgpOworICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBtTnVtYmVyT2ZQcm9qZWN0aW9uczsgaSsrKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1Qcm9qZWN0aW9uUGF0dGVybnNbaV0ubWF0Y2hlcihsb2NhbE5vZGVQYXRoKS5tYXRjaGVzKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgU3RyaW5nIGF0dHJpYnV0ZSA9IG1BdHRyaWJ1dGVOYW1lc1tpXTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGF0dHJpYnV0ZSAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtQ3VycmVudFZhbHVlc1tpICsgMV0gPQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcnNlci5nZXRBdHRyaWJ1dGVWYWx1ZShudWxsLCBhdHRyaWJ1dGUpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUFjdGl2ZVRleHREZXB0aE1hc2tbaV0uc2V0KGN1cnJlbnROb2RlRGVwdGgsIHRydWUpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGV2ZW50VHlwZSA9PSBYbWxQdWxsUGFyc2VyLkVORF9UQUcpIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gUG9wIGxhc3Qgbm9kZSBmcm9tIHBhdGgKKyAgICAgICAgICAgICAgICAgICAgZmluYWwgaW50IGxlbmd0aCA9IHBhdGhMZW5ndGhTdGFjay5wb3AoKTsKKyAgICAgICAgICAgICAgICAgICAgcGF0aC5zZXRMZW5ndGgobGVuZ3RoKTsKKworICAgICAgICAgICAgICAgICAgICBpZiAoY3VycmVudE5vZGVEZXB0aCA+PSAwKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoY3VycmVudE5vZGVEZXB0aCA9PSAwKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gTGVhdmluZyBhIHNlbGVjdGlvbiBtYXRjaGluZyBub2RlOiBhZGQgYSBuZXcgcm93IHdpdGggcmVzdWx0cworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFkZFJvdyhtQ3VycmVudFZhbHVlcyk7CisgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbU51bWJlck9mUHJvamVjdGlvbnM7IGkrKykgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtQWN0aXZlVGV4dERlcHRoTWFza1tpXS5zZXQoY3VycmVudE5vZGVEZXB0aCwgZmFsc2UpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIGN1cnJlbnROb2RlRGVwdGgtLTsKKyAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgfSBlbHNlIGlmICgoZXZlbnRUeXBlID09IFhtbFB1bGxQYXJzZXIuVEVYVCkgJiYgKCFwYXJzZXIuaXNXaGl0ZXNwYWNlKCkpKSB7CisgICAgICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbU51bWJlck9mUHJvamVjdGlvbnM7IGkrKykgeworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKChjdXJyZW50Tm9kZURlcHRoID49IDApICYmCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgKG1BY3RpdmVUZXh0RGVwdGhNYXNrW2ldLmdldChjdXJyZW50Tm9kZURlcHRoKSkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBtQ3VycmVudFZhbHVlc1tpICsgMV0gKz0gcGFyc2VyLmdldFRleHQoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIGV2ZW50VHlwZSA9IHBhcnNlci5uZXh0KCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9Cit9CmRpZmYgLS1naXQgYS9jb3JlL2phdmEvYW5kcm9pZC9jb250ZW50L3BtL0FjdGl2aXR5SW5mby5qYXZhIGIvY29yZS9qYXZhL2FuZHJvaWQvY29udGVudC9wbS9BY3Rpdml0eUluZm8uamF2YQppbmRleCAzNjRjOTFlLi5lMjFjYjk3IDEwMDY0NAotLS0gYS9jb3JlL2phdmEvYW5kcm9pZC9jb250ZW50L3BtL0FjdGl2aXR5SW5mby5qYXZhCisrKyBiL2NvcmUvamF2YS9hbmRyb2lkL2NvbnRlbnQvcG0vQWN0aXZpdHlJbmZvLmphdmEKQEAgLTE2Niw2ICsxNjYsMTEgQEAKICAgICAgKi8KICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGludCBGTEFHX0lNTUVSU0lWRSA9IDB4MDIwMDsKICAgICAvKioKKyAgICAgKiBWYWx1ZSBmb3Ige0BsaW5rICNmbGFnc306IHRydWUgd2hlbiB0aGUgYXBwbGljYXRpb24ncyByZW5kZXJpbmcgc2hvdWxkCisgICAgICogYmUgaGFyZHdhcmUgYWNjZWxlcmF0ZWQuCisgICAgICovCisgICAgcHVibGljIHN0YXRpYyBmaW5hbCBpbnQgRkxBR19IQVJEV0FSRV9BQ0NFTEVSQVRFRCA9IDB4MDQwMDsKKyAgICAvKioKICAgICAgKiBPcHRpb25zIHRoYXQgaGF2ZSBiZWVuIHNldCBpbiB0aGUgYWN0aXZpdHkgZGVjbGFyYXRpb24gaW4gdGhlCiAgICAgICogbWFuaWZ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kVfTU9ERTsKICAgICAgICAgfQogCisgICAgICAgIGJvb2xlYW4gaGFyZHdhcmVBY2NlbGVyYXRlZCA9IHNhLmdldEJvb2xlYW4oCisgICAgICAgICAgICAgICAgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHlsZWFibGUuQW5kcm9pZE1hbmlmZXN0QXBwbGljYXRpb25faGFyZHdhcmVBY2NlbGVyYXRlZCwKKyAgICAgICAgICAgICAgICBmYWxzZSk7CisKICAgICAgICAgaWYgKHNhLmdldEJvb2xlYW4oCiAgICAgICAgICAgICAgICAgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHlsZWFibGUuQW5kcm9pZE1hbmlmZXN0QXBwbGljYXRpb25faGFzQ29kZSwKICAgICAgICAgICAgICAgICB0cnVlKSkgewpAQCAtMTYzMiw3ICsxNjMyLDggQEAKIAogICAgICAgICAgICAgU3RyaW5nIHRhZ05hbWUgPSBwYXJzZXIuZ2V0TmFtZSgpOwogICAgICAgICAgICAgaWYgKHRhZ05hbWUuZXF1YWxzKCJhY3Rpdml0eSIpKSB7Ci0gICAgICAgICAgICAgICAgQWN0aXZpdHkgYSA9IHBhcnNlQWN0aXZpdHkob3duZXIsIHJlcywgcGFyc2VyLCBhdHRycywgZmxhZ3MsIG91dEVycm9yLCBmYWxzZSk7CisgICAgICAgICAgICAgICAgQWN0aXZpdHkgYSA9IHBhcnNlQWN0aXZpdHkob3duZXIsIHJlcywgcGFyc2VyLCBhdHRycywgZmxhZ3MsIG91dEVycm9yLCBmYWxzZSwKKyAgICAgICAgICAgICAgICAgICAgICAgIGhhcmR3YXJlQWNjZWxlcmF0ZWQpOwogICAgICAgICAgICAgICAgIGlmIChhID09IG51bGwpIHsKICAgICAgICAgICAgICAgICAgICAgbVBhcnNlRXJyb3IgPSBQYWNrYWdlTWFuYWdlci5JTlNUQUxMX1BBUlNFX0ZBSUxFRF9NQU5JRkVTVF9NQUxGT1JNRUQ7CiAgICAgICAgICAgICAgICAgICAgIHJldHVyb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QobmF2aWdhdGlvbkhpZGRlbik7CiAgICAgICAgIHNiLmFwcGVuZCgiIG9yaWVuPSIpOwotICAgICAgICBzYi5hcHBlbmQob3JpZW50YXRpb24pOwotICAgICAgICBzYi5hcHBlbmQoIiBsYXlvdXQ9Iik7Ci0gICAgICAgIHNiLmFwcGVuZChzY3JlZW5MYXlvdXQpOwotICAgICAgICBzYi5hcHBlbmQoIiB1aU1vZGU9Iik7Ci0gICAgICAgIHNiLmFwcGVuZCh1aU1vZGUpOworICAgICAgICBzd2l0Y2gob3JpZW50YXRpb24pIHsKKyAgICAgICAgICAgIGNhc2UgT1JJRU5UQVRJT05fTEFORFNDQVBFOgorICAgICAgICAgICAgICAgIHNiLmFwcGVuZCgiTCIpOyBicmVhazsKKyAgICAgICAgICAgIGNhc2UgT1JJRU5UQVRJT05fUE9SVFJBSVQ6CisgICAgICAgICAgICAgICAgc2IuYXBwZW5kKCJQIik7IGJyZWFrOworICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICBzYi5hcHBlbmQob3JpZW50YXRpb24pOworICAgICAgICB9CisgICAgICAgIHNiLmFwcGVuZCgiIGxheW91dD0weCIpOworICAgICAgICBzYi5hcHBlbmQoamF2YS5sYW5nLkludGVnZXIudG9IZXhTdHJpbmcoc2NyZWVuTGF5b3V0KSk7CisgICAgICAgIHNiLmFwcGVuZCgiIHVpTW9kZT0weCIpOworICAgICAgICBzYi5hcHBlbmQoamF2YS5sYW5nLkludGVnZXIudG9IZXhTdHJpbmcodWlNb2RlKSk7CiAgICAgICAgIGlmIChzZXEgIT0gMCkgewogICAgICAgICAgICAgc2IuYXBwZW5kKCIgc2VxPSIpOwogICAgICAgICAgICAgc2IuYXBwZW5kKHNlcSk7CmRpZmYgLS1naXQgYS9jb3JlL2phdmEvYW5kcm9pZC9jb250ZW50L3Jlcy9QbHVyYWxSdWxlcy5qYXZhIGIvY29yZS9qYXZhL2FuZHJvaWQvY29udGVudC9yZXMvUGx1cmFsUnVsZX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HlwZXMuaAotICAgICAgICBzd2l0Y2ggKHF1YW50aXR5KSB7Ci0gICAgICAgICAgICBjYXNlIFFVQU5USVRZX1pFUk86IHJldHVybiAweDAxMDAwMDA1OwotICAgICAgICAgICAgY2FzZSBRVUFOVElUWV9PTkU6ICByZXR1cm4gMHgwMTAwMDAwNjsKLSAgICAgICAgICAgIGNhc2UgUVVBTlRJVFlfVFdPOiAgcmV0dXJuIDB4MDEwMDAwMDc7Ci0gICAgICAgICAgICBjYXNlIFFVQU5USVRZX0ZFVzogIHJldHVybiAweDAxMDAwMDA4OwotICAgICAgICAgICAgY2FzZSBRVUFOVElUWV9NQU5ZOiByZXR1cm4gMHgwMTAwMDAwOTsKLSAgICAgICAgICAgIGRlZmF1bHQ6ICAgICAgICAgICAgcmV0dXJuIElEX09USEVSOwotICAgICAgICB9Ci0gICAgfQotCi0gICAgc3RhdGljIGZpbmFsIFN0cmluZyBzdHJpbmdGb3JRdWFudGl0eShpbnQgcXVhbnRpdHkpIHsKLSAgICAgICAgc3dpdGNoIChxdWFudGl0eSkgewotICAgICAgICAgICAgY2FzZSBRVUFOVElUWV9aRVJPOgotICAgICAgICAgICAgICAgIHJldHVybiAiemVybyI7Ci0gICAgICAgICAgICBjYXNlIFFVQU5USVRZX09ORToKLSAgICAgICAgICAgICAgICByZXR1cm4gIm9uZSI7Ci0gICAgICAgICAgICBjYXNlIFFVQU5USVRZX1RXTzoKLSAgICAgICAgICAgICAgICByZXR1cm4gInR3byI7Ci0gICAgICAgICAgICBjYXNlIFFVQU5USVRZX0ZFVzoKLSAgICAgICAgICAgICAgICByZXR1cm4gImZldyI7Ci0gICAgICAgICAgICBjYXNlIFFVQU5USVRZX01BTlk6Ci0gICAgICAgICAgICAgICAgcmV0dXJuICJtYW55IjsKLSAgICAgICAgICAgIGRlZmF1bHQ6Ci0gICAgICAgICAgICAgICAgcmV0dXJuICJvdGhlciI7Ci0gICAgICAgIH0KLSAgICB9Ci0KLSAgICBzdGF0aWMgZmluYWwgUGx1cmFsUnVsZXMgcnVsZUZvckxvY2FsZShMb2NhbGUgbG9jYWxlKSB7Ci0gICAgICAgIFN0cmluZyBsYW5nID0gbG9jYWxlLmdldExhbmd1YWdlKCk7Ci0gICAgICAgIGlmICgiY3MiLmVxdWFscyhsYW5nKSkgewotICAgICAgICAgICAgaWYgKGNzID09IG51bGwpIGNzID0gbmV3IGNzKCk7Ci0gICAgICAgICAgICByZXR1cm4gY3M7Ci0gICAgICAgIH0KLSAgICAgICAgZWxzZSB7Ci0gICAgICAgICAgICBpZiAoZW4gPT0gbnVsbCkgZW4gPSBuZXcgZW4oKTsKLSAgICAgICAgICAgIHJldHVybiBlbjsKLSAgICAgICAgfQotICAgIH0KLQotICAgIHByaXZhdGUgc3RhdGljIFBsdXJhbFJ1bGVzIGNzOwotICAgIHByaXZhdGUgc3RhdGljIGNsYXNzIGNzIGV4dGVuZHMgUGx1cmFsUnVsZXMgewotICAgICAgICBpbnQgcXVhbnRpdHlGb3JOdW1iZXIoaW50IG4pIHsKLSAgICAgICAgICAgIGlmIChuID09IDEpIHsKLSAgICAgICAgICAgICAgICByZXR1cm4gUVVBTlRJVFlfT05FOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgZWxzZSBpZiAobiA+PSAyICYmIG4gPD0gNCkgewotICAgICAgICAgICAgICAgIHJldHVybiBRVUFOVElUWV9GRVc7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBlbHNlIHsKLSAgICAgICAgICAgICAgICByZXR1cm4gUVVBTlRJVFlfT1RIRVI7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLSAgICB9Ci0KLSAgICBwcml2YXRlIHN0YXRpYyBQbHVyYWxSdWxlcyBlbjsKLSAgICBwcml2YXRlIHN0YXRpYyBjbGFzcyBlbiBleHRlbmRzIFBsdXJhbFJ1bGVzIHsKLSAgICAgICAgaW50IHF1YW50aXR5Rm9yTnVtYmVyKGludCBuKSB7Ci0gICAgICAgICAgICBpZiAobiA9PSAxKSB7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pdHkpIHRocm93cyBOb3RGb3VuZEV4Y2VwdGlvbiB7Ci0gICAgICAgIFBsdXJhbFJ1bGVzIHJ1bGUgPSBnZXRQbHVyYWxSdWxlKCk7Ci0gICAgICAgIENoYXJTZXF1ZW5jZSByZXMgPSBtQXNzZXRzLmdldFJlc291cmNlQmFnVGV4dChpZCwgcnVsZS5hdHRyRm9yTnVtYmVyKHF1YW50aXR5KSk7CisgICAgICAgIE5hdGl2ZVBsdXJhbFJ1bGVzIHJ1bGUgPSBnZXRQbHVyYWxSdWxlKCk7CisgICAgICAgIENoYXJTZXF1ZW5jZSByZXMgPSBtQXNzZXRzLmdldFJlc291cmNlQmFnVGV4dChpZCwKKyAgICAgICAgICAgICAgICBhdHRyRm9yUXVhbnRpdHlDb2RlKHJ1bGUucXVhbnRpdHlGb3JJbnQocXVhbnRpdHkpKSk7CiAgICAgICAgIGlmIChyZXMgIT0gbnVsbCkgewogICAgICAgICAgICAgcmV0dXJuIHJlczsKICAgICAgICAgfQotICAgICAgICByZXMgPSBtQXNzZXRzLmdldFJlc291cmNlQmFnVGV4dChpZCwgUGx1cmFsUnVsZXMuSURfT1RIRVIpOworICAgICAgICByZXMgPSBtQXNzZXRzLmdldFJlc291cmNlQmFnVGV4dChpZCwgSURfT1RIRVIpOwogICAgICAgICBpZiAocmVzICE9IG51bGwpIHsKICAgICAgICAgICAgIHJldHVybiByZXM7CiAgICAgICAgIH0KICAgICAgICAgdGhyb3cgbmV3IE5vdEZvdW5kRXhjZXB0aW9uKCJQbHVyYWwgcmVzb3VyY2UgSUQgIzB4IiArIEludGVnZXIudG9IZXhTdHJpbmcoaWQpCiAgICAgICAgICAgICAgICAgKyAiIHF1YW50aXR5PSIgKyBxdWFudGl0eQotICAgICAgICAgICAgICAgICsgIiBpdGVtPSIgKyBQbHVyYWxSdWxlcy5zdHJpbmdGb3JRdWFudGl0eShydWxlLnF1YW50aXR5Rm9yTnVtYmVyKHF1YW50aXR5KSkpOworICAgICAgICAgICAgICAgICs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HVyYWxSdWxlcy5NQU5ZOiByZXR1cm4gMHgwMTAwMDAwOTsKKyAgICAgICAgICAgIGRlZmF1bHQ6ICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIElEX09USEVSOworICAgICAgICB9CisgICAgfQorCisgICAgcHJpdmF0ZSBzdGF0aWMgU3RyaW5nIHN0cmluZ0ZvclF1YW50aXR5Q29kZShpbnQgcXVhbnRpdHlDb2RlKSB7CisgICAgICAgIHN3aXRjaCAocXVhbnRpdHlDb2RlKSB7CisgICAgICAgICAgICBjYXNlIE5hdGl2ZVBsdXJhbFJ1bGVzLlpFUk86IHJldHVybiAiemVybyI7CisgICAgICAgICAgICBjYXNlIE5hdGl2ZVBsdXJhbFJ1bGVzLk9ORTogIHJldHVybiAib25lIjsKKyAgICAgICAgICAgIGNhc2UgTmF0aXZlUGx1cmFsUnVsZXMuVFdPOiAgcmV0dXJuICJ0d28iOworICAgICAgICAgICAgY2FzZSBOYXRpdmVQbHVyYWxSdWxlcy5GRVc6ICByZXR1cm4gImZldyI7CisgICAgICAgICAgICBjYXNlIE5hdGl2ZVBsdXJhbFJ1bGVzLk1BTlk6IHJldHVybiAibWFueSI7CisgICAgICAgICAgICBkZWZhdWx0OiAgICAgICAgICAgICAgICAgICAgIHJldHVybiAib3RoZXIiOworICAgICAgICB9CisgICAgfQorCiAgICAgLyoqCiAgICAgICogUmV0dXJuIHRoZSBzdHJpbmcgdmFsdWUgYXNzb2NpYXRlZCB3aXRoIGEgcGFydGljdWxhciByZXNvdXJjZSBJRC4gIEl0CiAgICAgICogd2lsbCBiZSBzdHJpcHBlZCBvZiBhbnkgc3R5bGVkIHRleHQgaW5mb3JtYXRpb24uCkBAIC0yOTUsNiArMzI5LDkgQEAKICAgICAgKiBzdHJpcHBlZCBvZiBhbnkgc3R5bGVkIHRleHQgaW5mb3JtYXRpb24uCiAgICAgICoge0Btb3JlfQogICAgICAqCisgICAgICogPHA+U2VlIDxhIGhyZWY9IntAZG9jUm9vdH1ndWlkZS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XgsIHNob3J0IHZhbHVlKSB7Ci0gICAgICAgIHJldHVybiB1cGRhdGUoY29sdW1uSW5kZXgsIFNob3J0LnZhbHVlT2YodmFsdWUpKTsKLSAgICB9Ci0KLSAgICAvKioKLSAgICAgKiBAaGlkZQotICAgICAqIEBkZXByZWNhdGVkCi0gICAgICovCi0gICAgcHVibGljIGJvb2xlYW4gdXBkYXRlSW50KGludCBjb2x1bW5JbmRleCwgaW50IHZhbHVlKSB7Ci0gICAgICAgIHJldHVybiB1cGRhdGUoY29sdW1uSW5kZXgsIEludGVnZXIudmFsdWVPZih2YWx1ZSkpOwotICAgIH0KLQotICAgIC8qKgotICAgICAqIEBoaWRlCi0gICAgICogQGRlcHJlY2F0ZWQKLSAgICAgKi8KLSAgICBwdWJsaWMgYm9vbGVhbiB1cGRhdGVMb25nKGludCBjb2x1bW5JbmRleCwgbG9uZyB2YWx1ZSkgewotICAgICAgICByZXR1cm4gdXBkYXRlKGNvbHVtbkluZGV4LCBMb25nLnZhbHVlT2YodmFsdWUpKTsKLSAgICB9Ci0KLSAgICAvKioKLSAgICAgKiBAaGlkZQotICAgICAqIEBkZXByZWNhdGVkCi0gICAgICovCi0gICAgcHVibGljIGJvb2xlYW4gdXBkYXRlRmxvYXQoaW50IGNvbHVtbkluZGV4LCBmbG9hdCB2YWx1ZSkgewotICAgICAgICByZXR1cm4gdXBkYXRlKGNvbHVtbkluZGV4LCBGbG9hdC52YWx1ZU9mKHZhbHVlKSk7Ci0gICAgfQotCi0gICAgLyoqCi0gICAgICogQGhpZGUKLSAgICAgKiBAZGVwcmVjYXRlZAotICAgICAqLwotICAgIHB1YmxpYyBib29sZWFuIHVwZGF0ZURvdWJsZShpbnQgY29sdW1uSW5kZXgsIGRvdWJsZSB2YWx1ZSkgewotICAgICAgICByZXR1cm4gdXBkYXRlKGNvbHVtbkluZGV4LCBEb3VibGUudmFsdWVPZih2YWx1ZSkpOwotICAgIH0KLQotICAgIC8qKgotICAgICAqIEBoaWRlCi0gICAg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AogICAgIEBPdmVycmlkZQotICAgIHB1YmxpYyBzaG9ydCBnZXRTaG9ydChpbnQgY29sdW1uSW5kZXgpCi0gICAgeworICAgIHB1YmxpYyBzaG9ydCBnZXRTaG9ydChpbnQgY29sdW1uSW5kZXgpIHsKICAgICAgICAgY2hlY2tQb3NpdGlvbigpOwotCi0gICAgICAgIHN5bmNocm9uaXplZChtVXBkYXRlZFJvd3MpIHsKLSAgICAgICAgICAgIGlmIChpc0ZpZWxkVXBkYXRlZChjb2x1bW5JbmRleCkpIHsKLSAgICAgICAgICAgICAgICBOdW1iZXIgdmFsdWUgPSAoTnVtYmVyKWdldFVwZGF0ZWRGaWVsZChjb2x1bW5JbmRleCk7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIHZhbHVlLnNob3J0VmFsdWUoKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCiAgICAgICAgIHJldHVybiBtV2luZG93LmdldFNob3J0KG1Qb3MsIGNvbHVtbkluZGV4KTsKICAgICB9CiAKICAgICBAT3ZlcnJpZGUKLSAgICBwdWJsaWMgaW50IGdldEludChpbnQgY29sdW1uSW5kZXgpCi0gICAgeworICAgIHB1YmxpYyBpbnQgZ2V0SW50KGludCBjb2x1bW5JbmRleCkgewogICAgICAgICBjaGVja1Bvc2l0aW9uKCk7Ci0KLSAgICAgICAgc3luY2hyb25pemVkKG1VcGRhdGVkUm93cykgewotICAgICAgICAgICAgaWYgKGlzRmllbGRVcGRhdGVkKGNvbHVtbkluZGV4KSkgewotICAgICAgICAgICAgICAgIE51bWJlciB2YWx1ZSA9IChOdW1iZXIpZ2V0VXBkYXRlZEZpZWxkKGNvbHVtbkluZGV4KTsKLSAgICAgICAgICAgICAgICByZXR1cm4gdmFsdWUuaW50VmFsdWUoKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCiAgICAgICAgIHJldHVybiBtV2luZG93LmdldEludChtUG9zLCBjb2x1bW5JbmRleCk7CiAgICAgfQogCiAgICAgQE92ZXJyaWRlCi0gICAgcHVibGljIGxvbmcgZ2V0TG9uZyhpbnQgY29sdW1uSW5kZXgpCi0gICAgeworICAgIHB1YmxpYyBsb25nIGdldExvbmcoaW50IGNvbHVtbkluZGV4KSB7CiAgICAgICAgIGNoZWNrUG9zaXRpb24oKTsKLQotICAgICAgICBzeW5jaHJvbml6ZWQobVVwZGF0ZWRSb3dzKSB7Ci0gICAgICAgICAgICBpZiAoaXNGaWVsZFVwZGF0ZWQoY29sdW1uSW5kZXgpKSB7Ci0gICAgICAgICAgICAgICAgTnVtYmVyIHZhbHVlID0gKE51bWJlcilnZXRVcGRhdGVkRmllbGQoY29sdW1uSW5kZXgpOwotICAgICAgICAgICAgICAgIHJldHVybiB2YWx1ZS5sb25nVmFsdWUoKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCiAgICAgICAgIHJldHVybiBtV2luZG93LmdldExvbmcobVBvcywgY29sdW1uSW5kZXgpOwogICAgIH0KIAogICAgIEBPdmVycmlkZQotICAgIHB1YmxpYyBmbG9hdCBnZXRGbG9hdChpbnQgY29sdW1uSW5kZXgpCi0gICAgeworICAgIHB1YmxpYyBmbG9hdCBnZXRGbG9hdChpbnQgY29sdW1uSW5kZXgpIHsKICAgICAgICAgY2hlY2tQb3NpdGlvbigpOwotCi0gICAgICAgIHN5bmNocm9uaXplZChtVXBkYXRlZFJvd3MpIHsKLSAgICAgICAgICAgIGlmIChpc0ZpZWxkVXBkYXRlZChjb2x1bW5JbmRleCkpIHsKLSAgICAgICAgICAgICAgICBOdW1iZXIgdmFsdWUgPSAoTnVtYmVyKWdldFVwZGF0ZWRGaWVsZChjb2x1bW5JbmRleCk7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIHZhbHVlLmZsb2F0VmFsdWUoKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCiAgICAgICAgIHJldHVybiBtV2luZG93LmdldEZsb2F0KG1Qb3MsIGNvbHVtbkluZGV4KTsKICAgICB9CiAKICAgICBAT3ZlcnJpZGUKLSAgICBwdWJsaWMgZG91YmxlIGdldERvdWJsZShpbnQgY29sdW1uSW5kZXgpCi0gICAgeworICAgIHB1YmxpYyBkb3VibGUgZ2V0RG91YmxlKGludCBjb2x1bW5JbmRleCkgewogICAgICAgICBjaGVja1Bvc2l0aW9uKCk7Ci0KLSAgICAgICAgc3luY2hyb25pemVkKG1VcGRhdGVkUm93cykgewotICAgICAgICAgICAgaWYgKGlzRmllbGRVcGRhdGVkKGNvbHVtbkluZGV4KSkgewotICAgICAgICAgICAgICAgIE51bWJlciB2YWx1ZSA9IChOdW1iZXIpZ2V0VXBkYXRlZEZpZWxkKGNvbHVtbkluZGV4KTsKLSAgICAgICAgICAgICAgICByZXR1cm4gdmFsdWUuZG91YmxlVmFsdWUoKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCiAgICAgICAgIHJldHVybiBtV2luZG93LmdldERvdWJsZShtUG9zLCBjb2x1bW5JbmRleCk7CiAgICAgfQogCiAgICAgQE92ZXJyaWRlCi0gICAgcHVibGljIGJvb2xlYW4gaXNOdWxsKGludCBjb2x1bW5JbmRleCkKLSAgICB7CisgICAgcHVibGljIGJvb2xlYW4gaXNOdWxsKGludCBjb2x1bW5JbmRleCkgewogICAgICAgICBjaGVja1Bvc2l0aW9uKCk7Ci0KLSAgICAgICAgc3luY2hyb25pemVkKG1VcGRhdGVkUm93cykgewotICAgICAgICAgICAgaWYgKGlzRmllbGRVcGRhdGVkKGNvbHVtbkluZGV4KSkgewotICAgICAgICAgICAgICAgIHJldHVybiBnZXRVcGRhdGVkRmllbGQoY29sdW1uSW5kZXgpID09IG51bGw7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQotICAgICAgICByZXR1cm4gbVdpbmRvdy5pc051bGwobVBvcywgY29sdW1uSW5kZXgpOworICAgICAgICByZXR1cm4gbVdpbmRvdy5nZXRUeXBlKG1Qb3MsIGNvbHVtbkluZGV4KSA9PSBDdXJzb3IuRklFTERfVFlQRV9OVUxMOwogICAgIH0KIAotICAgIHB1YmxpYyBib29sZWFuIGlzQmxvYihpbnQgY29sdW1uSW5kZXgpCi0gICAgewotICAgICAgICBjaGVja1Bvc2l0aW9uKCk7Ci0KLSAgICAgICAgc3luY2hyb25pemVkKG1VcGRhdGVkUm93cykgewotICAgICAgICAgICAgaWYgKGlzRmllbGRVcGRhdGVkKGNvbHVtbkluZGV4KSkgewotICAgICAgICAgICAgICAgIE9iamVjdCBvYmplY3QgPSBnZXRVcGRhdGVkRmllbGQoY29sdW1uSW5kZXgpOwotICAgICAgICAgICAgICAgIHJldHVybiBvYmplY3QgPT0gbnVsbCB8fCBvYmplY3QgaW5zdGFuY2VvZiBieXRlW107Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQotICAgICAgICByZXR1cm4gbVdpbmRvdy5pc0Jsb2IobVBvcywgY29sdW1uSW5kZXgpOworICAgIC8qKgorICAgICAqIEBkZXByZWNhdGVkIFVzZSB7QGxpbmsgI2dldFR5cGV9CisgICAgICovCisgICAgQERlcHJlY2F0ZWQKKyAgICBwdWJsaWMgYm9vbGVhbiBpc0Jsb2IoaW50IGNvbHVtbkluZGV4KSB7CisgICAgICAgIHJldHVybiBnZXRUeXBlKGNvbHVtbkluZGV4KSA9PSBDdXJzb3IuRklFTERfVFlQRV9CTE9COwogICAgIH0KIAotICAgIHB1YmxpYyBib29sZWFuIGlzU3RyaW5nKGludCBjb2x1bW5JbmRleCkKLSAgICB7Ci0gICAgICAgIGNoZWNrUG9zaXRpb24oKTsKLQotICAgICAgICBzeW5jaHJvbml6ZWQobVVwZGF0ZWRSb3dzKSB7Ci0gICAgICAgICAgICBpZiAoaXNGaWVsZFVwZGF0ZWQoY29sdW1uSW5kZXgpKSB7Ci0gICAgICAgICAgICAgICAgT2JqZWN0IG9iamVjdCA9IGdldFVwZGF0ZWRGaWVsZChjb2x1bW5JbmRleCk7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIG9iamVjdCA9PSBudWxsIHx8IG9iamVjdCBpbnN0YW5jZW9mIFN0cmluZzsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCi0gICAgICAgIHJldHVybiBtV2luZG93LmlzU3RyaW5nKG1Qb3MsIGNvbHVtbkluZGV4KTsKKyAgICAvKioKKyAgICAgKiBAZGVwcmVjYXRlZCBVc2Uge0BsaW5rICNnZXRUeXBlfQorICAgICAqLworICAgIEBEZXByZWNhdGVkCisgICAgcHVibGljIGJvb2xlYW4gaXNTdHJpbmcoaW50IGNvbHVtbkluZGV4KSB7CisgICAgICAgIHJldHVybiBnZXRUeXBlKGNvbHVtbkluZGV4KSA9PSBDdXJzb3IuRklFTERfVFlQRV9TVFJJTkc7CiAgICAgfQogCi0gICAgcHVibGljIGJvb2xlYW4gaXNMb25nKGludCBjb2x1bW5JbmRleCkKLSAgICB7Ci0gICAgICAgIGNoZWNrUG9zaXRpb24oKTsKLQotICAgICAgICBzeW5jaHJvbml6ZWQobVVwZGF0ZWRSb3dzKSB7Ci0gICAgICAgICAgICBpZiAoaXNGaWVsZFVwZGF0ZWQoY29sdW1uSW5kZXgpKSB7Ci0gICAgICAgICAgICAgICAgT2JqZWN0IG9iamVjdCA9IGdldFVwZGF0ZWRGaWVsZChjb2x1bW5JbmRleCk7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIG9iamVjdCAhPSBudWxsICYmIChvYmplY3QgaW5zdGFuY2VvZiBJbnRlZ2VyIHx8IG9iamVjdCBpbnN0YW5jZW9mIExvbmcpOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgcmV0dXJuIG1XaW5kb3cuaXNMb25nKG1Qb3MsIGNvbHVtbkluZGV4KTsKKyAgICAvKioKKyAgICAgKiBAZGVwcmVjYXRlZCBVc2Uge0BsaW5rICNnZXRUeXBlfQorICAgICAqLworICAgIEBEZXByZWNhdGVkCisgICAgcHVibGljIGJvb2xlYW4gaXNMb25nKGludCBjb2x1bW5JbmRleCkgeworICAgICAgICByZXR1cm4gZ2V0VHlwZShjb2x1bW5JbmRleCkgPT0gQ3Vyc29yLkZJRUxEX1RZUEVfSU5URUdFUjsKICAgICB9CiAKLSAgICBwdWJsaWMgYm9vbGVhbiBpc0Zsb2F0KGludCBjb2x1bW5JbmRleCkKLSAgICB7Ci0gICAgICAgIGNoZWNrUG9zaXRpb24oKTsKLQotICAgICAgICBzeW5jaHJvbml6ZWQobVVwZGF0ZWRSb3dzKSB7Ci0gICAgICAgICAgICBpZiAoaXNGaWVsZFVwZGF0ZWQoY29sdW1uSW5kZXgpKSB7Ci0gICAgICAgICAgICAgICAgT2JqZWN0IG9iamVjdCA9IGdldFVwZGF0ZWRGaWVsZChjb2x1bW5JbmRleCk7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIG9iamVjdCAhPSBudWxsICYmIChvYmplY3QgaW5zdGFuY2VvZiBGbG9hdCB8fCBvYmplY3QgaW5zdGFuY2VvZiBEb3VibGUpOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgcmV0dXJuIG1XaW5kb3cuaXNGbG9hdChtUG9zLCBjb2x1bW5JbmRleCk7CisgICAgLyoqCisgICAgICogQGRlcHJlY2F0ZWQgVXNlIHtAbGluayAjZ2V0VHlwZX0KKyAgICAgKi8KKyAgICBARGVwcmVjYXRlZAorICAgIHB1YmxpYyBib29sZWFuIGlzRmxvYXQoaW50IGNvbHVtbkluZGV4KSB7CisgICAgICAgIHJldHVybiBnZXRUeXBlKGNvbHVtbkluZGV4KSA9PSBDdXJzb3IuRklFTERfVFlQRV9GTE9BVDsKICAgICB9CiAKICAgICBAT3ZlcnJpZGUKLSAgICBwcm90ZWN0ZWQgdm9pZCBjaGVja1Bvc2l0aW9uKCkKLSAgICB7CisgICAgcHVibGljIGludCBnZXRUeXBlKGludCBjb2x1bW5JbmRleCkgeworICAgICAgICBjaGVja1Bvc2l0aW9uKCk7CisgICAgICAgIHJldHVybiBtV2luZG93LmdldFR5cGUobVBvcywgY29sdW1uSW5kZXgpOworICAgIH0KKworICAgIEBP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ZUludGVyZmFjZShJQnVsa0N1cnNvci5kZXNjcmlwdG9yKTsKLSAgICAgICAgICAgICAgICAgICAgaW50IHBvc2l0aW9uID0gZGF0YS5yZWFkSW50KCk7Ci0gICAgICAgICAgICAgICAgICAgIGJvb2xlYW4gcmVzdWx0ID0gZGVsZXRlUm93KHBvc2l0aW9uKTsKLSAgICAgICAgICAgICAgICAgICAgcmVwbHkud3JpdGVOb0V4Y2VwdGlvbigpOwotICAgICAgICAgICAgICAgICAgICByZXBseS53cml0ZUludCgocmVzdWx0ID09IHRydWUgPyAxIDogMCkpOwotICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKLSAgICAgICAgICAgICAgICB9Ci0KICAgICAgICAgICAgICAgICBjYXNlIE9OX01PVkVfVFJBTlNBQ1RJT046IHsKICAgICAgICAgICAgICAgICAgICAgZGF0YS5lbmZvcmNlSW50ZXJmYWNlKElCdWxrQ3Vyc29yLmRlc2NyaXB0b3IpOwogICAgICAgICAgICAgICAgICAgICBpbnQgcG9zaXRpb24gPSBkYXRhLnJlYWRJbnQoKTsKQEAgLTM0Myw0OCArMzIwLDYgQEAKICAgICAgICAgcmV0dXJuIGNvdW50OwogICAgIH0KIAotICAgIHB1YmxpYyBib29sZWFuIHVwZGF0ZVJvd3MoTWFwIHZhbHVlcykgdGhyb3dzIFJlbW90ZUV4Y2VwdGlvbgotICAgIHsKLSAgICAgICAgUGFyY2VsIGRhdGEgPSBQYXJjZWwub2J0YWluKCk7Ci0gICAgICAgIFBhcmNlbCByZXBseSA9IFBhcmNlbC5vYnRhaW4oKTsKLQotICAgICAgICBkYXRhLndyaXRlSW50ZXJmYWNlVG9rZW4oSUJ1bGtDdXJzb3IuZGVzY3JpcHRvcik7Ci0KLSAgICAgICAgZGF0YS53cml0ZU1hcCh2YWx1ZXMpOwotCi0gICAgICAgIG1SZW1vdGUudHJhbnNhY3QoVVBEQVRFX1JPV1NfVFJBTlNBQ1RJT04sIGRhdGEsIHJlcGx5LCAwKTs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B7Ci0gICAgICAgIHRyeSB7Ci0gICAgICAgICAgICBib29sZWFuIHJlc3VsdCA9IG1CdWxrQ3Vyc29yLmRlbGV0ZVJvdyhtUG9zKTsKLSAgICAgICAgICAgIGlmIChyZXN1bHQgIT0gZmFsc2UpIHsKLSAgICAgICAgICAgICAgICAvLyBUaGUgd2luZG93IGNvbnRhaW5zIHRoZSBvbGQgdmFsdWUsIGRpc2NhcmQgaXQKLSAgICAgICAgICAgICAgICBtV2luZG93ID0gbnVsbDsKLSAgICAKLSAgICAgICAgICAgICAgICAvLyBGaXggdXAgdGhlIHBvc2l0aW9uCi0gICAgICAgICAgICAgICAgbUNvdW50ID0gbUJ1bGtDdXJzb3IuY291bnQoKTsKLSAgICAgICAgICAgICAgICBpZiAobVBvcyA8IG1Db3VudCkgewotICAgICAgICAgICAgICAgICAgICBpbnQgb2xkUG9zID0gbVBvczsKLSAgICAgICAgICAgICAgICAgICAgbVBvcyA9IC0xOwotICAgICAgICAgICAgICAgICAgICBtb3ZlVG9Qb3NpdGlvbihvbGRQb3MpOwotICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIG1Qb3MgPSBtQ291bnQ7Ci0gICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgLy8gU2VuZCB0aGUgY2hhbmdlIG5vdGlmaWNhdGlvbgotICAgICAgICAgICAgICAgIG9uQ2hhbmdlKHRydWUpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgcmV0dXJuIHJlc3VsdDsKLSAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGV4KSB7Ci0gICAgICAgICAgICBMb2cuZShUQUcsICJVbmFibGUgdG8gZGVsZXRlIHJvdyBiZWNhdXNlIHRoZSByZW1vdGUgcHJvY2VzcyBpcyBkZWFkIik7Ci0gICAgICAgICAgICByZXR1cm4gZmFsc2U7Ci0gICAgICAgIH0KLSAgICB9Ci0KICAgICBAT3ZlcnJpZGUKICAgICBwdWJsaWMgU3RyaW5nW10gZ2V0Q29sdW1uTmFtZXMoKSB7CiAgICAgICAgIGlmIChtQ29sdW1ucyA9PSBudWxsKSB7CkBAIC0yMTksNDQgKzE4NSw2IEBACiAgICAgICAgIHJldHVybiBtQ29sdW1uczsKICAgICB9CiAKLSAgICAvKioKLSAgICAgKiBAaGlkZQotICAgICAqIEBkZXByZWNhdGVkCi0gICAgICovCi0gICAgQE92ZXJyaWRlCi0gICAgcHVibGljIGJvb2xlYW4gY29tbWl0VXBkYXRlcyhNYXA8PyBleHRlbmRzIExvbmcsCi0gICAgICAgICAgICA/IGV4dGVuZHMgTWFwPFN0cmluZyxPYmplY3Q+PiBhZGRpdGlvbmFsVmFsdWVzKSB7Ci0gICAgICAgIGlmICghc3VwcG9ydHNVcGRhdGVzKCkpIHsKLSAgICAgICAgICAgIExvZy5lKFRBRywgImNvbW1pdFVwZGF0ZXMgbm90IHN1cHBvcnRlZCBvbiB0aGlzIGN1cnNvciwgZGlkIHlvdSBpbmNsdWRlIHRoZSBfaWQgY29sdW1uPyIpOwotICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwotICAgICAgICB9Ci0KLSAgICAgICAgc3luY2hyb25pemVkKG1VcGRhdGVkUm93cykgewotICAgICAgICAgICAgaWYgKGFkZGl0aW9uYWxWYWx1ZXMgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgIG1VcGRhdGVkUm93cy5wdXRBbGwoYWRkaXRpb25hbFZhbHVlcyk7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIGlmIChtVXBkYXRlZFJvd3Muc2l6ZSgpIDw9IDApIHsKLSAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIHRyeSB7Ci0gICAgICAgICAgICAgICAgYm9vbGVhbiByZXN1bHQgPSBtQnVsa0N1cnNvci51cGRhdGVSb3dzKG1VcGRhdGVkUm93cyk7Ci0gICAgCi0gICAgICAgICAgICA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yc29ycyBhcmUgc3VwcG9ydGVkIGFjcm9zcyBwcm9jZXNzIGZvciBub3ciLCBlKTsKICAgICAgICAgfQogICAgICAgICBtUHJvdmlkZXJOYW1lID0gcHJvdmlkZXJOYW1lOwotICAgICAgICBtUmVhZE9ubHkgPSAhYWxsb3dXcml0ZTsKIAogICAgICAgICBjcmVhdGVBbmRSZWdpc3Rlck9ic2VydmVyUHJveHkob2JzZXJ2ZXIpOwogICAgIH0KQEAgLTE5NywzMSArMTkxLDYgQEAKICAgICAgICAgfQogICAgIH0KIAotICAgIHB1YmxpYyBib29sZWFuIHVwZGF0ZVJvd3MoTWFwPD8gZXh0ZW5kcyBMb25nLCA/IGV4dGVuZHMgTWFwPFN0cmluZywgT2JqZWN0Pj4gdmFsdWVzKSB7Ci0gICAgICAgIGlmIChtUmVhZE9ubHkpIHsKLSAgICAgICAgICAgIExvZy53KCJDb250ZW50UHJvdmlkZXIiLCAiUGVybWlzc2lvbiBEZW5pYWw6IG1vZGlmeWluZyAiCi0gICAgICAgICAgICAgICAgICAgICsgbVByb3ZpZGVyTmFtZQotICAgICAgICAgICAgICAgICAgICArICIgZnJvbSBwaWQ9IiArIEJpbmRlci5nZXRDYWxsaW5nUGlkKCkKLSAgICAgICAgICAgICAgICAgICAgKyAiLCB1aWQ9IiArIEJpbmRlci5nZXRDYWxsaW5nVWlkKCkpOwotICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwotICAgICAgICB9Ci0gICAgICAgIHJldHVybiBtQ3Vyc29yLmNvbW1pdFVwZGF0ZXModmFsdWVzKTsKLSAgICB9Ci0KLSAgICBwdWJsaWMgYm9vbGVhbiBkZWxldGVSb3coaW50IHBvc2l0aW9uKSB7Ci0gICAgICAgIGlmIChtUmVhZE9ubHkpIHsKLSAgICAgICAgICAgIExvZy53KCJDb250ZW50UHJvdmlkZXIiLCAiUGVybWlzc2lvbiBEZW5pYWw6IG1vZGlmeWluZyAiCi0gICAgICAgICAgICAgICAgICAgICsgbVByb3ZpZG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AqICAgPGxpPntAbGluayBDdXJzb3IjRklFTERfVFlQRV9GTE9BVH08L2xpPgorICAgICAqICAgPGxpPntAbGluayBDdXJzb3IjRklFTERfVFlQRV9TVFJJTkd9PC9saT4KKyAgICAgKiAgIDxsaT57QGxpbmsgQ3Vyc29yI0ZJRUxEX1RZUEVfQkxPQn08L2xpPgorICAgICAqPC91bD4KKyAgICAgKjwvcD4KKyAgICAgKgorICAgICAqIEBwYXJhbSByb3cgdGhlIHJvdyB0byByZWFkIGZyb20sIHJvdyAtIGdldFN0YXJ0UG9zaXRpb24oKSBiZWluZyB0aGUgYWN0dWFsIHJvdyBpbiB0aGUgd2luZG93CisgICAgICogQHBhcmFtIGNvbCB0aGUgY29sdW1uIHRvIHJlYWQgZnJvbQorICAgICAqIEByZXR1cm4gdGhlIHZhbHVlIHR5cGUKKyAgICAgKi8KKyAgICBwdWJsaWMgaW50IGdldFR5cGUoaW50IHJvdywgaW50IGNvbCkgeworICAgICAgICBhY3F1aXJlUmVmZXJlbmNlKCk7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICByZXR1cm4gZ2V0VHlwZV9uYXRpdmUocm93IC0gbVN0YXJ0UG9zLCBjb2wpOworICAgICAgICB9IGZpbmFsbHkgeworICAgICAgICAgICAgcmVsZWFzZVJlZmVyZW5jZSgpOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqCiAgICAgICogQ2hlY2tzIGlmIGEgZmllbGQgY29udGFpbnMgZWl0aGVyIGEgYmxvYiBvciBpcyBudWxsLgogICAgICAqCiAgICAgICogQHBhcmFtIHJvdyB0aGUgcm93IHRvIHJlYWQgZnJvbSwgcm93IC0gZ2V0U3RhcnRQb3NpdGlvbigpIGJlaW5nIHRoZSBhY3R1YWwgcm93IGluIHRoZSB3aW5kb3cKICAgICAgKiBAcGFyYW0gY29sIHRoZSBjb2x1bW4gdG8gcmVhZCBmcm9tCiAgICAgICogQHJldHVybiB7QGNvZGUgdHJ1ZX0gaWYgZ2l2ZW4gZmllbG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XJuaW5nIGFuIGV4Y2VwdGlvbiBmcm9tIGEgdHJhbnNhY3Rpb24uCkBAIC0xOTMsNiArMjA5LDM3IEBACiAgICAgfQogCiAgICAgLyoqCisgICAgICogUmV0dXJucyBkYXRhIHR5cGUgb2YgdGhlIGdpdmVuIG9iamVjdCdzIHZhbHVlLgorICAgICAqPHA+CisgICAgICogUmV0dXJuZWQgdmFsdWVzIGFyZQorICAgICAqIDx1bD4KKyAgICAgKiAgIDxsaT57QGxpbmsgQ3Vyc29yI0ZJRUxEX1RZUEVfTlVMTH08L2xpPgorICAgICAqICAgPGxpPntAbGluayBDdXJzb3IjRklFTERfVFlQRV9JTlRFR0VSfTwvbGk+CisgICAgICogICA8bGk+e0BsaW5rIEN1cnNvciNGSUVMRF9UWVBFX0ZMT0FUfTwvbGk+CisgICAgICogICA8bGk+e0BsaW5rIEN1cnNvciNGSUVMRF9UWVBFX1NUUklOR308L2xpPgorICAgICAqICAgPGxpPntAbGluayBDdXJzb3IjRklFTERfVFlQRV9CTE9CfTwvbGk+CisgICAgICo8L3VsPgorICAgICAqPC9wPgorICAgICAqCisgICAgICogQHBhcmFtIG9iaiB0aGUgb2JqZWN0IHdob3NlIHZhbHVlIHR5cGUgaXMgdG8gYmUgcmV0dXJuZWQKKyAgICAgKiBAcmV0dXJuIG9iamVjdCB2YWx1ZSB0eXBlCisgICAgICogQGhpZGUKKyAgICAgKi8KKyAgICBwdWJsaWMgc3RhdGljIGludCBnZXRUeXBlT2ZPYmplY3QoT2JqZWN0IG9iaikgeworICAgICAgICBpZiAob2JqID09IG51bGwpIHsKKyAgICAgICAgICAgIHJldHVybiBDdXJzb3IuRklFTERfVFlQRV9OVUxMOworICAgICAgICB9IGVsc2UgaWYgKG9iaiBpbnN0YW5jZW9mIGJ5dGVbXSkgeworICAgICAgICAgICAgcmV0dXJuIEN1cnNvci5GSUVMRF9UWVBFX0JMT0I7CisgICAgICAgIH0gZWxzZSBpZiAob2JqIGluc3RhbmNlb2YgRmxvYXQ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lvbkFyZ3MpIHsKKyAgICAgICAgcHJvZy5iaW5kQWxsQXJnc0FzU3RyaW5ncyhzZWxlY3Rpb25BcmdzKTsKKyAgICAgICAgcmV0dXJuIHByb2cuc2ltcGxlUXVlcnlGb3JCbG9iRmlsZURlc2NyaXB0b3IoKTsKICAgICB9CiAKICAgICAvKioKQEAgLTExMjgsNCArMTE5MSw1OSBAQAogICAgICAgICBkYi5zZXRWZXJzaW9uKGRiVmVyc2lvbik7CiAgICAgICAgIGRiLmNsb3NlKCk7CiAgICAgfQorCisgICAgLyoqCisgICAgICogUmV0dXJucyBvbmUgb2YgdGhlIGZvbGxvd2luZyB3aGljaCByZXByZXNlbnQgdGhlIHR5cGUgb2YgdGhlIGdpdmVuIFNRTCBzdGF0ZW1lbnQuCisgICAgICogPG9sPgorICAgICAqICAgPGxpPntAbGluayAjU1RBVEVNRU5UX1NFTEVDVH08L2xpPgorICAgICAqICAgPGxpPntAbGluayAjU1RBVEVNRU5UX1VQREFURX08L2xpPgorICAgICAqICAgPGxpPntAbGluayAjU1RBVEVNRU5UX0FUVEFDSH08L2xpPgorICAgICAqICAgPGxpPntAbGluayAjU1RBVEVNRU5UX0JFR0lOfTwvbGk+CisgICAgICogICA8bGk+e0BsaW5rICNTVEFURU1FTlRfQ09NTUlUfTwvbGk+CisgICAgICogICA8bGk+e0BsaW5rICNTVEFURU1FTlRfQUJPUlR9PC9saT4KKyAgICAgKiAgIDxsaT57QGxpbmsgI1NUQVRFTUVOVF9PVEhFUn08L2xpPgorICAgICAqIDwvb2w+CisgICAgICogQHBhcmFtIHNxbCB0aGUgU1FMIHN0YXRlbWVudCB3aG9zZSB0eXBlIGlzIHJldHVybmVkIGJ5IHRoaXMgbWV0aG9kCisgICAgICogQHJldHVybiBvbmUgb2YgdGhlIHZhbHVlcyBsaXN0ZWQgYWJvdmUKKyAgICAgKi8KKyAgICBwdWJsaWMgc3RhdGljIGludCBnZXRTcWxTdGF0ZW1lbnRUeXBlKFN0cmluZyBzcWwpIHsKKyAgICAgICAgc3FsID0gc3FsLnRyaW0oKTsKKyAgICAgICAgaWYgKHNxbC5sZW5ndGgoKSA8IDMpIHsKKyAgICAgICAgICAgIHJldHVybiBTVEFURU1FTlRfT1RIRVI7CisgICAgICAgIH0KKyAgICAgICAgU3RyaW5nIHByZWZpeFNxbCA9IHNxbC5zdWJzdHJpbmcoMCwgMykudG9VcHBlckNhc2UoKTsKKyAgICAgICAgaWYgKHByZWZpeFNxbC5lcXVhbHMoIlNFTCIpKSB7CisgICAgICAgICAgICByZXR1cm4gU1RBVEVNRU5UX1NFTEVDVDsKKyAgICAgICAgfSBlbHNlIGlmIChwcmVmaXhTcWwuZXF1YWxzKCJJTlMiKSB8fAorICAgICAgICAgICAgICAgIHByZWZpeFNxbC5lcXVhbHMoIlVQRCIpIHx8CisgICAgICAgICAgICAgICAgcHJlZml4U3FsLmVxdWFscygiUkVQIikgfHwKKyAgICAgICAgICAgICAgICBwcmVmaXhTcWwuZXF1YWxzKCJERUwiKSkgeworICAgICAgICAgICAgcmV0dXJuIFNUQVRFTUVOVF9VUERBVEU7CisgICAgICAgIH0gZWxzZSBpZiAocHJlZml4U3FsLmVxdWFscygiQVRUIikpIHsKKyAgICAgICAgICAgIHJldHVybiBTVEFURU1FTlRfQVRUQUNIOworICAgICAgICB9IGVsc2UgaWYgKHByZWZpeFNxbC5lcXVhbHMoIkNPTSIpKSB7CisgICAgICAgICAgICByZXR1cm4gU1RBVEVNRU5UX0NPTU1JVDsKKyAgICAgICAgfSBlbHNlIGlmIChwcmVmaXhTcWwuZXF1YWxzKCJFTkQiKSkgeworICAgICAgICAgICAgcmV0dXJuIFNUQVRFTUVOVF9DT01NSVQ7CisgICAgICAgIH0gZWxzZSBpZiAocHJlZml4U3FsLmVxdWFscygiUk9MIikpIHsKKyAgICAgICAgICAgIHJldHVybiBTVEFURU1FTlRfQUJPUlQ7CisgICAgICAgIH0gZWxzZSBpZiAocHJlZml4U3FsLmVxdWFscygiQkVHIikpIHsKK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AgICB9CisKKyAgICAgICAgQXJyYXlMaXN0PFBhaXI8U3RyaW5nLCBTdHJpbmc+PiBhdHRhY2hlZERicyA9IG51bGw7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICAvLyBDbG9zZSB0aGUgZGF0YWJhc2UsIHdoaWNoIHdpbGwgY2F1c2Ugc3Vic2VxdWVudCBvcGVyYXRpb25zIHRvIGZhaWwuCisgICAgICAgICAgICAvLyBiZWZvcmUgdGhhdCwgZ2V0IHRoZSBhdHRhY2hlZCBkYXRhYmFzZSBsaXN0IGZpcnN0LgorICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICBhdHRhY2hlZERicyA9IGRiT2JqLmdldEF0dGFjaGVkRGJzKCk7CisgICAgICAgICAgICB9IGNhdGNoIChTUUxpdGVFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgIC8qIGlnbm9yZSAqLworICAgICAgICAgICAgfQorICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICBkYk9iai5jbG9zZSgpOworICAgICAgICAgICAgfSBjYXRjaCAoU1FMaXRlRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICAvKiBpZ25vcmUgKi8KKyAgICAgICAgICAgIH0KKyAgICAgICAgfSBmaW5hbGx5IHsKKyAgICAgICAgICAgIC8vIERlbGV0ZSBhbGwgZmlsZXMgb2YgdGhpcyBjb3JydXB0IGRhdGFiYXNlIGFuZC9vciBhdHRhY2hlZCBkYXRhYmFzZXMKKyAgICAgICAgICAgIGlmIChhdHRhY2hlZERicyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgZm9yIChQYWlyPFN0cmluZywgU3RyaW5nPiBwIDogYXR0YWNoZWREYnMpIHsKKyAgICAgICAgICAgICAgICAgICAgZGVsZXRlRGF0YWJhc2VGaWxlKHAuc2Vjb25kKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIC8vIGF0dGFjaG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pAQCAtOTIsMzIgKzkyLDYgQEAKICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgIH0KIAotICAgIC8qKgotICAgICAqIEBoaWRlCi0gICAgICogQGRlcHJlY2F0ZWQKLSAgICAgKi8KLSAgICBAT3ZlcnJpZGUKLSAgICBwdWJsaWMgYm9vbGVhbiBkZWxldGVSb3coKQotICAgIHsKLSAgICAgICAgcmV0dXJuIG1DdXJzb3IuZGVsZXRlUm93KCk7Ci0gICAgfQotICAgIAotICAgIC8qKgotICAgICAqIEBoaWRlCi0gICAgICogQGRlcHJlY2F0ZWQKLSAgICAgKi8KLSAgICBAT3ZlcnJpZGUKLSAgICBwdWJsaWMgYm9vbGVhbiBjb21taXRVcGRhdGVzKCkgewotICAgICAgICBpbnQgbGVuZ3RoID0gbUN1cnNvcnMubGVuZ3RoOwotICAgICAgICBmb3IgKGludCBpID0gMCA7IGkgPCBsZW5ndGggOyBpKyspIHsKLSAgICAgICAgICAgIGlmIChtQ3Vyc29yc1tpXSAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgbUN1cnNvcnNbaV0uY29tbWl0VXBkYXRlcygpOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgICAgIG9uQ2hhbmdlKHRydWUpOwotICAgICAgICByZXR1cm4gdHJ1ZTsKLSAgICB9Ci0KICAgICBAT3ZlcnJpZGUKICAgICBwdWJsaWMgU3RyaW5nIGdldFN0cmluZyhpbnQgY29sdW1uKQogICAgIHsKQEAgLTE1NSw2ICsxMjksMTEgQEAKICAgICB9CiAKICAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgaW50IGdldFR5cGUoaW50IGNvbHVtbikgeworICAgICAgICByZXR1cm4gbUN1cnNvci5nZXRUeXBlKGNvbHVtbik7CisgICAgfQorCisgICAgQE92ZXJyaWRlCiAgICAgcHVibGljIGJvb2xlYW4gaXNOdWxsKGludCBjb2x1bW4pCiAgICAgewogICAgICAgICByZXR1cm4gbUN1cnNvci5pc051bGwoY29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qLyB2b2lkIGNsb3NlKCkgeworICAgICAgICBzeW5jaHJvbml6ZWQobVBhcmVudERiT2JqKSB7CisgICAgICAgICAgICBpZiAoTG9nLmlzTG9nZ2FibGUoVEFHLCBMb2cuREVCVUcpKSB7CisgICAgICAgICAgICAgICAgTG9nLmQoVEFHLCAiQ2xvc2luZyB0aGUgY29ubmVjdGlvbiBwb29sIG9uICIgKyBtUGFyZW50RGJPYmouZ2V0UGF0aCgpICsgdG9TdHJpbmcoKSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBmb3IgKGludCBpID0gbVBvb2wuc2l6ZSgpIC0gMTsgaSA+PSAwOyBpLS0pIHsKKyAgICAgICAgICAgICAgICBtUG9vbC5nZXQoaSkubURiLmNsb3NlKCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBtUG9vbC5jbGVhcigpOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogZ2V0IGEgZnJlZSBjb25uZWN0aW9uIGZyb20gdGhlIHBvb2wKKyAgICAgKgorICAgICAqIEBwYXJhbSBzcWwgaWYgbm90IG51bGwsIHRyeSB0byBmaW5kIGEgY29ubmVjdGlvbiBpbnRoZSBwb29sIHdoaWNoIGFscmVhZHkgaGFzIGNhY2hlZAorICAgICAqIHRoZSBjb21waWxlZCBzdGF0ZW1lbnQgZm9yIHRoaXMgc3FsLgorICAgICAqIEByZXR1cm4gdGhlIERhdGFiYXNlIGNvbm5lY3Rpb24gdGhhdCB0aGUgY2FsbGVyIGNhbiB1c2UKKyAgICAgKi8KKyAgICAvKiBwYWNrYWdlICovIFNRTGl0ZURhdGFiYXNlIGdldChTdHJpbmcgc3FsKSB7CisgICAgICAgIFNRTGl0ZURhdGFiYXNlIGRiID0gbnVsbDsKKyAgICAgICAgUG9vbE9iaiBwb29sT2JqID0gbnVsbDsKKyAgICAgICAgc3luY2hyb25pemVkKG1QYXJlbnREYk9iaikgeworICAgICAgICAgICAgaW50IHBvb2xTaXplID0gbVBvb2wuc2l6ZSgpOworICAgICAgICAgICAgaWYgKExvZy5pc0xvZ2dhYmxlKFRBRywgTG9nLkRFQlVHKSkgeworICAgICAgICAgICAgICAgIGFzc2VydCBzcWwgIT0gbnVsbDsKKyAgICAgICAgICAgICAgICBkb0Fzc2VydHMoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmIChnZXRGcmVlUG9vbFNpemUoKSA9PSAwKSB7CisgICAgICAgICAgICAgICAgLy8gbm8gZnJlZSAoID0gYXZhaWxhYmxlKSBjb25uZWN0aW9ucworICAgICAgICAgICAgICAgIGlmIChtTWF4UG9vbFNpemUgPT0gcG9vbFNpemUpIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gbWF4ZWQgb3V0LiBjYW4ndCBvcGVuIGFueSBtb3JlIGNvbm5lY3Rpb25zLgorICAgICAgICAgICAgICAgICAgICAvLyBsZXQgdGhlIGNhbGxlciB3YWl0IG9uIG9uZSBvZiB0aGUgcG9vbGVkIGNvbm5lY3Rpb25zCisgICAgICAgICAgICAgICAgICAgIC8vIHByZWZlcmFibHkgYSBjb25uZWN0aW9uIGNhY2hpbmcgdGhlIHByZS1jb21waWxlZCBzdGF0ZW1lbnQgb2YgdGhlIGdpdmVuIFNRTAorICAgICAgICAgICAgICAgICAgICBpZiAobU1heFBvb2xTaXplID09IDEpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHBvb2xPYmogPSBtUG9vbC5nZXQoMCk7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IG1NYXhQb29sU2l6ZTsgaSsrKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1Qb29sLmdldChpKS5tRGIuaXNTcWxJblN0YXRlbWVudENhY2hlKHNxbCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcG9vbE9iaiA9IG1Qb29sLmdldChpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHBvb2xPYmogPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHRoZXJlIGFyZSBubyBkYXRhYmFzZSBjb25uZWN0aW9ucyB3aXRoIHRoZSBnaXZlbiBTUUwgcHJlLWNvbXBpbGVkLgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIG9rIHRvIHJldHVybiBhbnkgb2YgdGhlIGNvbm5lY3Rpb25zLgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyYW5kID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmFuZCA9IG5ldyBSYW5kb20oU3lzdGVtQ2xvY2suZWxhcHNlZFJlYWx0aW1lKCkpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBwb29sT2JqID0gbVBvb2wuZ2V0KHJhbmQubmV4dEludChtTWF4UG9vbFNpemUpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBkYiA9IHBvb2xPYmoubURiOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIC8vIGNyZWF0ZSBhIG5ldyBjb25uZWN0aW9uIGFuZCBhZGQgaXQgdG8gdGhlIHBvb2wsIHNpbmNlIHdlIGhhdmVuJ3QgcmVhY2hlZAorICAgICAgICAgICAgICAgICAgICAvLyBtYXggcG9vbCBzaXplIGFsbG93ZWQKKyAgICAgICAgICAgICAgICAgICAgZGIgPSBtUGFyZW50RGJPYmouY3JlYXRlUG9vbENvbm5lY3Rpb24oKHNob3J0KShwb29sU2l6ZSArIDEpKTsKKyAgICAgICAgICAgICAgICAgICAgcG9vbE9iaiA9IG5ldyBQb29sT2JqKGRiKTsKKyAgICAgICAgICAgICAgICAgICAgbVBvb2wuYWRkKHBvb2xTaXplLCBwb29sT2JqKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIC8vIHRoZXJlIGFyZSBmcmVlIGNvbm5lY3Rpb25zIGF2YWlsYWJsZS4gcGljayBvbmUKKyAgICAgICAgICAgICAgICAvLyBwcmVmZXJhYmx5IGEgY29ubmVjdGlvbiBjYWNoaW5nIHRoZSBwcmUtY29tcGlsZWQgc3RhdGVtZW50IG9mIHRoZSBnaXZlbiBTUUwKKyAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IHBvb2xTaXplOyBpKyspIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKG1Qb29sLmdldChpKS5pc0ZyZWUoKSAmJiBtUG9vbC5nZXQoaSkubURiLmlzU3FsSW5TdGF0ZW1lbnRDYWNoZShzcWwpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBwb29sT2JqID0gbVBvb2wuZ2V0KGkpOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaWYgKHBvb2xPYmogPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAvLyBkaWRuJ3QgZmluZCBhIGZyZWUgZGF0YWJhc2UgY29ubmVjdGlvbiB3aXRoIHRoZSBnaXZlbiBTUUwgYWxyZWFkeQorICAgICAgICAgICAgICAgICAgICAvLyBwcmUtY29tcGlsZWQuIHJldHVybiBhIGZyZWUgY29ubmVjdGlvbiAodGhpcyBtZWFucywgdGhlIHNhbWUgU1FMIGNvdWxkIGJlCisgICAgICAgICAgICAgICAgICAgIC8vIHByZS1jb21waWxlZCBvbiBtb3JlIHRoYW4gb25lIGRhdGFiYXNlIGNvbm5lY3Rpb24uIHBvdGVudGlhbCB3YXN0ZWQgbWVtb3J5LikKKyAgICAgICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBwb29sU2l6ZTsgaSsrKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAobVBvb2wuZ2V0KGkpLmlzRnJlZSgpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcG9vbE9iaiA9IG1Qb29sLmdldChpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBkYiA9IHBvb2xPYmoubURiOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBhc3NlcnQgcG9vbE9iaiAhPSBudWxsOworICAgICAgICAgICAgYXNzZXJ0IHBvb2xPYmoubURiID09IGRiOworCisgICAgICAgICAgICBwb29sT2JqLmFjcXVpcmUoKTsKKyAgICAgICAgfQorCisgICAgICAgIGlmIChMb2cuaXNMb2dnYWJsZShUQUcsIExvZy5ERUJVRykpIHsKKyAgICAgICAgICAgIExvZy5kKFRBRywgIkVORCBnZXQtY29ubmVjdGlvbjogIiArIHRvU3RyaW5nKCkgKyBwb29sT2JqLnRvU3RyaW5nKCkpOworICAgICAgICB9CisgICAgICAgIHJldHVybiBkYjsKKyAgICAgICAgLy8gVE9ETyBpZiBhIHRocmVhZCBhY3F1aXJlcyBhIGNvbm5lY3Rpb24gYW5kIGRpZXMgd2l0aG91dCByZWxlYXNpbmcgdGhlIGNvbm5lY3Rpb24sIHRoZW4KKyAgICAgICAgLy8gdGhlcmUgY291bGQgYmUgYSBjb25uZWN0aW9uIGxlYWsuCisgICAgfQorCisgICAgLyoqCisgICAgICogcmVsZWFzZSB0aGUgZ2l2ZW4gZGF0YWJhc2UgY29ubmVjdGlvbiBiYWNrIHRvIHRoZSBwb29sLgorICAgICAqIEBwYXJhbSBkYiB0aGUgY29ubmVjdGlvbiB0byBiZSByZWxlYXNlZAorICAgICAqLworICAgIC8qIHBhY2thZ2UgKi8gdm9pZCByZWxlYXNlKFNRTGl0ZURhdGFiYXNlIGRiKSB7CisgICAgICAgIFBvb2xPYmogcG9vbE9iajsKKyAgICAgICAgc3luY2hyb25pemVkKG1QYXJlbnREYk9iaikgeworICAgICAgICAgICAgaWYgKExvZy5pc0xvZ2dhYmxlKFRBRywgTG9nLkRFQlVHKSkgeworICAgICAgICAgICAgICAgIGFzc2VydCBkYi5tQ29ubmVjdGlvbk51bSA+IDA7CisgICAgICAgICAgICAgICAgZG9Bc3NlcnRzKCk7CisgICAgICAgICAgICAgICAgYXNzZXJ0IG1Qb29sLmdldChkYi5tQ29ubmVjdGlvbk51bSAtIDEpLm1EYiA9PSBkYjsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcG9vbE9iaiA9IG1Qb29sLmdldChkYi5tQ29ubmVjdGlvbk51bSAtIDEpOworCisgICAgICAgICAgICBpZiAoTG9nLmlzTG9nZ2FibGUoVEFHLCBMb2cuREVCVUcpKSB7CisgICAgICAgICAgICAgICAgTG9nLmQoVEFHLCAiQkVHSU4gcmVsZWFzZS1jb25uOiAiICsgdG9TdHJpbmcoKSArIHBvb2xPYmoudG9TdHJpbmcoKSk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmIChwb29sT2JqLmlzRnJlZSgpKSB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigiUmVsZWFzaW5nIG9iamVjdCBhbHJlYWR5IGZyZWVkOiAiICsKKyAgICAgICAgICAgICAgICAgICAgICAgIGRiLm1Db25uZWN0aW9uTnVtKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcG9vbE9iai5yZWxlYXNlKCk7CisgICAgICAgIH0KKworICAgICAgICBpZiAoTG9nLmlzTG9nZ2FibGUoVEFHLCBMb2cuREVCVUcpKSB7CisgICAgICAgICAgICBMb2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lcnRzKCkgeworICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IG1Qb29sLnNpemUoKTsgaSsrKSB7CisgICAgICAgICAgICBtUG9vbC5nZXQoaSkudmVyaWZ5KCk7CisgICAgICAgICAgICBhc3NlcnQgbVBvb2wuZ2V0KGkpLm1EYi5tQ29ubmVjdGlvbk51bSA9PSAoaSArIDEpOworICAgICAgICB9CisgICAgfQorCisgICAgLyogcGFja2FnZSAqLyB2b2lkIHNldE1heFBvb2xTaXplKGludCBzaXplKSB7CisgICAgICAgIHN5bmNocm9uaXplZChtUGFyZW50RGJPYmopIHsKKyAgICAgICAgICAgIG1NYXhQb29sU2l6ZSA9IHNpemU7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKiBwYWNrYWdlICovIGludCBnZXRNYXhQb29sU2l6ZSgpIHsKKyAgICAgICAgc3luY2hyb25pemVkKG1QYXJlbnREYk9iaikgeworICAgICAgICAgICAgcmV0dXJuIG1NYXhQb29sU2l6ZTsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKiBvbmx5IHVzZWQgZm9yIHRlc3RpbmcgcHVycG9zZXMuICovCisgICAgLyogcGFja2FnZSAqLyBib29sZWFuIGlzRGF0YWJhc2VPYmpGcmVlKFNRTGl0ZURhdGFiYXNlIGRiKSB7CisgICAgICAgIHJldHVybiBtUG9vbC5nZXQoZGIubUNvbm5lY3Rpb25OdW0gLSAxKS5pc0ZyZWUoKTsKKyAgICB9CisKKyAgICAvKiogb25seSB1c2VkIGZvciB0ZXN0aW5nIHB1cnBvc2VzLiAqLworICAgIC8qIHBhY2thZ2UgKi8gaW50IGdldFNpemUoKSB7CisgICAgICAgIHJldHVybiBtUG9vbC5zaXplKCk7CisgICAgfQorCisgICAgLyoqCisgICAgICogcmVwcmVzZW50cyBvYmplY3RzIGluIHRoZSBjb25uZWN0aW9uIHBvb2wuCisgICAgICogcGFja2FnZS1sZXZlbCBhY2Nlc3MgZm9yIHRlc3RpbmcgcHVycG9zZXMgb25seS4KKyAgICAgKi8KKyAgICAvKiBwYWNrYWdlICovIHN0YXRpYyBjbGFzcyBQb29sT2JqIHsKKworICAgICAgICBwcml2YXRlIGZpbmFsIFNRTGl0ZURhdGFiYXNlIG1EYjsKKyAgICAgICAgcHJpdmF0ZSBib29sZWFuIG1GcmVlQnVzeUZsYWcgPSBGUkVFOworICAgICAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBib29sZWFuIEZSRUUgPSB0cnVlOworICAgICAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBib29sZWFuIEJVU1kgPSBmYWxzZTsKKworICAgICAgICAvKiogdGhlIG51bWJlciBvZiB0aHJlYWRzIGhvbGRpbmcgdGhpcyBjb25uZWN0aW9uICovCisgICAgICAgIC8vIEBHdWFyZGVkQnkoInRoaXMiKQorICAgICAgICBwcml2YXRlIGludCBtTnVtSG9sZGVycyA9IDA7CisKKyAgICAgICAgLyoqIGNvbnRhaW5zIHRoZSB0aHJlYWRJZHMgb2YgdGhlIHRocmVhZHMgaG9sZGluZyB0aGlzIGNvbm5lY3Rpb24uCisgICAgICAgICAqIHVzZWQgZm9yIGRlYnVnZ2luZyBwdXJwb3NlcyBvbmx5LgorICAgICAgICAgKi8KKyAgICAgICAgLy8gQEd1YXJkZWRCeSgidGhpcyIpCisgICAgICAgIHByaXZhdGUgSGFzaFNldDxMb25nPiBtSG9sZGVySWRzID0gbmV3IEhhc2hTZXQ8TG9uZz4oKTsKKworICAgICAgICBwdWJsaWMgUG9vbE9iaihTUUxpdGVEYXRhYmFzZSBkYikgeworICAgICAgICAgICAgbURiID0gZGI7CisgICAgICAgIH0KKworICAgICAgICBwcml2YXRlIHN5bmNocm9uaXplZCB2b2lkIGFjcXVpcmUoKSB7CisgICAgICAgICAgICBpZiAoTG9nLmlzTG9nZ2FibGUoVEFHLCBMb2cuREVCVUcpKSB7CisgICAgICAgICAgICAgICAgYXNzZXJ0IGlzRnJlZSgpOworICAgICAgICAgICAgICAgIGxvbmcgaWQgPSBUaHJlYWQuY3VycmVudFRocmVhZCgpLmdldElkKCk7CisgICAgICAgICAgICAgICAgYXNzZXJ0ICFtSG9sZGVySWRzLmNvbnRhaW5zKGlkKTsKKyAgICAgICAgICAgICAgICBtSG9sZGVySWRzLmFkZChpZCk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIG1OdW1Ib2xkZXJzKys7CisgICAgICAgICAgICBtRnJlZUJ1c3lGbGFnID0gQlVTWTsKKyAgICAgICAgfQorCisgICAgICAgIHByaXZhdGUgc3luY2hyb25pemVkIHZvaWQgcmVsZWFzZSgpIHsKKyAgICAgICAgICAgIGlmIChMb2cuaXNMb2dnYWJsZShUQUcsIExvZy5ERUJVRykpIHsKKyAgICAgICAgICAgICAgICBsb25nIGlkID0gVGhyZWFkLmN1cnJlbnRUaHJlYWQoKS5nZXRJZCgpOworICAgICAgICAgICAgICAgIGFzc2VydCBtSG9sZGVySWRzLnNpemUoKSA9PSBtTnVtSG9sZGVyczsKKyAgICAgICAgICAgICAgICBhc3NlcnQgbUhvbGRlcklkcy5jb250YWlucyhpZCk7CisgICAgICAgICAgICAgICAgbUhvbGRlcklkcy5yZW1vdmUoaWQpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBtTnVtSG9sZGVycy0tOworICAgICAgICAgICAgaWYgKG1OdW1Ib2xkZXJzID09IDApIHsKKyAgICAgICAgICAgICAgICBtRnJlZUJ1c3lGbGFnID0gRlJFRTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHByaXZhdGUgc3luY2hyb25pemVkIGJvb2xlYW4gaXNGcmVlKCkgeworICAgICAgICAgICAgaWYgKExvZy5pc0xvZ2dhYmxlKFRBRywgTG9nLkRFQlVHKSkgeworICAgICAgICAgICAgICAgIHZlcmlmeSgpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuIChtRnJlZUJ1c3lGbGFnID09IEZSRUUpOworICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSBzeW5jaHJvbml6ZWQgdm9pZCB2ZXJpZnkoKSB7CisgICAgICAgICAgICBpZiAobUZyZWVCdXN5RmxhZyA9PSBGUkVFKSB7CisgICAgICAgICAgICAgICAgYXNzZXJ0IG1OdW1Ib2xkZXJzID09IDA7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIGFzc2VydCBtTnVtSG9sZGVycyA+IDA7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICAvKioKKyAgICAgICAgICogb25seSBmb3IgdGVzdGluZyBwdXJwb3NlcworICAgICAgICAgKi8KKyAgICAgICAgLyogcGFja2FnZSAqLyBzeW5jaHJvbml6ZWQgaW50IGdldE51bUhvbGRlcnMoKSB7CisgICAgICAgICAgICByZXR1cm4gbU51bUhvbGRlcnM7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIFN0cmluZyB0b1N0cmluZygpIHsKKyAgICAgICAgICAgIFN0cmluZ0J1aWxkZXIgYnVmZiA9IG5ldyBTdHJpbmdCdWlsZGVyKCk7CisgICAgICAgICAgICBidWZmLmFwcGVuZCgiLCBjb25uICMgIik7CisgICAgICAgICAgICBidWZmLmFwcGVuZChtRGIubUNvbm5lY3Rpb25OdW0pOworICAgICAgICAgICAgYnVmZi5hcHBlbmQoIiwgbUNvdW50SG9sZGVycyA9ICIpOworICAgICAgICAgICAgc3luY2hyb25pemVkKHRoaXMpIHsKKyAgICAgICAgICAgICAgICBidWZmLmFwcGVuZChtTnVtSG9sZGVycyk7CisgICAgICAgICAgICAgICAgYnVmZi5hcHBlbmQoIiwgZnJlZUJ1c3lGbGFnID0gIik7CisgICAgICAgICAgICAgICAgYnVmZi5hcHBlbmQobUZyZWVCdXN5RmxhZyk7CisgICAgICAgICAgICAgICAgZm9yIChMb25nIGwgOiBtSG9sZGVySWRzKSB7CisgICAgICAgICAgICAgICAgICAgIGJ1ZmYuYXBwZW5kKCIsIGlkID0gIiArIGwpOworICAgICAgICAgICA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QUxJWkFUSU9OKSB7CiAgICAgICAgICAgICAgICAgTG9nLnYoVEFHLCAiY2xvc2VkIGFuZCBkZWFsbG9jYXRlZCBEYk9iaiAoaWQjIiArIG5TdGF0ZW1lbnQgKyIpIik7CiAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB0cnkgewotICAgICAgICAgICAgICAgIG1EYXRhYmFzZS5sb2NrKCk7Ci0gICAgICAgICAgICAgICAgbmF0aXZlX2ZpbmFsaXplKCk7Ci0gICAgICAgICAgICAgICAgblN0YXRlbWVudCA9IDA7Ci0gICAgICAgICAgICB9IGZpbmFsbHkgewotICAgICAgICAgICAgICAgIG1EYXRhYmFzZS51bmxvY2soKTsKLSAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1EYXRhYmFzZS5maW5hbGl6ZVN0YXRlbWVudExhdGVyKG5TdGF0ZW1lbnQpOworICAgICAgICAgICAgblN0YXRlbWVudCA9IDA7CiAgICAgICAgIH0KICAgICB9CiAKQEAgLTEzNCw2ICsxMjIsMTAgQEAKICAgICAgICAgbUluVXNlID0gZmFsc2U7CiAgICAgfQogCisgICAgLyogcGFja2FnZSAqLyBzeW5jaHJvbml6ZWQgYm9vbGVhbiBpc0luVXNlKCkgeworICAgICAgICByZXR1cm4gbUluVXNlOworICAgIH0KKwogICAgIC8qKgogICAgICAqIE1ha2Ugc3VyZSB0aGF0IHRoZSBuYXRpdmUgcmVzb3VyY2UgaXMgY2xlYW5lZCB1cC4KICAgICAgKi8KQEAgLTE0Miw5ICsxMzQsNiBAQAogICAgICAgICB0cnkgewogICAgICAgICAgICAgaWYgKG5TdGF0ZW1lbnQgPT0gMCkgcmV0dXJuOwogICAgICAgICAgICAgLy8gZmluYWxpemVyIHNob3VsZCBORVZFUiBnZXQgY2FsbGVkCi0gICAgICAgICAgICBpZiAoU1FMaXRlRGVidWcuREVCVUdfQUNUSVZFX0NVUlNPUl9GSU5BTElaQVRJT04pIHsKLSAgICAgICAgICAgICAgICBMb2cudihUQUcsICIqKiB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uPigpOwogICAgIAogICAgIC8qKgogICAgICAqICBzdXBwb3J0IGZvciBhIGN1cnNvciB2YXJpYW50IHRoYXQgZG9lc24ndCBhbHdheXMgcmVhZCBhbGwgcmVzdWx0cwpAQCAtMTM2LDcgKzEzNyw3IEBACiAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICB0cnkgewotICAgICAgICAgICAgICAgICAgICBpbnQgY291bnQgPSBtUXVlcnkuZmlsbFdpbmRvdyhjdywgbU1heFJlYWQsIG1Db3VudCk7CisgICAgICAgICAgICAgICAgICAgIGludCBjb3VudCA9IGdldFF1ZXJ5KCkuZmlsbFdpbmRvdyhjdywgbU1heFJlYWQsIG1Db3VudCk7CiAgICAgICAgICAgICAgICAgICAgIC8vIHJldHVybiAtMSBtZWFucyBub3QgZmluaXNoZWQKICAgICAgICAgICAgICAgICAgICAgaWYgKGNvdW50ICE9IDApIHsKICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjb3VudCA9PSBOT19DT1VOVCl7CkBAIC0yMDEsMjQgKzIwMiw0NiBAQAogICAgICAqIGhhcyBwYWNrYWdlIHNjb3BlLgogICAgICAqCiAgICAgICogQHBhcmFtIGRiIGEgcmVmZXJlbmNlIHRvIGEgRGF0YWJhc2Ugb2JqZWN0IHRoYXQgaXMgYWxyZWFkeSBjb25zdHJ1Y3RlZAotICAgICAqICAgICBhbmQgb3BlbmVkCisgICAgICogICAgIGFuZCBvcGVuZWQuIFRoaXMgcGFyYW0gaXMgbm90IHVzZWQgYW55IGxvbmdlcgogICAgICAqIEBwYXJhbSBlZGl0VGFibGUgdGhlIG5hbWUgb2YgdGhlIHRhYmxlIHVzZWQgZm9yIHRoaXMgcXVlcnkKICAgICAgKiBAcGFyYW0gcXVlcnkgdGhlIHJlc3Qgb2YgdGhlIHF1ZXJ5IHRlcm1zCiAgICAgICogICAgIGN1cnNvciBpcyBmaW5hbGl6ZWQKKyAgICAgKiBAZGVw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vIFNldHVwIHRoZSBsaXN0IG9mIGNvbHVtbnMKICAgICAgICAgICAgIGludCBjb2x1bW5Db3VudCA9IG1RdWVyeS5jb2x1bW5Db3VudExvY2tlZCgpOwpAQCAtMjM5LDcgKzI2Miw3IEBACiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogICAgICAgICB9IGZpbmFsbHkgewotICAgICAgICAgICAgZGIudW5sb2NrKCk7CisgICAgICAgICAgICBxdWVyeS5tRGF0YWJhc2UudW5sb2NrKCk7CiAgICAgICAgIH0KICAgICB9CiAKQEAgLTI0Nyw3ICsyNzAsOSBAQAogICAgICAqIEByZXR1cm4gdGhlIFNRTGl0ZURhdGFiYXNlIHRoYXQgdGhpcyBjdXJzb3IgaXMgYXNzb2NpYXRlZCB3aXRoLgogICAgICAqLwogICAgIHB1YmxpYyBTUUxpdGVEYXRhYmFzZSBnZXREYXRhYmFzZSgpIHsKLSAgICAgICAgcmV0dXJuIG1EYXRhYmFzZTsKKyAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CisgICAgICAgICAgICByZXR1cm4gbVF1ZXJ5Lm1EYXRhYmFzZTsKKyAgICAgICAgfQogICAgIH0KIAogICAgIEBPdmVycmlkZQpAQCAtMjgzLDcgKzMwOCw3IEBACiAgICAgICAgICAgICAgICAgfQogICAgICAgICB9CiAgICAgICAgIG1XaW5kb3cuc2V0U3RhcnRQb3NpdGlvbihzdGFydFBvcyk7Ci0gICAgICAgIG1Db3VudCA9IG1RdWVyeS5maWxsV2luZG93KG1XaW5kb3csIG1Jbml0aWFsUmVhZCwgMCk7CisgICAgICAgIG1Db3VudCA9IGdldFF1ZXJ5KCkuZmlsbFdpbmRvdyhtV2luZG93LCBtSW5pdGlhbFJlYWQsIDApOwogICAgICAgICAvLyByZXR1cm4gLTEgbWVhbnMgbm90IGZpbmlzaGVkCiAgICAgICAgIGlmIChtQ291bnQgPT0gTk9fQ09VTlQpewogICAgICAgICAgICAgbUNvdW50ID0gc3RhcnRQb3MgKyBtSW5pdGlhbFJlYWQ7CkBAIC0yOTIsNiArMzE3LDEwIEBACiAgICAgICAgIH0gCiAgICAgfQogCisgICAgcHJpdmF0ZSBzeW5jaHJvbml6ZWQgU1FMaXRlUXVlcnkgZ2V0UXVlcnkoKSB7CisgICAgICAgIHJldHVybiBtUXVlcnk7CisgICAgfQorCiAgICAgQE92ZXJyaWRlCiAgICAgcHVibGljIGludCBnZXRDb2x1bW5JbmRleChTdHJpbmcgY29sdW1uTmFtZSkgewogICAgICAgICAvLyBDcmVhdGUgbUNvbHVtbk5hbWVNYXAgb24gZGVtYW5kCkBAIC0zMjEsMTY2ICszNTAsMTEgQEAKICAgICAgICAgfQogICAgIH0KIAotICAgIC8qKgotICAgICAqIEBoaWRlCi0gICAgICogQGRlcHJlY2F0ZWQKLSAgICAgKi8KLSAgICBAT3ZlcnJpZGUKLSAgICBwdWJsaWMgYm9vbGVhbiBkZWxldGVSb3coKSB7Ci0gICAgICAgIGNoZWNrUG9zaXRpb24oKTsKLQotICAgICAgICAvLyBPbmx5IGFsbG93IGRlbGV0ZXMgaWYgdGhlcmUgaXMgYW4gSUQgY29sdW1uLCBhbmQgdGhlIElEIGhhcyBiZWVuIHJlYWQgZnJvbSBpdAotICAgICAgICBpZiAobVJvd0lkQ29sdW1uSW5kZXggPT0gLTEgfHwgbUN1cnJlbnRSb3dJRCA9PSBudWxsKSB7Ci0gICAgICAgICAgICBMb2cuZShUQUcsCi0gICAgICAgICAgICAgICAgICAgICJDb3VsZCBub3QgZGVsZXRlIHJvdyBiZWNhdXNlIGVpdGhlciB0aGUgcm93IElEIGNvbHVtbiBpcyBub3QgYXZhaWxhYmxlIG9yIGl0IiArCi0gICAgICAgICAgICAgICAgICAgICJoYXMgbm90IGJlZW4gcmVhZC4iKTsKLSAgICAgICAgICAgIHJldHVybiBmYWxzZTsKLSAgICAgICAgfQotCi0gICAgICAgIGJvb2xlYW4gc3VjY2VzczsKLQotICAgICAgICAvKgotICAgICAgICAgKiBFbnN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kIGNvbHVtbj8iKTsKLSAgICAgICAgICAgIHJldHVybiBmYWxzZTsKLSAgICAgICAgfQotCi0gICAgICAgIC8qCi0gICAgICAgICAqIFByZXZlbnQgb3RoZXIgdGhyZWFkcyBmcm9tIGNoYW5naW5nIHRoZSB1cGRhdGVkIHJvd3Mgd2hpbGUgdGhleSdyZQotICAgICAgICAgKiBiZWluZyBwcm9jZXNzZWQgaGVyZS4KLSAgICAgICAgICovCi0gICAgICAgIHN5bmNocm9uaXplZCAobVVwZGF0ZWRSb3dzKSB7Ci0gICAgICAgICAgICBpZiAoYWRkaXRpb25hbFZhbHVlcyAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgbVVwZGF0ZWRSb3dzLnB1dEFsbChhZGRpdGlvbmFsVmFsdWVzKTsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgaWYgKG1VcGRhdGVkUm93cy5zaXplKCkgPT0gMCkgewotICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAvKgotICAgICAgICAgICAgICogUHJldmVudCBvdGhlciB0aHJlYWRzIGZyb20gY2hhbmdpbmcgdGhlIGRhdGFiYXNlIHN0YXRlIHdoaWxlCi0gICAgICAgICAgICAgKiB3ZSBwcm9jZXNzIHRoZSB1cGRhdGVkIHJvd3MsIGFuZCBwcmV2ZW50cyB1cyBmcm9tIGNoYW5naW5nIHRoZQotICAgICAgICAgICAgICogZGF0YWJhc2UgYmVoaW5kIHRoZSBiYWNrIG9mIGFub3RoZXIgdGhyZWFkLgotICAgICAgICAgICAgICovCi0gICAgICAgICAgICBtRGF0YWJhc2UuYmVnaW5UcmFuc2FjdGlvbigpOwotICAgICAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgICAgICBTdHJpbmdCdWlsZGVyIHNxbCA9IG5ldyBTdHJpbmdCdWlsZGVyKDEyOCk7Ci0KLSAgICAgICAgICAgICAgICAvLyBGb3IgZWFjaCByb3cgdGhhdCBoYXMgYmVlbiB1cGRhdGVkCi0gICAgICAgICAgICAgICAgZm9yIChNYXAuRW50cnk8TG9uZywgTWFwPFN0cmluZywgT2JqZWN0Pj4gcm93RW50cnkgOgotICAgICAgICAgICAgICAgICAgICAgICAgbVVwZGF0ZWRSb3dzLmVudHJ5U2V0KCkpIHsKLSAgICAgICAgICAgICAgICAgICAgTWFwPFN0cmluZywgT2JqZWN0PiB2YWx1ZXMgPSByb3dFbnRyeS5nZXRWYWx1ZSgpOwotICAgICAgICAgICAgICAgICAgICBMb25nIHJvd0lkT2JqID0gcm93RW50cnkuZ2V0S2V5KCk7Ci0KLSAgICAgICAgICAgICAgICAgICAgaWYgKHJvd0lkT2JqID09IG51bGwgfHwgdmFsdWVzID09IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oIm51bGwgcm93SWQgb3IgdmFsdWVzIGZvdW5kISByb3dJZCA9ICIKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyByb3dJZE9iaiArICIsIHZhbHVlcyA9ICIgKyB2YWx1ZXMpOwotICAgICAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICAgICAgaWYgKHZhbHVlcy5zaXplKCkgPT0gMCkgewotICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7Ci0gICAgICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgICAgICBsb25nIHJvd0lkID0gcm93SWRPYmoubG9uZ1ZhbHVlKCk7Ci0KLSAgICAgICAgICAgICAgICAgICAgSXRlcmF0b3I8TWFwLkVudHJ5PFN0cmluZywgT2JqZWN0Pj4gdmFsdWVzSXRlciA9Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVzLmVudHJ5U2V0KCkuaXRlcmF0b3IoKTsKLQotICAgICAgICAgICAgICAgICAgICBzcWwuc2V0TGVuZ3RoKDApOwotICAgICAgICAgICAgICAgICAgICBzcWwuYXBwZW5kKCJVUERBVEUgIiArIG1FZGl0VGFibGUgKyAiIFNFVCAiKTsKLQotICAgICAgICAgICAgICAgICAgICAvLyBGb3IgZWFjaCBjb2x1bW4gdmFsdWUgdGhhdCBoYXMgYmVlbiB1cGRhdGVkCi0gICAgICAgICAgICAgICAgICAgIE9iamVjdFtdIGJpbmRpbmdzID0gbmV3IE9iamVjdFt2YWx1ZXMuc2l6ZSgpXTsKLSAgICAgICAgICAgICAgICAgICAgaW50IGkgPSAwOwotICAgICAgICAgICAgICAgICAgICB3aGlsZSAodmFsdWVzSXRlci5oYXNOZXh0KCkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIE1hcC5FbnRyeTxTdHJpbmcsIE9iamVjdD4gZW50cnkgPSB2YWx1ZXNJdGVyLm5leHQoKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIHNxbC5hcHBlbmQoZW50cnkuZ2V0S2V5KCkpOwotICAgICAgICAgICAgICAgICAgICAgICAgc3FsLmFwcGVuZCgiPT8iKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGJpbmRpbmdzW2ldID0gZW50cnkuZ2V0VmFsdWUoKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2YWx1ZXNJdGVyLmhhc05leHQoKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNxbC5hcHBlbmQoIiwgIik7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICBpKys7Ci0gICAgICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgICAgICBzcWwuYXBwZW5kKCIgV0hFUkUgIiArIG1Db2x1bW5zW21Sb3dJZENvbHVtbkluZGV4XQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgJz0nICsgcm93SWQpOwotICAgICAgICAgICAgICAgICAgICBzcWwuYXBwZW5kKCc7Jyk7Ci0gICAgICAgICAgICAgICAgICAgIG1EYXRhYmFzZS5leGVjU1FMKHNxbC50b1N0cmluZygpLCBiaW5kaW5ncyk7Ci0gICAgICAgICAgICAgICAgICAgIG1EYXRhYmFzZS5yb3dVcGRhdGVkKG1FZGl0VGFibGUsIHJvd0lkKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgbURhdGFiYXNlLnNldFRyYW5zYWN0aW9uU3VjY2Vzc2Z1bCgpOwotICAgICAgICAgICAgfSBmaW5hbGx5IHsKLSAgICAgICAgICAgICAgICBtRGF0YWJhc2UuZW5kVHJhbnNhY3Rpb24oKTsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgbVVwZGF0ZWRSb3dzLmNsZWFyKCk7Ci0gICAgICAgIH0KLQotICAgICAgICAvLyBMZXQgYW55IGNoYW5nZSBvYnNlcnZlcnMga25vdyBhYm91dCB0aGUgdXBkYXRlCi0gICAgICAgIG9uQ2hhbmdlKHRydWUpOwotCi0gICAgICAgIHJldHVybiB0cnVlOwotICAgIH0KLQogICAgIHByaXZhdGUgdm9pZCBkZWFjdGl2YXRlQ29tbW9uKCkgewogICAgICAgICBpZiAoQ29uZmlnLkxPR1YpIExvZy52KFRBRywgIjw8PCBSZWxlYXNpbmcgY3Vyc29yICIgKyB0aGlzKTsKICAgICAgICAgbUN1cnNvclN0YXRlID0gMDsKQEAgLTUwMSw5ICszNzUsMzIgQEAKICAgICBAT3ZlcnJpZGUKICAgICBwdWJsaWMgdm9pZCBjbG9zZSgpIHsKICAgICAgICAgc3VwZXIuY2xvc2UoKTsKLSAgICAgICAgZGVhY3RpdmF0ZUNvbW1vbigpOwotICAgICAgICBtUXVlcnkuY2xvc2UoKTsKLSAgICAgICAgbURyaXZlci5jdXJzb3JDbG9zZWQoKTsKKyAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CisgICAgICAgICAgICBkZWFjdGl2YXRlQ29tbW9uKCk7CisgICAgICAgICAgICBtUXVlcnkuY2xvc2UoKTsKKyAgICAgICAgICAgIG1Ecml2ZXIuY3Vyc29yQ2xvc2VkKCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBTaG93IGEgd2FybmluZyBhZ2FpbnN0IHRoZSB1c2Ugb2YgcmVxdWVyeSgpIGlmIGNhbGxlZCBvbiB0aGUgbWFpbiB0aHJlYWQuCisgICAgICogVGhpcyB3YXJuaW5nIGlzIHNob3duIHBlciBkYXRhYmFzZSBwZXIgcHJvY2Vzcy4KKyAgICAgKi8KKyAgICBwcml2YXRlIHZvaWQgd2FybklmVWlUaHJlYWQoKSB7CisgICAgICAgIGlmIChMb29wZXIuZ2V0TWFpbkxvb3BlcigpID09IExvb3Blci5teUxvb3BlcigpKSB7CisgICAgICAgICAgICBTdHJpbmcgZGF0YWJhc2VQYXRoID0gZ2V0UXVlcnkoKS5tRGF0YWJhc2UuZ2V0UGF0aCgpOworICAgICAgICAgICAgLy8gV2Ugc2hvdyB0aGUgd2FybmluZyBvbmNlIHBlciBkYXRhYmFzZSBpbiBvcmRlciBub3QgdG8gc3BhbSBsb2djYXQuCisgICAgICAgICAgICBpZiAoIXNBbHJlYWR5V2FybmVkLmNvbnRhaW5zS2V5KGRhdGFiYXNlUGF0aCkpIHsKKyAgICAgICAgICAgICAgICBzQWxyZWFkeVdhcm5lZC5wdXQoZGF0YWJhc2VQYXRoLCB0cnVlKTsKKyAgICAgICAgICAgICAgICBTdHJpbmcgcGFja2FnZU5hbWUgPSBBY3Rpdml0eVRocmVhZC5jdXJyZW50UGFja2FnZU5hbWUoKTsKKyAgICAgICAgICAgICAgICBUaHJvd2FibGUgdCA9IG51bGw7CisgICAgICAgICAgICAgICAgLy8gQkVHSU4gU1RPUFNISVAgcmVtb3ZlIHRoZSBmb2xsb3dpbmcgbGluZQorICAgICAgICAgICAgICAgIHQgPSBuZXcgUmVxdWVyeU9uVWlUaHJlYWRFeGNlcHRpb24ocGFja2FnZU5hbWUpOworICAgICAgICAgICAgICAgIC8vIEVORCBTVE9QU0hJUAorICAgICAgICAgICAgICAgIExvZy53KFRBRywgInNob3VsZCBub3QgYXR0ZW1wdCByZXF1ZXJ5IG9uIG1haW4gKFVJKSB0aHJlYWQ6IGFwcCA9ICIgKworICAgICAgICAgICAgICAgICAgICAgICAgcGFja2FnZU5hbWUgPT0gbnVsbCA/ICIndW5rbm93biciIDogcGFja2FnZU5hbWUsIHQpOworICAgICAgICAgICAgfQorICAgICAgICB9CiAgICAgfQogCiAgICAgQE92ZXJyaWRlCkBAIC01MTEsMjAgKzQwOCwzMCBAQAogICAgICAgICBpZiAoaXNDbG9zZWQoKSkgewogICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICB9CisgICAgICAgIHdhcm5JZlVpVGhyZWFkKCk7CiAgICAgICAgIGxvbmcgdGltZVN0YXJ0ID0gMDsKICAgICAgICAgaWYgKENvbmZpZy5MT0dWKSB7CiAgICAgICAgICAgICB0aW1lU3RhcnQgPSBTeXN0ZW0uY3VycmVudFRpbWVNaWxsaXMoKTsKICAgICAgICAgfQotICAgICAgICAvKgotICAgICAgICAgKiBTeW5jaHJvbml6ZSBvbiB0aGUgZGF0YWJhc2UgbG9jayB0byBlbnN1cmUgdGhhdCBtQ291bnQgbWF0Y2hlcyB0aGUKLSAgICAgICAgICogcmVzdWx0cyBvZiBtUXVlcnkucmVxdWVyeSgpLgotICAgICAgICAgKi8KLSAgICAgICAgbURhdGFiYXNlLmxvY2soKTsKLSAgICAgICAgdHJ5IHsKKworICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKICAgICAgICAgICAgIGlmIChtV2luZG93ICE9IG51bGwpIHsKICAgICAgICAgICAgICAgICBtV2luZG93LmNsZWFyKCk7CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBtUG9zID0gLTE7CisgICAgICAgICAgICBTUUxpdGVEYXRhYmFzZSBkYiA9IG1RdWVyeS5tRGF0YWJhc2UuZ2V0RGF0YWJhc2VIYW5kbGUobVF1ZXJ5Lm1TcWwpOworICAgICAgICAgICAgaWYgKCFkYi5lcXVhbHMobVF1ZXJ5Lm1EYXRhYmFzZSkpIHsKKyAgICAgICAgICAgICAgICAvLyBzaW5jZSB3ZSBuZWVkIHRvIHVzZSBhIGRpZmZlcmVudCBkYXRhYmFzZSBjb25uZWN0aW9uIGhhbmRsZSwKKyAgICAgICAgICAgICAgICAvLyByZS1jb21waWxlIHRoZSBxdWVyeQorICAgICAgICAgICAgICAgIGRiLmxvY2soKTsKKyAgICAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgICAgICAvLyBjbG9zZSB0aGUgb2xkIG1RdWVyeSBvYmplY3QgYW5kIG9wZW4gYSBuZXcgb25lCisgICAgICAgICAgICAgICAgICAgIG1RdWVyeS5jbG9zZSgpOworICAgICAgICAgICAgICAgICAgICBtUXVlcnkgPSBuZXcgU1FMaXRlUXVlcnkoZGIsIG1RdWVyeSk7CisgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKKyAgICAgICAgICAgICAgICAgICAgZGIudW5sb2NrKCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQogICAgICAgICAgICAgLy8gVGhpcyBvbmUgd2lsbCByZWNyZWF0ZSB0aGUgdGVtcCB0YWJsZSwgYW5kIGdldCBpdHMgY291bnQKICAgICAgICAgICAgIG1Ecml2ZXIuY3Vyc29yUmVxdWVyaWVkKHRoaXMpOwogICAgICAgICAgICAgbUNvdW50ID0gTk9fQ09VTlQ7CkBAIC01MzUsOCArNDQyLDYgQEAKICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgcXVlcnlUaHJlYWRVbmxvY2soKTsKICAgICAgICAgICAgIH0KLSAgICAgICAgfSBmaW5hbGx5IHsKLSAgICAgICAgICAgIG1EYXRhYmFzZS51bmxvY2soKTsKICAgICAgICAgfQogCiAgICAgICAgIGlmIChDb25maWcuTE9HVikgewpAQCAtNTg0LDE0ICs0ODksMTQgQEAKICAgICAgICAgICAgIGlmIChtV2luZG93ICE9IG51bGwpIHsKICAgICAgICAgICAgICAgICBpbnQgbGVuID0gbVF1ZXJ5Lm1TcWwubGVuZ3RoKCk7CiAgICAgICAgICAgICAgICAgTG9nLmUoVEFHLCAiRmluYWxpemluZyBhIEN1cnNvciB0aGF0IGhhcyBub3QgYmVlbiBkZWFjdGl2YXRlZCBvciBjbG9zZWQuICIgKwotICAgICAgICAgICAgICAgICAgICAgICAgImRhdGFiYXNlID0gIiArIG1EYXRhYmFzZS5nZXRQYXRoKCkgKyAiLCB0YWJsZSA9ICIgKyBtRWRpdFRhYmxlICsKKyAgICAgICAgICAgICAgICAgICAgICAgICJkYXRhYmFzZSA9ICIgKyBtUXVlcnkubURhdGFiYXNlLmdldFBhdGgoKSArICIsIHRhYmxlID0gIiArIG1FZGl0VGFibGUgKwogICAgICAgICAgICAgICAgICAgICAgICAgIiwgcXVlcnkgPSAiICsgbVF1ZXJ5Lm1TcWwuc3Vic3RyaW5nKDAsIChsZW4gPiAxMDApID8gMTAwIDogbGVuKSwKICAgICAgICAgICAgICAgICAgICAgICAgIG1TdGFja1RyYWNlKTsKICAgICAgICAgICAgICAgICBjbG9zZSgpOwogICAgICAgICAgICAgICAgIFNRTGl0ZURlYnVnLm5vdGlmeUFjdGl2ZUN1cnNvckZpbmFsaXplZCgpOwogICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICBpZiAoQ29uZmlnLkxPR1YpIHsKLSAgICAgICAgICAgICAgICAgICAgTG9nLnYoVEFHLCAiRmluYWxpemluZyBjdXJzb3Igb24gZGF0YWJhc2UgPSAiICsgbURhdGFiYXNlLmdldFBhdGgoKSArCisgICAgICAgICAgICAgICAgICAgIExvZy52KFRBRywgIkZpbmFsaXppbmcgY3Vyc29yIG9uIGRhdGFiYXNlID0gIiArIG1RdWVyeS5tRGF0YWJhc2UuZ2V0UGF0aCgpICsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiLCB0YWJsZSA9ICIgKyBtRWRpdFRhYmxlICsgIiwgcXVlcnkgPSAiICsgbVF1ZXJ5Lm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RlciB0cmFuc2FjdGlvbiBpcyBlbmRlZCBhbGwgb2YgdGhlIHdvcmsgZG9uZSBpbiB0aGF0IHRyYW5zYWN0aW9uCisgICAgICogYW5kIGFsbCBvZiB0aGUgbmVzdGVkIHRyYW5zYWN0aW9ucyB3aWxsIGJlIGNvbW1pdHRlZCBvciByb2xsZWQgYmFjay4gVGhlCisgICAgICogY2hhbmdlcyB3aWxsIGJlIHJvbGxlZCBiYWNrIGlmIGFueSB0cmFuc2FjdGlvbiBpcyBlbmRlZCB3aXRob3V0IGJlaW5nCisgICAgICogbWFya2VkIGFzIGNsZWFuIChieSBjYWxsaW5nIHNldFRyYW5zYWN0aW9uU3VjY2Vzc2Z1bCkuIE90aGVyd2lzZSB0aGV5CisgICAgICogd2lsbCBiZSBjb21taXR0ZWQuCisgICAgICogPHA+CisgICAgICogSGVyZSBpcyB0aGUgc3RhbmRhcmQgaWRpb20gZm9yIHRyYW5zYWN0aW9uczoKKyAgICAgKgorICAgICAqIDxwcmU+CisgICAgICogICBkYi5iZWdpblRyYW5zYWN0aW9uTm9uRXhjbHVzaXZlKCk7CisgICAgICogICB0cnkgeworICAgICAqICAgICAuLi4KKyAgICAgKiAgICAgZGIuc2V0VHJhbnNhY3Rpb25TdWNjZXNzZnVsKCk7CisgICAgICogICB9IGZpbmFsbHkgeworICAgICAqICAgICBkYi5lbmRUcmFuc2FjdGlvbigpOworICAgICAqICAgfQorICAgICAqIDwvcHJlPgorICAgICAqLworICAgIHB1YmxpYyB2b2lkIGJlZ2luVHJhbnNhY3Rpb25Ob25FeGNsdXNpdmUoKSB7CisgICAgICAgIGJlZ2luVHJhbnNhY3Rpb24obnVsbCAvKiB0cmFuc2FjdGlvblN0YXR1c0NhbGxiYWNrICovLCBmYWxzZSk7CisgICAgfQorCisgICAgLyoqCisgICAgICogQmVnaW5zIGEgdHJhbnNhY3Rpb24gaW4gRVhDTFVTSVZFIG1vZGUuCisgICAgICogPHA+CisgICAgICogVHJhbnNhY3Rpb25zIGN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otICAgICAgICB9CisgICAgICAgIHZlcmlmeUxvY2tPd25lcigpOwogICAgICAgICB0cnkgewogICAgICAgICAgICAgaWYgKG1Jbm5lclRyYW5zYWN0aW9uSXNTdWNjZXNzZnVsKSB7CiAgICAgICAgICAgICAgICAgbUlubmVyVHJhbnNhY3Rpb25Jc1N1Y2Nlc3NmdWwgPSBmYWxzZTsKQEAgLTU4MSw2ICs2ODIsMTggQEAKICAgICAgICAgICAgIH0KICAgICAgICAgICAgIGlmIChtVHJhbnNhY3Rpb25Jc1N1Y2Nlc3NmdWwpIHsKICAgICAgICAgICAgICAgICBleGVjU1FMKENPTU1JVF9TUUwpOworICAgICAgICAgICAgICAgIC8vIGlmIHdyaXRlLWFoZWFkIGxvZ2dpbmcgaXMgdXNlZCwgd2UgaGF2ZSB0byB0YWtlIGNhcmUgb2YgY2hlY2twb2ludC4KKyAgICAgICAgICAgICAgICAvLyBUT0RPOiBzaG91bGQgYXBwbGljYXRpb25zIGJlIGdpdmVuIHRoZSBmbGV4aWJpbGl0eSBvZiBjaG9vc2luZyB3aGVuIHRvCisgICAgICAgICAgICAgICAgLy8gdHJpZ2dlciBjaGVja3BvaW50PworICAgICAgICAgICAgICAgIC8vIGZvciBub3csIGRvIGNoZWNrcG9pbnQgYWZ0ZXIgZXZlcnkgQ09NTUlUIGJlY2F1c2UgdGhhdCBpcyB0aGUgZmFzdGVzdAorICAgICAgICAgICAgICAgIC8vIHdheSB0byBndWFyYW50ZWUgdGhhdCByZWFkZXJzIHdpbGwgc2VlIGxhdGVzdCBkYXRhLgorICAgICAgICAgICAgICAgIC8vIGJ1dCB0aGlzIGlzIHRoZSBzbG93ZXN0IHdheSB0byBydW4gc3FsaXRlIHdpdGggaW4gd3JpdGUtYWhlYWQgbG9nZ2luZyBtb2RlLgorICAgICAgICAgICAgICAgIGlmICh0aGlzLm1Db25uZWN0aW9uUG9vbCAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIGV4ZWNTUUwoIlBSQUdNQSB3YWxfY2hlY2twb2ludDsiKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKFNRTGl0ZURlYnVnLkRFQlVHX1NRTF9TVEFURU1FTlRTKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBMb2cuaShUQUcsICJQUkFHTUEgd2FsX0NoZWNrcG9pbnQgZG9uZSIpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICBleGVjU1FMKCJST0xMQkFDSzsiKTsKQEAgLTYxNCw5ICs3MjcsNyBAQAogICAgICAqIHRyYW5zYWN0aW9uIGlzIGFscmVhZHkgbWFya2VkIGFzIHN1Y2Nlc3NmdWwuCiAgICAgICovCiAgICAgcHVibGljIHZvaWQgc2V0VHJhbnNhY3Rpb25TdWNjZXNzZnVsKCkgewotICAgICAgICBpZiAoIWlzT3BlbigpKSB7Ci0gICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJkYXRhYmFzZSBub3Qgb3BlbiIpOwotICAgICAgICB9CisgICAgICAgIHZlcmlmeURiSXNPcGVuKCk7CiAgICAgICAgIGlmICghbUxvY2suaXNIZWxkQnlDdXJyZW50VGhyZWFkKCkpIHsKICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oIm5vIHRyYW5zYWN0aW9uIHBlbmRpbmciKTsKICAgICAgICAgfQpAQCAtNjMxLDcgKzc0Miw1MCBAQAogICAgICAqIHJldHVybiB0cnVlIGlmIHRoZXJlIGlzIGEgdHJhbnNhY3Rpb24gcGVuZGluZwogICAgICAqLwogICAgIHB1YmxpYyBib29sZWFuIGluVHJhbnNhY3Rpb24oKSB7Ci0gICAgICAgIHJldHVybiBtTG9jay5nZXRIb2xkQ291bnQoKSA+IDA7CisgICAgICAgIHJldHVybiBtTG9jay5nZXRIb2xkQ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WMgc3RyaW5nIHdpdGggc3BlY2lhbCBtZWFuaW5nIGZvciBTUUxpdGUuCi0gICAgICAgIHJldHVybiBvcGVuRGF0YWJhc2UoIjptZW1vcnk6IiwgZmFjdG9yeSwgQ1JFQVRFX0lGX05FQ0VTU0FSWSk7CisgICAgICAgIHJldHVybiBvcGVuRGF0YWJhc2UoTUVNT1JZX0RCX1BBVEgsIGZhY3RvcnksIENSRUFURV9JRl9ORUNFU1NBUlkpOwogICAgIH0KIAogICAgIC8qKgpAQCAtODc3LDE4ICsxMDU4LDMxIEBACiAgICAgICAgIGlmICghaXNPcGVuKCkpIHsKICAgICAgICAgICAgIHJldHVybjsgLy8gYWxyZWFkeSBjbG9zZWQKICAgICAgICAgfQorICAgICAgICBpZiAoTG9nLmlzTG9nZ2FibGUoVEFHLCBMb2cuREVCVUcpKSB7CisgICAgICAgICAgICBMb2cuaShUQUcsICJjbG9zaW5nIGRiOiAiICsgbVBhdGggKyAiIChjb25uZWN0aW9uICMgIiArIG1Db25uZWN0aW9uTnVtKTsKKyAgICAgICAgfQogICAgICAgICBsb2NrKCk7CiAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICBjbG9zZUNsb3NhYmxlKCk7CisgICAgICAgICAgICAvLyBmaW5hbGl6ZSBBTEwgc3RhdGVtZW50cyBxdWV1ZWQgdXAgc28gZmFyCisgICAgICAgICAgICBjbG9zZVBlbmRpbmdTdGF0ZW1lbnRzKCk7CisgICAgICAgICAgICByZWxlYXNlQ3VzdG9tRnVuY3Rpb25zKCk7CiAgICAgICAgICAgICAvLyBjbG9zZSB0aGlzIGRhdGFiYXNlIGluc3RhbmNlIC0gcmVnYXJkbGVzcyBvZiBpdHMgcmVmZXJlbmNlIGNvdW50IHZhbHVlCi0gICAgICAgICAgICBvbkFsbFJlZmVyZW5jZXNSZWxlYXNlZCgpOworICAgICAgICAgICAgZGJjbG9zZSgpOworICAgICAgICAgICAgaWYgKG1Db25uZWN0aW9uUG9vbCAhPSBudWxsKSB7Cisg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YXRhYmFzZSBzaXplCiAgICAgICovCiAgICAgcHVibGljIGxvbmcgc2V0TWF4aW11bVNpemUobG9uZyBudW1CeXRlcykgewotICAgICAgICBTUUxpdGVTdGF0ZW1lbnQgcHJvZyA9IG51bGw7Ci0gICAgICAgIGxvY2soKTsKLSAgICAgICAgaWYgKCFpc09wZW4oKSkgewotICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigiZGF0YWJhc2Ugbm90IG9wZW4iKTsKKyAgICAgICAgbG9uZyBwYWdlU2l6ZSA9IGdldFBhZ2VTaXplKCk7CisgICAgICAgIGxvbmcgbnVtUGFnZXMgPSBudW1CeXRlcyAvIHBhZ2VTaXplOworICAgICAgICAvLyBJZiBudW1CeXRlcyBpc24ndCBhIG11bHRpcGxlIG9mIHBhZ2VTaXplLCBidW1wIHVwIGEgcGFnZQorICAgICAgICBpZiAoKG51bUJ5dGVzICUgcGFnZVNpemUpICE9IDApIHsKKyAgICAgICAgICAgIG51bVBhZ2VzKys7CiAgICAgICAgIH0KLSAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgIGxvbmcgcGFnZVNpemUgPSBnZXRQYWdlU2l6ZSgpOwotICAgICAgICAgICAgbG9uZyBudW1QYWdlcyA9IG51bUJ5dGVzIC8gcGFnZVNpemU7Ci0gICAgICAgICAgICAvLyBJZiBudW1CeXRlcyBpc24ndCBhIG11bHRpcGxlIG9mIHBhZ2VTaXplLCBidW1wIHVwIGEgcGFnZQotICAgICAgICAgICAgaWYgKChudW1CeXRlcyAlIHBhZ2VTaXplKSAhPSAwKSB7Ci0gICAgICAgICAgICAgICAgbnVtUGFnZXMrKzsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHByb2cgPSBuZXcgU1FMaXRlU3RhdGVtZW50KHRoaXMsCi0gICAgICAgICAgICAgICAgICAgICJQUkFHTUEgbWF4X3BhZ2VfY291bnQgPSAiICsgbnVtUGFnZXMpOwotICAgICAgICAgICAgbG9u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09wZW4oKTsKICAgICAgICAgQmxvY2tHdWFyZC5nZXRUaHJlYWRQb2xpY3koKS5vblJlYWRGcm9tRGlzaygpOwogICAgICAgICBsb25nIHRpbWVTdGFydCA9IDA7CiAKQEAgLTEzNDksNyArMTQ4NSw4IEBACiAgICAgICAgICAgICB0aW1lU3RhcnQgPSBTeXN0ZW0uY3VycmVudFRpbWVNaWxsaXMoKTsKICAgICAgICAgfQogCi0gICAgICAgIFNRTGl0ZUN1cnNvckRyaXZlciBkcml2ZXIgPSBuZXcgU1FMaXRlRGlyZWN0Q3Vyc29yRHJpdmVyKHRoaXMsIHNxbCwgZWRpdFRhYmxlKTsKKyAgICAgICAgU1FMaXRlRGF0YWJhc2UgZGIgPSBnZXREYkNvbm5lY3Rpb24oc3FsKTsKKyAgICAgICAgU1FMaXRlQ3Vyc29yRHJpdmVyIGRyaXZlciA9IG5ldyBTUUxpdGVEaXJlY3RDdXJzb3JEcml2ZXIoZGIsIHNxbCwgZWRpdFRhYmxlKTsKIAogICAgICAgICBDdXJzb3IgY3Vyc29yID0gbnVsbDsKICAgICAgICAgdHJ5IHsKQEAgLTEzNzUsNiArMTUxMiw3IEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOiAiPG51bGw+IikgICsgIiwgY291bnQgaXMgIiArIGNvdW50KTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CisgICAgICAgICAgICByZWxlYXNlRGJDb25uZWN0aW9uKGRiKTsKICAgICAgICAgfQogICAgICAgICByZXR1cm4gY3Vyc29yOwogICAgIH0KQEAgLTE1MDEsODQgKzE2MzksNDEgQEAKICAgICAgKi8KICAgICBwdWJsaWMgbG9uZyBpbnNlcnRXaXRoT25Db25mbGljdChTdHJpbmcgdGFibGUsIFN0cmluZyBudWxsQ29sdW1uSGFjaywKICAgICAgICAgICAgIENvbnRlbnRWYWx1ZXMgaW5pdGlhbFZhbHVlcywgaW50IGNvbmZsaWN0QWxnb3JpdGhtKSB7Ci0gIC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udHJpZXNJdGVyID0gZW50cnlTZXQuaXRlcmF0b3IoKTsKLSAgICAgICAgICAgIHNxbC5hcHBlbmQoJygnKTsKLQotICAgICAgICAgICAgYm9vbGVhbiBuZWVkU2VwYXJhdG9yID0gZmFsc2U7Ci0gICAgICAgICAgICB3aGlsZSAoZW50cmllc0l0ZXIuaGFzTmV4dCgpKSB7Ci0gICAgICAgICAgICAgICAgaWYgKG5lZWRTZXBhcmF0b3IpIHsKLSAgICAgICAgICAgICAgICAgICAgc3FsLmFwcGVuZCgiLCAiKTsKLSAgICAgICAgICAgICAgICAgICAgdmFsdWVzLmFwcGVuZCgiLCAiKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgbmVlZFNlcGFyYXRvciA9IHRydWU7Ci0gICAgICAgICAgICAgICAgTWFwLkVudHJ5PFN0cmluZywgT2JqZWN0PiBlbnRyeSA9IGVudHJpZXNJdGVyLm5leHQoKTsKLSAgICAgICAgICAgICAgICBzcWwuYXBwZW5kKGVudHJ5LmdldEtleSgpKTsKLSAgICAgICAgICAgICAgICB2YWx1ZXMuYXBwZW5kKCc/Jyk7CisgICAgICAgIE9iamVjdFtdIGJpbmRBcmdzID0gbnVsbDsKKyAgICAgICAgaW50IHNpemUgPSAoaW5pdGlhbFZhbHVlcyAhPSBudWxsICYmIGluaXRpYWxWYWx1ZXMuc2l6ZSgpID4gMCkgPyBpbml0aWFsVmFsdWVzLnNpemUoKSA6IDA7CisgICAgICAgIGlmIChzaXplID4gMCkgeworICAgICAgICAgICAgYmluZEFyZ3MgPSBuZXcgT2JqZWN0W3NpemVdOworICAgICAgICAgICAgaW50IGkgPSAwOworICAgICAgICAgICAgZm9yIChTdHJpbmcgY29sTmFtZSA6IGluaXRpYWxWYWx1ZXMua2V5U2V0KCkpIHsKKyAgICAgICAgICAgICAgICBzcWwuYXBwZW5kKChpID4gMCkgPyAiLCIgOiAiIik7CisgICAgICAgICAgICAgICAgc3FsLmFwcGVuZChjb2xOYW1lKTsKKyAgICAgICAgICAgICAgICBiaW5kQXJnc1tpKytdID0gaW5pdGlhbFZhbHVlcy5nZXQoY29sTmFtZSk7CiAgICAgICAgICAgICB9Ci0KICAgICAgICAgICAgIHNxbC5hcHBlbmQoJyknKTsKKyAgICAgICAgICAgIHNxbC5hcHBlbmQoIiBWQUxVRVMgKCIpOworICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IHNpemU7IGkrKykgeworICAgICAgICAgICAgICAgIHNxbC5hcHBlbmQoKGkgPiAwKSA/ICIsPyIgOiAiPyIpOworICAgICAgICAgICAgfQogICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgc3FsLmFwcGVuZCgiKCIgKyBudWxsQ29sdW1uSGFjayArICIpICIpOwotICAgICAgICAgICAgdmFsdWVzLmFwcGVuZCgiTlVMTCIpOworICAgICAgICAgICAgc3FsLmFwcGVuZChudWxsQ29sdW1uSGFjayArICIpIFZBTFVFUyAoTlVMTCIpOwogICAgICAgICB9CisgICAgICAgIHNxbC5hcHBlbmQoJyknKTsKIAotICAgICAgICBzcWwuYXBwZW5kKCIgVkFMVUVTKCIpOwotICAgICAgICBzcWwuYXBwZW5kKHZhbHVlcyk7Ci0gICAgICAgIHNxbC5hcHBlbmQoIik7Iik7Ci0KLSAgICAgICAgbG9jaygpOwotICAgICAgICBTUUxpdGVTdGF0ZW1lbnQgc3RhdGVtZW50ID0gbnVsbDsKKyAgICAgICAgU1FMaXRlU3RhdGVtZW50IHN0YXRlbWVudCA9IG5ldyBTUUxpdGVTdGF0ZW1lbnQodGhpcywgc3FsLnRvU3RyaW5nKCksIGJpbmRBcmdzKTsKICAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgIHN0YXRlbWVudCA9IGNvbXBpbGVTdGF0ZW1lbnQoc3FsLnRvU3RyaW5nKCkpOwotCi0gICAgICAgICAgICAvLyBCaW5kIHRoZSB2YWx1ZXMKLSAgICAgICAgICAgIGlmIChlbnRyeVNldCAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgaW50IHNpemUgPSBlbnRyeVNldC5zaXplKCk7Ci0gICAgICAgICAgICAgICAgSXRlcmF0b3I8TWFwLkVudHJ5PFN0cmluZywgT2JqZWN0Pj4gZW50cmllc0l0ZXIgPSBlbnRyeVNldC5pdGVyYXRvcigpOwotICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgc2l6ZTsgaSsrKSB7Ci0gICAgICAgICAgICAgICAgICAgIE1hcC5FbnRyeTxTdHJpbmcsIE9iamVjdD4gZW50cnkgPSBlbnRyaWVzSXRlci5uZXh0KCk7Ci0gICAgICAgICAgICAgICAgICAgIERhdGFiYXNlVXRpbHMuYmluZE9iamVjdFRvUHJvZ3JhbShzdGF0ZW1lbnQsIGkgKyAxLCBlbnRyeS5nZXRWYWx1ZSgpKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIC8vIFJ1biB0aGUgcHJvZ3JhbSBhbmQgdGhlbiBjbGVhbnVwCi0gICAgICAgICAgICBzdGF0ZW1lbnQuZXhlY3V0ZSgpOwotCi0gICAgICAgICAgICBsb25nIGluc2VydGVkUm93SWQgPSBsYXN0SW5zZXJ0Um93KCk7Ci0gICAgICAgICAgICBpZiAoaW5zZXJ0ZWRSb3dJZCA9PSAtMSkgewotICAgICAgICAgICAgICAgIExvZy5lKFRBRywgIkVycm9yIGluc2VydGluZyAiICsgaW5pdGlhbFZhbHVlcyArICIgdXNpbmcgIiArIHNxbCk7Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIGlmIChDb25maWcuTE9HRCAmJiBMb2cuaXNMb2dnYWJsZShUQUcsIExvZy5WRVJCT1NFKSkgewotICAgICAgICAgICAgICAgICAgICBMb2cudihUQUcsICJJbnNlcnRpbmcgcm93ICIgKyBpbnNlcnRlZFJvd0lkICsgIiBmcm9tICIKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICArIGluaXRpYWxWYWx1ZXMgKyA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KHRoaXMsICJERUxFVEUgRlJPTSAiICsgdGFibGUgKworICAgICAgICAgICAgICAgICghVGV4dFV0aWxzLmlzRW1wdHkod2hlcmVDbGF1c2UpID8gIiBXSEVSRSAiICsgd2hlcmVDbGF1c2UgOiAiIiksIHdoZXJlQXJncyk7CiAgICAgICAgIHRyeSB7Ci0gICAgICAgICAgICBzdGF0ZW1lbnQgPSBjb21waWxlU3RhdGVtZW50KCJERUxFVEUgRlJPTSAiICsgdGFibGUKLSAgICAgICAgICAgICAgICAgICAgKyAoIVRleHRVdGlscy5pc0VtcHR5KHdoZXJlQ2xhdXNlKQotICAgICAgICAgICAgICAgICAgICA/ICIgV0hFUkUgIiArIHdoZXJlQ2xhdXNlIDogIiIpKTsKLSAgICAgICAgICAgIGlmICh3aGVyZUFyZ3MgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgIGludCBudW1BcmdzID0gd2hlcmVBcmdzLmxlbmd0aDsKLSAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IG51bUFyZ3M7IGkrKykgewotICAgICAgICAgICAgICAgICAgICBEYXRhYmFzZVV0aWxzLmJpbmRPYmplY3RUb1Byb2dyYW0oc3RhdGVtZW50LCBpICsgMSwgd2hlcmVBcmdzW2ldKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBzdGF0ZW1lbnQuZXhlY3V0ZSgpOwotICAgICAgICAgICAgcmV0dXJuIGxhc3RDaGFuZ2VDb3VudCgpOworICAgICAgICAgICAgcmV0dXJuIHN0YXRlbWVudC5leGVjdXRlVXBkYXRlRGVsZXRlKCk7CiAgICAgICAgIH0gY2F0Y2ggKFNRTGl0ZURhdGFiYXNlQ29ycnVwdEV4Y2VwdGlvbiBlKSB7CiAgICAgICAgICAgICBvbkNvcnJ1cHRpb24oKTsKICAgICAgICAgICAgIHRocm93IGU7CiAgICAgICAgIH0gZmluYWxseSB7Ci0gICAgICAgICAgICBpZiAoc3RhdGVtZW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ICAgICAgYmluZEFyZysrOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBpZiAod2hlcmVBcmdzICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICBzaXplID0gd2hlcmVBcmdzLmxlbmd0aDsKLSAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IHNpemU7IGkrKykgewotICAgICAgICAgICAgICAgICAgICBzdGF0ZW1lbnQuYmluZFN0cmluZyhiaW5kQXJnLCB3aGVyZUFyZ3NbaV0pOwotICAgICAgICAgICAgICAgICAgICBiaW5kQXJnKys7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAvLyBSdW4gdGhlIHByb2dyYW0gYW5kIHRoZW4gY2xlYW51cAotICAgICAgICAgICAgc3RhdGVtZW50LmV4ZWN1dGUoKTsKLSAgICAgICAgICAgIGludCBudW1DaGFuZ2VkUm93cyA9IGxhc3RDaGFuZ2VDb3VudCgpOwotICAgICAgICAgICAgaWYgKENvbmZpZy5MT0dEICYmIExvZy5pc0xvZ2dhYmxlKFRBRywgTG9nLlZFUkJPU0UpKSB7Ci0gICAgICAgICAgICAgICAgTG9nLnYoVEFHLCAiVXBkYXRlZCAiICsgbnVtQ2hhbmdlZFJvd3MgKyAiIHVzaW5nICIgKyB2YWx1ZXMgKyAiIGFuZCAiICsgc3FsKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHJldHVybiBudW1DaGFuZ2VkUm93czsKKyAgICAgICAgICAgIHJldHVybiBzdGF0ZW1lbnQuZXhlY3V0ZVVwZGF0ZURlbGV0ZSgpOwogICAgICAgICB9IGNhdGNoIChTUUxpdGVEYXRhYmFzZUNvcnJ1cHRFeGNlcHRpb24gZSkgewogICAgICAgICAgICAgb25Db3JydXB0aW9uKCk7CiAgICAgICAgICAgICB0aHJvdyBlOwotICAgICAgICB9IGNhdGNoIChTUUxFeGNlcHRpb24gZSkgewotICAgICAgICAgICAgTG9nLmUoVEFHLCAiR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gorICAgICAqIDx1bD4KKyAgICAgKiAgIDxsaT57QGxpbmsgI3VwZGF0ZShTdHJpbmcsIENvbnRlbnRWYWx1ZXMsIFN0cmluZywgU3RyaW5nW10pfTwvbGk+CisgICAgICogICA8bGk+e0BsaW5rICN1cGRhdGVXaXRoT25Db25mbGljdChTdHJpbmcsIENvbnRlbnRWYWx1ZXMsIFN0cmluZywgU3RyaW5nW10sIGludCl9PC9saT4KKyAgICAgKiA8L3VsPgorICAgICAqIDxwPgorICAgICAqIEZvciBERUxFVEUgc3RhdGVtZW50cywgdXNlIGFueSBvZiB0aGUgZm9sbG93aW5nIGluc3RlYWQuCisgICAgICogPHVsPgorICAgICAqICAgPGxpPntAbGluayAjZGVsZXRlKFN0cmluZywgU3RyaW5nLCBTdHJpbmdbXSl9PC9saT4KKyAgICAgKiA8L3VsPgorICAgICAqIDxwPgorICAgICAqIEZvciBleGFtcGxlLCB0aGUgZm9sbG93aW5nIGFyZSBnb29kIGNhbmRpZGF0ZXMgZm9yIHVzaW5nIHRoaXMgbWV0aG9kOgorICAgICAqIDx1bD4KKyAgICAgKiAgIDxsaT5BTFRFUiBUQUJMRTwvbGk+CisgICAgICogICA8bGk+Q1JFQVRFIG9yIERST1AgdGFibGUgLyB0cmlnZ2VyIC8gdmlldyAvIGluZGV4IC8gdmlydHVhbCB0YWJsZTwvbGk+CisgICAgICogICA8bGk+UkVJTkRFWDwvbGk+CisgICAgICogICA8bGk+UkVMRUFTRTwvbGk+CisgICAgICogICA8bGk+U0FWRVBPSU5UPC9saT4KKyAgICAgKiAgIDxsaT5QUkFHTUEgdGhhdCByZXR1cm5zIG5vIGRhdGE8L2xpPgorICAgICAqIDwvdWw+CisgICAgICogPC9wPgorICAgICAqIDxwPgorICAgICAqIFdoZW4gdXNpbmcge0BsaW5rICNlbmFibGVXcml0ZUFoZWFkTG9nZ2luZygpfSwgam91cm5hbF9tb2RlIGlzCisgICAgICogYXV0b21hdGljYWxseSBtYW5hZ2VkIGJ5IHRoaX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IGU7CiAgICAgICAgIH0gZmluYWxseSB7Ci0gICAgICAgICAgICBpZiAoc3RhdGVtZW50ICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICBzdGF0ZW1lbnQuY2xvc2UoKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHVubG9jaygpOworICAgICAgICAgICAgc3RhdGVtZW50LmNsb3NlKCk7CiAgICAgICAgIH0KICAgICAgICAgbG9nVGltZVN0YXQoc3FsLCB0aW1lU3RhcnQpOwogICAgIH0KIAogICAgIEBPdmVycmlkZQotICAgIHByb3RlY3RlZCB2b2lkIGZpbmFsaXplKCkgewotICAgICAgICBpZiAoaXNPcGVuKCkpIHsKLSAgICAgICAgICAgIExvZy5lKFRBRywgImNsb3NlKCkgd2FzIG5ldmVyIGV4cGxpY2l0bHkgY2FsbGVkIG9uIGRhdGFiYXNlICciICsKLSAgICAgICAgICAgICAgICAgICAgbVBhdGggKyAiJyAiLCBtU3RhY2tUcmFjZSk7Ci0gICAgICAgICAgICBjbG9zZUNsb3NhYmxlKCk7Ci0gICAgICAgICAgICBvbkFsbFJlZmVyZW5jZXNSZWxlYXNlZCgpOworICAgIHByb3RlY3RlZCB2b2lkIGZpbmFsaXplKCkgdGhyb3dzIFRocm93YWJsZSB7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBpZiAoaXNPcGVuKCkpIHsKKyAgICAgICAgICAgICAgICBMb2cuZShUQUcsICJjbG9zZSgpIHdhcyBuZXZlciBleHBsaWNpdGx5IGNhbGxlZCBvbiBkYXRhYmFzZSAnIiArCisgICAgICAgICAgICAgICAgICAgICAgICBtUGF0aCArICInICIsIG1TdGFja1RyYWNlKTsKKyAgICAgICAgICAgICAgICBjbG9zZUNsb3NhYmxlKCk7CisgICAgICAgICAgICAgICAgb25BbGxSZWZlcmVuY2VzUmVsZWFzZWQoKTsKKyAgICAgICAgICAgICAgICByZWxlYXNlQ3VzdG9tRnVuY3Rpb25zKCk7CisgICAgICAgICAgICB9CisgICAgIC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oaW50KSAoMTAwICogZHVyYXRpb25NaWxsaXMgLyBzUXVlcnlMb2dUaW1lSW5NaWxsaXMpICsgMTsKICAgICAgICAgICAgIGlmIChtUmFuZG9tLm5leHRJbnQoMTAwKSA+PSBzYW1wbGVQZXJjZW50KSByZXR1cm47CiAgICAgICAgIH0KQEAgLTE5NzAsNiArMjAzNywyMCBAQAogICAgICAgICB9CiAgICAgfQogCisgICAgLyogcGFja2FnZSAqLyB2b2lkIHZlcmlmeURiSXNPcGVuKCkgeworICAgICAgICBpZiAoIWlzT3BlbigpKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJkYXRhYmFzZSAiICsgZ2V0UGF0aCgpICsgIiAoY29ubiMgIiArCisgICAgICAgICAgICAgICAgICAgIG1Db25uZWN0aW9uTnVtICsgIikgYWxyZWFkeSBjbG9zZWQiKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qIHBhY2thZ2UgKi8gdm9pZCB2ZXJpZnlMb2NrT3duZXIoKSB7CisgICAgICAgIHZlcmlmeURiSXNPcGVuKCk7CisgICAgICAgIGlmIChtTG9ja2luZ0VuYWJsZWQgJiYgIWlzRGJMb2NrZWRCeUN1cnJlbnRUaHJlYWQoKSkgeworICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigiRG9uJ3QgaGF2ZSBkYXRhYmFzZSBsb2NrISIpOworICAgICAgICB9CisgICAgfQorCiAgICAgLyoKICAgICAgKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09CiAgICAgICoKQEAgLTE5NzcsMjIgKzIwNTgsMTQgQEAKICAgICAgKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09CiAgICAgICovCiAgICAgLyoqCi0gICAgICogYWRk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TF9DQUNIRSkgewotICAgICAgICAgICAgICAgIExvZy52KFRBRywgInxOT1QgYWRkaW5nX3NxbF90b19jYWNoZXwiICsgZ2V0UGF0aCgpICsgInwiICsgc3FsKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgfQotCiAgICAgICAgIFNRTGl0ZUNvbXBpbGVkU3FsIGNvbXBpbGVkU3FsID0gbnVsbDsKICAgICAgICAgc3luY2hyb25pemVkKG1Db21waWxlZFF1ZXJpZXMpIHsKICAgICAgICAgICAgIC8vIGRvbid0IGluc2VydCB0aGUgbmV3IG1hcHBpbmcgaWYgYSBtYXBwaW5nIGFscmVhZHkgZXhpc3RzCkBAIC0yMDAwLDM2ICsyMDczLDMyIEBACiAgICAgICAgICAgICBpZiAoY29tcGlsZWRTcWwgIT0gbnVsbCkgewogICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIC8vIGFkZCB0aGlzIDxzcWwsIGNvbXBpbGVkU3RhdGVtZW50PiB0byB0aGUgY2FjaGUKKwogICAgICAgICAgICAgaWYgKG1Db21waWxlZFF1ZXJpZXMuc2l6ZSgpID09IG1NYXhTcWxDYWNoZVNpemUpIHsKICAgICAgICAgICAgICAgICAvKgogICAgICAgICAgICAgICAgICAqIGNhY2hlIHNpemUgb2Yge0BsaW5rICNtTWF4U3FsQ2FjaGVTaXplfSBpcyBub3QgZW5vdWdoIGZvciB0aGlzIGFwcC4KLSAgICAgICAgICAgICAgICAgKiBsb2cgYSB3YXJuaW5nIE1BWF9XQVJOSU5HU19PTl9DQUNIRVNJWkVfQ09ORElUSU9OIHRpbWVzCi0gICAgICAgICAgICAgICAgICogY2hhbmNlcyBhcmUgaXQgaXMgTk9UIHVzaW5nID8gZm9yIGJpbmRhcmdzIC0gc28gY2FjaGluZyBpcyB1c2VsZXNzLgotICAgICAgICAgICAgICAgICAqIFRPRE86IGVpdGhlciBsZXQgdGhlIGNhbGxlcnMgc2V0IG1heCBjY2hlc2l6ZSBmb3IgdGhlaXIgYXBwLCBvciBpbnRlbGxpZ2VudGx5Ci0gICAgICAgICAgICAgICAgICogZmlndXJlIG91dCB3aGF0IHNob3VsZCBiZSBjYWNoZWQgZm9yIGEgZ2l2ZW4gYXBwLgorICAgICAgICAgICAgICAgICAqIGxvZyBhIHdhcm5pbmcuCisgICAgICAgICAgICAgICAgICogY2hhbmNlcyBhcmUgaXQgaXMgTk9UIHVzaW5nID8gZm9yIGJpbmRhcmdzIC0gb3IgY2FjaGVzaXplIGlzIHRvbyBzbWFsbC4KICAgICAgICAgICAgICAgICAgKi8KICAgICAgICAgICAgICAgICBpZiAoKyttQ2FjaGVGdWxsV2FybmluZ3MgPT0gTUFYX1dBUk5JTkdTX09OX0NBQ0hFU0laRV9DT05ESVRJT04pIHsKICAgICAgICAgICAgICAgICAgICAgTG9nLncoVEFHLCAiUmVhY2hlZCBNQVggc2l6ZSBmb3IgY29tcGlsZWQtc3FsIHN0YXRlbWVudCBjYWNoZSBmb3IgZGF0YWJhc2UgIiArCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0UGF0aCgpICsgIjsgaS5lLiwgTk8gc3BhY2UgZm9yIHRoaXMgc3FsIHN0YXRlbWVudCBpbiBjYWNoZTogIiArCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgc3FsICsgIi4gUGxlYXNlIGNoYW5nZSB5b3VyIHNxbCBzdGF0ZW1lbnRzIHRvIHVzZSAnPycgZm9yICIgKwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICJiaW5kYXJncywgaW5zdGVhZCBvZiB1c2luZyBhY3R1YWwgdmFsdWVzIik7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0UGF0aCgpICsgIi4gQ29uc2lkZXIgaW5jcmVhc2luZyBjYWNoZXNpemUuIik7CiAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIC8vIGRvbid0IGFkZCB0aGlzIGVudHJ5IHRvIGNhY2hlCi0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIC8vIGNhY2hlIGlzIE5PVCBmdWxsLiBhZGQgdGhpcyB0byBjYWNoZS4KLSAgICAgICAgICAgICAgICBtQ29tcGlsZWRRdWVyaWVzLnB1dChzcWwsIGNvbXBpbGVkU3RhdGVtZW50KTsKLSAgICAgICAgICAgICAgICBpZiAoU1FMaXRlRGVidWcuREVCVUdfU1FMX0NBQ0hFKSB7Ci0gICAgICAgICAgICAgICAgICAgIExvZy52KFRBRywgInxhZGRpbmdfc3FsX3RvX2NhY2hlfCIgKyBnZXRQYXRoKCkgKyAifCIgKwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1Db21waWxlZFF1ZXJpZXMuc2l6ZSgpICsgInwiICsgc3FsKTsKLSAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9IAorICAgICAgICAgICAgLyogYWRkIHRoZSBnaXZlbiBTUUxpdGVDb21waWxlZFNxbCBjb21waWxlZFN0YXRlbWVudCB0byBjYWNoZS4KKyAgICAgICAgICAgICAqIG5vIG5lZWQgdG8gd29ycnkgYWJvdXQgdGhlIGNhY2hlIHNpemUgLSBiZWNhdXNlIHtAbGluayAjbUNvbXBpbGVkUXVlcmllc30KKyAgICAgICAgICAgICAqIHNlbGYtbGltaXRzIGl0cyBzaXplIHRvIHtAbGluayAjbU1heFNxbENhY2hlU2l6ZX0uCisgICAgICAgICAgICAgKi8KKyAgICAgICAgICAgIG1Db21waWxlZFF1ZXJpZXMucHV0KHNxbCwgY29tcGlsZWRTdGF0ZW1lbnQpOworICAgICAgICAgICAgaWYgKFNRTGl0ZURlYnVnLkRFQlVHX1NRTF9DQUNIRSkgeworICAgICAgICAgICAgICAgIExvZy52KFRBRywgInxhZGRpbmdfc3FsX3RvX2NhY2hlfCIgKyBnZXRQYXRoKCkgKyAifCIgKworICAgICAgICAgICAgICAgICAgICAgICAgbUNvbXBpbGVkUXVlcmllcy5zaXplKCkgKyAifCIgKyBzc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0ZW1lbnQgPSBudWxsOwogICAgICAgICBib29sZWFuIGNhY2hlSGl0OwogICAgICAgICBzeW5jaHJvbml6ZWQobUNvbXBpbGVkUXVlcmllcykgewotICAgICAgICAgICAgaWYgKG1NYXhTcWxDYWNoZVNpemUgPT0gMCkgewotICAgICAgICAgICAgICAgIC8vIGZvciB0aGlzIGRhdGFiYXNlLCB0aGVyZSBpcyBubyBjYWNoZSBvZiBjb21waWxlZCBzcWwuCi0gICAgICAgICAgICAgICAgaWYgKFNRTGl0ZURlYnVnLkRFQlVHX1NRTF9DQUNIRSkgewotICAgICAgICAgICAgICAgICAgICBMb2cudihUQUcsICJ8Y2FjaGUgTk9UIGZvdW5kfCIgKyBnZXRQYXRoKCkpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKLSAgICAgICAgICAgIH0KICAgICAgICAgICAgIGNhY2hlSGl0ID0gKGNvbXBpbGVkU3RhdGVtZW50ID0gbUNvbXBpbGVkUXVlcmllcy5nZXQoc3FsKSkgIT0gbnVsbDsKICAgICAgICAgfQogICAgICAgICBpZiAoY2FjaGVIaXQpIHsKQEAgLTIwNjUsNjMgKzIxMjcsMjQgQEAKICAgICAgICAgICAgIExvZy52KFRBRywgInxjYWNoZV9zdGF0c3wiICsKICAgICAgICAgICAgICAgICAgICAgZ2V0UGF0aCgpICsgInwiICsgbUNvbXBpbGVkUXVlcmllcy5zaXplKCkgKwogICAgICAgICAgICAgICAgICAgICAifCIgKyBtTnVtQ2FjaGVIaXRzICsgInwiICsgbU51bUNhY2hlTWlzc2VzICsKLSAgICAgICAgICAgICAgICAgICAgInwiICsgY2FjaGVIaXQgKyAifCIgKyBtVGltZU9wZW5lZCArICJ8IiArIG1UaW1lQ2xvc2VkICsgInwiICsgc3FsKTsKKyAgICAgICAgICAgICAgICAgICAgInwiICsgY2FjaGVIaXQgKyAifCIgKyBzcWwpOwogICAgICAgICB9CiAgICAgICAgIHJldHVybiBjb21waWxlZFN0YXRlbWVudDsKICAgICB9CiAKICAgICAvKioKLSAgICAgKiByZXR1cm5zIHRydWUgaWYgdGhlIGdpdmVuIHNxbCBpcyBjYWNoZWQgaW4gY29tcGlsZWQtc3FsIGNhY2hlLgotICAgICAqIEBoaWRlCi0gICAgICovCi0gICAgcHVibGljIGJvb2xlYW4gaXNJbkNvbXBpbGVkU3FsQ2FjaGUoU3RyaW5nIHNxbCkgewotICAgICAgICBzeW5jaHJvbml6ZWQobUNvbXBpbGVkUXVlcmllcykgewotICAgICAgICAgICAgcmV0dXJuIG1Db21waWxlZFF1ZXJpZXMuY29udGFpbnNLZXkoc3FsKTsKLSAgICAgICAgfQotICAgIH0KLQotICAgIC8qKgotICAgICAqIHB1cmdlcyB0aGUgZ2l2ZW4gc3FsIGZyb20gdGhlIGNvbXBpbGVkLXNxbCBjYWNoZS4KLSAgICAgKiBAaGlkZQotICAgICAqLwotICAgIHB1YmxpYyB2b2lkIHB1cmdlRnJvbUNvbXBpbGVkU3FsQ2FjaGUoU3RyaW5nIHNxbCkgewotICAgICAgICBzeW5jaHJvbml6ZWQobUNvbXBpbGVkUXVlcmllcykgewotICAgICAgICAgICAgbUNvbXBpbGVkUXVlcmllcy5yZW1vdmUoc3FsKTsKLSAgICAgICAgfQotICAgIH0KLQotICAgIC8qKgotICAgICAqIHJlbW92ZSBldmVyeXRoaW5nIGZyb20gdGhlIGNvbXBpbGVkIHNxbCBjYWNoZQotICAgICAqIEBoaWRlCi0gICAgICovCi0gICAgcHVibGljIHZvaWQgcmVzZXRDb21waWxlZFNxbENhY2hlKCkgewotICAgICAgICBzeW5jaHJvbml6ZWQobUNvbXBpbGVkUXVlcmllcykgewotICAgICAgICAgICAgbUNvbXBpbGVkUXVlcmllcy5jbGVhcigpOwotICAgICAgICB9Ci0gICAgfQotCi0gICAgLyoqCi0gICAgICogcmV0dXJuIHRoZSBjdXJyZW50IG1heENhY2hlU3FsQ2FjaGVTaXplCi0gICAgICogQGhpZGUKLSAgICAgKi8KL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xpemVkLgorICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisgICAgICAgIHN5bmNocm9uaXplZChtQ2xvc2VkU3RhdGVtZW50SWRzKSB7CisgICAgICAgICAgICBpZiAobUNsb3NlZFN0YXRlbWVudElkcy5jb250YWlucyhpZCkpIHsKKyAgICAgICAgICAgICAgICAvLyB0aGlzIHN0YXRlbWVudCBpZCBpcyBhbHJlYWR5IHF1ZXVlZCB1cCBmb3IgZmluYWxpemF0aW9uLgorICAgICAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1DbG9zZWRTdGF0ZW1lbnRJZHMuYWRkKGlkKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qIHBhY2thZ2UgKi8gdm9pZCBjbG9zZVBlbmRpbmdTdGF0ZW1lbnRzKCkgeworICAgICAgICBpZiAoIWlzT3BlbigpKSB7CisgICAgICAgICAgICAvLyBzaW5jZSB0aGlzIGRhdGFiYXNlIGlzIGFscmVhZHkgY2xvc2VkLCBubyBuZWVkIHRvIGZpbmFsaXplIGFueXRoaW5nLgorICAgICAgICAgICAgbUNsb3NlZFN0YXRlbWVudElkcy5jbGVhcigpOworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisgICAgICAgIHZlcmlmeUxvY2tPd25lcigpOworICAgICAgICAvKiB0byBtaW5pbWl6ZSBzeW5jaHJvbml6YXRpb24gb24gbUNsb3NlZFN0YXRlbWVudElkcywgbWFrZSBhIGNvcHkgb2YgdGhlIGxpc3QgKi8KKyAgICAgICAgQXJyYXlMaXN0PEludGVnZXI+IGxpc3QgPSBuZXcgQXJyYXlMaXN0PEludGVnZXI+KG1DbG9zZWRTdGF0ZW1lbnRJZHMuc2l6ZSgpKTsKKyAgICAgICAgc3luY2hyb25pemVkKG1DbG9zZWRTdGF0ZW1lbnRJZHMpIHsKKyAgICAgICAgICAgIGxpc3QuYWRkQWxsKG1DbG9zZWRTdGF0ZW1lbnRJZHMpOworICAgICAg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ICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKyAgICAgICAgaWYgKG1Db25uZWN0aW9uUG9vbCA9PSBudWxsKSB7CisgICAgICAgICAgICBtQ29ubmVjdGlvblBvb2wgPSBuZXcgRGF0YWJhc2VDb25uZWN0aW9uUG9vbCh0aGlzKTsKKyAgICAgICAgICAgIHNldEpvdXJuYWxNb2RlKG1QYXRoLCAiV0FMIik7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIHRydWU7CisgICAgfQorCisgICAgLyoqCisgICAgICogVGhpcyBtZXRob2QgZGlzYWJsZXMgdGhlIGZlYXR1cmVzIGVuYWJsZWQgYnkge0BsaW5rICNlbmFibGVXcml0ZUFoZWFkTG9nZ2luZygpfS4KKyAgICAgKiBAaGlkZQorICAgICAqLworICAgIHB1YmxpYyB2b2lkIGRpc2FibGVXcml0ZUFoZWFkTG9nZ2luZygpIHsKKyAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CisgICAgICAgICAgICBpZiAobUNvbm5lY3Rpb25Qb29sID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgICAgICB9CisgICAgICAgICAgICBtQ29ubmVjdGlvblBvb2wuY2xvc2UoKTsKKyAgICAgICAgICAgIG1Db25uZWN0aW9uUG9vbCA9IG51bGw7CisgICAgICAgICAgICBzZXRKb3VybmFsTW9kZShtUGF0aCwgIlRSVU5DQVRFIik7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKiBwYWNrYWdlICovIFNRTGl0ZURhdGFiYXNlIGdldERhdGFiYXNlSGFuZGxlKFN0cmluZyBzcWwpIHsKKyAgICAgICAgaWYgKGlzUG9vbGVkQ29ubmVjdGlvbigpKSB7CisgICAgICAgICAgICAvLyB0aGlzIGlzIGEgcG9vbGVkIGRhdGFiYXNlIGNvbm5lY3Rpb24KKyAgICAgICAgICAgIC8vIHVzZSBpdCBpZiBpdCBpcyBvcGVuIEFORCBpZiBJIGFtIG5vdCBjdXJyZW50bHkgcGFydCBvZiBhIHRyYW5zYWN0aW9uCisgICAgICAgICAgICBpZiAoaXNPcGVuKCkgJiYgIWFtSUluVHJhbnNhY3Rpb24oKSkgeworICAgICAgICAgICAgICAgIC8vIFRPRE86IHVzZSBhbm90aGVyIGNvbm5lY3Rpb24gZnJvbSB0aGUgcG9vbAorICAgICAgICAgICAgICAgIC8vIGlmIHRoaXMgY29ubmVjdGlvbiBpcyBjdXJyZW50bHkgaW4gdXNlIGJ5IHNvbWUgb3RoZXIgdGhyZWFkCisgICAgICAgICAgICAgICAgLy8gQU5EIGlmIHRoZXJlIGFyZSBmcmVlIGNvbm5lY3Rpb25zIGluIHRoZSBwb29sCisgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXM7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIC8vIHRoZSBwb29sZWQgY29ubmVjdGlvbiBpcyBub3Qgb3BlbiEgY291bGQgaGF2ZSBiZWVuIGNsb3NlZCBlaXRoZXIgZHVlCisgICAgICAgICAgICAgICAgLy8gdG8gY29ycnVwdGlvbiBvbiB0aGlzIG9yIHNvbWUgb3RoZXIgY29ubmVjdGlvbiB0byB0aGUgZGF0YWJhc2UKKyAgICAgICAgICAgICAgICAvLyBPUiwgbWF5YmUgdGhlIGNvbm5lY3Rpb24gcG9vbCBpcyBkaXNhYmxlZCBhZnRlciB0aGlzIGNvbm5lY3Rpb24gaGFzIGJlZW4KKyAgICAgICAgICAgICAgICAvLyBhbGxvY2F0ZWQgdG8gbWUuIHRyeSB0byBnZXQgc29tZSBvdGhlciBwb29sZWQgb3IgbWFpbiBkYXRhYmFzZSBjb25uZWN0aW9uCisgICAgICAgICAgICAgICAgcmV0dXJuIGdldFBhcmVudERiQ29ubk9iaigpLmdldERiQ29ubmVjdGlvbihzcWwpOworICAgICAgICAgICAgfQorICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgLy8gdGhpcyBpcyBOT1QgYSBwb29sZ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Iik7CisgICAgICAgIH0KKyAgICAgICAgaW50IGkgPSBtQ29ubmVjdGlvblBvb2wuZ2V0TWF4UG9vbFNpemUoKTsKKyAgICAgICAgaWYgKHNpemUgPCBpKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKAorICAgICAgICAgICAgICAgICAgICAiY2Fubm90IHNldCBtYXggcG9vbCBzaXplIHRvIGEgdmFsdWUgbGVzcyB0aGFuIHRoZSBjdXJyZW50IG1heCB2YWx1ZSg9IiArCisgICAgICAgICAgICAgICAgICAgIGkgKyAiKSIpOworICAgICAgICB9CisgICAgICAgIG1Db25uZWN0aW9uUG9vbC5zZXRNYXhQb29sU2l6ZShzaXplKTsKKyAgICB9CisKKyAgICAvKiBwYWNrYWdlICovIFNRTGl0ZURhdGFiYXNlIGNyZWF0ZVBvb2xDb25uZWN0aW9uKHNob3J0IGNvbm5lY3Rpb25OdW0pIHsKKyAgICAgICAgU1FMaXRlRGF0YWJhc2UgZGIgPSBvcGVuRGF0YWJhc2UobVBhdGgsIG1GYWN0b3J5LCBtRmxhZ3MsIG1FcnJvckhhbmRsZXIsIGNvbm5lY3Rpb25OdW0pOworICAgICAgICBkYi5tUGFyZW50Q29ubk9iaiA9IHRoaXM7CisgICAgICAgIHJldHVybiBkYjsKKyAgICB9CisKKyAgICBwcml2YXRlIHN5bmNocm9uaXplZCBTUUxpdGVEYXRhYmFzZSBnZXRQYXJlbnREYkNvbm5PYmooKSB7CisgICAgICAgIHJldHVybiBtUGFyZW50Q29ubk9iajsKKyAgICB9CisKKyAgICBwcml2YXRlIGJvb2xlYW4gaXNQb29sZWRDb25uZWN0aW9uKCkgeworICAgICAgICByZXR1cm4gdGhpcy5tQ29ubmVjdGlvbk51bSA+IDA7CisgICAgfQorCisgICAgLyogcGFja2FnZSAqLyBTUUxpdGVEYXRhYmFzZSBnZXREYkNvbm5lY3Rpb24oU3RyaW5nIHNxbCkgeworICAgICAgICB2ZXJp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XNlcykgeworICAgICAgICAgICAgQ29sbGVjdGlvbnMuY29weSh0ZW1wTGlzdCwgbUFjdGl2ZURhdGFiYXNlcyk7CisgICAgICAgIH0KKyAgICAgICAgZm9yIChXZWFrUmVmZXJlbmNlPFNRTGl0ZURhdGFiYXNlPiB3IDogdGVtcExpc3QpIHsKICAgICAgICAgICAgIFNRTGl0ZURhdGFiYXNlIGRiID0gdy5nZXQoKTsKICAgICAgICAgICAgIGlmIChkYiA9PSBudWxsIHx8ICFkYi5pc09wZW4oKSkgewogICAgICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICAgfQotICAgICAgICAgICAgLy8gZ2V0IFNRTElURV9EQlNUQVRVU19MT09LQVNJREVfVVNFRCBmb3IgdGhlIGRiCi0gICAgICAgICAgICBpbnQgbG9va2FzaWRlVXNlZCA9IGRiLm5hdGl2ZV9nZXREYkxvb2thc2lkZSgpOwogCi0gICAgICAgICAgICAvLyBnZXQgdGhlIGxhc3Rub2RlIG9mIHRoZSBkYm5hbWUKLSAgICAgICAgICAgIFN0cmluZyBwYXRoID0gZGIuZ2V0UGF0aCgpOwotICAgICAgICAgICAgaW50IGluZHggPSBwYXRoLmxhc3RJbmRleE9mKCIvIik7Ci0gICAgICAgICAgICBTdHJpbmcgbGFzdG5vZGUgPSBwYXRoLnN1YnN0cmluZygoaW5keCAhPSAtMSkgPyArK2luZHggOiAwKTsKKyAgICAgICAgICAgIHN5bmNocm9uaXplZCAoZGIpIHsKKyAgICAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgICAgICAvLyBnZXQgU1FMSVRFX0RCU1RBVFVTX0xPT0tBU0lERV9VU0VEIGZvciB0aGUgZGIKKyAgICAgICAgICAgICAgICAgICAgaW50IGxvb2thc2lkZVVzZWQgPSBkYi5uYXRpdmVfZ2V0RGJMb29rYXNpZGUoKTsKIAotICAgICAgICAgICAgLy8gZ2V0IGxpc3Qgb2YgYXR0YWNoZWQgZGJzIGFuZCBmb3IgZWFjaCBkYiwgZ2V0IGl0cyBzaXplIGFuZCBwYWdlc2l6ZQotICAgICAgICAgICAgQXJyYXlMaXN0PFBhaXI8U3RyaW5nLCBTdHJpbmc+PiBhdHRhY2hlZERicyA9IGdldEF0dGFjaGVkRGJzKGRiKTsKLSAgICAgICAgICAgIGlmIChhdHRhY2hlZERicyA9PSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgY29udGludWU7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGF0dGFjaGVkRGJzLnNpemUoKTsgaSsrKSB7Ci0gICAgICAgICAgICAgICAgUGFpcjxTdHJpbmcsIFN0cmluZz4gcCA9IGF0dGFjaGVkRGJzLmdldChpKTsKLSAgICAgICAgICAgICAgICBsb25nIHBhZ2VDb3VudCA9IGdldFByYWdtYVZhbChkYiwgcC5maXJzdCArICIucGFnZV9jb3VudDsiKTsKKyAgICAgICAgICAgICAgICAgICAgLy8gZ2V0IHRoZSBsYXN0bm9kZSBvZiB0aGUgZGJuYW1lCisgICAgICAgICAgICAgICAgICAgIFN0cmluZyBwYXRoID0gZGIuZ2V0UGF0aCgpOworICAgICAgICAgICAgICAgICAgICBpbnQgaW5keCA9IHBhdGgubGFzdEluZGV4T2YoIi8iKTsKKyAgICAgICAgICAgICAgICAgICAgU3RyaW5nIGxhc3Rub2RlID0gcGF0aC5zdWJzdHJpbmcoKGluZHggIT0gLTEpID8gKytpbmR4IDogMCk7CiAKLSAgICAgICAgICAgICAgICAvLyBmaXJzdCBlbnRyeSBpbiB0aGUgYXR0YWNoZWQgZGIgbGlzdCBpcyBhbHdheXMgdGhlIG1haW4gZGF0YWJhc2UKLSAgICAgICAgICAgICAgICAvLyBkb24ndCB3b3JyeSBhYm91dCBwcmVmaXhpbmcgdGhlIGRibmFtZSB3aXRoICJtYWluIgotICAgICAgICAgICAgICAgIFN0cmluZyBkYk5hbWU7Ci0gICAgICAgICAgICAgICAgaWYgKGkgPT0gMCkgewotICAgICAgICAgICAgICAgICAgICBkYk5hbWUgPSBsYXN0bm9kZTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICAvLyBsb29rYXNpZGUgaXMgb25seSByZWxldmFudCBmb3IgdGhlIG1haW4gZGIKLSAgICAgICAgICAgICAgICAgICAgbG9va2FzaWRlVXNlZCA9IDA7Ci0gICAgICAgICAgICAgICAgICAgIGRiTmFtZSA9ICIgIChhdHRhY2hlZCkgIiArIHAuZmlyc3Q7Ci0gICAgICAgICAgICAgICAgICAgIC8vIGlmIHRoZSBhdHRhY2hlZCBkYiBoYXMgYSBwYXRoLCBhdHRhY2ggdGhlIGxhc3Rub2RlIGZyb20gdGhlIHBhdGggdG8gYWJvdmUKLSAgICAgICAgICAgICAgICAgICAgaWYgKHAuc2Vjb25kLnRyaW0oKS5sZW5ndGgoKSA+IDApIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGludCBpZHggPSBwLnNlY29uZC5sYXN0SW5kZXhPZigiLyIpOwotICAgICAgICAgICAgICAgICAgICAgICAgZGJOYW1lICs9ICIgOiAiICsgcC5zZWNvbmQuc3Vic3RyaW5nKChpZHggIT0gLTEpID8gKytpZHggOiAwKTsKKyAgICAgICAgICAgICAgICAgICAgLy8gZ2V0IGxpc3Qgb2YgYXR0YWNoZWQgZGJzIGFuZCBmb3IgZWFjaCBkYiwgZ2V0IGl0cyBzaXplIGFuZCBwYWdlc2l6ZQorICAgICAgICAgICAgICAgICAgICBBcnJheUxpc3Q8UGFpcjxTdHJpbmcsIFN0cmluZz4+IGF0dGFjaGVkRGJzID0gZGIuZ2V0QXR0YWNoZWREYnMoKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGF0dGFjaGVkRGJzID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGlmIChwYWdlQ291bnQgPiAwKSB7Ci0gICAgICAgICAgICAgICAgICAgIGRiU3RhdHNMaXN0LmFkZChuZXcgRGJTdGF0cyhkYk5hbWUsIHBhZ2VDb3VudCwgZGIuZ2V0UGFnZVNpemUoKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBsb29rYXNpZGVVc2VkKSk7CisgICAgICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgYXR0YWNoZWREYnMuc2l6ZSgpOyBpKyspIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIFBhaXI8U3RyaW5nLCBTdHJpbmc+IHAgPSBhdHRhY2hlZERicy5nZXQoaSk7CisgICAgICAgICAgICAgICAgICAgICAgICBsb25nIHBhZ2VDb3VudCA9IERhdGFiYXNlVXRpbHMubG9uZ0ZvclF1ZXJ5KGRiLCAiUFJBR01BICIgKyBwLmZpcnN0CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgIi5wYWdlX2NvdW50OyIsIG51bGwpOworCisgICAgICAgICAgICAgICAgICAgICAgICAvLyBmaXJzdCBlbnRyeSBpbiB0aGUgYXR0YWNoZWQgZGIgbGlzdCBpcyBhbHdheXMgdGhlIG1haW4gZGF0YWJhc2UKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIGRvbid0IHdvcnJ5IGFib3V0IHByZWZpeGluZyB0aGUgZGJuYW1lIHdpdGggIm1haW4iCisgICAgICAgICAgICAgICAgICAgICAgICBTdHJpbmcgZGJOYW1lOworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGkgPT0gMCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRiTmFtZSA9IGxhc3Rub2RlOworICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBsb29rYXNpZGUgaXMgb25seSByZWxldmFudCBmb3IgdGhlIG1haW4gZGIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBsb29rYXNpZGVVc2VkID0gMDsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYk5hbWUgPSAiICAoYXR0YWNoZWQpICIgKyBwLmZpcnN0OworICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGlmIHRoZSBhdHRhY2hlZCBkYiBoYXMgYSBwYXRoLCBhdHRhY2ggdGhlIGxhc3Rub2RlIGZyb20gdGhlIHBhdGggdG8gYWJvdmUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocC5zZWNvbmQudHJpbSgpLmxlbmd0aCgpID4gMCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgaWR4ID0gcC5zZWNvbmQubGFzdEluZGV4T2YoIi8iKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGJOYW1lICs9ICIgOiAiICsgcC5zZWNvbmQuc3Vic3RyaW5nKChpZHggIT0gLTEpID8gKytpZHggOiAwKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAocGFnZUNvdW50ID4gMCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRiU3RhdHNMaXN0LmFkZChuZXcgRGJTdGF0cyhkYk5hbWUsIHBhZ2VDb3VudCwgZGIuZ2V0UGFnZVNpemUoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxvb2thc2lkZVVzZWQsIGRiLm1OdW1DYWNoZUhpdHMsIGRiLm1OdW1DYWNoZU1pc3NlcywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRiLm1Db21waWxlZFF1ZXJpZXMuc2l6ZSgpKSk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgLy8gaWYgdGhlcmUgYXJlIHBvb2xlZCBjb25uZWN0aW9ucywgcmV0dXJuIHRoZSBjYWNoZSBzdGF0cyBmb3IgdGhlbSBhbHNvLgorICAgICAgICAgICAgICAgICAgICBpZiAoZGIubUNvbm5lY3Rpb25Qb29sICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoU1FMaXRlRGF0YWJhc2UgcERiIDogZGIubUNvbm5lY3Rpb25Qb29sLmdldENvbm5lY3Rpb25MaXN0KCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYlN0YXRzTGlzdC5hZGQobmV3IERiU3RhdHMoIihwb29sZWQgIyAiICsgcERiLm1Db25uZWN0aW9uTnVtICsgIikgIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyBsYXN0bm9kZSwgMCwgMCwgMCwgcERiLm1OdW1DYWNoZUhpdHMsIHBEYi5tTnVtQ2FjaGVNaXNzZXMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwRGIubUNvbXBpbGVkUXVlcmllcy5zaXplKCkpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0gY2F0Y2ggKFNRTGl0ZUV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgICAgIC8vIGlnbm9yZS4gd2UgZG9uJ3QgY2FyZSBhYm91dCBleGNlcHRpb25zIHdoZW4gd2UgYXJlIHRha2luZyBhZGIKKyAgICAgICAgICAgICAgICAgICAgLy8gYnVncmVwb3J0IQogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KICAgICAgICAgfQpAQCAtMjE5NCw0NCArMjQ2Miw3NiBAQAogICAgIH0KIAogICAgIC8qKgotICAgICAqIGdldCB0aGUgc3BlY2lmaWVkIHByYWdtYSB2YWx1ZSBmcm9tIHNxbGl0ZSBmb3IgdGhlIHNwZWNpZmllZCBkYXRhYmFzZS4KLSAgICAgKiBvbmx5IGhhbmRsZXMgcHJhZ21hJ3MgdGhhdCByZXR1cm4gaW50L2xvbmcuC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8vIHNxbGl0ZSByZXR1cm5zIGEgcm93IGZvciBlYWNoIGRhdGFiYXNlIGluIHRoZSByZXR1cm5lZCBsaXN0IG9mIGRhdGFiYXNlcy4KKyAgICAgICAgICAgICAgICAvLyAgIGluIGVhY2ggcm93LAorICAgICAgICAgICAgICAgIC8vICAgICAgIDFzdCBjb2x1bW4gaXMgdGhlIGRhdGFiYXNlIG5hbWUgc3VjaCBhcyBtYWluLCBvciB0aGUgZGF0YWJhc2UKKyAgICAgICAgICAgICAgICAvLyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWUgc3BlY2lmaWVkIG9uIHRoZSAiQVRUQUNIIiBjb21tYW5kCisgICAgICAgICAgICAgICAgLy8gICAgICAgMm5kIGNvbHVtbiBpcyB0aGUgZGF0YWJhc2UgZmlsZSBwYXRoLgorICAgICAgICAgICAgICAgIGF0dGFjaGVkRGJzLmFkZChuZXcgUGFpcjxTdHJpbmcsIFN0cmluZz4oYy5nZXRTdHJpbmcoMSksIGMuZ2V0U3RyaW5nKDIpKSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICBpZiAoYyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgYy5jbG9zZSgpOworICAgICAgICAgICAgfQogICAgICAgICB9Ci0gICAgICAgIGMuY2xvc2UoKTsKICAgICAgICAgcmV0dXJuIGF0dGFjaGVkRGJzOwogICAgIH0KIAogICAgIC8qKgorICAgICAqIFJ1bnMgJ3ByYWdtYSBpbnRlZ3JpdHlfY2hlY2snIG9uIHRoZSBnaXZlbiBkYXRhYmFzZSAoYW5kIGFsbCB0aGUgYXR0YWNoZWQgZGF0YWJhc2VzKQorICAgICAqIGFuZCByZXR1cm5zIHRydWUgaWYgdGhlIGdpdmVuIGRhdGFiYXNlIChhbmQgYWxsIGl0cyBhdHRhY2hlZCBkYXRhYmFzZXMpIHBhc3MgaW50ZWdyaXR5X2NoZWNrLAorICAgICAqIGZhbHNlIG90aGVyd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NpemUoKTsgaSsrKSB7CisgICAgICAgICAgICBQYWlyPFN0cmluZywgU3RyaW5nPiBwID0gYXR0YWNoZWREYnMuZ2V0KGkpOworICAgICAgICAgICAgU1FMaXRlU3RhdGVtZW50IHByb2cgPSBudWxsOworICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICBwcm9nID0gY29tcGlsZVN0YXRlbWVudCgiUFJBR01BICIgKyBwLmZpcnN0ICsgIi5pbnRlZ3JpdHlfY2hlY2soMSk7Iik7CisgICAgICAgICAgICAgICAgU3RyaW5nIHJzbHQgPSBwcm9nLnNpbXBsZVF1ZXJ5Rm9yU3RyaW5nKCk7CisgICAgICAgICAgICAgICAgaWYgKCFyc2x0LmVxdWFsc0lnbm9yZUNhc2UoIm9rIikpIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gaW50ZWdyaXR5X2NoZWNrZXIgZmFpbGVkIG9uIG1haW4gb3IgYXR0YWNoZWQgZGF0YWJhc2VzCisgICAgICAgICAgICAgICAgICAgIGlzRGF0YWJhc2VDb3JydXB0ID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICAgICAgTG9nLmUoVEFHLCAiUFJBR01BIGludGVncml0eV9jaGVjayBvbiAiICsgcC5zZWNvbmQgKyAiIHJldHVybmVkOiAiICsgcnNsdCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSBmaW5hbGx5IHsKKyAgICAgICAgICAgICAgICBpZiAocHJvZyAhPSBudWxsKSBwcm9nLmNsb3NlKCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIGlzRGF0YWJhc2VDb3JydXB0OworICAgIH0KKworICAgIC8qKgogICAgICAqIE5hdGl2ZSBjYWxsIHRvIG9wZW4gdGhlIGRhdGFiYXNlLgogICAgICAqCiAgICAgICogQHBhcmFtIHBhdGggVGhlIGZ1bGwgcGF0aCB0byB0aGUgZGF0YWJhc2UKQEAgLTIyMzksNTEgKzI1MzksMzQgQEAKICAgIC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lcnNpb24gPCAxKSB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCJWZXJzaW9uIG11c3QgYmUgPj0gMSwgd2FzICIgKyB2ZXJzaW9uKTsKKyAgICAgICAgaWYgKGVycm9ySGFuZGxlciA9PSBudWxsKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCJEYXRhYmFzZUVycm9ySGFuZGxlciBwYXJhbSB2YWx1ZSBjYW4ndCBiZSBudWxsLiIpOworICAgICAgICB9CiAKICAgICAgICAgbUNvbnRleHQgPSBjb250ZXh0OwogICAgICAgICBtTmFtZSA9IG5hbWU7CiAgICAgICAgIG1GYWN0b3J5ID0gZmFjdG9yeTsKICAgICAgICAgbU5ld1ZlcnNpb24gPSB2ZXJzaW9uOworICAgICAgICBtRXJyb3JIYW5kbGVyID0gZXJyb3JIYW5kbGVyOwogICAgIH0KIAogICAgIC8qKgpAQCAtMTE1LDEwICsxNDMsMTQgQEAKICAgICAgICAgICAgIGlmIChtTmFtZSA9PSBudWxsKSB7CiAgICAgICAgICAgICAgICAgZGIgPSBTUUxpdGVEYXRhYmFzZS5jcmVhdGUobnVsbCk7CiAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIGRiID0gbUNvbnRleHQub3Blbk9yQ3JlYXRlRGF0YWJhc2UobU5hbWUsIDAsIG1GYWN0b3J5KTsKKyAgICAgICAgICAgICAgICBkYiA9IG1Db250ZXh0Lm9wZW5PckNyZWF0ZURhdGFiYXNlKG1OYW1lLCAwLCBtRmFjdG9yeSwgbUVycm9ySGFuZGxlcik7CiAgICAgICAgICAgICB9CiAKICAgICAgICAgICAgIGludCB2ZXJzaW9uID0gZGIuZ2V0VmVyc2lvbigpOworICAgICAgICAgICAgaWYgKHZlcnNpb24gPiBtTmV3VmVyc2lvbikgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsU3RhdGVFeGNlcH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bGluayAjYmluZEJsb2IoaW50LCBieXRlW10pfTwvbGk+CisgICAgICogICA8bGk+e0BsaW5rICNiaW5kRG91YmxlKGludCwgZG91YmxlKX08L2xpPgorICAgICAqICAgPGxpPntAbGluayAjYmluZExvbmcoaW50LCBsb25nKX08L2xpPgorICAgICAqICAgPGxpPntAbGluayAjYmluZE51bGwoaW50KX08L2xpPgorICAgICAqICAgPGxpPntAbGluayAjYmluZFN0cmluZyhpbnQsIFN0cmluZyl9PC9saT4KKyAgICAgKiA8L3VsPgorICAgICAqIDxwPgorICAgICAqIEVhY2ggZW50cnkgaW4gdGhlIGFycmF5IGlzIGEgUGFpciBvZgorICAgICAqIDxvbD4KKyAgICAgKiAgIDxsaT5iaW5kIGFyZyBwb3NpdGlvbiBudW1iZXI8L2xpPgorICAgICAqICAgPGxpPnRoZSB2YWx1ZSB0byBiZSBib3VuZCB0byB0aGUgYmluZGFyZzwvbGk+CisgICAgICogPC9vbD4KKyAgICAgKiA8cD4KKyAgICAgKiBJdCBpcyBsYXppbHkgaW5pdGlhbGl6ZWQgaW4gdGhlIGFib3ZlIGJpbmQgbWV0aG9kcworICAgICAqIGFuZCBpdCBpcyBjbGVhcmVkIGluIHtAbGluayAjY2xlYXJCaW5kaW5ncygpfSBtZXRob2QuCisgICAgICogPHA+CisgICAgICogSXQgaXMgcHJvdGVjdGVkIChpbiBtdWx0aS10aHJlYWRlZCBlbnZpcm9ubWVudCkgYnkge0BsaW5rIFNRTGl0ZVByb2dyYW19LnRoaXMKKyAgICAgKi8KKyAgICAvKiBwYWNrYWdlICovIEhhc2hNYXA8SW50ZWdlciwgT2JqZWN0PiBtQmluZEFyZ3MgPSBudWxsOworICAgIC8qIHBhY2thZ2UgKi8gZmluYWwgaW50IG1TdGF0ZW1lbnRUeXBlOwogCiAgICAgLyogcGFja2FnZSAqLyBTUUxpdGVQcm9ncmFtKFNRTGl0ZURhdGFiYXNlIGRiLCBTdHJpbmcgc3FsKSB7Ci0gICAgICAgIG1EYXRhYmFzZSA9IGRiOworICAgICAgICB0aGlzKGRiLCBzcWwsIG51bGwsIHRydWUpOworICAgIH0KKworICAgIC8qIHBhY2thZ2UgKi8gU1FMaXRlUHJvZ3JhbShTUUxpdGVEYXRhYmFzZSBkYiwgU3RyaW5nIHNxbCwgT2JqZWN0W10gYmluZEFyZ3MsCisgICAgICAgICAgICBib29sZWFuIGNvbXBpbGVGbGFnKSB7CiAgICAgICAgIG1TcWwgPSBzcWwudHJpbSgpOworICAgICAgICBtU3RhdGVtZW50VHlwZSA9IERhdGFiYXNlVXRpbHMuZ2V0U3FsU3RhdGVtZW50VHlwZShtU3FsKTsKICAgICAgICAgZGIuYWNxdWlyZVJlZmVyZW5jZSgpOwogICAgICAgICBkYi5hZGRTUUxpdGVDbG9zYWJsZSh0aGlzKTsKLSAgICAgICAgdGhpcy5uSGFuZGxlID0gZGIubU5hdGl2ZUhhbmRsZTsKKyAgICAgICAgbURhdGFiYXNlID0gZGI7CisgICAgICAgIG5IYW5kbGUgPSBkYi5tTmF0aXZlSGFuZGxlOworICAgICAgICBpZiAoYmluZEFyZ3MgIT0gbnVsbCkgeworICAgICAgICAgICAgaW50IHNpemUgPSBiaW5kQXJncy5sZW5ndGg7CisgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IHNpemU7IGkrKykgeworICAgICAgICAgICAgICAgIHRoaXMuYWRkVG9CaW5kQXJncyhpICsgMSwgYmluZEFyZ3NbaV0pOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIGlmIChjb21waWxlRmxhZykgeworICAgICAgICAgICAgY29tcGlsZUFuZGJpbmRBbGxBcmdzKCk7CisgICAgICAgIH0KKyAgICB9CiAKKyAgICBwcml2YXRlIHZvaWQgY29tcGlsZVNxbCgpIHsKICAgICAgICAgLy8gb25seSBjYWNoZSBDUlVEIHN0YXRlbWVudHMKLSAgICAgICAgU3RyaW5nIHByZWZpeFNxbCA9IG1TcWwuc3Vic3RyaW5nKDAsIDYpOwotICAgICAgIC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GlsZWRTcWwgPT0gbnVsbCkgewogICAgICAgICAgICAgLy8gY3JlYXRlIGEgbmV3IGNvbXBpbGVkLXNxbCBvYmoKLSAgICAgICAgICAgIG1Db21waWxlZFNxbCA9IG5ldyBTUUxpdGVDb21waWxlZFNxbChkYiwgc3FsKTsKKyAgICAgICAgICAgIG1Db21waWxlZFNxbCA9IG5ldyBTUUxpdGVDb21waWxlZFNxbChtRGF0YWJhc2UsIG1TcWwpOwogCiAgICAgICAgICAgICAvLyBhZGQgaXQgdG8gdGhlIGNhY2hlIG9mIGNvbXBpbGVkLXNxbHMKICAgICAgICAgICAgIC8vIGJ1dCBiZWZvcmUgYWRkaW5nIGl0IGFuZCB0aHVzIG1ha2luZyBpdCBhdmFpbGFibGUgZm9yIGFueW9uZSBlbHNlIHRvIHVzZSBpdCwKICAgICAgICAgICAgIC8vIG1ha2Ugc3VyZSBpdCBpcyBhY3F1aXJlZCBieSBtZS4KICAgICAgICAgICAgIG1Db21waWxlZFNxbC5hY3F1aXJlKCk7Ci0gICAgICAgICAgICBkYi5hZGRUb0NvbXBpbGVkUXVlcmllcyhzcWwsIG1Db21waWxlZFNxbCk7CisgICAgICAgICAgICBtRGF0YWJhc2UuYWRkVG9Db21waWxlZFF1ZXJpZXMobVNxbCwgbUNvbXBpbGVkU3FsKTsKICAgICAgICAgICAgIGlmIChTUUxpdGVEZWJ1Zy5ERUJVR19BQ1RJVkVfQ1VSU09SX0ZJTkFMSVpBVElPTikgewogICAgICAgICAgICAgICAgIExvZy52KFRBRywgIkNyZWF0ZWQgRGJPYmogKGlkIyIgKyBtQ29tcGlsZWRTcWwublN0YXRlbWVudCArCi0gICAgICAgICAgICAgICAgICAgICAgICAiKSBmb3Igc3FsOiAiICsgc3FsKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICIpIGZvciBzcWw6ICIgKyBtU3FsKTsKICAgICAgICAgICAgIH0KICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgIC8vIGl0IGlzIGFscmVhZHkgaW4gY29tcGlsZWQtc3FsIGNhY2hlLgpAQCAtMTAwLDEyICsxNDMsMTIgQEAKICAgICAgICAgICAgICAgICAvLyB3ZSBjYW4ndCBoYXZlIHR3byBkaWZmZXJlbnQgU1FMaXRlUHJvZ2FtIG9iamVjdHMgY2FuJ3Qgc2hhcmUgdGhlIHNhbWUKICAgICAgICAgICAgICAgICAvLyBDb21waWxlZFNxbCBvYmplY3QuIGNyZWF0ZSBhIG5ldyBvbmUuCiAgICAgICAgICAgICAgICAgLy8gZmluYWxpemUgaXQgd2hlbiBJIGFtIGRvbmUgd2l0aCBpdCBpbiAidGhpcyIgb2JqZWN0LgotICAgICAgICAgICAgICAgIG1Db21waWxlZFNxbCA9IG5ldyBTUUxpdGVDb21waWxlZFNxbChkYiwgc3FsKTsKKyAgICAgICAgICAgICAgICBtQ29tcGlsZWRTcWwgPSBuZXcgU1FMaXRlQ29tcGlsZWRTcWwobURhdGFiYXNlLCBtU3FsKTsKICAgICAgICAgICAgICAgICBpZiAoU1FMaXRlRGVidWcuREVCVUdfQUNUSVZFX0NVUlNPUl9GSU5BTElaQVRJT04pIHsKICAgICAgICAgICAgICAgICAgICAgTG9nLnYoVEFHLCAiKiogcG9zc2libGUgYnVnICoqIENyZWF0ZWQgTkVXIERiT2JqIChpZCMiICsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtQ29tcGlsZWRTcWwublN0YXRlbWVudCArCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIikgYmVjYXVzZSB0aGUgcHJldmlvdXNseSBjcmVhdGVkIERiT2JqIChpZCMiICsgbGFzdCArCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgIikgd2FzIG5vdCByZWxlYXNlZCBmb3Igc3FsOiIgKyBzcWwpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICIpIHdhcyBub3QgcmVsZWFzZWQgZm9yIHNxbDoiICsgbVNxbCk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIC8vIHN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A9IG51bGw7Ci0gICAgICAgICAgICAgICAgblN0YXRlbWVudCA9IDA7CiAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgIC8vIGl0IGlzIGluIGNvbXBpbGVkLXNxbCBjYWNoZS4gcmVzZXQgaXRzIENvbXBpbGVkU3FsI21JblVzZSBmbGFnCiAgICAgICAgICAgICAgICAgbUNvbXBpbGVkU3FsLnJlbGVhc2UoKTsKICAgICAgICAgICAgIH0KLSAgICAgICAgfSAKKyAgICAgICAgfQorICAgICAgICBtQ29tcGlsZWRTcWwgPSBudWxsOworICAgICAgICBuU3RhdGVtZW50ID0gMDsKICAgICB9CiAKICAgICAvKioKICAgICAgKiBSZXR1cm5zIGEgdW5pcXVlIGlkZW50aWZpZXIgZm9yIHRoaXMgcHJvZ3JhbS4KICAgICAgKgogICAgICAqIEByZXR1cm4gYSB1bmlxdWUgaWRlbnRpZmllciBmb3IgdGhpcyBwcm9ncmFtCisgICAgICogQGRlcHJlY2F0ZWQgZG8gbm90IHVzZSB0aGlzIG1ldGhvZC4gaXQgaXMgbm90IGd1YXJhbnRlZWQgdG8gYmUgdGhlIHNhbWUgYWNyb3NzIGV4ZWN1dGlvbnMgb2YKKyAgICAgKiB0aGUgU1FMIHN0YXRlbWVudCBjb250YWluZWQgaW4gdGhpcyBvYmplY3QuCiAgICAgICovCisgICAgQERlcHJlY2F0ZWQKICAgICBwdWJsaWMgZmluYWwgaW50IGdldFVuaXF1ZUlkKCkgewotICAgICAgICByZXR1cm4gblN0YXRlbWVudDsKKyAgICAgIHJldHVybiAtMTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiB1c2VkIG9ubHkgZm9yIHRlc3RpbmcgcHVycG9zZXMKKyAgICAgKi8KKyAgICAvKiBwYWNrYWdlICovIGludCBnZXRTcWxTdGF0ZW1lbnRJZCgpIHsKKyAgICAgIHN5bmNocm9uaXplZCh0aGlzKSB7CisgICAgICAgIHJldHVybiAobUNvbXBpbGVkU3FsID09IG51bGwpID8gMCA6IG5TdGF0ZW1lbnQ7CisgICAgICB9CiAgICAgfQogCiAgICAgLyogcGFja2FnZSAqLyBTdHJpbmcgZ2V0U3FsU3RyaW5nKCkgewpAQCAtMTY5LDYgKzIyNCwzOSBAQAogICAgICAgICAvLyBUT0RPIGlzIHRoZXJlIGEgbmVlZCBmb3IgdGhpcz8KICAgICB9CiAKKyAgICBwcml2YXRlIHZvaWQgYmluZChpbnQgdHlwZSwgaW50IGluZGV4LCBPYmplY3QgdmFsdWUpIHsKKyAgICAgICAgbURhdGFiYXNlLnZlcmlmeURiSXNPcGVuKCk7CisgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgeworICAgICAgICAgICAgYWRkVG9CaW5kQXJncyhpbmRleCwgKHR5cGUgPT0gQ3Vyc29yLkZJRUxEX1RZUEVfTlVMTCkgPyBudWxsIDogdmFsdWUpOworICAgICAgICAgICAgaWYgKG5TdGF0ZW1lbnQgPiAwKSB7CisgICAgICAgICAgICAgICAgLy8gYmluZCBvbmx5IGlmIHRoZSBTUUwgc3RhdGVtZW50IGlzIGNvbXBpbGVkCisgICAgICAgICAgICAgICAgYWNxdWlyZVJlZmVyZW5jZSgpOworICAgICAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAodHlwZSkgeworICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBDdXJzb3IuRklFTERfVFlQRV9OVUxMOgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hdGl2ZV9iaW5kX251bGwoaW5kZXgpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBDdXJzb3IuRklFTERfVFlQRV9CTE9COgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hdGl2ZV9iaW5kX2Jsb2IoaW5kZXgsIChieXRlW10pIHZhbHVlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgQ3Vyc29yLkZJRUxEX1RZUEVfRkxPQVQ6CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmF0aXZlX2JpbmRfZG91YmxlKGluZGV4LCAoRG91YmxlKSB2YWx1ZSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIEN1cnNvci5GSUVMRF9UWVBFX0lOVEVHRVI6CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmF0aXZlX2JpbmRfbG9uZyhpbmRleCwgKExvbmcpIHZhbHVlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgQ3Vyc29yLkZJRUxEX1RZUEVfU1RSSU5HOgorICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYXRpdmVfYmluZF9zdHJpbmcoaW5kZXgsIChTdHJpbmcpIHZhbHVlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICAgICAgICAgIHJlbGVhc2VSZWZlcmVuY2UoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKICAgICAvKioKICAgICAgKiBCaW5kIGEgTlVMTCB2YWx1ZSB0byB0aGlzIHN0YXRlbWVudC4gVGhlIHZhbHVlIHJlbWFpbnMgYm91bmQgdW50aWwKICAgICAgKiB7QGxpbmsgI2NsZWFyQmluZGluZ3N9IGlzIGNhbGxlZC4KQEAgLTE3NiwzNCArMjY0LDE4IEBACiAgICAgICogQHBhcmFtIGluZGV4IFRoZSAxLWJhc2VkIGluZGV4IHRvIHRoZSBwYXJhbWV0ZXIgdG8gYmluZCBudWxsIHRvCiAgICAg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RleCwgdmFsdWUpOwotICAgICAgICB9IGZpbmFsbHkgewotICAgICAgICAgICAgcmVsZWFzZVJlZmVyZW5jZSgpOwotICAgICAgICB9CisgICAgICAgIGJpbmQoQ3Vyc29yLkZJRUxEX1RZUEVfQkxPQiwgaW5kZXgsIHZhbHVlKTsKICAgICB9CiAKICAgICAvKioKICAgICAgKiBDbGVhcnMgYWxsIGV4aXN0aW5nIGJpbmRpbmdzLiBVbnNldCBiaW5kaW5ncyBhcmUgdHJlYXRlZCBhcyBOVUxMLgogICAgICAqLwogICAgIHB1YmxpYyB2b2lkIGNsZWFyQmluZGluZ3MoKSB7Ci0gICAgICAgIGlmICghbURhdGFiYXNlLmlzT3BlbigpKSB7Ci0gICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJkYXRhYmFzZSAiICsgbURhdGFiYXNlLmdldFBhdGgoKSArICIgYWxyZWFkeSBjbG9zZWQiKTsKLSAgICAgICAgfQotICAgICAgICBhY3F1aXJlUmVmZXJlbmNlKCk7Ci0gICAgICAgIHRyeSB7Ci0gICAgICAgICAgICBuYXRpdmVfY2xlYXJfYmluZGluZ3MoKTsKLSAgICAgICAgfSBmaW5hbGx5IHsKLSAgICAgICAgICAgIHJlbGVhc2VSZWZlcmVuY2UoKTsKKyAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CisgICAgICAgICAgICBtQmluZEFyZ3MgPSBudWxsOworICAgICAgICAgICAgaWYgKHRoaXMublN0YXRlbWVudCA9PSAwKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgfQorICAgICAgICAgICAgbURhdGFiYXNlLnZlcmlmeURiSXNPcGVuKCk7CisgICAgICAgICAgICBhY3F1aXJlUmVmZXJlbmNlKCk7CisgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIG5hdGl2ZV9jbGVhcl9iaW5kaW5ncygpOworICAgICAgICAgICAgfSBmaW5hbGx5IHsKKyAgICAgICAgICAgICAgICByZWxlYXNlUmVmZXJlbmNlKCk7CisgICAgICAgICAgICB9CiAgICAgICAgIH0KICAgICB9CiAKQEAgLTI4OCwxNCArMzQwLDY4IEBACiAgICAgICogUmVsZWFzZSB0aGlzIHByb2dyYW0ncyByZXNvdXJjZXMsIG1ha2luZyBpdCBpbnZhbGlkLgogICAgICAqLwogICAgIHB1YmxpYyB2b2lkIGNsb3NlKCkgewotICAgICAgICBpZiAoIW1EYXRhYmFzZS5pc09wZW4oKSkgeworICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKKyAgICAgICAgICAgIG1CaW5kQXJncyA9IG51bGw7CisgICAgICAgICAgICBpZiAobkhhbmRsZSA9PSAwIHx8ICFtRGF0YWJhc2UuaXNPcGVuKCkpIHsKKyAgICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZWxlYXNlUmVmZXJlbmNlKCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcml2YXRlIHN5bmNocm9uaXplZCB2b2lkIGFkZFRvQmluZEFyZ3MoaW50IGluZGV4LCBPYmplY3QgdmFsdWUpIHsKKyAgICAgICAgaWYgKG1CaW5kQXJncyA9PSBudWxsKSB7CisgICAgICAgICAgICBtQmluZEFyZ3MgPSBuZXcgSGFzaE1hcDxJbnRlZ2VyLCBPYmplY3Q+KCk7CisgICAgICAgIH0KKyAgICAgICAgbUJpbmRBcmdzLnB1dChpbmRleCwgdmFsdWUpOworICAgIH0KKworICAgIC8qIHBhY2thZ2UgKi8gc3luY2hyb25pemVkIHZvaWQgY29tcGlsZUFuZGJpbmRBbGxBcmdzKCkgeworICAgICAgICBpZiAoblN0YXRlbWVudCA9PSAwKSB7CisgICAgICAgICAgICAvLyBTUUwgc3RhdGVtZW50IGlzIG5vdCBjb21waWxlZCB5ZXQuIGNvbXBpbGUgaXQgbm93LgorICAgICAgICAgICAgY29tcGlsZVNxbCgpOworICAgICAgICB9CisgICAgICAgIGlmIChtQmluZEFyZ3MgPT0gbnVsbCkgewogICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICB9Ci0gICAgICAgIG1EYXRhYmFzZS5sb2NrKCk7Ci0gICAgICAgIHRyeSB7Ci0gICAgICAgICAgICByZWxlYXNlUmVmZXJlbmNlKCk7Ci0gICAgICAgIH0gZmluYWxseSB7Ci0gICAgICAgICAgICBtRGF0YWJhc2UudW5sb2NrKCk7CisgICAgICAgIGZvciAoaW50IGluZGV4IDogbUJpbmRBcmdzLmtleVNldCgpKSB7CisgICAgICAgICAgICBPYmplY3QgdmFsdWUgPSBtQmluZEFyZ3MuZ2V0KGluZGV4KTsKKyAgICAgICAgICAgIGlmICh2YWx1ZSA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgbmF0aXZlX2JpbmRfbnVsbChpbmRleCk7CisgICAgICAgICAgICB9IGVsc2UgaWYgKHZhbHVlIGluc3RhbmNlb2YgRG91YmxlIHx8IHZhbHVlIGluc3RhbmNlb2YgRmxvYXQpIHsKKyAgICAgICAgICAgICAgICBuYXRpdmVfYmluZF9kb3VibGUoaW5kZXgsICgoTnVtYmVyKSB2YWx1ZSkuZG91YmxlVmFsdWUoKSk7CisgICAgICAgICAgICB9IGVsc2UgaWYgKHZhbHVlIGluc3RhbmNlb2YgTnVtYmVyKSB7CisgICAgICAgICAgICAgICAgbmF0aXZlX2JpbmRfbG9uZyhpbmRleCwgKChOdW1iZXIpIHZhbHVlKS5sb25nVmFsdWUoKSk7CisgICAgICAgICAgICB9IGVsc2UgaWYgKHZhbHVlIGluc3RhbmNlb2YgQm9vbGVhbikgeworICAgICAgICAgICAgICAgIEJvb2xlYW4gYm9vbCA9IChCb29sZWFuKXZhbHVlOworICAgICAgICAgICAgICAgIG5hdGl2ZV9iaW5kX2xvbmcoaW5kZXgsIChib29sKSA/IDEgOiAwKTsKKyAgICAgICAgICAgICAgICBpZiAoYm9vbCkgeworICAgICAgICAgICAgICAgICAgICBuYXRpdmVfYmluZF9sb25nKGluZGV4LCAxKTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICBuYXRpdmVfYmluZF9sb25nKGluZGV4LCAwKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9IGVsc2UgaWYgKHZhbHVlIGluc3RhbmNlb2YgYnl0ZVtdKXsKKyAgICAgICAgICAgICAgICBuYXRpdmVfYmluZF9ibG9iKGluZGV4LCAoYnl0ZVtdKSB2YWx1ZSk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIG5hdGl2ZV9iaW5kX3N0cmluZyhpbmRleCwgdmFsdWUudG9TdHJpbmcoKSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBHaXZlbiBhbiBhcnJheSBvZiBTdHJpbmcgYmluZEFyZ3MsIHRoaXMgbWV0aG9kIGJpbmRzIGFsbCBvZiB0aGVtIGluIG9uZSBzaW5nbGUgY2FsbC4KKyAgICAgKgorICAgICAqIEBwYXJhbSBiaW5kQXJncyB0aGUgU3RyaW5nIGFycmF5IG9mIGJpbmQgYXJncy4KKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBiaW5kQWxsQXJnc0FzU3RyaW5ncyhTdHJpbmdbXSBiaW5kQXJncykgeworICAgICAgICBpZiAoYmluZEFyZ3MgPT0gbnVsbCkgeworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisgICAgICAgIGludCBzaXplID0gYmluZEFyZ3MubGVuZ3RoOworICAgICAgICBzeW5jaHJvbml6ZWQodGhpcykgeworICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBzaXplOyBpKyspIHsKKyAgICAgICAgICAgICAgICBiaW5kU3RyaW5nKGkgKyAxLCBiaW5kQXJnc1tpXSk7CisgICAgICAgICAgICB9CiAgICAgICAgIH0KICAgICB9CiAKZGlmZiAtLWdpdCBhL2NvcmUvamF2YS9hbmRyb2lkL2RhdGFiYXNlL3Nxb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gICAgICAgICAgICAgbURhdGFiYXNlLmxvZ1RpbWVTdGF0KG1TcWwsIHRpbWVTdGFydCk7CiAgICAgICAgICAgICAgICAgcmV0dXJuIG51bVJvd3M7CiAgICAgICAgICAgICB9IGNhdGNoIChJbGxlZ2FsU3RhdGVFeGNlcHRpb24gZSl7CkBAIC0xNDEsNTEgKzE0NCwxMyBAQAogICAgICAqIENhbGxlZCBieSBTUUxpdGVDdXJzb3Igd2hlbiBpdCBpcyByZXF1ZXJpZWQuCiAgICAgICovCiAgICAgLyogcGFja2FnZSAqLyB2b2lkIHJlcXVlcnkoKSB7Ci0gICAgICAgIGlmIChtQmluZEFyZ3MgIT0gbnVsbCkgewotICAgICAgICAgICAgaW50IGxlbiA9IG1CaW5kQXJncy5sZW5ndGg7Ci0gICAgICAgICAgICB0cnkgewotICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbGVuOyBpKyspIHsKLSAgICAgICAgICAgICAgICAgICAgc3VwZXIuYmluZFN0cmluZyhpICsgMSwgbUJpbmRBcmdzW2ldKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9IGNhdGNoIChTUUxpdGVNaXN1c2VFeGNlcHRpb24gZSkgewotICAgICAgICAgICAgICAgIFN0cmluZ0J1aWxkZXIgZXJyTXNnID0gbmV3IFN0cmluZ0J1aWxkZXIoIm1TcWwgIiArIG1TcWwpOwotICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbGVuOyBpKyspIHsKLSAgICAgICAgICAgICAgICAgICAgZXJyTXNnLmFwcGVuZCgiICIpOwotICAgICAgICAgICAgICAgICAgICBlcnJNc2cuYXBwZW5kKG1CaW5kQXJnc1tpXSk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGVyck1zZy5hcHBlbmQoIiAiKTsKLSAgICAgICAgICAgICAgICBJbGxlZ2FsU3RhdGVFeGNlcHRpb24gbGVha1Byb2dyYW0gPSBuZXcgSWxsZW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5kcm9pZC5kYXRhYmFzZS5TUUxFeGNlcHRpb24gSWYgdGhlIFNRTCBzdHJpbmcgaXMgaW52YWxpZCBmb3IKKyAgICAgKiAgICAgICAgIHNvbWUgcmVhc29uCisgICAgICovCisgICAgcHVibGljIGludCBleGVjdXRlVXBkYXRlRGVsZXRlKCkgeworICAgICAgICBzeW5jaHJvbml6ZWQodGhpcykgeworICAgICAgICAgICAgbG9uZyB0aW1lU3RhcnQgPSBhY3F1aXJlQW5kTG9jayhXUklURSk7CisgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIGludCBudW1DaGFuZ2VzID0gbmF0aXZlX2V4ZWN1dGUoKTsKKyAgICAgICAgICAgICAgICBtRGF0YWJhc2UubG9nVGltZVN0YXQobVNxbCwgdGltZVN0YXJ0KTsKKyAgICAgICAgICAgICAgICByZXR1cm4gbnVtQ2hhbmdlczsKKyAgICAgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICAgICAgcmVsZWFzZUFuZFVubG9jaygpOworICAgICAgICAgICAgfQogICAgICAgICB9CiAgICAgfQogCkBAIC03NiwyMSArMTAyLDE1IEBACiAgICAgICogICAgICAgICBzb21lIHJlYXNvbgogICAgICAqLwogICAgIHB1YmxpYyBsb25nIGV4ZWN1dGVJbnNlcnQoKSB7Ci0gICAgICAgIEJsb2NrR3VhcmQuZ2V0VGhyZWFkUG9saWN5KCkub25Xcml0ZVRvRGlzaygpOwotICAgICAgICBpZiAoIW1EYXRhYmFzZS5pc09wZW4oKSkgewotICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigiZGF0YWJhc2UgIiArIG1EYXRhYmFzZS5nZXRQYXRoKCkgKyAiIGFscmVhZHkgY2xvc2VkIik7Ci0gICAgICAgIH0KLSAgICAgICAgbG9uZyB0aW1lU3RhcnQgPSBTeXN0ZW1DbG9jay51cHRpbWVNaWxsaXMoKTsKLSAgICAgICAgbURhdGFiYXNlLmxvY2soKTsKLQotICAgICAgICBhY3F1aXJlUmVmZXJlbmNlKCk7Ci0gICAgICAgIHRyeSB7Ci0gICAgICAgICAgICBuYXRpdmVfZXhlY3V0ZSgpOwotICAgICAgICAgICAgbURhdGFiYXNlLmxvZ1RpbWVTdGF0KG1TcWwsIHRpbWVTdGFydCk7Ci0gICAgICAgICAgICByZXR1cm4gKG1EYXRhYmFzZS5sYXN0Q2hhbmdlQ291bnQoKSA+IDApID8gbURhdGFiYXNlLmxhc3RJbnNlcnRSb3coKSA6IC0xOwotICAgICAgICB9IGZpbmFsbHkgewotICAgICAgICAgICAgcmVsZWFzZVJlZmVyZW5jZSgpOwotICAgICAgICAgICAgbURhdGFiYXNlLnVubG9jaygpOworICAgICAgICBzeW5jaHJvbml6ZWQodGhpcykgeworICAgICAgICAgICAgbG9uZyB0aW1lU3RhcnQgPSBhY3F1aXJlQW5kTG9jayhXUklURSk7CisgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIGxvbmcgbGFzdEluc2VydGVkUm93SWQgPSBuYXRpdmVfZXhlY3V0ZUluc2VydCgpOworICAgICAgICAgICAgICAgIG1EYXRhYmFzZS5sb2dUaW1lU3RhdChtU3FsLCB0aW1lU3RhcnQpOworICAgICAgICAgICAgICAgIHJldHVybiBsYXN0SW5zZXJ0ZWRSb3dJZDsKKyAgICAgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICAgICAgcmVsZWFzZUFuZFVubG9jaygpOworICAgICAgICAgICAgfQogICAgICAgICB9CiAgICAgfQogCkBAIC0xMDMsMjEgKzEyMywxNSBAQAogICAgICAqIEB0aHJvd3MgYW5kcm9pZC5kYXRhYmFzZS5zcWxpdGUuU1FMaXRlRG9uZUV4Y2VwdGlvbiBpZiB0aGUgcXVlcnkgcmV0dXJucyB6ZXJvIHJvd3MKICAgICAgKi8KICAgICBwdWJsaWMgbG9uZyBzaW1wbGVRdWVyeUZvckxvbmcoKSB7Ci0gICAgICAgIEJsb2NrR3VhcmQuZ2V0VGhyZWFkUG9saWN5KCkub25SZWFkRnJvbURpc2soKTsKLSAgICAgICAgaWYgKCFtRGF0YWJhc2UuaXNPcGVuKCkpIHsKLSAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oImRhdGFiYXNlICIgKyBtRGF0YWJhc2UuZ2V0UGF0aCgpICsgIiBhbHJlYWR5IGNsb3NlZCIpOwotICAgICAgICB9Ci0gICAgICAgIGxvbmcgdGltZVN0YXJ0ID0gU3lzdGVtQ2xvY2sudXB0aW1lTWlsbGlzKCk7Ci0gICAgICAgIG1EYXRhYmFzZS5sb2NrKCk7Ci0KLSAgICAgICAgYWNxdWlyZVJlZmVyZW5jZSgpOwotICAgICAgICB0cnkgewotICAgICAgICAgICAgbG9uZyByZXRWYWx1ZSA9IG5hdGl2ZV8xeDFfbG9uZygpOwotICAgICAgICAgICAgbURhdGFiYXNlLmxvZ1RpbWVTdGF0KG1TcWwsIHRpbWVTdGFydCk7Ci0gICAgICAgICAgICByZXR1cm4gcmV0VmFsdWU7Ci0gICAgICAgIH0gZmluYWxseSB7Ci0gICAgICAgICAgICByZWxlYXNlUmVmZXJlbmNlKCk7Ci0gICAgICAgICAgICBtRGF0YWJhc2UudW5sb2NrKCk7CisgICAgICAgIHN5bmNocm9uaXplZCh0aGlzKSB7CisgICAgICAgICAgICBsb25nIHRpbWVTdGFydCA9IGFjcXVpcmVBbmRMb2NrKFJFQUQpOworICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICBsb25nIHJldFZhbHVlID0gbmF0aXZlXzF4MV9sb25nKCk7CisgICAgICAgICAgICAgICAgbURhdGFiYXNlLmxvZ1RpbWVTdGF0KG1TcWwsIHRpbWVTdGFydCk7CisgICAgICAgICAgICAgICAgcmV0dXJuIHJldFZhbHVlOworICAgICAgICAgICAgfSBmaW5hbGx5IHsKKyAgICAgICAgICAgICAgICByZWxlYXNlQW5kVW5sb2NrKCk7CisgICAgICAgICAgICB9CiAgICAgICAgIH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gICAgICAgICAgICAgIFN0cmluZyByZXRWYWx1ZSA9IG5hdGl2ZV8xeDFfc3RyaW5nKCk7CisgICAgICAgICAgICAgICAgbURhdGFiYXNlLmxvZ1RpbWVTdGF0KG1TcWwsIHRpbWVTdGFydCk7CisgICAgICAgICAgICAgICAgcmV0dXJuIHJldFZhbHVlOworICAgICAgICAgICAgfSBmaW5hbGx5IHsKKyAgICAgICAgICAgICAgICByZWxlYXNlQW5kVW5sb2NrKCk7CisgICAgICAgICAgICB9CiAgICAgICAgIH0KICAgICB9CiAKLSAgICBwcml2YXRlIGZpbmFsIG5hdGl2ZSB2b2lkIG5hdGl2ZV9leGVjdXRlKCk7CisgICAgLyoqCisgICAgICogRXhlY3V0ZXMgYSBzdGF0ZW1lbnQgdGhhdCByZXR1cm5zIGEgMSBieSAxIHRhYmxlIHdpdGggYSBibG9iIHZhbHVlLgorICAgICAqCisgICAgICogQHJldHVybiBBIHJlYWQtb25seSBmaWxlIGRlc2NyaXB0b3IgZm9yIGEgY29weSBvZiB0aGUgYmxvYiB2YWx1ZSwgb3Ige0Bjb2RlIG51bGx9CisgICAgICogICAgICAgICBpZiB0aGUgdmFsdWUgaXMgbnVsbCBvciBjb3VsZCBub3QgYmUgcmVhZCBmb3Igc29tZSByZWFzb24uCisgICAgICoKKyAgICAgKiBAdGhyb3dzIGFuZHJvaWQuZGF0YWJhc2Uuc3FsaXRlLlNRTGl0ZURvbmVFeGNlcHRpb24gaWYgdGhlIHF1ZXJ5IHJldHVybnMgemVybyByb3dzCisgICAgICovCisgICAgcHVibGljIFBhcmNlbEZpbGVEZXNjcmlwdG9yIHNpbXBsZVF1ZXJ5Rm9yQmxvYkZpbGVEZXNjcmlwdG9yKCkgeworICAgICAgICBzeW5jaHJvbml6ZWQodGhpcykgeworICAgICAgICAgICAgbG9uZyB0aW1lU3RhcnQgPSBhY3F1aXJlQW5kTG9jayhSRUFEKTsKKyAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgUGFyY2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XBlID09IERhdGFiYXNlVXRpbHMuU1RBVEVNRU5UX1VQREFURSkgeworICAgICAgICAgICAgLy8gZ290IHVwZGF0ZSBTUUwgc3RhdGVtZW50LiBpZiB0aGVyZSBpcyBOTyBwZW5kaW5nIHRyYW5zYWN0aW9uLCBzdGFydCBvbmUKKyAgICAgICAgICAgIGlmICghbURhdGFiYXNlLmluVHJhbnNhY3Rpb24oKSkgeworICAgICAgICAgICAgICAgIG1EYXRhYmFzZS5iZWdpblRyYW5zYWN0aW9uTm9uRXhjbHVzaXZlKCk7CisgICAgICAgICAgICAgICAgbVN0YXRlID0gVFJBTlNfU1RBUlRFRDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICAvLyBkbyBJIGhhdmUgZGF0YWJhc2UgbG9jaz8gaWYgbm90LCBncmFiIGl0LgorICAgICAgICBpZiAoIW1EYXRhYmFzZS5pc0RiTG9ja2VkQnlDdXJyZW50VGhyZWFkKCkpIHsKKyAgICAgICAgICAgIG1EYXRhYmFzZS5sb2NrKCk7CisgICAgICAgICAgICBtU3RhdGUgPSBMT0NLX0FDUVVJUkVEOworICAgICAgICB9CisKKyAgICAgICAgYWNxdWlyZVJlZmVyZW5jZSgpOworICAgICAgICBsb25nIHN0YXJ0VGltZSA9IFN5c3RlbUNsb2NrLnVwdGltZU1pbGxpcygpOworICAgICAgICBtRGF0YWJhc2UuY2xvc2VQZW5kaW5nU3RhdGVtZW50cygpOworICAgICAgICBjb21waWxlQW5kYmluZEFsbEFyZ3MoKTsKKyAgICAgICAgcmV0dXJuIHN0YXJ0VGltZTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiB0aGlzIG1ldGhvZCByZWxlYXNlcyBsb2NrcyBhbmQgcmVmZXJlbmNlcyBhY3F1aXJlZCBpbiB7QGxpbmsgI2FjcXVpcmVBbmRMb2NrKGJvb2xlYW4pfQorICAgICAqLworICAgIHByaXZhdGUgdm9pZCByZWxlYXNlQW5kVW5sb2NrKCkgeworICAgICAgICBy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dW5kRGF0YVNldHRpbmcoKTsKICAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGUpIHsKLSAgICAgICAgICAgIC8vIEVyciBvbiB0aGUgc2lkZSBvZiBzYWZldHkgCisgICAgICAgICAgICAvLyBFcnIgb24gdGhlIHNpZGUgb2Ygc2FmZXR5CiAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgIH0KICAgICB9CkBAIC00ODksNiArNDg5LDE3IEBACiAgICAgICAgIH0KICAgICB9CiAKKyAgICAvKioKKyAgICAgKiB7QGhpZGV9CisgICAgICovCisgICAgcHVibGljIFN0cmluZ1tdIGdldFRldGhlcmFibGVCbHVldG9vdGhSZWdleHMoKSB7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICByZXR1cm4gbVNlcnZpY2UuZ2V0VGV0aGVyYWJsZUJsdWV0b290aFJlZ2V4cygpOworICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgcmV0dXJuIG5ldyBTdHJpbmdbMF07CisgICAgICAgIH0KKyAgICB9CisKICAgICAvKioge0BoaWRlfSAqLwogICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgaW50IFRFVEhFUl9FUlJPUl9OT19FUlJPUiAgICAgICAgICAgPSAwOwogICAgIC8qKiB7QGhpZGV9ICovCkBAIC01MjQsNSArNTM1LDIwIEBACiAgICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBlKSB7CiAgICAgICAgICAgICByZXR1cm4gVEVUSEVSX0VSUk9SX1NFUlZJQ0VfVU5BVkFJTDsKICAgICAgICAgfQotICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIEVuc3VyZSB0aGUgZGV2aWNlIHN0YXlzIGF3YWtlIHVudGlsIHdlIGNvbm5lY3Qgd2l0aCB0aGUgbmV4dCBuZXR3b3JrCisgICAgICogQHBhcmFtIGZvcldob21lIFRoZSBuYW1lIG9mIHRoZSBuZX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uQVBOX1RZUEVfREVGQVVMVDsKLSAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgIG1BcG5UeXBlVG9XYXRjaEZvciA9IG1BcG5UeXBlOwotICAgICAgICB9CiAgICAgICAgIGlmIChuZXRUeXBlID09IENvbm5lY3Rpdml0eU1hbmFnZXIuVFlQRV9NT0JJTEUgfHwKICAgICAgICAgICAgICAgICBuZXRUeXBlID09IENvbm5lY3Rpdml0eU1hbmFnZXIuVFlQRV9NT0JJTEVfSElQUkkpIHsKICAgICAgICAgICAgIG1Jc0RlZmF1bHRPckhpcHJpID0gdHJ1ZTsKICAgICAgICAgfQogCiAgICAgICAgIG1QaG9uZVNlcnZpY2UgPSBudWxsOwotICAgICAgICBpZihuZXRUeXBlID09IENvbm5lY3Rpdml0eU1hbmFnZXIuVFlQRV9NT0JJTEUpIHsKLSAgICAgICAgICAgIG1FbmFibGVkID0gdHJ1ZTsKLSAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgIG1FbmFibGVkID0gZmFsc2U7Ci0gICAgICAgIH0KIAotICAgICAgICBtRG5zUHJvcE5hbWVzID0gbmV3IFN0cmluZ1tdIHsKKyAgICAgICAgc0Ruc1Byb3BOYW1lcyA9IG5ldyBTdHJpbmdbXSB7CiAgICAgICAgICAgICAgICAgIm5ldC5ybW5ldDAuZG5zMSIsCiAgICAgICAgICAgICAgICAgIm5ldC5ybW5ldDAuZG5zMiIsCiAgICAgICAgICAgICAgICAgIm5ldC5ldGgwLmRuczEiLApAQCAtOTgsMTY1ICs5MywxNjcgQEAKICAgICAgICAgICAgICAgICAibmV0LmdwcnMuZG5zMiIsCiAgICAgICAgICAgICAgICAgIm5ldC5wcHAwLmRuczEiLAogICAgICAgICAgICAgICAgICJuZXQucHBwMC5kbnMyIn07Ci0KICAgICB9CiAKICAgICAvKioKLSAgICAgKiBCZWdpbiBtb25pdG9yaW5nIG1vYmlsZSBkYXRhIGNvbm5lY3Rpdml0eS4KKyAgICAgKiBCZWdpbiBt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B3aXRoIG5vIGhvbGVzLgorICAgICAqLworICAgIHB1YmxpYyBTdHJpbmdbXSBnZXREbnNQcm9wTmFtZXMoKSB7CisgICAgICAgIHJldHVybiBzRG5zUHJvcE5hbWVzOwogICAgIH0KIAotICAgIHByaXZhdGUgYm9vbGVhbiBpc0FwblR5cGVJbmNsdWRlZChTdHJpbmcgdHlwZUxpc3QpIHsKLSAgICAgICAgLyogY29tbWEgc2VwZXJhdGVkIGxpc3QgLSBzcGxpdCBhbmQgY2hlY2sgKi8KLSAgICAgICAgaWYgKHR5cGVMaXN0ID09IG51bGwpCi0gICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgcHVibGljIGJvb2xlYW4gaXNQcml2YXRlRG5zUm91dGVTZXQoKSB7CisgICAgICAgIHJldHVybiBtUHJpdmF0ZURuc1JvdXRlU2V0OworICAgIH0KIAotICAgICAgICBTdHJpbmdbXSBsaXN0ID0gdHlwZUxpc3Quc3BsaXQoIiwiKTsKLSAgICAgICAgZm9yKGludCBpPTA7IGk8IGxpc3QubGVuZ3RoOyBpKyspIHsKLSAgICAgICAgICAgIGlmIChUZXh0VXRpbHMuZXF1YWxzKGxpc3RbaV0sIG1BcG5UeXBlVG9XYXRjaEZvcikgfHwKLSAgICAgICAgICAgICAgICBUZXh0VXRpbHMuZXF1YWxzKGxpc3RbaV0sIFBob25lLkFQTl9UWVBFX0FMTCkpIHsKLSAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgcHVibGljIHZvaWQgcHJpdmF0ZURuc1JvdXRlU2V0KGJvb2xlYW4gZW5hYmxlZCkgeworICAgICAgICBtUHJpdmF0ZURuc1JvdXRlU2V0ID0gZW5hYmxlZDsKKyAgICB9CisKKyAgICBwdWJsaWMgTmV0d29ya0luZm8gZ2V0TmV0d29ya0luZm8oKSB7CisgICAgICAgIHJldHVybiBtTmV0d29ya0luZm87CisgICAgfQorCisgICAgcHVibGljIGludCBnZXREZWZhdWx0R2F0ZXdheUFkZHIoKSB7CisgICAgICAgIHJldHVybiBtRGVmYXVsdEdhdGV3YXlBZGRyOworICAgIH0KKworICAgIHB1YmxpYyBib29sZWFuIGlzRGVmYXVsdFJvdXRlU2V0KCkgeworICAgICAgICByZXR1cm4gbURlZmF1bHRSb3V0ZVNldDsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBkZWZhdWx0Um91dGVTZXQoYm9vbGVhbiBlbmFibGVkKSB7CisgICAgICAgIG1EZWZhdWx0Um91dGVTZXQgPSBlbmFibGVkOworICAgIH0KKworICAgIC8qKgorICAgICAqIFRoaXMgaXMgbm90IGltcGxlbWVudGVkLgorICAgICAqLworICAgIHB1YmxpYyB2b2lkIHJlbGVhc2VXYWtlTG9jaygpIHsKICAgICB9CiAKICAgICBwcml2YXRlIGNsYXNzIE1vYmlsZURhdGFTdGF0ZVJlY2VpdmVyIGV4dGVuZHMgQnJvYWRjYXN0UmVjZWl2ZXIgewotICAgICAgICBDb25uZWN0aXZpdHlNYW5hZ2VyIG1Db25uZWN0aXZpdHlNYW5hZ2VyOworICAgICAgICBJQ29ubmVjdGl2aXR5TWFuYWdlciBtQ29ubmVjdGl2aXR5TWFuYWdlcjsKKwogICAgICAgICBwdWJsaWMgdm9pZCBvblJlY2VpdmUoQ29udGV4dCBjb250ZXh0LCBJbnRlbnQgaW50ZW50KSB7Ci0gICAgICAgICAgICBzeW5jaHJvbml6ZWQodGhpcykgewotICAgICAgICAgICAgICAgIGlmIChpbnRlbnQuZ2V0QWN0aW9uKCkuZXF1YWxzKFRlbGVwaG9ueUludGVudHMuCi0gICAgICAgICAgICAgICAgICAgICAgICBBQ1RJT05fQU5ZX0RBVEFfQ09OTkVDVElPTl9TVEFURV9DSEFOR0VEKSkgewotICAgICAgICAgICAgICAgICAgICBQaG9uZS5EYXRhU3RhdGUgc3RhdGUgPSBnZXRNb2JpbGVEYXRhU3RhdGUoaW50ZW50KTsKLSAgICAgICAgICAgICAgICAgICAgU3RyaW5nIHJlYXNvbiA9IGludGVudC5nZXRTdHJpbmdFeHRyYShQaG9uZS5TVEFURV9DSEFOR0VfUkVBU09OX0tFWSk7Ci0gICAgICAgICAgICAgICAgICAgIFN0cmluZyBhcG5OYW1lID0gaW50ZW50LmdldFN0cmluZ0V4dHJhKFBob25lLkRBVEFfQVBOX0tFWSk7Ci0gICAgICAgICAgICAgICAgICAgIFN0cmluZyBhcG5UeXBlTGlzdCA9IGludGVudC5nZXRTdHJpbmdFeHRyYShQaG9uZS5EQVRBX0FQTl9UWVBFU19LRVkpOwotICAgICAgICAgICAgICAgICAgICBtQXBuTmFtZSA9IGFwbk5hbWU7CisgICAgICAgICAgICBpZiAoaW50ZW50LmdldEFjdGlvbigpLmVxdWFscyhUZWxlcGhvbnlJbnRlbnRzLgorICAgICAgICAgICAgICAgICAgICBBQ1RJT05fQU5ZX0RBVEFfQ09OTkVDVElPTl9TVEFURV9DSEFOR0VEKSkgeworICAgICAgICAgICAgICAgIFN0cmluZyBhcG5UeXBlID0gaW50ZW50LmdldFN0cmluZ0V4dHJhKFBob25lLkRBVEFfQVBOX1RZUEVfS0VZKTsKIAotICAgICAgICAgICAgICAgICAgICBib29sZWFuIHVuYXZhaWxhYmxlID0gaW50ZW50LmdldEJvb2xlYW5FeHRyYShQaG9uZS5ORVRXT1JLX1VOQVZBSUxBQkxFX0tFWSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBmYWxzZSk7CisgICAgICAgICAgICAgICAgaWYgKCFUZXh0VXRpbHMuZXF1YWxzKGFwblR5cGUsIG1BcG5UeXBlKSkgeworICAgICAgICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIFBob25lLkRhdGFTdGF0ZSBzdGF0ZSA9IEVudW0udmFsdWVPZihQaG9uZS5EYXRhU3RhdGUuY2xhc3MsCisgICAgICAgICAgICAgICAgICAgICAgICBpbnRlbnQuZ2V0U3RyaW5nRXh0cmEoUGhvbmUuU1RBVEVfS0VZKSk7CisgICAgICAgICAgICAgICAgU3RyaW5nIHJlYXNvbiA9IGludGVudC5nZXRTdHJpbmdFeHRyYShQaG9uZS5TVEFURV9DSEFOR0VfUkVBU09OX0tFWSk7CisgICAgICAgICAgICAgICAgU3RyaW5nIGFwbk5hbWUgPSBpbnRlbnQuZ2V0U3RyaW5nRXh0cmEoUGhvbmUuREFUQV9BUE5fS0VZKTsKIAotICAgICAgICAgICAgICAgICAgICAvLyBzZXQgdGhpcyByZWdhcmRsZXNzIG9mIHRoZSBhcG5UeXBlTGlzdC4gIEl0J3MgYWxsIHRoZSBzYW1lIHJhZGlvL25ldHdvcmsKLSAgICAgICAgICAgICAgICAgICAgLy8gdW5kZXJuZWF0aAotICAgICAgICAgICAgICAgICAgICBtTmV0d29ya0luZm8uc2V0SXNBdmFpbGFibGUoIXVuYXZhaWxhYmxlKTsKKyAgICAgICAgICAgICAgICBib29sZWFuIHVuYXZhaWxhYmxlID0gaW50ZW50LmdldEJvb2xlYW5FeHRyYShQaG9uZS5ORVRXT1JLX1VOQVZBSUxBQkxFX0tFWSwKKyAgICAgICAgICAgICAgICAgICAgICAgIGZhbHNlKTsKKyAgICAgICAgICAgICAgICBtTmV0d29ya0luZm8uc2V0SXNBdmFpbGFibGUoIXVuYXZhaWxhYmxlKTsKIAotICAgICAgICAgICAgICAgICAgICBpZiAoaXNBcG5UeXBlSW5jbHVkZWQoYXBuVHlwZUxpc3QpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAobUVuYWJsZWQgPT0gZmFsc2UpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBpZiB3ZSdyZSBub3QgZW5hYmxlZCBidXQgdGhlIEFQTiBUeXBlIGlzIHN1cHBvcnRlZCBieSB0aGlzIGNvbm5lY3Rpb24KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyB3ZSBzaG91bGQgcmVjb3JkIHRoZSBpbnRlcmZhY2UgbmFtZSBpZiBvbmUncyBwcm92aWRlZC4gIElmIHRoZSB1c2VyCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gdHVybnMgb24gdGhpcyBuZXR3b3JrIHdlIHdpbGwgbmVlZCB0aGUgaW50ZXJmYWNlbmFtZSBidXQgd29uJ3QgZ2V0Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gYSBmcmVzaCBjb25uZWN0ZWQgbWVzc2FnZSAtIFRPRE8gZml4IHRoaXMgd2hlbiB3ZSBnZXQgcGVyLUFQTgotICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIG5vdGlmaWNhdGlvbnMKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoc3RhdGUgPT0gUGhvbmUuRGF0YVN0YXRlLkNPTk5FQ1RFRCkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoREJHKSBMb2cuZChUQUcsICJyZXBsYWNpbmcgb2xkIG1JbnRlcmZhY2VOYW1lICgiICsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtSW50ZXJmYWNlTmFtZSArICIpIHdpdGggIiArCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50ZW50LmdldFN0cmluZ0V4dHJhKFBob25lLkRBVEFfSUZBQ0VfTkFNRV9LRVkpICsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiIGZvciAiICsgbUFwblR5cGUpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtSW50ZXJmYWNlTmFtZSA9IGludGVudC5nZXRTdHJpbmdFeHRyYShQaG9uZS5EQVRBX0lGQUNFX05BTUVfS0VZKTsKKyAgICAgICAgICAgICAgICBpZiAoREJHKSBMb2cuZChUQUcsIG1BcG5UeXBlICsgIiBSZWNlaXZlZCBzdGF0ZT0gIiArIHN0YXRlICsgIiwgb2xkPSAiICsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1Nb2JpbGVEYXRhU3RhdGUgKyAiLCByZWFzb249ICIgKworICAgICAgICAgICAgICAgICAgICAgICAgKHJlYXNvbiA9PSBudWxsID8gIih1bnNwZWNpZmllZCkiIDogcmVhc29uKSk7CisKKyAgICAgICAgICAgICAgICBpZiAobU1vYmlsZURhdGFTdGF0ZSAhPSBzdGF0ZSkgeworICAgICAgICAgICAgICAgICAgICBtTW9iaWxlRGF0YVN0YXRlID0gc3RhdGU7CisgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoc3RhdGUpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgRElTQ09OTkVDVEVEOgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKGlzVGVhcmRvd25SZXF1ZXN0ZWQoKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXRUZWFyZG93blJlcXVlc3RlZChmYWxzZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgICAgICAgICAgICAgfQogCi0gICAgICAgICAgICAgICAgICAgIGlmIChEQkcpIExvZy5kKFRBRywgbUFwblR5cGUgKyAiIFJlY2VpdmVkIHN0YXRlPSAiICsgc3RhdGUgKyAiLCBvbGQ9ICIgKwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1Nb2JpbGVEYXRhU3RhdGUgKyAiLCByZWFzb249ICIgKwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIChyZWFzb24gPT0gbnVsbCA/ICIodW5zcGVjaWZpZWQpIiA6IHJlYXNvbikgKwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICIsIGFwblR5cGVMaXN0PSAiICsgYXBuVHlwZUxpc3QpOwotCi0gICAgICAgICAgICAgICAgICAgIGlmIChtTW9iaWxlRGF0YVN0YXRlICE9IHN0YXRlKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBtTW9iaWxlRGF0YVN0YXRlID0gc3RhdGU7Ci0gICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKHN0YXRlKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBESVNDT05ORUNURUQ6Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKGlzVGVhcmRvd25SZXF1ZXN0ZWQoKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUVuYWJsZWQgPSBmYWxzZTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldFRlYXJkb3duUmVxdWVzdGVkKGZhbHNlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXREZXRhaWxlZFN0YXRlKERldGFpbGVkU3RhdGUuRElTQ09OTkVDVEVELCByZWFzb24sIGFwbk5hbWUpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2xlYW4gZG9SZXNldCA9IHRydWU7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1Jc0RlZmF1bHRPckhpcHJpID09IHRydWUpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gYm90aCBkZWZhdWx0IGFuZCBoaXByaSBtdXN0IGdvIGRvd24gYmVmb3JlIHdlIHJlc2V0CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCB0eXBlVG9DaGVjayA9IChQaG9uZS5BUE5fVFlQRV9ERUZBVUxULmVxdWFscyhtQXBuVHlwZSkgPworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ29ubmVjdGl2aXR5TWFuYWdlci5UWVBFX01PQklMRV9ISVBSSSA6CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDb25uZWN0aXZpdHlNYW5hZ2VyLlRZUEVfTU9CSUxFKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1Db25uZWN0aXZpdHlNYW5hZ2VyID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIElCaW5kZXIgYiA9IFNlcnZpY2VNYW5hZ2VyLmdldFNlcnZpY2UoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1Db250ZXh0LkNPTk5FQ1RJVklUWV9TRVJWSUNFKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1Db25uZWN0aXZpdHlNYW5hZ2VyID0gSUNvbm5lY3Rpdml0eU1hbmFnZXIuU3R1Yi5hc0ludGVyZmFjZShiKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldERldGFpbGVkU3RhdGUoRGV0YWlsZWRTdGF0ZS5ESVNDT05ORUNURUQsIHJlYXNvbiwgYXBuTmFtZSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2xlYW4gZG9SZXNldCA9IHRydWU7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtSXNEZWZhdWx0T3JIaXByaSA9PSB0cnVlKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBib3RoIGRlZmF1bHQgYW5kIGhpcHJpIG11c3QgZ28gZG93biBiZWZvcmUgd2UgcmVzZXQKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCB0eXBlVG9DaGVjayA9IChQaG9uZS5BUE5fVFlQRV9ERUZBVUxULmVxdWFscyhtQXBuVHlwZSkgPwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDb25uZWN0aXZpdHlNYW5hZ2VyLlRZUEVfTU9CSUxFX0hJUFJJIDoKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ29ubmVjdGl2aXR5TWFuYWdlci5UWVBFX01PQklMRSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobUNvbm5lY3Rpdml0eU1hbmFnZXIgPT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1Db25uZWN0aXZpdHlNYW5hZ2VyID0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChDb25uZWN0aXZpdHlNYW5hZ2VyKWNvbnRleHQuZ2V0U3lzdGVtU2VydmljZSgKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENvbnRleHQuQ09OTkVDVElWSVRZX1NFUlZJQ0UpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1Db25uZWN0aXZpdHlNYW5hZ2VyICE9IG51bGwpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBOZXR3b3JrSW5mbyBpbmZvID0gbUNvbm5lY3Rpdml0eU1hbmFnZXIuZ2V0TmV0d29ya0luZm8oCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZVRvQ2hlY2spOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpbmZvICE9IG51bGwgJiYgaW5mby5pc0Nvbm5lY3RlZCgpID09IHRydWUpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGVUb0NoZWNrKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaW5mby5pc0Nvbm5lY3RlZCgpID09IHRydWUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9SZXNldCA9IGZhbHNlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGp1c3QgZ28gYWhlYWQgd2l0aCB0aGUgcmVzZXQKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExvZy5lKFRBRywgIkV4Y2VwdGlvbiB0cnlpbmcgdG8gY29udGFjdCBDb25uU2VydmljZTogIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkb1Jlc2V0ICYmIG1JbnRlcmZhY2VOYW1lICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5ldHdvcmtVdGlscy5yZXNldENvbm5lY3Rpb25zKG1JbnRlcmZhY2VOYW1lKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBjYW4ndCBkbyB0aGlzIGhlcmUgLSBDb25uZWN0aXZpdHlTZXJ2aWNlIG5lZWRzIGl0IHRvIGNsZWFyIHN0dWZmCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGl0J3Mgb2sgdGhvdWdoIC0ganVzdCBsZWF2ZSBpdCB0byBiZSByZWZyZXNoZWQgbmV4dCB0aW1lCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHdlIGNvbm5lY3QuCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vaWYgKERCRykgTG9nLmQoVEFHLCAiY2xlYXJpbmcgbUludGVyZmFjZU5hbWUgZm9yICIrIG1BcG5UeXBlICsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gICAgICAgICIgYXMgaXQgRElTQ09OTkVDVEVEIik7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vbUludGVyZmFjZU5hbWUgPSBudWxsOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvL21EZWZhdWx0R2F0ZXdheUFkZHIgPSAwOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIENPTk5FQ1RJTkc6Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldERldGFpbGVkU3RhdGUoRGV0YWlsZWRTdGF0ZS5DT05ORUNUSU5HLCByZWFzb24sIGFwbk5hbWUpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFNVU1BFTkRFRDoKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0RGV0YWlsZWRTdGF0ZShEZXRhaWxlZFN0YXRlLlNVU1BFTkRFRCwgcmVhc29uLCBhcG5OYW1lKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBDT05ORUNURUQ6Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1JbnRlcmZhY2VOYW1lID0gaW50ZW50LmdldFN0cmluZ0V4dHJhKFBob25lLkRBVEFfSUZBQ0VfTkFNRV9LRVkpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobUludGVyZmFjZU5hbWUgPT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTG9nLmQoVEFHLCAiQ09OTkVDVEVEIGV2ZW50IGRpZCBub3Qgc3VwcGx5IGludGVyZmFjZSBuYW1lLiIpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldERldGFpbGVkU3RhdGUoRGV0YWlsZWRTdGF0ZS5DT05ORUNURUQsIHJlYXNvbiwgYXBuTmFtZSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZG9SZXNldCAmJiBtTmV0d29ya1Byb3BlcnRpZXMgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTdHJpbmcgaWZhY2UgPSBtTmV0d29ya1Byb3BlcnRpZXMuZ2V0SW50ZXJmYWNlTmFtZSgpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaWZhY2UgIT0gbnVsbCkgTmV0d29ya1V0aWxzLnJlc2V0Q29ubmVjdGlvbnMoaWZhY2UpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBUT0RPIC0gY2hlY2sgdGhpcworICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGNhbid0IGRvIHRoaXMgaGVyZSAtIENvbm5lY3Rpdml0eVNlcnZpY2UgbmVlZHMgaXQgdG8gY2xlYXIgc3R1ZmYKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBpdCdzIG9rIHRob3VnaCAtIGp1c3QgbGVhdmUgaXQgdG8gYmUgcmVmcmVzaGVkIG5leHQgdGltZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHdlIGNvbm5lY3QuCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy9pZiAoREJHKSBMb2cuZChUQUcsICJjbGVhcmluZyBtSW50ZXJmYWNlTmFtZSBmb3IgIisgbUFwblR5cGUgKworICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vICAgICAgICAiIGFzIGl0IERJU0NPTk5FQ1RFRCIpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vbUludGVyZmFjZU5hbWUgPSBudWxsOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vbURlZmF1bHRHYXRld2F5QWRkciA9IDA7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIENPTk5FQ1RJTkc6CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0RGV0YWlsZWRTdGF0ZShEZXRhaWxlZFN0YXRlLkNPTk5FQ1RJTkcsIHJlYXNvbiwgYXBuTmFtZSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFNVU1BFTkRFRDoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXREZXRhaWxlZFN0YXRlKERldGFpbGVkU3RhdGUuU1VTUEVOREVELCByZWFzb24sIGFwbk5hbWUpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBDT05ORUNURUQ6CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbU5ldHdvcmtQcm9wZXJ0aWVzID0gaW50ZW50LmdldFBhcmNlbGFibGVFeHRyYSgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBob25lLkRBVEFfTkVUV09SS19QUk9QRVJUSUVTX0tFWSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1OZXR3b3JrUHJvcGVydGllcyA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExvZy5kKFRBRywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiQ09OTkVDVEVEIGV2ZW50IGRpZCBub3Qgc3VwcGx5IG5ldHdvcmsgcHJvcGVydGllcy4iKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0RGV0YWlsZWRTdGF0ZShEZXRhaWxlZFN0YXRlLkNPTk5FQ1RFRCwgcmVhc29uLCBhcG5OYW1lKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoaW50ZW50LmdldEFjdGlvbigpLgotICAgICAgICAgICAgICAgICAgICAgICAgZXF1YWxzKFRlbGVwaG9ueUludGVudHMuQUNUSU9OX0RBVEFfQ09OTkVDVElPTl9GQUlMRUQpKSB7Ci0gICAgICAgICAgICAgICAgICAgIG1FbmFibGVkID0gZmFsc2U7Ci0gICAgICAgICAgICAgICAgICAgIFN0cmluZyByZWFzb24gPSBpbnRlbnQuZ2V0U3RyaW5nRXh0cmEoUGhvbmUuRkFJTFVSRV9SRUFTT05fS0VZKTsKLSAgICAgICAgICAgICAgICAgICAgU3RyaW5nIGFwbk5hbWUgPSBpbnRlbnQuZ2V0U3RyaW5nRXh0cmEoUGhvbmUuREFUQV9BUE5fS0VZKTsKLSAgICAgICAgICAgICAgICAgICAgaWYgKERCRykgTG9nLmQoVEFHLCAiUmVjZWl2ZWQgIiArIGludGVudC5nZXRBY3Rpb24oKSArICIgYnJvYWRjYXN0IiArCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVhc29uID09IG51bGwgPyAiIiA6ICIoIiArIHJlYXNvbiArICIpIik7Ci0gICAgICAgICAgICAgICAgICAgIHNldERldGFpbGVkU3RhdGUoRGV0YWlsZWRTdGF0ZS5GQUlMRUQsIHJlYXNvbiwgYXBuTmFtZSk7CiAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIFRlbGVwaG9ueU1hbmFnZXIgdG0gPSBUZWxlcGhvbnlNYW5hZ2VyLmdldERlZmF1bHQoKTsKLSAgICAgICAgICAgICAgICBzZXRSb2FtaW5nU3RhdHVzKHRtLmlzTmV0d29ya1JvYW1pbmcoKSk7Ci0gICAgICAgICAgICAgICAgc2V0U3VidHlwZSh0bS5nZXROZXR3b3JrVHlwZSgpLCB0bS5nZXROZXR3b3JrVHlwZU5hbWUoKSk7CisgICAgICAgICAgICB9IGVsc2UgaWYgKGludGVudC5nZXRBY3Rpb24oKS4KKyAgICAgICAgICAgICAgICAgICAgZXF1YWxzKFRlbGVwaG9ueUludGVudHMuQUNUSU9OX0RBVEFfQ09OTkVDVElPTl9GQUlMRUQpKSB7CisgICAgICAgICAgICAgICAgU3RyaW5nIGFwblR5cGUgPSBpbnRlbnQuZ2V0U3RyaW5nRXh0cmEoUGhvbmUuREFUQV9BUE5fVFlQRV9LRVkpOworICAgICAgICAgICAgICAgIGlmICghVGV4dFV0aWxzLmVxdWFscyhhcG5UeXBlLCBtQXBuVHlwZSkpIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBTdHJpbmcgcmVhc29uID0gaW50ZW50LmdldFN0cmluZ0V4dHJhKFBob25lLkZBSUxVUkVfUkVBU09OX0tFWSk7CisgICAgICAgICAgICAgICAgU3RyaW5nIGFwbk5hbWUgPSBpbnRlbnQuZ2V0U3RyaW5nRXh0cmEoUGhvbmUuREFUQV9BUE5fS0VZKTsKKyAgICAgICAgICAgICAgICBpZiAoREJHKSBMb2cuZChUQUcsIG1BcG5UeXBlICsgIlJlY2VpdmVkICIgKyBpbnRlbnQuZ2V0QWN0aW9uKCkgKworICAgICAgICAgICAgICAgICAgICAgICAgIiBicm9hZGNhc3QiICsgcmVhc29uID09IG51bGwgPyAiIiA6ICIoIiArIHJlYXNvbiArICIpIik7CisgICAgICAgICAgICAgIC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KLSAgICAgICAgICAgICAgICAvLyBBaXJwbGFuZU1vZGUgb3IgRS1DYWxsIG9yIHdoYXRldmVyLi4KLSAgICAgICAgICAgICAgICBpZiAobUFwblR5cGUgIT0gUGhvbmUuQVBOX1RZUEVfREVGQVVMVCkgewotICAgICAgICAgICAgICAgICAgICBtRW5hYmxlZCA9IGZhbHNlOwotICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICAgTG9nLmUoVEFHLCAiRXJyb3IgaW4gcmVjb25uZWN0IC0gdW5leHBlY3RlZCByZXNwb25zZS4iKTsKLSAgICAgICAgICAgICAgICBtRW5hYmxlZCA9IGZhbHNlOwogICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICB9Ci0gICAgICAgIHJldHVybiBtRW5hYmxlZDsKKyAgICAgICAgcmV0dXJuIHJldFZhbHVlOwogICAgIH0KIAogICAgIC8qKgpAQCAtNDg0LDI2ICs0OTksNiBAQAogICAgICAgICByZXR1cm4gLTE7CiAgICAgfQogCi0gICAgLyoqCi0gICAgICogRW5zdXJlIHRoYXQgYSBuZXR3b3JrIHJvdXRlIGV4aXN0cyB0byBkZWxpdmVyIHRyYWZmaWMgdG8gdGhlIHNwZWNpZmllZAotICAgICAqIGhvc3QgdmlhIHRoZSBtb2JpbGUgZGF0YSBuZXR3b3JrLgotICAgICAqIEBwYXJhbSBob3N0QWRkcmVzcyB0aGUgSVAgYWRkcmVzcyBvZiB0aGUgaG9zdCB0byB3aGljaCB0aGUgcm91dGUgaXMgZGVzaXJlZCwKLSAgICAgKiBpbiBuZXR3b3JrIGJ5dGUgb3JkZXIuCi0gICAgICogQHJldHVybiB7QGNvZGUgdHJ1ZX0gb24gc3VjY2Vzcywge0Bjb2RlIGZhbHNlfSBvbiBmYWlsdXJlCi0gICAgICovCi0gICAgQE92ZXJyaWRlCi0gICAgcHVibGljIGJvb2xlYW4gcmVxdWVzdFJv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ICAgICAgKi8KICAgICBwdWJsaWMgaW50IGdldFR5cGUoKSB7Ci0gICAgICAgIHJldHVybiBtTmV0d29ya1R5cGU7CisgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgeworICAgICAgICAgICAgcmV0dXJuIG1OZXR3b3JrVHlwZTsKKyAgICAgICAgfQogICAgIH0KIAogICAgIC8qKgpAQCAtMTUwLDEyICsxNTUsMTYgQEAKICAgICAgKiBAcmV0dXJuIHRoZSBuZXR3b3JrIHN1YnR5cGUKICAgICAgKi8KICAgICBwdWJsaWMgaW50IGdldFN1YnR5cGUoKSB7Ci0gICAgICAgIHJldHVybiBtU3VidHlwZTsKKyAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CisgICAgICAgICAgICByZXR1cm4gbVN1YnR5cGU7CisgICAgICAgIH0KICAgICB9CiAKICAgICB2b2lkIHNldFN1YnR5cGUoaW50IHN1YnR5cGUsIFN0cmluZyBzdWJ0eXBlTmFtZSkgewotICAgICAgICBtU3VidHlwZSA9IHN1YnR5cGU7Ci0gICAgICAgIG1TdWJ0eXBlTmFtZSA9IHN1YnR5cGVOYW1lOworICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKKyAgICAgICAgICAgIG1TdWJ0eXBlID0gc3VidHlwZTsKKyAgICAgICAgICAgIG1TdWJ0eXBlTmFtZSA9IHN1YnR5cGVOYW1lOworICAgICAgICB9CiAgICAgfQogCiAgICAgLyoqCkBAIC0xNjQsNyArMTczLDkgQEAKICAgICAgKiBAcmV0dXJuIHRoZSBuYW1lIG9mIHRoZSBuZXR3b3JrIHR5cGUKICAgICAgKi8KICAgICBwdWJsaWMgU3RyaW5nIGdldFR5cGVOYW1lKCkgewotICAgICAgICByZXR1cm4gbVR5cGVOYW1lOworICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKKyAgICAgICAgICAgIHJldHVybiBtVHlwZU5hbWU7CisgICAgICAgIH0KICAgICB9CiAKICAgICAvKioKQEAgLTE3Miw3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CisgICAgICAgIH0KICAgICB9CiAKICAgICAvKioKQEAgLTIxMCw3ICsyMjcsOSBAQAogICAgICAqIEByZXR1cm4ge0Bjb2RlIHRydWV9IGlmIHRoZSBuZXR3b3JrIGlzIGF2YWlsYWJsZSwge0Bjb2RlIGZhbHNlfSBvdGhlcndpc2UKICAgICAgKi8KICAgICBwdWJsaWMgYm9vbGVhbiBpc0F2YWlsYWJsZSgpIHsKLSAgICAgICAgcmV0dXJuIG1Jc0F2YWlsYWJsZTsKKyAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CisgICAgICAgICAgICByZXR1cm4gbUlzQXZhaWxhYmxlOworICAgICAgICB9CiAgICAgfQogCiAgICAgLyoqCkBAIC0yMjAsNyArMjM5LDkgQEAKICAgICAgKiBAaGlkZQogICAgICAqLwogICAgIHB1YmxpYyB2b2lkIHNldElzQXZhaWxhYmxlKGJvb2xlYW4gaXNBdmFpbGFibGUpIHsKLSAgICAgICAgbUlzQXZhaWxhYmxlID0gaXNBdmFpbGFibGU7CisgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgeworICAgICAgICAgICAgbUlzQXZhaWxhYmxlID0gaXNBdmFpbGFibGU7CisgICAgICAgIH0KICAgICB9CiAKICAgICAvKioKQEAgLTIzMSw3ICsyNTIsOSBAQAogICAgICAqIG90aGVyd2lzZS4KICAgICAgKi8KICAgICBwdWJsaWMgYm9vbGVhbiBpc0ZhaWxvdmVyKCkgewotICAgICAgICByZXR1cm4gbUlzRmFpbG92ZXI7CisgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgeworICAgICAgICAgICAgcmV0dXJuIG1Jc0ZhaWxvdmVyOworICAgICAgICB9CiAgICAgfQogCiAgICAgLyoqCkBAIC0yNDEsNyArMjY0LDkgQEAKICAgICAgKiBAaGlkZQogICAgICAqLwogICAgIHB1YmxpYyB2b2lkIHNldEZhaWxvdmVyKGJvb2xlYW4gaXNGYWlsb3ZlcikgewotICAgICAgICBtSXNGYWlsb3ZlciA9IGlzRmFpbG92ZXI7CisgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgeworICAgICAgICAgICAgbUlzRmFpbG92ZXIgPSBpc0ZhaWxvdmVyOworICAgICAgICB9CiAgICAgfQogCiAgICAgLyoqCkBAIC0yNTEsMTEgKzI3NiwxNSBAQAogICAgICAqIEByZXR1cm4ge0Bjb2RlIHRydWV9IGlmIHJvYW1pbmcgaXMgaW4gZWZmZWN0LCB7QGNvZGUgZmFsc2V9IG90aGVyd2lzZS4KICAgICAgKi8KICAgICBwdWJsaWMgYm9vbGVhbiBpc1JvYW1pbmcoKSB7Ci0gICAgICAgIHJldHVybiBtSXNSb2FtaW5nOworICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKKyAgICAgICAgICAgIHJldHVybiBtSXNSb2FtaW5nOworICAgICAgICB9CiAgICAgfQogCiAgICAgdm9pZCBzZXRSb2FtaW5nKGJvb2xlYW4gaXNSb2FtaW5nKSB7Ci0gICAgICAgIG1Jc1JvYW1pbmcgPSBpc1JvYW1pbmc7CisgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgeworICAgICAgICAgICAgbUlzUm9hbWluZyA9IGlzUm9hbWluZzsKKyAgICAgICAgfQogICAgIH0KIAogICAgIC8qKgpAQCAtMjYzLDcgKzI5Miw5IEBACiAgICAgICogQHJldHVybiB0aGUgY29hcnNlLWdyYWluZWQgc3RhdGUKICAgICAgKi8KICAgICBwdWJsaWMgU3RhdGUgZ2V0U3RhdGUoKSB7Ci0gICAgICAgIHJldHVybiBtU3RhdGU7CisgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgeworICAgICAgICAgICAgcmV0dXJuIG1TdGF0ZTsKKyAgICAgICAgfQogICAgIH0KIAogICAgIC8qKgpAQCAtMjcxLDcgKzMwMiw5IEBACiAgICAgICogQHJldHVybiB0aGUgZmluZS1ncmFpbmVkIHN0YXRlCiAgICAgICovCiAgICAgcHVibGljIERldGFpbGVkU3RhdGUgZ2V0RGV0YWlsZWR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IHRoaXMubVN0YXRlID0gc3RhdGVNYXAuZ2V0KGRldGFpbGVkU3RhdGUpOworICAgICAgICAgICAgdGhpcy5tUmVhc29uID0gcmVhc29uOworICAgICAgICAgICAgdGhpcy5tRXh0cmFJbmZvID0gZXh0cmFJbmZvOworICAgICAgICB9CiAgICAgfQogCiAgICAgLyoqCkBAIC0yOTUsNyArMzMxLDkgQEAKICAgICAgKiBAcmV0dXJuIHRoZSByZWFzb24gZm9yIGZhaWx1cmUsIG9yIG51bGwgaWYgbm90IGF2YWlsYWJsZQogICAgICAqLwogICAgIHB1YmxpYyBTdHJpbmcgZ2V0UmVhc29uKCkgewotICAgICAgICByZXR1cm4gbVJlYXNvbjsKKyAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CisgICAgICAgICAgICByZXR1cm4gbVJlYXNvbjsKKyAgICAgICAgfQogICAgIH0KIAogICAgIC8qKgpAQCAtMzA1LDIwICszNDMsMjQgQEAKICAgICAgKiBAcmV0dXJuIHRoZSBleHRyYSBpbmZvcm1hdGlvbiwgb3IgbnVsbCBpZiBub3QgYXZhaWxhYmxlCiAgICAgICovCiAgICAgcHVibGljIFN0cmluZyBnZXRFeHRyYUluZm8oKSB7Ci0gICAgICAgIHJldHVybiBtRXh0cmFJbmZvOworICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKKyAgICAgICAgICAgIHJldHVybiBtRXh0cmFJbmZvOworICAgICAgICB9CiAgICAgfQogCiAgICAgQE92ZXJyaWRlCiAgICAgcHVibGljIFN0cmluZyB0b1N0cmluZygpIHsKLSAgICAgICAgU3RyaW5nQnVpbGRlciBidWlsZGVyID0gbmV3IFN0cmluZ0J1aWxkZXIoIk5ldHdvcmtJbmZvOiAiKTsKLSAgICAgICAgYnVpbGRlci5hcHBlbmQoInR5cGU6ICIpLmFwcGVuZChnZXRUeXBlTmFtZSgpKS5hcHBlbmQoIlsiKS5hcHBlbmQoZ2V0U3VidHlwZU5hbWUoKSkuCi0gICAgICAgICAg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ud3JpdGVTdHJpbmcobVJlYXNvbik7Ci0gICAgICAgIGRlc3Qud3JpdGVTdHJpbmcobUV4dHJhSW5mbyk7CisgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgeworICAgICAgICAgICAgZGVzdC53cml0ZUludChtTmV0d29ya1R5cGUpOworICAgICAgICAgICAgZGVzdC53cml0ZUludChtU3VidHlwZSk7CisgICAgICAgICAgICBkZXN0LndyaXRlU3RyaW5nKG1UeXBlTmFtZSk7CisgICAgICAgICAgICBkZXN0LndyaXRlU3RyaW5nKG1TdWJ0eXBlTmFtZSk7CisgICAgICAgICAgICBkZXN0LndyaXRlU3RyaW5nKG1TdGF0ZS5uYW1lKCkpOworICAgICAgICAgICAgZGVzdC53cml0ZVN0cmluZyhtRGV0YWlsZWRTdGF0ZS5uYW1lKCkpOworICAgICAgICAgICAgZGVzdC53cml0ZUludChtSXNGYWlsb3ZlciA/IDEgOiAwKTsKKyAgICAgICAgICAgIGRlc3Qud3JpdGVJbnQobUlzQXZhaWxhYmxlID8gMSA6IDApOworICAgICAgICAgICAgZGVzdC53cml0ZUludChtSXNSb2FtaW5nID8gMSA6IDApOworICAgICAgICAgICAgZGVzdC53cml0ZVN0cmluZyhtUmVhc29uKTsKKyAgICAgICAgICAgIGRlc3Qud3JpdGVTdHJpbmcobUV4dHJhSW5mbyk7CisgICAgICAgIH0KICAgICB9CiAKICAgICAvKioKZGlmZiAtLWdpdCBhL2NvcmUvamF2YS9hbmRyb2lkL25ldC9OZXR3b3JrUHJvcGVydGllcy5haWRsIGIvY29yZS9qYXZhL2FuZHJvaWQvbmV0L05ldHdvcmtQcm9wZXJ0aWVzLmFpZGwKbmV3IGZpbGUgbW9kZSAxMDA2NDQKaW5kZXggMDAwMDAwMC4uMDdhYWM2ZQotLS0gL2Rldi9udWxsCisrKyBiL2NvcmUvamF2YS9hbmRyb2lkL25ldC9OZXR3b3JrUHJvcGVydGllcy5haWRsCkBAIC0wLDAgKzEsMjIgQEAKKy8qCisqKgorK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IHB1YmxpYyBzeW5jaHJvbml6ZWQgdm9pZCBzZXRJbnRlcmZhY2UoTmV0d29ya0ludGVyZmFjZSBpZmFjZSkgeworICAgICAgICBtSWZhY2UgPSBpZmFjZTsKKyAgICB9CisgICAgcHVibGljIHN5bmNocm9uaXplZCBOZXR3b3JrSW50ZXJmYWNlIGdldEludGVyZmFjZSgpIHsKKyAgICAgICAgcmV0dXJuIG1JZmFjZTsKKyAgICB9CisgICAgcHVibGljIHN5bmNocm9uaXplZCBTdHJpbmcgZ2V0SW50ZXJmYWNlTmFtZSgpIHsKKyAgICAgICAgcmV0dXJuIChtSWZhY2UgPT0gbnVsbCA/IG51bGwgOiBtSWZhY2UuZ2V0TmFtZSgpKTsKKyAgICB9CisKKyAgICBwdWJsaWMgc3luY2hyb25pemVkIHZvaWQgYWRkQWRkcmVzcyhJbmV0QWRkcmVzcyBhZGRyZXNzKSB7CisgICAgICAgIG1BZGRyZXNzZXMuYWRkKGFkZHJlc3MpOworICAgIH0KKyAgICBwdWJsaWMgc3luY2hyb25pemVkIENvbGxlY3Rpb248SW5ldEFkZHJlc3M+IGdldEFkZHJlc3NlcygpIHsKKyAgICAgICAgcmV0dXJuIG1BZGRyZXNzZXM7CisgICAgfQorCisgICAgcHVibGljIHN5bmNocm9uaXplZCB2b2lkIGFkZERucyhJbmV0QWRkcmVzcyBkbnMpIHsKKyAgICAgICAgbURuc2VzLmFkZChkbnMpOworICAgIH0KKyAgICBwdWJsaWMgc3luY2hyb25pemVkIENvbGxlY3Rpb248SW5ldEFkZHJlc3M+IGdldERuc2VzKCkgeworICAgICAgICByZXR1cm4gbURuc2VzOworICAgIH0KKworICAgIHB1YmxpYyBzeW5jaHJvbml6ZWQgdm9pZCBzZXRHYXRld2F5KEluZXRBZGRyZXNzIGdhdGV3YXkpIHsKKyAgICAgICAgbUdhdGV3YXkgPSBnYXRld2F5OworICAgIH0KKyAgICBwdWJsaWMgc3luY2hyb25pemVkIEluZXRBZGRyZXNzIGdldEdhdGV3YXkoKSB7CisgICAgICAgIHJldHVybiBtR2F0ZXdheTsKKyAgICB9CisKKyAgICBwdWJsaWMgc3luY2hyb25pemVkIHZvaWQgc2V0SHR0cFByb3h5KFByb3h5UHJvcGVydGllcyBwcm94eSkgeworICAgICAgICBtSHR0cFByb3h5ID0gcHJveHk7CisgICAgfQorICAgIHB1YmxpYyBzeW5jaHJvbml6ZWQgUHJveHlQcm9wZXJ0aWVzIGdldEh0dHBQcm94eSgpIHsKKyAgICAgICAgcmV0dXJuIG1IdHRwUHJveHk7CisgICAgfQorCisgICAgcHVibGljIHN5bmNocm9uaXplZCB2b2lkIGNsZWFyKCkgeworICAgICAgICBtSWZhY2UgPSBudWxsOworICAgICAgICBtQWRkcmVzc2VzID0gbmV3IEFycmF5TGlzdDxJbmV0QWRkcmVzcz4oKTsKKyAgICAgICAgbURuc2VzID0gbmV3IEFycmF5TGlzdDxJbmV0QWRkcmVzcz4oKTsKKyAgICAgICAgbUdhdGV3YXkgPSBudWxsOworICAgICAgICBtSHR0cFByb3h5ID0gbnVsbDsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBJbXBsZW1lbnQgdGhlIFBhcmNlbGFibGUgaW50ZXJmYWNlCisgICAgICogQGhpZGUKKyAgICAgKi8KKyAgICBwdWJsaWMgaW50IGRlc2NyaWJlQ29udGVudHMoKSB7CisgICAgICAgIHJldHVybiAwOworICAgIH0KKworICAgIHB1YmxpYyBzeW5jaHJvbml6ZWQgU3RyaW5nIHRvU3RyaW5nKCkgeworICAgICAgICBTdHJpbmcgaWZhY2VOYW1lID0gKG1JZmFjZSA9PSBudWxsID8gIiIgOiAiSW50ZXJmYWNlTmFtZTogIiArIG1JZmFjZS5nZXROYW1lKCkgKyAiICIpOworCisgICAgICAgIFN0cmluZyBpcCA9ICJJcEFkZHJlc3NlczogWyI7CisgICAgICAgIGZvciAoSW5ldEFkZHJlc3MgYWRkciA6IG1BZGRyZXNzZXMpIGlwICs9ICBhZGRyLnRvU3RyaW5nKCkgKyAiLCI7CisgICAgICAgIGlwICs9ICJdICI7CisKKyAgICAgICAgU3RyaW5nIGRucyA9ICJEbnNBZGRyZXNzZXM6IFsiOworICAgICAgICBmb3IgKEluZXRBZGRyZXNzIGFkZHIgOiBtRG5zZXMpIGRucyArPSBhZGRyLnRvU3RyaW5nKCkgKyAiLCI7CisgICAgICAgIGRucyArPSAiXSAiOworCisgICAgICAgIFN0cmluZyBwcm94eSA9IChtSHR0cFByb3h5ID09IG51bGwgPyAiIiA6ICJIdHRwUHJveHk6ICIgKyBtSHR0cFByb3h5LnRvU3RyaW5nKCkgKyAiICIpOworICAgICAgICBTdHJpbmcgZ2F0ZXdheSA9IChtR2F0ZXdheSA9PSBudWxsID8gIiIgOiAiR2F0ZXdheTogIiArIG1HYXRld2F5LnRvU3RyaW5nKCkgKyAiICIpOworCisgICAgICAgIHJldHVybiBpZmFjZU5hbWUgKyBpcCArIGdhdGV3YXkgKyBkbnMgKyBwcm94eTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBJbXBsZW1lbnQgdGhlIFBhcmNlbGFibGUgaW50ZXJmYWNlLgorICAgICAqIEBoaWRlCisgICAgICovCisgICAgcHVibGljIHN5bmNocm9uaXplZCB2b2lkIHdyaXRlVG9QYXJjZWwoUGFyY2VsIGRlc3QsIGludCBmbGFncykgeworICAgICAgICBkZXN0LndyaXRlU3RyaW5nKGdldEludGVyZmFjZU5hbWUoKSk7CisgICAgICAgIGRlc3Qud3JpdGVJbnQobUFkZHJlc3Nlcy5zaXplKCkpOworICAgICAgICAvL1RPRE86IGV4cGxvcmUgYW4gZWFzeSBhbHRlcm5hdGl2ZSB0byBwcmVzZXJ2ZSBob3N0bmFtZQorICAgICAgICAvLyB3aXRob3V0IGRvaW5nIGEgbG9va3VwCisgICAgICAgIGZvcihJbmV0QWRkcmVzcyBhIDogbUFkZHJlc3NlcykgeworICAgICAgICAgICAgZGVzdC53cml0ZUJ5dGVBcnJheShhLmdldEFkZHJlc3MoKSk7CisgICAgICAgIH0KKyAgICAgICAgZGVzdC53cml0ZUludChtRG5zZXMuc2l6ZSgpKTsKKyAgICAgICAgZm9yKEluZXRBZGRyZXNzIGQgOiBtRG5zZXMpIHsKKyAgICAgICAgICAgIGRlc3Qud3JpdGVCeXRlQXJyYXkoZC5nZXRBZGRyZXNzKCkpOworICAgICAgICB9CisgICAgICAgIGlmIChtR2F0ZXdheSAhPSBudWxsKSB7CisgICAgICAgICAgICBkZXN0LndyaXRlQnl0ZSgoYnl0ZSkxKTsKKyAgICAgICAgICAgIGRlc3Qud3JpdGVCeXRlQXJyYXkobUdhdGV3YXkuZ2V0QWRkcmVzcygpKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIGRlc3Qud3JpdGVCeXRlKChieXRlKTApOworICAgICAgICB9CisgICAgICAgIGlmIChtSHR0cFByb3h5ICE9IG51bGwpIHsKKyAgICAgICAgICAgIGRlc3Qud3JpdGVCeXRlKChieXRlKTEpOworICAgICAgICAgICAgZGVzdC53cml0ZVBhcmNlbGFibGUobUh0dHBQcm94eSwgZmxhZ3MpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgZGVzdC53cml0ZUJ5dGUoKGJ5dGUpMCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBJbXBsZW1lbnQgdGhlIFBhcmNlbGFibGUgaW50ZXJmYWNlLgorICAgICAqIEBoaWRlCisgICAgICovCisgICAgcHVibGljIHN0YXRpYyBmaW5hbCBDcmVhdG9yPE5ldHdvcmtQcm9wZXJ0aWVzPiBDUkVBVE9SID0KKyAgICAgICAgbmV3IENyZWF0b3I8TmV0d29ya1Byb3BlcnRpZXM+KCkgeworICAgICAgICAgICAgcHVibGljIE5ldHdvcmtQcm9wZXJ0aWVzIGNyZWF0ZUZyb21QYXJjZWwoUGFyY2VsIGluKSB7CisgICAgICAgICAgICAgICAgTmV0d29ya1Byb3BlcnRpZXMgbmV0UHJvcCA9IG5ldyBOZXR3b3JrUHJvcGVydGllcygpOworICAgICAgICAgICAgICAgIFN0cmluZyBpZmFjZSA9IGluLnJlYWRTdHJpbmcoKTsKKyAgICAgICAgICAgICAgICBpZiAoaWZhY2UgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgICAgICAgICAgbmV0UHJvcC5zZXRJbnRlcmZhY2UoTmV0d29ya0ludGVyZmFjZS5nZXRCeU5hbWUoaWZhY2UpKTsKKyAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGludCBhZGRyZXNzQ291bnQgPSBpbi5yZWFkSW50KCk7CisgICAgICAgICAgICAgICAgZm9yIChpbnQgaT0wOyBpPGFkZHJlc3NDb3VudDsgaSsrKSB7CisgICAgICAgICAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgICAgICAgICBuZXRQcm9wLmFkZEFkZHJlc3MoSW5ldEFkZHJlc3MuZ2V0QnlBZGRyZXNzKGluLmNyZWF0ZUJ5dGVBcnJheSgpKSk7CisgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKFVua25vd25Ib3N0RXhjZXB0aW9uIGUpIHsgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBhZGRyZXNzQ291bnQgPSBpbi5yZWFkSW50KCk7CisgICAgICAgICAgICAgICAgZm9yIChpbnQgaT0wOyBpPGFkZHJlc3NDb3VudDsgaSsrKSB7CisgICAgICAgICAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgICAgICAgICBuZXRQcm9wLmFkZERucyhJbmV0QWRkcmVzcy5nZXRCeUFkZHJlc3MoaW4uY3JlYXRlQnl0ZUFycmF5KCkpKTsKKyAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoVW5rbm93bkhvc3RFeGNlcHRpb24gZSkgeyB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGlmIChpbi5yZWFkQnl0ZSgpID09IDEpIHsKKyAgICAgICAgICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICAgICAgICAgIG5ldFByb3Auc2V0R2F0ZXdheShJbmV0QWRkcmVzcy5nZXRCeUFkZHJlc3MoaW4uY3JlYXRlQnl0ZUFycmF5KCkpKTsKKyAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoVW5rbm93bkhvc3RFeGNlcHRpb24gZSkge30KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaWYgKGluLnJlYWRCeXRlKCkgPT0gMSkgeworICAgICAgICAgICAgICAgICAgICBuZXRQcm9wLnNldEh0dHBQcm94eSgoUHJveHlQcm9wZXJ0aWVzKWluLnJlYWRQYXJjZWxhYmxlKG51bGwpKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgcmV0dXJuIG5ldFByb3A7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHB1YmxpYyBOZXR3b3JrUHJvcGVydGllc1tdIG5ld0FycmF5KGludCBzaXplKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBOZXR3b3JrUHJvcGVydGllc1tzaXplXTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfTsKK30KZGlmZiAtLWdpdCBhL2NvcmUvamF2YS9hbmRyb2lkL25ldC9OZXR3b3JrU3RhdGVUcmFja2VyLmphdmEgYi9jb3JlL2phdmEvYW5kcm9pZC9uZXQvTmV0d29ya1N0YXRlVHJhY2tlci5qYXZhCmluZGV4IDAyNzdkMmQuLjAwNDhhMmUgMTAwNjQ0Ci0tLSBhL2NvcmUvamF2YS9hbmRyb2lkL25ldC9OZXR3b3JrU3RhdGVUcmFja2VyLmphdmEKKysrIGIvY29yZS9qYXZhL2FuZHJvaWQvbmV0L05ldHdvcmtTdGF0ZVRyY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SBHU00gbGF5ZXIgc29tZXRpbWVzIHNldHMgYSBib2d1cyBETlMgc2VydmVyIGFkZHJlc3Mgb2YKLSAgICAgICAgICAgIC8vIDAuMC4wLjAKLSAgICAgICAgICAgIGlmICghVGV4dFV0aWxzLmlzRW1wdHkodmFsdWUpICYmICFUZXh0VXRpbHMuZXF1YWxzKHZhbHVlLCAiMC4wLjAuMCIpKSB7Ci0gICAgICAgICAgICAgICAgZG5zQWRkcmVzc2VzW2orK10gPSB2YWx1ZTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgICAgICByZXR1cm4gZG5zQWRkcmVzc2VzOwotICAgIH0KLQotICAgIHB1YmxpYyB2b2lkIGFkZFByaXZhdGVEbnNSb3V0ZXMoKSB7Ci0gICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgIExvZy5kKFRBRywgImFkZFByaXZhdGVEbnNSb3V0ZXMgZm9yICIgKyB0aGlzICsKLSAgICAgICAgICAgICAgICAgICAgIigiICsgbUludGVyZmFjZU5hbWUgKyAiKSAtIG1Qcml2YXRlRG5zUm91dGVTZXQgPSAiK21Qcml2YXRlRG5zUm91dGVTZXQpOwotICAgICAgICB9Ci0gICAgICAgIGlmIChtSW50ZXJmYWNlTmFtZSAhPSBudWxsICYmICFtUHJpdmF0ZURuc1JvdXRlU2V0KSB7Ci0gICAgICAgICAgICBmb3IgKFN0cmluZyBhZGRyU3RyaW5nIDogZ2V0TmFtZVNlcnZlcnMoKSkgewotICAgICAgICAgICAgICAgIGludCBhZGRyID0gTmV0d29ya1V0aWxzLmxvb2t1cEhvc3QoYWRkclN0cmluZyk7Ci0gICAgICAgICAgICAgICAgaWYgKGFkZHIgIT0gLTEgJiYgYWRkciAhPSAwKSB7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChEQkcpIExvZy5kKFRBRywgIiAgYWRkaW5nICIrYWRkclN0cmluZysiICgiK2FkZHIrIikiKTsKLSAgICAgICAgICAgICAgICAgICAgTmV0d29ya1V0aWxzLmFkZEhvc3RSb3V0ZShtSW50ZXJmYWNlTmFtZSwgYWRkcik7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICAgICAgbVByaXZhdGVEbnNSb3V0ZVNldCA9IHRydWU7Ci0gICAgICAgIH0KLSAgICB9Ci0KLSAgICBwdWJsaWMgdm9pZCByZW1vdmVQcml2YXRlRG5zUm91dGVzKCkgewotICAgICAgICAvLyBUT0RPIC0gd2Ugc2hvdWxkIGRvIHRoaXMgZXhwbGljaXRseSBidXQgdGhlIE5ldFV0aWxzIGFwaSBkb2VzbnQKLSAgICAgICAgLy8gc3VwcG9ydCB0aGlzIHlldCAtIG11c3QgcmVtb3ZlIGFsbC4gIE5vIHdvcnNlIHRoYW4gYmVmb3JlCi0gICAgICAgIGlmIChtSW50ZXJmYWNlTmFtZSAhPSBudWxsICYmIG1Qcml2YXRlRG5zUm91dGVTZXQpIHsKLSAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICBMb2cuZChUQUcsICJyZW1vdmVQcml2YXRlRG5zUm91dGVzIGZvciAiICsgbU5ldHdvcmtJbmZvLmdldFR5cGVOYW1lKCkgKwotICAgICAgICAgICAgICAgICAgICAgICAgIiAoIiArIG1JbnRlcmZhY2VOYW1lICsgIikiKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIE5ldHdvcmtVdGlscy5yZW1vdmVIb3N0Um91dGVzKG1JbnRlcmZhY2VOYW1lKTsKLSAgICAgICAgICAgIG1Qcml2YXRlRG5zUm91dGVTZXQgPSBmYWxzZTsKLSAgICAgICAgfQotICAgIH0KLQotICAgIHB1YmxpYyB2b2lkIGFkZERlZmF1bHRSb3V0ZSgpIHsKLSAgICAgICAgaWYgKChtSW50ZXJmYWNlTmFtZSAhPSBudWxsKSAmJiAobURlZmF1bHRHYXRld2F5QWRkciAhPSAwKSkgewotICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgIExvZy5kKFRBRywgImFk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3BlcmF0aW9uLgotICAgICAqLwotICAgIHB1YmxpYyB2b2lkIHJlbGVhc2VXYWtlTG9jaygpIHsKLSAgICB9Ci0KLSAgICAvKioKLSAgICAgKiBXcml0ZXMgVENQIGJ1ZmZlciBzaXplcyB0byAvc3lzL2tlcm5lbC9pcHY0L3RjcF9bci93XW1lbV9bbWluL2RlZi9tYXhdCi0gICAgICogd2hpY2ggbWFwcyB0byAvcHJvYy9zeXMvbmV0L2lwdjQvdGNwX3JtZW0gYW5kIHRjcHdtZW0KLSAgICAgKiAKLSAgICAgKiBAcGFyYW0gYnVmZmVyU2l6ZXMgaW4gdGhlIGZvcm1hdCBvZiAicmVhZE1pbiwgcmVhZEluaXRpYWwsIHJlYWRNYXgsCi0gICAgICogICAgICAgIHdyaXRlTWluLCB3cml0ZUluaXRpYWwsIHdyaXRlTWF4IgotICAgICAqLwotICAgIHByaXZhdGUgdm9pZCBzZXRCdWZmZXJTaXplKFN0cmluZyBidWZmZXJTaXplcykgewotICAgICAgICB0cnkgewotICAgICAgICAgICAgU3RyaW5nW10gdmFsdWVzID0gYnVmZmVyU2l6ZXMuc3BsaXQoIiwiKTsKLQotICAgICAgICAgICAgaWYgKHZhbHVlcy5sZW5ndGggPT0gNikgewotICAgICAgICAgICAgICBmaW5hbCBTdHJpbmcgcHJlZml4ID0gIi9zeXMva2VybmVsL2lwdjQvdGNwXyI7Ci0gICAgICAgICAgICAgICAgc3RyaW5nVG9GaWxlKHByZWZpeCArICJybWVtX21pbiIsIHZhbHVlc1swXSk7Ci0gICAgICAgICAgICAgICAgc3RyaW5nVG9GaWxlKHByZWZpeCArICJybWVtX2RlZiIsIHZhbHVlc1sxXSk7Ci0gICAgICAgICAgICAgICAgc3RyaW5nVG9GaWxlKHByZWZpeCArICJybWVtX21heCIsIHZhbHVlc1syXSk7Ci0gICAgICAgICAgICAgICAgc3RyaW5nVG9GaWxlKHByZWZpeCArICJ3bWVtX21pbiIsIHZhbHVlc1szXSk7Ci0gICAgICAgICAg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GV4dHJhSW5mbykgewotICAgICAgICBpZiAoREJHKSBMb2cuZChUQUcsICJzZXREZXRhaWxlZCBzdGF0ZSwgb2xkID0iK21OZXR3b3JrSW5mby5nZXREZXRhaWxlZFN0YXRlKCkrIiBhbmQgbmV3IHN0YXRlPSIrc3RhdGUpOwotICAgICAgICBpZiAoc3RhdGUgIT0gbU5ldHdvcmtJbmZvLmdldERldGFpbGVkU3RhdGUoKSkgewotICAgICAgICAgICAgYm9vbGVhbiB3YXNDb25uZWN0aW5nID0gKG1OZXR3b3JrSW5mby5nZXRTdGF0ZSgpID09IE5ldHdvcmtJbmZvLlN0YXRlLkNPTk5FQ1RJTkcpOwotICAgICAgICAgICAgU3RyaW5nIGxhc3RSZWFzb24gPSBtTmV0d29ya0luZm8uZ2V0UmVhc29uKCk7Ci0gICAgICAgICAgICAvKgotICAgICAgICAgICAgICogSWYgYSByZWFzb24gd2FzIHN1cHBsaWVkIHdoZW4gdGhlIENPTk5FQ1RJTkcgc3RhdGUgd2FzIGVudGVyZWQsIGFuZCBubwotICAgICAgICAgICAgICogcmVhc29uIHdhcyBzdXBwbGllZCBmb3IgZW50ZXJpbmcgdGhlIENPTk5FQ1RFRCBzdGF0ZSwgdGhlbiByZXRhaW4gdGhlCi0gICAgICAgICAgICAgKiByZWFzb24gdGhhdCB3YXMgc3VwcGxpZWQgd2hlbiBnb2luZyB0byBDT05ORUNUSU5HLgotICAgICAgICAgICAgICovCi0gICAgICAgICAgICBpZiAod2FzQ29ubmVjdGluZyAmJiBzdGF0ZSA9PSBOZXR3b3JrSW5mby5EZXRhaWxlZFN0YXRlLkNPTk5FQ1RFRCAmJiByZWFzb24gPT0gbnVsbAotICAgICAgICAgICAgICAgICAgICAmJiBsYXN0UmVhc29uICE9IG51bGwpCi0gICAgICAgICAgICAgICAgcmVhc29uID0gbGFzdFJlYXNvbjsKLSAgICAgICAgICAgIG1OZXR3b3JrSW5mby5zZXREZXRhaWxlZFN0YXRlKHN0YXRlLCByZWFzb24sI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EFkZHJlc3Mgc2NoZW1lLiAgVGhleSBzaG91bGQgZ28gYXdheSB3aGVuIHdlIGdvIGZ1bGx5IHRvIEluZXRBZGRyZXNzCisgICAgLy8gVE9ETyAtIHJlbW92ZSB3aGVuIHdlIHN3aXRjaCBmdWxseSB0byBJbmV0QWRkcmVzcworICAgIHB1YmxpYyBzdGF0aWMgYnl0ZVtdIHY0SW50VG9BcnJheShpbnQgYWRkcikgeworICAgICAgICBieXRlW10gYWRkckJ5dGVzID0gbmV3IGJ5dGVbNF07CisgICAgICAgIGFkZHJCeXRlc1swXSA9IChieXRlKShhZGRyICYgMHhmZik7CisgICAgICAgIGFkZHJCeXRlc1sxXSA9IChieXRlKSgoYWRkciA+PiA4KSAmIDB4ZmYpOworICAgICAgICBhZGRyQnl0ZXNbMl0gPSAoYnl0ZSkoKGFkZHIgPj4gMTYpICYgMHhmZik7CisgICAgICAgIGFkZHJCeXRlc1szXSA9IChieXRlKSgoYWRkciA+PiAyNCkgJiAweGZmKTsKKyAgICAgICAgcmV0dXJuIGFkZHJCeXRlczsKKyAgICB9CisKKyAgICBwdWJsaWMgc3RhdGljIGludCB2NFN0cmluZ1RvSW50KFN0cmluZyBzdHIpIHsKKyAgICAgICAgaW50IHJlc3VsdCA9IDA7CisgICAgICAgIFN0cmluZ1tdIGFycmF5ID0gc3RyLnNwbGl0KCJcXC4iKTsKKyAgICAgICAgaWYgKGFycmF5Lmxlbmd0aCAhPSA0KSByZXR1cm4gMDsKICAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgIGluZXRBZGRyZXNzID0gSW5ldEFkZHJlc3MuZ2V0QnlOYW1lKGhvc3RuYW1lKTsKLSAgICAgICAgfSBjYXRjaCAoVW5rbm93bkhvc3RFeGNlcHRpb24gZSkgewotICAgICAgICAgICAgcmV0dXJuIC0xOworICAgICAgICAgICAgcmVzdWx0ID0gSW50ZWdlci5wYXJzZUludChhcnJheVszXSk7CisgICAgICAgICAgICByZXN1bHQgPSAocmVzdWx0IDw8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ugd2lzaCB0byBtYXRjaAorICAgICAgICAvLyBodHRwOi8vYW5kcm9pZC5jb20gYXMgd2VsbCBhcyBodHRwOi8veHh4LmFuZHJvaWQuY29tICwgYnV0IG5vdAorICAgICAgICAvLyBodHRwOi8vbXlhbmRyb2lkLmNvbSAuIFRoaXMgY29kZSB3b3JrcyBvdXQgdGhlIGxvZ2ljLgorICAgICAgICBmb3IgKFN0cmluZyBleGNsdWRlZERvbWFpbiA6IGV4Y2x1c2lvbkxpc3QpIHsKKyAgICAgICAgICAgIFN0cmluZyBkb3REb21haW4gPSAiLiIgKyBleGNsdWRlZERvbWFpbjsKKyAgICAgICAgICAgIGlmICh1cmxEb21haW4uZXF1YWxzKGV4Y2x1ZGVkRG9tYWluKSkgeworICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKHVybERvbWFpbi5lbmRzV2l0aChkb3REb21haW4pKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgLy8gTm8gbWF0Y2gKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIHByaXZhdGUgc3RhdGljIFN0cmluZyBwYXJzZUhvc3QoU3RyaW5nIHByb3h5U3BlYykgeworICAgICAgICBpbnQgaSA9IHByb3h5U3BlYy5pbmRleE9mKCc6Jyk7CisgICAgICAgIGlmIChpID09IC0xKSB7CisgICAgICAgICAgICBpZiAoREVCVUcpIHsKKyAgICAgICAgICAgICAgICBBc3NlcnQuYXNzZXJ0VHJ1ZShwcm94eVNwZWMubGVuZ3RoKCkgPT0gMCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gbnVsbDsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gcHJveHlTcGVjLnN1YnN0cmluZygwLCBpKTsKKyAgICB9CisKKyAgICBwcml2YXRlIHN0YXRpYyBpbnQgcGFyc2VQb3J0KFN0cmluZyBwcm94eVNwZWMpIHsKKyAgICAgICAgaW50IGkgPSBwcm94eVNwZWMuaW5kZXhPZignOicpOworICAgICAgICBpZiAoaSA9PSAtMSkgeworICAgICAgICAgICAgaWYgKERFQlVHKSB7CisgICAgICAgICAgICAgICAgQXNzZXJ0LmFzc2VydFRydWUocHJveHlTcGVjLmxlbmd0aCgpID09IDApOworICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuIC0xOworICAgICAgICB9CisgICAgICAgIGlmIChERUJVRykgeworICAgICAgICAgICAgQXNzZXJ0LmFzc2VydFRydWUoaSA8IHByb3h5U3BlYy5sZW5ndGgoKSk7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIEludGVnZXIucGFyc2VJbnQocHJveHlTcGVjLnN1YnN0cmluZyhpKzEpKTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBSZXR1cm4gdGhlIHByb3h5IG9iamVjdCB0byBiZSB1c2VkIGZvciB0aGUgVVJMIGdpdmVuIGFzIHBhcmFtZXRlci4KKyAgICAgKiBAcGFyYW0gY3R4IEEgQ29udGV4dCB1c2VkIHRvIGdldCB0aGUgc2V0dGluZ3MgZm9yIHRoZSBwcm94eSBob3N0LgorICAgICAqIEBwYXJhbSB1cmwgQSBVUkwgdG8gYmUgYWNjZXNzZWQuIFVzZWQgdG8gZXZhbHVhdGUgZXhjbHVzaW9uIGxpc3QuCisgICAgICogQHJldHVybiBQcm94eSAoamF2YS5uZXQpIG9iamVjdCBjb250YWluaW5nIHRoZSBob3N0IG5hbWUuIElmIHRoZQorICAgICAqICAgICAgICAgdXNlciBkaWQgbm90IHNldCBhIGhvc3RuYW1lIGl0IHJldHVybnMgdGhlIGRlZmF1bHQgaG9zdC4KKyAgICAgKiAgICAgICAgIEEgbnVsbCB2YWx1ZSBtZWFucyB0aGF0IG5vIGhvc3QgaXMgdG8gYmUgdXNlZC4KKyAgICAgKiB7QGhpZGV9CisgICAgICovCisgICAgcHVibGljIHN0YXRpYyBmaW5hbCBqYXZhLm5ldC5Qcm94eSBnZXRQcm94eShDb250ZXh0IGN0eCwgU3RyaW5nIHVybCkgeworICAgICAgICBzUHJveHlJbmZvTG9jay5yZWFkTG9jaygpLmxvY2soKTsKKyAgICAgICAgamF2YS5uZXQuUHJveHkgcmV0dmFsOworICAgICAgICB0cnkgeworICAgICAgICAgICAgaWYgKHNHbG9iYWxQcm94eUNoYW5nZWRPYnNlcnZlciA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgcmVnaXN0ZXJDb250ZW50T2JzZXJ2ZXJzUmVhZExvY2tlZChjdHgpOworICAgICAgICAgICAgICAgIHBhcnNlR2xvYmFsUHJveHlJbmZvUmVhZExvY2tlZChjdHgpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKHNHbG9iYWxQcm94eVNwZWMgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIC8vIFByb3h5IGRlZmluZWQgLSBBcHBseSBleGNsdXNpb24gcnVsZXMKKyAgICAgICAgICAgICAgICBpZiAoaXNVUkxJbkV4Y2x1c2lvbkxpc3RSZWFkTG9ja2VkKHVybCwgc0dsb2JhbFByb3h5U3BlYy5leGNsdXNpb25MaXN0KSkgeworICAgICAgICAgICAgICAgICAgICAvLyBSZXR1cm4gbm8gcHJveHkKKyAgICAgICAgICAgICAgICAgICAgcmV0dmFsID0gamF2YS5uZXQuUHJveHkuTk9fUFJPWFk7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0dmFsID0KKyAgICAgICAgICAgICAgICAgICAgICAgIG5ldyBqYXZhLm5ldC5Qcm94eShqYXZhLm5ldC5Qcm94eS5UeXBlLkhUVFAsIHNHbG9iYWxQcm94eVNwZWMucHJveHlBZGRyZXNzKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIC8vIElmIG5ldHdvcmsgaXMgV2lGaSwgcmV0dXJuIG5vIHByb3h5LgorICAgICAgICAgICAgICAgIC8vIE90aGVyd2lzZSwgcmV0dXJuIHRoZSBNb2JpbGUgT3BlcmF0b3IgcHJveHkuCisgICAgICAgICAgICAgICAgaWYgKCFpc05ldHdvcmtXaWZpKGN0eCkpIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0dmFsID0gZ2V0RGVmYXVsdFByb3h5KHVybCk7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0dmFsID0gamF2YS5uZXQuUHJveHkuTk9fUFJPWFk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9IGZpbmFsbHkgeworICAgICAgICAgICAgc1Byb3h5SW5mb0xvY2sucmVhZExvY2soKS51bmxvY2soKTsKKyAgICAgICAgfQorICAgICAgICBpZiAoKHJldHZhbCAhPSBqYXZhLm5ldC5Qcm94eS5OT19QUk9YWSkgJiYgKGlzTG9jYWxIb3N0KHVybCkpKSB7CisgICAgICAgICAgICByZXR2YWwgPSBqYXZhLm5ldC5Qcm94eS5OT19QUk9YWTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gcmV0dmFsOworICAgIH0KKworICAgIC8vIFRPRE86IGRlcHJlY2F0ZSB0aGlzIGZ1bmN0aW9uCiAgICAgLyoqCiAgICAgICogUmV0dXJuIHRoZSBwcm94eSBob3N0IHNldCBieSB0aGUgdXNlci4KICAgICAgKiBAcGFyYW0gY3R4IEEgQ29udGV4dCB1c2VkIHRvIGdldCB0aGUgc2V0dGluZ3MgZm9yIHRoZSBwcm94eSBob3N0LgpAQCAtNDksNjAgKzE3OSw1NSBAQAogICAgICAqICAgICAgICAgbmFtZSBpdCByZXR1cm5zIHRoZSBkZWZhdWx0IGhvc3QuIEEgbnVsbCB2YWx1ZSBtZWFucyB0aGF0IG5vCiAgICAgICogICAgICAgICBob3N0IGlzIHRvIGJlIHVzZWQuCiAgICAgICovCi0gICAgc3RhdGljIGZpbmFsIHB1YmxpYyBTdHJpbmcgZ2V0SG9zdChDb250ZXh0IGN0eCkgewotICAgICAgICBDb250ZW50UmVzb2x2ZXIgY29udGVudFJlc29sdmVyID0gY3R4LmdldENvbnRlbnRSZXNvbHZlcigpOwotICAgICAgICBBc3NlcnQuYXNzZXJ0Tm90TnVsbChjb250ZW50UmVzb2x2ZXIpOwotICAgICAgICBTdHJpbmcgaG9zdCA9IFNldHRpbmdzLlNlY3VyZS5nZXRTdHJpbmcoCi0gICAgICAgICAgICAgICAgY29udGVudFJlc29sdmVyLAotICAgICAgICAgICAgICAgIFNldHRpbmdzLlNlY3VyZS5IVFRQX1BST1hZKTsKLSAgICAgICAgaWYgKGhvc3QgIT0gbnVsbCkgewotICAgICAgICAgICAgaW50IGkgPSBob3N0LmluZGV4T2YoJzonKTsKLSAgICAgICAgICAgIGlmIChpID09IC0xKSB7Ci0gICAgICAgICAgICAgICAgaWYgKERFQlVHKSB7Ci0gICAgICAgICAgICAgICAgICAgIEFzc2VydC5hc3NlcnRUcnVlKGhvc3QubGVuZ3RoKCkgPT0gMCk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIHJldHVybiBudWxsOworICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIGdldEhvc3QoQ29udGV4dCBjdHgpIHsKKyAgICAgICAgc1Byb3h5SW5mb0xvY2sucmVhZExvY2soKS5sb2NrKCk7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBpZiAoc0dsb2JhbFByb3h5Q2hhbmdlZE9ic2VydmVyID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICByZWdpc3RlckNvbnRlbnRPYnNlcnZlcnNSZWFkTG9ja2VkKGN0eCk7CisgICAgICAgICAgICAgICAgcGFyc2VHbG9iYWxQcm94eUluZm9SZWFkTG9ja2VkKGN0eCk7CiAgICAgICAgICAgICB9Ci0gICAgICAgICAgICByZXR1cm4gaG9zdC5zdWJzdHJpbmcoMCwgaSk7CisgICAgICAgICAgICBpZiAoc0dsb2JhbFByb3h5U3BlYyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgSW5ldFNvY2tldEFkZHJlc3Mgc2EgPSBzR2xvYmFsUHJveHlTcGVjLnByb3h5QWRkcmVzczsKKyAgICAgICAgICAgICAgICByZXR1cm4gc2EuZ2V0SG9zdE5hbWUoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHJldHVybiBnZXREZWZhdWx0SG9zdCgpOworICAgICAgICB9IGZpbmFsbHkgeworICAgICAgICAgICAgc1Byb3h5SW5mb0xvY2sucmVhZExvY2soKS51bmxvY2soKTsKICAgICAgICAgfQotICAgICAgICByZXR1cm4gZ2V0RGVmYXVsdEhvc3QoKTsKICAgICB9CiAKKyAgICAvLyBUT0RPOiBkZXByZWNhdGUgdGhpcyBmdW5jdGlvbgogICAgIC8qKgogICAgICAqIFJldHVybiB0aGUgcHJveHkgcG9ydCBzZXQgYnkgdGhlIHVzZXIuCiAgICAgICogQHBhcmFtIGN0eCBBIENvbnRleHQgdXNlZCB0byBnZXQgdGhlIHNldHRpbmdzIGZvciB0aGUgcHJveHkgcG9ydC4KICAgICAgKiBAcmV0dXJuIFRoZSBwb3J0IG51bWJlciB0byB1c2Ugb3IgLTEgaWYgbm8gcHJveHkgaXMgdG8gYmUgdXNlZC4KICAgICAgKi8KLSAgICBzdGF0aWMgZmluYWwgcHVibGljIGludCBnZXRQb3J0KENvbnRleHQgY3R4KSB7Ci0gICAgICAgIENvbnRlbnRSZXNvbHZlciBjb250ZW50UmVzb2x2ZXIgPSBjdHguZ2V0Q29udGVudFJlc29sdmVyKCk7Ci0gICAgICAgIEFzc2VydC5hc3NlcnROb3ROdWxsKGNvbnRlbnRSZXNvbHZlcik7Ci0gICAgICAgIFN0cmluZyBob3N0ID0gU2V0dGluZ3MuU2VjdXJlLmdldFN0cmluZygKLSAgICAgICAgICAgICAgICBjb250ZW50UmVzb2x2ZXIsCi0gICAgICAgICAgICAgICAgU2V0dGluZ3MuU2VjdXJlLkhUVFBfUFJPWFkpOwotICAgICAgICBpZiAoaG9zdCAhPSBudWxsKSB7Ci0gICAgICAgICAgICBpbnQgaSA9IGhvc3QuaW5kZXhPZignOicpOwotICAgICAgICAgICAgaWYgKGkgPT0gLTEpIHsKLSAgICAgICAgICAgICAgICBpZiAoREVCVUcpIHsKLSAgICAgICAgICAgICAgICAgICAgQXNzZXJ0LmFzc2VydFRydWUoaG9zdC5sZW5ndGgoKSA9PSAwKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgcmV0dXJuIC0xOworICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgaW50IGdldFBvcnQoQ29udGV4dCBjdHgpIHsKKyAgICAgICAgc1Byb3h5SW5mb0xvY2sucmVhZExvY2soKS5sb2NrKCk7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBpZiAoc0dsb2JhbFByb3h5Q2hhbmdlZE9ic2VydmVyID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICByZWdpc3RlckNvbnRlbnRPYnNlcnZlcnNSZWFkTG9ja2VkKGN0eCk7CisgICAgICAgICAgICAgICAgcGFyc2VHbG9iYWxQcm94eUluZm9SZWFkTG9ja2VkKGN0eCk7CiAgICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAoREVCVUcpIHsKLSAgICAgICAgICAgICAgICBBc3NlcnQuYXNzZXJ0VHJ1ZShpIDwgaG9zdC5sZW5ndGgoKSk7CisgICAgICAgICAgICBpZiAoc0dsb2JhbFByb3h5U3BlYyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgSW5ldFNvY2tldEFkZHJlc3Mgc2EgPSBzR2xvYmFsUHJveHlTcGVjLnByb3h5QWRkcmVzczsKKyAgICAgICAgICAgICAgICByZXR1cm4gc2EuZ2V0UG9ydCgpOwogICAgICAgICAgICAgfQotICAgICAgICAgICAgcmV0dXJuIEludGVnZXIucGFyc2VJbnQoaG9zdC5zdWJzdHJpbmcoaSsxKSk7CisgICAgICAgICAgICByZXR1cm4gZ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mFsIEh0dHBIb3N0IGdldFByZWZlcnJlZEh0dHBIb3N0KENvbnRleHQgY29udGV4dCwKICAgICAgICAgICAgIFN0cmluZyB1cmwpIHsKLSAgICAgICAgaWYgKCFpc0xvY2FsSG9zdCh1cmwpICYmICFpc05ldHdvcmtXaWZpKGNvbnRleHQpKSB7Ci0gICAgICAgICAgICBmaW5hbCBTdHJpbmcgcHJveHlIb3N0ID0gUHJveHkuZ2V0SG9zdChjb250ZXh0KTsKLSAgICAgICAgICAgIGlmIChwcm94eUhvc3QgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgIHJldHVybiBuZXcgSHR0cEhvc3QocHJveHlIb3N0LCBQcm94eS5nZXRQb3J0KGNvbnRleHQpLCAiaHR0cCIpOwotICAgICAgICAgICAgfQorICAgICAgICBqYXZhLm5ldC5Qcm94eSBwcmVmUHJveHkgPSBnZXRQcm94eShjb250ZXh0LCB1cmwpOworICAgICAgICBpZiAocHJlZlByb3h5LmVxdWFscyhqYXZhLm5ldC5Qcm94eS5OT19QUk9YWSkpIHsKKyAgICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgSW5ldFNvY2tldEFkZHJlc3Mgc2EgPSAoSW5ldFNvY2tldEFkZHJlc3MpcHJlZlByb3h5LmFkZHJlc3MoKTsKKyAgICAgICAgICAgIHJldHVybiBuZXcgSHR0cEhvc3Qoc2EuZ2V0SG9zdE5hbWUoKSwgc2EuZ2V0UG9ydCgpLCAiaHR0cCIpOwogICAgICAgICB9Ci0KLSAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgfQogCi0gICAgc3RhdGljIGZpbmFsIHByaXZhdGUgYm9vbGVhbiBpc0xvY2FsSG9zdChTdHJpbmcgdXJsKSB7CisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgYm9vbGVhbiBpc0xvY2FsSG9zdChTdHJpbmcgdXJsKSB7CiAgICAgICAgIGlmICh1cmwgPT0gbnVsbCkgewogICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICB9Ci0KICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgIGZpbmFsIFVSSSB1cmkgPSBVUkkuY3JlYXRlKHVybCk7CiAgICAgICAgICAgICBmaW5hbCBTdHJpbmcgaG9zdCA9IHVyaS5nZXRIb3N0KCk7CkBAIC0xNzQsMTUgKzMxMSwxMyBAQAogICAgICAgICB9IGNhdGNoIChJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24gaWV4KSB7CiAgICAgICAgICAgICAvLyBJZ25vcmUgKFVSSS5jcmVhdGUpCiAgICAgICAgIH0KLQogICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgfQogCi0gICAgc3RhdGljIGZpbmFsIHByaXZhdGUgYm9vbGVhbiBpc05ldHdvcmtXaWZpKENvbnRleHQgY29udGV4dCkgeworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGJvb2xlYW4gaXNOZXR3b3JrV2lmaShDb250ZXh0IGNvbnRleHQpIHsKICAgICAgICAgaWYgKGNvbnRleHQgPT0gbnVsbCkgewogICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICB9Ci0KICAgICAgICAgZmluYWwgQ29ubmVjdGl2aXR5TWFuYWdlciBjb25uZWN0aXZpdHkgPSAoQ29ubmVjdGl2aXR5TWFuYWdlcikKICAgICAgICAgICAgIGNvbnRleHQuZ2V0U3lzdGVtU2VydmljZShDb250ZXh0LkNPTk5FQ1RJVklUWV9TRVJWSUNFKTsKICAgICAgICAgaWYgKGNvbm5lY3Rpdml0eSAhPSBudWxsKSB7CkBAIC0xOTIsNyArMzI3LDEyOSBAQAogICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgICAgICAgfQogICAgICAgICB9Ci0KICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgIH0KLX07CisKKyAgICBwcml2YXRlIHN0YXRpYyBjbGFzcyBTZXR0aW5nc09ic2VydmVyIGV4dGVuZHMgQ29udGVudE9ic2VydmVyIHsKKworICAgICAgICBwcml2YXRlIENvbnRleHQgbUNvbnRleHQ7CisKKyAgICAgICAgU2V0dGluZ3NPYnNlcnZlcihDb250ZXh0IGN0eCkgeworICAgICAgICAgICAgc3VwZXIobmV3IEhhbmRsZXIoY3R4LmdldE1haW5Mb29wZXIoKSkpOworICAgICAgICAgICAgbUNvbnRleHQgPSBjdHg7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIHZvaWQgb25DaGFuZ2UoYm9vbGVhbiBzZWxmQ2hhbmdlKSB7CisgICAgICAgICAgICBzUHJveHlJbmZvTG9jay5yZWFkTG9jaygpLmxvY2soKTsKKyAgICAgICAgICAgIHBhcnNlR2xvYmFsUHJveHlJbmZvUmVhZExvY2tlZChtQ29udGV4dCk7CisgICAgICAgICAgICBzUHJveHlJbmZvTG9jay5yZWFkTG9jaygpLnVubG9jaygpOworICAgICAgICB9CisgICAgfQorCisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgdm9pZCByZWdpc3RlckNvbnRlbnRPYnNlcnZlcnNSZWFkTG9ja2VkKENvbnRleHQgY3R4KSB7CisgICAgICAgIFVyaSB1cmlHbG9iYWxQcm94eSA9IFNldHRpbmdzLlNlY3VyZS5nZXRVcmlGb3IoU2V0dGluZ3MuU2VjdXJlLkhUVFBfUFJPWFkpOworICAgICAgICBVcmkgdXJpR2xvYmFsRXhjbExpc3QgPQorICAgICAgICAgICAgU2V0dGluZ3MuU2VjdXJlLmdldFVyaUZvcihTZXR0aW5ncy5TZWN1cmUuSFRUUF9QUk9YWV9FWENMVVNJT05fTElTVCk7CisKKyAgICAgICAgLy8gTm8gbG9jayB1cGdyYWRpbmcgKGZyb20gcmVhZCB0byB3cml0ZSkgYWxsb3dlZAorICAgICAgICBzUHJveHlJbmZvTG9jay5yZWFkTG9jaygpLnVubG9jaygpOworICAgICAgICBzUHJveHlJbmZvTG9jay53cml0ZUxvY2soKS5sb2NrKCk7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBzR2xvYmFsUHJveHlDaGFuZ2VkT2JzZXJ2ZXIgPSBuZXcgU2V0dGluZ3NPYnNlcnZlcihjdHgpOworICAgICAgICB9IGZpbmFsbHkgeworICAgICAgICAgICAgLy8gRG93bmdyYWRpbmcgbG9ja3MgKGZyb20gd3JpdGUgdG8gcmVhZCkgaXMgYWxsb3dlZAorICAgICAgICAgICAgc1Byb3h5SW5mb0xvY2sucmVhZExvY2soKS5sb2NrKCk7CisgICAgICAgICAgICBzUHJveHlJbmZvTG9jay53cml0ZUxvY2soKS51bmxvY2soKTsKKyAgICAgICAgfQorICAgICAgICBjdHguZ2V0Q29udGVudFJlc29sdmVyKCkucmVnaXN0ZXJDb250ZW50T2JzZXJ2ZXIodXJpR2xvYmFsUHJveHksIGZhbHNlLAorICAgICAgICAgICAgICAgIHNHbG9iYWxQcm94eUNoYW5nZWRPYnNlcnZlcik7CisgICAgICAgIGN0eC5nZXRDb250ZW50UmVzb2x2ZXIoKS5yZWdpc3RlckNvbnRlbnRPYnNlcnZlcih1cmlHbG9iYWxFeGNsTGlzdCwgZmFsc2UsCisgICAgICAgICAgICAgICAgc0dsb2JhbFByb3h5Q2hhbmdlZE9ic2VydmVyKTsKKyAgICB9CisKKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCB2b2lkIHBhcnNlR2xvYmFsUHJveHlJbmZvUmVhZExvY2tlZChDb250ZXh0IGN0eCkgeworICAgICAgICBDb250ZW50UmVzb2x2ZXIgY29udGVudFJlc29sdmVyID0gY3R4LmdldENvbnRlbnRSZXNvbHZlcigpOworICAgICAgICBTdHJpbmcgcHJveHlIb3N0ID0gIFNldHRpbmdzLlNlY3VyZS5nZXRTdHJpbmcoCisgICAgICAgICAgICAgICAgY29udGVudFJlc29sdmVyLAorICAgICAgICAgICAgICAgIFNldHRpbmdzLlNlY3VyZS5IVFRQX1BST1hZKTsKKyAgICAgICAgaWYgKChwcm94eUhvc3QgPT0gbnVsbCkgfHwgKHByb3h5SG9zdC5sZW5ndGgoKSA9PSAwKSkgeworICAgICAgICAgICAgLy8gQ2xlYXIgc2lnbmFsCisgICAgICAgICAgICBzUHJveHlJbmZvTG9jay5yZWFkTG9jaygpLnVubG9jaygpOworICAgICAgICAgICAgc1Byb3h5SW5mb0xvY2sud3JpdGVMb2NrKCkubG9jaygpOworICAgICAgICAgICAgc0dsb2JhbFByb3h5U3BlYyA9IG51bGw7CisgICAgICAgICAgICBzUHJveHlJbmZvTG9jay5yZWFkTG9jaygpLmxvY2soKTsKKyAgICAgICAgICAgIHNQcm94eUluZm9Mb2NrLndyaXRlTG9jaygpLnVubG9jaygpOworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisgICAgICAgIFN0cmluZyBleGNsdXNpb25MaXN0U3BlYyA9IFNldHRpbmdzLlNlY3VyZS5nZXRTdHJpbmcoCisgICAgICAgICAgICAgICAgY29udGVudFJlc29sdmVyLAorICAgICAgICAgICAgICAgIFNldHRpbmdzLlNlY3VyZS5IVFRQX1BST1hZX0VYQ0xVU0lPTl9MSVNUKTsKKyAgICAgICAgU3RyaW5nIGhvc3QgPSBwYXJzZUhvc3QocHJveHlIb3N0KTsKKyAgICAgICAgaW50IHBvcnQgPSBwYXJzZVBvcnQocHJveHlIb3N0KTsKKyAgICAgICAgaWYgKHByb3h5SG9zdCAhPSBudWxsKSB7CisgICAgICAgICAgICBzR2xvYmFsUHJveHlTcGVjID0gbmV3IFByb3h5U3BlYygpOworICAgICAgICAgICAgc0dsb2JhbFByb3h5U3BlYy5wcm94eUFkZHJlc3MgPSBuZXcgSW5ldFNvY2tldEFkZHJlc3MoaG9zdCwgcG9ydCk7CisgICAgICAgICAgICBpZiAoKGV4Y2x1c2lvbkxpc3RTcGVjICE9IG51bGwpICYmIChleGNsdXNpb25MaXN0U3BlYy5sZW5ndGgoKSAhPSAwKSkgeworICAgICAgICAgICAgICAgIFN0cmluZ1tdIGV4Y2x1c2lvbkxpc3RFbnRyaWVzID0gZXhjbHVzaW9uTGlzdFNwZWMudG9Mb3dlckNhc2UoKS5zcGxpdCgiLCIpOworICAgICAgICAgICAgICAgIFN0cmluZ1tdIHByb2Nlc3NlZEVudHJpZXMgPSBuZXcgU3RyaW5nW2V4Y2x1c2lvbkxpc3RFbnRyaWVzLmxlbmd0aF07CisgICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBleGNsdXNpb25MaXN0RW50cmllcy5sZW5ndGg7IGkrKykgeworICAgICAgICAgICAgICAgICAgICBTdHJpbmcgZW50cnkgPSBleGNsdXNpb25MaXN0RW50cmllc1tpXS50cmltKCk7CisgICAgICAgICAgICAgICAgICAgIGlmIChlbnRyeS5zdGFydHNXaXRoKCIuIikpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGVudHJ5ID0gZW50cnkuc3Vic3RyaW5nKDEpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIHByb2Nlc3NlZEVudHJpZXNbaV0gPSBlbnRyeTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgc1Byb3h5SW5mb0xvY2sucmVhZExvY2soKS51bmxvY2soKTsKKyAgICAgICAgICAgICAgICBzUHJveHlJbmZvTG9jay53cml0ZUxvY2soKS5sb2NrKCk7CisgICAgICAgICAgICAgICAgc0dsb2JhbFByb3h5U3BlYy5leGNsdXNpb25MaXN0ID0gcHJvY2Vzc2VkRW50cmllczsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgc1Byb3h5SW5mb0xvY2sucmVhZExvY2soKS51bmxvY2soKTsKKyAgICAgICAgICAgICAgICBzUHJveHlJbmZvTG9jay53cml0ZUxvY2soKS5sb2NrKCk7CisgICAgICAgICAgICAgICAgc0dsb2JhbFByb3h5U3BlYy5leGNsdXNpb25MaXN0ID0gbnVsbDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIHNQcm94eUluZm9Mb2NrLnJlYWRMb2NrKCkudW5sb2NrKCk7CisgICAgICAgICAgICBzUHJveHlJbmZvTG9jay53cml0ZUxvY2soKS5sb2NrKCk7CisgICAgICAgICAgICBzR2xvYmFsUHJveHlTcGVjID0gbnVsbDsKKyAgICAgICAgfQorICAgICAgICBzUHJveHlJbmZvTG9jay5yZWFkTG9jaygpLmxvY2soKTsKKyAgICAgICAgc1Byb3h5SW5mb0xvY2sud3JpdGVMb2NrKCkudW5sb2NrKCk7CisgICAgfQorCisgICAgLyoqCisgICAgICogVmFsaWRhdGUgc3ludGF4IG9mIGhvc3RuYW1lLCBwb3J0IGFuZCBleGNsdXNpb24gbGlzdCBlbnRyaWVzCisgICAgICoge0BoaWRlfQorICAgICAqLworICAgIHB1YmxpYyBzdGF0aWMgdm9pZCB2YWxpZGF0ZShTdHJpbmcgaG9zdG5hbWUsIFN0cmluZyBwb3J0LCBTdHJpbmcgZXhjbExpc3QpIHsKKyAgICAgICAgTWF0Y2hlciBtYXRjaCA9IEhPU1ROQU1FX1BBVFRFUk4ubWF0Y2hlcihob3N0bmFtZSk7CisgICAgICAgIE1hdGNoZXIgbGlzdE1hdGNoID0gRVhDTExJU1RfUEFUVEVSTi5tYXRjaGVyKGV4Y2xMaXN0KTsKKworICAgICAgICBpZiAoIW1hdGNoLm1hdGNoZXMoKSkgeworICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigpOworICAgICAgICB9CisKKyAgICAgICAgaWYgKCFsaXN0TWF0Y2gubWF0Y2hlcygpKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCk7CisgICAgICAgIH0KKworICAgICAgICBpZiAoaG9zdG5hbWUubGVuZ3RoKCkgPiAwICYmIHBvcnQubGVuZ3RoKCkgPT0gMCkgeworICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigpOworICAgICAgICB9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SBJbmV0QWRkcmVzcyBtUHJveHk7CisgICAgcHJpdmF0ZSBpbnQgbVBvcnQ7CisgICAgcHJpdmF0ZSBTdHJpbmcgbUV4Y2x1c2lvbkxpc3Q7CisKKyAgICBwdWJsaWMgUHJveHlQcm9wZXJ0aWVzKCkgeworICAgIH0KKworICAgIHB1YmxpYyBzeW5jaHJvbml6ZWQgSW5ldEFkZHJlc3MgZ2V0QWRkcmVzcygpIHsKKyAgICAgICAgcmV0dXJuIG1Qcm94eTsKKyAgICB9CisgICAgcHVibGljIHN5bmNocm9uaXplZCB2b2lkIHNldEFkZHJlc3MoSW5ldEFkZHJlc3MgcHJveHkpIHsKKyAgICAgICAgbVByb3h5ID0gcHJveHk7CisgICAgfQorCisgICAgcHVibGljIHN5bmNocm9uaXplZCBpbnQgZ2V0UG9ydCgpIHsKKyAgICAgICAgcmV0dXJuIG1Qb3J0OworICAgIH0KKyAgICBwdWJsaWMgc3luY2hyb25pemVkIHZvaWQgc2V0UG9ydChpbnQgcG9ydCkgeworICAgICAgICBtUG9ydCA9IHBvcnQ7CisgICAgfQorCisgICAgcHVibGljIHN5bmNocm9uaXplZCBTdHJpbmcgZ2V0RXhjbHVzaW9uTGlzdCgpIHsKKyAgICAgICAgcmV0dXJuIG1FeGNsdXNpb25MaXN0OworICAgIH0KKyAgICBwdWJsaWMgc3luY2hyb25pemVkIHZvaWQgc2V0RXhjbHVzaW9uTGlzdChTdHJpbmcgZXhjbHVzaW9uTGlzdCkgeworICAgICAgICBtRXhjbHVzaW9uTGlzdCA9IGV4Y2x1c2lvbkxpc3Q7CisgICAgfQorCisgICAgLyoqCisgICAgICogSW1wbGVtZW50IHRoZSBQYXJjZWxhYmxlIGludGVyZmFjZQorICAgICAqIEBoaWRlCisgICAgICovCisgICAgcHVibGljIGludCBkZXNjcmliZUNvbnRlbnRzKCkgeworICAgICAgICByZXR1cm4gMDsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBJbXBsZW1lbnQgdGhlIFBhcmNlbGFibGUgaW50ZXJmYWNlLgorICAgICAqIEBoaWRlCisgICAgICovCisgICAgcHVibGljIHN5bmNocm9uaXplZCB2b2lkIHdyaXRlVG9QYXJjZWwoUGFyY2VsIGRlc3QsIGludCBmbGFncykgeworICAgICAgICBpZiAobVByb3h5ICE9IG51bGwpIHsKKyAgICAgICAgICAgIGRlc3Qud3JpdGVCeXRlKChieXRlKTEpOworICAgICAgICAgICAgZGVzdC53cml0ZVN0cmluZyhtUHJveHkuZ2V0SG9zdE5hbWUoKSk7CisgICAgICAgICAgICBkZXN0LndyaXRlQnl0ZUFycmF5KG1Qcm94eS5nZXRBZGRyZXNzKCkpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgZGVzdC53cml0ZUJ5dGUoKGJ5dGUpMCk7CisgICAgICAgIH0KKyAgICAgICAgZGVzdC53cml0ZUludChtUG9ydCk7CisgICAgICAgIGRlc3Qud3JpdGVTdHJpbmcobUV4Y2x1c2lvbkxpc3QpOworICAgIH0KKworICAgIC8qKgorICAgICAqIEltcGxlbWVudCB0aGUgUGFyY2VsYWJsZSBpbnRlcmZhY2UuCisgICAgICogQGhpZGUKKyAgICAgKi8KKyAgICBwdWJsaWMgc3RhdGljIGZpbmFsIENyZWF0b3I8UHJveHlQcm9wZXJ0aWVzPiBDUkVBVE9SID0KKyAgICAgICAgbmV3IENyZWF0b3I8UHJveHlQcm9wZXJ0aWVzPigpIHsKKyAgICAgICAgICAgIHB1YmxpYyBQcm94eVByb3BlcnRpZXMgY3JlYXRlRnJvbVBhcmNlbChQYXJjZWwgaW4pIHsKKyAgICAgICAgICAgICAgICBQcm94eVByb3BlcnRpZXMgcHJveHlQcm9wZXJ0aWVzID0gbmV3IFByb3h5UHJvcGVydGllcygpOworICAgICAgICAgICAgICAgIGlmIChpbi5yZWFkQnl0ZSgpID09IDEpIHsKKyAgICAgICAgICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHByb3h5UHJvcGVydGllcy5zZXRBZGRyZXNzKEluZXRBZGRyZXNzLmdldEJ5QWRkcmVzcyhpbi5yZWFkU3RyaW5nKCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluLmNyZWF0ZUJ5dGVBcnJheSgpKSk7CisgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKFVua25vd25Ib3N0RXhjZXB0aW9uIGUpIHt9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHByb3h5UHJvcGVydGllcy5zZXRQb3J0KGluLnJlYWRJbnQoKSk7CisgICAgICAgICAgICAgICAgcHJveHlQcm9wZXJ0aWVzLnNldEV4Y2x1c2lvbkxpc3QoaW4ucmVhZFN0cmluZygpKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gcHJveHlQcm9wZXJ0aWVzOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBwdWJsaWMgUHJveHlQcm9wZXJ0aWVzW10gbmV3QXJyYXkoaW50IHNpemUpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gbmV3IFByb3h5UHJvcGVydGllc1tzaXplXTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfTsKKworfTsKZGlmZiAtLWdpdCBhL2NvcmUvamF2YS9hbmRyb2lkL25ldC9VcmkuamF2YSBiL2NvcmUvamF2YS9hbmRyb2lkL25ldC9VcmkuamF2YQppbmRleCA0N2ZhYWJhLi42M2FkY2QwIDEwMDY0NAotLS0gYS9jb3JlL2phdmEvYW5kcm9pZC9uZXQvVXJpLmphdmEKKysrIGIvY29yZS9qYXZhL2FuZHJvaWQvbmV0L1VyaS5qYXZhCkBAIC0xNTY4LDcgKzE1NjgsNyBAQAogICAgICAgICAgICAgdGhyb3cgbmV3IFVuc3VwcG9ydGVkT3BlcmF0aW9uRXhjZXB0aW9uKE5PVF9ISUVSQVJDSElDQUwpOwogICAgICAgICB9CiAgICAgICAgIGlmIChrZXkgPT0gbnVsbCkgewotICAgICAgICAgIHRocm93IG5ldyBOdWxsUG9pbnRlck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ICAgICAgICAgICAgICAgICAgU3RyaW5nIGVudGl0eVN0cmluZyA9IHN0cmVhbS50b1N0cmluZygpOwogCi0gICAgICAgICAgICAgICAgICAgIC8vIFRPRE86IENoZWNrIHRoZSBjb250ZW50IHR5cGUsIHRvby4KLSAgICAgICAgICAgICAgICAgICAgYnVpbGRlci5hcHBlbmQoIiAtLWRhdGEtYXNjaWkgXCIiKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5hcHBlbmQoZW50aXR5U3RyaW5nKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5hcHBlbmQoIlwiIik7CisgICAgICAgICAgICAgICAgICAgIGlmIChpc0JpbmFyeUNvbnRlbnQocmVxdWVzdCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIFN0cmluZyBiYXNlNjQgPSBCYXNlNjQuZW5jb2RlVG9TdHJpbmcoc3RyZWFtLnRvQnl0ZUFycmF5KCksIEJhc2U2NC5OT19XUkFQKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJ1aWxkZXIuaW5zZXJ0KDAsICJlY2hvICciICsgYmFzZTY0ICsgIicgfCBiYXNlNjQgLWQgPiAvdG1wLyQkLmJpbjsgIik7CisgICAgICAgICAgICAgICAgICAgICAgICBidWlsZGVyLmFwcGVuZCgiIC0tZGF0YS1iaW5hcnkgQC90bXAvJCQuYmluIik7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICBTdHJpbmcgZW50aXR5U3RyaW5nID0gc3RyZWFtLnRvU3RyaW5nKCk7CisgICAgICAgICAgICAgICAgICAgICAgICBidWlsZGVyLmFwcGVuZCgiIC0tZGF0YS1hc2NpaSBcIiIpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5hcHBlbmQoZW50aXR5U3RyaW5nKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAuYXBwZW5kKCJcIiIpOworICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgYnVpbGRlci5hcHBlbmQoIiBbVE9PIE1VQ0ggREFUQSBUTyBJTkNMVURFXSIpOwogICAgICAgICAgICAgICAgIH0KQEAgLTQ0Niw2ICs0NTcsMzAgQEAKICAgICAgICAgcmV0dXJuIGJ1aWxkZXIudG9TdHJpbmcoKTsKICAgICB9CiAKKyAgICBwcml2YXRlIHN0YXRpYyBib29sZWFuIGlzQmluYXJ5Q29udGVudChIdHRwVXJpUmVxdWVzdCByZXF1ZXN0KSB7CisgICAgICAgIEhlYWRlcltdIGhlYWRlcnM7CisgICAgICAgIGhlYWRlcnMgPSByZXF1ZXN0LmdldEhlYWRlcnMoSGVhZGVycy5DT05URU5UX0VOQ09ESU5HKTsKKyAgICAgICAgaWYgKGhlYWRlcnMgIT0gbnVsbCkgeworICAgICAgICAgICAgZm9yIChIZWFkZXIgaGVhZGVyIDogaGVhZGVycykgeworICAgICAgICAgICAgICAgIGlmICgiZ3ppcCIuZXF1YWxzSWdub3JlQ2FzZShoZWFkZXIuZ2V0VmFsdWUoKSkpIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgaGVhZGVycyA9IHJlcXVlc3QuZ2V0SGVhZGVycyhIZWFkZXJzLkNPTlRFTlRfVFlQRSk7CisgICAgICAgIGlmIChoZWFkZXJzICE9IG51bGwpIHsKKyAgICAgICAgICAgIGZvciAoSGVhZGVyIGhlYWRlciA6IGhlYWRlcnMpIHsKKyAgICAgICAgICAgICAgICBmb3IgKFN0cmluZyBjb250ZW50VHlwZSA6IHRleHRDb250ZW50VHlwZXMpIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGhlYWRlci5nZXRWYWx1ZSgpLnN0YXJ0c1dpdGgoY29udGVudFR5cGUpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmF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2hyb25vdXMgdGFzay4gVGhpcyBjb25zdHJ1Y3RvciBtdXN0IGJlIGludm9rZWQgb24gdGhlIFVJIHRocmVhZC4KICAgICAgKi8KQEAgLTE4Nyw2ICsxOTIsMTcgQEAKICAgICAgICAgfTsKIAogICAgICAgICBtRnV0dXJlID0gbmV3IEZ1dHVyZVRhc2s8UmVzdWx0PihtV29ya2VyKSB7CisKKyAgICAgICAgICAgIEBPdmVycmlkZQorICAgICAgICAgICAgcHJvdGVjdGVkIHZvaWQgc2V0KFJlc3VsdCB2KSB7CisgICAgICAgICAgICAgICAgc3VwZXIuc2V0KHYpOworICAgICAgICAgICAgICAgIGlmIChpc0NhbmNlbGxlZCgpKSB7CisgICAgICAgICAgICAgICAgICAgIE1lc3NhZ2UgbWVzc2FnZSA9IHNIYW5kbGVyLm9idGFpbk1lc3NhZ2UoTUVTU0FHRV9QT1NUX0NBTkNFTCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXcgQXN5bmNUYXNrUmVzdWx0PFJlc3VsdD4oQXN5bmNUYXNrLnRoaXMsIChSZXN1bHRbXSkgbnVsbCkpOworICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnNlbmRUb1RhcmdldCgpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKwogICAgICAgICAgICAgQE92ZXJyaWRlCiAgICAgICAgICAgICBwcm90ZWN0ZWQgdm9pZCBkb25lKCkgewogICAgICAgICAgICAgICAgIE1lc3NhZ2UgbWVzc2FnZTsKQEAgLTQwMiwxNCArNDE4LDE5IEBACiAgICAgICogc3RpbGwgcnVubmluZy4gRWFjaCBjYWxsIHRvIHRoaXMgbWV0aG9kIHdpbGwgdHJpZ2dlciB0aGUgZXhlY3V0aW9uIG9mCiAgICAgICoge0BsaW5rICNvblByb2dyZXNzVXBkYXRlfSBvbiB0aGUgVUkgdGhyZWFkLgogICAgICAqCisgICAgICoge0BsaW5rICNvblByb2dyZXNzVXBkYXRlfSB3aWxsIG5vdGU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TdkIDEwMDY0NAotLS0gYS9jb3JlL2phdmEvYW5kcm9pZC9waW0vUmVjdXJyZW5jZVNldC5qYXZhCisrKyBiL2NvcmUvamF2YS9hbmRyb2lkL3BpbS9SZWN1cnJlbmNlU2V0LmphdmEKQEAgLTE4MSw3ICsxODEsOSBAQAogICAgICAgICBib29sZWFuIGluVXRjID0gc3RhcnQucGFyc2UoZHRzdGFydCk7CiAgICAgICAgIGJvb2xlYW4gYWxsRGF5ID0gc3RhcnQuYWxsRGF5OwogCi0gICAgICAgIGlmIChpblV0YykgeworICAgICAgICAvLyBXZSBmb3JjZSBUaW1lWm9uZSB0byBVVEMgZm9yICJhbGwgZGF5IHJlY3VycmluZyBldmVudHMiIGFzIHRoZSBzZXJ2ZXIgaXMgc2VuZGluZyBubworICAgICAgICAvLyBUaW1lWm9uZSBpbiBEVFNUQVJUIGZvciB0aGVtCisgICAgICAgIGlmIChpblV0YyB8fCBhbGxEYXkpIHsKICAgICAgICAgICAgIHR6aWQgPSBUaW1lLlRJTUVaT05FX1VUQzsKICAgICAgICAgfQogICAgICAgICAgICAgICAgIApAQCAtMjA0LDEwICsyMDYsNyBAQAogICAgICAgICB9CiAgICAgICAgIAogICAgICAgICBpZiAoYWxsRGF5KSB7Ci0gICAgICAgIAkvLyBUT0RPOiBhbHNvIGNoYW5nZSB0emlkIHRvIGJlIFVUQz8gIHRoYXQgd291bGQgYmUgY29uc2lzdGVudCwgYnV0Ci0gICAgICAgIAkvLyB0aGF0IHdvdWxkIG5vdCByZWZsZWN0IHRoZSBvcmlnaW5hbCB0aW1lem9uZSB2YWx1ZSBiYWNrIHRvIHRoZQotICAgICAgICAJLy8gc2VydmVyLgotICAgICAgICAJc3RhcnQudGltZXpvbmUgPSBUaW1lLlRJTUVaT05FX1VUQzsKKyAgICAgICAgICAgIHN0YXJ0LnRpbWV6b25lID0gVGltZS5USU1FWk9ORV9VVEM7CiAgICAgICAgIH0KICAgICAgICAgbG9uZyBtaWxsaXMgPSBzdGFydC50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SIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjZCJywgIlx1RkY2QiIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjZDJywgIlx1RkY2QyIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjZEJywgIlx1RkY2RCIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjZFJywgIlx1RkY2RSIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjZGJywgIlx1RkY2RiIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjcwJywgIlx1RkY3MCIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjcxJywgIlx1RkY3MSIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjcyJywgIlx1RkY3MiIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjczJywgIlx1RkY3MyIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjc0JywgIlx1RkY3NCIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjc1JywgIlx1RkY3NSIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjc2JywgIlx1RkY3NiIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjc3JywgIlx1RkY3NyIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjc4JywgIlx1RkY3OCIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjc5JywgIlx1RkY3OSIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjdBJywgIlx1RkY3QSIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjdCJywgIlx1RkY3QiIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjdDJywgIlx1RkY3QyIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjdEJywgIlx1RkY3RCIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjdFJywgIlx1RkY3RSIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjdGJywgIlx1RkY3RiIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjgwJywgIlx1RkY4MCIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjgxJywgIlx1RkY4MSIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjgyJywgIlx1RkY4MiIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjgzJywgIlx1RkY4MyIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjg0JywgIlx1RkY4NCIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjg1JywgIlx1RkY4NSIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjg2JywgIlx1RkY4NiIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjg3JywgIlx1RkY4NyIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjg4JywgIlx1RkY4OCIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjg5JywgIlx1RkY4OSIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjhBJywgIlx1RkY4QSIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjhCJywgIlx1RkY4QiIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjhDJywgIlx1RkY4QyIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjhEJywgIlx1RkY4RCIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjhFJywgIlx1RkY4RSIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjhGJywgIlx1RkY4RiIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjkwJywgIlx1RkY5MCIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjkxJywgIlx1RkY5MSIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjkyJywgIlx1RkY5MiIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjkzJywgIlx1RkY5MyIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjk0JywgIlx1RkY5NCIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjk1JywgIlx1RkY5NSIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjk2JywgIlx1RkY5NiIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjk3JywgIlx1RkY5NyIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjk4JywgIlx1RkY5OCIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjk5JywgIlx1RkY5OSIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjlBJywgIlx1RkY5QSIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjlCJywgIlx1RkY5QiIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjlDJywgIlx1RkY5QyIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjlEJywgIlx1RkY5RCIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjlFJywgIlx1RkY5RSIpOwotICAgICAgICBzSGFsZldpZHRoTWFwLnB1dCgnXHVGRjlGJywgIlx1RkY5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vclZlbmRvcihTSElGVF9KSVMsICJkb2NvbW8iKS5uYW1lKCk7Ci0gICAgICAgICAgICB9IGNhdGNoIChVbnN1cHBvcnRlZENoYXJzZXRFeGNlcHRpb24gZSkgewotICAgICAgICAgICAgICAgIExvZy5lKExPR19UQUcsICJEb0NvTW8tc3BlY2lmaWMgU0hJRlRfSklTIHdhcyBub3QgZm91bmQuIFVzZSBTSElGVF9KSVMgYXMgaXMuIik7Ci0gICAgICAgICAgICAgICAgY2hhcnNldCA9IFNISUZUX0pJUzsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIG1DaGFyc2V0U3RyaW5nID0gY2hhcnNldDsKLSAgICAgICAgICAgIC8vIERvIG5vdCB1c2UgbUNoYXJzZXRTdHJpbmcgYmVsbG93IHNpbmNlIGl0IGlzIGRpZmZlcmVudCBmcm9tICJTSElGVF9KSVMiIGJ1dAotICAgICAgICAgICAgLy8gbWF5IGJlICJET0NPTU9fU0hJRlRfSklTIiBvciBzb21ldGhpbmcgbGlrZSB0aGF0IChpbnRlcm5hbCBleHByZXNzaW9uIHVzZWQgaW4KLSAgICAgICAgICAgIC8vIEFuZHJvaWQsIG5vdCBzaG93biB0byB0aGUgcHVibGljKS4KLSAgICAgICAgICAgIG1WQ2FyZENoYXJzZXRQYXJhbWV0ZXIgPSAiQ0hBUlNFVD0iICsgU0hJRlRfSklTOwotICAgICAgICB9IGVsc2UgaWYgKG1Vc2VzU2hpZnRKaXMpIHsKLSAgICAgICAgICAgIFN0cmluZyBjaGFyc2V0OwotICAgICAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgICAgICBjaGFyc2V0ID0gQ2hhcnNldFV0aWxzLmNoYXJzZXRGb3JWZW5kb3IoU0hJRlRfSklTKS5uYW1lKCk7Ci0gICAgICAgICAgICB9IGNhdGNoIChVbnN1cHBvcnRlZENoYXJzZXRFeGNlcHRpb24gZSkgewotICAgICAgICAgICAgICAgIExvZy5lKExPR19UQUcsICJWZW5kb3Itc3BlY2lmaWMg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0gICAgICAgICAgICBJbnRlZ2VyIGlzU3VwZXJQcmltYXJ5ID0gY29udGVudFZhbHVlcy5nZXRBc0ludGVnZXIoU3RydWN0dXJlZE5hbWUuSVNfU1VQRVJfUFJJTUFSWSk7Ci0gICAgICAgICAgICBpZiAoaXNTdXBlclByaW1hcnkgIT0gbnVsbCAmJiBpc1N1cGVyUHJpbWFyeSA+IDApIHsKLSAgICAgICAgICAgICAgICAvLyBXZSBjaG9vc2UgInN1cGVyIHByaW1hcnkiIENvbnRlbnRWYWx1ZXMuCi0gICAgICAgICAgICAgICAgcHJpbWFyeUNvbnRlbnRWYWx1ZXMgPSBjb250ZW50VmFsdWVzOwotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgfSBlbHNlIGlmIChwcmltYXJ5Q29udGVudFZhbHVlcyA9PSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgLy8gV2UgY2hvb3NlIHRoZSBmaXJzdCAicHJpbWFyeSIgQ29udGVudFZhbHVlcwotICAgICAgICAgICAgICAgIC8vIGlmICJzdXBlciBwcmltYXJ5IiBDb250ZW50VmFsdWVzIGRvZXMgbm90IGV4aXN0LgotICAgICAgICAgICAgICAgIGZpbmFsIEludGVnZXIgaXNQcmltYXJ5ID0gY29udGVudFZhbHVlcy5nZXRBc0ludGVnZXIoU3RydWN0dXJlZE5hbWUuSVNfUFJJTUFSWSk7Ci0gICAgICAgICAgICAgICAgaWYgKGlzUHJpbWFyeSAhPSBudWxsICYmIGlzUHJpbWFyeSA+IDAgJiYKLSAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRhaW5zTm9uRW1wdHlOYW1lKGNvbnRlbnRWYWx1ZXMpKSB7Ci0gICAgICAgICAgICAgICAgICAgIHByaW1hcnlDb250ZW50VmFsdWVzID0gY29udGVudFZhbHVlczsKLSAgICAgICAgICAgICAgICAgICAgLy8gRG8gbm90IGJyZWFrLCBzaW5jZSB0aGVyZSBtYXkgYmUgQ29udGVudFZhbHVlcyB3aXRoICJzdXBlciBwcmltYXJ5IgotICAgICAgICAgICAgICAgICAgICAvLyBhZnRlcndvcmQuCi0gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChzdWJwcmltYXJ5Q29udGVudFZhbHVlcyA9PSBudWxsICYmCi0gICAgICAgICAgICAgICAgICAgICAgICBjb250YWluc05vbkVtcHR5TmFtZShjb250ZW50VmFsdWVzKSkgewotICAgICAgICAgICAgICAgICAgICBzdWJwcmltYXJ5Q29udGVudFZhbHVlcyA9IGNvbnRlbnRWYWx1ZXM7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgaWYgKHByaW1hcnlDb250ZW50VmFsdWVzID09IG51bGwpIHsKLSAgICAgICAgICAgIGlmIChzdWJwcmltYXJ5Q29udGVudFZhbHVlcyAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgLy8gV2UgY2hvb3NlIHRoZSBmaXJzdCBDb250ZW50VmFsdWVzIGlmIGFueSAicHJpbWFyeSIgQ29udGVudFZhbHVlcyBkb2VzIG5vdCBleGlzdC4KLSAgICAgICAgICAgICAgICBwcmltYXJ5Q29udGVudFZhbHVlcyA9IHN1YnByaW1hcnlDb250ZW50VmFsdWVzOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBMb2cuZShMT0dfVEFHLCAiQWxsIENvbnRlbnRWYWx1ZXMgZ2l2ZW4gZnJvbSBkYXRhYmFzZSBpcyBlbXB0eS4iKTsKLSAgICAgICAgICAgICAgICBwcmltYXJ5Q29udGVudFZhbHVlcyA9IG5ldyBDb250ZW50VmFsdWVzKCk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQotICAgICAgICByZXR1cm4gcHJpbWFyeUNvbnRlbnRWYWx1ZXM7Ci0gICAgfQotCi0gICAgLyoqCi0gICAgICogRm9yIHNhZmV0eSwgd2UnbGwgZW1pdCBqdXN0IG9uZSB2YWx1ZSBhcm91bmQgU3RydWN0dXJ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AgICAgICAgICAgICAgICAgICAgICAgICAhKFZDYXJkVXRpbHMuY29udGFpbnNPbmx5Tm9uQ3JMZlByaW50YWJsZUFzY2lpKGZhbWlseU5hbWUpICYmCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBWQ2FyZFV0aWxzLmNvbnRhaW5zT25seU5vbkNyTGZQcmludGFibGVBc2NpaShnaXZlbk5hbWUpICYmCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBWQ2FyZFV0aWxzLmNvbnRhaW5zT25seU5vbkNyTGZQcmludGFibGVBc2NpaShtaWRkbGVOYW1lKSAmJgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVkNhcmRVdGlscy5jb250YWluc09ubHlOb25DckxmUHJpbnRhYmxlQXNjaWkocHJlZml4KSAmJgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVkNhcmRVdGlscy5jb250YWluc09ubHlOb25DckxmUHJpbnRhYmxlQXNjaWkoc3VmZml4KSkpOwotCi0gICAgICAgICAgICBmaW5hbCBTdHJpbmcgZm9ybWF0dGVkTmFtZTsKLSAgICAgICAgICAgIGlmICghVGV4dFV0aWxzLmlzRW1wdHkoZGlzcGxheU5hbWUpKSB7Ci0gICAgICAgICAgICAgICAgZm9ybWF0dGVkTmFtZSA9IGRpc3BsYXlOYW1lOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBmb3JtYXR0ZWROYW1lID0gVkNhcmRVdGlscy5jb25zdHJ1Y3ROYW1lRnJvbUVsZW1lbnRzKAotICAgICAgICAgICAgICAgICAgICAgICAgVkNhcmRDb25maWcuZ2V0TmFtZU9yZGVyVHlwZShtVkNhcmRUeXBlKSwKLSAgICAgICAgICAgICAgICAgICAgICAgIGZhbWlseU5hbWUsIG1pZGRsZU5hbWUsIGdpdmVuTmFtZSwgcHJlZml4LCBzdWZmaXgpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgZmluYWwgY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uZChtVkNhcmRDaGFyc2V0UGFyYW1ldGVyKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgaWYgKHJlYWxseVVzZVF1b3RlZFByaW50YWJsZVRvTmFtZSkgewotICAgICAgICAgICAgICAgICAgICBtQnVpbGRlci5hcHBlbmQoVkNBUkRfUEFSQU1fU0VQQVJBVE9SKTsKLSAgICAgICAgICAgICAgICAgICAgbUJ1aWxkZXIuYXBwZW5kKFZDQVJEX1BBUkFNX0VOQ09ESU5HX1FQKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgbUJ1aWxkZXIuYXBwZW5kKFZDQVJEX0RBVEFfU0VQQVJBVE9SKTsKLSAgICAgICAgICAgICAgICBtQnVpbGRlci5hcHBlbmQoZW5jb2RlZEZhbWlseSk7Ci0gICAgICAgICAgICAgICAgbUJ1aWxkZXIuYXBwZW5kKFZDQVJEX0lURU1fU0VQQVJBVE9SKTsKLSAgICAgICAgICAgICAgICBtQnVpbGRlci5hcHBlbmQoZW5jb2RlZEdpdmVuKTsKLSAgICAgICAgICAgICAgICBtQnVpbGRlci5hcHBlbmQoVkNBUkRfSVRFTV9TRVBBUkFUT1IpOwotICAgICAgICAgICAgICAgIG1CdWlsZGVyLmFwcGVuZChlbmNvZGVkTWlkZGxlKTsKLSAgICAgICAgICAgICAgICBtQnVpbGRlci5hcHBlbmQoVkNBUkRfSVRFTV9TRVBBUkFUT1IpOwotICAgICAgICAgICAgICAgIG1CdWlsZGVyLmFwcGVuZChlbmNvZGVkUHJlZml4KTsKLSAgICAgICAgICAgICAgICBtQnVpbGRlci5hcHBlbmQoVkNBUkRfSVRFTV9TRVBBUkFUT1IpOwotICAgICAgICAgICAgICAgIG1CdWlsZGVyLmFwcGVuZChlbmNvZGVkU3VmZml4KTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIG1CdWlsZGVyLmFwcGVuZChWQ0FSRF9FTkRfT0ZfTElORSk7Ci0KLSAgICAgICAgIC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ShkaXNwbGF5TmFtZSkpOwotICAgICAgICAgICAgZmluYWwgU3RyaW5nIGVuY29kZWREaXNwbGF5TmFtZSA9Ci0gICAgICAgICAgICAgICAgICAgIHJlYWxseVVzZVF1b3RlZFByaW50YWJsZVRvRGlzcGxheU5hbWUgPwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVuY29kZVF1b3RlZFByaW50YWJsZShkaXNwbGF5TmFtZSkgOgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlc2NhcGVDaGFyYWN0ZXJzKGRpc3BsYXlOYW1lKTsKLQotICAgICAgICAgICAgbUJ1aWxkZXIuYXBwZW5kKFZDYXJkQ29uc3RhbnRzLlBST1BFUlRZX04pOwotICAgICAgICAgICAgaWYgKHNob3VsZEFwcGVuZENoYXJzZXRQYXJhbShkaXNwbGF5TmFtZSkpIHsKLSAgICAgICAgICAgICAgICBtQnVpbGRlci5hcHBlbmQoVkNBUkRfUEFSQU1fU0VQQVJBVE9SKTsKLSAgICAgICAgICAgICAgICBtQnVpbGRlci5hcHBlbmQobVZDYXJkQ2hhcnNldFBhcmFtZXRlcik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAocmVhbGx5VXNlUXVvdGVkUHJpbnRhYmxlVG9EaXNwbGF5TmFtZSkgewotICAgICAgICAgICAgICAgIG1CdWlsZGVyLmFwcGVuZChWQ0FSRF9QQVJBTV9TRVBBUkFUT1IpOwotICAgICAgICAgICAgICAgIG1CdWlsZGVyLmFwcGVuZChWQ0FSRF9QQVJBTV9FTkNPRElOR19RUCk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBtQnVpbGRlci5hcHBlbmQoVkNBUkRfREFUQV9TRVBBUkFUT1IpOwotICAgICAgICAgICAgbUJ1aWxkZXIuYXBwZW5kKGVuY29kZWREaXNwbGF5TmFtZSk7Ci0gICAgICAgICAgICBtQnVpbGRlci5hcHBlbmQoVkNBUkRfSVRFTV9TRVBBUkFUT1IpOwotICAgICAgICAg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ZE5hbWUuUEhPTkVUSUNfTUlERExFX05BTUUpOwotICAgICAgICAgICAgZmluYWwgU3RyaW5nIHRtcFBob25ldGljR2l2ZW5OYW1lID0KLSAgICAgICAgICAgICAgICBjb250ZW50VmFsdWVzLmdldEFzU3RyaW5nKFN0cnVjdHVyZWROYW1lLlBIT05FVElDX0dJVkVOX05BTUUpOwotICAgICAgICAgICAgaWYgKG1OZWVkc1RvQ29udmVydFBob25ldGljU3RyaW5nKSB7Ci0gICAgICAgICAgICAgICAgcGhvbmV0aWNGYW1pbHlOYW1lID0gVkNhcmRVdGlscy50b0hhbGZXaWR0aFN0cmluZyh0bXBQaG9uZXRpY0ZhbWlseU5hbWUpOwotICAgICAgICAgICAgICAgIHBob25ldGljTWlkZGxlTmFtZSA9IFZDYXJkVXRpbHMudG9IYWxmV2lkdGhTdHJpbmcodG1wUGhvbmV0aWNNaWRkbGVOYW1lKTsKLSAgICAgICAgICAgICAgICBwaG9uZXRpY0dpdmVuTmFtZSA9IFZDYXJkVXRpbHMudG9IYWxmV2lkdGhTdHJpbmcodG1wUGhvbmV0aWNHaXZlbk5hbWUpOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBwaG9uZXRpY0ZhbWlseU5hbWUgPSB0bXBQaG9uZXRpY0ZhbWlseU5hbWU7Ci0gICAgICAgICAgICAgICAgcGhvbmV0aWNNaWRkbGVOYW1lID0gdG1wUGhvbmV0aWNNaWRkbGVOYW1lOwotICAgICAgICAgICAgICAgIHBob25ldGljR2l2ZW5OYW1lID0gdG1wUGhvbmV0aWNHaXZlbk5hbWU7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQotICAgICAgICBpZiAoVGV4dFV0aWxzLmlzRW1wdHkocGhvbmV0aWNGYW1pbHlOYW1lKQotICAgICAgICAgICAgICAgICYmIFRleHRVdGlscy5pc0VtcHR5KHBob25ldGljTWlkZGxlTmFtZSkKLSAgICAgICAgICAgICAgICAmJiBUZXh0VXRpbHMuaXNFbXB0eShwaG9uZXRpY0dpdmVuTmFtZSkpIHsKLSAgICAgICAgICAgIGlmIChtSXNEb0NvTW8pIHsKLSAgICAgICAgICAgICAgICBtQnVpbGRlci5hcHBlbmQoVkNhcmRDb25zdGFudHMuUFJPUEVSVFlfU09VTkQpOwotICAgICAgICAgICAgICAgIG1CdWlsZGVyLmFwcGVuZChWQ0FSRF9QQVJBTV9TRVBBUkFUT1IpOwotICAgICAgICAgICAgICAgIG1CdWlsZGVyLmFwcGVuZChWQ2FyZENvbnN0YW50cy5QQVJBTV9UWVBFX1hfSVJNQ19OKTsKLSAgICAgICAgICAgICAgICBtQnVpbGRlci5hcHBlbmQoVkNBUkRfREFUQV9TRVBBUkFUT1IpOwotICAgICAgICAgICAgICAgIG1CdWlsZGVyLmFwcGVuZChWQ0FSRF9JVEVNX1NFUEFSQVRPUik7Ci0gICAgICAgICAgICAgICAgbUJ1aWxkZXIuYXBwZW5kKFZDQVJEX0lURU1fU0VQQVJBVE9SKTsKLSAgICAgICAgICAgICAgICBtQnVpbGRlci5hcHBlbmQoVkNBUkRfSVRFTV9TRVBBUkFUT1IpOwotICAgICAgICAgICAgICAgIG1CdWlsZGVyLmFwcGVuZChWQ0FSRF9JVEVNX1NFUEFSQVRPUik7Ci0gICAgICAgICAgICAgICAgbUJ1aWxkZXIuYXBwZW5kKFZDQVJEX0VORF9PRl9MSU5FKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgfQotCi0gICAgICAgIC8vIFRyeSB0byBlbWl0IHRoZSBmaWVsZChzKSByZWxhdGVkIHRvIHBob25ldGljIG5hbWUuCi0gICAgICAgIGlmIChtSXNWMzApIHsKLSAgICAgICAgICAgIGZpbmFsIFN0cmluZyBzb3J0U3RyaW5nID0gVkNhcmRVdGlscwotICAgICAgICAgICAgICAgICAgICAuY29uc3RydWN0TmFtZUZyb21FbGVtZW50cyhtVkNhcmRUeXBlLAotICAgICAgICAgICAgICAgICAgICAgICA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ZWQgYnkKLSAgICAgICAgICAgIC8vICAgICAgIGEgbG90IG9mIEphcGFuZXNlIG1vYmlsZSBwaG9uZXMuIFRoaXMgaXMgIlgtIiBwcm9wZXJ0eSwgc28KLSAgICAgICAgICAgIC8vICAgICAgIGFueSBwYXJzZXIgaG9wZWZ1bGx5IHdvdWxkIG5vdCBnZXQgY29uZnVzZWQgd2l0aCB0aGlzLgotICAgICAgICAgICAgLy8KLSAgICAgICAgICAgIC8vICAgICAgIEFsc28sIERvQ29NbydzIHNwZWNpZmljYXRpb24gcmVxdWlyZXMgdkNhcmQgY29tcG9zZXIgdG8gdXNlIGp1c3QgdGhlIGZpcnN0Ci0gICAgICAgICAgICAvLyAgICAgICBjb2x1bW4uCi0gICAgICAgICAgICAvLyAgICAgICBpLmUuCi0gICAgICAgICAgICAvLyAgICAgICBvICBTT1VORDtYLUlSTUMtTjpNaXlha2F3YSBEYWlzdWtlOzs7OwotICAgICAgICAgICAgLy8gICAgICAgeCAgU09VTkQ7WC1JUk1DLU46TWl5YWthd2E7RGFpc3VrZTs7OwotICAgICAgICAgICAgbUJ1aWxkZXIuYXBwZW5kKFZDYXJkQ29uc3RhbnRzLlBST1BFUlRZX1NPVU5EKTsKLSAgICAgICAgICAgIG1CdWlsZGVyLmFwcGVuZChWQ0FSRF9QQVJBTV9TRVBBUkFUT1IpOwotICAgICAgICAgICAgbUJ1aWxkZXIuYXBwZW5kKFZDYXJkQ29uc3RhbnRzLlBBUkFNX1RZUEVfWF9JUk1DX04pOwotCi0gICAgICAgICAgICBib29sZWFuIHJlYWxseVVzZVF1b3RlZFByaW50YWJsZSA9Ci0gICAgICAgICAgICAgICAgKCFtUmVmcmFpbnNRUFRvTmFtZVByb3BlcnRpZXMKLSAgICAgICAgICAgICAgICAgICAgICAgICYmICEoVkNhcmRVdGlscy5jb250YWluc09ubHlOb25DckxmUHJpbnRhYmxlQXNjaWkoCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBob25ldGljRmFtaWx5TmFtZSkKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJiYgVkNhcmRVdGlscy5jb250YWluc09ubHlOb25DckxmUHJpbnRhYmxlQXNjaWkoCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGhvbmV0aWNNaWRkbGVOYW1lKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmJiBWQ2FyZFV0aWxzLmNvbnRhaW5zT25seU5vbkNyTGZQcmludGFibGVBc2NpaSgKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwaG9uZXRpY0dpdmVuTmFtZSkpKTsKLQotICAgICAgICAgICAgZmluYWwgU3RyaW5nIGVuY29kZWRQaG9uZXRpY0ZhbWlseU5hbWU7Ci0gICAgICAgICAgICBmaW5hbCBTdHJpbmcgZW5jb2RlZFBob25ldGljTWlkZGxlTmFtZTsKLSAgICAgICAgICAgIGZpbmFsIFN0cmluZyBlbmNvZGVkUGhvbmV0aWNHaXZlbk5hbWU7Ci0gICAgICAgICAgICBpZiAocmVhbGx5VXNlUXVvdGVkUHJpbnRhYmxlKSB7Ci0gICAgICAgICAgICAgICAgZW5jb2RlZFBob25ldGljRmFtaWx5TmFtZSA9IGVuY29kZVF1b3RlZFByaW50YWJsZShwaG9uZXRpY0ZhbWlseU5hbWUpOwotICAgICAgICAgICAgICAgIGVuY29kZWRQaG9uZXRpY01pZGRsZU5hbWUgPSBlbmNvZGVRdW90ZWRQcmludGFibGUocGhvbmV0aWNNaWRkbGVOYW1lKTsKLSAgICAgICAgICAgICAgICBlbmNvZGVkUGhvbmV0aWNHaXZlbk5hbWUgPSBlbmNvZGVRdW90ZWRQcmludGFibGUocGhvbmV0aWNHaXZlbk5hbWUpOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBlbmNvZGVkUGhvbmV0aWNGYW1pbHlOYW1lID0gZXNjYXBlQ2hhcmFjdGVycyhwaG9uZXRpY0ZhbWlseU5hbWUpOwotICAgICAgICAgICAgICAgIGVuY29kZWRQaG9uZXRpY01pZGRsZU5hbWUgPSBlc2NhcGVDaGFyYWN0ZXJzKHBob25ldGljTWlkZGxlTmFtZSk7Ci0gICAgICAgICAgICAgICAgZW5jb2RlZFBob25ldGljR2l2ZW5OYW1lID0gZXNjYXBlQ2hhcmFjdGVycyhwaG9uZXRpY0dpdmVuTmFtZSk7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIGlmIChzaG91bGRBcHBlbmRDaGFyc2V0UGFyYW0oZW5jb2RlZFBob25ldGljRmFtaWx5TmFtZSwKLSAgICAgICAgICAgICAgICAgICAgZW5jb2RlZFBob25ldGljTWlkZGxlTmFtZSwgZW5jb2RlZFBob25ldGljR2l2ZW5OYW1lKSkgewotICAgICAgICAgICAgICAgIG1CdWlsZGVyLmFwcGVuZChWQ0FSRF9QQVJBTV9TRVBBUkFUT1IpOwotICAgICAgICAgICAgICAgIG1CdWlsZGVyLmFwcGVuZChtVkNhcmRDaGFyc2V0UGFyYW1ldGVyKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIG1CdWlsZGVyLmFwcGVuZChWQ0FSRF9EQVRBX1NFUEFSQVRPUik7Ci0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgYm9vbGVhbiBmaXJzdCA9IHRydWU7Ci0gICAgICAgICAgICAgICAgaWYgKCFUZXh0VXRpbHMuaXNFbXB0eShlbmNvZGVkUGhvbmV0aWNGYW1pbHlOYW1lKSkgewotICAgICAgICAgICAgICAgICAgICBtQnVpbGRlci5hcHBlbmQoZW5jb2RlZFBob25ldGljRmFtaWx5TmFtZSk7Ci0gICAgICAgICAgICAgICAgICAgIGZpcnN0ID0gZmFsc2U7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGlmICghVGV4dFV0aWxzLmlzRW1wdHkoZW5jb2RlZFBob25ldGljTWlkZGxlTmFtZSkpIHsKLSAgICAgICAgICAgICAgICAgICAgaWYgKGZpcnN0KSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBmaXJzdCA9IGZhbHNlOwotICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICAgICAgbUJ1aWxkZXIuYXBwZW5kKCcgJyk7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgbUJ1aWxkZXIuYXBwZW5kKGVuY29kZWRQaG9uZXRpY01pZGRsZU5hbWUpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBpZiAoIVRleHRVdGlscy5pc0VtcHR5KGVuY29kZWRQaG9uZXRpY0dpdmVuTmFtZSkpIHsKLSAgICAgICAgICAgICAgICAgICAgaWYgKCFmaXJzdCkgewotICAgICAgICAgICAgICAgICAgICAgICAgbUJ1aWxkZXIuYXBwZW5kKCcgJyk7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgbUJ1aWxkZXIuYXBwZW5kKGVuY29kZWRQaG9uZXRpY0dpdmVuTmFtZSk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICAgICAgbUJ1aWxkZXIuYXBwZW5kKFZDQVJEX0lURU1fU0VQQVJBVE9SKTsKLSAgICAgICAgICAgIG1CdWlsZGVyLmFwcGVuZChWQ0FSRF9JVEVNX1NFUEFSQVRPUik7Ci0gICAgICAgICAgICBtQnVpbGRlci5hcHBlbmQoVkNBUkRfSVRFTV9TRVBBUkFUT1IpOwotICAgICAgICAgICAgbUJ1aWxkZXIuYXBwZW5kKFZDQVJEX0lURU1fU0VQQVJBVE9SKTsKLSAgICAgICAgICAgIG1CdWlsZGVyLmFwcGVuZChWQ0FSRF9FTkRfT0ZfTElORSk7Ci0gICAgICAgIH0KLQotICAgICAgICBpZiAobVVzZXNEZWZhY3RQcm9wZXJ0eSkgewotICAgICAgICAgICAgaWYgKCFUZXh0VXRpbHMuaXNFbXB0eShwaG9uZXRpY0dpdmVuTmFtZSkpIHsKLSAgICAgICAgICAgICAgICBmaW5hbCBib29sZWFuIHJlYWxseVVzZVF1b3RlZFByaW50YWJsZSA9Ci0gICAgICAgICAgICAgICAgICAgIChtU2hvdWxkVXNlUXVvdGVkUHJpbnRhYmxlICYmCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgIVZDYXJkVXRpbHMuY29udGFpbnNPbmx5Tm9uQ3JMZlByaW50YWJsZUFzY2lpKHBob25ldGljR2l2ZW5OYW1lKSk7Ci0gICAgICAgICAgICAgICAgZmluYWwgU3RyaW5nIGVuY29kZWRQaG9uZXRpY0dpdmVuTmFtZTsKLSAgICAgICAgICAgICAgICBpZiAocmVhbGx5VXNlUXVvdGVkUHJpbnRhYmxlKSB7Ci0gICAgICAgICAgICAgICAgICAgIGVuY29kZWRQaG9uZXRpY0dpdmVuTmFtZSA9IGVuY29kZVF1b3RlZFByaW50YWJsZShwaG9uZXRpY0dpdmVuTmFtZSk7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgZW5jb2RlZFBob25ldGljR2l2ZW5OYW1lID0gZXNjYXBlQ2hhcmFjdGVycyhwaG9uZXRpY0dpdmVuTmFtZSk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIG1CdWlsZGVyLmFwcGVuZChWQ2FyZENvbnN0YW50cy5QUk9QRVJUWV9YX1BIT05FVElDX0ZJUlNUX05BTUUpOwotICAgICAgICAgICAgICAgIGlmIChzaG91bGRBcHBlbmRDaGFyc2V0UGFyYW0ocGhvbmV0aWNHaXZlbk5hbWUpKSB7Ci0gICAgICAgICAgICAgICAgICAgIG1CdWlsZGVyLmFwcGVuZChWQ0FSRF9QQVJBTV9TRVBBUkFUT1IpOwotICAgICAgICAgICAgICAgICAgICBtQnVpbGRlci5hcHBlbmQobVZDYXJkQ2hhcnNldFBhcmFtZXRlcik7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGlmIChyZWFsbHlVc2VRdW90ZWRQcmludGFibGUpIHsKLSAgICAgICAgICAgICAgICAgICAgbUJ1aWxkZXIuYXBwZW5kKFZDQVJEX1BBUkFNX1NFUEFSQVRPUik7Ci0gICAgICAgICAgICAgICAgICAgIG1CdWlsZGVyLmFwcGVuZChWQ0FSRF9QQVJBTV9FTkNPRElOR19RUCk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIG1CdWlsZGVyLmFwcGVuZChWQ0FSRF9EQVRBX1NFUEFSQVRPUik7Ci0gICAgICAgICAgICAgICAgbUJ1aWxkZXIuYXBwZW5kKGVuY29kZWRQaG9uZXRpY0dpdmVuTmFtZSk7Ci0gICAgICAgICAgICAgICAgbUJ1aWxkZXIuYXBwZW5kKFZDQVJEX0VORF9PRl9MSU5FKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmICghVGV4dFV0aWxzLmlzRW1wdHkocGhvbmV0aWNNaWRkbGVOYW1lKSkgewotICAgICAgICAgICAgICAgIGZpbmFsIGJvb2xlYW4gcmVhbGx5VXNlUXVvdGVkUHJpbnRhYmxlID0KLSAgICAgICAgICAgICAgICAgICAgKG1TaG91bGRVc2VRdW90ZWRQcmludGFibGUgJiYKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAhVkNhcmRVdGlscy5jb250YWluc09ubHlOb25DckxmUHJpbnRhYmxlQXNjaWkocGhvbmV0aWNNaWRkbGVOYW1lKSk7Ci0gICAgICAgICAgICAgICAgZmluYWwgU3RyaW5nIGVuY29kZWRQaG9uZXRpY01pZGRsZU5hbWU7Ci0gICAgICAgICAgICAgICAgaWYgKHJlYWxseVVzZVF1b3RlZFByaW50YWJsZSkgewotICAgICAgICAgICAgICAgICAgICBlbmNvZGVkUGhvbmV0aWNNaWRkbGVOYW1lID0gZW5jb2RlUXVvdGVkUHJpbnRhYmxlKHBob25ldGljTWlkZGxlTmFtZSk7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgZW5jb2RlZFBob25ldGljTWlkZGxlTmFtZSA9IGVzY2FwZUNoYXJhY3RlcnMocGhvbmV0aWNNaWRkbGVOYW1lKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgbUJ1aWxkZXIuYXBwZW5kKFZDYXJkQ29uc3RhbnRzLlBST1BFUlRZX1hfUEhPTkVUSUNfTUlERExFX05BTUUpOwotICAgICAgICAgICAgICAgIGlmIChzaG91bGRBcHBlbmRDaGFyc2V0UGFyYW0ocGhvbmV0aWNNaWRkbGVOYW1lKSkgewotICAgICAgICAgICAgICAgICAgICBtQnVpbGRlci5hcHBlbmQoVkNBUkRfUEFSQU1fU0VQQVJBVE9SKTsKLSAgICAgICAgICAgICAgICAgICAgbUJ1aWxkZXIuYXBwZW5kKG1WQ2FyZENoYXJzZXRQYXJhbWV0ZXIpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBpZiAocmVhbGx5VXNlUXVvdGVkUHJpbnRhYmxlKSB7Ci0gICAgICAgICAgICAgICAgICAgIG1CdWlsZGVyLmFwcGVuZChWQ0FSRF9QQVJBTV9TRVBBUkFUT1IpOwotICAgICAgICAgICAgICAgICAgICBtQnVpbGRlci5hcHBlbmQoVkNBUkRfUEFSQU1fRU5DT0RJTkdfUVApOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBtQnVpbGRlci5hcHBlbmQoVkNBUkRfREFUQV9TRVBBUkFUT1IpOwotICAgICAgICAgICAgICAgIG1CdWlsZGVyLmFwcGVuZChlbmNvZGVkUGhvbmV0aWNNaWRkbGVOYW1lKTsKLSAgICAgICAgICAgICAgICBtQnVpbGRlci5hcHBlbmQoVkNBUkRfRU5EX09GX0xJTkUpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKCFUZXh0VXRpbHMuaXNFbXB0eShwaG9uZXRpY0ZhbWlseU5hbWUpKSB7Ci0gICAgICAgICAgICAgICAgZmluYWwgYm9vbGVhbiByZWFsbHlVc2VRdW90ZWRQcmludGFibGUgPQotICAgICAgICAgICAgICAgICAgICAobVNob3VsZFVzZVF1b3RlZFByaW50YWJsZSAmJgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICFWQ2FyZFV0aWxzLmNvbnRhaW5zT25seU5vbkNyTGZQcmludGFibGVBc2NpaShwaG9uZXRpY0ZhbWlseU5hbWUpKTsKLSAgICAgICAgICAgICAgICBmaW5hbCBTdHJpbmcgZW5jb2RlZFBob25ldGljRmFtaWx5TmFtZTsKLSAgICAgICAgICAgICAgICBpZiAocmVhbGx5VXNlUXVvdGVkUHJpbnRhYmxlKSB7Ci0gICAgICAgICAgICAgICAgICAgIGVuY29kZWRQaG9uZXRpY0ZhbWlseU5hbWUgPSBlbmNvZGVRdW90ZWRQcmludGFibGUocGhvbmV0aWNGYW1pbHlOYW1lKTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICBlbmNvZGVkUGhvbmV0aWNGYW1pbHlOYW1lID0gZXNjYXBlQ2hhcmFjdGVycyhwaG9uZXRpY0ZhbWlseU5hbWUpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBtQnVpbGRlci5hcHBlbmQoVkNhcmRDb25zdGFudHMuUFJPUEVSVFlfWF9QSE9ORVRJQ19MQVNUX05BTUUpOwotICAgICAgICAgICAgICAgIGlmIChzaG91bGRBcHBlbmRDaGFyc2V0UGFyYW0ocGhvbmV0aWNGYW1pbHlOYW1lKSkgewotICAgICAgICAgICAgICAgICAgICBtQnVpbGRlci5hcHBlbmQoVkNBUkRfUEFSQU1fU0VQQVJBVE9SKTsKLSAgICAgICAgICAgICAgICAgICAgbUJ1aWxkZXIuYXBwZW5kKG1WQ2FyZENoYXJzZXRQYXJhbWV0ZXIpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBpZiAocmVhbGx5VXNlUXVvdGVkUHJpbnRhYmxlKSB7Ci0gICAgICAgICAgICAgICAgICAgIG1CdWlsZGVyLmFwcGVuZChWQ0FSRF9QQVJBTV9TRVBBUkFUT1IpOwotICAgICAgICAgICAgICAgICAgICBtQnVpbGRlci5hcHBlbmQoVkNBUkRfUEFSQU1fRU5DT0RJTkdfUVApOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBtQnVpbGRlci5hcHBlbmQoVkNBUkRfREFUQV9TRVBBUkFUT1IpOwotICAgICAgICAgICAgICAgIG1CdWlsZGVyLmFwcGVuZChlbmNvZGVkUGhvbmV0aWNGYW1pbHlOYW1lKTsKLSAgICAgICAgICAgICAgICBtQnVpbGRlci5hcHBlbmQoVkNBUkRfRU5EX09GX0xJTkUpOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgfQotCi0gICAgcHVibGljIFZDYXJkQnVpbGRlciBhcHBlbmROaWNrTmFtZXMoZmluYWwgTGlzdDxDb250ZW50VmFsdWVzPiBjb250ZW50VmFsdWVzTGlzdCkgewotICAgICAgICBmaW5hbCBib29sZWFuIHVzZUFuZHJvaWRQcm9wZXJ0eTsKLSAgICAgICAgaWYgKG1Jc1YzMCkgewotICAgICAgICAgICAgdXNlQW5kcm9pZFByb3BlcnR5ID0gZmFsc2U7Ci0gICAgICAgIH0gZWxzZSBpZiAobVVzZXNBbmRyb2lkUHJvcGVydHkpIHsKLSAgICAgICAgICAgIHVzZUFuZHJvaWRQcm9wZXJ0eSA9IHRydWU7Ci0gICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAvLyBUaGVyZSdzIG5vIHdheSB0byBhZGQgdGhpcyBmaWVsZC4KLSAgICAgICAgICAgIHJldHVybiB0aGlzOwotICAgICAgICB9Ci0gICAgICAgIGlmIChjb250ZW50VmFsdWVzTGlzdCAhPSBudWxsKSB7Ci0gICAgICAgICAgICBmb3IgKENvbnRlbnRWYWx1ZXMgY29udGVudFZhbHVlcyA6IGNvbnRlbnRWYWx1ZXNMaXN0KSB7Ci0gICAgICAgICAgICAgICAgZmluYWwgU3RyaW5nIG5pY2tuYW1lID0gY29udGVudFZhbHVlcy5nZXRBc1N0cmluZyhOaWNrbmFtZS5OQU1FKTsKLSAgICAgICAgICAgICAgICBpZiAoVGV4dFV0aWxzLmlzRW1wdHkobmlja25hbWUpKSB7Ci0gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBpZiAodXNlQW5kcm9pZFByb3BlcnR5KSB7Ci0gICAgICAgICAgICAgICAgICAgIGFwcGVuZEFuZHJvaWRTcGVjaWZpY1Byb3BlcnR5KE5pY2tuYW1lLkNPTlRFTlRfSVRFTV9UWVBFLCBjb250ZW50VmFsdWVzKTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICBhcHBlbmRMaW5lV2l0aENoYXJzZXRBbmRRUERldGVjdGlvbihWQ2FyZENvbnN0YW50cy5QUk9QRVJUWV9OSUNLTkFNRSwgbmlja25hbWUpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgICAgICByZXR1cm4gdGhpczsKLSAgICB9Ci0KLSAgICBwdWJsaWMgVkNhcmRCdWlsZGVyIGFwcGVuZFBob25lcyhmaW5hbCBMaXN0PENvbnRlbnRWYWx1ZXM+IGNvbnRlbnRWYWx1ZXNMaXN0KSB7Ci0gICAgICAgIGJvb2xlYW4gcGhvbmVMaW5lRXhpc3RzID0gZmFsc2U7Ci0gICAgICAgIGlmIChjb250ZW50VmFsdWVzTGlzdCAhPSBudWxsKSB7Ci0gICAgICAgICAgICBTZXQ8U3RyaW5nPiBwaG9uZVNldCA9IG5ldyBIYXNoU2V0PFN0cmluZz4oKTsKLSAgICAgICAgICAgIGZvciAoQ29udGVudFZhbHVlcyBjb250ZW50VmFsdWVzIDogY29udGVudFZhbHVlc0xpc3QpIHsKLSAgICAgICAgICAgICAgICBmaW5hbCBJbnRlZ2VyIHR5cGVBc09iamVjdCA9IGNvbnRlbnRWYWx1ZXMuZ2V0QXNJbnRlZ2VyKFBob25lLlRZUEUpOwotICAgICAgICAgICAgICAgIGZpbmFsIFN0cmluZyBsYWJlbCA9IGNvbnRlbnRWYWx1ZXMuZ2V0QXNTdHJpbmcoUGhvbmUuTEFCRUwpOwotICAgICAgICAgICAgICAgIGZpbmFsIEludGVnZXIgaXNQcmltYXJ5QXNJbnRlZ2VyID0gY29udGVudFZhbHVlcy5nZXRBc0ludGVnZXIoUGhvbmUuSVNfUFJJTUFSWSk7Ci0gICAgICAgICAgICAgICAgZmluYWwgYm9vbGVhbiBpc1ByaW1hcnkgPSAoaXNQcmltYXJ5QXNJbnRlZ2VyICE9IG51bGwgPwotICAgICAgICAgICAgICAgICAgICAgICAgKGlzUHJpbWFyeUFzSW50ZWdlciA+IDApIDogZmFsc2UpOwotICAgICAgICAgICAgICAgIFN0cmluZyBwaG9uZU51bWJlciA9IGNvbnRlbnRWYWx1ZXMuZ2V0QXNTdHJpbmcoUGhvbmUuTlVNQkVSKTsKLSAgICAgICAgICAgICAgICBpZiAocGhvbmVOdW1iZXIgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICBwaG9uZU51bWJlciA9IHBob25lTnVtYmVyLnRyaW0oKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgaWYgKFRleHRVdGlscy5pc0VtcHR5KHBob25lTnVtYmVyKSkgewotICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICAvLyBQQUdFUiBudW1iZXIgbmVlZHMgdW5mb3JtYXR0ZWQgInBob25lIG51bWJlciIuCi0gICAgICAgICAgICAgICAgZmluYWwgaW50IHR5cGUgPSAodHlwZUFzT2JqZWN0ICE9IG51bGwgPyB0eXBlQXNPYmplY3QgOiBERUZBVUxUX1BIT05FX1RZUEUpOwotICAgICAgICAgICAgICAgIGlmICh0eXBlID09IFBob25lLlRZUEVfUEFHRVIgfHwKLSAgICAgICAgICAgICAgICAgICAgICAgIFZDYXJkQ29uZmlnLnJlZnJhaW5QaG9uZU51bWJlckZvcm1hdHRpbmcobVZDYXJkVHlwZSkpIHsKLSAgICAgICAgICAgICAgICAgICAgcGhvbmVMaW5lRXhpc3RzID0gdHJ1ZTsKLSAgICAgICAgICAgICAgICAgICAgaWYgKCFwaG9uZVNldC5jb250YWlucyhwaG9uZU51bWJlcikpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHBob25lU2V0LmFkZChwaG9uZU51bWJlcik7Ci0gICAgICAgICAgICAgICAgICAgICAgICBhcHBlbmRUZWxMaW5lKHR5cGUsIGxhYmVsLCBwaG9uZU51bWJlciwgaXNQcmltYXJ5KTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIGZpbmFsIExpc3Q8U3RyaW5nPiBwaG9uZU51bWJlckxpc3QgPSBzcGxpdEFuZFRyaW1QaG9uZU51bWJlcnMocGhvbmVOdW1iZXIpOwotICAgICAgICAgICAgICAgICAgICBpZiAocGhvbmVOdW1iZXJMaXN0LmlzRW1wdHkoKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgcGhvbmVMaW5lRXhpc3RzID0gdHJ1ZTsKLSAgICAgICAgICAgICAgICAgICAgZm9yIChTdHJpbmcgYWN0dWFsUGhvbmVOdW1iZXIgOiBwaG9uZU51bWJlckxpc3QpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmICghcGhvbmVTZXQuY29udGFpbnMoYWN0dWFsUGhvbmVOdW1iZXIpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgZmluYWwgaW50IGZvcm1hdCA9IFZDYXJkVXRpbHMuZ2V0UGhvbmVOdW1iZXJGb3JtYXQobVZDYXJkVHlwZSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgZmluYWwgU3RyaW5nIGZvcm1hdHRlZFBob25lTnVtYmVyID0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBob25lTnVtYmVyVXRpbHMuZm9ybWF0TnVtYmVyKGFjdHVhbFBob25lTnVtYmVyLCBmb3JtYXQpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBob25lU2V0LmFkZChhY3R1YWxQaG9uZU51bWJlcik7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgYXBwZW5kVGVsTGluZSh0eXBlLCBsYWJlbCwgZm9ybWF0dGVkUGhvbmVOdW1iZXIsIGlzUHJpbWFyeSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIH0gIC8vIGZvciAoU3RyaW5nIGFjdHVhbFBob25lTnVtYmVyIDogcGhvbmVOdW1iZXJMaXN0KSB7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgaWYgKCFwaG9uZUxpbmVFeGlzdHMgJiYgbUlzRG9Db01vKSB7Ci0gICAgICAgICAgICBhcHBlbmRUZWxMaW5lKFBob25lLlRZUEVfSE9NRSwgIiIsICIiLCBmYWxzZSk7Ci0gICAgICAgIH0KLQotICAgICAgICByZXR1cm4gdGhpczsKLSAgICB9Ci0KLSAgICAvKioKLSAgICAgKiA8cD4KLSAgICAgKiBTcGxpdHMgYSBnaXZlbiBzdHJpbmcgZXhwcmVzc2luZyBwaG9uZSBudW1iZXJzIGludG8gc2V2ZXJhbCBzdHJpbmdzLCBhbmQgcmVtb3ZlCi0gICAgICogdW5uZWNlc3NhcnkgY2hhcmFjdGVycyBpbnNpZGUgdGhlbS4gVGhlIHNpemUgb2YgYSByZXR1cm5lZCBsaXN0IGJlY29tZXMgMSB3aGVuCi0gICAgICogbm8gc3BsaXQgaXMgbmVlZGVkLgotICAgICAqIDwvcD4KLSA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NlaXZlcnMuCi0gICAgICogPC9wPgotICAgICAqLwotICAgIHByaXZhdGUgTGlzdDxTdHJpbmc+IHNwbGl0QW5kVHJpbVBob25lTnVtYmVycyhmaW5hbCBTdHJpbmcgcGhvbmVOdW1iZXIpIHsKLSAgICAgICAgZmluYWwgTGlzdDxTdHJpbmc+IHBob25lTGlzdCA9IG5ldyBBcnJheUxpc3Q8U3RyaW5nPigpOwotCi0gICAgICAgIFN0cmluZ0J1aWxkZXIgYnVpbGRlciA9IG5ldyBTdHJpbmdCdWlsZGVyKCk7Ci0gICAgICAgIGZpbmFsIGludCBsZW5ndGggPSBwaG9uZU51bWJlci5sZW5ndGgoKTsKLSAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBsZW5ndGg7IGkrKykgewotICAgICAgICAgICAgZmluYWwgY2hhciBjaCA9IHBob25lTnVtYmVyLmNoYXJBdChpKTsKLSAgICAgICAgICAgIGlmIChDaGFyYWN0ZXIuaXNEaWdpdChjaCkgfHwgY2ggPT0gJysnKSB7Ci0gICAgICAgICAgICAgICAgYnVpbGRlci5hcHBlbmQoY2gpOwotICAgICAgICAgICAgfSBlbHNlIGlmICgoY2ggPT0gJzsnIHx8IGNoID09ICdcbicpICYmIGJ1aWxkZXIubGVuZ3RoKCkgPiAwKSB7Ci0gICAgICAgICAgICAgICAgcGhvbmVMaXN0LmFkZChidWlsZGVyLnRvU3RyaW5nKCkpOwotICAgICAgICAgICAgICAgIGJ1aWxkZXIgPSBuZXcgU3RyaW5nQnVpbGRlcigpOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgICAgIGlmIChidWlsZGVyLmxlbmd0aCgpID4gMCkgewotICAgICAgICAgICAgcGhvbmVMaXN0LmFkZChidWlsZGVyLnRvU3RyaW5nKCkpOwotICAgICAgICB9Ci0KLSAgICAgICAgcmV0dXJuIHBob25lTGlzdDsKLSAgICB9Ci0KLSAgICBwdWJsaWMgVkNhcmRCdWlsZGVyIGFwcGVuZEVtYWlscyhmaW5hbCBMaXN0PENvbnRlbnRWYWx1ZXM+IGNvbnRlbnRWYWx1ZXNMaXN0KSB7Ci0gICAgICAgIGJvb2xlYW4gZW1haWxBZGRyZXNzRXhpc3RzID0gZmFsc2U7Ci0gICAgICAgIGlmIChjb250ZW50VmFsdWVzTGlzdCAhPSBudWxsKSB7Ci0gICAgICAgICAgICBmaW5hbCBTZXQ8U3RyaW5nPiBhZGRyZXNzU2V0ID0gbmV3IEhhc2hTZXQ8U3RyaW5nPigpOwotICAgICAgICAgICAgZm9yIChDb250ZW50VmFsdWVzIGNvbnRlbnRWYWx1ZXMgOiBjb250ZW50VmFsdWVzTGlzdCkgewotICAgICAgICAgICAgICAgIFN0cmluZyBlbWFpbEFkZHJlc3MgPSBjb250ZW50VmFsdWVzLmdldEFzU3RyaW5nKEVtYWlsLkRBVEEpOwotICAgICAgICAgICAgICAgIGlmIChlbWFpbEFkZHJlc3MgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICBlbWFpbEFkZHJlc3MgPSBlbWFpbEFkZHJlc3MudHJpbSgpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBpZiAoVGV4dFV0aWxzLmlzRW1wdHkoZW1haWxBZGRyZXNzKSkgewotICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgSW50ZWdlciB0eXBlQXNPYmplY3QgPSBjb250ZW50VmFsdWVzLmdldEFzSW50ZWdlcihFbWFpbC5UWVBFKTsKLSAgICAgICAgICAgICAgICBmaW5hbCBpbnQgdHlwZSA9ICh0eXBlQXNPYmplY3QgIT0gbnVsbCA/Ci0gICAgICAgICAgICAgICAgICAgICAgICB0eXBlQXNPYmplY3QgOiBERUZBVUxUX0VNQUlMX1RZUEUpOwotICAgICAgICAgICAgICAgIGZpbmFsIFN0cmluZyBsYWJlbCA9IGNvbnRlbnRWYWx1ZXMuZ2V0QXNTdHJpbmcoRW1haWwuTEFCRUw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0d2ljZSwKLSAgICAgICAgICAgIC8vIGJ1dCB0aGlzIGlzIGludGVudGlvbmFsLgotICAgICAgICAgICAgLy8KLSAgICAgICAgICAgIC8vIFFQIGVuY29kaW5nIG1heSBhZGQgbGluZSBmZWVkcyB3aGVuIG5lZWRlZCBhbmQgdGhlIHJlc3VsdCBvZgotICAgICAgICAgICAgLy8gLSBlbmNvZGVRdW90ZWRQcmludGFibGUocmF3TG9jYWxpdHkgKyAiICIgKyByYXdOZWlnaGJvcmhvb2QpCi0gICAgICAgICAgICAvLyBtYXkgYmUgZGlmZmVyZW50IGZyb20KLSAgICAgICAgICAgIC8vIC0gZW5jb2RlZExvY2FsaXR5ICsgIiAiICsgZW5jb2RlZE5laWdoYm9yaG9vZC4KLSAgICAgICAgICAgIC8vCi0gICAgICAgICAgICAvLyBXZSB1c2Ugc2FmZXIgd2F5LgotICAgICAgICAgICAgaWYgKFRleHRVdGlscy5pc0VtcHR5KHJhd0xvY2FsaXR5KSkgewotICAgICAgICAgICAgICAgIGlmIChUZXh0VXRpbHMuaXNFbXB0eShyYXdOZWlnaGJvcmhvb2QpKSB7Ci0gICAgICAgICAgICAgICAgICAgIHJhd0xvY2FsaXR5MiA9ICIiOwotICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIHJhd0xvY2FsaXR5MiA9IHJhd05laWdoYm9yaG9vZDsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIGlmIChUZXh0VXRpbHMuaXNFbXB0eShyYXdOZWlnaGJvcmhvb2QpKSB7Ci0gICAgICAgICAgICAgICAgICAgIHJhd0xvY2FsaXR5MiA9IHJhd0xvY2FsaXR5OwotICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIHJhd0xvY2FsaXR5MiA9IHJhd0xvY2FsaXR5ICsgIiAiICsgcmF3TmVpZ2hib3Job29kOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmIChyZWFsbHlVc2VRdW90ZWRQcmludGFibGUpIHsKLSAgICAgICAgICAgICAgICBlbmNvZGVkUG9Cb3ggPSBlbmNvZGVRdW90ZWRQcmludGFibGUocmF3UG9Cb3gpOwotICAgICAgICAgICAgICAgIGVuY29kZWRTdHJlZXQgPSBlbmNvZGVRdW90ZWRQcmludGFibGUocmF3U3RyZWV0KTsKLSAgICAgICAgICAgICAgICBlbmNvZGVkTG9jYWxpdHkgPSBlbmNvZGVRdW90ZWRQcmludGFibGUocmF3TG9jYWxpdHkyKTsKLSAgICAgICAgICAgICAgICBlbmNvZGVkUmVnaW9uID0gZW5jb2RlUXVvdGVkUHJpbnRhYmxlKHJhd1JlZ2lvbik7Ci0gICAgICAgICAgICAgICAgZW5jb2RlZFBvc3RhbENvZGUgPSBlbmNvZGVRdW90ZWRQcmludGFibGUocmF3UG9zdGFsQ29kZSk7Ci0gICAgICAgICAgICAgICAgZW5jb2RlZENvdW50cnkgPSBlbmNvZGVRdW90ZWRQcmludGFibGUocmF3Q291bnRyeSk7Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIGVuY29kZWRQb0JveCA9IGVzY2FwZUNoYXJhY3RlcnMocmF3UG9Cb3gpOwotICAgICAgICAgICAgICAgIGVuY29kZWRTdHJlZXQgPSBlc2NhcGVDaGFyYWN0ZXJzKHJhd1N0cmVldCk7Ci0gICAgICAgICAgICAgICAgZW5jb2RlZExvY2FsaXR5ID0gZXNjYXBlQ2hhcmFjdGVycyhyYXdMb2NhbGl0eTIpOwotICAgICAgICAgICAgICAgIGVuY29kZWRSZWdpb24gPSBlc2NhcGVDaGFyYWN0ZXJzKHJhd1JlZ2lvbik7Ci0gICAgICAgICAgICAgICAgZW5jb2RlZFBvc3RhbENvZGUgPSBlc2NhcGVDaGFyYWN0ZXJzKHJhd1Bvc3RhbENvZGUpOwotICAgICAgICAgICAgICAgIGVuY29kZ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LmFwcGVuZChlbmNvZGVkQ291bnRyeSk7Ci0gICAgICAgICAgICByZXR1cm4gbmV3IFBvc3RhbFN0cnVjdCgKLSAgICAgICAgICAgICAgICAgICAgcmVhbGx5VXNlUXVvdGVkUHJpbnRhYmxlLCBhcHBlbmRDaGFyc2V0LCBhZGRyZXNzQnVmZmVyLnRvU3RyaW5nKCkpOwotICAgICAgICB9IGVsc2UgeyAgLy8gVkNhcmRVdGlscy5hcmVBbGxFbXB0eShyYXdBZGRyZXNzQXJyYXkpID09IHRydWUKLSAgICAgICAgICAgIC8vIFRyeSB0byB1c2UgRk9STUFUVEVEX0FERFJFU1MgaW5zdGVhZC4KLSAgICAgICAgICAgIGZpbmFsIFN0cmluZyByYXdGb3JtYXR0ZWRBZGRyZXNzID0KLSAgICAgICAgICAgICAgICBjb250ZW50VmFsdWVzLmdldEFzU3RyaW5nKFN0cnVjdHVyZWRQb3N0YWwuRk9STUFUVEVEX0FERFJFU1MpOwotICAgICAgICAgICAgaWYgKFRleHRVdGlscy5pc0VtcHR5KHJhd0Zvcm1hdHRlZEFkZHJlc3MpKSB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBmaW5hbCBib29sZWFuIHJlYWxseVVzZVF1b3RlZFByaW50YWJsZSA9Ci0gICAgICAgICAgICAgICAgKG1TaG91bGRVc2VRdW90ZWRQcmludGFibGUgJiYKLSAgICAgICAgICAgICAgICAgICAgICAgICFWQ2FyZFV0aWxzLmNvbnRhaW5zT25seU5vbkNyTGZQcmludGFibGVBc2NpaShyYXdGb3JtYXR0ZWRBZGRyZXNzKSk7Ci0gICAgICAgICAgICBmaW5hbCBib29sZWFuIGFwcGVuZENoYXJzZXQgPQotICAgICAgICAgICAgICAgICFWQ2FyZFV0aWxzLmNvbnRhaW5zT25seVByaW50YWJsZUFzY2lpKHJhd0Zvcm1hdHRlZEFkZHJlc3MpOwotICAgICAgICAgICAgZmluYWwgU3Rya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ZXNzQnVmZmVyLmFwcGVuZChWQ0FSRF9JVEVNX1NFUEFSQVRPUik7Ci0gICAgICAgICAgICBhZGRyZXNzQnVmZmVyLmFwcGVuZChWQ0FSRF9JVEVNX1NFUEFSQVRPUik7Ci0gICAgICAgICAgICBhZGRyZXNzQnVmZmVyLmFwcGVuZChWQ0FSRF9JVEVNX1NFUEFSQVRPUik7Ci0gICAgICAgICAgICByZXR1cm4gbmV3IFBvc3RhbFN0cnVjdCgKLSAgICAgICAgICAgICAgICAgICAgcmVhbGx5VXNlUXVvdGVkUHJpbnRhYmxlLCBhcHBlbmRDaGFyc2V0LCBhZGRyZXNzQnVmZmVyLnRvU3RyaW5nKCkpOwotICAgICAgICB9Ci0gICAgfQotCi0gICAgcHVibGljIFZDYXJkQnVpbGRlciBhcHBlbmRJbXMoZmluYWwgTGlzdDxDb250ZW50VmFsdWVzPiBjb250ZW50VmFsdWVzTGlzdCkgewotICAgICAgICBpZiAoY29udGVudFZhbHVlc0xpc3QgIT0gbnVsbCkgewotICAgICAgICAgICAgZm9yIChDb250ZW50VmFsdWVzIGNvbnRlbnRWYWx1ZXMgOiBjb250ZW50VmFsdWVzTGlzdCkgewotICAgICAgICAgICAgICAgIGZpbmFsIEludGVnZXIgcHJvdG9jb2xBc09iamVjdCA9IGNvbnRlbnRWYWx1ZXMuZ2V0QXNJbnRlZ2VyKEltLlBST1RPQ09MKTsKLSAgICAgICAgICAgICAgICBpZiAocHJvdG9jb2xBc09iamVjdCA9PSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBmaW5hbCBTdHJpbmcgcHJvcGVydHlOYW1lID0gVkNhcmRVdGlscy5nZXRQcm9wZXJ0eU5hbWVGb3JJbShwcm90b2NvbEFzT2JqZWN0KTsKLSAgICAgICAgICAgICAgICBpZiAocHJvcGVydHlOYW1lID09IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgY29udGludWU7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIFN0cmluZyBkYXRhID0gY29udGVudFZhbHVlcy5nZXRBc1N0cmluZyhJbS5EQVRBKTsKLSAgICAgICAgICAgICAgICBpZiAoZGF0YSAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIGRhdGEgPSBkYXRhLnRyaW0oKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgaWYgKFRleHRVdGlscy5pc0VtcHR5KGRhdGEpKSB7Ci0gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBmaW5hbCBTdHJpbmcgdHlwZUFzU3RyaW5nOwotICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgZmluYWwgSW50ZWdlciB0eXBlQXNJbnRlZ2VyID0gY29udGVudFZhbHVlcy5nZXRBc0ludGVnZXIoSW0uVFlQRSk7Ci0gICAgICAgICAgICAgICAgICAgIHN3aXRjaCAodHlwZUFzSW50ZWdlciAhPSBudWxsID8gdHlwZUFzSW50ZWdlciA6IEltLlRZUEVfT1RIRVIpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgSW0uVFlQRV9IT01FOiB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZUFzU3RyaW5nID0gVkNhcmRDb25zdGFudHMuUEFSQU1fVFlQRV9IT01FOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBJbS5UWVBFX1dPUks6IHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlQXNTdHJpbmcgPSBWQ2FyZENvbnN0YW50cy5QQVJBTV9UWVBFX1dPUks7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICBjYXNlIEltLlRZUEVfQ1VTVE9NOiB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgZmluYWwgU3RyaW5nIGxhYmVsID0gY29udGVudFZhbHVlcy5nZXRBc1N0cmluZyhJbS5MQUJFTCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZUFzU3RyaW5nID0gKGxhYmVsICE9IG51bGwgPyAiWC0iICsgbGFiZWwgOiBudWxsKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgSW0uVFlQRV9PVEhFUjogIC8vIElnbm9yZQotICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDogewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGVBc1N0cmluZyA9IG51bGw7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICBmaW5hbCBMaXN0PFN0cmluZz4gcGFyYW1ldGVyTGlzdCA9IG5ldyBBcnJheUxpc3Q8U3RyaW5nPigpOwotICAgICAgICAgICAgICAgIGlmICghVGV4dFV0aWxzLmlzRW1wdHkodHlwZUFzU3RyaW5nKSkgewotICAgICAgICAgICAgICAgICAgICBwYXJhbWV0ZXJMaXN0LmFkZCh0eXBlQXNTdHJpbmcpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBmaW5hbCBJbnRlZ2VyIGlzUHJpbWFyeUFzSW50ZWdlciA9IGNvbnRlbnRWYWx1ZXMuZ2V0QXNJbnRlZ2VyKEltLklTX1BSSU1BUlkpOwotICAgICAgICAgICAgICAgIGZpbmFsIGJvb2xlYW4gaXNQcmltYXJ5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RlcGFydG1lbnQgPSBkZXBhcnRtZW50LnRyaW0oKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgU3RyaW5nIHRpdGxlID0gY29udGVudFZhbHVlcy5nZXRBc1N0cmluZyhPcmdhbml6YXRpb24uVElUTEUpOwotICAgICAgICAgICAgICAgIGlmICh0aXRsZSAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIHRpdGxlID0gdGl0bGUudHJpbSgpOwotICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgIFN0cmluZ0J1aWxkZXIgb3JnQnVpbGRlciA9IG5ldyBTdHJpbmdCdWlsZGVyKCk7Ci0gICAgICAgICAgICAgICAgaWYgKCFUZXh0VXRpbHMuaXNFbXB0eShjb21wYW55KSkgewotICAgICAgICAgICAgICAgICAgICBvcmdCdWlsZGVyLmFwcGVuZChjb21wYW55KTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgaWYgKCFUZXh0VXRpbHMuaXNFbXB0eShkZXBhcnRtZW50KSkgewotICAgICAgICAgICAgICAgICAgICBpZiAob3JnQnVpbGRlci5sZW5ndGgoKSA+IDApIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIG9yZ0J1aWxkZXIuYXBwZW5kKCc7Jyk7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgb3JnQnVpbGRlci5hcHBlbmQoZGVwYXJ0bWVudCk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGZpbmFsIFN0cmluZyBvcmdsaW5lID0gb3JnQnVpbGRlci50b1N0cmluZygpOwotICAgICAgICAgICAgICAgIGFwcGVuZExpbmUoVkNhcmRDb25zdGFudHMuUFJPUEVSVFlfT1JHLCBvcmdsaW5lLAotICAgICAgICAgICAgICAgICAgICAgICAgIVZDYXJkVXRpbHMuY29udGFpbnNPbmx5UHJpbnRhYmxlQXNjaWkob3JnbGluZSksCi0gICAgICAgICAgICAgICAgICAgICAgICAobVNob3VsZFVzZVF1b3RlZFByaW50YWJsZSAmJgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAhVkNhcmRVdGlscy5jb250YWluc09ubHlOb25DckxmUHJpbnRhYmxlQXNjaWkob3JnbGluZSkpKTsKLQotICAgICAgICAgICAgICAgIGlmICghVGV4dFV0aWxzLmlzRW1wdHkodGl0bGUpKSB7Ci0gICAgICAgICAgICAgICAgICAgIGFwcGVuZExpbmUoVkNhcmRDb25zdGFudHMuUFJPUEVSVFlfVElUTEUsIHRpdGxlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICFWQ2FyZFV0aWxzLmNvbnRhaW5zT25seVByaW50YWJsZUFzY2lpKHRpdGxlKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAobVNob3VsZFVzZVF1b3RlZFByaW50YWJsZSAmJgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIVZDYXJkVXRpbHMuY29udGFpbnNPbmx5Tm9uQ3JMZlByaW50YWJsZUFzY2lpKHRpdGxlKSkpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgICAgICByZXR1cm4gdGhpczsKLSAgICB9Ci0KLSAgICBwdWJsaWMgVkNhcmRCdWlsZGVyIGFwcGVuZFBob3RvcyhmaW5hbCBMaXN0PENvbnRlbnRWYWx1ZXM+IGNvbnRlbnRWYWx1ZXNMaXN0KSB7Ci0gICAgICAgIGlmIChjb250ZW50VmFsdWVzTGlzdCAhPSBudWxsKSB7Ci0gICAgICAgICAgICBmb3IgKENvbnRlbnRWYWx1ZXMgY29udGVudFZhbHVlcyA6IGNvbnRlbnRWYWx1ZXNMaXN0KSB7Ci0gICAgICAgICAgICAgICAgaWYgKGNvbnRlbnRWYWx1ZXMgPT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgYnl0ZVtdIGRhdGEgPSBjb250ZW50VmFsdWVzLmdldEFzQnl0ZUFycmF5KFBob3RvLlBIT1RPKTsKLSAgICAgICAgICAgICAgICBpZiAoZGF0YSA9PSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBmaW5hbCBTdHJpbmcgcGhvdG9UeXBlID0gVkNhcmRVdGlscy5ndWVzc0ltYWdlVHlwZShkYXRhKTsKLSAgICAgICAgICAgICAgICBpZiAocGhvdG9UeXBlID09IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgTG9nLmQoTE9HX1RBRywgIlVua25vd24gcGhvdG8gdHlwZS4gSWdub3JlZC4iKTsKLSAgICAgICAgICAgICAgICAgICAgY29udGludWU7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGZpbmFsIFN0cmluZyBwaG90b1N0cmluZyA9IG5ldyBTdHJpbmcoQmFzZTY0LmVuY29kZUJhc2U2NChkYXRhKSk7Ci0gICAgICAgICAgICAgICAgaWYgKCFUZXh0VXRpbHMuaXNFbXB0eShwaG90b1N0cmluZykpIHsKLSAgICAgICAgICAgICAgICAgICAgYXBwZW5kUGhvdG9MaW5lKHBob3RvU3RyaW5nLCBwaG90b1R5cGUpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgICAgICByZXR1cm4gdGhpczsKLSAgICB9Ci0KLSAgICBwdWJsaWMgVkNhcmRCdWlsZGVyIGFwcGVuZE5vdGVzKGZpbmFsIExpc3Q8Q29udGVudFZhbHVlcz4gY29udGVudFZhbHVlc0xpc3QpIHsKLSAgICAgICAgaWYgKGNvbnRlbnRWYWx1ZXNMaXN0ICE9IG51bGwpIHsKLSAgICAgICAgICAgIGlmIChtT25seU9uZU5vdGVGaWVsZElzQXZhaWxhYmxlKSB7Ci0gICAgICAgICAgICAgICAgZmluYWwgU3RyaW5nQnVpbGRlciBub3RlQnVpbGRlciA9IG5ldyBTdHJpbmdCdWlsZGVyKCk7Ci0gICAgICAgICAgICAgICAgYm9vbGVhbiBmaXJzdCA9IHRydWU7Ci0gICAgICAgICAgICAgICAgZm9yIChmaW5hbCBDb250ZW50VmFsdWVzIGNvbnRlbnRWYWx1ZXMgOiBjb250ZW50VmFsdWVzTGlzdCkgewotICAgICAgICAgICAgICAgICAgICBTdHJpbmcgbm90ZSA9IGNvbnRlbnRWYWx1ZXMuZ2V0QXNTdHJpbmcoTm90ZS5OT1RFKTsKLSAgICAgICAgICAgICAgICAgICAgaWYgKG5vdGUgPT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICAgICAgbm90ZSA9ICIiOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIGlmIChub3RlLmxlbmd0aCgpID4gMCkgewotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGZpcnN0KSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgZmlyc3QgPSBmYWxzZTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgbm90ZUJ1aWxkZXIuYXBwZW5kKCdcbicpOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgbm90ZUJ1aWxkZXIuYXBwZW5kKG5vdGUpOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGZpbmFsIFN0cmluZyBub3RlU3RyID0gbm90ZUJ1aWxkZXIudG9TdHJpbmcoKTsKLSAgICAgICAgICAgICAgICAvLyBUaGlzIG1lYW5zIHdlIHNjYW4gbm90ZVN0ciBjb21wbGV0ZWx5IHR3aWNlLCB3aGljaCBpcyByZWR1bmRhbnQuCi0gICAgICAgICAgICAgICAgLy8gQnV0IGZvciBub3csIHdlIGFzc3VtZSB0aGlzIGlzIG5vdCBzbyB0aW1lLWNvbnN1bWluZy4uCi0gICAgICAgICAgICAgICAgZmluYWwgYm9vbGVhbiBzaG91bGRBcHBlbmRDaGFyc2V0SW5mbyA9Ci0gICAgICAgICAgICAgICAgICAgICFWQ2FyZFV0aWxzLmNvbnRhaW5zT25seVByaW50YWJsZUFzY2lpKG5vdGVTdHIpOwotICAgICAgICAgICAgICAgIGZpbmFsIGJvb2xlYW4gcmVhbGx5VXNlUXVvdGVkUHJpbnRhYmxlID0KLSAgICAgICAgICAgICAgICAgICAgICAgIChtU2hvdWxkVXNlUXVvdGVkUHJpbnRhYmxlICYmCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgIVZDYXJkVXRpbHMuY29udGFpbnNPbmx5Tm9uQ3JMZlByaW50YWJsZUFzY2lpKG5vdGVTdHIpKTsKLSAgICAgICAgICAgICAgICBhcHBlbmRMaW5lKFZDYXJkQ29uc3RhbnRzLlBST1BFUlRZX05PVEUsIG5vdGVTdHIsCi0gICAgICAgICAgICAgICAgICAgICAgICBzaG91bGRBcHBlbmRDaGFyc2V0SW5mbywgcmVhbGx5VXNlUXVvdGVkUHJpbnRhYmxlKTsKLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgZm9yIChDb250ZW50VmFsdWVzIGNvbnRlbnRWYWx1ZXMgOiBjb250ZW50VmFsdWVzTGlzdCkgewotICAgICAgICAgICAgICAgICAgICBmaW5hbCBTdHJpbmcgbm90ZVN0ciA9IGNvbnRlbnRWYWx1ZXMuZ2V0QXNTdHJpbmcoTm90ZS5OT1RFKTsKLSAgICAgICAgICAgICAgICAgICAgaWYgKCFUZXh0VXRpbHMuaXNFbXB0eShub3RlU3RyKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgZmluYWwgYm9vbGVhbiBzaG91bGRBcHBlbmRDaGFyc2V0SW5mbyA9Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICFWQ2FyZFV0aWxzLmNvbnRhaW5zT25seVByaW50YWJsZUFzY2lpKG5vdGVTdHIpOwotICAgICAgICAgICAgICAgICAgICAgICAgZmluYWwgYm9vbGVhbiByZWFsbHlVc2VRdW90ZWRQcmludGFibGUgPQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAobVNob3VsZFVzZVF1b3RlZFByaW50YWJsZSAmJgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIVZDYXJkVXRpbHMuY29udGFpbnNPbmx5Tm9uQ3JMZlByaW50YWJsZUFzY2lpKG5vdGVTdHIpKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGFwcGVuZExpbmUoVkNhcmRDb25zdGFudHMuUFJPUEVSVFlfTk9URSwgbm90ZVN0ciwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2hvdWxkQXBwZW5kQ2hhcnNldEluZm8sIHJlYWxseVVzZVF1b3RlZFByaW50YWJsZSk7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLSAgICAgICAgcmV0dXJuIHRoaXM7Ci0gICAgfQotCi0gICAgcHVibGljIFZDYXJkQnVpbGRlciBhcHBlbmRFdmVudHMoZmluYWwgTGlzdDxDb250ZW50VmFsdWVzPiBjb250ZW50VmFsdWVzTGlzdCkgewotICAgICAgICBpZiAoY29udGVudFZhbHVlc0xpc3QgIT0gbnVsbCkgewotICAgICAgICAgICAgU3RyaW5nIHByaW1hcnlCaXJ0aGRheSA9IG51bGw7Ci0gICAgICAgICAgICBTdHJpbmcgc2Vjb25kYXJ5QmlydGhkYXkgPSBudWxsOwotICAgICAgICAgICAgZm9yIChmaW5hbCBDb250ZW50VmFsdWVzIGNvbnRlbnRWYWx1ZXMgOiBjb250ZW50VmFsdWVzTGlzdCkgewotICAgICAgICAgICAgICAgIGlmIChjb250ZW50VmFsdWVzID09IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgY29udGludWU7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGZpbmFsIEludGVnZXIgZXZlbnRUeXBlQXNJbnRlZ2VyID0gY29udGVudFZhbHVlcy5nZXRBc0ludGVnZXIoRXZlbnQuVFlQRSk7Ci0gICAgICAgICAgICAgICAgZmluYWwgaW50IGV2ZW50VHlwZTsKLSAgICAgICAgICAgICAgICBpZiAoZXZlbnRUeXBlQXNJbnRlZ2VyICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgZXZlbnRUeXBlID0gZXZlbnRUeXBlQXNJbnRlZ2VyOwotICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIGV2ZW50VHlwZSA9IEV2ZW50LlRZUEVfT1RIRVI7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGlmIChldmVudFR5cGUgPT0gRXZlbnQuVFlQRV9CSVJUSERBWSkgewotICAgICAgICAgICAgICAgICAgICBmaW5hbCBTdHJpbmcgYmlydGhkYXlDYW5kaWRhdGUgPSBjb250ZW50VmFsdWVzLmdldEFzU3RyaW5nKEV2ZW50LlNUQVJUX0RBVEUpOwotICAgICAgICAgICAgICAgICAgICBpZiAoYmlydGhkYXlDYW5kaWRhdGUgPT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgZmluYWwgSW50ZWdlciBpc1N1cGVyUHJpbWFyeUFzSW50ZWdlciA9Ci0gICAgICAgICAgICAgICAgICAgICAgICBjb250ZW50VmFsdWVzLmdldEFzSW50ZWdlcihFdmVudC5JU19TVVBFUl9QUklNQVJZKTsKLSAgICAgICAgICAgICAgICAgICAgZmluYWwgYm9vbGVhbiBpc1N1cGVyUHJpbWFyeSA9IChpc1N1cGVyUHJpbWFyeUFzSW50ZWdlciAhPSBudWxsID8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAoaXNTdXBlclByaW1hcnlBc0ludGVnZXIgPiAwKSA6IGZhbHNlKTsKLSAgICAgICAgICAgICAgICAgICAgaWYgKGlzU3VwZXJQcmltYXJ5KSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAvLyAic3VwZXIgcHJpbWFyeSIgYmlydGhkYXkgc2hvdWxkIHRoZSBwcmVmZXJlZCBvbmUuCi0gICAgICAgICAgICAgICAgICAgICAgICBwcmltYXJ5QmlydGhkYXkgPSBiaXJ0aGRheUNhbmRpZGF0ZTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIGZpbmFsIEludGVnZXIgaXNQcmltYXJ5QXNJbnRlZ2VyID0KLSAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRlbnRWYWx1ZXMuZ2V0QXNJbnRlZ2VyKEV2ZW50LklTX1BSSU1BUlkpOwotICAgICAgICAgICAgICAgICAgICBmaW5hbCBib29sZWFuIGlzUHJpbWFyeSA9IChpc1ByaW1hcnlBc0ludGVnZXIgIT0gbnVsbCA/Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgKGlzUHJpbWFyeUFzSW50ZWdlciA+IDApIDogZmFsc2UpOwotICAgICAgICAgICAgICAgICAgICBpZiAoaXNQcmltYXJ5KSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAvLyBXZSBkb24ndCBicmVhayBoZXJlIHNpbmNlICJzdXBlciBwcmltYXJ5IiBiaXJ0aGRheSBtYXkgZXhpc3QgbGF0ZXIuCi0gICAgICAgICAgICAgICAgICAgICAgICBwcmltYXJ5QmlydGhkYXkgPSBiaXJ0aGRheUNhbmRpZGF0ZTsKLSAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChzZWNvbmRhcnlCaXJ0aGRheSA9PSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAvLyBGaXJzdCBlbnRyeSBpcyBzZXQgdG8gdGhlICJzZWNvbmRhcnkiIGNhbmRpZ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ZiAocG9zdGFsU3RydWN0ID09IG51bGwpIHsKLSAgICAgICAgICAgICAgICBpZiAoZW1pdExpbmVFdmVyeVRpbWUpIHsKLSAgICAgICAgICAgICAgICAgICAgcmVhbGx5VXNlUXVvdGVkUHJpbnRhYmxlID0gZmFsc2U7Ci0gICAgICAgICAgICAgICAgICAgIGFwcGVuZENoYXJzZXQgPSBmYWxzZTsKLSAgICAgICAgICAgICAgICAgICAgYWRkcmVzc1ZhbHVlID0gIiI7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgcmVhbGx5VXNlUXVvdGVkUHJpbnRhYmxlID0gcG9zdGFsU3RydWN0LnJlYWxseVVzZVF1b3RlZFByaW50YWJsZTsKLSAgICAgICAgICAgICAgICBhcHBlbmRDaGFyc2V0ID0gcG9zdGFsU3RydWN0LmFwcGVuZENoYXJzZXQ7Ci0gICAgICAgICAgICAgICAgYWRkcmVzc1ZhbHVlID0gcG9zdGFsU3RydWN0LmFkZHJlc3NEYXRhOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgTGlzdDxTdHJpbmc+IHBhcmFtZXRlckxpc3QgPSBuZXcgQXJyYXlMaXN0PFN0cmluZz4oKTsKLSAgICAgICAgaWYgKGlzUHJpbWFyeSkgewotICAgICAgICAgICAgcGFyYW1ldGVyTGlzdC5hZGQoVkNhcmRDb25zdGFudHMuUEFSQU1fVFlQRV9QUkVGKTsKLSAgICAgICAgfQotICAgICAgICBzd2l0Y2ggKHR5cGUpIHsKLSAgICAgICAgICAgIGNhc2UgU3RydWN0dXJlZFBvc3RhbC5UWVBFX0hPTUU6IHsKLSAgICAgICAgICAgICAgICBwYXJhbWV0ZXJMaXN0LmFkZChWQ2FyZENvbnN0YW50cy5QQVJBTV9UWVBFX0hPTUUpOwotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgY2FzZSBTdHJ1Y3R1cmVkUG9zdGFsLlRZUEVfV09SSzogewotICAgICAgICAgICAgICAgIHBhcmFtZXRlckxpc3QuYWRkKFZDYXJkQ29uc3RhbnRzLlBBUkFNX1RZUEVfV09SSyk7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBjYXNlIFN0cnVjdHVyZWRQb3N0YWwuVFlQRV9DVVNUT006IHsKLSAgICAgICAgICAgICAgICBpZiAoIVRleHRVdGlscy5pc0VtcHR5KGxhYmVsKQotICAgICAgICAgICAgICAgICAgICAgICAgJiYgVkNhcmRVdGlscy5jb250YWluc09ubHlBbHBoYURpZ2l0SHlwaGVuKGxhYmVsKSkgewotICAgICAgICAgICAgICAgICAgICAvLyBXZSdyZSBub3Qgc3VyZSB3aGV0aGVyIHRoZSBsYWJlbCBpcyB2YWxpZCBpbiB0aGUgc3BlYwotICAgICAgICAgICAgICAgICAgICAvLyAoIklBTkEtdG9rZW4iIGluIHRoZSB2Q2FyZCAzLjAgaXMgdW5jbGVhci4uLikKLSAgICAgICAgICAgICAgICAgICAgLy8gSnVzdCAgZm9yIHNhZmV0eSwgd2UgYWRkICJYLSIgYXQgdGhlIGJlZ2dpbmluZyBvZiBlYWNoIGxhYmVsLgotICAgICAgICAgICAgICAgICAgICAvLyBBbHNvIGNoZWNrcyB0aGUgbGFiZWwgb2JleXMgd2l0aCB2Q2FyZCAzLjAgc3BlYy4KLSAgICAgICAgICAgICAgICAgICAgcGFyYW1ldGVyTGlzdC5hZGQoIlgtIiArIGxhYmVsKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBjYXNlIFN0cnVjdHVyZWRQb3N0YWwuVFlQRV9PVEhFUjogewotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAg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2UgewotICAgICAgICAgICAgICAgICAgICB0eXBlQXNTdHJpbmcgPSBudWxsOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGNhc2UgRW1haWwuVFlQRV9IT01FOiB7Ci0gICAgICAgICAgICAgICAgdHlwZUFzU3RyaW5nID0gVkNhcmRDb25zdGFudHMuUEFSQU1fVFlQRV9IT01FOwotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgY2FzZSBFbWFpbC5UWVBFX1dPUks6IHsKLSAgICAgICAgICAgICAgICB0eXBlQXNTdHJpbmcgPSBWQ2FyZENvbnN0YW50cy5QQVJBTV9UWVBFX1dPUks7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBjYXNlIEVtYWlsLlRZUEVfT1RIRVI6IHsKLSAgICAgICAgICAgICAgICB0eXBlQXNTdHJpbmcgPSBudWxsOwotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgY2FzZSBFbWFpbC5UWVBFX01PQklMRTogewotICAgICAgICAgICAgICAgIHR5cGVBc1N0cmluZyA9IFZDYXJkQ29uc3RhbnRzLlBBUkFNX1RZUEVfQ0VMTDsKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGRlZmF1bHQ6IHsKLSAgICAgICAgICAgICAgICBMb2cuZShMT0dfVEFHLCAiVW5rbm93biBFbWFpbCB0eXBlOiAiICsgdHlwZSk7Ci0gICAgICAgICAgICAgICAgdHlwZUFzU3RyaW5nID0gbnVsbDsKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCi0gICAgICAgIGZpbmFsIExpc3Q8U3RyaW5nPiBwYXJhbWV0ZXJMaXN0ID0gbmV3IEFycmF5TGlzdDx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+KCk7Ci0gICAgICAgIHN3aXRjaCAodHlwZSkgewotICAgICAgICAgICAgY2FzZSBQaG9uZS5UWVBFX0hPTUU6IHsKLSAgICAgICAgICAgICAgICBwYXJhbWV0ZXJMaXN0LmFkZEFsbCgKLSAgICAgICAgICAgICAgICAgICAgICAgIEFycmF5cy5hc0xpc3QoVkNhcmRDb25zdGFudHMuUEFSQU1fVFlQRV9IT01FKSk7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBjYXNlIFBob25lLlRZUEVfV09SSzogewotICAgICAgICAgICAgICAgIHBhcmFtZXRlckxpc3QuYWRkQWxsKAotICAgICAgICAgICAgICAgICAgICAgICAgQXJyYXlzLmFzTGlzdChWQ2FyZENvbnN0YW50cy5QQVJBTV9UWVBFX1dPUkspKTsKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGNhc2UgUGhvbmUuVFlQRV9GQVhfSE9NRTogewotICAgICAgICAgICAgICAgIHBhcmFtZXRlckxpc3QuYWRkQWxsKAotICAgICAgICAgICAgICAgICAgICAgICAgQXJyYXlzLmFzTGlzdChWQ2FyZENvbnN0YW50cy5QQVJBTV9UWVBFX0hPTUUsIFZDYXJkQ29uc3RhbnRzLlBBUkFNX1RZUEVfRkFYKSk7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBjYXNlIFBob25lLlRZUEVfRkFYX1dPUks6IHsKLSAgICAgICAgICAgICAgICBwYXJhbWV0ZXJMaXN0LmFkZEFsbCgKLSAgICAgICAgICAgICAgICAgICAgICAgIEFycmF5cy5hc0xpc3QoVkNhcmRDb25zdGFudHMuUEFSQU1fVFlQRV9XT1JLLCBWQ2FyZENvbnN0YW50cy5QQVJBTV9UWVBFX0ZBWCkpOwotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgY2FzZSBQaG9uZS5UWVBFX01PQklMRTogewotICAgICAgICAgICAgICAgIHBhcmFtZXRlckxpc3QuYWRkKFZDYXJkQ29uc3RhbnRzLlBBUkFNX1RZUEVfQ0VMTCk7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBjYXNlIFBob25lLlRZUEVfUEFHRVI6IHsKLSAgICAgICAgICAgICAgICBpZiAobUlzRG9Db01vKSB7Ci0gICAgICAgICAgICAgICAgICAgIC8vIE5vdCBzdXJlIGFib3V0IHRoZSByZWFzb24sIGJ1dCBwcmV2aW91cyBpbXBsZW1lbnRhdGlvbiBoYWQKLSAgICAgICAgICAgICAgICAgICAgLy8gdXNlZCAiVk9JQ0UiIGluc3RlYWQgb2YgIlBBR0VSIgotICAgICAgICAgICAgICAgICAgICBwYXJhbWV0ZXJMaXN0LmFkZChWQ2FyZENvbnN0YW50cy5QQVJBTV9UWVBFX1ZPSUNFKTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICBwYXJhbWV0ZXJMaXN0LmFkZChWQ2FyZENvbnN0YW50cy5QQVJBTV9UWVBFX1BBR0VSKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBjYXNlIFBob25lLlRZUEVfT1RIRVI6IHsKLSAgICAgICAgICAgICAgICBwYXJhbWV0ZXJMaXN0LmFkZChWQ2FyZENvbnN0YW50cy5QQVJBTV9UWVBFX1ZPSUNFKTsKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGNhc2UgUGhvbmUuVFlQRV9DQVI6IHsKLSAgICAgICAgICAgICAgICBwYXJhbWV0ZXJMaXN0LmFkZChWQ2FyZENvbnN0YW50cy5QQVJBTV9UWVBFX0NBUik7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBjYXNlIFBob25lLlRZUEVfQ09NUEFOWV9NQUlOOiB7Ci0gICAgICAgICAgICAgICAgLy8gVGhlcmUncyBubyByZWxldmFudCBmaWVsZCBpbiB2Q2FyZCAoYXQgbGVhc3QgMi4xKS4KLSAgICAgICAgICAgICAgICBwYXJhbWV0ZXJMaXN0LmFkZChWQ2FyZENvbnN0YW50cy5QQVJBTV9UWVBFX1dPUkspOwotICAgICAgICAgICAgICAgIGlzUHJpbWFyeSA9IHRydWU7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBjYXNlIFBob25lLlRZUEVfSVNETjogewotICAgICAgICAgICAgICAgIHBhcmFtZXRlckxpc3QuYWRkKFZDYXJkQ29uc3RhbnRzLlBBUkFNX1RZUEVfSVNETik7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBjYXNlIFBob25lLlRZUEVfTUFJTjogewotICAgICAgICAgICAgICAgIGlzUHJpbWFyeSA9IHRydWU7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBjYXNlIFBob25lLlRZUEVfT1RIRVJfRkFYOiB7Ci0gICAgICAgICAgICAgICAgcGFyYW1ldGVyTGlzdC5hZGQoVkNhcmRDb25zdGFudHMuUEFSQU1fVFlQRV9GQVgpOwotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgY2FzZSBQaG9uZS5UWVBFX1RFTEVYOiB7Ci0gICAgICAgICAgICAgICAgcGFyYW1ldGVyTGlzdC5hZGQoVkNhcmRDb25zdGFudHMuUEFSQU1fVFlQRV9UTFgpOwotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgY2FzZSBQaG9uZS5UWVBFX1dPUktfTU9CSUxFOiB7Ci0gICAgICAgICAgICAgICAgcGFyYW1ldGVyTGlzdC5hZGRBbGwoCi0gICAgICAgICAgICAgICAgICAgICAgICBBcnJheXMuYXNMaXN0KFZDYXJkQ29uc3RhbnRzLlBBUkFNX1RZUEVfV09SSywgVkNhcmRDb25zdGFudHMuUEFSQU1fVFlQRV9DRUxMKSk7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBjYXNlIFBob25lLlRZUEVfV09SS19QQUdFUjogewotICAgICAgICAgICAgICAgIHBhcmFtZXRlckxpc3QuYWRkKFZDYXJkQ29uc3RhbnRzLlBBUkFNX1RZUEVfV09SSyk7Ci0gICAgICAgICAgICAgICAgLy8gU2VlIGFib3ZlLgotICAgICAgICAgICAgICAgIGlmIChtSXNEb0NvTW8pIHsKLSAgICAgICAgICAgICAgICAgICAgcGFyYW1ldGVyTGlzdC5hZGQoVkNhcmRDb25zdGFudHMuUEFSQU1fVFlQRV9WT0lDRSk7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgcGFyYW1ldGVyTGlzdC5hZGQoVkNhcmRDb25zdGFudHMuUEFSQU1fVFlQRV9QQUdFUik7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgY2FzZSBQaG9uZS5UWVBFX01NUzogewotICAgICAgICAgICAgICAgIHBhcmFtZXRlckxpc3QuYWRkKFZDYXJkQ29uc3RhbnRzLlBBUkFNX1RZUEVfTVNHKTsKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGNhc2UgUGhvbmUuVFlQRV9DVVNUT006IHsKLSAgICAgICAgICAgICAgICBpZiAoVGV4dFV0aWxzLmlzRW1wdHkobGFiZWwpKSB7Ci0gICAgICAgICAgICAgICAgICAgIC8vIEp1c3QgaWdub3JlIHRoZSBjdXN0b20gdHlwZS4KLSAgICAgICAgICAgICAgICAgICAgcGFyYW1ldGVyTGlzdC5hZGQoVkNhcmRDb25zdGFudHMuUEFSQU1fVFlQRV9WT0lDRSk7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChWQ2FyZFV0aWxzLmlzTW9iaWxlUGhvbmVMYWJlbChsYWJlbCkpIHsKLSAgICAgICAgICAgICAgICAgICAgcGFyYW1ldGVyTGlzdC5hZGQoVkNhcmRDb25zdGFudHMuUEFSQU1fVFlQRV9DRUxMKTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKG1Jc1YzMCkgewotICAgICAgICAgICAgICAgICAgICAvLyBUaGlzIGxhYmVsIGlzIGFwcHJvcHJpYXRlbHkgZW5jb2RlZCBpbiBhcHBlbmRUeXBlUGFyYW1ldGVycy4KLSAgICAgICAgICAgICAgICAgICAgcGFyYW1ldGVyTGlzdC5hZGQobGFiZWwpOwotICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIGZpbmFsIFN0cmluZyB1cHBlckxhYmVsID0gbGFiZWwudG9VcHBlckNhc2UoKTsKLSAgICAgICAgICAgICAgICAgICAgaWYgKFZDYXJkVXRpbHMuaXNWYWxpZEluVjIxQnV0VW5rbm93blRvQ29udGFjdHNQaG90ZVR5cGUodXBwZXJMYWJlbCkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtZXRlckxpc3QuYWRkKHVwcGVyTGFiZWwpOwotICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKFZDYXJkVXRpbHMuY29udGFpbnNPbmx5QWxwaGFEaWdpdEh5cGhlbihsYWJlbCkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIC8vIE5vdGU6IFN0cmljdGx5LCB2Q2FyZCAyLjEgZG9lcyBub3QgYWxsb3cgIlgtIiBwYXJhbWV0ZXIgd2l0aG91dAotICAgICAgICAgICAgICAgICAgICAgICAgLy8gICAgICAgIlRZUEU9IiBzdHJpbmcuCi0gICAgICAgICAgICAgICAgICAgICAgICBwYXJhbWV0ZXJMaXN0LmFkZCgiWC0iICsgbGFiZWwpOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgY2FzZSBQaG9uZS5UWVBFX1JBRElPOgotICAgICAgICAgICAgY2FzZSBQaG9uZS5UWVBFX1RUWV9UREQ6Ci0gICAgICAgICAgICBkZWZhdWx0OiB7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQotICAgICAgICBpZiAoaXNQcmltYXJ5KSB7Ci0gICAgICAgICAgICBwYXJhbWV0ZXJMaXN0LmFkZChWQ2FyZENvbnN0YW50cy5QQVJBTV9UWVBFX1BSRUYpOwotICAgICAgICB9Ci0KLSAgICAgICAgaWYgKHBhcmFtZXRlckxpc3QuaXNFbXB0eSgpKSB7Ci0gICAgICAgICAgICBhcHBlbmRVbmNvbW1vblBob25lVHlwZShtQnVpbGRlciwgdHlwZSk7Ci0gICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICBhcHBlbmRUeXBlUGFyYW1ldGVycyhwYXJhbWV0ZXJMaXN0KTsKLSAgICAgICAgfQotCi0gICAgICAgIG1CdWlsZGVyLmFwcGVuZChWQ0FSRF9EQVRBX1NFUEFSQVRPUik7Ci0gICAgICAgIG1CdWlsZGVyLmFwcGVuZChlbmNvZGVkVmFsdWUpOwotICAgICAgICBtQnVpbGRlci5hcHBlbmQoVkNBUkRfRU5EX09GX0xJTkUpOwotICAgIH0KLQotICAgIC8qKgotICAgICAqIEFwcGVuZHMgcGhvbmUgdHlwZSBzdHJpbmcgd2hpY2ggbWF5IG5vdCBiZSBhdmFpbGFibGUgaW4gc29tZSBkZXZpY2VzLgotICAgICAqLwotICAgIHByaXZhdGUgdm9pZCBhcHBlbmRVbmNvbW1vblBob25lVHlwZShmaW5hbCBTdH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OdW1Gb3JGaXJzdExpbmUgLSBWQ0FSRF9XUy5sZW5ndGgoKTsKLSAgICAgICAgaW50IG1heE51bSA9IG1heE51bUZvckZpcnN0TGluZTsKLSAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBsZW5ndGg7IGkrKykgewotICAgICAgICAgICAgdG1wQnVpbGRlci5hcHBlbmQodG1wU3RyLmNoYXJBdChpKSk7Ci0gICAgICAgICAgICBsaW5lQ291bnQrKzsKLSAgICAgICAgICAgIGlmIChsaW5lQ291bnQgPiBtYXhOdW0pIHsKLSAgICAgICAgICAgICAgICB0bXBCdWlsZGVyLmFwcGVuZChWQ0FSRF9FTkRfT0ZfTElORSk7Ci0gICAgICAgICAgICAgICAgdG1wQnVpbGRlci5hcHBlbmQoVkNBUkRfV1MpOwotICAgICAgICAgICAgICAgIG1heE51bSA9IG1heE51bUluR2VuZXJhbDsKLSAgICAgICAgICAgICAgICBsaW5lQ291bnQgPSAwOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgICAgIG1CdWlsZGVyLmFwcGVuZCh0bXBCdWlsZGVyLnRvU3RyaW5nKCkpOwotICAgICAgICBtQnVpbGRlci5hcHBlbmQoVkNBUkRfRU5EX09GX0xJTkUpOwotICAgICAgICBtQnVpbGRlci5hcHBlbmQoVkNBUkRfRU5EX09GX0xJTkUpOwotICAgIH0KLQotICAgIHB1YmxpYyB2b2lkIGFwcGVuZEFuZHJvaWRTcGVjaWZpY1Byb3BlcnR5KGZpbmFsIFN0cmluZyBtaW1lVHlwZSwgQ29udGVudFZhbHVlcyBjb250ZW50VmFsdWVzKSB7Ci0gICAgICAgIGlmICghc0FsbG93ZWRBbmRyb2lkUHJvcGVydHlTZXQuY29udGFpbnMobWltZVR5cGUpKSB7Ci0gICAgICAgICAgICByZXR1cm47Ci0gICAgICAgIH0KLSAgICAgICAgZmluYWwgTGlzdDxTdHJpbmc+IHJhd1ZhbHVlTGlzdCA9IG5ldyBBcnJheUxpc3Q8U3RyaW5nPigpOwotICAgICAgICBmb3IgKGludCBpID0gMTsgaSA8PSBWQ2FyZENvbnN0YW50cy5NQVhfREFUQV9DT0xVTU47IGkrKykgewotICAgICAgICAgICAgU3RyaW5nIHZhbHVlID0gY29udGVudFZhbHVlcy5nZXRBc1N0cmluZygiZGF0YSIgKyBpKTsKLSAgICAgICAgICAgIGlmICh2YWx1ZSA9PSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgdmFsdWUgPSAiIjsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHJhd1ZhbHVlTGlzdC5hZGQodmFsdWUpOwotICAgICAgICB9Ci0KLSAgICAgICAgYm9vbGVhbiBuZWVkQ2hhcnNldCA9Ci0gICAgICAgICAgICAobVNob3VsZEFwcGVuZENoYXJzZXRQYXJhbSAmJgotICAgICAgICAgICAgICAgICAgICAhVkNhcmRVdGlscy5jb250YWluc09ubHlOb25DckxmUHJpbnRhYmxlQXNjaWkocmF3VmFsdWVMaXN0KSk7Ci0gICAgICAgIGJvb2xlYW4gcmVhbGx5VXNlUXVvdGVkUHJpbnRhYmxlID0KLSAgICAgICAgICAgIChtU2hvdWxkVXNlUXVvdGVkUHJpbnRhYmxlICYmCi0gICAgICAgICAgICAgICAgICAgICFWQ2FyZFV0aWxzLmNvbnRhaW5zT25seU5vbkNyTGZQcmludGFibGVBc2NpaShyYXdWYWx1ZUxpc3QpKTsKLSAgICAgICAgbUJ1aWxkZXIuYXBwZW5kKFZDYXJkQ29uc3RhbnRzLlBST1BFUlRZX1hfQU5EUk9JRF9DVVNUT00pOwotICAgICAgICBpZiAobmVlZENoYXJzZXQpIHsKLSAgICAgICAgICAgIG1CdWlsZGVyLmFwcGVuZChWQ0FSRF9QQVJBTV9TRVBBUkFUT1IpOwotICAgICAgICAgICAgbUJ1aWxkZXIuYXBwZW5kKG1WQ2FyZENoYXJzZXRQYXJhbWV0ZXIpOwotICAgICAgICB9Ci0gICAgICAgIGlmIChyZWFsbHlVc2VRdW90ZWRQcmludGFibGU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Y29udGFpbnNPbmx5UHJpbnRhYmxlQXNjaWkocmF3VmFsdWUpOwotICAgICAgICBmaW5hbCBib29sZWFuIHJlYWxseVVzZVF1b3RlZFByaW50YWJsZSA9Ci0gICAgICAgICAgICAgICAgKG1TaG91bGRVc2VRdW90ZWRQcmludGFibGUgJiYKLSAgICAgICAgICAgICAgICAgICAgICAgICFWQ2FyZFV0aWxzLmNvbnRhaW5zT25seU5vbkNyTGZQcmludGFibGVBc2NpaShyYXdWYWx1ZSkpOwotICAgICAgICBhcHBlbmRMaW5lKHByb3BlcnR5TmFtZSwgcGFyYW1ldGVyTGlzdCwKLSAgICAgICAgICAgICAgICByYXdWYWx1ZSwgbmVlZENoYXJzZXQsIHJlYWxseVVzZVF1b3RlZFByaW50YWJsZSk7Ci0gICAgfQotCi0gICAgcHVibGljIHZvaWQgYXBwZW5kTGluZVdpdGhDaGFyc2V0QW5kUVBEZXRlY3Rpb24oZmluYWwgU3RyaW5nIHByb3BlcnR5TmFtZSwKLSAgICAgICAgICAgIGZpbmFsIExpc3Q8U3RyaW5nPiBwYXJhbWV0ZXJMaXN0LCBmaW5hbCBMaXN0PFN0cmluZz4gcmF3VmFsdWVMaXN0KSB7Ci0gICAgICAgIGJvb2xlYW4gbmVlZENoYXJzZXQgPQotICAgICAgICAgICAgKG1TaG91bGRBcHBlbmRDaGFyc2V0UGFyYW0gJiYKLSAgICAgICAgICAgICAgICAgICAgIVZDYXJkVXRpbHMuY29udGFpbnNPbmx5Tm9uQ3JMZlByaW50YWJsZUFzY2lpKHJhd1ZhbHVlTGlzdCkpOwotICAgICAgICBib29sZWFuIHJlYWxseVVzZVF1b3RlZFByaW50YWJsZSA9Ci0gICAgICAgICAgICAobVNob3VsZFVzZVF1b3RlZFByaW50YWJsZSAmJgotICAgICAgICAgICAgICAgICAgICAhVkNhcmRVdGlscy5jb250YWluc09ubHlOb25DckxmUHJpbnRhYmxlQXNjaWkocmF3VmFsdWVMaXN0KSk7Ci0gICAgICAgIGFwcGVu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gKFN0cmluZyByYXdWYWx1ZSA6IHJhd1ZhbHVlTGlzdCkgewotICAgICAgICAgICAgZmluYWwgU3RyaW5nIGVuY29kZWRWYWx1ZTsKLSAgICAgICAgICAgIGlmIChuZWVkUXVvdGVkUHJpbnRhYmxlKSB7Ci0gICAgICAgICAgICAgICAgZW5jb2RlZFZhbHVlID0gZW5jb2RlUXVvdGVkUHJpbnRhYmxlKHJhd1ZhbHVlKTsKLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgLy8gVE9ETzogb25lIGxpbmUgbWF5IGJlIHRvbyBodWdlLCB3aGljaCBtYXkgYmUgaW52YWxpZCBpbiB2Q2FyZCAzLjAKLSAgICAgICAgICAgICAgICAvLyAgICAgICAgKHdoaWNoIHNheXMgIldoZW4gZ2VuZXJhdGluZyBhIGNvbnRlbnQgbGluZSwgbGluZXMgbG9uZ2VyIHRoYW4KLSAgICAgICAgICAgICAgICAvLyAgICAgICAgNzUgY2hhcmFjdGVycyBTSE9VTEQgYmUgZm9sZGVkIiksIHRob3VnaCBzZXZlcmFsCi0gICAgICAgICAgICAgICAgLy8gICAgICAgIChldmVuIHdlbGwta25vd24pIGFwcGxpY2F0aW9ucyBkbyBub3QgY2FyZSB0aGlzLgotICAgICAgICAgICAgICAgIGVuY29kZWRWYWx1ZSA9IGVzY2FwZUNoYXJhY3RlcnMocmF3VmFsdWUpOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBpZiAoZmlyc3QpIHsKLSAgICAgICAgICAgICAgICBmaXJzdCA9IGZhbHNlOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBtQnVpbGRlci5hcHBlbmQoVkNBUkRfSVRFTV9TRVBBUkFUT1IpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgbUJ1aWxkZXIuYXBwZW5kKGVuY29kZWRWYWx1ZSk7Ci0gICAgICAgIH0KLSAgICAgICAgbUJ1aWxkZXIuYXBwZW5kKFZDQVJEX0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ICAgICAgICAgICAgICAvLyBlLmcuIFRZUEU9Ilx1NTc4Qlx1MzA2Qlx1MzA4NyIgKHZDYXJkIDMuMCBhbGxvd3Mgbm9uLUFzY2lpIGNoYXJhY3RlcnMgaWYgdGhleQotICAgICAgICAgICAgICAgIC8vICAgICAgYXJlIHF1b3RlZC4pCi0gICAgICAgICAgICAgICAgaWYgKGZpcnN0KSB7Ci0gICAgICAgICAgICAgICAgICAgIGZpcnN0ID0gZmFsc2U7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgbUJ1aWxkZXIuYXBwZW5kKFZDQVJEX1BBUkFNX1NFUEFSQVRPUik7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGFwcGVuZFR5cGVQYXJhbWV0ZXIoVkNhcmRVdGlscy50b1N0cmluZ0F2YWlsYWJsZUFzVjMwUGFyYW1lVmFsdWUodHlwZVZhbHVlKSk7Ci0gICAgICAgICAgICB9IGVsc2UgeyAgLy8gdkNhcmQgMi4xCi0gICAgICAgICAgICAgICAgaWYgKCFWQ2FyZFV0aWxzLmlzVjIxV29yZCh0eXBlVmFsdWUpKSB7Ci0gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBpZiAoZmlyc3QpIHsKLSAgICAgICAgICAgICAgICAgICAgZmlyc3QgPSBmYWxzZTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICBtQnVpbGRlci5hcHBlbmQoVkNBUkRfUEFSQU1fU0VQQVJBVE9SKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgYXBwZW5kVHlwZVBhcmFtZXRlcih0eXBlVmFsdWUpOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgfQotCi0gICAgLyoqCi0gICAgICogVkNBUkRfUEFSQU1fU0VQQVJBVE9SIG11c3QgYmUgYXBwZW5k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dmF0ZSBTdHJpbmcgZXNjYXBlQ2hhcmFjdGVycyhmaW5hbCBTdHJpbmcgdW5lc2NhcGVkKSB7Ci0gICAgICAgIGlmIChUZXh0VXRpbHMuaXNFbXB0eSh1bmVzY2FwZWQpKSB7Ci0gICAgICAgICAgICByZXR1cm4gIiI7Ci0gICAgICAgIH0KLQotICAgICAgICBmaW5hbCBTdHJpbmdCdWlsZGVyIHRtcEJ1aWxkZXIgPSBuZXcgU3RyaW5nQnVpbGRlcigpOwotICAgICAgICBmaW5hbCBpbnQgbGVuZ3RoID0gdW5lc2NhcGVkLmxlbmd0aCgpOwotICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGxlbmd0aDsgaSsrKSB7Ci0gICAgICAgICAgICBmaW5hbCBjaGFyIGNoID0gdW5lc2NhcGVkLmNoYXJBdChpKTsKLSAgICAgICAgICAgIHN3aXRjaCAoY2gpIHsKLSAgICAgICAgICAgICAgICBjYXNlICc7JzogewotICAgICAgICAgICAgICAgICAgICB0bXBCdWlsZGVyLmFwcGVuZCgnXFwnKTsKLSAgICAgICAgICAgICAgICAgICAgdG1wQnVpbGRlci5hcHBlbmQoJzsnKTsKLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGNhc2UgJ1xyJzogewotICAgICAgICAgICAgICAgICAgICBpZiAoaSArIDEgPCBsZW5ndGgpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGNoYXIgbmV4dENoYXIgPSB1bmVzY2FwZWQuY2hhckF0KGkpOwotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG5leHRDaGFyID09ICdcbicpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gZmFsbCB0aHJvdWdoCi0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAvLyBmYWxsIHRocm91Z2gKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBjYXNlICdcbic6IHsKLSAgICAgICAgICAgICAgICAgICAgLy8gSW4gdkNhcmQgMi4xLCB0aGVyZSdzIG5vIHNwZWNpZmljYXRpb24gYWJvdXQgdGhpcywgd2hpbGUKLSAgICAgICAgICAgICAgICAgICAgLy8gdkNhcmQgMy4wIGV4cGxpY2l0bHkgcmVxdWlyZXMgdGhpcyBzaG91bGQgYmUgZW5jb2RlZCB0byAiXG4iLgotICAgICAgICAgICAgICAgICAgICB0bXBCdWlsZGVyLmFwcGVuZCgiXFxuIik7Ci0gICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBjYXNlICdcXCc6IHsKLSAgICAgICAgICAgICAgICAgICAgaWYgKG1Jc1YzMCkgewotICAgICAgICAgICAgICAgICAgICAgICAgdG1wQnVpbGRlci5hcHBlbmQoIlxcXFwiKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICAgICAgLy8gZmFsbCB0aHJvdWdoCi0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgY2FzZSAnPCc6Ci0gICAgICAgICAgICAgICAgY2FzZSAnPic6IHsKLSAgICAgICAgICAgICAgICAgICAgaWYgKG1Jc0RvQ29NbykgewotICAgICAgICAgICAgICAgICAgICAgICAgdG1wQnVpbGRlci5hcHBlbmQoJ1xcJyk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB0bXBCdWlsZGVyLmFwcGVuZChjaCk7Ci0gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICB0bXBCdWlsZGVyLmFwcGVuZChjaCk7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGNhc2UgJywnOiB7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChtSXNWMzApIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHRtcEJ1aWxkZXIuYXBwZW5kKCJcXCwiKTsKLSAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHRtcEJ1aWxkZXIuYXBwZW5kKGNoKTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgZGVmYXVsdDogewotICAgICAgICAgICAgICAgICAgICB0bXBCdWlsZGVyLmFwcGVuZChjaCk7Ci0gICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgICAgICByZXR1cm4gdG1wQnVpbGRlci50b1N0cmluZygpOwotICAgIH0KLQotICAgIEBPdmVycmlkZQotICAgIHB1YmxpYyBTdHJpbmcgdG9TdHJpbmcoKSB7Ci0gICAgICAgIGlmICghbUVuZEFwcGVuZGVkKSB7Ci0gICAgICAgICAgICBpZiAobUlzRG9Db01vKSB7Ci0gICAgICAgICAgICAgICAgYXBwZW5kTGluZShWQ2FyZENvbnN0YW50cy5QUk9QRVJUWV9YX0NMQVNTLCBWQ0FSRF9EQVRBX1BVQkxJQyk7Ci0gICAgICAgICAgICAgICAgYXBwZW5kTGluZShWQ2FyZENvbnN0YW50cy5QUk9QRVJUWV9YX1JFRFVDVElPTiwgIiIpOwotICAgICAgICAgICAgICAgIGFwcGVuZExpbmUoVkNhcmRDb25zdGFudHMuUFJPUEVSVFlfWF9OTywgIiIpOw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N0cmVhbSA9IG91dHB1dFN0cmVhbTsKLSAgICAgICAgfQotCi0gICAgICAgIHB1YmxpYyBib29sZWFuIG9uSW5pdChDb250ZXh0IGNvbnRleHQpIHsKLSAgICAgICAgICAgIHRyeSB7Ci0gICAgICAgICAgICAgICAgbVdyaXRlciA9IG5ldyBCdWZmZXJlZFdyaXRlcihuZXcgT3V0cHV0U3RyZWFtV3JpdGVyKAotICAgICAgICAgICAgICAgICAgICAgICAgbU91dHB1dFN0cmVhbSwgbUNoYXJzZXRTdHJpbmcpKTsKLSAgICAgICAgICAgIH0gY2F0Y2ggKFVuc3VwcG9ydGVkRW5jb2RpbmdFeGNlcHRpb24gZTEpIHsKLSAgICAgICAgICAgICAgICBMb2cuZShMT0dfVEFHLCAiVW5zdXBwb3J0ZWQgY2hhcnNldDogIiArIG1DaGFyc2V0U3RyaW5nKTsKLSAgICAgICAgICAgICAgICBtRXJyb3JSZWFzb24gPSAiRW5jb2RpbmcgaXMgbm90IHN1cHBvcnRlZCAodXN1YWxseSB0aGlzIGRvZXMgbm90IGhhcHBlbiEpOiAiCi0gICAgICAgICAgICAgICAgICAgICAgICArIG1DaGFyc2V0U3RyaW5nOwotICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgaWYgKG1Jc0RvQ29NbykgewotICAgICAgICAgICAgICAgIHRyeSB7Ci0gICAgICAgICAgICAgICAgICAgIC8vIENyZWF0ZSBvbmUgZW1wdHkgZW50cnkuCi0gICAgICAgICAgICAgICAgICAgIG1Xcml0ZXIud3JpdGUoY3JlYXRlT25lRW50cnlJbnRlcm5hbCgiLTEiLCBudWxsKSk7Ci0gICAgICAgICAgICAgICAgfSBjYXRjaCAoVkNhcmRFeGNlcHRpb24gZSkgewotICAgICAgICAgICAgICAgICAgICBMb2cuZShMT0dfVEFHLCAiVkNhcmRFeGNlcHRpb24gaGFzIGJlZW4gdGhyb3duIGR1cmluZyBvbiBJbml0KCk6ICIgKwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZ2V0TWVzc2FnZSgpKTsKLSAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwotICAgICAgICAgICAgICAgIH0gY2F0Y2ggKElPRXhjZXB0aW9uIGUpIHsKLSAgICAgICAgICAgICAgICAgICAgTG9nLmUoTE9HX1RBRywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAiSU9FeGNlcHRpb24gb2NjdXJyZWQgZHVyaW5nIGV4cG9ydE9uZUNvbnRhY3REYXRhOiAiCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIGUuZ2V0TWVzc2FnZSgpKTsKLSAgICAgICAgICAgICAgICAgICAgbUVycm9yUmVhc29uID0gIklPRXhjZXB0aW9uIG9jY3VycmVkOiAiICsgZS5nZXRNZXNzYWdlKCk7Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICByZXR1cm4gdHJ1ZTsKLSAgICAgICAgfQotCi0gICAgICAgIHB1YmxpYyBib29sZWFuIG9uRW50cnlDcmVhdGVkKFN0cmluZyB2Y2FyZCkgewotICAgICAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgICAgICBtV3JpdGVyLndyaXRlKHZjYXJkKTsKLSAgICAgICAgICAgIH0gY2F0Y2ggKElPRXhjZXB0aW9uIGUpIHsKLSAgICAgICAgICAgICAgICBMb2cuZShMT0dfVEFHLAotICAgICAgICAgICAgICAgICAgICAgICAgIklPRXhjZXB0aW9uIG9jY3VycmVkIGR1cmluZyBleHBvcnRPbmVDb250YWN0RGF0YTogIgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIGUuZ2V0TWVzc2FnZSgpKTsKLSAgICAgICAgICAgICAgICBtRXJyb3JSZWFzb24gPSAiSU9FeGNlcHRpb24gb2NjdXJyZWQ6ICIgKyBlLmdldE1lc3NhZ2UoKTsKLSAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICByZXR1cm4gdHJ1ZTsKLSAgICAgICAgfQotCi0gICAgICAgIHB1YmxpYyB2b2lkIG9uVGVybWluYXRlKCkgewotICAgICAgICAgICAgbU9uVGVybWluYXRlSXNDYWxsZWQgPSB0cnVlOwotICAgICAgICAgICAgaWYgKG1Xcml0ZXIgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgIHRyeSB7Ci0gICAgICAgICAgICAgICAgICAgIC8vIEZsdXNoIGFuZCBzeW5jIHRoZSBkYXRhIHNvIHRoYXQgYSB1c2VyIGlzIGFibGUgdG8gcHVsbAotICAgICAgICAgICAgICAgICAgICAvLyB0aGUgU0RDYXJkIGp1c3QgYWZ0ZXIKLSAgICAgICAgICAgICAgICAgICAgLy8gdGhlIGV4cG9ydC4KLSAgICAgICAgICAgICAgICAgICAgbVdyaXRlci5mbHVzaCgpOwotICAgICAgICAgICAgICAgICAgICBpZiAobU91dHB1dFN0cmVhbSAhPSBudWxsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgJiYgbU91dHB1dFN0cmVhbSBpbnN0YW5jZW9mIEZpbGVPdXRwdXRTdHJlYW0pIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAoKEZpbGVPdXRwdXRTdHJlYW0pIG1PdXRwdXRTdHJlYW0pLmdldEZEKCkuc3luYygpOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfSBjYXRjaCAoSU9FeGNlcHRpb24gZSkgewotICAgICAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICJJT0V4Y2VwdGlvbiBkdXJpbmcgY2xvc2luZyB0aGUgb3V0cHV0IHN0cmVhbTogIgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyBlLmdldE1lc3NhZ2UoKSk7Ci0gICAgICAgICAgICA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ZWxlY3Rpb25BcmdzKSB7Ci0gICAgICAgIHJldHVybiBpbml0KENvbnRhY3RzLkNPTlRFTlRfVVJJLCBzZWxlY3Rpb24sIHNlbGVjdGlvbkFyZ3MsIG51bGwpOwotICAgIH0KLQotICAgIC8qKgotICAgICAqIE5vdGUgdGhhdCB0aGlzIGlzIHVuc3RhYmxlIGludGVyZmFjZSwgbWF5IGJlIGRlbGV0ZWQgaW4gdGhlIGZ1dHVyZS4KLSAgICAgKi8KLSAgICBwdWJsaWMgYm9vbGVhbiBpbml0KGZpbmFsIFVyaSBjb250ZW50VXJpLCBmaW5hbCBTdHJpbmcgc2VsZWN0aW9uLAotICAgICAgICAgICAgZmluYWwgU3RyaW5nW10gc2VsZWN0aW9uQXJncywgZmluYWwgU3RyaW5nIHNvcnRPcmRlcikgewotICAgICAgICBpZiAoY29udGVudFVyaSA9PSBudWxsKSB7Ci0gICAgICAgICAgICByZXR1cm4gZmFsc2U7Ci0gICAgICAgIH0KLQotICAgICAgICBpZiAobUNhcmVIYW5kbGVyRXJyb3JzKSB7Ci0gICAgICAgICAgICBMaXN0PE9uZUVudHJ5SGFuZGxlcj4gZmluaXNoZWRMaXN0ID0gbmV3IEFycmF5TGlzdDxPbmVFbnRyeUhhbmRsZXI+KAotICAgICAgICAgICAgICAgICAgICBtSGFuZGxlckxpc3Quc2l6ZSgpKTsKLSAgICAgICAgICAgIGZvciAoT25lRW50cnlIYW5kbGVyIGhhbmRsZXIgOiBtSGFuZGxlckxpc3QpIHsKLSAgICAgICAgICAgICAgICBpZiAoIWhhbmRsZXIub25Jbml0KG1Db250ZXh0KSkgewotICAgICAgICAgICAgICAgICAgICBmb3IgKE9uZUVudHJ5SGFuZGxlciBmaW5pc2hlZCA6IGZpbmlzaGVkTGlzdCkgewotICAgICAgICAgICAgICAgICAgICAgICAgZmluaXNoZWQub25UZXJtaW5hdGUoKTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgLy8gSnVzdCBpZ25vcmUgdGhlIGZhbHNlIHJldHVybmVkIGZyb20gb25Jbml0KCkuCi0gICAgICAgICAgICBmb3IgKE9uZUVudHJ5SGFuZGxlciBoYW5kbGVyIDogbUhhbmRsZXJMaXN0KSB7Ci0gICAgICAgICAgICAgICAgaGFuZGxlci5vbkluaXQobUNvbnRleHQpOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgZmluYWwgU3RyaW5nW10gcHJvamVjdGlvbjsKLSAgICAgICAgaWYgKENvbnRhY3RzLkNPTlRFTlRfVVJJLmVxdWFscyhjb250ZW50VXJpKSB8fAotICAgICAgICAgICAgICAgIENPTlRBQ1RTX1RFU1RfQ09OVEVOVF9VUkkuZXF1YWxzKGNvbnRlbnRVcmkpKSB7Ci0gICAgICAgICAgICBwcm9qZWN0aW9uID0gc0NvbnRhY3RzUHJvamVjdGlvbjsKLSAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgIG1FcnJvclJlYXNvbiA9IEZBSUxVUkVfUkVBU09OX1VOU1VQUE9SVEVEX1VSSTsKLSAgICAgICAgICAgIHJldHVybiBmYWxzZTsKLSAgICAgICAgfQotICAgICAgICBtQ3Vyc29yID0gbUNvbnRlbnRSZXNvbHZlci5xdWVyeSgKLSAgICAgICAgICAgICAgICBjb250ZW50VXJpLCBwcm9qZWN0aW9uLCBzZWxlY3Rpb24sIHNlbGVjdGlvbkFyZ3MsIHNvcnRPcmRlcik7Ci0KLSAgICAgICAgaWYgKG1DdXJzb3IgPT0gbnVsbCkgewotICAgICAgICAgICAgbUVycm9yUmVhc29uID0gRkFJTFVSRV9SRUFTT05fRkFJTEVEX1RPX0dFVF9EQVRBQkFTRV9JTkZPOwotICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwotICAgICAgICB9Ci0KLSAgICAgICAgaWYgKGdldENvd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ZWFzb24gPSBGQUlMVVJFX1JFQVNPTl9OT1RfSU5JVElBTElaRUQ7Ci0gICAgICAgICAgICByZXR1cm4gZmFsc2U7Ci0gICAgICAgIH0KLSAgICAgICAgU3RyaW5nIHZjYXJkOwotICAgICAgICB0cnkgewotICAgICAgICAgICAgaWYgKG1JZENvbHVtbiA+PSAwKSB7Ci0gICAgICAgICAgICAgICAgdmNhcmQgPSBjcmVhdGVPbmVFbnRyeUludGVybmFsKG1DdXJzb3IuZ2V0U3RyaW5nKG1JZENvbHVtbiksCi0gICAgICAgICAgICAgICAgICAgICAgICBnZXRFbnRpdHlJdGVyYXRvck1ldGhvZCk7Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIExvZy5lKExPR19UQUcsICJJbmNvcnJlY3QgbUlkQ29sdW1uOiAiICsgbUlkQ29sdW1uKTsKLSAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfSBjYXRjaCAoVkNhcmRFeGNlcHRpb24gZSkgewotICAgICAgICAgICAgTG9nLmUoTE9HX1RBRywgIlZDYXJkRXhjZXB0aW9uIGhhcyBiZWVuIHRocm93bjogIiArIGUuZ2V0TWVzc2FnZSgpKTsKLSAgICAgICAgICAgIHJldHVybiBmYWxzZTsKLSAgICAgICAgfSBjYXRjaCAoT3V0T2ZNZW1vcnlFcnJvciBlcnJvcikgewotICAgICAgICAgICAgLy8gTWF5YmUgc29tZSBkYXRhIChlLmcuIHBob3RvKSBpcyB0b28gYmlnIHRvIGhhdmUgaW4gbWVtb3J5LiBCdXQgaXQKLSAgICAgICAgICAgIC8vIHNob3VsZCBiZSByYXJlLgotICAgICAgICAgICAgTG9nLmUoTE9HX1RBRywgIk91dE9mTWVtb3J5RXJyb3Igb2NjdXJlZC4gSWdub3JlIHRoZSBlbnRyeS4iKTsKLSAgICAgICAgICAgIFN5c3RlbS5nYygpOwotICAgICAgICAgICAgLy8gVE9ETzogc2hvdWxkIHRlbGwgdXNlcnMgd2hhdCBoYXBwZW5lZD8KLSAgICAgICAgICAgIHJldHVybiB0cnVlOwotICAgICAgICB9IGZpbmFsbHkgewotICAgICAgICAgICAgbUN1cnNvci5tb3ZlVG9OZXh0KCk7Ci0gICAgICAgIH0KLQotICAgICAgICAvLyBUaGlzIGZ1bmN0aW9uIGRvZXMgbm90IGNhcmUgdGhlIE91dE9mTWVtb3J5RXJyb3Igb24gdGhlIGhhbmRsZXIgc2lkZQotICAgICAgICAvLyA6LVAKLSAgICAgICAgaWYgKG1DYXJlSGFuZGxlckVycm9ycykgewotICAgICAgICAgICAgTGlzdDxPbmVFbnRyeUhhbmRsZXI+IGZpbmlzaGVkTGlzdCA9IG5ldyBBcnJheUxpc3Q8T25lRW50cnlIYW5kbGVyPigKLSAgICAgICAgICAgICAgICAgICAgbUhhbmRsZXJMaXN0LnNpemUoKSk7Ci0gICAgICAgICAgICBmb3IgKE9uZUVudHJ5SGFuZGxlciBoYW5kbGVyIDogbUhhbmRsZXJMaXN0KSB7Ci0gICAgICAgICAgICAgICAgaWYgKCFoYW5kbGVyLm9uRW50cnlDcmVhdGVkKHZjYXJkKSkgewotICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgZm9yIChPbmVFbnRyeUhhbmRsZXIgaGFuZGxlciA6IG1IYW5kbGVyTGlzdCkgewotICAgICAgICAgICAgICAgIGhhbmRsZXIub25FbnRyeUNyZWF0ZWQodmNhcmQpOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgcmV0dXJuIHRydWU7Ci0gICAgfQotCi0gICAgcHJpdmF0ZSBTdHJpbmcgY3JlYXRlT25lRW50cnlJbnRlcm5hbChmaW5hbCBTdHJpbmcgY29udGFjdElkLAotICAgICAgICAgICAgTWV0aG9kIGdldEVudGl0eUl0ZXJhdG9yTWV0aG9kKS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ZXJhdG9yTWV0aG9kICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICAvLyBQbGVhc2Ugbm90ZSB0aGF0IHRoaXMgYnJhbmNoIGlzIGV4ZWN1dGVkIGJ5IHNvbWUgdGVzdHMgb25seQotICAgICAgICAgICAgICAgIHRyeSB7Ci0gICAgICAgICAgICAgICAgICAgIGVudGl0eUl0ZXJhdG9yID0gKEVudGl0eUl0ZXJhdG9yKWdldEVudGl0eUl0ZXJhdG9yTWV0aG9kLmludm9rZShudWxsLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1Db250ZW50UmVzb2x2ZXIsIHVyaSwgc2VsZWN0aW9uLCBzZWxlY3Rpb25BcmdzLCBudWxsKTsKLSAgICAgICAgICAgICAgICB9IGNhdGNoIChJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24gZSkgewotICAgICAgICAgICAgICAgICAgICBMb2cuZShMT0dfVEFHLCAiSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uIGhhcyBiZWVuIHRocm93bjogIiArCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5nZXRNZXNzYWdlKCkpOwotICAgICAgICAgICAgICAgIH0gY2F0Y2ggKElsbGVnYWxBY2Nlc3NFeGNlcHRpb24gZSkgewotICAgICAgICAgICAgICAgICAgICBMb2cuZShMT0dfVEFHLCAiSWxsZWdhbEFjY2Vzc0V4Y2VwdGlvbiBoYXMgYmVlbiB0aHJvd246ICIgKwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZ2V0TWVzc2FnZSgpKTsKLSAgICAgICAgICAgICAgICB9IGNhdGNoIChJbnZvY2F0aW9uVGFyZ2V0RXhjZXB0aW9uIGUpIHsKLSAgICAgICAgICAgICAgICAgICAgTG9nLmUoTE9HX1RBRywgIkludm9jYXRpb25UYXJnZXRFeGNlcHRpb24gaGFzIGJlZW4gdGhyb3duOiAiKTsKLSAgICAgICAgICAgICAgICAgICAgU3RhY2tUcmFjZUVsZW1lbnRbXSBzdGFja1RyYWNlRWxlbWVudHMgPSBlLmdldENhdXNlKCkuZ2V0U3RhY2tUcmFjZSgpOwotICAgICAgICAgICAgICAgICAgICBmb3IgKFN0YWNrVHJhY2VFbGVtZW50IGVsZW1lbnQgOiBzdGFja1RyYWNlRWxlbWVudHMpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIExvZy5lKExPR19UQUcsICIgICAgYXQgIiArIGVsZW1lbnQudG9TdHJpbmcoKSk7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFZDYXJkRXhjZXB0aW9uKCJJbnZvY2F0aW9uVGFyZ2V0RXhjZXB0aW9uIGhhcyBiZWVuIHRocm93bjogIiArCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5nZXRDYXVzZSgpLmdldE1lc3NhZ2UoKSk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBlbnRpdHlJdGVyYXRvciA9IFJhd0NvbnRhY3RzLm5ld0VudGl0eUl0ZXJhdG9yKG1Db250ZW50UmVzb2x2ZXIucXVlcnkoCi0gICAgICAgICAgICAgICAgICAgICAgICB1cmksIG51bGwsIHNlbGVjdGlvbiwgc2VsZWN0aW9uQXJncywgbnVsbCkpOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBpZiAoZW50aXR5SXRlcmF0b3IgPT0gbnVsbCkgewotICAgICAgICAgICAgICAgIExvZy5lKExPR19UQUcsICJFbnRpdHlJdGVyYXRvciBpcyBudWxsIik7Ci0gICAgICAgICAgICAgICAgcmV0dXJuICIiOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBpZiAoIWVudGl0eUl0ZXJhdG9yLmhhc05leHQoKSkgewotICAgICAgICAgICAgICAgIExvZy53KExPR19UQUcsICJEYXRhIGRvZXMgbm90IGV4aXN0LiBjb250YWN0SWQ6ICIgKyBjb250YWN0SWQpOwotICAgICAgICAgICAgICAgIHJldHVybiAiIjsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgd2hpbGUgKGVudGl0eUl0ZXJhdG9yLmhhc05leHQoKSkgewotICAgICAgICAgICAgICAgIEVudGl0eSBlbnRpdHkgPSBlbnRpdHlJdGVyYXRvci5uZXh0KCk7Ci0gICAgICAgICAgICAgICAgZm9yIChOYW1lZENvbnRlbnRWYWx1ZXMgbmFtZWRDb250ZW50VmFsdWVzIDogZW50aXR5LmdldFN1YlZhbHVlcygpKSB7Ci0gICAgICAgICAgICAgICAgICAgIENvbnRlbnRWYWx1ZXMgY29udGVudFZhbHVlcyA9IG5hbWVkQ29udGVudFZhbHVlcy52YWx1ZXM7Ci0gICAgICAgICAgICAgICAgICAgIFN0cmluZyBrZXkgPSBjb250ZW50VmFsdWVzLmdldEFzU3RyaW5nKERhdGEuTUlNRVRZUEUpOwotICAgICAgICAgICAgICAgICAgICBpZiAoa2V5ICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIExpc3Q8Q29udGVudFZhbHVlcz4gY29udGVudFZhbHVlc0xpc3QgPQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250ZW50VmFsdWVzTGlzdE1hcC5nZXQoa2V5KTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjb250ZW50VmFsdWVzTGlzdCA9PSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGVudFZhbHVlc0xpc3QgPSBuZXcgQXJyYXlMaXN0PENvbnRlbnRWYWx1ZXM+KCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGVudFZhbHVlc0xpc3RNYXAucHV0KGtleSwgY29udGVudFZhbHVlc0xpc3QpOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgY29udGVudFZhbHVlc0xpc3QuYWRkKGNvbnRlbnRWYWx1ZXMpOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICA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ICAgICAgICBMb2cuZShMT0dfVEFHLCAiU1FMaXRlRXhjZXB0aW9uIG9uIEN1cnNvciNjbG9zZSgpOiAiICsgZS5nZXRNZXNzYWdlKCkpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgbUN1cnNvciA9IG51bGw7Ci0gICAgICAgIH0KLQotICAgICAgICBtVGVybWluYXRlSXNDYWxsZWQgPSB0cnVlOwotICAgIH0KLQotICAgIEBPdmVycmlkZQotICAgIHB1YmxpYyB2b2lkIGZpbmFsaXplKCkgewotICAgICAgICBpZiAoIW1UZXJtaW5hdGVJc0NhbGxlZCkgewotICAgICAgICAgICAgdGVybWluYXRlKCk7Ci0gICAgICAgIH0KLSAgICB9Ci0KLSAgICBwdWJsaWMgaW50IGdldENvdW50KCkgewotICAgICAgICBpZiAobUN1cnNvciA9PSBudWxsKSB7Ci0gICAgICAgICAgICByZXR1cm4gMDsKLSAgICAgICAgfQotICAgICAgICByZXR1cm4gbUN1cnNvci5nZXRDb3VudCgpOwotICAgIH0KLQotICAgIHB1YmxpYyBib29sZWFuIGlzQWZ0ZXJMYXN0KCkgewotICAgICAgICBpZiAobUN1cnNvciA9PSBudWxsKSB7Ci0gICAgICAgICAgICByZXR1cm4gZmFsc2U7Ci0gICAgICAgIH0KLSAgICAgICAgcmV0dXJuIG1DdXJzb3IuaXNBZnRlckxhc3QoKTsKLSAgICB9Ci0KLSAgICAvKioKLSAgICAgKiBAcmV0dXJuIFJldHVybiB0aGUgZXJyb3IgcmVhc29uIGlmIHBvc3NpYmxlLgotICAgICAqLwotICAgIHB1YmxpYyBTdHJpbmcgZ2V0RXJyb3JSZWFzb24oKSB7Ci0gICAgICAgIHJldHVybiBtRXJyb3JSZWFzb247Ci0gICAgfQotfQpkaWZmIC0tZ2l0IGEvY29yZS9qYXZhL2FuZHJvaWQvcGltL3ZjYXJkL1ZDYXJkQ29uZmlnLmphdmEgYi9jb3JlL2phdmEvYW5kcm9pZC9waW0vdmNhcmQvVkNhcmRDb25maWcuamF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0gICAgICAgICAgICAgICAgSW0uUFJPVE9DT0xfR09PR0xFX1RBTEspOwotICAgIH0KLQotICAgIHN0YXRpYyBwdWJsaWMgY2xhc3MgUGhvbmVEYXRhIHsKLSAgICAgICAgcHVibGljIGZpbmFsIGludCB0eXBlOwotICAgICAgICBwdWJsaWMgZmluYWwgU3RyaW5nIGRhdGE7Ci0gICAgICAgIHB1YmxpYyBmaW5hbCBTdHJpbmcgbGFiZWw7Ci0gICAgICAgIC8vIGlzUHJpbWFyeSBpcyBjaGFuZ2FibGUgb25seSB3aGVuIHRoZXJlJ3Mgbm8gYXBwcm9wcmlhdGUgb25lIGV4aXN0aW5nIGluCi0gICAgICAgIC8vIHRoZSBvcmlnaW5hbCBWQ2FyZC4KLSAgICAgICAgcHVibGljIGJvb2xlYW4gaXNQcmltYXJ5OwotICAgICAgICBwdWJsaWMgUGhvbmVEYXRhKGludCB0eXBlLCBTdHJpbmcgZGF0YSwgU3RyaW5nIGxhYmVsLCBib29sZWFuIGlzUHJpbWFyeSkgewotICAgICAgICAgICAgdGhpcy50eXBlID0gdHlwZTsKLSAgICAgICAgICAgIHRoaXMuZGF0YSA9IGRhdGE7Ci0gICAgICAgICAgICB0aGlzLmxhYmVsID0gbGFiZWw7Ci0gICAgICAgICAgICB0aGlzLmlzUHJpbWFyeSA9IGlzUHJpbWFyeTsKLSAgICAgICAgfQotCi0gICAgICAgIEBPdmVycmlkZQotICAgICAgICBwdWJsaWMgYm9vbGVhbiBlcXVhbHMoT2JqZWN0IG9iaikgewotICAgICAgICAgICAgaWYgKCEob2JqIGluc3RhbmNlb2YgUGhvbmVEYXRhKSkgewotICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIFBob25lRGF0YSBwaG9uZURhdGEgPSAoUGhvbmVEYXRhKW9iajsKLSAgICAgICAgICAgIHJldHVybiAodHlwZSA9PSBwaG9uZURhdGEudHlwZSAmJiBkYXRhLmVxdWFscyhwaG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otCi0gICAgICAgICAgICAvLyBhZHItdmFsdWUgPSAwKjYodGV4dC12YWx1ZSAiOyIpIHRleHQtdmFsdWUKLSAgICAgICAgICAgIC8vICAgICAgICAgICA7IFBPIEJveCwgRXh0ZW5kZWQgQWRkcmVzcywgU3RyZWV0LCBMb2NhbGl0eSwgUmVnaW9uLCBQb3N0YWwKLSAgICAgICAgICAgIC8vICAgICAgICAgICA7IENvZGUsIENvdW50cnkgTmFtZQotICAgICAgICAgICAgLy8KLSAgICAgICAgICAgIC8vIFVzZSBJdGVyYXRvciBhc3N1bWluZyBMaXN0IG1heSBiZSBMaW5rZWRMaXN0LCB0aG91Z2ggYWN0dWFsbHkgaXQgaXMKLSAgICAgICAgICAgIC8vIGFsd2F5cyBBcnJheUxpc3QgaW4gdGhlIGN1cnJlbnQgaW1wbGVtZW50YXRpb24uCi0gICAgICAgICAgICBpbnQgaSA9IDA7Ci0gICAgICAgICAgICBmb3IgKFN0cmluZyBhZGRyZXNzRWxlbWVudCA6IHByb3BWYWx1ZUxpc3QpIHsKLSAgICAgICAgICAgICAgICBkYXRhQXJyYXlbaV0gPSBhZGRyZXNzRWxlbWVudDsKLSAgICAgICAgICAgICAgICBpZiAoKytpID49IHNpemUpIHsKLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICAgICAgd2hpbGUgKGkgPCBBRERSX01BWF9EQVRBX1NJWkUpIHsKLSAgICAgICAgICAgICAgICBkYXRhQXJyYXlbaSsrXSA9IG51bGw7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIHRoaXMucG9ib3ggPSBkYXRhQXJyYXlbMF07Ci0gICAgICAgICAgICB0aGlzLmV4dGVuZGVkQWRkcmVzcyA9IGRhdGFBcnJheVsxXTsKLSAgICAgICAgICAgIHRoaXMuc3RyZWV0ID0gZGF0YUFycmF5WzJdOwotICAgICAgICAgICAgdGhpcy5sb2NhbHR5ID0gZGF0YUFycmF5WzNdOwotICAgICAgICAgICAgdGhpcy5yZWdpb24gPSBkYXRhQXJyYXlbNF07Ci0gICAgICAgICAgICB0aGlzLnBvc3RhbENvZGUgPSBkYXRhQXJyYXlbNV07Ci0gICAgICAgICAgICB0aGlzLmNvdW50cnkgPSBkYXRhQXJyYXlbNl07Ci0gICAgICAgICAgICB0aGlzLmxhYmVsID0gbGFiZWw7Ci0gICAgICAgICAgICB0aGlzLmlzUHJpbWFyeSA9IGlzUHJpbWFyeTsKLSAgICAgICAgfQotCi0gICAgICAgIEBPdmVycmlkZQotICAgICAgICBwdWJsaWMgYm9vbGVhbiBlcXVhbHMoT2JqZWN0IG9iaikgewotICAgICAgICAgICAgaWYgKCEob2JqIGluc3RhbmNlb2YgUG9zdGFsRGF0YSkpIHsKLSAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBmaW5hbCBQb3N0YWxEYXRhIHBvc3RhbERhdGEgPSAoUG9zdGFsRGF0YSlvYmo7Ci0gICAgICAgICAgICByZXR1cm4gKEFycmF5cy5lcXVhbHMoZGF0YUFycmF5LCBwb3N0YWxEYXRhLmRhdGFBcnJheSkgJiYKLSAgICAgICAgICAgICAgICAgICAgKHR5cGUgPT0gcG9zdGFsRGF0YS50eXBlICYmCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgKHR5cGUgPT0gU3RydWN0dXJlZFBvc3RhbC5UWVBFX0NVU1RPTSA/Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAobGFiZWwgPT0gcG9zdGFsRGF0YS5sYWJlbCkgOiB0cnVlKSkgJiYKLSAgICAgICAgICAgICAgICAgICAgKGlzUHJpbWFyeSA9PSBwb3N0YWxEYXRhLmlzUHJpbWFyeSkpOwotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIFN0cmluZyBnZXRGb3JtYXR0ZWRBZGRyZXNzKGZpbmFsIGludCB2Y2FyZFR5cGUpIHsKLSAgICAgICAgICAgIFN0cmluZ0J1aWxkZXIgYnVpbGRlciA9IG5ldyBTdHJpbmdCdWlsZGVyKCk7Ci0gICAgICAgICAgICBib29sZWFuIGVtcHR5ID0gdHJ1ZTsKLSAgICAgICAgICAgIGlmIChWQ2FyZENvbmZpZy5pc0phcGFuZXNlRGV2aWNlKHZjYXJkVHlwZSkpIHsKLSAgICAgICAgICAgICAgICAvLyBJbiBKYXBhbiwgdGhlIG9yZGVyIGlzIHJldmVyc2VkLgotICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSBBRERSX01BWF9EQVRBX1NJWkUgLSAxOyBpID49IDA7IGktLSkgewotICAgICAgICAgICAgICAgICAgICBTdHJpbmcgYWRkcmVzc1BhcnQgPSBkYXRhQXJyYXlbaV07Ci0gICAgICAgICAgICAgICAgICAgIGlmICghVGV4dFV0aWxzLmlzRW1wdHkoYWRkcmVzc1BhcnQpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWVtcHR5KSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnVpbGRlci5hcHBlbmQoJyAnKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgZW1wdHkgPSBmYWxzZTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgIGJ1aWxkZXIuYXBwZW5kKGFkZHJlc3NQYXJ0KTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBBRERSX01BWF9EQVRBX1NJWkU7IGkrKykgewotICAgICAgICAgICAgICAgICAgICBTdHJpbmcgYWRkcmVzc1BhcnQgPSBkYXRhQXJyYXlbaV07Ci0gICAgICAgICAgICAgICAgICAgIGlmICghVGV4dFV0aWxzLmlzRW1wdHkoYWRkcmVzc1BhcnQpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWVtcHR5KSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnVpbGRlci5hcHBlbmQoJyAnKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgZW1wdHkgPSBmYWxzZTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgIGJ1aWxkZXIuYXBwZW5kKGFkZHJlc3NQYXJ0KTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgcmV0dXJuIGJ1aWxkZXIudG9TdHJpbmcoKS50cmltKCk7Ci0gICAgICAgIH0KLQotICAgICAgICBAT3ZlcnJpZGUKLSAgICAgICAgcHVibGljIFN0cmluZyB0b1N0cmluZygpIHsKLSAgICAgICAgICAgIHJldHVybiBTdHJpbmcuZm9ybWF0KCJ0eXBlOiAlZCwgbGFiZWw6ICVzLCBpc1ByaW1hcnk6ICVzIiwKLSAgICAgICAgICAgICAgICAgICAgdHlwZSwgbGFiZWwsIGlzUHJpbWFyeSk7Ci0gICAgICAgIH0KLSAgICB9Ci0KLSAgICBzdGF0aWMgcHVibGljIGNsYXNzIE9yZ2FuaXphdGlvbkRhdGEgewotICAgICAgICBwdWJsaWMgZmluYWwgaW50IHR5cGU7Ci0gICAgICAgIC8vIG5vbi1maW5hbCBpcyBJbnRlbnRpb25hbDogd2UgbWF5IGNoYW5nZSB0aGUgdmFsdWVzIHNpbmNlIHRoaXMgaW5mbyBpcyBzZXBhcmF0ZWQgaW50bwotICAgICAgICAvLyB0d28gcGFydHMgaW4gdkNhcmQ6ICJPUkciICsgIlRJVExFIi4KLSAgICAgICAgcHVibGljIFN0cmluZyBjb21wYW55TmFtZTsKLSAgICAgICAgcHVibGljIFN0cmluZyBkZXBhcnRtZW50TmFtZTsKLSAgICAgICAgcHVibGljIFN0cmluZyB0aXRsZU5hbWU7Ci0gICAgICAgIHB1YmxpYyBib29sZWFuIGlzUHJpbWFyeTsKLQotICAgICAgICBwdWJsaWMgT3JnYW5pemF0aW9uRGF0YShpbnQgdHlwZSwKLSAgICAgICAgICAgICAgICBTdHJpbmcgY29tcGFueU5hbWUsCi0gICAgICAgICAgICAgICAgU3RyaW5nIGRlcGFydG1lbnROYW1lLAotICAgICAgICAgICAgICAgIFN0cmluZyB0aXRsZU5hbWUsCi0gICAgICAgICAgICAgICAgYm9vbGVhbiBpc1ByaW1hcnkpIHsKLSAgICAgICAgICAgIHRoaXMudHlwZSA9IHR5cGU7Ci0gICAgICAgICAgICB0aGlzLmNvbXBhbnlOYW1lID0gY29tcGFueU5hbWU7Ci0gICAgICAgICAgICB0aGlzLmRlcGFydG1lbnROYW1lID0gZGVwYXJ0bWVudE5hbWU7Ci0gICAgICAgICAgICB0aGlzLnRpdGxlTmFtZSA9IHRpdGxlTmFtZTsKLSAgICAgICAgICAgIHRoaXMuaXNQcmltYXJ5ID0gaXNQcmltYXJ5OwotICAgICAgICB9Ci0KLSAgICAgICAgQE92ZXJyaWRlCi0gICAgICAgIHB1YmxpYyBib29sZWFuIGVxdWFscyhPYmplY3Qgb2JqKSB7Ci0gICAgICAgICAgICBpZiAoIShvYmogaW5zdGFuY2VvZiBPcmdhbml6YXRpb25EYXRhKSkgewotICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIE9yZ2FuaXphdGlvbkRhdGEgb3JnYW5pemF0aW9uID0gKE9yZ2FuaXphdGlvbkRhdGEpb2JqOwotICAgICAgICAgICAgcmV0dXJuICh0eXBlID09IG9yZ2FuaXphdGlvbi50eXBlICYmCi0gICAgICAgICAgICAgICAgICAgIFRleHRVdGlscy5lcXVhbHMoY29tcGFueU5hbWUsIG9yZ2FuaXphdGlvbi5jb21wYW55TmFtZSkgJiYKLSAgICAgICAgICAgICAgICAgICAgVGV4dFV0aWxzLmVxdWFscyhkZXBhcnRtZW50TmFtZSwgb3JnYW5pemF0aW9uLmRlcGFydG1lbnROYW1lKSAmJgotICAgICAgICAgICAgICAgICAgICBUZXh0VXRpbHMuZXF1YWxzKHRpdGxlTmFtZSwgb3JnYW5pemF0aW9uLnRpdGxlTmFtZSkgJiYKLSAgICAgICAgICAgICAgICAgICAgaXNQcmltYXJ5ID09IG9yZ2FuaXphdGlvbi5pc1ByaW1hcnkpOwotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIFN0cmluZyBnZXRGb3JtYXR0ZWRTdHJpbmcoKSB7Ci0gICAgICAgICAgICBmaW5hbCBTdHJpbmdCdWlsZGVyIGJ1aWxkZXIgPSBuZXcgU3RyaW5nQnVpbGRlcigpOwotICAgICAgICAgICAgaWYgKCFUZXh0VXRpbHMuaXNFbXB0eShjb21wYW55TmFtZSkpIHsKLSAgICAgICAgICAgICAgICBidWlsZGVyLmFwcGVuZChjb21wYW55TmFtZSk7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIGlmICghVGV4dFV0aWxzLmlzRW1wdHkoZGVwYXJ0bWVudE5hbWUpKSB7Ci0gICAgICAgICAgICAgICAgaWYgKGJ1aWxkZXIubGVuZ3RoKCkgPiAwKSB7Ci0gICAgICAgICAgICAgICAgICAgIGJ1aWxkZXIuYXBwZW5kKCIsICIpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBidWlsZGVyLmFwcGVuZChkZXBhcnRtZW50TmFtZSk7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIGlmICghVGV4dFV0aWxzLmlzRW1wdHkodGl0bGVOYW1lKSkgewotICAgICAgICAgICAgICAgIGlmIChidWlsZGVyLmxlbmd0aCgpID4gMCkgewotICAgICAgICAgICAgICAgICAgICBidWlsZGVyLmFwcGVuZCgiLCAiKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgYnVpbGRlci5hcHBlbmQodGl0bGVOYW1lKTsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgcmV0dXJuIGJ1aWxkZXIudG9TdHJpbmcoKTsKLSAgICAgICAgfQotCi0gICAgICAgIEBPdmVycmlkZQotICAgICAgICBwdWJsaWMgU3RyaW5nIHRvU3RyaW5nKCkgewotICAgICAgICAgICAgcmV0dXJuIFN0cmluZy5mb3JtYXQoCi0gICAgICAgICAgICAgICAgICAgICJ0eXBlOiAlZCwgY29tcGFueTogJXMsIGRlcGFydG1lbnQ6ICVzLCB0aXRsZTogJXMsIGlzUHJpbWFyeTogJXMiLAotICAgICAgICAgICAgICAgICAgICB0eXBlLCBjb21wYW55TmFtZSwgZGVwYXJ0bWVudE5hbWUsIHRpdGxlTmFtZSwgaXNQcmltYXJ5KTsKLSAgICAgICAgfQotICAgIH0KLQotICAgIHN0YXRpYyBwdWJsaWMgY2xhc3MgSW1EYXRhIHsKLSAgICAgICAgcHVibGljIGZpbmFsIGludCBwcm90b2NvbDsKLSAgICAgICAgcHVibGljIGZpbmFsIFN0cmluZyBjdXN0b21Qcm90b2NvbDsKLSAgICAgICAgcHVibGljIGZpbmFsIGludCB0eXBlOwotICAgICAgICBwdWJsaWMgZmluYWwgU3RyaW5nIGRhdGE7Ci0gICAgICAgIHB1YmxpYyBmaW5hbCBib29sZWFuIGlzUHJpbWFyeTsKLQotICAgICAgICBwdWJsaWMgSW1EYXRhKGZpbmFsIGludCBwcm90b2NvbCwgZmluYWwgU3RyaW5nIGN1c3RvbVByb3RvY29sLCBmaW5hbCBpbnQgdHlwZSwKLSAgICAgICAgICAgICAgICBmaW5hbCBTdHJpbmcgZGF0YSwgZmluYWwgYm9vbGVhbiBpc1ByaW1hcnkpIHsKLSAgICAgICAgICAgIHRoaXMucHJvdG9jb2wgPSBwcm90b2NvbDsKLSAgICAgICAgICAgIHRoaXMuY3VzdG9tUHJvdG9jb2wgPSBjdXN0b21Qcm90b2NvbDsKLSAgICAgICAgICAgIHRoaXMudHlwZSA9IHR5cGU7Ci0gICAgICAgICAgICB0aGlzLmRhdGEgPSBkYXRhOwotICAgICAgICAgICAgdGhpcy5pc1ByaW1hcnkgPSBpc1ByaW1hcnk7Ci0gICAgICAgIH0KLQotICAgICAgICBAT3ZlcnJpZGUKLSAgICAgICAgcHVibGljIGJvb2xlYW4gZXF1YWxzKE9iamVjdCBvYmopIHsKLSAgICAgICAgICAgIGlmICghKG9iaiBpbnN0YW5jZW9mIEltRGF0YSkpIHsKLSAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBJbURhdGEgaW1EYXRhID0gKEltRGF0YSlvYmo7Ci0gICAgICAgICAgICByZXR1cm4gKHR5cGUgPT0gaW1EYXRhLnR5cGUgJiYgcHJvdG9jb2wgPT0gaW1EYXRhLnByb3RvY29sCi0gICAgICAgICAgICAgICAgICAgICYmIChjdXN0b21Qcm90b2NvbCAhPSBudWxsID8gY3VzdG9tUHJvdG9jb2wuZXF1YWxzKGltRGF0YS5jdXN0b21Qcm90b2NvbCkgOgotICAgICAgICAgICAgICAgICAgICAgICAgKGltRGF0YS5jdXN0b21Qcm90b2NvbCA9PSBudWxsKSkKLSAgICAgICAgICAgICAgICAgICAgJiYgKGRhdGEgIT0gbnVsbCA/IGRhdGEuZXF1YWxzKGltRGF0YS5kYXRhKSA6IChpbURhdGEuZGF0YSA9PSBudWxsKSkKLSAgICAgICAgICAgICAgICAgICAgJiYgaXNQcmltYXJ5ID09IGltRGF0YS5pc1ByaW1hcnkpOwotICAgICAgICB9Ci0KLSAgICAgICAgQE92ZXJyaWRlCi0gICAgICAgIHB1YmxpYyBTdHJpbmcgdG9TdHJpbmcoKSB7Ci0gICAgICAgICAgICByZXR1cm4gU3RyaW5nLmZvcm1hdCgKLSAgICAgICAgICAgICAgICAgICAgInR5cGU6ICVkLCBwcm90b2NvbDogJWQsIGN1c3RvbV9wcm90Y29sOiA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NlOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgUGhvdG9EYXRhIHBob3RvRGF0YSA9IChQaG90b0RhdGEpb2JqOwotICAgICAgICAgICAgcmV0dXJuICh0eXBlID09IHBob3RvRGF0YS50eXBlICYmCi0gICAgICAgICAgICAgICAgICAgIChmb3JtYXROYW1lID09IG51bGwgPyAocGhvdG9EYXRhLmZvcm1hdE5hbWUgPT0gbnVsbCkgOgotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvcm1hdE5hbWUuZXF1YWxzKHBob3RvRGF0YS5mb3JtYXROYW1lKSkgJiYKLSAgICAgICAgICAgICAgICAgICAgKEFycmF5cy5lcXVhbHMocGhvdG9CeXRlcywgcGhvdG9EYXRhLnBob3RvQnl0ZXMpKSAmJgotICAgICAgICAgICAgICAgICAgICAoaXNQcmltYXJ5ID09IHBob3RvRGF0YS5pc1ByaW1hcnkpKTsKLSAgICAgICAgfQotCi0gICAgICAgIEBPdmVycmlkZQotICAgICAgICBwdWJsaWMgU3RyaW5nIHRvU3RyaW5nKCkgewotICAgICAgICAgICAgcmV0dXJuIFN0cmluZy5mb3JtYXQoInR5cGU6ICVkLCBmb3JtYXQ6ICVzOiBzaXplOiAlZCwgaXNQcmltYXJ5OiAlcyIsCi0gICAgICAgICAgICAgICAgICAgIHR5cGUsIGZvcm1hdE5hbWUsIHBob3RvQnl0ZXMubGVuZ3RoLCBpc1ByaW1hcnkpOwotICAgICAgICB9Ci0gICAgfQotCi0gICAgLyogcGFja2FnZSAqLyBzdGF0aWMgY2xhc3MgUHJvcGVydHkgewotICAgICAgICBwcml2YXRlIFN0cmluZyBtUHJvcGVydHlOYW1lOwotICAgICAgICBwcml2YXRlIE1hcDxTdHJpbmcsIENvbGxlY3Rpb248U3RyaW5nPj4gbVBhcmFtZXRlck1hcCA9Ci0gICAgICAgICAgICBuZXcgSGFzaE1hcDxTdHJpbmcsIENvbGxlY3Rpb248U3RyaW5nPj4oKTsKLSAgICAgICAgcHJpdmF0ZSBM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0aW9uRGF0YX0gaXMgY3JlYXRlZCwKLSAgICAgKiB3aG9zZSB0aXRsZSBpcyBzZXQgdG8gbnVsbC4KLSAgICAgKi8KLSAgICBwcml2YXRlIHZvaWQgaGFuZGxlT3JnVmFsdWUoZmluYWwgaW50IHR5cGUsIExpc3Q8U3RyaW5nPiBvcmdMaXN0LCBib29sZWFuIGlzUHJpbWFyeSkgewotICAgICAgICBpZiAob3JnTGlzdCA9PSBudWxsKSB7Ci0gICAgICAgICAgICBvcmdMaXN0ID0gc0VtcHR5TGlzdDsKLSAgICAgICAgfQotICAgICAgICBmaW5hbCBTdHJpbmcgY29tcGFueU5hbWU7Ci0gICAgICAgIGZpbmFsIFN0cmluZyBkZXBhcnRtZW50TmFtZTsKLSAgICAgICAgZmluYWwgaW50IHNpemUgPSBvcmdMaXN0LnNpemUoKTsKLSAgICAgICAgc3dpdGNoIChzaXplKSB7Ci0gICAgICAgICAgICBjYXNlIDA6IHsKLSAgICAgICAgICAgICAgICBjb21wYW55TmFtZSA9ICIiOwotICAgICAgICAgICAgICAgIGRlcGFydG1lbnROYW1lID0gbnVsbDsKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGNhc2UgMTogewotICAgICAgICAgICAgICAgIGNvbXBhbnlOYW1lID0gb3JnTGlzdC5nZXQoMCk7Ci0gICAgICAgICAgICAgICAgZGVwYXJ0bWVudE5hbWUgPSBudWxsOwotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgZGVmYXVsdDogeyAgLy8gTW9yZSB0aGFuIDEuCi0gICAgICAgICAgICAgICAgY29tcGFueU5hbWUgPSBvcmdMaXN0LmdldCgwKTsKLSAgICAgICAgICAgICAgICAvLyBXZSdyZSBub3Qgc3VyZSB3aGljaCBpcyB0aGUgY29ycmVjdCBzdHJpbmcgZm9yIGRlcGFydG1lbnQuCi0gICAgICAgICAgICAgICAgLy8gSW4gb3JkZXIgdG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Z25vcmUgIlNPVU5EO1gtSVJNQy1OIi4KLSAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgfQotCi0gICAgICAgIGludCBzaXplOwotICAgICAgICBpZiAoZWxlbXMgPT0gbnVsbCB8fCAoc2l6ZSA9IGVsZW1zLnNpemUoKSkgPCAxKSB7Ci0gICAgICAgICAgICByZXR1cm47Ci0gICAgICAgIH0KLQotICAgICAgICAvLyBBc3N1bWUgdGhhdCB0aGUgb3JkZXIgaXMgIkZhbWlseSwgR2l2ZW4sIE1pZGRsZSIuCi0gICAgICAgIC8vIFRoaXMgaXMgbm90IGZyb20gc3BlY2lmaWNhdGlvbiBidXQgbWVyZSBhc3N1bXB0aW9uLiBTb21lIEphcGFuZXNlIHBob25lcyB1c2UgdGhpcyBvcmRlci4KLSAgICAgICAgaWYgKHNpemUgPiAzKSB7Ci0gICAgICAgICAgICBzaXplID0gMzsKLSAgICAgICAgfQotCi0gICAgICAgIGlmIChlbGVtcy5nZXQoMCkubGVuZ3RoKCkgPiAwKSB7Ci0gICAgICAgICAgICBib29sZWFuIG9ubHlGaXJzdEVsZW1Jc05vbkVtcHR5ID0gdHJ1ZTsKLSAgICAgICAgICAgIGZvciAoaW50IGkgPSAxOyBpIDwgc2l6ZTsgaSsrKSB7Ci0gICAgICAgICAgICAgICAgaWYgKGVsZW1zLmdldChpKS5sZW5ndGgoKSA+IDApIHsKLSAgICAgICAgICAgICAgICAgICAgb25seUZpcnN0RWxlbUlzTm9uRW1wdHkgPSBmYWxzZTsKLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKG9ubHlGaXJzdEVsZW1Jc05vbkVtcHR5KSB7Ci0gICAgICAgICAgICAgICAgZmluYWwgU3RyaW5nW10gbmFtZXNBcnJheSA9IGVsZW1zLmdldCgwKS5zcGxpdCgiICIpOwotICAgICAgICAgICAgICAgIGZpbmFsIGludCBuYW1lQXJyYXlMZW5ndGggPSBuYW1lc0FycmF5Lmxlbmd0aDsKLSAgICAgICAgICAgICAgICBpZiAobmFtZUFycmF5TGVuZ3RoID09IDMpIHsKLSAgICAgICAgICAgICAgICAgICAgLy8gQXNzdW1lIHRoZSBzdHJpbmcgaXMgIkZhbWlseSBNaWRkbGUgR2l2ZW4iLgotICAgICAgICAgICAgICAgICAgICBtUGhvbmV0aWNGYW1pbHlOYW1lID0gbmFtZXNBcnJheVswXTsKLSAgICAgICAgICAgICAgICAgICAgbVBob25ldGljTWlkZGxlTmFtZSA9IG5hbWVzQXJyYXlbMV07Ci0gICAgICAgICAgICAgICAgICAgIG1QaG9uZXRpY0dpdmVuTmFtZSA9IG5hbWVzQXJyYXlbMl07Ci0gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChuYW1lQXJyYXlMZW5ndGggPT0gMikgewotICAgICAgICAgICAgICAgICAgICAvLyBBc3N1bWUgdGhlIHN0cmluZyBpcyAiRmFtaWx5IEdpdmVuIiBiYXNlZCBvbiB0aGUgSmFwYW5lc2UgbW9iaWxlCi0gICAgICAgICAgICAgICAgICAgIC8vIHBob25lcycgcHJlZmVyZW5jZS4KLSAgICAgICAgICAgICAgICAgICAgbVBob25ldGljRmFtaWx5TmFtZSA9IG5hbWVzQXJyYXlbMF07Ci0gICAgICAgICAgICAgICAgICAgIG1QaG9uZXRpY0dpdmVuTmFtZSA9IG5hbWVzQXJyYXlbMV07Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgbVBob25ldGljRnVsbE5hbWUgPSBlbGVtcy5nZXQoMCk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCi0gICAgICAgIHN3aXRjaCAoc2l6ZSkgewotICAgICAgICAgICAgLy8gZmFsbHRocm91Z2gKLSAgICAgICAgICAgIGNhc2UgMzogbVBob25ldGljTWlkZGxlTmFtZSA9IGVs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BbmRyb2lkIGNhbm5vdCB1bmRlcnN0YW5kIHdoYXQgaXQgaXMuCi0gICAgICAgICAgICB9Ci0gICAgICAgIH0gZWxzZSBpZiAocHJvcE5hbWUuZXF1YWxzKFZDYXJkQ29uc3RhbnRzLlBST1BFUlRZX0FEUikpIHsKLSAgICAgICAgICAgIGJvb2xlYW4gdmFsdWVzQXJlQWxsRW1wdHkgPSB0cnVlOwotICAgICAgICAgICAgZm9yIChTdHJpbmcgdmFsdWUgOiBwcm9wVmFsdWVMaXN0KSB7Ci0gICAgICAgICAgICAgICAgaWYgKHZhbHVlLmxlbmd0aCgpID4gMCkgewotICAgICAgICAgICAgICAgICAgICB2YWx1ZXNBcmVBbGxFbXB0eSA9IGZhbHNlOwotICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAodmFsdWVzQXJlQWxsRW1wdHkpIHsKLSAgICAgICAgICAgICAgICByZXR1cm47Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIGludCB0eXBlID0gLTE7Ci0gICAgICAgICAgICBTdHJpbmcgbGFiZWwgPSAiIjsKLSAgICAgICAgICAgIGJvb2xlYW4gaXNQcmltYXJ5ID0gZmFsc2U7Ci0gICAgICAgICAgICBDb2xsZWN0aW9uPFN0cmluZz4gdHlwZUNvbGxlY3Rpb24gPSBwYXJhbU1hcC5nZXQoVkNhcmRDb25zdGFudHMuUEFSQU1fVFlQRSk7Ci0gICAgICAgICAgICBpZiAodHlwZUNvbGxlY3Rpb24gIT0gbnVsbCkgewotICAgICAgICAgICAgICAgIGZvciAoU3RyaW5nIHR5cGVTdHJpbmcgOiB0eXBlQ29sbGVjdGlvbikgewotICAgICAgICAgICAgICAgICAgICB0eXBlU3RyaW5nID0gdHlwZVN0cmluZy50b1VwcGVyQ2FzZSgpOwotICAgICAgICAgICAgICAgICAgICBpZiAodHlwZVN0cmluZy5lcXVhbHMoVkNhcmRDb25zdGFudHMuUEFSQU1fVFlQRV9QUkVGKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgaXNQcmltYXJ5ID0gdHJ1ZTsKLSAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICh0eXBlU3RyaW5nLmVxdWFscyhWQ2FyZENvbnN0YW50cy5QQVJBTV9UWVBFX0hPTUUpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICB0eXBlID0gU3RydWN0dXJlZFBvc3RhbC5UWVBFX0hPTUU7Ci0gICAgICAgICAgICAgICAgICAgICAgICBsYWJlbCA9ICIiOwotICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHR5cGVTdHJpbmcuZXF1YWxzKFZDYXJkQ29uc3RhbnRzLlBBUkFNX1RZUEVfV09SSykgfHwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlU3RyaW5nLmVxdWFsc0lnbm9yZUNhc2UoVkNhcmRDb25zdGFudHMuUEFSQU1fRVhUUkFfVFlQRV9DT01QQU5ZKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgLy8gIkNPTVBBTlkiIHNlZW1zIGVtaXR0ZWQgYnkgV2luZG93cyBNb2JpbGUsIHdoaWNoIGlzIG5vdAotICAgICAgICAgICAgICAgICAgICAgICAgLy8gc3BlY2lmaWNhbGx5IHN1cHBvcnRlZCBieSB2Q2FyZCAyLjEuIFdlIGFzc3VtZSB0aGlzIGlzIHNhbWUKLSAgICAgICAgICAgICAgICAgICAgICAgIC8vIGFzICJXT1JLIi4KLSAgICAgICAgICAgICAgICAgICAgICAgIHR5cGUgPSBTdHJ1Y3R1cmVkUG9zdGFsLlRZUEVfV09SSzsKLSAgICAgICAgICAgICAgICAgICAgICAgIGxhYmVsID0gIiI7Ci0gICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAodHlwZVN0cmluZy5lcXVhbHMoVkNhcmRDb25zdGFudHMuUEFSQU1fQURSX1RZUEVfUEFSQ0VMKSB8fAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGVTdHJpbmcuZXF1YWxzKFZDYXJkQ29uc3RhbnRzLlBBUkFNX0FEUl9UWVBFX0RPTSkgfHwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlU3RyaW5nLmVxdWFscyhWQ2FyZENvbnN0YW50cy5QQVJBTV9BRFJfVFlQRV9JTlRMKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgLy8gV2UgZG8gbm90IGhhdmUgYW55IGFwcHJvcHJpYXRlIHdheSB0byBzdG9yZSB0aGlzIGluZm9ybWF0aW9uLgotICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVTdHJpbmcuc3RhcnRzV2l0aCgiWC0iKSAmJiB0eXBlIDwgMCkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGVTdHJpbmcgPSB0eXBlU3RyaW5nLnN1YnN0cmluZygyKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgIC8vIHZDYXJkIDMuMCBhbGxvd3MgaWFuYS10b2tlbi4gQWxzbyBzb21lIHZDYXJkIDIuMSBleHBvcnRlcnMKLSAgICAgICAgICAgICAgICAgICAgICAgIC8vIGVtaXQgbm9uLXN0YW5kYXJkIHR5cGVzLiBXZSBkbyBub3QgaGFuZGxlIHRoZWlyIHZhbHVlcyBub3cuCi0gICAgICAgICAgICAgICAgICAgICAgICB0eXBlID0gU3RydWN0dXJlZFBvc3RhbC5UWVBFX0NVU1RPTTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGxhYmVsID0gdHlwZVN0cmluZzsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIC8vIFdlIHVzZSAiSE9NRSIgYXMgZGVmYXVsdAotICAgICAgICAgICAgaWYgKHR5cGUgPCAwKSB7Ci0gICAgICAgICAgICAgICAgdHlwZSA9IFN0cnVjdHVyZWRQb3N0YWwuVFlQRV9IT01FOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBhZGRQb3N0YWwodHlwZSwgcHJvcFZhbHVlTGlzdCwgbGFiZWwsIGlzUHJpbWFyeSk7Ci0gICAgICAgIH0gZWxzZSBpZiAocHJvcE5hbWUuZXF1YWxzKFZDYXJkQ29uc3RhbnRzLlBST1BFUlRZX0VNQUlMKSkgewotICAgICAgICAgICAgaW50IHR5cGUgPSAtMTsKLSAgICAgICAgICAgIFN0cmluZyBsYWJlbCA9IG51bGw7Ci0gICAgICAgICAgICBib29sZWFuIGlzUHJpbWFyeSA9IGZhbHNlOwotICAgICAgICAgICAgQ29sbGVjdGlvbjxTdHJpbmc+IHR5cGVDb2xsZWN0aW9uID0gcGFyYW1NYXAuZ2V0KFZDYXJkQ29uc3RhbnRzLlBBUkFNX1RZUEUpOwotICAgICAgICAgICAgaWYgKHR5cGVDb2xsZWN0aW9uICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICBmb3IgKFN0cmluZyB0eXBlU3RyaW5nIDogdHlwZUNvbGxlY3Rpb24pIHsKLSAgICAgICAgICAgICAgICAgICAgdHlwZVN0cmluZyA9IHR5cGVTdHJpbmcudG9VcHBlckNhc2UoKTsKLSAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVTdHJpbmcuZXF1YWxzKFZDYXJkQ29uc3RhbnRzLlBBUkFNX1RZUEVfUFJFRikpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlzUHJpbWFyeSA9IHRydWU7Ci0gICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAodHlwZVN0cmluZy5lcXVhbHMoVkNhcmRDb25zdGFudHMuUEFSQU1fVFlQRV9IT01FKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgdHlwZSA9IEVtYWlsLlRZUEVfSE9NRTsKLSAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICh0eXBlU3RyaW5nLmVxdWFscyhWQ2FyZENvbnN0YW50cy5QQVJBTV9UWVBFX1dPUkspKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICB0eXBlID0gRW1haWwuVFlQRV9XT1JLOwotICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHR5cGVTdHJpbmcuZXF1YWxzKFZDYXJkQ29uc3RhbnRzLlBBUkFNX1RZUEVfQ0VMTCkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHR5cGUgPSBFbWFpbC5UWVBFX01PQklMRTsKLSAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0eXBlU3RyaW5nLnN0YXJ0c1dpdGgoIlgtIikgJiYgdHlwZSA8IDApIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlU3RyaW5nID0gdHlwZVN0cmluZy5zdWJzdHJpbmcoMik7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICAvLyB2Q2FyZCAzLjAgYWxsb3dzIGlhbmEtdG9rZW4uCi0gICAgICAgICAgICAgICAgICAgICAgICAvLyBXZSBtYXkgaGF2ZSBJTlRFUk5FVCAoc3BlY2lmaWVkIGluIHZDYXJkIHNwZWMpLAotICAgICAgICAgICAgICAgICAgICAgICAgLy8gU0NIT09MLCBldGMuCi0gICAgICAgICAgICAgICAgICAgICAgICB0eXBlID0gRW1haWwuVFlQRV9DVVNUT007Ci0gICAgICAgICAgICAgICAgICAgICAgICBsYWJlbCA9IHR5cGVTdHJpbmc7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAodHlwZSA8IDApIHsKLSAgICAgICAgICAgICAgICB0eXBlID0gRW1haWwuVFlQRV9PVEhFUjsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGFkZEVtYWlsKHR5cGUsIHByb3BWYWx1ZSwgb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QU1fVFlQRV9QUkVGLmVxdWFscyh0eXBlVmFsdWUpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNQcmltYXJ5ID0gdHJ1ZTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoZm9ybWF0TmFtZSA9PSBudWxsKXsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3JtYXROYW1lID0gdHlwZVZhbHVlOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGFkZFBob3RvQnl0ZXMoZm9ybWF0TmFtZSwgcHJvcEJ5dGVzLCBpc1ByaW1hcnkpOwotICAgICAgICAgICAgfQotICAgICAgICB9IGVsc2UgaWYgKHByb3BOYW1lLmVxdWFscyhWQ2FyZENvbnN0YW50cy5QUk9QRVJUWV9URUwpKSB7Ci0gICAgICAgICAgICBmaW5hbCBDb2xsZWN0aW9uPFN0cmluZz4gdHlwZUNvbGxlY3Rpb24gPSBwYXJhbU1hcC5nZXQoVkNhcmRDb25zdGFudHMuUEFSQU1fVFlQRSk7Ci0gICAgICAgICAgICBmaW5hbCBPYmplY3QgdHlwZU9iamVjdCA9Ci0gICAgICAgICAgICAgICAgVkNhcmRVdGlscy5nZXRQaG9uZVR5cGVGcm9tU3RyaW5ncyh0eXBlQ29sbGVjdGlvbiwgcHJvcFZhbHVlKTsKLSAgICAgICAgICAgIGZpbmFsIGludCB0eXBlOwotICAgICAgICAgICAgZmluYWwgU3RyaW5nIGxhYmVsOwotICAgICAgICAgICAgaWYgKHR5cGVPYmplY3QgaW5zdGFuY2VvZiBJbnRlZ2VyKSB7Ci0gICAgICAgICAgICAgICAgdHlwZSA9IChJbnRlZ2VyKXR5cGVPYmplY3Q7Ci0gICAgICAgICAgICAgICAgbGFiZWwgPSBudWxsOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICB0eXBl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KLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgaXNQcmltYXJ5ID0gZmFsc2U7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBhZGRQaG9uZSh0eXBlLCBwcm9wVmFsdWUsIG51bGwsIGlzUHJpbWFyeSk7Ci0gICAgICAgIH0gZWxzZSBpZiAoc0ltTWFwLmNvbnRhaW5zS2V5KHByb3BOYW1lKSkgewotICAgICAgICAgICAgZmluYWwgaW50IHByb3RvY29sID0gc0ltTWFwLmdldChwcm9wTmFtZSk7Ci0gICAgICAgICAgICBib29sZWFuIGlzUHJpbWFyeSA9IGZhbHNlOwotICAgICAgICAgICAgaW50IHR5cGUgPSAtMTsKLSAgICAgICAgICAgIGZpbmFsIENvbGxlY3Rpb248U3RyaW5nPiB0eXBlQ29sbGVjdGlvbiA9IHBhcmFtTWFwLmdldChWQ2FyZENvbnN0YW50cy5QQVJBTV9UWVBFKTsKLSAgICAgICAgICAgIGlmICh0eXBlQ29sbGVjdGlvbiAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgZm9yIChTdHJpbmcgdHlwZVN0cmluZyA6IHR5cGVDb2xsZWN0aW9uKSB7Ci0gICAgICAgICAgICAgICAgICAgIGlmICh0eXBlU3RyaW5nLmVxdWFscyhWQ2FyZENvbnN0YW50cy5QQVJBTV9UWVBFX1BSRUYpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpc1ByaW1hcnkgPSB0cnVlOwotICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHR5cGUgPCAwKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAodHlwZVN0cmluZy5lcXVhbHNJZ25vcmVDYXNlKFZDYXJkQ29uc3RhbnRzLlBBUkFNX1RZUEVfSE9NRSkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlID0gSW0uVFlQRV9IT01FOwotICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICh0eXBlU3RyaW5nLmVxdWFsc0lnbm9yZUNhc2UoVkNhcmRDb25zdGFudHMuUEFSQU1fVFlQRV9XT1JLKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGUgPSBJbS5UWVBFX1dPUks7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAodHlwZSA8IDApIHsKLSAgICAgICAgICAgICAgICB0eXBlID0gUGhvbmUuVFlQRV9IT01FOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgYWRkSW0ocHJvdG9jb2wsIG51bGwsIHR5cGUsIHByb3BWYWx1ZSwgaXNQcmltYXJ5KTsKLSAgICAgICAgfSBlbHNlIGlmIChwcm9wTmFtZS5lcXVhbHMoVkNhcmRDb25zdGFudHMuUFJPUEVSVFlfTk9URSkpIHsKLSAgICAgICAgICAgIGFkZE5vdGUocHJvcFZhbHVlKTsKLSAgICAgICAgfSBlbHNlIGlmIChwcm9wTmFtZS5lcXVhbHMoVkNhcmRDb25zdGFudHMuUFJPUEVSVFlfVVJMKSkgewotICAgICAgICAgICAgaWYgKG1XZWJzaXRlTGlzdCA9PSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgbVdlYnNpdGVMaXN0ID0gbmV3IEFycmF5TGlzdDxTdHJpbmc+KDEpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgbVdlYnNpdGVMaXN0LmFkZChwcm9wVmFsdWUpOwotICAgICAgICB9IGVsc2UgaWYgKHByb3BOYW1lLmVxdWFscyhWQ2FyZENvbnN0YW50cy5QUk9QRVJUWV9CREFZKSkgewotICAgICAgICAgICAgbUJpcnRoZGF5ID0gcHJvcFZhbHVlOwotICAgICAgICB9IGVsc2UgaWYgKHByb3BOYW1lLmVxdWFscyhWQ2FyZENvbnN0YW50cy5QUk9QRVJUWV9YX1BIT05FVElDX0ZJUlNUX05BTUUpK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gICAgICAgICAgICAgICB0cnkgewotICAgICAgICAgICAgICAgICAgICBpZiAoY3Vyc29yICE9IG51bGwgJiYgY3Vyc29yLm1vdmVUb0ZpcnN0KCkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIG15R3JvdXBzSWQgPSBjdXJzb3IuZ2V0U3RyaW5nKDApOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKLSAgICAgICAgICAgICAgICAgICAgaWYgKGN1cnNvciAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBjdXJzb3IuY2xvc2UoKTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgIGJ1aWxkZXIud2l0aFZhbHVlKFJhd0NvbnRhY3RzLkFDQ09VTlRfTkFNRSwgbnVsbCk7Ci0gICAgICAgICAgICBidWlsZGVyLndpdGhWYWx1ZShSYXdDb250YWN0cy5BQ0NPVU5UX1RZUEUsIG51bGwpOwotICAgICAgICB9Ci0gICAgICAgIG9wZXJhdGlvbkxpc3QuYWRkKGJ1aWxkZXIuYnVpbGQoKSk7Ci0KLSAgICAgICAgaWYgKCFuYW1lRmllbGRzQXJlRW1wdHkoKSkgewotICAgICAgICAgICAgYnVpbGRlciA9IENvbnRlbnRQcm92aWRlck9wZXJhdGlvbi5uZXdJbnNlcnQoRGF0YS5DT05URU5UX1VSSSk7Ci0gICAgICAgICAgICBidWlsZGVyLndpdGhWYWx1ZUJhY2tSZWZlcmVuY2UoU3RydWN0dXJlZE5hbWUuUkFXX0NPTlRBQ1RfSUQsIDApOwotICAgICAgICAgICAgYnVpbGRlci53aXRoVmFsdWUoRGF0YS5NSU1FVFlQRSwgU3RydWN0dXJlZE5hbWUuQ09OVEVOVF9JVEVNX1RZUEUpOwotCi0gICAgICAgICAgICBidWlsZGVyLndpdGhWYWx1ZShTdH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gaWYgKG1QaG9uZUxpc3QgIT0gbnVsbCkgewotICAgICAgICAgICAgZm9yIChQaG9uZURhdGEgcGhvbmVEYXRhIDogbVBob25lTGlzdCkgewotICAgICAgICAgICAgICAgIGJ1aWxkZXIgPSBDb250ZW50UHJvdmlkZXJPcGVyYXRpb24ubmV3SW5zZXJ0KERhdGEuQ09OVEVOVF9VUkkpOwotICAgICAgICAgICAgICAgIGJ1aWxkZXIud2l0aFZhbHVlQmFja1JlZmVyZW5jZShQaG9uZS5SQVdfQ09OVEFDVF9JRCwgMCk7Ci0gICAgICAgICAgICAgICAgYnVpbGRlci53aXRoVmFsdWUoRGF0YS5NSU1FVFlQRSwgUGhvbmUuQ09OVEVOVF9JVEVNX1RZUEUpOwotCi0gICAgICAgICAgICAgICAgYnVpbGRlci53aXRoVmFsdWUoUGhvbmUuVFlQRSwgcGhvbmVEYXRhLnR5cGUpOwotICAgICAgICAgICAgICAgIGlmIChwaG9uZURhdGEudHlwZSA9PSBQaG9uZS5UWVBFX0NVU1RPTSkgewotICAgICAgICAgICAgICAgICAgICBidWlsZGVyLndpdGhWYWx1ZShQaG9uZS5MQUJFTCwgcGhvbmVEYXRhLmxhYmVsKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgYnVpbGRlci53aXRoVmFsdWUoUGhvbmUuTlVNQkVSLCBwaG9uZURhdGEuZGF0YSk7Ci0gICAgICAgICAgICAgICAgaWYgKHBob25lRGF0YS5pc1ByaW1hcnkpIHsKLSAgICAgICAgICAgICAgICAgICAgYnVpbGRlci53aXRoVmFsdWUoUGhvbmUuSVNfUFJJTUFSWSwgMSk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIG9wZXJhdGlvbkxpc3QuYWRkKGJ1aWxkZXIuYnVpbGQoKSk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQotICAgICAgICBpZiAobU9yZ2FuaXphdGlvbkxpc3QgIT0gbnVsbCkgewotICAgICAgICAgICAgZm9yIChPcmdhbml6YXRpb25EYXRhIG9yZ2FuaXphdGlvbkRhdGEgOiBtT3JnYW5pemF0aW9uTGlzdCkgewotICAgICAgICAgICAgICAgIGJ1aWxkZXIgPSBDb250ZW50UHJvdmlkZXJPcGVyYXRpb24ubmV3SW5zZXJ0KERhdGEuQ09OVEVOVF9VUkkpOwotICAgICAgICAgICAgICAgIGJ1aWxkZXIud2l0aFZhbHVlQmFja1JlZmVyZW5jZShPcmdhbml6YXRpb24uUkFXX0NPTlRBQ1RfSUQsIDApOwotICAgICAgICAgICAgICAgIGJ1aWxkZXIud2l0aFZhbHVlKERhdGEuTUlNRVRZUEUsIE9yZ2FuaXphdGlvbi5DT05URU5UX0lURU1fVFlQRSk7Ci0gICAgICAgICAgICAgICAgYnVpbGRlci53aXRoVmFsdWUoT3JnYW5pemF0aW9uLlRZUEUsIG9yZ2FuaXphdGlvbkRhdGEudHlwZSk7Ci0gICAgICAgICAgICAgICAgaWYgKG9yZ2FuaXphdGlvbkRhdGEuY29tcGFueU5hbWUgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICBidWlsZGVyLndpdGhWYWx1ZShPcmdhbml6YXRpb24uQ09NUEFOWSwgb3JnYW5pemF0aW9uRGF0YS5jb21wYW55TmFtZSk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGlmIChvcmdhbml6YXRpb25EYXRhLmRlcGFydG1lbnROYW1lICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgYnVpbGRlci53aXRoVmFsdWUoT3JnYW5pemF0aW9uLkRFUEFSVE1FTlQsIG9yZ2FuaXphdGlvbkRhdGEuZGVwYXJ0bWVudE5hbWUpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBpZiAob3JnYW5pemF0aW9uRGF0YS50aXRsZU5hbWUgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICBidWlsZGVyLndpdGhWYWx1ZShPcmdhbml6YXRpb24uVElUTEUsIG9yZ2FuaXphdGlvbkRhdGEudGl0bGVOYW1lKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgaWYgKG9yZ2FuaXphdGlvbkRhdGEuaXNQcmltYXJ5KSB7Ci0gICAgICAgICAgICAgICAgICAgIGJ1aWxkZXIud2l0aFZhbHVlKE9yZ2FuaXphdGlvbi5JU19QUklNQVJZLCAxKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgb3BlcmF0aW9uTGlzdC5hZGQoYnVpbGRlci5idWlsZCgpKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCi0gICAgICAgIGlmIChtRW1haWxMaXN0ICE9IG51bGwpIHsKLSAgICAgICAgICAgIGZvciAoRW1haWxEYXRhIGVtYWlsRGF0YSA6IG1FbWFpbExpc3QpIHsKLSAgICAgICAgICAgICAgICBidWlsZGVyID0gQ29udGVudFByb3ZpZGVyT3BlcmF0aW9uLm5ld0luc2VydChEYXRhLkNPTlRFTlRfVVJJKTsKLSAgICAgICAgICAgICAgICBidWlsZGVyLndpdGhWYWx1ZUJhY2tSZWZlcmVuY2UoRW1haWwuUkFXX0NPTlRBQ1RfSUQsIDApOwotICAgICAgICAgICAgICAgIGJ1aWxkZXIud2l0aFZhbHVlKERhdGEuTUlNRVRZUEUsIEVtYWlsLkNPTlRFTlRfSVRFTV9UWVBFKTsKLQotICAgICAgICAgICAgICAgIGJ1aWxkZXIud2l0aFZhbHVlKEVtYWlsLlRZUEUsIGVtYWlsRGF0YS50eXBlKTsKLSAgICAgICAgICAgICAgICBpZiAoZW1haWxEYXRhLnR5cGUgPT0gRW1haWwuVFlQRV9DVVNUT00pIHsKLSAgICAgICAgICAgICAgICAgICAgYnVpbGRlci53aXRoVmFsdWUoRW1haWwuTEFCRUwsIGVtYWlsRGF0YS5sYWJlbCk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGJ1aWxkZXIud2l0aFZhbHVlKEVtYWlsLkRBVEEsIGVtYWlsRGF0YS5kYXRhKTsKLSAgICAgICAgICAgICAgICBpZiAoZW1haWxEYXRhLmlzUHJpbWFyeSkgewotICAgICAgICAgICAgICAgICAgICBidWlsZGVyLndpdGhWYWx1ZShEYXRhLklTX1BSSU1BUlksIDEpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBvcGVyYXRpb25MaXN0LmFkZChidWlsZGVyLmJ1aWxkKCkpOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgaWYgKG1Qb3N0YWxMaXN0ICE9IG51bGwpIHsKLSAgICAgICAgICAgIGZvciAoUG9zdGFsRGF0YSBwb3N0YWxEYXRhIDogbVBvc3RhbExpc3QpIHsKLSAgICAgICAgICAgICAgICBidWlsZGVyID0gQ29udGVudFByb3ZpZGVyT3BlcmF0aW9uLm5ld0luc2VydChEYXRhLkNPTlRFTlRfVVJJKTsKLSAgICAgICAgICAgICAgICBWQ2FyZFV0aWxzLmluc2VydFN0cnVjdHVyZWRQb3N0YWxEYXRhVXNpbmdDb250YWN0c1N0cnVjdCgKLSAgICAgICAgICAgICAgICAgICAgICAgIG1WQ2FyZFR5cGUsIGJ1aWxkZXIsIHBvc3RhbERhdGEpOwotICAgICAgICAgICAgICAgIG9wZXJhdGlvbkxpc3QuYWRkKGJ1aWxkZXIuYnVpbGQoKSk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQotICAgICAgICBpZiAobUltTGlzdCAhPSBudWxsKSB7Ci0gICAgICAgICAgICBmb3IgKEltRGF0YSBpbURhdGEgOiBtSW1MaXN0KSB7Ci0gICAgICAgICAgICAgICAgYnVpbGRlciA9IENvbnRlbnRQcm92aWRlck9wZXJhdGlvbi5uZXdJbnNlcnQoRGF0YS5DT05URU5UX1VSSSk7Ci0gICAgICAgICAgICAgICAgYnVpbGRlci53aXRoVmFsdWVCYWNrUmVmZXJlbmNlKEltLlJBV19DT05UQUNUX0lELCAwKTsKLSAgICAgICAgICAgICAgICBidWlsZGVyLndpdGhWYWx1ZShEYXRhLk1JTUVUWVBFLCBJbS5DT05URU5UX0lURU1fVFlQRSk7Ci0gICAgICAgICAgICAgICAgYnVpbGRlci53aXRoVmFsdWUoSW0uVFlQRSwgaW1EYXRhLnR5cGUpOwotICAgICAgICAgICAgICAgIGJ1aWxkZXIud2l0aFZhbHVlKEltLlBST1RPQ09MLCBpbURhdGEucHJvdG9jb2wpOwotICAgICAgICAgICAgICAgIGlmIChpbURhdGEucHJvdG9jb2wgPT0gSW0uUFJPVE9DT0xfQ1VTVE9NKSB7Ci0gICAgICAgICAgICAgICAgICAgIGJ1aWxkZXIud2l0aFZhbHVlKEltLkNVU1RPTV9QUk9UT0NPTCwgaW1EYXRhLmN1c3RvbVByb3RvY29sKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgaWYgKGltRGF0YS5pc1ByaW1hcnkpIHsKLSAgICAgICAgICAgICAgICAgICAgYnVpbGRlci53aXRoVmFsdWUoRGF0YS5JU19QUklNQVJZLCAxKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQotICAgICAgICBpZiAobU5vdGVMaXN0ICE9IG51bGwpIHsKLSAgICAgICAgICAgIGZvciAoU3RyaW5nIG5vdGUgOiBtTm90ZUxpc3QpIHsKLSAgICAgICAgICAgICAgICBidWlsZGVyID0gQ29udGVudFByb3ZpZGVyT3BlcmF0aW9uLm5ld0luc2VydChEYXRhLkNPTlRFTlRfVVJJKTsKLSAgICAgICAgICAgICAgICBidWlsZGVyLndpdGhWYWx1ZUJhY2tSZWZlcmVuY2UoTm90ZS5SQVdfQ09OVEFDVF9JRCwgMCk7Ci0gICAgICAgICAgICAgICAgYnVpbGRlci53aXRoVmFsdWUoRGF0YS5NSU1FVFlQRSwgTm90ZS5DT05URU5UX0lURU1fVFlQRSk7Ci0gICAgICAgICAgICAgICAgYnVpbGRlci53aXRoVmFsdWUoTm90ZS5OT1RFLCBub3RlKTsKLSAgICAgICAgICAgICAgICBvcGVyYXRpb25MaXN0LmFkZChidWlsZGVyLmJ1aWxkKCkpOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgaWYgKG1QaG90b0xpc3QgIT0gbnVsbCkgewotICAgICAgICAgICAgZm9yIChQaG90b0RhdGEgcGhvdG9EYXRhIDogbVBob3RvTGlzdCkgewotICAgICAgICAgICAgICAgIGJ1aWxkZXIgPSBDb250ZW50UHJvdmlkZXJPcGVyYXRpb24ubmV3SW5zZXJ0KERhdGEuQ09OVEVOVF9VUkkpOwotICAgICAgICAgICAgICAgIGJ1aWxkZXIud2l0aFZhbHVlQmFja1JlZmVyZW5jZShQaG90by5SQVdfQ09OVEFDVF9JRCwgMCk7Ci0gICAgICAgICAgICAgICAgYnVpbGRlci53aXRoVmFsdWUoRGF0YS5NSU1FVFlQRSwgUGhvdG8uQ09OVEVOVF9JVEVNX1RZUEUpOwotICAgICAgICAgICAgICAgIGJ1aWxkZXIud2l0aFZhbHVlKFBob3RvLlBIT1RPLCBwaG90b0RhdGEucGhvdG9CeXRlcyk7Ci0gICAgICAgICAgICAgICAgaWYgKHBob3RvRGF0YS5pc1ByaW1hcnkpIHsKLSAgICAgICAgICAgICAgICAgICAgYnVpbGRlci53aXRoVmFsdWUoUGhvdG8uSVNfUFJJTUFSWSwgMSk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIG9wZXJhdGlvbkxpc3QuYWRkKGJ1aWxkZXIuYnVpbGQoKSk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQotICAgICAgICBpZiAobVdlYnNpdGVMaXN0ICE9IG51bGwpIHsKLSAgICAgICAgICAgIGZvciAoU3RyaW5nIHdlYnNpdGUgOiBtV2Vic2l0ZUxpc3QpIHsKLSAgICAgICAgICAgICAgICBidWlsZGVyID0gQ29udGVudFByb3ZpZGVyT3BlcmF0aW9uLm5ld0luc2VydChEYXRhLkNPTlRFTlRfVVJJKTsK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AgICAgICBpZiAoaSA9PSAwKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBmaW5hbCBTdHJpbmcgbWltZVR5cGUgPSBjdXN0b21Qcm9wZXJ0eVZhbHVlOwotICAgICAgICAgICAgICAgICAgICAgICAgYnVpbGRlciA9IENvbnRlbnRQcm92aWRlck9wZXJhdGlvbi5uZXdJbnNlcnQoRGF0YS5DT05URU5UX1VSSSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBidWlsZGVyLndpdGhWYWx1ZUJhY2tSZWZlcmVuY2UoR3JvdXBNZW1iZXJzaGlwLlJBV19DT05UQUNUX0lELCAwKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGJ1aWxkZXIud2l0aFZhbHVlKERhdGEuTUlNRVRZUEUsIG1pbWVUeXBlKTsKLSAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsgIC8vIDEgPD0gaSAmJiBpIDw9IE1BWF9EQVRBX0NPTFVNTlMKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmICghVGV4dFV0aWxzLmlzRW1wdHkoY3VzdG9tUHJvcGVydHlWYWx1ZSkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWlsZGVyLndpdGhWYWx1ZSgiZGF0YSIgKyBpLCBjdXN0b21Qcm9wZXJ0eVZhbHVlKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgICAgIGkrKzsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgb3BlcmF0aW9uTGlzdC5hZGQoYnVpbGRlci5idWlsZCgpKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCi0gICAgICAgIGlmIChteUdyb3Vwc0lkICE9IG51bGwpIHsKLSAgICAgICAgICAgIGJ1aWxkZXIgPSBDb250ZW50UHJvdmlkZXJPcGVyYXRpb24ubmV3SW5zZXJ0KERhdGEuQ09OVEVOVF9VUkkpOwotICAgICAgICAgICAgYnVpbGRlci53aXRoVmFsdWVCYWNrUmVmZXJlbmNlKEdyb3VwTWVtYmVyc2hpcC5SQVdfQ09OVEFDVF9JRCwgMCk7Ci0gICAgICAgICAgICBidWlsZGVyLndpdGhWYWx1ZShEYXRhLk1JTUVUWVBFLCBHcm91cE1lbWJlcnNoaXAuQ09OVEVOVF9JVEVNX1RZUEUpOwotICAgICAgICAgICAgYnVpbGRlci53aXRoVmFsdWUoR3JvdXBNZW1iZXJzaGlwLkdST1VQX1NPVVJDRV9JRCwgbXlHcm91cHNJZCk7Ci0gICAgICAgICAgICBvcGVyYXRpb25MaXN0LmFkZChidWlsZGVyLmJ1aWxkKCkpOwotICAgICAgICB9Ci0KLSAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgIENvbnRlbnRQcm92aWRlclJlc3VsdFtdIHJlc3VsdHMgPSByZXNvbHZlci5hcHBseUJhdGNoKAotICAgICAgICAgICAgICAgICAgICAgICAgQ29udGFjdHNDb250cmFjdC5BVVRIT1JJVFksIG9wZXJhdGlvbkxpc3QpOwotICAgICAgICAgICAgLy8gdGhlIGZpcnN0IHJlc3VsdCBpcyBhbHdheXMgdGhlIHJhd19jb250YWN0LiByZXR1cm4gaXQncyB1cmkgc28KLSAgICAgICAgICAgIC8vIHRoYXQgaXQgY2FuIGJlIGZvdW5kIGxhdGVyLiBkbyBudWxsIGNoZWNraW5nIGZvciBiYWRseSBiZWhhdmluZwotICAgICAgICAgICAgLy8gQ29udGVudFJlc29sdmVycwotICAgICAgICAgICAgcmV0dXJuIChyZXN1bHRzID09IG51bGwgfHwgcmVzdWx0cy5sZW5ndGggPT0gMCB8fCByZXN1bHRzWzBdID09IG51bGwpCi0gICAgICAgICAgICAgICAgPyBudWxsCi0gICAgICAgICAgICAgICAgOiByZXN1bHRzWzBdLnVyaTsKLSAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGUpIHsKLSAgICAgICAgICAgIExvZy5lKExPR19UQUcsIFN0cmluZ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FV0aWxzLmlzRW1wdHkobUZ1bGxOYW1lKQotICAgICAgICAgICAgICAgICYmIFRleHRVdGlscy5pc0VtcHR5KG1QaG9uZXRpY0ZhbWlseU5hbWUpCi0gICAgICAgICAgICAgICAgJiYgVGV4dFV0aWxzLmlzRW1wdHkobVBob25ldGljTWlkZGxlTmFtZSkKLSAgICAgICAgICAgICAgICAmJiBUZXh0VXRpbHMuaXNFbXB0eShtUGhvbmV0aWNHaXZlbk5hbWUpCi0gICAgICAgICAgICAgICAgJiYgVGV4dFV0aWxzLmlzRW1wdHkobVBob25ldGljRnVsbE5hbWUpKTsKLSAgICB9Ci0KLSAgICBwdWJsaWMgYm9vbGVhbiBpc0lnbm9yYWJsZSgpIHsKLSAgICAgICAgcmV0dXJuIGdldERpc3BsYXlOYW1lKCkubGVuZ3RoKCkgPT0gMDsKLSAgICB9Ci0KLSAgICBwcml2YXRlIFN0cmluZyBsaXN0VG9TdHJpbmcoTGlzdDxTdHJpbmc+IGxpc3QpewotICAgICAgICBmaW5hbCBpbnQgc2l6ZSA9IGxpc3Quc2l6ZSgpOwotICAgICAgICBpZiAoc2l6ZSA+IDEpIHsKLSAgICAgICAgICAgIFN0cmluZ0J1aWxkZXIgYnVpbGRlciA9IG5ldyBTdHJpbmdCdWlsZGVyKCk7Ci0gICAgICAgICAgICBpbnQgaSA9IDA7Ci0gICAgICAgICAgICBmb3IgKFN0cmluZyB0eXBlIDogbGlzdCkgewotICAgICAgICAgICAgICAgIGJ1aWxkZXIuYXBwZW5kKHR5cGUpOwotICAgICAgICAgICAgICAgIGlmIChpIDwgc2l6ZSAtIDEpIHsKLSAgICAgICAgICAgICAgICAgICAgYnVpbGRlci5hcHBlbmQoIjsiKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICByZXR1cm4gYnVpbGRlci50b1N0cmluZygpOwotICAgICAgICB9IGVsc2UgaWYgKHNpemUgPT0gMSkgewotICAgICAgICAgICAgcmV0dXJuIG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gICAgICAgIFN0cmluZ0J1aWxkZXIgYnVpbGRlciA9IG5ldyBTdHJpbmdCdWlsZGVyKCk7Ci0gICAgICAgICAgICAgICAgaW50IGxlbmd0aCA9IHZhbHVlLmxlbmd0aCgpOwotICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbGVuZ3RoOyBpKyspIHsKLSAgICAgICAgICAgICAgICAgICAgY2hhciBjaCA9IHZhbHVlLmNoYXJBdChpKTsKLSAgICAgICAgICAgICAgICAgICAgaWYgKGNoID09ICc9JyAmJiBpIDwgbGVuZ3RoIC0gMSkgewotICAgICAgICAgICAgICAgICAgICAgICAgY2hhciBuZXh0Q2ggPSB2YWx1ZS5jaGFyQXQoaSArIDEpOwotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG5leHRDaCA9PSAnICcgfHwgbmV4dENoID09ICdcdCcpIHsKLQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1aWxkZXIuYXBwZW5kKG5leHRDaCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgaSsrOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIGJ1aWxkZXIuYXBwZW5kKGNoKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgU3RyaW5nIHF1b3RlZFByaW50YWJsZSA9IGJ1aWxkZXIudG9TdHJpbmcoKTsKLSAgICAgICAgICAgICAgICAKLSAgICAgICAgICAgICAgICBTdHJpbmdbXSBsaW5lczsKLSAgICAgICAgICAgICAgICBpZiAobVN0cmljdExpbmVCcmVha1BhcnNpbmcpIHsKLSAgICAgICAgICAgICAgICAgICAgbGluZXMgPSBxdW90ZWRQcmludGFibGUuc3BsaXQoIlxyXG4iKTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICBidWlsZGVyID0gbmV3IFN0cmluZ0J1aWxkZXIoKTsKLSAgICAgICAgICAgICAgICAgICAgbGVuZ3RoID0gcXVvdGVkUHJpbnRhYmxlLmxlbmd0aCgpOwotICAgICAgICAgICAgICAgICAgICBBcnJheUxpc3Q8U3RyaW5nPiBsaXN0ID0gbmV3IEFycmF5TGlzdDxTdHJpbmc+KCk7Ci0gICAgICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbGVuZ3RoOyBpKyspIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGNoYXIgY2ggPSBxdW90ZWRQcmludGFibGUuY2hhckF0KGkpOwotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNoID09ICdcbicpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaXN0LmFkZChidWlsZGVyLnRvU3RyaW5nKCkpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1aWxkZXIgPSBuZXcgU3RyaW5nQnVpbGRlcigpOwotICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChjaCA9PSAnXHInKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlzdC5hZGQoYnVpbGRlci50b1N0cmluZygpKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWlsZGVyID0gbmV3IFN0cmluZ0J1aWxkZXIoKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaSA8IGxlbmd0aCAtIDEpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hhciBuZXh0Q2ggPSBxdW90ZWRQcmludGFibGUuY2hhckF0KGkgKyAxKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG5leHRDaCA9PSAnXG4nKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpKys7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1aWxkZXIuYXBwZW5kKGNoKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBTdHJpbmcgZmluYWxMaW5lID0gYnVpbGRlci50b1N0cmluZygpOwotICAgICAgICAgICAgICAgICAgICBpZiAoZmluYWxMaW5lLmxlbmd0aCgpID4gMCkgewotICAgICAgICAgICAgICAgICAgICAgICAgbGlzdC5hZGQoZmluYWxMaW5lKTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBsaW5lcyA9IGxpc3QudG9BcnJheShuZXcgU3RyaW5nWzBdKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgCi0gICAgICAgICAgICAgICAgYnVpbGRlciA9IG5ldyBTdHJpbmdCdWlsZGVyKCk7Ci0gICAgICAgICAgICAgICAgZm9yIChTdHJpbmcgbGluZSA6IGxpbmVzKSB7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChsaW5lLmVuZHNXaXRoKCI9IikpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGxpbmUgPSBsaW5lLnN1YnN0cmluZygwLCBsaW5lLmxlbmd0aCgpIC0gMSk7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgYnVpbGRlci5hcHBlbmQobGluZSk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGJ5dGVbXSBieXRlczsKLSAgICAgICAgICAgICAgICB0cnkgewotICAgICAgICAgICAgICAgICAgICBieXRlcyA9IGJ1aWxkZXIudG9TdHJpbmcoKS5nZXRCeXRlcyhtSW5wdXRDaGFyc2V0KTsKLSAgICAgICAgICAgICAgICB9IGNhdGNoIChVbnN1cHBvcnRlZEVuY29kaW5nRXhjZXB0aW9uIGUxKSB7Ci0gICAgICAgICAgICAgICAgICAgIExvZy5lKExPR19UQUcsICJGYWlsZWQgdG8gZW5jb2RlOiBjaGFyc2V0PSIgKyBtSW5wdXRDaGFyc2V0KTsKLSAgICAgICAgICAgICAgICAgICAgYnl0ZXMgPSBidWlsZGVyLnRvU3RyaW5nKCkuZ2V0Qnl0ZXMoKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgCi0gICAgICAgICAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgICAgICAgICAgYnl0ZXMgPSBRdW90ZWRQcmludGFibGVDb2RlYy5kZWNvZGVRdW90ZWRQcmludGFibGUoYnl0ZXMpOwotICAgICAgICAgICAgICAgIH0gY2F0Y2ggKERlY29kZXJFeGNlcHRpb24gZSkgewotICAgICAgICAgICAgICAgICAgICBMb2cuZShMT0dfVEFHLCAiRmFpbGVkIHRvIGRlY29kZSBxdW90ZWQtcHJpbnRhYmxlOiAiICsgZSk7Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybiAiIjsKLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICB0cnkgewotICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IFN0cmluZyhieXRlcywgY2hhcnNldEZvckRlY29kZWRCeXRlcyk7Ci0gICAgICAgICAgICAgICAgfSBjYXRjaCAoVW5zdXBwb3J0ZWRFbmNvZGluZ0V4Y2VwdGlvbiBlKSB7Ci0gICAgICAgICAgICAgICAgICAgIExvZy5lKExPR19UQUcsICJGYWlsZWQgdG8gZW5jb2RlOiBjaGFyc2V0PSIgKyBjaGFyc2V0Rm9yRGVjb2RlZEJ5dGVzKTsKLSAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBTdHJpbmcoYnl0ZXMpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIC8vIFVua25vd24gZW5jb2RpbmcuIEZhbGwgYmFjayB0byBkZWZhdWx0LgotICAgICAgICB9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ICAgICAgICAgICBidWlsZGVyLnN0YXJ0KCk7Ci0gICAgICAgIH0KLSAgICB9Ci0KLSAgICBwdWJsaWMgdm9pZCBlbmQoKSB7Ci0gICAgICAgIGZvciAoVkNhcmRJbnRlcnByZXRlciBidWlsZGVyIDogbUludGVycHJldGVyQ29sbGVjdGlvbikgewotICAgICAgICAgICAgYnVpbGRlci5lbmQoKTsKLSAgICAgICAgfQotICAgIH0KLQotICAgIHB1YmxpYyB2b2lkIHN0YXJ0RW50cnkoKSB7Ci0gICAgICAgIGZvciAoVkNhcmRJbnRlcnByZXRlciBidWlsZGVyIDogbUludGVycHJldGVyQ29sbGVjdGlvbikgewotICAgICAgICAgICAgYnVpbGRlci5zdGFydEVudHJ5KCk7Ci0gICAgICAgIH0KLSAgICB9Ci0KLSAgICBwdWJsaWMgdm9pZCBlbmRFbnRyeSgpIHsKLSAgICAgICAgZm9yIChWQ2FyZEludGVycHJldGVyIGJ1aWxkZXIgOiBtSW50ZXJwcmV0ZXJDb2xsZWN0aW9uKSB7Ci0gICAgICAgICAgICBidWlsZGVyLmVuZEVudHJ5KCk7Ci0gICAgICAgIH0KLSAgICB9Ci0KLSAgICBwdWJsaWMgdm9pZCBzdGFydFByb3BlcnR5KCkgewotICAgICAgICBmb3IgKFZDYXJkSW50ZXJwcmV0ZXIgYnVpbGRlciA6IG1JbnRlcnByZXRlckNvbGxlY3Rpb24pIHsKLSAgICAgICAgICAgIGJ1aWxkZXIuc3RhcnRQcm9wZXJ0eSgpOwotICAgICAgICB9Ci0gICAgfQotCi0gICAgcHVibGljIHZvaWQgZW5kUHJvcGVydHkoKSB7Ci0gICAgICAgIGZvciAoVkNhcmRJbnRlcnByZXRlciBidWlsZGVyIDogbUludGVycHJldGVyQ29sbGVjdGlvbikgewotICAgICAgICAgICAgYnVpbGRlci5lbmRQcm9wZXJ0eSgpOwotICAgICAgICB9Ci0gICAgfQotCi0gICAgcHVibGljIHZvaWQgcHJvcGVydHlHcm91cChTdHJpbmcgZ3J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cmQgW3dzbHNdCi0gICAgICovCi0gICAgcHJvdGVjdGVkIHZvaWQgcGFyc2VWQ2FyZEZpbGUoKSB0aHJvd3MgSU9FeGNlcHRpb24sIFZDYXJkRXhjZXB0aW9uIHsKLSAgICAgICAgYm9vbGVhbiBmaXJzdFJlYWRpbmcgPSB0cnVlOwotICAgICAgICB3aGlsZSAodHJ1ZSkgewotICAgICAgICAgICAgaWYgKG1DYW5jZWxlZCkgewotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKCFwYXJzZU9uZVZDYXJkKGZpcnN0UmVhZGluZykpIHsKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGZpcnN0UmVhZGluZyA9IGZhbHNlOwotICAgICAgICB9Ci0KLSAgICAgICAgaWYgKG1OZXN0Q291bnQgPiAwKSB7Ci0gICAgICAgICAgICBib29sZWFuIHVzZUNhY2hlID0gdHJ1ZTsKLSAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbU5lc3RDb3VudDsgaSsrKSB7Ci0gICAgICAgICAgICAgICAgcmVhZEVuZFZDYXJkKHVzZUNhY2hlLCB0cnVlKTsKLSAgICAgICAgICAgICAgICB1c2VDYWNoZSA9IGZhbHNlOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgfQotCi0gICAgcHJvdGVjdGVkIGludCBnZXRWZXJzaW9uKCkgewotICAgICAgICByZXR1cm4gVkNhcmRDb25maWcuRkxBR19WMjE7Ci0gICAgfQotCi0gICAgcHJvdGVjdGVkIFN0cmluZyBnZXRWZXJzaW9uU3RyaW5nKCkgewotICAgICAgICByZXR1cm4gVkNhcmRDb25zdGFudHMuVkVSU0lPTl9WMjE7Ci0gICAgfQotCi0gICAgLyoqCi0gICAgICogQHJldHVybiB0cnVlIHdoZW4gdGhlIHByb3BlcnR5TmFtZSBpcyBhIHZhbGlkIHByb3BlcnR5IG5hbWUuCi0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AgICBib29sZWFuIGFsbG93R2FyYmFnZSA9IGZhbHNlOwotICAgICAgICBpZiAoZmlyc3RSZWFkaW5nKSB7Ci0gICAgICAgICAgICBpZiAobU5lc3RDb3VudCA+IDApIHsKLSAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IG1OZXN0Q291bnQ7IGkrKykgewotICAgICAgICAgICAgICAgICAgICBpZiAoIXJlYWRCZWdpblZDYXJkKGFsbG93R2FyYmFnZSkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBhbGxvd0dhcmJhZ2UgPSB0cnVlOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCi0gICAgICAgIGlmICghcmVhZEJlZ2luVkNhcmQoYWxsb3dHYXJiYWdlKSkgewotICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwotICAgICAgICB9Ci0gICAgICAgIGxvbmcgc3RhcnQ7Ci0gICAgICAgIGlmIChtQnVpbGRlciAhPSBudWxsKSB7Ci0gICAgICAgICAgICBzdGFydCA9IFN5c3RlbS5jdXJyZW50VGltZU1pbGxpcygpOwotICAgICAgICAgICAgbUJ1aWxkZXIuc3RhcnRFbnRyeSgpOwotICAgICAgICAgICAgbVRpbWVSZWFkU3RhcnRSZWNvcmQgKz0gU3lzdGVtLmN1cnJlbnRUaW1lTWlsbGlzKCkgLSBzdGFydDsKLSAgICAgICAgfQotICAgICAgICBzdGFydCA9IFN5c3RlbS5jdXJyZW50VGltZU1pbGxpcygpOwotICAgICAgICBwYXJzZUl0ZW1zKCk7Ci0gICAgICAgIG1UaW1lUGFyc2VJdGVtcyArPSBTeXN0ZW0uY3VycmVudFRpbWVNaWxsaXMoKSAtIHN0YXJ0OwotICAgICAgICByZWFkRW5kVkNhcmQodHJ1ZSwgZmFsc2UpOwotICAgICAgICBpZiAobUJ1aWxkZXIgIT0gbnVsbCkgewotICAgICAgICAgICAgc3RhcnQgPSBTeXN0ZW0uY3VycmVudFRpbWVNaWxsaXMoKTsKLSAgICAgICAgICAgIG1CdWlsZGVyLmVuZEVudHJ5KCk7Ci0gICAgICAgICAgICBtVGltZVJlYWRFbmRSZWNvcmQgKz0gU3lzdGVtLmN1cnJlbnRUaW1lTWlsbGlzKCkgLSBzdGFydDsKLSAgICAgICAgfQotICAgICAgICByZXR1cm4gdHJ1ZTsKLSAgICB9Ci0gICAgCi0gICAgLyoqCi0gICAgICogQHJldHVybiBUcnVlIHdoZW4gc3VjY2Vzc2Z1bC4gRmFsc2Ugd2hlbiByZWFjaGluZyB0aGUgZW5kIG9mIGxpbmUgIAotICAgICAqIEB0aHJvd3MgSU9FeGNlcHRpb24KLSAgICAgKiBAdGhyb3dzIFZDYXJkRXhjZXB0aW9uCi0gICAgICovCi0gICAgcHJvdGVjdGVkIGJvb2xlYW4gcmVhZEJlZ2luVkNhcmQoYm9vbGVhbiBhbGxvd0dhcmJhZ2UpIHRocm93cyBJT0V4Y2VwdGlvbiwgVkNhcmRFeGNlcHRpb24gewotICAgICAgICBTdHJpbmcgbGluZTsKLSAgICAgICAgZG8gewotICAgICAgICAgICAgd2hpbGUgKHRydWUpIHsKLSAgICAgICAgICAgICAgICBsaW5lID0gZ2V0TGluZSgpOwotICAgICAgICAgICAgICAgIGlmIChsaW5lID09IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwotICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAobGluZS50cmltKCkubGVuZ3RoKCkgPiAwKSB7Ci0gICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIFN0cmluZ1tdIHN0ckFycmF5ID0gbGluZS5zcGxpdCgiOiIsIDIpOwotICAgICAgICAgICAgaW50IGxlbmd0aCA9IHN0ckFycmF5Lmxlbmd0aDsKLQotICAgICAgICAgICAgLy8gVGhvdWdoIHZDYXJkIDIuMS8zLjAgc3BlY2lmaWNhdGlvbiBkb2VzIG5vdCBhbGxvdyBsb3dlciBjYXNlcywKLSAgICAgICAgICAgIC8vIHZDYXJkIGZpbGUgZW1pdHRlZCBieSBzb21lIGV4dGVybmFsIHZDYXJkIGV4cG90ZXIgaGF2ZSBzdWNoIGludmFsaWQgU3RyaW5ncy4KLSAgICAgICAgICAgIC8vIFNvIHdlIGFsbG93IGl0LgotICAgICAgICAgICAgLy8gZS5nLiBCRUdJTjp2Q2FyZAotICAgICAgICAgICAgaWYgKGxlbmd0aCA9PSAyICYmCi0gICAgICAgICAgICAgICAgICAgIHN0ckFycmF5WzBdLnRyaW0oKS5lcXVhbHNJZ25vcmVDYXNlKCJCRUdJTiIpICYmCi0gICAgICAgICAgICAgICAgICAgIHN0ckFycmF5WzFdLnRyaW0oKS5lcXVhbHNJZ25vcmVDYXNlKCJWQ0FSRCIpKSB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7Ci0gICAgICAgICAgICB9IGVsc2UgaWYgKCFhbGxvd0dhcmJhZ2UpIHsKLSAgICAgICAgICAgICAgICBpZiAobU5lc3RDb3VudCA+IDApIHsKLSAgICAgICAgICAgICAgICAgICAgbVByZXZpb3VzTGluZSA9IGxpbmU7Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVkNhcmRFeGNlcHRpb24oCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgIkV4cGVjdGVkIFN0cmluZyBcIkJFR0lOOlZDQVJEXCIgZGlkIG5vdCBjb21lICIKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICArICIoSW5zdGVhZCwgXCIiICsgbGluZSArICJcIiBjYW1lKSIpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgfSB3aGlsZShhbG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F2ZSB0aGVtLCBzbyB3ZSBhbGxvdyBpdC4KLSAgICAgICAgICAgICAgICBsaW5lID0gbVByZXZpb3VzTGluZTsKLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgd2hpbGUgKHRydWUpIHsKLSAgICAgICAgICAgICAgICAgICAgbGluZSA9IGdldExpbmUoKTsKLSAgICAgICAgICAgICAgICAgICAgaWYgKGxpbmUgPT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFZDYXJkRXhjZXB0aW9uKCJFeHBlY3RlZCBFTkQ6VkNBUkQgd2FzIG5vdCBmb3VuZC4iKTsKLSAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChsaW5lLnRyaW0oKS5sZW5ndGgoKSA+IDApIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBTdHJpbmdbXSBzdHJBcnJheSA9IGxpbmUuc3BsaXQoIjoiLCAyKTsKLSAgICAgICAgICAgIGlmIChzdHJBcnJheS5sZW5ndGggPT0gMiAmJgotICAgICAgICAgICAgICAgICAgICBzdHJBcnJheVswXS50cmltKCkuZXF1YWxzSWdub3JlQ2FzZSgiRU5EIikgJiYKLSAgICAgICAgICAgICAgICAgICAgc3RyQXJyYXlbMV0udHJpbSgpLmVxdWFsc0lnbm9yZUNhc2UoIlZDQVJEIikpIHsKLSAgICAgICAgICAgICAgICByZXR1cm47Ci0gICAgICAgICAgICB9IGVsc2UgaWYgKCFhbGxvd0dhcmJhZ2UpIHsKLSAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVkNhcmRFeGNlcHRpb24oIkVORDpWQ0FSRCAhPSBcIiIgKyBtUHJldmlvdXNMaW5lICsgIlwiIik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICB1c2VDYWNoZSA9IGZhbHNlO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FRpbWVNaWxsaXMoKTsKLSAgICAgICAgICAgICAgICBtQnVpbGRlci5zdGFydFByb3BlcnR5KCk7Ci0gICAgICAgICAgICAgICAgbVRpbWVTdGFydFByb3BlcnR5ICs9IFN5c3RlbS5jdXJyZW50VGltZU1pbGxpcygpIC0gc3RhcnQ7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICB0cnkgewotICAgICAgICAgICAgICAgIGVuZGVkID0gcGFyc2VJdGVtKCk7Ci0gICAgICAgICAgICB9IGNhdGNoIChWQ2FyZEludmFsaWRDb21tZW50TGluZUV4Y2VwdGlvbiBlKSB7Ci0gICAgICAgICAgICAgICAgTG9nLmUoTE9HX1RBRywgIkludmFsaWQgbGluZSB3aGljaCBsb29rcyBsaWtlIHNvbWUgY29tbWVudCB3YXMgZm91bmQuIElnbm9yZWQuIik7Ci0gICAgICAgICAgICAgICAgZW5kZWQgPSBmYWxzZTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmIChtQnVpbGRlciAhPSBudWxsICYmICFlbmRlZCkgewotICAgICAgICAgICAgICAgIGxvbmcgc3RhcnQgPSBTeXN0ZW0uY3VycmVudFRpbWVNaWxsaXMoKTsKLSAgICAgICAgICAgICAgICBtQnVpbGRlci5lbmRQcm9wZXJ0eSgpOwotICAgICAgICAgICAgICAgIG1UaW1lRW5kUHJvcGVydHkgKz0gU3lzdGVtLmN1cnJlbnRUaW1lTWlsbGlzKCkgLSBzdGFydDsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgIH0KLSAgICAKLSAgICAvKioKLSAgICAgKiBpdGVtID0gW2dyb3VwcyAiLiJdIG5hbWUgICAgW3BhcmFtc10gIjoiIHZhbHVlIENSTEYKLSAgICAgKiAgICAgIC8gW2dyb3VwcyAiLiJdICJBRFIiICAgW3BhcmFtc10gIjoiIGFkZHJlc3NwYXJ0cyBDUkxGCi0gICAgICogICAgICAvIFtncm91cHMgIi4iXSAiT1JHIiAgIFtwYXJhbXNdICI6IiBv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ZXF1YWxzSWdub3JlQ2FzZSgiRU5EIikpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBtUHJldmlvdXNMaW5lID0gbGluZTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtQnVpbGRlciAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgbUJ1aWxkZXIucHJvcGVydHlOYW1lKHByb3BlcnR5TmFtZSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICBwcm9wZXJ0eU5hbWVBbmRWYWx1ZVswXSA9IHByb3BlcnR5TmFtZTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpIDwgbGVuZ3RoIC0gMSkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb3BlcnR5TmFtZUFuZFZhbHVlWzFdID0gbGluZS5zdWJzdHJpbmcoaSArIDEpOwotICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm9wZXJ0eU5hbWVBbmRWYWx1ZVsxXSA9ICIiOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHByb3BlcnR5TmFtZUFuZFZhbHVlOwotICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGNoID09ICcuJykgewotICAgICAgICAgICAgICAgICAgICAgICAgU3RyaW5nIGdyb3VwTmFtZSA9IGxpbmUuc3Vic3RyaW5nKG5hbWVJbmRleCwgaSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAobUJ1aWxkZXIgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1CdWlsZGVyLnByb3BlcnR5R3JvdXAoZ3JvdXBOYW1lKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgIG5hbWVJbmRleCA9IGkgKyAxOwotICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGNoID09ICc7JykgewotICAgICAgICAgICAgICAgICAgICAgICAgU3RyaW5nIHByb3BlcnR5TmFtZSA9IGxpbmUuc3Vic3RyaW5nKG5hbWVJbmRleCwgaSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAocHJvcGVydHlOYW1lLmVxdWFsc0lnbm9yZUNhc2UoIkVORCIpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgbVByZXZpb3VzTGluZSA9IGxpbmU7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAobUJ1aWxkZXIgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1CdWlsZGVyLnByb3BlcnR5TmFtZShwcm9wZXJ0eU5hbWUpOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgcHJvcGVydHlOYW1lQW5kVmFsdWVbMF0gPSBwcm9wZXJ0eU5hbWU7Ci0gICAgICAgICAgICAgICAgICAgICAgICBuYW1lSW5kZXggPSBpICsgMTsKLSAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlID0gU1RBVEVfUEFSQU1TOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBjYXNlIFNUQVRFX1BBUkFNUzogewotICAgICAgICAgICAgICAgICAgICBpZiAoY2ggPT0gJyInKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBzdGF0ZSA9IFNUQVRFX1BBUkFNU19JTl9EUVVPVEU7Ci0gICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoY2ggPT0gJzsnKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBoYW5kbGVQYXJhbXMobGluZS5zdWJzdHJpbmcobmFtZUluZGV4LCBpKSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBuYW1lSW5kZXggPSBpICsgMTsKLSAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChjaCA9PSAnOicpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGhhbmRsZVBhcmFtcyhsaW5lLnN1YnN0cmluZyhuYW1lSW5kZXgsIGkpKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpIDwgbGVuZ3RoIC0gMSkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb3BlcnR5TmFtZUFuZFZhbHVlWzFdID0gbGluZS5zdWJzdHJpbmcoaSArIDEpOwotICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm9wZXJ0eU5hbWVBbmRWYWx1ZVsxXSA9ICIiOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHByb3BlcnR5TmFtZUFuZFZhbHVlOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBjYXNlIFNUQVRFX1BBUkFNU19JTl9EUVVPVEU6IHsKLSAgICAgICAgICAgICAgICAgICAgaWYgKGNoID09ICciJykgewotICAgICAgICAgICAgICAgICAgICAgICAgc3RhdGUgPSBTVEFURV9QQVJBTVM7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgICAgIAotICAgICAgICB0aHJvdyBuZXcgVkNhcmRJbnZhbGlkTGluZUV4Y2VwdGlvbigiSW52YWxpZCBsaW5lOiBcIiIgKyBsaW5lICsgIlwiIik7Ci0gICAgfQotCi0gICAgLyoqCi0gICAgICogcGFyYW1zICAgICA9ICI7IiBbd3NdIHBhcmFtbGlzdAotICAgICAqIHBhcmFtbGlzdCAgPSBwYXJhbWxpc3QgW3dzXSAiOyIgW3dzXSBwYXJhbQotICAgICAqICAgICAgICAgICAgLyBwYXJhbQotICAgICAqIHBhcmFtICAgICAgPSAiVFlQRSIgW3dzXSAiPSIgW3dzXSBwdHlwZXZhbAotICAgICAqICAgICAgICAgICAgLyAiVkFMVUUiIFt3c10gIj0iIFt3c10gcHZhbHVldmFsCi0gICAgICogICAgICAgICAgICAvICJFTkNPRElORyIgW3dzXSAiPSIgW3dzXSBwZW5jb2Rpbmd2YWwKLSAgICAgKiAgICAgICAgICAgIC8gIkNIQVJTRVQiIFt3c10gIj0iIFt3c10gY2hhcnNldHZhbAotICAgICAqICAgICAgICAgICAgLyAiTEFOR1VBR0UiIFt3c10gIj0iIFt3c10gbGFuZ3ZhbAotICAgICAqICAgICAgICAgICAgLyAiWC0iIHdvcmQgW3dzXSAiPSIgW3dzXSB3b3JkCi0gICAgICogICAgICAgICAgICAvIGtub3dudHlwZQotICAgICAqLwotICAgIHByb3RlY3RlZCB2b2lkIGhhbmRsZVBhcmFtcyhTdHJpbmcgcGFyYW1zKSB0aHJvd3MgVkNhcmRFeGNlcHRpb24gewotICAgICAgICBTdHJpbmdbXSBzdHJBcnJheSA9IHBhcmFtcy5zcGxpdCgiPSIsIDIpOwotICAgICAgICBpZiAoc3RyQXJyYXkubGVuZ3RoID09IDIpIHsKLSAgICAgICAgICAgIGZpbmFsIFN0cmluZyBwYXJhbU5hbWUgPSBzdHJBcnJheVswXS50cmltKCkudG9VcHBlckNhc2UoKTsKLSAgICAgICAgICAgIFN0cmluZyBwYXJhbVZhbHVlID0gc3RyQXJyYXlbMV0udHJpbSgpOwotICAgICAgICAgICAgaWYgKHBhcmFtTmF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BvcnQtcGFkZGluZyIKLSAgICAgICAgICAgIGludCBwb3MgPSBmaXJzdFN0cmluZy5sZW5ndGgoKSAtIDE7Ci0gICAgICAgICAgICB3aGlsZShmaXJzdFN0cmluZy5jaGFyQXQocG9zKSAhPSAnPScpIHsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIFN0cmluZ0J1aWxkZXIgYnVpbGRlciA9IG5ldyBTdHJpbmdCdWlsZGVyKCk7Ci0gICAgICAgICAgICBidWlsZGVyLmFwcGVuZChmaXJzdFN0cmluZy5zdWJzdHJpbmcoMCwgcG9zICsgMSkpOwotICAgICAgICAgICAgYnVpbGRlci5hcHBlbmQoIlxyXG4iKTsKLSAgICAgICAgICAgIFN0cmluZyBsaW5lOwotICAgICAgICAgICAgd2hpbGUgKHRydWUpIHsKLSAgICAgICAgICAgICAgICBsaW5lID0gZ2V0TGluZSgpOwotICAgICAgICAgICAgICAgIGlmIChsaW5lID09IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFZDYXJkRXhjZXB0aW9uKAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICJGaWxlIGVuZGVkIGR1cmluZyBwYXJzaW5nIHF1b3RlZC1wcmludGFibGUgU3RyaW5nIik7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGlmIChsaW5lLnRyaW0oKS5lbmRzV2l0aCgiPSIpKSB7Ci0gICAgICAgICAgICAgICAgICAgIC8vIHJlbW92ZSAidHJhbnNwb3J0LXBhZGRpbmciCi0gICAgICAgICAgICAgICAgICAgIHBvcyA9IGxpbmUubGVuZ3RoKCkgLSAxOwotICAgICAgICAgICAgICAgICAgICB3aGlsZShsaW5lLmNoYXJBdChwb3MpICE9ICc9JykgewotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIGJ1aWxkZXIuYXBwZW5kKGxpbmUuc3Vic3RyaW5nKDAsIHBvcyArIDEpKTsKLSAgICAgICAgICAgICAgICAgICAgYnVpbGRlci5hcHBlbmQoIlxyXG4iKTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICBidWlsZGVyLmFwcGVuZChsaW5lKTsKLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICAgICAgcmV0dXJuIGJ1aWxkZXIudG9TdHJpbmcoKTsgCi0gICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICByZXR1cm4gZmlyc3RTdHJpbmc7Ci0gICAgICAgIH0KLSAgICB9Ci0gICAgCi0gICAgcHJvdGVjdGVkIFN0cmluZyBnZXRCYXNlNjQoU3RyaW5nIGZpcnN0U3RyaW5nKSB0aHJvd3MgSU9FeGNlcHRpb24sIFZDYXJkRXhjZXB0aW9uIHsKLSAgICAgICAgU3RyaW5nQnVpbGRlciBidWlsZGVyID0gbmV3IFN0cmluZ0J1aWxkZXIoKTsKLSAgICAgICAgYnVpbGRlci5hcHBlbmQoZmlyc3RTdHJpbmcpOwotICAgICAgICAKLSAgICAgICAgd2hpbGUgKHRydWUpIHsKLSAgICAgICAgICAgIFN0cmluZyBsaW5lID0gZ2V0TGluZSgpOwotICAgICAgICAgICAgaWYgKGxpbmUgPT0gbnVsbCkgewotICAgICAgICAgICAgICAgIHRocm93IG5ldyBWQ2FyZEV4Y2VwdGlvbigKLSAgICAgICAgICAgICAgICAgICAgICAgICJGaWxlIGVuZGVkIGR1cmluZyBwYXJzaW5nIEJBU0U2NCBiaW5hcnkiKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmIChsaW5lLmxlbmd0aCgpID09IDApIHsKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGJ1aWxkZXIuYXBwZW5kKGxpbmUpOwotICAgICAgICB9Ci0gICAgICAgIAotICAgICAgICByZXR1cm4gYnVpbGRlci50b1N0cmluZygpOwotICAgIH0KLSAgICAKLSAgICAvKioKLSAgICAgKiBNYWlubHkgZm9yICJBRFIiLCAiT1JHIiwgYW5kICJOIgotICAgICAqIFdlIGRvIG5vdCBjYXJlIHRoZSBudW1iZXIgb2Ygc3Rybm9zZW1pIGhlcmUuCi0gICAgICogCi0gICAgICogYWRkcmVzc3BhcnRzID0gMCo2KHN0cm5vc2VtaSAiOyIpIHN0cm5vc2VtaQotICAgICAqICAgICAgICAgICAgICA7IFBPIEJveCwgRXh0ZW5kZWQgQWRkciwgU3RyZWV0LCBMb2NhbGl0eSwgUmVnaW9uLAotICAgICAqICAgICAgICAgICAgICAgIFBvc3RhbCBDb2RlLCBDb3VudHJ5IE5hbWUKLSAgICAgKiBvcmdwYXJ0cyAgICAgPSAqKHN0cm5vc2VtaSAiOyIpIHN0cm5vc2VtaQotICAgICAqICAgICAgICAgICAgICA7IEZpcnN0IGlzIE9yZ2FuaXphdGlvbiBOYW1lLAotICAgICAqICAgICAgICAgICAgICAgIHJlbWFpbmRlciBhcmUgT3JnYW5pemF0aW9uIFVuaXRzLgotICAgICAqIG5hbWVwYXJ0cyAgICA9IDAqNChzdHJub3NlbWkgIjsiKSBzdHJub3NlbWkKLSAgICAgKiAgICAgICAgICAgICAgOyBGYW1pbHksIEdpdmVuLCBNaWRkbGUsIFByZWZpeCwgU3VmZml4LgotICAgICAqICAgICAgICAgICAgICA7IEV4YW1wbGU6UHVibGljO0pvaG47US47UmV2ZXJlbmQgRHIuO0lJSSwgRXNxLgotICAgICAqIHN0cm5vc2VtaSAgICA9ICooKm5vbnNlbWkgKCJcOyIgLyAiXCIgQ1JMRikpICpub25zZW1pCi0gICAgICogICAgICAgICAgICAgIDsgVG8gaW5jbHVkZSBhIHNlbWljb2xvbiBpbiB0aGlzIHN0cmluZywgaXQgbXVzdCBiZSBlc2NhcGVkCi0gICAgICogICAgICAgICAgICAgIDsgd2l0aCBhICJcIiBjaGFyYWN0ZXIuCi0gICAgICogICAgICAgICAgICAgIAotICAgICAqIFdlIG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b3RlY3RlZCBTdHJpbmcgZ2V0TGluZSgpIHRocm93cyBJT0V4Y2VwdGlvbiB7Ci0gICAgICAgIGlmIChtUHJldmlvdXNMaW5lICE9IG51bGwpIHsKLSAgICAgICAgICAgIFN0cmluZyByZXQgPSBtUHJldmlvdXNMaW5lOwotICAgICAgICAgICAgbVByZXZpb3VzTGluZSA9IG51bGw7Ci0gICAgICAgICAgICByZXR1cm4gcmV0OwotICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgcmV0dXJuIG1SZWFkZXIucmVhZExpbmUoKTsKLSAgICAgICAgfQotICAgIH0KLSAgICAKLSAgICAvKioKLSAgICAgKiB2Q2FyZCAzLjAgcmVxdWlyZXMgdGhhdCB0aGUgbGluZSB3aXRoIHNwYWNlIGF0IHRoZSBiZWdpbm5pbmcgb2YgdGhlIGxpbmUKLSAgICAgKiBtdXN0IGJlIGNvbWJpbmVkIHdpdGggcHJldmlvdXMgbGluZS4gCi0gICAgICovCi0gICAgQE92ZXJyaWRlCi0gICAgcHJvdGVjdGVkIFN0cmluZyBnZXROb25FbXB0eUxpbmUoKSB0aHJvd3MgSU9FeGNlcHRpb24sIFZDYXJkRXhjZXB0aW9uIHsKLSAgICAgICAgU3RyaW5nIGxpbmU7Ci0gICAgICAgIFN0cmluZ0J1aWxkZXIgYnVpbGRlciA9IG51bGw7Ci0gICAgICAgIHdoaWxlICh0cnVlKSB7Ci0gICAgICAgICAgICBsaW5lID0gbVJlYWRlci5yZWFkTGluZSgpOwotICAgICAgICAgICAgaWYgKGxpbmUgPT0gbnVsbCkgewotICAgICAgICAgICAgICAgIGlmIChidWlsZGVyICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGJ1aWxkZXIudG9TdHJpbmcoKTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKG1QcmV2aW91c0xpbmUgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICBTdHJpbmcgcmV0ID0gbVByZXZpb3VzTGluZTsKLSAgICAgICAgICAgICAgICAgICAgbVByZXZpb3VzTGluZSA9IG51bGw7Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybiByZXQ7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIHRocm93IG5ldyBWQ2FyZEV4Y2VwdGlvbigiUmVhY2hlZCBlbmQgb2YgYnVmZmVyLiIpOwotICAgICAgICAgICAgfSBlbHNlIGlmIChsaW5lLmxlbmd0aCgpID09IDApIHsKLSAgICAgICAgICAgICAgICBpZiAoYnVpbGRlciAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybiBidWlsZGVyLnRvU3RyaW5nKCk7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChtUHJldmlvdXNMaW5lICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgU3RyaW5nIHJldCA9IG1QcmV2aW91c0xpbmU7Ci0gICAgICAgICAgICAgICAgICAgIG1QcmV2aW91c0xpbmUgPSBudWxsOwotICAgICAgICAgICAgICAgICAgICByZXR1cm4gcmV0OwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0gZWxzZSBpZiAobGluZS5jaGFyQXQoMCkgPT0gJyAnIHx8IGxpbmUuY2hhckF0KDApID09ICdcdCcpIHsKLSAgICAgICAgICAgICAgICBpZiAoYnVpbGRlciAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIC8vIFNlZSBTZWN0aW9uIDUuOC4xIG9mIFJGQyAyNDI1IChNSU1FLURJUiBkb2N1bWVudCkuCi0gICAgICAgICAgICAgICAgICAgIC8vIEZvbGxvd2luZyBpcyB0aGUgZXhjZXJwdHMgZnJvbSBpdC4gIAotICAgICAgICAgICAgICAgICAgICAvLwotICAgICAgICAgICAgICAgICAgICAvLyBERVNDUklQVElPTjpUaGlzIGlzIGEgbG9uZyBkZXNjcmlwdGlvbiB0aGF0IGV4aXN0cyBvbiBhIGxvbmcgbGluZS4KLSAgICAgICAgICAgICAgICAgICAgLy8gCi0gICAgICAgICAgICAgICAgICAgIC8vIENhbiBiZSByZXByZXNlbnRlZCBhczoKLSAgICAgICAgICAgICAgICAgICAgLy8KLSAgICAgICAgICAgICAgICAgICAgLy8gREVTQ1JJUFRJT046VGhpcyBpcyBhIGxvbmcgZGVzY3JpcHRpb24KLSAgICAgICAgICAgICAgICAgICAgLy8gIHRoYXQgZXhpc3RzIG9uIGEgbG9uZyBsaW5lLgotICAgICAgICAgICAgICAgICAgICAvLwotICAgICAgICAgICAgICAgICAgICAvLyBJdCBjb3VsZCBhbHNvIGJlIHJlcHJlc2VudGVkIGFzOgotICAgICAgICAgICAgICAgICAgICAvLwotICAgICAgICAgICAgICAgICAgICAvLyBERVNDUklQVElPTjpUaGlzIGlzIGEgbG9uZyBkZXNjcmlwCi0gICAgICAgICAgICAgICAgICAgIC8vICB0aW9uIHRoYXQgZXhpc3RzIG8KLSAgICAgICAgICAgICAgICAgICAgLy8gIG4gYSBsb25nIGxpbmUuCi0gICAgICAgICAgICAgICAgICAgIGJ1aWxkZXIuYXBwZW5kKGxpbmUuc3Vic3RyaW5nKDEpKTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKG1QcmV2aW91c0xpbmUgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICBidWlsZGVyID0gbmV3IFN0cmluZ0J1aWxkZXIoKTsKLSAgICAgICAgICAgICAgICAgICAgYnVpbGRlci5hcHBlbmQobVByZXZpb3VzTGluZSk7Ci0gICAgICAgICAgICAgICAgICAgIG1QcmV2aW91c0xpbmUgPSBudWxsOwotICAgICAgICAgICAgICAgICAgICBidWlsZGVyLmFwcGVuZChsaW5lLnN1YnN0cmluZygxKSk7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFZDYXJkRXhjZXB0aW9uKCJTcGFjZSBleGlzdHMgYXQgdGhlIGJlZ2lubmluZyBvZiB0aGUgbGluZSIpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgaWYgKG1QcmV2aW91c0xpbmUgPT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICBtUHJldmlvdXNMaW5lID0gbGluZTsKLSAgICAgICAgICAgICAgICAgICAgaWYgKGJ1aWxkZXIgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGJ1aWxkZXIudG9TdHJpbmcoKTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIFN0cmluZyByZXQgPSBtUHJldmlvdXNMaW5lOwotICAgICAgICAgICAgICAgICAgICBtUHJldmlvdXNMaW5lID0gbGluZTsKLSAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHJldDsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLSAgICB9Ci0gICAgCi0gICAgCi0gICAgLyoqCi0gICAgICogdmNhcmQgPSBbZ3JvdXAgIi4iXSAiQkVHSU4iICI6IiAiVkNBUkQiIDEgKiBDUkxGCi0gICAgICogICAgICAgICAxICogKGNvbnRlbnRsaW5lKQotICAgICAqICAgICAgICAgO0EgdkNhcmQgb2JqZWN0IE1VU1QgaW5jbHVkZSB0aGUgVkVSU0lPTiwgRk4gYW5kIE4gdHlwZXMuCi0gICAgICogICAgICAgICBbZ3JvdXAgIi4iXSAiRU5EIiAiOiIgIlZDQVJEIiAxICogQ1JMRgotICAgICAqLwotICAgIEBPdmVycmlkZQotICAgIHByb3RlY3RlZCBib29sZWFuIHJlYWRCZWdpblZDYXJkKGJvb2xlYW4gYWxsb3dHYXJiYWdlKSB0aHJvd3MgSU9FeGNlcHRpb24sIFZDYXJkRXhjZXB0aW9uIHsKLSAgICAgICAgLy8gVE9ETzogdkNhcmQgMy4wIHN1cHBvcnRzIGdyb3VwLgotICAgICAgICByZXR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AgICAgICBib29sZWFuIGhhc1ByZWYgPSBmYWxzZTsKLSAgICAgICAgCi0gICAgICAgIGlmICh0eXBlcyAhPSBudWxsKSB7Ci0gICAgICAgICAgICBmb3IgKFN0cmluZyB0eXBlU3RyaW5nIDogdHlwZXMpIHsKLSAgICAgICAgICAgICAgICBpZiAodHlwZVN0cmluZyA9PSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB0eXBlU3RyaW5nID0gdHlwZVN0cmluZy50b1VwcGVyQ2FzZSgpOwotICAgICAgICAgICAgICAgIGlmICh0eXBlU3RyaW5nLmVxdWFscyhWQ2FyZENvbnN0YW50cy5QQVJBTV9UWVBFX1BSRUYpKSB7Ci0gICAgICAgICAgICAgICAgICAgIGhhc1ByZWYgPSB0cnVlOwotICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAodHlwZVN0cmluZy5lcXVhbHMoVkNhcmRDb25zdGFudHMuUEFSQU1fVFlQRV9GQVgpKSB7Ci0gICAgICAgICAgICAgICAgICAgIGlzRmF4ID0gdHJ1ZTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICBpZiAodHlwZVN0cmluZy5zdGFydHNXaXRoKCJYLSIpICYmIHR5cGUgPCAwKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICB0eXBlU3RyaW5nID0gdHlwZVN0cmluZy5zdWJzdHJpbmcoMik7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVTdHJpbmcubGVuZ3RoKCkgPT0gMCkgewotICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgZmluYWwgSW50ZWdlciB0bXAgPSBzS25vd25QaG9uZVR5cGVNYXBfU3RvSS5nZXQodHlwZVN0cmluZyk7Ci0gICAgICAgICAgICAgICAgICAgIGlmICh0bXAgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICAgICAgZmluYWwgaW50IHR5cGVDYW5kaWRhdGUgPSB0bXA7Ci0gICAgICAgICAgICAgICAgICAgICAgICAvLyBUWVBFX1BBR0VSIGlzIHByZWZlcmVkIHdoZW4gdGhlIG51bWJlciBjb250YWlucyBAIHN1cnJvbmRlZCBieQotICAgICAgICAgICAgICAgICAgICAgICAgLy8gYSBwYWdlciBudW1iZXIgYW5kIGEgZG9tYWluIG5hbWUuCi0gICAgICAgICAgICAgICAgICAgICAgICAvLyBlLmcuCi0gICAgICAgICAgICAgICAgICAgICAgICAvLyBvIDExMTFAZG9tYWluLmNvbQotICAgICAgICAgICAgICAgICAgICAgICAgLy8geCBAZG9tYWluLmNvbQotICAgICAgICAgICAgICAgICAgICAgICAgLy8geCAxMTExQAotICAgICAgICAgICAgICAgICAgICAgICAgZmluYWwgaW50IGluZGV4T2ZBdCA9IG51bWJlci5pbmRleE9mKCJAIik7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoKHR5cGVDYW5kaWRhdGUgPT0gUGhvbmUuVFlQRV9QQUdFUgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmJiAwIDwgaW5kZXhPZkF0ICYmIGluZGV4T2ZBdCA8IG51bWJlci5sZW5ndGgoKSAtIDEpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHx8IHR5cGUgPCAwCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHx8IHR5cGUgPT0gUGhvbmUuVFlQRV9DVVNUT00pIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlID0gdG1wOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHR5cGUgPCAwKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICB0eXBlID0gUGhvbmUuVFlQRV9DVVNUT007Ci0gICAgICAgICAgICAgICAgICAgICAgICBsYWJlbCA9IHR5cGVTdHJpbmc7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLSAgICAgICAgaWYgKHR5cGUgPCAwKSB7Ci0gICAgICAgICAgICBpZiAoaGFzUHJlZikgewotICAgICAgICAgICAgICAgIHR5cGUgPSBQaG9uZS5UWVBFX01BSU47Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIC8vIGRlZmF1bHQgdG8gVFlQRV9IT01FCi0gICAgICAgICAgICAgICAgdHlwZSA9IFBob25lLlRZUEVfSE9NRTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgICAgICBpZiAoaXNGYXgpIHsKLSAgICAgICAgICAgIGlmICh0eXBlID09IFBob25lLlRZUEVfSE9NRSkgewotICAgICAgICAgICAgICAgIHR5cGUgPSBQaG9uZS5UWVBFX0ZBWF9IT01FOwotICAgICAgICAgICAgfSBlbHNlIGlmICh0eXBlID09IFBob25lLlRZUEVfV09SSykgewotICAgICAgICAgICAgICAgIHR5cGUgPSBQaG9uZS5UWVBFX0ZBWF9XT1JLOwotICAgICAgICAgICAgfSBlbHNlIGlmICh0eXBlID09IFBob25lLlRZUEVfT1RIRVIpIHsKLSAgICAgICAgICAgICAgICB0eXBlID0gUGhvbmUuVFlQRV9PVEhFUl9GQVg7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLSAgICAgICAgaWYgKHR5cGUgPT0gUGhvbmUuVFlQRV9DVVNUT00pIHsKLSAgICAgICAgICAgIHJldHVybiBsYWJlbDsKLSAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgIHJldHVybiB0eXBlOwotICAgICAgICB9Ci0gICAgfQotCi0gICAgQFN1cHByZXNzV2FybmluZ3MoImRlcHJlY2F0aW9uIikKLSAgICBwdWJsaWMgc3RhdGljIGJvb2xlYW4gaXNNb2JpbGVQaG9uZUxhYmVsK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ZGRsZU5hbWUsIGZpbmFsIFN0cmluZyBnaXZlbk5hbWUpIHsKLSAgICAgICAgZmluYWwgU3RyaW5nW10gbGlzdCA9IG5ldyBTdHJpbmdbM107Ci0gICAgICAgIGZpbmFsIGludCBuYW1lT3JkZXJUeXBlID0gVkNhcmRDb25maWcuZ2V0TmFtZU9yZGVyVHlwZSh2Y2FyZFR5cGUpOwotICAgICAgICBzd2l0Y2ggKG5hbWVPcmRlclR5cGUpIHsKLSAgICAgICAgICAgIGNhc2UgVkNhcmRDb25maWcuTkFNRV9PUkRFUl9KQVBBTkVTRTogewotICAgICAgICAgICAgICAgIGlmIChjb250YWluc09ubHlQcmludGFibGVBc2NpaShmYW1pbHlOYW1lKSAmJgotICAgICAgICAgICAgICAgICAgICAgICAgY29udGFpbnNPbmx5UHJpbnRhYmxlQXNjaWkoZ2l2ZW5OYW1lKSkgewotICAgICAgICAgICAgICAgICAgICBsaXN0WzBdID0gZ2l2ZW5OYW1lOwotICAgICAgICAgICAgICAgICAgICBsaXN0WzFdID0gbWlkZGxlTmFtZTsKLSAgICAgICAgICAgICAgICAgICAgbGlzdFsyXSA9IGZhbWlseU5hbWU7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgbGlzdFswXSA9IGZhbWlseU5hbWU7Ci0gICAgICAgICAgICAgICAgICAgIGxpc3RbMV0gPSBtaWRkbGVOYW1lOwotICAgICAgICAgICAgICAgICAgICBsaXN0WzJdID0gZ2l2ZW5OYW1lOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGNhc2UgVkNhcmRDb25maWcuTkFNRV9PUkRFUl9FVVJPUEU6IHsKLSAgICAgICAgICAgICAgICBsaXN0WzBdID0gbWlkZGxlTmFtZTsKLSAgICAgICAgICAgICAgICBsaXN0WzFdID0gZ2l2ZW5OYW1lOwotICAgICAgICAgICAgICAgIGxpc3RbMl0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0cmluZ0J1aWxkZXIoKTsKLSAgICAgICAgaW50IGxlbmd0aCA9IHZhbHVlLmxlbmd0aCgpOwotICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGxlbmd0aDsgaSsrKSB7Ci0gICAgICAgICAgICBjaGFyIGNoID0gdmFsdWUuY2hhckF0KGkpOwotICAgICAgICAgICAgaWYgKGNoID09ICdcXCcgJiYgaSA8IGxlbmd0aCAtIDEpIHsKLSAgICAgICAgICAgICAgICBjaGFyIG5leHRDaCA9IHZhbHVlLmNoYXJBdChpICsgMSk7Ci0gICAgICAgICAgICAgICAgZmluYWwgU3RyaW5nIHVuZXNjYXBlZFN0cmluZyA9Ci0gICAgICAgICAgICAgICAgICAgIChpc1YzMCA/IFZDYXJkUGFyc2VyX1YzMC51bmVzY2FwZUNoYXJhY3RlcihuZXh0Q2gpIDoKLSAgICAgICAgICAgICAgICAgICAgICAgIFZDYXJkUGFyc2VyX1YyMS51bmVzY2FwZUNoYXJhY3RlcihuZXh0Q2gpKTsKLSAgICAgICAgICAgICAgICBpZiAodW5lc2NhcGVkU3RyaW5nICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgYnVpbGRlci5hcHBlbmQodW5lc2NhcGVkU3RyaW5nKTsKLSAgICAgICAgICAgICAgICAgICAgaSsrOwotICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIGJ1aWxkZXIuYXBwZW5kKGNoKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9IGVsc2UgaWYgKGNoID09ICc7JykgewotICAgICAgICAgICAgICAgIGxpc3QuYWRkKGJ1aWxkZXIudG9TdHJpbmcoKSk7Ci0gICAgICAgICAgICAgICAgYnVpbGRlciA9IG5ldyBTdHJpbmdCdWlsZGVyKCk7Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIGJ1aWxkZXIuYXBwZW5kKGNoKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgICAgICBsaXN0LmFkZChidWlsZGVyLnRvU3RyaW5nKCkpOwotICAgICAgICByZXR1cm4gbGlzdDsKLSAgICB9Ci0KLSAgICBwdWJsaWMgc3RhdGljIGJvb2xlYW4gY29udGFpbnNPbmx5UHJpbnRhYmxlQXNjaWkoZmluYWwgU3RyaW5nLi4udmFsdWVzKSB7Ci0gICAgICAgIGlmICh2YWx1ZXMgPT0gbnVsbCkgewotICAgICAgICAgICAgcmV0dXJuIHRydWU7Ci0gICAgICAgIH0KLSAgICAgICAgcmV0dXJuIGNvbnRhaW5zT25seVByaW50YWJsZUFzY2lpKEFycmF5cy5hc0xpc3QodmFsdWVzKSk7Ci0gICAgfQotCi0gICAgcHVibGljIHN0YXRpYyBib29sZWFuIGNvbnRhaW5zT25seVByaW50YWJsZUFzY2lpKGZpbmFsIENvbGxlY3Rpb248U3RyaW5nPiB2YWx1ZXMpIHsKLSAgICAgICAgaWYgKHZhbHVlcyA9PSBudWxsKSB7Ci0gICAgICAgICAgICByZXR1cm4gdHJ1ZTsKLSAgICAgICAgfQotICAgICAgICBmb3IgKGZpbmFsIFN0cmluZyB2YWx1ZSA6IHZhbHVlcykgewotICAgICAgICAgICAgaWYgKFRleHRVdGlscy5pc0VtcHR5KHZhbHVlKSkgewotICAgICAgICAgICAgICAgIGNvbnRpbnVlOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKCFUZXh0VXRpbHMuaXNQcmludGFibGVBc2NpaU9ubHkodmFsdWUpKSB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgICAgIHJldHVybiB0cnVlOwotICAgIH0KLQotICAgIC8qKgotICAgICAqIFRoaXMgaXMgdXNlZnVsIHdoZW4gY2hlY2tpbmcgdGhlIHN0cmluZyBzaG91bGQgYmUgZW5jb2RlZCBpbnRvIHF1b3RlZC1wcmludGFibGUKLSAgICAgKiBvciBub3QsIHdoaWNoIGlzIHJlcXVpcmVkIGJ5IHZDYXJkIDIuMS4KLSAgICAgKiBTZWUgdGhlIGRlZmluaXRpb24gb2YgIjdiaXQiIGluIHZDYXJkIDIuMSBzcGVjIGZvciBtb3JlIGluZm9ybWF0aW9uLgotICAgICAqLwotICAgIHB1YmxpYyBzdGF0aWMgYm9vbGVhbiBjb250YWluc09ubHlOb25DckxmUHJpbnRhYmxlQXNjaWkoZmluYWwgU3RyaW5nLi4udmFsdWVzKSB7Ci0gICAgICAgIGlmICh2YWx1ZXMgPT0gbnVsbCkgewotICAgICAgICAgICAgcmV0dXJuIHRydWU7Ci0gICAgICAgIH0KLSAgICAgICAgcmV0dXJuIGNvbnRhaW5zT25seU5vbkNyTGZQcmludGFibGVBc2NpaShBcnJheXMuYXNMaXN0KHZhbHVlcykpOwotICAgIH0KLQotICAgIHB1YmxpYyBzdGF0aWMgYm9vbGVhbiBjb250YWluc09ubHlOb25DckxmUHJpbnRhYmxlQXNjaWkoZmluYWwgQ29sbGVjdGlvbjxTdHJpbmc+IHZhbHVlcykgewotICAgICAgICBpZiAodmFsdWVzID09IG51bGwpIHsKLSAgICAgICAgICAgIHJldHVybiB0cnVlOwotICAgICAgICB9Ci0gICAgICAgIGZpbmFsIGludCBhc2NpaUZpcnN0ID0gMHgyMDsKLSAgICAgICAgZmluYWwgaW50IGFzY2lpTGFzdCA9IDB4N0U7ICAvLyBpbmNsdWRlZAotICAgICAgICBmb3IgKGZpbmFsIFN0cmluZyB2YWx1ZSA6IHZhbHVlcykgewotICAgICAgICAgICAgaWYgKFRleHRVdGlscy5pc0VtcHR5KHZhbHVlKSkgewotICAgICAgICAgICAgICAgIGNvbnRpbnVlOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgZmluYWwgaW50IGxlbmd0aCA9IHZhbHVlLmxlbmd0aCgpOwotICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBsZW5ndGg7IGkgPSB2YWx1ZS5vZmZzZXRCeUNvZGVQb2ludHMoaSwgMSkp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0gICAgICogICAgICAgdG8gdGhlIGRldmljZSB3aGljaCBpcyBhYmxlIHRvIHBhcnNlIHRoZSBtYWxmb3JtZWQgaW5wdXQuIAotICAgICAqLwotICAgIHB1YmxpYyBzdGF0aWMgYm9vbGVhbiBjb250YWluc09ubHlBbHBoYURpZ2l0SHlwaGVuKGZpbmFsIFN0cmluZy4uLnZhbHVlcykgewotICAgICAgICBpZiAodmFsdWVzID09IG51bGwpIHsKLSAgICAgICAgICAgIHJldHVybiB0cnVlOwotICAgICAgICB9Ci0gICAgICAgIHJldHVybiBjb250YWluc09ubHlBbHBoYURpZ2l0SHlwaGVuKEFycmF5cy5hc0xpc3QodmFsdWVzKSk7Ci0gICAgfQotCi0gICAgcHVibGljIHN0YXRpYyBib29sZWFuIGNvbnRhaW5zT25seUFscGhhRGlnaXRIeXBoZW4oZmluYWwgQ29sbGVjdGlvbjxTdHJpbmc+IHZhbHVlcykgewotICAgICAgICBpZiAodmFsdWVzID09IG51bGwpIHsKLSAgICAgICAgICAgIHJldHVybiB0cnVlOwotICAgICAgICB9Ci0gICAgICAgIGZpbmFsIGludCB1cHBlckFscGhhYmV0Rmlyc3QgPSAweDQxOyAgLy8gQQotICAgICAgICBmaW5hbCBpbnQgdXBwZXJBbHBoYWJldEFmdGVyTGFzdCA9IDB4NWI7ICAvLyBbCi0gICAgICAgIGZpbmFsIGludCBsb3dlckFscGhhYmV0Rmlyc3QgPSAweDYxOyAgLy8gYQotICAgICAgICBmaW5hbCBpbnQgbG93ZXJBbHBoYWJldEFmdGVyTGFzdCA9IDB4N2I7ICAvLyB7Ci0gICAgICAgIGZpbmFsIGludCBkaWdpdEZpcnN0ID0gMHgzMDsgIC8vIDAKLSAgICAgICAgZmluYWwgaW50IGRpZ2l0QWZ0ZXJMYXN0ID0gMHgzQTsgIC8vIDoKLSAgICAgICAgZmluYWwgaW50IGh5cGhlbiA9ICctJzsKLSAgICAgICAgZm9yIChmaW5hbCBTdHJpbmcgc3RyIDogdmFsdWVzKSB7Ci0gICAgICAgICAgICBpZiAoVGV4dFV0aWxzLmlzRW1wdHkoc3RyKSkgewotICAgICAgICAgICAgICAgIGNvbnRpbnVlOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgZmluYWwgaW50IGxlbmd0aCA9IHN0ci5sZW5ndGgoKTsKLSAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbGVuZ3RoOyBpID0gc3RyLm9mZnNldEJ5Q29kZVBvaW50cyhpLCAxKSkgewotICAgICAgICAgICAgICAgIGludCBjb2RlcG9pbnQgPSBzdHIuY29kZVBvaW50QXQoaSk7Ci0gICAgICAgICAgICAgICAgaWYgKCEoKGxvd2VyQWxwaGFiZXRGaXJzdCA8PSBjb2RlcG9pbnQgJiYgY29kZXBvaW50IDwgbG93ZXJBbHBoYWJldEFmdGVyTGFzdCkgfHwKLSAgICAgICAgICAgICAgICAgICAgKHVwcGVyQWxwaGFiZXRGaXJzdCA8PSBjb2RlcG9pbnQgJiYgY29kZXBvaW50IDwgdXBwZXJBbHBoYWJldEFmdGVyTGFzdCkgfHwKLSAgICAgICAgICAgICAgICAgICAgKGRpZ2l0Rmlyc3QgPD0gY29kZXBvaW50ICYmIGNvZGVwb2ludCA8IGRpZ2l0QWZ0ZXJMYXN0KSB8fAotICAgICAgICAgICAgICAgICAgICAoY29kZXBvaW50ID09IGh5cGhlbikpKSB7Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLSAgICAgICAgcmV0dXJuIHRydWU7Ci0gICAgfQotCi0gICAgLyoqCi0gICAgICogPFA+Ci0gICAgICogUmV0dXJucyB0cnVlIHdoZW4gdGhlIGdpdmVuIFN0cmluZyBpcyBjYXRlZ29yaXplZCBhcyAid29yZCIgc3BlY2lmaWVkIGluIHZDYXJkIHNwZWMgMi4xLgotICAgICAqIDwvUD4KLSAgICAgKiA8UD4KLSAgICAgKiB2Q2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W5lZC4KLSAgICAgKi8KLSAgICBwdWJsaWMgc3RhdGljIFN0cmluZyBndWVzc0ltYWdlVHlwZShmaW5hbCBieXRlW10gaW5wdXQpIHsKLSAgICAgICAgaWYgKGlucHV0ID09IG51bGwpIHsKLSAgICAgICAgICAgIHJldHVybiBudWxsOwotICAgICAgICB9Ci0gICAgICAgIGlmIChpbnB1dC5sZW5ndGggPj0gMyAmJiBpbnB1dFswXSA9PSAnRycgJiYgaW5wdXRbMV0gPT0gJ0knICYmIGlucHV0WzJdID09ICdGJykgewotICAgICAgICAgICAgcmV0dXJuICJHSUYiOwotICAgICAgICB9IGVsc2UgaWYgKGlucHV0Lmxlbmd0aCA+PSA0ICYmIGlucHV0WzBdID09IChieXRlKSAweDg5Ci0gICAgICAgICAgICAgICAgJiYgaW5wdXRbMV0gPT0gJ1AnICYmIGlucHV0WzJdID09ICdOJyAmJiBpbnB1dFszXSA9PSAnRycpIHsKLSAgICAgICAgICAgIC8vIE5vdGU6IHZDYXJkIDIuMSBvZmZpY2lhbGx5IGRvZXMgbm90IHN1cHBvcnQgUE5HLCBidXQgd2UgbWF5IGhhdmUgaXQgYW5kCi0gICAgICAgICAgICAvLyAgICAgICB1c2luZyBYLSB3b3JkIGxpa2UgIlgtUE5HIiBtYXkgbm90IGxldCBpbXBvcnRlcnMga25vdyBpdCBpcyBQTkcuCi0gICAgICAgICAgICAvLyAgICAgICBTbyB3ZSB1c2UgdGhlIFN0cmluZyAiUE5HIiBhcyBpcy4uLgotICAgICAgICAgICAgcmV0dXJuICJQTkciOwotICAgICAgICB9IGVsc2UgaWYgKGlucHV0Lmxlbmd0aCA+PSAyICYmIGlucHV0WzBdID09IChieXRlKSAweGZmCi0gICAgICAgICAgICAgICAgJiYgaW5wdXRbMV0gPT0gKGJ5dGUpIDB4ZDgpIHsKLSAgICAgICAgICAgIHJldHVybiAiSlBFRyI7Ci0gICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICByZXR1cm4gbnVsbDsKLSAgIC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mlidXRlcyhhdHRycywKKyAgICAgICAgICAgICAgICBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0eWxlYWJsZS5NdWx0aVNlbGVjdExpc3RQcmVmZXJlbmNlLCAwLCAwKTsKKyAgICAgICAgbUVudHJpZXMgPSBhLmdldFRleHRBcnJheShjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0eWxlYWJsZS5NdWx0aVNlbGVjdExpc3RQcmVmZXJlbmNlX2VudHJpZXMpOworICAgICAgICBtRW50cnlWYWx1ZXMgPSBhLmdldFRleHRBcnJheShjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0eWxlYWJsZS5NdWx0aVNlbGVjdExpc3RQcmVmZXJlbmNlX2VudHJ5VmFsdWVzKTsKKyAgICAgICAgYS5yZWN5Y2xlKCk7CisgICAgfQorICAgIAorICAgIHB1YmxpYyBNdWx0aVNlbGVjdExpc3RQcmVmZXJlbmNlKENvbnRleHQgY29udGV4dCkgeworICAgICAgICB0aGlzKGNvbnRleHQsIG51bGwpOworICAgIH0KKyAgICAKKyAgICAvKioKKyAgICAgKiBTZXRzIHRoZSBodW1hbi1yZWFkYWJsZSBlbnRyaWVzIHRvIGJlIHNob3duIGluIHRoZSBsaXN0LiBUaGlzIHdpbGwgYmUKKyAgICAgKiBzaG93biBpbiBzdWJzZXF1ZW50IGRpYWxvZ3MuCisgICAgICogPHA+CisgICAgICogRWFjaCBlbnRyeSBtdXN0IGhhdmUgYSBjb3JyZXNwb25kaW5nIGluZGV4IGluCisgICAgICoge0BsaW5rICNzZXRFbnRyeVZhbHVlcyhDaGFyU2VxdWVuY2VbXSl9LgorICAgICAqIAorICAgICAqIEBwYXJhbSBlbnRyaWVzIFRoZSBlbnRyaWVzLgorICAgICAqIEBzZWUgI3NldEVudHJ5VmFsdWVzKENoYXJTZXF1ZW5jZVtdKQorICAgICAqLworICAgIHB1YmxpYyB2b2lkIHNldEVudHJpZXMoQ2hhclNlcXVlbmNlW10gZW50cmllcykgeworICAgICAgICBtRW50cmllcyA9IGVudHJpZXM7CisgICAgfQorICAgIAorICAgIC8qKgorICAgICAqIEBzZWUgI3NldEVudHJpZXMoQ2hhclNlcXVlbmNlW10pCisgICAgICogQHBhcmFtIGVudHJpZXNSZXNJZCBUaGUgZW50cmllcyBhcnJheSBhcyBhIHJlc291cmNlLgorICAgICAqLworICAgIHB1YmxpYyB2b2lkIHNldEVudHJpZXMoaW50IGVudHJpZXNSZXNJZCkgeworICAgICAgICBzZXRFbnRyaWVzKGdldENvbnRleHQoKS5nZXRSZXNvdXJjZXMoKS5nZXRUZXh0QXJyYXkoZW50cmllc1Jlc0lkKSk7CisgICAgfQorICAgIAorICAgIC8qKgorICAgICAqIFRoZSBsaXN0IG9mIGVudHJpZXMgdG8gYmUgc2hvd24gaW4gdGhlIGxpc3QgaW4gc3Vic2VxdWVudCBkaWFsb2dzLgorICAgICAqIAorICAgICAqIEByZXR1cm4gVGhlIGxpc3QgYXMgYW4gYXJyYXkuCisgICAgICovCisgICAgcHVibGljIENoYXJTZXF1ZW5jZVtdIGdldEVudHJpZXMoKSB7CisgICAgICAgIHJldHVybiBtRW50cmllczsKKyAgICB9CisgICAgCisgICAgLyoqCisgICAgICogVGhlIGFycmF5IHRvIGZpbmQgdGhlIHZhbHVlIHRvIHNhdmUgZm9yIGEgcHJlZmVyZW5jZSB3aGVuIGFuIGVudHJ5IGZyb20KKyAgICAgKiBlbnRyaWVzIGlzIHNlbGVjdGVkLiBJZiBhIHVzZXIgY2xpY2tzIG9uIHRoZSBzZWNvbmQgaXRlbSBpbiBlbnRyaWVzLCB0aGUKKyAgICAgKiBzZWNvbmQgaXRlbSBpbiB0aGlzIGFycmF5IHdpbGwgYmUgc2F2ZWQgdG8gdGhlIHByZWZlcmVuY2UuCisgICAgICogCisgICAgICogQHBhcmFtIGVudHJ5VmFsdWVzIFRoZSBhcnJheSB0byBiZSB1c2VkIGFzIHZhbHVlcyB0byBzYXZlIGZvciB0aGUgcHJlZmVyZW5jZS4KKy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iB2YWx1ZXMpIHsKKyAgICAgICAgbVZhbHVlcyA9IHZhbHVlczsKKyAgICAgICAgCisgICAgICAgIHBlcnNpc3RTdHJpbmdTZXQodmFsdWVzKTsKKyAgICB9CisgICAgCisgICAgLyoqCisgICAgICogUmV0cmlldmVzIHRoZSBjdXJyZW50IHZhbHVlIG9mIHRoZSBrZXkuCisgICAgICovCisgICAgcHVibGljIFNldDxTdHJpbmc+IGdldFZhbHVlcygpIHsKKyAgICAgICAgcmV0dXJuIG1WYWx1ZXM7CisgICAgfQorICAgIAorICAgIC8qKgorICAgICAqIFJldHVybnMgdGhlIGluZGV4IG9mIHRoZSBnaXZlbiB2YWx1ZSAoaW4gdGhlIGVudHJ5IHZhbHVlcyBhcnJheSkuCisgICAgICogCisgICAgICogQHBhcmFtIHZhbHVlIFRoZSB2YWx1ZSB3aG9zZSBpbmRleCBzaG91bGQgYmUgcmV0dXJuZWQuCisgICAgICogQHJldHVybiBUaGUgaW5kZXggb2YgdGhlIHZhbHVlLCBvciAtMSBpZiBub3QgZm91bmQuCisgICAgICovCisgICAgcHVibGljIGludCBmaW5kSW5kZXhPZlZhbHVlKFN0cmluZyB2YWx1ZSkgeworICAgICAgICBpZiAodmFsdWUgIT0gbnVsbCAmJiBtRW50cnlWYWx1ZXMgIT0gbnVsbCkgeworICAgICAgICAgICAgZm9yIChpbnQgaSA9IG1FbnRyeVZhbHVlcy5sZW5ndGggLSAxOyBpID49IDA7IGktLSkgeworICAgICAgICAgICAgICAgIGlmIChtRW50cnlWYWx1ZXNbaV0uZXF1YWxzKHZhbHVlKSkgeworICAgICAgICAgICAgICAgICAgICByZXR1cm4gaTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIC0xOworICAgIH0KKyAgICAKKyAgICBAT3ZlcnJpZGUKKyAgICBwcm90ZWN0ZWQgdm9pZCBvblByZXBhcmVEaWFsb2dCdWlsZGVyKEJ1aWxkZXIgYnVpbGRlcikgeworICAgICAgICBzdXBlci5vblByZXBhcmVEaWFsb2dCdWlsZGVyKGJ1aWxkZXIpOworICAgICAgICAKKyAgICAgICAgaWYgKG1FbnRyaWVzID09IG51bGwgfHwgbUVudHJ5VmFsdWVzID09IG51bGwpIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oCisgICAgICAgICAgICAgICAgICAgICJNdWx0aVNlbGVjdExpc3RQcmVmZXJlbmNlIHJlcXVpcmVzIGFuIGVudHJpZXMgYXJyYXkgYW5kICIgKworICAgICAgICAgICAgICAgICAgICAiYW4gZW50cnlWYWx1ZXMgYXJyYXkuIik7CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIGJvb2xlYW5bXSBjaGVja2VkSXRlbXMgPSBnZXRTZWxlY3RlZEl0ZW1zKCk7CisgICAgICAgIGJ1aWxkZXIuc2V0TXVsdGlDaG9pY2VJdGVtcyhtRW50cmllcywgY2hlY2tlZEl0ZW1zLAorICAgICAgICAgICAgICAgIG5ldyBEaWFsb2dJbnRlcmZhY2UuT25NdWx0aUNob2ljZUNsaWNrTGlzdGVuZXIoKSB7CisgICAgICAgICAgICAgICAgICAgIHB1YmxpYyB2b2lkIG9uQ2xpY2soRGlhbG9nSW50ZXJmYWNlIGRpYWxvZywgaW50IHdoaWNoLCBib29sZWFuIGlzQ2hlY2tlZCkgeworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGlzQ2hlY2tlZCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1QcmVmZXJlbmNlQ2hhbmdlZCB8PSBtTmV3VmFsdWVzLmFkZChtRW50cmllc1t3aGljaF0udG9TdHJpbmcoKSk7CisgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1QcmVmZXJlbmNlQ2hhbmdlZCB8PSBtTmV3VmFsdWVzLnJlbW92ZShtRW50cmllc1t3aGljaF0udG9TdHJpbmcoKSk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9KTsKKyAgICAgICAgbU5ld1ZhbHVlcy5jbGVhcigpOworICAgICAgICBtTmV3VmFsdWVzLmFkZEFsbChtVmFsdWVzKTsKKyAgICB9CisgICAgCisgICAgcHJpdmF0ZSBib29sZWFuW10gZ2V0U2VsZWN0ZWRJdGVtcygpIHsKKyAgICAgICAgZmluYWwgQ2hhclNlcXVlbmNlW10gZW50cmllcyA9IG1FbnRyaWVzOworICAgICAgICBmaW5hbCBpbnQgZW50cnlDb3VudCA9IGVudHJpZXMubGVuZ3RoOworICAgICAgICBmaW5hbCBTZXQ8U3RyaW5nPiB2YWx1ZXMgPSBtVmFsdWVzOworICAgICAgICBib29sZWFuW10gcmVzdWx0ID0gbmV3IGJvb2xlYW5bZW50cnlDb3VudF07CisgICAgICAgIAorICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGVudHJ5Q291bnQ7IGkrKykgeworICAgICAgICAgICAgcmVzdWx0W2ldID0gdmFsdWVzLmNvbnRhaW5zKGVudHJpZXNbaV0udG9TdHJpbmcoKSk7CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIHJldHVybiByZXN1bHQ7CisgICAgfQorICAgIAorICAgIEBPdmVycmlkZQorICAgIHByb3RlY3RlZCB2b2lkIG9uRGlhbG9nQ2xvc2VkKGJvb2xlYW4gcG9zaXRpdmVSZXN1bHQpIHsKKyAgICAgICAgc3VwZXIub25EaWFsb2dDbG9zZWQocG9zaXRpdmVSZXN1bHQpOworICAgICAgICAKKyAgICAgICAgaWYgKHBvc2l0aXZlUmVzdWx0ICYmIG1QcmVmZXJlbmNlQ2hhbmdlZCkgeworICAgICAgICAgICAgZmluYWwgU2V0PFN0cmluZz4gdmFsdWVzID0gbU5ld1ZhbHVlczsKKyAgICAgICAgICAgIGlmIChjYWxsQ2hhbmdlTGlzdGVuZXIodmFsdWVzKSkgeworIC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Aoc2hvdWxkUGVyc2lzdCgpKSB7CisgICAgICAgICAgICAvLyBTaG91bGRuJ3Qgc3RvcmUgbnVsbAorICAgICAgICAgICAgaWYgKHZhbHVlcy5lcXVhbHMoZ2V0UGVyc2lzdGVkU3RyaW5nU2V0KG51bGwpKSkgeworICAgICAgICAgICAgICAgIC8vIEl0J3MgYWxyZWFkeSB0aGVyZSwgc28gdGhlIHNhbWUgYXMgcGVyc2lzdGluZworICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICAgICAgfQorICAgICAgICAgICAgCisgICAgICAgICAgICBTaGFyZWRQcmVmZXJlbmNlcy5FZGl0b3IgZWRpdG9yID0gbVByZWZlcmVuY2VNYW5hZ2VyLmdldEVkaXRvcigpOworICAgICAgICAgICAgZWRpdG9yLnB1dFN0cmluZ1NldChtS2V5LCB2YWx1ZXMpOworICAgICAgICAgICAgdHJ5Q29tbWl0KGVkaXRvcik7CisgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgLyoqCisgICAgICogQXR0ZW1wdHMgdG8gZ2V0IGEgcGVyc2lzdGVkIHNldCBvZiBTdHJpbmdzIGZyb20gdGhlCisgICAgICoge0BsaW5rIGFuZHJvaWQuY29udGVudC5TaGFyZWRQcmVmZXJlbmNlc30uCisgICAgICogPHA+CisgICAgICogVGhpcyB3aWxsIGNoZWNrIGlmIHRoaXMgUHJlZmVyZW5jZSBpcyBwZXJzaXN0ZW50LCBnZXQgdGhlIFNoYXJlZFByZWZlcmVuY2VzCisgICAgICogZnJvbSB0aGUge0BsaW5rIFByZWZlcmVuY2VNYW5hZ2VyfSwgYW5kIGdldCB0aGUgdmFsdWUuCisgICAgICogCisgICAgICogQHBhcmFtIGRlZmF1bHRSZXR1cm5WYWx1ZSBUaGUgZGVmYXVsdCB2YWx1ZSB0byByZXR1cm4gaWYgZWl0aGVyIHRoZQorICAgICAqICAgICAgICAgICA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NHX0JJTkRfUFJFRkVSRU5DRVMgPSAwOworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBNU0dfQlVJTERfSEVBREVSUyA9IDE7CiAgICAgcHJpdmF0ZSBIYW5kbGVyIG1IYW5kbGVyID0gbmV3IEhhbmRsZXIoKSB7CiAgICAgICAgIEBPdmVycmlkZQogICAgICAgICBwdWJsaWMgdm9pZCBoYW5kbGVNZXNzYWdlKE1lc3NhZ2UgbXNnKSB7CiAgICAgICAgICAgICBzd2l0Y2ggKG1zZy53aGF0KSB7Ci0gICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgY2FzZSBNU0dfQklORF9QUkVGRVJFTkNFUzoKICAgICAgICAgICAgICAgICAgICAgYmluZFByZWZlcmVuY2VzKCk7CiAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgTVNHX0JVSUxEX0hFQURFUlM6CisgICAgICAgICAgICAgICAgICAgIG9uQnVpbGRIZWFkZXJzKG1IZWFkZXJzKTsKKyAgICAgICAgICAgICAgICAgICAgbUFkYXB0ZXIubm90aWZ5RGF0YVNldENoYW5nZWQoKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KICAgICB9OwogCisgICAgcHJpdmF0ZSBzdGF0aWMgY2xhc3MgSGVhZGVyQWRhcHRlciBleHRlbmRzIEFycmF5QWRhcHRlcjxIZWFkZXI+IHsKKyAgICAgICAgcHJpdmF0ZSBzdGF0aWMgY2xhc3MgSGVhZGVyVmlld0hvbGRlciB7CisgICAgICAgICAgICBJbWFnZVZpZXcgaWNvbjsKKyAgICAgICAgICAgIFRleHRWaWV3IHRpdGxlOworICAgICAgICAgICAgVGV4dFZpZXcgc3VtbWFyeTsKKyAgICAgICAgfQorCisgICAgICAgIHByaXZhdGUgTGF5b3V0SW5mbGF0ZXIgbUluZmxhdGVyOworCisgICAgICAgIHB1YmxpYyBIZWFkZXJBZGFwdGVyKENvbnRleHQgY29udGV4dCwgTGlzdDxIZWFkZXI+IG9iamVjdHMpIHsKKyAgICAgICAgICAgIHN1cGVyKGNvbnRleHQsIDAsIG9iamVjdHMpOworICAgICAgICAgICAgbUluZmxhdGVyID0gKExheW91dEluZmxhdGVyKWNvbnRleHQuZ2V0U3lzdGVtU2VydmljZShDb250ZXh0LkxBWU9VVF9JTkZMQVRFUl9TRVJWSUNFKTsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgVmlldyBnZXRWaWV3KGludCBwb3NpdGlvbiwgVmlldyBjb252ZXJ0VmlldywgVmlld0dyb3VwIHBhcmVudCkgeworICAgICAgICAgICAgSGVhZGVyVmlld0hvbGRlciBob2xkZXI7CisgICAgICAgICAgICBWaWV3IHZpZXc7CisKKyAgICAgICAgICAgIGlmIChjb252ZXJ0VmlldyA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgdmlldyA9IG1JbmZsYXRlci5pbmZsYXRlKGNvbS5hbmRyb2lkLmludGVybmFsLlIubGF5b3V0LnByZWZlcmVuY2VfbGlzdF9pdGVtLAorICAgICAgICAgICAgICAgICAgICAgICAgcGFyZW50LCBmYWxzZSk7CisgICAgICAgICAgICAgICAgaG9sZGVyID0gbmV3IEhlYWRlclZpZXdIb2xkZXIoKTsKKyAgICAgICAgICAgICAgICBob2xkZXIuaWNvbiA9IChJbWFnZVZpZXcpIHZpZXcuZmluZFZpZXdCeUlkKGNvbS5hbmRyb2lkLmludGVybmFsLlIuaWQuaWNvbik7CisgICAgICAgICAgICAgICAgaG9sZGVyLnRpdGxlID0gKFRleHRWaWV3KSB2aWV3LmZpbmRWaWV3QnlJZChjb20uYW5kcm9pZC5pbnRlcm5hbC5SLmlkLnRpdGxlKTsKKyAgICAgICAgICAgICAgICBob2xkZXIuc3VtbWFyeSA9IChUZXh0Vmlldykgdmlldy5maW5kVmlld0J5SWQoY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5pZC5zdW1tYXJ5KTsKKyAgICAgICAgICAgICAgICB2aWV3LnNldFRhZyhob2xkZXIpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICB2aWV3ID0gY29udmVydFZpZXc7CisgICAgICAgICAgICAgICAgaG9sZGVyID0gKEhlYWRlclZpZXdIb2xkZXIpIHZpZXcuZ2V0VGFnKCk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIC8vIEFsbCB2aWV3IGZpZWxkcyBtdXN0IGJlIHVwZGF0ZWQgZXZlcnkgdGltZSwgYmVjYXVzZSB0aGUgdmlldyBtYXkgYmUgcmVjeWNsZWQgCisgICAgICAgICAgICBIZWFkZXIgaGVhZGVyID0gZ2V0SXRlbShwb3NpdGlvbik7CisgICAgICAgICAgICBpZiAoaGVhZGVyLmljb24gPT0gbnVsbCkgeworICAgICAgICAgICAgICAgIGhvbGRlci5pY29uLnNldEltYWdlRHJhd2FibGUobnVsbCk7CisgICAgICAgICAgICAgICAgaG9sZGVyLmljb24uc2V0SW1hZ2VSZXNvdXJjZShoZWFkZXIuaWNvblJlcyk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIGhvbGRlci5pY29uLnNldEltYWdlUmVzb3VyY2UoMCk7CisgICAgICAgICAgICAgICAgaG9sZGVyLmljb24uc2V0SW1hZ2VEcmF3YWJsZShoZWFkZXIuaWNvbik7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBob2xkZXIudGl0bGUuc2V0VGV4dChoZWFkZXIudGl0bGUpOworICAgICAgICAgICAgaWYgKFRleHRVdGlscy5pc0VtcHR5KGhlYWRlci5zdW1tYXJ5KSkgeworICAgICAgICAgICAgICAgIGhvbGRlci5zdW1tYXJ5LnNldFZpc2liaWxpdHkoVmlldy5HT05FKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgaG9sZGVyLnN1bW1hcnkuc2V0VmlzaWJpbGl0eShWaWV3LlZJU0lCTEUpOworICAgICAgICAgICAgICAgIGhvbGRlci5zdW1tYXJ5LnNldFRleHQoaGVhZGVyLnN1bW1hcnkpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICByZXR1cm4gdmlldzsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIERlc2NyaXB0aW9uIG9mIGEgc2luZ2xlIEhlYWRlciBpdGVtIHRoYXQgdGhlIHVzZXIgY2FuIHNlbGVjdC4KKyAgICAgKi8KKyAgICBwdWJsaWMgc3RhdGljIGNsYXNzIEhlYWRlciB7CisgICAgICAgIC8qKgorICAgICAgICAgKiBUaXRsZSBvZiB0aGUgaGVhZGVyIHRoYXQgaXMgc2hvd24gdG8gdGhlIHVzZXIuCisgICAgICAgICAqIEBhdHRyIHJlZiBhbmRyb2lkLlIuc3R5bGVhYmxlI1ByZWZlcmVuY2VIZWFkZXJfdGl0bGUKKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBDaGFyU2VxdWVuY2UgdGl0bGU7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIE9wdGlvbmFsIHN1bW1hcnkgZGVzY3JpYmluZyB3aGF0IHRoaXMgaGVhZGVyIGNvbnRyb2xzLgorICAgICAgICAgKiBAYXR0ciByZWYgYW5kcm9pZC5SLnN0eWxlYWJsZSNQcmVmZXJlbmNlSGVhZGVyX3N1bW1hcnkKKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBDaGFyU2VxdWVuY2Ugc3VtbWFyeTsKKworICAgICAgICAvKioKKyAgICAgICAgICogT3B0aW9uYWwgaWNvbiByZXNvdXJjZSB0byBzaG93IGZvciB0aGlzIGhlYWRlci4KKyAgICAgICAgICogQGF0dHIgcmVmIGFuZHJvaWQuUi5zdHlsZWFibGUjUHJlZmVyZW5jZUhlYWRlcl9pY29uCisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgaW50IGljb25SZXM7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIE9wdGlvbmFsIGljb24gZHJhd2FibGUgdG8gc2hvdyBmb3IgdGhpcyBoZWFkZXIuICAoSWYgdGhpcyBpcyBub24tbnVsbCwKKyAgICAgICAgICogdGhlIGljb25SZXMgd2lsbCBiZSBpZ25vcmVkLikKKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBEcmF3YWJsZSBpY29uOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBGdWxsIGNsYXNzIG5hbWUgb2YgdGhlIGZyYWdtZW50IHRvIGRpc3BsYXkgd2hlbiB0aGlzIGhlYWRlciBpcworICAgICAgICAgKiBzZWxlY3RlZC4KKyAgICAgICAgICogQGF0dHIgcmVmIGFuZHJvaWQuUi5zdHlsZWFibGUjUHJlZmVyZW5jZUhlYWRlcl9mcmFnbWVudAorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIFN0cmluZyBmcmFnbWVudDsKKworICAgICAgICAvKioKKyAgICAgICAgICogT3B0aW9uYWwgYXJndW1lbnRzIHRvIHN1cHBseSB0byB0aGUgZnJhZ21lbnQgd2hlbiBpdCBpcworICAgICAgICAgKiBpbnN0YW50aWF0ZWQuCisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgQnVuZGxlIGZyYWdtZW50QXJndW1lbnRzOworICAgIH0KKwogICAgIEBPdmVycmlkZQogICAgIHByb3RlY3RlZCB2b2lkIG9uQ3JlYXRlKEJ1bmRsZSBzYXZlZEluc3RhbmNlU3RhdGUpIHsKICAgICAgICAgc3VwZXIub25DcmVhdGUoc2F2ZWRJbnN0YW5jZVN0YXRlKTsKIAogICAgICAgICBzZXRDb250ZW50Vmlldyhjb20uYW5kcm9pZC5pbnRlcm5hbC5SLmxheW91dC5wcmVmZXJlbmNlX2xpc3RfY29udGVudCk7Ci0gICAgICAgIAotICAgICAgICBtUHJlZmVyZW5jZU1hbmFnZXIgPSBvbkNyZWF0ZVByZWZlcmVuY2VNYW5hZ2VyKCk7CisKKyAgICAgICAgbVByZWZzQ29udGFpbmVyID0gZmluZFZpZXdCeUlkKGNvbS5hbmRyb2lkLmludGVybmFsLlIuaWQucHJlZnMpOworICAgICAgICBib29sZWFuIGhpZGluZ0hlYWRlcnMgPSBvbklzSGlkaW5nSGVhZGVycygpOworICAgICAgICBtU2luZ2xlUGFuZSA9IGhpZGluZ0hlYWRlcnMgfHwgIW9uSXNNdWx0aVBhbmUoKTsKKyAgICAgICAgU3RyaW5nIGluaXRpYWxGcmFnbWVudCA9IGdldEludGVudCgpLmdldFN0cmluZ0V4dHJhKEVYVFJBX1NIT1dfRlJBR01FTlQpOworICAgICAgICBCdW5kbGUgaW5pdGlhbEFyZ3VtZW50cyA9IGdldEludGVudCgpLmdldEJ1bmRsZUV4dHJhKEVYVFJBX1NIT1dfRlJBR01FTlRfQVJHVU1FTlRTKTsKKworICAgICAgICBpZiAoaW5pdGlhbEZyYWdtZW50ICE9IG51bGwgJiYgbVNpbmdsZVBhbmUpIHsKKyAgICAgICAgICAgIC8vIElmIHdlIGFyZSBqdXN0IHNob3dpbmcgYSBmcmFnbWVudCwgd2Ugd2FudCB0byBydW4gaW4KKyAgICAgICAgICAgIC8vIG5ldyBmcmFnbWVudCBtb2RlLCBidXQgZG9uJ3QgbmVlZCB0byBjb21wdXRlIGFuZCBzaG93CisgICAgICAgICAgICAvLyB0aGUgaGVhZGVycy4KKyAgICAgICAgICAgIGdldExpc3RWaWV3KCkuc2V0VmlzaWJpbGl0eShWaWV3LkdPTkUpOworICAgICAgICAgICAgbVByZWZzQ29udGFpbmVyLnNldFZpc2liaWxpdHkoVmlldy5WSVNJQkxFKTsKKyAgICAgICAgICAgIHN3aXRjaFRvSGVhZGVyKGluaXRpYWxGcmFnbWVudCwgaW5pdGlhbEFyZ3VtZW50cyk7CisKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIC8vIFdlIG5lZWQgdG8gdHJ5IHRvIGJ1aWxkIHRoZSBoZWFkZXJzLgorICAgICAgICAgICAgb25CdWlsZEhlYWRlcnMobUhlYWRlcnMpOworCisgICAgICAgICAgICAvLyBJZiB0aGVyZSBhcmUgaGVhZGVycywgdGhlbiBhdCB0aGlzIHBvaW50IHdlIG5lZWQgdG8gc2hvdworICAgICAgICAgICAgLy8gdGhlbSBhbmQsIGRlcGVuZGluZyBvbiB0aGUgc2NyZWVuLCB3ZSBtYXkgYWxzbyBzaG93IGluLWxpbmUKKyAgICAgICAgICAgIC8vIHRoZSBjdXJyZW50bHkgc2VsZWN0ZWQgcHJlZmVyZW5jZSBmcmFnbWVudC4KKyAgICAgICAgICAgIGlmIChtSGVhZGVycy5zaXplKCkgPiAwKSB7CisgICAgICAgICAgICAgICAgbUFkYXB0ZXIgPSBuZXcgSGVhZGVyQWRhcHRlcih0aGlzLCBtSGVhZGVycyk7CisgICAgICAgICAgICAgICAgc2V0TGlzdEFkYXB0ZXIobUFkYXB0ZXIpOworICAgICAgICAgICAgICAgIGlmICghbVNpbmdsZVBhbmUpIHsKKyAgICAgICAgICAgICAgICAgICAgbVByZWZzQ29udGFpbmVyLnNldFZpc2liaWxpdHkoVmlldy5WSVNJQkxFKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGluaXRpYWxGcmFnbWVudCA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBIZWFkZXIgaCA9IG9uR2V0SW5pdGlhbEhlYWRlcigpOworICAgICAgICAgICAgICAgICAgICAgICAgaW5pdGlhbEZyYWdtZW50ID0gaC5mcmFnbWVudDsKKyAgICAgICAgICAgICAgICAgICAgICAgIGluaXRpYWxBcmd1bWVudHMgPSBoLmZyYWdtZW50QXJndW1lbnRzOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIHN3aXRjaFRvSGVhZGVyKGluaXRpYWxGcmFnbWVudCwgaW5pdGlhbEFyZ3VtZW50cyk7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAvLyBJZiB0aGVyZSBhcmUgbm8gaGVhZGVycywgd2UgYXJlIGluIHRoZSBvbGQgImp1c3Qgc2hvdyBhIHNjcmVlbgorICAgICAgICAgICAgLy8gb2YgcHJlZmVyZW5jZXMiIG1vZGUuCisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIG1QcmVmZXJlbmNlTWFuYWdlciA9IG5ldyBQcmVmZXJlbmNlTWFuYWdlcih0aGlzLCBGSVJTVF9SRVFVRVNUX0NPREUpOworICAgICAgICAgICAgICAgIG1QcmVmZXJlbmNlTWFuYWdlci5zZXRPblByZWZlcmVuY2VUcmVlQ2xpY2tMaXN0ZW5lcih0aGlzKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCiAgICAgICAgIGdldExpc3RWaWV3KCkuc2V0U2Nyb2xsQmFyU3R5bGUoVmlldy5TQ1JPTExCQVJTX0lOU0lERV9PVkVSTEFZKTsKKworICAgICAgICAvLyBzZWUgaWYgd2Ugc2hvdWxkIHNob3cgQmFjay9OZXh0IGJ1dHRvbnMKKyAgICAgICAgSW50ZW50IGludGVudCA9IGdldEludGVudCgpOworICAgICAgICBpZiAoaW50ZW50LmdldEJvb2xlYW5FeHRyYShFWFRSQV9QUkVGU19TSE9XX0JVVFRPTl9CQVIsIGZhbHNlKSkgeworCisgICAgICAgICAgICBmaW5kVmlld0J5SWQoY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5pZC5idXR0b25fYmFyKS5zZXRWaXNpYmlsaXR5KFZpZXcuVklTSUJMRSk7CisKKyAgICAgICAgICAgIEJ1dHRvbiBiYWNrQnV0dG9uID0gKEJ1dHRvbilmaW5kVmlld0J5SWQoY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5pZC5iYWNrX2J1dHRvbik7CisgICAgICAgICAgICBiYWNrQnV0dG9uLnNldE9uQ2xpY2tMaXN0ZW5lcihuZXcgT25DbGlja0xpc3RlbmVyKCkgeworICAgICAgICAgICAgICAgIHB1YmxpYyB2b2lkIG9uQ2xpY2soVmlldyB2KSB7CisgICAgICAgICAgICAgICAgICAgIHNldFJlc3VsdChSRVNVTFRfQ0FOQ0VMRUQpOworICAgICAgICAgICAgICAgICAgICBmaW5pc2goKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9KTsKKyAgICAgICAgICAgIEJ1dHRvbiBza2lwQnV0dG9uID0gKEJ1dHRvbilmaW5kVmlld0J5SWQoY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5pZC5za2lwX2J1dHRvbik7CisgICAgICAgICAgICBza2lwQnV0dG9uLnNldE9uQ2xpY2tMaXN0ZW5lcihuZXcgT25DbGlja0xpc3RlbmVyKCkgeworICAgICAgICAgICAgICAgIHB1YmxpYyB2b2lkIG9uQ2xpY2soVmlldyB2KSB7CisgICAgICAgICAgICAgICAgICAgIHNldFJlc3VsdChSRVNVTFRfT0spOworICAgICAgICAgICAgICAgICAgICBmaW5pc2goKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9KTsKKyAgICAgICAgICAgIG1OZXh0QnV0dG9uID0gKEJ1dHRvbilmaW5kVmlld0J5SWQoY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5pZC5uZXh0X2J1dHRvbik7CisgICAgICAgICAgICBtTmV4dEJ1dHRvbi5zZXRPbkNsaWNrTGlzdGVuZXIobmV3IE9uQ2xpY2tMaXN0ZW5lcigpIHsKKyAgICAgICAgICAgICAgICBwdWJsaWMgdm9pZCBvbkNsaWNrKFZpZXcgdikgeworICAgICAgICAgICAgICAgICAgICBzZXRSZXN1bHQoUkVTVUxUX09LKTsKKyAgICAgICAgICAgICAgICAgICAgZmluaXNoKCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSk7CisKKyAgICAgICAgICAgIC8vIHNldCBvdXIgdmFyaW91cyBidXR0b24gcGFyYW1ldGVycworICAgICAgICAgICAgaWYgKGludGVudC5oYXNFeHRyYShFWFRSQV9QUkVGU19TRVRfTkVYVF9URVhUKSkgeworICAgICAgICAgICAgICAgIFN0cmluZyBidXR0b25UZXh0ID0gaW50ZW50LmdldFN0cmluZ0V4dHJhKEVYVFJBX1BSRUZTX1NFVF9ORVhUX1RFWFQpOworICAgICAgICAgICAgICAgIGlmIChUZXh0VXRpbHMuaXNFbXB0eShidXR0b25UZXh0KSkgeworICAgICAgICAgICAgICAgICAgICBtTmV4dEJ1dHRvbi5zZXRWaXNpYmlsaXR5KFZpZXcuR09ORSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGVsc2UgeworICAgICAgICAgICAgICAgICAgICBtTmV4dEJ1dHRvbi5zZXRUZXh0KGJ1dHRvblRleHQpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmIChpbnRlbnQuaGFzRXh0cmEoRVhUUkFfUFJFRlNfU0VUX0JBQ0tfVEVYVCkpIHsKKyAgICAgICAgICAgICAgICBTdHJpbmcgYnV0dG9uVGV4dCA9IGludGVudC5nZXRTdHJpbmdFeHRyYShFWFRSQV9QUkVGU19TRVRfQkFDS19URVhUKTsKKyAgICAgICAgICAgICAgICBpZiAoVGV4dFV0aWxzLmlzRW1wdHkoYnV0dG9uVGV4dCkpIHsKKyAgICAgICAgICAgICAgICAgICAgYmFja0J1dHRvbi5zZXRWaXNpYmlsaXR5KFZpZXcuR09ORSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGVsc2UgeworICAgICAgICAgICAgICAgICAgICBiYWNrQnV0dG9uLnNldFRleHQoYnV0dG9uVGV4dCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKGludGVudC5nZXRCb29sZWFuRXh0cmEoRVhUUkFfUFJFRlNfU0hPV19TS0lQLCBmYWxzZSkpIHsKKyAgICAgICAgICAgICAgICBza2lwQnV0dG9uLnNldFZpc2liaWxpdHkoVmlldy5WSVNJQkxFKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIFJldHVybnMgdHJ1ZSBpZiB0aGlzIGFjdGl2aXR5IGlzIGN1cnJlbnRseSBzaG93aW5nIHRoZSBoZWFkZXIgbGlzdC4KKyAgICAgKi8KKyAgICBwdWJsaWMgYm9vbGVhbiBoYXNIZWFkZXJzKCkgeworICAgICAgICByZXR1cm4gZ2V0TGlzdFZpZXcoKS5nZXRWaXNpYmlsaXR5KCkgPT0gVmlldy5WSVNJQkxFCisgICAgICAgICAgICAgICAgJiYgbVByZWZlcmVuY2VNYW5hZ2VyID09IG51bGw7CisgICAgfQorCisgICAgLyoqCisgICAgICogUmV0dXJucyB0cnVlIGlmIHRoaXMgYWN0aXZpdHkgaXMgc2hvd2luZyBtdWx0aXBsZSBwYW5lcyAtLSB0aGUgaGVhZGVycworICAgICAqIGFuZCBhIHByZWZlcmVuY2UgZnJhZ21lbnQuCisgICAgICovCisgICAgcHVibGljIGJvb2xlYW4gaXNNdWx0aVBhbmUoKSB7CisgICAgICAgIHJldHVybiBoYXNIZWFkZXJzKCkgJiYgbVByZWZzQ29udGFpbmVyLmdldFZpc2liaWxpdHkoKSA9PSBWaWV3LlZJU0lCTEU7CisgICAgfQorCisgICAgLyoqCisgICAgICogQ2FsbGVkIHRvIGRldGVybWluZSBpZiB0aGUgYWN0aXZpdHkgc2hvdWxkIHJ1biBpbiBtdWx0aS1wYW5lIG1vZGUuCisgICAgICogVGhlIGRlZmF1bHQgaW1wbGVtZW50YXRpb24gcmV0dXJucyB0cnVlIGlmIHRoZSBzY3JlZW4gaXMgbGFyZ2UKKyAgICAgKiBlbm91Z2guCisgICAgICovCisgICAgcHVibGljIGJvb2xlYW4gb25Jc011bHRpUGFuZSgpIHsKKyAgICAgICAgQ29uZmlndXJhdGlvbiBjb25maWcgPSBnZXRSZXNvdXJjZXMoKS5nZXRDb25maWd1cmF0aW9uKCk7CisgICAgICAgIGlmICgoY29uZmlnLnNjcmVlbkxheW91dCZDb25maWd1cmF0aW9uLlNDUkVFTkxBWU9VVF9TSVpFX01BU0spCisgICAgICAgICAgICAgICAgPT0gQ29uZmlndXJhdGlvbi5TQ1JFRU5MQVlPV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bFJlc291cmNlUGFyc2VyIHBhcnNlciA9IG51bGw7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBwYXJzZXIgPSBnZXRSZXNvdXJjZXMoKS5nZXRYbWwocmVzaWQpOworICAgICAgICAgICAgQXR0cmlidXRlU2V0IGF0dHJzID0gWG1sLmFzQXR0cmlidXRlU2V0KHBhcnNlcik7CisKKyAgICAgICAgICAgIGludCB0eXBlOworICAgICAgICAgICAgd2hpbGUgKCh0eXBlPXBhcnNlci5uZXh0KCkpICE9IFhtbFB1bGxQYXJzZXIuRU5EX0RPQ1VNRU5UCisgICAgICAgICAgICAgICAgICAgICYmIHR5cGUgIT0gWG1sUHVsbFBhcnNlci5TVEFSVF9UQUcpIHsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgU3RyaW5nIG5vZGVOYW1lID0gcGFyc2VyLmdldE5hbWUoKTsKKyAgICAgICAgICAgIGlmICghInByZWZlcmVuY2UtaGVhZGVycyIuZXF1YWxzKG5vZGVOYW1lKSkgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBSdW50aW1lRXhjZXB0aW9uKAorICAgICAgICAgICAgICAgICAgICAgICAgIlhNTCBkb2N1bWVudCBtdXN0IHN0YXJ0IHdpdGggPHByZWZlcmVuY2UtaGVhZGVycz4gdGFnOyBmb3VuZCIKKyAgICAgICAgICAgICAgICAgICAgICAgICsgbm9kZU5hbWUgKyAiIGF0ICIgKyBwYXJzZXIuZ2V0UG9zaXRpb25EZXNjcmlwdGlvbigpKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgQnVuZGxlIGN1ckJ1bmRsZSA9IG51bGw7CisKKyAgICAgICAgICAgIGludCBvdXRlckRlcHRoID0gcGFyc2VyLmdldERlcHRoKCk7CisgICAgICAgICAgICB3aGlsZSAoKHR5cGU9cGFyc2VyLm5leHQoKSkgIT0gWG1sUHVsbFBhcnNlci5FTkRfRE9DVU1FTlQKKyAgICAgICAgICAgICAgICAgICAmJiAodHlwZSAhPSBYbWxQdWxsUGFyc2VyLkVORF9UQUcgfHwgcGFyc2VyLmdldERlcHRoKCkgPiBvdXRlckRlcHRoKSkgeworICAgICAgICAgICAgICAgIGlmICh0eXBlID09IFhtbFB1bGxQYXJzZXIuRU5EX1RBRyB8fCB0eXBlID09IFhtbFB1bGxQYXJzZXIuVEVYVCkgeworICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICBub2RlTmFtZSA9IHBhcnNlci5nZXROYW1lKCk7CisgICAgICAgICAgICAgICAgaWYgKCJoZWFkZXIiLmVxdWFscyhub2RlTmFtZSkpIHsKKyAgICAgICAgICAgICAgICAgICAgSGVhZGVyIGhlYWRlciA9IG5ldyBIZWFkZXIoKTsKKworICAgICAgICAgICAgICAgICAgICBUeXBlZEFycmF5IHNhID0gZ2V0UmVzb3VyY2VzKCkub2J0YWluQXR0cmlidXRlcyhhdHRycywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0eWxlYWJsZS5QcmVmZXJlbmNlSGVhZGVyKTsKKyAgICAgICAgICAgICAgICAgICAgaGVhZGVyLnRpdGxlID0gc2EuZ2V0VGV4dCgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0eWxlYWJsZS5QcmVmZXJlbmNlSGVhZGVyX3RpdGxlKTsKKyAgICAgICAgICAgICAgICAgICAgaGVhZGVyLnN1bW1hcnkgPSBzYS5nZXRUZXh0KAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3R5bGVhYmxlLlByZWZlcmVuY2VIZWFkZXJfc3VtbWFyeSk7CisgICAgICAgICAgICAgICAgICAgIGhlYWRlci5pY29uUmVzID0gc2EuZ2V0UmVzb3VyY2VJZCgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0eWxlYWJsZS5QcmVmZXJlbmNlSGVhZGVyX2ljb24sIDApOworICAgICAgICAgICAgICAgICAgICBoZWFkZXIuZnJhZ21lbnQgPSBzYS5nZXRTdHJpbmcoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHlsZWFibGUuUHJlZmVyZW5jZUhlYWRlcl9mcmFnbWVudCk7CisgICAgICAgICAgICAgICAgICAgIHNhLnJlY3ljbGUoKTsKKworICAgICAgICAgICAgICAgICAgICBpZiAoY3VyQnVuZGxlID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGN1ckJ1bmRsZSA9IG5ldyBCdW5kbGUoKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBnZXRSZXNvdXJjZXMoKS5wYXJzZUJ1bmRsZUV4dHJhcyhwYXJzZXIsIGN1ckJ1bmRsZSk7CisgICAgICAgICAgICAgICAgICAgIGlmIChjdXJCdW5kbGUuc2l6ZSgpID4gMCkgeworICAgICAgICAgICAgICAgICAgICAgICAgaGVhZGVyLmZyYWdtZW50QXJndW1lbnRzID0gY3VyQnVuZGxlOworICAgICAgICAgICAgICAgICAgICAgICAgY3VyQnVuZGxlID0gbnVsbDsKKyAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgIHRhcmdldC5hZGQoaGVhZGVyKTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICBYbWxVdGlscy5za2lwQ3VycmVudFRhZyhwYXJzZXIpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKworICAgICAgICB9IGNhdGNoIChYbWxQdWxsUGFyc2VyRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBSdW50aW1lRXhjZXB0aW9uKCJFcnJvciBwYXJzaW5nIGhlYWRlcnMiLCBlKTsKKyAg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ICAgICBmaW5hbCBQcmVmZXJlbmNlU2NyZWVuIHByZWZlcmVuY2VTY3JlZW4gPSBnZXRQcmVmZXJlbmNlU2NyZWVuKCk7Ci0gICAgICAgICAgICBpZiAocHJlZmVyZW5jZVNjcmVlbiAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgcHJlZmVyZW5jZVNjcmVlbi5yZXN0b3JlSGllcmFyY2h5U3RhdGUoY29udGFpbmVyKTsKLSAgICAgICAgICAgICAgICBtU2F2ZWRJbnN0YW5jZVN0YXRlID0gc3RhdGU7Ci0gICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICBpZiAobVByZWZlcmVuY2VNYW5hZ2VyICE9IG51bGwpIHsKKyAgICAgICAgICAgIEJ1bmRsZSBjb250YWluZXIgPSBzdGF0ZS5nZXRCdW5kbGUoUFJFRkVSRU5DRVNfVEFHKTsKKyAgICAgICAgICAgIGlmIChjb250YWluZXIgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIGZpbmFsIFByZWZlcmVuY2VTY3JlZW4gcHJlZmVyZW5jZVNjcmVlbiA9IGdldFByZWZlcmVuY2VTY3JlZW4oKTsKKyAgICAgICAgICAgICAgICBpZiAocHJlZmVyZW5jZVNjcmVlbiAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIHByZWZlcmVuY2VTY3JlZW4ucmVzdG9yZUhpZXJhcmNoeVN0YXRlKGNvbnRhaW5lcik7CisgICAgICAgICAgICAgICAgICAgIG1TYXZlZEluc3RhbmNlU3RhdGUgPSBzdGF0ZTsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KICAgICAgICAgfQogCkBAIC0xNTYsMTQgKzYwMCw4NSBAQAogICAgIEBPdmVycmlkZQogICAgIHByb3RlY3RlZCB2b2lkIG9uQWN0aXZpdHlSZXN1bHQoaW50IHJlcXVlc3RDb2RlLCBpbnQgcmVzdWx0Q29kZSwgSW50ZW50IGRhd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gICAgICogUHJlZmVyZW5jZUFjdGl2aXR5LgogICAgICAqLworICAgIEBEZXByZWNhdGVkCiAgICAgcHVibGljIGJvb2xlYW4gb25QcmVmZXJlbmNlVHJlZUNsaWNrKFByZWZlcmVuY2VTY3JlZW4gcHJlZmVyZW5jZVNjcmVlbiwgUHJlZmVyZW5jZSBwcmVmZXJlbmNlKSB7CiAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICB9Ci0gICAgCisKICAgICAvKioKICAgICAgKiBGaW5kcyBhIHtAbGluayBQcmVmZXJlbmNlfSBiYXNlZCBvbiBpdHMga2V5LgotICAgICAqIAorICAgICAqCiAgICAgICogQHBhcmFtIGtleSBUaGUga2V5IG9mIHRoZSBwcmVmZXJlbmNlIHRvIHJldHJpZXZlLgogICAgICAqIEByZXR1cm4gVGhlIHtAbGluayBQcmVmZXJlbmNlfSB3aXRoIHRoZSBrZXksIG9yIG51bGwuCiAgICAgICogQHNlZSBQcmVmZXJlbmNlR3JvdXAjZmluZFByZWZlcmVuY2UoQ2hhclNlcXVlbmNlKQorICAgICAqCisgICAgICogQGRlcHJlY2F0ZWQgVGhpcyBmdW5jdGlvbiBpcyBub3QgcmVsZXZhbnQgZm9yIGEgbW9kZXJuIGZyYWdtZW50LWJhc2VkCisgICAgICogUHJlZmVyZW5jZUFjdGl2aXR5LgogICAgICAqLworICAgIEBEZXByZWNhdGVkCiAgICAgcHVibGljIFByZWZlcmVuY2UgZmluZFByZWZlcmVuY2UoQ2hhclNlcXVlbmNlIGtleSkgewotICAgICAgICAKKwogICAgICAgICBpZiAobVByZWZlcmVuY2VNYW5hZ2VyID09IG51bGwpIHsKICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICB9Ci0gICAgICAgIAorCiAgICAgICAgIHJldHVybiBtUHJlZmVyZW5jZU1hbmFnZXIuZmluZFByZWZlcmVuY2Uoa2V5KTsKICAgICB9CiAKQEAgLTI5Miw1ICs4MzMsMTQgQEAKICAgICAgICAgICAgIG1QcmVmZ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AgIGlmIChzYXZlZEluc3RhbmNlU3RhdGUgIT0gbnVsbCkgeworICAgICAgICAgICAgQnVuZGxlIGNvbnRhaW5lciA9IHNhdmVkSW5zdGFuY2VTdGF0ZS5nZXRCdW5kbGUoUFJFRkVSRU5DRVNfVEFHKTsKKyAgICAgICAgICAgIGlmIChjb250YWluZXIgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIGZpbmFsIFByZWZlcmVuY2VTY3JlZW4gcHJlZmVyZW5jZVNjcmVlbiA9IGdldFByZWZlcmVuY2VTY3JlZW4oKTsKKyAgICAgICAgICAgICAgICBpZiAocHJlZmVyZW5jZVNjcmVlbiAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIHByZWZlcmVuY2VTY3JlZW4ucmVzdG9yZUhpZXJhcmNoeVN0YXRlKGNvbnRhaW5lcik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgb25TdG9wKCkgeworICAgICAgICBzdXBlci5vblN0b3AoKTsKKyAgICAgICAgbVByZWZlcmVuY2VNYW5hZ2VyLmRpc3BhdGNoQWN0aXZpdHlTdG9wKCk7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgb25EZXN0cm95VmlldygpIHsKKyAgICAgICAgbUxpc3QgPSBudWxsOworICAgICAgICBtSGFuZGxlci5yZW1vdmVDYWxsYmFja3MobVJlcXVlc3RGb2N1cyk7CisgICAgICAgIHN1cGVyLm9uRGVzdHJveVZpZXcoKTsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgdm9pZCBvbkRlc3Ryb3koKSB7CisgICAgICAgIHN1cGVyLm9uRGVzdHJveSgpOworICAgICAgICBtUHJlZmVyZW5jZU1hbmFnZXIuZGlzcGF0Y2hBY3Rpdml0eURlc3Ryb3koKTsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGU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VNYW5hZ2VyKCkgeworICAgICAgICByZXR1cm4gbVByZWZlcmVuY2VNYW5hZ2VyOworICAgIH0KKworICAgIC8qKgorICAgICAqIFNldHMgdGhlIHJvb3Qgb2YgdGhlIHByZWZlcmVuY2UgaGllcmFyY2h5IHRoYXQgdGhpcyBmcmFnbWVudCBpcyBzaG93aW5nLgorICAgICAqCisgICAgICogQHBhcmFtIHByZWZlcmVuY2VTY3JlZW4gVGhlIHJvb3Qge0BsaW5rIFByZWZlcmVuY2VTY3JlZW59IG9mIHRoZSBwcmVmZXJlbmNlIGhpZXJhcmNoeS4KKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBzZXRQcmVmZXJlbmNlU2NyZWVuKFByZWZlcmVuY2VTY3JlZW4gcHJlZmVyZW5jZVNjcmVlbikgeworICAgICAgICBpZiAobVByZWZlcmVuY2VNYW5hZ2VyLnNldFByZWZlcmVuY2VzKHByZWZlcmVuY2VTY3JlZW4pICYmIHByZWZlcmVuY2VTY3JlZW4gIT0gbnVsbCkgeworICAgICAgICAgICAgbUhhdmVQcmVmcyA9IHRydWU7CisgICAgICAgICAgICBpZiAobUluaXREb25lKSB7CisgICAgICAgICAgICAgICAgcG9zdEJpbmRQcmVmZXJlbmNlcygpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogR2V0cyB0aGUgcm9vdCBvZiB0aGUgcHJlZmVyZW5jZSBoaWVyYXJjaHkgdGhhdCB0aGlzIGZyYWdtZW50IGlzIHNob3dpbmcuCisgICAgICoKKyAgICAgKiBAcmV0dXJuIFRoZSB7QGxpbmsgUHJlZmVyZW5jZVNjcmVlbn0gdGhhdCBpcyB0aGUgcm9vdCBvZiB0aGUgcHJlZmVyZW5jZQorICAgICAqICAgICAgICAgaGllcmFyY2h5LgorICAgICAqLworICAgIHB1YmxpYyBQcmVmZXJlbmNlU2NyZWVuIGdldFByZWZlcmVuY2VTY3JlZW4oKSB7CisgICAgICAgIHJldHVybiBtU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IChtUHJlZmVyZW5jZU1hbmFnZXIgPT0gbnVsbCkgeworICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIG1QcmVmZXJlbmNlTWFuYWdlci5maW5kUHJlZmVyZW5jZShrZXkpOworICAgIH0KKworICAgIHByaXZhdGUgdm9pZCByZXF1aXJlUHJlZmVyZW5jZU1hbmFnZXIoKSB7CisgICAgICAgIGlmIChtUHJlZmVyZW5jZU1hbmFnZXIgPT0gbnVsbCkgeworICAgICAgICAgICAgdGhyb3cgbmV3IFJ1bnRpbWVFeGNlcHRpb24oIlRoaXMgc2hvdWxkIGJlIGNhbGxlZCBhZnRlciBzdXBlci5vbkNyZWF0ZS4iKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgdm9pZCBwb3N0QmluZFByZWZlcmVuY2VzKCkgeworICAgICAgICBpZiAobUhhbmRsZXIuaGFzTWVzc2FnZXMoTVNHX0JJTkRfUFJFRkVSRU5DRVMpKSByZXR1cm47CisgICAgICAgIG1IYW5kbGVyLm9idGFpbk1lc3NhZ2UoTVNHX0JJTkRfUFJFRkVSRU5DRVMpLnNlbmRUb1RhcmdldCgpOworICAgIH0KKworICAgIHByaXZhdGUgdm9pZCBiaW5kUHJlZmVyZW5jZXMoKSB7CisgICAgICAgIGZpbmFsIFByZWZlcmVuY2VTY3JlZW4gcHJlZmVyZW5jZVNjcmVlbiA9IGdldFByZWZlcmVuY2VTY3JlZW4oKTsKKyAgICAgICAgaWYgKHByZWZlcmVuY2VTY3JlZW4gIT0gbnVsbCkgeworICAgICAgICAgICAgcHJlZmVyZW5jZVNjcmVlbi5iaW5kKGdldExpc3RWaWV3KCkpOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqIEBoaWRlICovCisgICAgcHVibGljIExpc3RWaWV3IGdldExpc3RWaWV3KCkgeworICAgICAgICBlbnN1cmVMaXN0KCk7CisgICAgICAgIHJldHVybiBtTGlzdDsKKyAgICB9CisKKyAgICBwcml2YXRlIHZvaWQgZW5zdXJlTGlzdCgpIHsKKyAgICAgICAgaWYgKG1MaXN0ICE9IG51bGwpIHsKKyAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfQorICAgICAgICBWaWV3IHJvb3QgPSBnZXRWaWV3KCk7CisgICAgICAgIGlmIChyb290ID09IG51bGwpIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oIkNvbnRlbnQgdmlldyBub3QgeWV0IGNyZWF0ZWQiKTsKKyAgICAgICAgfQorICAgICAgICBWaWV3IHJhd0xpc3RWaWV3ID0gcm9vdC5maW5kVmlld0J5SWQoYW5kcm9pZC5SLmlkLmxpc3QpOworICAgICAgICBpZiAoIShyYXdMaXN0VmlldyBpbnN0YW5jZW9mIExpc3RWaWV3KSkgeworICAgICAgICAgICAgdGhyb3cgbmV3IFJ1bnRpbWVFeGNlcHRpb24oCisgICAgICAgICAgICAgICAgICAgICJDb250ZW50IGhhcyB2aWV3IHdpdGggaWQgYXR0cmlidXRlICdhbmRyb2lkLlIuaWQubGlzdCcgIgorICAgICAgICAgICAgICAgICAgICArICJ0aGF0IGlzIG5vdCBhIExpc3RWaWV3IGNsYXNzIik7CisgICAgICAgIH0KKyAgICAgICAgbUxpc3QgPSAoTGlzdFZpZXcpcmF3TGlzdFZpZXc7CisgICAgICAgIGlmIChtTGlzdCA9PSBudWxsKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgUnVudGltZUV4Y2VwdGlvbigKKyAgICAgICAgICAgICAgICAgICAgIllvdXIgY29udGVudCBtdXN0IGhhdmUgYSBMaXN0VmlldyB3aG9zZSBpZCBhdHRyaWJ1dGUgaXMgIiArCisgICAgICAgICAgICAgICAgICAgICInYW5kcm9pZC5SLmlkLmxpc3QnIik7CisgICAgICAgIH0KKyAgICAgICAgbUhhbmRsZXIucG9zdChtUmVxdWVzdEZvY3VzKTsKKyAgICB9Cit9CmRpZmYgLS1naXQgYS9j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RlbnQgPSBJbnRlbnQucGFyc2VJbnRlbnQoZ2V0Q29udGV4dCgpLmdldFJlc291cmNlcygpLCBwYXJzZXIsIGF0dHJzKTsKICAgICAgICAgICAgIH0gY2F0Y2ggKElPRXhjZXB0aW9uIGUpIHsKLSAgICAgICAgICAgICAgICBMb2cudyhUQUcsICJDb3VsZCBub3QgcGFyc2UgSW50ZW50LiIpOwotICAgICAgICAgICAgICAgIExvZy53KFRBRywgZSk7CisgICAgICAgICAgICAgICAgWG1sUHVsbFBhcnNlckV4Y2VwdGlvbiBleCA9IG5ldyBYbWxQdWxsUGFyc2VyRXhjZXB0aW9uKAorICAgICAgICAgICAgICAgICAgICAgICAgIkVycm9yIHBhcnNpbmcgcHJlZmVyZW5jZSIpOworICAgICAgICAgICAgICAgIGV4LmluaXRDYXVzZShlKTsKKyAgICAgICAgICAgICAgICB0aHJvdyBleDsKICAgICAgICAgICAgIH0KICAgICAgICAgICAgIAogICAgICAgICAgICAgaWYgKGludGVudCAhPSBudWxsKSB7CkBAIC04Miw2ICs4NywxOCBAQAogICAgICAgICAgICAgfQogICAgICAgICAgICAgCiAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgfSBlbHNlIGlmICh0YWcuZXF1YWxzKEVYVFJBX1RBR19OQU1FKSkgeworICAgICAgICAgICAgZ2V0Q29udGV4dCgpLmdldFJlc291cmNlcygpLnBhcnNlQnVuZGxlRXh0cmEoRVhUUkFfVEFHX05BTUUsIGF0dHJzLAorICAgICAgICAgICAgICAgICAgICBwYXJlbnRQcmVmZXJlbmNlLmdldEV4dHJhcygpKTsKKyAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgWG1sVXRpbHMuc2tpcEN1cnJlbnRUYWcocGFyc2VyKTsKKyAgICAgICAgICAgIH0gY2F0Y2ggKElPRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICBYbWxQdWxsUGFyc2VyRXhjZXB0aW9uIGV4ID0gbmV3IFhtbFB1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AgICAgICAgICJib29rbWFyayA9IDEiLCBudWxsLCBudWxsKTsKKyAgICAgICAgcmV0dXJuIGNyLnF1ZXJ5KEJvb2ttYXJrcy5DT05URU5UX1VSSSwKKyAgICAgICAgICAgICAgICBuZXcgU3RyaW5nW10geyBCb29rbWFya3MuVVJMIH0sIAorICAgICAgICAgICAgICAgIEJvb2ttYXJrcy5JU19GT0xERVIgKyAiID0gMCIsIG51bGwsIG51bGwpOwogICAgIH0KIAogICAgIC8qKgotICAgICAqICBSZXR1cm4gYSBjdXJzb3IgcG9pbnRpbmcgdG8gYSBsaXN0IG9mIGFsbCB2aXNpdGVkIHNpdGUgdXJscy4KKyAgICAgKiAgUmV0dXJuIGEgY3Vyc29yIHBvaW50aW5nIHRvIGEgbGlzdCBvZiBhbGwgdmlzaXRlZCBzaXRlIHVybHMuIFRoZSBjdXJzb3Igd2lsbAorICAgICAqICBoYXZlIGEgc2luZ2xlIGNvbHVtbiwge0BsaW5rIEJvb2ttYXJrQ29sdW1ucyNVUkx9LgorICAgICAqICA8cD4KICAgICAgKiAgUmVxdWlyZXMge0BsaW5rIGFuZHJvaWQuTWFuaWZlc3QucGVybWlzc2lvbiNSRUFEX0hJU1RPUllfQk9PS01BUktTfQorICAgICAqCiAgICAgICogIEBwYXJhbSBjciAgIFRoZSBDb250ZW50UmVzb2x2ZXIgdXNlZCB0byBhY2Nlc3MgdGhlIGRhdGFiYXNlLgogICAgICAqLwogICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgQ3Vyc29yIGdldEFsbFZpc2l0ZWRVcmxzKENvbnRlbnRSZXNvbHZlciBjcikgdGhyb3dzCiAgICAgICAgICAgICBJbGxlZ2FsU3RhdGVFeGNlcHRpb24gewotICAgICAgICByZXR1cm4gY3IucXVlcnkoQk9PS01BUktTX1VSSSwKLSAgICAgICAgICAgICAgICBuZXcgU3RyaW5nW10geyBCb29rbWFya0NvbHVtbnMuVVJMIH0sIG51bGwsIG51bGwsIG51bGwpOworICAgICAgICByZXR1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lbnRWYWx1ZXMgbWFwID0gbmV3IENvbnRlbnRWYWx1ZXMoKTsKKyAgICAgICAgICAgICAgICBDb250ZW50VmFsdWVzIHZhbHVlcyA9IG5ldyBDb250ZW50VmFsdWVzKCk7CiAgICAgICAgICAgICAgICAgaWYgKHJlYWwpIHsKLSAgICAgICAgICAgICAgICAgICAgbWFwLnB1dChCb29rbWFya0NvbHVtbnMuVklTSVRTLCBjCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgLmdldEludChISVNUT1JZX1BST0pFQ1RJT05fVklTSVRTX0lOREVYKSArIDEpOworICAgICAgICAgICAgICAgICAgICB2YWx1ZXMucHV0KEhpc3RvcnkuVklTSVRTLCBjLmdldEludCgxKSArIDEpOwogICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIG1hcC5wdXQoQm9va21hcmtDb2x1bW5zLlVTRVJfRU5URVJFRCwgMSk7CisgICAgICAgICAgICAgICAgICAgIHZhbHVlcy5wdXQoSGlzdG9yeS5VU0VSX0VOVEVSRUQsIDEpOwogICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBtYXAucHV0KEJvb2ttYXJrQ29sdW1ucy5EQVRFLCBub3cpOwotICAgICAgICAgICAgICAgIFN0cmluZ1tdIHByb2plY3Rpb24gPSBuZXcgU3RyaW5nW10KLSAgICAgICAgICAgICAgICAgICAgICAgIHsgSW50ZWdlci52YWx1ZU9mKGMuZ2V0SW50KDApKS50b1N0cmluZygpIH07Ci0gICAgICAgICAgICAgICAgY3IudXBkYXRlKEJPT0tNQVJLU19VUkksIG1hcCwgIl9pZCA9ID8iLCBwcm9qZWN0aW9uKTsKKyAgICAgICAgICAgICAgICB2YWx1ZXMucHV0KEhpc3RvcnkuREFURV9MQVNUX1ZJU0lURUQsIG5vdyk7CisgICAgICAgICAgICAgICAgY3IudXBkYXRlKENvbnRlbnRVcmlzLndpdGhBcHBlbmRlZElkKEhpc3RvcnkuQ09OVEVOVF9VUkksIGMuZ2V0TG9uZygwKSksCisgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXMsIG51bGwsIG51bGwpOwogICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICB0cnVuY2F0ZUhpc3RvcnkoY3IpOwotICAgICAgICAgICAgICAgIENvbnRlbnRWYWx1ZXMgbWFwID0gbmV3IENvbnRlbnRWYWx1ZXMoKTsKKyAgICAgICAgICAgICAgICBDb250ZW50VmFsdWVzIHZhbHVlcyA9IG5ldyBDb250ZW50VmFsdWVzKCk7CiAgICAgICAgICAgICAgICAgaW50IHZpc2l0czsKICAgICAgICAgICAgICAgICBpbnQgdXNlcl9lbnRlcmVkOwogICAgICAgICAgICAgICAgIGlmIChyZWFsKSB7CkBAIC0yOTUsMTQgKzMyNiwxMyBAQAogICAgICAgICAgICAgICAgICAgICB2aXNpdHMgPSAwOwogICAgICAgICAgICAgICAgICAgICB1c2VyX2VudGVyZWQgPSAxOwogICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBtYXAucHV0KEJvb2ttYXJrQ29sdW1ucy5VUkwsIHVybCk7Ci0gICAgICAgICAgICAgICAgbWFwLnB1dChCb29rbWFya0NvbHVtbnMuVklTSVRTLCB2aXNpdHMpOwotICAgICAgICAgICAgICAgIG1hcC5wdXQoQm9va21hcmtDb2x1bW5zLkRBVEUsIG5vdyk7Ci0gICAgICAgICAgICAgICAgbWFwLnB1dChCb29rbWFya0NvbHVtbnMuQk9PS01BUkssIDApOwotICAgICAgICAgICAgICAgIG1hcC5wdXQoQm9va21hcmtDb2x1bW5zLlRJVExFLCB1cmwpOwotICAgICAgICAgICAgICAgIG1hcC5wdXQoQm9va21hcmtDb2x1bW5zLkNSRUFURUQsIDApOwotICAgICAgICAgICAgICAgIG1hcC5wdXQoQm9va21hcmtDb2x1bW5zLlVTRVJfRU5URVJFRCwgdXNlcl9lbnRlcmVkKTsKLSAgICAgICAgICAgICAgICBjci5pbnNlcnQoQk9PS01BUktTX1VSSSwgbWFwKTsKKyAgICAgICAgICAgICAgICB2YWx1ZXMucHV0KEhpc3RvcnkuVVJMLCB1cmwpOworICAgICAgICAgICAgICAgIHZhbHVlcy5wdXQoSGlzdG9yeS5WSVNJVFMsIHZpc2l0cyk7CisgICAgICAgICAgICAgICAgdmFsdWVzLnB1dChIaXN0b3J5LkRBVEVfTEFTVF9WSVNJVEVELCBub3cpOworICAgICAgICAgICAgICAgIHZhbHVlcy5wdXQoSGlzdG9yeS5USVRMRSwgdXJsKTsKKyAgICAgICAgICAgICAgICB2YWx1ZXMucHV0KEhpc3RvcnkuREFURV9DUkVBVEVELCAwKTsKKyAgICAgICAgICAgICAgICB2YWx1ZXMucHV0KEhpc3RvcnkuVVNFUl9FTlRFUkVELCB1c2VyX2VudGVyZWQpOworICAgICAgICAgICAgICAgIGNyLmluc2VydChIaXN0b3J5LkNPTlRFTlRfVVJJLCB2YWx1ZXMpOwogICAgICAgICAgICAgfQogICAgICAgICB9IGNhdGNoIChJbGxlZ2FsU3RhdGVFeGNlcHRpb24gZSkgewogICAgICAgICAgICAgTG9nLmUoTE9HVEFHLCAidXBkYXRlVmlzaXRlZEhpc3RvcnkiLCBlKTsKQEAgLTMyMiwxMCArMzUyLDEwIEBACiAgICAgICAgIFN0cmluZ1tdIHN0ciA9IG51bGw7CiAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICBTdHJpbmdbXSBwcm9qZWN0aW9uID0gbmV3IFN0cmluZ1tdIHsKLSAgICAgICAgICAgICAgICAidXJsIgorICAgICAgICAgICAgICAgICAgICBIaXN0b3J5LlVSTCwKICAgICAgICAgICAgIH07Ci0gICAgICAgICAgICBjID0gY3IucXVlcnkoQk9PS01BUktTX1VSSSwgcHJvamVjdGlvbiwgInZpc2l0cyA+IDAiLCBudWxsLAotICAgICAgICAgICAgICAgICAgICBudWxsKTsKKyAgICAgICAgICAgIGMgPSBjci5xdWVyeShIaXN0b3J5LkNPTlRFTlRfVVJJLCBwcm9qZWN0aW9uLCBIaXN0b3J5LlZJU0lUUyArICIgPiAwIiwgbnVsbCwgbnVsbCk7CisgICAgICAgICAgICBpZiAoYyA9PSBudWxsKSByZXR1cm4gbmV3IFN0cmluZ1swXTsKICAgICAgICAgICAgIHN0ciA9IG5ldyBTdHJpbmdbYy5nZXRDb3VudCgpXTsKICAgICAgICAgICAgIGludCBpID0gMDsKICAgICAgICAgICAgIHdoaWxlIChjLm1vdmVUb05leHQoKSkgewpAQCAtMzUzLDMxICszODMsMjkgQEAKICAgICAgKiBAcGFyYW0gY3IgVGhlIENvbnRlbnRSZXNvbHZlciB1c2VkIHRvIGFjY2VzcyB0aGUgZGF0YWJhc2UuCiAgICAgICovCiAgICAgcHVibGljIHN0YXRpYyBmaW5hbCB2b2lkIHRydW5jYXRlSGlzdG9yeShDb250ZW50UmVzb2x2ZXIgY3IpIHsKLSAgICAgICAgQ3Vyc29yIGMgPSBudWxsOworICAgICAgICAvLyBUT0RPIG1ha2UgYSBzaW5nbGUgcmVxdWVzdCB0byB0aGUgcHJvdmlkZXIgdG8gZG8gdGhpcyBpbiBhIHNpbmdsZSB0cmFuc2FjdGlvbgorICAgICAgICBDdXJzb3IgY3Vyc29yID0gbnVsbDsKICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIAogICAgICAgICAgICAgLy8gU2VsZWN0IG5vbi1ib29rbWFyayBoaXN0b3J5LCBvcmRlcmVkIGJ5IGRhdGUKLSAgICAgICAgICAgIGMgPSBjci5xdWVyeSgKLSAgICAgICAgICAgICAgICAgICAgQk9PS01BUktTX1VSSSwKLSAgICAgICAgICAgICAgICAgICAgVFJVTkNBVEVfSElTVE9SWV9QUk9KRUNUSU9OLAotICAgICAgICAgICAgICAgICAgICAiYm9va21hcmsgPSAwIiwKLSAgICAgICAgICAgICAgICAgICAgbnVsbCwKLSAgICAgICAgICAgICAgICAgICAgQm9va21hcmtDb2x1bW5zLkRBVEUpOwotICAgICAgICAgICAgLy8gTG9nLnYoTE9HVEFHLCAiaGlzdG9yeSBjb3VudCAiICsgYy5jb3VudCgpKTsKLSAgICAgICAgICAgIGlmIChjLm1vdmVUb0ZpcnN0KCkgJiYgYy5nZXRDb3VudCgpID49IE1BWF9ISVNUT1JZX0NPVU5UKSB7CisgICAgICAgICAgICBjdXJzb3IgPSBjci5xdWVyeShIaXN0b3J5LkNPTlRFTlRfVVJJLAorICAgICAgICAgICAgICAgICAgICBuZXcgU3RyaW5nW10geyBIaXN0b3J5Ll9JRCwgSGlzdG9yeS5VUkwsIEhpc3RvcnkuREFURV9MQVNUX1ZJU0lURUQgfSwKKyAgICAgICAgICAgICAgICAgICAgbnVsbCwgbnVsbCwgSGlzdG9yeS5EQVRFX0xBU1RfVklTSVRFRCArICIgQVNDIik7CisKKyAgICAgICAgICAgIGlmIChjdXJzb3IubW92ZVRvRmlyc3QoKSAmJiBjdXJzb3IuZ2V0Q291bnQoKSA+PSBNQVhfSElTVE9SWV9DT1VOVCkgeworICAgICAgICAgICAgICAgIGZpbmFsIFdlYkljb25EYXRhYmFzZSBpY29uRGIgPSBXZWJJY29uRGF0YWJhc2UuZ2V0SW5zdGFuY2UoKTsKICAgICAgICAgICAgICAgICAvKiBlbGltaW5hdGUgb2xkZXN0IGhpc3RvcnkgaXRlbXMgKi8KICAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IFRSVU5DQVRFX05fT0xERVNUOyBpKyspIHsKLSAgICAgICAgICAgICAgICAgICAgLy8gTG9nLnYoTE9HVEFHLCAidHJ1bmNhdGUgaGlzdG9yeSAiICsKLSAgICAgICAgICAgICAgICAgICAgLy8gYy5nZXRJbnQoVFJVTkNBVEVfSElTVE9SWV9QUk9KRUNUSU9OX0lEX0lOREVYKSk7Ci0gICAgICAgICAgICAgICAgICAgIGNyLmRlbGV0ZShCT09LTUFSS1NfVVJJLCAiX2lkID0gIiArCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgYy5nZXRJbnQoVFJVTkNBVEVfSElTVE9SWV9QUk9KRUNUSU9OX0lEX0lOREVYKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsKTsKLSAgICAgICAgICAgICAgICAgICAgaWYgKCFjLm1vdmVUb05leHQoKSkgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGNyLmRlbGV0ZShDb250ZW50VXJpcy53aXRoQXBwZW5kZWRJZChIaXN0b3J5LkNPTlRFTlRfVVJJLCBjdXJzb3IuZ2V0TG9uZygwKSksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwgbnVsbCk7CisgICAgICAgICAgICAgICAgICAgIGljb25EYi5yZWxlYXNlSWNvbkZvclBhZ2VVcmwoY3Vyc29yLmdldFN0cmluZygxKSk7CisgICAgICAgICAgICAgICAgICAgIGlmICghY3Vyc29yLm1vdmVUb05leHQoKSkgYnJlYWs7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogICAgICAgICB9IGNhdGNoIChJbGxlZ2FsU3RhdGVFeGNlcHRpb24gZSkgewogICAgICAgICAgICAgTG9nLmUoTE9HVEFHLCAidHJ1bmNhdGVIaXN0b3J5IiwgZSk7CiAgICAgICAgIH0gZmluYWxseSB7Ci0gICAgICAgICAgICBpZiAoYyAhPSBudWxsKSBjLmNsb3NlKCk7CisgICAgICAgICAgICBpZiAoY3Vyc29yICE9IG51bGwpIGN1cnNvci5jbG9zZSgpOwogICAgICAgICB9CiAgICAgfQogCkBAIC0zODgsMjMgKzQxNiwxNyBAQAogICAgICAqIEByZXR1cm4gYm9vbGVhbiAgVHJ1ZSBpZiB0aGUgaGlzdG9yeSBjYW4gYmUgY2xlYXJlZC4KICAgICAgKi8KICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGJvb2xlYW4gY2FuQ2xlYXJIaXN0b3J5KENvbnRlbnRSZXNvbHZlciBjcikgewotICAgICAgICBDdXJzb3IgYyA9IG51bGw7CisgICAgICAgIEN1cnNvciBjdXJzb3IgPSBudWxsOwogICAgICAgICBib29sZWFuIHJldCA9IGZhbHNlOwogICAgICAgICB0cnkgewotICAgICAgICAgICAgYyA9IGNyLnF1ZXJ5KAotICAgICAgICAgICAgICAgIEJPT0tNQVJLU19VUkksCi0gICAgICAgICAgICAgICAgbmV3IFN0cmluZyBbXSB7IEJvb2ttYXJrQ29sdW1ucy5fSUQsIAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBCb29rbWFya0NvbHVtbnMuQk9PS01BUkssCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEJvb2ttYXJrQ29sdW1ucy5WSVNJVFMgfSwKLSAgICAgICAgICAgICAgICAiYm9va21hcmsgPSAwIE9SIHZpc2l0cyA+IDAiLCAKLSAgICAgICAgICAgICAgICBudWxsLAotICAgICAgICAgICAgICAgIG51bGwKLSAgICAgICAgICAgICAgICApOwotICAgICAgICAgICAgcmV0ID0gYy5tb3ZlVG9GaXJzdCgpOworICAgICAgICAgICAgY3Vyc29yID0gY3IucXVlcnkoSGlzdG9yeS5DT05URU5UX1VSSSwKKyAgICAgICAgICAgICAgICBuZXcgU3RyaW5nIFtdIHsgSGlzdG9yeS5fSUQsIEhpc3RvcnkuVklTSVRTIH0sCisgICAgICAgICAgICAgICAgbnVsbCwgbnVsbCwgbnVsbCk7CisgICAgICAgICAgICByZXQgPSBjdXJzb3IuZ2V0Q291bnQoKSA+IDA7CiAgICAgICAgIH0gY2F0Y2ggKElsbGVnYWxTdGF0ZUV4Y2VwdGlvbiBlKSB7CiAgICAgICAgICAgICBMb2cuZShMT0dUQUcsICJjYW5DbGVhckhpc3RvcnkiLCBlKTsKICAgICAgICAgfSBmaW5hbGx5IHsKLSAgICAgICAgICAgIGlmIChjICE9IG51bGwpIGMuY2xvc2UoKTsKKyAgICAgICAgICAgIGlmIChjdXJzb3IgIT0gbnVsbCkgY3Vyc29yLmNsb3NlKCk7CiAgICAgICAgIH0KICAgICAgICAgcmV0dXJuIHJldDsKICAgICB9CkBAIC00MjAsNjcgKzQ0MiwzNiBAQAogICAgIH0KIAogICAgIC8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cnlXaGVyZShDb250ZW50UmVzb2x2ZXIgY3IsCi0gICAgICAgICAgICBTdHJpbmcgd2hlcmVDbGF1c2UpIHsKLSAgICAgICAgQ3Vyc29yIGMgPSBudWxsOworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIHZvaWQgZGVsZXRlSGlzdG9yeVdoZXJlKENvbnRlbnRSZXNvbHZlciBjciwgU3RyaW5nIHdoZXJlQ2xhdXNlKSB7CisgICAgICAgIEN1cnNvciBjdXJzb3IgPSBudWxsOwogICAgICAgICB0cnkgewotICAgICAgICAgICAgYyA9IGNyLnF1ZXJ5KEJPT0tNQVJLU19VUkksCi0gICAgICAgICAgICAgICAgSElTVE9SWV9QUk9KRUNUSU9OLAotICAgICAgICAgICAgICAgIHdoZXJlQ2xhdXNlLAotICAgICAgICAgICAgICAgIG51bGwsCi0gICAgICAgICAgICAgICAgbnVsbCk7Ci0gICAgICAgICAgICBpZiAoYy5tb3ZlVG9GaXJzdCgpKSB7CisgICAgICAgICAgICBjdXJzb3IgPSBjci5xdWVyeShIaXN0b3J5LkNPTlRFTlRfVVJJLCBuZXcgU3RyaW5nW10geyBIaXN0b3J5LlVSTCB9LCB3aGVyZUNsYXVzZSwKKyAgICAgICAgICAgICAgICAgICAgbnVsbCwgbnVsbCk7CisgICAgICAgICAgICBpZiAoY3Vyc29yLm1vdmVUb0ZpcnN0KCkpIHsKICAgICAgICAgICAgICAgICBmaW5hbCBXZWJJY29uRGF0YWJhc2UgaWNvbkRiID0gV2ViSWNvbkRhdGFiYXNlLmdldEluc3RhbmNlKCk7Ci0gICAgICAgICAgICAgICAgLyogRGVsZXRlIGZhdmljb25zLCBhbmQgcmV2ZXJ0IGJvb2ttYXJrcyB3aGljaCBoYXZlIGJlZW4gdmlzaXRlZAotICAgICAgICAgICAgICAgICAqIHRvIHNpbXBseSBib29rbWFya3MuCi0gICAgICAgICAgICAgICAgICovCi0gICAgICAgICAgICAgICAgU3RyaW5nQnVmZmVyIHNiID0gbmV3IFN0cmluZ0J1ZmZlcigpOwotICAgICAgICAgICAgICAgIGJvb2xlYW4gZmlyc3RUaW1lID0gdHJ1ZTsKICAgICAgICAgICAgICAgICBkbyB7Ci0gICAgICAgICAgICAgICAgICAgIFN0cmluZyB1cmwgPSBjLmdldFN0cmluZyhISVNUT1JZX1BST0pFQ1RJT05fVVJMX0lOREVYKTsKLSAgICAgICAgICAgICAgICAgICAgYm9vbGVhbiBpc0Jvb2ttYXJrID0KLSAgICAgICAgICAgICAgICAgICAgICAgIGMuZ2V0SW50KEhJU1RPUllfUFJPSkVDVElPTl9CT09LTUFSS19JTkRFWCkgPT0gMTsKLSAgICAgICAgICAgICAgICAgICAgaWYgKGlzQm9va21hcmspIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChmaXJzdFRpbWUpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaXJzdFRpbWUgPSBmYWxzZTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2IuYXBwZW5kKCIgT1IgIik7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICBzYi5hcHBlbmQoIiggX2lkID0gIik7Ci0gICAgICAgICAgICAgICAgICAgICAgICBzYi5hcHBlbmQoYy5nZXRJbnQoMCkpOwotICAgICAgICAgICAgICAgICAgICAgICAgc2IuYXBwZW5kKCIgKSIpOwotICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICAgICAgaWNvbkRiLnJlbGVhc2VJY29uRm9yUGFnZVVybCh1cmwpOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfSB3aGlsZSAoYy5tb3ZlVG9OZXh0KCkpOworICAgICAgICAgICAgICAgICAgICAvLyBEZWxldGUgZmF2aWNvbnMKKyAgICAgICAgICAgICAgICAgICAgLy8gVE9ETyBkb24ndCByZWxlYXNlIGlmIHRoZSBVUkwgaXMgYm9va21hcmtlZAorICAgICAgICAgICAgICAgICAgICBpY29uRGIucmVsZWFzZUljb25Gb3JQYWdlVXJsKGN1cnNvci5nZXRTdHJpbmcoMCkpOworICAgICAgICAgICAgICAgIH0gd2hpbGUgKGN1cnNvci5tb3ZlVG9OZXh0KCkpOwogCi0gICAgICAgICAgICAgICAgaWYgKCFmaXJzdFRpbWUpIHsKLSAgICAgICAgICAgICAgICAgICAgQ29udGVudFZhbHVlcyBtYXAgPSBuZXcgQ29udGVudFZhbHVlcygpOwotICAgICAgICAgICAgICAgICAgICBtYXAucHV0KEJvb2ttYXJrQ29sdW1ucy5WSVNJVFMsIDApOwotICAgICAgICAgICAgICAgICAgICBtYXAucHV0KEJvb2ttYXJrQ29sdW1ucy5EQVRFLCAwKTsKLSAgICAgICAgICAgICAgICAgICAgLyogRklYTUU6IFNob3VsZCBJIGFsc28gcmVtb3ZlIHRoZSB0aXRsZT8gKi8KLSAgICAgICAgICAgICAgICAgICAgY3IudXBkYXRlKEJPT0tNQVJLU19VUkksIG1hcCwgc2IudG9TdHJpbmcoKSwgbnVsbCk7Ci0gICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgU3RyaW5nIGRlbGV0ZVdoZXJlQ2xhdXNlID0gQm9va21hcmtDb2x1bW5zLkJPT0tNQVJLICsgIiA9IDAiOwotICAgICAgICAgICAgICAgIGlmICh3aGVyZUNsYXVzZSAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIGRlbGV0ZVdoZXJlQ2xhdXNlICs9ICIgQU5EICIgKyB3aGVyZUNsYXVzZTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgY3IuZGVsZXRlKEJPT0tNQVJLU19VUkksIGRlbGV0ZVdoZXJlQ2xhdXNlLCBudWxsKTsKKyAgICAgICAgICAgICAgICBjci5kZWxldGUoQk9PS01BUktTX1VSSSwgd2hlcmVDbGF1c2UsIG51bGwpOwogICAgICAgICAgICAgfQogICAgICAgICB9IGNhdGNoIChJbGxlZ2FsU3RhdGVFeGNlcHRpb24gZSkgewogICAgICAgICAgICAgTG9nLmUoTE9HVEFHLCAiZGVsZXRlSGlzdG9yeVdoZXJlIiwgZSk7CiAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgIH0gZmluYWxseSB7Ci0gICAgICAgICAgICBpZiAoYyAhPSBudWxsKSBjLmNsb3NlKCk7CisgICAgICAgICAgICBpZiAoY3Vyc29yICE9IG51bGwpIGN1cnNvci5jbG9zZSgpOwogICAgICAgICB9CiAgICAgfQogCkBAIC01MjAsMTAgKzUxMSw3IEBACiAgICAgICovCiAgICAgcHVibGljIHN0YXRpYyBmaW5hbCB2b2lkIGRlbGV0ZUZyb21IaXN0b3J5KENvbnRlbnRSZXNvbHZlciBjciwgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFN0cmluZyB1cmwpIHsKLSAgICAgICAgU3RyaW5nQnVpbGRlciBzYiA9IG5ldyBTdHJpbmdCdWlsZGVyKEJvb2ttYXJrQ29sdW1ucy5VUkwgKyAiID0gIik7Ci0gICAgICAgIERhdGFiYXNlVXRpbHMuYXBwZW5kRXNjYXBlZFNRTFN0cmluZyhzYiwgdXJsKTsKLSAgICAgICAgU3RyaW5nIG1hdGNoZXNVcmwgPSBzYi50b1N0cmluZygpOwotICAgICAgICBkZWxldGVIaXN0b3J5V2hlcmUoY3IsIG1hdGNoZXNVcmwpOworICAgICAgICBjci5kZWxldGUoSGlzdG9yeS5DT05URU5UX1VSSSwgSGlzdG9yeS5VUkwgKyAiPT8iLCBuZXcgU3RyaW5nW10geyB1cmwgfSk7CiAgICAgfQogCiAgICAgLyoqCkBAIC01MzQsNyArNTIyLDcgQEAKICAgICAgKiBAcGFyYW0gc2VhcmNoICAgIFRoZSBzdHJpbmcgdG8gYWRkIHRvIHRoZSBzZWFyY2hlcyBkYXRhYmFzZS4KICAgICAgKi8KICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIHZvaWQgYWRkU2VhcmNoVXJsKENvbnRlbnRSZXNvbHZlciBjciwgU3RyaW5nIHNlYXJjaCkgewotICAgICAgICBsb25nIG5vdyA9IG5ldyBEYXRlKCkuZ2V0VGltZSgpOworICAgICAgICBsb25nIG5vdyA9IFN5c3RlbS5jdXJyZW50VGltZU1pbGxpcygpOwogICAgICAgICBDdXJzb3IgYyA9IG51bGw7CiAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICBjID0gY3IucXVlcnkoCkBAIC01NTgsNiArNTQ2LDcgQEAKICAgICAgICAgICAgIGlmIChjICE9IG51bGwpIGMuY2xvc2UoKTsKICAgICAgICAgfQogICAgIH0KKwogICAgIC8qKgogICAgICAqIFJlbW92ZSBhbGwgc2VhcmNoZXMgZnJvbSB0aGUgc2VhcmNoIGRhdGFiYXNlLgogICAgICAqICBSZXF1aXJlcyB7QGxpbmsgYW5kcm9pZC5NYW5pZmVzdC5wZXJtaXNzaW9uI1dSSVRFX0hJU1RPUllfQk9PS01BUktTfQpAQCAtNTkwLDMxICs1NzksOTAgQEAKICAgICAgICAgICAgICAgICAuYnVsa1JlcXVlc3RJY29uRm9yUGFnZVVybChjciwgd2hlcmUsIGxpc3RlbmVyKTsKICAgICB9CiAKKyAgICAvKioKKyAgICAgKiBDb2x1bW4gZGVmaW5pdGlvbnMgZm9yIHRoZSBtaXhlZCBib29rbWFyayBhbmQgaGlzdG9yeSBpdGVtcyBhdmFpbGFibGUKKyAgICAgKiBhdCB7QGxpbmsgI0JPT0tNQVJLU19VUkl9LgorICAgICAqLwogICAgIHB1YmxpYyBzdGF0aWMgY2xhc3MgQm9va21hcmtDb2x1bW5zIGltcGxlbWVudHMgQmFzZUNvbHVtbnMgeworICAgICAgICAvKioKKyAgICAgICAgICogVGhlIFVSTCBvZiB0aGUgYm9va21hcmsgb3IgaGlzdG9yeSBpdGVtLgorICAgICAgICAgKiA8cD5UeXBlOiBURVhUIChVUkwpPC9wPgorICAgICAgICAgKi8KICAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgVVJMID0gInVybCI7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFRoZSBudW1iZXIgb2YgdGltZSB0aGUgaXRlbSBoYXMgYmVlbiB2aXNpdGVkLgorICAgICAgICAgKiA8cD5UeXBlOiBOVU1CRVI8L3A+CisgICAgICAgICAqLwogICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBWSVNJVFMgPSAidmlzaXRzIjsKKworICAgICAgICAvKioKKyAgICAgICAgICogVGhlIGRhdGUgdGhlIGl0ZW0gd2FzIGxhc3QgdmlzaXRlZCwgaW4gbWlsbGlzZWNvbmRzIHNpbmNlIHRoZSBlcG9jaC4KKyAgICAgICAgICogPHA+VHlwZTogTlVNQkVSIChkYXRlIGluIG1pbGxpc2Vjb25kcyBzaW5jZSBKYW51YXJ5IDEsIDE5NzApPC9wPgorICAgICAgICAgKi8KICAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgREFURSA9ICJkYXRlIjsKKworICAgICAgICAvKioKKyAgICAgICAgICogRmxhZyBpbmRpY2F0aW5nIHRoYXQgYW4gaXRlbSBpcyBhIGJvb2ttYXJrLiBBIHZhbHVlIG9mIDEgaW5kaWNhdGVzIGEgYm9va21hcmssIGEgdmFsdWUKKyAgICAgICAgICogb2YgMCBpbmRpY2F0ZXMgYSBoaXN0b3J5IGl0ZW0uCisgICAgICAgICAqIDxwPlR5cGU6IElOVEVHRVIgKGJvb2xlYW4pPC9wPgorICAgICAgICAgKi8KICAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgQk9PS01BUksgPSAiYm9va21hcmsiOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBUaGUgdXNlciB2aXNpYmxlIHRpdGxlIG9mIHRoZSBib29rbWFyayBvciBoaXN0b3J5IGl0ZW0uCisgICAgICAgICAqIDxwPlR5cGU6IFRFWFQ8L3A+CisgICAgICAgICAqLwogICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBUSVRMRSA9ICJ0aXRsZSI7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFRoZSBkYXRlIHRoZSBpdGVtIGNyZWF0ZWQsIGluIG1pbGxpc2Vjb25kcyBzaW5jZSB0aGUgZXBvY2guCisgICAgICAgICAqIDxwPlR5cGU6IE5VTUJFUiAoZGF0ZSBpbiBtaWxsaXNlY29uZHMgc2luY2UgSmFudWFyeSAxLCAxOTcwKTwvcD4KKyAgICAgICAgICovCiAgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIENSRUFURUQgPSAiY3JlYXRlZCI7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFRoZSBmYXZpY29uIG9mIHRoZSBib29rbWFyay4gTXVzdCBkZWNvZGUgdmlhIHtAbGluayBCaXRtYXBGYWN0b3J5I2RlY29kZUJ5dGVBcnJheX0uCisgICAgICAgICAqIDxwPlR5cGU6IEJMT0IgKGltYWdlKTwvcD4KKyAgICAgICAgICovCiAgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIEZBVklDT04gPSAiZmF2aWNvbiI7CisKICAgICAgICAgLyoqCiAgICAgICAgICAqIEBoaWRlCiAgICAgICAgICAqLwogICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBUSFVNQk5BSUwgPSAidGh1bWJuYWlsIjsKKwogICAgICAgICAvKioKICAgICAgICAgICogQGhpZGUKICAgICAgICAgICovCiAgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIFRPVUNIX0lDT04gPSAidG91Y2hfaWNvbiI7CisKICAgICAgICAgLyoqCiAgICAgICAgICAqIEBoaWRlCiAgICAgICAgICAqLwogICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBVU0VSX0VOVEVSRUQgPSAidXNlcl9lbnRlcmVkIjsKICAgICB9CiAKKyAgICA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ICAgICAvKiogR2VuZXJpYyBjb2x1bW4gZm9yIHVzZSBieSBzeW5jIGFkYXB0ZXJzLiAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBTWU5DMyA9ICJzeW5jMyI7CisgICAgICAgIC8qKiBHZW5lcmljIGNvbHVtbiBmb3IgdXNlIGJ5IHN5bmMgYWRhcHRlcnMuICovCisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIFNZTkM0ID0gInN5bmM0IjsKKyAgICAgICAgLyoqIEdlbmVyaWMgY29sdW1uIGZvciB1c2UgYnkgc3luYyBhZGFwdGVycy4gKi8KKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgU1lOQzUgPSAic3luYzUiOworICAgIH0KKworICAgIC8qKgorICAgICAqIENvbnZlbmllbmNlIGRlZmluaXRpb25zIGZvciB1c2UgaW4gaW1wbGVtZW50aW5nIGNocm9tZSBib29rbWFya3Mgc3luYyBpbiB0aGUgQm9va21hcmtzIHRhYmxlLgorICAgICAqLworICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgY2xhc3MgQ2hyb21lU3luY0NvbHVtbnMgeworICAgICAgICBwcml2YXRlIENocm9tZVN5bmNDb2x1bW5zKCkge30KKworICAgICAgICAvKiogVGhlIHNlcnZlciB1bmlxdWUgSUQgZm9yIGFuIGl0ZW0gKi8KKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgU0VSVkVSX1VOSVFVRSA9IEJhc2VTeW5jQ29sdW1ucy5TWU5DMzsKKworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBGT0xERVJfTkFNRV9ST09UID0gImdvb2dsZV9jaHJvbWUiOworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBGT0xERVJfTkFNRV9CT09LTUFSS1MgPSAiZ29vZ2xlX2Nocm9tZV9ib29rbWFya3MiOworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBGT0xERVJfTkFNRV9CT09LTUFSS1NfQkFSID0gImJvb2ttYXJrX2JhciI7CisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIEZPTERFUl9OQU1FX09USEVSX0JPT0tNQVJLUyA9ICJvdGhlcl9ib29rbWFya3MiOworICAgICAgICAKKyAgICAgICAgLyoqIFRoZSBjbGllbnQgdW5pcXVlIElEIGZvciBhbiBpdGVtICovCisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIENMSUVOVF9VTklRVUUgPSBCYXNlU3luY0NvbHVtbnMuU1lOQzQ7CisgICAgfQorICAgIAorICAgIC8qKgorICAgICAqIENvbHVtbnMgdGhhdCBhcHBlYXIgd2hlbiBlYWNoIHJvdyBvZiBhIHRhYmxlIGJlbG9uZ3MgdG8gYSBzcGVjaWZpYworICAgICAqIGFjY291bnQsIGluY2x1ZGluZyBzeW5jIGluZm9ybWF0aW9uIHRoYXQgYW4gYWNjb3VudCBtYXkgbmVlZC4KKyAgICAgKi8KKyAgICBpbnRlcmZhY2UgU3luY0NvbHVtbnMgZXh0ZW5kcyBCYXNlU3luY0NvbHVtbnMgeworICAgICAgICAvKioKKyAgICAgICAgICogVGhlIG5hbWUgb2YgdGhlIGFjY291bnQgaW5zdGFuY2UgdG8gd2hpY2ggdGhpcyByb3cgYmVsb25ncywgd2hpY2ggd2hlbiBwYWlyZWQgd2l0aAorICAgICAgICAgKiB7QGxpbmsgI0FDQ09VTlRfVFlQRX0gaWRlbnRpZmllcyBhIHNwZWNpZmljIGFjY291bnQuCisgICAgICAgICAqIDxQPlR5cGU6IFRFWFQ8L1A+CisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBBQ0NPVU5UX05BTUUgPSAiYWNjb3VudF9uYW1lIjsKKworICAgICAgICAvKioKKyAgICAgICAgICogVGhlIHR5cGUgb2YgYWNjb3VudCB0byB3aGljaCB0aGlzIHJvdyBiZWxvbmdzLCB3aGljaCB3aGVuIHBhaXJlZCB3aXRoCisgICAgICAgICAqIHtAbGluayAjQUNDT1VOVF9OQU1FfSBpZGVudGlmaWVzIGEgc3BlY2lmaWMgYWNjb3VudC4KKyAgICAgICAgICogPFA+VHlwZTogVEVYVDwvUD4KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIEFDQ09VTlRfVFlQRSA9ICJhY2NvdW50X3R5cGUiOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBTdHJpbmcgdGhhdCB1bmlxdWVseSBpZGVudGlmaWVzIHRoaXMgcm93IHRvIGl0cyBzb3VyY2UgYWNjb3VudC4KKyAgICAgICAgICogPFA+VHlwZTogVEVYVDwvUD4KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIFNPVVJDRV9JRCA9ICJzb3VyY2VpZCI7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFZlcnNpb24gbnVtYmVyIHRoYXQgaXMgdXBkYXRlZCB3aGVuZXZlciB0aGlzIHJvdyBvciBpdHMgcmVsYXRlZCBkYXRhCisgICAgICAgICAqIGNoYW5nZXMuCisgICAgICAgICAqIDxQPlR5cGU6IElOVEVHRVI8L1A+CisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBWRVJTSU9OID0gInZlcnNpb24iOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBGbGFnIGluZGljYXRpbmcgdGhhdCB7QGxpbmsgI1ZFUlNJT059IGhhcyBjaGFuZ2VkLCBhbmQgdGhpcyByb3cgbmVlZHMKKyAgICAgICAgICogdG8gYmUgc3luY2hyb25pemVkIGJ5IGl0cyBvd25pbmcgYWNjb3VudC4KKyAgICAgICAgICogPFA+VHlwZTogSU5URUdFUiAoYm9vbGVhbik8L1A+CisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBESVJUWSA9ICJkaXJ0eSI7CisgICAgfQorCisgICAgaW50ZXJmYWNlIEJvb2ttYXJrQ29sdW1ucyB7CisgICAgICAgIC8qKgorICAgICAgICAgKiBUaGUgdW5pcXVlIElEIGZvciBhIHJvdy4KKyAgICAgICAgICogPFA+VHlwZTogSU5URUdFUiAobG9uZyk8L1A+CisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBfSUQgPSAiX2lkIjsKKworICAgICAgICAvKioKKyAgICAgICAgICogVGhlIFVSTCBvZiB0aGUgYm9va21hcmsuCisgICAgICAgICAqIDxQPlR5cGU6IFRFWFQgKFVSTCk8L1A+CisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBVUkwgPSAidXJsIjsKKworICAgICAgICAvKioKKyAgICAgICAgICogVGhlIHVzZXIgdmlzaWJsZSB0aXRsZSBvZiB0aGUgYm9va21hcmsuCisgICAgICAgICAqIDxQPlR5cGU6IFRFWFQ8L1A+CisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBUSVRMRSA9ICJ0aXRsZSI7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFRoZSBmYXZpY29uIG9mIHRoZSBib29rbWFyaywgbWF5IGJlIE5VTEwuCisgICAgICAgICAqIE11c3QgZGVjb2RlIHZpYSB7QGxpbmsgQml0bWFwRmFjdG9yeSNkZWNvZGVCeXRlQXJyYXl9LgorICAgICAgICAgKiA8cD5UeXBlOiBCTE9CIChpbWFnZSk8L3A+CisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBGQVZJQ09OID0gImZhdmljb24iOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBBIHRodW1ibmFpbCBvZiB0aGUgcGFnZSxtYXkgYmUgTlVMTC4KKyAgICAgICAgICogTXVzdCBkZWNvZGUgdmlhIHtAbGluayBCaXRtYXBGYWN0b3J5I2RlY29kZUJ5dGVBcnJheX0uCisgICAgICAgICAqIDxwPlR5cGU6IEJMT0IgKGltYWdlKTwvcD4KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIFRIVU1CTkFJTCA9ICJ0aHVtYm5haWwiOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBUaGUgdG91Y2ggaWNvbiBmb3IgdGhlIHdlYiBwYWdlLCBtYXkgYmUgTlVMTC4KKyAgICAgICAgICogTXVzdCBkZWNvZGUgdmlhIHtAbGluayBCaXRtYXBGYWN0b3J5I2RlY29kZUJ5dGVBcnJheX0uCisgICAgICAgICAqIDxwPlR5cGU6IEJMT0IgKGltYWdlKTwvcD4KKyAgICAgICAgICogQGhpZGUKKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIFRPVUNIX0lDT04gPSAidG91Y2hfaWNvbiI7CisgICAgfQorCisgICAgLyoqCisgICAgICogVGhlIGJvb2ttYXJrcyB0YWJsZSwgd2hpY2ggaG9sZHMgdGhlIHVzZXIncyBicm93c2VyIGJvb2ttYXJrcy4KKyAgICAgKi8KKyAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGNsYXNzIEJvb2ttYXJrcyBpbXBsZW1lbnRzIEJvb2ttYXJrQ29sdW1ucywgU3luY0NvbHVtbnMgeworICAgICAgICAvKioKKyAgICAgICAgICogVGhpcyB1dGlsaXR5IGNsYXNzIGNhbm5vdCBiZSBpbnN0YW50aWF0ZWQuCisgICAgICAgICAqLworICAgICAgICBwcml2YXRlIEJvb2ttYXJrcygpIHt9CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFRoZSBjb250ZW50Oi8vIHN0eWxlIFVSSSBmb3IgdGhpcyB0YWJsZQorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBVcmkgQ09OVEVOVF9VUkkgPSBVcmkud2l0aEFwcGVuZGVkUGF0aChBVVRIT1JJVFlfVVJJLCAiYm9va21hcmtzIik7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFRoZSBjb250ZW50Oi8vIHN0eWxlIFVSSSBmb3IgdGhlIGRlZmF1bHQgZm9sZGVyCisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFVyaSBDT05URU5UX1VSSV9ERUZBVUxUX0ZPTERFUiA9CisgICAgICAgICAgICAgICAgVXJpLndpdGhBcHBlbmRlZFBhdGgoQ09OVEVOVF9VUkksICJmb2xkZXIiKTsKKworICAgICAgICAvKioKKyAgICAgICAgICogQnVpbGRzIGEgVVJJIHRoYXQgcG9pbnRzIHRvIGEgc3BlY2lmaWMgZm9sZGVyLgorICAgICAgICAgKiBAcGFyYW0gZm9sZGVySWQgdGhlIElEIG9mIHRoZSBmb2xkZXIgdG8gcG9pbnQgdG8KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgVXJpIGJ1aWxkRm9sZGVyVXJpKGxvbmcgZm9sZGVySWQpIHsKKyAgICAgICAgICAgIHJldHVybiBDb250ZW50VXJpcy53aXRoQXBwZW5kZWRJZChDT05URU5UX1VSSV9ERUZBVUxUX0ZPTERFUiwgZm9sZGVySWQpOworICAgICAgICB9CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFRoZSBNSU1FIHR5cGUgb2Yge0BsaW5rICNDT05URU5UX1VSSX0gcHJvdmlkaW5nIGEgZGlyZWN0b3J5IG9mIGJvb2ttYXJrcy4KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIENPTlRFTlRfVFlQRSA9ICJ2bmQuYW5kcm9pZC5jdXJzb3IuZGlyL2Jvb2ttYXJrIjsKKworICAgICAgICAvKioKKyAgICAgICAgICogVGhlIE1JTUUgdHlwZSBvZiBhIHtAbGluayAjQ09OVEVOVF9VUkl9IG9mIGEgc2luZ2xlIGJvb2ttYXJrLgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgQ09OVEVOVF9JVEVNX1RZUEUgPSAidm5kLmFuZHJvaWQuY3Vyc29yLml0ZW0vYm9va21hcmsiOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBRdWVyeSBwYXJhbWV0ZXIgdG8gdXNlIGlmIHlvdSB3YW50IHRvIHNlZSBkZWxldGVkIGJvb2ttYXJrcyB0aGF0IGFyZSBzdGlsbAorICAgICAgICAgKiBhcm91bmQgb24gdGhlIGRldmljZSBhbmQgaGF2ZW4ndCBiZWVuIHN5bmNlZCB5ZXQuCisgICAgICAgICAqIEBzZWUgI0lTX0RFTEVURUQKKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIFFVRVJZX1BBUkFNRVRFUl9TSE9XX0RFTEVURUQgPSAic2hvd19kZWxldGVkIjsKKworICAgICAgICAvKioKKyAgICAgICAgICogRmxhZyBpbmRpY2F0aW5nIGlmIGFuIGl0ZW0gaXMgYSBmb2xkZXIgb3IgYm9va21hcmsuIE5vbi16ZXJvIHZhbHVlcyBpbmRpY2F0ZQorICAgICAgICAgKiBhIGZvbGRlciBhbmQgemVybyBpbmRpY2F0ZXMgYSBib29rbWFyay4KKyAgICAgICAgICogPFA+VHlwZTogSU5URUdFUiAoYm9vbGVhbik8L1A+CisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBJU19GT0xERVIgPSAiZm9sZGVyIjsKKworICAgICAgICAvKioKKyAgICAgICAgICogVGhlIElEIG9mIHRoZSBwYXJlbnQgZm9sZGVyLiBJRCAwIGlzIHRoZSByb290IGZvbGRlci4KKyAgICAgICAgICogPFA+VHlwZTogSU5URUdFUiAocmVmZXJlbmNlIHRvIGl0ZW0gaW4gdGhlIHNhbWUgdGFibGUpPC9QPgorICAgICAgICAgKi8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4gZGVsZXRlZCwgemVybyBpZiBpdCBoYXNuJ3QpCisgICAgICAgICAqIEBzZWUgI1FVRVJZX1BBUkFNRVRFUl9TSE9XX0RFTEVURUQKKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIElTX0RFTEVURUQgPSAiZGVsZXRlZCI7CisgICAgfQorCisgICAgLyoqCisgICAgICogVGhlIGhpc3RvcnkgdGFibGUsIHdoaWNoIGhvbGRzIHRoZSBicm93c2luZyBoaXN0b3J5LgorICAgICAqLworICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgY2xhc3MgSGlzdG9yeSBpbXBsZW1lbnRzIEJvb2ttYXJrQ29sdW1ucyB7CisgICAgICAgIC8qKgorICAgICAgICAgKiBUaGlzIHV0aWxpdHkgY2xhc3MgY2Fubm90IGJlIGluc3RhbnRpYXRlZC4KKyAgICAgICAgICovCisgICAgICAgIHByaXZhdGUgSGlzdG9yeSgpIHt9CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFRoZSBjb250ZW50Oi8vIHN0eWxlIFVSSSBmb3IgdGhpcyB0YWJsZQorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBVcmkgQ09OVEVOVF9VUkkgPSBVcmkud2l0aEFwcGVuZGVkUGF0aChBVVRIT1JJVFlfVVJJLCAiaGlzdG9yeSIpOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBUaGUgTUlNRSB0eXBlIG9mIHtAbGluayAjQ09OVEVOVF9VUkl9IHByb3ZpZGluZyBhIGRpcmVjdG9yeSBvZiBicm93c2VyIGhpc3RvcnkgaXRlbXMuCisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBDT05URU5UX1RZUEUgPSAidm5kLmFuZHJvaWQuY3Vyc29yLmRpci9icm93c2VyLWhpc3RvcnkiOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBUaGUgTUlNRSB0eXBlI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KyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgVVNFUl9FTlRFUkVEID0gInVzZXJfZW50ZXJlZCI7CisgICAgfQorCisgICAgLyoqCisgICAgICogVGhlIHNlYXJjaCBoaXN0b3J5IHRhYmxlLgorICAgICAqIEBoaWRlCisgICAgICovCisgICAgcHVibGljIHN0YXRpYyBmaW5hbCBjbGFzcyBTZWFyY2hlcyB7CisgICAgICAgIHByaXZhdGUgU2VhcmNoZXMoKSB7fQorCisgICAgICAgIC8qKgorICAgICAgICAgKiBUaGUgY29udGVudDovLyBzdHlsZSBVUkkgZm9yIHRoaXMgdGFibGUKKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgVXJpIENPTlRFTlRfVVJJID0gVXJpLndpdGhBcHBlbmRlZFBhdGgoQVVUSE9SSVRZX1VSSSwgInNlYXJjaGVzIik7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFRoZSBNSU1FIHR5cGUgb2Yge0BsaW5rICNDT05URU5UX1VSSX0gcHJvdmlkaW5nIGEgZGlyZWN0b3J5IG9mIGJyb3dzZXIgc2VhcmNoIGl0ZW1zLgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgQ09OVEVOVF9UWVBFID0gInZuZC5hbmRyb2lkLmN1cnNvci5kaXIvc2VhcmNoZXMiOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBUaGUgTUlNRSB0eXBlIG9mIGEge0BsaW5rICNDT05URU5UX1VSSX0gb2YgYSBzaW5nbGUgYnJvd3NlciBzZWFyY2ggaXRlbS4KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIENPTlRFTlRfSVRFTV9UWVBFID0gInZuZC5hbmRyb2lkLmN1cnNvci5pdGVtL3NlYXJjaGVzIjsKKworICAgICAgICAvKioKKyAgICAgICAgICogVGhlIHVuaXF1ZSBJRCBmb3IgYSByb3cuCisgICAgICAgICAqIDxQPlR5cGU6IElOVEVHRVIgKGxvbmcpPC9QPgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgX0lEID0gIl9pZCI7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFRoZSB1c2VyIGVudGVyZWQgc2VhcmNoIHRlcm0uCisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBTRUFSQ0ggPSAic2VhcmNoIjsKKworICAgICAgICAvKioKKyAgICAgICAgICogVGhlIGRhdGUgdGhlIHNlYXJjaCB3YXMgcGVyZm9ybWVkLCBpbiBtaWxsaXNlY29uZHMgc2luY2UgdGhlIGVwb2NoLgorICAgICAgICAgKiA8cD5UeXBlOiBOVU1CRVIgKGRhdGUgaW4gbWlsbGlzZWNvbmRzIHNpbmNlIEphbnVhcnkgMSwgMTk3MCk8L3A+CisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBEQVRFID0gImRhdGUiOworICAgIH0KKworICAgIC8qKgorICAgICAqIEEgdGFibGUgcHJvdmlkZWQgZm9yIHN5bmMgYWRhcHRlcnMgdG8gdXNlIGZvciBzdG9yaW5nIHByaXZhdGUgc3luYyBzdGF0ZSBkYXRhLgorICAgICAqCisgICAgICogQHNlZSBTeW5jU3RhdGVDb250cmFjdAorICAgICAqLworICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgY2xhc3MgU3luY1N0YXRlIGltcGxlbWVudHMgU3luY1N0YXRlQ29udHJhY3QuQ29sdW1ucyB7CisgICAgICAgIC8qKgorICAgICAgICAgKiBUaGlzIHV0aWxpdHkgY2xhc3MgY2Fubm90IGJlIGluc3RhbnRpYXRlZAorICAgICAgICAgKi8KKyAgICAgICAgcHJpdmF0ZSBTeW5jU3RhdGUoKSB7fQorCisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIENPTlRFTlRfRElSRUNUT1JZID0KKyAgICAgICAgICAgICAgICBTeW5jU3RhdGVDb250cmFjdC5Db25zdGFudHMuQ09OVEVOVF9ESVJFQ1RPUlk7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFRoZSBjb250ZW50Oi8vIHN0eWxlIFVSSSBmb3IgdGhpcyB0YWJsZQorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBVcmkgQ09OVEVOVF9VUkkgPQorICAgICAgICAgICAgICAgIFVyaS53aXRoQXBwZW5kZWRQYXRoKEFVVEhPUklUWV9VUkksIENPTlRFTlRfRElSRUNUT1JZKTsKKworICAgICAgICAvKioKKyAgICAgICAgICogQHNlZSBhbmRyb2lkLnByb3ZpZGVyLlN5bmNTdGF0ZUNvbnRyYWN0LkhlbHBlcnMjZ2V0CisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGJ5dGVbXSBnZXQoQ29udGVudFByb3ZpZGVyQ2xpZW50IHByb3ZpZGVyLCBBY2NvdW50IGFjY291bnQpCisgICAgICAgICAgICAgICAgdGhyb3dzIFJlbW90ZUV4Y2VwdGlvbiB7CisgICAgICAgICAgICByZXR1cm4gU3luY1N0YXRlQ29udHJhY3QuSGVscGVycy5nZXQocHJvdmlkZXIsIENPTlRFTlRfVVJJLCBhY2NvdW50KTsKKyAgICAgICAgfQorCisgICAgICAgIC8qKgorICAgICAgICAgKiBAc2VlIGFuZHJvaWQucHJvdmlkZXIuU3luY1N0YXRlQ29udHJhY3QuSGVscGVycyNnZXQKKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBzdGF0aWMgUGFpcjxVcmksIGJ5dGVbXT4gZ2V0V2l0aFVyaShDb250ZW50UHJvdmlkZXJDbGllbnQgcHJvdmlkZXIsIEFjY291bnQgYWNjb3VudCkKKyAgICAgICAgICAgICAgICB0aHJvd3MgUmVtb3RlRXhjZXB0aW9uIHsKKyAgICAgICAgICAgIHJldHVybiBTeW5jU3RhdGVDb250cmFjdC5IZWxwZXJzLmdldFdpdGhVcmkocHJvdmlkZXIsIENPTlRFTlRfVVJJLCBhY2NvdW50KTsKKyAgICAgICAgfQorCisgICAgICAgIC8qKgorICAgICAgICAgKiBAc2VlIGFuZHJvaWQucHJvdmlkZXIuU3luY1N0YXRlQ29udHJhY3QuSGVscGVycyNzZXQKKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBzdGF0aWMgdm9pZCBzZXQoQ29udGVudFByb3ZpZGVyQ2xpZW50IHByb3ZpZGVyLCBBY2NvdW50IGFjY291bnQsIGJ5dGVbXSBkYXRhKQorICAgICAgICAgICAgICAgIHRocm93cyBSZW1vdGVFeGNlcHRpb24geworICAgICAgICAgICAgU3luY1N0YXRlQ29udHJhY3QuSGVscGVycy5zZXQocHJvdmlkZXIsIENPTlRFTlRfVVJJLCBhY2NvdW50LCBkYXRhKTsKKyAgICAgICAgfQorCisgICAgICAgIC8qKgorICAgICAgICAgKiBAc2VlIGFuZHJvaWQucHJvdmlkZXIuU3luY1N0YXRlQ29udHJhY3QuSGVscGVycyNuZXdTZXRPcGVyYXRpb24KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBzdGF0aWMgQ29udGVudFByb3ZpZGVyT3BlcmF0aW9uIG5ld1NldE9wZXJhdGlvbihBY2NvdW50IGFjY291bnQsIGJ5dGVbXSBkYXRhKSB7CisgICAgICAgICAgICByZXR1cm4gU3luY1N0YXRlQ29udHJhY3QuSGVscGVycy5uZXdTZXRPcGVyYXRpb24oQ09OVEVOVF9VUkksIGFjY291bnQsIGRhdGEpOworICAgICAgICB9CisgICAgfQorfQpkaWZmIC0tZ2l0IGEvY29yZS9qYXZhL2FuZHJvaWQvcHJvdmlkZXIvQ2FsZW5kYXIuamF2YSBiL2NvcmUvamF2YS9hbmRyb2lkL3Byb3ZpZGVyL0NhbGVuZGFyLmphdmEKaW5kZXggOWEwOTgwNS4uYTYzOTRlNSAxMDA2NDQKLS0tIGEvY29yZS9qYXZh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d2l0aCBzb21ldGhpbmcgbW9yZSBnZW5lcmFsIGluIHRoZSBmdXR1cmUuCisgICAgICAgICAqIDxQPlR5cGU6IElOVEVHRVIgKGxvbmcpPC9QPgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgX1NZTkNfREFUQSA9ICJfc3luY19sb2NhbF9pZCI7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFVzZWQgb25seSBpbiBwZXJzaXN0ZW50IHByb3ZpZGVycywgYW5kIG9ubHkgZHVyaW5nIG1lcmdpbmcuCisgICAgICAgICAqIDxQPlR5cGU6IElOVEVHRVIgKGxvbmcpPC9QPgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgX1NZTkNfTUFSSyA9ICJfc3luY19tYXJrIjsKKworICAgICAgICAvKioKKyAgICAgICAgICogVXNlZCB0byBpbmRpY2F0ZSB0aGF0IGxvY2FsLCB1bnN5bmNlZCwgY2hhbmdlcyBhcmUgcHJlc2VudC4KKyAgICAgICAgICogPFA+VHlwZTogSU5URUdFUiAobG9uZyk8L1A+CisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBfU1lOQ19ESVJUWSA9ICJfc3luY19kaXJ0eSI7CisKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBDb2x1bW5zIGZyb20gdGhlIEFjY291bnQgaW5mb3JtYXRpb24gdXNlZCBieSBDYWxlbmRhcnMgYW5kIEV2ZW50cyB0YWJsZXMuCisgICAgICovCisgICAgcHVibGljIGludGVyZmFjZSBBY2NvdW50Q29sdW1ucyB7CisgICAgICAgIC8qKgorICAgICAgICAgKiBUaGUgbmFtZSBvZiB0aGUgYWNjb3VudCBpbnN0YW5jZSB0byB3aGljaCB0aGlzIHJvdyBiZWxvbmdzLCB3aGljaCB3aGVuIHBhaXJlZCB3aXRoCisgICAgICAgICAqIHtAbGluayAjQUNDT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bCBleHRlbmRzIEN1cnNvckVudGl0eUl0ZXJhdG9yIHsKKyAgICAgICAgICAgIHByaXZhdGUgZmluYWwgQ29udGVudFJlc29sdmVyIG1SZXNvbHZlcjsKKyAgICAgICAgICAgIHByaXZhdGUgZmluYWwgQ29udGVudFByb3ZpZGVyQ2xpZW50IG1Qcm92aWRlcjsKKworICAgICAgICAgICAgcHVibGljIEVudGl0eUl0ZXJhdG9ySW1wbChDdXJzb3IgY3Vyc29yLCBDb250ZW50UmVzb2x2ZXIgcmVzb2x2ZXIpIHsKKyAgICAgICAgICAgICAgICBzdXBlcihjdXJzb3IpOworICAgICAgICAgICAgICAgIG1SZXNvbHZlciA9IHJlc29sdmVyOworICAgICAgICAgICAgICAgIG1Qcm92aWRlciA9IG51bGw7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHB1YmxpYyBFbnRpdHlJdGVyYXRvckltcGwoQ3Vyc29yIGN1cnNvciwgQ29udGVudFByb3ZpZGVyQ2xpZW50IHByb3ZpZGVyKSB7CisgICAgICAgICAgICAgICAgc3VwZXIoY3Vyc29yKTsKKyAgICAgICAgICAgICAgICBtUmVzb2x2ZXIgPSBudWxsOworICAgICAgICAgICAgICAgIG1Qcm92aWRlciA9IHByb3ZpZGVyOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgICAgIHB1YmxpYyBFbnRpdHkgZ2V0RW50aXR5QW5kSW5jcmVtZW50Q3Vyc29yKEN1cnNvciBjdXJzb3IpIHRocm93cyBSZW1vdGVFeGNlcHRpb24geworICAgICAgICAgICAgICAgIC8vIHdlIGV4cGVjdCB0aGUgY3Vyc29yIGlzIGFscmVhZHkgYXQgdGhlIHJvdyB3ZSBuZWVkIHRvIHJlYWQgZnJvbQorICAgICAgICAgICAgICAgIGZpbmFsIGxvbmcgY2FsZW5kYXJJZCA9IGN1cnNvci5nZXRMb25nKGN1cnNvci5nZXRDb2x1bW5JbmRleE9yVGhyb3coX0lEKSk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LCBjdiwgREVMRVRFRCk7CisKKyAgICAgICAgICAgICAgICAvLyBDcmVhdGUgdGhlIEVudGl0eSBmcm9tIHRoZSBDb250ZW50VmFsdWUKKyAgICAgICAgICAgICAgICBFbnRpdHkgZW50aXR5ID0gbmV3IEVudGl0eShjdik7CisKKyAgICAgICAgICAgICAgICAvLyBTZXQgY3Vyc29yIHRvIG5leHQgcm93CisgICAgICAgICAgICAgICAgY3Vyc29yLm1vdmVUb05leHQoKTsKKworICAgICAgICAgICAgICAgIC8vIFJldHVybiB0aGUgY3JlYXRlZCBFbnRpdHkKKyAgICAgICAgICAgICAgICByZXR1cm4gZW50aXR5OworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgIH0KKworICAgIC8qKgogICAgICAqIENvbnRhaW5zIGEgbGlzdCBvZiBhdmFpbGFibGUgY2FsZW5kYXJzLgogICAgICAqLwotICAgIHB1YmxpYyBzdGF0aWMgY2xhc3MgQ2FsZW5kYXJzIGltcGxlbWVudHMgQmFzZUNvbHVtbnMsIENhbGVuZGFyc0NvbHVtbnMKKyAgICBwdWJsaWMgc3RhdGljIGNsYXNzIENhbGVuZGFycyBpbXBsZW1lbnRzIEJhc2VDb2x1bW5zLCBTeW5jQ29sdW1ucywgQWNjb3VudENvbHVtbnMsCisgICAgICAgICAgICBDYWxlbmRhcnNDb2x1bW5zCiAgICAgewogICAgICAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBTdHJpbmcgV0hFUkVfREVMRVRFX0ZPUl9BQ0NPVU5UID0gQ2FsZW5kYXJzLl9TWU5DX0FDQ09VTlQgKyAiPT8iCiAgICAgICAgICAgICAgICAgKyAiIEFORCAiICsgQ2FsZW5kYXJzLl9TWU5DX0FDQ09VTlRfVFlQRSArICI9PyI7CkBAIC0yNTgsNiArMzgxLDI0IEBACiAgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIFVSTCA9ICJ1cmwiOwogCiAgICAgICAgIC8qKgorICAgICAgICAgKiBUaGUgVVJMIGZvciB0aGUgY2FsZW5kYXIgaXRzZWxmCisgICAgICAgICAqIDxQPlR5cGU6IFRFWFQgKFVSTCk8L1A+CisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBTRUxGX1VSTCA9ICJzZWxmVXJsIjsKKworICAgICAgICAvKioKKyAgICAgICAgICogVGhlIFVSTCBmb3IgdGhlIGNhbGVuZGFyIHRvIGJlIGVkaXRlZAorICAgICAgICAgKiA8UD5UeXBlOiBURVhUIChVUkwpPC9QPgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgRURJVF9VUkwgPSAiZWRpdFVybCI7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFRoZSBVUkwgZm9yIHRoZSBjYWxlbmRhciBldmVudHMKKyAgICAgICAgICogPFA+VHlwZTogVEVYVCAoVVJMKTwvUD4KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIEVWRU5UU19VUkwgPSAiZXZlbnRzVXJsIjsKKworICAgICAgICAvKioKICAgICAgICAgICogVGhlIG5hbWUgb2YgdGhlIGNhbGVuZGFyCiAgICAgICAgICAqIDxQPlR5cGU6IFRFWFQ8L1A+CiAgICAgICAgICAqLwpAQCAtMjc2LDEyICs0MTcsNiBAQAogICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBMT0NBVElPTiA9ICJsb2NhdGlvbiI7CiAKICAgICAgICAgLyoqCi0gICAgICAgICAqIFNob3VsZCB0aGUgY2FsZW5kYXIgYmUgaGlkZGVuIGluIHRoZSBjYWxlbmRhciBzZWxlY3Rpb24gcGFuZWw/Ci0gICAgICAgICAqIDxQPlR5cGU6IElOVEVHRVIgKGJvb2xlYW4pPC9QPgotICAgICAgICAgKi8KLSAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgSElEREVOID0gImhpZGRlbiI7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HVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgRFRFTkQgPSAiZHRlbmQiOwogCiAgICAgICAgIC8qKgorICAgICAgICAgKiBUaGUgdGltZSB0aGUgZXZlbnQgc3RhcnRzIHdpdGggYWxsRGF5IGV2ZW50cyBpbiBhIGxvY2FsIHR6CisgICAgICAgICAqIDxQPlR5cGU6IElOVEVHRVIgKGxvbmc7IG1pbGxpcyBzaW5jZSBlcG9jaCk8L1A+CisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBEVFNUQVJUMiA9ICJkdHN0YXJ0MiI7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFRoZSB0aW1lIHRoZSBldmVudCBlbmRzIHdpdGggYWxsRGF5IGV2ZW50cyBpbiBhIGxvY2FsIHR6CisgICAgICAgICAqIDxQPlR5cGU6IElOVEVHRVIgKGxvbmc7IG1pbGxpcyBzaW5jZSBlcG9jaCk8L1A+CisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBEVEVORDIgPSAiZHRlbmQyIjsKKworICAgICAgICAvKioKICAgICAgICAgICogVGhlIGR1cmF0aW9uIG9mIHRoZSBldmVudAogICAgICAgICAgKiA8UD5UeXBlOiBURVhUIChkdXJhdGlvbiBpbiBSRkMyNDQ1IGZvcm1hdCk8L1A+CiAgICAgICAgICAqLwpAQCAtNDUwLDYgKzU5OSwxMiBAQAogICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBFVkVOVF9USU1FWk9ORSA9ICJldmVudFRpbWV6b25lIjsKIAogICAgICAgICAvKioKKyAgICAgICAgICogVGhlIHRpbWV6b25lIGZvciB0aGUgZXZlbnQsIGFsbERheSBldmVudHMgd2lsbCBoYXZlIGEgbG9jYWwgdHogaW5zdGVhZCBvZiBVVEMKKyAgICAgICAgICogPFA+VHlwZTogVEVYVAorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgRVZFTlRfVElNRVpPTkUyID0gImV2ZW50VGltZXpvbmUyIjsKKworICAgICAgICAvKioKICAgICAgICAgICogV2hldGhlciB0aGUgZXZlbnQgbGFzdHMgYWxsIGRheSBvciBub3QKICAgICAgICAgICogPFA+VHlwZTogSU5URUdFUiAoYm9vbGVhbik8L1A+CiAgICAgICAgICAqLwpAQCAtNTk4LDcgKzc1Myw4IEBACiAgICAgLyoqCiAgICAgICogQ29udGFpbnMgb25lIGVudHJ5IHBlciBjYWxlbmRhciBldmVudC4gUmVjdXJyaW5nIGV2ZW50cyBzaG93IHVwIGFzIGEgc2luZ2xlIGVudHJ5LgogICAgICAqLwotICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgY2xhc3MgRXZlbnRzRW50aXR5IGltcGxlbWVudHMgQmFzZUNvbHVtbnMsIEV2ZW50c0NvbHVtbnMsIENhbGVuZGFyc0NvbHVtbnMgeworICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgY2xhc3MgRXZlbnRzRW50aXR5IGltcGxlbWVudHMgQmFzZUNvbHVtbnMsIFN5bmNDb2x1bW5zLCBBY2NvdW50Q29sdW1ucywKKyAgICAgICAgICAgIEV2ZW50c0NvbHVtbnMgewogICAgICAgICAvKioKICAgICAgICAgICogVGhlIGNvbnRlbnQ6Ly8gc3R5bGUgVVJMIGZvciB0aGlzIHRhYmxlCiAgICAgICAgICAqLwpAQCAtNzAzLDggKzg1OSw4IEBACiAgICAgICAgICAgICAgICAgRGF0YWJhc2VVdGlscy5jdXJzb3JTdHJpbmdUb0NvbnRlbnRWYWx1ZXNJZlByZXNlbnQoY3Vyc29yLCBjdiwgX1NZTkNfREFUQSk7CiAgICAgICAgICAgICAgICAgRGF0YWJhc2VVdGlscy5jdXJzb3JMb25nVG9Db250ZW50VmFsdWVzSWZQcmVzZW50KGN1cnNvciwgY3YsIF9TWU5DX0RJUlRZKTsKICAgICAgICAgICAgICAgICBEYXRhYmFzZVV0aWxzLm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Njb3VudENvbHVtbnMsCisgICAgICAgICAgICBFdmVudHNDb2x1bW5zIHsKIAogICAgICAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBTdHJpbmdbXSBGRVRDSF9FTlRSWV9DT0xVTU5TID0KICAgICAgICAgICAgICAgICBuZXcgU3RyaW5nW10geyBFdmVudHMuX1NZTkNfQUNDT1VOVCwgRXZlbnRzLl9TWU5DX0lEIH07CkBAIC04NjAsNiArMTAxNywxNSBAQAogICAgICAgICB9CiAKICAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBDdXJzb3IgcXVlcnkoQ29udGVudFJlc29sdmVyIGNyLCBTdHJpbmdbXSBwcm9qZWN0aW9uLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsb25nIGJlZ2luLCBsb25nIGVuZCwgU3RyaW5nIHNlYXJjaFF1ZXJ5KSB7CisgICAgICAgICAgICBVcmkuQnVpbGRlciBidWlsZGVyID0gQ09OVEVOVF9TRUFSQ0hfVVJJLmJ1aWxkVXBvbigpOworICAgICAgICAgICAgQ29udGVudFVyaXMuYXBwZW5kSWQoYnVpbGRlciwgYmVnaW4pOworICAgICAgICAgICAgQ29udGVudFVyaXMuYXBwZW5kSWQoYnVpbGRlciwgZW5kKTsKKyAgICAgICAgICAgIHJldHVybiBjci5xdWVyeShidWlsZGVyLmJ1aWxkKCksIHByb2plY3Rpb24sIFdIRVJFX0NBTEVOREFSU19TRUxFQ1RFRCwKKyAgICAgICAgICAgICAgICAgICAgICAgICBuZXcgU3RyaW5nW10geyBzZWFyY2hRdWVyeSB9LCBERUZBVUxUX1NPUlRfT1JERVIpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBDdXJzb3IgcXVlcnkoQ29udGVudFJlc29sdmVyIGNyLCBTdHJpbmdbXSBwcm9qZWN0aW9uLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsb25nIGJlZ2luLCBsb25nIGVuZCwgU3RyaW5nIHdoZXJlLCBTdHJpbmcgb3JkZXJCeSkgewogICAgICAgICAgICAgVXJpLkJ1aWxkZXIgYnVpbGRlciA9IENPTlRFTlRfVVJJLmJ1aWxkVXBvbigpOwogICAgICAgICAgICAgQ29udGVudFVyaXMuYXBwZW5kSWQoYnVpbGRlciwgYmVnaW4pOwpAQCAtODczLDYgKzEwMzksMjEgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLCBvcmRlckJ5ID09IG51bGwgPyBERUZBVUxUX1NPUlRfT1JERVIgOiBvcmRlckJ5KTsKICAgICAgICAgfQogCisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgQ3Vyc29yIHF1ZXJ5KENvbnRlbnRSZXNvbHZlciBjciwgU3RyaW5nW10gcHJvamVjdGlvbiwgbG9uZyBiZWdpbiwKKyAgICAgICAgICAgICAgICBsb25nIGVuZCwgU3RyaW5nIHNlYXJjaFF1ZXJ5LCBTdHJpbmcgd2hlcmUsIFN0cmluZyBvcmRlckJ5KSB7CisgICAgICAgICAgICBVcmkuQnVpbGRlciBidWlsZGVyID0gQ09OVEVOVF9TRUFSQ0hfVVJJLmJ1aWxkVXBvbigpOworICAgICAgICAgICAgQ29udGVudFVyaXMuYXBwZW5kSWQoYnVpbGRlciwgYmVnaW4pOworICAgICAgICAgICAgQ29udGVudFVyaXMuYXBwZW5kSWQoYnVpbGRlciwgZW5kKTsKKyAgICAgICAgICAgIGJ1aWxkZXIgPSBidWlsZGVyLmFwcGVuZFBhdGgoc2VhcmNoUXVlcnkpOworICAgICAgICAgICAgaWYgKFRleHRVdGlscy5pc0VtcHR5KHdoZXJlKSkgeworICAgICAgICAgICAgICAgIHdoZXJlID0gV0hFUkVfQ0FMRU5EQVJTX1NFTEVDVEVEOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICB3aGVyZSA9ICIoIiArIHdoZXJlICsgIikgQU5EICIgKyBXSEVSRV9DQUxFTkRBUlNfU0VMRUNURUQ7CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gY3IucXVlcnkoYnVpbGRlci5idWlsZCgpLCBwcm9qZWN0aW9uLCB3aGVyZSwgbnVsbCwKKyAgICAgICAgICAgICAgICAgICAgb3JkZXJCeSA9PSBudWxsID8gREVGQVVMVF9TT1JUX09SREVSIDogb3JkZXJCeSk7CisgICAgICAgIH0KKwogICAgICAgICAvKioKICAgICAgICAgICogVGhlIGNvbnRlbnQ6Ly8gc3R5bGUgVVJMIGZvciB0aGlzIHRhYmxlCiAgICAgICAgICAqLwpAQCAtODgwLDYgKzEwNjEsMTAgQEAKICAgICAgICAgICAgICAgICAiL2luc3RhbmNlcy93aGVuIik7CiAgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgVXJpIENPTlRFTlRfQllfREFZX1VSSSA9CiAgICAgICAgICAgICBVcmkucGFyc2UoImNvbnRlbnQ6Ly8iICsgQVVUSE9SSVRZICsgIi9pbnN0YW5jZXMvd2hlbmJ5ZGF5Iik7CisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgVXJpIENPTlRFTlRfU0VBUkNIX1VSSSA9IFVyaS5wYXJzZSgiY29udGVudDovLyIgKyBBVVRIT1JJVFkgKworICAgICAgICAgICAgICAgICIvaW5zdGFuY2VzL3NlYXJjaCIpOworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFVyaSBDT05URU5UX1NFQVJDSF9CWV9EQVlfVVJJID0KKyAgICAgICAgICAgIFVyaS5wYXJzZSgiY29udGVudDovLyIgKyBBVVRIT1JJVFkgKyAiL2luc3RhbmNlcy9zZWFyY2hieWRheSIpOwogCiAgICAgICAgIC8qKgogICAgICAgICAgKiBUaGUgZGVmYXVsdCBzb3J0IG9yZGVyIGZvciB0aGlzIHRhYmxlLgpAQCAtODk2LDcgKzEwODEsNiBAQAogICAgICAgICAgKiByZXF1aXJlZCBmb3IgY29ycmVjdG5lc3MsIGl0IGp1c3QgYWRkcyBhIG5p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YXdUaW1lc0NvbHVtbnMgeworICAgICAgICAvKioKKyAgICAgICAgICogVGhlIGNvcnJlc3BvbmRpbmcgZXZlbnQgaWQKKyAgICAgICAgICogPFA+VHlwZTogSU5URUdFUiAobG9uZyk8L1A+CisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBFVkVOVF9JRCA9ICJldmVudF9pZCI7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFRoZSBSRkMyNDQ1IGNvbXBsaWFudCB0aW1lIHRoZSBldmVudCBzdGFydHMKKyAgICAgICAgICogPFA+VHlwZTogVEVYVDwvUD4KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIERUU1RBUlRfMjQ0NSA9ICJkdHN0YXJ0MjQ0NSI7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFRoZSBSRkMyNDQ1IGNvbXBsaWFudCB0aW1lIHRoZSBldmVudCBlbmRzCisgICAgICAgICAqIDxQPlR5cGU6IFRFWFQ8L1A+CisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBEVEVORF8yNDQ1ID0gImR0ZW5kMjQ0NSI7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFRoZSBSRkMyNDQ1IGNvbXBsaWFudCBvcmlnaW5hbCBpbnN0YW5jZSB0aW1lIG9mIHRoZSByZWN1cnJpbmcgZXZlbnQgZm9yIHdoaWNoIHRoaXMKKyAgICAgICAgICogZXZlbnQgaXMgYW4gZXhjZXB0aW9uLgorICAgICAgICAgKiA8UD5UeXBlOiBURVhUPC9QPgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgT1JJR0lOQUxfSU5TVEFOQ0VfVElNRV8yNDQ1ID0gIm9yaWdpbmFsSW5zdGFuY2VUaW1lMjQ0NSI7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFR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IgcmVtb3ZlZCwKKyAgICAgKiB0aGUgY29ycmVzcG9uZGluZyBkaXJlY3Rvcnkgcm93cyBhcmUgYXV0b21hdGljYWxseSByZW1vdmVkIGZyb20gdGhlIENvbnRhY3RzIFByb3ZpZGVyLgorICAgICAqIDwvcD4KKyAgICAgKi8KKyAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGNsYXNzIERpcmVjdG9yeSBpbXBsZW1lbnRzIEJhc2VDb2x1bW5zIHsKKworICAgICAgICAvKioKKyAgICAgICAgICogTm90IGluc3RhbnRpYWJsZS4KKyAgICAgICAgICovCisgICAgICAgIHByaXZhdGUgRGlyZWN0b3J5KCkgeworICAgICAgICB9CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFRoZSBjb250ZW50Oi8vIHN0eWxlIFVSSSBmb3IgdGhpcyB0YWJsZS4gIFJlcXVlc3RzIHRvIHRoaXMgVVJJIGNhbiBiZQorICAgICAgICAgKiBwZXJmb3JtZWQgb24gdGhlIFVJIHRocmVhZCBiZWNhdXNlIHRoZXkgYXJlIGFsd2F5cyB1bmJsb2NraW5nLgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBVcmkgQ09OVEVOVF9VUkkgPQorICAgICAgICAgICAgICAgIFVyaS53aXRoQXBwZW5kZWRQYXRoKEFVVEhPUklUWV9VUkksICJkaXJlY3RvcmllcyIpOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBUaGUgTUlNRS10eXBlIG9mIHtAbGluayAjQ09OVEVOVF9VUkl9IHByb3ZpZGluZyBhIGRpcmVjdG9yeSBvZgorICAgICAgICAgKiBjb250YWN0IGRpcmVjdG9yaWVzLgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgQ09OVEVOVF9UWVBFID0KKyAgICAgICAgICAgICAgICAidm5kLmFuZHJvaWQuY3Vyc29yLmRpci9jb250YWN0X2RpcmVjdG9yaWVzIjsKKworICAgICAgICAvKioKKyAgICAgICAgICogVGhlIE1JTUUgdHlwZSBvZiBhIHtAbGluayAjQ09OVEVOVF9VUkl9IGl0ZW0uCisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBDT05URU5UX0lURU1fVFlQRSA9CisgICAgICAgICAgICAgICAgInZuZC5hbmRyb2lkLmN1cnNvci5pdGVtL2NvbnRhY3RfZGlyZWN0b3J5IjsKKworICAgICAgICAvKioKKyAgICAgICAgICogX0lEIG9mIHRoZSBkZWZhdWx0IGRpcmVjdG9yeSwgd2hpY2ggcmVwcmVzZW50cyBsb2NhbGx5IHN0b3JlZCBjb250YWN0cy4KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgbG9uZyBERUZBVUxUID0gMDsKKworICAgICAgICAvKioKKyAgICAgICAgICogX0lEIG9mIHRoZSBkaXJlY3RvcnkgdGhhdCByZXByZXNlbnRzIGxvY2FsbHkgc3RvcmVkIGludmlzaWJsZSBjb250YWN0cy4KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgbG9uZyBMT0NBTF9JTlZJU0lCTEUgPSAxOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBUaGUgbmFtZSBvZiB0aGUgcGFja2FnZSB0aGF0IG93bnMgdGhpcyBkaXJlY3RvcnkuIENvbnRhY3RzIFByb3ZpZGVyCisgICAgICAgICAqIGZpbGwgaXQgaW4gd2l0aCB0aGUgbmFtZSBvZiB0aGUgcGFja2FnZSBjb250YWluaW5nIHRoZSBkaXJlY3RvcnkgcHJvdmlkZXIuCisgICAgICAgICAqIElmIHRoZSBwYWNrYWdlIGlzIGxhdGVyIHVuaW5zdGFsbGVkLCB0aGUgZGlyZWN0b3JpZXMgaXQgb3ducyBhcmUKKyAgICAgICAgICogYXV0b21hdGljYWxseSByZW1vdmVkIGZyb20gdGhpcyB0YWJsZS4KKyAgICAgICAgICoKKyAgICAgICAgICogPHA+VFlQRTogVEVYVDwvcD4KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIFBBQ0tBR0VfTkFNRSA9ICJwYWNrYWdlTmFtZSI7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFRoZSB0eXBlIG9mIGRpcmVjdG9yeSBjYXB0dXJlZCBhcyBhIHJlc291cmNlIElEIGluIHRoZSBjb250ZXh0IG9mIHRoZQorICAgICAgICAgKiBwYWNrYWdlIHtAbGluayAjUEFDS0FHRV9OQU1FfSwgZS5nLiAiQ29ycG9yYXRlIERpcmVjdG9yeSIKKyAgICAgICAgICoKKyAgICAgICAgICogPHA+VFlQRTogSU5URUdFUjwvcD4KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIFRZUEVfUkVTT1VSQ0VfSUQgPSAidHlwZVJlc291cmNlSWQiOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBBbiBvcHRpb25hbCBuYW1lIHRoYXQgY2FuIGJlIHVzZWQgaW4gdGhlIFVJIHRvIHJlcHJlc2VudCB0aGlzIGRpcmVjdG9yeSwKKyAgICAgICAgICogZS5nLiAiQWNtZSBDb3JwIgorICAgICAgICAgKiA8cD5UWVBFOiB0ZXh0PC9wPgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgRElTUExBWV9OQU1FID0gImRpc3BsYXlOYW1lIjsKKworICAgICAgICAvKioKKyAgICAgICAgICogPHA+CisgICAgICAgICAqIFRoZSBhdXRob3JpdHkgb2YgdGhlIERpcmVjdG9yeSBQcm92aWRlci4gQ29udGFjdHMgUHJvdmlkZXIgd2lsbAorICAgICAgICAgKiB1c2UgdGhpcyBhdXRob3JpdHkgdG8gZm9yd2FyZCByZXF1ZXN0cyB0byB0aGUgZGlyZWN0b3J5IHByb3ZpZGVyLgorICAgICAgICAgKiBBIGRpcmVjdG9yeSBwcm92aWRlciBjYW4gbGVhdmUgdGhpcyBjb2x1bW4gZW1wdHkgLSBDb250YWN0cyBQcm92aWRlciB3aWxsIGZpbGwgaXQgaW4uCisgICAgICAgICAqIDwvcD4KKyAgICAgICAgICogPHA+CisgICAgICAgICAqIENsaWVudHMgb2YgdGhpcyBBUEkgc2hvdWxkIG5vdCBzZW5kIHJlcXVlc3RzIGRpcmVjdGx5IHRvIHRoaXMgYXV0aG9yaXR5LgorICAgICAgICAgKiBBbGwgZGlyZWN0b3J5IHJlcXVlc3RzIG11c3QgYmUgcm91dGVkIHRocm91Z2ggQ29udGFjdHMgUHJvdmlkZXIuCisgICAgICAgICAqIDwvcD4KKyAgICAgICAgICoKKyAgICAgICAgICogPHA+VFlQRTogdGV4dDwvcD4KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIERJUkVDVE9SWV9BVVRIT1JJVFkgPSAiYXV0aG9yaXR5IjsKKworICAgICAgICAvKioKKyAgICAgICAgICogVGhlIGFjY291bnQgdHlwZSB3aGljaCB0aGlzIGRpcmVjdG9yeSBpcyBhc3NvY2lhdGVkLgorICAgICAgICAgKgorICAgICAgICAgKiA8cD5UWVBFOiB0ZXh0PC9wPgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgQUNDT1VOVF9UWVBFID0gImFjY291bnRUeXBlIjsKKworICAgICAgICAvKioKKyAgICAgICAgICogVGhlIGFjY291bnQgd2l0aCB3aGljaCB0aGlzIGRpcmVjdG9yeSBpcyBhc3NvY2lhdGVkLiBJZiB0aGUgYWNjb3VudCBpcyBsYXRlcgorICAgICAgICAgKiByZW1vdmVkLCB0aGUgZGlyZWN0b3JpZXMgaXQgb3ducyBhcmUgYXV0b21hdGljYWxseSByZW1vdmVkIGZyb20gdGhpcyB0YWJsZS4KKyAgICAgICAgICoKKyAgICAgICAgICogPHA+VFlQRTogdGV4dDwvcD4KKyAgICAgICAgICovCisgICAg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lmaWNhbnQgZGF0YSBkdXBsaWNhdGlvbgorICAgICAgICAgKiBpbiB0aGUgRW50aXR5IChlYWNoIHJvdyByZXBlYXRzIGFsbCBDb250YWN0IGNvbHVtbnMgYW5kIGFsbCBSYXdDb250YWN0CisgICAgICAgICAqIGNvbHVtbnMpLCBzbyB0aGUgYmVuZWZpdHMgb2YgdHJhbnNhY3Rpb25hbCBjb25zaXN0ZW5jeSBzaG91bGQgYmUgd2VpZ2hlZAorICAgICAgICAgKiBhZ2FpbnN0IHRoZSBjb3N0IG9mIHRyYW5zZmVycmluZyBsYXJnZSBhbW91bnRzIG9mIGRlbm9ybWFsaXplZCBkYXRhCisgICAgICAgICAqIGZyb20gdGhlIFByb3ZpZGVyLgorICAgICAgICAgKiA8L3A+CisgICAgICAgICAqCisgICAgICAgICAqIEBoaWRlCisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGNsYXNzIEVudGl0eSBpbXBsZW1lbnRzIEJhc2VDb2x1bW5zLCBDb250YWN0c0NvbHVtbnMsCisgICAgICAgICAgICAgICAgQ29udGFjdE5hbWVDb2x1bW5zLCBSYXdDb250YWN0c0NvbHVtbnMsIEJhc2VTeW5jQ29sdW1ucywgU3luY0NvbHVtbnMsIERhdGFDb2x1bW5zLAorICAgICAgICAgICAgICAgIFN0YXR1c0NvbHVtbnMsIENvbnRhY3RPcHRpb25zQ29sdW1ucywgQ29udGFjdFN0YXR1c0NvbHVtbnMgeworICAgICAgICAgICAgLyoqCisgICAgICAgICAgICAgKiBubyBwdWJsaWMgY29uc3RydWN0b3Igc2luY2UgdGhpcyBpcyBhIHV0aWxpdHkgY2xhc3MKKyAgICAgICAgICAgICAqLworICAgICAgICAgICAgcHJpdmF0ZSBFbnRpdHkoKSB7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIC8qKgorICAgICAgICAgICAgICogVGhlIGRpcmVjdG9yeSB0d2lnIGZvciB0aGlzIHN1Yi10YWJsZQorICAgICAgICAgICAgICovCisgICAgICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBDT05URU5UX0RJUkVDVE9SWSA9ICJlbnRpdGllcyI7CisKKyAgICAgICAgICAgIC8qKgorICAgICAgICAgICAgICogVGhlIElEIG9mIHRoZSByYXcgY29udGFjdCByb3cuCisgICAgICAgICAgICAgKiA8UD5UeXBlOiBJTlRFR0VSPC9QPgorICAgICAgICAgICAgICovCisgICAgICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBSQVdfQ09OVEFDVF9JRCA9ICJyYXdfY29udGFjdF9pZCI7CisKKyAgICAgICAgICAgIC8qKgorICAgICAgICAgICAgICogVGhlIElEIG9mIHRoZSBkYXRhIHJvdy4gVGhlIHZhbHVlIHdpbGwgYmUgbnVsbCBpZiB0aGlzIHJhdyBjb250YWN0IGhhcyBubworICAgICAgICAgICAgICogZGF0YSByb3dzLgorICAgICAgICAgICAgICogPFA+VHlwZTogSU5URUdFUjwvUD4KKyAgICAgICAgICAgICAqLworICAgICAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgREFUQV9JRCA9ICJkYXRhX2lkIjsKKyAgICAgICAgfQorCisgICAgICAgIC8qKgorICAgICAgICAgKiA8cD4KICAgICAgICAgICogQSA8aT5yZWFkLW9ubHk8L2k+IHN1Yi1kaXJlY3Rvcnkgb2YgYSBzaW5nbGUgY29udGFjdCBhZ2dyZWdhdGUgdGhhdAogICAgICAgICAgKiBjb250YWlucyBhbGwgYWdncmVnYXRpb24gc3VnZ2VzdGlvbnMgKG90aGVyIGNvbnRhY3RzKS4gVGhlCiAgICAgICAgICAqIGFnZ3JlZ2F0aW9uIHN1Z2dlc3Rpb25zIGFyZSBjb21wdXRlZCBiYXNlZCBvbiBhcHByb3hpbWF0ZSBkYXRhCkBAIC0xMDk0LDYgKzE0NDUsMTA2IEBACiAgICAgICAgICAgICAgKiB7QGxpbmsgYW5kcm9pZC5wcm92aWRlci5Db250YWN0c0NvbnRyYWN0LkNvbnRhY3RzI0NPTlRFTlRfRklMVEVSX1VSSX0uCiAgICAgICAgICAgICAgKi8KICAgICAgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIENPTlRFTlRfRElSRUNUT1JZID0gInN1Z2dlc3Rpb25zIjsKKworICAgICAgICAgICAgLyoqCisgICAgICAgICAgICAgKiBVc2VkIHdpdGgge0BsaW5rIEJ1aWxkZXIjYWRkUGFyYW1ldGVyfSB0byBzcGVjaWZ5IHdoYXQga2luZCBvZiBkYXRhIGlzCisgICAgICAgICAgICAgKiBzdXBwbGllZCBmb3IgdGhlIHN1Z2dlc3Rpb24gcXVlcnkuCisgICAgICAgICAgICAgKgorICAgICAgICAgICAgICogQGhpZGUKKyAgICAgICAgICAgICAqLworICAgICAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgUEFSQU1FVEVSX01BVENIX05BTUUgPSAibmFtZSI7CisKKyAgICAgICAgICAgIC8qKgorICAgICAgICAgICAgICogVXNlZCB3aXRoIHtAbGluayBCdWlsZGVyI2FkZFBhcmFtZXRlcn0gdG8gc3BlY2lmeSB3aGF0IGtpbmQgb2YgZGF0YSBpcworICAgICAgICAgICAgICogc3VwcGxpZWQgZm9yIHRoZSBzdWdnZXN0aW9uIHF1ZXJ5LgorICAgICAgICAgICAgICoKKyAgICAgICAgICAgICAqIEBoaWRlCisgICAgICAgICAgICAgKi8KKyAgICAgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIFBBUkFNRVRFUl9NQVRDSF9FTUFJTCA9ICJlbWFpbCI7CisKKyAgICAgICAgICAgIC8qKgorICAgICAgICAgICAgICogVXNlZCB3aXRoIHtAbGluayBCdWlsZGVyI2FkZFBhcmFtZXRlcn0gdG8gc3BlY2lmeSB3aGF0IGtpbmQgb2YgZGF0YSBpcworICAgICAgICAgICAgICogc3VwcGxpZWQgZm9yIHRoZSBzdWdnZXN0aW9uIHF1ZXJ5LgorICAgICAgICAgICAgICoKKyAgICAgICAgICAgICAqIEBoaWRlCisgICAgICAgICAgICAgKi8KKyAgICAgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIFBBUkFNRVRFUl9NQVRDSF9QSE9ORSA9ICJwaG9uZSI7CisKKyAgICAgICAgICAgIC8qKgorICAgICAgICAgICAgICogVXNlZCB3aXRoIHtAbGluayBCdWlsZGVyI2FkZFBhcmFtZXRlcn0gdG8gc3BlY2lmeSB3aGF0IGtpbmQgb2YgZGF0YSBpcworICAgICAgICAgICAgICogc3VwcGxpZWQgZm9yIHRoZSBzdWdnZXN0aW9uIHF1ZXJ5LgorICAgICAgICAgICAgICoKKyAgICAgICAgICAgICAqIEBoaWRlCisgICAgICAgICAgICAgKi8KKyAgICAgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIFBBUkFNRVRFUl9NQVRDSF9OSUNLTkFNRSA9ICJuaWNrbmFtZSI7CisKKyAgICAgICAgICAgIC8qKgorICAgICAgICAgICAgICogQSBjb252ZW5pZW5jZSBidWlsZGVyIGZvciBhZ2dyZWdhdGlvbiBzdWdnZXN0aW9uIGNvbnRlbnQgVVJJcy4KKyAgICAgICAgICAgICAqCisgICAgICAgICAgICAgKiBUT0RPOiBjaGFuZ2UgZG9jdW1lbnRhdGlvbiBmb3IgdGhpcyBjbGFzcyB0byB1c2UgdGhlIGJ1aWxkZXIuCisgICAgICAgICAgICAgKiBAaGlkZQorICAgICAgICAgICAgICovCisgICAgICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGNsYXNzIEJ1aWxkZXIgeworICAgICAgICAgICAgICAgIHByaXZhdGUgbG9uZyBtQ29udGFjdElkOworICAgICAgICAgICAgICAgIHByaXZhdGUgQXJyYXlMaXN0PFN0cmluZz4gbUtpbmRzID0gbmV3IEFycmF5TGlzdDxTdHJpbmc+KCk7CisgICAgICAgICAgICAgICAgcHJpdmF0ZSBBcnJheUxpc3Q8U3RyaW5nPiBtVmFsdWVzID0gbmV3IEFycmF5TGlzdDxTdHJpbmc+KCk7CisgICAgICAgICAgICAgICAgcHJpdmF0ZSBpbnQgbUxpbWl0OworCisgICAgICAgICAgICAgICAgLyoqCisgICAgICAgICAgICAgICAgICogT3B0aW9uYWwgZXhpc3RpbmcgY29udGFjdCBJRC4gIElmIGl0IGlzIG5vdCBwcm92aWRlZCwgdGhlIHNlYXJjaAorICAgICAgICAgICAgICAgICAqIHdpbGwgYmUgYmFzZWQgZXhjbHVzaXZlbHkgb24gdGhlIHZhbHVlcyBzdXBwbGllZCB3aXRoIHtAbGluayAjYWRkUGFyYW1ldGVyfS4KKyAgICAgICAgICAgICAgICAgKi8KKyAgICAgICAgICAgICAgICBwdWJsaWMgQnVpbGRlciBzZXRDb250YWN0SWQobG9uZyBjb250YWN0SWQpIHsKKyAgICAgICAgICAgICAgICAgICAgdGhpcy5tQ29udGFjdElkID0gY29udGFjdElkOworICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpczsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAvKioKKyAgICAgICAgICAgICAgICAgKiBBIHZhbHVlIHRoYXQgY2FuIGJlIHVzZWQgd2hlbiBzZWFyY2hpbmcgZm9yIGFuIGFnZ3JlZ2F0aW9uCisgICAgICAgICAgICAgICAgICogc3VnZ2VzdGlvbi4KKyAgICAgICAgICAgICAgICAgKgorICAgICAgICAgICAgICAgICAqIEBwYXJhbSBraW5kIGNhbiBiZSBvbmUgb2YKKyAgICAgICAgICAgICAgICAgKiAgICAgICAgICAgIHtAbGluayBBZ2dyZWdhdGlvblN1Z2dlc3Rpb25zI1BBUkFNRVRFUl9NQVRDSF9OQU1FfSwKKyAgICAgICAgICAgICAgICAgKiAgICAgICAgICAgIHtAbGluayBBZ2dyZWdhdGlvblN1Z2dlc3Rpb25zI1BBUkFNRVRFUl9NQVRDSF9FTUFJTH0sCisgICAgICAgICAgICAgICAgICogICAgICAgICAgICB7QGxpbmsgQWdncmVnYXRpb25TdWdnZXN0aW9ucyNQQVJBTUVURVJfTUFUQ0hfTklDS05BTUV9LAorICAgICAgICAgICAgICAgICAqICAgICAgICAgICAge0BsaW5rIEFnZ3JlZ2F0aW9uU3VnZ2VzdGlvbnMjUEFSQU1FVEVSX01BVENIX1BIT05FfQorICAgICAgICAgICAgICAgICAqLworICAgICAgICAgICAgICAgIHB1YmxpYyBCdWlsZGVyIGFkZFBhcmFtZXRlcihTdHJpbmcga2luZCwgU3RyaW5nIHZhbHVlKSB7CisgICAgICAgICAgICAgICAgICAgIGlmICghVGV4dFV0aWxzLmlzRW1wdHkodmFsdWUpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBtS2luZHMuYWRkKGtpbmQpOworICAgICAgICAgICAgICAgICAgICAgICAgbVZhbHVlcy5hZGQodmFsdWUpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIHB1YmxpYyBCdWlsZGVyIHNldExpbWl0KGludCBsaW1pdCkgeworICAgICAgICAgICAgICAgICAgICBtTGltaXQgPSBsaW1pdDsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXM7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgcHVibGljIFVyaSBidWlsZCgpIHsKKyAgICAgICAgICAgICAgICAgICAgYW5kcm9pZC5uZXQuVXJpLkJ1aWxkZXIgYnVpbGRlciA9IENvbnRhY3RzLkNPTlRFTlRfVVJJLmJ1aWxkVXBvbigpOworICAgICAgICAgICAgICAgICAgICBidWlsZGVyLmFwcGVuZEVuY29kZWRQYXRoKFN0cmluZy52YWx1ZU9mKG1Db250YWN0SWQpKTsKKyAgICAgICAgICAgICAgICAgICAgYnVpbGRlci5hcHBlbmRQYXRoKENvbnRhY3RzLkFnZ3JlZ2F0aW9uU3VnZ2VzdGlvbnMuQ09OVEVOVF9ESVJFQ1RPUlkpOworICAgICAgICAgICAgICAgICAgICBpZiAobUxpbWl0ICE9IDApIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJ1aWxkZXIuYXBwZW5kUXVlcnlQYXJhbWV0ZXIoImxpbWl0IiwgU3RyaW5nLnZhbHVlT2YobUxpbWl0KSk7CisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICBpbnQgY291bnQgPSBtS2luZHMuc2l6ZSgpOworICAgICAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGNvdW50OyBpKyspIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJ1aWxkZXIuYXBwZW5kUXVlcnlQYXJhbWV0ZXIoInF1ZXJ5IiwgbUtpbmRzLmdldChpKSArICI6IiArIG1WYWx1ZXMuZ2V0KGkpKTsKKyAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgIHJldHVybiBidWlsZGVyLmJ1aWxkKCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorCisgICAgICAgICAgICAvKioKKyAgICAgICAgICAgICAqIEBoaWRlCisgICAgICAgICAgICAgKi8KKyAgICAgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgQnVpbGRlciBidWlsZGVyKCkgeworICAgICAgICAgICAgICAgIHJldHVybiBuZXcgQnVpbGRlcigpOworICAgICAgICAgICAgfQogICAgICAgICB9CiAKICAgICAgICAgLyoqCkBAIC0xMTQ3LDcgKzE1OTgsNiBAQAogICAgICAgICAgICAgICogdGhhdCBjb3VsZCBiZSBpbmZsYXRlZCB1c2luZyB7QGxpbmsgYW5kcm9pZC5ncmFwaGljcy5CaXRtYXBGYWN0b3J5fS4KICAgICAgICAgICAgICAqIDxwPgogICAgICAgICAgICAgICogVHlwZTogQkxPQgotICAgICAgICAgICAgICogQGhpZGUgVE9ETzogVW5oaWRlIGluIGEgc2VwYXJhdGUgQ0wKICAgICAgICAgICAgICAqLwogICAgICAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgUEhPVE8gPSBEQVRBMTU7CiAgICAgICAgIH0KQEAgLTEyNDQsNiArMTY5NCwxMyBAQAogICAgICAgICAgKiBAaGlkZQogICAgICAgICAgKi8KICAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgTkFNRV9WRVJJRklFRCA9ICJuYW1lX3ZlcmlmaWVkIjsKKworICAgICAgICAvKioKKyAgICAgICAgICogVGhlICJyZWFkLW9ubHkiIGZsYWc6ICIwIiBieSBkZWZhdWx0LCAiMSIgaWYgdGhlIHJvdyBjYW5ub3QgYmUgbW9kaWZpZWQgb3IKKyAgICAgICAgICogZGVsZXRlZCBleGNlcHQgYnkgYSBzeW5jIGFkYXB0ZXIuICBTZWUge0BsaW5rIENvbnRhY3RzQ29udHJhY3QjQ0FMTEVSX0lTX1NZTkNBREFQVEVSfS4KKyAgICAgICAgICogPFA+VHlwZTogSU5URUdFUjwvUD4KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIFJBV19DT05UQUNUX0lTX1JFQURfT05MWSA9ICJyYXdfY29udGFjdF9pc19yZWFkX29ubHkiOwogICAgIH0KIAogICAgIC8qKgpAQCAtMTc1MSw3ICsyMjA4LDcgQEAKICAgICAgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIENPTlRFTlRfRElSRUNUT1JZID0gImVudGl0eSI7CiAKICAgICAgICAgICAgIC8qKgotICAgICAgICAgICAgICogVGhlIElEIG9mIHRoZSBkYXRhIGNvbHVtbi4gVGhlIHZhbHVlIHdpbGwgYmUgbnVsbCBpZiB0aGlzIHJhdyBjb250YWN0IGhhcyBubworICAgICAgICAgICAgICogVGhlIElEIG9mIHRoZSBkYXRhIHJvdy4gVGhlIHZhbHVlIHdpbGwgYmUgbnVsbCBpZiB0aGlzIHJhdyBjb250YWN0IGhhcyBubwogICAgICAgICAgICAgICogZGF0YSByb3dzLgogICAgICAgICAgICAgICogPFA+VHlwZTogSU5URUdFUjwvUD4KICAgICAgICAgICAgICAqLwpAQCAtMTgzOSwyOCArMjI5NiwyMSBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIERhdGEuREFUQV9WRVJTSU9OKTsKICAgICAgICAgICAgICAgICAgICAgZm9yIChTdHJpbmcga2V5IDogREFUQV9LRVlTKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBmaW5hbCBpbnQgY29sdW1uSW5kZXggPSBjdXJzb3IuZ2V0Q29sdW1uSW5kZXhPclRocm93KGtleSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoY3Vyc29yLmlzTnVsbChjb2x1bW5JbmRleCkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBkb24ndCBwdXQgYW55dGhpbmcKLSAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoY3Vyc29yLmdldFR5cGUoY29sdW1uSW5kZXgpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBDdXJzb3IuRklFTERfVFlQRV9OVUxMOgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBkb24ndCBwdXQgYW55dGhpbmcKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBDdXJzb3IuRklFTERfVFlQRV9JTlRFR0VSOgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgQ3Vyc29yLkZJRUxEX1RZUEVfRkxPQVQ6CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBDdXJzb3IuRklFTERfVFlQRV9TVFJJTkc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN2LnB1dChrZXksIGN1cnNvci5nZXRTdHJpbmcoY29sdW1uSW5kZXgpKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChTUUxpdGVFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIEN1cnNvci5GSUVMRF9UWVBFX0JMT0I6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN2LnB1dChrZXksIGN1cnNvci5nZXRCbG9iKGNvbHVtbkluZGV4KSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJJbnZhbGlkIG9yIHVuaGFuZGxlZCBkYXRhIHR5cGUiKTsKICAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgIC8vIFRPRE86IGdvIGJhY2sgdG8gdGhpcyB2ZXJzaW9uIG9mIHRoZSBjb2RlIHdoZW4gYnVnCi0gICAgICAgICAgICAgICAgICAgICAgICAvLyBodHRwOi8vYi9pc3N1ZT9pZD0yMzA2MzcwIGlzIGZpeGVkLgotLy8gICAgICAgICAgICAgICAgICAgICAgICBpZiAoY3Vyc29yLmlzTnVsbChjb2x1bW5JbmRleCkpIHsKLS8vICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGRvbid0IHB1dCBhbnl0aGluZwotLy8gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGN1cnNvci5pc0xvbmcoY29sdW1uSW5kZXgpKSB7Ci0vLyAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXMucHV0KGtleSwgY3Vyc29yLmdldExvbmcoY29sdW1uSW5kZXgpKTsKLS8vICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChjdXJzb3IuaXNGbG9hdChjb2x1bW5JbmRleCkpIHsKLS8vICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlcy5wdXQoa2V5LCBjdXJzb3IuZ2V0RmxvYXQoY29sdW1uSW5kZXgpKTsKLS8vICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChjdXJzb3IuaXNTdHJpbmcoY29sdW1uSW5kZXgpKSB7Ci0vLyAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXMucHV0KGtleSwgY3Vyc29yLmdldFN0cmluZyhjb2x1bW5JbmRleCkpOwotLy8gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGN1cnNvci5pc0Jsb2IoY29sdW1uSW5kZXgpKSB7Ci0vLyAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXMucHV0KGtleSwgY3Vyc29yLmdldEJsb2IoY29sdW1uSW5kZXgpKTsKLS8vICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgIGNvbnRhY3QuYWRkU3ViVmFsdWUoQ29udGFjdHNDb250cmFjdC5EYXRhLkNPTlRFTlRfVVJJLCBjdik7CiAgICAgICAgICAgICAgICAgfSB3aGlsZSAoY3Vyc29yLm1vdmVUb05leHQoKSk7CkBAIC0xOTY1LDE4ICsyNDE1LDE5IEBACiAgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIENIQVRfQ0FQQUJJTElUWSA9ICJjaGF0X2NhcGFiaWxpdHkiOwogCiAgICAgICAgIC8qKgotICAgICAgICAgKiBBbiBhbGxvd2VkIHZhbHVlIG9mIHtAbGluayAjQ0hBVF9DQVBBQklMSVRZfS4gSW5kaWNhdGVzIHRoYXQgdGhlIGNvbnRhY3QncyBkZXZpY2UgY2FuCisgICAgICAgICAqIEFuIGFsbG93ZWQ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kBAIC0zMTI4LDEwICszNTg2LDExIEBACiAgICAgICogPHRkPmludDwvdGQ+CiAgICAgICogPHRkPntAbGluayAjQ0hBVF9DQVBBQklMSVRZfTwvdGQ+CiAgICAgICogPHRkPnJlYWQvd3JpdGU8L3RkPgotICAgICAqIDx0ZD5Db250YWN0IElNIGNoYXQgY29tcGF0aWJpbGl0eSB2YWx1ZS4gVGhlIGFsbG93ZWQgdmFsdWVzIGFyZToKKyAgICAgKiA8dGQ+Q29udGFjdCBJTSBjaGF0IGNvbXBhdGliaWxpdHkgdmFsdWUuIFRoZSBhbGxvd2VkIHZhbHVlcyBjb21iaW5hdGlvbnMgb2YgdGhlIGZvbGxvd2luZworICAgICAqIGZsYWdzLiBJZiBOb25lIG9mIHRoZXNlIGZsYWdzIGlzIHNldCwgdGhlIGRldmljZSBjYW4gb25seSBkbyB0ZXh0IG1lc3NhZ2luZy4KICAgICAgKiA8cD4KICAgICAgKiA8dWw+Ci0gICAgICogPGxpPntAbGluayAjQ0FQQUJJTElUWV9IQVNfVklERU9fUExBWUJBQ0tfT05MWX08L2xpPgorICAgICAqIDxsaT57QGxpbmsgI0NBUEFCSUxJVFlfSEFTX1ZJREVPfTwvbGk+CiAgICAgICogPGxpPntAbGluayAjQ0FQQUJJTElUWV9IQVNfVk9JQ0V9PC9saT4KICAgICAgKiA8bGk+e0BsaW5rICNDQVBBQklMSVRZX0hBU19DQU1FUkF9PC9saT4KICAgICAgKiA8L3VsPgpAQCAtMzg3OSw3ICs0MzM4LDYgQEAKICAgICAgICAgICAgIC8qKgogICAgICAgICAgICAgICogVGhlIGVtYWlsIGFkZHJlc3MuCiAgICAgICAgICAgICAgKiA8UD5UeXBlOiBURVhUPC9QPgotICAgICAgICAgICAgICogQGhpZGUgVE9ETzogVW5oaWRlIGluIGEgc2VwYXJhdGUgQ0wKICAgICAgICAgICAgICAqLwogICAgICAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgQUREUkVTUyA9IERBVEExOwogCkBAIC00OTUxLDYgKzU0MDksMjMgQEAKICAgICAgICAgICogVHlwZTogSU5URUdFUiAoYm9vbGVhbikKICAgICAgICAgICovCiAgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIFNIT1VMRF9TWU5DID0gInNob3VsZF9zeW5jIjsKKworICAgICAgICAvKioKKyAgICAgICAgICogQW55IG5ld2x5IGNyZWF0ZWQgY29udGFjdHMgd2lsbCBhdXRvbWF0aWNhbGx5IGJlIGFkZGVkIHRvIGdyb3VwcyB0aGF0IGhhdmUgdGhpcworICAgICAgICAgKiBmbGFnIHNldCB0byB0cnVlLgorICAgICAgICAgKiA8cD4KKyAgICAgICAgICogVHlwZTogSU5URUdFUiAoYm9vbGVhbikKKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIEFVVE9fQUREID0gImF1dG9fYWRkIjsKKworICAgICAgICAvKioKKyAgICAgICAgICogV2hlbiBhIGNvbnRhY3RzIGlzIG1hcmtlZCBhcyBhIGZhdm9yaXRlcyBpdCB3aWxsIGJlIGF1dG9tYXRpY2FsbHkgYWRkZWQKKyAgICAgICAgICogdG8gdGhlIGdyb3VwcyB0aGF0IGhhdmUgdGhpcyBmbGFnIHNldCwgYW5kIHdoZW4gaXQgaXMgcmVtb3ZlZCBmcm9tIGZhdm9yaXRlcworICAgICAgICAgKiBpdCB3aWxsIGJlIHJlbW92ZWQgZnJvbSB0aGVzZSBncm91cHMuCisgICAgICAgICAqIDxwPgorICAgICAgICAgKiBUeXBlOiBJTlRFR0VSIChib29sZWFuKQorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgRkFWT1JJVEVTID0gImZhdm9yaXRlcyI7CiAgICAgfQogCiAgICAgLyoqCkBAIC01MDkxLDYgKzU1NjYsOCBAQAogICAgICAgICAgICAgICAgIERhdGFiYXNlVXRpbHMuY3Vyc29yTG9uZ1RvQ29udGVudFZhbHVlc0lmUHJlc2VudChjdXJzb3IsIHZhbHVlcywgREVMRVRFRCk7CiAgICAgICAgICAgICAgICAgRGF0YWJhc2VVdGlscy5jdXJzb3JTdHJpbmdUb0NvbnRlbnRWYWx1ZXNJZlByZXNlbnQoY3Vyc29yLCB2YWx1ZXMsIE5PVEVTKTsKICAgICAgICAgICAgICAgICBEYXRhYmFzZVV0aWxzLmN1cnNvclN0cmluZ1RvQ29udGVudFZhbHVlc0lmUHJlc2VudChjdXJzb3IsIHZhbHVlcywgU0hPVUxEX1NZTkMpOworICAgICAgICAgICAgICAgIERhdGFiYXNlVXRpbHMuY3Vyc29yU3RyaW5nVG9Db250ZW50VmFsdWVzSWZQcmVzZW50KGN1cnNvciwgdmFsdWVzLCBGQVZPUklURVMpOworICAgICAgICAgICAgICAgIERhdGFiYXNlVXRpbHMuY3Vyc29yU3RyaW5nVG9Db250ZW50VmFsdWVzSWZQcmVzZW50KGN1cnNvciwgdmFsdWVzLCBBVVRPX0FERCk7CiAgICAgICAgICAgICAgICAgY3Vyc29yLm1vdmVUb05leHQoKTsKICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IEVudGl0eSh2YWx1ZXMpOwogICAgICAgICAgICAgfQpAQCAtNTYwNyw2ICs2MDg0LDI4IEBACiAgICAgICAgICAgICAgICAgImNvbS5hbmRyb2lkLmNvbnRhY3RzLmFjdGlvbi5TSE9XX09SX0NSRUFURV9DT05UQUNUIjsKIAogICAgICAgICAvKioKKyAgICAgICAgICogU3RhcnRzIGFuIEFjdGl2aXR5IHRoYXQgbGV0cyB0aGUgdXNlciBzZWxlY3QgdGhlIG11bHRpcGxlIHBob25lcyBmcm9tIGEKKyAgICAgICAgICogbGlzdCBvZiBwaG9uZSBudW1iZXJzIHdoaWNoIGNvbWUgZnJvbSB0aGUgY29udGFjdHMgb3IKKyAgICAgICAgICoge0BsaW5rICNFWFRSQV9QSE9ORV9VUklTfS4KKyAgICAgICAgICogPHA+CisgICAgICAgICAqIFRoZSBwaG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3QgdGFibGUgY29ycmVzcG9uZGluZyB0byB0aGlzIG1lZGlhIGZpbGUuCisgICAgICAgICAqIDxQPlR5cGU6IElOVEVHRVI8L1A+CisgICAgICAgICAqIEBoaWRlCisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBNVFBfT0JKRUNUX0lEID0gIm9iamVjdF9pZCI7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFRoZSBNVFAgb2JqZWN0IGhhbmRsZSBvZiBhIG5ld2x5IHRyYW5zZmVyZWQgZmlsZS4KKyAgICAgICAgICogVXNlZCB0byBwYXNzIHRoZSBuZXcgZmlsZSdzIG9iamVjdCBoYW5kbGUgdGhyb3VnaCB0aGUgbWVkaWEgc2Nhbm5lcgorICAgICAgICAgKiBmcm9tIE1UUCB0byB0aGUgbWVkaWEgcHJvdmlkZXIKKyAgICAgICAgICogRm9yIGludGVybmFsIHVzZSBvbmx5IGJ5IE1UUCwgbWVkaWEgc2Nhbm5lciBhbmQgbWVkaWEgcHJvdmlkZXIuCisgICAgICAgICAqIDxQPlR5cGU6IElOVEVHRVI8L1A+CisgICAgICAgICAqIEBoaWRlCisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBNRURJQV9TQ0FOTkVSX05FV19PQkpFQ1RfSUQgPSAibWVkaWFfc2Nhbm5lcl9uZXdfb2JqZWN0X2lkIjsKICAgICAgfQogCiAgICAgLyoqCisgICAgICogTWVkaWEgcHJvdmlkZXIgaW50ZXJmYWNlIHVzZWQgYnkgTVRQIGltcGxlbWVudGF0aW9uLgorICAgICAqIEBoaWRlCisgICAgICovCisgICAgcHVibGljIHN0YXRpYyBmaW5hbCBjbGFzcyBNdHBPYmplY3RzIHsKKworICAgICAgICBwdWJsaWMgc3RhdGljIFVyaSBnZXRDb250ZW50VXJpKFN0cmluZyB2b2x1bWVOYW1lKSB7CisgICAgICAgICAgICByZXR1cm4gVXJpLnBhcnNlKENPTlRFTlRfQVVUSE9SSVRZX1NMQVNIICsgdm9sdW1lTmFtZSArCisgICAgICAgICAgICAgICAgICAgICIvb2JqZWN0Iik7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFVyaSBnZXRDb250ZW50VXJpKFN0cmluZyB2b2x1bWVOYW1lLAorICAgICAgICAgICAgICAgIGxvbmcgb2JqZWN0SWQpIHsKKyAgICAgICAgICAgIHJldHVybiBVcmkucGFyc2UoQ09OVEVOVF9BVVRIT1JJVFlfU0xBU0ggKyB2b2x1bWVOYW1lCisgICAgICAgICAgICAgICAgICAgICsgIi9vYmplY3QvIiArIG9iamVjdElkKTsKKyAgICAgICAgfQorCisgICAgICAgIC8vIHVzZWQgZm9yIE1UUCBHZXRPYmplY3RSZWZlcmVuY2VzIGFuZCBTZXRPYmplY3RSZWZlcmVuY2VzCisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgVXJpIGdldFJlZmVyZW5jZXNVcmkoU3RyaW5nIHZvbHVtZU5hbWUsCisgICAgICAgICAgICAgICAgbG9uZyBvYmplY3RJZCkgeworICAgICAgICAgICAgcmV0dXJuIFVyaS5wYXJzZShDT05URU5UX0FVVEhPUklUWV9TTEFTSCArIHZvbHVtZU5hbWUKKyAgICAgICAgICAgICAgICAgICAgKyAiL29iamVjdC8iICsgb2JqZWN0SWQgKyAiL3JlZmVyZW5jZXMiKTsKKyAgICAgICAgfQorCisgICAgICAgIC8qKgorICAgICAgICAgKiBGaWVsZHMgZm9yIG1hc3RlciB0YWJsZSBmb3IgYWxsIG1lZGlhIGZpbGVzLgorICAgICAgICAgKiBUYWJsZSBhbHNvIGNvbnRhaW5zIE1lZGlhQ29sdW1ucy5fSUQsIERBVEEsIFNJWkUgYW5kIERBVEVfTU9ESUZJRUQuCisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgaW50ZXJmYWNlIE9iamVjdENvbHVtbnMgZXh0ZW5kcyBNZWRpYUNvbHVtbnMgeworICAgICAgICAgICAgLyoqCisgICAgICAgICAgICAgKiBUaGUgTVRQIGZvcm1hdCBjb2RlIG9mIHRoZSBmaWxlCisgICAgICAgICAgICAgKiA8UD5UeXBlOiBJTlRFR0VSPC9QPgorICAgICAgICAgICAgICovCisgICAgICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBGT1JNQVQgPSAiZm9ybWF0IjsKKworICAgICAgICAgICAgLyoqCisgICAgICAgICAgICAgKiBUaGUgaW5kZXggb2YgdGhlIHBhcmVudCBkaXJlY3Rvcnkgb2YgdGhlIGZpbGUKKyAgICAgICAgICAgICAqIDxQPlR5cGU6IElOVEVHRVI8L1A+CisgICAgICAgICAgICAgKi8KKyAgICAgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIFBBUkVOVCA9ICJwYXJlbnQiOworCisgICAgICAgICAgICAvKioKKyAgICAgICAgICAgICAqIElkZW50aWZpZXIgZm9yIHRoZSBtZWRpYSB0YWJsZSBjb250YWluaW5nIHRoZSBvYmplY3QuCisgICAgICAgICAgICAgKiBVc2VkIGludGVybmFsbHkgYnkgTWVkaWFQcm92aWRlcgorICAgICAgICAgICAgICogPFA+VHlwZTogSU5URUdFUjwvUD4KKyAgICAgICAgICAgICAqLworICAgICAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgTUVESUFfVEFCTEUgPSAibWVkaWFfdGFibGUiOworCisgICAgICAgICAgICAvKioKKyAgICAgICAgICAgICAqIFRoZSBJRCBvZiB0aGUgb2JqZWN0IGluIGl0cyBtZWRpYSB0YWJsZS4KKyAgICAgICAgICAgICAqIDxQPlR5cGU6IElOVEVHRVI8L1A+CisgICAgICAgICAgICAgKi8KKyAgICAgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIE1FRElBX0lEID0gIm1lZGlhX2lkIjsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgogICAgICAqIFRoaXMgY2xhc3MgaXMg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uZ3RoKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChiaXRtYXAgPT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIExvZy53KFRBRywgImNvdWxkbid0IGRlY29kZSBieXRlIGFycmF5LiIpOworICAgICAgICAgICAgTWluaVRodW1iRmlsZSB0aHVtYkZpbGUgPSBuZXcgTWluaVRodW1iRmlsZShpc1ZpZGVvID8gVmlkZW8uTWVkaWEuRVhURVJOQUxfQ09OVEVOVF9VUkkKKyAgICAgICAgICAgICAgICAgICAgOiBJbWFnZXMuTWVkaWEuRVhURVJOQUxfQ09OVEVOVF9VUkkpOworICAgICAgICAgICAgQ3Vyc29yIGMgPSBudWxsOworICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICBsb25nIG1hZ2ljID0gdGh1bWJGaWxlLmdldE1hZ2ljKG9yaWdJZCk7CisgICAgICAgICAgICAgICAgaWYgKG1hZ2ljICE9IDApIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGtpbmQgPT0gTUlDUk9fS0lORCkgeworICAgICAgICAgICAgICAgICAgICAgICAgYnl0ZVtdIGRhdGEgPSBuZXcgYnl0ZVtNaW5pVGh1bWJGaWxlLkJZVEVTX1BFUl9NSU5USFVNQl07CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAodGh1bWJGaWxlLmdldE1pbmlUaHVtYkZyb21GaWxlKG9yaWdJZCwgZGF0YSkgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJpdG1hcCA9IEJpdG1hcEZhY3RvcnkuZGVjb2RlQnl0ZUFycmF5KGRhdGEsIDAsIGRhdGEubGVuZ3RoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYml0bWFwID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTG9nLncoVEFHLCAiY291bGRuJ3QgZGVjb2RlIGJ5dGUgYXJyYXkuIik7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybiBiaXRtYXA7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChraW5kID09IE1JTklfS0lORCkgewotICAgICAgICAgICAgICAgICAgICBTdHJpbmcgY29sdW1uID0gaXNWaWRlbyA/ICJ2aWRlb19pZD0iIDogImltYWdlX2lkPSI7Ci0gICAgICAgICAgICAgICAgICAgIEN1cnNvciBjID0gbnVsbDsKLSAgICAgICAgICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBiaXRtYXA7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoa2luZCA9PSBNSU5JX0tJTkQpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIFN0cmluZyBjb2x1bW4gPSBpc1ZpZGVvID8gInZpZGVvX2lkPSIgOiAiaW1hZ2VfaWQ9IjsKICAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBjci5xdWVyeShiYXNlVXJpLCBQUk9KRUNUSU9OLCBjb2x1bW4gKyBvcmlnSWQsIG51bGwsIG51bGwpOwogICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGMgIT0gbnVsbCAmJiBjLm1vdmVUb0ZpcnN0KCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiaXRtYXAgPSBnZXRNaW5pVGh1bWJGcm9tRmlsZShjLCBiYXNlVXJpLCBjciwgb3B0aW9ucyk7CkBAIC0zNDAsMTcgKzQxNCwxMyBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYml0bWFwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjICE9IG51bGwpIGMuY2xvc2UoKTsKICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KIAotICAgICAgICAgICAgQ3Vyc29yIGMgPSBudWxsOwotICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICBVcmkgYmxvY2tpbmdVcmkgPSBiYXNlVXJpLmJ1aWxkVXBvbigpLmFwcGVuZFF1ZXJ5UGFyYW1ldGVyKCJibG9ja2luZyIsICIxIikKICAgICAgICAgICAgICAgICAgICAgICAgIC5hcHBlbmRRdWVyeVBhcmFtZXRlcigib3JpZ19pZCIsIFN0cmluZy52YWx1ZU9mKG9yaWdJZCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAuYXBwZW5kUXVlcnlQYXJhbWV0ZXIoImdyb3VwX2lkIiwgU3RyaW5nLnZhbHVlT2YoZ3JvdXBJZCkpLmJ1aWxkKCk7CisgICAgICAgICAgICAgICAgaWYgKGMgIT0gbnVsbCkgYy5jbG9zZSgpOwogICAgICAgICAgICAgICAgIGMgPSBjci5xdWVyeShibG9ja2luZ1VyaSwgUFJPSkVDVElPTiwgbnVsbCwgbnVsbCwgbnVsbCk7CiAgICAgICAgICAgICAgICAgLy8gVGhpcyBoYXBwZW5zIHdoZW4gb3JpZ2luYWwgaW1hZ2UvdmlkZW8gZG9lc24ndCBleGlzdC4KICAgICAgICAgICAgICAgICBpZiAoYyA9PSBudWxsKSByZXR1cm4gbnVsbDsKQEAgLTM5Nyw2ICs0NjcsOSBAQAogICAgICAgICAgICAgICAgIExvZy53KFRBRywgZXgpOwogICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgICBpZiAoYyAhPSBudWxsKSBjLmNsb3NlKCk7CisgICAgICAgICAgICAgICAgLy8gVG8gYXZvaWQgZmlsZSBkZXNjcmlwdG9yIGxlYWsgaW4gYXBwbGljYXRpb24gcHJvY2Vzcy4KKyAgICAgICAgICAgICAgICB0aHVtYkZpbGUuZGV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pIENPTlRFTlRfVVJJID0gVXJpLnBhcnNlKENPTlRFTlRfQVVUSE9SSVRZX1NMQVNIICsgImRldmljZSIpOworCisgICAgICAgIHB1YmxpYyBzdGF0aWMgVXJpIGdldENvbnRlbnRVcmkoaW50IGRldmljZUlEKSB7CisgICAgICAgICAgICByZXR1cm4gVXJpLnBhcnNlKENPTlRFTlRfQVVUSE9SSVRZX0RFVklDRV9TTEFTSCArIGRldmljZUlEKTsKKyAgICAgICAgfQorCisgICAgICAgIC8qKgorICAgICAgICAgKiBUaGUgbWFudWZhY3R1cmVyIG9mIHRoZSBkZXZpY2UKKyAgICAgICAgICogPFA+VHlwZTogVEVYVDwvUD4KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIE1BTlVGQUNUVVJFUiA9ICJtYW51ZmFjdHVyZXIiOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBUaGUgbW9kZWwgbmFtZSBvZiB0aGUgZGV2aWNlCisgICAgICAgICAqIDxQPlR5cGU6IFRFWFQ8L1A+CisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBNT0RFTCA9ICJtb2RlbCI7CisgICAgfQorCisgICAgLyoqCisgICAgICogQ29udGFpbnMgbGlzdCBvZiBzdG9yYWdlIHVuaXRzIGZvciBhbiBNVFAvUFRQIGRldmljZQorICAgICAqLworICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgY2xhc3MgU3RvcmFnZSBpbXBsZW1lbnRzIEJhc2VDb2x1bW5zIHsKKworICAgICAgICBwdWJsaWMgc3RhdGljIFVyaSBnZXRDb250ZW50VXJpKGludCBkZXZpY2VJRCkgeworICAgICAgICAgICAgcmV0dXJuIFVyaS5wYXJzZShDT05URU5UX0FVVEhPUklUWV9ERVZJQ0VfU0xBU0ggKyBkZXZpY2VJRCArICIvc3RvcmFnZSIpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHN0YXRpYyBVcmkgZ2V0Q29udGVudFVyaShpbnQgZGV2aWNlSUQsIGludCBzdG9yYWdlSUQpIHsKKyAgICAgICAgICAgIHJldHVybiBVcmkucGFyc2UoQ09OVEVOVF9BVVRIT1JJVFlfREVWSUNFX1NMQVNIICsgZGV2aWNlSUQgKyAiL3N0b3JhZ2UvIiArIHN0b3JhZ2VJRCk7CisgICAgICAgIH0KKworICAgICAgICAvKioKKyAgICAgICAgICogU3RvcmFnZSB1bml0IGlkZW50aWZpZXIKKyAgICAgICAgICogPFA+VHlwZTogVEVYVDwvUD4KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIElERU5USUZJRVIgPSAiaWRlbnRpZmllciI7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFN0b3JhZ2UgdW5pdCBkZXNjcmlwdGlvbgorICAgICAgICAgKiA8UD5UeXBlOiBURVhUPC9QPgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgREVTQ1JJUFRJT04gPSAiZGVzY3JpcHRpb24iOworICAgIH0KKworICAgIC8qKgorICAgICAqIENvbnRhaW5zIGxpc3Qgb2Ygb2JqZWN0cyBvbiBhbiBNVFAvUFRQIGRldmljZQorICAgICAqLworICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgY2xhc3MgT2JqZWN0IGltcGxlbWVudHMgQmFzZUNvbHVtbnMgeworCisgICAgICAgIHB1YmxpYyBzdGF0aWMgVXJpIGdldENvbnRlbnRVcmkoaW50IGRldmljZUlELCBpbnQgb2JqZWN0SUQpIHsKKyAgICAgICAgICAgIHJldHVybiBVcmkucGFyc2UoQ09OVEVOVF9BVVRIT1JJVFlfREVWSUNFX1NMQVNIICsgZGV2aWNlSUQKKyAgICAgICAgICAgICAgICAgICAgKyAiL29iamVjdC8iICsgb2JqZWN0SUQpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHN0YXRpYyBVcmkgZ2V0Q29udGVudFVyaUZvck9iamVjdENoaWxkcmVuKGludCBkZXZpY2VJRCwgaW50IG9iamVjdElEKSB7CisgICAgICAgICAgICByZXR1cm4gVXJpLnBhcnNlKENPTlRFTlRfQVVUSE9SSVRZX0RFVklDRV9TTEFTSCArIGRldmljZUlECisgICAgICAgICAgICAgICAgICAgICsgIi9vYmplY3QvIiArIG9iamVjdElEICsgIi9jaGlsZCIpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHN0YXRpYyBVcmkgZ2V0Q29udGVudFVyaUZvclN0b3JhZ2VDaGlsZHJlbihpbnQgZGV2aWNlSUQsIGludCBzdG9yYWdlSUQpIHsKKyAgICAgICAgICAgIHJldHVybiBVcmkucGFyc2UoQ09OVEVOVF9BVVRIT1JJVFlfREVWSUNFX1NMQVNIICsgZGV2aWNlSUQKKyAgICAgICAgICAgICAgICAgICAgKyAiL3N0b3JhZ2UvIiArIHN0b3JhZ2VJRCArICIvY2hpbGQiKTsKKyAgICAgICAgfQorCisgICAgICAgIC8qKgorICAgICAgICAgKiBUaGUgZm9sbG93aW5nIGNvbHVtbnMgY29ycmVzcG9uZCB0byB0aGUgZmllbGRzIGluIHRoZSBPYmplY3RJbmZvIGRhdGFzZXQKKyAgICAgICAgICogYXMgZGVzY3JpYmVkIGluIHRoZSBNVFAgc3BlY2lmaWNhdGlvbi4KKyAgICAgICAgICovCisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFRoZSBJRCBvZiB0aGUgc3RvcmFnZSB1bml0IGNvbnRhaW5pbmcgdGhlIG9iamVjdC4KKyAgICAgICAgICogPFA+VHlwZTogSU5URUdFUjwvUD4KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIFNUT1JBR0VfSUQgPSAic3RvcmFnZV9pZCI7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFRoZSBvYmplY3QncyBmb3JtYXQuICBDYW4gYmUgb25lIG9mIHRoZSBGT1JNQVRfKiBzeW1ib2xzIGJlbG93LAorICAgICAgICAgKiBvciBhbnkgb2YgdGhlIHZhbGlkIE1UUCBvYmplY3QgZm9ybWF0cyBhcyBkZWZpbmVkIGluIHRoZSBNVFAgc3BlY2lmaWNhdGlvbi4KKyAgICAgICAgICogPFA+VHlwZTogSU5URUdFUjwvUD4KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIEZPUk1BVCA9ICJmb3JtYXQiOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBUaGUgcHJvdGVjdGlvbiBzdGF0dXMgb2YgdGhlIG9iamVjdC4gIFNlZSB0aGUgUFJPVEVDVElPTl9TVEFUVVNfKnN5bWJvbHMgYmVsb3cuCisgICAgICAgICAqIDxQPlR5cGU6IElOVEVHRVI8L1A+CisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBQUk9URUNUSU9OX1NUQVRVUyA9ICJwcm90ZWN0aW9uX3N0YXR1cyI7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFRoZSBzaXplIG9mIHRoZSBvYmplY3QgaW4gYnl0ZXMuCisgICAgICAgICAqIDxQPlR5cGU6IElOVEVHRVI8L1A+CisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBTSVpFID0gInNpemUiOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBUaGUgb2JqZWN0J3MgdGh1bWJuYWlsIGZvcm1hdC4gIENhbiBiZSBvbmUgb2YgdGhlIEZPUk1BVF8qIHN5bWJvbHMgYmVsb3csCisgICAgICAgICAqIG9yIGFueSBvZiB0aGUgdmFsaWQgTVRQIG9iamVjdCBmb3JtYXRzIGFzIGRlZmluZWQgaW4gdGhlIE1UUCBzcGVjaWZpY2F0aW9uLgorICAgICAgICAgKiA8UD5UeXBlOiBJTlRFR0VSPC9QPgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgVEhVTUJfRk9STUFUID0gImZvcm1hdCI7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFRoZSBzaXplIG9mIHRoZSBvYmplY3QncyB0aHVtYm5haWwgaW4gYnl0ZXMuCisgICAgICAgICAqIDxQPlR5cGU6IElOVEVHRVI8L1A+CisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBUSFVNQl9TSVpFID0gInRodW1iX3NpemUiOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBUaGUgd2lkdGggb2YgdGhlIG9iamVjdCdzIHRodW1ibmFpbCBpbiBwaXhlbHMuCisgICAgICAgICAqIDxQPlR5cGU6IElOVEVHRVI8L1A+CisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBUSFVNQl9XSURUSCA9ICJ0aHVtYl93aWR0aCI7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFRoZSBoZWlnaHQgb2YgdGhlIG9iamVjdCdzIHRodW1ibmFpbCBpbiBwaXhlbHMuCisgICAgICAgICAqIDxQPlR5cGU6IElOVEVHRVI8L1A+CisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBUSFVNQl9IRUlHSFQgPSAidGh1bWJfaGVpZ2h0IjsKKworICAgICAgICAvKioKKyAgICAgICAgICogVGhlIG9iamVjdCdzIHRodW1ibmFpbC4KKyAgICAgICAgICogPFA+VHlwZTogQkxPQjwvUD4KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIFRIVU1CID0gInRodW1iIjsKKworICAgICAgICAvKioKKyAgICAgICAgICogVGhlIHdpZHRoIG9mIHRoZSBvYmplY3QgaW4gcGl4ZWxzLgorICAgICAgICAgKiA8UD5UeXBlOiBJTlRFR0VSPC9QPgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgSU1BR0VfV0lEVEggPSAiaW1hZ2Vfd2lkdGgiOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBUaGUgaGVpZ2h0IG9mIHRoZSBvYmplY3QgaW4gcGl4ZWxzLgorICAgICAgICAgKiA8UD5UeXBlOiBJTlRFR0VSPC9QPgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgSU1BR0VfSEVJR0hUID0gImltYWdlX2hlaWdodCI7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFRoZSBkZXB0aCBvZiB0aGUgb2JqZWN0IGluIGJpdHMgcGVyIHBpeGVsLgorICAgICAgICAgKiA8UD5UeXBlOiBJTlRFR0VSPC9QPgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgSU1BR0VfREVQVEggPSAiaW1hZ2VfZGVwdGgiOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBUaGUgSUQgb2YgdGhlIG9iamVjdCdzIHBhcmVudCwgb3IgemVybyBpZiB0aGUgb2JqZWN0CisgICAgICAgICAqIGlzIGluIHRoZSByb290IG9mIGl0cyBzdG9yYWdlIHVuaXQuCisgICAgICAgICAqIDxQPlR5cGU6IElOVEVHRVI8L1A+CisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBQQVJFTlQgPSAicGFyZW50IjsKKworICAgICAgICAvKioKKyAgICAgICAgICogVGhlIGFzc29jaWF0aW9uIHR5cGUgZm9yIGEgY29udGFpbmVyIG9iamVjdC4KKyAgICAgICAgICogRm9yIGZvbGRlcnMgdGhpcyBpcyB0eXBpY2FsbHkge0BsaW5rICNBU1NPQ0lBVElPTl9UWVBFX0dFTkVSSUNfRk9MREVSfQorICAgICAgICAgKiA8UD5UeXBlOiBJTlRFR0VSPC9QPgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgQVNTT0NJQVRJT05fVFlQRSA9ICJhc3NvY2lhdGlvbl90eXBlIjsKKworICAgICAgICAvKioKKyAgICAgICAgICogQ29udGFpbnMgYWRkaXRpb25hbCBpbmZvcm1hdGlvbiBhYm91dCBjb250YWluZXIgb2JqZWN0cy4KKyAgICAgICAgICogPFA+VHlwZTogSU5URUdFUjwvUD4KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIEFTU09DSUFUSU9OX0RFU0MgPSAiYXNzb2NpYXRpb25fZGVzYyI7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFRoZSBzZXF1ZW5jZSBudW1iZXIgb2YgdGhlIG9iamVjdCwgdHlwaWNhbGx5IHVzZWQgZm9yIGFuIGFzc29jaWF0aW9uCisgICAgICAgICAqIGNvbnRhaW5pbmcgaW1hZ2VzIHRha2VuIGluIHNlcXVlbmNlLgorICAgICAgICAgKiA8UD5UeXBlOiBJTlRFR0VSPC9QPgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgU0VRVUVOQ0VfTlVNQkVSID0gInNlcXVlbmNlX251bWJlciI7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFRoZSBuYW1lIG9mIHRoZSBvYmplY3QuCisgICAgICAgICAqIDxQPlR5cGU6IFRFWFQ8L1A+CisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBOQU1FID0gIm5hbWUiOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBUaGUgZGF0ZSB0aGUgb2JqZWN0IHdhcyBjcmVhdGVkLCBpbiBzZWNvbmRzIHNpbmNlIEphbnVhcnkgMSwgMTk3MC4KKyAgICAgICAgICogPFA+VHlwZTogSU5URUdFUjwvUD4KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIERBVEVfQ1JFQVRFRCA9ICJk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IGludCBGT1JNQVRfSFRNTCA9IDB4MzAwNTsKKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBpbnQgRk9STUFUX0RQT0YgPSAweDMwMDY7CisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgaW50IEZPUk1BVF9BSUZGID0gMHgzMDA3OworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGludCBGT1JNQVRfV0FWID0gMHgzMDA4OworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGludCBGT1JNQVRfTVAzID0gMHgzMDA5OworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGludCBGT1JNQVRfQVZJID0gMHgzMDBBOworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGludCBGT1JNQVRfTVBFRyA9IDB4MzAwQjsKKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBpbnQgRk9STUFUX0FTRiA9IDB4MzAwQzsKKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBpbnQgRk9STUFUX0RFRklORUQgPSAweDM4MDA7CisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgaW50IEZPUk1BVF9FWElGX0pQRUcgPSAweDM4MDE7CisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgaW50IEZPUk1BVF9USUZGX0VQID0gMHgzODAyOworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGludCBGT1JNQVRfRkxBU0hQSVggPSAweDM4MDM7CisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgaW50IEZPUk1BVF9CTVAgPSAweDM4MDQ7CisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgaW50IEZPUk1BVF9DSUZGID0gMHgzODA1OworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGludCBGT1JNQVRfR0lGID0gMHgzODA3OworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGludCBGT1JNQVRfSkZJRiA9IDB4MzgwODsKKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBpbnQgRk9STUFUX0NEID0gMHgzODA5OworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGludCBGT1JNQVRfUElDVCA9IDB4MzgwQTsKKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBpbnQgRk9STUFUX1BORyA9IDB4MzgwQjsKKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBpbnQgRk9STUFUX1RJRkYgPSAweDM4MEQ7CisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgaW50IEZPUk1BVF9USUZGX0lUID0gMHgzODBFOworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGludCBGT1JNQVRfSlAyID0gMHgzODBGOworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGludCBGT1JNQVRfSlBYID0gMHgzODEwOworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGludCBGT1JNQVRfVU5ERUZJTkVEX0ZJUk1XQVJFID0gMHhCODAyOworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGludCBGT1JNQVRfV0lORE9XU19JTUFHRV9GT1JNQVQgPSAweEI4ODE7CisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgaW50IEZPUk1BVF9VTkRFRklORURfQVVESU8gPSAweEI5MDA7CisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgaW50IEZPUk1BVF9XTUEgPSAweEI5MDE7CisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgaW50IEZPUk1BVF9PR0cgPSAweEI5MDI7CisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgaW50IEZPUk1BVF9BQUMgPSAweEI5MDM7CisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgaW50IEZPUk1BVF9BVURJQkxFID0gMHhCOTA0OworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGludCBGT1JNQVRfRkxB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Ci0gICAgICAgIAorCiAgICAgICAgIHB1YmxpYyBzdGF0aWMgYm9vbGVhbiBnZXRTaG93R1RhbGtTZXJ2aWNlU3RhdHVzKENvbnRlbnRSZXNvbHZlciBjcikgewogICAgICAgICAgICAgcmV0dXJuIGdldEludChjciwgU0hPV19HVEFMS19TRVJWSUNFX1NUQVRVUywgMCkgIT0gMDsKICAgICAgICAgfQpAQCAtMTIxNiw3ICsxMjA4LDcgQEAKICAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgTE9DS19QQVRURVJOX1ZJU0lCTEUgPSAibG9ja19wYXR0ZXJuX3Zpc2libGVfcGF0dGVybiI7CiAKICAgICAgICAgLyoqCi0gICAgICAgICAqIEBkZXByZWNhdGVkIFVzZSAKKyAgICAgICAgICogQGRlcHJlY2F0ZWQgVXNlCiAgICAgICAgICAqIHtAbGluayBhbmRyb2lkLnByb3ZpZGVyLlNldHRpbmdzLlNlY3VyZSNMT0NLX1BBVFRFUk5fVEFDVElMRV9GRUVEQkFDS19FTkFCTEVEfQogICAgICAgICAgKiBpbnN0ZWFkCiAgICAgICAgICAqLwpAQCAtMjI5MCw2ICsyMjgyLDE0IEBACiAgICAgICAgIH0KIAogICAgICAgICAvKioKKyAgICAgICAgICogR2V0IHRoZSBrZXkgdGhhdCByZXRyaWV2ZXMgYSBibHVldG9vdGggSW5wdXQgRGV2aWNlJ3MgcHJpb3JpdHkuCisgICAgICAgICAqIEBoaWRlCisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBnZXRCbHVldG9vdGhJbnB1dERldmljZVByaW9yaXR5S2V5KFN0cmluZyBhZGRyZXNzKSB7CisgICAgICAgICAgICByZXR1cm4gKCJibHVldG9vdGhfaW5wdXRfZGV2aWNlX3ByaW9yaXR5XyIgKyBhZGRyZXNzLnRvVXBwZXJDYXNlKCkpOworICAgICAgICB9CisKKyAgICAgICAgLyoqCiAgICAgICAgICAqIFdoZXRoZXI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ICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgU0FNUExJTkdfUFJPRklMRVJfSFogPSAic2FtcGxpbmdfcHJvZmlsZXJfaHoiOworCisgICAgICAgIC8qKgogICAgICAgICAgKiBTZXR0aW5ncyBjbGFzc25hbWUgdG8gbGF1bmNoIHdoZW4gU2V0dGluZ3MgaXMgY2xpY2tlZCBmcm9tIEFsbAogICAgICAgICAgKiBBcHBsaWNhdGlvbnMuICBOZWVkZWQgYmVjYXVzZSBvZiB1c2VyIHRlc3RpbmcgYmV0d2VlbiB0aGUgb2xkCiAgICAgICAgICAqIGFuZCBuZXcgU2V0dGluZ3MgYXBwcy4KQEAgLTM1ODEsMjAgKzM2MDQsOCBAQAogICAgICAgICAgICAgLy8gSWYgYSBzaG9ydGN1dCBpcyBzdXBwbGllZCwgYW5kIGl0IGlzIGFscmVhZHkgZGVmaW5lZCBmb3IKICAgICAgICAgICAgIC8vIGFub3RoZXIgYm9va21hcmssIHRoZW4gcmVtb3ZlIHRoZSBvbGQgZGVmaW5pdGlvbi4KICAgICAgICAgICAgIGlmIChzaG9ydGN1dCAhPSAwKSB7Ci0gICAgICAgICAgICAgICAgQ3Vyc29yIGMgPSBjci5xdWVyeShDT05URU5UX1VSSSwKLSAgICAgICAgICAgICAgICAgICAgICAgIHNTaG9ydGN1dFByb2plY3Rpb24sIHNTaG9ydGN1dFNlbGVjdGlvbiwKLSAgICAgICAgICAgICAgICAgICAgICAgIG5ldyBTdHJpbmdbXSB7IFN0cmluZy52YWx1ZU9mKChpbnQpIHNob3J0Y3V0KSB9LCBudWxsKTsKLSAgICAgICAgICAgICAgICB0cnkgewotICAgICAgICAgICAgICAgICAgICBpZiAoYy5tb3ZlVG9GaXJzdCgpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAoYy5nZXRDb3VudCgpID4gMCkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghYy5kZWxldGVSb3coKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMb2cudyhUQUcsICJDb3VsZCBub3QgZGVsZXRlIGV4aXN0aW5nIHNob3J0Y3V0IHJvdyIpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0gZmluYWxseSB7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChjICE9IG51bGwpIGMuY2xvc2UoKTsKLSAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgY3IuZGVsZXRlKENPTlRFTlRfVVJJLCBzU2hvcnRjdXRTZWxlY3Rpb24sCisgICAgICAgICAgICAgICAgICAgICAgICBuZXcgU3RyaW5nW10geyBTdHJpbmcudmFsdWVPZigoaW50KSBzaG9ydGN1dCkgfSk7CiAgICAgICAgICAgICB9CiAKICAgICAgICAgICAgIENvbnRlbnRWYWx1ZXMgdmFsdWVzID0gbmV3IENvbnRlbnRWYWx1ZXMoKTsKZGlmZiAtLWdpdCBhL2NvcmUvamF2YS9hbmRyb2lkL3NlcnZlci9CbHVldG9vdGhFdmVudExvb3AuamF2YSBiL2NvcmUvamF2YS9hbmRyb2lkL3NlcnZlci9CbHVldG9vdGhFdmVudExvb3AuamF2YQppbmRleCAzNWE1ODJkLi45OTQ4MDYwIDEwMDY0NAotLS0gYS9jb3JlL2phdmEvYW5kcm9pZC9zZXJ2ZXIvQmx1ZXRvb3RoRXZlbnRMb29wLmphdmEKKysrIGIvY29yZS9qYXZhL2FuZHJvaWQvc2VydmVyL0JsdWV0b290aEV2ZW50TG9vcC5qYXZhCkBAIC0yMCw2ICsyMCw4IEBACiBpbXBvcnQgYW5kcm9pZC5ibHVldG9vdGguQmx1ZXRvb3RoQWRhcHRlcjsKIGltcG9ydCBhbmRyb2lkLmJsdWV0b290aC5CbHVldG9vdGhDbGFzczsKIGltcG9ydCBhbmRyb2lkLmJsdWV0b290aC5CbHVldG9vdGhEZ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5wdXREZXZpY2UobUNvbnRleHQpOworICAgICAgICAgICAgYXV0aG9yaXplZCA9IGlucHV0RGV2aWNlLmdldElucHV0RGV2aWNlUHJpb3JpdHkoZGV2aWNlKSA+CisgICAgICAgICAgICAgICAgICAgICAgICAgQmx1ZXRvb3RoSW5wdXREZXZpY2UuUFJJT1JJVFlfT0ZGOworICAgICAgICAgICAgIGlmIChhdXRob3JpemVkKSB7CisgICAgICAgICAgICAgICAgIExvZy5pKFRBRywgIkFsbG93aW5nIGluY29taW5nIEhJRCBjb25uZWN0aW9uIGZyb20gIiArIGFkZHJlc3MpOworICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgIExvZy5pKFRBRywgIlJlamVjdGluZyBpbmNvbWluZyBISUQgY29ubmVjdGlvbiBmcm9tICIgKyBhZGRyZXNzKTsKKyAgICAgICAgICAgICB9CisgICAgICAgIH0gZWxzZSBpZiAoQmx1ZXRvb3RoVXVpZC5pc05BUCh1dWlkKSl7CisgICAgICAgICAgICBhdXRob3JpemVkID0gdHJ1ZTsKICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgIExvZy5pKFRBRywgIlJlamVjdGluZyBpbmNvbWluZyAiICsgZGV2aWNlVXVpZCArICIgY29ubmVjdGlvbiBmcm9tICIgKyBhZGRyZXNzKTsKICAgICAgICAgfQpAQCAtNjA0LDcgKzY1MywxOSBAQAogICAgICAgICByZXR1cm4gYXV0aG9yaXplZDsKICAgICB9CiAKLSAgICBib29sZWFuIGlzT3RoZXJTaW5rSW5Ob25EaXNjb25uZWN0aW5nU3RhdGUoU3RyaW5nIGFkZHJlc3MpIHsKKyAgICBwcml2YXRlIGJvb2xlYW4gaXNPdGhlcklucHV0RGV2aWNlQ29ubmVjdGVkKFN0cmluZyBhZGRyZXNzKSB7CisgICAgICAgIFNldDxCbHVldG9vdGhEZXZpY2U+IGRldmljZXMgPQorICAgICAgICAgICAgbUJsdWV0b290aFNlcnZpY2UubG9va3VwSW5wdXREZXZpY2VzTWF0Y2hpbmdTdGF0ZXMobmV3IGludFtdIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEJsdWV0b290aElucHV0RGV2aWNlLlNUQVRFX0NPTk5FQ1RJTkcsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBCbHVldG9vdGhJbnB1dERldmljZS5TVEFURV9DT05ORUNURUR9KTsKKworICAgICAgICBmb3IgKEJsdWV0b290aERldmljZSBkZXZpY2UgOiBkZXZpY2VzKSB7CisgICAgICAgICAgICBpZiAoIWRldmljZS5nZXRBZGRyZXNzKCkuZXF1YWxzKGFkZHJlc3MpKSByZXR1cm4gdHJ1ZTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgcHJpdmF0ZSBib29sZWFuIGlzT3RoZXJTaW5rSW5Ob25EaXNjb25uZWN0aW5nU3RhdGUoU3RyaW5nIGFkZHJlc3MpIHsKICAgICAgICAgQmx1ZXRvb3RoQTJkcCBhMmRwID0gbmV3IEJsdWV0b290aEEyZHAobUNvbnRleHQpOwogICAgICAgICBTZXQ8Qmx1ZXRvb3RoRGV2aWNlPiBkZXZpY2VzID0gYTJkcC5nZXROb25EaXNjb25uZWN0ZWRTaW5rcygpOwogICAgICAgICBpZiAoZGV2aWNlcy5zaXplKCkgPT0gMCkgcmV0dXJuIGZhbHNlOwpAQCAtNjU1LDYgKzcxNiw1MCBAQAogICAgICAgICB9CiAgICAgfQogCisgICAgcHJpdmF0ZSB2b2lkIG9uSW5wdXREZXZpY2VDb25uZWN0aW9uUmVzdWx0KFN0cmluZyBwYXRoLCBib29sZWFuIHJlc3VsdCkgeworICAgICAgICAvLyBTdWNjZXNzIGNhc2UgZ2V0cyBoYW5kbGVkIGJ5IFByb3BlcnR5IENoYW5nZSBzaWduYWwKKyAgICAgICAgaWYgKCFyZXN1bHQpIHsKKyAgICAgICAgICAgIFN0cmluZyBhZGRyZXNzID0gbUJsdWV0b290aFNlcnZpY2UuZ2V0QWRkcmVzc0Zyb21PYmplY3RQYXRoKHBhdGgpOworICAgICAgICAgICAgaWYgKGFkZHJlc3MgPT0gbnVsbCkgcmV0dXJuOworCisgICAgICAgICAgICBib29sZWFuIGNvbm5lY3RlZCA9IGZhbHNlOworICAgICAgICAgICAgQmx1ZXRvb3RoRGV2aWNlIGRldmljZSA9IG1BZGFwdGVyLmdldFJlbW90ZURldmljZShhZGRyZXNzKTsKKyAgICAgICAgICAgIGludCBzdGF0ZSA9IG1CbHVldG9vdGhTZXJ2aWNlLmdldElucHV0RGV2aWNlU3RhdGUoZGV2aWNlKTsKKyAgICAgICAgICAgIGlmIChzdGF0ZSA9PSBCbHVldG9vdGhJbnB1dERldmljZS5TVEFURV9DT05ORUNUSU5HKSB7CisgICAgICAgICAgICAgICAgY29ubmVjdGVkID0gZmFsc2U7CisgICAgICAgICAgICB9IGVsc2UgaWYgKHN0YXRlID09IEJsdWV0b290aElucHV0RGV2aWNlLlNUQVRFX0RJU0NPTk5FQ1RJTkcpIHsKKyAgICAgICAgICAgICAgICBjb25uZWN0ZWQgPSB0cnVlOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBMb2cuZShUQUcsICJFcnJvciBvbklucHV0RGV2aWNlQ29ubmVjdGlvblJlc3VsdC4gU3RhdGUgaXM6IiArIHN0YXRlKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1CbHVldG9vdGhTZXJ2aWNlLmhhbmRsZUlucHV0RGV2aWNlUHJvcGVydHlDaGFuZ2UoYWRkcmVzcywgY29ubmVjdGVkKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgdm9pZCBvblBhbkRldmljZUNvbm5lY3Rpb25SZXN1bHQoU3RyaW5nIHBhdGgsIGJvb2xlYW4gcmVzdWx0KSB7CisgICAgICAgIGxvZyAoIm9uUGFuRGV2aWNlQ29ubmVjdGlvblJlc3VsdCAiICsgcGF0aCArICIgIiArIHJlc3VsdCk7CisgICAgICAgIC8vIFN1Y2Nlc3MgY2FzZSBnZXRzIGhhbmRsZWQgYnkgUHJvcGVydHkgQ2hhbmdlIHNpZ25hbAorICAgICAgICBpZiAoIXJlc3VsdCkgeworICAgICAgICAgICAgU3RyaW5nIGFkZHJlc3MgPSBtQmx1ZXRvb3RoU2VydmljZS5nZXRBZGRyZXNzRnJvbU9iamVjdFBhdGgocGF0aCk7CisgICAgICAgICAgICBpZiAoYWRkcmVzcyA9PSBudWxsKSByZXR1cm47CisKKyAgICAgICAgICAgIGJvb2xlYW4gY29ubmVjdGVkID0gZmFsc2U7CisgICAgICAgICAgICBCbHVldG9vdGhEZXZpY2UgZGV2aWNlID0gbUFkYXB0ZXIuZ2V0UmVtb3RlRGV2aWNlKGFkZHJlc3MpOworICAgICAgICAgICAgaW50IHN0YXRlID0gbUJsdWV0b290aFNlcnZpY2UuZ2V0UGFuRGV2aWNlU3RhdGUoZGV2aWNlKTsKKyAgICAgICAgICAgIGlmIChzdGF0ZSA9PSBCbHVldG9vdGhQYW4uU1RBVEVfQ09OTkVDVElORykgeworICAgICAgICAgICAgICAgIGNvbm5lY3RlZCA9IGZhbHNlOworICAgICAgICAgICAgfSBlbHNlIGlmIChzdGF0ZSA9PSBCbHVldG9vdGhQYW4uU1RBVEVfRElTQ09OTkVDVElORykgeworICAgICAgICAgICAgICAgIGNvbm5lY3RlZCA9IHRydWU7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIExvZy5lKFRBRywgIkVycm9yIG9uUGFuRGV2aWNlQ29ubmVjdGlvblJlc3VsdC4gU3RhdGUgaXM6ICIKKyAgICAgICAgICAgICAgICAgICAgICAgICsgc3RhdGUgKyAiIHJlc3VsdDogIisgcmVzdWx0KTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGludCBuZXdTdGF0ZSA9IGNvbm5lY3RlZD8gQmx1ZXRvb3RoUGFuLlNUQVRFX0NPTk5F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ICAgIHByaXZhdGUgQnJvYWRjYXN0UmVjZWl2ZXIgbVRldGhlcmluZ1JlY2VpdmVyID0gbnVsbDsKKworICAgIHB1YmxpYyBzeW5jaHJvbml6ZWQgdm9pZCBzZXRCbHVldG9vdGhUZXRoZXJpbmcoYm9vbGVhbiB2YWx1ZSwgCisgICAgICAgICAgICBmaW5hbCBTdHJpbmcgdXVpZCwgZmluYWwgU3RyaW5nIGJyaWRnZSkgeworICAgICAgICBtVGV0aGVyaW5nT24gPSB2YWx1ZTsKKyAgICAgICAgaWYgKCF2YWx1ZSkgeworICAgICAgICAgICAgZGlzY29ubmVjdFBhbigpOworICAgICAgICB9CisKKyAgICAgICAgaWYgKGdldEJsdWV0b290aFN0YXRlKCkgIT0gQmx1ZXRvb3RoQWRhcHRlci5TVEFURV9PTiAmJiBtVGV0aGVyaW5nT24pIHsKKyAgICAgICAgICAgIEludGVudEZpbHRlciBmaWx0ZXIgPSBuZXcgSW50ZW50RmlsdGVyKCk7CisgICAgICAgICAgICBmaWx0ZXIuYWRkQWN0aW9uKEJsdWV0b290aEFkYXB0ZXIuQUNUSU9OX1NUQVRFX0NIQU5HRUQpOworICAgICAgICAgICAgbVRldGhlcmluZ1JlY2VpdmVyID0gbmV3IEJyb2FkY2FzdFJlY2VpdmVyKCkgeworICAgICAgICAgICAgICAgIEBPdmVycmlkZQorICAgICAgICAgICAgICAgIHB1YmxpYyBzeW5jaHJvbml6ZWQgdm9pZCBvblJlY2VpdmUoQ29udGV4dCBjb250ZXh0LCBJbnRlbnQgaW50ZW50KSB7CisgICAgICAgICAgICAgICAgICAgIGlmIChpbnRlbnQuZ2V0SW50RXh0cmEoQmx1ZXRvb3RoQWRhcHRlci5FWFRSQV9TVEFURSwgQmx1ZXRvb3RoQWRhcHRlci5TVEFURV9PRkYpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgPT0gQmx1ZXRvb3RoQWRhcHRlci5TVEFURV9PTikgeworICAgICAgICAgICAgICAgICAgICAgICAgc2V0Qmx1ZXRvb3RoVGV0aGVyaW5nKHRydWUsIHV1aWQsIGJyaWRnZSk7CisgICAgICAgICAgICAgICAgICAgICAgICBtQ29udGV4dC51bnJlZ2lzdGVyUmVjZWl2ZXIobVRldGhlcmluZ1JlY2VpdmVyKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH07CisgICAgICAgICAgICBtQ29udGV4dC5yZWdpc3RlclJlY2VpdmVyKG1UZXRoZXJpbmdSZWNlaXZlciwgZmlsdGVyKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIHNldEJsdWV0b290aFRldGhlcmluZ05hdGl2ZSh2YWx1ZSwgdXVpZCwgYnJpZGdlKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyBzeW5jaHJvbml6ZWQgaW50IGdldFBhbkRldmljZVN0YXRlKEJsdWV0b290aERldmljZSBkZXZpY2UpIHsKKyAgICAgICAgbUNvbnRleHQuZW5mb3JjZUNhbGxpbmdPclNlbGZQZXJtaXNzaW9uKEJMVUVUT09USF9QRVJNLCAiTmVlZCBCTFVFVE9PVEggcGVybWlzc2lvbiIpOworCisgICAgICAgIGlmIChtUGFuRGV2aWNlcy5nZXQoZGV2aWNlKSA9PSBudWxsKSB7CisgICAgICAgICAgICByZXR1cm4gQmx1ZXRvb3RoUGFuLlNUQVRFX0RJU0NPTk5FQ1RFRDsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gbVBhbkRldmljZXMuZ2V0KGRldmljZSk7CisgICAgfQorCisgICAgcHVibGljIHN5bmNocm9uaXplZCBib29sZWFuIGNvbm5lY3RQYW5EZXZpY2UoQmx1ZXRvb3RoRGV2aWNlIGRldmljZSkgeworICAgICAgICBtQ29udGV4dC5lbmZvcmNlQ2FsbGluZ09yU2VsZlBlcm1pc3Npb24oQkxVRVRPT1RIX0FETUlOX1BFUk0sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiTmVlZCBCTFVFVE9PVEhfQURNSU4gcGVybWlzc2lvbiIpOworCisgICAgICAgIFN0cmluZyBvYmplY3RQYXRoID0gZ2V0T2JqZWN0UGF0aEZyb21BZGRyZXNzKGRldmljZS5nZXRBZGRyZXNzKCkpOworICAgICAgICBpZiAoREJHKSBsb2coImNvbm5lY3QgUEFOKCIgKyBvYmplY3RQYXRoICsgIikiKTsKKyAgICAgICAgaWYgKGdldFBhbkRldmljZVN0YXRlKGRldmljZSkgIT0gQmx1ZXRvb3RoUGFuLlNUQVRFX0RJU0NPTk5FQ1RFRCkgeworICAgICAgICAgICAgbG9nIChkZXZpY2UgKyAiIGFscmVhZHkgY29ubmVjdGVkIHRvIFBBTiIpOworICAgICAgICB9CisKKyAgICAgICAgaW50IGNvbm5lY3RlZENvdW50ID0gMDsKKyAgICAgICAgZm9yIChCbHVldG9vdGhEZXZpY2UgQlRkZXZpY2U6IG1QYW5EZXZpY2VzLmtleVNldCgpKSB7CisgICAgICAgICAgICBpZiAoZ2V0UGFuRGV2aWNlU3RhdGUoQlRkZXZpY2UpID09IEJsdWV0b290aFBhbi5TVEFURV9DT05ORUNURUQpIHsKKyAgICAgICAgICAgICAgICBjb25uZWN0ZWRDb3VudCArKzsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICBpZiAoY29ubmVjdGVkQ291bnQgPiA4KSB7CisgICAgICAgICAgICBsb2cgKGRldmljZSArICIgY291bGQgbm90IGNvbm5lY3QgdG8gUEFOIGJlY2F1c2UgOCBvdGhlciBkZXZpY2VzIGFyZSBhbHJlYWR5IGNvbm5lY3RlZCIpOworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisKKyAgICAgICAgaGFuZGxlUGFuRGV2aWNlU3RhdGVDaGFuZ2UoZGV2aWNlLCBCbHVldG9vdGhQYW4uU1RBVEVfQ09OTkVDVElORyk7CisgICAgICAgIGlmIChjb25uZWN0UGFuRGV2aWNlTmF0aXZlKG9iamVjdFBhdGgsICJuYXAiLCAicGFudSIpKSB7CisgICAgICAgICAgICBsb2cgKCJjb25uZWN0aW5nIHRvIFBBTiIpOworICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBoYW5kbGVQYW5EZXZpY2VTdGF0ZUNoYW5nZShkZXZpY2UsIEJsdWV0b290aFBhbi5TVEFURV9ESVNDT05ORUNURUQpOworICAgICAgICAgICAgbG9nICgiY291bGQgbm90IGNvbm5lY3QgdG8gUEFOIik7CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcml2YXRlIHN5bmNocm9uaXplZCBib29sZWFuIGRpc2Nvbm5lY3RQYW4oKSB7CisgICAgICAgIG1Db250ZXh0LmVuZm9yY2VDYWxsaW5nT3JTZWxmUGVybWlzc2lvbihCTFVFVE9PVEhfUEVSTSwgIk5lZWQgQkxVRVRPT1RIIHBlcm1pc3Npb24iKTsKKyAgICAgICAgaWYgKERCRykgbG9nKCJkaXNjb25uZWN0IGFsbCBQQU4gZGV2aWNlcyIpOworCisgICAgICAgIGZvciAoQmx1ZXRvb3RoRGV2aWNlIGRldmljZTogbVBhbkRldmljZXMua2V5U2V0KCkpIHsKKyAgICAgICAgICAgIGlmIChnZXRQYW5EZXZpY2VTdGF0ZShkZXZpY2UpID09IEJsdWV0b290aFBhbi5TVEFURV9DT05ORUNURUQpIHsKKyAgICAgICAgICAgICAgICBpZiAoIWRpc2Nvbm5lY3RQYW5EZXZpY2UoZGV2aWNlKSkgeworICAgICAgICAgICAgICAgICAgICBsb2cgKCJjb3VsZCBub3QgZGlzY29ubmVjdCBQYW4gRGV2aWNlICIrZGV2aWNlLmdldEFkZHJlc3MoKSk7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIHRydWU7CisgICAgfQorCisgICAgcHVibGljIHN5bmNocm9uaXplZCBCbHVldG9vdGhEZXZpY2VbXSBnZXRDb25uZWN0ZWRQYW5EZXZpY2VzKCkgeworICAgICAgICBtQ29udGV4dC5lbmZvcmNlQ2FsbGluZ09yU2VsZlBlcm1pc3Npb24oQkxVRVRPT1RIX1BFUk0sICJOZWVkIEJMVUVUT09USCBwZXJtaXNzaW9uIik7CisKKyAgICAgICAgU2V0PEJsdWV0b290aERldmljZT4gZGV2aWNlcyA9IG5ldyBIYXNoU2V0PEJsdWV0b290aERldmljZT4oKTsKKyAgICAgICAgZm9yIChCbHVldG9vdGhEZXZpY2UgZGV2aWNlOiBtUGFuRGV2aWNlcy5rZXlTZXQoKSkgeworICAgICAgICAgICAgaWYgKGdldFBhbkRldmljZVN0YXRlKGRldmljZSkgPT0gQmx1ZXRvb3RoUGFuLlNUQVRFX0NPTk5FQ1RFRCkgeworICAgICAgICAgICAgICAgIGRldmljZXMuYWRkKGRldmljZSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIGRldmljZXMudG9BcnJheShuZXcgQmx1ZXRvb3RoRGV2aWNlW2RldmljZXMuc2l6ZSgpXSk7CisgICAgfQorCisgICAgcHVibGljIHN5bmNocm9uaXplZCBib29sZWFuIGRpc2Nvbm5lY3RQYW5EZXZpY2UoQmx1ZXRvb3RoRGV2aWNlIGRldmljZSkgeworICAgICAgICBtQ29udGV4dC5lbmZvcmNlQ2FsbGluZ09yU2VsZlBlcm1pc3Npb24oQkxVRVRPT1RIX0FETUlOX1BFUk0sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiTmVlZCBCTFVFVE9PVEhfQURNSU4gcGVybWlzc2lvbiIpOworICAgICAgICBTdHJpbmcgb2JqZWN0UGF0aCA9IGdldE9iamVjdFBhdGhGcm9tQWRkcmVzcyhkZXZpY2UuZ2V0QWRkcmVzcygpKTsKKyAgICAgICAgaWYgKERCRykgbG9nKCJkaXNjb25uZWN0IFBBTigiICsgb2JqZWN0UGF0aCArICIpIik7CisgICAgICAgIGlmIChnZXRQYW5EZXZpY2VTdGF0ZShkZXZpY2UpICE9IEJsdWV0b290aFBhbi5TVEFURV9DT05ORUNURUQpIHsKKyAgICAgICAgICAgIGxvZyAoZGV2aWNlICsgIiBhbHJlYWR5IGRpc2Nvbm5lY3RlZCBmcm9tIFBBTiIpOworICAgICAgICB9CisgICAgICAgIGhhbmRsZVBhbkRldmljZVN0YXRlQ2hhbmdlKGRldmljZSwgQmx1ZXRvb3RoUGFuLlNUQVRFX0RJU0NPTk5FQ1RJTkcpOworICAgICAgICByZXR1cm4gZGlzY29ubmVjdFBhbkRldmljZU5hdGl2ZShvYmplY3RQYXRoKTsKKyAgICB9CisKKyAgICAvKnBhY2thZ2UqLyB2b2lkIGhhbmRsZVBhbkRldmljZVN0YXRlQ2hhbmdlKEJsdWV0b290aERldmljZSBkZXZpY2UsIGludCBzdGF0ZSkgeworICAgICAgICBpbnQgcHJldlN0YXRlOworICAgICAgICBpZiAobVBhbkRldmljZXMuZ2V0KGRldmljZSkgPT0gbnVsbCkgeworICAgICAgICAgICAgcHJldlN0YXRlID0gQmx1ZXRvb3RoUGFuLlNUQVRFX0RJU0NPTk5FQ1RFRDsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIHByZXZTdGF0ZSA9IG1QYW5EZXZpY2VzLmdldChkZXZpY2UpOworICAgICAgICB9CisgICAgICAgIGlmIChwcmV2U3RhdGUgPT0gc3RhdGUpIHJldHVybjsKKworICAgICAgICBtUGFuRGV2aWNlcy5wdXQoZGV2aWNlLCBzdGF0ZSk7CisKKyAgICAgICAgaWYgKHN0YXRlID09IEJsdWV0b290aFBhbi5TVEFURV9DT05ORUNURUQpIHsKKyAgICAgICAgICAgIHVwZGF0ZVRldGhlclN0YXRlKHRydWUpOworICAgICAgICB9CisKKyAgICAgICAgSW50ZW50IGludGVudCA9IG5ldyBJbnRlbnQ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AgICAgICAgKENvbm5lY3Rpdml0eU1hbmFnZXIpbUNvbnRleHQuZ2V0U3lzdGVtU2VydmljZShDb250ZXh0LkNPTk5FQ1RJVklUWV9TRVJWSUNFKTsKKyAgICAgICAgU3RyaW5nW10gYmx1ZXRvb3RoUmVnZXhzID0gY20uZ2V0VGV0aGVyYWJsZUJsdWV0b290aFJlZ2V4cygpOworCisgICAgICAgIC8vIGJyaW5nIHRvZ2dsZSB0aGUgaW50ZXJmYWNlcworICAgICAgICBTdHJpbmdbXSBpZmFjZXMgPSBuZXcgU3RyaW5nWzBdOworICAgICAgICB0cnkgeworICAgICAgICAgICAgaWZhY2VzID0gc2VydmljZS5saXN0SW50ZXJmYWNlcygpOworICAgICAgICB9IGNhdGNoIChFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgTG9nLmUoVEFHLCAiRXJyb3IgbGlzdGluZyBJbnRlcmZhY2VzIDoiICsgZSk7CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKworICAgICAgICBBcnJheUxpc3Q8U3RyaW5nPiBpZmFjZUFkZHJlc3NlcyA9IChBcnJheUxpc3Q8U3RyaW5nPikgbUJsdWV0b290aElmYWNlQWRkcmVzc2VzLmNsb25lKCk7CisgICAgICAgIGZvciAoU3RyaW5nIGlmYWNlIDogaWZhY2VzKSB7CisgICAgICAgICAgICBmb3IgKFN0cmluZyByZWdleCA6IGJsdWV0b290aFJlZ2V4cykgeworICAgICAgICAgICAgICAgIGlmIChpZmFjZS5tYXRjaGVzKHJlZ2V4KSkgeworICAgICAgICAgICAgICAgICAgICBJbnRlcmZhY2VDb25maWd1cmF0aW9uIGlmY2cgPSBudWxsOworICAgICAgICAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgICAgICAgICAgaWZjZyA9IHNlcnZpY2UuZ2V0SW50ZXJmYWNlQ29uZmlnKGlmYWNlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpZmNnICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZW5hYmxlZCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTdHJpbmdbXSBhZGRyID0gQkxVRVRPT1RIX05FVE1BU0suc3BsaXQoIlxcLiIpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZmNnLm5ldG1hc2sgPSAoSW50ZWdlci5wYXJzZUludChhZGRyWzBdKSA8PCAyNCkgKworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChJbnRlZ2VyLnBhcnNlSW50KGFkZHJbMV0pIDw8IDE2KSArCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKEludGVnZXIucGFyc2VJbnQoYWRkclsyXSkgPDwgOCkgKworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChJbnRlZ2VyLnBhcnNlSW50KGFkZHJbM10pKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGlmY2cuaXBBZGRyID09IDAgJiYgIWlmYWNlQWRkcmVzc2VzLmlzRW1wdHkoKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRkciA9IGlmYWNlQWRkcmVzc2VzLnJlbW92ZSgwKS5zcGxpdCgiXFwuIik7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZmNnLmlwQWRkciA9IChJbnRlZ2VyLnBhcnNlSW50KGFkZHJbMF0pIDw8IDI0KSArCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChJbnRlZ2VyLnBhcnNlSW50KGFkZHJbMV0pIDw8IDE2KSArCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChJbnRlZ2VyLnBhcnNlSW50KGFkZHJbMl0pIDw8IDgpICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKEludGVnZXIucGFyc2VJbnQoYWRkclszXSkpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgU3RyaW5nIElmYWNlQWRkcmVzcyA9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFN0cmluZy52YWx1ZU9mKGlmY2cuaXBBZGRyID4+PiAyNCkgKyAiLiIgKworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTdHJpbmcudmFsdWVPZigoaWZjZy5pcEFkZHIgJiAweDAwRkYwMDAwKSA+Pj4gMTYpICsgIi4iICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgU3RyaW5nLnZhbHVlT2YoKGlmY2cuaXBBZGRyICYgMHgwMDAwRkYwMCkgPj4+IDgpICsgIi4iICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgU3RyaW5nLnZhbHVlT2YoaWZjZy5pcEFkZHIgJiAweDAwMDAwMEZGKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmYWNlQWRkcmVzc2VzLnJlbW92ZShJZmFjZUFkZHJlc3MpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmY2cuaW50ZXJmYWNlRmxhZ3MgPSBpZmNnLmludGVyZmFjZUZsYWdzLnJlcGxhY2UoImRvd24iLCAidXAiKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZmNnLmludGVyZmFjZUZsYWdzID0gaWZjZy5pbnRlcmZhY2VGbGFncy5yZXBsYWNlKCJ1cCIsICJkb3duIik7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmY2cuaW50ZXJmYWNlRmxhZ3MgPSBpZmNnLmludGVyZmFjZUZsYWdzLnJlcGxhY2UoInJ1bm5pbmciLCAiIik7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWZjZy5pbnRlcmZhY2VGbGFncyA9IGlmY2cuaW50ZXJmYWNlRmxhZ3MucmVwbGFjZSgiICAiLCIgIik7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VydmljZS5zZXRJbnRlcmZhY2VDb25maWcoaWZhY2UsIGlmY2cpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlbmFibGVkKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjbS50ZXRoZXIoaWZhY2UpICE9IENvbm5lY3Rpdml0eU1hbmFnZXIuVEVUSEVSX0VSUk9SX05PX0VSUk9SKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMb2cuZShUQUcsICJFcnJvciB0ZXRoZXJpbmcgIitpZmFjZXMpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgICAgICAgICAgTG9nLmUoVEFHLCAiRXJyb3IgY29uZmlndXJpbmcgaW50ZXJmYWNlICIgKyBpZmFjZSArICIsIDoiICsgZSk7CisgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICB9CisKKyAgICBwdWJsaWMgc3luY2hyb25pemVkIGJvb2xlYW4gY29ubmVjdElucHV0RGV2aWNlKEJsdWV0b290aERldmljZSBkZXZpY2UpIHsKKyAgICAgICAgbUNvbnRleHQuZW5mb3JjZUNhbGxpbmdPclNlbGZQZXJtaXNzaW9uKEJMVUVUT09USF9BRE1JTl9QRVJNLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIk5lZWQgQkxVRVRPT1RIX0FETUlOIHBlcm1pc3Npb24iKTsKKworICAgICAgICBTdHJpbmcgb2JqZWN0UGF0aCA9IGdldE9iamVjdFBhdGhGcm9tQWRkcmVzcyhkZXZpY2UuZ2V0QWRkcmVzcygpKTsKKyAgICAgICAgaWYgKG9iamVjdFBhdGggPT0gbnVsbCB8fAorICAgICAgICAgICAgZ2V0SW5wdXREZXZpY2VTdGF0ZShkZXZpY2UpICE9IEJsdWV0b290aElucHV0RGV2aWNlLlNUQVRFX0RJU0NPTk5FQ1RFRCB8fAorICAgICAgICAgICAgZ2V0SW5wdXREZXZpY2VQcmlvcml0eShkZXZpY2UpID09IEJsdWV0b290aElucHV0RGV2aWNlLlBSSU9SSVRZX09GRikgeworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisgICAgICAgIEJsdWV0b290aERldmljZVByb2ZpbGVTdGF0ZSBzdGF0ZSA9IG1EZXZpY2VQcm9maWxlU3RhdGUuZ2V0KGRldmljZS5nZXRBZGRyZXNzKCkpOworICAgICAgICBpZiAoc3RhdGUgIT0gbnVsbCkgeworICAgICAgICAgICAgTWVzc2FnZSBtc2cgPSBuZXcgTWVzc2FnZSgpOworICAgICAgICAgICAgbXNnLmFyZzEgPSBCbHVldG9vdGhEZXZpY2VQcm9maWxlU3RhdGUuQ09OTkVDVF9ISURfT1VUR09JTkc7CisgICAgICAgICAgICBtc2cub2JqID0gc3RhdGU7CisgICAgICAgICAgICBtSGlkUHJvZmlsZVN0YXRlLnNlbmRNZXNzYWdlKG1zZyk7CisgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgcHVibGljIHN5bmNocm9uaXplZCBib29sZWFuIGNvbm5lY3RJbnB1dERldmljZUludGVybmFsKEJsdWV0b290aERldmljZSBkZXZpY2UpIHsKKyAgICAgICAgU3RyaW5nIG9iamVjdFBhdGggPSBnZXRPYmplY3RQYXRoRnJvbUFkZHJlc3MoZGV2aWNlLmdldEFkZHJlc3MoKSk7CisgICAgICAgIGhhbmRsZUlucHV0RGV2aWNlU3RhdGVDaGFuZ2UoZGV2aWNlLCBCbHVldG9vdGhJbnB1dERldmljZS5TVEFURV9DT05ORUNUSU5HKTsKKyAgICAgICAgaWYgKCFjb25uZWN0SW5wdXREZXZpY2VOYXRpdmUob2JqZWN0UGF0aCkpIHsKKyAgICAgICAgICAgIGhhbmRsZUlucHV0RGV2aWNlU3RhdGVDaGFuZ2UoZGV2aWNlLCBCbHVldG9vdGhJbnB1dERldmljZS5TVEFURV9ESVNDT05ORUNURUQpOworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisgICAgICAgIHJldHVybiB0cnVlOworICAgIH0KKworICAgIHB1YmxpYyBzeW5jaHJvbml6ZWQgYm9vbGVhbiBkaXNjb25uZWN0SW5wdXREZXZpY2UoQmx1ZXRvb3RoRGV2aWNlIGRldmljZSkgeworICAgICAgICBtQ29udGV4dC5lbmZvcmNlQ2FsbGluZ09yU2VsZlBlcm1pc3Npb24oQkxVRVRPT1RIX0FETUlOX1BFUk0sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiTmVlZCBCTFVFVE9PVEhfQURNSU4gcGVybWlzc2lvbiIpOworCisgICAgICAgIFN0cmluZyBvYmplY3RQYXRoID0gZ2V0T2JqZWN0UGF0aEZyb21BZGRyZXNzKGRldmljZS5nZXRBZGRyZXNzKCkpOworICAgICAgICBpZiAob2JqZWN0UGF0aCA9PSBudWxsIHx8IGdldENvbm5lY3RlZElucHV0RGV2aWNlcygpLmxlbmd0aCA9PSAwKSB7CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0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RydWU7CisgICAgfQorCisgICAgcHVibGljIHN5bmNocm9uaXplZCBpbnQgZ2V0SW5wdXREZXZpY2VTdGF0ZShCbHVldG9vdGhEZXZpY2UgZGV2aWNlKSB7CisgICAgICAgIG1Db250ZXh0LmVuZm9yY2VDYWxsaW5nT3JTZWxmUGVybWlzc2lvbihCTFVFVE9PVEhfUEVSTSwgIk5lZWQgQkxVRVRPT1RIIHBlcm1pc3Npb24iKTsKKworICAgICAgICBpZiAobUlucHV0RGV2aWNlcy5nZXQoZGV2aWNlKSA9PSBudWxsKSB7CisgICAgICAgICAgICByZXR1cm4gQmx1ZXRvb3RoSW5wdXREZXZpY2UuU1RBVEVfRElTQ09OTkVDVEVEOworICAgICAgICB9CisgICAgICAgIHJldHVybiBtSW5wdXREZXZpY2VzLmdldChkZXZpY2UpOworICAgIH0KKworICAgIHB1YmxpYyBzeW5jaHJvbml6ZWQgQmx1ZXRvb3RoRGV2aWNlW10gZ2V0Q29ubmVjdGVkSW5wdXREZXZpY2VzKCkgeworICAgICAgICBtQ29udGV4dC5lbmZvcmNlQ2FsbGluZ09yU2VsZlBlcm1pc3Npb24oQkxVRVRPT1RIX1BFUk0sICJOZWVkIEJMVUVUT09USCBwZXJtaXNzaW9uIik7CisgICAgICAgIFNldDxCbHVldG9vdGhEZXZpY2U+IGRldmljZXMgPSBsb29rdXBJbnB1dERldmljZXNNYXRjaGluZ1N0YXRlcygKKyAgICAgICAgICAgIG5ldyBpbnRbXSB7Qmx1ZXRvb3RoSW5wdXREZXZpY2UuU1RBVEVfQ09OTkVDVEVEfSk7CisgICAgICAgIHJldHVybiBkZXZpY2VzLnRvQXJyYXkobmV3IEJsdWV0b290aERldmljZVtkZXZpY2VzLnNpemUoKV0pOworICAgIH0KKworICAgIHB1YmxpYyBzeW5jaHJvbml6ZWQgaW50IGdldElucHV0RGV2aWNlUHJpb3JpdHkoQmx1ZXRvb3RoRGV2aWNlIGRldmljZSkgeworICAgICAgICBtQ29udGV4dC5lbmZvcmNlQ2FsbGluZ09yU2VsZlBlcm1pc3Npb24oQkxVRVRPT1RIX1BFUk0sICJOZWVkIEJMVUVUT09USCBwZXJtaXNzaW9uIik7CisgICAgICAgIHJldHVybiBTZXR0aW5ncy5TZWN1cmUuZ2V0SW50KG1Db250ZXh0LmdldENvbnRlbnRSZXNvbHZlcigpLAorICAgICAgICAgICAgICAgIFNldHRpbmdzLlNlY3VyZS5nZXRCbHVldG9vdGhJbnB1dERldmljZVByaW9yaXR5S2V5KGRldmljZS5nZXRBZGRyZXNzKCkpLAorICAgICAgICAgICAgICAgIEJsdWV0b290aElucHV0RGV2aWNlLlBSSU9SSVRZX1VOREVGSU5FRCk7CisgICAgfQorCisgICAgcHVibGljIHN5bmNocm9uaXplZCBib29sZWFuIHNldElucHV0RGV2aWNlUHJpb3JpdHkoQmx1ZXRvb3RoRGV2aWNlIGRldmljZSwgaW50IHByaW9yaXR5KSB7CisgICAgICAgIG1Db250ZXh0LmVuZm9yY2VDYWxsaW5nT3JTZWxmUGVybWlzc2lvbihCTFVFVE9PVEhfQURNSU5fUEVSTSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJOZWVkIEJMVUVUT09USF9BRE1JTiBwZXJtaXNzaW9uIik7CisgICAgICAgIGlmICghQmx1ZXRvb3RoQWRhcHRlci5jaGVja0JsdWV0b290aEFkZHJlc3MoZGV2aWNlLmdldEFkZHJlc3MoKSkpIHsKKyAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gU2V0dGluZ3MuU2VjdXJlLnB1dEludChtQ29udGV4dC5nZXRDb250ZW50UmVzb2x2ZXIoKSwKKyAgICAgICAgICAgICAgICBTZXR0aW5ncy5TZWN1cmUuZ2V0Qmx1ZXRvb3RoSW5wdXREZXZpY2VQcmlvcml0eUtleShkZXZpY2UuZ2V0QWRkcmVzcygpKSwKKyAgICAgICAgICAgICAgICBwcmlvcml0eSk7CisgICAgfQorCisgICAgLypwYWNrYWdlKi9zeW5jaHJvbml6ZWQgU2V0PEJsdWV0b290aERldmljZT4gbG9va3VwSW5wdXREZXZpY2VzTWF0Y2hpbmdTdGF0ZXMoaW50W10gc3RhdGVzKSB7CisgICAgICAgIFNldDxCbHVldG9vdGhEZXZpY2U+IGlucHV0RGV2aWNlcyA9IG5ldyBIYXNoU2V0PEJsdWV0b290aERldmljZT4oKTsKKyAgICAgICAgaWYgKG1JbnB1dERldmljZXMuaXNFbXB0eSgpKSB7CisgICAgICAgICAgICByZXR1cm4gaW5wdXREZXZpY2VzOworICAgICAgICB9CisgICAgICAgIGZvciAoQmx1ZXRvb3RoRGV2aWNlIGRldmljZTogbUlucHV0RGV2aWNlcy5rZXlTZXQoKSkgeworICAgICAgICAgICAgaW50IGlucHV0RGV2aWNlU3RhdGUgPSBnZXRJbnB1dERldmljZVN0YXRlKGRldmljZSk7CisgICAgICAgICAgICBmb3IgKGludCBzdGF0ZSA6IHN0YXRlcykgeworICAgICAgICAgICAgICAgIGlmIChzdGF0ZSA9PSBpbnB1dERldmljZVN0YXRlKSB7CisgICAgICAgICAgICAgICAgICAgIGlucHV0RGV2aWNlcy5hZGQoZGV2aWNlKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHJldHVybiBpbnB1dERldmljZXM7CisgICAgfQorCisgICAgcHJpdmF0ZSBzeW5jaHJvbml6ZWQgdm9pZCBoYW5kbGVJbnB1dERldmljZVN0YXRlQ2hhbmdlKEJsdWV0b290aERldmljZSBkZXZpY2UsIGludCBzdGF0ZSkgeworICAgICAgICBpbnQgcHJldlN0YXRlOworICAgICAgICBpZiAobUlucHV0RGV2aWNlcy5nZXQoZGV2aWNlKSA9PSBudWxsKSB7CisgICAgICAgICAgICBwcmV2U3RhdGUgPSBCbHVldG9vdGhJbnB1dERldmljZS5TVEFURV9ESVNDT05ORUNURUQ7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBwcmV2U3RhdGUgPSBtSW5wdXREZXZpY2VzLmdldChkZXZpY2UpOworICAgICAgICB9CisgICAgICAgIGlmIChwcmV2U3RhdGUgPT0gc3RhdGUpIHJldHVybjsKKworICAgICAgICBtSW5wdXREZXZpY2VzLnB1dChkZXZpY2UsIHN0YXRlKTsKKworICAgICAgICBpZiAoZ2V0SW5wdXREZXZpY2VQcmlvcml0eShkZXZpY2UpID4KKyAgICAgICAgICAgICAgQmx1ZXRvb3RoSW5wdXREZXZpY2UuUFJJT1JJVFlfT0ZGICYmCisgICAgICAgICAgICBzdGF0ZSA9PSBCbHVldG9vdGhJbnB1dERldmljZS5TVEFURV9DT05ORUNUSU5HIHx8CisgICAgICAgICAgICBzdGF0ZSA9PSBCbHVldG9vdGhJbnB1dERldmljZS5TVEFURV9DT05ORUNURUQpIHsKKyAgICAgICAgICAgIC8vIFdlIGhhdmUgY29ubmVjdGVkIG9yIGF0dGVtcHRpbmcgdG8gY29ubmVjdC4KKyAgICAgICAgICAgIC8vIEJ1bXAgcHJpb3JpdHkKKyAgICAgICAgICAgIHNldElucHV0RGV2aWNlUHJpb3JpdHkoZGV2aWNlLCBCbHVldG9vdGhJbnB1dERldmljZS5QUklPUklUWV9BVVRPX0NPTk5FQ1QpOworICAgICAgICB9CisKKyAgICAgICAgSW50ZW50IGludGVudCA9IG5ldyBJbnRlbnQoQmx1ZXRvb3RoSW5wdXREZXZpY2UuQUNUSU9OX0lOUFVUX0RFVklDRV9TVEFURV9DSEFOR0VEKTsKKyAgICAgICAgaW50ZW50LnB1dEV4dHJhKEJsdWV0b290aERldmljZS5FWFRSQV9ERVZJQ0UsIGRldmljZSk7CisgICAgICAgIGludGVudC5wdXRFeHRyYShCbHVldG9vdGhJbnB1dERldmljZS5FWFRSQV9QUkVWSU9VU19JTlBVVF9ERVZJQ0VfU1RBVEUsIHByZXZTdGF0ZSk7CisgICAgICAgIGludGVudC5wdXRFeHRyYShCb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gICAgICAgICAgICAgICAgICAgIHNldElucHV0RGV2aWNlUHJpb3JpdHkoZGV2aWNlLCBCbHVldG9vdGhJbnB1dERldmljZS5QUklPUklUWV9PTik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBCbHVldG9vdGhEZXZpY2UuQk9ORF9OT05FOgorICAgICAgICAgICAgICAgIHNldElucHV0RGV2aWNlUHJpb3JpdHkoZGV2aWNlLCBCbHVldG9vdGhJbnB1dERldmljZS5QUklPUklUWV9VTkRFRklORUQpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgfQorCiAgICAgLypwYWNrYWdlKi8gYm9vbGVhbiBpc1JlbW90ZURldmljZUluQ2FjaGUoU3RyaW5nIGFkZHJlc3MpIHsKICAgICAgICAgcmV0dXJuIChtRGV2aWNlUHJvcGVydGllcy5nZXQoYWRkcmVzcykgIT0gbnVsbCk7CiAgICAgfQpAQCAtMTI0Miw3ICsxNjQzLDcgQEAKICAgICAgICAgICAgIGlmICh1cGRhdGVSZW1vdGVEZXZpY2VQcm9wZXJ0aWVzQ2FjaGUoYWRkcmVzcykpCiAgICAgICAgICAgICAgICAgcmV0dXJuIGdldFJlbW90ZURldmljZVByb3BlcnR5KGFkZHJlc3MsIHByb3BlcnR5KTsKICAgICAgICAgfQotICAgICAgICBMb2cuZShUQUcsICJnZXRSZW1vdGVEZXZpY2VQcm9wZXJ0eTogIiArIHByb3BlcnR5ICsgIm5vdCBwcmVzZW50OiIgKyBhZGRyZXNzKTsKKyAgICAgICAgTG9nLmUoVEFHLCAiZ2V0UmVtb3RlRGV2aWNlUHJvcGVydHk6ICIgKyBwcm9wZXJ0eSArICIgbm90IHByZXNlbnQ6ICIgKyBhZGRyZXNzKTsKICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgfQogCkBAIC0yMTAzLDQgKzI1MDQsMTAgQEAKICAgICAgICAgICAgIHNob3J0IGNoYW5uZWwpOw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ikgeworCisgICAgICAgIGludCBiYXNlTGV2ZWwgPSBkaXIgPT0gTGF5b3V0LkRJUl9MRUZUX1RPX1JJR0hUID8gMCA6IDE7CisgICAgICAgIGludCBjdXJMZXZlbCA9IGxldmVsc1tsc3RhcnRdOworICAgICAgICBpbnQgbWluTGV2ZWwgPSBjdXJMZXZlbDsKKyAgICAgICAgaW50IHJ1bkNvdW50ID0gMTsKKyAgICAgICAgZm9yIChpbnQgaSA9IGxzdGFydCArIDEsIGUgPSBsc3RhcnQgKyBsZW47IGkgPCBlOyArK2kpIHsKKyAgICAgICAgICAgIGludCBsZXZlbCA9IGxldmVsc1tpXTsKKyAgICAgICAgICAgIGlmIChsZXZlbCAhPSBjdXJMZXZlbCkgeworICAgICAgICAgICAgICAgIGN1ckxldmVsID0gbGV2ZWw7CisgICAgICAgICAgICAgICAgKytydW5Db3VudDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIC8vIGFkZCBmaW5hbCBydW4gZm9yIHRyYWlsaW5nIGNvdW50ZXItZGlyZWN0aW9uYWwgd2hpdGVzcGFjZQorICAgICAgICBpbnQgdmlzTGVuID0gbGVuOworICAgICAgICBpZiAoKGN1ckxldmVsICYgMSkgIT0gKGJhc2VMZXZlbCAmIDEpKSB7CisgICAgICAgICAgICAvLyBsb29rIGZvciB2aXNpYmxlIGVuZAorICAgICAgICAgICAgd2hpbGUgKC0tdmlzTGVuID49IDApIHsKKyAgICAgICAgICAgICAgICBjaGFyIGNoID0gY2hhcnNbY3N0YXJ0ICsgdmlzTGVuXTsKKworICAgICAgICAgICAgICAgIGlmIChjaCA9PSAnXG4nKSB7CisgICAgICAgICAgICAgICAgICAgIC0tdmlzTGVuOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICBpZiAoY2ggIT0gJyAnICYmIGNoICE9ICdcdCcpIHsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgKyt2aXNMZW47CisgICAgICAgICAgICBpZiAodmlzTGVuICE9IGxlbikgeworICAgICAgICAgICAgICAgICsrcnVuQ291bnQ7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBpZiAocnVuQ291bnQgPT0gMSAmJiBtaW5MZXZlbCA9PSBiYXNlTGV2ZWwpIHsKKyAgICAgICAgICAgIC8vIHdlJ3JlIGRvbmUsIG9ubHkgb25lIHJ1biBvbiB0aGlzIGxpbmUKKyAgICAgICAgICAgIGlmICgobWluTGV2ZWwgJiAxKSAhPSAwKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIExheW91dC5ESVJTX0FMTF9SSUdIVF9UT19MRUZUOworICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuIExheW91dC5ESVJTX0FMTF9MRUZUX1RPX1JJR0hUOworICAgICAgICB9CisKKyAgICAgICAgaW50W10gbGQgPSBuZXcgaW50W3J1bkNvdW50ICogMl07CisgICAgICAgIGludCBtYXhMZXZlbCA9IG1pbkxldmVsOworICAgICAgICBpbnQgbGV2ZWxCaXRzID0gbWluTGV2ZWwgPDwgTGF5b3V0LlJVTl9MRVZFTF9TSElGVDsKKyAgICAgICAgeworICAgICAgICAgICAgLy8gU3RhcnQgb2YgZmlyc3QgcGFpciBpcyBhbHdheXMgMCwgd2Ugd3JpdGUKKyAgICAgICAgICAgIC8vIGxlbmd0aCB0aGVuIHN0YXJ0IGF0IGVhY2ggbmV3IHJ1biwgYW5kIHRoZQorICAgICAgICAgICAgLy8gbGFzdCBydW4gbGVuZ3RoIGFmdGVyIHdlJ3JlIGRvbmUuCisgICAgICAgICAgICBpbnQgbiA9IDE7CisgICAgICAgICAgICBpbnQgcHJldiA9IGxzdGFydDsKKyAgICAgICAgICAgIGN1ckxldmVsID0gbWluTGV2ZWw7CisgICAgICAgICAgICBmb3IgKGludCBpID0gbHN0YXJ0LCBlID0gbHN0YXJ0ICsgdmlzTGVuOyBpIDwgZTsgKytpKSB7CisgICAgICAgICAgICAgICAgaW50IGxldmVsID0gbGV2ZWxzW2ldOworICAgICAgICAgICAgICAgIGlmIChsZXZlbCAhPSBjdXJMZXZlbCkgeworICAgICAgICAgICAgICAgICAgICBjdXJMZXZlbCA9IGxldmVsOworICAgICAgICAgICAgICAgICAgICBpZiAobGV2ZWwgPiBtYXhMZXZlbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgbWF4TGV2ZWwgPSBsZXZlbDsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChsZXZlbCA8IG1pbkxldmVsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBtaW5MZXZlbCA9IGxldmVsOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIC8vIFhYWCBpZ25vcmUgcnVuIGxlbmd0aCBsaW1pdCBvZiAyXlJVTl9MRVZFTF9TSElGVAorICAgICAgICAgICAgICAgICAgICBsZFtuKytdID0gKGkgLSBwcmV2KSB8IGxldmVsQml0czsKKyAgICAgICAgICAgICAgICAgICAgbGRbbisrXSA9IGkgLSBsc3RhcnQ7CisgICAgICAgICAgICAgICAgICAgIGxldmVsQml0cyA9IGN1ckxldmVsIDw8IExheW91dC5SVU5fTEVWRUxfU0hJRlQ7CisgICAgICAgICAgICAgICAgICAgIHByZXYgPSBpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGxkW25dID0gKGxzdGFydCArIHZpc0xlbiAtIHByZXYpIHwgbGV2ZWxCaXRzOworICAgICAgICAgICAgaWYgKHZpc0xlbiA8IGxlbikgeworICAgICAgICAgICAgICAgIGxkWysrbl0gPSB2aXNMZW47CisgICAgICAgICAgICAgICAgbGRbKytuXSA9IChsZW4gLSB2aXNMZW4pIHwgKGJhc2VMZXZlbCA8PCBMYXlvdXQuUlVOX0xFVkVMX1NISUZUKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQor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sgLS1sZXZlbCkgeworICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbGQubGVuZ3RoOyBpICs9IDIpIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGxldmVsc1tsZFtpXV0gPj0gbGV2ZWwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGludCBlID0gaSArIDI7CisgICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAoZSA8IGxkLmxlbmd0aCAmJiBsZXZlbHNbbGRbZV1dID49IGxldmVsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSArPSAyOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChpbnQgbG93ID0gaSwgaGkgPSBlIC0gMjsgbG93IDwgaGk7IGxvdyArPSAyLCBoaSAtPSAyKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IHggPSBsZFtsb3ddOyBsZFtsb3ddID0gbGRbaGldOyBsZFtoaV0gPSB4OworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHggPSBsZFtsb3crMV07IGxkW2xvdysxXSA9IGxkW2hpKzFdOyBsZFtoaSsxXSA9IHg7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBpID0gZSArIDI7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIG5ldyBEaXJlY3Rpb25zKGxkKTsKKyAgICB9CisKICAgICBwcml2YXRlIG5hdGl2ZSBzdGF0aWMgaW50IHJ1bkJpZGkoaW50IGRpciwgY2hhcltdIGNocywgYnl0ZVtdIGNoSW5mbywgaW50IG4sIGJvb2xlYW4gaGF2ZUluZm8pOwogfQpcIE5vIG5ld2xpbmUgYXQgZW5kIG9mIGZpbGUKZGlmZiAtLWdpdCBhL2NvcmUvamF2YS9hbmRyb2lkL3RleHQvQm9yaW5nTGF5b3V0LmphdmEgYi9jb3JlL2phdmEvYW5kcm9pZC90ZXh0L0JvcmluZ0xheW91dC5qYXZhCmluZGV4IDk0NGY3MzUuLjkzMDliMDUgMTAwNjQ0Ci0tLSBhL2NvcmUvamF2YS9hbmRyb2lkL3RleHQvQm9yaW5nTGF5b3V0LmphdmEKKysrIGIvY29yZS9qYXZhL2FuZHJvaWQvdGV4dC9Cb3JpbmdMYXlvdXQuamF2YQpAQCAtMjA4LDExICsyMDgsMTEgQEAKICAgICAgICAgICAgICAqIHdpZHRoIGJlY2F1c2UgdGhlIHdpZHRoIHRoYXQgd2FzIHBhc3NlZCBpbiB3YXMgZm9yIHRoZQogICAgICAgICAgICAgICogZnVsbCB0ZXh0LCBub3QgdGhlIGVsbGlwc2l6ZWQgZm9ybS4KICAgICAgICAgICAgICAqLwotICAgICAgICAgICAgc3luY2hyb25pemVkIChzVGVtcCkgewotICAgICAgICAgICAgICAgIG1NYXggPSAoaW50KSAoRmxvYXRNYXRoLmNlaWwoU3R5bGVkLm1lYXN1cmVUZXh0KHBhaW50LCBzVGVtcCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZSwgMCwgc291cmNlLmxlbmd0aCgpLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCkpKTsKLSAgICAgICAgICAgIH0KKyAgICAgICAgICAgIFRleHRMaW5lIGxpbmUgPSBUZXh0TGluZS5vYnRhaW4oKTsKKyAgICAgICAgICAgIGxpbmUuc2V0KHBhaW50LCBzb3VyY2UsIDAsIHNvdXJjZS5sZW5ndGgoKSwgTGF5b3V0LkRJUl9MRUZUX1RPX1JJR0hULAorICAgICAgICAgICAgICAgICAgICBMYXlvdXQuRElSU19BTExfTEVGVF9UT19SSUdIVCwgZmFsc2UsIG51bGwpOworICAgICAgICAgICAgbU1heCA9IChpbnQpIEZsb2F0TWF0aC5jZWlsKGxpbmUubWV0cmljcyhudWxsKSk7CisgICAgICAgICAgICBUZXh0TGluZS5yZWN5Y2xlKGxpbmUpOwogICAgICAgICB9CiAKICAgICAgICAgaWYgKGluY2x1ZGVwYWQpIHsKQEAgLTI3NiwxNCArMjc2LDEzIEBACiAgICAgICAgICAgICBpZiAoZm0gPT0gbnVsbCkgewogICAgICAgICAgICAgICAgIGZtID0gbmV3IE1ldHJpY3MoKTsKICAgICAgICAgICAgIH0KLSAgICAKLSAgICAgICAgICAgIGludCB3aWQ7CiAKLSAgICAgICAgICAgIHN5bmNocm9uaXplZCAoc1RlbXApIHsKLSAgICAgICAgICAgICAgICB3aWQgPSAoaW50KSAoRmxvYXRNYXRoLmNlaWwoU3R5bGVkLm1lYXN1cmVUZXh0KHBhaW50LCBzVGVtcCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRleHQsIDAsIHRleHQubGVuZ3RoKCksIGZtKSkpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgZm0ud2lkdGggPSB3aWQ7CisgICAgICAgICAgICBUZXh0TGluZSBsaW5lID0gVGV4dExpbmUub2J0YWluKCk7CisgICAgICAgICAgICBsaW5lLnNldChwYWludCwgdGV4dCwgMCwgdGV4dC5sZW5ndGgoKSwgTGF5b3V0LkRJUl9MRUZUX1RPX1JJR0hULAorICAgICAgICAgICAgICAgICAgICBMYXlvdXQuRElSU19BTExfTEVGVF9UT19SSUdIVCwgZmFsc2UsIG51bGwpOworICAgICAgICAgICAgZm0ud2lkdGggPSAoaW50KSBGbG9hdE1hdGguY2VpbChsaW5lLm1ldHJpY3MoZm0pKTsKKyAgICAgICAgICAgIFRleHRMaW5lLnJlY3ljbGUobGluZSk7CisKICAgICAgICAgICAgIHJldHVybiBmbTsKICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgIHJldHVybiBudWxsOwpAQCAtMzg5LDcgKzM4OCw3IEBACiAKICAgICBwdWJsaWMgc3RhdGljIGNsYXNzIE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L0dyYXBoaWNzT3BlcmF0aW9ucy5qYXZhCmluZGV4IGMzYmQwYWUuLmQ0MjZkMTI0IDEwMDY0NAotLS0gYS9jb3JlL2phdmEvYW5kcm9pZC90ZXh0L0dyYXBoaWNzT3BlcmF0aW9ucy5qYXZhCisrKyBiL2NvcmUvamF2YS9hbmRyb2lkL3RleHQvR3JhcGhpY3NPcGVyYXRpb25zLmphdmEKQEAgLTM0LDEzICszNCwzMyBAQAogICAgICAgICAgICAgICAgICAgICAgICAgIGZsb2F0IHgsIGZsb2F0IHksIFBhaW50IHApOwogCiAgICAgLyoqCisgICAgICogSnVzdCBsaWtlIHtAbGluayBDYW52YXMjZHJhd1RleHRSdW59LgorICAgICAqIHtAaGlkZX0KKyAgICAgKi8KKyAgICB2b2lkIGRyYXdUZXh0UnVuKENhbnZhcyBjLCBpbnQgc3RhcnQsIGludCBlbmQsIGludCBjb250ZXh0U3RhcnQsIGludCBjb250ZXh0RW5kLAorICAgICAgICAgICAgZmxvYXQgeCwgZmxvYXQgeSwgaW50IGZsYWdzLCBQYWludCBwKTsKKworICAgLyoqCiAgICAgICogSnVzdCBsaWtlIHtAbGluayBQYWludCNtZWFzdXJlVGV4dH0uCiAgICAgICovCiAgICAgZmxvYXQgbWVhc3VyZVRleHQoaW50IHN0YXJ0LCBpbnQgZW5kLCBQYWludCBwKTsKIAotCiAgICAgLyoqCiAgICAgICogSnVzdCBsaWtlIHtAbGluayBQYWludCNnZXRUZXh0V2lkdGhzfS4KICAgICAgKi8KICAgICBwdWJsaWMgaW50IGdldFRleHRXaWR0aHMoaW50IHN0YXJ0LCBpbnQgZW5kLCBmbG9hdFtdIHdpZHRocywgUGFpbnQgcCk7CisKKyAgICAvKioKKyAgICAgKiBKdXN0IGxpa2Uge0BsaW5rIFBhaW50I2dldFRleHRSdW5BZHZhbmNlc30uCisgICAgICogQGhpZGUKKyAgICAgKi8KKyAgICBmbG9hdCBnZXRUZXh0UnVuQWR2YW5jZXMoaW50IHN0YXJ0LCB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WxpbmVTaGlmdCBhbmQgYmdDb2xvci4gIFdlIHByb2JhYmx5IHNob3VsZCByZWV2YWx1YXRlIGJnQ29sb3IuCisgICAgICAgIGlmIChwYWludCAhPSBudWxsKSB7CisgICAgICAgICAgICBwYWludC5iZ0NvbG9yID0gMDsKKyAgICAgICAgICAgIHBhaW50LmJhc2VsaW5lU2hpZnQgPSAwOworICAgICAgICB9CisKICAgICAgICAgbVRleHQgPSB0ZXh0OwogICAgICAgICBtUGFpbnQgPSBwYWludDsKICAgICAgICAgbVdvcmtQYWludCA9IG5ldyBUZXh0UGFpbnQoKTsKQEAgLTE3NSw3ICsxODUsNiBAQAogICAgICAgICAgICAgZGJvdHRvbSA9IHNUZW1wUmVjdC5ib3R0b207CiAgICAgICAgIH0KIAotCiAgICAgICAgIGludCB0b3AgPSAwOwogICAgICAgICBpbnQgYm90dG9tID0gZ2V0TGluZVRvcChnZXRMaW5lQ291bnQoKSk7CiAKQEAgLTE4NSwyNiArMTk0LDI4IEBACiAgICAgICAgIGlmIChkYm90dG9tIDwgYm90dG9tKSB7CiAgICAgICAgICAgICBib3R0b20gPSBkYm90dG9tOwogICAgICAgICB9Ci0gICAgICAgIAotICAgICAgICBpbnQgZmlyc3QgPSBnZXRMaW5lRm9yVmVydGljYWwodG9wKTsgCisKKyAgICAgICAgaW50IGZpcnN0ID0gZ2V0TGluZUZvclZlcnRpY2FsKHRvcCk7CiAgICAgICAgIGludCBsYXN0ID0gZ2V0TGluZUZvclZlcnRpY2FsKGJvdHRvbSk7Ci0gICAgICAgIAorCiAgICAgICAgIGludCBwcmV2aW91c0xpbmVCb3R0b20gPSBnZXRMaW5lVG9wKGZpcnN0KTsKICAgICAgICAgaW50IHByZXZpb3VzTGluZUVuZCA9IGdldExpbmVTdGFydChmaXJzdCk7Ci0gICAgICAgIAorCiAgICAgICAgIFRleHRQYWludCBwYWludCA9IG1QYWludDsKICAgICAgICAgQ2hhclNlcXVlbmNlIGJ1ZiA9IG1UZXh0OwogICAgICAgICBpbnQgd2lkdGggPSBtV2lkdGg7CiAgICAgICAgIGJvb2xlYW4gc3Bhbm5lZFRleHQgPSBtU3Bhbm5lZFRleHQ7CiAKICAgICAgICAgUGFyYWdyYXBoU3R5bGVbXSBzcGFucyA9IE5PX1BBUkFfU1BBTlM7Ci0gICAgICAgIGludCBzcGFuZW5kID0gMDsKKyAgICAgICAgaW50IHNwYW5FbmQgPSAwOwogICAgICAgICBpbnQgdGV4dExlbmd0aCA9IDA7CiAKICAgICAgICAgLy8gRmlyc3QsIGRyYXcgTGluZUJhY2tncm91bmRTcGFucy4KLSAgICAgICAgLy8gTGluZUJhY2tncm91bmRTcGFucyBrbm93IG5vdGhpbmcgYWJvdXQgdGhlIGFsaWdubWVudCBvciBkaXJlY3Rpb24gb2YKLSAgICAgICAgLy8gdGhlIGxheW91dCBvciBsaW5lLiAgWFhYOiBTaG91bGQgdGhleT8KKyAgICAgICAgLy8gTGluZUJhY2tncm91bmRTcGFucyBrbm93IG5vdGhpbmcgYWJvdXQgdGhlIGFsaWdubWVudCwgbWFyZ2lucywgb3IKKyAgICAgICAgLy8gZGlyZWN0aW9uIG9mIHRoZSBsYXlvdXQgb3IgbGluZS4gIFhYWDogU2hvdWxkIHRoZXk/CisgICAgICAgIC8vIFRoZXkgYXJlIGV2YWx1YXRlZCBhdCBlYWNoIGxpbmUuCiAgICAgICAgIGlmIChzcGFubmVkVGV4dCkgeworICAgICAgICAgICAgU3Bhbm5lZCBzcCA9IChTcGFubmVkKSBidWY7CiAgICAgICAgICAgICB0ZXh0TGVuZ3RoID0gYnVmLmxlbmd0aCgpOwogICAgICAgICAgICAgZm9yIChpbnQgaSA9IGZpcnN0OyBpIDw9IGxhc3Q7IGkrKykgewogICAgICAgICAgICAgICAgIGludCBzdGFydCA9IHByZXZpb3VzTGluZUVuZDsKQEAgLTIxNiwxMiArMjI3LDE0IEBACiAgICAgICAgICAgICAgICAgcHJldmlvdXNMaW5lQm90dG9tID0gbGJvdHRvbTsKICAgICAgICAgICAgICAgICBpbnQgbGJhc2VsaW5lID0gbGJvdHRvbSAtIGdldExpbmVEZXNjZW50KGkpOwogCi0gICAgICAgICAgICAgICAgaWYgKHN0YXJ0ID49IHNwYW5lbmQpIHsKLSAgICAgICAgICAgICAgICAgICBTcGFubmVkIHNwID0gKFNwYW5uZWQpIGJ1ZjsKLSAgICAgICAgICAgICAgICAgICBzcGFuZW5kID0gc3AubmV4dFNwYW5UcmFuc2l0aW9uKHN0YXJ0LCB0ZXh0TGVuZ3RoLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTGluZUJhY2tncm91bmRTcGFuLmNsYXNzKTsKLSAgICAgICAgICAgICAgICAgICBzcGFucyA9IHNwLmdldFNwYW5zKHN0YXJ0LCBzcGFuZW5kLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTGluZUJhY2tncm91bmRTcGFuLmNsYXNzKTsKKyAgICAgICAgICAgICAgICBpZiAoc3RhcnQgPj0gc3BhbkVuZCkgeworICAgICAgICAgICAgICAgICAgICAvLyBUaGVzZSBzaG91bGQgYmUgaW5mcmVxdWVudCwgc28gd2UnbGwgdXNlIHRoaXMgc28gdGhhdAorICAgICAgICAgICAgICAgICAgICAvLyB3ZSBkb24ndCBoYXZlIHRvIGNoZWNrIGFzIG9mdGVuLgorICAgICAgICAgICAgICAgICAgICBzcGFuRW5kID0gc3AubmV4dFNwYW5UcmFuc2l0aW9uKHN0YXJ0LCB0ZXh0TGVuZ3RoLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIExpbmVCYWNrZ3JvdW5kU3Bhbi5jbGFzcyk7CisgICAgICAgICAgICAgICAgICAgIC8vIEFsbCBMaW5lQmFja2dyb3VuZFNwYW5zIG9uIGEgbGluZSBjb250cmlidXRlIHRvIGl0cworICAgICAgICAgICAgICAgICAgICAvLyBiYWNrZ3JvdW5kLgorICAgICAgICAgICAgICAgICAgIHNwYW5zID0gZ2V0UGFyYWdyYXBoU3BhbnMoc3AsIHN0YXJ0LCBlbmQsIExpbmVCYWNrZ3JvdW5kU3Bhbi5jbGFzcyk7CiAgICAgICAgICAgICAgICAgfQogCiAgICAgICAgICAgICAgICAgZm9yIChpbnQgbiA9IDA7IG4gPCBzcGFucy5sZW5ndGg7IG4rKykgewpAQCAtMjM0LDExICsyNDcsMTEgQEAKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICAvLyByZXNldCB0byB0aGVpciBvcmlnaW5hbCB2YWx1ZXMKLSAgICAgICAgICAgIHNwYW5lbmQgPSAwOworICAgICAgICAgICAgc3BhbkVuZCA9IDA7CiAgICAgICAgICAgICBwcmV2aW91c0xpbmVCb3R0b20gPSBnZXRMaW5lVG9wKGZpcnN0KTsKICAgICAgICAgICAgIHByZXZpb3VzTGluZUVuZCA9IGdldExpbmVTdGFydChmaXJzdCk7CiAgICAgICAgICAgICBzcGFucyA9IE5PX1BBUkFfU1BBTlM7Ci0gICAgICAgIH0gCisgICAgICAgIH0KIAogICAgICAgICAvLyBUaGVyZSBjYW4gYmUgYSBoaWdobGlnaHQgZXZlbiB3aXRob3V0IHNwYW5zIGlmIHdlIGFyZSBkcmF3aW5nCiAgICAgICAgIC8vIGEgbm9uLXNwYW5uZWQgdHJhbnNmb3JtYXRpb24gb2YgYSBzcGFubmVkIGVkaXRpbmcgYnVmZmVyLgpAQCAtMjU1LDcgKzI2OCwxMSBAQAogICAgICAgICB9CiAKICAgICAgICAgQWxpZ25tZW50IGFsaWduID0gbUFsaWdubWVudDsKLSAgICAgICAgCisgICAgICAgIFRhYlN0b3BzIHRhYlN0b3BzID0gbnVsbDsKKyAgICAgICAgYm9vbGVhbiB0YWJTdG9wc0lzSW5pdGlhbGl6ZWQgPSBmYWxzZTsKKworICAgICAgICBUZXh0TGluZSB0bCA9IFRleHRMaW5lLm9idGFpbigpOworCiAgICAgICAgIC8vIE5leHQgZHJhdyB0aGUgbGluZXMsIG9uZSBhdCBhIHRpbWUuCiAgICAgICAgIC8vIHRoZSBiYXNlbGluZSBpcyB0aGUgdG9wIG9mIHRoZSBmb2xsb3dpbmcgbGluZSBtaW51cyB0aGUgY3VycmVudAogICAgICAgICAvLyBsaW5lJ3MgZGVzY2VudC4KQEAgLTI3MCwxOSArMjg3LDMwIEBACiAgICAgICAgICAgICBwcmV2aW91c0xpbmVCb3R0b20gPSBsYm90dG9tOwogICAgICAgICAgICAgaW50IGxiYXNlbGluZSA9IGxib3R0b20gLSBnZXRMaW5lRGVzY2VudChpKTsKIAotICAgICAgICAgICAgYm9vbGVhbiBpc0ZpcnN0UGFyYUxpbmUgPSBmYWxzZTsKLSAgICAgICAgICAgIGlmIChzcGFubmVkVGV4dCkgeyAKLSAgICAgICAgICAgICAgICBpZiAoc3RhcnQgPT0gMCB8fCBidWYuY2hhckF0KHN0YXJ0IC0gMSkgPT0gJ1xuJykgewotICAgICAgICAgICAgICAgICAgICBpc0ZpcnN0UGFyYUxpbmUgPSB0cnVlOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAvLyBOZXcgYmF0Y2ggb2YgcGFyYWdyYXBoIHN0eWxlcywgY29tcHV0ZSB0aGUgYWxpZ25tZW50LgotICAgICAgICAgICAgICAgIC8vIExhc3QgYWxpZ25tZW50IHN0eWxlIHdpbnMuCi0gICAgICAgICAgICAgICAgaWYgKHN0YXJ0ID49IHNwYW5lbmQpIHsKLSAgICAgICAgICAgICAgICAgICAgU3Bhbm5lZCBzcCA9IChTcGFubmVkKSBidWY7Ci0gICAgICAgICAgICAgICAgICAgIHNwYW5lbmQgPSBzcC5uZXh0U3BhblRyYW5zaXRpb24oc3RhcnQsIHRleHRMZW5ndGgsCisgICAgICAgICAgICBpbnQgZGlyID0gZ2V0UGFyYWdyYXBoRGlyZWN0aW9uKGkpOworICAgICAgICAgICAgaW50IGxlZnQgPSAwOworICAgICAgICAgICAgaW50IHJpZ2h0ID0gbVdpZHRoOworCisgICAgICAgICAgICBpZiAoc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yIHByb2JsZW0uCisgICAgICAgICAgICAgICAgaWYgKHN0YXJ0ID49IHNwYW5FbmQgJiYgKGkgPT0gZmlyc3QgfHwgaXNGaXJzdFBhcmFMaW5lKSkgeworICAgICAgICAgICAgICAgICAgICBzcGFuRW5kID0gc3AubmV4dFNwYW5UcmFuc2l0aW9uKHN0YXJ0LCB0ZXh0TGVuZ3RoLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBhcmFncmFwaFN0eWxlLmNsYXNzKTsKLSAgICAgICAgICAgICAgICAgICAgc3BhbnMgPSBzcC5nZXRTcGFucyhzdGFydCwgc3BhbmVuZCwgUGFyYWdyYXBoU3R5bGUuY2xhc3MpOwotICAgICAgICAgICAgICAgICAgICAKKyAgICAgICAgICAgICAgICAgICAgc3BhbnMgPSBnZXRQYXJhZ3JhcGhTcGFucyhzcCwgc3RhcnQsIHNwYW5FbmQsIFBhcmFncmFwaFN0eWxlLmNsYXNzKTsKKwogICAgICAgICAgICAgICAgICAgICBhbGlnbiA9IG1BbGlnbm1lbnQ7CiAgICAgICAgICAgICAgICAgICAgIGZvciAoaW50IG4gPSBzcGFucy5sZW5ndGgtMTsgbiA+PSAwOyBuLS0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzcGFuc1tuXSBpbnN0YW5jZW9mIEFsaWdubWVudFNwYW4pIHsKQEAgLTI5MCw0NSArMzE4LDQ5IEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICAKLSAgICAgICAgICAgIGludCBkaXIgPSBnZXRQYXJhZ3JhcGhEaXJlY3Rpb24oaSk7Ci0gICAgICAgICAgICBpbnQgbGVmdCA9IDA7Ci0gICAgICAgICAgICBpbnQgcmlnaHQgPSBtV2lkdGg7CiAKLSAgICAgICAgICAgIC8vIERyYXcgYWxsIGxlYWRpbmcgbWFyZ2luIHNwYW5zLiAgQWRqdXN0IGxlZnQgb3IgcmlnaHQgYWNjb3JkaW5nCi0gICAgICAgICAgICAvLyB0byB0aGUgcGFyYWdyYXBoIGRpcmVjdGlvbiBvZiB0aGUgbGluZS4KLSAgICAgICAgICAgIGlmIChzcGFubmVkVGV4dCkgeworICAgICAgICAgICAgICAgICAgICB0YWJTdG9wc0lzSW5pdGlhbGl6ZWQgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAvLyBEcmF3IGFsbCBsZWFkaW5nIG1hcmdpbiBzcGFucy4gIEFkanVzdCBsZWZ0IG9yIHJpZ2h0IGFjY29yZGluZworICAgICAgICAgICAgICAgIC8vIHRvIHRoZSBwYXJhZ3JhcGggZGlyZWN0aW9uIG9mIHRoZSBsaW5lLgogICAgICAgICAgICAgICAgIGZpbmFsIGludCBsZW5ndGggPSBzcGFucy5sZW5ndGg7CiAgICAgICAgICAgICAgICAgZm9yIChpbnQgbiA9IDA7IG4gPCBsZW5ndGg7IG4rKykgewogICAgICAgICAgICAgICAgICAgICBpZiAoc3BhbnNbbl0gaW5zdGFuY2VvZiBMZWFkaW5nTWFyZ2luU3BhbikgewogICAgICAgICAgICAgICAgICAgICAgICAgTGVhZGluZ01hcmdpblNwYW4gbWFyZ2luID0gKExlYWRpbmdNYXJnaW5TcGFuKSBzcGFuc1tuXTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJvb2xlYW4gdXNlRmlyc3RMaW5lTWFyZ2luID0gaXNGaXJzdFBhcmFMaW5lOworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1hcmdpbiBpbnN0YW5jZW9mIExlYWRpbmdNYXJnaW5TcGFuMikgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBjb3VudCA9ICgoTGVhZGluZ01hcmdpblNwYW4yKSBtYXJnaW4pLmdldExlYWRpbmdNYXJnaW5MaW5lQ291bnQoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgc3RhcnRMaW5lID0gZ2V0TGluZUZvck9mZnNldChzcC5nZXRTcGFuU3RhcnQobWFyZ2luKSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXNlRmlyc3RMaW5lTWFyZ2luID0gaSA8IHN0YXJ0TGluZSArIGNvdW50OworICAgICAgICAgICAgICAgICAgICAgICAgfQogCiAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZGlyID09IERJUl9SSUdIVF9UT19MRUZUKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWFyZ2luLmRyYXdMZWFkaW5nTWFyZ2luKGMsIHBhaW50LCByaWdodCwgZGlyLCBsdG9wLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYmFzZWxpbmUsIGxib3R0b20sIGJ1ZiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnQsIGVuZCwgaXNGaXJzdFBhcmFMaW5lLCB0aGlzKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmlnaHQgLT0gbWFyZ2luLmdldExlYWRpbmdNYXJnaW4oaXNGaXJzdFBhcmFMaW5lKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICByaWdodCAtPSBtYXJnaW4uZ2V0TGVhZGluZ01hcmdpbih1c2VGaXJzdExpbmVNYXJnaW4pOwogICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXJnaW4uZHJhd0xlYWRpbmdNYXJnaW4oYywgcGFpbnQsIGxlZnQsIGRpciwgbHRvcCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGJhc2VsaW5lLCBsYm90dG9tLCBidWYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXJ0LCBlbmQsIGlzRmlyc3RQYXJhTGluZSwgdGhpcyk7Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sZWFuIHVzZU1hcmdpbiA9IGlzRmlyc3RQYXJhTGluZTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobWFyZ2luIGluc3RhbmNlb2YgTGVhZGluZ01hcmdpblNwYW4uTGVhZGluZ01hcmdpblNwYW4yKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBjb3VudCA9ICgoTGVhZGluZ01hcmdpblNwYW4uTGVhZGluZ01hcmdpblNwYW4yKW1hcmdpbikuZ2V0TGVhZGluZ01hcmdpbkxpbmVDb3VudCgpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1c2VNYXJnaW4gPSBjb3VudCA+IGk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlZnQgKz0gbWFyZ2luLmdldExlYWRpbmdNYXJnaW4odXNlTWFyZ2luKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZWZ0ICs9IG1hcmdpbi5nZXRMZWFkaW5nTWFyZ2luKHVzZUZpcnN0TGluZU1hcmdpbik7CiAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CiAKLSAgICAgICAgICAgIC8vIEFkanVzdCB0aGUgcG9pbnQgYXQgd2hpY2ggdG8gc3RhcnQgcmVuZGVyaW5nIGRlcGVuZGluZyBvbiB0aGUKLSAgICAgICAgICAgIC8vIGFsaWdubWVudCBvZiB0aGUgcGFyYWdyYXBoLgorICAgICAgICAgICAgYm9vbGVhbiBoYXNUYWJPckVtb2ppID0gZ2V0TGluZUNvbnRhaW5zVGFiKGkpOworICAgICAgICAgICAgLy8gQ2FuJ3QgdGVsbCBpZiB3ZSBoYXZlIHRhYnMgZm9yIHN1cmUsIGN1cnJlbnRseQorICAgICAgICAgICAgaWYgKGhhc1RhYk9yRW1vamkgJiYgIXRhYlN0b3BzSXNJbml0aWFsaXplZCkgeworICAgICAgICAgICAgICAgIGlmICh0YWJTdG9wcyA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIHRhYlN0b3BzID0gbmV3IFRhYlN0b3BzKFRBQl9JTkNSRU1FTlQsIHNwYW5zKTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICB0YWJTdG9wcy5yZXNldChUQUJfSU5DUkVNRU5ULCBzcGFucyk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHRhYlN0b3BzSXNJbml0aWFsaXplZCA9IHRydWU7CisgICAgICAgICAgICB9CisKICAgICAgICAgICAgIGludCB4OwogICAgICAgICAgICAgaWYgKGFsaWduID09IEFsaWdubWVudC5BTElHTl9OT1JNQUwpIHsKICAgICAgICAgICAgICAgICBpZiAoZGlyID09IERJUl9MRUZUX1RPX1JJR0hUKSB7CkBAIC0zMzcsNDEgKzM2OSw4MCBAQAogICAgICAgICAgICAgICAgICAgICB4ID0gcmlnaHQ7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBpbnQgbWF4ID0gKGludClnZXRMaW5lTWF4KGksIHNwYW5zLCBmYWxzZSk7CisgICAgICAgICAgICAgICAgaW50IG1heCA9IChpbnQpZ2V0TGluZUV4dGVudChpLCB0YWJTdG9wcywgZmFsc2UpOwogICAgICAgICAgICAgICAgIGlmIChhbGlnbiA9PSBBbGlnbm1lbnQuQUxJR05fT1BQT1NJVEUpIHsKLSAgICAgICAgICAgICAgICAgICAgaWYgKGRpciA9PSBESVJfUklHSFRfVE9fTEVGVCkgewotICAgICAgICAgICAgICAgICAgICAgICAgeCA9IGxlZnQgKyBtYXg7Ci0gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIGlmIChkaXIgPT0gRElSX0xFRlRfVE9fUklHSFQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgIHggPSByaWdodCAtIG1heDsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIC8vIEFsaWdubWVudC5BTElHTl9DRU5URVIKLSAgICAgICAgICAgICAgICAgICAgbWF4ID0gbWF4ICYgfjE7Ci0gICAgICAgICAgICAgICAgICAgIGludCBoYWxmID0gKHJpZ2h0IC0gbGVmdCAtIG1heCkgPj4gMTsKLSAgICAgICAgICAgICAgICAgICAgaWYgKGRpciA9PSBESVJfUklHSFRfVE9fTEVGVCkgewotICAgICAgICAgICAgICAgICAgICAgICAgeCA9IHJpZ2h0IC0gaGFsZjsKICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHggPSBsZWZ0ICsgaGFsZjsKKyAgICAgICAgICAgICAgICAgICAgICAgIHggPSBsZWZ0IC0gbWF4OwogICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfSBlbHNlIHsgLy8gQWxpZ25tZW50LkFMSUdOX0NFTlRFUgorICAgICAgICAgICAgICAgICAgICBtYXggPSBtYXggJiB+MTsKKyAgICAgICAgICAgICAgICAgICAgeCA9IChyaWdodCArIGxlZnQgLSBtYXgpID4+IDE7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogCiAgICAgICAgICAgICBEaXJlY3Rpb25zIGRpcmVjdGlvbnMgPSBnZXRMaW5lRGlyZWN0aW9ucyhpKTsKLSAgICAgICAgICAgIGJvb2xlYW4gaGFzVGFiID0gZ2V0TGluZUNvbnRhaW5zVGFiKGkpOwogICAgICAgICAgICAgaWYgKGRpcmVjdGlvbnMgPT0gRElSU19BTExfTEVGVF9UT19SSUdIVCAmJgotICAgICAgICAgICAgICAgICAgICAhc3Bhbm5lZFRleHQgJiYgIWhhc1RhYikgewotICAgICAgICAgICAgICAgIGlmIChERUJVRykgewotICAgICAgICAgICAgICAgICAgICBBc3NlcnQuYXNzZXJ0VHJ1ZShkaXIgPT0gRElSX0xFRlRfVE9fUklHSFQpOwotICAgICAgICAgICAgICAgICAgICBBc3NlcnQuYXNzZXJ0Tm90TnVsbChjKTsKLSAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICFzcGFubmVkVGV4dCAmJiAhaGFzVGFiT3JFbW9qaSkgewogICAgICAgICAgICAgICAgIC8vIFhYWDogYXNzdW1lcyB0aGVyZSdzIG5vdGhpbmcgYWRkaXRpb25hbCB0byBiZSBkb25lCiAgICAgICAgICAgICAgICAgYy5kcmF3VGV4dChidWYsIHN0YXJ0LCBlbmQsIHgsIGxiYXNlbGluZSwgcGFpbnQpOwogICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBkcmF3VGV4dChjLCBidWYsIHN0YXJ0LCBlbmQsIGRpciwgZGlyZWN0aW9ucywKLSAgICAgICAgICAgICAgICAgICAgeCwgbHRvcCwgbGJhc2VsaW5lLCBsYm90dG9tLCBwYWludCwgbVdvcmtQYWludCwKLSAgICAgICAgICAgICAgICAgICAgaGFzVGFiLCBzcGFucyk7CisgICAgICAgICAgICAgICAgdGwuc2V0KHBhaW50LCBidWYsIHN0YXJ0LCBlbmQsIGRpciwgZGlyZWN0aW9ucywgaGFzVGFiT3JFbW9qaSwgdGFiU3RvcHMpOworICAgICAgICAgICAgICAgIHRsLmRyYXcoYywgeCwgbHRvcCwgbGJhc2VsaW5lLCBsYm90dG9tKTsKICAgICAgICAgICAgIH0KICAgICAgICAgfQorCisgICAgICAgIFRleHRMaW5lLnJlY3ljbGUodGwpOworICAgIH0KKworICAgIC8qKgorICAgICAqIFJldHVybiB0aGUgc3RhcnQgcG9zaXRpb24gb2YgdGhlIGxpbmUsIGdpdmVuIHRoZSBsZWZ0IGFuZCByaWdodCBib3VuZHMKKyAgICAgKiBvZiB0aGUgbWFyZ2lucy4KKyAgICAgKgorICAgICAqIEBwYXJhbSBsaW5lIHRoZSBsaW5lIGluZGV4CisgICAgICogQHBhcmFtIGxlZnQgdGhlIGxlZnQgYm91bmRzICgwLCBvciBsZWFkaW5nIG1hcmdpbiBpZiBsdHIgcGFyYSkKKyAgICAgKiBAcGFyYW0gcmlnaHQgdGhlIHJpZ2h0IGJvdW5kcyAod2lkdGgsIG1pbnVzIGxlYWRpbmcgbWFyZ2luIGlmIHJ0bCBwYXJhKQorICAgICAqIEByZXR1cm4gdGhlIHN0YXJ0IHBvc2l0aW9uIG9mIHRoZSBsaW5lICh0byByaWdodCBvZiBsaW5lIGlmIHJ0bCBwYXJhKQorICAgICAqLworICAgIHByaXZhdGUgaW50IGdldExpbmVTdGFydFBvcyhpbnQgbGluZSwgaW50IGxlZnQsIGludCByaWdodCkgeworICAgICAgICAvLyBBZGp1c3QgdGhlIHBvaW50IGF0IHdoaWNoIHRvIHN0YXJ0IHJlbmRlcmluZyBkZXBlbmRpbmcgb24gdGhlCisgICAgICAgIC8vIGFsaWdubWVudCBvZiB0aGUgcGFyYWdyYXBoLgorICAgICAgICBBbGlnbm1lbnQgYWxpZ24gPSBnZXRQYXJhZ3JhcGhBbGlnbm1lbnQobGluZSk7CisgICAgICAgIGludCBkaXIgPSBnZXRQYXJhZ3JhcGhEaXJlY3Rpb24obGluZSk7CisKKyAgICAgICAgaW50IHg7CisgICAgICAgIGlmIChhbGlnbiA9PSBBbGlnbm1lbnQuQUxJR05fTk9STUFMKSB7CisgICAgICAgICAgICBpZiAoZGlyID09IERJUl9MRUZUX1RPX1JJR0hUKSB7CisgICAgICAgICAgICAgICAgeCA9IGxlZnQ7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIHggPSByaWdodDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIFRhYlN0b3BzIHRhYlN0b3BzID0gbnVsbDsKKyAgICAgICAgICAgIGlmIChtU3Bhbm5lZFRleHQgJiYgZ2V0TGluZUNvbnRhaW5zVGFiKGxpbmUpKSB7CisgICAgICAgICAgICAgICAgU3Bhbm5lZCBzcGFubmVkID0gKFNwYW5uZWQpIG1UZXh0OworICAgICAgICAgICAgICAgIGludCBzdGFydCA9IGdldExpbmVTdGFydChsaW5lKTsKKyAgICAgICAgICAgICAgICBpbnQgc3BhbkVuZCA9IHNwYW5uZWQubmV4dFNwYW5UcmFuc2l0aW9uKHN0YXJ0LCBzcGFubmVkLmxlbmd0aCgpLAorICAgICAgICAgICAgICAgICAgICAgICAgVGFiU3RvcFNwYW4uY2xhc3MpOworICAgICAgICAgICAgICAgIFRhYlN0b3BTcGFuW10gdGFiU3BhbnMgPSBnZXRQYXJhZ3JhcGhTcGFucyhzcGFubmVkLCBzdGFydCwgc3BhbkVuZCwgVGFiU3RvcFNwYW4uY2xhc3MpOworICAgICAgICAgICAgICAgIGlmICh0YWJTcGFucy5sZW5ndGggPiAwKSB7CisgICAgICAgICAgICAgICAgICAgIHRhYlN0b3BzID0gbmV3IFRhYlN0b3BzKFRBQl9JTkNSRU1FTlQsIHRhYlNwYW5zKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpbnQgbWF4ID0gKGludClnZXRMaW5lRXh0ZW50KGxpbmUsIHRhYlN0b3BzLCBmYWxzZSk7CisgICAgICAgICAgICBpZiAoYWxpZ24gPT0gQWxpZ25tZW50LkFMSUdOX09QUE9TSVRFKSB7CisgICAgICAgICAgICAgICAgaWYgKGRpciA9PSBESVJfTEVGVF9UT19SSUdIVCkgeworICAgICAgICAgICAgICAgICAgICB4ID0gcmlnaHQgLSBtYXg7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgeCA9IGxlZnQgLSBtYXg7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSBlbHNlIHsgLy8gQWxpZ25tZW50LkFMSUdOX0NFTlRFUgorICAgICAgICAgICAgICAgIG1heCA9IG1heCAmIH4xOworICAgICAgICAgICAgICAgIHggPSAobGVmdCArIHJpZ2h0IC0gbWF4KSA+PiAxOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHJldHVybiB4OwogICAgIH0KIAogICAgIC8qKgpAQCAtNDE3LDcgKzQ4OCw3IEBACiAKICAgICAgICAgbVdpZHRoID0gd2lkOwogICAgIH0KLSAgICAKKwogICAgIC8qKgogICAgICAqIFJldHVybiB0aGUgdG90YWwgaGVpZ2h0IG9mIHRoaXMgbGF5b3V0LgogICAgICAqLwpAQCAtNDUwLDcgKzUyMSw3IEBACiAgICAgICogUmV0dXJuIHRoZSBudW1iZXIgb2YgbGluZXMgb2YgdGV4dCBpbiB0aGlzIGxheW91dC4KICAgICAgKi8KICAgICBwdWJsaWMgYWJzdHJhY3QgaW50IGdldExpbmVDb3VudCgpOwotICAgIAorCiAgICAgLyoqCiAgICAgICogUmV0dXJuIHRoZSBiYXNlbGluZSBmb3IgdGhlIHNwZWNpZmllZCBsaW5lICgwJmhlbGxpcDtnZXRMaW5lQ291bnQoKSAtIDEpCiAgICAgICogSWYgYm91bmRzIGlzIG5vdCBudWxsLCByZXR1cm4gdGhlIHRvcCwgbGVmdCwgcmlnaHQsIGJvdHRvbSBleHRlbnRzCkBAIC01MjQsMTMgKzU5NSw5NSBAQAogICAgICAqLwogICAgIHB1YmxpYyBhYnN0cmFjdCBpbnQgZ2V0Qm90dG9tUGFkZGluZygpOwogCisKKyAgICAvKioKKyAgICAgKiBSZXR1cm5zIHRydWUgaWYgdGhlIGNoYXJhY3RlciBhdCBvZmZzZXQgYW5kIHRoZSBwcmVjZWRpbmcgY2hhcmFjdGVyCisgICAgICogYXJlIGF0IGRpZmZlcmVudCBydW4gbGV2ZWxzIChhbmQgdGh1cyB0aGVyZSdzIGEgc3BsaXQgY2FyZXQpLgorICAgICAqIEBwYXJhbSBvZmZzZXQgdGhlIG9mZnNldAorICAgICAqIEByZXR1cm4gdHJ1ZSBpZiBhdCBhIGxldmVsIGJvdW5kYXJ5CisgICAgICovCisgICAgcHJpdmF0ZSBib29sZWFuIGlzTGV2ZWxCb3VuZGFyeShpbnQgb2Zmc2V0KSB7CisgICAgICAgIGludCBsaW5lID0gZ2V0TGluZUZvck9mZnNldChvZmZzZXQpOworICAgICAgICBEaXJlY3Rpb25zIGRpcnMgPSBnZXRMaW5lRGlyZWN0aW9ucyhsaW5lKTsKKyAgICAgICAgaWYgKGRpcnMgPT0gRElSU19BTExfTEVGVF9UT19SSUdIVCB8fCBkaXJzID09IERJUlNfQUxMX1JJR0hUX1RPX0xFRlQpIHsKKyAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgfQorCisgICAgICAgIGludFtdIHJ1bnMgPSBkaXJzLm1EaXJlY3Rpb25zOworICAgICAgICBpbnQgbGluZVN0YXJ0ID0gZ2V0TGluZVN0YXJ0KGxpbmUpOworICAgICAgICBpbnQgbGluZUVuZCA9IGdldExpbmVFbmQobGluZSk7CisgICAgICAgIGlmIChvZmZzZXQgPT0gbGluZVN0YXJ0IHx8IG9mZnNldCA9PSBsaW5lRW5kKSB7CisgICAgICAgICAgICBpbnQgcGFyYUxldmVsID0gZ2V0UGFyYWdyYXBoRGlyZWN0aW9uKGxpbmUpID09IDEgPyAwIDogMTsKKyAgICAgICAgICAgIGludCBydW5JbmRleCA9IG9mZnNldCA9PSBsaW5lU3RhcnQgPyAwIDogcnVucy5sZW5ndGggLSAyOworICAgICAgICAgICAgcmV0dXJuICgocnVuc1tydW5JbmRleCArIDFdID4+PiBSVU5fTEVWRUxfU0hJRlQpICYgUlVOX0xFVkVMX01BU0spICE9IHBhcmFMZXZlbDsKKyAgICAgICAgfQorCisgICAgICAgIG9mZnNldCAtPSBsaW5lU3RhcnQ7CisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgcnVucy5sZW5ndGg7IGkgKz0gMikgeworICAgICAgICAgICAgaWYgKG9mZnNldCA9PSBydW5zW2ldKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIHByaXZhdGUgYm9vbGVhbiBwcmltYXJ5SXNUcmFpbGluZ1ByZXZpb3VzKGludCBvZmZzZXQpIHsKKyAgICAgICAgaW50IGxpbmUgPSBnZXRMaW5lRm9yT2Zmc2V0KG9mZnNldCk7CisgICAgICAgIGludCBsaW5lU3RhcnQgPSBnZXRMaW5lU3RhcnQobGluZSk7CisgICAgICAgIGludCBsaW5lRW5kID0gZ2V0TGluZUVuZChsaW5lKTsKKyAgICAgICAgaW50W10gcnVucyA9IGdldExpbmVEaXJlY3Rpb25zKGxpbmUpLm1EaXJlY3Rpb25zOworCisgICAgICAgIGludCBsZXZlbEF0ID0gLTE7CisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgcnVucy5sZW5ndGg7IGkgKz0gMikgeworICAgICAgICAgICAgaW50IHN0YXJ0ID0gbGluZVN0YXJ0ICsgcnVuc1tpXTsKKyAgICAgICAgICAgIGludCBsaW1pdCA9IHN0YXJ0ICsgKHJ1bnNbaSsxXSAmIFJVTl9MRU5HVEhfTUFTSyk7CisgICAgICAgICAgICBpZiAobGltaXQgPiBsaW5lRW5kKSB7CisgICAgICAgICAgICAgICAgbGltaXQgPSBsaW5lRW5kOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKG9mZnNldCA+PSBzdGFydCAmJiBvZmZzZXQgPCBsaW1pdCkgeworICAgICAgICAgICAgICAgIGlmIChvZmZzZXQgPiBzdGFydCkgeworICAgICAgICAgICAgICAgICAgICAvLyBQcmV2aW91cyBjaGFyYWN0ZXIgaXMgYXQgc2FtZSBsZXZlbCwgc28gZG9uJ3QgdXNlIHRyYWlsaW5nLgorICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGxldmVsQXQgPSAocnVuc1tpKzFdID4+PiBSVU5fTEVWRUxfU0hJRlQpICYgUlVOX0xFVkVMX01BU0s7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgaWYgKGxldmVsQXQgPT0gLTEpIHsKKyAgICAgICAgICAgIC8vIE9mZnNldCB3YXMgbGltaXQgb2YgbGluZS4KKyAgICAgICAgICAgIGxldmVsQXQgPSBnZXRQYXJhZ3JhcGhEaXJlY3Rpb24obGluZSkgPT0gMSA/IDAgOiAxOworICAgICAgICB9CisKKyAgICAgICAgLy8gQXQgbGV2ZWwgYm91bmRhcnksIGNoZWNrIHByZXZpb3VzIGxldmVsLgorICAgICAgICBpbnQgbGV2ZWxCZWZvcmUgPSAtMTsKKyAgICAgICAgaWYgKG9mZnNldCA9PSBsaW5lU3RhcnQpIHsKKyAgICAgICAgICAgIGxldmVsQmVmb3JlID0gZ2V0UGFyYWdyYXBoRGlyZWN0aW9uKGxpbmUpID09IDEgPyAwIDogMTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIG9mZnNldCAtPSAxOworICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBydW5zLmxlbmd0aDsgaSArPSAyKSB7CisgICAgICAgICAgICAgICAgaW50IHN0YXJ0ID0gbGluZVN0YXJ0ICsgcnVuc1tpXTsKKyAgICAgICAgICAgICAgICBpbnQgbGltaXQgPSBzdGFydCArIChydW5zW2krMV0gJiBSVU5fTEVOR1RIX01BU0spOworICAgICAgICAgICAgICAgIGlmIChsaW1pdCA+IGxpbmVFbmQpIHsKKyAgICAgICAgICAgICAgICAgICAgbGltaXQgPSBsaW5lRW5kOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBpZiAob2Zmc2V0ID49IHN0YXJ0ICYmIG9mZnNldCA8IGxpbWl0KSB7CisgICAgICAgICAgICAgICAgICAgIGxldmVsQmVmb3JlID0gKHJ1bnNbaSsxXSA+Pj4gUlVOX0xFVkVMX1NISUZUKSAmIFJVTl9MRVZFTF9NQVNLOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gbGV2ZWxCZWZvcmUgPCBsZXZlbEF0OworICAgIH0KKwogICAgIC8qKgogICAgICAqIEdldCB0aGUgcHJpbWFyeSBob3Jpem9udGFsIHBvc2l0aW9uIGZvciB0aGUgc3BlY2lmaWVkIHRleHQgb2Zmc2V0LgogICAgICAqIFRoaXMgaXMgdGhlIGxvY2F0aW9uIHdoZXJlIGEgbmV3IGNoYXJhY3RlciB3b3VsZCBiZSBpbnNlcnRlZCBpbgogICAgICAqIHRoZSBwYXJhZ3JhcGgncyBwcmltYXJ5IGRpcmVjdGlvbi4KICAgICAgKi8KICAgICBwdWJsaWMgZmxvYXQgZ2V0UHJpbWFyeUhvcml6b250YWwoaW50IG9mZnNldCkgewotICAgICAgICByZXR1cm4gZ2V0SG9yaXpvbnRhbChvZmZzZXQsIGZhbHNlLCB0cnVlKTsKKyAgICAgICAgYm9vbGVhbiB0cmFpbGluZyA9IHByaW1hcnlJc1RyYWlsaW5nUHJldmlvdXMob2Zmc2V0KTsKKyAgICAgICAgcmV0dXJuIGdldEhvcml6b250YWwob2Zmc2V0LCB0cmFpbGluZyk7CiAgICAgfQogCiAgICAgLyoqCkBAIC01MzksNjYgKzY5Miw0MiBAQAogICAgICAqIHRoZSBkaXJlY3Rpb24gb3RoZXIgdGhhbiB0aGUgcGFyYWdyYXBoJ3MgcHJpbWFyeSBkaXJlY3Rpb24uCiAgICAgICovCiAgICAgcHVibGljIGZsb2F0IGdldFNlY29uZGFyeUhvcml6b250YWwoaW50IG9mZnNldCkgewotICAgICAgICByZXR1cm4gZ2V0SG9ya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YWludCwgbVdvcmtQYWludCwgbVRleHQsIHN0YXJ0LCBvZmZzZXQsIGVuZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGlyLCBkaXJlY3Rpb25zLCB0cmFpbGluZywgYWx0LCB0YWIsIHRhYnMpOworICAgICAgICBUZXh0TGluZSB0bCA9IFRleHRMaW5lLm9idGFpbigpOworICAgICAgICB0bC5zZXQobVBhaW50LCBtVGV4dCwgc3RhcnQsIGVuZCwgZGlyLCBkaXJlY3Rpb25zLCBoYXNUYWJPckVtb2ppLCB0YWJTdG9wcyk7CisgICAgICAgIGZsb2F0IHdpZCA9IHRsLm1lYXN1cmUob2Zmc2V0IC0gc3RhcnQsIHRyYWlsaW5nLCBudWxsKTsKKyAgICAgICAgVGV4dExpbmUucmVjeWNsZSh0bCk7CiAKLSAgICAgICAgaWYgKG9mZnNldCA+IGVuZCkgewotICAgICAgICAgICAgaWYgKGRpciA9PSBESVJfUklHSFRfVE9fTEVGVCkKLSAgICAgICAgICAgICAgICB3aWQgLT0gbWVhc3VyZVRleHQobVBhaW50LCBtV29ya1BhaW50LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtVGV4dCwgZW5kLCBvZmZzZXQsIG51bGwsIHRhYiwgdGFicyk7Ci0gICAgICAgICAgICBlbHNlCi0gICAgICAgICAgICAgICAgd2lkICs9IG1lYXN1cmVUZXh0KG1QYWludCwgbVdvcmtQYWludCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVRleHQsIGVuZCwgb2Zmc2V0LCBudWxsLCB0YWIsIHRhYnMpOwotICAgICAgICB9Ci0KLSAgICAgICAgQWxpZ25tZW50IGFsaWduID0gZ2V0UGFyYWdyYXBoQWxpZ25tZW50KGxpbmUpOwogICAgICAgICBpbnQgbGVmdCA9IGdldFBhcmFncmFwaExlZnQobGluZSk7CiAgICAgICAgIGludCByaWdodCA9IGdldFBhcmFncmFwaFJpZ2h0KGxpbmUpOwogCi0gICAgICAgIGlmIChhbGlnbiA9PSBBbGlnbm1lbnQuQUxJR05fTk9STUFMKSB7Ci0gICAgICAgICAgICBpZiAoZGlyID09IERJUl9SSUdIVF9UT19MRUZUKQotICAgICAgICAgICAgICAgIHJldHVybiByaWdodCArIHdpZDsKLSAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgICAgICByZXR1cm4gbGVmdCArIHdpZDsKLSAgICAgICAgfQotCi0gICAgICAgIGZsb2F0IG1heCA9IGdldExpbmVNYXgobGluZSk7Ci0KLSAgICAgICAgaWYgKGFsaWduID09IEFsaWdubWVudC5BTElHTl9PUFBPU0lURSkgewotICAgICAgICAgICAgaWYgKGRpciA9PSBESVJfUklHSFRfVE9fTEVGVCkKLSAgICAgICAgICAgICAgICByZXR1cm4gbGVmdCArIG1heCArIHdpZDsKLSAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgICAgICByZXR1cm4gcmlnaHQgLSBtYXggKyB3aWQ7Ci0gICAgICAgIH0gZWxzZSB7IC8qIGFsaWduID09IEFsaWdubWVudC5BTElHTl9DRU5URVIgKi8KLSAgICAgICAgICAgIGludCBpbWF4ID0gKChpbnQpIG1heCkgJiB+MTsKLQotICAgICAgICAgICAgaWYgKGRpciA9PSBESVJfUklHSFRfVE9fTEVGVCkKLSAgICAgICAgICAgICAgICByZXR1cm4gcmlnaHQgLSAoKChyaWdodCAtIGxlZnQpIC0gaW1heCkgLyAyKSArIHdpZDsKLSAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgICAgICByZXR1cm4gbGVmdCArICgocmlnaHQgLSBsZWZ0KSAtIGltYXgpIC8gMiArIHdpZDsKLSAgICAgICAgfQorICAgICAgICByZXR1cm4gZ2V0TGluZVN0YXJ0UG9zKGxpbmUsIGxlZnQsIHJpZ2h0KSArIHdpZDsKICAgICB9CiAKICAgICAvKioKQEAgLTY1NiwzOCArNzg1LDc2IEBACiAgICAgfQogCiAgICAgLyoqCi0gICAgICogR2V0cyB0aGUgaG9yaXpvbnR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zdCkgewogICAgICAgICAgICAgICAgICAgICBiZXN0ZGlzdCA9IGRpc3Q7Ci0gICAgICAgICAgICAgICAgICAgIGJlc3QgPSBsb3c7ICAgCisgICAgICAgICAgICAgICAgICAgIGJlc3QgPSBsb3c7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogCkBAIC04MDIsOCArOTY4LDYgQEAKICAgICAgICAgICAgICAgICBiZXN0ZGlzdCA9IGRpc3Q7CiAgICAgICAgICAgICAgICAgYmVzdCA9IGhlcmU7CiAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIGhlcmUgPSB0aGVyZTsKICAgICAgICAgfQogCiAgICAgICAgIGZsb2F0IGRpc3QgPSBNYXRoLmFicyhnZXRQcmltYXJ5SG9yaXpvbnRhbChtYXgpIC0gaG9yaXopOwpAQCAtODIzLDE5ICs5ODcsMTUgQEAKICAgICAgICAgcmV0dXJuIGdldExpbmVTdGFydChsaW5lICsgMSk7CiAgICAgfQogCi0gICAgLyoqIAorICAgIC8qKgogICAgICAqIFJldHVybiB0aGUgdGV4dCBvZmZzZXQgYWZ0ZXIgdGhlIGxhc3QgdmlzaWJsZSBjaGFyYWN0ZXIgKHNvIHdoaXRlc3BhY2UKICAgICAgKiBpcyBub3QgY291bnRlZCkgb24gdGhlIHNwZWNpZmllZCBsaW5lLgogICAgICAqLwogICAgIHB1YmxpYyBpbnQgZ2V0TGluZVZpc2libGVFbmQoaW50IGxpbmUpIHsKICAgICAgICAgcmV0dXJuIGdldExpbmVWaXNpYmxlRW5kKGxpbmUsIGdldExpbmVTdGFydChsaW5lKSwgZ2V0TGluZVN0YXJ0KGxpbmUrMSkpOwogICAgIH0KLSAgICAKLSAgICBwcml2YXRlIGludCBnZXRMaW5lVmlzaWJsZUVuZChpbnQgbGluZSwgaW50IHN0YXJ0LCBpbnQgZW5kKSB7Ci0gICAgICAgIGlmIChERUJVRykgewotICAgICAgICAgICAgQXNzZXJ0LmFzc2VydFRydWUoZ2V0TGluZVN0YXJ0KGxpbmUpID09IHN0YXJ0ICYmIGdldExpbmVTdGFydChsaW5lKzEpID09IGVuZCk7Ci0gICAgICAgIH0KIAorICAgIHByaXZhdGUgaW50IGdldExpbmVWaXNpYmxlRW5kKGludCBsaW5lLCBpbnQgc3RhcnQsIGludCBlbmQpIHsKICAgICAgICAgQ2hhclNlcXVlbmNlIHRleHQgPSBtVGV4dDsKICAgICAgICAgY2hhciBjaDsKICAgICAgICAgaWYgKGxpbmUgPT0gZ2V0TGluZUNvdW50KCkgLSAxKSB7CkBAIC04ODIsMjA3ICsxMDQyLDYyIEBACiAgICAgICAgIHJldHVybiBnZXRMaW5lVG9wKGxpbmUpIC0gKGdldExpbmVUb3AobGluZSsxKSAtIGdldExpbmVEZXNjZW50KGxpbmUpKTsKICAgICB9CiAKLSAgICAvKioKLSAgICAgKiBSZXR1cm4gdGhlIHRleHQgb2Zmc2V0IHRoYXQgd291bGQgYmUgcmVhY2hlZCBieSBtb3ZpbmcgbGVmdAotICAgICAqIChwb3NzaWJseSBvbnRvIGFub3RoZXIgbGluZSkgZnJvbSB0aGUgc3BlY2lmaWVkIG9mZnNldC4KLSAgICAgKi8KICAgICBwdWJsaWMgaW50IGdldE9mZnNldFRvTGVmdE9mKGludCBvZmZzZXQpIHsKLSAgICAgICAgaW50IGxpbmUgPSBnZXRMaW5lRm9yT2Zmc2V0KG9mZnNldCk7Ci0gICAgICAgIGludCBzdGFydCA9IGdldExpbmVTdGFydChsaW5lKTsKLSAgICAgICAgaW50IGVuZCA9IGdldExpbmVFbmQobGluZSk7Ci0gICAgICAgIERpcmVjdGlvbnMgZGlycyA9IGdldExpbmVEaXJlY3Rpb25zKGxpbmUpOwotCi0gICAgICAgIGlmIChsaW5lICE9IGdldExpbmVDb3VudCgpIC0gMSkKLSAgICAgICAgICAgIGVuZC0tOwotCi0gICAgICAgIGZsb2F0IGhvcml6ID0gZ2V0UHJpbWFyeUhvcml6b250YWwob2Zmc2V0KTsKLQotICAgICAgICBpbnQgYmV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KLSAgICAgICAgICAgIGlmICh0aGVyZSA+IGVuZCkKLSAgICAgICAgICAgICAgICB0aGVyZSA9IGVuZDsKLQotICAgICAgICAgICAgZmxvYXQgaCA9IGdldFByaW1hcnlIb3Jpem9udGFsKGhlcmUpOwotCi0gICAgICAgICAgICBpZiAoaCA8IGhvcml6ICYmIGggPiBiZXN0aCkgewotICAgICAgICAgICAgICAgIGJlc3QgPSBoZXJlOwotICAgICAgICAgICAgICAgIGJlc3RoID0gaDsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgY2FuZGlkYXRlID0gVGV4dFV0aWxzLmdldE9mZnNldEFmdGVyKG1UZXh0LCBoZXJlKTsKLSAgICAgICAgICAgIGlmIChjYW5kaWRhdGUgPj0gc3RhcnQgJiYgY2FuZGlkYXRlIDw9IGVuZCkgewotICAgICAgICAgICAgICAgIGggPSBnZXRQcmltYXJ5SG9yaXpvbnRhbChjYW5kaWRhdGUpOwotCi0gICAgICAgICAgICAgICAgaWYgKGggPCBob3JpeiAmJiBoID4gYmVzdGgpIHsKLSAgICAgICAgICAgICAgICAgICAgYmVzdCA9IGNhbmRpZGF0ZTsKLSAgICAgICAgICAgICAgICAgICAgYmVzdGggPSBoOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgY2FuZGlkYXRlID0gVGV4dFV0aWxzLmdldE9mZnNldEJlZm9yZShtVGV4dCwgdGhlcmUpOwotICAgICAgICAgICAgaWYgKGNhbmRpZGF0ZSA+PSBzdGFydCAmJiBjYW5kaWRhdGUgPD0gZW5kKSB7Ci0gICAgICAgICAgICAgICAgaCA9IGdldFByaW1hcnlIb3Jpem9udGFsKGNhbmRpZGF0ZSk7Ci0KLSAgICAgICAgICAgICAgICBpZiAoaCA8IGhvcml6ICYmIGggPiBiZXN0aCkgewotICAgICAgICAgICAgICAgICAgICBiZXN0ID0gY2FuZGlkYXRlOwotICAgICAgICAgICAgICAgICAgICBiZXN0aCA9IGg7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBoZXJlID0gdGhlcmU7Ci0gICAgICAgIH0KLQotICAgICAgICBmbG9hdCBoID0gZ2V0UHJpbWFyeUhvcml6b250YWwoZW5kKTsKLQotICAgICAgICBpZiAoaCA8IGhvcml6ICYmIGggPiBiZXN0aCkgewotICAgICAgICAgICAgYmVzdCA9IGVuZDsKLSAgICAgICAgICAgIGJlc3RoID0gaDsKLSAgICAgICAgfQotCi0gICAgICAgIGlmIChiZXN0ICE9IG9mZnNldCkKLSAgICAgICAgICAgIHJldHVybiBiZXN0OwotCi0gICAgICAgIGludCBkaXIgPSBnZXRQYXJhZ3JhcGhEaXJlY3Rpb24obGluZSk7Ci0KLSAgICAgICAgaWYgKGRpciA+IDApIHsKLSAgICAgICAgICAgIGlmIChsaW5lID09IDApCi0gICAgICAgICAgICAgICAgcmV0dXJuIGJlc3Q7Ci0gICAgICAgICAgICBlbHNlCi0gICAgICAgICAgICAgICAgcmV0dXJuIGdldE9mZnNldEZvckhvcml6b250YWwobGluZSAtIDEsIDEwMDAwKTsKLSAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgIGlmIChsaW5lID09IGdldExpbmVDb3VudCgpIC0gMSkKLSAgICAgICAgICAgICAgICByZXR1cm4gYmVzdDsKLSAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgICAgICByZXR1cm4gZ2V0T2Zmc2V0Rm9ySG9yaXpvbnRhbChsaW5lICsgMSwgMTAwMDApOwotICAgICAgICB9CisgICAgICAgIHJldHVybiBnZXRPZmZzZXRUb0xlZnRSaWdodE9mKG9mZnNldCwgdHJ1ZSk7CiAgICAgfQogCi0gICAgLyoqCi0gICAgICogUmV0dXJuIHRoZSB0ZXh0IG9mZnNldCB0aGF0IHdvdWxkIGJlIHJlYWNoZWQgYnkgbW92aW5nIHJpZ2h0Ci0gICAgICogKHBvc3NpYmx5IG9udG8gYW5vdGhlciBsaW5lKSBmcm9tIHRoZS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9yaXogJiYgaCA8IGJlc3RoKSB7Ci0gICAgICAgICAgICAgICAgYmVzdCA9IGhlcmU7Ci0gICAgICAgICAgICAgICAgYmVzdGggPSBoOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBjYW5kaWRhdGUgPSBUZXh0VXRpbHMuZ2V0T2Zmc2V0QWZ0ZXIobVRleHQsIGhlcmUpOwotICAgICAgICAgICAgaWYgKGNhbmRpZGF0ZSA+PSBzdGFydCAmJiBjYW5kaWRhdGUgPD0gZW5kKSB7Ci0gICAgICAgICAgICAgICAgaCA9IGdldFByaW1hcnlIb3Jpem9udGFsKGNhbmRpZGF0ZSk7Ci0KLSAgICAgICAgICAgICAgICBpZiAoaCA+IGhvcml6ICYmIGggPCBiZXN0aCkgewotICAgICAgICAgICAgICAgICAgICBiZXN0ID0gY2FuZGlkYXRlOwotICAgICAgICAgICAgICAgICAgICBiZXN0aCA9IGg7CisgICAgICAgIGJvb2xlYW4gYWR2YW5jZSA9IHRvTGVmdCA9PSAobGluZURpciA9PSBESVJfUklHSFRfVE9fTEVGVCk7CisgICAgICAgIGlmIChjYXJldCA9PSAoYWR2YW5jZSA/IGxpbmVFbmQgOiBsaW5lU3RhcnQpKSB7CisgICAgICAgICAgICAvLyB3YWxraW5nIG9mZiBsaW5lLCBzbyBsb29rIGF0IHRoZSBsaW5lIHdlJ3JlIGhlYWRlZCB0bworICAgICAgICAgICAgaWYgKGNhcmV0ID09IGxpbmVTdGFydCkgeworICAgICAgICAgICAgICAgIGlmIChsaW5lID4gMCkgeworICAgICAgICAgICAgICAgICAgICAtLWxpbmU7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNhcmV0OyAvLyBhdCB2ZXJ5IHN0YXJ0LCBkb24ndCBtb3ZlCisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBpZiAobGluZSA8IGdldExpbmVDb3VudCgpIC0gMSkgeworICAgICAgICAgICAgICAgICAgICArK2xpbmU7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNhcmV0OyAvLyBhdCB2ZXJ5IGVuZCwgZG9uJ3QgbW92ZQogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KIAotICAgICAgICAgICAgY2FuZGlkYXRlID0gVGV4dFV0aWxzLmdldE9mZnNldEJlZm9yZShtVGV4dCwgdGhlcmUpOwotICAgICAgICAgICAgaWYgKGNhbmRpZGF0ZSA+PSBzdGFydCAmJiBjYW5kaWRhdGUgPD0gZW5kKSB7Ci0gICAgICAgICAgICAgICAgaCA9IGdldFByaW1hcnlIb3Jpem9udGFsKGNhbmRpZGF0ZSk7Ci0KLSAgICAgICAgICAgICAgICBpZiAoaCA+IGhvcml6ICYmIGggPCBiZXN0aCkgewotICAgICAgICAgICAgICAgICAgICBiZXN0ID0gY2FuZGlkYXRlOwotICAgICAgICAgICAgICAgICAgICBiZXN0aCA9IGg7Ci0gICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgbGluZVN0YXJ0ID0gZ2V0TGluZVN0YXJ0KGxpbmUpOworICAgICAgICAgICAgbGluZUVuZCA9IGdldExpbmVFbmQobGluZSk7CisgICAgICAgICAgICBpbnQgbmV3RGlyID0gZ2V0UGFyYWdyYXBoRGlyZWN0aW9uKGxpbmUpOworICAgICAgICAgICAgaWYgKG5ld0RpciAhPSBsaW5lRGlyKSB7CisgICAgICAgICAgICAgICAgLy8gdW51c3VhbCBjYXNlLiAgd2Ugd2FudCB0byB3YWxrIG9udG8gdGhlIGxpbmUsIGJ1dCBpdCBydW5zCisgICAgICAgICAgICAgICAgLy8gaW4gYSBkaWZmZXJlbnQgZGlyZWN0aW9uIHRoYW4gdGhpcyBvbmUsIHNvIHdlIGZha2UgbW92ZW1lbnQKKyAgICAgICAgICAgICAgICAvLyBpbiB0aGUgb3Bwb3NpdGUgZGlyZWN0aW9uLgorICAgICAgICAgICAgICAgIHRvTGVmdCA9ICF0b0xlZnQ7CisgICAgICAgICAgICAgICAgbGluZURpciA9IG5ld0RpcjsKICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgaGVyZSA9IHRoZXJlOwogICAgICAgICB9CiAKLSAgICAgICAgZmxvYXQgaCA9IGdldFByaW1hcnlIb3Jpem9udGFsKGVuZCk7CisgICAgICAgIERpcmVjdGlvbnMgZGlyZWN0aW9ucyA9IGdldExpbmVEaXJlY3Rpb25zKGxpbmUpOwogCi0gICAgICAgIGlmIChoID4gaG9yaXogJiYgaCA8IGJlc3RoKSB7Ci0gICAgICAgICAgICBiZXN0ID0gZW5kOwotICAgICAgICAgICAgYmVzdGggPSBoOwotICAgICAgICB9Ci0KLSAgICAgICAgaWYgKGJlc3QgIT0gb2Zmc2V0KQotICAgICAgICAgICAgcmV0dXJuIGJlc3Q7Ci0KLSAgICAgICAgaW50IGRpciA9IGdldFBhcmFncmFwaERpcmVjdGlvbihsaW5lKTsKLQotICAgICAgICBpZiAoZGlyID4gMCkgewotICAgICAgICAgICAgaWYgKGxpbmUgPT0gZ2V0TGluZUNvdW50KCkgLSAxKQotICAgICAgICAgICAgICAgIHJldHVybiBiZXN0OwotICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgICAgIHJldHVybiBnZXRPZmZzZXRGb3JIb3Jpem9udGFsKGxpbmUgKyAxLCAtMTAwMDApOwotICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgaWYgKGxpbmUgPT0gMCkKLSAgICAgICAgICAgICAgICByZXR1cm4gYmVzdDsKLSAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgICAgICByZXR1cm4gZ2V0T2Zmc2V0Rm9ySG9yaXpvbnRhbChsaW5lIC0gMSwgLTEwMDAwKTsKLSAgICAgICAgfQorICAgICAgICBUZXh0TGluZSB0bCA9IFRleHRMaW5lLm9idGFpbigpOworICAgICAgICAvLyBYWFg6IHdlIGRvbid0IGNhcmUgYWJvdXQ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yc29yUGF0aChpbnQgcG9pbnQsIFBhdGggZGVzdCwKQEAgLTExMjcsNyArMTE0Miw4IEBACiAgICAgICAgIGludCBib3R0b20gPSBnZXRMaW5lVG9wKGxpbmUrMSk7CiAKICAgICAgICAgZmxvYXQgaDEgPSBnZXRQcmltYXJ5SG9yaXpvbnRhbChwb2ludCkgLSAwLjVmOwotICAgICAgICBmbG9hdCBoMiA9IGdldFNlY29uZGFyeUhvcml6b250YWwocG9pbnQpIC0gMC41ZjsKKyAgICAgICAgZmxvYXQgaDIgPSBpc0xldmVsQm91bmRhcnkocG9pbnQpID8KKyAgICAgICAgICAgICAgICAgICAgZ2V0U2Vjb25kYXJ5SG9yaXpvbnRhbChwb2ludCkgLSAwLjVmIDogaDE7CiAKICAgICAgICAgaW50IGNhcHMgPSBUZXh0S2V5TGlzdGVuZXIuZ2V0TWV0YVN0YXRlKGVkaXRpbmdCdWZmZXIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBLZXlFdmVudC5NRVRBX1NISUZUX09OKSB8CkBAIC0xMjA0LDkgKzEyMjAsMTAgQEAKICAgICAgICAgaWYgKGxpbmVlbmQgPiBsaW5lc3RhcnQgJiYgbVRleHQuY2hhckF0KGxpbmVlbmQgLSAxKSA9PSAnXG4nKQogICAgICAgICAgICAgbGluZWVuZC0tOwogCi0gICAgICAgIGludCBoZXJlID0gbGluZXN0YXJ0OwotICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGRpcnMubURpcmVjdGlvbnMubGVuZ3RoOyBpKyspIHsKLSAgICAgICAgICAgIGludCB0aGVyZSA9IGhlcmUgKyBkaXJzLm1EaXJlY3Rpb25zW2ldOworICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGRpcnMubURpcmVjdGlvbnMubGVuZ3RoOyBpICs9IDIpIHsKKyAgICAgICAgICAgIGludCBoZXJlID0gbGluZXN0YXJ0ICsgZGlycy5tRGlyZWN0aW9uc1tpXTsKKyAgICAgICAgICAgIGludCB0aGVyZSA9IGhlcmUgKyAoZGlycy5tRGlyZWN0aW9uc1tpKzFdICYgUlVOX0xFTkdUSF9NQVNLKTsKKwogICAgICAgICAgICAgaWYgKHRoZXJlID4gbGluZWVuZCkKICAgICAgICAgICAgICAgICB0aGVyZSA9IGxpbmVlbmQ7CiAKQEAgLTEyMTUsMTQgKzEyMzIsMTIgQEAKICAgICAgICAgICAgICAgICBpbnQgZW4gPSBNYXRoLm1pbihlbmQsIHRoZXJlKTsKIAogICAgICAgICAgICAgICAgIGlmIChzdCAhPSBlbikgewotICAgICAgICAgICAgICAgICAgICBmbG9hdCBoMSA9IGdldEhvcml6b250YWwoc3QsIGZhbHNlLCBmYWxzZSwgbGluZSk7Ci0gICAgICAgICAgICAgICAgICAgIGZsb2F0IGgyID0gZ2V0SG9yaXpvbnRhbChlbiwgdHJ1ZSwgZmFsc2UsIGxpbmUpOworICAgICAgICAgICAgICAgICAgICBmbG9hdCBoMSA9IGdldEhvcml6b250YWwoc3QsIGZhbHNlLCBsaW5lKTsKKyAgICAgICAgICAgICAgICAgICAgZmxvYXQgaDIgPSBnZXRIb3Jpem9udGFsKGVuLCB0cnVlLCBsaW5lKTsKIAogICAgICAgICAgICAgICAgICAgICBkZXN0LmFkZFJlY3QoaDEsIHRvcCwgaDIsIGJvdHRvbSwgUGF0aC5EaXJlY3Rpb24uQ1cpOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgaGVyZSA9IHRoZXJlOwogICAgICAgICB9CiAgICAgfQogCkBAIC0xMjU3LDcgKzEyNzIsNyBAQAogCiAgICAgICAgICAgICBhZGRTZWxlY3Rpb24oc3RhcnRsaW5lLCBzdGFydCwgZ2V0TGluZUVuZChzdGFydGxpbmUpLAogICAgICAgICAgICAgICAgICAgICAgICAgIHRvcCwgZ2V0TGluZUJvdHRvbShzdGFydGxpbmUpLCBkZXN0KTsKLSAgICAgICAgICAgIAorCiAgICAgICAgICAgICBpZiAoZ2V0UGFyYWdyYXBoRGlyZWN0aW9uKHN0YXJ0bGluZSkgPT0gRElSX1JJR0hUX1RPX0xFRlQpCiAgICAgICAgICAgICAgICAgZGVzdC5hZGRSZWN0KGdldExpbmVMZWZ0KHN0YXJ0bGluZSksIHRvcCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAsIGdldExpbmVCb3R0b20oc3RhcnRsaW5lKSwgUGF0aC5EaXJlY3Rpb24uQ1cpOwpAQCAtMTI5Myw3ICsxMzA4LDcgQEAKIAogICAgICAgICBpZiAobVNwYW5uZWRUZXh0KSB7CiAgICAgICAgICAgICBTcGFubmVkIHNwID0gKFNwYW5uZWQpIG1UZXh0OwotICAgICAgICAgICAgQWxpZ25tZW50U3BhbltdIHNwYW5zID0gc3AuZ2V0U3BhbnMoZ2V0TGluZVN0YXJ0KGxpbmUpLAorICAgICAgICAgICAgQWxpZ25tZW50U3BhbltdIHNwYW5zID0gZ2V0UGFyYWdyYXBoU3BhbnMoc3AsIGdldExpbmVTdGFydChsaW5lKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldExpbmVFbmQobGluZSksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBbGlnbm1lbnRTcGFuLmNsYXNzKTsKIApAQCAtMTMxMCw0MjIgKzEzMjUsMTczIEBACiAgICAgICogR2V0IHRoZSBsZWZ0IGVkZ2Ugb2YgdGhlIHNwZWNpZmllZCBwYXJhZ3JhcGgsIGluc2V0IGJ5IGxlZnQgbWFyZ2lucy4KICAgICAgKi8KICAgICBwdWJsaWMgZmluYWwgaW50IGdldFBhcmFncmFwaExlZnQoaW50IGxpbmUpIHsKLSAgICAgICAgaW50IGRpciA9IGdldFBhcmFncmFwaERpcmVjdGlvbihsaW5lKTsKLQogICAgICAgICBpbnQgbGVmdCA9IDA7Ci0KLSAgICAgICAgYm9vbGVhbiBwYXIgPSBmYWxzZTsKLSAgICAgICAgaW50IG9mZiA9IGdldExpbmVTdGFydChsaW5lKTsKLSAgICAgICAgaWYgKG9mZiA9PSAwIHx8IG1UZXh0LmNoYXJBdChvZmYgLSAxKSA9PSAnXG4nKQotICAgICAgICAgICAgcGFyID0gdHJ1ZTsKLQotICAgICAgICBpZiAoZGlyID09IERJUl9MRUZUX1RPX1JJR0hUKSB7Ci0gICAgICAgICAgICBpZiAobVNwYW5uZWRUZXh0KSB7Ci0gICAgICAgICAgICAgICAgU3Bhbm5lZCBzcCA9IChTcGFubmVkKSBtVGV4dDsKLSAgICAgICAgICAgICAgICBMZWFkaW5nTWFyZ2luU3BhbltdIHNwYW5zID0gc3AuZ2V0U3BhbnMoZ2V0TGluZVN0YXJ0KGxpbmUpLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRMaW5lRW5kKGxpbmUpLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMZWFkaW5nTWFyZ2luU3Bhbi5jbGFzcyk7Ci0KLSAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IHNwYW5zLmxlbmd0aDsgaSsrKSB7Ci0gICAgICAgICAgICAgICAgICAgIGJvb2xlYW4gbWFyZ2luID0gcGFyOwotICAgICAgICAgICAgICAgICAgICBMZWFkaW5nTWFyZ2luU3BhbiBzcGFuID0gc3BhbnNbaV07Ci0gICAgICAgICAgICAgICAgICAgIGlmIChzcGFuIGluc3RhbmNlb2YgTGVhZGluZ01hcmdpblNwYW4uTGVhZGluZ01hcmdpblNwYW4yKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpbnQgY291bnQgPSAoKExlYWRpbmdNYXJnaW5TcGFuLkxlYWRpbmdNYXJnaW5TcGFuMilzcGFuKS5nZXRMZWFkaW5nTWFyZ2luTGluZUNvdW50KCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBtYXJnaW4gPSBjb3VudCA+PSBsaW5lOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIGxlZnQgKz0gc3Bhbi5nZXRMZWFkaW5nTWFyZ2luKG1hcmdpbik7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQorICAgICAgICBpbnQgZGlyID0gZ2V0UGFyYWdyYXBoRGlyZWN0aW9uKGxpbmUpOworICAgICAgICBpZiAoZGlyID09IERJUl9SSUdIVF9UT19MRUZUIHx8ICFtU3Bhbm5lZFRleHQpIHsKKyAgICAgICAgICAgIHJldHVybiBsZWZ0OyAvLyBsZWFkaW5nIG1hcmdpbiBoYXMgbm8gaW1wYWN0LCBvciBubyBzdHlsZXMKICAgICAgICAgfQotCi0gICAgICAgIHJldHVybiBsZWZ0OworICAgICAgICByZXR1cm4gZ2V0UGFyYWdyYXBoTGVhZGluZ01hcmdpbihsaW5lKTsKICAgICB9CiAKICAgICAvKioKICAgICAgKiBHZXQgdGhlIHJpZ2h0IGVkZ2Ugb2YgdGhlIHNwZWNpZmllZCBwYXJhZ3JhcGgsIGluc2V0IGJ5IHJpZ2h0IG1hcmdpbnMuCiAgICAgICovCiAgICAgcHVibGljIGZpbmFsIGludCBnZXRQYXJhZ3JhcGhSaWdodChpbnQgbGluZSkgewotICAgICAgICBpbnQgZGlyID0gZ2V0UGFyYWdyYXBoRGlyZWN0aW9uKGxpbmUpOwotCiAgICAgICAgIGludCByaWdodCA9IG1XaWR0aDsKLQotICAgICAgICBib29sZWFuIHBhciA9IGZhbHNlOwotICAgICAgICBpbnQgb2ZmID0gZ2V0TGluZVN0YXJ0KGxpbmUpOwotICAgICAgICBpZiAob2ZmID09IDAgfHwgbVRleHQuY2hhckF0KG9mZiAtIDEpID09ICdcbicpCi0gICAgICAgICAgICBwYXIgPSB0cnVlOwotCi0KLSAgICAgICAgaWYgKGRpciA9PSBESVJfUklHSFRfVE9fTEVGVCkgewotICAgICAgICAgICAgaWYgKG1TcGFubmVkVGV4dCkgewotICAgICAgICAgICAgICAgIFNwYW5uZWQgc3AgPSAoU3Bhbm5lZCkgbVRleHQ7Ci0gICAgICAgICAgICAgICAgTGVhZGluZ01hcmdpblNwYW5bXSBzcGFucyA9IHNwLmdldFNwYW5zKGdldExpbmVTdGFydChsaW5lKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0TGluZUVuZChsaW5lKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTGVhZGluZ01hcmdpblNwYW4uY2xhc3MpOwotCi0gICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBzcGFucy5sZW5ndGg7IGkrKykgewotICAgICAgICAgICAgICAgICAgICByaWdodCAtPSBzcGFuc1tpXS5nZXRMZWFkaW5nTWFyZ2luKHBhcik7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQorICAgICAgICBpbnQgZGlyID0gZ2V0UGFyYWdyYXBoRGlyZWN0aW9uKGxpbmUpOworICAgICAgICBpZiAoZGlyID09IERJUl9MRUZUX1RPX1JJR0hUIHx8ICFtU3Bhbm5lZFRleHQpIHsKKyAgICAgICAgICAgIHJldHVybiByaWdodDsgLy8gbGVhZGluZyBtYXJnaW4gaGFzIG5vIGltcGFjdCwgb3Igbm8gc3R5bGVzCiAgICAgICAgIH0KLQotICAgICAgICByZXR1cm4gcmlnaHQ7Ci0gICAgfQotCi0gICAgcHJpdmF0ZSB2b2lkIGRyYXdUZXh0KENhbnZhcyBjYW52YXMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDaGFyU2VxdWVuY2UgdGV4dCwgaW50IHN0YXJ0LCBpbnQgZW5kLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGRpciwgRGlyZWN0aW9ucyBkaXJlY3Rpb25zLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgeCwgaW50IHRvcCwgaW50IHksIGludCBib3R0b20sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUZXh0UGFpbnQgcGFpbnQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUZXh0UGFpbnQgd29ya1BhaW50LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbGVhbiBoYXNUYWJzLCBPYmplY3RbXSBwYXJzcGFucykgewotICAgICAgICBjaGFyW10gYnVmOwotICAgICAgICBpZiAoIWhhc1RhYnMpIHsKLSAgICAgICAgICAgIGlmIChkaXJlY3Rpb25zID09IERJUlNfQUxMX0xFRlRfVE9fUklHSFQpIHsKLSAgICAgICAgICAgICAgICBpZiAoREVCVUcpIHsKLSAgICAgICAgICAgICAgICAgICAgQXNzZXJ0LmFzc2VydFRydWUoRElSX0xFRlRfVE9fUklHSFQgPT0gZGlyKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgU3R5bGVkLmRyYXdUZXh0KGNhbnZhcywgdGV4dCwgc3RhcnQsIGVuZCwgZGlyLCBmYWxzZSwgeCwgdG9wLCB5LCBib3R0b20sIHBhaW50LCB3b3JrUGFpbnQsIGZhbHNlKTsKLSAgICAgICAgICAgICAgICByZXR1cm47Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBidWYgPSBudWxsOwotICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgYnVmID0gVGV4dFV0aWxzLm9idGFpbihlbmQgLSBzdGFydCk7Ci0gICAgICAgICAgICBUZXh0VXRpbHMuZ2V0Q2hhcnModGV4dCwgc3RhcnQsIGVuZCwgYnVmLCAwKTsKLSAgICAgICAgfQotCi0gICAgICAgIGZsb2F0IGggPSAwOwotCi0gICAgICAgIGludCBoZXJlID0gMDsKLSAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBkaXJlY3Rpb25zLm1EaXJlY3Rpb25zLmxlbmd0aDsgaSsrKSB7Ci0gICAgICAgICAgICBpbnQgdGhlcmUgPSBoZXJlICsgZGlyZWN0aW9ucy5tRGlyZWN0aW9uc1tpXTsKLSAgICAgICAgICAgIGlmICh0aGVyZSA+IGVuZCAtIHN0YXJ0KQotICAgICAgICAgICAgICAgIHRoZXJlID0gZW5kIC0gc3RhcnQ7Ci0KLSAgICAgICAgICAgIGludCBzZWdzdGFydCA9IGhlcmU7Ci0gICAgICAgICAgICBmb3IgKGludCBqID0gaGFzVGFicyA/IGhlcmUgOiB0aGVyZTsgaiA8PSB0aGVyZTsgaisrKSB7Ci0gICAgICAgICAgICAgICAgaWYgKGogPT0gdGhlcmUgfHwgYnVmW2pdID09ICdcdCcpIHsKLSAgICAgICAgICAgICAgICAgICAgaCArPSBTdHlsZWQuZHJhd1RleHQoY2FudmFzLCB0ZXh0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGFydCArIHNlZ3N0YXJ0LCBzdGFydCArIGosCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpciwgKGkgJiAxKSAhPSAwLCB4ICsgaCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdG9wLCB5LCBib3R0b20sIHBhaW50LCB3b3JrUGFpbnQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXJ0ICsgaiAhPSBlbmQpOwotCi0gICAgICAgICAgICAgICAgICAgIGlmIChqICE9IHRoZXJlICYmIGJ1ZltqXSA9PSAnXHQnKQotICAgICAgICAgICAgICAgICAgICAgICAgaCA9IGRpciAqIG5leHRUYWIodGV4dCwgc3RhcnQsIGVuZCwgaCAqIGRpciwgcGFyc3BhbnMpOwotCi0gICAgICAgICAgICAgICAgICAgIHNlZ3N0YXJ0ID0gaiArIDE7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChoYXNUYWJzICYmIGJ1ZltqXSA+PSAweEQ4MDAgJiYgYnVmW2pdIDw9IDB4REZGRiAmJiBqICsgMSA8IHRoZXJlKSB7Ci0gICAgICAgICAgICAgICAgICAgIGludCBlbW9qaSA9IENoYXJhY3Rlci5jb2RlUG9pbnRBdChidWYsIGopOwotCi0gICAgICAgICAgICAgICAgICAgIGlmIChlbW9qaSA+PSBNSU5fRU1PSkkgJiYgZW1vamkgPD0gTUFYX0VNT0pJKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBCaXRtYXAgYm0gPSBFTU9KSV9GQUNUT1JZLgotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldEJpdG1hcEZyb21BbmRyb2lkUHVhKGVtb2ppKTsKLQotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGJtICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBoICs9IFN0eWxlZC5kcmF3VGV4dChjYW52YXMsIHRleHQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnQgKyBzZWdzdGFydCwgc3RhcnQgKyBqLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpciwgKGkgJiAxKSAhPSAwLCB4ICsgaCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b3AsIHksIGJvdHRvbSwgcGFpbnQsIHdvcmtQYWludCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGFydCArIGogIT0gZW5kKTsKLQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtRW1vamlSZWN0ID09IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUVtb2ppUmVjdCA9IG5ldyBSZWN0RigpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdvcmtQYWludC5zZXQocGFpbnQpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIFN0eWxlZC5tZWFzdXJlVGV4dChwYWludCwgd29ya1BhaW50LCB0ZXh0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGFydCArIGosIHN0YXJ0ICsgaiArIDEsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsb2F0IGJpdG1hcEhlaWdodCA9IGJtLmdldEhlaWdodCgpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsb2F0IHRleHRIZWlnaHQgPSAtd29ya1BhaW50LmFzY2VudCgpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsb2F0IHNjYWxlID0gdGV4dEhlaWdodCAvIGJpdG1hcEhlaWdodDsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCB3aWR0aCA9IGJtLmdldFdpZHRoKCkgKiBzY2FsZTsKLQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1FbW9qaVJlY3Quc2V0KHggKyBoLCB5IC0gdGV4dEhlaWdodCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB4ICsgaCArIHdpZHRoLCB5KTsKLQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhbnZhcy5kcmF3Qml0bWFwKGJtLCBudWxsLCBtRW1vamlSZWN0LCBwYWludCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgaCArPSB3aWR0aDsKLQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGorKzsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWdzdGFydCA9IGogKyAxOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBoZXJlID0gdGhlcmU7Ci0gICAgICAgIH0KLQotICAgICAgICBpZiAoaGFzVGFicykKLSAgICAgICAgICAgIFRleHRVdGlscy5yZWN5Y2xlKGJ1Zik7Ci0gICAgfQotCi0gICAgcHJpdmF0ZSBzdGF0aWMgZmxvYXQgbWVhc3VyZVRleHQoVGV4dFBhaW50IHBhaW50LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRleHRQYWludCB3b3JrUGFpbnQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ2hhclNlcXVlbmNlIHRleHQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IHN0YXJ0LCBpbnQgb2Zmc2V0LCBpbnQgZW5kLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBkaXIsIERpcmVjdGlvbnMgZGlyZWN0aW9ucywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sZWFuIHRyYWlsaW5nLCBib29sZWFuIGFsdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sZWFuIGhhc1RhYnMsIE9iamVjdFtdIHRhYnMpIHsKLSAgICAgICAgY2hhcltdIGJ1ZiA9IG51bGw7Ci0KLSAgICAgICAgaWYgKGhhc1RhYnMpIHsKLSAgICAgICAgICAgIGJ1ZiA9IFRleHRVdGlscy5vYnRhaW4oZW5kIC0gc3RhcnQpOwotICAgICAgICAgICAgVGV4dFV0aWxzLmdldENoYXJzKHRleHQsIHN0YXJ0LCBlbmQsIGJ1ZiwgMCk7Ci0gICAgICAgIH0KLQotICAgICAgICBmbG9hdCBoID0gMDsKLQotICAgICAgICBpZiAoYWx0KSB7Ci0gICAgICAgICAgICBpZiAoZGlyID09IERJUl9SSUdIVF9UT19MRUZUKQotICAgICAgICAgICAgICAgIHRyYWlsaW5nID0gIXRyYWlsaW5nOwotICAgICAgICB9Ci0KLSAgICAgICAgaW50IGhlcmUgPSAwOwotICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGRpcmVjdGlvbnMubURpcmVjdGlvbnMubGVuZ3RoOyBpKyspIHsKLSAgICAgICAgICAgIGlmIChhbHQpCi0gICAgICAgICAgICAgICAgdHJhaWxpbmcgPSAhdHJhaWxpbmc7Ci0KLSAgICAgICAgICAgIGludCB0aGVyZSA9IGhlcmUgKyBkaXJlY3Rpb25zLm1EaXJlY3Rpb25zW2ldOwotICAgICAgICAgICAgaWYgKHRoZXJlID4gZW5kIC0gc3RhcnQpCi0gICAgICAgICAgICAgICAgdGhlcmUgPSBlbmQgLSBzdGFydDsKLQotICAgICAgICAgICAgaW50IHNlZ3N0YXJ0ID0gaGVyZTsKLSAgICAgICAgICAgIGZvciAoaW50IGogPSBoYXNUYWJzID8gaGVyZSA6IHRoZXJlOyBqIDw9IHRoZXJlOyBqKyspIHsKLSAgICAgICAgICAgICAgICBpbnQgY29kZXB0ID0gMDsKLSAgICAgICAgICAgICAgICBCaXRtYXAgYm0gPSBudWxsOwotCi0gICAgICAgICAgICAgICAgaWYgKGhhc1RhYnMgJiYgaiA8IHRoZXJlKSB7Ci0gICAgICAgICAgICAgICAgICAgIGNvZGVwdCA9IGJ1ZltqXTsKLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICBpZiAoY29kZXB0ID49IDB4RDgwMCAmJiBjb2RlcHQgPD0gMHhERkZGICYmIGogKyAxIDwgdGhlcmUpIHsKLSAgICAgICAgICAgICAgICAgICAgY29kZXB0ID0gQ2hhcmFjdGVyLmNvZGVQb2ludEF0KGJ1Ziwgaik7Ci0KLSAgICAgICAgICAgICAgICAgICAgaWYgKGNvZGVwdCA+PSBNSU5fRU1PSkkgJiYgY29kZXB0IDw9IE1BWF9FTU9KSSkgewotICAgICAgICAgICAgICAgICAgICAgICAgYm0gPSBFTU9KSV9GQUNUT1JZLmdldEJpdG1hcEZyb21BbmRyb2lkUHVhKGNvZGVwdCk7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICBpZiAoaiA9PSB0aGVyZSB8fCBjb2RlcHQgPT0gJ1x0JyB8fCBibSAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIGZsb2F0IHNlZ3c7Ci0KLSAgICAgICAgICAgICAgICAgICAgaWYgKG9mZnNldCA8IHN0YXJ0ICsgaiB8fAotICAgICAgICAgICAgICAgICAgICAgICAodHJhaWxpbmcgJiYgb2Zmc2V0IDw9IHN0YXJ0ICsgaikpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkaXIgPT0gRElSX0xFRlRfVE9fUklHSFQgJiYgKGkgJiAxKSA9PSAwKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgaCArPSBTdHlsZWQubWVhc3VyZVRleHQocGFpbnQsIHdvcmtQYWludCwgdGV4dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGFydCArIHNlZ3N0YXJ0LCBvZmZzZXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGg7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkaXIgPT0gRElSX1JJR0hUX1RPX0xFRlQgJiYgKGkgJiAxKSAhPSAwKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgaCAtPSBTdHlsZWQubWVhc3VyZVRleHQocGFpbnQsIHdvcmtQYWludCwgdGV4dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGFydCArIHNlZ3N0YXJ0LCBvZmZzZXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGg7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgICAgICBzZWd3ID0gU3R5bGVkLm1lYXN1cmVUZXh0KHBhaW50LCB3b3JrUGFpbnQsIHRleHQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnQgKyBzZWdzdGFydCwgc3RhcnQgKyBqLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwpOwotCi0gICAgICAgICAgICAgICAgICAgIGlmIChvZmZzZXQgPCBzdGFydCArIGogfHwKLSAgICAgICAgICAgICAgICAgICAgICAgICh0cmFpbGluZyAmJiBvZmZzZXQgPD0gc3RhcnQgKyBqKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGRpciA9PSBESVJfTEVGVF9UT19SSUdIVCkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGggKz0gc2VndyAtIFN0eWxlZC5tZWFzdXJlVGV4dChwYWludCwgd29ya1BhaW50LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ZXh0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGFydCArIHNlZ3N0YXJ0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvZmZzZXQsIG51bGwpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBoOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoZGlyID09IERJUl9SSUdIVF9UT19MRUZUKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgaCAtPSBzZWd3IC0gU3R5bGVkLm1lYXN1cmVUZXh0KHBhaW50LCB3b3JrUGFpbnQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRleHQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXJ0ICsgc2Vnc3RhcnQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9mZnNldCwgbnVsbCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGg7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgICAgICBpZiAoZGlyID09IERJUl9SSUdIVF9UT19MRUZUKQotICAgICAgICAgICAgICAgICAgICAgICAgaCAtPSBzZWd3OwotICAgICAgICAgICAgICAgICAgICBlbHNlCi0gICAgICAgICAgICAgICAgICAgICAgICBoICs9IHNlZ3c7Ci0KLSAgICAgICAgICAgICAgICAgICAgaWYgKGogIT0gdGhlcmUgJiYgYnVmW2pdID09ICdcdCcpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChvZmZzZXQgPT0gc3RhcnQgKyBqKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBoOwotCi0gICAgICAgICAgICAgICAgICAgICAgICBoID0gZGlyICogbmV4dFRhYih0ZXh0LCBzdGFydCwgZW5kLCBoICogZGlyLCB0YWJzKTsKLSAgICAgICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgICAgIGlmIChibSAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICB3b3JrUGFpbnQuc2V0KHBhaW50KTsKLSAgICAgICAgICAgICAgICAgICAgICAgIFN0eWxlZC5tZWFzdXJlVGV4dChwYWludCwgd29ya1BhaW50LCB0ZXh0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGosIGogKyAyLCBudWxsKTsKLQotICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgd2lkID0gKGZsb2F0KSBibS5nZXRXaWR0aCgpICoKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC13b3JrUGFpbnQuYXNjZW50KCkgLyBibS5nZXRIZWlnaHQoKTsKLQotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGRpciA9PSBESVJfUklHSFRfVE9fTEVGVCkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGggLT0gd2lkOwotICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBoICs9IHdpZDsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgICAgICAgICAgaisrOwotICAgICAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICAgICAgc2Vnc3RhcnQgPSBqICsgMTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIGhlcmUgPSB0aGVyZTsKLSAgICAgICAgfQotCi0gICAgICAgIGlmIChoYXNUYWJzKQotICAgICAgICAgICAgVGV4dFV0aWxzLnJlY3ljbGUoYnVmKTsKLQotICAgICAgICByZXR1cm4gaDsKKyAgICAgICAgcmV0dXJuIHJpZ2h0IC0gZ2V0UGFyYWdyYXBoTGVhZGluZ01hcmdpbihsaW5lKTsKICAgICB9CiAKICAgICAvKioKLSAgICAgKiBNZWFzdXJlIHdpZHRoIG9mIGEgcnVuIG9mIHRleHQgb24gYSBzaW5nbGUgbGluZSB0aGF0IGlzIGtub3duIHRvIGFsbCBiZQotICAgICAqIGluIHRoZSBzYW1lIGRpcmVjdGlvbiBhcyB0aGUgcGFyYWdyYXBoIGJhc2UgZGlyZWN0aW9uLiBSZXR1cm5zIHRoZSB3aWR0aCwKLSAgICAgKiBhbmQgdGhlIGxpbmUgbW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gICAgIFRleHRQYWludCB3b3JrUGFpbnQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ2hhclNlcXVlbmNlIHRleHQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IHN0YXJ0LCBpbnQgZW5kLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBhaW50LkZvbnRNZXRyaWNzSW50IGZtLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2xlYW4gaGFzVGFicywgT2JqZWN0W10gdGFicykgewotICAgICAgICBjaGFyW10gYnVmID0gbnVsbDsKLSAgCi0gICAgICAgIGlmIChoYXNUYWJzKSB7Ci0gICAgICAgICAgICBidWYgPSBUZXh0VXRpbHMub2J0YWluKGVuZCAtIHN0YXJ0KTsKLSAgICAgICAgICAgIFRleHRVdGlscy5nZXRDaGFycyh0ZXh0LCBzdGFydCwgZW5kLCBidWYsIDApOworICAgIHByaXZhdGUgaW50IGdldFBhcmFncmFwaExlYWRpbmdNYXJnaW4oaW50IGxpbmUpIHsKKyAgICAgICAgaWYgKCFtU3Bhbm5lZFRleHQpIHsKKyAgICAgICAgICAgIHJldHVybiAwOworICAgICAgICB9CisgICAgICAgIFNwYW5uZWQgc3Bhbm5lZCA9IChTcGFubmVkKSBtVGV4dDsKKworICAgICAgICBpbnQgbGluZVN0YXJ0ID0gZ2V0TGluZVN0YXJ0KGxpbmUpOworICAgICAgICBpbnQgbGluZUVuZCA9IGdldExpbmVFbmQobGluZSk7CisgICAgICAgIGludCBzcGFuRW5kID0gc3Bhbm5lZC5uZXh0U3BhblRyYW5zaXRpb24obGluZVN0YXJ0LCBsaW5lRW5kLAorICAgICAgICAgICAgICAgIExlYWRpbmdNYXJnaW5TcGFuLmNsYXNzKTsKKyAgICAgICAgTGVhZGluZ01hcmdpblNwYW5bXSBzcGFucyA9IGdldFBhcmFncmFwaFNwYW5zKHNwYW5uZWQsIGxpbmVTdGFydCwgc3BhbkVuZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExlYWRpbmdNYXJnaW5TcGFuLmNsYXNzKTsKKyAgICAgICAgaWYgKHNwYW5zLmxlbmd0aCA9PSAwKSB7CisgICAgICAgICAgICByZXR1cm4gMDsgLy8gbm8gbGVhZGluZyBtYXJnaW4gc3BhbjsKICAgICAgICAgfQogCi0gICAgICAgIGludCBsZW4gPSBlbmQgLSBzdGFydDsKKyAgICAgICAgaW50IG1hcmdpbiA9IDA7CiAKLSAgICAgICAgaW50IGxhc3RQb3MgPSAwOwotICAgICAgICBmbG9hdCB3aWR0aCA9IDA7Ci0gICAgICAgIGludCBhc2NlbnQgPSAwLCBkZXNjZW50ID0gMCwgdG9wID0gMCwgYm90dG9tID0gMDsKKyAgICAgICAgYm9vbGVhbiBpc0ZpcnN0UGFyYUxpbmUgPSBsaW5lU3RhcnQgPT0gMCB8fAorICAgICAgICAgICAgc3Bhbm5lZC5jaGFyQXQobGluZVN0YXJ0IC0gMSkgPT0gJ1xuJzsKIAotICAgICAgICBpZiAoZm0gIT0gbnVsbCkgewotICAgICAgICAgICAgZm0uYXNjZW50ID0gMDsKLSAgICAgICAgICAgIGZtLmRlc2NlbnQgPSAwOwotICAgICAgICB9Ci0KLSAgICAgICAgZm9yIChpbnQgcG9zID0gaGFzVGFicyA/IDAgOiBsZW47IHBvcyA8PSBsZW47IHBvcysrKSB7Ci0gICAgICAgICAgICBpbnQgY29kZXB0ID0gMDsKLSAgICAgICAgICAgIEJpdG1hcCBibSA9IG51bGw7Ci0KLSAgICAgICAgICAgIGlmIChoYXNUYWJzICYmIHBvcyA8IGxlbikgewotICAgICAgICAgICAgICAgIGNvZGVwdCA9IGJ1Zltwb3NdOworICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IHNwYW5zLmxlbmd0aDsgaSsrKSB7CisgICAgICAgICAgICBMZWFkaW5nTWFyZ2luU3BhbiBzcGFuID0gc3BhbnNbaV07CisgICAgICAgICAgICBib29sZWFuIHVzZUZpcnN0TGluZU1hcmdpbiA9IGlzRmlyc3RQYXJhTGluZTsKKyAgICAgICAgICAgIGlmIChzcGFuIGluc3RhbmNlb2YgTGVhZGluZ01hcmdpblNwYW4yKSB7CisgICAgICAgICAgICAgICAgaW50IHNwU3RhcnQgPSBzcGFubmVkLmdldFNwYW5TdGFydChzcGFuKTsKKyAgICAgICAgICAgICAgICBpbnQgc3BhbkxpbmUgPSBnZXRMaW5lRm9yT2Zmc2V0KHNwU3RhcnQpOworICAgICAgICAgICAgICAgIGludCBjb3VudCA9ICgoTGVhZGluZ01hcmdpblNwYW4yKXNwYW4pLmdldExlYWRpbmdNYXJnaW5MaW5lQ291bnQoKTsKKyAgICAgICAgICAgICAgICB1c2VGaXJzdExpbmVNYXJnaW4gPSBsaW5lIDwgc3BhbkxpbmUgKyBjb3VudDsKICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1hcmdpbiArPSBzcGFuLmdldExlYWRpbmdNYXJnaW4odXNlRmlyc3RMaW5lTWFyZ2luKTsKKyAgICAgICAgfQogCi0gICAgICAgICAgICBpZiAoY29kZXB0ID49IDB4RDgwMCAmJiBjb2RlcHQgPD0gMHhERkZGICYmIHBvcyA8IGxlbikgewotICAgICAgICAgICAgICAgIGNvZGVwdCA9IENoYXJhY3Rlci5jb2RlUG9pbnRBdChidWYsIHBvcyk7CisgICAgICAgIHJldHVybiBtYXJnaW47CisgICAgfQogCi0gICAgICAgICAgICAgICAgaWYgKGNvZGVwdCA+PSBNSU5fRU1PSkkgJiYgY29kZXB0IDw9IE1BWF9FTU9KSSkgewotICAgICAgICAgICAgICAgICAgICBibSA9IEVNT0pJX0ZBQ1RPUlkuZ2V0Qml0bWFwRnJvbUFuZHJvaWRQdWEoY29kZXB0KTsKKyAgICAvKiBwYWNrYWdlICovCisgICAgc3RhdGljIGZsb2F0IG1lYXN1cmVQYXJhKFRleHRQYWludCBwYWludCwgVGV4dFBhaW50IHdvcmtQYWludCwKKyAgICAgICAgICAgIENoYXJTZXF1ZW5jZSB0ZXh0LCBpbnQgc3RhcnQsIGludCBlbmQpIHsKKworICAgICAgICBNZWFzdXJlZFRleHQgbXQgPSBNZWFzdXJlZFRleHQub2J0YWluKCk7CisgICAgICAgIFRleHRMaW5lIHRsID0gVGV4dExpbmUub2J0YWluKCk7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBtdC5zZXRQYXJhKHRleHQsIHN0YXJ0LCBlbmQsIERJUl9SRVFVRVNUX0xUUik7CisgICAgICAgICAgICBEaXJlY3Rpb25zIGRpcmVjdGlvbnM7CisgICAgICAgICAgICBpbnQgZGlyOworICAgICAgICAgICAgaWYgKG10Lm1FYXN5KSB7CisgICAgICAgICAgICAgICAgZGlyZWN0aW9ucyA9IERJUlNfQUxMX0xFRlRfVE9fUklHSFQ7CisgICAgICAgICAgICAgICAgZGlyID0gTGF5b3V0LkRJUl9MRUZUX1RPX1JJR0hUOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBkaXJlY3Rpb25zID0gQW5kcm9pZEJpZGkuZGlyZWN0aW9ucyhtdC5tRGlyLCBtdC5tTGV2ZWxzLAorICAgICAgICAgICAgICAgICAgICAwLCBtdC5tQ2hhcnMsIDAsIG10Lm1MZW4pOworICAgICAgICAgICAgICAgIGRpciA9IG10Lm1EaXI7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjaGFyW10gY2hhcnMgPSBtdC5tQ2hhcnM7CisgICAgICAgICAgICBpbnQgbGVuID0gbXQubUxlbjsKKyAgICAgICAgICAgIGJvb2xlYW4gaGFzVGFicyA9IGZhbHNlOworICAgICAgICAgICAgVGFiU3RvcHMgdGFiU3RvcHMgPSBudWxsOworICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBsZW47ICsraSkgeworICAgICAgICAgICAgICAgIGlmIChjaGFyc1tpXSA9PSAnXHQnKSB7CisgICAgICAgICAgICAgICAgICAgIGhhc1RhYnMgPSB0cnVlOworICAgICAgICAgICAgICAgICAgICBpZiAodGV4dCBpbnN0YW5jZW9mIFNwYW5uZWQpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIFNwYW5uZWQgc3Bhbm5lZCA9IChTcGFubmVkKSB0ZXh0OworICAgICAgICAgICAgICAgICAgICAgICAgaW50IHNwYW5FbmQgPSBzcGFubmVkLm5leHRTcGFuVHJhbnNpdGlvbihzdGFydCwgZW5kLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUYWJTdG9wU3Bhbi5jbGFzcyk7CisgICAgICAgICAgICAgICAgICAgICAgICBUYWJTdG9wU3BhbltdIHNwYW5zID0gZ2V0UGFyYWdyYXBoU3BhbnMoc3Bhbm5lZCwgc3RhcnQsIHNwYW5FbmQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRhYlN0b3BTcGFuLmNsYXNzKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzcGFucy5sZW5ndGggPiAwKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGFiU3RvcHMgPSBuZXcgVGFiU3RvcHMoVEFCX0lOQ1JFTUVOVCwgc3BhbnMpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHRsLnNldChwYWludCwgdGV4dCwgc3RhcnQsIGVuZCwgZGlyLCBkaXJlY3Rpb25zLCBoYXNUYWJzLCB0YWJTdG9wcyk7CisgICAgICAgICAgICByZXR1cm4gdGwubWV0cmljcyhudWxsKTsKKyAgICAgICAgfSBmaW5hbGx5IHsKKyAgICAgICAgICAgIFRleHRMaW5lLnJlY3ljbGUodGwpOworICAgICAgICAgICAgTWVhc3VyZWRUZXh0LnJlY3ljbGUobXQpOworICAgICAgICB9CisgICAgfQogCi0gICAgICAgICAgICBpZiAocG9zID09IGxlbiB8fCBjb2RlcHQgPT0gJ1x0JyB8fCBibSAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgd29ya1BhaW50LmJhc2VsaW5lU2hpZnQgPSAwOworICAgIC8qKgorICAgICAqIEBoaWRlCisgICAgICovCisgICAgLyogcGFja2FnZSAqLyBzdGF0aWMgY2xhc3MgVGFiU3RvcHMgeworICAgICAgICBwcml2YXRlIGludFtdIG1TdG9wczsKKyAgICAgICAgcHJpdmF0ZSBpbnQgbU51bVN0b3BzOworICAgICAgICBwcml2YXRlIGludCBtSW5jcmVtZW50OwogCi0gICAgICAgICAgICAgICAgd2lkdGggKz0gU3R5bGVkLm1lYXN1cmVUZXh0KHBhaW50LCB3b3JrUGFpbnQsIHRleHQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnQgKyBsYXN0UG9zLCBzdGFydCArIHBvcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbSk7CisgICAgICAgIFRhYlN0b3BzKGludCBpbmNyZW1lbnQsIE9iamVjdFtdIHNwYW5zKSB7CisgICAgICAgICAgICByZXNldChpbmNyZW1lbnQsIHNwYW5zKTsKKyAgICAgICAgfQogCi0gICAgICAgICAgICAgICAgaWYgKGZtICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgaWYgKHdvcmtQYWludC5iYXNlbGluZVNoaWZ0IDwgMCkgewotICAgICAgICAgICAgICAgICAgICAgICAgZm0uYXNjZW50ICs9IHdvcmtQYWludC5iYXNlbGluZVNoaWZ0OwotICAgICAgICAgICAgICAgICAgICAgICAgZm0udG9wICs9IHdvcmtQYWludC5iYXNlbGluZVNoaWZ0OwotICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICAgICAgZm0uZGVzY2VudCArPSB3b3JrUGFpbnQuYmFzZWxpbmVTaGlmdDsKLSAgICAgICAgICAgICAgICAgICAgICAgIGZtLmJvdHRvbSArPSB3b3JrUGFpbnQuYmFzZWxpbmVTaGlmdDsKKyAgICAgICAgdm9pZCByZXNldChpbnQgaW5jcmVtZW50LCBPYmplY3RbXSBzcGFucykgeworICAgICAgICAgICAgdGhpcy5tSW5jcmVtZW50ID0gaW5jcmVtZW50OworCisgICAgICAgICAgICBpbnQgbnMgPSAwOworICAgICAgICAgICAgaWYgKHNwYW5zICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBpbnRbXSBzdG9wcyA9IHRoaXMubVN0b3BzOworICAgICAgICAgICAgICAgIGZvciAoT2JqZWN0IG8gOiBzcGFucykgeworICAgICAgICAgICAgICAgICAgICBpZiAobyBpbnN0YW5jZW9mIFRhYlN0b3BTcGFuKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoc3RvcHMgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0b3BzID0gbmV3IGludFsxMF07CisgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKG5zID09IHN0b3BzLmxlbmd0aCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludFtdIG5zdG9wcyA9IG5ldyBpbnRbbnMgKiAyXTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IG5zOyArK2kpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnN0b3BzW2ldID0gc3RvcHNbaV07CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0b3BzID0gbnN0b3BzOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgc3RvcHNbbnMrK10gPSAoKFRhYlN0b3BTcGFuKSBvKS5nZXRUYWJTdG9wKCk7CiAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICBpZiAocG9zICE9IGxlbikgewotICAgICAgICAgICAgICAgICAgICBpZiAoYm0gPT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICAgICAgLy8gbm8gZW1vamksIG11c3QgaGF2ZSBoaXQgYSB0YWIKLSAgICAgICAgICAgICAgICAgICAgICAgIHdpZHRoID0gbmV4dFRhYih0ZXh0LCBzdGFydCwgZW5kLCB3aWR0aCwgdGFicyk7Ci0gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAvLyBUaGlzIHNldHMgdXAgd29ya1BhaW50IHdpdGggdGhlIGZvbnQgb24gdGhlIGVtb2ppCi0gICAgICAgICAgICAgICAgICAgICAgICAvLyB0ZXh0LCBzbyB0aGF0IHdlIGNhbiBleHRyYWN0IHRoZSBhc2NlbnQgYW5kIHNjYWxlLgotCi0gICAgICAgICAgICAgICAgICAgICAgICAvLyBXZSBjYW4ndCB1c2UgdGhlIHJlc3VsdCBvZiB0aGUgcHJldmlvdXMgY2FsbCB0bwotICAgICAgICAgICAgICAgICAgICAgICAgLy8gbWVhc3VyZVRleHQgYmVjYXVzZSB0aGUgZW1vamkgbWlnaHQgaGF2ZSBpdHMgb3duIHN0eWxlLgotICAgICAgICAgICAgICAgICAgICAgICAgLy8gV2UgaGF2ZSB0byBpbml0aWFsaXplIHdvcmtQYWludCBoZXJlIGJlY2F1c2UgaWYgdGhlCi0gICAgICAgICAgICAgICAgICAgICAgICAvLyB0ZXh0IGlzIHVuc3R5bGVkIG1lYXN1cmVUZXh0IG1pZ2h0IG5vdCB1c2Ugd29ya1BhaW50Ci0gICAgICAgICAgICAgICAgICAgICAgICAvLyBhdCBhbGwuCi0gICAgICAgICAgICAgICAgICAgICAgICB3b3JrUGFpbnQuc2V0KHBhaW50KTsKLSAgICAgICAgICAgICAgICAgICAgICAgIFN0eWxlZC5tZWFzdXJlVGV4dChwYWludCwgd29ya1BhaW50LCB0ZXh0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXJ0ICsgcG9zLCBzdGFydCArIHBvcyArIDEsIG51bGwpOwotCi0gICAgICAgICAgICAgICAgICAgICAgICB3aWR0aCArPSAoZmxvYXQpIGJtLmdldFdpZHRoKCkgKgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLXdvcmtQYWludC5hc2NlbnQoKSAvIGJtLmdldEhlaWdodCgpOwotCi0gICAgICAgICAgICAgICAgICAgICAgICAvLyBTaW5jZSB3ZSBoYWQgYW4gZW1vamksIHdlIGJ1bXAgcGFzdCB0aGUgc2Vjb25kIGhhbGYKLSAgICAgICAgICAgICAgICAgICAgICAgIC8vIG9mIHRoZSBzdXJyb2dhdGUgcGFpci4KLSAgICAgICAgICAgICAgICAgICAgICAgIHBvcysrOwotICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaWYgKG5zID4gMSkgeworICAgICAgICAgICAgICAgICAgICBBcnJheXMuc29ydChzdG9wcywgMCwgbnMpOwogICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgIGlmIChmbSAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChmbS5hc2NlbnQgPCBhc2NlbnQpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGFzY2VudCA9IGZtLmFzY2VudDsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBpZiAoZm0uZGVzY2VudCA+IGRlc2NlbnQpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGRlc2NlbnQgPSBmbS5kZXNjZW50OwotICAgICAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICAgICAgaWYgKGZtLnRvcCA8IHRvcCkgewotICAgICAgICAgICAgICAgICAgICAgICAgdG9wID0gZm0udG9wOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIGlmIChmbS5ib3R0b20gPiBib3R0b20pIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGJvdHRvbSA9IGZtLmJvdHRvbTsKLSAgICAgICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgICAgIC8vIE5vIG5lZWQgdG8gdGFrZSBiaXRtYXAgaGVpZ2h0IGludG8gYWNjb3VudCBoZXJlLAotICAgICAgICAgICAgICAgICAgICAvLyBzaW5jZSBpdCBpcyBzY2FsZWQgdG8gbWF0Y2ggdGhlIHRleHQgaGVpZ2h0LgorICAgICAgICAgICAgICAgIGlmIChzdG9wcyAhPSB0aGlzLm1TdG9wcykgeworICAgICAgICAgICAgICAgICAgICB0aGlzLm1TdG9wcyA9IHN0b3BzOwogICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgIGxhc3RQb3MgPSBwb3MgKyAxOwogICAgICAgICAgICAgfQorICAgICAgICAgICAgdGhpcy5tTnVtU3RvcHMgPSBuczsKICAgICAgICAgfQogCi0gICAgICAgIGlmIChmbSAhPSBudWxsKSB7Ci0gICAgICAgICAgICBmbS5hc2NlbnQgPSBhc2NlbnQ7Ci0gICAgICAgICAgICBmbS5kZXNjZW50ID0gZGVzY2VudDsKLSAgICAgICAgICAgIGZtLnRvcCA9IHRvcDsKLSAgICAgICAgICAgIGZtLmJvdHRvbSA9IGJvdHRvbTsKKyAgICAgICAgZmxvYXQgbmV4dFRhYihmbG9hdCBoKSB7CisgICAgICAgICAgICBpbnQgbnMgPSB0aGlzLm1OdW1TdG9wczsKKyAgICAgICAgICAgIGlmIChucyA+IDApIHsKKyAgICAgICAgICAgICAgICBpbnRbXSBzdG9wcyA9IHRoaXMubVN0b3BzOworICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbnM7ICsraSkgeworICAgICAgICAgICAgICAgICAgICBpbnQgc3RvcCA9IHN0b3BzW2ldOworICAgICAgICAgICAgICAgICAgICBpZiAoc3RvcCA+IGgpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBzdG9wOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuIG5leHREZWZhdWx0U3RvcChoLCBtSW5jcmVtZW50KTsKICAgICAgICAgfQogCi0gICAgICAgIGlmIChoYXNUYWJzKQotICAgICAgICAgICAgVGV4dFV0aWxzLnJlY3ljbGUoYnVmKTsKLQotICAgICAgICByZXR1cm4gd2lkdGg7CisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmxvYXQgbmV4dERlZmF1bHRTdG9wKGZsb2F0IGgsIGludCBpbmMpIHsKKyAgICAgICAgICAgIHJldHVybiAoKGludCkgKChoICsgaW5jKSAvIGluYykpICogaW5jOworICAgICAgICB9CiAgICAgfQogCiAgICAgLyoqCkBAIC0xNzQ3LDcgKzE1MTMsNyBAQAogCiAgICAgICAgIGlmICh0ZXh0IGluc3RhbmNlb2YgU3Bhbm5lZCkgewogICAgICAgICAgICAgaWYgKHRhYnMgPT0gbnVsbCkgewotICAgICAgICAgICAgICAgIHRhYnMgPSAoKFNwYW5uZWQpIHRleHQpLmdldFNwYW5zKHN0YXJ0LCBlbmQsIFRhYlN0b3BTcGFuLmNsYXNzKTsKKyAgICAgICAgICAgICAgICB0YWJzID0gZ2V0UGFyYWdyYXBoU3BhbnMoKFNwYW5uZWQpIHRleHQsIHN0YXJ0LCBlbmQsIFRhYlN0b3BTcGFuLmNsYXNzKTsKICAgICAgICAgICAgICAgICBhbGx0YWJzID0gdHJ1ZTsKICAgICAgICAgICAgIH0KIApAQCAtMTc3NCw2ICsxNTQwLDM4IEBACiAgICAgICAgIHJldHVybiBtU3Bhbm5lZFRleHQ7CiAgICAgfQogCisgICAgLyoqCisgICAgICogUmV0dXJucyB0aGUgc2FtZSBhcyA8Y29kZT50ZXh0LmdldFNwYW5zKCk8L2NvZGU+LCBleGNlcHQgd2hlcmUKKyAgICAgKiA8Y29kZT5zdGFydDwvY29kZT4gYW5kIDxjb2RlPmVuZDwvY29kZT4gYXJlIH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yAgICAgICAgTWVhc3VyZWRUZXh0IG10OworICAgICAgICBzeW5jaHJvbml6ZWQgKGNhY2hlZCkgeworICAgICAgICAgICAgZm9yIChpbnQgaSA9IGNhY2hlZC5sZW5ndGg7IC0taSA+PSAwOykgeworICAgICAgICAgICAgICAgIGlmIChjYWNoZWRbaV0gIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICBtdCA9IGNhY2hlZFtpXTsKKyAgICAgICAgICAgICAgICAgICAgY2FjaGVkW2ldID0gbnVsbDsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG10OworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICBtdCA9IG5ldyBNZWFzdXJlZFRleHQoKTsKKyAgICAgICAgTG9nLmUoIk1FQVMiLCAibmV3OiAiICsgbXQpOworICAgICAgICByZXR1cm4gbXQ7CisgICAgfQorCisgICAgLyogcGFja2FnZSAqLworICAgIHN0YXRpYyBNZWFzdXJlZFRleHQgcmVjeWNsZShNZWFzdXJlZFRleHQgbXQpIHsKKyAgICAgICAgbXQubVRleHQgPSBudWxsOworICAgICAgICBpZiAobXQubUxlbiA8IDEwMDApIHsKKyAgICAgICAgICAgIHN5bmNocm9uaXplZChjYWNoZWQpIHsKKyAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGNhY2hlZC5sZW5ndGg7ICsraSkgeworICAgICAgICAgICAgICAgICAgICBpZiAoY2FjaGVkW2ldID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNhY2hlZFtpXSA9IG10OworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIG51bGw7CisgICAgfQorCisgICAgLyoqCisgICAgICogQW5hbHl6ZXMgdGV4dCBmb3IgYmlkaXJlY3Rpb25hbCBydW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OyBpKyspIHsKKyAgICAgICAgICAgICAgICBpbnQgc3RhcnRJblBhcmEgPSBzcGFubmVkLmdldFNwYW5TdGFydChzcGFuc1tpXSkgLSBzdGFydDsKKyAgICAgICAgICAgICAgICBpbnQgZW5kSW5QYXJhID0gc3Bhbm5lZC5nZXRTcGFuRW5kKHNwYW5zW2ldKSAtIHN0YXJ0OworICAgICAgICAgICAgICAgIGZvciAoaW50IGogPSBzdGFydEluUGFyYTsgaiA8IGVuZEluUGFyYTsgaisrKSB7CisgICAgICAgICAgICAgICAgICAgIG1DaGFyc1tqXSA9ICdcdUZGRkMnOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIGlmIChUZXh0VXRpbHMuZG9lc05vdE5lZWRCaWRpKG1DaGFycywgMCwgbGVuKSkgeworICAgICAgICAgICAgbURpciA9IExheW91dC5ESVJfTEVGVF9UT19SSUdIVDsKKyAgICAgICAgICAgIG1FYXN5ID0gdHJ1ZTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIGlmIChtTGV2ZWxzID09IG51bGwgfHwgbUxldmVscy5sZW5ndGggPCBsZW4pIHsKKyAgICAgICAgICAgICAgICBtTGV2ZWxzID0gbmV3IGJ5dGVbQXJyYXlVdGlscy5pZGVhbEJ5dGVBcnJheVNpemUobGVuKV07CisgICAgICAgICAgICB9CisgICAgICAgICAgICBtRGlyID0gQW5kcm9pZEJpZGkuYmlkaShiaWRpUmVxdWVzdCwgbUNoYXJzLCBtTGV2ZWxzLCBsZW4sIGZhbHNlKTsKKyAgICAgICAgICAgIG1FYXN5ID0gZmFsc2U7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBmbG9hdCBhZGRTdHlsZVJ1bihUZXh0UGFpbnQgcGFpbnQsIGludCBsZW4sIFBhaW50LkZvbnRNZXRyaWNzSW50IGZtKSB7CisgICAgICAgIGlmIChmbSAhPSBudWxsKSB7CisgICAgICAgICAgICBwYWludC5nZXRGb250TWV0cmljc0ludChmbSk7CisgICAgICAgIH0KKworICAgICAgICBpbnQgcCA9IG1Qb3M7CisgICAgICAgIG1Qb3MgPSBwICsgbGVuOworCisgICAgICAgIGlmIChtRWFzeSkgeworICAgICAgICAgICAgaW50IGZsYWdzID0gbURpciA9PSBMYXlvdXQuRElSX0xFRlRfVE9fUklHSFQKKyAgICAgICAgICAgICAgICA/IENhbnZhcy5ESVJFQ1RJT05fTFRSIDogQ2FudmFzLkRJUkVDVElPTl9SVEw7CisgICAgICAgICAgICByZXR1cm4gcGFpbnQuZ2V0VGV4dFJ1bkFkdmFuY2VzKG1DaGFycywgcCwgbGVuLCBwLCBsZW4sIGZsYWdzLCBtV2lkdGhzLCBwKTsKKyAgICAgICAgfQorCisgICAgICAgIGZsb2F0IHRvdGFsQWR2YW5jZSA9IDA7CisgICAgICAgIGludCBsZXZlbCA9IG1MZXZlbHNbcF07CisgICAgICAgIGZvciAoaW50IHEgPSBwLCBpID0gcCArIDEsIGUgPSBwICsgbGVuOzsgKytpKSB7CisgICAgICAgICAgICBpZiAoaSA9PSBlIHx8IG1MZXZlbHNbaV0gIT0gbGV2ZWwpIHsKKyAgICAgICAgICAgICAgICBpbnQgZmxhZ3MgPSAobGV2ZWwgJiAweDEpID09IDAgPyBDYW52YXMuRElSRUNUSU9OX0xUUiA6IENhbnZhcy5ESVJFQ1RJT05fUlRMOworICAgICAgICAgICAgICAgIHRvdGFsQWR2YW5jZSArPQorICAgICAgICAgICAgICAgICAgICAgICAgcGFpbnQuZ2V0VGV4dFJ1bkFkdmFuY2VzKG1DaGFycywgcSwgaSAtIHEsIHEsIGkgLSBxLCBmbGFncywgbVdpZHRocywgcSk7CisgICAgICAgICAgICAgICAgaWYgKGkgPT0gZSkgeworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgcSA9IGk7CisgICAgICAgICAgICAgICAgbGV2ZWwgPSBtTGV2ZWxzW2ldOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHJldHVybiB0b3RhbEFkdmFuY2U7CisgICAgfQorCisgICAgZmxvYXQgYWRkU3R5bGVSdW4oVGV4dFBhaW50IHBhaW50LCBNZXRyaWNBZmZlY3RpbmdTcGFuW10gc3BhbnMsIGludCBsZW4sCisgICAgICAgICAgICBQYWludC5Gb250TWV0cmljc0ludCBmbSkgeworCisgICAgICAgIFRleHRQYWludCB3b3JrUGFpbnQgPSBtV29ya1BhaW50OworICAgICAgICB3b3JrUGFpbnQuc2V0KHBhaW50KTsKKyAgICAgICAgLy8gWFhYIHBhaW50IHNob3VsZCBub3QgaGF2ZSBhIGJhc2VsaW5lIHNoaWZ0LCBidXQuLi4KKyAgICAgICAgd29ya1BhaW50LmJhc2VsaW5lU2hpZnQgPSAwOworCisgICAgICAgIFJlcGxhY2VtZW50U3BhbiByZXBsYWNlbWVudCA9IG51bGw7CisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgc3BhbnMubGVuZ3RoOyBpKyspIHsKKyAgICAgICAgICAgIE1ldHJpY0FmZmVjdGluZ1NwYW4gc3BhbiA9IHNwYW5zW2ldOworICAgICAgICAgICAgaWYgKHNwYW4gaW5zdGFuY2VvZiBSZXBsYWNlbWVudFNwYW4pIHsKKyAgICAgICAgICAgICAgICByZXBsYWNlbWVudCA9IChSZXBsYWNlbWVudFNwYW4pc3BhbjsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgc3Bhbi51cGRhdGVNZWFzdXJlU3RhdGUod29ya1BhaW50KTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIGZsb2F0IHdpZDsKKyAgICAgICAgaWYgKHJlcGxhY2VtZW50ID09IG51bGwpIHsKKyAgICAgICAgICAgIHdpZCA9IGFkZFN0eWxlUnVuKHdvcmtQYWludCwgbGVuLCBmbSk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAvLyBVc2Ugb3JpZ2luYWwgdGV4dC4gIFNob3VsZG4ndCBtYXR0ZXIuCisgICAgICAgICAgICB3aWQgPSByZXBsYWNlbWVudC5nZXRTaXplKHdvcmtQYWludCwgbVRleHQsIG1UZXh0U3RhcnQgKyBtUG9zLAorICAgICAgICAgICAgICAgICAgICBtVGV4dFN0YXJ0ICsgbVBvcyArIGxlbiwgZm0pOworICAgICAgICAgICAgZmxvYXRbXSB3ID0gbVdpZHRoczsKKyAgICAgICAgICAgIHdbbVBvc10gPSB3aWQ7CisgICAgICAgICAgICBmb3IgKGludCBpID0gbVBvcyArIDEsIGUgPSBtUG9zICsgbGVuOyBpIDwgZTsgaSsrKQorICAgICAgICAgICAgICAgIHdbaV0gPSAwOworICAgICAgICB9CisKKyAgICAgICAgaWYgKGZtICE9IG51bGwpIHsKKyAgICAgICAgICAgIGlmICh3b3JrUGFpbnQuYmFzZWxpbmVTaGlmdCA8IDApIHsKKyAgICAgICAgICAgICAgICBmbS5hc2NlbnQgKz0gd29ya1BhaW50LmJhc2VsaW5lU2hpZnQ7CisgICAgICAgICAgICAgICAgZm0udG9wICs9IHdvcmtQYWludC5iYXNlbGluZVNoaWZ0OworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBmbS5kZXNjZW50ICs9IHdvcmtQYWludC5iYXNlbGluZVNoaWZ0OworICAgICAgICAgICAgICAgIGZtLmJvdHRvbSArPSB3b3JrUGFpbnQuYmFzZWxpbmVTaGlmdDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHJldHVybiB3aWQ7CisgICAgfQorCisgICAgaW50IGJyZWFrVGV4dChpbnQgc3RhcnQsIGludCBsaW1pdCwgYm9vbGVhbiBmb3J3YXJkcywgZmxvYXQgd2lkdGgpIHsKKyAgICAgICAgZmxvYXRbXSB3ID0gbVdpZHRoczsKKyAgICAgICAgaWYgKGZvcndhcmRzKSB7CisgICAgICAgICAgICBmb3IgKGludCBpID0gc3RhcnQ7IGkgPCBsaW1pdDsgKytpKSB7CisgICAgICAgICAgICAgICAgaWYgKCh3aWR0aCAtPSB3W2ldKSA8IDApIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkgLSBzdGFydDsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBmb3IgKGludCBpID0gbGltaXQ7IC0taSA+PSBzdGFydDspIHsKKyAgICAgICAgICAgICAgICBpZiAoKHdpZHRoIC09IHdbaV0pIDwgMCkgeworICAgICAgICAgICAgICAgICAgICByZXR1cm4gbGltaXQgLSBpIC0xOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHJldHVybiBsaW1pdCAtIHN0YXJ0OworICAgIH0KKworICAgIGZsb2F0IG1lYXN1cmUoaW50IHN0YXJ0LCBpbnQgbGltaXQpIHsKKyAgICAgICAgZmxvYXQgd2lkdGggPSAwOworICAgICAgICBmbG9hdFtdIHcgPSBtV2lkdGhzOworICAgICAgICBmb3IgKGludCBpID0gc3RhcnQ7IGkgPCBsaW1pdDsgKytpKSB7CisgICAgICAgICAgICB3aWR0aCArPSB3W2ldOworICAgICAgICB9CisgICAgICAgIHJldHVybiB3aWR0aDsKKyAgICB9Cit9ClwgTm8gbmV3bGluZSBhdCBlbmQgb2YgZmlsZQpkaWZmIC0tZ2l0IGEvY29yZS9qYXZhL2FuZHJvaWQvdGV4dC9TZWxlY3Rpb24uamF2YSBiL2NvcmUvamF2YS9hbmRyb2lkL3RleHQvU2VsZWN0aW9uLmphdmEKaW5kZXggYmI5OGJjZS4uMTNjYjVlNiAxMDA2NDQKLS0tIGEvY29yZS9qYXZhL2FuZHJvaWQvdGV4dC9TZWxlY3Rpb24uamF2YQorKysgYi9jb3JlL2phdmEvYW5kcm9pZC90ZXh0L1NlbGVjdGlvbi5qYXZhCkBAIC00MTcsOCArNDE3LDggQEAKICAgICAgICAgfQogICAgIH0KIAotICAgIHByaXZhd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ZXNzV2FybmluZ3MoInVuY2hlY2tlZCIpCiAgICAgcHVibGljIDxUPiBUW10gZ2V0U3BhbnMoaW50IHF1ZXJ5U3RhcnQsIGludCBxdWVyeUVuZCwgQ2xhc3M8VD4ga2luZCkgewogICAgICAgICBpbnQgc3BhbkNvdW50ID0gbVNwYW5Db3VudDsKICAgICAgICAgT2JqZWN0W10gc3BhbnMgPSBtU3BhbnM7CkBAIC03MTcsOCArNzIyLDggQEAKICAgICAgICAgaW50IGdhcGxlbiA9IG1HYXBMZW5ndGg7CiAKICAgICAgICAgaW50IGNvdW50ID0gMDsKLSAgICAgICAgT2JqZWN0W10gcmV0ID0gbnVsbDsKLSAgICAgICAgT2JqZWN0IHJldDEgPSBudWxsOworICAgICAgICBUW10gcmV0ID0gbnVsbDsKKyAgICAgICAgVCByZXQxID0gbnVsbDsKIAogICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IHNwYW5Db3VudDsgaSsrKSB7CiAgICAgICAgICAgICBpbnQgc3BhblN0YXJ0ID0gc3RhcnRzW2ldOwpAQCAtNzUwLDExICs3NTUsMTMgQEAKICAgICAgICAgICAgIH0KIAogICAgICAgICAgICAgaWYgKGNvdW50ID09IDApIHsKLSAgICAgICAgICAgICAgICByZXQxID0gc3BhbnNbaV07CisgICAgICAgICAgICAgICAgLy8gU2FmZSBjb252ZXJzaW9uIHRoYW5rcyB0byB0aGUgaXNJbnN0YW5jZSB0ZXN0IGFib3ZlCisgICAgICAgICAgICAgICAgcmV0MSA9IChUKSBzcGFuc1tpXTsKICAgICAgICAgICAgICAgICBjb3VudCsrOwogICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICBpZiAoY291bnQgPT0gMSkgewotICAgICAgICAgICAgICAgICAgICByZXQgPSAoT2JqZWN0W10pIEFycmF5Lm5ld0luc3RhbmNlKGtpbmQsIHNwYW5Db3VudCAtIGkgKyAxKTsKKyAgICAgICAgICAgICAgICAgICAgLy8gU2FmZSBjb252ZXJzaW9uLCBidXQgcmVxdWlyZXMgYSBzdXBwcmVzc1dhcm5pbmcKKyAgICAgICAgICAgICAgICAgICAgcmV0ID0gKFRbXSkgQXJyYXkubmV3SW5zdGFuY2Uoa2luZCwgc3BhbkNvdW50IC0gaSArIDEpOwogICAgICAgICAgICAgICAgICAgICByZXRbMF0gPSByZXQxOwogICAgICAgICAgICAgICAgIH0KIApAQCAtNzcxLDI5ICs3NzgsMzMgQEAKICAgICAgICAgICAgICAgICAgICAgfQogCiAgICAgICAgICAgICAgICAgICAgIFN5c3RlbS5hcnJheWNvcHkocmV0LCBqLCByZXQsIGogKyAxLCBjb3VudCAtIGopOwotICAgICAgICAgICAgICAgICAgICByZXRbal0gPSBzcGFuc1tpXTsKKyAgICAgICAgICAgICAgICAgICAgLy8gU2FmZSBjb252ZXJzaW9uIHRoYW5rcyB0byB0aGUgaXNJbnN0YW5jZSB0ZXN0IGFib3ZlCisgICAgICAgICAgICAgICAgICAgIHJldFtqXSA9IChUKSBzcGFuc1tpXTsKICAgICAgICAgICAgICAgICAgICAgY291bnQrKzsKICAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICByZXRbY291bnQrK10gPSBzcGFuc1tpXTsKKyAgICAgICAgICAgICAgICAgICAgLy8gU2FmZSBjb252ZXJzaW9uIHRoYW5rcyB0byB0aGUgaXNJbnN0YW5jZSB0ZXN0IGFib3ZlCisgICAgICAgICAgICAgICAgICAgIHJldFtjb3VudCsrXSA9IChUKSBzcGFuc1tpXTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KIAogICAgICAgICBpZiAoY291bnQgPT0gMCkgewotICAgICAgICAgICAgcmV0dXJuIChUW10pIEFycmF5VXRpbHMuZW1wdHlBcnJheShraW5kKTsKKyAgICAgICAgICAgIHJldHVybiBBcnJheVV0aWxzLmVtcHR5QXJyYXkoa2luZCk7CiAgICAgICAgIH0KICAgICAgICAgaWYgKGNvdW50ID09IDEpIHsKLSAgICAgICAgICAgIHJldCA9IChPYmplY3RbXSkgQXJyYXkubmV3SW5zdGFuY2Uoa2luZCwgMSk7CisgICAgICAgICAgICAvLyBTYWZlIGNvbnZlcnNpb24sIGJ1dCByZXF1aXJlcyBhIHN1cHByZXNzV2FybmluZworICAgICAgICAgICAgcmV0ID0gKFRbXSkgQXJyYXkubmV3SW5zdGFuY2Uoa2luZCwgMSk7CiAgICAgICAgICAgICByZXRbMF0gPSByZXQxOwotICAgICAgICAgICAgcmV0dXJuIChUW10pIHJldDsKKyAgICAgICAgICAgIHJldHVybiByZXQ7CiAgICAgICAgIH0KICAgICAgICAgaWYgKGNvdW50ID09IHJldC5sZW5ndGgpIHsKLSAgICAgICAgICAgIHJldHVybiAoVFtdKSByZXQ7CisgICAgICAgICAgICByZXR1cm4gcmV0OwogICAgICAgICB9CiAKLSAgICAgICAgT2JqZWN0W10gbnJldCA9IChPYmplY3RbXSkgQXJyYXkubmV3SW5zdGFuY2Uoa2luZCwgY291bnQpOworICAgICAgICAvLyBTYWZlIGNvbnZlcnNpb24sIGJ1dCByZXF1aXJlcyBhIHN1cHByZXNzV2FybmluZworICAgICAgICBUW10gbnJldCA9IChUW10pIEFycmF5Lm5ld0luc3RhbmNlKGtpbmQsIGNvdW50KTsKICAgICAgICAgU3lzdGVtLmFycmF5Y29weShyZXQsIDAsIG5yZXQsIDAsIGNvdW50KTsKLSAgICAgICAgcmV0dXJuIChUW10pIG5yZXQ7CisgICAgICAgIHJldHVybiBucmV0OwogICAgIH0KIAogICAgIC8qKgpAQCAtODYyLDYgKzg3Myw3IEBACiAgICAgLyoqCiAgICAgICogUmV0dXJuIGEgU3RyaW5nIGNvbnRhaW5pbmcgYSBjb3B5IG9mIHRoZSBjaGFycyBpbiB0aGlzIGJ1ZmZlci4KICAgICAgKi8KKyAgICBAT3ZlcnJpZGUKICAgICBwdWJsaWMgU3RyaW5nIHRvU3RyaW5nKCkgewogICAgICAgICBpbnQgbGVuID0gbGVuZ3RoKCk7CiAgICAgICAgIGNoYXJbXSBidWYgPSBuZXcgY2hhcltsZW5dOwpAQCAtOTUyLDYgKzk2NCw3IEBACiAgICAgICAgIH0KICAgICB9CiAKKy8qCiAgICAgcHJpdmF0ZSBib29sZWFuIGlzcHJpbnQoY2hhciBjKSB7IC8vIFhYWAogICAgICAgICBpZiAoYyA+PSAnICcgJiYgYyA8PSAnficpCiAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKQEAgLTk1OSw3ICs5NzIsNiBAQAogICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgIH0KIAotLyoKICAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgc3RhcnRGbGFnKGludCBmbGFnKSB7CiAgICAgICAgIHJldHVybiAoZmxhZyA+PiA0KSAmIDB4MEY7CiAgICAgfQpAQCAtMTA1NCw3ICsxMDY2LDMyIEBACiAgICAgICAgIH0KICAgICB9CiAKKwogICAgIC8qKgorICAgICAqIERvbid0IGNhbGwgdGhpcyB5b3Vyc2VsZiAtLSBleGlzdHMgZm9yIENhbnZhcyB0byB1c2UgaW50ZXJuYWxseS4KKyAgICAgKiB7QGhpZGV9CisgICAgICovCisgICAgcHVibGljIHZvaWQgZHJhd1RleHRSdW4oQ2FudmFzIGMsIGludCBzdGFydCwgaW50IGVuZCwKKyAgICAgICAgICAgIGludCBjb250ZXh0U3RhcnQsIGludCBjb250ZXh0RW5kLAorICAgICAgICAgICAgZmxvYXQgeCwgZmxvYXQgeSwgaW50IGZsYWdzLCBQYWludCBwKSB7CisgICAgICAgIGNoZWNrUmFuZ2UoImRyYXdUZXh0UnVuIiwgc3RhcnQsIGVuZCk7CisKKyAgICAgICAgaW50IGNvbnRleHRMZW4gPSBjb250ZXh0RW5kIC0gY29udGV4dFN0YXJ0OworICAgICAgICBpbnQgbGVuID0gZW5kIC0gc3RhcnQ7CisgICAgICAgIGlmIChjb250ZXh0RW5kIDw9IG1HYXBTdGFydCkgeworICAgICAgICAgICAgYy5kcmF3VGV4dFJ1b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W50IGVuZCwgaW50IGNvbnRleHRTdGFydCwgaW50IGNvbnRleHRFbmQsIGludCBmbGFncywKKyAgICAgICAgICAgIGZsb2F0W10gYWR2YW5jZXMsIGludCBhZHZhbmNlc1BvcywgUGFpbnQgcCkgeworCisgICAgICAgIGZsb2F0IHJldDsKKworICAgICAgICBpbnQgY29udGV4dExlbiA9IGNvbnRleHRFbmQgLSBjb250ZXh0U3RhcnQ7CisgICAgICAgIGludCBsZW4gPSBlbmQgLSBzdGFydDsKKworICAgICAgICBpZiAoZW5kIDw9IG1HYXBTdGFydCkgeworICAgICAgICAgICAgcmV0ID0gcC5nZXRUZXh0UnVuQWR2YW5jZXMobVRleHQsIHN0YXJ0LCBsZW4sIGNvbnRleHRTdGFydCwgY29udGV4dExlbiwKKyAgICAgICAgICAgICAgICAgICAgZmxhZ3MsIGFkdmFuY2VzLCBhZHZhbmNlc1Bvcyk7CisgICAgICAgIH0gZWxzZSBpZiAoc3RhcnQgPj0gbUdhcFN0YXJ0KSB7CisgICAgICAgICAgICByZXQgPSBwLmdldFRleHRSdW5BZHZhbmNlcyhtVGV4dCwgc3RhcnQgKyBtR2FwTGVuZ3RoLCBsZW4sCisgICAgICAgICAgICAgICAgICAgIGNvbnRleHRTdGFydCArIG1HYXBMZW5ndGgsIGNvbnRleHRMZW4sIGZsYWdzLCBhZHZhbmNlcywgYWR2YW5jZXNQb3MpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgY2hhcltdIGJ1ZiA9IFRleHRVdGlscy5vYnRhaW4oY29udGV4dExlbik7CisgICAgICAgICAgICBnZXRDaGFycyhjb250ZXh0U3RhcnQsIGNvbnRleHRFbmQsIGJ1ZiwgMCk7CisgICAgICAgICAgICByZXQgPSBwLmdldFRleHRSdW5BZHZhbmNlcyhidWYsIHN0YXJ0IC0gY29udGV4dFN0YXJ0LCBsZW4sCisgICAgICAgICAgICAgICAgICAgIDAsIGNvbnRleHRMZW4sIGZsYWdzLCBhZHZhbmNlcywgYWR2YW5jZXNQb3MpOworICAgICAgICAgICAgVGV4dFV0aWxzLnJlY3ljbGUoYnVmKTsKKyAgICAgICAgfQorCisgICAgICAgIHJldHVybiByZXQ7CisgICAgfQorCisgICAgcHVibGljIGludCBnZXRUZXh0UnVuQ3Vyc29yKGludCBjb250ZXh0U3RhcnQsIGludCBjb250ZXh0RW5kLCBpbnQgZmxhZ3MsIGludCBvZmZzZXQsCisgICAgICAgICAgICBpbnQgY3Vyc29yT3B0LCBQYWludCBwKSB7CisKKyAgICAgICAgaW50IHJldDsKKworICAgICAgICBpbnQgY29udGV4dExlbiA9IGNvbnRleHRFbmQgLSBjb250ZXh0U3RhcnQ7CisgICAgICAgIGlmIChjb250ZXh0RW5kIDw9IG1HYXBTdGFydCkgeworICAgICAgICAgICAgcmV0ID0gcC5nZXRUZXh0UnVuQ3Vyc29yKG1UZXh0LCBjb250ZXh0U3RhcnQsIGNvbnRleHRMZW4sCisgICAgICAgICAgICAgICAgICAgIGZsYWdzLCBvZmZzZXQsIGN1cnNvck9wdCk7CisgICAgICAgIH0gZWxzZSBpZiAoY29udGV4dFN0YXJ0ID49IG1HYXBTdGFydCkgeworICAgICAgICAgICAgcmV0ID0gcC5nZXRUZXh0UnVuQ3Vyc29yKG1UZXh0LCBjb250ZXh0U3RhcnQgKyBtR2FwTGVuZ3RoLCBjb250ZXh0TGVuLAorICAgICAgICAgICAgICAgICAgICBmbGFncywgb2Zmc2V0ICsgbUdhcExlbmd0aCwgY3Vyc29yT3B0KSAtIG1HYXBMZW5ndGg7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBjaGFyW10gYnVmID0gVGV4dFV0aWxzLm9idGFpbihjb250ZXh0TGVuKTsKKyAgICAgICAgICAgIGdldENoYXJzKGNvbnRleHRTdGFydCwgY29udGV4dEVuZCwgYnVmLCAwKTsKKyAgICAgICAgICAgIHJldCA9IHAuZ2V0VGV4dFJ1bkN1cnNvcihidWYsIDAsIGNvbnRleHRMZW4sCisgICAgICAgICAgICA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AgICAgICAgICAgICAgID8gc291cmNlCiAgICAgICAgICAgICAgICAgOiAoc291cmNlIGluc3RhbmNlb2YgU3Bhbm5lZCkKICAgICAgICAgICAgICAgICAgICAgPyBuZXcgU3Bhbm5lZEVsbGlwc2l6ZXIoc291cmNlKQogICAgICAgICAgICAgICAgICAgICA6IG5ldyBFbGxpcHNpemVyKHNvdXJjZSksCkBAIC03Miw3ICs3NCw3IEBACiAgICAgICAgICAqIFRoaXMgaXMgYW5ub3lpbmcsIGJ1dCB3ZSBjYW4ndCByZWZlciB0byB0aGUgbGF5b3V0IHVudGlsCiAgICAgICAgICAqIHN1cGVyY2xhc3MgY29uc3RydWN0aW9uIGlzIGZpbmlzaGVkLCBhbmQgdGhlIHN1cGVyY2xhc3MKICAgICAgICAgICogY29uc3RydWN0b3Igd2FudHMgdGhlIHJlZmVyZW5jZSB0byB0aGUgZGlzcGxheSB0ZXh0LgotICAgICAgICAgKiAKKyAgICAgICAgICoKICAgICAgICAgICogVGhpcyB3aWxsIGJyZWFrIGlmIHRoZSBzdXBlcmNsYXNzIGNvbnN0cnVjdG9yIGV2ZXIgYWN0dWFsbHkKICAgICAgICAgICogY2FyZXMgYWJvdXQgdGhlIGNvbnRlbnQgaW5zdGVhZCBvZiBqdXN0IGhvbGRpbmcgdGhlIHJlZmVyZW5jZS4KICAgICAgICAgICovCkBAIC05NCwxMyArOTYsMTMgQEAKICAgICAgICAgbUxpbmVEaXJlY3Rpb25zID0gbmV3IERpcmVjdGlvbnNbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFycmF5VXRpbHMuaWRlYWxJbnRBcnJheVNpemUoMiAqIG1Db2x1bW5zKV07CiAKKyAgICAgICAgbU1lYXN1cmVkID0gTWVhc3VyZWRUZXh0Lm9idGFpbigpOworCiAgICAgICAgIGdlbmVyYXRlKHNvdXJjZSwgYnVmc3RhcnQsIGJ1ZmVuZCwgcGFpbnQsIG91dGVyd2lkdGgsIGFsaWduLAogICAgICAgICAgICAgICAgIC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U7CisgICAgICAgIGludCBwYXJhRW5kOworICAgICAgICBmb3IgKGludCBwYXJhU3RhcnQgPSBidWZzdGFydDsgcGFyYVN0YXJ0IDw9IGJ1ZmVuZDsgcGFyYVN0YXJ0ID0gcGFyYUVuZCkgeworICAgICAgICAgICAgcGFyYUVuZCA9IFRleHRVdGlscy5pbmRleE9mKHNvdXJjZSwgJ1xuJywgcGFyYVN0YXJ0LCBidWZlbmQpOworICAgICAgICAgICAgaWYgKHBhcmFFbmQgPCAwKQorICAgICAgICAgICAgICAgIHBhcmFFbmQgPSBidWZlbmQ7CiAgICAgICAgICAgICBlbHNlCi0gICAgICAgICAgICAgICAgZW5kID0gVGV4dFV0aWxzLmluZGV4T2Yoc291cmNlLCAnXG4nLCBzdGFydCwgYnVmZW5kKTsKKyAgICAgICAgICAgICAgICBwYXJhRW5kKys7CisgICAgICAgICAgICBpbnQgcGFyYUxlbiA9IHBhcmFFbmQgLSBwYXJhU3RhcnQ7CiAKLSAgICAgICAgICAgIGlmIChlbmQgPCAwKQotICAgICAgICAgICAgICAgIGVuZCA9IGJ1ZmVuZDsKLSAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgICAgICBlbmQrKzsKLQotICAgICAgICAgICAgaW50IGZpcnN0V2lkdGhMaW5lQ291bnQgPSAxOworICAgICAgICAgICAgaW50IGZpcnN0V2lkdGhMaW5lTGltaXQgPSBtTGluZUNvdW50ICsgMTsKICAgICAgICAgICAgIGludCBmaXJzdHdpZHRoID0gb3V0ZXJ3aWR0aDsKICAgICAgICAgICAgIGludCByZXN0d2lkdGggPSBvdXRlcndpZHRoOwogCiAgICAgICAgICAgICBMaW5lSGVpZ2h0U3BhbltdIGNob29zZWh0ID0gbnVsbDsKIAogICAgICAgICAgICAgaWYgKHNwYW5uZWQgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgIExlYWRpbmdNYXJnaW5TcGFuW10gc3A7Ci0KLSAgICAgICAgICAgICAgICBzcCA9IHNwYW5uZWQuZ2V0U3BhbnMoc3RhcnQsIGVuZCwgTGVhZGluZ01hcmdpblNwYW4uY2xhc3MpOworICAgICAgICAgICAgICAgIExlYWRpbmdNYXJnaW5TcGFuW10gc3AgPSBnZXRQYXJhZ3JhcGhTcGFucyhzcGFubmVkLCBwYXJhU3RhcnQsIHBhcmFFbmQsCisgICAgICAgICAgICAgICAgICAgICAgICBMZWFkaW5nTWFyZ2luU3Bhbi5jbGFzcyk7CiAgICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBzcC5sZW5ndGg7IGkrKykgewogICAgICAgICAgICAgICAgICAgICBMZWFkaW5nTWFyZ2luU3BhbiBsbXMgPSBzcFtpXTsKICAgICAgICAgICAgICAgICAgICAgZmlyc3R3aWR0aCAtPSBzcFtpXS5nZXRMZWFkaW5nTWFyZ2luKHRydWUpOwogICAgICAgICAgICAgICAgICAgICByZXN0d2lkdGggLT0gc3BbaV0uZ2V0TGVhZGluZ01hcmdpbihmYWxzZSk7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChsbXMgaW5zdGFuY2VvZiBMZWFkaW5nTWFyZ2luU3Bhbi5MZWFkaW5nTWFyZ2luU3BhbjIpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGZpcnN0V2lkdGhMaW5lQ291bnQgPSAoKExlYWRpbmdNYXJnaW5TcGFuLkxlYWRpbmdNYXJnaW5TcGFuMilsbXMpLmdldExlYWRpbmdNYXJnaW5MaW5lQ291bnQoKTsKKyAgICAgICAgICAgICAgICAgICAgCisgICAgICAgICAgICAgICAgICAgIC8vIExlYWRpbmdNYXJnaW5TcGFuMiBpcyBvZGQuICBUaGUgY291bnQgYWZmZWN0cyBhbGwKKyAgICAgICAgICAgICAgICAgICAgLy8gbGVhZGluZyBtYXJnaW4gc3BhbnMsIG5vdCBqdXN0IHRoaXMgcGFydGljdWxhciBvbmUsCisgICAgICAgICAgICAgICAgICAgIC8vIGFuZCBzdGFydCBmcm9tIHRoZSB0b3Agb2YgdGhlIHNwYW4sIG5vdCB0aGUgdG9wIG9mIHRoZQorICAgICAgICAgICAgICAgICAgICAvLyBwYXJhZ3JhcGguCisgICAgICAgICAgICAgICAgICAgIGlmIChsbXMgaW5zdGFuY2VvZiBMZWFkaW5nTWFyZ2luU3BhbjIpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIExlYWRpbmdNYXJnaW5TcGFuMiBsbXMyID0gKExlYWRpbmdNYXJnaW5TcGFuMikgbG1zOworICAgICAgICAgICAgICAgICAgICAgICAgaW50IGxtc0ZpcnN0TGluZSA9IGdldExpbmVGb3JPZmZzZXQoc3Bhbm5lZC5nZXRTcGFuU3RhcnQobG1zMikpOworICAgICAgICAgICAgICAgICAgICAgICAgZmlyc3RXaWR0aExpbmVMaW1pdCA9IGxtc0ZpcnN0TGluZSArIAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxtczIuZ2V0TGVhZGluZ01hcmdpbkxpbmVDb3VudCgpOwogICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgfQogCi0gICAgICAgICAgICAgICAgY2hvb3NlaHQgPSBzcGFubmVkLmdldFNwYW5zKHN0YXJ0LCBlbmQsIExpbmVIZWlnaHRTcGFuLmNsYXNzKTsKKyAgICAgICAgICAgICAgICBjaG9vc2VodCA9IGdldFBhcmFncmFwaFNwYW5zKHNwYW5uZWQsIHBhcmFTdGFydCwgcGFyYUVuZCwgTGluZUhlaWdodFNwYW4uY2xhc3MpOwogCiAgICAgICAgICAgICAgICAgaWYgKGNob29zZWh0Lmxlbmd0aCAhPSAwKSB7CiAgICAgICAgICAgICAgICAgICAgIGlmIChjaG9vc2VodHYgPT0gbnVsbCB8fApAQCAtMTkyLDExICsxODYsMTEgQEAKICAgICAgICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBjaG9vc2VodC5sZW5ndGg7IGkrKykgewogICAgICAgICAgICAgICAgICAgICAgICAgaW50IG8gPSBzcGFubmVkLmdldFNwYW5TdGFydChjaG9vc2VodFtpXSk7CiAKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChvIDwgc3RhcnQpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChvIDwgcGFyYVN0YXJ0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gc3RhcnRzIGluIHRoaXMgbGF5b3V0LCBiZWZvcmUgdGhlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gY3VycmVudCBwYXJhZ3JhcGgKIAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNob29zZWh0dltpXSA9IGdldExpbmVUb3AoZ2V0TGluZUZvck9mZnNldChvKSk7IAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNob29zZWh0dltpXSA9IGdldExpbmVUb3AoZ2V0TGluZUZvck9mZnNldChvKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHN0YXJ0cyBpbiB0aGlzIHBhcmFncmFwaAogCkBAIC0yMDYsMTYyICsyMDAsODcgQEAKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CiAKLSAgICAgICAgICAgIGlmIChlbmQgLSBzdGFydCA+IGNoZGlycy5sZW5ndGgpIHsKLSAgICAgICAgICAgICAgICBjaGRpcnMgPSBuZXcgYnl0ZVtBcnJheVV0aWxzLmlkZWFsQnl0ZUFycmF5U2l6ZShlbmQgLSBzdGFydCldOwotICAgICAgICAgICAgICAgIG1DaGRpcnMgPSBjaGRpcnM7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAoZW5kIC0gc3RhcnQgPiBjaHMubGVuZ3RoKSB7Ci0gICAgICAgICAgICAgICAgY2hzID0gbmV3IGNoYXJbQXJyYXlVdGlscy5pZGVhbENoYXJBcnJheVNpemUoZW5kIC0gc3RhcnQpXTsKLSAgICAgICAgICAgICAgICBtQ2hzID0gY2hzOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKChlbmQgLSBzdGFydCkgKiAyID4gd2lkdGhzLmxlbmd0aCkgewotICAgICAgICAgICAgICAgIHdpZHRocyA9IG5ldyBmbG9hdFtBcnJheVV0aWxzLmlkZWFsSW50QXJyYXlTaXplKChlbmQgLSBzdGFydCkgKiAyKV07Ci0gICAgICAgICAgICAgICAgbVdpZHRocyA9IHdpZHRoczsKLSAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1lYXN1cmVkLnNldFBhcmEoc291cmNlLCBwYXJhU3RhcnQsIHBhcmFFbmQsIERJUl9SRVFVRVNUX0RFRkFVTFRfTFRSKTsKKyAgICAgICAgICAgIGNoYXJbXSBjaHMgPSBtZWFzdXJlZC5tQ2hhcnM7CisgICAgICAgICAgICBmbG9hdFtdIHdpZHRocyA9IG1lYXN1cmVkLm1XaWR0aHM7CisgICAgICAgICAgICBieXRlW10gY2hkaXJzID0gbWVhc3VyZWQubUxldmVsczsKKyAgICAgICAgICAgIGludCBkaXIgPSBtZWFzdXJlZC5tRGlyOworICAgICAgICAgICAgYm9vbGVhbiBlYXN5ID0gbWVhc3VyZWQubUVhc3k7CiAKLSAgICAgICAgICAgIFRleHRVdGlscy5nZXRDaGFycyhzb3VyY2UsIHN0YXJ0LCBlbmQsIGNocywgMCk7Ci0gICAgICAgICAgICBmaW5hbCBpbnQgbiA9IGVuZCAtIHN0YXJ0OwotCi0gICAgICAgICAgICBib29sZWFuIGVhc3kgPSB0cnVlOwotICAgICAgICAgICAgYm9vbGVhbiBhbHRlcmVkID0gZmFsc2U7Ci0gICAgICAgICAgICBpbnQgZGlyID0gREVGQVVMVF9ESVI7IC8vIFhYWAotCi0gICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IG47IGkrKykgewotICAgICAgICAgICAgICAgIGlmIChjaHNbaV0gPj0gRklSU1RfUklHSFRfVE9fTEVGVCkgewotICAgICAgICAgICAgICAgICAgICBlYXN5ID0gZmFsc2U7Ci0gICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgLy8gRW5zdXJlIHRoYXQgbm9uZSBvZiB0aGUgdW5kZXJseWluZyBjaGFyYWN0ZXJzIGFyZSB0cmVhdGVkCi0gICAgICAgICAgICAvLyBhcyB2aWFibGUgYnJlYWtwb2ludHMsIGFuZCB0aGF0IHRoZSBlbnRpcmUgcnVuIGdldHMgdGhlCi0gICAgICAgICAgICAvLyBzYW1lIGJpZGkgZGlyZWN0aW9uLgotCi0gICAgICAgICAgICBpZiAoc291cmNlIGluc3RhbmNlb2YgU3Bhbm5lZCkgewotICAgICAgICAgICAgICAgIFNwYW5uZWQgc3AgPSAoU3Bhbm5lZCkgc291cmNlOwotICAgICAgICAgICAgICAgIFJlcGxhY2VtZW50U3BhbltdIHNwYW5zID0gc3AuZ2V0U3BhbnMoc3RhcnQsIGVuZCwgUmVwbGFjZW1lbnRTcGFuLmNsYXNzKTsKLQotICAgICAgICAgICAgICAgIGZvciAoaW50IHkgPSAwOyB5IDwgc3BhbnMubGVuZ3RoOyB5KyspIHsKLSAgICAgICAgICAgICAgICAgICAgaW50IGEgPSBzcC5nZXRTcGFuU3RhcnQoc3BhbnNbeV0pOwotICAgICAgICAgICAgICAgICAgICBpbnQgYiA9IHNwLmdldFNwYW5FbmQoc3BhbnNbeV0pOwotCi0gICAgICAgICAgICAgICAgICAgIGZvciAoaW50IHggPSBhOyB4IDwgYjsgeCsrKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBjaHNbeCAtIHN0YXJ0XSA9ICdcdUZGRkMnOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBpZiAoIWVhc3kpIHsKLSAgICAgICAgICAgICAgICAvLyBYWFggcHV0IG92ZXJyaWRlIGZsYWdzLCBldGMuIGludG8gY2hkaXJzCi0gICAgICAgICAgICAgICAgZGlyID0gYmlkaShkaXIsIGNocywgY2hkaXJzLCBuLCBmYWxzZSk7Ci0KLSAgICAgICAgICAgICAgICAvLyBEbyBtaXJyb3JpbmcgZm9yIHJpZ2h0LXRvLWxlZnQgc2VnbWVudHMKLQotICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbjsgaSsrKSB7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChjaGRpcnNbaV0gPT0gQ2hhcmFjdGVyLkRJUkVDVElPTkFMSVRZX1JJR0hUX1RPX0xFRlQpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGludCBqOwotCi0gICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGogPSBpOyBqIDwgbjsgaisrKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNoZGlyc1tqXSAhPQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDaGFyYWN0ZXIuRElSRUNUSU9OQUxJVFlfUklHSFRfVE9fTEVGVCkKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChBbmRyb2lkQ2hhcmFjdGVyLm1pcnJvcihjaHMsIGksIGogLSBpKSkKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBhbHRlcmVkID0gdHJ1ZTsKLQotICAgICAgICAgICAgICAgICAgICAgICAgaSA9IGogLSAxOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBDaGFyU2VxdWVuY2Ugc3ViOwotCi0gICAgICAgICAgICBpZiAoYWx0ZXJlZCkgewotICAgICAgICAgICAgICAgIGlmIChhbHRlciA9PSBudWxsKQotICAgICAgICAgICAgICAgICAgICBhbHRlciA9IEFsdGVyZWRDaGFyU2VxdWVuY2UubWFrZShzb3VyY2UsIGNocywgc3RhcnQsIGVuZCk7Ci0gICAgICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgICAgICAgICBhbHRlci51cGRhdGUoY2hzLCBzdGFydCwgZW5kKTsKLQotICAgICAgICAgICAgICAgIHN1YiA9IGFsdGVyOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBzdWIgPSBzb3VyY2U7Ci0gICAgICAgICAgICB9CisgICAgICAgICAgICBDaGFyU2VxdWVuY2Ugc3ViID0gc291cmNlOwogCiAgICAgICAgICAgICBpbnQgd2lkdGggPSBmaXJzdHdpZHRoOwogCiAgICAgICAgICAgICBmbG9hdCB3ID0gMDsKLSAgICAgICAgICAgIGludCBoZXJlID0gc3RhcnQ7CisgICAgICAgICAgICBpbnQgaGVyZSA9IHBhcmFTdGFydDsKIAotICAgICAgICAgICAgaW50IG9rID0gc3RhcnQ7CisgICAgICAgICAgICBpbnQgb2sgPSBwYXJhU3RhcnQ7CiAgICAgICAgICAgICBmbG9hdCBva3dpZHRoID0gdzsKICAgICAgICAgICAgIGludCBva2FzY2VudCA9IDAsIG9rZGVzY2VudCA9IDAsIG9rdG9wID0gMCwgb2tib3R0b20gPSAwOwogCi0gICAgICAgICAgICBpbnQgZml0ID0gc3RhcnQ7CisgICAgICAgICAgICBpbnQgZml0ID0gcGFyYVN0YXJ0OwogICAgICAgICAgICAgZmxvYXQgZml0d2lkdGggPSB3OwogICAgICAgICAgICAgaW50IGZpdGFzY2VudCA9IDAsIGZpdGRlc2NlbnQgPSAwLCBmaXR0b3AgPSAwLCBmaXRib3R0b20gPSAwOwogCi0gICAgICAgICAgICBib29sZWFuIHRhYiA9IGZhbHNlOworICAgICAgICAgICAgYm9vbGVhbiBoYXNUYWJPckVtb2ppID0gZmFsc2U7CisgICAgICAgICAgICBib29sZWFuIGhhc1RhYiA9IGZhbHNlOworICAgICAgICAgICAgVGFiU3RvcHMgdGFiU3RvcHMgPSBudWxsOwogCi0gICAgICAgICAgICBpbnQgbmV4dDsKLSAgICAgICAgICAgIGZvciAoaW50IGkgPSBzdGFydDsgaSA8IGVuZDsgaSA9IG5leHQpIHsKLSAgICAgICAgICAgICAgICBpZiAoc3Bhbm5lZCA9PSBudWxsKQotICAgICAgICAgICAgICAgICAgICBuZXh0ID0gZW5kOwotICAgICAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgICAgICAgICAgbmV4dCA9IHNwYW5uZWQubmV4dFNwYW5UcmFuc2l0aW9uKGksIGVuZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1ldHJpY0FmZmVjdGluZ1NwYW4uCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGFzcyk7CisgICAgICAgICAgICBmb3IgKGludCBzcGFuU3RhcnQgPSBwYXJhU3RhcnQsIHNwYW5FbmQgPSBzcGFuU3RhcnQsIG5leHRTcGFuU3RhcnQ7CisgICAgICAgICAgICAgICAgICAgIHNwYW5TdGFydCA8IHBhcmFFbmQ7IHNwYW5TdGFydCA9IG5leHRTcGFuU3RhcnQpIHsKIAotICAgICAgICAgICAgICAgIGlmIChzcGFubmVkID09IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgcGFpbnQuZ2V0VGV4dFdpZHRocyhzdWIsIGksIG5leHQsIHdpZHRocyk7Ci0gICAgICAgICAgICAgICAgICAgIFN5c3RlbS5hcnJheWNvcHkod2lkdGhzLCAwLCB3aWR0aHMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5kIC0gc3RhcnQgKyAoaSAtIHN0YXJ0KSwgbmV4dCAtIGkpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAotICAgICAgICAgICAgICAgICAgICBwYWludC5nZXRGb250TWV0cmljc0ludChmbSk7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgbVdvcmtQYWludC5iYXNlbGluZVNoaWZ0ID0gMDsKKyAgICAgICAgICAgICAgICBpZiAoc3BhblN0YXJ0ID09IHNwYW5FbmQpIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKHNwYW5uZWQgPT0gbnVsbCkKKyAgICAgICAgICAgICAgICAgICAgICAgIHNwYW5FbmQgPSBwYXJhRW5kOworICAgICAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgICAgICAgICBzcGFuRW5kID0gc3Bhbm5lZC5uZXh0U3BhblRyYW5zaXRpb24oc3BhblN0YXJ0LCBwYXJhRW5kLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNZXRyaWNBZmZlY3RpbmdTcGFuLmNsYXNzKTsKIAotICAgICAgICAgICAgICAgICAgICBTdHlsZWQuZ2V0VGV4dFdpZHRocyhwYWludCwgbVdvcmtQYWludCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3Bhbm5lZCwgaSwgbmV4dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2lkdGhzLCBmbSk7Ci0gICAgICAgICAgICAgICAgICAgIFN5c3RlbS5hcnJheWNvcHkod2lkdGhzLCAwLCB3aWR0aHMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5kIC0gc3RhcnQgKyAoaSAtIHN0YXJ0KSwgbmV4dCAtIGkpOwotCi0gICAgICAgICAgICAgICAgICAgIGlmIChtV29ya1BhaW50LmJhc2VsaW5lU2hpZnQgPCAwKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBmbS5hc2NlbnQgKz0gbVdvcmtQYWludC5iYXNlbGluZVNoaWZ0OwotICAgICAgICAgICAgICAgICAgICAgICAgZm0udG9wICs9IG1Xb3JrUGFpbnQuYmFzZWxpbmVTaGlmdDsKKyAgICAgICAgICAgICAgICAgICAgaW50IHNwYW5MZW4gPSBzcGFuRW5kIC0gc3BhblN0YXJ0OworICAgICAgICAgICAgICAgICAgICBpZiAoc3Bhbm5lZCA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBtZWFzdXJlZC5hZGRTdHlsZVJ1bihwYWludCwgc3BhbkxlbiwgZm0pOwogICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICAgICAgZm0uZGVzY2VudCArPSBtV29ya1BhaW50LmJhc2VsaW5lU2hpZnQ7Ci0gICAgICAgICAgICAgICAgICAgICAgICBmbS5ib3R0b20gKz0gbVdvcmtQYWludC5iYXNlbGluZVNoaWZ0OworICAgICAgICAgICAgICAgICAgICAgICAgTWV0cmljQWZmZWN0aW5nU3BhbltdIHNwYW5zID0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcGFubmVkLmdldFNwYW5zKHNwYW5TdGFydCwgc3BhbkVuZCwgTWV0cmljQWZmZWN0aW5nU3Bhbi5jbGFzcyk7CisgICAgICAgICAgICAgICAgICAgICAgICBtZWFzdXJlZC5hZGRTdHlsZVJ1bihwYWludCwgc3BhbnMsIHNwYW5MZW4sIGZtKTsKICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIH0KIAorICAgICAgICAgICAgICAgIG5leHRTcGFuU3RhcnQgPSBzcGFuRW5kOworICAgICAgICAgICAgICAgIGludCBzdGFydEluUGFyYSA9IHNwYW5TdGFydCAtIHBhcmFTdGFydDsKKyAgICAgICAgICAgICAgICBpbnQgZW5kSW5QYXJhID0gc3BhbkVuZCAtIHBhcmFTdGFydDsKKwogICAgICAgICAgICAgICAgIGludCBmbXRvcCA9IGZtLnRvcDsKICAgICAgICAgICAgICAgICBpbnQgZm1ib3R0b20gPSBmbS5ib3R0b207CiAgICAgICAgICAgICAgICAgaW50IGZtYXNjZW50ID0gZm0uYXNjZW50OwogICAgICAgICAgICAgICAgIGludCBmbWRlc2NlbnQgPSBmbS5kZXNjZW50OwogCi0gICAgICAgICAgICAgICAgaWYgKGZhbHNlKSB7Ci0gICAgICAgICAgICAgICAgICAgIFN0cmluZ0J1aWxkZXIgc2IgPSBuZXcgU3RyaW5nQnVpbGRlcigpOwotICAgICAgICAgICAgICAgICAgICBmb3IgKGludCBqID0gaTsgaiA8IG5leHQ7IGorKykgewotICAgICAgICAgICAgICAgICAgICAgICAgc2IuYXBwZW5kKHdpZHRoc1tqIC0gc3RhcnQgKyAoZW5kIC0gc3RhcnQpXSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBzYi5hcHBlbmQoJyAnKTsKLSAgICAgICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgICAgIExvZy5lKCJ0ZXh0Iiwgc2IudG9TdHJpbmcoKSk7Ci0gICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgZm9yIChpbnQgaiA9IGk7IGogPCBuZXh0OyBqKyspIHsKLSAgICAgICAgICAgICAgICAgICAgY2hhciBjID0gY2hzW2ogLSBzdGFydF07CisgICAgICAgICAgICAgICAgZm9yIChpbnQgaiA9IHNwYW5TdGFydDsgaiA8IHNwYW5FbmQ7IGorKykgeworICAgICAgICAgICAgICAgICAgICBjaGFyIGMgPSBjaHNbaiAtIHBhcmFTdGFydF07CiAgICAgICAgICAgICAgICAgICAgIGZsb2F0IGJlZm9yZSA9IHc7CiAKICAgICAgICAgICAgICAgICAgICAgaWYgKGMgPT0gJ1xuJykgewogICAgICAgICAgICAgICAgICAgICAgICAgOwogICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGMgPT0gJ1x0JykgewotICAgICAgICAgICAgICAgICAgICAgICAgdyA9IExheW91dC5uZXh0VGFiKHN1Yiwgc3RhcnQsIGVuZCwgdywgbnVsbCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB0YWIgPSB0cnVlOwotICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGMgPj0gMHhEODAwICYmIGMgPD0gMHhERkZGICYmIGogKyAxIDwgbmV4dCkgewotICAgICAgICAgICAgICAgICAgICAgICAgaW50IGVtb2ppID0gQ2hhcmFjdGVyLmNvZGVQb2ludEF0KGNocywgaiAtIHN0YXJ0KTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChoYXNUYWIgPT0gZmFsc2UpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYXNUYWIgPSB0cnVlOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhhc1RhYk9yRW1vamkgPSB0cnVlOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzcGFubmVkICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gRmlyc3QgdGFiIHRoaXMgcGFyYSwgY2hlY2sgZm9yIHRhYnN0b3BzCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRhYlN0b3BTcGFuW10gc3BhbnMgPSBnZXRQYXJhZ3JhcGhTcGFucyhzcGFubmVkLCBwYXJhU3RhcnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyYUVuZCwgVGFiU3RvcFNwYW4uY2xhc3MpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoc3BhbnMubGVuZ3RoID4gMCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGFiU3RvcHMgPSBuZXcgVGFiU3RvcHMoVEFCX0lOQ1JFTUVOVCwgc3BhbnMpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHRhYlN0b3BzICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB3ID0gdGFiU3RvcHMubmV4dFRhYih3KTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgdyA9IFRhYlN0b3BzLm5leHREZWZhdWx0U3RvcCh3LCBUQUJfSU5DUkVNRU5UKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChjID49IDB4RDgwMCAmJiBjIDw9IDB4REZGRiAmJiBqICsgMSA8IHNwYW5FbmQpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGludCBlbW9qaSA9IENoYXJhY3Rlci5jb2RlUG9pbnRBdChjaHMsIGogLSBwYXJhU3RhcnQpOwogCiAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZW1vamkgPj0gTUlOX0VNT0pJICYmIGVtb2ppIDw9IE1BWF9FTU9KSSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgIEJpdG1hcCBibSA9IEVNT0pJX0ZBQ1RPUlkuCkBAIC0zNzYsMjEgKzI5NSwyMSBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2hpY2hQYWludCA9IG1Xb3JrUGFpbnQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KIAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCB3aWQgPSAoZmxvYXQpIGJtLmdldFdpZHRoKCkgKgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCB3aWQgPSBibS5nZXRXaWR0aCgpICoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLXdoaWNoUGFpbnQuYXNjZW50KCkgLwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBibS5nZXRIZWlnaHQoKTsKIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3ICs9IHdpZDsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGFiID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGFzVGFiT3JFbW9qaSA9IHRydWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGorKzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3ICs9IHdpZHRoc1tqIC0gc3RhcnQgKyAoZW5kIC0gc3RhcnQpXTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdyArPSB3aWR0aHNbaiAtIHBhcmFTdGFydF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB3ICs9IHdpZHRoc1tqIC0gc3RhcnQgKyAoZW5kIC0gc3RhcnQpXTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB3ICs9IHdpZHRoc1tqIC0gcGFyYVN0YXJ0XTsKICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHcgKz0gd2lkdGhzW2ogLSBzdGFydCArIChlbmQgLSBzdGFydCldOworICAgICAgICAgICAgICAgICAgICAgICAgdyArPSB3aWR0aHNbaiAtIHBhcmFTdGFydF07CiAgICAgICAgICAgICAgICAgICAgIH0KIAogICAgICAgICAgICAgICAgICAgICAvLyBMb2cuZSgidGV4dCIsICJ3YXMgIiArIGJlZm9yZSArICIgbm93ICIgKyB3ICsgIiBhZnRlciAiICsgYyArICIgd2l0aGluICIgKyB3aWR0aCk7CkBAIC00MTEsNyArMzMwLDcgQEAKICAgICAgICAgICAgICAgICAgICAgICAgIC8qCiAgICAgICAgICAgICAgICAgICAgICAgICAgKiBGcm9tIHRoZSBVbmljb2RlIExpbmUgQnJlYWtpbmcgQWxnb3JpdGhtOgogICAgICAgICAgICAgICAgICAgICAgICAgICogKGF0IGxlYXN0IGFwcHJveGltYXRlbHkpCi0gICAgICAgICAgICAgICAgICAgICAgICAgKiAgCisgICAgICAgICAgICAgICAgICAgICAgICAgKgogICAgICAgICAgICAgICAgICAgICAgICAgICogLiw6OyBhcmUgY2xhc3MgSVM6IGJyZWFrcG9pbnRzCiAgICAgICAgICAgICAgICAgICAgICAgICAgKiAgICAgIGV4Y2VwdCB3aGVuIGFkamFjZW50IHRvIGRpZ2l0cwogICAgICAgICAgICAgICAgICAgICAgICAgICogLyAgICBpcyBjbGFzcyBTWTogYSBicmVha3BvaW50CkBAIC00MjYsMTIgKzM0NSwxMiBAQAogCiAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYyA9PSAnICcgfHwgYyA9PSAnXHQnIHx8CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKChjID09ICcuJyAgfHwgYyA9PSAnLCcgfHwgYyA9PSAnOicgfHwgYyA9PSAnOycpICYmCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgIChqIC0gMSA8IGhlcmUgfHwgIUNoYXJhY3Rlci5pc0RpZ2l0KGNoc1tqIC0gMSAtIHN0YXJ0XSkpICYmCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgIChqICsgMSA+PSBuZXh0IHx8ICFDaGFyYWN0ZXIuaXNEaWdpdChjaHNbaiArIDEgLSBzdGFydF0pKSkgfHwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGogLSAxIDwgaGVyZSB8fCAhQ2hhcmFjdGVyLmlzRGlnaXQoY2hzW2ogLSAxIC0gcGFyYVN0YXJ0XSkpICYmCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChqICsgMSA+PSBzcGFuRW5kIHx8ICFDaGFyYWN0ZXIuaXNEaWdpdChjaHNbaiArIDEgLSBwYXJhU3RhcnRdKSkpIHx8CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKChjID09ICcvJyB8fCBjID09ICctJykgJiYKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGogKyAxID49IG5leHQgfHwgIUNoYXJhY3Rlci5pc0RpZ2l0KGNoc1tqICsgMSAtIHN0YXJ0XSkpKSB8fAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoaiArIDEgPj0gc3BhbkVuZCB8fCAhQ2hhcmFjdGVyLmlzRGlnaXQoY2hzW2ogKyAxIC0gcGFyYVN0YXJ0XSkpKSB8fAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIChjID49IEZJUlNUX0NKSyAmJiBpc0lkZW9ncmFwaGljKGMsIHRydWUpICYmCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgIGogKyAxIDwgbmV4dCAmJiBpc0lkZW9ncmFwaGljKGNoc1tqICsgMSAtIHN0YXJ0XSwgZmFsc2UpKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqICsgMSA8IHNwYW5FbmQgJiYgaXNJZGVvZ3JhcGhpYyhjaHNbaiArIDEgLSBwYXJhU3RhcnRdLCBmYWxzZSkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb2t3aWR0aCA9IHc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb2sgPSBqICsgMTsKIApAQCAtNDQ4LDcgKzM2Nyw3IEBACiAgICAgICAgICAgICAgICAgICAgICAgICBpZiAob2sgIT0gaGVyZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIExvZy5lKCJ0ZXh0IiwgIm91dHB1dCBvayAiICsgaGVyZSArICIgdG8gIiArb2spOwogCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKG9rIDwgbmV4dCAmJiBjaHNbb2sgLSBzdGFydF0gPT0gJyAnKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKG9rIDwgc3BhbkVuZCAmJiBjaHNbb2sgLSBwYXJhU3RhcnRdID09ICcgJykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvaysrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KIApAQCAtNDU3LDEwICszNzYsMTAgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9rYXNjZW50LCBva2Rlc2NlbnQsIG9rdG9wLCBva2JvdHRvbSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcGFjaW5nbXVsdCwgc3BhY2luZ2FkZCwgY2hvb3NlaHQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaG9vc2VodHYsIGZtLCB0YWIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZWVkTXVsdGlwbHksIHN0YXJ0LCBjaGRpcnMsIGRpciwgZWFzeSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNob29zZWh0diwgZm0sIGhhc1RhYk9yRW1vamksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZWVkTXVsdGlwbHksIHBhcmFTdGFydCwgY2hkaXJzLCBkaXIsIGVhc3ksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvayA9PSBidWZlbmQsIGluY2x1ZGVwYWQsIHRyYWNrcGFkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2lkdGhzLCBzdGFydCwgZW5kIC0gc3RhcnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaHMsIHdpZHRocywgaGVyZSAtIHBhcmFTdGFydCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdoZXJlLCBlbGxpcHNpemVkV2lkdGgsIG9rd2lkdGgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYWludCk7CiAKQEAgLTQ4NCw3ICs0MDMsNyBAQAogICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG9rICE9IGhlcmUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBMb2cuZSgidGV4dCIsICJvdXRwdXQgb2sgIiArIGhlcmUgKyAiIHRvICIgK29rKTsKIAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChvayA8IG5leHQgJiYgY2hzW29rIC0gc3RhcnRdID09ICcgJykgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChvayA8IHNwYW5FbmQgJiYgY2hzW29rIC0gcGFyYVN0YXJ0XSA9PSAnICcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb2srKzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAKQEAgLTQ5MywxMCArNDEyLDEwIEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBva2FzY2VudCwgb2tkZXNjZW50LCBva3RvcCwgb2tib3R0b20sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3BhY2luZ211bHQsIHNwYWNpbmdhZGQsIGNob29zZWh0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hvb3NlaHR2LCBmbSwgdGFiLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmVlZE11bHRpcGx5LCBzdGFydCwgY2hkaXJzLCBkaXIsIGVhc3ksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaG9vc2VodHYsIGZtLCBoYXNUYWJPckVtb2ppLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmVlZE11bHRpcGx5LCBwYXJhU3RhcnQsIGNoZGlycywgZGlyLCBlYXN5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb2sgPT0gYnVmZW5kLCBpbmNsdWRlcGFkLCB0cmFja3BhZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpZHRocywgc3RhcnQsIGVuZCAtIHN0YXJ0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hzLCB3aWR0aHMsIGhlcmUgLSBwYXJhU3RhcnQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aGVyZSwgZWxsaXBzaXplZFdpZHRoLCBva3dpZHRoLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFpbnQpOwogCkBAIC01MDksMTkgKzQyOCwyMCBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZml0dG9wLCBmaXRib3R0b20sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3BhY2luZ211bHQsIHNwYWNpbmdhZGQsIGNob29zZWh0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hvb3NlaHR2LCBmbSwgdGFiLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmVlZE11bHRpcGx5LCBzdGFydCwgY2hkaXJzLCBkaXIsIGVhc3ksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaG9vc2VodHYsIGZtLCBoYXNUYWJPckVtb2ppLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmVlZE11bHRpcGx5LCBwYXJhU3RhcnQsIGNoZGlycywgZGlyLCBlYXN5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZml0ID09IGJ1ZmVuZCwgaW5jbHVkZXBhZCwgdHJhY2twYWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aWR0aHMsIHN0YXJ0LCBlbmQgLSBzdGFydCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNocywgd2lkdGhzLCBoZXJlIC0gcGFyYVN0YXJ0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2hlcmUsIGVsbGlwc2l6ZWRXaWR0aCwgZml0d2lkdGgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYWludCk7CiAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoZXJlID0gZml0OwogICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBMb2cuZSgidGV4dCIsICJvdXRwdXQgb25lICIgKyBoZXJlICsgIiB0byAiICsoaGVyZSArIDEpKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZWFzdXJlVGV4dChwYWludCwgbVdvcmtQYWludCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2UsIGhlcmUsIGhlcmUgKyAxLCBmbSwgdGFiLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIFhYWCBub3Qgc3VyZSB3aHkgdGhlIGV4aXN0aW5nIGZtIHdhc24ndCBvay4KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBtZWFzdXJlVGV4dChwYWludCwgbVdvcmtQYWludCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyAgICAgICAgICAgICBzb3VyY2UsIGhlcmUsIGhlcmUgKyAxLCBmbSwgdGFiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vICAgICAgICAgICAgIG51bGwpOwogCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdiA9IG91dChzb3VyY2UsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoZXJlLCBoZXJlKzEsCkBAIC01MjksMTkgKzQ0OSwyMiBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm0udG9wLCBmbS5ib3R0b20sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3BhY2luZ211bHQsIHNwYWNpbmdhZGQsIGNob29zZWh0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hvb3NlaHR2LCBmbSwgdGFiLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmVlZE11bHRpcGx5LCBzdGFydCwgY2hkaXJzLCBkaXIsIGVhc3ksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaG9vc2VodHYsIGZtLCBoYXNUYWJPckVtb2ppLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmVlZE11bHRpcGx5LCBwYXJhU3RhcnQsIGNoZGlycywgZGlyLCBlYXN5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGVyZSArIDEgPT0gYnVmZW5kLCBpbmNsdWRlcGFkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2twYWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aWR0aHMsIHN0YXJ0LCBlbmQgLSBzdGFydCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNocywgd2lkdGhzLCBoZXJlIC0gcGFyYVN0YXJ0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2hlcmUsIGVsbGlwc2l6ZWRXaWR0aCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpZHRoc1toZXJlIC0gc3RhcnRdLCBwYWludCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aWR0aHNbaGVyZSAtIHBhcmFTdGFydF0sIHBhaW50KTsKIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhlcmUgPSBoZXJlICsgMTsKICAgICAgICAgICAgICAgICAgICAgICAgIH0KIAotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGhlcmUgPCBpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgaiA9IG5leHQgPSBoZXJlOyAvLyBtdXN0IHJlbWVhc3VyZQorICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGhlcmUgPCBzcGFuU3RhcnQpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBkaWRuJ3Qgb3V0cHV0IGFsbCB0aGUgdGV4dCBmb3IgdGhpcyBzcGFuCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gd2UndmUgbWVhc3VyZWQgdGhlIHJhdyB3aWR0aHMsIHRob3VnaCwgc28KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBqdXN0IHJlc2V0IHRoZSBzdGFydCBwb2ludAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGogPSBuZXh0U3BhblN0YXJ0ID0gaGVyZTsKICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaiA9IGhlcmUgLSAxOyAgICAvLyBjb250aW51ZSBsb29waW5nCiAgICAgICAgICAgICAgICAgICAgICAgICB9CkBAIC01NTEsMTQgKzQ3NCwxNCBAQAogICAgICAgICAgICAgICAgICAgICAgICAgZml0YXNjZW50ID0gZml0ZGVzY2VudCA9IGZpdHRvcCA9IGZpdGJvdHRvbSA9IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICBva2FzY2VudCA9IG9rZGVzY2VudCA9IG9rdG9wID0gb2tib3R0b20gPSAwOwogCi0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoLS1maXJzdFdpZHRoTGluZUNvdW50IDw9IDApIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmICgtLWZpcnN0V2lkdGhMaW5lTGltaXQgPD0gMCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpZHRoID0gcmVzdHdpZHRoOwogICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogCi0gICAgICAgICAgICBpZiAoZW5kICE9IGhlcmUpIHsKKyAgICAgICAgICAgIGlmIChwYXJhRW5kICE9IGhlcmUpIHsKICAgICAgICAgICAgICAgICBpZiAoKGZpdHRvcCB8IGZpdGJvdHRvbSB8IGZpdGRlc2NlbnQgfCBmaXRhc2NlbnQpID09IDApIHsKICAgICAgICAgICAgICAgICAgICAgcGFpbnQuZ2V0Rm9udE1ldHJpY3NJbnQoZm0pOwogCkBAIC01NzEsMjAgKzQ5NCwyMCBAQAogICAgICAgICAgICAgICAgIC8vIExvZy5lKCJ0ZXh0IiwgIm91dHB1dCByZXN0ICIgKyBoZXJlICsgIiB0byAiICsgZW5kKTsKIAogICAgICAgICAgICAgICAgIHYgPSBvdXQoc291cmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgaGVyZSwgZW5kLCBmaXRhc2NlbnQsIGZpdGRlc2NlbnQsCisgICAgICAgICAgICAgICAgICAgICAgICBoZXJlLCBwYXJhRW5kLCBmaXRhc2NlbnQsIGZpdGRlc2NlbnQsCiAgICAgICAgICAgICAgICAgICAgICAgICBmaXR0b3AsIGZpdGJvdHRvbSwKICAgICAgICAgICAgICAgICAgICAgICAgIHYsCiAgICAgICAgICAgICAgICAgICAgICAgICBzcGFjaW5nbXVsdCwgc3BhY2luZ2FkZCwgY2hvb3NlaHQsCi0gICAgICAgICAgICAgICAgICAgICAgICBjaG9vc2VodHYsIGZtLCB0YWIsCi0gICAgICAgICAgICAgICAgICAgICAgICBuZWVkTXVsdGlwbHksIHN0YXJ0LCBjaGRpcnMsIGRpciwgZWFzeSwKLSAgICAgICAgICAgICAgICAgICAgICAgIGVuZCA9PSBidWZlbmQsIGluY2x1ZGVwYWQsIHRyYWNrcGFkLAotICAgICAgICAgICAgICAgICAgICAgICAgd2lkdGhzLCBzdGFydCwgZW5kIC0gc3RhcnQsCisgICAgICAgICAgICAgICAgICAgICAgICBjaG9vc2VodHYsIGZtLCBoYXNUYWJPckVtb2ppLAorICAgICAgICAgICAgICAgICAgICAgICAgbmVlZE11bHRpcGx5LCBwYXJhU3RhcnQsIGNoZGlycywgZGlyLCBlYXN5LAorICAgICAgICAgICAgICAgICAgICAgICAgcGFyYUVuZCA9PSBidWZlbmQsIGluY2x1ZGVwYWQsIHRyYWNrcGFkLAorICAgICAgICAgICAgICAgICAgICAgICAgY2hzLCB3aWR0aHMsIGhlcmUgLSBwYXJhU3RhcnQsCiAgICAgICAgICAgICAgICAgICAgICAgICB3aGVyZSwgZWxsaXBzaXplZFdpZHRoLCB3LCBwYWludCk7CiAgICAgICAgICAgICB9CiAKLSAgICAgICAgICAgIHN0YXJ0ID0gZW5kOworICAgICAgICAgICAgcGFyYVN0YXJ0ID0gcGFyYUVuZDsKIAotICAgICAgICAgICAgaWYgKGVuZCA9PSBidWZlbmQpCisgICAgICAgICAgICBpZiAocGFyYUVuZCA9PSBidWZlbmQpCiAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgIH0KIApAQCAtNTk5LDI0NiArNTIyLDEzIEBACiAgICAgICAgICAgICAgICAgICAgIHYsCiAgICAgICAgICAgICAgICAgICAgIHNwYWNpbmdtdWx0LCBzcGFjaW5nYWRkLCBudWxsLAogICAgICAgICAgICAgICAgICAgICBudWxsLCBmbSwgZmFsc2UsCi0gICAgICAgICAgICAgICAgICAgIG5lZWRNdWx0aXBseSwgYnVmZW5kLCBjaGRpcnMsIERFRkFVTFRfRElSLCB0cnVlLAorICAgICAgICAgICAgICAgICAgICBuZWVkTXVsdGlwbHksIGJ1ZmVuZCwgbnVsbCwgREVGQVVMVF9ESVIsIHRydWUsCiAgICAgICAgICAgICAgICAgICAgIHRydWUsIGluY2x1ZGVwYWQsIHRyYWNrcGFkLAotICAgICAgICAgICAgICAgICAgICB3aWR0aHMsIGJ1ZnN0YXJ0LCAwLAorICAgICAgICAgICAgICAgICAgICBudWxsLCBudWxsLCBidWZzdGFydCwKICAgICAgICAgICAgICAgICAgICAgd2hlcmUsIGVsbGlwc2l6ZWRXaWR0aCwgMCwgcGFpbnQpOwogICAgICAgICB9CiAgICAgfQogCi0gICAgLyoqCi0gICAgICogUnVucyB0aGUgdW5pY29kZSBiaWRpIGFsZ29yaXRobSBvbiB0aGUgZmlyc3QgbiBjaGFycyB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ElSX0xFRlRfVE9fUklHSFQgb3IgRElSX1JJR0hUX1RPX0xFRlQuCi0gICAgICovCi0gICAgLyogcGFja2FnZSAqLyBzdGF0aWMgaW50IGJpZGkoaW50IGRpciwgY2hhcltdIGNocywgYnl0ZVtdIGNoSW5mbywgaW50IG4sIAotICAgICAgICAgICAgYm9vbGVhbiBoYXNJbmZvKSB7Ci0gICAgICAgIAotICAgICAgICBBbmRyb2lkQ2hhcmFjdGVyLmdldERpcmVjdGlvbmFsaXRpZXMoY2hzLCBjaEluZm8sIG4pOwotCi0gICAgICAgIC8qCi0gICAgICAgICAqIERldGVybWluZSBwcmltYXJ5IHBhcmFncmFwaCBkaXJlY3Rpb24gaWYgbm90IHNwZWNpZmllZAotICAgICAgICAgKi8KLSAgICAgICAgaWYgKGRpciAhPSBESVJfUkVRVUVTVF9MVFIgJiYgZGlyICE9IERJUl9SRVFVRVNUX1JUTCkgewotICAgICAgICAgICAgLy8gc2V0IHVwIGRlZmF1bHQKLSAgICAgICAgICAgIGRpciA9IGRpciA+PSAwID8gRElSX0xFRlRfVE9fUklHSFQgOiBESVJfUklHSFRfVE9fTEVGVDsKLSAgICAgICAgICAgIGZvciAoaW50IGogPSAwOyBqIDwgbjsgaisrKSB7Ci0gICAgICAgICAgICAgICAgaW50IGQgPSBjaEluZm9bal07Ci0KLSAgICAgICAgICAgICAgICBpZiAoZCA9PSBDaGFyYWN0ZXIuRElSRUNUSU9OQUxJVFlfTEVGVF9UT19SSUdIVCkgewotICAgICAgICAgICAgICAgICAgICBkaXIgPSBESVJfTEVGVF9UT19SSUdIVDsKLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGlmIChkID09IENoYXJhY3Rlci5ESVJFQ1RJT05BTElUWV9SSUdIVF9UT19MRUZUKSB7Ci0gICAgICAgICAgICAgICAgICAgIGRpciA9IERJUl9SSUdIVF9UT19MRUZUOwotICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQotICAgICAgICBmaW5hbCBieXRlIFNPUiA9IGRpciA9PSBESVJfTEVGVF9UT19SSUdIVCA/Ci0gICAgICAgICAgICAgICAgQ2hhcmFjdGVyLkRJUkVDVElPTkFMSVRZX0xFRlRfVE9fUklHSFQgOgotICAgICAgICAgICAgICAgIENoYXJhY3Rlci5ESVJFQ1RJT05BTElUWV9SSUdIVF9UT19MRUZUOwotCi0gICAgICAgIC8qCi0gICAgICAgICAqIFhYWCBFeHBsaWNpdCBvdmVycmlkZXMgc2hvdWxkIGdvIGhlcmUKLSAgICAgICAgICovCi0KLSAgICAgICAgLyoKLSAgICAgICAgICogV2VhayB0eXBlIHJlc29sdXRpb24KLSAgICAgICAgICovCi0KLSAgICAgICAgLy8gZHVtcChjaGRpcnMsIG4sICJpbml0aWFsIik7Ci0KLSAgICAgICAgLy8gVzEgbm9uIHNwYWNpbmcgbWFya3MKLSAgICAgICAgZm9yIChpbnQgaiA9IDA7IGogPCBuOyBqKyspIHsKLSAgICAgICAgICAgIGlmIChjaEluZm9bal0gPT0gQ2hhcmFjdGVyLk5PTl9TUEFDSU5HX01BUkspIHsKLSAgICAgICAgICAgICAgICBpZiAoaiA9PSAwKQotICAgICAgICAgICAgICAgICAgICBjaEluZm9bal0gPSBTT1I7Ci0gICAgICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgICAgICAgICBjaEluZm9bal0gPSBjaEluZm9baiAtIDFdOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgLy8gZHVtcChjaGRpcnMsIG4sICJXMSIpOwotCi0gICAgICAgIC8vIFcyIGV1cm9wZWFuIG51bWJlcnMKLSAgICAgICAgYnl0ZSBjdXIgPSBTT1I7Ci0gICAgICAgIGZvciAoaW50IGogPSAwOyBqIDwgbjsgaisrKSB7Ci0gICAgICAgICAgICBieXRlIGQgPSBjaEluZm9bal07Ci0KLSAgICAgICAgICAgIGlmIChkID09IENoYXJhY3Rlci5ESVJFQ1RJT05BTElUWV9MRUZUX1RPX1JJR0hUIHx8Ci0gICAgICAgICAgICAgICAgZCA9PSBDaGFyYWN0ZXIuRElSRUNUSU9OQUxJVFlfUklHSFRfVE9fTEVGVCB8fAotICAgICAgICAgICAgICAgIGQgPT0gQ2hhcmFjdGVyLkRJUkVDVElPTkFMSVRZX1JJR0hUX1RPX0xFRlRfQVJBQklDKQotICAgICAgICAgICAgICAgIGN1ciA9IGQ7Ci0gICAgICAgICAgICBlbHNlIGlmIChkID09IENoYXJhY3Rlci5ESVJFQ1RJT05BTElUWV9FVVJPUEVBTl9OVU1CRVIpIHsKLSAgICAgICAgICAgICAgICAgaWYgKGN1ciA9PQotICAgICAgICAgICAgICAgICAgICBDaGFyYWN0ZXIuRElSRUNUSU9OQUxJVFlfUklHSFRfVE9fTEVGVF9BUkFCSUMpCi0gICAgICAgICAgICAgICAgICAgIGNoSW5mb1tqXSA9IENoYXJhY3Rlci5ESVJFQ1RJT05BTElUWV9BUkFCSUNfTlVNQkVSOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgLy8gZHVtcChjaGRpcnMsIG4sICJXMiIpOwotCi0gICAgICAgIC8vIFczIGFyYWJpYyBsZXR0ZXJzCi0gICAgICAgIGZvciAoaW50IGogPSAwOyBqIDwgbjsgaisrKSB7Ci0gICAgICAgICAgICBpZiAoY2hJbmZvW2pdID09IENoYXJhY3Rlci5ESVJFQ1RJT05BTElUWV9SSUdIVF9UT19MRUZUX0FSQUJJQykKLSAgICAgICAgICAgICAgICBjaEluZm9bal0gPSBDaGFyYWN0ZXIuRElSRUNUSU9OQUxJVFlfUklHSFRfVE9fTEVGVDsKLSAgICAgICAgfQotCi0gICAgICAgIC8vIGR1bXAoY2hkaXJzLCBuLCAiVzMiKTsKLQotICAgICAgICAvLyBXNCBzaW5nbGUgc2VwYXJhdG9yIGJldHdlZW4gbnVtYmVycwotICAgICAgICBmb3IgKGludCBqID0gMTsgaiA8IG4gLSAxOyBqKyspIHsKLSAgICAgICAgICAgIGJ5dGUgZCA9IGNoSW5mb1tqXTsKLSAgICAgICAgICAgIGJ5dGUgcHJldiA9IGNoSW5mb1tqIC0gMV07Ci0gICAgICAgICAgICBieXRlIG5leHQgPSBjaEluZm9baiArIDFdOwotCi0gICAgICAgICAgICBpZiAoZCA9PSBDaGFyYWN0ZXIuRElSRUNUSU9OQUxJVFlfRVVST1BFQU5fTlVNQkVSX1NFUEFSQVRPUikgewotICAgICAgICAgICAgICAgIGlmIChwcmV2ID09IENoYXJhY3Rlci5ESVJFQ1RJT05BTElUWV9FVVJPUEVBTl9OVU1CRVIgJiYKLSAgICAgICAgICAgICAgICAgICAgbmV4dCA9PSBDaGFyYWN0ZXIuRElSRUNUSU9OQUxJVFlfRVVST1BFQU5fTlVNQkVSKQotICAgICAgICAgICAgICAgICAgICBjaEluZm9bal0gPSBDaGFyYWN0ZXIuRElSRUNUSU9OQUxJVFlfRVVST1BFQU5fTlVNQkVSOwotICAgICAgICAgICAgfSBlbHNlIGlmIChkID09IENoYXJhY3Rlci5ESVJFQ1RJT05BTElUWV9DT01NT05fTlVNQkVSX1NFUEFSQVRPUikgewotICAgICAgICAgICAgICAgIGlmIChwcmV2ID09IENoYXJhY3Rlci5ESVJFQ1RJT05BTElUWV9FVVJPUEVBTl9OVU1CRVIgJiYKLSAgICAgICAgICAgICAgICAgICAgbmV4dCA9PSBDaGFyYWN0ZXIuRElSRUNUSU9OQUxJVFlfRVVST1BFQU5fTlVNQkVSKQotICAgICAgICAgICAgICAgICAgICBjaEluZm9bal0gPSBDaGFyYWN0ZXIuRElSRUNUSU9OQUxJVFlfRVVST1BFQU5fTlVNQkVSOwotICAgICAgICAgICAgICAgIGlmIChwcmV2ID09IENoYXJhY3Rlci5ESVJFQ1RJT05BTElUWV9BUkFCSUNfTlVNQkVSICYmCi0gICAgICAgICAgICAgICAgICAgIG5leHQgPT0gQ2hhcmFjdGVyLk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kgewotICAgICAgICAgICAgYnl0ZSBkID0gY2hJbmZvW2pdOwotCi0gICAgICAgICAgICBpZiAoZCA9PSBDaGFyYWN0ZXIuRElSRUNUSU9OQUxJVFlfRVVST1BFQU5fTlVNQkVSKQotICAgICAgICAgICAgICAgIGFkamFjZW50ID0gdHJ1ZTsKLSAgICAgICAgICAgIGVsc2UgaWYgKGQgPT0gQ2hhcmFjdGVyLkRJUkVDVElPTkFMSVRZX0VVUk9QRUFOX05VTUJFUl9URVJNSU5BVE9SKSB7Ci0gICAgICAgICAgICAgICAgaWYgKGFkamFjZW50KQotICAgICAgICAgICAgICAgICAgICBjaEluZm9bal0gPSBDaGFyYWN0ZXIuRElSRUNUSU9OQUxJVFlfRVVST1BFQU5fTlVNQkVSOwotICAgICAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgICAgICAgICAgY2hJbmZvW2pdID0gQ2hhcmFjdGVyLkRJUkVDVElPTkFMSVRZX09USEVSX05FVVRSQUxTOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgZWxzZSB7Ci0gICAgICAgICAgICAgICAgYWRqYWNlbnQgPSBmYWxzZTsKLQotICAgICAgICAgICAgICAgIGlmIChkID09IENoYXJhY3Rlci5ESVJFQ1RJT05BTElUWV9FVVJPUEVBTl9OVU1CRVJfU0VQQVJBVE9SIHx8Ci0gICAgICAgICAgICAgICAgICAgIGQgPT0gQ2hhcmFjdGVyLkRJUkVDVElPTkFMSVRZX0NPTU1PTl9OVU1CRVJfU0VQQVJBVE9SIHx8Ci0gICAgICAgICAgICAgICAgICAgIGQgPT0gQ2hhcmFjdGVyLkRJUkVDVElPTkFMSVRZX1BBUkFHUkFQSF9TRVBBUkFUT1IgfHwKLSAgICAgICAgICAgICAgICAgICAgZCA9PSBDaGFyYWN0ZXIuRElSRUNUSU9OQUxJVFlfU0VHTUVOVF9TRVBBUkFUT1IpCi0gICAgICAgICAgICAgICAgICAgIGNoSW5mb1tqXSA9IENoYXJhY3Rlci5ESVJFQ1RJT05BTElUWV9PVEhFUl9ORVVUUkFMUzsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCi0gICAgICAgIC8vIGR1bXAoY2hkaXJzLCBuLCAiVzYiKTsKLQotICAgICAgICAvLyBXNyBzdHJvbmcgZGlyZWN0aW9uIG9mIGV1cm9wZWFuIG51bWJlcnMKLSAgICAgICAgY3VyID0gU09SOwotICAgICAgICBmb3IgKGludCBqID0gMDsgaiA8IG47IGorKykgewotICAgICAgICAgICAgYnl0ZSBkID0gY2hJbmZvW2pdOwotCi0gICAgICAgICAgICBpZiAoZCA9PSBTT1IgfHwKLSAgICAgICAgICAgICAgICBkID09IENoYXJhY3Rlci5ESVJFQ1RJT05BTElUWV9MRUZUX1RPX1JJR0hUIHx8Ci0gICAgICAgICAgICAgICAgZCA9PSBDaGFyYWN0ZXIuRElSRUNUSU9OQUxJVFlfUklHSFRfVE9fTEVGVCkKLSAgICAgICAgICAgICAgICBjdXIgPSBkOwotCi0gICAgICAgICAgICBpZiAoZCA9PSBDaGFyYWN0ZXIuRElSRUNUSU9OQUxJVFlfRVVST1BFQU5fTlVNQkVSKQotICAgICAgICAgICAgICAgIGNoSW5mb1tqXSA9IGN1cjsKLSAgICAgICAgfQotCi0gICAgICAgIC8vIGR1bXAoY2hkaXJzLCBuLCAiVzciKTsKLQotICAgICAgICAvLyBOMSwgTjIgbmV1dHJhbHMKLSAgICAgICAgY3VyID0gU09SOwotICAgICAgICBmb3IgKGludCBqID0gMDsgaiA8IG47IGorKykgewotICAgICAgICAgICAgYnl0ZSBkID0gY2hJbmZvW2pdOwotCi0gICAgICAgICAgICBpZiAoZCA9PSBDaGFyYWN0ZXIuRElSRUNUSU9OQUxJVFlfTEVGVF9UT19SSUdIVCB8fAotICAgICAgICAgICAgICAgIGQgPT0gQ2hhcmFjdGVyLkRJUkVDVElPTkFMSVRZX1JJR0hUX1RPX0xFRlQpIHsKLSAgICAgICAgICAgICAgICBjdXIgPSBkOwotICAgICAgICAgICAgfSBlbHNlIGlmIChkID09IENoYXJhY3Rlci5ESVJFQ1RJT05BTElUWV9FVVJPUEVBTl9OVU1CRVIgfHwKLSAgICAgICAgICAgICAgICAgICAgICAgZCA9PSBDaGFyYWN0ZXIuRElSRUNUSU9OQUxJVFlfQVJBQklDX05VTUJFUikgewotICAgICAgICAgICAgICAgIGN1ciA9IENoYXJhY3Rlci5ESVJFQ1RJT05BTElUWV9SSUdIVF9UT19MRUZUOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBieXRlIGRkID0gU09SOwotICAgICAgICAgICAgICAgIGludCBrOwotCi0gICAgICAgICAgICAgICAgZm9yIChrID0gaiArIDE7IGsgPCBuOyBrKyspIHsKLSAgICAgICAgICAgICAgICAgICAgZGQgPSBjaEluZm9ba107Ci0KLSAgICAgICAgICAgICAgICAgICAgaWYgKGRkID09IENoYXJhY3Rlci5ESVJFQ1RJT05BTElUWV9MRUZUX1RPX1JJR0hUIHx8Ci0gICAgICAgICAgICAgICAgICAgICAgICBkZCA9PSBDaGFyYWN0ZXIuRElSRUNUSU9OQUxJVFlfUklHSFRfVE9fTEVGVCkgewotICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgaWYgKGRkID09IENoYXJhY3Rlci5ESVJFQ1RJT05BTElUWV9FVVJPUEVBTl9OVU1CRVIgfHwKLSAgICAgICAgICAgICAgICAgICAgICAgIGRkID09IENoYXJhY3Rlci5ESVJFQ1RJT05BTElUWV9BUkFCSUNfTlVNQkVSKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBkZCA9IENoYXJhY3Rlci5ESVJFQ1RJT05BTElUWV9SSUdIVF9UT19MRUZUOwotICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICBmb3IgKGludCB5ID0gajsgeSA8IGs7IHkrKykgewotICAgICAgICAgICAgICAgICAgICBpZiAoZGQgPT0gY3VyKQotICAgICAgICAgICAgICAgICAgICAgICAgY2hJbmZvW3ldID0gY3VyOwotICAgICAgICAgICAgICAgICAgICBlbHNlCi0gICAgICAgICAgICAgICAgICAgICAgICBjaEluZm9beV0gPSBTT1I7Ci0gICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgaiA9IGsgLSAxOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgLy8gZHVtcChjaGRpcnMsIG4sICJmaW5hbCIpOwotCi0gICAgICAgIC8vIGV4dHJhOiBlbmZvcmNlIHRoYXQgYWxsIHRhYnMgYW5kIHN1cnJvZ2F0ZSBjaGFyYWN0ZXJzIGdvIHRoZQotICAgICAgICAvLyBwcmltYXJ5IGRpcmVjdGlvbgotICAgICAgICAvLyBUT0RPOiBhY3R1YWxseSBkbyBkaXJlY3Rpb25zIHJpZ2h0IGZvciBzdXJyb2dhdGVzCi0KLSAgICAgICAgZm9yIChpbnQgaiA9IDA7IGogPCBuOyBqKyspIHsKLSAgICAgICAgICAgIGNoYXIgYyA9IGNoc1tqXTsKLQotICAgICAgICAgICAgaWYgKGMgPT0gJ1x0JyB8fCAoYyA+PSAweEQ4MDAgJiYgYyA8PSAweERGRkYpKSB7Ci0gICAgICAgICAgICAgICAgY2hJbmZvW2pdID0gU09SOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgICAgIAotICAgICAgICByZXR1cm4gZGlyOwotICAgIH0KLQogICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGNoYXIgRklSU1RfQ0pLID0gJ1x1MkU4MCc7CiAgICAgLyoqCiAgICAgICogUmV0dXJucyB0cnVlIGlmIHRoZSBzcGVjaWZpZWQgY2hhcmFjdGVyIGlzIG9uZSBvZiB0aG9zZSBzcGVjaWZpZWQKQEAgLTk0NCwzNyArNjM0LDE1IEBACiAgICAgfQogKi8KIAotICAgIHByaXZhdGUgc3RhdGljIGludCBnZXRGaXQoVGV4dFBhaW50IHBhaW50LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVGV4dFBhaW50IHdvcmtQYWludCwKLSAgICAgICAgICAgICAgICAgICAgICAgQ2hhclNlcXVlbmNlIHRleHQsIGludCBzdGFydCwgaW50IGVuZCwKLSAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgd2lkKSB7Ci0gICAgICAgIGludCBoaWdoID0gZW5kICsgMSwgbG93ID0gc3RhcnQgLSAxLCBndWVzczsKLQotICAgICAgICB3aGlsZSAoaGlnaCAtIGxvdyA+IDEpIHsKLSAgICAgICAgICAgIGd1ZXNzID0gKGhpZ2ggKyBsb3cpIC8gMjsKLQotICAgICAgICAgICAgaWYgKG1lYXN1cmVUZXh0KHBhaW50LCB3b3JrUGFpbnQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGV4dCwgc3RhcnQsIGd1ZXNzLCBudWxsLCB0cnVlLCBudWxsKSA+IHdpZCkKLSAgICAgICAgICAgICAgICBoaWdoID0gZ3Vlc3M7Ci0gICAgICAgICAgICBlbHNlCi0gICAgICAgICAgICAgICAgbG93ID0gZ3Vlc3M7Ci0gICAgICAgIH0KLQotICAgICAgICBpZiAobG93IDwgc3RhcnQpCi0gICAgICAgICAgICByZXR1cm4gc3RhcnQ7Ci0gICAgICAgIGVsc2UKLSAgICAgICAgICAgIHJldHVybiBsb3c7Ci0gICAgfQotCiAgICAgcHJpdmF0ZSBpbnQgb3V0KENoYXJTZXF1ZW5jZSB0ZXh0LCBpbnQgc3RhcnQsIGludCBlbmQsCiAgICAgICAgICAgICAgICAgICAgICAgaW50IGFib3ZlLCBpbnQgYmVsb3csIGludCB0b3AsIGludCBib3R0b20sIGludCB2LAogICAgICAgICAgICAgICAgICAgICAgIGZsb2F0IHNwYWNpbmdtdWx0LCBmbG9hdCBzcGFjaW5nYWRkLAogICAgICAgICAgICAgICAgICAgICAgIExpbmVIZWlnaHRTcGFuW10gY2hvb3NlaHQsIGludFtdIGNob29zZWh0diwKLSAgICAgICAgICAgICAgICAgICAgICBQYWludC5Gb250TWV0cmljc0ludCBmbSwgYm9vbGVhbiB0YWIsCisgICAgICAgICAgICAgICAgICAgICAgUGFpbnQuRm9udE1ldHJpY3NJbnQgZm0sIGJvb2xlYW4gaGFzVGFiT3JFbW9qaSwKICAgICAgICAgICAgICAgICAgICAgICBib29sZWFuIG5lZWRNdWx0aXBseSwgaW50IHBzdGFydCwgYnl0ZVtdIGNoZGlycywKICAgICAgICAgICAgICAgICAgICAgICBpbnQgZGlyLCBib29sZWFuIGVhc3ksIGJvb2xlYW4gbGFzdCwKICAgICAgICAgICAgICAgICAgICAgICBib29sZWFuIGluY2x1ZGVwYWQsIGJvb2xlYW4gdHJhY2twYWQsCi0gICAgICAgICAgICAgICAgICAgICAgZmxvYXRbXSB3aWR0aHMsIGludCB3aWRzdGFydCwgaW50IHdpZG9mZiwKKyAgICAgICAgICAgICAgICAgICAgICBjaGFyW10gY2hzLCBmbG9hdFtdIHdpZHRocywgaW50IHdpZHN0YXJ0LAogICAgICAgICAgICAgICAgICAgICAgIFRleHRVdGlscy5UcnVuY2F0ZUF0IGVsbGlwc2l6ZSwgZmxvYXQgZWxsaXBzaXN3aWR0aCwKICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCB0ZXh0d2lkdGgsIFRleHRQYWludCBwYWludCkgewogICAgICAgICBpbnQgaiA9IG1MaW5lQ291bnQ7CkBAIC05ODIsOCArNjUwLDYgQEAKICAgICAgICAgaW50IHdhbnQgPSBvZmYgKyBtQ29sdW1ucyArIFRPUDsKICAgICAgICAgaW50W10gbGluZXMgPSBtTGluZXM7CiAKLSAgICAgICAgLy8gTG9nLmUoInRleHQiLCAibGluZSAiICsgc3RhcnQgKyAiIHRvICIgKyBlbmQgKyAobGFzdCA/ICI9PT0iIDogIiIpKTsKLQogICAgICAgICBpZiAod2FudCA+PSBsaW5lcy5sZW5ndGgpIHsKICAgICAgICAgICAgIGludCBubGVuID0gQXJyYXlVdGlscy5pZGVhbEludEFycmF5U2l6ZSh3YW50ICsgMSk7CiAgICAgICAgICAgICBpbnRbXSBncm93ID0gbmV3IGludFtubGVuXTsKQEAgLTEwNTksNTkgKzcyNSwyMyBAQAogICAgICAgICBsaW5lc1tvZmYgKyBtQ29sdW1ucyArIFNUQVJUXSA9IGVuZDsKICAgICAgICAgbGluZXNbb2ZmICsgbUNvbHVtbnMgKyBUT1BdID0gdjsKIAotICAgICAgICBpZiAodGFiKQorICAgICAgICBpZiAoaGFzVGFiT3JFbW9qaSkKICAgICAgICAgICAgIGxpbmVzW29mZiArIFRBQl0gfD0gVEFCX01BU0s7CiAKLSAgICAgICAgewotICAgICAgICAgICAgbGluZXNbb2ZmICsgRElSXSB8PSBkaXIgPDwgRElSX1NISUZUOwotCi0gICAgICAgICAgICBpbnQgY3VyID0gQ2hhcmFjdGVyLkRJUkVDVElPTkFMSVRZX0xFRlRfVE9fUklHSFQ7Ci0gICAgICAgICAgICBpbnQgY291bnQgPSAwOwotCi0gICAgICAgICAgICBpZiAoIWVhc3kpIHsKLSAgICAgICAgICAgICAgICBmb3IgKGludCBrID0gc3RhcnQ7IGsgPCBlbmQ7IGsrKykgewotICAgICAgICAgICAgICAgICAgICBpZiAoY2hkaXJzW2sgLSBwc3RhcnRdICE9IGN1cikgewotICAgICAgICAgICAgICAgICAgICAgICAgY291bnQrKzsKLSAgICAgICAgICAgICAgICAgICAgICAgIGN1ciA9IGNoZGlyc1trIC0gcHN0YXJ0XTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgRGlyZWN0aW9ucyBsaW5lZGlyczsKLQotICAgICAgICAgICAgaWYgKGNvdW50ID09IDApIHsKLSAgICAgICAgICAgICAgICBsaW5lZGlycyA9IERJUlNfQUxMX0xFRlRfVE9fUklHSFQ7Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIHNob3J0W10gbGQgPSBuZXcgc2hvcnRbY291bnQgKyAxXTsKLQotICAgICAgICAgICAgICAgIGN1ciA9IENoYXJhY3Rlci5ESVJFQ1RJT05BTElUWV9MRUZUX1RPX1JJR0hUOwotICAgICAgICAgICAgICAgIGNvdW50ID0gMDsKLSAgICAgICAgICAgICAgICBpbnQgaGVyZSA9IHN0YXJ0OwotCi0gICAgICAgICAgICAgICAgZm9yIChpbnQgayA9IHN0YXJ0OyBrIDwgZW5kOyBrKyspIHsKLSAgICAgICAgICAgICAgICAgICAgaWYgKGNoZGlyc1trIC0gcHN0YXJ0XSAhPSBjdXIpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIC8vIFhYWCBjaGVjayB0byBtYWtlIHN1cmUgd2UgZG9uJ3QKLSAgICAgICAgICAgICAgICAgICAgICAgIC8vICAgICBvdmVyZmxvdyBzaG9ydAotICAgICAgICAgICAgICAgICAgICAgICAgbGRbY291bnQrK10gPSAoc2hvcnQpIChrIC0gaGVyZSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBjdXIgPSBjaGRpcnNbayAtIHBzdGFydF07Ci0gICAgICAgICAgICAgICAgICAgICAgICBoZXJlID0gazsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgIGxkW2NvdW50XSA9IChzaG9ydCkgKGVuZCAtIGhlcmUpOwotCi0gICAgICAgICAgICAgICAgaWYgKGNvdW50ID09IDEgJiYgbGRbMF0gPT0gMCkgewotICAgICAgICAgICAgICAgICAgICBsaW5lZGlycyA9IERJUlNfQUxMX1JJR0hUX1RPX0xFRlQ7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgbGluZWRpcnMgPSBuZXcgRGlyZWN0aW9ucyhsZCk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotCisgICAgICAgIGxpbmVzW29mZiArIERJUl0gfD0gZGlyIDw8IERJUl9TS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AgICAgICAgICAgICAgICAgICAgICAgICAgIGVsbGlwc2lzd2lkdGgsIGVsbGlwc2l6ZSwgaiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ZXh0d2lkdGgsIHBhaW50KTsKICAgICAgICAgICAgIH0KQEAgLTExMjIsNyArNzUyLDcgQEAKICAgICB9CiAKICAgICBwcml2YXRlIHZvaWQgY2FsY3VsYXRlRWxsaXBzaXMoaW50IGxpbmVzdGFydCwgaW50IGxpbmVlbmQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsb2F0W10gd2lkdGhzLCBpbnQgd2lkc3RhcnQsIGludCB3aWRvZmYsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsb2F0W10gd2lkdGhzLCBpbnQgd2lkc3RhcnQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsb2F0IGF2YWlsLCBUZXh0VXRpbHMuVHJ1bmNhdGVBdCB3aGVyZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGxpbmUsIGZsb2F0IHRleHR3aWR0aCwgVGV4dFBhaW50IHBhaW50KSB7CiAgICAgICAgIGludCBsZW4gPSBsaW5lZW5kIC0gbGluZXN0YXJ0OwpAQCAtMTE0Miw3ICs3NzIsNyBAQAogICAgICAgICAgICAgaW50IGk7CiAKICAgICAgICAgICAgIGZvciAoaSA9IGxlbjsgaSA+PSAwOyBpLS0pIHsKLSAgICAgICAgICAgICAgICBmbG9hdCB3ID0gd2lkdGhzW2kgLSAxICsgbGluZXN0YXJ0IC0gd2lkc3RhcnQgKyB3aWRvZmZdOworICAgICAgICAgICAgICAgIGZsb2F0IHcgPSB3aWR0aHNbaSAtIDEgKyBsaW5lc3RhcnQgLSB3aWRzdGFydF07CiAKICAgICAgICAgICAgICAgICBpZiAodyArIHN1bSArIGVsbGlwc2lzd2lkID4gYXZhaWwpIHsKICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CkBAIC0xMTU4LDcgKzc4OCw3IEBACiAgICAgICAgICAgICBpbnQgaTsKIAogICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IGxlbjsgaSsrKSB7Ci0gICAgICAgICAgICAgICAgZmxvYXQgdyA9IHdpZHRoc1tpICsgbGluZXN0YXJ0IC0gd2lkc3RhcnQgKyB3aWRvZmZdOworICAgICAgICAgICAgICAgIGZsb2F0IHcgPSB3aWR0aHNbaSArIGxpbmVzdGFydCAtIHdpZHN0YXJ0XTsKIAogICAgICAgICAgICAgICAgIGlmICh3ICsgc3VtICsgZWxsaXBzaXN3aWQgPiBhdmFpbCkgewogICAgICAgICAgICAgICAgICAgICBicmVhazsKQEAgLTExNzUsNyArODA1LDcgQEAKIAogICAgICAgICAgICAgZmxvYXQgcmF2YWlsID0gKGF2YWlsIC0gZWxsaXBzaXN3aWQpIC8gMjsKICAgICAgICAgICAgIGZvciAocmlnaHQgPSBsZW47IHJpZ2h0ID49IDA7IHJpZ2h0LS0pIHsKLSAgICAgICAgICAgICAgICBmbG9hdCB3ID0gd2lkdGhzW3JpZ2h0IC0gMSArIGxpbmVzdGFydCAtIHdpZHN0YXJ0ICsgd2lkb2ZmXTsKKyAgICAgICAgICAgICAgICBmbG9hdCB3ID0gd2lkdGhzW3JpZ2h0IC0gMSArIGxpbmVzdGFydCAtIHdpZHN0YXJ0XTsKIAogICAgICAgICAgICAgICAgIGlmICh3ICsgcnN1bSA+IHJhdmFpbCkgewogICAgICAgICAgICAgICAgICAgICBicmVhazsKQEAgLTExODYsNyArODE2LDcgQEAKIAogICAgICAgICAgICAgZmxvYXQgbGF2YWlsID0gYXZhaWwgLSBlbGxpcHNpc3dpZCAtIHJzdW07CiAgICAgICAgICAgICBmb3IgKGxlZnQgPSAwOyBsZWZ0IDwgcmlnaHQ7IGxlZnQrKykgewotICAgICAgICAgICAgICAgIGZsb2F0IHcgPSB3aWR0aHNbbGVmdCArIGxpbmVzdGFydCAtIHdpZHN0YXJ0ICsgd2l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IHdpbGwgYmUgdG8gdGhlIHJpZ2h0IG9mIHRoZSB0ZXh0IHRvIGJlIGRyYXduLiBQYWludAotICAgICAqIHNob3VsZCBub3QgaGF2ZSBhbiBBbGlnbiB2YWx1ZSBvdGhlciB0aGFuIExFRlQgb3IgcG9zaXRpb25pbmcgd2lsbCBnZXQKLSAgICAgKiBjb25mdXNlZC4KLSAgICAgKgotICAgICAqIDxwPk9uIHJldHVybiwgd29ya1BhaW50IHdpbGwgcmVmbGVjdCB0aGUgb3JpZ2luYWwgcGFpbnQgcGx1cyBhbnkKLSAgICAgKiBtb2RpZmljYXRpb25zIG1hZGUgYnkgY2hhcmFjdGVyIHN0eWxlcyBvbiB0aGUgcnVuLgotICAgICAqCi0gICAgICogPHA+VGhlIHJldHVybmVkIHdpZHRoIGlzIHNpZ25lZCBhbmQgd2lsbCBiZSA8IDAgaWYgdGhlIHBhcmFncmFwaAotICAgICAqIGRpcmVjdGlvbiBpcyByaWdodC10by1sZWZ0LgotICAgICAqLwotICAgIHByaXZhdGUgc3RhdGljIGZsb2F0IGRyYXdVbmlmb3JtUnVuKENhbnZhcyBjYW52YXMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTcGFubmVkIHRleHQsIGludCBzdGFydCwgaW50IGVuZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBkaXIsIGJvb2xlYW4gcnVuSXNSdGwsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCB4LCBpbnQgdG9wLCBpbnQgeSwgaW50IGJvdHRvbSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBhaW50LkZvbnRNZXRyaWNzSW50IGZtaSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRleHRQYWludCBwYWludCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRleHRQYWludCB3b3JrUGFpbnQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sZWFuIG5lZWRXaWR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0gbnVsbCkgewotICAgICAgICAgICAgQ2hhclNlcXVlbmNlIHRtcDsKLSAgICAgICAgICAgIGludCB0bXBzdGFydCwgdG1wZW5kOwotCi0gICAgICAgICAgICBpZiAocnVuSXNSdGwpIHsKLSAgICAgICAgICAgICAgICB0bXAgPSBUZXh0VXRpbHMuZ2V0UmV2ZXJzZSh0ZXh0LCBzdGFydCwgZW5kKTsKLSAgICAgICAgICAgICAgICB0bXBzdGFydCA9IDA7Ci0gICAgICAgICAgICAgICAgLy8gWFhYOiBhc3N1bWVzIGdldFJldmVyc2UgZG9lc24ndCBjaGFuZ2UgdGhlIGxlbmd0aCBvZiB0aGUgdGV4dAotICAgICAgICAgICAgICAgIHRtcGVuZCA9IGVuZCAtIHN0YXJ0OwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICB0bXAgPSB0ZXh0OwotICAgICAgICAgICAgICAgIHRtcHN0YXJ0ID0gc3RhcnQ7Ci0gICAgICAgICAgICAgICAgdG1wZW5kID0gZW5kOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBpZiAoZm1pICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICB3b3JrUGFpbnQuZ2V0Rm9udE1ldHJpY3NJbnQoZm1pKTsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgaWYgKGNhbnZhcyAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgaWYgKHdvcmtQYWludC5iZ0NvbG9yICE9IDApIHsKLSAgICAgICAgICAgICAgICAgICAgaW50IGMgPSB3b3JrUGFpbnQuZ2V0Q29sb3IoKTsKLSAgICAgICAgICAgICAgICAgICAgUGFpbnQuU3R5bGUgcyA9IHdvcmtQYWludC5nZXRTdHlsZSgpOwotICAgICAgICAgICAgICAgICAgICB3b3JrUGFpbnQuc2V0Q29sb3Iod29ya1BhaW50LmJnQ29sb3IpOwotICAgICAgICAgICAgICAgICAgICB3b3JrUGFpbnQuc2V0U3R5bGUoUGFpbnQuU3R5bGUuRklMTCk7Ci0KLSAgICAgICAgICAgICAgICAgICAgaWYgKCFoYXZlV2lkdGgpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHJldCA9IHdvcmtQYWludC5tZWFzdXJlVGV4dCh0bXAsIHRtcHN0YXJ0LCB0bXBlbmQpOwotICAgICAgICAgICAgICAgICAgICAgICAgaGF2ZVdpZHRoID0gdHJ1ZTsKLSAgICAgICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgICAgIGlmIChkaXIgPT0gTGF5b3V0LkRJUl9SSUdIVF9UT19MRUZUKQotICAgICAgICAgICAgICAgICAgICAgICAgY2FudmFzLmRyYXdSZWN0KHggLSByZXQsIHRvcCwgeCwgYm90dG9tLCB3b3JrUGFpbnQpOwotICAgICAgICAgICAgICAgICAgICBlbHNlCi0gICAgICAgICAgICAgICAgICAgICAgICBjYW52YXMuZHJhd1JlY3QoeCwgdG9wLCB4ICsgcmV0LCBib3R0b20sIHdvcmtQYWludCk7Ci0KLSAgICAgICAgICAgICAgICAgICAgd29ya1BhaW50LnNldFN0eWxlKHMpOwotICAgICAgICAgICAgICAgICAgICB3b3JrUGFpbnQuc2V0Q29sb3IoYyk7Ci0gICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgaWYgKGRpciA9PSBMYXlvdXQuRElSX1JJR0hUX1RPX0xFRlQpIHsKLSAgICAgICAgICAgICAgICAgICAgaWYgKCFoYXZlV2lkdGgpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHJldCA9IHdvcmtQYWludC5tZWFzdXJlVGV4dCh0bXAsIHRtcHN0YXJ0LCB0bXBlbmQpOwotICAgICAgICAgICAgICAgICAgICAgICAgaGF2ZVdpZHRoID0gdHJ1ZTsKLSAgICAgICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgICAgIGNhbnZhcy5kcmF3VGV4dCh0bXAsIHRtcHN0YXJ0LCB0bXBlbmQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB4IC0gcmV0LCB5ICsgd29ya1BhaW50LmJhc2VsaW5lU2hpZnQsIHdvcmtQYWludCk7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgaWYgKG5lZWRXaWR0aCkgewotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFoYXZlV2lkdGgpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXQgPSB3b3JrUGFpbnQubWVhc3VyZVRleHQodG1wLCB0bXBzdGFydCwgdG1wZW5kKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYXZlV2lkdGggPSB0cnVlOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICAgICAgY2FudmFzLmRyYXdUZXh0KHRtcCwgdG1wc3RhcnQsIHRtcGVuZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHgsIHkgKyB3b3JrUGFpbnQuYmFzZWxpbmVTaGlmdCwgd29ya1BhaW50KTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIGlmIChuZWVkV2lkdGggJiYgIWhhdmVXaWR0aCkgewotICAgICAgICAgICAgICAgICAgICByZXQgPSB3b3JrUGFpbnQubWVhc3VyZVRleHQodG1wLCB0bXBzdGFydCwgdG1wZW5kKTsKLSAgICAgICAgICAgICAgICAgICAgaGF2ZVdpZHRoID0gdHJ1ZTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICByZXQgPSByZXBsYWNlbWVudC5nZXRTaXplKHdvcmtQYWludCwgdGV4dCwgc3RhcnQsIGVuZCwgZm1pKTsKLQotICAgICAgICAgICAgaWYgKGNhbnZhcyAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgaWYgKGRpciA9PSBMYXlvdXQuRElSX1JJR0hUX1RPX0xFRlQpCi0gICAgICAgICAgICAgICAgICAgIHJlcGxhY2VtZW50LmRyYXcoY2FudmFzLCB0ZXh0LCBzdGFydCwgZW5kLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHggLSByZXQsIHRvcCwgeSwgYm90dG9tLCB3b3JrUGFpbnQpOwotICAgICAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgICAgICAgICAgcmVwbGFjZW1lbnQuZHJhdyhjYW52YXMsIHRleHQsIHN0YXJ0LCBlbmQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeCwgdG9wLCB5LCBib3R0b20sIHdvcmtQYWludCk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQotICAgICAgICBpZiAoZGlyID09IExheW91dC5ESVJfUklHSFRfVE9fTEVGVCkKLSAgICAgICAgICAgIHJldHVybiAtcmV0OwotICAgICAgICBlbHNlCi0gICAgICAgICAgICByZXR1cm4gcmV0OwotICAgIH0KLQotICAgIC8qKgotICAgICAqIFJldHVybnMgdGhlIGFkdmFuY2Ugd2lkdGhzIGZvciBhIHVuaWZvcm0gbGVmdC10by1yaWdodCBydW4gb2YgdGV4dCB3aXRoCi0gICAgICogbm8gc3R5bGUgY2hhbmdlcyBpbiB0aGUgbWlkZGxlIG9mIHRoZSBydW4uIElmIGFueSBzdHlsZSBpcyByZXBsYWNlbWVudAotICAgICAqIHRleHQsIHRoZSBmaXJzdCBjaGFyYWN0ZXIgd2lsbCBnZXQgdGhlIHdpZHRoIG9mIHRoZSByZXBsYWNlbWVudCBhbmQgdGhlCi0gICAgICogcmVtYWluaW5nIGNoYXJhY3RlcnMgd2lsbCBnZXQgYSB3aWR0aCBvZiAwLgotICAgICAqIAotICAgICAqIEBwYXJhbSBwYWludCB0aGUgcGFpbnQsIHdpbGwgbm90IGJlIG1vZGlmaWVkCi0gICAgICogQHBhcmFtIHdvcmtQYWludCBhIHBhaW50IHRvIG1vZGlmeTsgb24gcmV0dXJuIHdpbGwgcmVmbGVjdCB0aGUgb3JpZ2luYWwKLSAgICAgKiAgICAgICAgcGFpbnQgcGx1cyB0aGUgZWZmZWN0IG9mIGFsbCBzcGFucyBvbiB0aGUgcnVuCi0gICAgICogQHBhcmFtIHRleHQgdGhlIHRleHQKLSAgICAgKiBAcGFyYW0gc3RhcnQgdGhlIHN0YXJ0IG9mIHRoZSBydW4KLSAgICAgKiBAcGFyYW0gZW5kIHRoZSBsaW1pdCBvZiB0aGUgcnVuCi0gICAgICogQHBhcmFtIHdpZHRocyBhcnJheSB0byByZWNlaXZlIHRoZSBhZHZhbmNlIHdpZHRocyBvZiB0aGUgY2hhcmFjdGVycy4gTXVzdAotICAgICAqICAgICAgICBiZSBhdCBsZWFzdCBhIGxhcmdlIGFzIChlbmQgLSBzdGFydCkuCi0gICAgICogQHBhcmFtIGZtaSBGb250TWV0cmljcyBpbmZvcm1hdGlvbjsgY2FuIGJlIG51bGwKLSAgICAgKiBAcmV0dXJuIHRoZSBhY3R1YWwgbnVtYmVyIG9mIHdpZHRocyByZXR1cm5lZAotICAgICAqLwotICAgIHB1YmxpYyBzdGF0aWMgaW50IGdldFRleHRXaWR0aHMoVGV4dFBhaW50IHBhaW50LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVGV4dFBhaW50IHdvcmtQYWludCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNwYW5uZWQgdGV4dCwgaW50IHN0YXJ0LCBpbnQgZW5kLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXRbXSB3aWR0aHMsIFBhaW50LkZvbnRNZXRyaWNzSW50IGZtaSkgewotICAgICAgICBNZXRyaWNBZmZlY3RpbmdTcGFuW10gc3BhbnMgPQotICAgICAgICAgICAgdGV4dC5nZXRTcGFucyhzdGFydCwgZW5kLCBNZXRyaWNBZmZlY3RpbmdTcGFuLmNsYXNzKTsKLQotCQlSZXB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AgICAgICAgICAgaW50IGRpciwgYm9vbGVhbiBydW5Jc1J0bCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsb2F0IHgsIGludCB0b3AsIGludCB5LCBpbnQgYm90dG9tLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUGFpbnQuRm9udE1ldHJpY3NJbnQgZm1pLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVGV4dFBhaW50IHBhaW50LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVGV4dFBhaW50IHdvcmtQYWludCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2xlYW4gbmVlZFdpZHRoKSB7Ci0KLSAgICAgICAgLy8gWFhYOiBJdCBsb29rcyBsaWtlIGFsbCBjYWxscyB0byB0aGlzIEFQSSBtYXRjaCBkaXIgYW5kIHJ1bklzUnRsLCBzbwotICAgICAgICAvLyBoYXZpbmcgYm90aCBwYXJhbWV0ZXJzIGlzIHJlZHVuZGFudCBhbmQgY29uZnVzaW5nLgotCi0gICAgICAgIC8vIGZhc3QgcGF0aCBmb3IgdW5zdHlsZWQgdGV4dAotICAgICAgICBpZiAoISh0ZXh0IGluc3RhbmNlb2YgU3Bhbm5lZCkpIHsKLSAgICAgICAgICAgIGZsb2F0IHJldCA9IDA7Ci0KLSAgICAgICAgICAgIGlmIChydW5Jc1J0bCkgewotICAgICAgICAgICAgICAgIENoYXJTZXF1ZW5jZSB0bXAgPSBUZXh0VXRpbHMuZ2V0UmV2ZXJzZSh0ZXh0LCBzdGFydCwgZW5kKTsKLSAgICAgICAgICAgICAgICAvLyBYWFg6IHRoaXMgYXNzdW1lcyBnZXRSZXZlcnNlIGRvZXNuJ3QgdHdlYWsgdGhlIGxlbmd0aCBvZgotICAgICAgICAgICAgICAgIC8vIHRoZSB0ZXh0Ci0gICAgICAgICAgICAgICAgaW50IHRtcGVuZCA9IGVuZCAtIHN0YXJ0OwotCi0gICAgICAgICAgICAgICAgaWYgKGNhbnZhcyAhPSBudWxsIHx8IG5lZWRXaWR0aCkKLSAgICAgICAgICAgICAgICAgICAgcmV0ID0gcGFpbnQubWVhc3VyZVRleHQodG1wLCAwLCB0bXBlbmQpOwotCi0gICAgICAgICAgICAgICAgaWYgKGNhbnZhcyAhPSBudWxsKQotICAgICAgICAgICAgICAgICAgICBjYW52YXMuZHJhd1RleHQodG1wLCAwLCB0bXBlbmQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB4IC0gcmV0LCB5LCBwYWludCk7Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIGlmIChuZWVkV2lkdGgpCi0gICAgICAgICAgICAgICAgICAgIHJldCA9IHBhaW50Lm1lYXN1cmVUZXh0KHRleHQsIHN0YXJ0LCBlbmQpOwotCi0gICAgICAgICAgICAgICAgaWYgKGNhbnZhcyAhPSBudWxsKQotICAgICAgICAgICAgICAgICAgICBjYW52YXMuZHJhd1RleHQodGV4dCwgc3RhcnQsIGVuZCwgeCwgeSwgcGFpbnQpOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBpZiAoZm1pICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICBwYWludC5nZXRGb250TWV0cmljc0ludChmbWkpOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICByZXR1cm4gcmV0ICogZGlyOyAgIC8vIExheW91dC5ESVJfUklHSFRfVE9fTEVGVCA9PSAtMQotICAgICAgICB9Ci0gICAgICAgIAotICAgICAgICBmbG9hdCBveCA9IHg7Ci0gICAgICAgIGludCBtaW5Bc2NlbnQgPSAwLCBtYXhEZXNjZW50ID0gMCwgbWluVG9wID0gMCwgbWF4Qm90dG9tID0gMDsKLQotICAgICAgICBTcGFubmVkIHNwID0gKFNwYW5uZWQpIHRleHQ7Ci0gICAgICAgIENsYXNzPD8+IGRpdmlzaW9uOwotCi0gICAgICAgIGlmIChjYW52YXMgPT0gbnVsbCkKLSAgICAgICAgICAgIGRpdmlzaW9uID0gTWV0cmljQWZmZWN0aW5nU3Bhbi5jbGFzczsKLSAgICAgICAgZWxzZQotICAgICAgICAgICAgZGl2aXNpb24gPSBDaGFyYWN0ZXJTdHlsZS5jbGFzczsKLQotICAgICAgICBpbnQgbmV4dDsKLSAgICAgICAgZm9yIChpbnQgaSA9IHN0YXJ0OyBpIDwgZW5kOyBpID0gbmV4dCkgewotICAgICAgICAgICAgbmV4dCA9IHNwLm5leHRTcGFuVHJhbnNpdGlvbihpLCBlbmQsIGRpdmlzaW9uKTsKLQotICAgICAgICAgICAgLy8gWFhYOiBpZiBkaXIgYW5kIHJ1bklzUnRsIHdlcmUgbm90IHRoZSBzYW1lLCB0aGlzIHdvdWxkIGRyYXcKLSAgICAgICAgICAgIC8vIHNwYW5zIGluIHRoZSB3cm9uZyBvcmRlciwgYnV0IG5vIG9uZSBhcHBlYXJzIHRvIGNhbGwgaXQgdGhpcwotICAgICAgICAgICAgLy8gd2F5LgotICAgICAgICAgICAgeCArPSBkcmF3VW5pZm9ybVJ1bihjYW52YXMsIHNwLCBpLCBuZXh0LCBkaXIsIHJ1bklzUnRsLAotICAgICAgICAgICAgICAgICAgeCwgdG9wLCB5LCBib3R0b20sIGZtaSwgcGFpbnQsIHdvcmtQYWludCwKLSAgICAgICAgICAgICAgICAgIG5lZWRXaWR0aCB8fCBuZXh0ICE9IGVuZCk7Ci0KLSAgICAgICAgICAgIGlmIChmbWkgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgIGlmIChmbWkuYXNjZW50IDwgbWluQXNjZW50KQotICAgICAgICAgICAgICAgICAgICBtaW5Bc2NlbnQgPSBmbWkuYXNjZW50OwotICAgICAgICAgICAgICAgIGlmIChmbWkuZGVzY2VudCA+IG1heERlc2NlbnQpCi0gICAgICAgICAgICAgICAgICAgIG1heERlc2NlbnQgPSBmbWkuZGVzY2VudDsKLQotICAgICAgICAgICAgICAgIGlmIChmbWkudG9wIDwgbWluVG9wKQotICAgICAgICAgICAgICAgICAgICBtaW5Ub3AgPSBmbWkudG9wOwotICAgICAgICAgICAgICAgIGlmIChmbWkuYm90dG9tID4gbWF4Qm90dG9tKQotICAgICAgICAgICAgICAgICAgICBtYXhCb3R0b20gPSBmbWkuYm90dG9tOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgaWYgKGZtaSAhPSBudWxsKSB7Ci0gICAgICAgICAgICBpZiAoc3RhcnQgPT0gZW5kKSB7Ci0gICAgICAgICAgICAgICAgcGFpbnQuZ2V0Rm9udE1ldHJpY3NJbnQoZm1pKTsKLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgZm1pLmFzY2VudCA9IG1pbkFzY2VudDsKLSAgICAgICAgICAgICAgICBmbWkuZGVzY2VudCA9IG1heERlc2NlbnQ7Ci0gICAgICAgICAgICAgICAgZm1pLnRvcCA9IG1pblRvcDsKLSAgICAgICAgICAgICAgICBmbWkuYm90dG9tID0gbWF4Qm90dG9tOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgcmV0dXJuIHggLSBveDsKLSAgICB9Ci0KLSAgICAvKioKLSAgICAgKiBEcmF3cyBhIHVuaWRpcmVjdGlvbmFsIHJ1biBvZiB0ZXh0IG9uIGEgc2luZ2xlIGxpbmUsIGFuZCBvcHRpb25hbGx5Ci0gICAgICogcmV0dXJucyB0aGUgc2lnbmVkIGFkdmFuY2UuICBVbmxpa2UgZHJhd0RpcmVjdGlvbmFsUnVuLCB0aGUgcGFyYWdyYXBoCi0gICAgICogZGlyZWN0aW9uIGFuZCBydW4gZGlyZWN0aW9uIGNhbiBiZSBkaWZmZXJlbnQuCi0gICAgICovCi0gICAgLyogcGFja2FnZSAqLyBzdGF0aWMgZmxvYXQgZHJhd1RleHQoQ2FudmFzIGNhbnZhcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENoYXJTZXF1ZW5jZSB0ZXh0LCBpbnQgc3RhcnQsIGludCBlbmQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgZGlyLCBib29sZWFuIHJ1bklzUnRsLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgeCwgaW50IHRvcCwgaW50IHksIGludCBib3R0b20sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUZXh0UGFpbnQgcGFpbnQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUZXh0UGFpbnQgd29ya1BhaW50LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbGVhbiBuZWVkV2lkdGgpIHsKLSAgICAgICAgLy8gWFhYIHRoaXMgbG9naWMgaXMgKGRpciA9PSBESVJfTEVGVF9UT19SSUdIVCkgPT0gcnVuSXNSdGwKLSAgICAgICAgaWYgKChkaXIgPT0gTGF5b3V0LkRJUl9SSUdIVF9UT19MRUZUICYmICFydW5Jc1J0bCkgfHwKLSAgICAgICAgICAgIChydW5Jc1J0bCAmJiBkaXIgPT0gTGF5b3V0LkRJUl9MRUZUX1RPX1JJR0hUKSkgewotICAgICAgICAgICAgLy8gVE9ETzogdGhpcyBuZWVkcyB0aGUgcmVhbCBkaXJlY3Rpb24KLSAgICAgICAgICAgIGZsb2F0IGNoID0gZHJhd0RpcmVjdGlvbmFsUnVuKG51bGwsIHRleHQsIHN0YXJ0LCBlbmQsCi0gICAgICAgICAgICAgICAgICAgIExheW91dC5ESVJfTEVGVF9UT19SSUdIVCwgZmFsc2UsIDAsIDAsIDAsIDAsIG51bGwsIHBhaW50LAotICAgICAgICAgICAgICAgICAgICB3b3JrUGFpbnQsIHRydWUpOwotCi0gICAgICAgICAgICBjaCAqPSBkaXI7ICAvLyBESVJfUklHSFRfVE9fTEVGVCA9PSAtMQotICAgICAgICAgICAgZHJhd0RpcmVjdGlvbmFsUnVuKGNhbnZhcywgdGV4dCwgc3RhcnQsIGVuZCwgLWRpciw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SBtYWluIHtAbGluayBUZXh0UGFpbnR9IG9iamVjdC4KLSAgICAgKiBAcGFyYW0gd29ya1BhaW50IFRoZSB7QGxpbmsgVGV4dFBhaW50fSBvYmplY3QgdXNlZCBmb3IgdGVtcG9yYWwKLSAgICAgKiAgICAgICAgd29ya3NwYWNlLgotICAgICAqIEBwYXJhbSBuZWVkV2lkdGggSWYgdHJ1ZSwgdGhpcyBtZXRob2QgcmV0dXJucyB0aGUgd2lkdGggb2YgZHJhd24gdGV4dAotICAgICAqIEByZXR1cm4gV2lkdGggb2YgdGhlIGRyYXduIHRleHQgaWYgbmVlZFdpZHRoIGlzIHRydWUKLSAgICAgKi8KLSAgICBwdWJsaWMgc3RhdGljIGZsb2F0IGRyYXdUZXh0KENhbnZhcyBjYW52YXMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDaGFyU2VxdWVuY2UgdGV4dCwgaW50IHN0YXJ0LCBpbnQgZW5kLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGRpcmVjdGlvbiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsb2F0IHgsIGludCB0b3AsIGludCB5LCBpbnQgYm90dG9tLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVGV4dFBhaW50IHBhaW50LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVGV4dFBhaW50IHdvcmtQYWludCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2xlYW4gbmVlZFdpZHRoKSB7Ci0gICAgICAgIC8vIEZvciBzYWZldHkuCi0gICAgICAgIGRpcmVjdGlvbiA9IGRpcmVjdGlvbiA+PSAwID8gTGF5b3V0LkRJUl9MRUZUX1RPX1JJR0hUCi0gICAgICAgICAgICAgICAgOiBMYXlvdXQuRElSX1JJR0hUX1RPX0xFRlQ7Ci0KLSAgICAgICAgLy8gSGlkZSBydW5Jc1J0bCBwYXJhbWV0ZXIgc2luY2UgaXQ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leHQgdGhlIHRleHQgdG8gbWVhc3VyZQotICAgICAqIEBwYXJhbSBzdGFydCB0aGUgaW5kZXggb2YgdGhlIGZpcnN0IGNoYXJhY3RlciB0byBzdGFydCBtZWFzdXJpbmcKLSAgICAgKiBAcGFyYW0gZW5kIDEgYmV5b25kIHRoZSBpbmRleCBvZiB0aGUgbGFzdCBjaGFyYWN0ZXIgdG8gbWVhc3VyZQotICAgICAqIEBwYXJhbSBmbWkgRm9udE1ldHJpY3MgaW5mb3JtYXRpb247IGNhbiBiZSBudWxsCi0gICAgICogQHJldHVybiBUaGUgd2lkdGggb2YgdGhlIHRleHQKLSAgICAgKi8KLSAgICBwdWJsaWMgc3RhdGljIGZsb2F0IG1lYXN1cmVUZXh0KFRleHRQYWludCBwYWludCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRleHRQYWludCB3b3JrUGFpbnQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDaGFyU2VxdWVuY2UgdGV4dCwgaW50IHN0YXJ0LCBpbnQgZW5kLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUGFpbnQuRm9udE1ldHJpY3NJbnQgZm1pKSB7Ci0gICAgICAgIHJldHVybiBkcmF3RGlyZWN0aW9uYWxSdW4obnVsbCwgdGV4dCwgc3RhcnQsIGVuZCwKLSAgICAgICAgICAgICAgICAgICAgICAgTGF5b3V0LkRJUl9MRUZUX1RPX1JJR0hULCBmYWxzZSwKLSAgICAgICAgICAgICAgICAgICAgICAgMCwgMCwgMCwgMCwgZm1pLCBwYWludCwgd29ya1BhaW50LCB0cnVlKTsKLSAgICB9Ci19CmRpZmYgLS1naXQgYS9jb3JlL2phdmEvYW5kcm9pZC90ZXh0L1RleHRMaW5lLmphdmEgYi9jb3JlL2phdmEvYW5kcm9pZC90ZXh0L1RleHRMaW5lLmphdmEKbmV3IGZpbGUgbW9kZSAxMDA2NDQKaW5kZXggMDAwMDAwMC4uMGUzNTIyZ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lbmNlIG1UZXh0OworICAgIHByaXZhdGUgaW50IG1TdGFydDsKKyAgICBwcml2YXRlIGludCBtTGVuOworICAgIHByaXZhdGUgaW50IG1EaXI7CisgICAgcHJpdmF0ZSBEaXJlY3Rpb25zIG1EaXJlY3Rpb25zOworICAgIHByaXZhdGUgYm9vbGVhbiBtSGFzVGFiczsKKyAgICBwcml2YXRlIFRhYlN0b3BzIG1UYWJzOworICAgIHByaXZhdGUgY2hhcltdIG1DaGFyczsKKyAgICBwcml2YXRlIGJvb2xlYW4gbUNoYXJzVmFsaWQ7CisgICAgcHJpdmF0ZSBTcGFubmVkIG1TcGFubmVkOworICAgIHByaXZhdGUgZmluYWwgVGV4dFBhaW50IG1Xb3JrUGFpbnQgPSBuZXcgVGV4dFBhaW50KCk7CisKKyAgICBwcml2YXRlIHN0YXRpYyBUZXh0TGluZVtdIGNhY2hlZCA9IG5ldyBUZXh0TGluZVszXTsKKworICAgIC8qKgorICAgICAqIFJldHVybnMgYSBuZXcgVGV4dExpbmUgZnJvbSB0aGUgc2hhcmVkIHBvb2wuCisgICAgICoKKyAgICAgKiBAcmV0dXJuIGFuIHVuaW5pdGlhbGl6ZWQgVGV4dExpbmUKKyAgICAgKi8KKyAgICBzdGF0aWMgVGV4dExpbmUgb2J0YWluKCkgeworICAgICAgICBUZXh0TGluZSB0bDsKKyAgICAgICAgc3luY2hyb25pemVkIChjYWNoZWQpIHsKKyAgICAgICAgICAgIGZvciAoaW50IGkgPSBjYWNoZWQubGVuZ3RoOyAtLWkgPj0gMDspIHsKKyAgICAgICAgICAgICAgICBpZiAoY2FjaGVkW2ldICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgdGwgPSBjYWNoZWRbaV07CisgICAgICAgICAgICAgICAgICAgIGNhY2hlZFtpXSA9IG51bGw7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiB0bDsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgdGwgPSBuZXcgVGV4dExpbmUoKTsKKyAgICAgICAgTG9nLmUoIlRMSU5FIiwgIm5ldzogIiArIHRsKTsKKyAgICAgICAgcmV0dXJuIHRsOworICAgIH0KKworICAgIC8qKgorICAgICAqIFB1dHMgYSBUZXh0TGluZSBiYWNrIGludG8gdGhlIHNoYXJlZCBwb29sLiBEbyBub3QgdXNlIHRoaXMgVGV4dExpbmUgb25jZQorICAgICAqIGl0IGhhcyBiZWVuIHJldHVybmVkLgorICAgICAqIEBwYXJhbSB0bCB0aGUgdGV4dExpbmUKKyAgICAgKiBAcmV0dXJuIG51bGwsIGFzIGEgY29udmVuaWVuY2UgZnJvbSBjbGVhcmluZyByZWZlcmVuY2VzIHRvIHRoZSBwcm92aWRlZAorICAgICAqIFRleHRMaW5lCisgICAgICovCisgICAgc3RhdGljIFRleHRMaW5lIHJlY3ljbGUoVGV4dExpbmUgdGwpIHsKKyAgICAgICAgdGwubVRleHQgPSBudWxsOworICAgICAgICB0bC5tUGFpbnQgPSBudWxsOworICAgICAgICB0bC5tRGlyZWN0aW9ucyA9IG51bGw7CisgICAgICAgIGlmICh0bC5tTGVuIDwgMjUwKSB7CisgICAgICAgICAgICBzeW5jaHJvbml6ZWQoY2FjaGVkKSB7CisgICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBjYWNoZWQubGVuZ3RoOyArK2kpIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGNhY2hlZFtpXSA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBjYWNoZWRbaV0gPSB0bDsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHJldHVybiBudWxsOworICAgIH0KKworICAgIC8qKgorICAgICAqIEluaXRpYWxpemVzIGEgVGV4dExpbmUgYW5kIHByZXBhcmVzIGl0IGZvciB1c2UuCisgICAg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AgICBtU3Bhbm5lZCA9IG51bGw7CisKKyAgICAgICAgYm9vbGVhbiBoYXNSZXBsYWNlbWVudCA9IGZhbHNlOworICAgICAgICBpZiAodGV4dCBpbnN0YW5jZW9mIFNwYW5uZWQpIHsKKyAgICAgICAgICAgIG1TcGFubmVkID0gKFNwYW5uZWQpIHRleHQ7CisgICAgICAgICAgICBoYXNSZXBsYWNlbWVudCA9IG1TcGFubmVkLmdldFNwYW5zKHN0YXJ0LCBsaW1pdCwKKyAgICAgICAgICAgICAgICAgICAgUmVwbGFjZW1lbnRTcGFuLmNsYXNzKS5sZW5ndGggPiAwOworICAgICAgICB9CisKKyAgICAgICAgbUNoYXJzVmFsaWQgPSBoYXNSZXBsYWNlbWVudCB8fCBoYXNUYWJzIHx8CisgICAgICAgICAgICBkaXJlY3Rpb25zICE9IExheW91dC5ESVJTX0FMTF9MRUZUX1RPX1JJR0hUOworCisgICAgICAgIGlmIChtQ2hhcnNWYWxpZCkgeworICAgICAgICAgICAgaWYgKG1DaGFycyA9PSBudWxsIHx8IG1DaGFycy5sZW5ndGggPCBtTGVuKSB7CisgICAgICAgICAgICAgICAgbUNoYXJzID0gbmV3IGNoYXJbQXJyYXlVdGlscy5pZGVhbENoYXJBcnJheVNpemUobUxlbildOworICAgICAgICAgICAgfQorICAgICAgICAgICAgVGV4dFV0aWxzLmdldENoYXJzKHRleHQsIHN0YXJ0LCBsaW1pdCwgbUNoYXJzLCAwKTsKKyAgICAgICAgICAgIGlmIChoYXNSZXBsYWNlbWVudCkgeworICAgICAgICAgICAgICAgIC8vIEhhbmRsZSB0aGVzZSBhbGwgYXQgb25jZSBzbyB3ZSBkb24ndCBoYXZlIHRvIGRvIGl0IGFzIHdlIGdvLgorICAgICAgICAgICAgICAgIC8vIFJlcGxhY2UgdGhlIGZpcnN0IGNoYXJhY3RlciBvZiBlYWNoIHJlcGxhY2VtZW50IHJ1biB3aXRoIHRoZQorICAgICAgICAgICAgICAgIC8vIG9iamVjdC1yZXBsYWNlbWVudCBjaGFyYWN0ZXIgYW5kIHRoZSByZW1haW5kZXIgd2l0aCB6ZXJvIHdpZHRoCisgICAgICAgICAgICAgICAgLy8gbm9uLWJyZWFrIHNwYWNlIGFrYSBCT00uICBDdXJzb3IgbW92ZW1lbnQgY29kZSBza2lwcyB0aGVzZQorICAgICAgICAgICAgICAgIC8vIHplcm8td2lkdGggY2hhcmFjdGVycy4KKyAgICAgICAgICAgICAgICBjaGFyW10gY2hhcnMgPSBtQ2hhcnM7CisgICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IHN0YXJ0LCBpbmV4dDsgaSA8IGxpbWl0OyBpID0gaW5leHQpIHsKKyAgICAgICAgICAgICAgICAgICAgaW5leHQgPSBtU3Bhbm5lZC5uZXh0U3BhblRyYW5zaXRpb24oaSwgbGltaXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgUmVwbGFjZW1lbnRTcGFuLmNsYXNzKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKG1TcGFubmVkLmdldFNwYW5zKGksIGluZXh0LCBSZXBsYWNlbWVudFNwYW4uY2xhc3MpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLmxlbmd0aCA+IDApIHsgLy8gdHJhbnNpdGlvbiBpbnRvIGEgc3BhbgorICAgICAgICAgICAgICAgICAgICAgICAgY2hhcnNbaSAtIHN0YXJ0XSA9ICdcdWZmZmMnOworICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChpbnQgaiA9IGkgLSBzdGFydCArIDEsIGUgPSBpbmV4dCAtIHN0YXJ0OyBqIDwgZTsgKytqKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hhcnNbal0gPSAnXHVmZWZmJzsgLy8gdXNlZCBhcyBaV05CUywgbWFya3MgcG9zaXRpb25zIHRvIHNraXAKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICBtVGFicyA9IHRhYlN0b3BzOworICAgIH0KKworICAgIC8qKgorICAgICAqIFJlbmRlcnMgdGhlIFRleHRMaW5lLgorICAgICAqCisgICAgICogQHBhcmFtIGMgdGhlIGNhbnZhcyB0byByZW5kZXIgb24KKyAgICAgKiBAcGFyYW0geCB0aGUgbGVhZGluZyBtYXJnaW4gcG9zaXRpb24KKyAgICAgKiBAcGFyYW0gdG9wIHRoZSB0b3Agb2YgdGhlIGxpbmUKKyAgICAgKiBAcGFyYW0geSB0aGUgYmFzZWxpbmUKKyAgICAgKiBAcGFyYW0gYm90dG9tIHRoZSBib3R0b20gb2YgdGhlIGxpbmUKKyAgICAgKi8KKyAgICB2b2lkIGRyYXcoQ2FudmFzIGMsIGZsb2F0IHgsIGludCB0b3AsIGludCB5LCBpbnQgYm90dG9tKSB7CisgICAgICAgIGlmICghbUhhc1RhYnMpIHsKKyAgICAgICAgICAgIGlmIChtRGlyZWN0aW9ucyA9PSBMYXlvdXQuRElSU19BTExfTEVGVF9UT19SSUdIVCkgeworICAgICAgICAgICAgICAgIGRyYXdSdW4oYywgMCwgMCwgbUxlbiwgZmFsc2UsIHgsIHRvcCwgeSwgYm90dG9tLCBmYWxzZSk7CisgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKG1EaXJlY3Rpb25zID09IExheW91dC5ESVJTX0FMTF9SSUdIVF9UT19MRUZUKSB7CisgICAgICAgICAgICAgICAgZHJhd1J1bihjLCAwLCAwLCBtTGVuLCB0cnVlLCB4LCB0b3AsIHksIGJvdHRvbSwgZmFsc2UpOworICAgICAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIGZsb2F0IGggPSAwOworICAgICAgICBpbnRbXSBydW5zID0gbURpcmVjdGlvbnMubURpcmVjdGlvbnM7CisgICAgICAgIFJlY3RGIGVtb2ppUmVjdCA9IG51bGw7CisKKyAgICAgICAgaW50IGxhc3RSdW5JbmRleCA9IHJ1bnMubGVuZ3RoIC0gMjsKKyAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBydW5zLmxlbmd0aDsgaSArPSAyKSB7CisgICAgICAgICAgICBpbnQgcnVuU3RhcnQgPSBydW5zW2ldOworICAgICAgICAgICAgaW50IHJ1bkxpbWl0ID0gcnVuU3RhcnQgKyAocnVuc1tpKzFdICYgTGF5b3V0LlJVTl9MRU5HVEhfTUFTSyk7CisgICAgICAgICAgICBpZiAocnVuTGltaXQgPiBtTGVuKSB7CisgICAgICAgICAgICAgICAgcnVuTGltaXQgPSBtTGVuOworICAgICAgICAgICAgfQorICAgICAgICAgICAgYm9vbGVhbiBydW5Jc1J0bCA9IChydW5zW2krMV0gJiBMYXlvdXQuUlVOX1JUTF9GTEFHKSAhPSAwOworCisgICAgICAgICAgICBpbnQgc2Vnc3RhcnQgPSBydW5TdGFydDsKKyAgICAgICAgICAgIGNoYXJbXSBjaGFycyA9IG1DaGFyczsKKyAgICAgICAgICAgIGZvciAoaW50IGogPSBtSGFzVGFicyA/IHJ1blN0YXJ0IDogcnVuTGltaXQ7IGogPD0gcnVuTGltaXQ7IGorKykgeworICAgICAgICAgICAgICAgIGludCBjb2RlcHQgPSAwOworICAgICAgICAgICAgICAgIEJpdG1hcCBibSA9IG51bGw7CisKKyAgICAgICAgICAgICAgICBpZiAobUhhc1RhYnMgJiYgaiA8IHJ1bkxpbWl0KSB7CisgICAgICAgICAgICAgICAgICAgIGNvZGVwdCA9IG1DaGFyc1tqXTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGNvZGVwdCA+PSAweGQ4MDAgJiYgY29kZXB0IDwgMHhkYzAwICYmIGogKyAxIDwgcnVuTGltaXQpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNvZGVwdCA9IENoYXJhY3Rlci5jb2RlUG9pbnRBdChtQ2hhcnMsIGopOworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNvZGVwdCA+PSBMYXlvdXQuTUlOX0VNT0pJICYmIGNvZGVwdCA8PSBMYXlvdXQuTUFYX0VNT0pJKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm0gPSBMYXlvdXQuRU1PSklfRkFDVE9SWS5nZXRCaXRtYXBGcm9tQW5kcm9pZFB1YShjb2RlcHQpOworICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChjb2RlcHQgPiAweGZmZmYpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICArK2o7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICBpZiAoaiA9PSBydW5MaW1pdCB8fCBjb2RlcHQgPT0gJ1x0JyB8fCBibSAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIGggKz0gZHJhd1J1bihjLCBpLCBzZWdzdGFydCwgaiwgcnVuSXNSdGwsIHgraCwgdG9wLCB5LCBib3R0b20sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaSAhPSBsYXN0UnVuSW5kZXggfHwgaiAhPSBtTGVuKTsKKworICAgICAgICAgICAgICAgICAgICBpZiAoY29kZXB0ID09ICdcdCcpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGggPSBtRGlyICogbmV4dFRhYihoICogbURpcik7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoYm0gIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgYm1Bc2NlbnQgPSBhc2NlbnQoaik7CisgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCBiaXRtYXBIZWlnaHQgPSBibS5nZXRIZWlnaHQoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGZsb2F0IHNjYWxlID0gLWJtQXNjZW50IC8gYml0bWFwSGVpZ2h0OworICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgd2lkdGggPSBibS5nZXRXaWR0aCgpICogc2NhbGU7CisKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlbW9qaVJlY3QgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVtb2ppUmVjdCA9IG5ldyBSZWN0RigpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgZW1vamlSZWN0LnNldCh4ICsgaCwgeSArIGJtQXNjZW50LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB4ICsgaCArIHdpZHRoLCB5KTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGMuZHJhd0JpdG1hcChibSwgbnVsbCwgZW1vamlSZWN0LCBtUGFpbnQpOworICAgICAgICAgICAgICAgICAgICAgICAgaCArPSB3aWR0aDsKKyAgICAgICAgICAgICAgICAgICAgICAgIGorKzsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBzZWdzdGFydCA9IGogKyAxOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIFJldHVybnMgbWV0cmljcyBpbmZvcm1hdGlvbiBmb3IgdGhlIGVudGlyZSBsaW5lLgorICAgICAqCisgICAgICogQHBhcmFtIGZtaSByZWNlaXZlcyBmb250IG1ldHJpY3MgaW5mb3JtYXRpb24sIGNhbiBiZSBudWxsCisgICAgICogQHJldHVybiB0aGUgc2lnbmVkIHdpZHRoIG9mIHRoZSBsaW5lCisgICAgICovCisgICAgZmxvYXQgbWV0cmljcyhGb250TWV0cmljc0ludCBmbWkpIHsKKyAgICAgICAgcmV0dXJuIG1lYXN1cmUobUxlbiwgZmFsc2UsIGZtaSk7CisgICAgfQorCisgICAgLyoqCisgICAgICogUmV0dXJucyBpbmZvcm1hdGlvbiBhYm91dCBhIHBvc2l0aW9uIG9uIHRoZSBsaW5lLgorICAgICAqC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Zmc2V0LCBtTGVuLCBmYWxzZSwgZm1pKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmIChtRGlyZWN0aW9ucyA9PSBMYXlvdXQuRElSU19BTExfUklHSFRfVE9fTEVGVCkgeworICAgICAgICAgICAgICAgIHJldHVybiBtZWFzdXJlUnVuKDAsIDAsIG9mZnNldCwgbUxlbiwgdHJ1ZSwgZm1pKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIGNoYXJbXSBjaGFycyA9IG1DaGFyczsKKyAgICAgICAgaW50W10gcnVucyA9IG1EaXJlY3Rpb25zLm1EaXJlY3Rpb25zOworICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IHJ1bnMubGVuZ3RoOyBpICs9IDIpIHsKKyAgICAgICAgICAgIGludCBydW5TdGFydCA9IHJ1bnNbaV07CisgICAgICAgICAgICBpbnQgcnVuTGltaXQgPSBydW5TdGFydCArIChydW5zW2krMV0gJiBMYXlvdXQuUlVOX0xFTkdUSF9NQVNLKTsKKyAgICAgICAgICAgIGlmIChydW5MaW1pdCA+IG1MZW4pIHsKKyAgICAgICAgICAgICAgICBydW5MaW1pdCA9IG1MZW47CisgICAgICAgICAgICB9CisgICAgICAgICAgICBib29sZWFuIHJ1bklzUnRsID0gKHJ1bnNbaSsxXSAmIExheW91dC5SVU5fUlRMX0ZMQUcpICE9IDA7CisKKyAgICAgICAgICAgIGludCBzZWdzdGFydCA9IHJ1blN0YXJ0OworICAgICAgICAgICAgZm9yIChpbnQgaiA9IG1IYXNUYWJzID8gcnVuU3RhcnQgOiBydW5MaW1pdDsgaiA8PSBydW5MaW1pdDsgaisrKSB7CisgICAgICAgICAgICAgICAgaW50IGNvZGVwdCA9IDA7CisgICAgICAgICAgICAgICAgQml0bWFwIGJtID0gbnVsbDsKKworICAgICAgICAgICAgICAgIGlmIChtSGFzVGFicyAmJiBqIDwgcnVuTGltaXQpIHsKKyAgICAgICAgICAgICAgICAgICAgY29kZXB0ID0gY2hhcnNbal07CisgICAgICAgICAgICAgICAgICAgIGlmIChjb2RlcHQgPj0gMHhkODAwICYmIGNvZGVwdCA8IDB4ZGMwMCAmJiBqICsgMSA8IHJ1bkxpbWl0KSB7CisgICAgICAgICAgICAgICAgICAgICAgICBjb2RlcHQgPSBDaGFyYWN0ZXIuY29kZVBvaW50QXQoY2hhcnMsIGopOworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNvZGVwdCA+PSBMYXlvdXQuTUlOX0VNT0pJICYmIGNvZGVwdCA8PSBMYXlvdXQuTUFYX0VNT0pJKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm0gPSBMYXlvdXQuRU1PSklfRkFDVE9SWS5nZXRCaXRtYXBGcm9tQW5kcm9pZFB1YShjb2RlcHQpOworICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChjb2RlcHQgPiAweGZmZmYpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICArK2o7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICBpZiAoaiA9PSBydW5MaW1pdCB8fCBjb2RlcHQgPT0gJ1x0JyB8fCBibSAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIGJvb2xlYW4gaW5TZWdtZW50ID0gdGFyZ2V0ID49IHNlZ3N0YXJ0ICYmIHRhcmdldCA8IGo7CisKKyAgICAgICAgICAgICAgICAgICAgYm9vbGVhbiBhZHZhbmNlID0gKG1EaXIgPT0gTGF5b3V0LkRJUl9SSUdIVF9UT19MRUZUKSA9PSBydW5Jc1J0bDsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGluU2VnbWVudCAmJiBhZHZhbmNlKSB7CisgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaCArPSBtZWFzdXJlUnVuKGksIHNlZ3N0YXJ0LCBvZmZzZXQsIGosIHJ1bklzUnRsLCBmbWkpOworICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgICAgZmxvYXQgdyA9IG1lYXN1cmVSdW4oaSwgc2Vnc3RhcnQsIGosIGosIHJ1bklzUnRsLCBmbWkpOworICAgICAgICAgICAgICAgICAgICBoICs9IGFkdmFuY2UgPyB3IDogLXc7CisKKyAgICAgICAgICAgICAgICAgICAgaWYgKGluU2VnbWVudCkgeworICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGggKz0gbWVhc3VyZVJ1bihpLCBzZWdzdGFydCwgb2Zmc2V0LCBqLCBydW5Jc1J0bCwgbnVsbCk7CisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICBpZiAoY29kZXB0ID09ICdcdCcpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChvZmZzZXQgPT0gaikgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBoOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgaCA9IG1EaXIgKiBuZXh0VGFiKGggKiBtRGlyKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0YXJnZXQgPT0gaikgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBoOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgICAgaWYgKGJtICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGZsb2F0IGJtQXNjZW50ID0gYXNjZW50KGopOworICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgd2lkID0gYm0uZ2V0V2lkdGgoKSAqIC1ibUFzY2VudCAvIGJtLmdldEhlaWdodCgpOworICAgICAgICAgICAgICAgICAgICAgICAgaCArPSBtRGlyICogd2lkOworICAgICAgICAgICAgICAgICAgICAgICAgaisrOworICA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pbmVFbmQgPSBtTGVuOworICAgICAgICBib29sZWFuIHBhcmFJc1J0bCA9IG1EaXIgPT0gLTE7CisgICAgICAgIGludFtdIHJ1bnMgPSBtRGlyZWN0aW9ucy5tRGlyZWN0aW9uczsKKworICAgICAgICBpbnQgcnVuSW5kZXgsIHJ1bkxldmVsID0gMCwgcnVuU3RhcnQgPSBsaW5lU3RhcnQsIHJ1bkxpbWl0ID0gbGluZUVuZCwgbmV3Q2FyZXQgPSAtMTsKKyAgICAgICAgYm9vbGVhbiB0cmFpbGluZyA9IGZhbHNlOworCisgICAgICAgIGlmIChjdXJzb3IgPT0gbGluZVN0YXJ0KSB7CisgICAgICAgICAgICBydW5JbmRleCA9IC0yOworICAgICAgICB9IGVsc2UgaWYgKGN1cnNvciA9PSBsaW5lRW5kKSB7CisgICAgICAgICAgICBydW5JbmRleCA9IHJ1bnMubGVuZ3RoOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgIC8vIEZpcnN0LCBnZXQgaW5mb3JtYXRpb24gYWJvdXQgdGhlIHJ1biBjb250YWluaW5nIHRoZSBjaGFyYWN0ZXIgd2l0aAorICAgICAgICAgIC8vIHRoZSBhY3RpdmUgY2FyZXQuCisgICAgICAgICAgZm9yIChydW5JbmRleCA9IDA7IHJ1bkluZGV4IDwgcnVucy5sZW5ndGg7IHJ1bkluZGV4ICs9IDIpIHsKKyAgICAgICAgICAgIHJ1blN0YXJ0ID0gbGluZVN0YXJ0ICsgcnVuc1tydW5JbmRleF07CisgICAgICAgICAgICBpZiAoY3Vyc29yID49IHJ1blN0YXJ0KSB7CisgICAgICAgICAgICAgIHJ1bkxpbWl0ID0gcnVuU3RhcnQgKyAocnVuc1tydW5JbmRleCsxXSAmIExheW91dC5SVU5fTEVOR1RIX01BU0spOworICAgICAgICAgICAgICBpZiAocnVuTGltaXQgPiBsaW5lRW5kKSB7CisgICAgICAgICAgICAgICAgICBydW5MaW1pdCA9IGxpbmVFbmQ7CisgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgaWYgKGN1cnNvciA8IHJ1bkxpbWl0KSB7CisgICAgICAgICAgICAgICAgcnVuTGV2ZWwgPSAocnVuc1tydW5JbmRleCsxXSA+Pj4gTGF5b3V0LlJVTl9MRVZFTF9TSElGVCkgJgorICAgICAgICAgICAgICAgICAgICBMYXlvdXQuUlVOX0xFVkVMX01BU0s7CisgICAgICAgICAgICAgICAgaWYgKGN1cnNvciA9PSBydW5TdGFydCkgeworICAgICAgICAgICAgICAgICAgLy8gVGhlIGNhcmV0IGlzIG9uIGEgcnVuIGJvdW5kYXJ5LCBzZWUgaWYgd2Ugc2hvdWxkCisgICAgICAgICAgICAgICAgICAvLyB1c2UgdGhlIHBvc2l0aW9uIG9uIHRoZSB0cmFpbGluZyBlZGdlIG9mIHRoZSBwcmV2aW91cworICAgICAgICAgICAgICAgICAgLy8gbG9naWNhbCBjaGFyYWN0ZXIgaW5zdGVhZC4KKyAgICAgICAgICAgICAgICAgIGludCBwcmV2UnVuSW5kZXgsIHByZXZSdW5MZXZlbCwgcHJldlJ1blN0YXJ0LCBwcmV2UnVuTGltaXQ7CisgICAgICAgICAgICAgICAgICBpbnQgcG9zID0gY3Vyc29yIC0gMTsKKyAgICAgICAgICAgICAgICAgIGZvciAocHJldlJ1bkluZGV4ID0gMDsgcHJldlJ1bkluZGV4IDwgcnVucy5sZW5ndGg7IHByZXZSdW5JbmRleCArPSAyKSB7CisgICAgICAgICAgICAgICAgICAgIHByZXZSdW5TdGFydCA9IGxpbmVTdGFydCArIHJ1bnNbcHJldlJ1bkluZGV4XTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKHBvcyA+PSBwcmV2UnVuU3RhcnQpIHsKKyAgICAgICAgICAgICAgICAgICAgICBwcmV2UnVuTGltaXQgPSBwcmV2UnVuU3RhcnQgKworICAgICAgICAgICAgICAgICAgICAgICAgICAocnVuc1twcmV2UnVuSW5kZXgrMV0gJiBMYXlvdXQuUlVOX0xFTkdUSF9NQVNLKTsKKyAgICAgICAgICAgICAgICAgICAgICBpZiAocHJldlJ1bkxpbWl0ID4gbGluZUVuZCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICBwcmV2UnVuTGltaXQgPSBsaW5lRW5kOworICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICBpZiAocG9zIDwgcHJldlJ1bkxpbWl0KSB7CisgICAgICAgICAgICAgICAgICAgICAgICBwcmV2UnVuTGV2ZWwgPSAocnVuc1twcmV2UnVuSW5kZXgrMV0gPj4+IExheW91dC5SVU5fTEVWRUxfU0hJRlQpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgJiBMYXlvdXQuUlVOX0xFVkVMX01BU0s7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAocHJldlJ1bkxldmVsIDwgcnVuTGV2ZWwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gU3RhcnQgZnJvbSBsb2dpY2FsbHkgcHJldmlvdXMgY2hhcmFjdGVyLgorICAgICAgICAgICAgICAgICAgICAgICAgICBydW5JbmRleCA9IHByZXZSdW5JbmRleDsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgcnVuTGV2ZWwgPSBwcmV2UnVuTGV2ZWw7CisgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1blN0YXJ0ID0gcHJldlJ1blN0YXJ0OworICAgICAgICAgICAgICAgICAgICAgICAgICBydW5MaW1pdCA9IHByZXZSdW5MaW1pdDsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhaWxpbmcgPSB0cnVlOworICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICB9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UnVuSW5kZXggPCBydW5zLmxlbmd0aCkgeworICAgICAgICAgICAgaW50IG90aGVyUnVuU3RhcnQgPSBsaW5lU3RhcnQgKyBydW5zW290aGVyUnVuSW5kZXhdOworICAgICAgICAgICAgaW50IG90aGVyUnVuTGltaXQgPSBvdGhlclJ1blN0YXJ0ICsKKyAgICAgICAgICAgIChydW5zW290aGVyUnVuSW5kZXgrMV0gJiBMYXlvdXQuUlVOX0xFTkdUSF9NQVNLKTsKKyAgICAgICAgICAgIGlmIChvdGhlclJ1bkxpbWl0ID4gbGluZUVuZCkgeworICAgICAgICAgICAgICAgIG90aGVyUnVuTGltaXQgPSBsaW5lRW5kOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaW50IG90aGVyUnVuTGV2ZWwgPSAocnVuc1tvdGhlclJ1bkluZGV4KzFdID4+PiBMYXlvdXQuUlVOX0xFVkVMX1NISUZUKSAmCisgICAgICAgICAgICAgICAgTGF5b3V0LlJVTl9MRVZFTF9NQVNLOworICAgICAgICAgICAgYm9vbGVhbiBvdGhlclJ1bklzUnRsID0gKG90aGVyUnVuTGV2ZWwgJiAxKSAhPSAwOworCisgICAgICAgICAgICBhZHZhbmNlID0gdG9MZWZ0ID09IG90aGVyUnVuSXNSdGw7CisgICAgICAgICAgICBpZiAobmV3Q2FyZXQgPT0gLTEpIHsKKyAgICAgICAgICAgICAgICBuZXdDYXJldCA9IGdldE9mZnNldEJlZm9yZUFmdGVyKG90aGVyUnVuSW5kZXgsIG90aGVyUnVuU3RhcnQsCisgICAgICAgICAgICAgICAgICAgICAgICBvdGhlclJ1bkxpbWl0LCBvdGhlclJ1bklzUnRsLAorICAgICAgICAgICAgICAgICAgICAgICAgYWR2YW5jZSA/IG90aGVyUnVuU3RhcnQgOiBvdGhlclJ1bkxpbWl0LCBhZHZhbmNlKTsKKyAgICAgICAgICAgICAgICBpZiAobmV3Q2FyZXQgPT0gKGFkdmFuY2UgPyBvdGhlclJ1bkxpbWl0IDogb3RoZXJSdW5TdGFydCkpIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gQ3Jvc3NlZCBhbmQgZW5kZWQgdXAgYXQgYSBuZXcgYm91bmRhcnksCisgICAgICAgICAgICAgICAgICAgIC8vIHJlcGVhdCBhIHNlY29uZCBhbmQgZmluYWwgdGltZS4KKyAgICAgICAgICAgICAgICAgICAgcnVuSW5kZXggPSBvdGhlclJ1bkluZGV4OworICAgICAgICAgICAgICAgICAgICBydW5MZXZlbCA9IG90aGVyUnVuTGV2ZWw7CisgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgLy8gVGhlIG5ldyBjYXJldCBpcyBhdCBhIGJvdW5kYXJ5LgorICAgICAgICAgICAgaWYgKG90aGVyUnVuTGV2ZWwgPCBydW5MZXZlbCkgeworICAgICAgICAgICAgICAvLyBUaGUgc3Ryb25nIGNoYXJhY3RlciBpcyBpbiB0aGUgb3RoZXIgcnVuLgorICAgICAgICAgICAgICBuZXdDYXJldCA9IGFkdmFuY2UgPyBvdGhlclJ1blN0YXJ0IDogb3RoZXJSdW5MaW1pdDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgIH0KKworICAgICAgICAgIGlmIChuZXdDYXJldCA9PSAtMSkgeworICAgICAgICAgICAgICAvLyBXZSdyZSB3YWxraW5nIG9mZiB0aGUgZW5kIG9mIHRoZSBsaW5lLiAgVGhlIHBhcmFncmFwaAorICAgICAgICAgICAgICAvLyBsZXZlbCBpcyBhbHdheXMgZXF1YWwgdG8gb3IgbG93ZXIgdGhhbiBhbnkgaW50ZXJuYWwgbGV2ZWwsIHNvCisgICAgICAgICAgICAgIC8vIHRoZSBib3VuZGFyaWVzIGdldCB0aGUgc3Ryb25nIGNhcmV0LgorICAgICAgICAgICAgICBuZXdDYXJldCA9IGFkdmFuY2UgPyBtTGVuICsgMSA6IC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Q7CisgICAgICAgICAgICB3aGlsZSAodHJ1ZSkgeworICAgICAgICAgICAgICAgIHNwYW5MaW1pdCA9IG1TcGFubmVkLm5leHRTcGFuVHJhbnNpdGlvbihtU3RhcnQgKyBzcGFuU3RhcnQsIGxpbWl0LAorICAgICAgICAgICAgICAgICAgICAgICAgTWV0cmljQWZmZWN0aW5nU3Bhbi5jbGFzcykgLSBtU3RhcnQ7CisgICAgICAgICAgICAgICAgaWYgKHNwYW5MaW1pdCA+PSB0YXJnZXQpIHsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHNwYW5TdGFydCA9IHNwYW5MaW1pdDsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgTWV0cmljQWZmZWN0aW5nU3BhbltdIHNwYW5zID0gbVNwYW5uZWQuZ2V0U3BhbnMobVN0YXJ0ICsgc3BhblN0YXJ0LAorICAgICAgICAgICAgICAgICAgICBtU3RhcnQgKyBzcGFuTGltaXQsIE1ldHJpY0FmZmVjdGluZ1NwYW4uY2xhc3MpOworCisgICAgICAgICAgICBpZiAoc3BhbnMubGVuZ3RoID4gMCkgeworICAgICAgICAgICAgICAgIFJlcGxhY2VtZW50U3BhbiByZXBsYWNlbWVudCA9IG51bGw7CisgICAgICAgICAgICAgICAgZm9yIChpbnQgaiA9IDA7IGogPCBzcGFucy5sZW5ndGg7IGorKykgeworICAgICAgICAgICAgICAgICAgICBNZXRyaWNBZmZlY3RpbmdTcGFuIHNwYW4gPSBzcGFuc1tqXTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKHNwYW4gaW5zdGFuY2VvZiBSZXBsYWNlbWVudFNwYW4pIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJlcGxhY2VtZW50ID0gKFJlcGxhY2VtZW50U3BhbilzcGFuOworICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAgICAgc3Bhbi51cGRhdGVNZWFzdXJlU3RhdGUod3ApOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgaWYgKHJlcGxhY2VtZW50ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gSWYgd2UgaGF2ZSBhIHJlcGxhY2VtZW50IHNwYW4sIHdlJ3JlIG1vdmluZyBlaXRoZXIgdG8KKyAgICAgICAgICAgICAgICAgICAgLy8gdGhlIHN0YXJ0IG9yIGVuZCBvZiB0aGlzIHNwYW4uCisgICAgICAgICAgICAgICAgICAgIHJldHVybiBhZnRlciA/IHNwYW5MaW1pdCA6IHNwYW5TdGFydDsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBpbnQgZmxhZ3MgPSBydW5Jc1J0bCA/IFBhaW50LkRJUkVDVElPTl9SVEwgOiBQYWludC5ESVJFQ1RJT05fTFRSOworICAgICAgICBpbnQgY3Vyc29yT3B0ID0gYWZ0ZXIgPyBQYWludC5DVVJTT1JfQUZURVIgOiBQYWludC5DVVJTT1JfQkVGT1JFOworICAgICAgICBpZiAobUNoYXJzVmFsaWQpIHsKKyAgICAgICAgICAgIHJldHVybiB3cC5nZXRUZXh0UnVuQ3Vyc29yKG1DaGFycywgc3BhblN0YXJ0LCBzcGFuTGltaXQgLSBzcGFuU3RhcnQsCisgICAgICAgICAgICAgICAgICAgIGZsYWdzLCBvZmZzZXQsIGN1cnNvck9wdCk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICByZXR1cm4gd3AuZ2V0VGV4dFJ1bkN1cnNvcihtVGV4dCwgbVN0YXJ0ICsgc3BhblN0YXJ0LAorICAgICAgICAgICAgICAgICAgICBtU3RhcnQgKyBzcGFuTGltaXQsIGZsYWdzLCBtU3RhcnQgKyBvZmZzZXQsIGN1cnNvck9wdCkgLSBtU3RhcnQ7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBVd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GludCBzdGFydCwgaW50IGVuZCwKKyAgICAgICAgICAgIGludCBjb250ZXh0U3RhcnQsIGludCBjb250ZXh0RW5kLCBib29sZWFuIHJ1bklzUnRsLAorICAgICAgICAgICAgQ2FudmFzIGMsIGZsb2F0IHgsIGludCB0b3AsIGludCB5LCBpbnQgYm90dG9tLAorICAgICAgICAgICAgRm9udE1ldHJpY3NJbnQgZm1pLCBib29sZWFuIG5lZWRXaWR0aCkgeworCisgICAgICAgIGZsb2F0IHJldCA9IDA7CisKKyAgICAgICAgaW50IHJ1bkxlbiA9IGVuZCAtIHN0YXJ0OworICAgICAgICBpbnQgY29udGV4dExlbiA9IGNvbnRleHRFbmQgLSBjb250ZXh0U3RhcnQ7CisgICAgICAgIGlmIChuZWVkV2lkdGggfHwgKGMgIT0gbnVsbCAmJiAod3AuYmdDb2xvciAhPSAwIHx8IHJ1bklzUnRsKSkpIHsKKyAgICAgICAgICAgIGludCBmbGFncyA9IHJ1bklzUnRsID8gUGFpbnQuRElSRUNUSU9OX1JUTCA6IFBhaW50LkRJUkVDVElPTl9MVFI7CisgICAgICAgICAgICBpZiAobUNoYXJzVmFsaWQpIHsKKyAgICAgICAgICAgICAgICByZXQgPSB3cC5nZXRUZXh0UnVuQWR2YW5jZXMobUNoYXJzLCBzdGFydCwgcnVuTGVuLAorICAgICAgICAgICAgICAgICAgICAgICAgY29udGV4dFN0YXJ0LCBjb250ZXh0TGVuLCBmbGFncywgbnVsbCwgMCk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIGludCBkZWx0YSA9IG1TdGFydDsKKyAgICAgICAgICAgICAgICByZXQgPSB3cC5nZXRUZXh0UnVuQWR2YW5jZXMobVRleHQsIGRlbHRhICsgc3RhcnQsCisgICAgICAgICAgICAgICAgICAgICAgICBkZWx0YSArIGVuZCwgZGVsdGEgKyBjb250ZXh0U3RhcnQsIGRlbHRhICsgY29udGV4dEVuZCwKKyAgICAgICAgICAgICAgICAgICAgICAgIGZsYWdzLCBudWxsLCAwKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIGlmIChmbWkgIT0gbnVsbCkgeworICAgICAgICAgICAgd3AuZ2V0Rm9udE1ldHJpY3NJbnQoZm1pKTsKKyAgICAgICAgfQorCisgICAgICAgIGlmIChjICE9IG51bGwpIHsKKyAgICAgICAgICAgIGlmIChydW5Jc1J0bCkgeworICAgICAgICAgICAgICAgIHggLT0gcmV0OworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpZiAod3AuYmdDb2xvciAhPSAwKSB7CisgICAgICAgICAgICAgICAgaW50IGNvbG9yID0gd3AuZ2V0Q29sb3IoKTsKKyAgICAgICAgICAgICAgICBQYWludC5TdHlsZSBzID0gd3AuZ2V0U3R5bGUoKTsKKyAgICAgICAgICAgICAgICB3cC5zZXRDb2xvcih3cC5iZ0NvbG9yKTsKKyAgICAgICAgICAgICAgICB3cC5zZXRTdHlsZShQYWludC5TdHlsZS5GSUxMKTsKKworICAgICAgICAgICAgICAgIGMuZHJhd1JlY3QoeCwgdG9wLCB4ICsgcmV0LCBib3R0b20sIHdwKTsKKworICAgICAgICAgICAgICAgIHdwLnNldFN0eWxlKHMpOworICAgICAgICAgICAgICAgIHdwLnNldENvbG9yKGNvbG9yKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgZHJhd1RleHRSdW4oYywgd3AsIHN0YXJ0LCBlbmQsIGNvbnRleHRTdGFydCwgY29udGV4dEVuZCwgcnVuSXNSdGwsCisgICAgICAgICAgICAgICAgICAgIHgsIHkgKyB3cC5iYXNlbGluZVNoaWZ0KTsKKyAgICAgICAgfQorCisgICAgICAgIHJldHVybiBydW5Jc1J0bCA/IC1yZXQgOiByZXQ7CisgICAgfQorCisgICAgLyoqCisgICAgICogVXRpbGl0eSBmdW5jdGlvbiBmb3IgbWVhc3VyaW5nIGFuZCByZW5kZXJpbmcgYSByZXBsYWNlbWVudC4KKyAgICAgKgorICAgICAqIEBwYXJhbSByZXBsYW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Qgd3AsCisgICAgICAgICAgICBpbnQgcnVuSW5kZXgsIGludCBzdGFydCwgaW50IGxpbWl0LCBib29sZWFuIHJ1bklzUnRsLCBDYW52YXMgYywKKyAgICAgICAgICAgIGZsb2F0IHgsIGludCB0b3AsIGludCB5LCBpbnQgYm90dG9tLCBGb250TWV0cmljc0ludCBmbWksCisgICAgICAgICAgICBib29sZWFuIG5lZWRXaWR0aCkgeworCisgICAgICAgIGZsb2F0IHJldCA9IDA7CisKKyAgICAgICAgaW50IHRleHRTdGFydCA9IG1TdGFydCArIHN0YXJ0OworICAgICAgICBpbnQgdGV4dExpbWl0ID0gbVN0YXJ0ICsgbGltaXQ7CisKKyAgICAgICAgaWYgKG5lZWRXaWR0aCB8fCAoYyAhPSBudWxsICYmIHJ1bklzUnRsKSkgeworICAgICAgICAgICAgcmV0ID0gcmVwbGFjZW1lbnQuZ2V0U2l6ZSh3cCwgbVRleHQsIHRleHRTdGFydCwgdGV4dExpbWl0LCBmbWkpOworICAgICAgICB9CisKKyAgICAgICAgaWYgKGMgIT0gbnVsbCkgeworICAgICAgICAgICAgaWYgKHJ1bklzUnRsKSB7CisgICAgICAgICAgICAgICAgeCAtPSByZXQ7CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXBsYWNlbWVudC5kcmF3KGMsIG1UZXh0LCB0ZXh0U3RhcnQsIHRleHRMaW1pdCwKKyAgICAgICAgICAgICAgICAgICAgeCwgdG9wLCB5LCBib3R0b20sIHdwKTsKKyAgICAgICAgfQorCisgICAgICAgIHJldHVybiBydW5Jc1J0bCA/IC1yZXQgOiByZXQ7CisgICAgfQorCisgICAgLyoqCisgICAgICogVXRpbGl0eSBmdW5jdGlvbiBmb3IgaGFuZGxpbmcgYSB1bmlkaXJlY3Rpb25hbCBydW4uICBUaGUgcnVuIG11c3Qgbm90CisgICAgICogY29udGFpbiB0YWJzIG9yIGVtb2ppIGJ1dCBjYW4gY29udGFpbiBzdHlsZXMuCisgICAgICoKKyAgICAgKiBAcGFyY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RhcnQgKyBsaW1pdCwKKyAgICAgICAgICAgICAgICAgICAgICAgIE1ldHJpY0FmZmVjdGluZ1NwYW4uY2xhc3MpIC0gbVN0YXJ0OworCisgICAgICAgICAgICAgICAgbWxpbWl0ID0gaW5leHQgPCBtZWFzdXJlTGltaXQgPyBpbmV4dCA6IG1lYXN1cmVMaW1pdDsKKyAgICAgICAgICAgICAgICBNZXRyaWNBZmZlY3RpbmdTcGFuW10gc3BhbnMgPSBtU3Bhbm5lZC5nZXRTcGFucyhtU3RhcnQgKyBpLAorICAgICAgICAgICAgICAgICAgICAgICAgbVN0YXJ0ICsgbWxpbWl0LCBNZXRyaWNBZmZlY3RpbmdTcGFuLmNsYXNzKTsKKworICAgICAgICAgICAgICAgIGlmIChzcGFucy5sZW5ndGggPiAwKSB7CisgICAgICAgICAgICAgICAgICAgIFJlcGxhY2VtZW50U3BhbiByZXBsYWNlbWVudCA9IG51bGw7CisgICAgICAgICAgICAgICAgICAgIGZvciAoaW50IGogPSAwOyBqIDwgc3BhbnMubGVuZ3RoOyBqKyspIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIE1ldHJpY0FmZmVjdGluZ1NwYW4gc3BhbiA9IHNwYW5zW2pdOworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHNwYW4gaW5zdGFuY2VvZiBSZXBsYWNlbWVudFNwYW4pIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXBsYWNlbWVudCA9IChSZXBsYWNlbWVudFNwYW4pc3BhbjsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gV2UgbWlnaHQgaGF2ZSBhIHJlcGxhY2VtZW50IHRoYXQgdXNlcyB0aGUgZHJhdworICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHN0YXRlLCBvdGhlcndpc2UgbWVhc3VyZSBzdGF0ZSB3b3VsZCBzdWZmaWNlLgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNwYW4udXBkYXRlRHJhd1N0YXRlKHdwKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgIGlmIChyZXBsYWNlbWVudCAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICB4ICs9IGhhbmRsZVJlcGxhY2VtZW50KHJlcGxhY2VtZW50LCB3cCwgcnVuSW5kZXgsIGksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1saW1pdCwgcnVuSXNSdGwsIGMsIHgsIHRvcCwgeSwgYm90dG9tLCBmbWksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5lZWRXaWR0aCB8fCBtbGltaXQgPCBtZWFzdXJlTGltaXQpOworICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmIChtU3Bhbm5lZCA9PSBudWxsIHx8IGMgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgIHggKz0gaGFuZGxlVGV4dCh3cCwgaSwgbWxpbWl0LCBpLCBpbmV4dCwgcnVuSXNSdGwsIGMsIHgsIHRvcCwKKyAgICAgICAgICAgICAgICAgICAgICAgIHksIGJvdHRvbSwgZm1pLCBuZWVkV2lkdGggfHwgbWxpbWl0IDwgbWVhc3VyZUxpbWl0KTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgZm9yIChpbnQgaiA9IGksIGpuZXh0OyBqIDwgbWxpbWl0OyBqID0gam5leHQpIHsKKyAgICAgICAgICAgICAgICAgICAgam5leHQgPSBtU3Bhbm5lZC5uZXh0U3BhblRyYW5zaXRpb24obVN0YXJ0ICsgaiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBtU3RhcnQgKyBtbGltaXQsIENoYXJhY3RlclN0eWxlLmNsYXNzKSAtIG1TdGFydDsKKworICAgICAgICAgICAgICAgICAgICBDaGFyYWN0ZXJTdHlsZVtdIHNwYW5zID0gbVNwYW5uZWQuZ2V0U3BhbnMobVN0YXJ0ICsgaiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBtU3RhcnQgKyBqbmV4dCwgQ2hhcmFjdGVyU3R5bGUuY2xhc3MpOworCisgICAgICAgICAgICAgICAgICAgIHdwLnNldChtUGFpbnQpOworICAgICAgICAgICAgICAgICAgICBmb3IgKGludCBrID0gMDsgayA8IHNwYW5zLmxlbmd0aDsgaysrKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBDaGFyYWN0ZXJTdHlsZSBzcGFuID0gc3BhbnNba107CisgICAgICAgICAgICAgICAgICAgICAgICBzcGFuLnVwZGF0ZURyYXdTdGF0ZSh3cCk7CisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICB4ICs9IGhhbmRsZVRleHQod3AsIGosIGpuZXh0LCBpLCBpbmV4dCwgcnVuSXNSdGwsIGMsIHgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgdG9wLCB5LCBib3R0b20sIGZtaSwgbmVlZFdpZHRoIHx8IGpuZXh0IDwgbWVhc3VyZUxpbWl0KTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4geCAtIG94OworICAgIH0KKworICAgIC8qKgorICAgICAqIFJlbmRlciBhIHRleHQgcnVuIHdpdGggdGhlIHNldC11cCBwYWludC4KKyAgICAgKgorICAgICAqIEBwYXJhbSBjIHRoZSBjYW52YXMKKyAgICAgKiBAcGFyYW0gd3AgdGhlIHBhaW50IHVzZWQgdG8gcmVuZGVyIHRoZSB0ZXh0CisgICAgICogQHBhcmFtIHN0YXJ0IHRoZSBzdGFydCBvZiB0aGUgcnVuCisgICAgICogQHBhcmFtIGVuZCB0aGUgZW5kIG9mIHRoZSBydW4KKyAgICAgKiBAcGFyYW0gY29udGV4d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YXJ0LCBkZWx0YSArIGVuZCwKKyAgICAgICAgICAgICAgICAgICAgZGVsdGEgKyBjb250ZXh0U3RhcnQsIGRlbHRhICsgY29udGV4dEVuZCwgeCwgeSwgZmxhZ3MsIHdwKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIFJldHVybnMgdGhlIGFzY2VudCBvZiB0aGUgdGV4dCBhdCBzdGFydC4gIFRoaXMgaXMgdXNlZCBmb3Igc2NhbGluZworICAgICAqIGVtb2ppLgorICAgICAqCisgICAgICogQHBhcmFtIHBvcyB0aGUgbGluZS1yZWxhdGl2ZSBwb3NpdGlvbgorICAgICAqIEByZXR1cm4gdGhlIGFzY2VudCBvZiB0aGUgdGV4dCBhdCBzdGFydAorICAgICAqLworICAgIGZsb2F0IGFzY2VudChpbnQgcG9zKSB7CisgICAgICAgIGlmIChtU3Bhbm5lZCA9PSBudWxsKSB7CisgICAgICAgICAgICByZXR1cm4gbVBhaW50LmFzY2VudCgpOworICAgICAgICB9CisKKyAgICAgICAgcG9zICs9IG1TdGFydDsKKyAgICAgICAgTWV0cmljQWZmZWN0aW5nU3BhbltdIHNwYW5zID0gbVNwYW5uZWQuZ2V0U3BhbnMocG9zLCBwb3MgKyAxLAorICAgICAgICAgICAgICAgIE1ldHJpY0FmZmVjdGluZ1NwYW4uY2xhc3MpOworICAgICAgICBpZiAoc3BhbnMubGVuZ3RoID09IDApIHsKKyAgICAgICAgICAgIHJldHVybiBtUGFpbnQuYXNjZW50KCk7CisgICAgICAgIH0KKworICAgICAgICBUZXh0UGFpbnQgd3AgPSBtV29ya1BhaW50OworICAgICAgICB3cC5zZXQobVBhaW50KTsKKyAgICAgICAgZm9yIChNZXRyaWNBZmZlY3RpbmdTcGFuIHNwYW4gOiBzcGFucykgeworICAgICAgICAgICAgc3Bhbi51cGRhdGVNZWFzdXJlU3RhdGUod3ApOworICAgICAgICB9CisgICAgICAgIHJldHVybiB3cC5hc2NlbnQoKTsKKyAgICB9CisKKyAgIC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G5vdCBmaXQsIGEgY29weSB3aXRoIGVsbGlwc2lzIGNoYXJhY3RlciBhZGRlZAogICAgICAqIGF0IHRoZSBzcGVjaWZpZWQgZWRnZSBvciBjZW50ZXIuCiAgICAgICogSWYgPGNvZGU+cHJlc2VydmVMZW5ndGg8L2NvZGU+IGlzIHNwZWNpZmllZCwgdGhlIHJldHVybmVkIGNvcHkKICAgICAgKiB3aWxsIGJlIHBhZGRlZCB3aXRoIHplcm8td2lkdGggc3BhY2VzIHRvIHByZXNlcnZlIHRoZSBvcmlnaW5hbApAQCAtOTkyLDcgKzk4OSw3IEBACiAgICAgICogcmVwb3J0IHRoZSBzdGFydCBhbmQgZW5kIG9mIHRoZSBlbGxpcHNpemVkIHJhbmdlLgogICAgICAqLwogICAgIHB1YmxpYyBzdGF0aWMgQ2hhclNlcXVlbmNlIGVsbGlwc2l6ZShDaGFyU2VxdWVuY2UgdGV4dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVGV4dFBhaW50IHAsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRleHRQYWludCBwYWludCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgYXZhaWwsIFRydW5jYXRlQXQgd2hlcmUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2xlYW4gcHJlc2VydmVMZW5ndGgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEVsbGlwc2l6ZUNhbGxiYWNrIGNhbGxiYWNrKSB7CkBAIC0xMDAzLDEzICsxMDAwLDEyIEBACiAKICAgICAgICAgaW50IGxlbiA9IHRleHQubGVuZ3RoKCk7CiAKLSAgICAgICAgLy8gVXNlIFBhaW50LmJyZWFrVGV4dCgpIGZvciB0aGUgbm9uLVNwYW5uZWQgY2FzZSB0byBhdm9pZCBoYXZpbmcKLSAgICAgICAgLy8gdG8gYWxsb2NhdGUgbWVtb3J5IGFuZCBhY2N1bXVsYXRlIHRoZSBjaGFyYWN0ZXIgd2lkdGhzIG91cnNlbHZlcy4KKyAgICAgICAgTWVhc3VyZWRUZXh0IG10ID0gTWVhc3VyZWRUZXh0Lm9idGFpbigpOworICAgICAgICB0cnkgeworICAgICAgICAgICAgZmxvYXQgd2lkdGggPSBzZXRQYXJhKG10LCBwYWludCwgdGV4dCwgMCwgdGV4dC5sZW5ndGgoKSwKKyAgICAgICAgICAgICAgICAgICAgTGF5b3V0LkRJUl9SRVFVRVNUX0RFRkFVTFRfTFRSKTsKIAotICAgICAgICBpZiAoISh0ZXh0IGluc3RhbmNlb2YgU3Bhbm5lZCkpIHsKLSAgICAgICAgICAgIGZsb2F0IHdpZCA9IHAubWVhc3VyZVRleHQodGV4dCwgMCwgbGVuKTsKLQotICAgICAgICAgICAgaWYgKHdpZCA8PSBhdmFpbCkgeworICAgICAgICAgICAgaWYgKHdpZHRoIDw9IGF2YWlsKSB7CiAgICAgICAgICAgICAgICAgaWYgKGNhbGxiYWNrICE9IG51bGwpIHsKICAgICAgICAgICAgICAgICAgICAgY2FsbGJhY2suZWxsaXBzaXplZCgwLCAwKTsKICAgICAgICAgICAgICAgICB9CkBAIC0xMDE3LDI1MCArMTAxMyw2OSBAQAogICAgICAgICAgICAgICAgIHJldHVybiB0ZXh0OwogICAgICAgICAgICAgfQogCi0gICAgICAgICAgICBmbG9hdCBlbGxpcHNpc3dpZCA9IHAubWVhc3VyZVRleHQoc0VsbGlwc2lzKTsKKyAgICAgICAgICAgIC8vIFhYWCBhc3N1bWVzIGVsbGlwc2lzIHN0cmluZyBkb2VzIG5vdCByZXF1aXJlIHNoYXBpbmcgYW5kCisgICAgICAgICAgICAvLyBpcyB1bmFmZmVjdGVkIGJ5IHN0eWxlCisgICAgICAgICAgICBmbG9hdCBlbGxpcHNpc3dpZCA9IHBhaW50Lm1lYXN1cmVUZXh0KHNFbGxpcHNpcyk7CisgICAgICAgICAgICBhdmFpbCAtPSBlbGxpcHNpc3dpZDsKIAotICAgICAgICAgICAgaWYgKGVsbGlwc2lzd2lkID4gYXZhaWwpIHsKLSAgICAgICAgICAgICAgICBpZiAoY2FsbGJhY2sgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICBjYWxsYmFjay5lbGxpcHNpemVkKDAsIGxlbik7Ci0gICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgaWYgKHByZXNlcnZlTGVuZ3RoKSB7Ci0gICAgICAgICAgICAgICAgICAgIGNoYXJbXSBidWYgPSBvYnRhaW4obGVuKTsKLSAgICAgICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBsZW47IGkrKykgewotICAgICAgICAgICAgICAgICAgICAgICAgYnVmW2ldID0gJ1x1RkVGRic7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgU3RyaW5nIHJldCA9IG5ldyBTdHJpbmcoYnVmLCAwLCBsZW4pOwotICAgICAgICAgICAgICAgICAgICByZWN5Y2xlKGJ1Zik7Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybiByZXQ7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgcmV0dXJuICIiOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgaWYgKHdoZXJlID09IFRydW5jYXRlQXQuU1RBUlQpIHsKLSAgICAgICAgICAgICAgICBpbnQgZml0ID0gcC5icmVha1RleHQodGV4dCwgMCwgbGVuLCBmYWxzZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXZhaWwgLSBlbGxpcHNpc3dpZCwgbnVsbCk7Ci0KLSAgICAgICAgICAgICAgICBpZiAoY2FsbGJhY2sgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICBjYWxsYmFjay5lbGxpcHNpemVkKDAsIGxlbiAtIGZpdCk7Ci0gICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgaWYgKHByZXNlcnZlTGVuZ3RoKSB7Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybiBibGFuayh0ZXh0LCAwLCBsZW4gLSBmaXQpOwotICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybiBzRWxsaXBzaXMgKyB0ZXh0LnRvU3RyaW5nKCkuc3Vic3RyaW5nKGxlbiAtIGZpdCwgbGVuKTsKLSAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICBpbnQgbGVmdCA9IDA7CisgICAgICAgICAgICBpbnQgcmlnaHQgPSBsZW47CisgICAgICAgICAgICBpZiAoYXZhaWwgPCAwKSB7CisgICAgICAgICAgICAgICAgLy8gaXQgYWxsIGdvZXMKKyAgICAgICAgICAgIH0gZWxzZSBpZiAod2hlcmUgPT0gVHJ1bmNhdGVBdC5TVEFSVCkgeworICAgICAgICAgICAgICAgIHJpZ2h0ID0gbGVuIC0gbXQuYnJlYWtUZXh0KDAsIGxlbiwgZmFsc2UsIGF2YWlsKTsKICAgICAgICAgICAgIH0gZWxzZSBpZiAod2hlcmUgPT0gVHJ1bmNhdGVBdC5FTkQpIHsKLSAgICAgICAgICAgICAgICBpbnQgZml0ID0gcC5icmVha1RleHQodGV4dCwgMCwgbGVuLCB0cnVlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdmFpbCAtIGVsbGlwc2lzd2lkLCBudWxsKTsKLQotICAgICAgICAgICAgICAgIGlmIChjYWxsYmFjayAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIGNhbGxiYWNrLmVsbGlwc2l6ZWQoZml0LCBsZW4pOwotICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgIGlmIChwcmVzZXJ2ZUxlbmd0aCkgewotICAgICAgICAgICAgICAgICAgICByZXR1cm4gYmxhbmsodGV4dCwgZml0LCBsZW4pOwotICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybiB0ZXh0LnRvU3RyaW5nKCkuc3Vic3RyaW5nKDAsIGZpdCkgKyBzRWxsaXBzaXM7Ci0gICAgICAgICAgICAgICAgfSAKLSAgICAgICAgICAgIH0gZWxzZSAvKiB3aGVyZSA9PSBUcnVuY2F0ZUF0Lk1JRERMRSAqLyB7Ci0gICAgICAgICAgICAgICAgaW50IHJpZ2h0ID0gcC5icmVha1RleHQodGV4dCwgMCwgbGVuLCBmYWxzZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoYXZhaWwgLSBlbGxpcHNpc3dpZCkgLyAyLCBudWxsKTsKLSAgICAgICAgICAgICAgICBmbG9hdCB1c2VkID0gcC5tZWFzdXJlVGV4dCh0ZXh0LCBsZW4gLSByaWdodCwgbGVuKTsKLSAgICAgICAgICAgICAgICBpbnQgbGVmdCA9IHAuYnJlYWtUZXh0KHRleHQsIDAsIGxlbiAtIHJpZ2h0LCB0cnVlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXZhaWwgLSBlbGxpcHNpc3dpZCAtIHVzZWQsIG51bGwpOwotCi0gICAgICAgICAgICAgICAgaWYgKGNhbGxiYWNrICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgY2FsbGJhY2suZWxsaXBzaXplZChsZWZ0LCBsZW4gLSByaWdodCk7Ci0gICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgaWYgKHByZXNlcnZlTGVuZ3RoKSB7Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybiBibGFuayh0ZXh0LCBsZWZ0LCBsZW4gLSByaWdodCk7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgU3RyaW5nIHMgPSB0ZXh0LnRvU3RyaW5nKCk7Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybiBzLnN1YnN0cmluZygwLCBsZWZ0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BhaW50LCBzcCwgaSwgbmV4dCwgd2lkLCBudWxsKTsKLSAgICAgICAgICAgIFN5c3RlbS5hcnJheWNvcHkod2lkLCAwLCB3aWQsIGxlbiArIGksIG5leHQgLSBpKTsKLSAgICAgICAgfQotCi0gICAgICAgIGZsb2F0IHN1bSA9IDA7Ci0gICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbGVuOyBpKyspIHsKLSAgICAgICAgICAgIHN1bSArPSB3aWRbbGVuICsgaV07Ci0gICAgICAgIH0KLQotICAgICAgICBpZiAoc3VtIDw9IGF2YWlsKSB7Ci0gICAgICAgICAgICBpZiAoY2FsbGJhY2sgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgIGNhbGxiYWNrLmVsbGlwc2l6ZWQoMCwgMCk7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIHJldHVybiB0ZXh0OwotICAgICAgICB9Ci0KLSAgICAgICAgZmxvYXQgZWxsaXBzaXN3aWQgPSBwLm1lYXN1cmVUZXh0KHNFbGxpcHNpcyk7Ci0KLSAgICAgICAgaWYgKGVsbGlwc2lzd2lkID4gYXZhaWwpIHsKLSAgICAgICAgICAgIGlmIChjYWxsYmFjayAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgY2FsbGJhY2suZWxsaXBzaXplZCgwLCBsZW4pOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBpZiAocHJlc2VydmVMZW5ndGgpIHsKLSAgICAgICAgICAgICAgICBjaGFyW10gYnVmID0gb2J0YWluKGxlbik7Ci0gICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBsZW47IGkrKykgewotICAgICAgICAgICAgICAgICAgICBidWZbaV0gPSAnXHVGRUZGJzsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgU3Bhbm5hYmxlU3RyaW5nIHNzID0gbmV3IFNwYW5uYWJsZVN0cmluZyhuZXcgU3RyaW5nKGJ1ZiwgMCwgbGVuKSk7Ci0gICAgICAgICAgICAgICAgcmVjeWNsZShidWYpOwotICAgICAgICAgICAgICAgIGNvcHlTcGFuc0Zyb20oc3AsIDAsIGxlbiwgT2JqZWN0LmNsYXNzLCBzcywgMCk7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIHNzOworICAgICAgICAgICAgICAgIGxlZnQgPSBtdC5icmVha1RleHQoMCwgbGVuLCB0cnVlLCBhdmFpbCk7CiAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIHJldHVybiAiIjsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCi0gICAgICAgIGlmICh3aGVyZSA9PSBUcnVuY2F0ZUF0LlNUQVJUKSB7Ci0gICAgICAgICAgICBzdW0gPSAwOwotICAgICAgICAgICAgaW50IGk7Ci0KLSAgICAgICAgICAgIGZvciAoaSA9IGxlbjsgaSA+PSAwOyBpLS0pIHsKLSAgICAgICAgICAgICAgICBmbG9hdCB3ID0gd2lkW2xlbiArIGkgLSAxXTsKLQotICAgICAgICAgICAgICAgIGlmICh3ICsgc3VtICsgZWxsaXBzaXN3aWQgPiBhdmFpbCkgewotICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICBzdW0gKz0gdzsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgaWYgKGNhbGxiYWNrICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICBjYWxsYmFjay5lbGxpcHNpemVkKDAsIGkpOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBpZiAocHJlc2VydmVMZW5ndGgpIHsKLSAgICAgICAgICAgICAgICBTcGFubmFibGVTdHJpbmcgc3MgPSBuZXcgU3Bhbm5hYmxlU3RyaW5nKGJsYW5rKHRleHQsIDAsIGkpKTsKLSAgICAgICAgICAgICAgICBjb3B5U3BhbnNGcm9tKHNwLCAwLCBsZW4sIE9iamVjdC5jbGFzcywgc3MsIDApOwotICAgICAgICAgICAgICAgIHJldHVybiBzczsKLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgU3Bhbm5hYmxlU3RyaW5nQnVpbGRlciBvdXQgPSBuZXcgU3Bhbm5hYmxlU3RyaW5nQnVpbGRlcihzRWxsaXBzaXMpOwotICAgICAgICAgICAgICAgIG91dC5pbnNlcnQoMSwgdGV4dCwgaSwgbGVuKTsKLQotICAgICAgICAgICAgICAgIHJldHVybiBvdXQ7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0gZWxzZSBpZiAod2hlcmUgPT0gVHJ1bmNhdGVBdC5FTkQpIHsKLSAgICAgICAgICAgIHN1bSA9IDA7Ci0gICAgICAgICAgICBpbnQgaTsKLQotICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IGxlbjsgaSsrKSB7Ci0gICAgICAgICAgICAgICAgZmxvYXQgdyA9IHdpZFtsZW4gKyBpXTsKLQotICAgICAgICAgICAgICAgIGlmICh3ICsgc3VtICsgZWxsaXBzaXN3aWQgPiBhdmFpbCkgewotICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICBzdW0gKz0gdzsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgaWYgKGNhbGxiYWNrICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICBjYWxsYmFjay5lbGxpcHNpemVkKGksIGxlbik7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIGlmIChwcmVzZXJ2ZUxlbmd0aCkgewotICAgICAgICAgICAgICAgIFNwYW5uYWJsZVN0cmluZyBzcyA9IG5ldyBTcGFubmFibGVTdHJpbmcoYmxhbmsodGV4dCwgaSwgbGVuKSk7Ci0gICAgICAgICAgICAgICAgY29weVNwYW5zRnJvbShzcCwgMCwgbGVuLCBPYmplY3QuY2xhc3MsIHNzLCAwKTsKLSAgICAgICAgICAgICAgICByZXR1cm4gc3M7Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIFNwYW5uYWJsZVN0cmluZ0J1aWxkZXIgb3V0ID0gbmV3IFNwYW5uYWJsZVN0cmluZ0J1aWxkZXIoc0VsbGlwc2lzKTsKLSAgICAgICAgICAgICAgICBvdXQuaW5zZXJ0KDAsIHRleHQsIDAsIGkpOwotCi0gICAgICAgICAgICAgICAgcmV0dXJuIG91dDsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfSBlbHNlIC8qIHdoZXJlID0gVHJ1bmNhdGVBdC5NSURETEUgKi8gewotICAgICAgICAgICAgZmxvYXQgbHN1bSA9IDAsIHJzdW0gPSAwOwotICAgICAgICAgICAgaW50IGxlZnQgPSAwLCByaWdodCA9IGxlbjsKLQotICAgICAgICAgICAgZmxvYXQgcmF2YWlsID0gKGF2YWlsIC0gZWxsaXBzaXN3aWQpIC8gMjsKLSAgICAgICAgICAgIGZvciAocmlnaHQgPSBsZW47IHJpZ2h0ID49IDA7IHJpZ2h0LS0pIHsKLSAgICAgICAgICAgICAgICBmbG9hdCB3ID0gd2lkW2xlbiArIHJpZ2h0IC0gMV07Ci0KLSAgICAgICAgICAgICAgICBpZiAodyArIHJzdW0gPiByYXZhaWwpIHsKLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgcnN1bSArPSB3OwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBmbG9hdCBsYXZhaWwgPSBhdmFpbCAtIGVsbGlwc2lzd2lkIC0gcnN1bTsKLSAgICAgICAgICAgIGZvciAobGVmdCA9IDA7IGxlZnQgPCByaWdodDsgbGVmdCsrKSB7Ci0gICAgICAgICAgICAgICAgZmxvYXQgdyA9IHdpZFtsZW4gKyBsZWZ0XTsKLQotICAgICAgICAgICAgICAgIGlmICh3ICsgbHN1bSA+IGxhdmFpbCkgewotICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICBsc3VtICs9IHc7CisgICAgICAgICAgICAgICAgcmlnaHQgPSBsZW4gLSBtdC5icmVha1RleHQoMCwgbGVuLCBmYWxzZSwgYXZhaWwgLyAyKTsKKyAgICAgICAgICAgICAgICBhdmFpbCAtPSBtdC5tZWFzdXJlKHJpZ2h0LCBsZW4pOworICAgICAgICAgICAgICAgIGxlZnQgPSBtdC5icmVha1RleHQoMCwgcmlnaHQsIHRydWUsIGF2YWlsKTsKICAgICAgICAgICAgIH0KIAogICAgICAgICAgICAgaWYgKGNhbGxiYWNrICE9IG51bGwpIHsKICAgICAgICAgICAgICAgICBjYWxsYmFjay5lbGxpcHNpemVkKGxlZnQsIHJpZ2h0KTsKICAgICAgICAgICAgIH0KIAorICAgICAgICAgICAgY2hhcltdIGJ1ZiA9IG10Lm1DaGFyczsKKyAgICAgICAgICAgIFNwYW5uZWQgc3AgPSB0ZXh0IGluc3RhbmNlb2YgU3Bhbm5lZCA/IChTcGFubmVkKSB0ZXh0IDogbnVsbDsKKworICAgICAgICAgICAgaW50IHJlbWFpbmluZyA9IGxlbiAtIChyaWdodCAtIGxlZnQpOwogICAgICAgICAgICAgaWYgKHByZXNlcnZlTGVuZ3RoKSB7Ci0gICAgICAgICAgICAgICAgU3Bhbm5hYmxlU3RyaW5nIHNzID0gbmV3IFNwYW5uYWJsZVN0cmluZyhibGFuayh0ZXh0LCBsZWZ0LCByaWdodCkpOworICAgICAgICAgICAgICAgIGlmIChyZW1haW5pbmcgPiAwKSB7IC8vIGVsc2UgZWxpbWluYXRlIHRoZSBlbGxpcHNpcyB0b28KKyAgICAgICAgICAgICAgICAgICAgYnVmW2xlZnQrK10gPSAnXHUyMDI2JzsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IGxlZnQ7IGkgPCByaWdodDsgaSsrKSB7CisgICAgICAgICAgICAgICAgICAgIGJ1ZltpXSA9ICdcdUZFRkYnOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBTdHJpbmcgcyA9IG5ldyBTdHJpbmcoYnVmLCAwLCBsZW4pOworICAgICAgICAgICAgICAgIGlmIChzcCA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBzOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBTcGFubmFibGVTdHJpbmcgc3MgPSBuZXcgU3Bhbm5hYmxlU3RyaW5nKHMpOwogICAgICAgICAgICAgICAgIGNvcHlTcGFuc0Zyb20oc3AsIDAsIGxlbiwgT2JqZWN0LmNsYXNzLCBzcywgMCk7CiAgICAgICAgICAgICAgICAgcmV0dXJuIHNzOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBTcGFubmFibGVTdHJpbmdCdWlsZGVyIG91dCA9IG5ldyBTcGFubmFibGVTdHJpbmdCdWlsZGVyKHNFbGxpcHNpcyk7Ci0gICAgICAgICAgICAgICAgb3V0Lmluc2VydCgwLCB0ZXh0LCAwLCBsZWZ0KTsKLSAgICAgICAgICAgICAgICBvdXQuaW5zZXJ0KG91dC5sZW5ndGgoKSwgdGV4dCwgcmlnaHQsIGxlbik7Ci0KLSAgICAgICAgICAgICAgICByZXR1cm4gb3V0OwogICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgfQogCi0gICAgcHJpdmF0ZSBzdGF0aWMgU3RyaW5nIGJsYW5rKENoYXJTZXF1ZW5jZSBzb3VyY2UsIGludCBzdGFydCwgaW50IGVuZCkgewotICAgICAgICBpbnQgbGVuID0gc291cmNlLmxlbmd0aCgpOwotICAgICAgICBjaGFyW10gYnVmID0gb2J0YWluKGxlbik7Ci0KLSAgICAgICAgaWYgKHN0YXJ0ICE9IDApIHsKLSAgICAgICAgICAgIGdldENoYXJzKHNvdXJjZSwgMCwgc3RhcnQsIGJ1ZiwgMCk7Ci0gICAgICAgIH0KLSAgICAgICAgaWYgKGVuZCAhPSBsZW4pIHsKLSAgICAgICAgICAgIGdldENoYXJzKHNvdXJjZSwgZ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gIHNzYi5hcHBlbmQodGV4dCwgcmlnaHQsIGxlbik7CisgICAgICAgICAgICByZXR1cm4gc3NiOworICAgICAgICB9IGZpbmFsbHkgeworICAgICAgICAgICAgTWVhc3VyZWRUZXh0LnJlY3ljbGUobXQpOworICAgICAgICB9CiAgICAgfQogCiAgICAgLyoqCkBAIC0xMjc4LDgwICsxMDkzLDEyMSBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRleHRQYWludCBwLCBmbG9hdCBhdmFpbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTdHJpbmcgb25lTW9yZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTdHJpbmcgbW9yZSkgewotICAgICAgICBpbnQgbGVuID0gdGV4dC5sZW5ndGgoKTsKLSAgICAgICAgY2hhcltdIGJ1ZiA9IG5ldyBjaGFyW2xlbl07Ci0gICAgICAgIFRleHRVdGlscy5nZXRDaGFycyh0ZXh0LCAwLCBsZW4sIGJ1ZiwgMCk7CiAKLSAgICAgICAgaW50IGNvbW1hQ291bnQgPSAwOwotICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGxlbjsgaSsrKSB7Ci0gICAgICAgICAgICBpZiAoYnVmW2ldID09ICcsJykgewotICAgICAgICAgICAgICAgIGNvbW1hQ291bnQrKzsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCi0gICAgICAgIGZsb2F0W10gd2lkOwotCi0gICAgICAgIGlmICh0ZXh0IGluc3RhbmNlb2YgU3Bhbm5lZCkgewotICAgICAgICAgICAgU3Bhbm5lZCBzcCA9IChTcGFubmVkKSB0ZXh0OwotICAgICAgICAgICAgVGV4dFBhaW50IHRlbXBwYWludCA9IG5ldyBUZXh0UGFpbnQoKTsKLSAgICAgICAgICAgIHdpZCA9IG5ldyBmbG9hdFtsZW4gKiAyXTsKLQotICAgICAgICAgICAgaW50IG5leHQ7Ci0g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A9ICIiOwotCi0gICAgICAgIGludCB3ID0gMDsKLSAgICAgICAgaW50IGNvdW50ID0gMDsKLQotICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGxlbjsgaSsrKSB7Ci0gICAgICAgICAgICB3ICs9IHdpZFtpXTsKLQotICAgICAgICAgICAgaWYgKGJ1ZltpXSA9PSAnLCcpIHsKLSAgICAgICAgICAgICAgICBjb3VudCsrOwotCi0gICAgICAgICAgICAgICAgaW50IHJlbWFpbmluZyA9IGNvbW1hQ291bnQgLSBjb3VudCArIDE7Ci0gICAgICAgICAgICAgICAgZmxvYXQgbW9yZVdpZDsKLSAgICAgICAgICAgICAgICBTdHJpbmcgZm9ybWF0OwotCi0gICAgICAgICAgICAgICAgaWYgKHJlbWFpbmluZyA9PSAxKSB7Ci0gICAgICAgICAgICAgICAgICAgIGZvcm1hdCA9ICIgIiArIG9uZU1vcmU7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgZm9ybWF0ID0gIiAiICsgU3RyaW5nLmZvcm1hdChtb3JlLCByZW1haW5pbmcpOwotICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgIG1vcmVXaWQgPSBwLm1lYXN1cmVUZXh0KGZvcm1hdCk7Ci0KLSAgICAgICAgICAgICAgICBpZiAodyArIG1vcmVXaWQgPD0gYXZhaWwpIHsKLSAgICAgICAgICAgICAgICAgICAgb2sgPSBpICsgMTsKLSAgICAgICAgICAgICAgICAgICAgb2tSZW1haW5pbmcgPSByZW1haW5pbmc7Ci0gICAgICAgICAgICAgICAgICAgIG9rRm9ybWF0ID0gZm9ybWF0OworICAgICAgICAgICAgaW50IGNvbW1hQ291bnQgPSAwOworICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBsZW47IGkrKykgeworICAgICAgICAgICAgICAgIGlmIChidWZbaV0gPT0gJywnKSB7CisgICAgICAgICAgICAgICAgICAgIGNvbW1hQ291bnQrKzsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9Ci0gICAgICAgIH0KIAotICAgICAgICBpZiAodyA8PSBhdmFpbCkgewotICAgICAgICAgICAgcmV0dXJuIHRleHQ7Ci0gICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBpbnQgcmVtYWluaW5nID0gY29tbWFDb3VudCArIDE7CisKKyAgICAgICAgICAgIGludCBvayA9IDA7CisgICAgICAgICAgICBpbnQgb2tSZW1haW5pbmcgPSByZW1haW5pbmc7CisgICAgICAgICAgICBTdHJpbmcgb2tGb3JtYXQgPSAiIjsKKworICAgICAgICAgICAgaW50IHcgPSAwOworICAgICAgICAgICAgaW50IGNvdW50ID0gMDsKKyAgICAgICAgICAgIGZsb2F0W10gd2lkdGhzID0gbXQubVdpZHRoczsKKworICAgICAgICAgICAgaW50IHJlcXVlc3QgPSBtdC5tRGlyID09IDEgPyBMYXlvdXQuRElSX1JFUVVFU1RfTFRSIDoKKyAgICAgICAgICAgICAgICBMYXlvdXQuRElSX1JFUVVFU1RfUlRMOworCisgICAgICAgICAgICBNZWFzdXJlZFRleHQgdGVtcE10ID0gTWVhc3VyZWRUZXh0Lm9idGFpbigpOworICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBsZW47IGkrKykgeworICAgICAgICAgICAgICAgIHcgKz0gd2lkdGhzW2ldOworCisgICAgICAgICAgICAgICAgaWYgKGJ1ZltpXSA9PSAnLCcpIHsKKyAgICAgICAgICAgICAgICAgICAgY291bnQrKzsKKworICAgICAgICAgICAgICAgICAgICBTdHJpbmcgZm9ybWF0OworICAgICAgICAgICAgICAgICAgICAvLyBYWFggc2hvdWxkIG5vdCBpbnNlcnQgc3BhY2VzLCBzaG91bGQgYmUgcGFydCBvZiBzdHJpbmcKKyAgICAgICAgICAgICAgICAgICAgLy8gWFhYIHNob3VsZCB1c2UgcGx1cmFsIHJ1bGVzIGFuZCBub3QgYXNzdW1lIEVuZ2xpc2ggcGx1cmFscworICAgICAgICAgICAgICAgICAgICBpZiAoLS1yZW1haW5pbmcgPT0gMSkgeworICAgICAgICAgICAgICAgICAgICAgICAgZm9ybWF0ID0gIiAiICsgb25lTW9yZTsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGZvcm1hdCA9ICIgIiArIFN0cmluZy5mb3JtYXQobW9yZSwgcmVtYWluaW5nKTsKKyAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgIC8vIFhYWCB0aGlzIGlzIHByb2JhYmx5IG9rLCBidXQgbmVlZCB0byBsb29rIGF0IGl0IG1vcmUKKyAgICAgICAgICAgICAgICAgICAgdGVtcE10LnNldFBhcmEoZm9ybWF0LCAwLCBmb3JtYXQubGVuZ3RoKCksIHJlcXVlc3QpOworICAgICAgICAgICAgICAgICAgICBmbG9hdCBtb3JlV2lkID0gbXQuYWRkU3R5bGVSdW4ocCwgbXQubUxlbiwgbnVsbCk7CisKKyAgICAgICAgICAgICAgICAgICAgaWYgKHcgKyBtb3JlV2lkIDw9IGF2YWlsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBvayA9IGkgKyAxOworICAgICAgICAgICAgICAgICAgICAgICAgb2tSZW1haW5pbmcgPSByZW1haW5pbmc7CisgICAgICAgICAgICAgICAgICAgICAgICBva0Zvcm1hdCA9IGZvcm1hdDsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIE1lYXN1cmVkVGV4dC5yZWN5Y2xlKHRlbXBNdCk7CisKICAgICAgICAgICAgIFNwYW5uYWJsZVN0cmluZ0J1aWxkZXIgb3V0ID0gbmV3IFNwYW5uYWJsZVN0cmluZ0J1aWxkZXIob2tGb3JtYXQpOwogICAgICAgICAgICAgb3V0Lmluc2VydCgwLCB0ZXh0LCAwLCBvayk7CiAgICAgICAgICAgICByZXR1cm4gb3V0OworICAgICAgICB9IGZpbmFsbHkgeworICAgICAgICAgICAgTWVhc3VyZWRUZXh0LnJlY3ljbGUobXQpOwogICAgICAgICB9CiAgICAgfQogCisgICAgcHJpdmF0ZSBzdGF0aWMgZmxvYXQgc2V0UGFyYShNZWFzdXJlZFRleHQgbXQsIFRleHRQYWludCBwYWludCwKKyAgICAgICAgICAgIENoYXJTZXF1ZW5jZSB0ZXh0LCBpbnQgc3RhcnQsIGludCBlbmQsIGludCBiaWRpUmVxdWVzdCkgeworCisgICAgICAgIG10LnNldFBhcmEodGV4dCwgc3RhcnQsIGVuZCwgYmlkaVJlcXVlc3QpOworCisgICAgICAgIGZsb2F0IHdpZHRoOworICAgICAgICBTcGFubmVkIHNwID0gdGV4dCBpbnN0YW5jZW9mIFNwYW5uZWQgPyAoU3Bhbm5lZCkgdGV4dCA6IG51bGw7CisgICAgICAgIGludCBsZW4gPSBlbmQgLSBzdGFydDsKKyAgICAgICAgaWYgKHNwID09IG51bGwpIHsKKyAgICAgICAgICAgIHdpZHRoID0gbXQuYWRkU3R5bGVSdW4ocGFpbnQsIGxlbiwgbnVsbCk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICB3aWR0aCA9IDA7CisgICAgICAgICAgICBpbnQgc3BhbkVuZDsKKyAgICAgICAgICAgIGZvciAoaW50IHNwYW5TdGFydCA9IDA7IHNwYW5TdGFydCA8IGxlbjsgc3BhblN0YXJ0ID0gc3BhbkVuZCkgeworICAgICAgICAgICAgICAgIHNwYW5FbmQgPSBzcC5uZXh0U3BhblRyYW5zaXRpb24oc3BhblN0YXJ0LCBsZW4sCisgICAgICAgICAgICAgICAgICAgICAgICBNZXRyaWNBZmZlY3RpbmdTcGFuLmNsYXNzKTsKKyAgICAgICAgICAgICAgICBNZXRyaWNBZmZlY3RpbmdTcGFuW10gc3BhbnMgPSBzcC5nZXRTcGFucygKKyAgICAgICAgICAgICAgICAgICAgICAgIHNwYW5TdGFydCwgc3BhbkVuZCwgTWV0cmljQWZmZWN0aW5nU3Bhbi5jbGFzcyk7CisgICAgICAgICAgICAgICAgd2lkdGggKz0gbXQuYWRkU3R5bGVSdW4ocGFpbnQsIHNwYW5zLCBzcGFuRW5kIC0gc3BhblN0YXJ0LCBudWxsKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHJldHVybiB3aWR0aDsKKyAgICB9CisKKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBjaGFyIEZJUlNUX1JJR0hUX1RPX0xFRlQgPSAnXHUwNTkwJzsKKworICAgIC8qIHBhY2thZ2UgKi8KKyAgICBzdGF0aWMgYm9vbGVhbiBkb2VzTm90TmVlZEJpZGkoQ2hhclNlcXVlbmNlIHMsIGludCBzdGFydCwgaW50IGVuZCkgeworICAgICAgICBmb3IgKGludCBpID0gc3RhcnQ7IGkgPCBlbmQ7IGkrKykgeworICAgICAgICAgICAgaWYgKHMuY2hhckF0KGkpID49IEZJUlNUX1JJR0hUX1RPX0xFRlQpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIHRydWU7CisgICAgfQorCisgICAgLyogcGFja2FnZSAqLworICAgIHN0YXRpYyBib29sZWFuIGRvZXNOb3ROZWVkQmlkaShjaGFyW10gdGV4dCwgaW50IHN0YXJ0LCBpbnQgbGVuKSB7CisgICAgICAgIGZvciAoaW50IGkgPSBzdGFydCwgZSA9IGkgKyBsZW47IGkgPCBlOyBpKyspIHsKKyAgICAgICAgICAgIGlmICh0ZXh0W2ldID49IEZJUlNUX1JJR0hUX1RPX0xFRlQpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIHRydWU7CisgICAgfQorCiAgICAgLyogcGFja2FnZSAqLyBzdGF0aWMgY2hhcltdIG9idGFpbihpbnQgbGVuKSB7CiAgICAgICAgIGNoYXJbXSBidWY7CiAKQEAgLTE1MjksNyArMT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8fAotICAgICAgICAgICAgICAgICAgICAgIChNZXRhS2V5S2V5TGlzdGVuZXIuZ2V0TWV0YVN0YXRlKGJ1ZmZlciwKLSAgICAgICAgICAgICAgICAgICAgICAgIE1ldGFLZXlLZXlMaXN0ZW5lci5NRVRBX1NFTEVDVElORykgIT0gMCk7Ci0gICAgICAgIGJvb2xlYW4gYWx0ID0gTWV0YUtleUtleUxpc3RlbmVyLmdldE1ldGFTdGF0ZShidWZmZXIsCi0gICAgICAgICAgICAgICAgICAgICAgICBLZXlFdmVudC5NRVRBX0FMVF9PTikgPT0gMTsKKyAgICAgICAgYm9vbGVhbiBjYXAgPSBpc0NhcChidWZmZXIpOworICAgICAgICBib29sZWFuIGFsdCA9IGlzQWx0KGJ1ZmZlcik7CiAgICAgICAgIExheW91dCBsYXlvdXQgPSB3aWRnZXQuZ2V0TGF5b3V0KCk7CiAKICAgICAgICAgaWYgKGNhcCkgewpAQCAtNjAsMTIgKzY4LDggQEAKICAgICB9CiAKICAgICBwcml2YXRlIGJvb2xlYW4gZG93bihUZXh0VmlldyB3aWRnZXQsIFNwYW5uYWJsZSBidWZmZXIpIHsKLSAgICAgICAgYm9vbGVhbiBjYXAgPSAoTWV0YUtleUtleUxpc3RlbmVyLmdldE1ldGFTdGF0ZShidWZmZXIsCi0gICAgICAgICAgICAgICAgICAgICAgICBLZXlFdmVudC5NRVRBX1NISUZUX09OKSA9PSAxKSB8fAotICAgICAgICAgICAgICAgICAgICAgIChNZXRhS2V5S2V5TGlzdGVuZXIuZ2V0TWV0YVN0YXRlKGJ1ZmZlciwKLSAgICAgICAgICAgICAgICAgICAgICAgIE1ldGFLZXlLZXlMaXN0ZW5lci5NRVRBX1NFTEVDVElORykgIT0gMCk7Ci0gICAgICAgIGJvb2xlYW4gYWx0ID0gTWV0YUtleUtleUxpc3RlbmVyLmdldE1ldGFTdGF0ZShidWZmZXIsCi0gICAgICAgICAgICAgICAgICAgICAgICBLZXlFdmVudC5NRVRBX0FMVF9PTikgPT0gMTsKKyAgICAgICAgYm9vbGVhbiBjYXAgPSBpc0NhcChidWZmZXIpOworICAgICAgICBib29sZWFuIGFsdCA9IGlzQWx0KGJ1ZmZlcik7CiAgICAgICAgIExheW91dCBsYXlvdXQgPSB3aWRnZXQuZ2V0TGF5b3V0KCk7CiAKICAgICAgICAgaWYgKGNhcCkgewpAQCAtODYsMTIgKzkwLDggQEAKICAgICB9CiAKICAgICBwcml2YXRlIGJvb2xlYW4gbGVmdChUZXh0VmlldyB3aWRnZXQsIFNwYW5uYWJsZSBidWZmZXIpIHsKLSAgICAgICAgYm9vbGVhbiBjYXAgPSAoTWV0YUtleUtleUxpc3RlbmVyLmdldE1ldGFTdGF0ZShidWZmZXIsCi0gICAgICAgICAgICAgICAgICAgICAgICBLZXlFdmVudC5NRVRBX1NISUZUX09OKSA9PSAxKSB8fAotICAgICAgICAgICAgICAgICAgICAgIChNZXRhS2V5S2V5TGlzdGVuZXIuZ2V0TWV0YVN0YXRlKGJ1ZmZlciwKLSAgICAgICAgICAgICAgICAgICAgICAgIE1ldGFLZXlLZXlMaXN0ZW5lci5NRVRBX1NFTEVDVElORykgIT0gMCk7Ci0gICAgICAgIGJvb2xlYW4gYWx0ID0gTWV0YUtleUtleUxpc3RlbmVyLmdldE1ldGFTdGF0ZShidWZmZXIsCi0gICAgICAgICAgICAgICAgICAgICAgICBLZXlFdmVudC5NRVRBX0FMVF9PTikgPT0gMTsKKyAgICAgICAgYm9vbGVhbiBjYXAgPSBpc0NhcChidWZmZXIpOworICAgICAgICBib29sZWFuIGFsdCA9IGlzQWx0KGJ1ZmZlcik7CiAgICAgICAgIExheW91dCBsYXlvdXQgPSB3aWRnZXQuZ2V0TGF5b3V0KCk7CiAKICAgICAgICAgaWYgKGNhcCkgewpAQCAtMTEwLDEyICsxMTAsOCBAQAogICAgIH0KIAogICAgIHByaXZhdGUgYm9vbGVhbiByaWdodChUZXh0VmlldyB3aWRnZXQsIFNwYW5uYWJsZSBidWZmZXIpIHsKLSAgICA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KICAgICAgICAgaWYgKGV4ZWN1dGVEb3duKHdpZGdldCwgYnVmZmVyLCBrZXlDb2RlKSkgewogICAgICAgICAgICAgTWV0YUtleUtleUxpc3RlbmVyLmFkanVzdE1ldGFBZnRlcktleXByZXNzKGJ1ZmZlcik7CkBAIC0xOTMsMTAgKzE2MCw5IEBACiAgICAgICAgICAgICBicmVhazsKIAogICAgICAgICBjYXNlIEtleUV2ZW50LktFWUNPREVfRFBBRF9DRU5URVI6Ci0gICAgICAgICAgICBpZiAoTWV0YUtleUtleUxpc3RlbmVyLmdldE1ldGFTdGF0ZShidWZmZXIsIE1ldGFLZXlLZXlMaXN0ZW5lci5NRVRBX1NFTEVDVElORykgIT0gMCkgewotICAgICAgICAgICAgICAgIGlmICh3aWRnZXQuc2hvd0NvbnRleHRNZW51KCkpIHsKKyAgICAgICAgICAgIGlmICgoTWV0YUtleUtleUxpc3RlbmVyLmdldE1ldGFTdGF0ZShidWZmZXIsIE1ldGFLZXlLZXlMaXN0ZW5lci5NRVRBX1NFTEVDVElORykgIT0gMCkgJiYKKyAgICAgICAgICAgICAgICAod2lkZ2V0LnNob3dDb250ZXh0TWVudSgpKSkgewogICAgICAgICAgICAgICAgICAgICBoYW5kbGVkID0gdHJ1ZTsKLSAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KIApAQCAtMjE0LDggKzE4MCw3IEBACiAKICAgICBwdWJsaWMgYm9vbGVhbiBvbktleU90aGVyKFRleHRWaWV3IHZpZXcsIFNwYW5uYWJsZSB0ZXh0LCBLZXlFdmVudCBldmVudCkgewogICAgICAgICBpbnQgY29kZSA9IGV2ZW50LmdldEtleUNvZGUoKTsKLSAgICAgICAgaWYgKGNvZGUgIT0gS2V5RXZlbnQuS0VZQ09ERV9VTktOT1dOCi0gICAgICAgICAgICAgICAgJiYgZXZlbnQuZ2V0QWN0aW9uKCkgPT0gS2V5RXZlbnQuQUNUSU9OX01VTFRJUExFKSB7CisgICAgICAgIGlmIChjb2RlICE9IEtleUV2ZW50LktFWUNPREVfVU5LTk9XTiAmJiBldmVudC5nZXRBY3Rpb24oKSA9PSBLZXlFdmVudC5BQ1RJT05fTVVMVElQTEUpIHsKICAgICAgICAgICAgIGludCByZXBlYXQgPSBldmVudC5nZXRSZXBlYXRDb3VudCgpOwogICAgICAgICAgICAgYm9vbGVhbiBoYW5kbGVkID0gZmFsc2U7CiAgICAgICAgICAgICB3aGlsZSAoKC0tcmVwZWF0KSA+IDApIHsKQEAgLTIyNiwxMyArMTkxLDIyIEBACiAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICB9CiAKLSAgICBwdWJsaWMgYm9vbGVhbiBvblRyYWNrYmFsbEV2ZW50KFRleHRWaWV3IHdpZGdldCwgU3Bhbm5hYmxlIHRleHQsCi0gICAgICAgICAgICBNb3Rpb25FdmVudCBldmVudCkgeworICAgIHB1YmxpYyBib29sZWFuIG9uVHJhY2tiYWxsRXZlbnQoVGV4dFZpZXcgd2lkZ2V0LCBTcGFubmFibGUgdGV4dCwgTW90aW9uRXZlbnQgZXZlbnQpIHsKKyAgICAgICAgaWYgKG1DdXJzb3JDb250cm9sbGVyICE9IG51bGwpIHsKKyAgICAgICAgICAgIG1DdXJzb3JDb250cm9sbGVyLmhpZGUoKTsKKyAgICAgICAgfQogICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgfQogCi0gICAgcHVibGljIGJvb2xlYW4gb25Ub3VjaEV2ZW50KFRleHRWaWV3IHdpZGdldCwgU3Bhbm5hYmxlIGJ1ZmZlciwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTW90aW9uRXZlbnQgZXZlbnQpIHsKKyAgICBwdWJsaWMgYm9vbGVhbiBvblRvdWNoRXZlbnQoVGV4dFZpZXcgd2lkZ2V0LCBTcGFubmFibGUgYnVmZmVyLCBNb3Rpb25FdmVudCBldmVudCkgeworICAgICAgICBpZiAobUN1cnNvckNvbnRyb2xsZXIgIT0gbnVsbCkgeworICAgICAgICAgICAgcmV0dXJuIG9uVG91Y2hFdmVudEN1cnNvcih3aWRnZXQsIGJ1ZmZlciwgZXZlbnQpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgcmV0dXJuIG9uVG91Y2hFdmVudFN0YW5kYXJkKHdpZGdldCwgYnVmZmVyLCBldmVudCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcml2YXRlIGJvb2xlYW4gb25Ub3VjaEV2ZW50U3RhbmRhcmQoVGV4dFZpZXcgd2lkZ2V0LCBTcGFubmFibGUgYnVmZmVyLCBNb3Rpb25FdmVudCBldmVudCkgewogICAgICAgICBpbnQgaW5pdGlhbFNjcm9sbFggPSAtMSwgaW5pdGlhbFNjcm9sbFkgPSAtMTsKICAgICAgICAgaWYgKGV2ZW50LmdldEFjdGlvbigpID09IE1vdGlvbkV2ZW50LkFDVElPTl9VUCkgewogICAgICAgICAgICAgaW5pdGlhbFNjcm9sbFggPSBUb3VjaC5nZXRJbml0aWFsU2Nyb2xsWCh3aWRnZXQsIGJ1ZmZlcik7CkBAIC0yNDMsNTMgKzIxNywyMCBAQAogCiAgICAgICAgIGlmICh3aWRnZXQuaXNGb2N1c2VkKCkgJiYgIXdpZGdldC5kaWRUb3VjaEZvY3VzU2VsZWN0KCkpIHsKICAgICAgICAgICAgIGlmIChldmVudC5nZXRBY3Rpb24oKSA9PSBNb3Rpb25FdmVudC5BQ1RJT05fRE9XTikgewotICAgICAgICAgICAgICBib29sZWFuIGNhcCA9IChNZXRhS2V5S2V5TGlzdGVuZXIuZ2V0TWV0YVN0YXRlKGJ1ZmZlciwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEtleUV2ZW50Lk1FVEFfU0hJRlRfT04pID09IDEpIHx8Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgKE1ldGFLZXlLZXlMaXN0ZW5lci5nZXRNZXRhU3RhdGUoYnVmZmVyLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTWV0YUtleUtleUxpc3Rlbm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dG8gc2Nyb2xsLgogICAgICAgICAgICAgICAgICAgd2lkZ2V0LmdldFBhcmVudCgpLnJlcXVlc3REaXNhbGxvd0ludGVyY2VwdFRvdWNoRXZlbnQodHJ1ZSk7Ci0gICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICBPbmVQb2ludEZpdmVUYXBTdGF0ZVtdIHRhcCA9IGJ1ZmZlci5nZXRTcGFucygwLCBidWZmZXIubGVuZ3RoKCksCi0gICAgICAgICAgICAgICAgICAgICAgT25lUG9pbnRGaXZlVGFwU3RhdGUuY2xhc3MpOwotCi0gICAgICAgICAgICAgICAgICBpZiAodGFwLmxlbmd0aCA+IDApIHsKLSAgICAgICAgICAgICAgICAgICAgICBpZiAoZXZlbnQuZ2V0RXZlbnRUaW1lKCkgLSB0YXBbMF0ubVdoZW4gPD0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgVmlld0NvbmZpZ3VyYXRpb24uZ2V0RG91YmxlVGFwVGltZW91dCgpICYmCi0gICAgICAgICAgICAgICAgICAgICAgICAgIHNhbWVXb3JkKGJ1ZmZlciwgb2Zmc2V0LCBTZWxlY3Rpb24uZ2V0U2VsZWN0aW9uRW5kKGJ1ZmZlcikpKSB7Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgdGFwWzBdLmFjdGl2ZSA9IHRydWU7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgIE1ldGFLZXlLZXlMaXN0ZW5lci5zdGFydFNlbGVjdGluZyh3aWRnZXQsIGJ1ZmZlcik7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgIHdpZGdldC5nZXRQYXJlbnQoKS5yZXF1ZXN0RGlzYWxsb3dJbnRlcmNlcHRUb3VjaEV2ZW50KHRydWUpOwotICAgICAgICAgICAgICAgICAgICAgICAgICBidWZmZXIuc2V0U3BhbihMQVNUX1RBUF9ET1dOLCBvZmZzZXQsIG9mZnNldCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNwYW5uYWJsZS5TUEFOX1BPSU5UX1BPSU5UKTsKLSAgICAgICAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICAgICAgICB0YXBbMF0ubVdoZW4gPSBldmVudC5nZXRFdmVudFRpbWUoKTsKLSAgICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgICAgT25lUG9pbnRGaXZlVGFwU3RhdGUgbmV3dGFwID0gbmV3IE9uZVBvaW50Rml2ZVRhcFN0YXRlKCk7Ci0gICAgICAgICAgICAgICAgICAgICAgbmV3dGFwLm1XaGVuID0gZXZlbnQuZ2V0RXZlbnRUaW1lKCk7Ci0gICAgICAgICAgICAgICAgICAgICAgbmV3dGFwLmFjdGl2ZSA9IGZhbHNlOwotICAgICAgICAgICAgICAgICAgICAgIGJ1ZmZlci5zZXRTcGFuKG5ld3RhcCwgMCwgYnVmZmVyLmxlbmd0aCgpLAotICAgICAgICAgICAgICAgICAgICAgICAgICBTcGFubmFibGUuU1BBTl9JTkNMVVNJVkVfSU5DTFVTSVZFKTsKLSAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfSBlbHNlIGlmIChldmVudC5nZXRBY3Rpb24oKSA9PSBNb3Rpb25FdmVudC5BQ1RJT05fTU9WRSkgewotICAgICAgICAgICAgICAgIGJvb2xlYW4gY2FwID0gKE1ldGFLZXlLZXlMaXN0ZW5lci5nZXRNZXRhU3RhdGUoYnVmZmVyLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBLZXlFdmVudC5NRVRBX1NISUZUX09OKSA9PSAxKSB8fAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKE1ldGFLZXlLZXlMaXN0ZW5lci5nZXRNZXRhU3RhdGUoYnVmZmVyLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNZXRhS2V5S2V5TGlzdGVuZXIuTUVUQV9TRUxFQ1RJTkcpICE9IDApOworICAgICAgICAgICAgICAgIGJvb2xlYW4gY2FwID0gaXNDYXAoYnVmZmVyKTsKIAogICAgICAgICAgICAgICAgIGlmIChjYXAgJiYgaGFuZGxlZCkgewogICAgICAgICAgICAgICAgICAgICAvLyBCZWZvcmUgc2VsZWN0aW5nLCBtYWtlIHN1cmUgd2UndmUgbW92ZWQgb3V0IG9mIHRoZSAic2xvcCIuCkBAIC0yOTcsNDUgKzIzOCwxNSBAQAogICAgICAgICAgICAgICAgICAgICAvLyBPVVQgb2YgdGhlIHNsb3AKIAogICAgICAgICAgICAgICAgICAgICAvLyBUdXJuIGxvbmcgcHJlc3Mgb2ZmIHdoaWxlIHdlJ3JlIHNlbGVjdGluZy4gVXNlciBuZWVkcyB0bwotICAgICAgICAgICAgICAgICAgICAvLyByZS10YXAgb24gdGhlIHNlbGVjdGlvbiB0byBlbmFibGUgbG9uZ3ByZXNzCisgICAgICAgICAgICAgICAgICAgIC8vIHJlLXRhcCBvbiB0aGUgc2VsZWN0aW9uIHRvIGVuYWJsZSBsb25nIHByZXNzCiAgICAgICAgICAgICAgICAgICAgIHdpZGdldC5jYW5jZWxMb25nUHJlc3MoKTsKIAogICAgICAgICAgICAgICAgICAgICAvLyBVcGRhdGUgc2VsZWN0aW9uIGFzIHdlJ3JlIG1vdmluZyB0aGUgc2VsZWN0aW9uIGFyZWEuCiAKICAgICAgICAgICAgICAgICAgICAgLy8gR2V0IHRoZSBjdXJyZW50IHRvdWNoIHBvc2l0aW9uCi0gICAgICAgICAgICAgICAgICAgIGludCB4ID0gKGludCkgZXZlbnQuZ2V0WCgpOwotICAgICAgICAgICAgICAgICAgICBpbnQgeSA9IChpbnQpIGV2ZW50LmdldFkoKTsKLSAgICAgICAgICAgICAgICAgICAgaW50IG9mZnNldCA9IGdldE9mZnNldCh4LCB5LCB3aWRnZXQpOworICAgICAgICAgICAgICAgICAgICBpbnQgb2Zmc2V0ID0gd2lkZ2V0LmdldE9mZnNldCgoaW50KSBldmVudC5nZXRYKCksIChpbnQpIGV2ZW50LmdldFkoKSk7CiAKLSAgICAgICAgICAgICAgICAgICAgZmluYWwgT25lUG9pbnRGaXZlVGFwU3RhdGVbXSB0YXAgPSBidWZmZXIuZ2V0U3BhbnMoMCwgYnVmZmVyLmxlbmd0aCgpLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9uZVBvaW50Rml2ZVRhcFN0YXRlLmNsYXNzKTsKLQotICAgICAgICAgICAgICAgICAgICBpZiAodGFwLmxlbmd0aCA+IDAgJiYgdGFwWzBdLmFjdGl2ZSkgewotICAgICAgICAgICAgICAgICAgICAgICAgLy8gR2V0IHRoZSBsYXN0IGRvd24gdG91Y2ggcG9zaXRpb24gKHRoZSBwb3NpdGlvbiBhdCB3aGljaCB0aGUKLSAgICAgICAgICAgICAgICAgICAgICAgIC8vIHVzZXIgc3RhcnRlZCB0aGUgc2VsZWN0aW9uKQotICAgICAgICAgICAgICAgICAgICAgICAgaW50IGxhc3REb3duT2Zmc2V0ID0gYnVmZmVyLmdldFNwYW5TdGFydChMQVNUX1RBUF9ET1dOKTsKLQotICAgICAgICAgICAgICAgICAgICAgICAgLy8gQ29tcHV0ZSB0aGUgc2VsZWN0aW9uIGJvdW5kYXJpZXMKLSAgICAgICAgICAgICAgICAgICAgICAgIGludCBzcGFuc3RhcnQ7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpbnQgc3BhbmVuZDsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChvZmZzZXQgPj0gbGFzdERvd25PZmZzZXQpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBFeHBhbmQgZnJvbSB3b3JkIHN0YXJ0IG9mIHRoZSBvcmlnaW5hbCB0YXAgdG8gbmV3IHdvcmQKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBlbmQsIHNpbmNlIHdlIGFyZSBzZWxlY3RpbmcgImZvcndhcmRzIgotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNwYW5zdGFydCA9IGZpbmRXb3JkU3RhcnQoYnVmZmVyLCBsYXN0RG93bk9mZnNldCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgc3BhbmVuZCA9IGZpbmRXb3JkRW5kKGJ1ZmZlciwgb2Zmc2V0KTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gRXhwYW5kIHRvIGZyb20gbmV3IHdvcmQgc3RhcnQgdG8gd29yZCBlbmQgb2YgdGhlIG9yaWdpbmFsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gdGFwIHNpbmNlIHdlIGFyZSBzZWxlY3RpbmcgImJhY2t3YXJkcyIuCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gVGhlIHNwYW5lbmQgd2lsbCBhbHdheXMgbmVlZCB0byBiZSBhc3NvY2lhdGVkIHdpdGggdGhlIHRvdWNoCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gdXAgcG9zaXRpb24sIHNvIHRoYXQgcmVmaW5pbmcgdGhlIHNlbGVjdGlvbiB3aXRoIHRoZQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHRyYWNrYmFsbCB3aWxsIHdvcmsgYXMgZXhwZWN0ZWQuCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgc3BhbnN0YXJ0ID0gZmluZFdvcmRFbmQoYnVmZmVyLCBsYXN0RG93bk9mZnNldCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgc3BhbmVuZCA9IGZpbmRXb3JkU3RhcnQoYnVmZmVyLCBvZmZzZXQpOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgU2VsZWN0aW9uLnNldFNlbGVjdGlvbihidWZmZXIsIHNwYW5zdGFydCwgc3BhbmVuZCk7Ci0gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBTZWxlY3Rpb24uZXh0ZW5kU2VsZWN0aW9uKGJ1ZmZlciwgb2Zmc2V0KTsKLSAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBTZWxlY3Rpb24uZXh0ZW5kU2VsZWN0aW9uKGJ1ZmZlciwgb2Zmc2V0KTsKICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfSBlbHNlIGlmIChldmVudC5nZXRBY3Rpb24oKSA9PSBNb3Rpb25FdmVudC5BQ1RJT05fVVApIHsKQEAgLTM0NCw3MCArMjU1LDE3IEBACiAgICAgICAgICAgICAgICAgLy8gdGhlIGN1cnJlbnQgc2Nyb2xsIG9mZnNldCB0byBhdm9pZCB0aGUgc2Nyb2xsIGp1bXBpbmcgbGF0ZXIKICAgICAgICAgICAgICAgICAvLyB0byBzaG93IGl0LgogICAgICAgICAgICAgICAgIGlmICgoaW5pdGlhbFNjcm9sbFkgPj0gMCAmJiBpbml0aWFsU2Nyb2xsWSAhPSB3aWRnZXQuZ2V0U2Nyb2xsWSgpKSB8fAotICAgICAgICAgICAgICAgICAgICAgICAgKGluaXRpYWxTY3JvbGxYID49IDAgJiYgaW5pdGlhbFNjcm9sbFggIT0gd2lkZ2V0LmdldFNjcm9sbFgoKSkpIHsKKyAgICAgICAgICAgICAgICAgICAgKGluaXRpYWxTY3JvbGxYID49IDAgJiYgaW5pdGlhbFNjcm9sbFggIT0gd2lkZ2V0LmdldFNjcm9sbFgoKSkpIHsKICAgICAgICAgICAgICAgICAgICAgd2lkZ2V0Lm1vdmVDdXJzb3JUb1Zpc2libGVPZmZzZXQoKTsKICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICAgICAgICAgfQogCi0gICAgICAgICAgICAgICAgaW50IHggPSAoaW50KSBldmVudC5nZXRYKCk7Ci0gICAgICAgICAgICAgICAgaW50IHkgPSAoaW50KSBldmVudC5nZXRZKCk7Ci0gICAgICAgICAgICAgICAgaW50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gICAgICAgICAgICAgICAgICAgICBidWZmZXIucmVtb3ZlU3BhbihvbmVwb2ludGZpdmV0YXBbaV0pOwotICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaW50IG9mZnNldCA9IHdpZGdldC5nZXRPZmZzZXQoKGludCkgZXZlbnQuZ2V0WCgpLCAoaW50KSBldmVudC5nZXRZKCkpOworICAgICAgICAgICAgICAgIGlmIChpc0NhcChidWZmZXIpKSB7CiAgICAgICAgICAgICAgICAgICAgIGJ1ZmZlci5yZW1vdmVTcGFuKExBU1RfVEFQX0RPV04pOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBib29sZWFuIGNhcCA9IChNZXRhS2V5S2V5TGlzdGVuZXIuZ2V0TWV0YVN0YXRlKGJ1ZmZlciwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgS2V5RXZlbnQuTUVUQV9TSElGVF9PTikgPT0gMSkgfHwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChNZXRhS2V5S2V5TGlzdGVuZXIuZ2V0TWV0YVN0YXRlKGJ1ZmZlciwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTWV0YUtleUtleUxpc3RlbmVyLk1FVEFfU0VMRUNUSU5HKSAhPSAwKTsKLQotICAgICAgICAgICAgICAgIERvdWJsZVRhcFN0YXRlW10gdGFwID0gYnVmZmVyLmdldFNwYW5zKDAsIGJ1ZmZlci5sZW5ndGgoKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBEb3VibGVUYXBTdGF0ZS5jbGFzcyk7Ci0gICAgICAgICAgICAgICAgYm9vbGVhbiBkb3VibGV0YXAgPSBmYWxzZTsKLQotICAgICAgICAgICAgICAgIGlmICh0YXAubGVuZ3RoID4gMCkgewotICAgICAgICAgICAgICAgICAgICBpZiAoZXZlbnQuZ2V0RXZlbnRUaW1lKCkgLSB0YXBbMF0ubVdoZW4gPD0KLSAgICAgICAgICAgICAgICAgICAgICAgIFZpZXdDb25maWd1cmF0aW9uLmdldERvdWJsZVRhcFRpbWVvdXQoKSAmJgotICAgICAgICAgICAgICAgICAgICAgICAgc2FtZVdvcmQoYnVmZmVyLCBvZmYsIFNlbGVjdGlvbi5nZXRTZWxlY3Rpb25FbmQoYnVmZmVyKSkpIHsKLQotICAgICAgICAgICAgICAgICAgICAgICAgZG91YmxldGFwID0gdHJ1ZTsKLSAgICAgICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgICAgIHRhcFswXS5tV2hlbiA9IGV2ZW50LmdldEV2ZW50VGltZSgpOworICAgICAgICAgICAgICAgICAgICBTZWxlY3Rpb24uZXh0ZW5kU2VsZWN0aW9uKGJ1ZmZlciwgb2Zmc2V0KTsKICAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICBEb3VibGVUYXBTdGF0ZSBuZXd0YXAgPSBuZXcgRG91YmxlVGFwU3RhdGUoKTsKLSAgICAgICAgICAgICAgICAgICAgbmV3dGFwLm1XaGVuID0gZXZlbnQuZ2V0RXZlbnRUaW1lKCk7Ci0gICAgICAgICAgICAgICAgICAgIGJ1ZmZlci5zZXRTcGFuKG5ld3RhcCwgMCwgYnVmZmVyLmxlbmd0aCgpLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTcGFubmFibGUuU1BBTl9JTkNMVVNJVkVfSU5DTFVTSVZFKTsKLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICBpZiAoY2FwKSB7Ci0gICAgICAgICAgICAgICAgICAgIGJ1ZmZlci5yZW1vdmVTcGFuKExBU1RfVEFQX0RPV04pOwotICAgICAgICAgICAgICAgICAgICBpZiAob25lcG9pbnRmaXZldGFwLmxlbmd0aCA+IDAgJiYgb25lcG9pbnRmaXZldGFwWzBdLmFjdGl2ZSkgewotICAgICAgICAgICAgICAgICAgICAgICAgLy8gSWYgd2Ugc2VsZWN0aW5nIHNvbWV0aGluZyB3aXRoIHRoZSBvbmVwb2ludGZpdmV0YXAtYW5kCi0gICAgICAgICAgICAgICAgICAgICAgICAvLyBzd2lwZSBnZXN0dXJlLCBzdG9wIGl0IG9uIGZpbmdlciB1cC4KLSAgICAgICAgICAgICAgICAgICAgICAgIE1ldGFLZXlLZXlMaXN0ZW5lci5zdG9wU2VsZWN0aW5nKHdpZGdldCwgYnVmZmVyKTsKLSAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIFNlbGVjdGlvbi5leHRlbmRTZWxlY3Rpb24oYnVmZmVyLCBvZmYpOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChkb3VibGV0YXApIHsKLSAgICAgICAgICAgICAgICAgICAgU2VsZWN0aW9uLnNldFNlbGVjdGlvbihidWZmZXIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmluZFdvcmRTdGFydChidWZmZXIsIG9mZiksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmluZFdvcmRFbmQoYnVmZmVyLCBvZmYpKTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICBTZWxlY3Rpb24uc2V0U2VsZWN0aW9uKGJ1ZmZlciwgb2ZmKTsKKyAgICAgICAgICAgICAgICAgICAgU2VsZWN0aW9uLnNldFNlbGVjdGlvbihidWZmZXIsIG9mZnNldCk7CiAgICAgICAgICAgICAgICAgfQogCiAgICAgICAgICAgICAgICAgTWV0YUtleUtleUxpc3RlbmVyLmFkanVzdE1ldGFBZnRlcktleXByZXNzKGJ1ZmZlcik7CkBAIC00MjAsNzMgKzI3OCwzNiBAQAogICAgICAgICByZXR1cm4gaGFuZGxlZDsKICAgICB9CiAKLSAgICBwcml2YXRlIHN0YXRpYyBjbGFzcyBEb3VibGVUYXBTdGF0ZSBpbXBsZW1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GV4dCIgb3B0aW9uIGluIHRoZSBjb250ZXh0IG1lbnUuCi0gICAgKi8KLSAgICBwcml2YXRlIHN0YXRpYyBjbGFzcyBPbmVQb2ludEZpdmVUYXBTdGF0ZSBpbXBsZW1lbnRzIE5vQ29weVNwYW4gewotICAgICAgICBsb25nIG1XaGVuOwotICAgICAgICBib29sZWFuIGFjdGl2ZTsKLSAgICB9CisgICAgICAgICAgICAgICAgICAgIC8vIE9mZnNldCB0aGUgY3VycmVudCB0b3VjaCBwb3NpdGlvbiAoZnJvbSBjb250cm9sbGVyIHRvIGN1cnNvcikKKyAgICAgICAgICAgICAgICAgICAgZmluYWwgZmxvYXQgeCA9IGV2ZW50LmdldFgoKSArIG1DdXJzb3JDb250cm9sbGVyLmdldE9mZnNldFgoKTsKKyAgICAgICAgICAgICAgICAgICAgZmluYWwgZmxvYXQgeSA9IGV2ZW50LmdldFkoKSArIG1DdXJzb3JDb250cm9sbGVyLmdldE9mZnNldFkoKTsKKyAgICAgICAgICAgICAgICAgICAgaW50IG9mZnNldCA9IHdpZGdldC5nZXRPZmZzZXQoKGludCkgeCwgKGludCkgeSk7CisgICAgICAgICAgICAgICAgICAgIG1DdXJzb3JDb250cm9sbGVyLnVwZGF0ZVBvc2l0aW9uKG9mZnNldCk7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwogCi0gICAgcHJpdmF0ZSBzdGF0aWMgYm9vbGVhbiBzYW1lV29yZChDaGFyU2VxdWVuY2UgdGV4dCwgaW50IG9uZSwgaW50IHR3bykgewotICAgICAgICBpbnQgc3RhcnQgPSBmaW5kV29yZFN0YXJ0KHRleHQsIG9uZSk7Ci0gICAgICAgIGludCBlbmQgPSBmaW5kV29yZEVuZCh0ZXh0LCBvbmUpOwotCi0gICAgICAgIGlmIChlbmQgPT0gc3RhcnQpIHsKLSAgICAgICAgICAgIHJldHVybiBmYWxzZTsKLSAgICAgICAgfQotCi0gICAgICAgIHJldHVybiBzdGFydCA9PSBmaW5kV29yZFN0YXJ0KHRleHQsIHR3bykgJiYKLSAgICAgICAgICAgICAgIGVuZCA9PSBmaW5kV29yZEVuZCh0ZXh0LCB0d28pOwotICAgIH0KLQotICAgIC8vIFRPRE86IFVuaWZ5IHdpdGggVGV4dFZpZXcuZ2V0V29yZEZvckRpY3Rpb25hcnkoKQotICAgIHByaXZhdGUgc3RhdGljIGludCBmaW5kV29yZFN0YXJ0KENoYXJTZXF1ZW5jZSB0ZXh0LCBpbnQgc3RhcnQpIHsKLSAgICAgICAgZm9yICg7IHN0YXJ0ID4gMDsgc3RhcnQtLSkgewotICAgICAgICAgICAgY2hhciBjID0gdGV4dC5jaGFyQXQoc3RhcnQgLSAxKTsKLSAgICAgICAgICAgIGludCB0eXBlID0gQ2hhcmFjdGVyLmdldFR5cGUoYyk7Ci0KLSAgICAgICAgICAgIGlmIChjICE9ICdcJycgJiYKLSAgICAgICAgICAgICAgICB0eXBlICE9IENoYXJhY3Rlci5VUFBFUkNBU0VfTEVUVEVSICYmCi0gICAgICAgICAgICAgICAgdHlwZSAhPSBDaGFyYWN0ZXIuTE9XRVJDQVNFX0xFVFRFUiAmJgotICAgICAgICAgICAgICAgIHR5cGUgIT0gQ2hhcmFjdGVyLlRJVExFQ0FTRV9MRVRURVIgJiYKLSAgICAgICAgICAgICAgICB0eXBlICE9IENoYXJhY3Rlci5NT0RJRklFUl9MRVRURVIgJiYKLSAgICAgICAgICAgICAgICB0eXBlICE9IENoYXJhY3Rlci5ERUNJTUFMX0RJR0lUX05VTUJFUikgewotICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgTW90aW9uRXZlbnQuQUNUSU9OX1VQOgorICAgICAgICAgICAgICAgIGNhc2UgTW90aW9uRXZlbnQuQUNUSU9OX0NBTkNFTDoKKyAgICAgICAgICAgICAgICAgICAgbUN1cnNvckNvbnRyb2xsZXIgPSBudWxsOworICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgICAgICAgIH0KICAgICAgICAgfQotCi0gICAgICAgIHJldHVybiBzdGFydDsKKyAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgIH0KIAotICAgIC8vIFRPRE86IFVuaWZ5IHdpdGggVGV4dFZpZXcuZ2V0V29yZEZvckRpY3Rpb25hcnkoKQotICAgIHByaXZhdGUgc3RhdGljIGludCBmaW5kV29yZEVuZChDaGFyU2VxdWVuY2UgdGV4dCwgaW50IGVuZCkgewotICAgICAgICBpbnQgbGVuID0gdGV4dC5sZW5ndGgoKTsKLQotICAgICAgICBmb3IgKDsgZW5kIDwgbGVuOyBlbmQrKykgewotICAgICAgICAgICAgY2hhciBjID0gdGV4dC5jaGFyQXQoZW5kKTsKLSAgICAgICAgICAgIGludCB0eXBlID0gQ2hhcmFjdGVyLmdldFR5cGUoYyk7Ci0KLSAgICAgICAgICAgIGlmIChjICE9ICdcJycgJiYKLSAgICAgICAgICAgICAgICB0eXBlICE9IENoYXJhY3Rlci5VUFBFUkNBU0VfTEVUVEVSICYmCi0gICAgICAgICAgICAgICAgdHlwZSAhPSBDaGFyYWN0ZXIuTE9XRVJDQVNFX0xFVFRFUiAmJgotICAgICAgICAgICAgICAgIHR5cGUgIT0gQ2hhcmFjdGVyLlRJVExFQ0FTRV9MRVRURVIgJiYKLSAgICAgICAgICAgICAgICB0eXBlICE9IENoYXJhY3Rlci5NT0RJRklFUl9MRVRURVIgJiYKLSAgICAgICAgICAgICAgICB0eXBlICE9IENoYXJhY3Rlci5ERUNJTUFMX0RJR0lUX05VTUJFUikgewotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgcmV0dXJuIGVuZDsKKyAgICAvKioKKyAgICAgKiBEZWZpbmVzIHRoZSBjdXJzb3IgY29udHJvbGxlci4KKyAgICAgKgorICAgICAqIFdoZW4gc2V0LCB0aGlzIG9iamVjdCBjYW4gYmUgdXNlZCB0byBoYW5kbGUgZXZlbnRzLCB0aGF0IGNhbiB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MTAgKzYwLDEyIEBACiAgICAgICAgIGludCB3aWR0aCA9IHdpZGdldC5nZXRXaWR0aCgpOwogICAgICAgICBpbnQgZGlmZiA9IDA7CiAKKyAgICAgICAgLy8gYWxpZ25fb3Bwb3NpdGUgZG9lcyBOT1QgbWVhbiBhbGlnbl9yaWdodCwgd2UgbmVlZCB0aGUgcGFyYWdyYXBoCisgICAgICAgIC8vIGRpcmVjdGlvbiB0byByZXNvbHZlIGl0IHRvIGxlZnQgb3IgcmlnaHQKICAgICAgICAgaWYgKHJpZ2h0IC0gbGVmdCA8IHdpZHRoIC0gcGFkZGluZykgewogICAgICAgICAgICAgaWYgKGEgPT0gQWxpZ25tZW50LkFMSUdOX0NFTlRFUikgewogICAgICAgICAgICAgICAgIGRpZmYgPSAod2lkdGggLSBwYWRkaW5nIC0gKHJpZ2h0IC0gbGVmdCkpIC8gMjsKLSAgICAgICAgICAgIH0gZWxzZSBpZiAoYSA9PSBBbGlnbm1lbnQuQUxJR05fT1BQT1NJVEUpIHsKKyAgICAgICAgICAgIH0gZWxzZSBpZiAobHRyID09IChhID09IEFsaWdubWVudC5BTElHTl9PUFBPU0lURSkpIHsKICAgICAgICAgICAgICAgICBkaWZmID0gd2lkdGggLSBwYWRkaW5nIC0gKHJpZ2h0IC0gbGVmdCk7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KQEAgLTk5LDcgKzEwMiw3IEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNb3Rpb25FdmVudCBldmVudCkgewogICAgICAgICBEcmFnU3RhdGVbXSBkczsKIAotICAgICAgICBzd2l0Y2ggKGV2ZW50LmdldEFjdGlvbigpKSB7CisgICAgICAgIHN3aXRjaCAoZXZlbnQuZ2V0QWN0aW9uTWFza2VkKCkpIHsKICAgICAgICAgY2FzZSBNb3Rpb25FdmVudC5BQ1RJT05fRE9XTjoKICAgICAgICAgICAgIGRzID0gYnVmZmVyLmdldFNwYW5zKDAsIGJ1ZmZlci5sZW5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haW1lciBzUmVjbGFpbWVyOworCisgICAgLyoqCisgICAgICogU3ViY2xhc3Mgb2YgUGhhbnRvbVJlZmVyZW5jZSB1c2VkIHRvIHJlY2xhaW0gcmVzb3VyY2VzLgorICAgICAqLworICAgIHB1YmxpYyBzdGF0aWMgYWJzdHJhY3QgY2xhc3MgUmVjbGFpbWFibGVSZWZlcmVuY2U8VD4gZXh0ZW5kcyBQaGFudG9tUmVmZXJlbmNlPFQ+IHsKKyAgICAgICAgcHVibGljIFJlY2xhaW1hYmxlUmVmZXJlbmNlKFQgciwgUmVmZXJlbmNlUXVldWU8T2JqZWN0PiBxKSB7CisgICAgICAgICAgICBzdXBlcihyLCBxKTsKKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgcHVibGljIGFic3RyYWN0IHZvaWQgcmVjbGFpbSgpOworICAgIH0KKworICAgIC8qKgorICAgICAqIFJldHVybnMgdGhlIHF1ZXVlIHVzZWQgdG8gcmVjbGFpbSBSZWNsYWltYWJsZVJlZmVyZW5jZXMuCisgICAgICogCisgICAgICogQHJldHVybiBBIHJlZmVyZW5jZSBxdWV1ZSBvciBudWxsIGJlZm9yZSBpbml0aWFsaXphdGlvbgorICAgICAqLworICAgIHB1YmxpYyBzdGF0aWMgUmVmZXJlbmNlUXVldWU8T2JqZWN0PiBnZXRRdWV1ZSgpIHsKKyAgICAgICAgc3luY2hyb25pemVkIChzTG9jaykgeworICAgICAgICAgICAgaWYgKCFzSW5pdCkgeworICAgICAgICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKCFzUmVjbGFpbWVyLmlzUnVubmluZygpKSB7CisgICAgICAgICAgICAgICAgc1JlY2xhaW1lciA9IG5ldyBSZWNsYWltZXIoc1JlY2xhaW1lci5tUXVldWUpOworICAgICAgICAgICAgICAgIHNSZWNsYWltZXIuc3RhcnQoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHJldHVybiBzUmVjbGFpbWVyLm1RdWV1ZTsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIEludm9rZWQgYnkgWnlnb3RlLiBEb24ndCB0b3VjaCEKKyAgICAgKi8KKyAgICBwdWJsaWMgc3RhdGljIHZvaWQgaW5pdCgpIHsKKyAgICAgICAgc3luY2hyb25pemVkIChzTG9jaykgeworICAgICAgICAgICAgaWYgKCFzSW5pdCAmJiBzUmVjbGFpbWVyID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICBzUmVjbGFpbWVyID0gbmV3IFJlY2xhaW1lcigpOworICAgICAgICAgICAgICAgIHNSZWNsYWltZXIuc3RhcnQoKTsKKyAgICAgICAgICAgICAgICBzSW5pdCA9IHRydWU7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisgICAgCisgICAgcHJpdmF0ZSBzdGF0aWMgY2xhc3MgUmVjbGFpbWVyIGV4dGVuZHMgVGhyZWFkIHsKKyAgICAgICAgUmVmZXJlbmNlUXVldWU8T2JqZWN0PiBtUXVldWU7CisKKyAgICAgICAgcHJpdmF0ZSB2b2xhdGlsZSBib29sZWFuIG1SdW5uaW5nID0gZmFsc2U7CisKKyAgICAgICAgUmVjbGFpbWVyKCkgeworICAgICAgICAgICAgdGhpcyhuZXcgUmVmZXJlbmNlUXVldWU8T2JqZWN0PigpKTsKKyAgICAgICAgfQorCisgICAgICAgIFJlY2xhaW1lcihSZWZlcmVuY2VRdWV1ZTxPYmplY3Q+IHF1ZXVlKSB7CisgICAgICAgICAgICBzdXBlcigiUmVjbGFpbWVyIik7CisgICAgICAgICAgICBzZXREYWVtb24odHJ1ZSk7CisgICAgICAgICAgICBtUXVldWUgPSBxdWV1ZTsgICAgICAgICAgICAKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgdm9pZCBzdGFydCgpIHsKKyAgICAgICAgICAgIG1SdW5uaW5nID0gdHJ1ZTsKKyAgICAgICAgICAgIHN1cGVyLnN0YXJ0KCk7CisgICAgICAgIH0KKworICAgICAgICBib29sZWFuIGlzUnVubmluZygpIHsKKyAgICAgICAgICAgIHJldHVybiBtUnVubmluZzsKKyAgICAgICAgfQorCisgICAgICAgIEBTdXBwcmVzc1dhcm5pbmdzKHsiSW5maW5pdGVMb29wU3RhdGVtZW50In0pCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgdm9pZCBydW4oKSB7CisgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIHdoaWxlICh0cnVlKSB7CisgICAgICAgICAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgICAgICAgICBjbGVhblVwKG1RdWV1ZS5yZW1vdmUoKSk7CisgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKEludGVycnVwdGVkRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIElnbm9yZQorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSBjYXRjaCAoRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICBMb2cuZShMT0dfVEFHLCAiUmVjbGFpbWVyIHRocmVhZCBleGl0aW5nOiAiLCBlKTsKKyAgICAgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICAgICAgbVJ1bm5pbmcgPSBmYWxzZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHByaXZhdGUgdm9pZCBjbGVhblVwKFJlZmVyZW5jZTw/PiByZWZlcmVuY2UpIHsKKyAgICAgICAgICAgIGRvIHsKKyAgICAgICAgICAgICAgICByZWZlcmVuY2UuY2xlYXIoKTsKKyAgICAgICAgICAgICAgICAoKFJlY2xhaW1hYmxlUmVmZXJlbmNlPD8+KSByZWZlcmVuY2UpLnJlY2xhaW0oKTsKKyAgICAgICAgICAgIH0gd2hpbGUgKChyZWZlcmVuY2UgPSBtUXVldWUucG9sbCgpKSAhPSBudWxsKTsKKyAgICAgICAgfQ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yYXkoKTsKKyAqICAgICB3aGlsZSAocmVhZGVyLmhhc05leHQoKSkgeworICogICAgICAgbWVzc2FnZXMuYWRkKHJlYWRNZXNzYWdlKHJlYWRlcikpOworICogICAgIH0KKyAqICAgICByZWFkZXIuZW5kQXJyYXkoKTsKKyAqICAgICByZXR1cm4gbWVzc2FnZXM7CisgKiAgIH0KKyAqCisgKiAgIHB1YmxpYyBNZXNzYWdlIHJlYWRNZXNzYWdlKEpzb25SZWFkZXIgcmVhZGVyKSB0aHJvd3MgSU9FeGNlcHRpb24geworICogICAgIGxvbmcgaWQgPSAtMTsKKyAqICAgICBTdHJpbmcgdGV4dCA9IG51bGw7CisgKiAgICAgVXNlciB1c2VyID0gbnVsbDsKKyAqICAgICBMaXN0PERvdWJsZT4gZ2VvID0gbnVsbDsKKyAqCisgKiAgICAgcmVhZGVyLmJlZ2luT2JqZWN0KCk7CisgKiAgICAgd2hpbGUgKHJlYWRlci5oYXNOZXh0KCkpIHsKKyAqICAgICAgIFN0cmluZyBuYW1lID0gcmVhZGVyLm5leHROYW1lKCk7CisgKiAgICAgICBpZiAobmFtZS5lcXVhbHMoImlkIikpIHsKKyAqICAgICAgICAgaWQgPSByZWFkZXIubmV4dExvbmcoKTsKKyAqICAgICAgIH0gZWxzZSBpZiAobmFtZS5lcXVhbHMoInRleHQiKSkgeworICogICAgICAgICB0ZXh0ID0gcmVhZGVyLm5leHRTdHJpbmcoKTsKKyAqICAgICAgIH0gZWxzZSBpZiAobmFtZS5lcXVhbHMoImdlbyIpICYmIHJlYWRlci5wZWVrKCkgIT0gSnNvblRva2VuLk5VTEwpIHsKKyAqICAgICAgICAgZ2VvID0gcmVhZERvdWJsZXNBcnJheShyZWFkZXIpOworICogICAgICAgfSBlbHNlIGlmIChuYW1lLmVxdWFscygidXNlciIpKSB7CisgKiAgICAgICAgIHVzZXIgPSByZWFkVXNlcihyZWFkZXIpOworICogICAgICAgfSBlbHNlIHsKKyAqICAgICAgICAgcmVhZGVyLnNraXBWYWx1ZSgpOworICogICAgICAgfQorICogICAgIH0KKyAqICAgICByZWFkZXIuZW5kT2JqZWN0KCk7CisgKiAgICAgcmV0dXJuIG5ldyBNZXNzYWdlKGlkLCB0ZXh0LCB1c2VyLCBnZW8pOworICogICB9CisgKgorICogICBwdWJsaWMgTGlzdDxEb3VibGU+IHJlYWREb3VibGVzQXJyYXkoSnNvblJlYWRlciByZWFkZXIpIHRocm93cyBJT0V4Y2VwdGlvbiB7CisgKiAgICAgTGlzdDxEb3VibGU+IGRvdWJsZXMgPSBuZXcgQXJyYXlMaXN0PERvdWJsZT4oKTsKKyAqCisgKiAgICAgcmVhZGVyLmJlZ2luQXJyYXkoKTsKKyAqICAgICB3aGlsZSAocmVhZGVyLmhhc05leHQoKSkgeworICogICAgICAgZG91Ymxlcy5hZGQocmVhZGVyLm5leHREb3VibGUoKSk7CisgKiAgICAgfQorICogICAgIHJlYWRlci5lbmRBcnJheSgpOworICogICAgIHJldHVybiBkb3VibGVzOworICogICB9CisgKgorICogICBwdWJsaWMgVXNlciByZWFkVXNlcihKc29uUmVhZGVyIHJlYWRlcikgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAqICAgICBTdHJpbmcgdXNlcm5hbWUgPSBudWxsOworICogICAgIGludCBmb2xsb3dlcnNDb3VudCA9IC0xOworICoKKyAqICAgICByZWFkZXIuYmVnaW5PYmplY3QoKTsKKyAqICAgICB3aGlsZSAocmVhZGVyLmhhc05leHQoKSkgeworICogICAgICAgU3RyaW5nIG5hbWUgPSByZWFkZXIubmV4dE5hbWUoKTsKKyAqICAgICAgIGlmIChuYW1lLmVxdWFscygibmFtZSIpKSB7CisgKiAgICAgICAgIHVzZXJuYW1lID0gcmVhZGVyLm5leHRTdHJpbmcoKTsKKyAqICAgICAgIH0gZWxzZSBpZiAobmFtZS5lcXVhbHMoImZvbGxvd2Vyc19jb3VudCIpKSB7CisgKiAgICAgICAgIGZvbGxvd2Vyc0NvdW50ID0gcmVhZGVyLm5leHRJbnQoKTs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AgICogdmFsdWUsIHVzZSB7QGxpbmsgI3BlZWsoKX0KKyAgICAgKi8KKyAgICBwcml2YXRlIEpzb25Ub2tlbiBxdWlja1BlZWsoKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICBpZiAoaGFzVG9rZW4pIHsKKyAgICAgICAgICAgIHJldHVybiB0b2tlbjsKKyAgICAgICAgfQorCisgICAgICAgIHN3aXRjaCAocGVla1N0YWNrKCkpIHsKKyAgICAgICAgICAgIGNhc2UgRU1QVFlfRE9DVU1FTlQ6CisgICAgICAgICAgICAgICAgcmVwbGFjZVRvcChKc29uU2NvcGUuTk9ORU1QVFlfRE9DVU1FTlQpOworICAgICAgICAgICAgICAgIEpzb25Ub2tlbiBmaXJzdFRva2VuID0gbmV4dFZhbHVlKCk7CisgICAgICAgICAgICAgICAgaWYgKHRva2VuICE9IEpzb25Ub2tlbi5CRUdJTl9BUlJBWSAmJiB0b2tlbiAhPSBKc29uVG9rZW4uQkVHSU5fT0JKRUNUKSB7CisgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBJT0V4Y2VwdGlvbigKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAiRXhwZWN0ZWQgSlNPTiBkb2N1bWVudCB0byBzdGFydCB3aXRoICdbJyBvciAneycgYnV0IHdhcyAiICsgdG9rZW4pOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICByZXR1cm4gZmlyc3RUb2tlbjsKKyAgICAgICAgICAgIGNhc2UgRU1QVFlfQVJSQVk6CisgICAgICAgICAgICAgICAgcmV0dXJuIG5leHRJbkFycmF5KHRydWUpOworICAgICAgICAgICAgY2FzZSBOT05FTVBUWV9BUlJBWToKKyAgICAgICAgICAgICAgICByZXR1cm4gbmV4dEluQXJyYXkoZmFsc2UpOworICAgICAgICAgICAgY2FzZSBFTVBUWV9PQkpFQ1Q6CisgICAgICAgICAgICAgICAgcmV0dXJuIG5leHRJbk9iamVjdCh0cnVlKTsKKyAgICAgICAgICAgIGNhc2UgREFOR0xJTkdfTkFNRToKKyAgICAgICAgICAgICAgICByZXR1cm4gb2JqZWN0VmFsdWUoKTsKKyAgICAgICAgICAgIGNhc2UgTk9ORU1QVFlfT0JKRUNUOgorICAgICAgICAgICAgICAgIHJldHVybiBuZXh0SW5PYmplY3QoZmFsc2UpOworICAgICAgICAgICAgY2FzZSBOT05FTVBUWV9ET0NVTUVOVDoKKyAgICAgICAgICAgICAgICBoYXNUb2tlbiA9IHRydWU7CisgICAgICAgICAgICAgICAgcmV0dXJuIHRva2VuID0gSnNvblRva2VuLkVORF9ET0NVTUVOVDsKKyAgICAgICAgICAgIGNhc2UgQ0xPU0VEOgorICAgICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oIkpzb25SZWFkZXIgaXMgY2xvc2VkIik7CisgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgIHRocm93IG5ldyBBc3NlcnRpb25FcnJvcigpOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogQWR2YW5jZXMgdGhlIGN1cnNvciBpbiB0aGUgSlNPTiBzdHJlYW0gdG8gdGhlIG5leHQgdG9rZW4uCisgICAgICovCisgICAgcHJpdmF0ZSBKc29uVG9rZW4gYWR2YW5jZSgpIHRocm93cyBJT0V4Y2VwdGlvbiB7CisgICAgICAgIHF1aWNrUGVlaygpOworCisgICAgICAgIEpzb25Ub2tlbiByZXN1bHQgPSB0b2tlbjsKKyAgICAgICAgaGFzVG9rZW4gPSBmYWxzZTsKKyAgICAgICAgdG9rZW4gPSBudWxsOworICAgICAgICB2YWx1ZSA9IG51bGw7CisgICAgICAgIG5hbWUgPSBudWxsOworICAgICAgICByZXR1cm4gcmVzdWx0OworICAgIH0KKworICAgIC8qKgorICAgICAqIFJldHVybnMgdGhlIG5leHQgdG9rZW4sIGEge0BsaW5rIEpzb25Ub2tlbiNOQU1FIHByb3BlcnR5IG5hbWV9LCBhbmQKKyAgICAgKiBjb25zdW1lcyBpdC4KKyAgICAgKgorICAgICAqIEB0aHJvd3MgSU9FeGNlcHRpb24gaWYgdGhlIG5leHQgdG9rZW4gaW4gdGhlIHN0cmVhbSBpcyBub3QgYSBwcm9wZXJ0eQorICAgICAqICAgICBuYW1lLgorICAgICAqLworICAgIHB1YmxpYyBTdHJpbmcgbmV4dE5hbWUoKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICBxdWlja1BlZWsoKTsKKyAgICAgICAgaWYgKHRva2VuICE9IEpzb25Ub2tlbi5OQU1FKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJFeHBlY3RlZCBhIG5hbWUgYnV0IHdhcyAiICsgcGVlaygpKTsKKyAgICAgICAgfQorICAgICAgICBTdHJpbmcgcmVzdWx0ID0gbmFtZTsKKyAgICAgICAgYWR2YW5jZSgpOworICAgICAgICByZXR1cm4gcmVzdWx0OworICAgIH0KKworICAgIC8qKgorICAgICAqIFJldHVybnMgdGhlIHtAbGluayBKc29uVG9rZW4jU1RSSU5HIHN0cmluZ30gdmFsdWUgb2YgdGhlIG5leHQgdG9rZW4sCisgICAgICogY29uc3VtaW5nIGl0LiBJZiB0aGUgbmV4dCB0b2tlbiBpcyBhIG51bWJlciwgdGhpcyBtZXRob2Qgd2lsbCByZXR1cm4gaXRzCisgICAgICogc3RyaW5nIGZvcm0uCisgICAgICoKKyAgICAgKiBAdGhyb3dzIElsbGVnYWxTdGF0ZUV4Y2VwdGlvbiBpZiB0aGUgbmV4dCB0b2tlbiBpcyBub3QgYSBzdHJpbmcgb3IgaWYKKyAgICAgKiAgICAgdGhpcyByZWFkZXIgaXMgY2xvc2VkLgorICAgICAqLworICAgIHB1YmxpYyBTdHJpbmcgbmV4dFN0cmluZygpIHRocm93cyBJT0V4Y2VwdGlvbiB7CisgICAgICAgIHBlZWsoKTsKKyAgICAgICAgaWYgKHZhbHVlID09IG51bGwgfHwgKHRva2VuICE9IEpzb25Ub2tlbi5TVFJJTkcgJiYgdG9rZW4gIT0gSnNvblRva2VuLk5VTUJFUikpIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oIkV4cGVjdGVkIGEgc3RyaW5nIGJ1dCB3YXMgIiArIHBlZWsoKSk7CisgICAgICAgIH0KKworICAgICAgICBTdHJpbmcgcmVzdWx0ID0gdmFsdWU7CisgICAgICAgIGFkdmFuY2UoKTsKKyAgICAgICAgcmV0dXJuIHJlc3VsdDsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBSZXR1cm5zIHRoZSB7QGxpbmsgSnNvblRva2VuI0JPT0xFQU4gYm9vbGVhbn0gdmFsdWUgb2YgdGhlIG5leHQgdG9rZW4sCisgICAgICogY29uc3VtaW5nIGl0LgorICAgICAqCisgICAgICogQHRocm93cyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24gaWYgdGhlIG5leHQgdG9rZW4gaXMgbm90IGEgYm9vbGVhbiBvciBpZgorICAgICAqICAgICB0aGlzIHJlYWRlciBpcyBjbG9zZWQuCisgICAgICovCisgICAgcHVibGljIGJvb2xlYW4gbmV4dEJvb2xlYW4oKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICBxdWlja1BlZWsoKTsKKyAgICAgICAgaWYgKHZhbHVlID09IG51bGwgfHwgdG9rZW4gPT0gSnNvblRva2VuLlNUUklORykgeworICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigiRXhwZWN0ZWQgYSBib29sZWFuIGJ1dCB3YXMgIiArIHBlZWsoKSk7CisgICAgICAgIH0KKworICAgICAgICBib29sZWFuIHJlc3VsdDsKKyAgICAgICAgaWYgKHZhbHVlLmVxdWFsc0lnbm9yZUNhc2UoInRydWUiKSkgeworICAgICAgICAgICAgcmVzdWx0ID0gdHJ1ZTsKKyAgICAgICAgfSBlbHNlIGlmICh2YWx1ZS5lcXVhbHNJZ25vcmVDYXNlKCJmYWxzZSIpKSB7CisgICAgICAgICAgICByZXN1bHQgPSBmYWxzZTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oIk5vdCBhIGJvb2xlYW46ICIgKyB2YWx1ZSk7CisgICAgICAgIH0KKworICAgICAgICBhZHZhbmNlKCk7CisgICAgICAgIHJldHVybiByZXN1bHQ7CisgICAgfQorCisgICAgLyoqCisgICAgICogQ29uc3VtZXMgdGhlIG5leHQgdG9rZW4gZnJvbSB0aGUgSlNPTiBzdHJlYW0gYW5kIGFzc2VydHMgdGhhdCBpdCBpcyBhCisgICAgICogbGl0ZXJhbCBudWxsLgorICAgICAqCisgICAgICogQHRocm93cyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24gaWYgdGhlIG5leHQgdG9rZW4gaXMgbm90IG51bGwgb3IgaWYgdGhpcworICAgICAqICAgICByZWFkZXIgaXMgY2xvc2VkLgorICAgICAqLworICAgIHB1YmxpYyB2b2lkIG5leHROdWxsKCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICAgcXVpY2tQZWVrKCk7CisgICAgICAgIGlmICh2YWx1ZSA9PSBudWxsIHx8IHRva2VuID09IEpzb25Ub2tlbi5TVFJJTkcpIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oIkV4cGVjdGVkIG51bGwgYnV0IHdhcyAiICsgcGVlaygpKTsKKyAgICAgICAgfQorCisgICAgICAgIGlmICghdmFsdWUuZXF1YWxzSWdub3JlQ2FzZSgibnVsbCIpKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJOb3QgYSBudWxsOiAiICsgdmFsdWUpOworICAgICAgICB9CisKKyAgICAgICAgYWR2YW5jZSgpOworICAgIH0KKworICAgIC8qKgorICAgICAqIFJldHVybnMgdGhlIHtAbGluayBKc29uVG9rZ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bigiRXhwZWN0ZWQgYSBsb25nIGJ1dCB3YXMgIiArIHBlZWsoKSk7CisgICAgICAgIH0KKworICAgICAgICBsb25nIHJlc3VsdDsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIHJlc3VsdCA9IExvbmcucGFyc2VMb25nKHZhbHVlKTsKKyAgICAgICAgfSBjYXRjaCAoTnVtYmVyRm9ybWF0RXhjZXB0aW9uIGlnbm9yZWQpIHsKKyAgICAgICAgICAgIGRvdWJsZSBhc0RvdWJsZSA9IERvdWJsZS5wYXJzZURvdWJsZSh2YWx1ZSk7IC8vIGRvbid0IGNhdGNoIHRoaXMgTnVtYmVyRm9ybWF0RXhjZXB0aW9uCisgICAgICAgICAgICByZXN1bHQgPSAobG9uZykgYXNEb3VibGU7CisgICAgICAgICAgICBpZiAoKGRvdWJsZSkgcmVzdWx0ICE9IGFzRG91YmxlKSB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IE51bWJlckZvcm1hdEV4Y2VwdGlvbih2YWx1ZSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBpZiAocmVzdWx0ID49IDFMICYmIHZhbHVlLnN0YXJ0c1dpdGgoIjAiKSkgeworICAgICAgICAgICAgdGhyb3cgbmV3IE51bWJlckZvcm1hdEV4Y2VwdGlvbigiSlNPTiBmb3JiaWRzIG9jdGFsIHByZWZpeGVzOiAiICsgdmFsdWUpOworICAgICAgICB9CisKKyAgICAgICAgYWR2YW5jZSgpOworICAgICAgICByZXR1cm4gcmVzdWx0OworICAgIH0KKworICAgIC8qKgorICAgICAqIFJldHVybnMgdGhlIHtAbGluayBKc29uVG9rZW4jTlVNQkVSIGludH0gdmFsdWUgb2YgdGhlIG5leHQgdG9rZW4sCisgICAgICogY29uc3VtaW5nIGl0LiBJZiB0aGUgbmV4dCB0b2tlbiBpcyBhIHN0cmluZywgdGhpcyBtZXRob2Qgd2lsbCBhdHRlbXB0IHRvCisgICAgICogcGFyc2UgaXQgYXMgYW4gaW50LiBJZiB0aGUgbmV4dCB0b2tlbidzIG51bWVyaWMgdmFsdWUgY2Fubm90IGJlIGV4YWN0bHkKKyAgICAgKiByZXByZXNlbnRlZCBieSBhIEphdmEge0Bjb2RlIGludH0sIHRoaXMgbWV0aG9kIHRocm93cy4KKyAgICAgKgorICAgICAqIEB0aHJvd3MgSWxsZWdhbFN0YXRlRXhjZXB0aW9uIGlmIHRoZSBuZXh0IHRva2VuIGlzIG5vdCBhIGxpdGVyYWwgdmFsdWUuCisgICAgICogQHRocm93cyBOdW1iZXJGb3JtYXRFeGNlcHRpb24gaWYgdGhlIG5leHQgbGl0ZXJhbCB2YWx1ZSBjYW5ub3QgYmUgcGFyc2VkCisgICAgICogICAgIGFzIGEgbnVtYmVyLCBvciBleGFjdGx5IHJlcHJlc2VudGVkIGFzIGFuIGludC4KKyAgICAgKi8KKyAgICBwdWJsaWMgaW50IG5leHRJbnQoKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICBxdWlja1BlZWsoKTsKKyAgICAgICAgaWYgKHZhbHVlID09IG51bGwpIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oIkV4cGVjdGVkIGFuIGludCBidXQgd2FzICIgKyBwZWVrKCkpOworICAgICAgICB9CisKKyAgICAgICAgaW50IHJlc3VsdDsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIHJlc3VsdCA9IEludGVnZXIucGFyc2VJbnQodmFsdWUpOworICAgICAgICB9IGNhdGNoIChOdW1iZXJGb3JtYXRFeGNlcHRpb24gaWdub3JlZCkgeworICAgICAgICAgICAgZG91YmxlIGFzRG91YmxlID0gRG91YmxlLnBhcnNlRG91YmxlKHZhbHVlKTsgLy8gZG9uJ3QgY2F0Y2ggdGhpcyBOdW1iZXJGb3JtYXRFeGNlcHRpb24KKyAgICAgICAgICAgIHJlc3VsdCA9IChpbnQpIGFzRG91YmxlOworICAgICAgICAgICAgaWYgKChkb3VibGUpIHJlc3VsdCAhPSBhc0RvdWJsZSkgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBOdW1iZXJGb3JtYXRFeGNlcHRpb24odmFsdWUpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgaWYgKHJlc3VsdCA+PSAxTCAmJiB2YWx1ZS5zdGFydHNXaXRoKCIwIikpIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBOdW1iZXJGb3JtYXRFeGNlcHRpb24oIkpTT04gZm9yYmlkcyBvY3RhbCBwcmVmaXhlczogIiArIHZhbHVlKTsKKyAgICAgICAgfQorCisgICAgICAgIGFkdmFuY2UoKTsKKyAgICAgICAgcmV0dXJuIHJlc3VsdDsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBDbG9zZXMgdGhpcyBKU09OIHJlYWRlciBhbmQgdGhlIHVuZGVybHlpbmcge0BsaW5rIFJlYWRlcn0uCisgICAgICovCisgICAgcHVibGljIHZvaWQgY2xvc2UoKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICBoYXNUb2tlbiA9IGZhbHNlOworICAgICAgICB2YWx1ZSA9IG51bGw7CisgICAgICAgIHRva2VuID0gbnVsbDsKKyAgICAgICAgc3RhY2suY2xlYXIoKTsKKyAgICAgICAgc3RhY2suYWRkKEpzb25TY29wZS5DTE9TRUQpOworICAgICAgICBpbi5jbG9zZSgpOworICAgIH0KKworICAgIC8qKgorICAgICAqIFNraXBzIHRoZSBuZXh0IHZhbHVlIHJlY3Vyc2l2ZWx5LiBJZiBpdCBpcyBhbiBvYmplY3Qgb3IgYXJyYXksIGFsbCBuZXN0ZWQKKyAgICAgKiBlbGVtZW50cyBhcmUgc2tpcHBlZC4gVGhpcyBtZXRob2QgaXMgaW50ZW5kZWQgZm9yIHVzZSB3aGVuIHRoZSBKU09OIHRva2VuCisgICAgICogc3RyZWFtIGNvbnRhaW5zIHVucmVjb2duaXplZCBvciB1bmhhbmRsZWQgdmFsdWVzLgorICAgICAqLworICAgIHB1YmxpYyB2b2lkIHNraXBWYWx1ZSgpIHRocm93cyBJT0V4Y2VwdGlvbiB7CisgICAgICAgIHNraXBwaW5nID0gdHJ1ZTsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIGludCBjb3VudCA9IDA7CisgICAgICAgICAgICBkbyB7CisgICAgICAgICAgICAgICAgSnNvblRva2VuIHRva2VuID0gYWR2YW5jZSgpOworICAgICAgICAgICAgICAgIGlmICh0b2tlbiA9PSBKc29uVG9rZW4uQkVHSU5fQVJSQVkgfHwgdG9rZW4gPT0gSnNvblRva2VuLkJFR0lOX09CSkVDVCkgeworICAgICAgICAgICAgICAgICAgICBjb3VudCsrOworICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAodG9rZW4gPT0gSnNvblRva2VuLkVORF9BUlJBWSB8fCB0b2tlbiA9PSBKc29uVG9rZW4uRU5EX09CSkVDVCkgeworICAgICAgICAgICAgICAgICAgICBjb3VudC0tOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0gd2hpbGUgKGNvdW50ICE9IDApOworICAgICAgICB9IGZpbmFsbHkgeworICAgICAgICAgICAgc2tpcHBpbmcgPSBmYWxzZTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgSnNvblNjb3BlIHBlZWtTdGFjaygpIHsKKyAgICAgICAgcmV0dXJuIHN0YWNrLmdldChzdGFjay5zaXplKCkgLSAxKTsKKyAgICB9CisKKyAgICBwcml2YXRlIEpzb25TY29wZSBwb3AoKSB7CisgICAgICAgIHJldHVybiBzdGFjay5yZW1vdmUoc3RhY2suc2l6ZSgpIC0gMSk7CisgICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIHB1c2goSnNvblNjb3BlIG5ld1RvcCkgeworICAgICAgICBzdGFjay5hZGQobmV3VG9wKTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBSZXBsYWNlIHRoZSB2YWx1ZSBvbiB0aGUgdG9wIG9mIHRoZSBzdGFjayB3aXRoIHRoZSBnaXZlbiB2YWx1ZS4KKyAgICAgKi8KKyAgICBwcml2YXRlIHZvaWQgcmVwbGFjZVRvcChKc29uU2NvcGUgbmV3VG9wKSB7CisgICAgICAgIHN0YWNrLnNldChzdGFjay5zaXplKCkgLSAxLCBuZXdUb3ApOworICAgIH0KKworICAgIHByaXZhdGUgSnNvblRva2VuIG5leHRJbkFycmF5KGJvb2xlYW4gZmlyc3RFbGVtZW50KSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICBpZiAoZmlyc3RFbGVtZW50KSB7CisgICAgICAgICAgICByZXBsYWNlVG9wKEpzb25TY29wZS5OT05FTVBUWV9BUlJBWSk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAvKiBMb29rIGZvciBhIGNvbW1hIGJlZm9yZSBlYWNoIGVsZW1lbnQgYWZ0ZXIgdGhlIGZpcnN0IGVsZW1lbnQuICovCisgICAgICAgICAgICBzd2l0Y2ggKG5leHROb25XaGl0ZXNwYWNlKCkpIHsKKyAgICAgICAgICAgICAgICBjYXNlICddJzoKKyAgICAgICAgICAgICAgICAgICAgcG9wKCk7CisgICAgICAgICAgICAgICAgICAgIGhhc1Rva2VuID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRva2VuID0gSnNvblRva2VuLkVORF9BUlJBWTsKKyAgICAgICAgICAgICAgICBjYXNlICc7JzoKKyAgICAgICAgICAgICAgICAgICAgY2hlY2tMZW5pZW50KCk7IC8vIGZhbGwtdGhyb3VnaAorICAgICAgICAgICAgICAgIGNhc2UgJywnOgorICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgICAgICB0aHJvdyBzeW50YXhFcnJvcigiVW50ZXJtaW5hdGVkIGFycmF5Iik7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBzd2l0Y2ggKG5leHROb25XaGl0ZXNwYWNlKCkpIHsKKyAgICAgICAgICAgIGNhc2UgJ10nOgorICAgICAgICAgICAgICAgIGlmIChmaXJzdEVsZW1lbnQpIHsKKyAgICAgICAgICAgICAgICAgICAgcG9wKCk7CisgICAgICAgICAgICAgICAgICAgIGhhc1Rva2VuID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRva2VuID0gSnNvblRva2VuLkVORF9BUlJBWTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgLy8gZmFsbC10aHJvdWdoIHRvIGhhbmRsZSAiLF0iCisgICAgICAgICAgICBjYXNlICc7JzoKKyAgICAgICAgICAgIGNhc2UgJywnOgorICAgICAgICAgICAgICAgIC8qIEluIGxlbmllbnQgbW9kZSwgYSAwLWxlbmd0aCBsaXRlcmFsIG1lYW5zICdudWxsJyAqLworICAgICAgICAgICAgICAgIGNoZWNrTGVuaWVudCgpOworICAgICAgICAgICAgICAgIHBvcy0tOworICAgICAgICAgICAgICAgIGhhc1Rva2VuID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICB2YWx1ZSA9ICJudWxsIjsKKyAgICAgICAgICAgICAgICByZXR1cm4gdG9rZW4gPSBKc29uVG9rZW4uTlVMTDsKKyAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgcG9zLS07CisgICAgICAgICAgICAgICAgcmV0dXJuIG5leHRWYWx1ZSgpOworICAgICAgICB9CisgICAgfQorCisgICAgcHJpdmF0ZSBKc29uVG9rZW4gbmV4dEluT2JqZWN0KGJvb2xlYW4gZmlyc3RFbGVtZW50KSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICAvKgorICAgICAgICAgKiBSZWFkIGRlbGltaXRlcnMuIEVpdGhlciBhIGNvbW1hL3NlbWljb2xvbiBzZXBhcmF0aW5nIHRoaXMgYW5kIHRoZQorICAgICAgICAgKiBwcmV2aW91cyBuYW1lLXZhbHVlIHBhaXIsIG9yIGEgY2xvc2UgYnJhY2UgdG8gZGVub3RlIHRoZSBlbmQgb2YgdGhlCisgICAgICAgICAqIG9iamVjdC4KKyAgICAgICAgICovCisgICAgICAgIGlmIChmaXJzdEVsZW1lbnQpIHsKKyAgICAgICAgICAgIC8qIFBlZWsgdG8gc2VlIGlmIHRoaXMgaXMgdGhlIGVtcHR5IG9iamVjdC4gKi8KKyAgICAgICAgICAgIHN3aXRjaCAobmV4dE5vbldoaXRlc3BhY2UoKSkgeworICAgICAgICAgICAgICAgIGNhc2UgJ30nOgorICAgICAgICAgICAgICAgICAgICBwb3AoKTsKKyAgICAgICAgICAgICAgICAgICAgaGFzVG9rZW4gPSB0cnVlOworICAgICAgICAgICAgICAgICAgICByZXR1cm4gdG9rZW4gPSBKc29uVG9rZW4uRU5EX09CSkVDVDsKKyAgICAgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgICAgICBwb3MtLTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIHN3aXRjaCAobmV4dE5vbldoaXRlc3BhY2UoKSkgeworICAgICAgICAgICAgICAgIGNhc2UgJ30nOgorICAgICAgICAgICAgICAgICAgICBwb3AoKTsKKyAgICAgICAgICAgICAgICAgICAgaGFzVG9rZW4gPSB0cnVlOworICAgICAgICAgICAgICAgICAgICByZXR1cm4gdG9rZW4gPSBKc29uVG9rZW4uRU5EX09CSkVDVDsKKyAgICAgICAgICAgICAgICBjYXNlICc7JzoKKyAgICAgICAgICAgICAgICBjYXNlICcsJzoKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICAgICAgdGhyb3cgc3ludGF4RXJyb3IoIlVudGVybWluYXRlZCBvYmplY3QiKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIC8qIFJlYWQgdGhlIG5hbWUuICovCisgICAgICAgIGludCBxdW90ZSA9IG5leHROb25XaGl0ZXNwYWNlKCk7CisgICAgICAgIHN3aXRjaCAocXVvdGUpIHsKKyAgICAgICAgICAgIGNhc2UgJ1wnJzoKKyAgICAgICAgICAgICAgICBjaGVja0xlbmllbnQoKTsgLy8gZmFsbC10aHJvdWdoCisgICAgICAgICAgICBjYXNlICciJzoKKyAgICAgICAgICAgICAgICBuYW1lID0gbmV4dFN0cmluZygoY2hhcikgcXVvdGUpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICBjaGVja0xlbmllbnQoKTsKKyAgICAgICAgICAgICAgICBwb3MtLTsKKyAgICAgICAgICAgICAgICBuYW1lID0gbmV4dExpdGVyYWwoKTsKKyAgICAgICAgICAgICAgICBpZiAobmFtZS5pc0VtcHR5KCkpIHsKKyAgICAgICAgICAgICAgICAgICAgdGhyb3cgc3ludGF4RXJyb3IoIkV4cGVjdGVkIG5hbWUiKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICByZXBsYWNlVG9wKEpzb25TY29wZS5EQU5HTElOR19OQU1FKTsKKyAgICAgICAgaGFzVG9rZW4gPSB0cnVlOworICAgICAgICByZXR1cm4gdG9rZW4gPSBKc29uVG9rZW4uTkFNRTsKKyAgICB9CisKKyAgICBwcml2YXRlIEpzb25Ub2tlbiBvYmplY3RWYWx1ZSgpIHRocm93cyBJT0V4Y2VwdGlvbiB7CisgICAgICAgIC8qCisgICAgICAgICAqIFJlYWQgdGhlIG5hbWUvdmFsdWUgc2VwYXJhdG9yLiBVc3VhbGx5IGEgY29sb24gJzonLiBJbiBsZW5pZW50IG1vZGUKKyAgICAgICAgICogd2UgYWxzbyBhY2NlcHQgYW4gZXF1YWxzIHNpZ24gJz0nLCBvciBhbiBhcnJvdyAiPT4iLgorICAgICAgICAgKi8KKyAgICAgICAgc3dpdGNoIChuZXh0Tm9uV2hpdGVzcGFjZSgpKSB7CisgICAgICAgICAgICBjYXNlICc6JzoKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgJz0nOgorICAgICAgICAgICAgICAgIGNoZWNrTGVuaWVudCgpOworICAgICAgICAgICAgICAgIGlmICgocG9zIDwgbGltaXQgfHwgZmlsbEJ1ZmZlcigxKSkgJiYgYnVmZmVyW3Bvc10gPT0gJz4nKSB7CisgICAgICAgICAgICAgICAgICAgIHBvcysrOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgdGhyb3cgc3ludGF4RXJyb3IoIkV4cGVjdGVkICc6JyIpOworICAgICAgICB9CisKKyAgICAgICAgcmVwbGFjZVRvcChKc29uU2NvcGUuTk9ORU1QVFlfT0JKRUNUKTsKKyAgICAgICAgcmV0dXJuIG5leHRWYWx1ZSgpOworICAgIH0KKworICAgIHByaXZhdGUgSnNvblRva2VuIG5leHRWYWx1ZSgpIHRocm93cyBJT0V4Y2VwdGlvbiB7CisgICAgICAgIGludCBjID0gbmV4dE5vbldoaXRlc3BhY2UoKTsKKyAgICAgICAgc3dpdGNoIChjKSB7CisgICAgICAgICAgICBjYXNlICd7JzoKKyAgICAgICAgICAgICAgICBwdXNoKEpzb25TY29wZS5FTVBUWV9PQkpFQ1QpOworICAgICAgICAgICAgICAgIGhhc1Rva2VuID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICByZXR1cm4gdG9rZW4gPSBKc29uVG9rZW4uQkVHSU5fT0JKRUNUOworCisgICAgICAgICAgICBjYXNlICdbJzoKKyAgICAgICAgICAgICAgICBwdXNoKEpzb25TY29wZS5FTVBUWV9BUlJBWSk7CisgICAgICAgICAgICAgICAgaGFzVG9rZW4gPSB0cnVlOworICAgICAgICAgICAgICAgIHJldHVybiB0b2tlbiA9IEpzb25Ub2tlbi5CRUdJTl9BUlJBWTsKKworICAgICAgICAgICAgY2FzZSAnXCcnOgorICAgICAgICAgICAgICAgIGNoZWNrTGVuaWVudCgpOyAvLyBmYWxsLXRocm91Z2gKKyAgICAgICAgICAgIGNhc2UgJyInOgorICAgICAgICAgICAgICAgIHZhbHVlID0gbmV4dFN0cmluZygoY2hhcikgYyk7CisgICAgICAgICAgICAgICAgaGFzVG9rZW4gPSB0cnVlOworICAgICAgICAgICAgICAgIHJldHVybiB0b2tlbiA9IEpzb25Ub2tlbi5TVFJJTkc7CisKKyAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgcG9zLS07CisgICAgICAgICAgICAgICAgcmV0dXJuIHJlYWRMaXRlcmFsKCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBSZXR1cm5zIHRydWUgb25jZSB7QGNvZGUgbGltaXQgLSBwb3MgPj0gbWluaW11bX0uIElmIHRoZSBkYXRhIGlzCisgICAgICogZXhoYXVzdGVkIGJlZm9yZSB0aGF0IG1hbnkgY2hhcmFjdGVycyBhcmUgYXZhaWxhYmxlLCB0aGlzIHJldHVybnMKKyAgICAgKiBmYWxzZS4KKyAgICAgKi8KKyAgICBwcml2YXRlIGJvb2xlYW4gZmlsbEJ1ZmZlcihpbnQgbWluaW11bSkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICAgaWYgKGxpbWl0ICE9IHBvcykgeworICAgICAgICAgICAgbGltaXQgLT0gcG9zOworICAgICAgICAgICAgU3lzdGVtLmFycmF5Y29weShidWZmZXIsIHBvcywgYnVmZmVyLCAwLCBsaW1pdCk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBsaW1pdCA9IDA7CisgICAgICAgIH0KKworICAgICAgICBwb3MgPSAwOworICAgICAgICBpbnQgdG90YWw7CisgICAgICAgIHdoaWxlICgodG90YWwgPSBpbi5yZWFkKGJ1ZmZlciwgbGltaXQsIGJ1ZmZlci5sZW5ndGggLSBsaW1pdCkpICE9IC0xKSB7CisgICAgICAgICAgICBsaW1pdCArPSB0b3RhbDsKKyAgICAgICAgICAgIGlmIChsaW1pdCA+PSBtaW5pbXVtKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIHByaXZhdGUgaW50IG5leHROb25XaGl0ZXNwYWNlKCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICAgd2hpbGUgKHBvcyA8IGxpbWl0IHx8IGZpbGxCdWZmZXIoMSkpIHsKKyAgICAgICAgICAgIGludCBjID0gYnVmZmVyW3BvcysrXTsKKyAgICAgICAgICAgIHN3aXRjaCAoYykgeworICAgICAgICAgICAgICAgIGNhc2UgJ1x0JzoKKyAgICAgICAgICAgICAgICBjYXNlICcgJzoKKyAgICAgICAgICAgICAgICBjYXNlICdcbic6CisgICAgICAgICAgICAgICAgY2FzZSAnXHInOgorICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKKworICAgICAgICAgICAgICAgIGNhc2UgJy8nOgorICAgICAgICAgICAgICAgICAgICBpZiAocG9zID09IGxpbWl0ICYmICFmaWxsQnVmZmVyKDEpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYzsKKyAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgIGNoZWNrTGVuaWVudCgpOworICAgICAgICAgICAgICAgICAgICBjaGFyIHBlZWsgPSBidWZmZXJbcG9zXTsKKyAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChwZWVrKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICcqJzoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBza2lwIGEgLyogYy1zdHlsZSBjb21tZW50ICovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcG9zKys7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFza2lwVG8oIiovIikpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgc3ludGF4RXJyb3IoIlVudGVybWluYXRlZCBjb21tZW50Iik7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBvcyArPSAyOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOworCisgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICcvJzoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBza2lwIGEgLy8gZW5kLW9mLWxpbmUgY29tbWVudAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBvcysrOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNraXBUb0VuZE9mTGluZSgpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOworCisgICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjOworICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICBjYXNlICcjJzoKKyAgICAgICAgICAgICAgICAgICAgLyoKKyAgICAgICAgICAgICAgICAgICAgICogU2tpcCBhICMgaGFzaCBlbmQtb2YtbGluZSBjb21tZW50LiBUaGUgSlNPTiBSRkMgZG9lc24ndAorICAgICAgICAgICAgICAgICAgICAgKiBzcGVjaWZ5IHRoaXMgYmVoYXZpb3VyLCBidXQgaXQncyByZXF1aXJlZCB0byBwYXJzZQorICAgICAgICAgICAgICAgICAgICAgKiBleGlzdGluZyBkb2N1bWVudHMuIFNlZSBodHRwOi8vYi8yNTcxNDIzLgorICAgICAgICAgICAgICAgICAgICAgKi8KKyAgICAgICAgICAgICAgICAgICAgY2hlY2tMZW5pZW50KCk7CisgICAgICAgICAgICAgICAgICAgIHNraXBUb0VuZE9mTGluZSgpOworICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKKworICAgICAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBjOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgdGhyb3cgc3ludGF4RXJyb3IoIkVuZCBvZiBpbnB1dCIpOworICAgIH0KKworICAgIHByaXZhdGUgdm9pZCBjaGVja0xlbmllbnQoKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICBpZiAoIWxlbmllbnQpIHsKKyAgICAgICAgICAgIHRocm93IHN5bnRheEVycm9yKCJVc2UgSnNvblJlYWRlci5zZXRMZW5pZW50KHRydWUpIHRvIGFjY2VwdCBtYWxmb3JtZWQgSlNPTiIpOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogQWR2YW5jZXMgdGhlIHBvc2l0aW9uIHVudGlsIGFmdGVyIHRoZSBuZXh0IG5ld2xpbmUgY2hhcmFjdGVyLiBJZiB0aGUgbGluZQorICAgICAqIGlzIHRlcm1pbmF0ZWQgYnkgIlxyXG4iLCB0aGUgJ1xuJyBtdXN0IGJlIGNvbnN1bWVkIGFzIHdoaXRlc3BhY2UgYnkgdGhlCisgICAgICogY2FsbGVyLgorICAgICAqLworICAgIHByaXZhdGUgdm9pZCBza2lwVG9FbmRPZkxpbmUoKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICB3aGlsZSAocG9zIDwgbGltaXQgfHwgZmlsbEJ1ZmZlcigxKSkgeworICAgICAgICAgICAgY2hhciBjID0gYnVmZmVyW3BvcysrXTsKKyAgICAgICAgICAgIGlmIChjID09ICdccicgfHwgYyA9PSAnXG4nKSB7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcml2YXRlIGJvb2xlYW4gc2tpcFRvKFN0cmluZyB0b0ZpbmQpIHRocm93cyBJT0V4Y2VwdGlvbiB7CisgICAgICAgIG91dGVyOgorICAgICAgICBmb3IgKDsgcG9zICsgdG9GaW5kLmxlbmd0aCgpIDwgbGltaXQgfHwgZmlsbEJ1ZmZlcih0b0ZpbmQubGVuZ3RoKCkpOyBwb3MrKykgeworICAgICAgICAgICAgZm9yIChpbnQgYyA9IDA7IGMgPCB0b0ZpbmQubGVuZ3RoKCk7IGMrKykgeworICAgICAgICAgICAgICAgIGlmIChidWZmZXJbcG9zICsgY10gIT0gdG9GaW5kLmNoYXJBdChjKSkgeworICAgICAgICAgICAgICAgICAgICBjb250aW51ZSBvdXRlcjsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgLyoqCisgICAgICogUmV0dXJucyB0aGUgc3RyaW5nIHVwIHRvIGJ1dCBub3QgaW5jbHVkaW5nIHtAY29kZSBxdW90ZX0sIHVuZXNjYXBpbmcgYW55CisgICAgICogY2hhcmFjdGVyIGVzY2FwZSBzZXF1ZW5jZXMgZW5jb3VudGVyZWQgYWxvbmcgdGhlIHdheS4gVGhlIG9wZW5pbmcgcXVvdGUKKyAgICAgKiBzaG91bGQgaGF2ZSBhbHJlYWR5IGJlZW4gcmVhZC4gVGhpcyBjb25zdW1lcyB0aGUgY2xvc2luZyBxdW90ZSwgYnV0IGRvZXMKKyAgICAgKiBub3QgaW5jbHVkZSBpdCBpbiB0aGUgcmV0dXJuZWQgc3RyaW5nLgorICAgICAqCisgICAgICogQHBhcmFtIHF1b3RlIGVpdGhlciAnIG9yICIuCisgICAgICogQHRocm93cyBOdW1iZXJGb3JtYXRFeGNlcHRpb24gaWYgYW55IHVuaWNvZGUgZXNjYXBlIHNlcXVlbmNlcyBhcmUKKyAgICAgKiAgICAgbWFsZm9ybWVkLgorICAgICAqLworICAgIHByaXZhdGUgU3RyaW5nIG5leHRTdHJpbmcoY2hhciBxdW90ZSkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICAgU3RyaW5nQnVpbGRlciBidWlsZGVyID0gbnVsbDsKKyAgICAgICAgZG8geworICAgICAgICAgICAgLyogdGhlIGluZGV4IG9mIHRoZSBmaXJzdCBjaGFyYWN0ZXIgbm90IHlldCBhcHBlbmRlZCB0byB0aGUgYnVpbGRlci4gKi8KKyAgICAgICAgICAgIGludCBzdGFydCA9IHBvczsKKyAgICAgICAgICAgIHdoaWxlIChwb3MgPCBsaW1pdCkgeworICAgICAgICAgICAgICAgIGludCBjID0gYnVmZmVyW3BvcysrXTsKKworICAgICAgICAgICAgICAgIGlmIChjID09IHF1b3RlKSB7CisgICAgICAgICAgICAgICAgICAgIGlmIChza2lwcGluZykgeworICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICJza2lwcGVkISI7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoYnVpbGRlciA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IFN0cmluZyhidWZmZXIsIHN0YXJ0LCBwb3MgLSBzdGFydCAtIDEpOworICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAgICAgYnVpbGRlci5hcHBlbmQoYnVmZmVyLCBzdGFydCwgcG9zIC0gc3RhcnQgLSAxKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBidWlsZGVyLnRvU3RyaW5nKCk7CisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoYyA9PSAnXFwnKSB7CisgICAgICAgICAgICAgICAgICAgIGlmIChidWlsZGVyID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJ1aWxkZXIgPSBuZXcgU3RyaW5nQnVpbGRlcigpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGJ1aWxkZXIuYXBwZW5kKGJ1ZmZlciwgc3RhcnQsIHBvcyAtIHN0YXJ0IC0gMSk7CisgICAgICAgICAgICAgICAgICAgIGJ1aWxkZXIuYXBwZW5kKHJlYWRFc2NhcGVDaGFyYWN0ZXIoKSk7CisgICAgICAgICAgICAgICAgICAgIHN0YXJ0ID0gcG9zOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKGJ1aWxkZXIgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgIGJ1aWxkZXIgPSBuZXcgU3RyaW5nQnVpbGRlcigpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgYnVpbGRlci5hcHBlbmQoYnVmZmVyLCBzdGFydCwgcG9zIC0gc3RhcnQpOworICAgICAgICB9IHdoaWxlIChmaWxsQnVmZmVyKDEpKTsKKworICAgICAgICB0aHJvdyBzeW50YXhFcnJvcigiVW50ZXJtaW5hdGVkIHN0cmluZyIpOworICAgIH0KKworICAgIC8qKgorICAgICAqIFJldHVybnMgdGhlIHN0cmluZyB1cCB0byBidXQgbm90IGluY2x1ZGluZyBhbnkgZGVsaW1pdGVyIGNoYXJhY3RlcnMuIFRoaXMKKyAgICAgKiBkb2VzIG5vdCBjb25zdW1lIHRoZSBkZWxpbWl0ZXIgY2hhcmFjdGVyLgorICAgICAqLworICAgIHByaXZhdGUgU3RyaW5nIG5leHRMaXRlcmFsKCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICAgU3RyaW5nQnVpbGRlciBidWlsZGVyID0gbnVsbDsKKyAgICAgICAgZG8geworICAgICAgICAgICAgLyogdGhlIGluZGV4IG9mIHRoZSBmaXJzdCBjaGFyYWN0ZXIgbm90IHlldCBhcHBlbmRlZCB0byB0aGUgYnVpbGRlci4gKi8KKyAgICAgICAgICAgIGludCBzdGFydCA9IHBvczsKKyAgICAgICAgICAgIHdoaWxlIChwb3MgPCBsaW1pdCkgeworICAgICAgICAgICAgICAgIGludCBjID0gYnVmZmVyW3BvcysrXTsKKyAgICAgICAgICAgICAgICBzd2l0Y2ggKGMpIHsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSAnLyc6CisgICAgICAgICAgICAgICAgICAgIGNhc2UgJ1xcJzoKKyAgICAgICAgICAgICAgICAgICAgY2FzZSAnOyc6CisgICAgICAgICAgICAgICAgICAgIGNhc2UgJyMnOgorICAgICAgICAgICAgICAgICAgICBjYXNlICc9JzoKKyAgICAgICAgICAgICAgICAgICAgICAgIGNoZWNrTGVuaWVudCgpOyAvLyBmYWxsLXRocm91Z2gKKworICAgICAgICAgICAgICAgICAgICBjYXNlICd7JzoKKyAgICAgICAgICAgICAgICAgICAgY2FzZSAnfSc6CisgICAgICAgICAgICAgICAgICAgIGNhc2UgJ1snOgorICAgICAgICAgICAgICAgICAgICBjYXNlICddJzoKKyAgICAgICAgICAgICAgICAgICAgY2FzZSAnOic6CisgICAgICAgICAgICAgICAgICAgIGNhc2UgJywnOgorICAgICAgICAgICAgICAgICAgICBjYXNlICcgJzoKKyAgICAgICAgICAgICAgICAgICAgY2FzZSAnXHQnOgorICAgICAgICAgICAgICAgICAgICBjYXNlICdcZic6CisgICAgICAgICAgICAgICAgICAgIGNhc2UgJ1xyJzoKKyAgICAgICAgICAgICAgICAgICAgY2FzZSAnXG4nOgorICAgICAgICAgICAgICAgICAgICAgICAgcG9zLS07CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoc2tpcHBpbmcpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gInNraXBwZWQhIjsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoYnVpbGRlciA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBTdHJpbmcoYnVmZmVyLCBzdGFydCwgcG9zIC0gc3RhcnQpOworICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWlsZGVyLmFwcGVuZChidWZmZXIsIHN0YXJ0LCBwb3MgLSBzdGFydCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGJ1aWxkZXIudG9TdHJpbmcoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisKKyAgICA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sbEJ1ZmZlcigxKSkgeworICAgICAgICAgICAgdGhyb3cgc3ludGF4RXJyb3IoIlVudGVybWluYXRlZCBlc2NhcGUgc2VxdWVuY2UiKTsKKyAgICAgICAgfQorCisgICAgICAgIGNoYXIgZXNjYXBlZCA9IGJ1ZmZlcltwb3MrK107CisgICAgICAgIHN3aXRjaCAoZXNjYXBlZCkgeworICAgICAgICAgICAgY2FzZSAndSc6CisgICAgICAgICAgICAgICAgaWYgKHBvcyArIDQgPiBsaW1pdCAmJiAhZmlsbEJ1ZmZlcig0KSkgeworICAgICAgICAgICAgICAgICAgICB0aHJvdyBzeW50YXhFcnJvcigiVW50ZXJtaW5hdGVkIGVzY2FwZSBzZXF1ZW5jZSIpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBTdHJpbmcgaGV4ID0gbmV3IFN0cmluZyhidWZmZXIsIHBvcywgNCk7CisgICAgICAgICAgICAgICAgcG9zICs9IDQ7CisgICAgICAgICAgICAgICAgcmV0dXJuIChjaGFyKSBJbnRlZ2VyLnBhcnNlSW50KGhleCwgMTYpOworCisgICAgICAgICAgICBjYXNlICd0JzoKKyAgICAgICAgICAgICAgICByZXR1cm4gJ1x0JzsKKworICAgICAgICAgICAgY2FzZSAnYic6CisgICAgICAgICAgICAgICAgcmV0dXJuICdcYic7CisKKyAgICAgICAgICAgIGNhc2UgJ24nOgorICAgICAgICAgICAgICAgIHJldHVybiAnXG4nOworCisgICAgICAgICAgICBjYXNlICdyJzoKKyAgICAgICAgICAgICAgICByZXR1cm4gJ1xyJzsKKworICAgICAgICAgICAgY2FzZSAnZic6CisgICAgICAgICAgICAgICAgcmV0dXJuICdcZic7CisKKyAgICAgICAgICAgIGNhc2UgJ1wnJzoKKyAgICAgICAgICAgIGNhc2UgJyInOgorICAgICAgICAgICAgY2FzZSAnXFwnOgorICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICByZXR1cm4gZXNjYXBlZDsKKyAgICAgICAgfQorICAgI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B7CisgICAgICAgICAgICAgICAgRG91YmxlLnBhcnNlRG91YmxlKHZhbHVlKTsgLy8gdGhpcyB3b3JrIGNvdWxkIHBvdGVudGlhbGx5IGJlIGNhY2hlZAorICAgICAgICAgICAgICAgIHRva2VuID0gSnNvblRva2VuLk5VTUJFUjsKKyAgICAgICAgICAgIH0gY2F0Y2ggKE51bWJlckZvcm1hdEV4Y2VwdGlvbiBpZ25vcmVkKSB7CisgICAgICAgICAgICAgICAgLy8gdGhpcyBtdXN0IGJlIGFuIHVucXVvdGVkIHN0cmluZworICAgICAgICAgICAgICAgIGNoZWNrTGVuaWVudCgpOworICAgICAgICAgICAgICAgIHRva2VuID0gSnNvblRva2VuLlNUUklORzsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIFRocm93cyBhIG5ldyBJTyBleGNlcHRpb24gd2l0aCB0aGUgZ2l2ZW4gbWVzc2FnZSBhbmQgYSBjb250ZXh0IHNuaXBwZXQKKyAgICAgKiB3aXRoIHRoaXMgcmVhZGVyJ3MgY29udGVudC4KKyAgICAgKi8KKyAgICBwdWJsaWMgSU9FeGNlcHRpb24gc3ludGF4RXJyb3IoU3RyaW5nIG1lc3NhZ2UpIHRocm93cyBJT0V4Y2VwdGlvbiB7CisgICAgICAgIHRocm93IG5ldyBKc29uU3ludGF4RXhjZXB0aW9uKG1lc3NhZ2UgKyAiIG5lYXIgIiArIGdldFNuaXBwZXQoKSk7CisgICAgfQorCisgICAgcHJpdmF0ZSBDaGFyU2VxdWVuY2UgZ2V0U25pcHBldCgpIHsKKyAgICAgICAgU3RyaW5nQnVpbGRlciBzbmlwcGV0ID0gbmV3IFN0cmluZ0J1aWxkZXIoKTsKKyAgICAgICAgaW50IGJlZm9yZVBvcyA9IE1hdGgubWluKHBvcywgMjApOworICAgICAgICBzbmlwcGV0LmFwcGVuZChidWZmZXIsIHBvcyAtIGJlZm9yZVBvcywgYmVmb3JlUG9zKTsKKyAgICAgICAga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mQgcmVhZCB1c2luZyB7QGxpbmsgSnNvblJlYWRlciNiZWdpbk9iamVjdH0uCisgICAgICovCisgICAgQkVHSU5fQVJSQVksCisKKyAgICAvKioKKyAgICAgKiBUaGUgY2xvc2luZyBvZiBhIEpTT04gYXJyYXkuIFdyaXR0ZW4gdXNpbmcge0BsaW5rIEpzb25Xcml0ZXIjZW5kQXJyYXl9CisgICAgICogYW5kIHJlYWQgdXNpbmcge0BsaW5rIEpzb25SZWFkZXIjZW5kQXJyYXl9LgorICAgICAqLworICAgIEVORF9BUlJBWSwKKworICAgIC8qKgorICAgICAqIFRoZSBvcGVuaW5nIG9mIGEgSlNPTiBvYmplY3QuIFdyaXR0ZW4gdXNpbmcge0BsaW5rIEpzb25Xcml0ZXIjYmVnaW5PYmplY3R9CisgICAgICogYW5kIHJlYWQgdXNpbmcge0BsaW5rIEpzb25SZWFkZXIjYmVnaW5PYmplY3R9LgorICAgICAqLworICAgIEJFR0lOX09CSkVDVCwKKworICAgIC8qKgorICAgICAqIFRoZSBjbG9zaW5nIG9mIGEgSlNPTiBvYmplY3QuIFdyaXR0ZW4gdXNpbmcge0BsaW5rIEpzb25Xcml0ZXIjZW5kT2JqZWN0fQorICAgICAqIGFuZCByZWFkIHVzaW5nIHtAbGluayBKc29uUmVhZGVyI2VuZE9iamVjdH0uCisgICAgICovCisgICAgRU5EX09CSkVDVCwKKworICAgIC8qKgorICAgICAqIEEgSlNPTiBwcm9wZXJ0eSBuYW1lLiBXaXRoaW4gb2JqZWN0cywgdG9rZW5zIGFsdGVybmF0ZSBiZXR3ZWVuIG5hbWVzIGFuZAorICAgICAqIHRoZWlyIHZhbHVlcy4gV3JpdHRlbiB1c2luZyB7QGxpbmsgSnNvbldyaXRlciNuYW1lfSBhbmQgcmVhZCB1c2luZyB7QGxpbmsKKyAgICAgKiBKc29uUmVhZGVyI25leHROYW1lfQorICAgICAqLworICAgIE5BTUUsCisKKyAgICAvKioKKyAgICAgKiBBIEpTT04gc3RyaW5nLgor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KyAgICAgICAgaWYgKGluZGVudC5pc0VtcHR5KCkpIHsKKyAgICAgICAgICAgIHRoaXMuaW5kZW50ID0gbnVsbDsKKyAgICAgICAgICAgIHRoaXMuc2VwYXJhdG9yID0gIjoiOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgdGhpcy5pbmRlbnQgPSBpbmRlbnQ7CisgICAgICAgICAgICB0aGlzLnNlcGFyYXRvciA9ICI6ICI7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBCZWdpbnMgZW5jb2RpbmcgYSBuZXcgYXJyYXkuIEVhY2ggY2FsbCB0byB0aGlzIG1ldGhvZCBtdXN0IGJlIHBhaXJlZCB3aXRoCisgICAgICogYSBjYWxsIHRvIHtAbGluayAjZW5kQXJyYXl9LgorICAgICAqCisgICAgICogQHJldHVybiB0aGlzIHdyaXRlci4KKyAgICAgKi8KKyAgICBwdWJsaWMgSnNvbldyaXRlciBiZWdpbkFycmF5KCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICAgcmV0dXJuIG9wZW4oSnNvblNjb3BlLkVNUFRZX0FSUkFZLCAiWyIpOworICAgIH0KKworICAgIC8qKgorICAgICAqIEVuZHMgZW5jb2RpbmcgdGhlIGN1cnJlbnQgYXJyYXkuCisgICAgICoKKyAgICAgKiBAcmV0dXJuIHRoaXMgd3JpdGVyLgorICAgICAqLworICAgIHB1YmxpYyBKc29uV3JpdGVyIGVuZEFycmF5KCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICAgcmV0dXJuIGNsb3NlKEpzb25TY29wZS5FTVBUWV9BUlJBWSwgSnNvblNjb3BlLk5PTkVNUFRZX0FSUkFZLCAiXSIpOworICAgIH0KKworICAgIC8qKgorICAgICAqIEJlZ2lucyBlbmNvZGluZyBhIG5ldyBvYmplY3QuIEVhY2ggY2FsbCB0byB0aGlzIG1ldGhvZCBtdXN0IGJlIHBhaXJlZAorICAgICAqIHdpdGggYSBjYWxsIHRvIHtAbGluayAjZW5kT2JqZWN0fS4KKyAgICAgKgorICAgICAqIEByZXR1cm4gdGhpcyB3cml0ZXIuCisgICAgICovCisgICAgcHVibGljIEpzb25Xcml0ZXIgYmVnaW5PYmplY3QoKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICByZXR1cm4gb3BlbihKc29uU2NvcGUuRU1QVFlfT0JKRUNULCAieyIpOworICAgIH0KKworICAgIC8qKgorICAgICAqIEVuZHMgZW5jb2RpbmcgdGhlIGN1cnJlbnQgb2JqZWN0LgorICAgICAqCisgICAgICogQHJldHVybiB0aGlzIHdyaXRlci4KKyAgICAgKi8KKyAgICBwdWJsaWMgSnNvbldyaXRlciBlbmRPYmplY3QoKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICByZXR1cm4gY2xvc2UoSnNvblNjb3BlLkVNUFRZX09CSkVDVCwgSnNvblNjb3BlLk5PTkVNUFRZX09CSkVDVCwgIn0iKTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBFbnRlcnMgYSBuZXcgc2NvcGUgYnkgYXBwZW5kaW5nIGFueSBuZWNlc3Nhcnkgd2hpdGVzcGFjZSBhbmQgdGhlIGdpdmVuCisgICAgICogYnJhY2tldC4KKyAgICAgKi8KKyAgICBwcml2YXRlIEpzb25Xcml0ZXIgb3BlbihKc29uU2NvcGUgZW1wdHksIFN0cmluZyBvcGVuQnJhY2tldCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICAgYmVmb3JlVmFsdWUodHJ1ZSk7CisgICAgICAgIHN0YWNrLmFkZChlbXB0eSk7CisgICAgICAgIG91dC53cml0ZShvcGVuQnJhY2tldCk7CisgICAgICAgIHJldHVybiB0aGlzOworICAgIH0KKworICAgIC8qKgorICAgICAqIENsb3NlcyB0aGUgY3VycmVudCBzY29wZSBieSBhcHBlbmRpbmcgYW55IG5lY2Vzc2FyeSB3aGl0ZXNwYWNlIGFuZCB0aGUKKyAgICAgKiBnaXZlbiBicmFja2V0LgorICAgICAqLworICAgIHByaXZhdGUgSnNvbldyaXRlciBjbG9zZShKc29uU2NvcGUgZW1wdHksIEpzb25TY29wZSBub25lbXB0eSwgU3RyaW5nIGNsb3NlQnJhY2tldCkKKyAgICAgICAgICAgIHRocm93cyBJT0V4Y2VwdGlvbiB7CisgICAgICAgIEpzb25TY29wZSBjb250ZXh0ID0gcGVlaygpOworICAgICAgICBpZiAoY29udGV4dCAhPSBub25lbXB0eSAmJiBjb250ZXh0ICE9IGVtcHR5KSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJOZXN0aW5nIHByb2JsZW06ICIgKyBzdGFjayk7CisgICAgICAgIH0KKworICAgICAgICBzdGFjay5yZW1vdmUoc3RhY2suc2l6ZSgpIC0gMSk7CisgICAgICAgIGlmIChjb250ZXh0ID09IG5vbmVtcHR5KSB7CisgICAgICAgICAgICBuZXdsaW5lKCk7CisgICAgICAgIH0KKyAgICAgICAgb3V0LndyaXRlKGNsb3NlQnJhY2tldCk7CisgICAgICAgIHJldHVybiB0aGlzOworICAgIH0KKworICAgIC8qKgorICAgICAqIFJldHVybnMgdGhlIHZhbHVlIG9uIHRoZSB0b3Agb2YgdGhlIHN0YWNrLgorICAgICAqLworICAgIHByaXZhdGUgSnNvblNjb3BlIHBlZWsoKSB7CisgICAgICAgIHJldHVybiBzdGFjay5nZXQoc3RhY2suc2l6ZSgpIC0gMSk7CisgICAgfQorCisgICAgLyoqCisgICAgICogUmVwbGFjZSB0aGUgdmFsdWUgb24gdGhlIHRvcCBvZiB0aGUgc3RhY2sgd2l0aCB0aGUgZ2l2ZW4gdmFsdWUuCisgICAgICovCisgICAgcHJpdmF0ZSB2b2lkIHJlcGxhY2VUb3AoSnNvblNjb3BlIHRvcE9mU3RhY2spIHsKKyAgICAgICAgc3RhY2suc2V0KHN0YWNrLnNpemUoKSAtIDEsIHRvcE9mU3RhY2spOworICAgIH0KKworICAgIC8qKgorICAgICAqIEVuY29kZXMgdGhlIHByb3BlcnR5IG5hbWUuCisgICAgICoKKyAgICAgKiBAcGFyYW0gbmFtZSB0aGUgbmFtZSBvZiB0aGUgZm9ydGhjb21pbmcgdmFsdWUuIE1heSBub3QgYmUgbnVsbC4KKyAgICAgKiBAcmV0dXJuIHRoaXMgd3JpdGVyLgorICAgICAqLworICAgIHB1YmxpYyBKc29uV3JpdGVyIG5hbWUoU3RyaW5nIG5hbWUpIHRocm93cyBJT0V4Y2VwdGlvbiB7CisgICAgICAgIGlmIChuYW1lID09IG51bGwpIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBOdWxsUG9pbnRlckV4Y2VwdGlvbigibmFtZSA9PSBudWxsIik7CisgICAgICAgIH0KKyAgICAgICAgYmVmb3JlTmFtZSgpOworICAgICAgICBzdHJpbmcobmFtZSk7CisgICAgICAgIHJldHVybiB0aGlzOworICAgIH0KKworICAgIC8qKgorICAgICAqIEVuY29kZXMge0Bjb2RlIHZhbHVlfS4KKyAgICAgKgorICAgICAqIEBwYXJhbSB2YWx1ZSB0aGUgbGl0ZXJhbCBzdHJpbmcgdmFsdWUsIG9yIG51bGwgdG8gZW5jb2RlIGEgbnVsbCBsaXRlcmFsLgorICAgICAqIEByZXR1cm4gdGhpcyB3cml0ZXIuCisgICAgICovCisgICAgcHVibGljIEpzb25Xcml0ZXIgdmFsdWUoU3RyaW5nIHZhbHVlKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICBpZiAodmFsdWUgPT0gbnVsbCkgeworICAgICAgICAgICAgcmV0dXJuIG51bGxWYWx1ZSgpOworICAgICAgICB9CisgICAgICAgIGJlZm9yZVZhbHVlKGZhbHNlKTsKKyAgICAgICAgc3RyaW5nKHZhbHVlKTsKKyAgICAgICAgcmV0dXJuIHRoaXM7CisgICAgfQorCisgICAgLyoqCisgICAgICogRW5jb2RlcyB7QGNvZGUgbnVsbH0uCisgICAgICoKKyAgICAgKiBAcmV0dXJuIHRoaXMgd3JpdGVyLgorICAgICAqLwor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OworICAgICAgICB9CisgICAgICAgIGJlZm9yZVZhbHVlKGZhbHNlKTsKKyAgICAgICAgb3V0LmFwcGVuZChEb3VibGUudG9TdHJpbmcodmFsdWUpKTsKKyAgICAgICAgcmV0dXJuIHRoaXM7CisgICAgfQorCisgICAgLyoqCisgICAgICogRW5jb2RlcyB7QGNvZGUgdmFsdWV9LgorICAgICAqCisgICAgICogQHJldHVybiB0aGlzIHdyaXRlci4KKyAgICAgKi8KKyAgICBwdWJsaWMgSnNvbldyaXRlciB2YWx1ZShsb25nIHZhbHVlKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICBiZWZvcmVWYWx1ZShmYWxzZSk7CisgICAgICAgIG91dC53cml0ZShMb25nLnRvU3RyaW5nKHZhbHVlKSk7CisgICAgICAgIHJldHVybiB0aGlzOworICAgIH0KKworICAgIC8qKgorICAgICAqIEVuc3VyZXMgYWxsIGJ1ZmZlcmVkIGRhdGEgaXMgd3JpdHRlbiB0byB0aGUgdW5kZXJseWluZyB7QGxpbmsgV3JpdGVyfQorICAgICAqIGFuZCBmbHVzaGVzIHRoYXQgd3JpdGVyLgorICAgICAqLworICAgIHB1YmxpYyB2b2lkIGZsdXNoKCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICAgb3V0LmZsdXNoKCk7CisgICAgfQorCisgICAgLyoqCisgICAgICogRmx1c2hlcyBhbmQgY2xvc2VzIHRoaXMgd3JpdGVyIGFuZCB0aGUgdW5kZXJseWluZyB7QGxpbmsgV3JpdGVyfS4KKyAgICAgKgorICAgICAqIEB0aHJvd3MgSU9FeGNlcHRpb24gaWYgdGhlIEpTT04gZG9jdW1lbnQgaXMgaW5jb21wbGV0ZS4KKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBjbG9zZSgpIHRocm93cyBJT0V4Y2VwdGlvbiB7CisgICAgICAgIG91dC5jbG9zZSgpOworCisgICAgICAgIGlmIChwZWVrKCkgIT0gSnNvblNjb3BlLk5PTkVNUFRZX0RPQ1VNRU5UKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgSU9FeGNlcHRpb24oIkluY29tcGxldGUgZG9jdW1lbnQiKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgdm9pZCBzdHJpbmcoU3RyaW5nIHZhbHVlKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICBvdXQud3JpdGUoIlwiIik7CisgICAgICAgIGZvciAoaW50IGkgPSAwLCBsZW5ndGggPSB2YWx1ZS5sZW5ndGgoKTsgaSA8IGxlbmd0aDsgaSsrKSB7CisgICAgICAgICAgICBjaGFyIGMgPSB2YWx1ZS5jaGFyQXQoaSk7CisKKyAgICAgICAgICAgIC8qCisgICAgICAgICAgICAgKiBGcm9tIFJGQyA0NjI3LCAiQWxsIFVuaWNvZGUgY2hhcmFjdGVycyBtYXkgYmUgcGxhY2VkIHdpdGhpbiB0aGUKKyAgICAgICAgICAgICAqIHF1b3RhdGlvbiBtYXJrcyBleGNlcHQgZm9yIHRoZSBjaGFyYWN0ZXJzIHRoYXQgbXVzdCBiZSBlc2NhcGVkOgorICAgICAgICAgICAgICogcXVvdGF0aW9uIG1hcmssIHJldmVyc2Ugc29saWR1cywgYW5kIHRoZSBjb250cm9sIGNoYXJhY3RlcnMKKyAgICAgICAgICAgICAqIChVKzAwMDAgdGhyb3VnaCBVKzAwMUYpLiIKKyAgICAgICAgICAgICAqLworICAgICAgICAgICAgc3dpdGNoIChjKSB7CisgICAgICAgICAgICAgICAgY2FzZSAnIic6CisgICAgICAgICAgICAgICAgY2FzZSAnXFwnOgorICAgICAgICAgICAgICAgIGNhc2UgJy8nOgorICAgICAgICAgICAgICAgICAgICBvdXQud3JpdGUoJ1xcJyk7CisgICAgICAgICAgICAgICAgICAgIG91dC53cml0ZShjKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICAgICAgICBjYXNlICdcdCc6CisgICAgICAgICAgICAgICAgICAgIG91dC53cml0ZSgiXFx0Iik7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICAgICAgY2FzZSAnXGInOgorICAgICAgICAgICAgICAgICAgICBvdXQud3JpdGUoIlxcYiIpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKworICAgICAgICAgICAgICAgIGNhc2UgJ1xuJzoKKyAgICAgICAgICAgICAgICAgICAgb3V0LndyaXRlKCJcXG4iKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICAgICAgICBjYXNlICdccic6CisgICAgICAgICAgICAgICAgICAgIG91dC53cml0ZSgiXFxyIik7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICAgICAgY2FzZSAnXGYnOgorICAgICAgICAgICAgICAgICAgICBvdXQud3JpdGUoIlxcZiIpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKworICAgICAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgICAgIGlmIChjIDw9IDB4MUYpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIG91dC53cml0ZShTdHJpbmcuZm9ybWF0KCJcXHUlMDR4IiwgKGludCkgYykpOworICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAgICAgb3V0LndyaXRlKGMpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorCisgICAgICAgIH0KKyAgICAgICAgb3V0LndyaXRlKCJcIiIpOworICAgIH0KKworICAgIHByaXZhdGUgdm9pZCBuZXdsaW5lKCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICAgaWYgKGluZGVudCA9PSBudWxsKSB7CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKworICAgICAgICBvdXQud3JpdGUoIlxuIik7CisgICAgICAgIGZvciAoaW50IGkgPSAxOyBpIDwgc3RhY2suc2l6ZSgpOyBpKyspIHsKKyAgIC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gICoKKyAgICAgKiBAcGFyYW0gcm9vdCB0cnVlIGlmIHRoZSB2YWx1ZSBpcyBhIG5ldyBhcnJheSBvciBvYmplY3QsIHRoZSB0d28gdmFsdWVzCisgICAgICogICAgIHBlcm1pdHRlZCBhcyB0b3AtbGV2ZWwgZWxlbWVudHMuCisgICAgICovCisgICAgcHJpdmF0ZSB2b2lkIGJlZm9yZVZhbHVlKGJvb2xlYW4gcm9vdCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICAgc3dpdGNoIChwZWVrKCkpIHsKKyAgICAgICAgICAgIGNhc2UgRU1QVFlfRE9DVU1FTlQ6IC8vIGZpcnN0IGluIGRvY3VtZW50CisgICAgICAgICAgICAgICAgaWYgKCFyb290KSB7CisgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIkpTT04gbXVzdCBzdGFydCB3aXRoIGFuIGFycmF5IG9yIGFuIG9iamVjdC4iKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgcmVwbGFjZVRvcChKc29uU2NvcGUuTk9ORU1QVFlfRE9DVU1FTlQpOworICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICBjYXNlIEVNUFRZX0FSUkFZOiAvLyBmaXJzdCBpbiBhcnJheQorICAgICAgICAgICAgICAgIHJlcGxhY2VUb3AoSnNvblNjb3BlLk5PTkVNUFRZX0FSUkFZKTsKKyAgICAgICAgICAgICAgICBuZXdsaW5lKCk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICAgIGNhc2UgTk9ORU1QVFlfQVJSQVk6IC8vIGFub3RoZXIgaW4gYXJyYXkKKyAgICAgICAgICAgICAgICBvdXQuYXBwZW5kKCcsJyk7CisgICAgICAgICAgICAgICAgbmV3bGluZSgpOworICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICBjYXNlIER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FpbnQpOworCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgZHJhd0JpdG1hcChCaXRtYXAgYml0bWFwLCBSZWN0IHNyYywgUmVjdCBkc3QsIFBhaW50IHBhaW50KSB7CisgICAgICAgIC8vIFNoYWRlcnMgYXJlIGlnbm9yZWQgd2hlbiBkcmF3aW5nIGJpdG1hcHMKKyAgICAgICAgYm9vbGVhbiBoYXNDb2xvckZpbHRlciA9IHBhaW50ICE9IG51bGwgJiYgc2V0dXBDb2xvckZpbHRlcihwYWludCk7CisgICAgICAgIGZpbmFsIGludCBuYXRpdmVQYWludCA9IHBhaW50ID09IG51bGwgPyAwIDogcGFpbnQubU5hdGl2ZVBhaW50OworCisgICAgICAgIGludCBsZWZ0LCB0b3AsIHJpZ2h0LCBib3R0b207CisgICAgICAgIGlmIChzcmMgPT0gbnVsbCkgeworICAgICAgICAgICAgbGVmdCA9IHRvcCA9IDA7CisgICAgICAgICAgICByaWdodCA9IGJpdG1hcC5nZXRXaWR0aCgpOworICAgICAgICAgICAgYm90dG9tID0gYml0bWFwLmdldEhlaWdodCgpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgbGVmdCA9IHNyYy5sZWZ0OworICAgICAgICAgICAgcmlnaHQgPSBzcmMucmlnaHQ7CisgICAgICAgICAgICB0b3AgPSBzcmMudG9wOworICAgICAgICAgICAgYm90dG9tID0gc3JjLmJvdHRvbTsKKyAgICAgICAgfQorCisgICAgICAgIG5EcmF3Qml0bWFwKG1SZW5kZXJlciwgYml0bWFwLm1OYXRpdmVCaXRtYXAsIGxlZnQsIHRvcCwgcmlnaHQsIGJvdHRvbSwKKyAgICAgICAgICAgICAgICBkc3QubGVmdCwgZHN0LnRvcCwgZHN0LnJpZ2h0LCBkc3QuYm90dG9tLCBuYXRpdmVQYWludCk7CisgICAgICAgIGlmIChoYXNDb2xvckZpbHRlcikgblJlc2V0TW9kaWZpZXJzKG1SZW5kZXJlcik7CisgICAgfQorCisgICAgQE92ZXJ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ZXJyaWRlCisgICAgcHVibGljIHZvaWQgZHJhd0xpbmUoZmxvYXQgc3RhcnRYLCBmbG9hdCBzdGFydFksIGZsb2F0IHN0b3BYLCBmbG9hdCBzdG9wWSwgUGFpbnQgcGFpbnQpIHsKKyAgICAgICAgbUxpbmVbMF0gPSBzdGFydFg7CisgICAgICAgIG1MaW5lWzFdID0gc3RhcnRZOworICAgICAgICBtTGluZVsyXSA9IHN0b3BYOworICAgICAgICBtTGluZVszXSA9IHN0b3BZOworICAgICAgICBkcmF3TGluZXMobUxpbmUsIDAsIDEsIHBhaW50KTsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgdm9pZCBkcmF3TGluZXMoZmxvYXRbXSBwdHMsIGludCBvZmZzZXQsIGludCBjb3VudCwgUGFpbnQgcGFpbnQpIHsKKyAgICAgICAgLy8gVE9ETzogSW1wbGVtZW50CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgZHJhd0xpbmVzKGZsb2F0W10gcHRzLCBQYWludCBwYWludCkgeworICAgICAgICBkcmF3TGluZXMocHRzLCAwLCBwdHMubGVuZ3RoIC8gNCwgcGFpbnQpOworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIGRyYXdPdmFsKFJlY3RGIG92YWwsIFBhaW50IHBhaW50KSB7CisgICAgICAgIHRocm93IG5ldyBVbnN1cHBvcnRlZE9wZXJhdGlvbkV4Y2VwdGlvbigpOworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIGRyYXdQYWludChQYWludCBwYWludCkgeworICAgICAgICBmaW5hbCBSZWN0IHIgPSBtQ2xpcEJvdW5kczsKKyAgICAgICAgbkdldENsaXBCb3VuZHMobVJlbmRlcmVyLCByKTsKKyAgICAgICAgZHJhd1JlY3Qoci5sZWZ0LCByLnRvcCwgci5yaWdodCwgci5ib3R0b20sIHBhaW50KTsKKyAgICB9CisKKyAgICBAT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ZXB0aW9uKCk7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgZHJhd1BpY3R1cmUoUGljdHVyZSBwaWN0dXJlLCBSZWN0RiBkc3QpIHsKKyAgICAgICAgdGhyb3cgbmV3IFVuc3VwcG9ydGVkT3BlcmF0aW9uRXhjZXB0aW9uKCk7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgZHJhd1BvaW50KGZsb2F0IHgsIGZsb2F0IHksIFBhaW50IHBhaW50KSB7CisgICAgICAgIG1Qb2ludFswXSA9IHg7CisgICAgICAgIG1Qb2ludFsxXSA9IHk7CisgICAgICAgIGRyYXdQb2ludHMobVBvaW50LCAwLCAxLCBwYWludCk7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgZHJhd1BvaW50cyhmbG9hdFtdIHB0cywgaW50IG9mZnNldCwgaW50IGNvdW50LCBQYWludCBwYWludCkgeworICAgICAgICAvLyBUT0RPOiBJbXBsZW1lbnQKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgdm9pZCBkcmF3UG9pbnRzKGZsb2F0W10gcHRzLCBQYWludCBwYWludCkgeworICAgICAgICBkcmF3UG9pbnRzKHB0cywgMCwgcHRzLmxlbmd0aCAvIDIsIHBhaW50KTsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgdm9pZCBkcmF3UG9zVGV4dChjaGFyW10gdGV4dCwgaW50IGluZGV4LCBpbnQgY291bnQsIGZsb2F0W10gcG9zLCBQYWludCBwYWludCkgeworICAgICAgICB0aHJvdyBuZXcgVW5zdXBwb3J0ZWRPcGVyYXRpb25FeGNlcHRpb24oKTsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgdm9pZCBkcmF3UG9zVGV4dChTdHJpbmcgdGV4dCwgZmxvYXRbXSBwb3MsIFBhaW50IHBhaW50KSB7CisgICAgICAgIHRocm93IG5ldyBVbnN1cHBvcnRlZE9wZXJhdGlvbkV4Y2VwdGlvbigpOworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIGRyYXdSZWN0KGZsb2F0IGxlZnQsIGZsb2F0IHRvcCwgZmxvYXQgcmlnaHQsIGZsb2F0IGJvdHRvbSwgUGFpbnQgcGFpbnQpIHsKKyAgICAgICAgYm9vbGVhbiBoYXNNb2RpZmllciA9IHNldHVwTW9kaWZpZXJzKHBhaW50KTsKKyAgICAgICAgbkRyYXdSZWN0KG1SZW5kZXJlciwgbGVmdCwgdG9wLCByaWdodCwgYm90dG9tLCBwYWludC5tTmF0aXZlUGFpbnQpOworICAgICAgICBpZiAoaGFzTW9kaWZpZXIpIG5SZXNldE1vZGlmaWVycyhtUmVuZGVyZXIpOworICAgIH0KKworICAgIHByaXZhdGUgbmF0aXZlIHZvaWQgbkRyYXdSZWN0KGludCByZW5kZXJlciwgZmxvYXQgbGVmdCwgZmxvYXQgdG9wLCBmbG9hdCByaWdodCwgZmxvYXQgYm90dG9tLAorICAgICAgICAgICAgaW50IHBhaW50KTsKKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIGRyYXdSZWN0KFJlY3QgciwgUGFpbnQgcGFpbnQpIHsKKyAgICAgICAgZHJhd1JlY3Qoci5sZWZ0LCByLnRvcCwgci5yaWdodCwgci5ib3R0b20sIHBhaW50KTsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgdm9pZCBkcmF3UmVjdChSZWN0RiByLCBQYWludCBwYWludCkgeworICAgICAgICBkcmF3UmVjdChyLmxlZnQsIHIudG9wLCByLnJpZ2h0LCByLmJvdHRvbSwgcGFpbnQpOworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIGRyYXdSR0IoaW50IHIsIGludCBnLCBpbnQgYikgeworICAgICAgICBkcmF3Q29sb3IoMHhGRjAwMDAwMCB8IChyICYgMHhGRikgPDwgMTYgfCAoZyAmIDB4RkYpIDw8IDggfCAoYiAmIDB4RkYpKTsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgdm9pZCBkcmF3Um91bmRSZWN0KFJlY3RGIHJlY3QsIGZsb2F0IHJ4LCBmbG9hdCByeSwgUGFpbnQgcGFpbnQpIHsKKyAgICAgICAgLy8gVE9ETzogSW1wbGVtZW50CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgZHJhd1RleHQoY2hhcltdIHRleHQsIGludCBpbmRleCwgaW50IGNvdW50LCBmbG9hdCB4LCBmbG9hdCB5LCBQYWludCBwYWludCkgeworICAgICAgICBpZiAoKGluZGV4IHwgY291bnQgfCAoaW5kZXggKyBjb3VudCkgfCAodGV4dC5sZW5ndGggLSBpbmRleCAtIGNvdW50KSkgPCAwKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgSW5kZXhPdXRPZkJvdW5kc0V4Y2VwdGlvbigpOworICAgICAgICB9CisKKyAgICAgICAgYm9vbGVhbiBoYXNNb2RpZmllciA9IHNldHVwTW9kaWZpZXJzKHBhaW50KTsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIG5EcmF3VGV4dChtUmVuZGVyZXIsIHRleHQsIGluZGV4LCBjb3VudCwgeCwgeSwgcGFpbnQubUJpZGlGbGFncywgcGFpbnQubU5hdGl2ZVBhaW50KTsKKyAgICAgICAgfSBmaW5hbGx5IHsKKyAgICAgICAgICAgIGlmIChoYXNNb2RpZmllcikgblJlc2V0TW9kaWZpZXJzKG1SZW5kZXJlcik7CisgICAgICAgIH0KKyAgICB9CisgICAgCisgICAgcHJpdmF0ZSBuYXRpdmUgdm9pZCBuRHJhd1RleHQoaW50IHJlbmRlcmVyLCBjaGFyW10gdGV4dCwgaW50IGluZGV4LCBpbnQgY291bnQsIGZsb2F0IHgsIGZsb2F0IHksCisgICAgICAgICAgICBpbnQgYmlkaUZsYWdzLCBpbnQgcGFpbnQpOworCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgZHJhd1RleHQoQ2hhclNlcXVlbmNlIHRleHQsIGludCBzdGFydCwgaW50IGVuZCwgZmxvYXQgeCwgZmxvYXQgeSwgUGFpbnQgcGFpbnQpIHsKKyAgICAgICAgYm9vbGVhbiBoYXNNb2RpZmllciA9IHNldHVwTW9kaWZpZXJzKHBhaW50KTsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIGlmICh0ZXh0IGluc3RhbmNlb2YgU3RyaW5nIHx8IHRleHQgaW5zdGFuY2VvZiBTcGFubmVkU3RyaW5nIHx8CisgICAgICAgICAgICAgICAgICAgIHRleHQgaW5zdGFuY2VvZiBTcGFubmFibGVTdHJpbmcpIHsKKyAgICAgICAgICAgICAgICBuRHJhd1RleHQobVJlbmRlcmVyLCB0ZXh0LnRvU3RyaW5nKCksIHN0YXJ0LCBlbmQsIHgsIHksIHBhaW50Lm1CaWRpRmxhZ3MsCisgICAgICAgICAgICAgICAgICAgICAgICBwYWludC5tTmF0aXZlUGFpbnQpOworICAgICAgICAgICAgfSBlbHNlIGlmICh0ZXh0IGluc3RhbmNlb2YgR3JhcGhpY3NPcGVyYXRpb25zKSB7CisgICAgICAgICAgICAgICAgKChHcmFwaGljc09wZXJhdGlvbnMpIHRleHQpLmRyYXdUZXh0KHRoaXMsIHN0YXJ0LCBlbmQsIHgsIHksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYWludCk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIGNoYXJbXSBidWYgPSBUZW1wb3JhcnlCdWZmZXIub2J0YWluKGVuZCAtIHN0YXJ0KTsKKyAgICAgICAgICAgICAgICBUZXh0VXRpbHMuZ2V0Q2hhcnModGV4dCwgc3RhcnQsIGVuZCwgYnVmLCAwKTsKKyAgICAgICAgICAgICAgICBuRHJhd1RleHQobVJlbmRlcmVyLCBidWYsIDAsIGVuZCAtIHN0YXJ0LCB4LCB5LCBwYWludC5tQmlkaUZsYWdzLCBwYWludC5tTmF0aXZlUGFpbnQpOworICAgICAgICAgICAgICAgIFRlbXBvcmFyeUJ1ZmZlci5yZWN5Y2xlKGJ1Zik7CisgICAgICAgICAgICB9CisgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICBpZiAoaGFzTW9kaWZpZXIpIG5SZXNldE1vZGlmaWVycyhtUmVuZGVyZXIpOworICAgICAgICB9CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgZHJhd1RleHQoU3RyaW5nIHRleHQsIGludCBzdGFydCwgaW50IGVuZCwgZmxvYXQgeCwgZmxvYXQgeSwgUGFpbnQgcGFpbnQpIHsKKyAgICAgICAgaWYgKChzdGFydCB8IGVuZCB8IChlbmQgLSBzdGFydCkgfCAodGV4dC5sZW5ndGgoKSAtIGVuZCkpIDwgMCkgeworICAgICAgICAgICAgdGhyb3cgbmV3IEluZGV4T3V0T2ZCb3VuZHNFeGNlcHRpb24oKTsKKyAgICAgICAgfQorCisgICAgICAgIGJvb2xlYW4gaGFzTW9kaWZpZXIgPSBzZXR1cE1vZGlmaWVycyhwYWludCk7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBuRHJhd1RleHQobVJlbmRlcmVyLCB0ZXh0LCBzdGFydCwgZW5kLCB4LCB5LCBwYWludC5tQmlkaUZsYWdzLCBwYWludC5tTmF0aXZlUGFpbnQpOworICAgICAgICB9IGZpbmFsbHkgeworICAgICAgICAgICAgaWYgKGhhc01vZGlmaWVyKSBuUmVzZXRNb2RpZmllcnMobVJlbmRlcmVyKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgbmF0aXZlIHZvaWQgbkRyYXdUZXh0KGludCByZW5kZXJlciwgU3RyaW5nIHRleHQsIGludCBzdGFydCwgaW50IGVuZCwgZmxvYXQgeCwgZmxvYXQgeSwKKyAgICAgICAgICAg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1bihjaGFyW10gdGV4dCwgaW50IGluZGV4LCBpbnQgY291bnQsIGludCBjb250ZXh0SW5kZXgsIGludCBjb250ZXh0Q291bnQsCisgICAgICAgICAgICBmbG9hdCB4LCBmbG9hdCB5LCBpbnQgZGlyLCBQYWludCBwYWludCkgeworICAgICAgICBpZiAoKGluZGV4IHwgY291bnQgfCB0ZXh0Lmxlbmd0aCAtIGluZGV4IC0gY291bnQpIDwgMCkgeworICAgICAgICAgICAgdGhyb3cgbmV3IEluZGV4T3V0T2ZCb3VuZHNFeGNlcHRpb24oKTsKKyAgICAgICAgfQorICAgICAgICBpZiAoZGlyICE9IERJUkVDVElPTl9MVFIgJiYgZGlyICE9IERJUkVDVElPTl9SVEwpIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oIlVua25vd24gZGlyZWN0aW9uOiAiICsgZGlyKTsKKyAgICAgICAgfQorCisgICAgICAgIGJvb2xlYW4gaGFzTW9kaWZpZXIgPSBzZXR1cE1vZGlmaWVycyhwYWludCk7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBuRHJhd1RleHRSdW4obVJlbmRlcmVyLCB0ZXh0LCBpbmRleCwgY291bnQsIGNvbnRleHRJbmRleCwgY29udGV4dENvdW50LCB4LCB5LCBkaXIsCisgICAgICAgICAgICAgICAgICAgIHBhaW50Lm1OYXRpdmVQYWludCk7CisgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICBpZiAoaGFzTW9kaWZpZXIpIG5SZXNldE1vZGlmaWVycyhtUmVuZGVyZXIpOworICAgICAgICB9CisgICAgfQorCisgICAgcHJpdmF0ZSBuYXRpdmUgdm9pZCBuRHJhd1RleHRSdW4oaW50IHJlbmRlcmVyLCBjaGFyW10gdGV4dCwgaW50IGluZGV4LCBpbnQgY291bnQsCisgICAgICAgICAgICBpbnQgY29udGV4dEluZGV4LCBpbnQgY29udGV4dENvdW50LCBmbG9hdCB4LCBmbG9hdCB5LCBpbnQgZGlyLCBpbnQgbmF0aXZlUGFpbnQpOworCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgZHJhd1RleHRSdW4oQ2hhclNlcXVlbmNlIHRleHQsIGludCBzdGFydCwgaW50IGVuZCwgaW50IGNvbnRleHRTdGFydCwgaW50IGNvbnRleHRFbmQsCisgICAgICAgICAgICBmbG9hdCB4LCBmbG9hdCB5LCBpbnQgZGlyLCBQYWludCBwYWludCkgeworICAgICAgICBpZiAoKHN0YXJ0IHwgZW5kIHwgZW5kIC0gc3RhcnQgfCB0ZXh0Lmxlbmd0aCgpIC0gZW5kKSA8IDApIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBJbmRleE91dE9mQm91bmRzRXhjZXB0aW9uKCk7CisgICAgICAgIH0KKworICAgICAgICBib29sZWFuIGhhc01vZGlmaWVyID0gc2V0dXBNb2RpZmllcnMocGFpbnQpOworICAgICAgICB0cnkgeworICAgICAgICAgICAgaW50IGZsYWdzID0gZGlyID09IDAgPyAwIDogMTsKKyAgICAgICAgICAgIGlmICh0ZXh0IGluc3RhbmNlb2YgU3RyaW5nIHx8IHRleHQgaW5zdGFuY2VvZiBTcGFubmVkU3RyaW5nIHx8CisgICAgICAgICAgICAgICAgICAgIHRleHQgaW5zdGFuY2VvZiBTcGFubmFibGVTdHJpbmcpIHsKKyAgICAgICAgICAgICAgICBuRHJhd1RleHRSdW4obVJlbmRlcmVyLCB0ZXh0LnRvU3RyaW5nKCksIHN0YXJ0LCBlbmQsIGNvbnRleHRTdGFydCwKKyAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRleHRFbmQsIHgsIHksIGZsYWdzLCBwYWludC5tTmF0aXZlUGFpbnQpOworICAgICAgICAgICAgfSBlbHNlIGlmICh0ZXh0IGluc3RhbmNlb2YgR3JhcGhpY3NPcGVyYXRpb25zKSB7CisgICAgICAgICAgICAgICAgKChHcmFwaGljc09wZXJhdGlvbnMpIHRleHQpLmRyYXdUZXh0UnVuKHRoaXMsIHN0YXJ0LCBlbmQsCisgICAgICAgICAgICAgICAgICAgICAgICBjb250ZXh0U3RhcnQsIGNvbnRleHRFbmQsIHgsIHksIGZsYWdzLCBwYWludCk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIGludCBjb250ZXh0TGVuID0gY29udGV4dEVuZCAtIGNvbnRleHRTdGFydDsKKyAgICAgICAgICAgICAgICBpbnQgbGVuID0gZW5kIC0gc3RhcnQ7CisgICAgICAgICAgICAgICAgY2hhcltdIGJ1ZiA9IFRlbXBvcmFyeUJ1ZmZlci5vYnRhaW4oY29udGV4dExlbik7CisgICAgICAgICAgICAgICAgVGV4dFV0aWxzLmdldENoYXJzKHRleHQsIGNvbnRleHRTdGFydCwgY29udGV4dEVuZCwgYnVmLCAwKTsKKyAgICAgICAgICAgICAgICBuRHJhd1RleHRSdW4obVJlbmRlcmVyLCBidWYsIHN0YXJ0IC0gY29udGV4dFN0YXJ0LCBsZW4sIDAsIGNvbnRleHRMZW4sCisgICAgICAgICAgICAgICAgICAgICAgICB4LCB5LCBmbGFncywgcGFpbnQubU5hdGl2ZVBhaW50KTsKKyAgICAgICAgICAgICAgICBUZW1wb3JhcnlCdWZmZXIucmVjeWNsZShidWYpOworICAgICAgICAgICAgfQorICAgICAgICB9IGZpbmFsbHkgeworICAgICAgICAgICAgaWYgKGhhc01vZGlmaWVyKSBuUmVzZXRNb2RpZmllcnMobVJlbmRlcmVyKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgbmF0aXZlIHZvaWQgbkRyYXdUZXh0UnVuKGludCByZW5kZXJlciwgU3RyaW5nIHRleHQsIGludCBzdGFydCwgaW50IGVuZCwKKyAgICAgICAgICAgIGludCBjb250ZXh0U3RhcnQsIGludCBjb250ZXh0RW5kLCBmbG9hdCB4LCBmbG9hdCB5LCBpbnQgZmxhZ3MsIGludCBuYXRpdmVQYWludCk7CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgdm9pZCBkcmF3VmVydGljZXMoVmVydGV4TW9kZSBtb2RlLCBpbnQgdmVydGV4Q291bnQsIGZsb2F0W10gdmVydHMsIGludCB2ZXJ0T2Zmc2V0LAorICAgICAgICAgICAgZmxvYXRbXSB0ZXhzLCBpbnQgdGV4T2Zmc2V0LCBpbnRbXSBjb2xvcnMsIGludCBjb2xvck9mZnNldCwgc2hvcnRbXSBpbmRpY2VzLAorICAgICAgICAgICAgaW50IGluZGV4T2Zmc2V0LCBpbnQgaW5kZXhDb3VudCwgUGFpbnQgcGFpbnQpIHsKKyAgICAgICAgLy8gVE9ETzogSW1wbGVtZW50CisgICAgfQorCisgICAgcHJpdmF0ZSBib29sZWFuIHNldHVwTW9kaWZpZXJzKFBhaW50IHBhaW50KSB7CisgICAgICAgIGJvb2xlYW4gaGFzTW9kaWZpZXIgPSBmYWxzZTsKKworICAgICAgICBpZiAocGFpbnQuaGFzU2hhZG93KSB7CisgICAgICAgICAgICBuU2V0dXBTaGFkb3cobVJlbmRlcmVyLCBwYWludC5zaGFkb3dSYWRpdXMsIHBhaW50LnNoYWRvd0R4LCBwYWludC5zaGFkb3dEeSwKKyAgICAgICAgICAgICAgICAgICAgcGFpbnQuc2hhZG93Q29sb3IpOworICAgICAgICAgICAgaGFzTW9kaWZpZXIgPSB0cnVlOworICAgICAgICB9CisKKyAgICAgICAgZmluYWwgU2hhZGVyIHNoYWRlciA9IHBhaW50LmdldFNoYWRlcigpOworICAgICAgICBpZiAoc2hhZGVyICE9IG51bGwpIHsKKyAgICAgICAgICAgIG5TZXR1cFNoYWRlcihtUmVuZGVyZXIsIHNoYWRlci5uYXRpdmVfc2hhZGVyKTsKKyAgICAgICAgICAgIGhhc01vZGlmaWVyID0gdHJ1ZTsKKyAgICAgICAgfQorCisgICAgICAgIGZpbmFsIENvbG9yRmlsdGVyIGZpbHRlciA9IHBhaW50LmdldENvbG9yRmlsdGVyKCk7CisgICAgICAgIGlmIChmaWx0ZXIgIT0gbnVsbCkgeworICAgICAgICAg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bENvbmZpZzsKKworICAgICAgICBHTCBtR2w7CisgICAgICAgIENhbnZhcyBtQ2FudmFzOworCisgICAgICAgIGZpbmFsIGludCBtR2xWZXJzaW9uOworICAgICAgICBmaW5hbCBib29sZWFuIG1UcmFuc2x1Y2VudDsKKworICAgICAgICBHbFJlbmRlcmVyKGludCBnbFZlcnNpb24sIGJvb2xlYW4gdHJhbnNsdWNlbnQpIHsKKyAgICAgICAgICAgIG1HbFZlcnNpb24gPSBnbFZlcnNpb247CisgICAgICAgICAgICBtVHJhbnNsdWNlbnQgPSB0cmFuc2x1Y2VudDsKKyAgICAgICAgfQorCisgICAgICAgIC8qKgorICAgICAgICAgKiBDaGVja3MgZm9yIE9wZW5HTCBlcnJvcnMuIElmIGFuIGVycm9yIGhhcyBvY2N1cmVkLCB7QGxpbmsgI2Rlc3Ryb3koKX0KKyAgICAgICAgICogaXMgaW52b2tlZCBhbmQgdGhlIHJlcXVlc3RlZCBmbGFnIGlzIHR1cm5lZCBvZmYuIFRoZSBlcnJvciBjb2RlIGlzCisgICAgICAgICAqIGFsc28gbG9nZ2VkIGFzIGEgd2FybmluZy4KKyAgICAgICAgICovCisgICAgICAgIHZvaWQgY2hlY2tFcnJvcnMoKSB7CisgICAgICAgICAgICBpZiAoaXNFbmFibGVkKCkpIHsKKyAgICAgICAgICAgICAgICBpbnQgZXJyb3IgPSBtRWdsLmVnbEdldEVycm9yKCk7CisgICAgICAgICAgICAgICAgaWYgKGVycm9yICE9IEVHTDEwLkVHTF9TVUNDRVNTKSB7CisgICAgICAgICAgICAgICAgICAgIC8vIHNvbWV0aGluZyBiYWQgaGFzIGhhcHBlbmVkIHJldmVydCB0bworICAgICAgICAgICAgICAgICAgICAvLyBub3JtYWwgcmVuZGVyaW5nLgorICAgICAgICAgICAgICAgICAgICBkZXN0cm95KCk7CisgICAgICAgICAgICAgICAgICAgIGlmIChlcnJvciAhPSBFR0wxMS5FR0xfQ09OVEVYVF9MT1NUKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAvLyB3ZSdsbCB0cnkgYWdhaW4gaWYgaXQgd2FzIGNvbnRleHQgbG9zdAorICAgICAgICAgICAgICAgICAgICAgICAgc2V0UmVxdWVzdGVkKGZhbHNlKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBMb2cudyhMT0dfVEFHLCAiT3BlbkdMIGVycm9yOiAiICsgZXJyb3IpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIGJvb2xlYW4gaW5pdGlhbGl6ZShTdXJmYWNlSG9sZGVyIGhvbGRlcikgeworICAgICAgICAgICAgaWYgKGlzUmVxdWVzdGVkKCkgJiYgIWlzRW5hYmxlZCgpKSB7CisgICAgICAgICAgICAgICAgaW5pdGlhbGl6ZUVnbCgpOworICAgICAgICAgICAgICAgIG1HbCA9IGNyZWF0ZUVnbFN1cmZhY2UoaG9sZGVyKTsKKworICAgICAgICAgICAgICAgIGlmIChtR2wgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICBpbnQgZXJyID0gbUVnbC5lZ2xHZXRFcnJvcigpOworICAgICAgICAgICAgICAgICAgICBpZiAoZXJyICE9IEVHTDEwLkVHTF9TVUNDRVNTKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBkZXN0cm95KCk7CisgICAgICAgICAgICAgICAgICAgICAgICBzZXRSZXF1ZXN0ZWQoZmFsc2UpOworICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAgICAgbUNhbnZhcyA9IGNyZWF0ZUNhbnZhcygpOworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1DYW52YXMgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldEVuYWJsZWQodHJ1ZSk7CisgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIExvZy53KExPR19UQUcsICJIYXJkd2FyZSBhY2NlbGVyYXRlZCBDYW52YXMgY291bGQgbm90IGJlIGNyZWF0ZWQiKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgIHJldHVybiBtQ2FudmFzICE9IG51bGw7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisKKyAgICAgICAgYWJzdHJhY3QgQ2FudmFzIGNyZWF0ZUNhbnZhcygpOworCisgICAgICAgIHZvaWQgaW5pdGlhbGl6ZUVnbCgpIHsKKyAgICAgICAgICAgIG1FZ2wgPSAoRUdMMTApIEVHTENvbnRleHQuZ2V0RUdMKCk7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIC8vIEdldCB0byB0aGUgZGVmYXVsdCBkaXNwbGF5LgorICAgICAgICAgICAgbUVnbERpc3BsYXkgPSBtRWdsLmVnbEdldERpc3BsYXkoRUdMMTAuRUdMX0RFRkFVTFRfRElTUExBWSk7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIGlmIChtRWdsRGlzcGxheSA9PSBFR0wxMC5FR0xfTk9fRElTUExBWSkgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBSdW50aW1lRXhjZXB0aW9uKCJlZ2xHZXREaXNwbGF5IGZhaWxlZCIpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgCisgICAgICAgICAgICAvLyBXZSBjYW4gbm93IGluaXRpYWxpemUgRUdMIGZvciB0aGF0IGRpc3BsYXkKKyAgICAgICAgICAgIGludFtdIHZlcnNpb24gPSBuZXcgaW50WzJdOworICAgICAgICAgICAgaWYgKCFtRWdsLmVnbEluaXRpYWxpemUobUVnbERpc3BsYXksIHZlcnNpb24pKSB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFJ1bnRpbWVFeGNlcHRpb24oImVnbEluaXRpYWxpemUgZmFpbGVkIik7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBtRWdsQ29uZmlnID0gZ2V0Q29uZmlnQ2hvb3NlcihtR2xWZXJzaW9uKS5jaG9vc2VDb25maWcobUVnbCwgbUVnbERpc3BsYXkpOworICAgICAgICAgICAgCisgICAgICAgICAgICAvKgorICAgICAgICAgICAgKiBDcmVhdGUgYW4gRUdMIGNvbnRleHQuIFdlIHdhbnQgdG8gZG8gdGhpcyBhcyByYXJlbHkgYXMgd2UgY2FuLCBiZWNhdXNlIGFuCisgICAgICAgICAgICAqIEVHTCBjb250ZXh0IGlzIGEgc29tZXdoYXQgaGVhdnkgb2JqZWN0LgorICAgICAgICAgICAgKi8KKyAgICAgICAgICAgIG1FZ2xDb250ZXh0ID0gY3JlYXRlQ29udGV4dChtRWdsLCBtRWdsRGlzcGxheSwgbUVnbENvbmZpZyk7CisgICAgICAgIH0KKworICAgICAgICBHTCBjcmVhdGVFZ2xTdXJmYWNlKFN1cmZhY2VIb2xkZXIgaG9sZGVyKSB7CisgICAgICAgICAgICAvLyBDaGVjayBwcmVjb25kaXRpb25zLgorICAgICAgICAgICAgaWYgKG1FZ2wgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBSdW50aW1lRXhjZXB0aW9uKCJlZ2wgbm90IGluaXRpYWxpemVkIik7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAobUVnbERpc3BsYXkgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBSdW50aW1lRXhjZXB0aW9uKCJlZ2xEaXNwbGF5IG5vdCBpbml0aWFsaXplZCIpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKG1FZ2xDb25maWcgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBSdW50aW1lRXhjZXB0aW9uKCJtRWdsQ29uZmlnIG5vdCBpbml0aWFsaXplZCIpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICAvKgorICAgICAgICAgICAgICogIFRoZSB3aW5kb3cgc2l6ZSBoYXMgY2hhbmdlZCwgc28gd2UgbmVlZCB0byBjcmVhdGUgYSBuZXcKKyAgICAgICAgICAgICAqICBzdXJmYWNlLgorICAgICAgICAgICAgICovCisgICAgICAgICAgICBpZiAobUVnbFN1cmZhY2UgIT0gbnVsbCAmJiBtRWdsU3VyZmFjZSAhPSBFR0wxMC5FR0xfTk9fU1VSRkFDRSkgeworCisgICAgICAgICAgICAgICAgLyoKKyAgICAgICAgICAgICAgICAgKiBVbmJpbmQgYW5kIGRlc3Ryb3kgdGhlIG9sZCBFR0wgc3VyZmFjZSwgaWYKKyAgICAgICAgICAgICAgICAgKiB0aGVyZSBpcyBvbmUuCisgICAgICAgICAgICAgICAgICovCisgICAgICAgICAgICAgICAgbUVnbC5lZ2xNYWtlQ3VycmVudChtRWdsRGlzcGxheSwgRUdMMTAuRUdMX05PX1NVUkZBQ0UsCisgICAgICAgICAgICAgICAgICAgICAgICBFR0wxMC5FR0xfTk9fU1VSRkFDRSwgRUdMMTAuRUdMX05PX0NPTlRFWFQpOworICAgICAgICAgICAgICAgIG1FZ2wuZWdsRGVzdHJveVN1cmZhY2UobUVnbERpc3BsYXksIG1FZ2xTdXJmYWNlKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgLy8gQ3JlYXRlIGFuIEVHTCBzdXJmYWNlIHdlIGNhbiByZW5kZXIgaW50by4KKyAgICAgICAgICAgIG1FZ2xTdXJmYWNlID0gbUVnbC5lZ2xDcmVhdGVXaW5kb3dTdXJmYWNlKG1FZ2xEaXNwbGF5LCBtRWdsQ29uZmlnLCBob2xkZXIsIG51bGwpOworCisgICAgICAgICAgICBpZiAobUVnbFN1cmZhY2UgPT0gbnVsbCB8fCBtRWdsU3VyZmFjZSA9PSBFR0wxMC5FR0xfTk9fU1VSRkFDRSkgeworICAgICAgICAgICAgICAgIGludCBlcnJvciA9IG1FZ2wuZWdsR2V0RXJyb3IoKTsKKyAgICAgICAgICAgICAgICBpZiAoZXJyb3IgPT0gRUdMMTAuRUdMX0JBRF9OQVRJVkVfV0lORE9XKSB7CisgICAgICAgICAgICAgICAgICAgIExvZy5lKCJFZ2xIZWxwZXIiLCAiY3JlYXRlV2luZG93U3VyZmFjZSByZXR1cm5lZCBFR0xfQkFEX05BVElWRV9XSU5ET1cuIik7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgUnVudGltZUV4Y2VwdGlvbigiY3JlYXRlV2luZG93U3VyZmFjZSBmYWlsZWQiKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgLyoKKyAgICAgICAgICAgICAqIEJlZm9yZSB3ZSBjYW4gaXNzdWUgR0wgY29tbWFuZHMsIHdlIG5lZWQgdG8gbWFrZSBzdXJlCisgICAgICAgICAgICAgKiB0aGUgY29udGV4dCBpcyBjdXJyZW50IGFuZCBib3VuZCB0byBhIHN1cmZhY2UuCisgICAgICAgICAgICAgKi8KKyAgICAgICAgICAgIGlmICghbUVnbC5lZ2xNYWtlQ3VycmVudChtRWdsRGlzcGxheSwgbUVnbFN1cmZhY2UsIG1FZ2xTdXJmYWNlLCBtRWdsQ29udGV4dCkpIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgUnVudGltZUV4Y2VwdGlvbigiZWdsTWFrZUN1cnJlbnQgZmFpbGVkIik7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHJldHVybiBtRWdsQ29udGV4dC5nZXRHTCgpOworICAgICAgICB9CisKKyAgICAgICAgRUdMQ29udGV4dCBjcmVhdGVDb250ZXh0KEVHTDEwIGVnbCwgRUdMRGlzcGxheSBlZ2xEaXNwbGF5LCBFR0xDb25maWcgZWdsQ29uZmlnKSB7CisgICAgICAgICAgICBpbnRbXSBhdHRyaWJfbGlzdCA9IHsgRUdMX0NPTlRFWFRfQ0xJRU5UX1ZFUlNJT04sIG1HbFZlcnNpb24sIEVHTDEwLkVHTF9OT05FIH07CisKKyAgICAgICAgICAgIHJldHVybiBlZ2wuZWdsQ3JlYXRlQ29udGV4dChlZ2xEaXNwbGF5LCBlZ2xDb25maWcsIEVHTDEwLkVHTF9OT19DT05URVhULAorICAgICAgICAgICAgICAgICAgICBtR2xWZXJzaW9uICE9IDAgPyBhdHRyaWJfbGlzdCA6IG51bGwpOyAgICAgICAgICAgIAorICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHZvaWQgaW5pdGlhbGl6ZUlmTmVlZGVkKGludCB3aWR0aCwgaW50IGhlaWdodCwgVmlldy5BdHRhY2hJbmZvIGF0dGFjaEluZm8sCisgICAgICAgICAgICAgICAgU3VyZmFjZUhvbGRlciBob2xkZXIpIHsKKworICAgICAgICAgICAgaWYgKGlzUmVxdWVzdGVkKCkpIHsKKyAgICAgICAgICAgICAgICBjaGVja0Vycm9ycygpOworICAgICAgICAgICAgICAgIHN1cGVyLmluaXRpYWxpemVJZk5lZWRlZCh3aWR0aCwgaGVpZ2h0LCBhdHRhY2hJbmZvLCBob2xkZXIpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIAorICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgdm9pZCBkZXN0cm95KCkgeworICAgICAgICAgICAgaWYgKCFpc0VuYWJsZWQoKSkgcmV0dXJuOworCisgICAgICAgICAgICBtRWdsLmVnbE1ha2VDdXJyZW50KG1FZ2xEaXNwbGF5LCBFR0wxMC5FR0xfTk9fU1VSRkFDRSwKKyAgICAgICAgICAgICAgICAgICAgRUdMMTAuRUdMX05PX1NVUkZBQ0UsIEVHTDEwLkVHTF9OT19DT05URVhUKTsKKyAgICAgICAgICAgIG1FZ2wuZWdsRGVzdHJveUNvbnRleHQobUVnbERpc3BsYXksIG1FZ2xDb250ZXh0KTsKKyAgICAgICAgICAgIG1FZ2wuZWdsRGVzdHJveVN1cmZhY2UobUVnbERpc3BsYXksIG1FZ2xTdXJmYWNlKTsKKyAgICAgICAgICAgIG1FZ2wuZWdsVGVybWluYXRlKG1FZ2xEaXNwbGF5KTsKKworICAgICAgICAgICAgbUVnbENvbnRleHQgPSBudWxsOworICAgICAgICAgICAgbUVnbFN1cmZhY2UgPSBudWxsOworICAgICAgICAgICAgbUVnbERpc3BsYXkgPSBudWxsOworICAgICAgICAgICAgbUVnbCA9IG51bGw7CisgICAgICAgICAgICBtR2wgPSBudWxsOworICAgICAgICAgICAgbUNhbnZhcyA9IG51bGw7CisKKyAgICAgICAgICAgIHNldEVuYWJsZWQoZmFsc2UpOworICAgICAgICB9ICAgICAgICAKKyAgICAgICAgCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICB2b2lkIHNldHVwKGludCB3aWR0aCwgaW50IGhlaWdodCwgVmlldy5BdHRhY2hJbmZvIGF0dGFjaEluZm8pIHsKKyAgICAgICAgICAgIGZpbmFsIGZsb2F0IHNjYWxlID0gYXR0YWNoSW5mby5tQXBwbGljYXRpb25TY2FsZTsKKyAgICAgICAgICAgIG1DYW52YXMuc2V0Vmlld3BvcnQoKGludCkgKHdpZHRoICogc2NhbGUgKyAwLjVmKSwgKGludCkgKGhlaWdodCAqIHNjYWxlICsgMC41ZikpOworICAgICAgICB9CisgICAgICAgIAorICAgICAgICBib29sZWFuIGNhbkRyYXcoKSB7CisgICAgICAgICAgICByZXR1cm4gbUdsICE9IG51bGwgJiYgbUNhbnZhcyAhPSBudWxsOworICAgICAgICB9ICAgICAgICAKKyAgICAgICAgCisgICAgICAgIHZvaWQgb25QcmVEcmF3KCkgeworICAgICAgICB9CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIERlZmluZXMgdGhlIEVHTCBjb25maWd1cmF0aW9uIGZvciB0aGlzIHJlbmRlcmVyLiBUaGUgZGVmYXVsdCBjb25maWd1cmF0aW9uCisgICAgICAgICAqIGlzIFJHQlgsIG5vIGRlcHRoLCBubyBzdGVuY2lsLgorICAgICAgICAgKiAKKyAgICAgICAgICog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ICAgICAgICAgICAgICAgICAgICBtRWdsLmVnbEdldEN1cnJlbnRTdXJmYWNlKEVHTDEwLkVHTF9EUkFXKSAhPSBtRWdsU3VyZmFjZSkgeworICAgICAgICAgICAgICAgICAgICBpZiAoIW1FZ2wuZWdsTWFrZUN1cnJlbnQobUVnbERpc3BsYXksIG1FZ2xTdXJmYWNlLCBtRWdsU3VyZmFjZSwgbUVnbENvbnRleHQpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgUnVudGltZUV4Y2VwdGlvbigiZWdsTWFrZUN1cnJlbnQgZmFpbGVkIik7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICBvblByZURyYXcoKTsKKworICAgICAgICAgICAgICAgIENhbnZhcyBjYW52YXMgPSBtQ2FudmFzOworICAgICAgICAgICAgICAgIGludCBzYXZlQ291bnQgPSBjYW52YXMuc2F2ZSgpOworICAgICAgICAgICAgICAgIGNhbnZhcy50cmFuc2xhdGUoMCwgLXlPZmZzZXQpOworCisgICAgICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICAgICAgdmlldy5kcmF3KGNhbnZhcyk7CisgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKKyAgICAgICAgICAgICAgICAgICAgY2FudmFzLnJlc3RvcmVUb0NvdW50KHNhdmVDb3VudCk7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgYXR0YWNoSW5mby5tSWdub3JlRGlydHlTdGF0ZSA9IGZhbHNlOworCisgICAgICAgICAgICAgICAgbUVnbC5lZ2xTd2FwQnVmZmVycyhtRWdsRGlzcGxheSwgbUVnbFN1cmZhY2UpOworICAgICAgICAgICAgICAgIGNoZWNrRXJyb3JzKCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBzdGF0aWMgYWJzdHJhY3QgY2xhc3MgRWdsQ29uZmlnQ2hvb3NlciB7CisgICAgICAgICAgICBmaW5hbCBpbnRbXSBtQ29uZmlnU3BlYzsKKyAgICAgICAgICAgIHByaXZhdGUgZmluYWwgaW50IG1HbFZlcnNpb247CisKKyAgICAgICAgICAgIEVnbENvbmZpZ0Nob29zZXIoaW50IGdsVmVyc2lvbiwgaW50W10gY29uZmlnU3BlYykgeworICAgICAgICAgICAgICAgIG1HbFZlcnNpb24gPSBnbFZlcnNpb247CisgICAgICAgICAgICAgICAgbUNvbmZpZ1NwZWMgPSBmaWx0ZXJDb25maWdTcGVjKGNvbmZpZ1NwZWMpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBFR0xDb25maWcgY2hvb3NlQ29uZmlnKEVHTDEwIGVnbCwgRUdMRGlzcGxheSBkaXNwbGF5KSB7CisgICAgICAgICAgICAgICAgaW50W10gaW5kZXggPSBuZXcgaW50WzFdOworICAgICAgICAgICAgICAgIGlmICghZWdsLmVnbENob29zZUNvbmZpZyhkaXNwbGF5LCBtQ29uZmlnU3BlYywgbnVsbCwgMCwgaW5kZXgpKSB7CisgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oImVnbENob29zZUNvbmZpZyBmYWlsZWQiKTsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICBpbnQgbnVtQ29uZmlncyA9IGluZGV4WzBdOworICAgICAgICAgICAgICAgIGlmIChudW1Db25maWdzIDw9IDApIHsKKyAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigiTm8gY29uZmlncyBtYXRjaCBjb25maWdTcGVjIik7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgRUdMQ29uZmlnW10gY29uZmlncyA9IG5ldyBFR0xDb25maWdbbnVtQ29uZmlnc107CisgICAgICAgICAgICAgICAgaWYgKCFlZ2wuZWdsQ2hvb3NlQ29uZmlnKGRpc3BsYXksIG1Db25maWdTcGVjLCBjb25maWdzLCBudW1Db25maWdzLCBpbmRleCkpIHsKKyAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigiZWdsQ2hvb3NlQ29uZmlnIGZhaWxlZCIpOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIEVHTENvbmZpZyBjb25maWcgPSBjaG9vc2VDb25maWcoZWdsLCBkaXNwbGF5LCBjb25maWdzKTsKKyAgICAgICAgICAgICAgICBpZiAoY29uZmlnID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigiTm8gY29uZmlnIGNob3NlbiIpOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIHJldHVybiBjb25maWc7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGFic3RyYWN0IEVHTENvbmZpZyBjaG9vc2VDb25maWcoRUdMMTAgZWdsLCBFR0xEaXNwbGF5IGRpc3BsYXksIEVHTENvbmZpZ1tdIGNvbmZpZ3MpOworCisgICAgICAgICAgICBwcml2YXRlIGludFtdIGZpbHRlckNvbmZpZ1NwZWMoaW50W10gY29uZmlnU3BlYykgeworICAgICAgICAgICAgICAgIGlmIChtR2xWZXJzaW9uICE9IDIpIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNvbmZpZ1NwZWM7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIC8qIFdlIGtub3cgbm9uZSBvZiB0aGUgc3ViY2xhc3NlcyBkZWZpbmUgRUdMX1JFTkRFUkFCTEVfVFlQRS4KKyAgICAgICAgICAgICAgICAgKiBBbmQgd2Uga25vdyB0aGUgY29uZmlnU3BlYyBpcyB3ZWxsIGZvcm1lZC4KKyAgICAgICAgICAgICAgICAgKi8KKyAgICAgICAgICAgICAgICBpbnQgbGVuID0gY29uZmlnU3BlYy5sZW5ndGg7CisgICAgICAgICAgICAgICAgaW50W10gbmV3Q29uZmlnU3BlYyA9IG5ldyBpbnRbbGVuICsgMl07CisgICAgICAgICAgICAgICAgU3lzdGVtLmFycmF5Y29weShjb25maWdTcGVjLCAwLCBuZXdDb25maWdTcGVjLCAwLCBsZW4gLSAxKTsKKyAgICAgICAgICAgICAgICBuZXdDb25maWdTcGVjW2xlbiAtIDFdID0gRUdMMTAuRUdMX1JFTkRFUkFCTEVfVFlQRTsKKyAgICAgICAgICAgICAgICBuZXdDb25maWdTcGVjW2xlbl0gPSA0OyAvKiBFR0xfT1BFTkdMX0VTMl9CSVQgKi8KKyAgICAgICAgICAgICAgICBuZXdDb25maWdTcGVjW2xlbiArIDFdID0gRUdMMTAuRUdMX05PTkU7CisgICAgICAgICAgICAgICAgcmV0dXJuIG5ld0NvbmZpZ1NwZWM7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICAvKioKKyAgICAgICAgICogQ2hvb3NlIGEgY29uZmlndXJhdGlvbiB3aXRoIGV4YWN0bHkgdGhlIHNwZWNpZmllZCByLGcsYixhIHNpemVzLAorICAgICAgICAgKiBhbmQgYXQgbGVhc3QgdGhlIHNwZWNpZmllZCBkZXB0aCBhbmQgc3RlbmNpbCBzaXplcy4KKyAgICAgICAgICovCisgICAgICAgIHN0YXRpYyBjbGFzcyBDb21wb25lbnRTaXplQ2hvb3NlciBleHRlbmRzIEVnbENvbmZpZ0Nob29zZXIgeworICAgICAgICAgICAgcHJpdmF0ZSBpbnRbXSBtVmFsdWU7CisKKyAgICAgICAgICAgIHByaXZhdGUgaW50IG1SZWRTaXplOworICAgICAgICAgICAgcHJpdmF0ZSBpbnQgbUdyZWVuU2l6ZTsKKyAgICAgICAgICAgIHByaXZhdGUgaW50IG1CbHVlU2l6ZTsKKyAgICAgICAgICAgIHByaXZhdGUgaW50IG1BbHBoYVNpemU7CisgICAgICAgICAgICBwcml2YXRlIGludCBtRGVwdGhTaXplOworICAgICAgICAgICAgcHJpdmF0ZSBpbnQgbVN0ZW5jaWxTaXplOworCisgICAgICAgICAgICBDb21wb25lbnRTaXplQ2hvb3NlcihpbnQgZ2xWZXJzaW9uLCBpbnQgcmVkU2l6ZSwgaW50IGdyZWVuU2l6ZSwgaW50IGJsdWVTaXplLAorICAgICAgICAgICAgICAgICAgICBpbnQgYWxwaGFTaXplLCBpbnQgZGVwdGhTaXplLCBpbnQgc3RlbmNpbFNpemUpIHsKKyAgICAgICAgICAgICAgICBzdXBlcihnbFZlcnNpb24sIG5ldyBpbnRbXSB7CisgICAgICAgICAgICAgICAgICAgICAgICBFR0wxMC5FR0xfUkVEX1NJWkUsIHJlZFNpemUsCisgICAgICAgICAgICAgICAgICAgICAgICBFR0wxMC5FR0xfR1JFRU5fU0laRSwgZ3JlZW5TaXplLAorICAgICAgICAgICAgICAgICAgICAgICAgRUdMMTAuRUdMX0JMVUVfU0laRSwgYmx1ZVNpemUsCisgICAgICAgICAgICAgICAgICAgICAgICBFR0wxMC5FR0xfQUxQSEFfU0laRSwgYWxwaGFTaXplLAorICAgICAgICAgICAgICAgICAgICAgICAgRUdMMTAuRUdMX0RFUFRIX1NJWkUsIGRlcHRoU2l6ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgIEVHTDEwLkVHTF9TVEVOQ0lMX1NJWkUsIHN0ZW5jaWxTaXplLAorICAgICAgICAgICAgICAgICAgICAgICAgRUdMMTAuRUdMX05PTkUgfSk7CisgICAgICAgICAgICAgICAgbVZhbHVlID0gbmV3IGludFsxXTsKKyAgICAgICAgICAgICAgICBtUmVkU2l6ZSA9IHJlZFNpemU7CisgICAgICAgICAgICAgICAgbUdyZWVuU2l6ZSA9IGdyZWVuU2l6ZTsKKyAgICAgICAgICAgICAgICBtQmx1ZVNpemUgPSBibHVlU2l6ZTsKKyAgICAgICAgICAgICAgICBtQWxwaGFTaXplID0gYWxwaGFTaXplOworICAgICAgICAgICAgICAgIG1EZXB0aFNpemUgPSBkZXB0aFNpemU7CisgICAgICAgICAgICAgICAgbVN0ZW5jaWxTaXplID0gc3RlbmNpbFNpemU7CisgICAgICAgICAgIH0KKworICAgICAgICAgICAgQE92ZXJyaWRlCisgICAgICAgICAgICBFR0xDb25maWcgY2hvb3NlQ29uZmlnKEVHTDEwIGVnbCwgRUdMRGlzcGxheSBkaXNwbGF5LCBFR0xDb25maWdbXSBjb25maWdzKSB7CisgICAgICAgICAgICAgICAgZm9yIChFR0xDb25maWcgY29uZmlnIDogY29uZmlncykgeworICAgICAgICAgICAgICAgICAgICBpbnQgZCA9IGZpbmRDb25maWdBdHRyaWIoZWdsLCBkaXNwbGF5LCBjb25maWcsIEVHTDEwLkVHTF9ERVBUSF9TSVpFLCAwKTsKKyAgICAgICAgICAgICAgICAgICAgaW50IHMgPSBmaW5kQ29uZmlnQXR0cmliKGVnbCwgZGlzcGxheSwgY29uZmlnLCBFR0wxMC5FR0xfU1RFTkNJTF9TSVpFLCAwKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGQgPj0gbURlcHRoU2l6ZSAmJiBzID49IG1TdGVuY2lsU2l6ZSkgeworICAgICAgICAgICAgICAgICAgICAgICAgaW50IHIgPSBmaW5kQ29uZmlnQXR0cmliKGVnbCwgZGlzcGxheSwgY29uZmlnLCBFR0wxMC5FR0xfUkVEX1NJWkUsIDApOworICAgICAgICAgICAgICAgICAgICAgICAgaW50IGcgPSBmaW5kQ29uZmlnQXR0cmliKGVnbCwgZGlzcGxheSwgY29uZmlnLCBFR0wxMC5FR0xfR1JFRU5fU0laRSwgMCk7CisgICAgICAgICAgICAgICAgICAgICAgICBpbnQgYiA9IGZpbmRDb25maWdBdHRyaWIoZWdsLCBkaXNwbGF5LCBjb25maWcsIEVHTDEwLkVHTF9CTFVFX1NJWkUsIDApOworICAgICAgICAgICAgICAgICAgICAgICAgaW50IGEgPSBmaW5kQ29uZmlnQXR0cmliKGVnbCwgZGlzcGxheSwgY29uZmlnLCBFR0wxMC5FR0xfQUxQSEFfU0laRSwgMCk7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAociA9PSBtUmVkU2l6ZSAmJiBnID09IG1HcmVlblNpemUgJiYgYiA9PSBtQmx1ZVNpemUgJiYgYSA+PSBtQWxwaGFTaXplKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNvbmZpZzsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcHJpdmF0ZSBpbnQgZmluZENvbmZpZ0F0dHJpYihFR0wxMCBlZ2wsIEVHTERpc3BsYXkgZGlzcGxheSwgRUdMQ29uZmlnIGNvbmZpZywKKyAgICAgICAgICAgICAgICAgICAgaW50IGF0dHJpYnV0ZSwgaW50IGRlZmF1bHRWYWx1ZSkgeworICAgICAgICAgICAgICAgIGlmIChlZ2wuZWdsR2V0Q29uZmlnQXR0cmliKGRpc3BsYXksIGNvbmZpZywgYXR0cmlidXRlLCBtVmFsdWUpKSB7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBtVmFsdWVbMF07CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgcmV0dXJuIGRlZmF1bHRWYWx1ZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKyAgICAKKyAgICAvKioKKyAgICAgKiBIYXJkd2FyZSByZW5kZXJlciB1c2luZyBPcGVuR0wgRVMgMi4wLgorICAgICAqLworICAgIHN0YXRpYyBjbGFzcyBHbDIwUmVuZGVyZXIgZXh0ZW5kcyBHbFJlbmRlcmVyIHsKKyAgICAgICAgcHJpdmF0ZSBHTEVTMjBDYW52YXMgbUdsQ2FudmFzOworCisgICAgICAgIEdsMjBSZW5kZXJlcihib29sZWFuIHRyYW5zbHVjZW50KSB7CisgICAgICAgICAgICBzdXBlcigyLCB0cmFuc2x1Y2VudCk7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJ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Xc+PiBzQ29uc3RydWN0b3JNYXAgPQorICAgICAgICAgICAgbmV3IEhhc2hNYXA8U3RyaW5nLCBDb25zdHJ1Y3Rvcjw/IGV4dGVuZHMgVmlldz4+KCk7CiAgICAgCiAgICAgcHJpdmF0ZSBIYXNoTWFwPFN0cmluZywgQm9vbGVhbj4gbUZpbHRlck1hcDsKIApAQCAtOTcsNiArOTcsNyBAQAogICAgICAgICAgKiAKICAgICAgICAgICogQHJldHVybiBUcnVlIGlmIHRoaXMgY2xhc3MgaXMgYWxsb3dlZCB0byBiZSBpbmZsYXRlZCwgb3IgZmFsc2Ugb3RoZXJ3aXNlCiAgICAgICAgICAqLworICAgICAgICBAU3VwcHJlc3NXYXJuaW5ncygidW5jaGVja2VkIikKICAgICAgICAgYm9vbGVhbiBvbkxvYWRDbGFzcyhDbGFzcyBjbGF6eik7CiAgICAgfQogICAgIApAQCAtMzc5LDcgKzM4MCw3IEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgIlZpZXdHcm91cCByb290IGFuZCBhdHRhY2hUb1Jvb3Q9dHJ1ZSIpOwogICAgICAgICAgICAgICAgICAgICB9CiAKLSAgICAgICAgICAgICAgICAgICAgckluZmxhdGUocGFyc2VyLCByb290LCBhdHRycyk7CisgICAgICAgICAgICAgICAgICAgIHJJbmZsYXRlKHBhcnNlciwgcm9vdCwgYXR0cnMsIGZhbHNlKTsKICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAvLyBUZW1wIGlzIHRoZSByb290IHZpZXcgdGhhdCB3YXMgZm91bmQgaW4gdGhlIHhtbAogICAgICAgICAgICAgICAgICAgICBWaWV3IHRlbXAgPSBjcmVhdGVWaWV3RnJvbVRhZyhuYW1lLCBhdHRycyk7CkBAIC00MDQsNyArNDA1LDcgQEAKICAgICAgICAgICAgICAgICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbigiLS0tLS0+IHN0YXJ0IGluZmxhdGluZyBjaGlsZHJl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Y2xhenogPSBudWxsOworICAgICAgICBDb25zdHJ1Y3Rvcjw/IGV4dGVuZHMgVmlldz4gY29uc3RydWN0b3IgPSBzQ29uc3RydWN0b3JNYXAuZ2V0KG5hbWUpOworICAgICAgICBDbGFzczw/IGV4dGVuZHMgVmlldz4gY2xhenogPSBudWxsOwogCiAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICBpZiAoY29uc3RydWN0b3IgPT0gbnVsbCkgewogICAgICAgICAgICAgICAgIC8vIENsYXNzIG5vdCBmb3VuZCBpbiB0aGUgY2FjaGUsIHNlZSBpZiBpdCdzIHJlYWwsIGFuZCB0cnkgdG8gYWRkIGl0CiAgICAgICAgICAgICAgICAgY2xhenogPSBtQ29udGV4dC5nZXRDbGFzc0xvYWRlcigpLmxvYWRDbGFzcygKLSAgICAgICAgICAgICAgICAgICAgICAgIHByZWZpeCAhPSBudWxsID8gKHByZWZpeCArIG5hbWUpIDogbmFtZSk7CisgICAgICAgICAgICAgICAgICAgICAgICBwcmVmaXggIT0gbnVsbCA/IChwcmVmaXggKyBuYW1lKSA6IG5hbWUpLmFzU3ViY2xhc3MoVmlldy5jbGFzcyk7CiAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgaWYgKG1GaWx0ZXIgIT0gbnVsbCAmJiBjbGF6eiAhPSBudWxsKSB7CiAgICAgICAgICAgICAgICAgICAgIGJvb2xlYW4gYWxsb3dlZCA9IG1GaWx0ZXIub25Mb2FkQ2xhc3MoY2xhenopOwpAQCAtNDgyLDcgKzQ4Myw3IEBACiAgICAgICAgICAgICAgICAgICAgIGlmIChhbGxvd2VkU3RhdGUgPT0gbnVsbCkgewogICAgICAgICAgICAgICAgICAgICAgICAgLy8gTmV3IGNsYXNzIC0tIHJlbWVtYmVyIHdoZXRoZXIgaXQgaXMgYWxsb3dlZAogICAgICAgICAgICAgICAgICAgICAgICAgY2xhenogPSBtQ29udGV4dC5nZXRDbGFzc0xvYWRlcigpLmxvYWRDbGFzcygKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJlZml4ICE9IG51bGwgPyAocHJlZml4ICsgbmFtZSkgOiBuYW1lKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJlZml4ICE9IG51bGwgPyAocHJlZml4ICsgbmFtZSkgOiBuYW1lKS5hc1N1YmNsYXNzKFZpZXcuY2xhc3MpOwogICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICBib29sZWFuIGFsbG93ZWQgPSBjbGF6eiAhPSBudWxsICYmIG1GaWx0ZXIub25Mb2FkQ2xhc3MoY2xhenopOwogICAgICAgICAgICAgICAgICAgICAgICAgbUZpbHRlck1hcC5wdXQobmFtZSwgYWxsb3dlZCk7CkBAIC00OTcsNyArNDk4LDcgQEAKIAogICAgICAgICAgICAgT2JqZWN0W10gYXJncyA9IG1Db25zdHJ1Y3RvckFyZ3M7CiAgICAgICAgICAgICBhcmdzWzFdID0gYXR0cnM7Ci0gICAgICAgICAgICByZXR1cm4gKFZpZXcpIGNvbnN0cnVjdG9yLm5ld0luc3RhbmNlKGFyZ3MpOworICAgICAgICAgICAgcmV0dXJuIGNvbnN0cnVjdG9yLm5ld0luc3RhbmNlKGFyZ3MpOwogCiAgICAgICAgIH0gY2F0Y2ggKE5vU3VjaE1ldGhvZEV4Y2VwdGlvbiBlKSB7CiAgICAgICAgICAgICBJbmZsYXRlRXhjZXB0aW9uIGllID0gbmV3IEluZmxhdGVFeGNlcHRpb24oYXR0cnMuZ2V0UG9zaXRpb25EZXNjcmlwdGlvbigpCkBAIC01MDYsNiArNTA3LDEzIEBACiAgICAgICAgICAgICBpZS5pbml0Q2F1c2UoZSk7CiAgICAgICAgICAgICB0aHJvdyBpZTsKIAorICAgICAgICB9IGNhdGNoIChDbGFzc0Nhc3RFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgLy8gSWYgbG9hZGVkIGNsYXNzIGlzIG5vdCBhIFZpZXcgc3ViY2xhc3MKKyAg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ckluZmxhdGUocGFyc2VyLCB2aWV3LCBhdHRycywgdHJ1ZSk7CiAgICAgICAgICAgICAgICAgdmlld0dyb3VwLmFkZFZpZXcodmlldywgcGFyYW1zKTsKICAgICAgICAgICAgIH0KICAgICAgICAgfQogCi0gICAgICAgIHBhcmVudC5vbkZpbmlzaEluZmxhdGUoKTsKKyAgICAgICAgaWYgKGZpbmlzaEluZmxhdGUpIHBhcmVudC5vbkZpbmlzaEluZmxhdGUoKTsKICAgICB9CiAKICAgICBwcml2YXRlIHZvaWQgcGFyc2VSZXF1ZXN0Rm9jdXMoWG1sUHVsbFBhcnNlciBwYXJzZXIsIFZpZXcgcGFyZW50KQpAQCAtNjc0LDcgKzY4Miw3IEBACiAKICAgICAgICAgICAgICAgICAgICAgaWYgKFRBR19NRVJHRS5lcXVhbHMoY2hpbGROYW1lKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgLy8gSW5mbGF0ZSBhbGwgY2hpbGRyZW4uCi0gICAgICAgICAgICAgICAgICAgICAgICBySW5mbGF0ZShjaGlsZFBhcnNlciwgcGFyZW50LCBjaGlsZEF0dHJzKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJJbmZsYXRlKGNoaWxkUGFyc2VyLCBwYXJlbnQsIGNoaWxkQXR0cnMsIGZhbHNlKTsKICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgIGZpbmFsIFZpZXcgdmlldyA9IGNyZWF0ZVZpZXdGcm9tVGFnKGNoaWxkTmFtZSwgY2hpbGRBdHRycyk7CiAgICAgICAgICAgICAgICAgICAgICAgICBmaW5hbCBWaWV3R3JvdXAgZ3JvdXAgPSAoVmlld0dyb3VwKSBwYXJlbnQ7CkBAIC02OTksNyArNzA3LDcgQEAKICAgICAgICAgICAgICAgICAgICAgICAgIH0KIAogICAgICAgICAgICAgICAgICAgICAgICAgLy8gSW5mbGF0ZSBhbGwgY2hpbGRyZW4uCi0gICAgICAgICAgICAgICAgICA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ICAgICAgICJDb3VsZG4ndCByZXNvbHZlIG1lbnUgaXRlbSBvbkNsaWNrIGhhbmRsZXIgIiArIG1ldGhvZE5hbWUgKworICAgICAgICAgICAgICAgICAgICAgICAgIiBpbiBjbGFzcyAiICsgYy5nZXROYW1lKCkpOworICAgICAgICAgICAgICAgIGV4LmluaXRDYXVzZShlKTsKKyAgICAgICAgICAgICAgICB0aHJvdyBleDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgcHVibGljIGJvb2xlYW4gb25NZW51SXRlbUNsaWNrKE1lbnVJdGVtIGl0ZW0pIHsKKyAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgaWYgKG1NZXRob2QuZ2V0UmV0dXJuVHlwZSgpID09IEJvb2xlYW4uVFlQRSkgeworICAgICAgICAgICAgICAgICAgICByZXR1cm4gKEJvb2xlYW4pIG1NZXRob2QuaW52b2tlKG1Db250ZXh0LCBpdGVtKTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICBtTWV0aG9kLmludm9rZShtQ29udGV4dCwgaXRlbSk7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0gY2F0Y2ggKEV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFJ1bnRpbWVFeGNlcHRpb24oZSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisgICAgCiAgICAgLyoqCiAgICAgICogU3RhdGUgZm9yIHRoZSBjdXJyZW50IG1lbnUuCiAgICAgICogPHA+CkBAIC0yMDUsNiArMjQxLDE3IEBACiAgICAgICAgIHByaXZhdGUgYm9vbGVhbiBpdGVtVmlzaWJsZTsKICAgICAgICAgcHJpdmF0ZSBib29sZWFuIGl0ZW1FbmFibGVkOwogICAgICAgICAKKyAgICAgICAgLyoqCisgICAgICAgICAqIFN5bmMgd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S5nZXRJbnQoY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHlsZWFibGUuTWVudUl0ZW1fc2hvd0FzQWN0aW9uLCAtMSk7CisgICAgICAgICAgICBpdGVtTGlzdGVuZXJNZXRob2ROYW1lID0gYS5nZXRTdHJpbmcoY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHlsZWFibGUuTWVudUl0ZW1fb25DbGljayk7CiAgICAgICAgICAgICAKICAgICAgICAgICAgIGEucmVjeWNsZSgpOwogICAgICAgICAgICAgCkBAIC0yOTksOSArMzQ4LDI1IEBACiAgICAgICAgICAgICAgICAgLnNldEljb24oaXRlbUljb25SZXNJZCkKICAgICAgICAgICAgICAgICAuc2V0QWxwaGFiZXRpY1Nob3J0Y3V0KGl0ZW1BbHBoYWJldGljU2hvcnRjdXQpCiAgICAgICAgICAgICAgICAgLnNldE51bWVyaWNTaG9ydGN1dChpdGVtTnVtZXJpY1Nob3J0Y3V0KTsKKyAgICAgICAgICAgIAorICAgICAgICAgICAgaWYgKGl0ZW1TaG93QXNBY3Rpb24gPj0gMCkgeworICAgICAgICAgICAgICAgIGl0ZW0uc2V0U2hvd0FzQWN0aW9uKGl0ZW1TaG93QXNBY3Rpb24pOworICAgICAgICAgICAgfQorICAgICAgICAgICAgCisgICAgICAgICAgICBpZiAoaXRlbUxpc3RlbmVyTWV0aG9kTmFtZSAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgaWYgKG1Db250ZXh0LmlzUmVzdHJpY3RlZCgpKSB7CisgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oIlRoZSBhbmRyb2lkOm9uQ2xpY2sgYXR0cmlidXRlIGNhbm5vdCAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyAiYmUgdXNlZCB3aXRoaW4gYSByZXN0cmljdGVkIGNvbnRleHQiKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaXRlbS5zZXRPb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HVybnMgd2hldGhlciB0aGlzIFZpZXcgaXMgYWJsZSB0byB0YWtlIGZvY3VzLgogICAgICAqCiAgICAgICogQHJldHVybiBUcnVlIGlmIHRoaXMgdmlldyBjYW4gdGFrZSBmb2N1cywgb3IgZmFsc2Ugb3RoZXJ3aXNlLgpAQCAtNDIxOCw2ICs0NDE0LDEwIEBACiAgICAgICogU2hvdyB0aGUgY29udGV4dCBtZW51IGZvciB0aGlzIHZpZXcuIEl0IGlzIG5vdCBzYWZlIHRvIGhvbGQgb24gdG8gdGhlCiAgICAgICogbWVudSBhZnRlciByZXR1cm5pbmcgZnJvbSB0aGlzIG1ldGhvZC4KICAgICAgKgorICAgICAqIFlvdSBzaG91bGQgbm9ybWFsbHkgbm90IG92ZXJsb2FkIHRoaXMgbWV0aG9kLiBPdmVybG9hZAorICAgICAqIHtAbGluayAjb25DcmVhdGVDb250ZXh0TWVudShDb250ZXh0TWVudSl9IG9yIGRlZmluZSBhbgorICAgICAqIHtAbGluayBPbkNyZWF0ZUNvbnRleHRNZW51TGlzdGVuZXJ9IHRvIGFkZCBpdGVtcyB0byB0aGUgY29udGV4dCBtZW51LgorICAgICAqCiAgICAgICogQHBhcmFtIG1lbnUgVGhlIGNvbnRleHQgbWVudSB0byBwb3B1bGF0ZQogICAgICAqLwogICAgIHB1YmxpYyB2b2lkIGNyZWF0ZUNvbnRleHRNZW51KENvbnRleHRNZW51IG1lbnUpIHsKQEAgLTQzNzAsOSArNDU3MCw3IEBACiAgICAgICAgICAgICAgICAgICAgIGZpbmFsIGludCB5ID0gKGludCkgZXZlbnQuZ2V0WSgpOwogCiAgICAgICAgICAgICAgICAgICAgIC8vIEJlIGxlbmllbnQgYWJvdXQgbW92aW5nIG91dHNpZGUgb2YgYnV0dG9ucwotICAgICAgICAgICAgICAgICAgICBpbnQgc2xvcCA9IG1Ub3VjaFNsb3A7Ci0gICAgICAgICAgICAgICAgICAgIGlmICgoeCA8IDAgLSBzbG9wKSB8fCAoeCA+PSBnZXRXaWR0aCgpICsgc2xvcCkgfHwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAoeSA8IDAgLSBzbG9wKSB8fCAoeSA+PSBnZXRIZWlnaHQoKSArIHNsb3ApKSB7CisgICAgICAgICAgICAgICAgICAgIGlmICghcG9pbnRJblZpZXcoeCwgeSwgbVRvdWNoU2xvcCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgIC8vIE91dHNpZGUgYnV0dG9uCiAgICAgICAgICAgICAgICAgICAgICAgICByZW1vdmVUYXBDYWxsYmFjaygpOwogICAgICAgICAgICAgICAgICAgICAgICAgaWYgKChtUHJpdmF0ZUZsYWdzICYgUFJFU1NFRCkgIT0gMCkgewpAQCAtNDcxOCw2ICs0OTE2LDM0NCBAQAogICAgIH0KIAogICAgIC8qKgorICAgICAqIFRoZSB0cmFuc2Zvcm0gbWF0cml4IG9mIHRoaXMgdmlldywgd2hpY2ggaXMgY2FsY3VsYXRlZCBiYXNlZCBvbiB0aGUgY3VycmVudAorICAgICAqIHJvYXRpb24sIHNjYWxlLCBhbmQgcGl2b3QgcHJvcGVydGllcy4KKyAgICAgKgorICAgICAqIEBzZWUgI2dldFJvdGF0aW9uKCkKKyAgICAgKiBAc2VlICNnZXRTY2FsZVgoKQorICAgICAqIEBzZWUgI2dldFNjYWxlWSgpCisgICAgICogQHNlZSAjZ2V0UGl2b3RYKCkKKyAgICAgKiBAc2VlICNnZXRQaXZvdFkoKQorICAgICAqIEByZXR1cm4gVGhlIGN1cnJlbnQgdHJhbnNmb3JtIG1hdHJpeCBmb3IgdGhlIHZpZXcKKyAgICAgKi8KKyAgICBwdWJsaWMgTWF0cml4IGdldE1hdHJpeCgpIHsKKyAgICAgICAgaGFzSWRlbnRpdHlNYXRyaXgoKTsKKyAgICAgICAgcmV0dXJuIG1NYXRyaXg7CisgICAgfQorCisgICAgLyoqCisgICAgICogVXRpbGl0eSBmdW5jdGlvbiB0byBkZXRlcm1pbmUgaWYgdGhlIHZhbHVlIGlzIGZhciB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G9pbnQKKyAgICAgICAgICAgIGlmICgobVByaXZhdGVGbGFncyAmIFBJVk9UX0VYUExJQ0lUTFlfU0VUKSA9PSAwKSB7CisgICAgICAgICAgICAgICAgaWYgKChtUmlnaHQgLSBtTGVmdCkgIT0gbVByZXZXaWR0aCAmJiAobUJvdHRvbSAtIG1Ub3ApICE9IG1QcmV2SGVpZ2h0KSB7CisgICAgICAgICAgICAgICAgICAgIG1QcmV2V2lkdGggPSBtUmlnaHQgLSBtTGVmdDsKKyAgICAgICAgICAgICAgICAgICAgbVByZXZIZWlnaHQgPSBtQm90dG9tIC0gbVRvcDsKKyAgICAgICAgICAgICAgICAgICAgbVBpdm90WCA9IChmbG9hdCkgbVByZXZXaWR0aCAvIDJmOworICAgICAgICAgICAgICAgICAgICBtUGl2b3RZID0gKGZsb2F0KSBtUHJldkhlaWdodCAvIDJmOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1NYXRyaXgucmVzZXQoKTsKKyAgICAgICAgICAgIG1NYXRyaXguc2V0VHJhbnNsYXRlKG1UcmFuc2xhdGlvblgsIG1UcmFuc2xhdGlvblkpOworICAgICAgICAgICAgbU1hdHJpeC5wcmVSb3RhdGUobVJvdGF0aW9uLCBtUGl2b3RYLCBtUGl2b3RZKTsKKyAgICAgICAgICAgIG1NYXRyaXgucHJlU2NhbGUobVNjYWxlWCwgbVNjYWxlWSwgbVBpdm90WCwgbVBpdm90WSk7CisgICAgICAgICAgICBpZiAobm9uemVybyhtUm90YXRpb25YKSB8fCBub256ZXJvKG1Sb3RhdGlvblkpKSB7CisgICAgICAgICAgICAgICAgaWYgKG1DYW1lcmEgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICBtQ2FtZXJhID0gbmV3IENhbWVyYSgpOworICAgICAgICAgICAgICAgICAgICBtYXRyaXgzRCA9IG5ldyBNYXRyaXgoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgbUNhbWVyYS5zYXZlKCk7CisgICAgICAgICAgICAgICAgbUNhbWVyYS5yb3RhdGVYKG1Sb3RhdGlvblgpOworICAgICAgICAgICAgICAgIG1DYW1lcmEucm90YXRlWShtUm90YXRpb25ZKTsKKyAgICAgICAgICAgICAgICBtQ2FtZXJhLmdldE1hdHJpeChtYXRyaXgzRCk7CisgICAgICAgICAgICAgICAgbWF0cml4M0QucHJlVHJhbnNsYXRlKC1tUGl2b3RYLCAtbVBpdm90WSk7CisgICAgICAgICAgICAgICAgbWF0cml4M0QucG9zdFRyYW5zbGF0ZShtUGl2b3RYLCBtUGl2b3RZKTsKKyAgICAgICAgICAgICAgICBtTWF0cml4LnBvc3RDb25jYXQobWF0cml4M0QpOworICAgICAgICAgICAgICAgIG1DYW1lcmEucmVzdG9yZSgpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgbU1hdHJpeERpcnR5ID0gZmFsc2U7CisgICAgICAgICAgICBtTWF0cml4SXNJZGVudGl0eSA9IG1NYXRyaXguaXNJZGVudGl0eSgpOworICAgICAgICAgICAgbUludmVyc2VNYXRyaXhEaXJ0eSA9IHRydWU7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIG1NYXRyaXhJc0lkZW50aXR5OworICAgIH0KKworICAgIC8qKgorICAgICAqIFV0aWxpdHkgbWV0aG9kIHRvIHJldHJpZXZlIHRoZSBpbnZlcnNlIG9mIHRoZSBjdXJyZW50IG1NYXRyaXggcHJvcGVydHkuCisgICAgICogV2UgY2FjaGUgdGhlIG1hdHJpeCB0byBhdm9pZCByZWNhbGN1bGF0aW5nIGl0IHdoZW4gdHJhbnNmb3JtIHByb3BlcnRpZXMKKyAgICAgKiBoYXZlIG5vdCBjaGFuZ2VkLgorICAgICAqCisgICAgICogQHJldHVybiBUaGUgaW52ZXJzZSBvZiB0aGUgY3VycmVudCBtYXRyaXggb2YgdGhpcyB2aWV3LgorICAgICAqLworICAgIE1hdHJpeCBnZXRJbnZlcnNlTWF0cml4KCkgeworICAgICAgICBpZiAobUludmVyc2VNYXRyaXhEaXJ0eSkgeworICAgICAgICAgICAgaWYgKG1JbnZlcnNlTWF0cml4ID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICBtSW52ZXJzZU1hdHJpeCA9IG5ldyBNYXRyaXgoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1NYXRyaXguaW52ZXJ0KG1JbnZlcnNlTWF0cml4KTsKKyAgICAgICAgICAgIG1JbnZlcnNlTWF0cml4RGlydHkgPSBmYWxzZTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gbUludmVyc2VNYXRyaXg7CisgICAgfQorCisgICAgLyoqCisgICAgICogVGhlIGRlZ3JlZXMgdGhhdCB0aGUgdmlldyBpcyByb3RhdGVkIGFyb3VuZCB0aGUgcGl2b3QgcG9pbnQuCisgICAgICoKKyAgICAgKiBAc2VlICNnZXRQaXZvdFgoKQorICAgICAqIEBzZWUgI2dldFBpdm90WSgpCisgICAgICogQHJldHVybiBUaGUgZGVncmVlcyBvZiByb3RhdGlvbi4KKyAgICAgKi8KKyAgICBwdWJsaWMgZmxvYXQgZ2V0Um90YXRpb24oKSB7CisgICAgICAgIHJldHVybiBtUm90YXRpb247CisgICAgfQorCisgICAgLyoqCisgICAgICogU2V0cyB0aGUgZGVncmVlcyB0aGF0IHRoZSB2aWV3IGlzIHJvdGF0ZWQgYXJvdW5kIHRoZSBwaXZvdCBwb2ludC4KKyAgICAgKgorICAgICAqIEBwYXJhbSByb3RhdGlvbiBUaGUgZGVncmVlcyBvZiByb3RhdGlvbi4KKyAgICAgKiBAc2VlICNnZXRQaXZvdFgoKQorICAgICAqIEBzZWUgI2dldFBpdm90WSgpCisgICAgICovCisgICAgcHVibGljIHZvaWQgc2V0Um90YXRpb24oZmxvYXQgcm90YXRpb24pIHsKKyAgICAgICAgaWYgKG1Sb3RhdGlvbiAhPSByb3RhdGlvbikgeworICAgICAgICAgICAgLy8gRG91YmxlLWludmFsaWRhdGlvbiBpcyBuZWNlc3Nhcnk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ICAgaWYgKG1Sb3RhdGlvblkgIT0gcm90YXRpb25ZKSB7CisgICAgICAgICAgICAvLyBEb3VibGUtaW52YWxpZGF0aW9uIGlzIG5lY2Vzc2FyeSB0byBjYXB0dXJlIHZpZXcncyBvbGQgYW5kIG5ldyBhcmVhcworICAgICAgICAgICAgaW52YWxpZGF0ZSgpOworICAgICAgICAgICAgbVJvdGF0aW9uWSA9IHJvdGF0aW9uWTsKKyAgICAgICAgICAgIG1NYXRyaXhEaXJ0eSA9IHRydWU7CisgICAgICAgICAgICBtUHJpdmF0ZUZsYWdzIHw9IERSQVdOOyAvLyBmb3JjZSBhbm90aGVyIGludmFsaWRhdGlvbiB3aXRoIHRoZSBuZXcgb3JpZW50YXRpb24KKyAgICAgICAgICAgIGludmFsaWRhdGUoKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIFRoZSBkZWdyZWVzIHRoYXQgdGhlIHZpZXcgaXMgcm90YXRlZCBhcm91bmQgdGhlIGhvcml6b250YWwgYXhpcyB0aHJvdWdoIHRoZSBwaXZvdCBwb2ludC4KKyAgICAgKgorICAgICAqIEBzZWUgI2dldFBpdm90WCgpCisgICAgICogQHNlZSAjZ2V0UGl2b3RZKCkKKyAgICAgKiBAcmV0dXJuIFRoZSBkZWdyZWVzIG9mIFggcm90YXRpb24uCisgICAgICovCisgICAgcHVibGljIGZsb2F0IGdldFJvdGF0aW9uWCgpIHsKKyAgICAgICAgcmV0dXJuIG1Sb3RhdGlvblg7CisgICAgfQorCisgICAgLyoqCisgICAgICogU2V0cyB0aGUgZGVncmVlcyB0aGF0IHRoZSB2aWV3IGlzIHJvdGF0ZWQgYXJvdW5kIHRoZSBob3Jpem9udGFsIGF4aXMgdGhyb3VnaCBwaXZvdCBwb2ludC4KKyAgICAgKgorICAgICAqIEBwYXJhbSByb3RhdGlvblggVGhlIGRlZ3JlZXMgb2YgWCByb3RhdGlvbi4KKyAgICAgKiBAc2VlICNnZXRQaXZvdFgoKQorICAgICAqIEBzZWUgI2dldFBpdm90WSgpCisgICAgICovCisgICAgcHVibGljIHZvaWQgc2V0Um90YXRpb25YKGZsb2F0IHJvdGF0aW9uWCkgeworICAgICAgICBpZiAobVJvdGF0aW9uWCAhPSByb3RhdGlvblgpIHsKKyAgICAgICAgICAgIC8vIERvdWJsZS1pbnZhbGlkYXRpb24gaXMgbmVjZXNzYXJ5IHRvIGNhcHR1cmUgdmlldydzIG9sZCBhbmQgbmV3IGFyZWFzCisgICAgICAgICAgICBpbnZhbGlkYXRlKCk7CisgICAgICAgICAgICBtUm90YXRpb25YID0gcm90YXRpb25YOworICAgICAgICAgICAgbU1hdHJpeERpcnR5ID0gdHJ1ZTsKKyAgICAgICAgICAgIG1Qcml2YXRlRmxhZ3MgfD0gRFJBV047IC8vIGZvcmNlIGFub3RoZXIgaW52YWxpZGF0aW9uIHdpdGggdGhlIG5ldyBvcmllbnRhdGlvbgorICAgICAgICAgICAgaW52YWxpZGF0ZSgpOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogVGhlIGFtb3VudCB0aGF0IHRoZSB2aWV3IGlzIHNjYWxlZCBpbiB4IGFyb3VuZCB0aGUgcGl2b3QgcG9pbnQsIGFzIGEgcHJvcG9ydGlvbiBvZgorICAgICAqIHRoZSB2aWV3J3MgdW5zY2FsZWQgd2lkdGguIEEgdmFsdWUgb2YgMSwgdGhlIGRlZmF1bHQsIG1lYW5zIHRoYXQgbm8gc2NhbGluZyBpcyBhcHBsaWVkLgorICAgICAqCisgICAgICogQGRlZmF1bHQgMS4wZgorICAgICAqIEBzZWUgI2dldFBpdm90WCgpCisgICAgICogQHNlZSAjZ2V0UGl2b3RZKCkKKyAgICAgKiBAcmV0dXJuIFRoZSBzY2FsaW5nIGZhY3Rvci4KKyAgICAgKi8KKyAgICBwdWJsaWMgZmxvYXQgZ2V0U2NhbGVYKCkgeworICAgICAgICByZXR1cm4gbVNjYWxlWDsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBTZXR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hcmFtIHBpdm90WCBUaGUgeCBsb2NhdGlvbiBvZiB0aGUgcGl2b3QgcG9pbnQuCisgICAgICogQHNlZSAjZ2V0Um90YXRpb24oKQorICAgICAqIEBzZWUgI2dldFNjYWxlWCgpCisgICAgICogQHNlZSAjZ2V0U2NhbGVZKCkKKyAgICAgKiBAc2VlICNnZXRQaXZvdFkoKQorICAgICAqLworICAgIHB1YmxpYyB2b2lkIHNldFBpdm90WChmbG9hdCBwaXZvdFgpIHsKKyAgICAgICAgbVByaXZhdGVGbGFncyB8PSBQSVZPVF9FWFBMSUNJVExZX1NFVDsKKyAgICAgICAgaWYgKG1QaXZvdFggIT0gcGl2b3RYKSB7CisgICAgICAgICAgICAvLyBEb3VibGUtaW52YWxpZGF0aW9uIGlzIG5lY2Vzc2FyeSB0byBjYXB0dXJlIHZpZXcncyBvbGQgYW5kIG5ldyBhcmVhcworICAgICAgICAgICAgaW52YWxpZGF0ZSgpOworICAgICAgICAgICAgbVBpdm90WCA9IHBpdm90WDsKKyAgICAgICAgICAgIG1NYXRyaXhEaXJ0eSA9IHRydWU7CisgICAgICAgICAgICBtUHJpdmF0ZUZsYWdzIHw9IERSQVdOOyAvLyBmb3JjZSBhbm90aGVyIGludmFsaWRhdGlvbiB3aXRoIHRoZSBuZXcgb3JpZW50YXRpb24KKyAgICAgICAgICAgIGludmFsaWRhdGUoKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIFRoZSB5IGxvY2F0aW9uIG9mIHRoZSBwb2ludCBhcm91bmQgd2hpY2ggdGhlIHZpZXcgaXMge0BsaW5rICNzZXRSb3RhdGlvbihmbG9hdCkgcm90YXRlZH0KKyAgICAgKiBhbmQge0BsaW5rICNzZXRTY2FsZVkoZmxvYXQpIHNjYWxlZH0uCisgICAgICoKKyAgICAgKiBAc2VlICNnZXRSb3RhdGlvbigpCisgICAgICogQHNlZSAjZ2V0U2NhbGVYKCkKKyAgICAgKiBAc2VlICNnZXRTY2FsZVkoKQorICA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V3LgorICAgICAqLworICAgIHB1YmxpYyB2b2lkIHNldEFscGhhKGZsb2F0IGFscGhhKSB7CisgICAgICAgIG1BbHBoYSA9IGFscGhhOworICAgICAgICBpbnZhbGlkYXRlKCk7CisgICAgfQorCisgICAgLyoqCiAgICAgICogVG9wIHBvc2l0aW9uIG9mIHRoaXMgdmlldyByZWxhdGl2ZSB0byBpdHMgcGFyZW50LgogICAgICAqCiAgICAgICogQHJldHVybiBUaGUgdG9wIG9mIHRoaXMgdmlldywgaW4gcGl4ZWxzLgpAQCAtNDc1OCwxMiArNTI5NCwxMzggQEAKICAgICB9CiAKICAgICAvKioKKyAgICAgKiBUaGUgdmlzdWFsIHggcG9zaXRpb24gb2YgdGhpcyB2aWV3LCBpbiBwaXhlbHMuIFRoaXMgaXMgZXF1aXZhbGVudCB0byB0aGUKKyAgICAgKiB7QGxpbmsgI3NldFRyYW5zbGF0aW9uWChmbG9hdCkgdHJhbnNsYXRpb25YfSBwcm9wZXJ0eSBwbHVzIHRoZSBjdXJyZW50CisgICAgICoge0BsaW5rICNnZXRMZWZ0KCkgbGVmdH0gcHJvcGVydHkuIAorICAgICAqCisgICAgICogQHJldHVybiBUaGUgdmlzdWFsIHggcG9zaXRpb24gb2YgdGhpcyB2aWV3LCBpbiBwaXhlbHMuCisgICAgICovCisgICAgcHVibGljIGZsb2F0IGdldFgoKSB7CisgICAgICAgIHJldHVybiBtTGVmdCArIG1UcmFuc2xhdGlvblg7CisgICAgfQorCisgICAgLyoqCisgICAgICogU2V0cyB0aGUgdmlzdWFsIHggcG9zaXRpb24gb2YgdGhpcyB2aWV3LCBpbiBwaXhlbHMuIFRoaXMgaXMgZXF1aXZhbGVudCB0byBzZXR0aW5nIHRoZQorICAgICAqIHtAbGluayAjc2V0VHJhbnNsYXRpb25YKGZsb2F0KSB0cmFuc2xhdGlvblh9IHByb3BlcnR5IHRvIGJlIHRoZSBkaWZmZXJlbmNlIGJldHdlZW4KKyAgICAgKiB0aGUgeCB2YWx1ZS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orICAgICAgICAgICAgaW52YWxpZGF0ZSgpOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqCiAgICAgICogSGl0IHJlY3RhbmdsZSBpbiBwYXJlbnQncyBjb29yZGluYXRlcwogICAgICAqCiAgICAgICogQHBhcmFtIG91dFJlY3QgVGhlIGhpdCByZWN0YW5nbGUgb2YgdGhlIHZpZXcuCiAgICAgICovCiAgICAgcHVibGljIHZvaWQgZ2V0SGl0UmVjdChSZWN0IG91dFJlY3QpIHsKLSAgICAgICAgb3V0UmVjdC5zZXQobUxlZnQsIG1Ub3AsIG1SaWdodCwgbUJvdHRvbSk7CisgICAgICAgIGlmIChoYXNJZGVudGl0eU1hdHJpeCgpIHx8IG1BdHRhY2hJbmZvID09IG51bGwpIHsKKyAgICAgICAgICAgIG91dFJlY3Quc2V0KG1MZWZ0LCBtVG9wLCBtUmlnaHQsIG1Cb3R0b20pOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgTWF0cml4IG0gPSBnZXRNYXRyaXgoKTsKKyAgICAgICAgICAgIGZpbmFsIFJlY3RGIHRtcFJlY3QgPSBtQXR0YWNoSW5mby5tVG1wVHJhbnNmb3JtUmVjdDsKKyAgICAgICAgICAgIHRtcFJlY3Quc2V0KC1tUGl2b3RYLCAtbVBpdm90WSwgZ2V0V2lkdGgoKSAtIG1QaXZvdFgsIGdldEhlaWdodCgpIC0gbVBpdm90WSk7CisgICAgICAgICAgICBtLm1hcFJlY3QodG1wUmVjdCk7CisgICAgICAgICAgICBvdXRSZWN0LnNldCgoaW50KSB0bXBSZWN0LmxlZnQgKyBtTGVmdCwgKGludCkgdG1wUmVjdC50b3AgKyBtVG9wLAorICAgICAgICAgICAgICAgICAgICAoaW50KSB0bXBSZWN0LnJpZ2h0ICsgbUxlZnQsIChpbnQpIHRtcFJlY3QuYm90dG9tICsgbVRvcCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBVdGlsaXR5IG1ldGhvZCB0byBkZXRlcm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ICAgICAgICAgICAgICBpZiAocCAhPSBudWxsICYmIG1BdHRhY2hJbmZvICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgZmluYWwgUmVjdCByID0gbUF0dGFjaEluZm8ubVRtcEludmFsUmVjdDsKKyAgICAgICAgICAgICAgICAgICAgaW50IG1pblRvcDsKKyAgICAgICAgICAgICAgICAgICAgaW50IG1heEJvdHRvbTsKKyAgICAgICAgICAgICAgICAgICAgaW50IHlMb2M7CisgICAgICAgICAgICAgICAgICAgIGlmIChvZmZzZXQgPCAwKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBtaW5Ub3AgPSBtVG9wICsgb2Zmc2V0OworICAgICAgICAgICAgICAgICAgICAgICAgbWF4Qm90dG9tID0gbUJvdHRvbTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHlMb2MgPSBvZmZzZXQ7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICBtaW5Ub3AgPSBtVG9wOworICAgICAgICAgICAgICAgICAgICAgICAgbWF4Qm90dG9tID0gbUJvdHRvbSArIG9mZnNldDsKKyAgICAgICAgICAgICAgICAgICAgICAgIHlMb2MgPSAwOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIHIuc2V0KDAsIHlMb2MsIG1SaWdodCAtIG1MZWZ0LCBtYXhCb3R0b20gLSBtaW5Ub3ApOworICAgICAgICAgICAgICAgICAgICBwLmludmFsaWRhdGVDaGlsZCh0aGlzLCByKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIGludmFsaWRhdGUoKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgbVRvcCArPSBvZmZzZXQ7CisgICAgICAgICAgICBtQm90dG9tICs9IG9mZnNldDsKKworICAgICAgICAgICAgaWYgKCFtTWF0cml4SXNJZGVudGl0eSkgeworICAgICAgICAgICAgICAgIG1Qcml2YXRlRmxhZ3MgfD0gRFJBV047IC8vIGZvcmNlIGFub3RoZXIgaW52YWxpZGF0aW9uIHdpdGggdGhlIG5ldyBvcmllbnRhdGlvbgorICAgICAgICAgICAgICAgIGludmFsaWRhdGUoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQogICAgIH0KIAogICAgIC8qKgpAQCAtNDgzNiw4ICs1NTI4LDM4IEBACiAgICAgICogQHBhcmFtIG9mZnNldCB0aGUgbnVtZXIgb2YgcGl4ZWxzIHRvIG9mZnNldCB0aGUgdmlldyBieQogICAgICAqLwogICAgIHB1YmxpYyB2b2lkIG9mZnNldExlZnRBbmRSaWdodChpbnQgb2Zmc2V0KSB7Ci0gICAgICAgIG1MZWZ0ICs9IG9mZnNldDsKLSAgICAgICAgbVJpZ2h0ICs9IG9mZnNldDsKKyAgICAgICAgaWYgKG9mZnNldCAhPSAwKSB7CisgICAgICAgICAgICBpZiAoaGFzSWRlbnRpdHlNYXRyaXgoKSkgeworICAgICAgICAgICAgICAgIGZpbmFsIFZpZXdQYXJlbnQgcCA9IG1QYXJlbnQ7CisgICAgICAgICAgICAgICAgaWYgKHAgIT0gbnVsbCAmJiBtQXR0YWNoSW5mbyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIGZpbmFsIFJlY3QgciA9IG1BdHRhY2hJbmZvLm1UbXBJbnZhbFJlY3Q7CisgICAgICAgICAgICAgICAgICAgIGludCBtaW5MZWZ0OworICAgICAgICAgICAgICAgICAgICBpbnQgbWF4UmlnaHQ7CisgICAgICAgICAgICAgICAgICAgIGludCB4TG9jOworICAgICAgICAgICAgICAgICAgICBpZiAob2Zmc2V0IDwgMCkgeworICAgICAgICAgICAgICAgICAgICAgICAgbWluTGVmdCA9IG1MZWZ0ICsgb2Zmc2V0OworICAgICAgICAgICAgICAgICAgICAgICAgbWF4UmlnaHQgPSBtUmlnaHQ7CisgICAgICAgICAgICAgICAgICAgICAgICB4TG9jID0gb2Zmc2V0OworICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAgICAgbWluTGVmdCA9IG1MZWZ0OworICAgICAgICAgICAgICAgICAgICAgICAgbWF4UmlnaHQgPSBtUmlnaHQgKyBvZmZzZXQ7CisgICAgICAgICAgICAgICAgICAgICAgICB4TG9jID0gMDsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICByLnNldCgwLCAwLCBtYXhSaWdodCAtIG1pbkxlZnQsIG1Cb3R0b20gLSBtVG9wKTsKKyAgICAgICAgICAgICAgICAgICAgcC5pbnZhbGlkYXRlQ2hpbGQodGhpcywgcik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBpbnZhbGlkYXRlKCk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIG1MZWZ0ICs9IG9mZnNldDsKKyAgICAgICAgICAgIG1SaWdodCArPSBvZmZzZXQ7CisKKyAgICAgICAgICAgIGlmICghbU1hdHJpeElzSWRlbnRpdHkpIHsKKyAgICAgICAgICAgICAgICBtUHJpdmF0ZUZsYWdzIHw9IERSQVdOOyAvLyBmb3JjZSBhbm90aGVyIGludmFsaWRhdGlvbiB3aXRoIHRoZSBuZXcgb3JpZW50YXRpb24KKyAgICAgICAgICAgICAgICBpbnZhbGlkYXRlKCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KICAgICB9CiAKICAgICAvKioKQEAgLTU4NzYsOSArNjU5OCw4IEBACiAgICAgICogQHNlZSBhbmRyb2lkLndpZGdldC5TY3JvbGxCYXJEcmF3YWJsZQogICAgICAqIEBoaWRlCiAgICAgICovCi0gICAgcHJvdGVjdGVkIHZvaWQgb25EcmF3SG9yaXpvbnRhbFNjcm9sbEJhcihDYW52YXMgY2FudmFzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRHJhd2FibGUgc2Nyb2xsQmFyLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGwsIGludCB0LCBpbnQgciwgaW50IGIpIHsKKyAgICBwcm90ZWN0ZWQgdm9pZCBvbkRyYXdIb3Jpem9udGFsU2Nyb2xsQmFyKENhbnZhcyBjYW52YXMsIERyYXdhYmxlIHNjcm9sbEJhciwKKyAgICAgICAgICAgIGludCBsLCBpbnQgdCwgaW50IHIsIGludCBiKSB7CiAgICAgICAgIHNjcm9sbEJhci5zZXRCb3VuZHMobCwgdCwgciwgYik7CiAgICAgICAgIHNjcm9sbEJhci5kcmF3KGNhbnZhcyk7CiAgICAgfQpAQCAtNTg5Nyw5ICs2NjE4LDggQEAKICAgICAgKiBAc2VlIGFuZHJvaWQud2lkZ2V0LlNjcm9sbEJhckRyYXdhYmxlCiAgICAgICogQGhpZGUKICAgICAgKi8KLSAgICBwcm90ZWN0ZWQgdm9pZCBvbkRyYXdWZXJ0aWNhbFNjcm9sbEJhcihDYW52YXMgY2FudmFzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIERyYXdhYmxlIHNjcm9sbEJhciwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgbCwgaW50IHQsIGludCByLCBpbnQgYikgeworICAgIHByb3RlY3RlZCB2b2lkIG9uRHJhd1ZlcnRpY2FsU2Nyb2xsQmFyKENhbnZhcyBjYW52YXMsIERyYXdhYmxlIHNjcm9sbEJhciwKKyAgICAgICAgICAgIGludCBsLCBpbnQgdCwgaW50IHIsIGludCBiKSB7CiAgICAgICAgIHNjcm9sbEJhci5zZXRCb3VuZHMobCwgdCwgciwgYik7CiAgICAgICAgIHNjcm9sbEJhci5kcmF3KGNhbnZhcyk7CiAgICAgfQpAQCAtNjI5Nyw4ICs3MDE3LDcgQEAKICAgICAgICAgaWYgKChtVmlld0ZsYWdzICYgRFJBV0lOR19DQUNIRV9FTkFCTEVEKSA9PSBEUkFXSU5HX0NBQ0hFX0VOQUJMRUQpIHs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G1hcCBiaXRtYXAgPSBhdXRvU2NhbGUgPyBtRHJhd2luZ0NhY2hlIDogbVVuc2NhbGVkRHJhd2luZ0NhY2hlOwogCiAgICAgICAgICAgICBpZiAoYml0bWFwID09IG51bGwgfHwgYml0bWFwLmdldFdpZHRoKCkgIT0gd2lkdGggfHwgYml0bWFwLmdldEhlaWdodCgpICE9IGhlaWdodCkgewogICAgICAgICAgICAgICAgIEJpdG1hcC5Db25maWcgcXVhbGl0eTsKQEAgLTY0NDcsOSArNzE2Miw5IEBACiAgICAgICAgICAgICAgICAgICAgIGJpdG1hcCA9IEJpdG1hcC5jcmVhdGVCaXRtYXAod2lkdGgsIGhlaWdodCwgcXVhbGl0eSk7CiAgICAgICAgICAgICAgICAgICAgIGJpdG1hcC5zZXREZW5zaXR5KGdldFJlc291cmNlcygpLmdldERpc3BsYXlNZXRyaWNzKCkuZGVuc2l0eURwaSk7CiAgICAgICAgICAgICAgICAgICAgIGlmIChhdXRvU2NhbGUpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIG1EcmF3aW5nQ2FjaGUgPSBuZXcgU29mdFJlZmVyZW5jZTxCaXRtYXA+KGJpdG1hcCk7CisgICAgICAgICAgICAgICAgICAgICAgICBtRHJhd2luZ0NhY2hlID0gYml0bWFwOwogICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICAgICAgbVVuc2NhbGVkRHJhd2luZ0NhY2hlID0gbmV3IFNvZnRSZWZlcmVuY2U8Qml0bWFwPihiaXRtYXApOworICAgICAgICAgICAgICAgICAgICAgICAgbVVuc2NhbGVkRHJhd2luZ0NhY2hlID0gYml0bWFwOwogICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgIGlmIChvcGFxdWUgJiYgdHJhbnNsdWNlbnRXaW5kb3cpIGJpdG1hcC5zZXRIYXNBbHBoYShmYWxzZSk7CiAgICAgICAgICAgICAgICAgfSBjYXRjaCAoT3V0T2ZNZW1vcnlFcn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MzcsOCArOTM1MSw3IEBACiAgICAgICAgICAgICAgICAgVmlld0NvbmZpZ3VyYXRpb24uZ2V0TG9uZ1ByZXNzVGltZW91dCgpIC0gZGVsYXlPZmZzZXQpOwogICAgIH0KIAotICAgIHByaXZhdGUgc3RhdGljIGludFtdIHN0YXRlU2V0VW5pb24oZmluYWwgaW50W10gc3RhdGVTZXQxLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmluYWwgaW50W10gc3RhdGVTZXQyKSB7CisgICAgcHJpdmF0ZSBzdGF0aWMgaW50W10gc3RhdGVTZXRVbmlvbihmaW5hbCBpbnRbXSBzdGF0ZVNldDEsIGZpbmFsIGludFtdIHN0YXRlU2V0MikgewogICAgICAgICBmaW5hbCBpbnQgc3RhdGVTZXQxTGVuZ3RoID0gc3RhdGVTZXQxLmxlbmd0aDsKICAgICAgICAgZmluYWwgaW50IHN0YXRlU2V0Mkxlbmd0aCA9IHN0YXRlU2V0Mi5sZW5ndGg7CiAgICAgICAgIGZpbmFsIGludFtdIG5ld1NldCA9IG5ldyBpbnRbc3RhdGVTZXQxTGVuZ3RoICsgc3RhdGVTZXQyTGVuZ3RoXTsKQEAgLTkxNTksNiArOTg3MiwxMyBAQAogICAgICAgICAgKi8KICAgICAgICAgZmluYWwgaW50W10gbUludmFsaWRhdGVDaGlsZExvY2F0aW9uID0gbmV3IGludFsyXTsKIAorCisgICAgICAgIC8qKgorICAgICAgICAgKiBHbG9iYWwgdG8gdGhlIHZpZXcgaGllcmFyY2h5IHVzZWQgYXMgYSB0ZW1wb3JhcnkgZm9yIGRlYWxpbmcgd2l0aAorICAgICAgICAgKiB4L3kgbG9jYXRpb24gd2hlbiB2aWV3IGlzIHRyYW5zZm9ybWVkLgorICAgICAgICAgKi8KKyAgICAgICAgZmluYWwgZmxvYXRbXSBtVG1wVHJhbnNmb3JtTG9jYXRpb24gPSBuZXcgZmxvYXRbMl07CisKICAgICAgICAgLyoqCiAgICAgICAgICAqIFRoZSB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ZhdGUgc3RhdGljIGZpbmFsIGludCBGTEFHX1NQTElUX01PVElPTl9FVkVOVFMgPSAweDEwMDAwMDsKKworICAgIC8qKgogICAgICAqIEluZGljYXRlcyB3aGljaCB0eXBlcyBvZiBkcmF3aW5nIGNhY2hlcyBhcmUgdG8gYmUga2VwdCBpbiBtZW1vcnkuCiAgICAgICogVGhpcyBmaWVsZCBzaG91bGQgYmUgbWFkZSBwcml2YXRlLCBzbyBpdCBpcyBoaWRkZW4gZnJvbSB0aGUgU0RLLgogICAgICAqIHtAaGlkZX0KQEAgLTM0OCw2ICszNzEsOSBAQAogICAgICAgICAgICAgICAgIGNhc2UgUi5zdHlsZWFibGUuVmlld0dyb3VwX2Rlc2NlbmRhbnRGb2N1c2FiaWxpdHk6CiAgICAgICAgICAgICAgICAgICAgIHNldERlc2NlbmRhbnRGb2N1c2FiaWxpdHkoREVTQ0VOREFOVF9GT0NVU0FCSUxJVFlfRkxBR1NbYS5nZXRJbnQoYXR0ciwgMCldKTsKICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBSLnN0eWxlYWJsZS5WaWV3R3JvdXBfc3BsaXRNb3Rpb25FdmVudHM6CisgICAgICAgICAgICAgICAgICAgIHNldE1vdGlvbkV2ZW50U3BsaXR0aW5nRW5hYmxlZChhLmdldEJvb2xlYW4oYXR0ciwgZmFsc2UpKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KIApAQCAtNDYxLDYgKzQ4NywxMyBAQAogICAgIH0KIAogICAgIC8qKgorICAgICAqIHtAaW5oZXJpdERvY30KKyAgICAgKi8KKyAgICBwdWJsaWMgQWN0aW9uTW9kZSBzdGFydEFjdGlvbk1vZGVGb3JDaGlsZChWaWV3IG9yaWdpbmFsVmlldywgQWN0aW9uTW9kZS5DYWxsYmFjayBjYWxsYmFjaykgeworICAgICAgICByZXR1cm4gbVBhcmVudCAhPSBudWxsID8g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mVudC5BQ1RJT05fRE9XTik7CiAgICAgICAgICAgICAgICAgLy8gV2Uga25vdyB3ZSB3YW50IHRvIGRpc3BhdGNoIHRoZSBldmVudCBkb3duLCBmaW5kIGEgY2hpbGQKICAgICAgICAgICAgICAgICAvLyB3aG8gY2FuIGhhbmRsZSBpdCwgc3RhcnQgd2l0aCB0aGUgZnJvbnQtbW9zdCBjaGlsZC4KLSAgICAgICAgICAgICAgICBmaW5hbCBpbnQgc2Nyb2xsZWRYSW50ID0gKGludCkgc2Nyb2xsZWRYRmxvYXQ7Ci0gICAgICAgICAgICAgICAgZmluYWwgaW50IHNjcm9sbGVkWUludCA9IChpbnQpIHNjcm9sbGVkWUZsb2F0OwogICAgICAgICAgICAgICAgIGZpbmFsIFZpZXdbXSBjaGlsZHJlbiA9IG1DaGlsZHJlbjsKICAgICAgICAgICAgICAgICBmaW5hbCBpbnQgY291bnQgPSBtQ2hpbGRyZW5Db3VudDsKICAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gY291bnQgLSAxOyBpID49IDA7IGktLSkgewogICAgICAgICAgICAgICAgICAgICBmaW5hbCBWaWV3IGNoaWxkID0gY2hpbGRyZW5baV07CiAgICAgICAgICAgICAgICAgICAgIGlmICgoY2hpbGQubVZpZXdGbGFncyAmIFZJU0lCSUxJVFlfTUFTSykgPT0gVklTSUJMRQogICAgICAgICAgICAgICAgICAgICAgICAgICAgIHx8IGNoaWxkLmdldEFuaW1hdGlvbigpICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGNoaWxkLmdldEhpdFJlY3QoZnJhbWUpOwotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGZyYW1lLmNvbnRhaW5zKHNjcm9sbGVkWEludCwgc2Nyb2xsZWRZSW50KSkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIG9mZnNldCB0aGUgZXZlbnQgdG8gdGhlIHZpZXcncyBjb29yZGluYXRlIHN5c3RlbQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZpbmFsIGZsb2F0IHhjID0gc2Nyb2xsZWRYRmxvYXQgLSBjaGlsZC5tTGVmdDsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaW5hbCBmbG9hdCB5YyA9IHNjcm9sbGVkWUZsb2F0IC0gY2hpbGQubVRvcDsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBldi5zZXRMb2NhdGlvbih4YywgeWMpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoaWxkLm1Qcml2YXRlRmxhZ3MgJj0gfkNBTkNFTF9ORVhUX1VQX0VWRU5UOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjaGlsZC5kaXNwYXRjaFRvdWNoRXZlbnQoZXYpKSAgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBFdmVudCBoYW5kbGVkLCB3ZSBoYXZlIGEgdGFyZ2V0IG5vdy4KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbU1vdGlvblRhcmdldCA9IGNoaWxkOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gVGhlIGV2ZW50IGRpZG4ndCBnZXQgaGFuZGxlZCwgdHJ5IHRoZSBuZXh0IHZpZXcuCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gRG9uJ3QgcmVzZXQgdGhlIGV2ZW50J3MgbG9jYXRpb24sIGl0J3Mgbm90Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gbmVjZXNzYXJ5IGhlcmUuCisgICAgICAgICAgICAgICAgICAgICAgICAvLyBTaW5nbGUgZGlzcGF0Y2ggYWx3YXlzIHBpY2tzIGl0cyB0YXJnZXQgYmFzZWQgb24gdGhlIGluaXRpYWwgZG93bgorICAgICAgICAgICAgICAgICAgICAgICAgLy8gZXZlbnQncyBwb3NpdGlvbiAtIGluZGV4IDAKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkaXNwYXRjaFRvdWNoRXZlbnRJZkluVmlldyhjaGlsZCwgZXYsIDApKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbU1vdGlvblRhcmdldCA9IGNoaWxkOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgfQpAQCAtODk4LDExICs5MjIsMjIgQEAKICAgICAgICAgICAgIHJldHVybiBzdXBlci5kaXNwYXRjaFRvdWNoRXZlbnQoZXYpOwogICAgICAgICB9CiAKKyAgICAgICAgLy8gQ2FsY3VsYXRlIHRoZSBvZmZzZXQgcG9pbnQgaW50byB0aGUgdGFyZ2V0J3MgbG9jYWwgY29vcmRpbmF0ZXMKKyAgICAgICAgZmxvYXQgeGMgPSBzY3JvbGxlZFhGbG9hdCAtIChmbG9hdCkgdGFyZ2V0Lm1MZWZ0OworICAgICAgICBmbG9hdCB5YyA9IHNjcm9sbGVkWUZsb2F0IC0gKGZsb2F0KSB0YXJnZXQubVRvcDsKKyAgICAgICAgaWYgKCF0YXJnZXQuaGFzSWRlbnRpdHlNYXRyaXgoKSAmJiBtQXR0YWNoSW5mbyAhPSBudWxsKSB7CisgICAgICAgICAgICAvLyBub24taWRlbnRpdHkgbWF0cml4OiB0cmFuc2Zvcm0gdGhlIHBvaW50IGludG8gdGhlIHZpZXcncyBjb29yZGluYXRlcworICAgICAgICAgICAgZmluYWwgZmxvYXRbXSBsb2NhbFhZID0gbUF0dGFjaEluZm8ubVRtcFRyYW5zZm9ybUxvY2F0aW9uOworICAgICAgICAgICAgbG9jYWxYWVswXSA9IHhjOworICAgICAgICAgICAgbG9jYWxYWVsxXSA9IHljOworICAgICAgICAgICAgdGFyZ2V0LmdldEludmVyc2VNYXRyaXgoKS5tYXBQb2ludHMobG9jYW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PV04gfHwKKyAgICAgICAgICAgICAgICBtYXNrZWRBY3Rpb24gPT0gTW90aW9uRXZlbnQuQUNUSU9OX1BPSU5URVJfRE9XTikgeworICAgICAgICAgICAgZmluYWwgaW50IGFjdGlvbkluZGV4ID0gZXYuZ2V0QWN0aW9uSW5kZXgoKTsKKyAgICAgICAgICAgIGZpbmFsIGludCBhY3Rpb25JZCA9IGV2LmdldFBvaW50ZXJJZChhY3Rpb25JbmRleCk7CisKKyAgICAgICAgICAgIC8vIENsZWFyIG91dCBhbnkgY3VycmVudCB0YXJnZXQgZm9yIHRoaXMgSUQuCisgICAgICAgICAgICAvLyBYWFg6IFdlIHNob3VsZCBwcm9iYWJseSBzZW5kIGFuIEFDVElPTl9VUCB0byB0aGUgY3VycmVudAorICAgICAgICAgICAgLy8gdGFyZ2V0IGlmIHByZXNlbnQuCisgICAgICAgICAgICB0YXJnZXRzLnJlbW92ZUJ5SWQoYWN0aW9uSWQpOworCisgICAgICAgICAgICAvLyBJZiB3ZSdyZSBkaXNhbGxvd2luZyBpbnRlcmNlcHQgb3IgaWYgd2UncmUgYWxsb3dpbmcgYW5kIHdlIGRpZG4ndAorICAgICAgICAgICAgLy8gaW50ZXJjZXB0CisgICAgICAgICAgICBpZiAoZGlzYWxsb3dJbnRlcmNlcHQgfHwgIW9uSW50ZXJjZXB0VG91Y2hFdmVudChldikpIHsKKyAgICAgICAgICAgICAgICAvLyByZXNldCB0aGlzIGV2ZW50J3MgYWN0aW9uIChqdXN0IHRvIHByb3RlY3Qgb3Vyc2VsdmVzKQorICAgICAgICAgICAgICAgIGV2LnNldEFjdGlvbihhY3Rpb24pOworICAgICAgICAgICAgICAgIC8vIFdlIGtub3cgd2Ugd2FudCB0byBkaXNwYXRjaCB0aGUgZXZlbnQgZG93biwgdHJ5IHRvIGZpbmQgYSBjaGlsZAorICAgICAgICAgICAgICAgIC8vIHdobyBjYW4gaGFuZGxlIGl0LCBzdGFydCB3aXRoIHRoZSBmcm9udC1tb3N0IGNoaWxkLgorICAgICAgICAgICAgICAgIGZpbmFsIFZpZXdbXSBjaGlsZHJlbiA9IG1DaGlsZHJlbjsKKyAgICAgICAgICAgICAgICBmaW5hbCBpbnQgY291bnQgPSBtQ2hpbGRyZW5Db3VudDsKKyAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gY291bnQgLSAxOyBpID49IDA7IGktLSkgeworICAgICAgICAgICAgICAgICAgICBmaW5hbCBWaWV3IGNoaWxkID0gY2hpbGRyZW5baV07CisgICAgICAgICAgICAgICAgICAgIGlmICgoY2hpbGQubVZpZXdGbGFncyAmIFZJU0lCSUxJVFlfTUFTSykgPT0gVklTSUJMRQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHx8IGNoaWxkLmdldEFuaW1hdGlvbigpICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGZpbmFsIE1vdGlvbkV2ZW50IGNoaWxkRXZlbnQgPSB0YXJnZXRzLmZpbHRlck1vdGlvbkV2ZW50Rm9yQ2hpbGQoZXYsIGNoaWxkKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjaGlsZEV2ZW50ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaW5hbCBpbnQgY2hpbGRBY3Rpb25JbmRleCA9IGNoaWxkRXZlbnQuZmluZFBvaW50ZXJJbmRleChhY3Rpb25JZCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkaXNwYXRjaFRvdWNoRXZlbnRJZkluVmlldyhjaGlsZCwgY2hpbGRFdmVudCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGlsZEFjdGlvbkluZGV4KSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGFyZ2V0cy5hZGQoYWN0aW9uSWQsIGNoaWxkKTsKKworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGZpbmFsbHkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGlsZEV2ZW50LnJlY3ljbGUoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAvLyBEaWRuJ3QgZmluZCBhIG5ldyB0YXJnZXQuIERvIHdlIGhhdmUgYSAicHJpbWFyeSIgdGFyZ2V0IHRvIHNlbmQgdG8/CisgICAgICAgICAgICAgICAgZmluYWwgVmlldyBwcmltYXJ5VGFyZ2V0ID0gdGFyZ2V0cy5nZXRQcmltYXJ5VGFyZ2V0KCk7CisgICAgICAgICAgICAgICAgaWYgKHByaW1hcnlUYXJnZXQgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICBmaW5hbCBNb3Rpb25FdmVudCBjaGlsZEV2ZW50ID0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB0YXJnZXRzLmZpbHRlck1vdGlvbkV2ZW50Rm9yQ2hpbGQoZXYsIHByaW1hcnlUYXJnZXQpOworICAgICAgICAgICAgICAgICAgICBpZiAoY2hpbGRFdmVudCAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIENhbGN1bGF0ZSB0aGUgb2Zmc2V0IHBvaW50IGludG8gdGhlIHRhcmdldCdzIGxvY2FsIGNvb3JkaW5hdGVzCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgeGMgPSBzY3JvbGxlZFhGbG9hdCAtIChmbG9hdCkgcHJpbWFyeVRhcmdldC5tTGVmdDsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCB5YyA9IHNjcm9sbGVkWUZsb2F0IC0gKGZsb2F0KSBwcmltYXJ5VGFyZ2V0Lm1Ub3A7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFwcmltYXJ5VGFyZ2V0Lmhhc0lkZW50aXR5TWF0cml4KCkgJiYgbUF0dGFjaEluZm8gIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBub24taWRlbnRpdHkgbWF0cml4OiB0cmFuc2Zvcm0gdGhlIHBvaW50IGludG8gdGhlIHZpZXcncworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBjb29yZGluYXRlcworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaW5hbCBmbG9hdFtdIGxvY2FsWFkgPSBtQXR0YWNoSW5mby5tVG1wVHJhbnNmb3JtTG9jYXRpb247CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxvY2FsWFlbMF0gPSB4YzsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbG9jYWxYWVsxXSA9IHljOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcmltYXJ5VGFyZ2V0LmdldEludmVyc2VNYXRyaXgoKS5tYXBQb2ludHMobG9jYWxYWSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHhjID0gbG9jYWxYWVswXTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeWMgPSBsb2NhbFhZWzFdOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGlsZEV2ZW50LnNldExvY2F0aW9uKHhjLCB5Yyk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHByaW1hcnlUYXJnZXQuZGlzcGF0Y2hUb3VjaEV2ZW50KGNoaWxkRXZlbnQpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRhcmdldHMuYWRkKGFjdGlvbklkLCBwcmltYXJ5VGFyZ2V0KTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGlsZEV2ZW50LnJlY3ljbGUoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIGJvb2xlYW4gaXNVcE9yQ2FuY2VsID0gKGFjdGlvbiA9PSBNb3Rpb25FdmVudC5BQ1RJT05fVVApIHx8CisgICAgICAgICAgICAgICAgKGFjdGlvbiA9PSBNb3Rpb25FdmVudC5BQ1RJT05fQ0FOQ0VMKTsKKworICAgICAgICBpZiAoaXNVcE9yQ2FuY2VsKSB7CisgICAgICAgICAgICAvLyBOb3RlLCB3ZSd2ZSBhbHJlYWR5IGNvcGllZCB0aGUgcHJldmlvdXMgc3RhdGUgdG8gb3VyIGxvY2FsCisgICAgICAgICAgICAvLyB2YXJpYWJsZSwgc28gdGhpcyB0YWtlcyBlZmZlY3Qgb24gdGhlIG5leHQgZXZlbnQKKyAgICAgICAgICAgIG1Hcm91cEZsYWdzICY9IH5GTEFHX0RJU0FMTE9XX0lOVEVSQ0VQVDsKKyAgICAgICAgfQorCisgICAgICAgIGlmICh0YXJnZXRzLmlzRW1wdHkoKSkgeworICAgICAgICAgICAgLy8gV2UgZG9uJ3QgaGF2ZSBhbnkgdGFyZ2V0cywgdGhpcyBtZWFucyB3ZSdyZSBoYW5kbGluZyB0aGUKKyAgICAgICAgICAgIC8vIGV2ZW50IGFzIGEgcmVndWxhciB2aWV3LgorICAgICAgICAgICAgZXYuc2V0TG9jYXRpb24oeGYsIHlmKTsKKyAgICAgICAgICAgIGlmICgobVByaXZhdGVGbGFncyAmI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ICAgICAgZmxvYXQgeWMgPSBzY3JvbGxlZFlGbG9hdCAtIChmbG9hdCkgdGFyZ2V0Lm1Ub3A7CisgICAgICAgICAgICAgICAgaWYgKCF0YXJnZXQuaGFzSWRlbnRpdHlNYXRyaXgoKSAmJiBtQXR0YWNoSW5mbyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIC8vIG5vbi1pZGVudGl0eSBtYXRyaXg6IHRyYW5zZm9ybSB0aGUgcG9pbnQgaW50byB0aGUgdmlldydzIGNvb3JkaW5hdGVzCisgICAgICAgICAgICAgICAgICAgIGZpbmFsIGZsb2F0W10gbG9jYWxYWSA9IG1BdHRhY2hJbmZvLm1UbXBUcmFuc2Zvcm1Mb2NhdGlvbjsKKyAgICAgICAgICAgICAgICAgICAgbG9jYWxYWVswXSA9IHhjOworICAgICAgICAgICAgICAgICAgICBsb2NhbFhZWzFdID0geWM7CisgICAgICAgICAgICAgICAgICAgIHRhcmdldC5nZXRJbnZlcnNlTWF0cml4KCkubWFwUG9pbnRzKGxvY2FsWFkpOworICAgICAgICAgICAgICAgICAgICB4YyA9IGxvY2FsWFlbMF07CisgICAgICAgICAgICAgICAgICAgIHljID0gbG9jYWxYWVsxXTsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICBldi5zZXRBY3Rpb24oTW90aW9uRXZlbnQuQUNUSU9OX0NBTkNFTCk7CisgICAgICAgICAgICAgICAgZXYuc2V0TG9jYXRpb24oeGMsIHljKTsKKyAgICAgICAgICAgICAgICBpZiAoIXRhcmdldC5kaXNwYXRjaFRvdWNoRXZlbnQoZXYpKSB7CisgICAgICAgICAgICAgICAgICAgIC8vIHRhcmdldCBkaWRuJ3QgaGFuZGxlIEFDVElPTl9DQU5DRUwuIG5vdCBtdWNoIHdlIGNhbiBkbworICAgICAgICAgICAgICAgICAgICAvLyBidXQgdGhleSBzaG91bGQgaGF2ZS4KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAg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sbGVkWEZsb2F0ID0geGYgKyBtU2Nyb2xsWDsKKyAgICAgICAgICAgICAgICBzY3JvbGxlZFlGbG9hdCA9IHlmICsgbVNjcm9sbFk7CisgICAgICAgICAgICAgICAgZmxvYXQgeGMgPSBzY3JvbGxlZFhGbG9hdCAtIChmbG9hdCkgdGFyZ2V0Lm1MZWZ0OworICAgICAgICAgICAgICAgIGZsb2F0IHljID0gc2Nyb2xsZWRZRmxvYXQgLSAoZmxvYXQpIHRhcmdldC5tVG9wOworICAgICAgICAgICAgICAgIGlmICghdGFyZ2V0Lmhhc0lkZW50aXR5TWF0cml4KCkgJiYgbUF0dGFjaEluZm8gIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAvLyBub24taWRlbnRpdHkgbWF0cml4OiB0cmFuc2Zvcm0gdGhlIHBvaW50IGludG8gdGhlIHZpZXcncyBjb29yZGluYXRlcworICAgICAgICAgICAgICAgICAgICBmaW5hbCBmbG9hdFtdIGxvY2FsWFkgPSBtQXR0YWNoSW5mby5tVG1wVHJhbnNmb3JtTG9jYXRpb247CisgICAgICAgICAgICAgICAgICAgIGxvY2FsWFlbMF0gPSB4YzsKKyAgICAgICAgICAgICAgICAgICAgbG9jYWxYWVsxXSA9IHljOworICAgICAgICAgICAgICAgICAgICB0YXJnZXQuZ2V0SW52ZXJzZU1hdHJpeCgpLm1hcFBvaW50cyhsb2NhbFhZKTsKKyAgICAgICAgICAgICAgICAgICAgeGMgPSBsb2NhbFhZWzBdOworICAgICAgICAgICAgICAgICAgICB5YyA9IGxvY2FsWFlbMV07CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgLy8gZmluYWxseSBvZmZzZXQgdGhlIGV2ZW50IHRvIHRoZSB0YXJnZXQncyBjb29yZGluYXRlIHN5c3RlbSBhbmQKKyAgICAgICAgICAgICAgICAvLyBkaXNwYXRjaCB0aGUgZXZlbnQuCisgICAgICAgICAgICAgICAgdGFyZ2V0RXZlbnQuc2V0TG9jYXRpb24oeGMsIHljKTsKKworICAgICAgICAgICAgICAgIGlmICgodGFyZ2V0Lm1Qcml2YXRlRmxhZ3MgJiBDQU5DRUxfTkVYVF9VUF9FVkVOVCkgIT0gMCkgeworICAgICAgICAgICAgICAgICAgICB0YXJnZXRFdmVudC5zZXRBY3Rpb24oTW90aW9uRXZlbnQuQUNUSU9OX0NBTkNFTCk7CisgICAgICAgICAgICAgICAgICAgIHRhcmdldC5tUHJpdmF0ZUZsYWdzICY9IH5DQU5DRUxfTkVYVF9VUF9FVkVOVDsKKyAgICAgICAgICAgICAgICAgICAgdGFyZ2V0cy5yZW1vdmVWaWV3KHRhcmdldCk7CisgICAgICAgICAgICAgICAgICAgIHVuaXF1ZUluZGV4LS07CisgICAgICAgICAgICAgICAgICAgIHVuaXF1ZVRhcmdldENvdW50LS07CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgaGFuZGxlZCB8PSB0YXJnZXQuZGlzcGF0Y2hUb3VjaEV2ZW50KHRhcmdldEV2ZW50KTsKKyAgICAgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICAgICAgdGFyZ2V0RXZlbnQucmVjeWNsZSgpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgaWYgKG1hc2tlZEFjdGlvbiA9PSBNb3Rpb25FdmVudC5BQ1RJT05fUE9JTlRFUl9VUCkgeworICAgICAgICAgICAgZmluYWwgaW50IHJlbW92ZUlkID0gZXYuZ2V0UG9pbnRlcklkKGV2LmdldEFjdGlvbkluZGV4KCkpOworICAgICAgICAgICAgdGFyZ2V0cy5yZW1vdmVCeUlkKHJlbW92ZUlkKTsKKyAgICAgICAgfQorCisgICAgICAgIGlmIChpc1VwT3JDYW5jZWwpIHsKKyAgICAgICAgICAgIHRhcmdldHMuY2xlYXIoKTsKKyAgICAgICAgfQorCisgICAgICAgIHJldHVybiBoYW5kbGVkOworICAgIH0KKworICAgIC8qKgorICAgICAqIEVuYWJsZSBvciBkaXNhYmxlIHRoZSB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VElPTl9FVkVOVFMpID09IEZMQUdfU1BMSVRfTU9USU9OX0VWRU5UUzsKKyAgICB9CisKKyAgICAvKioKICAgICAgKiB7QGluaGVyaXREb2N9CiAgICAgICovCiAgICAgcHVibGljIHZvaWQgcmVxdWVzdERpc2FsbG93SW50ZXJjZXB0VG91Y2hFdmVudChib29sZWFuIGRpc2FsbG93SW50ZXJjZXB0KSB7CkBAIC0xMTgyLDcgKzE0ODUsMTAgQEAKICAgICAgICAgZmluYWwgaW50IGNvdW50ID0gbUNoaWxkcmVuQ291bnQ7CiAgICAgICAgIGZpbmFsIFZpZXdbXSBjaGlsZHJlbiA9IG1DaGlsZHJlbjsKICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBjb3VudDsgaSsrKSB7Ci0gICAgICAgICAgICBjaGlsZHJlbltpXS5kaXNwYXRjaFNhdmVJbnN0YW5jZVN0YXRlKGNvbnRhaW5lcik7CisgICAgICAgICAgICBWaWV3IGMgPSBjaGlsZHJlbltpXTsKKyAgICAgICAgICAgIGlmICgoYy5tVmlld0ZsYWdzICYgUEFSRU5UX1NBVkVfRElTQUJMRURfTUFTSykgIT0gUEFSRU5UX1NBVkVfRElTQUJMRUQpIHsKKyAgICAgICAgICAgICAgICBjLmRpc3BhdGNoU2F2ZUluc3RhbmNlU3RhdGUoY29udGFpbmVyKTsKKyAgICAgICAgICAgIH0KICAgICAgICAgfQogICAgIH0KIApAQCAtMTIwNyw3ICsxNTEzLDEwIEBACiAgICAgICAgIGZpbmFsIGludCBjb3VudCA9IG1DaGlsZHJlbkNvdW50OwogICAgICAgICBmaW5hbCBWaWV3W10gY2hpbGRyZW4gPSBtQ2hpbGRyZW47CiAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgY291bnQ7IGkrKykgewotICAgICAgICAgICAgY2hpbGRyZW5baV0uZGlzcGF0Y2hSZXN0b3JlSW5zdGFuY2VTdGF0ZShjb250YWluZXIpOworICAgICAgICAgICAgVmlldyBjID0gY2hpbGRyZ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F0aW9uID09IG51bGwpIHsKLSAgICAgICAgICAgICAgICBtQ2hpbGRUcmFuc2Zvcm1hdGlvbiA9IG5ldyBUcmFuc2Zvcm1hdGlvbigpOworICAgICAgICAgICAgbW9yZSA9IGEuZ2V0VHJhbnNmb3JtYXRpb24oZHJhd2luZ1RpbWUsIG1DaGlsZFRyYW5zZm9ybWF0aW9uLAorICAgICAgICAgICAgICAgICAgICBzY2FsaW5nUmVxdWlyZWQgPyBtQXR0YWNoSW5mby5tQXBwbGljYXRpb25TY2FsZSA6IDFmKTsKKyAgICAgICAgICAgIGlmIChzY2FsaW5nUmVxdWlyZWQgJiYgbUF0dGFjaEluZm8ubUFwcGxpY2F0aW9uU2NhbGUgIT0gMWYpIHsKKyAgICAgICAgICAgICAgICBpZiAobUludmFsaWRhdGlvblRyYW5zZm9ybWF0aW9uID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgbUludmFsaWRhdGlvblRyYW5zZm9ybWF0aW9uID0gbmV3IFRyYW5zZm9ybWF0aW9uKCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGludmFsaWRhdGlvblRyYW5zZm9ybSA9IG1JbnZhbGlkYXRpb25UcmFuc2Zvcm1hdGlvbjsKKyAgICAgICAgICAgICAgICBhLmdldFRyYW5zZm9ybWF0aW9uKGRyYXdpbmdUaW1lLCBpbnZhbGlkYXRpb25UcmFuc2Zvcm0sIDFmKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgaW52YWxpZGF0aW9uVHJhbnNmb3JtID0gbUNoaWxkVHJhbnNmb3JtYXRpb247CiAgICAgICAgICAgICB9Ci0gICAgICAgICAgICBtb3JlID0gYS5nZXRUcmFuc2Zvcm1hdGlvbihkcmF3aW5nVGltZSwgbUNoaWxkVHJhbnNmb3JtYXRpb24pOwogICAgICAgICAgICAgdHJhbnNmb3JtVG9BcHBseSA9IG1DaGlsZFRyYW5zZm9ybWF0aW9uOwogCiAgICAgICAgICAgICBjb25jYXRNYXRyaXggPSBhLndpbGxDaGFuZ2VUcmFuc2Zvcm1hdGlvbk1hdHJpeCgpOwpAQCAtMTUyMCw3ICsxODM5LDExIEBACiAgICAgICAgICAgICAgICAgICAgICAgICBpbnZhbGlkYXRlKGNsLCBjdCwgY3IsIGNiKTsKICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIGEuZ2V0SW52YWxpZGF0ZVJlZ2lvbigwLCAwLCBjciAtIGNsLCBjYiAtIGN0LCByZWdpb24sIHRyYW5zZm9ybVRvQXBwbHkpOworICAgICAgICAgICAgICAgICAgICBpZiAobUludmFsaWRhdGVSZWdpb24gPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgbUludmFsaWRhdGVSZWdpb24gPSBuZXcgUmVjdEYoKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBmaW5hbCBSZWN0RiByZWdpb24gPSBtSW52YWxpZGF0ZVJlZ2lvbjsKKyAgICAgICAgICAgICAgICAgICAgYS5nZXRJbnZhbGlkYXRlUmVnaW9uKDAsIDAsIGNyIC0gY2wsIGNiIC0gY3QsIHJlZ2lvbiwgaW52YWxpZGF0aW9uVHJhbnNmb3JtKTsKIAogICAgICAgICAgICAgICAgICAgICAvLyBUaGUgY2hpbGQgbmVlZCB0byBkcmF3IGFuIGFuaW1hdGlvbiwgcG90ZW50aWFsbHkgb2Zmc2NyZWVuLCBzbwogICAgICAgICAgICAgICAgICAgICAvLyBtYWtlIHN1cmUgd2UgZG8gbm90IGNhbmNlbCBpbnZhbGlkYXRlIHJlcXVlc3RzCkBAIC0xNTMzLDkgKzE4NTYsNiBAQAogICAgICAgICAgICAgfQogICAgICAgICB9IGVsc2UgaWYgKChmbGFncyAmIEZMQUdfU1VQUE9SVF9TVEFUSUNfVFJBTlNGT1JNQVRJT05TKSA9PQogICAgICAgICAgICAgICAgIEZMQU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gICAgICAgICAgICAgICAgLy8gdGhlbiByZWRvIHRoZSBzY3JvbGwgdHJhbnNsYXRlIHRvIGdldCB0aGUgY29ycmVjdCByZXN1bHQuCisgICAgICAgICAgICAgICAgICAgIGNhbnZhcy50cmFuc2xhdGUoLXRyYW5zWCwgLXRyYW5zWSk7CisgICAgICAgICAgICAgICAgICAgIGNhbnZhcy5jb25jYXQodHJhbnNmb3JtVG9BcHBseS5nZXRNYXRyaXgoKSk7CisgICAgICAgICAgICAgICAgICAgIGNhbnZhcy50cmFuc2xhdGUodHJhbnNYLCB0cmFuc1kpOworICAgICAgICAgICAgICAgICAgICBtR3JvdXBGbGFncyB8PSBGTEFHX0NMRUFSX1RSQU5TRk9STUFUSU9OOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIGZsb2F0IHRyYW5zZm9ybUFscGhhID0gdHJhbnNmb3JtVG9BcHBseS5nZXRBbHBoYSgpOworICAgICAgICAgICAgICAgIGlmICh0cmFuc2Zvcm1BbHBoYSA8IDEuMGYpIHsKKyAgICAgICAgICAgICAgICAgICAgYWxwaGEgKj0gdHJhbnNmb3JtVG9BcHBseS5nZXRBbHBoYSgpOworICAgICAgICAgICAgICAgICAgICBtR3JvdXBGbGFncyB8PSBGTEFHX0NMRUFSX1RSQU5TRk9STUFUSU9OOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKCFjaGlsZC5oYXNJZGVudGl0eU1hdHJpeCgpKSB7CisgICAgICAgICAgICAgICAgY2FudmFzLnRyYW5zbGF0ZSgtdHJhbnNYLCAtdHJhbnNZKTsKKyAgICAgICAgICAgICAgICBjYW52YXMuY29uY2F0KGNoaWxkLmdldE1hdHJpeCgpKTsKKyAgICAgICAgICAgICAgICBjYW52YXMudHJhbnNsYXRlKHRyYW5zWCwgdHJhbnNZKTsKKyAgICAgICAgICAgIH0KKwogICAgICAgICAgICAgaWYgKGFscGhhIDwgMS4wZikgewogICAgICAgICAgICAgICAgIG1Hcm91cEZsYWdzIHw9IEZMQUdfQ0xFQVJfVFJBTlNGT1JNQVRJT047Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIGlmIChhbHBoYSA8IDEuMGYgJiYgaGFzTm9DYWNoZSkgewotICAgICAgICAgICAgICAgIGZpbmFsIGludCBtdWx0aXBsaWVkQWxwaGEgPSAoaW50KSAoMjU1ICogYWxwaGEpOwotICAgICAgICAgICAgICAgIGlmICghY2hpbGQub25TZXRBbHBoYShtdWx0aXBsaWVkQWxwaGEpKSB7Ci0gICAgICAgICAgICAgICAgICAgIGNhbnZhcy5zYXZlTGF5ZXJBbHBoYShzeCwgc3ksIHN4ICsgY3IgLSBjbCwgc3kgKyBjYiAtIGN0LCBtdWx0aXBsaWVkQWxwaGEsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgQ2FudmFzLkhBU19BTFBIQV9MQVlFUl9TQVZFX0ZMQUcgfCBDYW52YXMuQ0xJUF9UT19MQVlFUl9TQVZFX0ZMQUcpOwotICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIGNoaWxkLm1Qcml2YXRlRmxhZ3MgfD0gQUxQSEFfU0VUOworICAgICAgICAgICAgCisgICAgICAgICAgICAgICAgaWYgKGhhc05vQ2FjaGUpIHsKKyAgICAgICAgICAgICAgICAgICAgZmluYWwgaW50IG11bHRpcGxpZWRBbHBoYSA9IChpbnQpICgyNTUgKiBhbHBoYSk7CisgICAgICAgICAgICAgICAgICAgIGlmICghY2hpbGQub25TZXRBbHBoYShtdWx0aXBsaWVkQWxwaGEpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBjYW52YXMuc2F2ZUxheWVyQWxwaGEoc3gsIHN5LCBzeCArIGNyIC0gY2wsIHN5ICsgY2IgLSBjdCwgbXVsdGlwbGllZEFscGhhLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDYW52YXMuSEFTX0FMUEhBX0xBWUVSX1NBVkVfRkxBRyB8IENhbnZhcy5DTElQX1RPX0xBWUVSX1NBVkVfRkxBRyk7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICBjaGlsZC5tUHJpdmF0ZUZsYWdzIHw9IEFMUEhBX1NFVDsKKyAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KICAgICAgICAgfSBlbHNlIGlmICgoY2hpbGQubVByaXZhdGVGbGFncyAmIEFMUEhBX1NFVCkgPT0gQUxQSEFfU0VUKSB7CkBAIC0xNjk3LDYgKzIwMzEsNyBAQAogICAgICAgICBmaW5hbCBWaWV3W10gY2hpbGRyZW4gPSBtQ2hpbGRyZW47CiAgICAgICAgIGZpbmFsIGludCBjb3VudCA9IG1DaGlsZHJlbkNvdW50OwogICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGNvdW50OyBpKyspIHsKKyAgICAgICAgICAgIAogICAgICAgICAgICAgY2hpbGRyZW5baV0uc2V0U2VsZWN0ZWQoc2VsZWN0ZWQpOwogICAgICAgICB9CiAgICAgfQpAQCAtMjQ3MCw2ICsyODA1LDE1IEBACiAgICAgICAgICAgICBmaW5hbCBpbnRbXSBsb2NhdGlvbiA9IGF0dGFjaEluZm8ubUludmFsaWRhdGVDaGlsZExvY2F0aW9uOwogICAgICAgICAgICAgbG9jYXRpb25bQ0hJTERfTEVGVF9JTkRFWF0gPSBjaGlsZC5tTGVmdDsKICAgICAgICAgICAgIGxvY2F0aW9uW0NISUxEX1RPUF9JTkRFWF0gPSBjaGlsZC5tVG9wOworICAgICAgICAgICAgTWF0cml4IGNoaWxkTWF0cml4ID0gY2hpbGQuZ2V0TWF0cml4KCk7CisgICAgICAgICAgICBpZiAoIWNoaWxkTWF0cml4LmlzSWRlbnRpdHkoKSkgeworICAgICAgICAgICAgICAgIFJlY3RGIGJvdW5kaW5nUmVjdCA9IGF0dGFjaEluZm8ubVRtcFRyYW5zZm9ybVJlY3Q7CisgICAgICAgICAgICAgICAgYm91bmRpbmdSZWN0LnNldChkaXJ0eSk7CisgICAgICAgICAgICAgICAgY2hpbGRNYXRyaXgubWFwUmVjdChib3VuZGluZ1JlY3QpOworICAgICAgICAgICAgICAgIGRpcnR5LnNldCgoaW50KSBib3VuZGluZ1JlY3QubGVmdCwgKGludCkgYm91bmRpbmdSZWN0LnRvcCwKKyAgICAgICAgICAgICAgICAgICAgICAgIChpbnQpIChib3VuZGluZ1JlY3QucmlnaHQgKyAwLjVmKSwKKyAgICAgICAgICAgICAgICAgICAgICAgIChpbnQpIChib3VuZGluZ1JlY3QuYm90dG9tICsgMC41ZikpOworICAgICAgICAgICAgfQogCiAgICAgICAgICAgICAvLyBJZiB0aGUgY2hpbGQgaXMgZHJhd2luZyBhbiBhbmltYXRpb24sIHdlIHdhbnQgdG8gY29weSB0aGlzIGZsYWcgb250bwogICAgICAgICAgICAgLy8gb3Vyc2VsdmVzIGFuZCB0aGUgcGFyZW50IHRvIG1ha2Ugc3VyZSB0aGUgaW52YWxpZGF0ZSByZXF1ZXN0IGdvZXMKQEAgLTI1MDQsNiArMjg0OCwxOCBAQAogICAgICAgICAgICAgICAgIH0KIAogICAgICAgICAgICAgICAgIHBhcmVudCA9IHBhcmVudC5pbnZhbGlkYXRlQ2hpbGRJblBhcmVudChsb2NhdGlvbiwgZGlydHkpOworICAgICAgICAgICAgICAgIGlmICh2aWV3ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gQWNjb3VudCBmb3IgdHJhbnNmb3JtIG9uIGN1cnJlbnQgcGFyZW50CisgICAgICAgICAgICAgICAgICAgIE1hdHJpeCBtID0gdmlldy5nZXRNYXRyaXgoKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKCFtLmlzSWRlbnRpdHkoKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgUmVjdEYgYm91bmRpbmdSZWN0ID0gYXR0YWNoSW5mby5tVG1wVHJhbnNmb3JtUmVjdDsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJvdW5kaW5nUmVjdC5zZXQoZGlydHkpOworICAgICAgICAgICAgICAgICAgICAgICAgbS5tYXBSZWN0KGJvdW5kaW5nUmVjdCk7CisgICAgICAgICAgICAgICAgICAgICAgICBkaXJ0eS5zZXQoKGludCkgYm91bmRpbmdSZWN0LmxlZnQsIChpbnQpIGJvdW5kaW5nUmVjdC50b3AsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChpbnQpIChib3VuZGluZ1JlY3QucmlnaHQgKyAwLjVmKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGludCkgKGJvdW5kaW5nUmVjdC5ib3R0b20gKyAwLjVmKSk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9IHdoaWxlIChwYXJlbnQgIT0gbnVsbCk7CiAgICAgICAgIH0KICAgICB9CkBAIC0yODcwLDcgKzMyMjYsNyBAQAogICAgICAqLwogICAgIEBWaWV3RGVidWcuRXhwb3J0ZWRQcm9wZXJ0eShjYXRlZ29yeSA9ICJkcmF3aW5nIiwgbWFwcGluZyA9IHsKICAgICAgICAgQFZpZXdEZWJ1Zy5JbnRUb1N0cmluZyhmcm9tID0gUEVSU0lTVEVOVF9OT19DQUNIRSwgICAgICAgIHRvID0gIk5PTkUiKSwKLSAgICAgICAgQFZpZXdEZWJ1Zy5JbnRUb1N0cmluZyhmcm9tID0gUEVSU0lTVEVOVF9BTExfQ0FDSEVTLCAgICAgIHRvID0gIkFOSU1BVElPTiIpLAorICAgICAgICBAVmlld0RlYnVnLkludFRvU3RyaW5nKGZyb20gPSBQRVJTSVNURU5UX0FOSU1BVElPTl9DQUNIRSwgdG8gPSAiQU5JTUFUSU9OIiksCiAgICAgICAgIEBWaWV3RGVidWcuSW50VG9TdHJpbmcoZnJvbSA9IFBFUlNJU1RFTlRfU0NST0xMSU5HX0NBQ0hFLCB0byA9ICJTQ1JPTExJTkciKSwKICAgICAgICAgQFZpZXdEZWJ1Zy5JbnRUb1N0cmluZyhmcm9tID0gUEVSU0lTVEVOVF9BTExfQ0FDSEVTLCAgICAgIHRvID0gIkFMTCIpCiAgICAgfSkKQEAgLTM3NDQsNCArNDEwMCwyNjMgQEAKICAgICAgICAgICAgIGJvdHRvbU1hcmdpbiA9IGJvdHRvbTsKICAgICAgICAgfQogICAgIH0KKworICAgIHByaXZhdGUgc3RhdGljIGNsYXNzIFNwbGl0TW90aW9uVGFyZ2V0cyB7CisgICAgICAgIHByaXZhdGUgU3BhcnNlQXJyYXk8Vmlldz4gbVRhcmdldHM7CisgICAgICAgIHByaXZhdGUgVmlld1tdIG1VbmlxdWVUYXJnZXRzOworICAgICAgICBwcml2YXRlIGludCBtVW5pcXVlVGFyZ2V0Q291bnQ7CisgICAgICAgIHByaXZhdGUgbG9uZyBtRG93blRpbWU7CisgICAgICAgIHByaXZhdGUgTW90aW9uRXZlbnQuUG9pbnRlckNvb3Jkc1tdIG1Qb2ludGVyQ29vcmRzOworICAgICAgICBwcml2YXRlIGludFtdIG1Qb2ludGVySWRzOworCisgICAgICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBJTklUSUFMX1VOSVFVRV9NT1RJT05fVEFSR0VUU19TSVpFID0gNTsKKyAgICAgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IElOSVRJQUxfQlVDS0VUX1NJWkUgPSA1OworCisgICAgICAgIHB1YmxpYyBTcGxpdE1vdGlvblRhcmdldHMoKSB7CisgICAgICAgICAgICBtVGFyZ2V0cyA9IG5ldyBTcGFyc2VBcnJheTxWaWV3PigpOworICAgICAgICAgICAgbVVuaXF1ZVRhcmdldHMgPSBuZXcgVmlld1tJTklUSUFMX1VOSVFVRV9NT1RJT05fVEFSR0VUU19TSVpFXTsKKyAgICAgICAgICAgIG1Qb2ludGVySWRzID0gbmV3IGludFtJTklUSUFMX0JVQ0tFVF9TSVpFXTsKKyAgICAgICAgICAgIG1Qb2ludGVyQ29vcmRzID0gbmV3IE1vdGlvbkV2ZW50LlBvaW50ZXJDb29yZHNbSU5JVElBTF9CVUNLRVRfU0laRV07CisgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IElOSVRJQUxfQlVDS0VUX1NJWkU7IGkrKykgeworICAgICAgICAgICAgICAgIG1Qb2ludGVyQ29vcmRzW2ldID0gbmV3IE1vdGlvbkV2ZW50LlBvaW50ZXJDb29yZHMoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyB2b2lkIGNsZWFyKCkgeworICAgICAgICAgICAgbVRhcmdldHMuY2xlYXIoKTsKKyAgICAgICAgICAgIEFycmF5cy5maWxsKG1VbmlxdWVUYXJnZXRzLCBudWxsKTsKKyAgICAgICAgICAgIG1VbmlxdWVUYXJnZXRDb3VudCA9IDA7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCBhZGQoaW50IHBvaW50ZXJJZCwgVmlldyB0YXJnZXQpIHsKKyAgICAgICAgICAgIG1UYXJnZXRzLnB1dChwb2ludGVySWQsIHRhcmdldCk7CisKKyAgICAgICAgICAgIGZpbmFsIGludCB1bmlxdWVDb3VudCA9IG1VbmlxdWVUYXJnZXRDb3VudDsKKyAgICAgICAgICAgIGJvb2xlYW4gYWRkVW5pcXVlID0gdHJ1ZTsKKyAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgdW5pcXVlQ291bnQ7IGkrKykgeworICAgICAgICAgICAgICAgIGlmIChtVW5pcXVlVGFyZ2V0c1tpXSA9PSB0YXJnZXQpIHsKKyAgICAgICAgICAgICAgICAgICAgYWRkVW5pcXVlID0gZmFsc2U7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKGFkZFVuaXF1ZSkgeworICAgICAgICAgICAgICAgIGlmIChtVW5pcXVlVGFyZ2V0cyA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIG1VbmlxdWVUYXJnZXRzID0gbmV3IFZpZXdbSU5JVElBTF9VTklRVUVfTU9USU9OX1RBUkdFVFNfU0laRV07CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGlmIChtVW5pcXVlVGFyZ2V0cy5sZW5ndGggPT0gdW5pcXVlQ291bnQpIHsKKyAgICAgICAgICAgICAgICAgICAgVmlld1tdIG5ld1RhcmdldHMgPQorICAgICAgICAgICAgICAgICAgICAgICAgbmV3IFZpZXdbdW5pcXVlQ291bnQgKyBJTklUSUFMX1VOSVFVRV9NT1RJT05fVEFSR0VUU19TSVpFXTsKKyAgICAgICAgICAgICAgICAgICAgU3lzdGVtLmFycmF5Y29weShtVW5pcXVlVGFyZ2V0cywgMCwgbmV3VGFyZ2V0cywgMCwgdW5pcXVlQ291bnQpOworICAgICAgICAgICAgICAgICAgICBtVW5pcXVlVGFyZ2V0cyA9IG5ld1RhcmdldHM7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIG1VbmlxdWVUYXJnZXRzW3VuaXF1ZUNvdW50XSA9IHRhcmdldDsKKyAgICAgICAgICAgICAgICBtVW5pcXVlVGFyZ2V0Q291bnQrKzsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBpbnQgZ2V0SWRDb3VudCgpIHsKKyAgICAgICAgICAgIHJldHVybiBtVGFyZ2V0cy5zaXplKCk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgaW50IGdldFVuaXF1ZVRhcmdldENvdW50KCkgeworICAgICAgICAgICAgcmV0dXJuIG1VbmlxdWVUYXJnZXRDb3VudDsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBWaWV3IGdldFVuaXF1ZVRhcmdldEF0KGludCBpbmRleCkgeworICAgICAgICAgICAgcmV0dXJuIG1VbmlxdWVUYXJnZXRzW2luZGV4XTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBWaWV3IGdldChpbnQgaWQpIHsKKyAgICAgICAgICAgIHJldHVybiBtVGFyZ2V0cy5nZXQoaWQpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIGludCBpbmRleE9mSWQoaW50IGlkKSB7CisgICAgICAgICAgICByZXR1cm4gbVRhcmdldHMuaW5kZXhPZktleShpZCk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgaW50IGluZGV4T2ZUYXJnZXQoVmlldyB0YXJnZXQpIHsKKyAgICAgICAgICAgIHJldHVybiBtVGFyZ2V0cy5pbmRleE9mVmFsdWUodGFyZ2V0KTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBpbnQgaWRBdChpbnQgaW5kZXgpIHsKKyAgICAgICAgICAgIHJldHVybiBtVGFyZ2V0cy5rZXlBdChpbmRleCk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgVmlldyB0YXJnZXRBdChpbnQgaW5kZXgpIHsKKyAgICAgICAgICAgIHJldHVybiBtVGFyZ2V0cy52YWx1ZUF0KGluZGV4KTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBWaWV3IGdldFByaW1hcnlUYXJnZXQoKSB7CisgICAgICAgICAgICBpZiAoIWlzRW1wdHkoKSkgeworICAgICAgICAgICAgICAgIHJldHVybiBtVW5pcXVlVGFyZ2V0c1swXTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIGJvb2xlYW4gaGFzVGFyZ2V0KFZpZXcgdGFyZ2V0KSB7CisgICAgICAgICAgICBmaW5hbCBWaWV3W10gdW5pcXVlID0gbVVuaXF1ZVRhcmdldHM7CisgICAgICAgICAgICBmaW5hbCBpbnQgdW5pcXVlQ291bnQgPSBtVW5pcXVlVGFyZ2V0Q291bnQ7CisgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IHVuaXF1ZUNvdW50OyBpKyspIHsKKyAgICAgICAgICAgICAgICBpZiAodW5pcXVlW2ldID09IHRhcmdldCkgeworICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgYm9vbGVhbiBpc0VtcHR5KCkgeworICAgICAgICAgICAgcmV0dXJuIG1VbmlxdWVUYXJnZXRDb3VudCA9PSAwOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgcmVtb3ZlQnlJZChpbnQgaWQpIHsKKyAgICAgICAgICAgIGZpbmFsIGludCBpbmRleCA9IG1UYXJnZXRzLmluZGV4T2ZLZXkoaWQpOworICAgICAgICAgICAgcmVtb3ZlQXQoaW5kZXgpOworICAgICAgICB9CisgICAgICAgIAorICAgICAgICBwdWJsaWMgdm9pZCByZW1vdmVWaWV3KFZpZXcgdmlldykgeworICAgICAgICAgICAgaW50IGkgPSAwOworICAgICAgICAgICAgd2hpbGUgKGkgPCBtVGFyZ2V0cy5zaXplKCkpIHsKKyAgICAgICAgICAgICAgICBpZiAobVRhcmdldHMudmFsdWVBdChpKSA9PSB2aWV3KSB7CisgICAgICAgICAgICAgICAgICAgIG1UYXJnZXRzLnJlbW92ZUF0KGkpOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIGkrKzsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZW1vdmVVbmlxdWUodmlldyk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCByZW1vdmVBdChpbnQgaW5kZXgpIHsKKyAgICAgICAgICAgIGlmIChpbmRleCA8IDAgfHwgaW5kZXggPj0gbVRhcmdldHMuc2l6ZSgpKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBmaW5hbCBWaWV3IHJlbW92ZVZpZXcgPSBtVGFyZ2V0cy52YWx1ZUF0KGluZGV4KTsKKyAgICAgICAgICAgIG1UYXJnZXRzLnJlbW92ZUF0KGluZGV4KTsKKyAgICAgICAgICAgIGlmIChtVGFyZ2V0cy5pbmRleE9mVmFsdWUocmVtb3ZlVmlldykgPCAwKSB7CisgICAgICAgICAgICAgICAgcmVtb3ZlVW5pcXVlKHJlbW92ZVZpZXcpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSB2b2lkIHJlbW92ZVVuaXF1ZShWaWV3IHJlbW92ZVZpZXcpIHsKKyAgICAgICAgICAgIFZpZXdbXSB1bmlxdWUgPSBtVW5pcXVlVGFyZ2V0czsKKyAgICAgICAgICAgIGludCB1bmlxdWVDb3VudCA9IG1VbmlxdWVUYXJnZXRDb3VudDsKKyAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgdW5pcXVlQ291bnQ7IGkrKykgeworICAgICAgICAgICAgICAgIGlmICh1bmlxdWVbaV0gPT0gcmVtb3ZlVmlldykgeworICAgICAgICAgICAgICAgICAgICB1bmlxdWVbaV0gPSB1bmlxdWVbLS11bmlxdWVDb3VudF07CisgICAgICAgICAgICAgICAgICAgIHVuaXF1ZVt1bmlxdWVDb3VudF0gPSBudWxsOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIG1VbmlxdWVUYXJnZXRDb3VudCA9IHVuaXF1ZUNvdW50OworICAgICAgICB9CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFJldHVybiBhIG5ldyAob2J0YWluKCllZCkgTW90aW9uRXZlbnQgY29udGFpbmluZyBvbmx5IGRhdGEgZm9yIHBvaW50ZXJzIHRoYXQgc2hvdWxkCisgICAgICAgICAqIGJlIGRpc3BhdGNoZWQgdG8gY2hpbGQuIERvbid0IGZvcmdldCB0byByZWN5Y2xlIGl0IQorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIE1vdGlvbkV2ZW50IGZpbHRlck1vdGlvbkV2ZW50Rm9yQ2hpbGQoTW90aW9uRXZlbnQgZXYsIFZpZXcgY2hpbGQpIHsKKyAgICAgICAgICAgIGludCBhY3Rpb24gPSBldi5nZXRBY3Rpb24oKTsKKyAgICAgICAgICAgIGZpbmFsIGludCBtYXNrZWRBY3Rpb24gPSBhY3Rpb24gJiBNb3Rpb25FdmVudC5BQ1RJT05fTUFTSzsKKworICAgICAgICAgICAgLy8gT25seSBzZW5kIHBvaW50ZXIgdXAgZXZlbnRzIGlmIHRoaXMgY2hpbGQgd2FzIHRoZSB0YXJnZXQuIERyb3AgaXQgb3RoZXJ3aXNlLgorICAgICAgICAgICAgaWYgKG1hc2tlZEFjdGlvbiA9PSBNb3Rpb25FdmVudC5BQ1RJT05fUE9JTlRFUl9VUCAmJgorICAgICAgICAgICAgICAgICAgICBnZXQoZXYuZ2V0UG9pbnRlcklkKGV2LmdldEFjdGlvbkluZGV4KCkpKSAhPSBjaGlsZCkgeworICAgICAgICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpbnQgcG9pbnRlckNvdW50ID0gMDsKKyAgICAgICAgICAgIGZpbmFsIGludCBpZENvdW50ID0gZ2V0SWRDb3VudCgpOworICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBpZENvdW50OyBpKyspIHsKKyAgICAgICAgICAgICAgICBpZiAodGFyZ2V0QXQoaSkgPT0gY2hpbGQpIHsKKyAgICAgICAgICAgICAgICAgICAgcG9pbnRlckNvdW50Kys7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpbnQgYWN0aW9uSWQgPSAtMTsKKyAgICAgICAgICAgIGJvb2xlYW4gbmVlZHNOZXdJbmRleCA9IGZhbHNlOyAvLyBUcnVlIGlmIHdlIHNob3VsZCBmaWxsIGluIHRoZSBhY3Rpb24ncyBtYXNrZWQgaW5kZXgKKworICAgICAgICAgICAgLy8gSWYgd2UgaGF2ZSBhIGRvd24gZXZlbnQsIGl0IHdhc24ndCBjb3VudGVkIGFib3ZlLgorICAgICAgICAgICAgaWYgKG1hc2tlZEFjdGlvbiA9PSBNb3Rpb25FdmVudC5BQ1RJT05fRE9XTikgeworICAgICAgICAgICAgICAgIHBvaW50ZXJDb3VudCsrOworICAgICAgICAgICAgICAgIGFjdGlvbklkID0gZXYuZ2V0UG9pbnRlcklkKDApOworICAgICAgICAgICAgICAgIG1Eb3duVGltZSA9IGV2LmdldERvd25UaW1lKCk7CisgICAgICAgICAgICB9IGVsc2UgaWYgKG1hc2tlZEFjdGlvbiA9PSBNb3Rpb25FdmVudC5BQ1RJT05fUE9JTlRFUl9ET1dOKSB7CisgICAgICAgICAgICAgICAgcG9pbnRlckNvdW50Kys7CisKKyAgICAgICAgICAgICAgICBhY3Rpb25JZCA9IGV2LmdldFBvaW50ZXJJZChldi5nZXRBY3Rpb25JbmRleCgpKTsKKworICAgICAgICAgICAgICAgIGlmIChpbmRleE9mVGFyZ2V0KGNoaWxkKSA8IDApIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gVGhlIG5ldyBhY3Rpb24gc2hvdWxkIGJlIEFDVElPTl9ET1dOIGlmIHRoaXMgY2hpbGQgaXNuJ3QgY3VycmVudGx5IGdldHRpbmcKKyAgICAgICAgICAgICAgICAgICAgLy8gYW55IGV2ZW50cy4KKyAgICAgICAgICAgICAgICAgICAgYWN0aW9uID0gTW90aW9uRXZlbnQuQUNUSU9OX0RPV047CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gRmlsbCBpbiB0aGUgaW5kZXggcG9ydGlvbiBvZiB0aGUgYWN0aW9uIGxhdGVyLgorICAgICAgICAgICAgICAgICAgICBuZWVkc05ld0luZGV4ID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9IGVsc2UgaWYgKG1hc2tlZEFjdGlvbiA9PSBNb3Rpb25FdmVudC5BQ1RJT05fUE9JTlRFUl9VUCkgeworICAgICAgICAgICAgICAgIGFjdGlvbklkID0gZXYuZ2V0UG9pbnRlcklkKGV2LmdldEFjdGlvbkluZGV4KCkpOworICAgICAgICAgICAgICAgIGlmIChwb2ludGVyQ291bnQgPT0gMSkgeworICAgICAgICAgICAgICAgICAgICAvLyBUaGUgbmV3IGFjdGlvbiBzaG91bGQgYmUgQUNUSU9OX1VQIGlmIHRoZXJlJ3Mgb25seSBvbmUgcG9pbnRlciBsZWZ0IGZvcgorICAgICAgICAgICAgICAgICAgICAvLyB0aGlzIHRhcmdldC4KKyAgICAgICAgICAgICAgICAgICAgYWN0aW9uID0gTW90aW9uRXZlbnQuQUNUSU9OX1VQOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIC8vIEZpbGwgaW4gdGhlIGluZGV4IHBvcnRpb24gb2YgdGhlIGFjdGlvbiBsYXRlci4KKyAgICAgICAgICAgICAgICAgICAgbmVlZHNOZXdJbmRleCA9IHRydWU7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpZiAocG9pbnRlckNvdW50ID09IDApIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgLy8gRmlsbCB0aGUgYnVja2V0cyB3aXRoIHBvaW50ZXIgZGF0YSEKKyAgICAgICAgICAgIGZpbmFsIGludCBldmVudFBvaW50ZXJDb3VudCA9IGV2LmdldFBvaW50ZXJDb3VudCgpOworICAgICAgICAgICAgaW50IGJ1Y2tldEluZGV4ID0gMDsKKyAgICAgICAgICAgIGludCBuZXdBY3Rpb25JbmRleCA9IC0xOworICAgICAgICAgICAgZm9yIChpbnQgZXZwID0gMDsgZXZwIDwgZXZlbnRQb2ludGVyQ291bnQ7IGV2cCsrKSB7CisgICAgICAgICAgICAgICAgZmluYWwgaW50IGlkID0gZXYuZ2V0UG9pbnRlcklkKGV2cCk7CisKKyAgICAgICAgICAgICAgICAvLyBBZGQgdGhpcyBwb2ludGVyIHRvIHRoZSBidWNrZXQgaWYgaXQgaXMgbmV3IG9yIHRhcmdldGVkIGF0IGNoaWxkCisgICAgICAgICAgICAgICAgaWYgKGlkID09IGFjdGlvbklkIHx8IGdldChpZCkgPT0gY2hpbGQpIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gRXhwYW5kIHNjcmF0Y2ggYXJyYXlzIGlmIG5lZWRlZAorICAgICAgICAgICAgICAgICAgICBpZiAobVBvaW50ZXJDb29yZHMubGVuZ3RoIDw9IGJ1Y2tldEluZGV4KSB7CisgICAgICAgICAgICAgICAgICAgICAgICBpbnRbXSBwb2ludGVySWRzID0gbmV3IGludFtwb2ludGVyQ291bnRdOworICAgICAgICAgICAgICAgICAgICAgICAgTW90aW9uRXZlbnQuUG9pbnRlckNvb3Jkc1tdIHBvaW50ZXJDb29yZHMgPQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXcgTW90aW9uRXZlbnQuUG9pbnRlckNvb3Jkc1twb2ludGVyQ291bnRdOworICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IG1Qb2ludGVyQ29vcmRzLmxlbmd0aDsgaSA8IHBvaW50ZXJDb29yZHMubGVuZ3RoOyBpKyspIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBwb2ludGVyQ29vcmRzW2ldID0gbmV3IE1vdGlvbkV2ZW50LlBvaW50ZXJDb29yZHMoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICAgICAgU3lzdGVtLmFycmF5Y29weShtUG9pbnRlckNvb3JkcywgMCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcG9pbnRlckNvb3JkcywgMCwgbVBvaW50ZXJDb29yZHMubGVuZ3RoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIFN5c3RlbS5hcnJheWNvcHkobVBvaW50ZXJJZHMsIDAsIHBvaW50ZXJJZHMsIDAsIG1Qb2ludGVySWRzLmxlbmd0aCk7CisKKyAgICAgICAgICAgICAgICAgICAgICAgIG1Qb2ludGVyQ29vcmRzID0gcG9pbnRlckNvb3JkczsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1Qb2ludGVySWRzID0gcG9pbnRlcklkczsKKyAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgIG1Qb2ludGVySWRzW2J1Y2tldEluZGV4XSA9IGlkOworICAgICAgICAgICAgICAgICAgICBldi5nZXRQb2ludGVyQ29vcmRzKGV2cCwgbVBvaW50ZXJDb29yZHNbYnVja2V0SW5kZXhdKTsKKworICAgICAgICAgICAgICAgICAgICBpZiAobmVlZHNOZXdJbmRleCAmJiBpZCA9PSBhY3Rpb25JZCkgeworICAgICAgICAgICAgICAgICAgICAgICAgbmV3QWN0aW9uSW5kZXggPSBidWNrZXRJbmRleDsKKyAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgIGJ1Y2tldEluZGV4Kys7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorCisgICAgICAgICAgICAvLyBFbmNvZGUgdGhlIG5ldyBhY3Rpb24gaW5kZXggaWYgd2UgaGF2ZSBvbmUKKyAgICAgICAgICAgIGlmIChuZXdBY3Rpb25JbmRleCA+PSAwKSB7CisgICAgICAgICAgICAgICAgYWN0aW9uID0gKGFjdGlvbiAmIE1vdGlvbkV2ZW50LkFDVElPTl9NQVNLKSB8CisgICAgICAgICAgICAgICAgICAgICAgICAobmV3QWN0aW9uSW5kZXggPDwgTW90aW9uRXZlbnQuQUNUSU9OX1BPSU5URVJfSU5ERVhfU0hJRlQpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBNb3Rpb25FdmVudCByZXN1bHQgPSBNb3Rpb25FdmVudC5vYnRhaW4obURvd25UaW1lLCBldi5nZXRFdmVudFRpbWUoKSwKKyAgICAgICAgICAgICAgICAgICAgYWN0aW9uLCBwb2lud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CkgewogICAgICAgICBzdXBlcigpOwogCi0gICAgICAgIGlmIChNRUFTVVJFX0xBVEVOQ1kgJiYgbHQgPT0gbnVsbCkgewotICAgICAgICAgICAgbHQgPSBuZXcgTGF0ZW5jeVRpbWVyKDEwMCwgMTAwMCk7CisgICAgICAgIGlmIChNRUFTVVJFX0xBVEVOQ1kpIHsKKyAgICAgICAgICAgIGlmIChsdCA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgbHQgPSBuZXcgTGF0ZW5jeVRpbWVyKDEwMCwgMTAwMCk7CisgICAgICAgICAgICB9CiAgICAgICAgIH0KIAogICAgICAgICAvLyBGb3IgZGVidWcgb25seQpAQCAtMzMwLDEyMiArMzE5LDE4IEBACiAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICB9CiAKLSAgICBwcml2YXRlIHZvaWQgaW5pdGlhbGl6ZUdMKCkgewotICAgICAgICBpbml0aWFsaXplR0xJbm5lcigpOwotICAgICAgICBpbnQgZXJyID0gbUVnbC5lZ2xHZXRFcnJvcigpOwotICAgICAgICBpZiAoZXJyICE9IEVHTDEwLkVHTF9TVUNDRVNTKSB7Ci0gICAgICAgICAgICAvLyBnaXZlLXVwIG9uIHVzaW5nIEdMCi0gICAgICAgICAgICBkZXN0cm95R0woKTsKLSAgICAgICAgICAgIG1HbFdhbnRlZCA9IGZhbHNlOwotICAgICAgICB9Ci0gICAgfQotCi0gICAgcHJpdmF0ZSB2b2lkIGluaXRpYWxpemVHTElubmVyKCkgewotICAgICAgICBmaW5hbCBFR0wxMCBlZ2wgPSAoRUdMMTApIEVHTENvbnRleHQuZ2V0RUdMKCk7Ci0gICAgICAgIG1FZ2wgPSBlZ2w7Ci0KLSAgICAgICAgLyoKLSAgICAgICAgICogR2V0IHRvIHRoZSBkZWZhdWx0IGRpc3BsYXkuCi0gICAgICAgICAqLwotICAgICAgICBmaW5hbCBFR0xEaXNwbGF5IGVnbERpc3BsYXkgPSBlZ2wuZWdsR2V0RGlzcGxheShFR0wxMC5FR0xfREVGQVVMVF9ESVNQTEFZKTsKLSAgICAgICAgbUVnbERpc3BsYXkgPSBlZ2xEaXNwbGF5OwotCi0gICAgICAgIC8qCi0gICAgICAgICAqIFdlIGNhbiBub3cgaW5pdGlhbGl6ZSBFR0wgZm9yIHRoYXQgZGlzcGxheQotICAgICAgICAgKi8KLSAgICAgICAgaW50W10gdmVyc2lvbiA9IG5ldyBpbnRbMl07Ci0gICAgICAgIGVnbC5lZ2xJbml0aWFsaXplKGVnbERpc3BsYXksIHZlcnNpb24pOwotCi0gICAgICAgIC8qCi0gICAgICAgICAqIFNwZWNpZnkgYSBjb25maWd1cmF0aW9uIGZvciBvdXIgb3BlbmdsIHNlc3Npb24KLSAgICAgICAgICogYW5kIGdyYWIgdGhlIGZpcnN0IGNvbmZpZ3VyYXRpb24gdGhhdCBtYXRjaGVzIGlzCi0gICAgICAgICAqLwotICAgICAgICBmaW5hbCBpbnRbXSBjb25maWdTcGVjID0gewotICAgICAgICAgICAgICAgIEVHTDEwLkVHTF9SRURfU0laRSwgICAgICA1LAotICAgICAgICAgICAgICAgIEVHTDEwLkVHTF9HUkVFTl9TSVpFLCAgICA2LAotICAgICAgICAgICAgICAgIEVHTDEwLkVHTF9CTFVFX1NJWkUsICAgICA1LAotICAgICAgICAgICAgICAgIEVHTDEwLkVHTF9ERVBUSF9TSVpFLCAgICAwLAotICAgICAgICAgICAgICAgIEVHTDEwLkVHTF9OT05FCi0gICAgICAgIH07Ci0gICAgICAgIGZpbmFsIEVHTENvbmZpZ1tdIGNvbmZpZ3MgPSBuZXcgRUdMQ29uZmlnWzFdOwotICAgICAgICBmaW5hbCBpbnRbXSBudW1fY29uZmlnID0gbmV3IGludFsxXTsKLSAgICAgICAgZWdsLmVnbENob29zZUNvbmZpZyhlZ2xEaXNwbGF5LCBjb25maWdTcGVjLCBjb25maWdzLCAxLCBudW1fY29uZmlnKTsKLSAgICAgICAgZmluYWwgRUdMQ29uZmlnIGNvbmZpZyA9IGNvbmZpZ3NbM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FcnJvcnMoKSB7Ci0gICAgICAgIGlmIChtVXNlR0wpIHsKLSAgICAgICAgICAgIGludCBlcnIgPSBtRWdsLmVnbEdldEVycm9yKCk7Ci0gICAgICAgICAgICBpZiAoZXJyICE9IEVHTDEwLkVHTF9TVUNDRVNTKSB7Ci0gICAgICAgICAgICAgICAgLy8gc29tZXRoaW5nIGJhZCBoYXMgaGFwcGVuZWQgcmV2ZXJ0IHRvCi0gICAgICAgICAgICAgICAgLy8gbm9ybWFsIHJlbmRlcmluZy4KLSAgICAgICAgICAgICAgICBkZXN0cm95R0woKTsKLSAgICAgICAgICAgICAgICBpZiAoZXJyICE9IEVHTDExLkVHTF9DT05URVhUX0xPU1QpIHsKLSAgICAgICAgICAgICAgICAgICAgLy8gd2UnbGwgdHJ5IGFnYWluIGlmIGl0IHdhcyBjb250ZXh0IGxvc3QKLSAgICAgICAgICAgICAgICAgICAgbUdsV2FudGVkID0gZmFsc2U7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgfQotCiAgICAgLyoqCiAgICAgICogV2UgaGF2ZSBvbmUgY2hpbGQKICAgICAgKi8KLSAgICBwdWJsaWMgdm9pZCBzZXRWaWV3KFZpZXcgdmlldywgV2luZG93TWFuYWdlci5MYXlvdXRQYXJhbXMgYXR0cnMsCi0gICAgICAgICAgICBWaWV3IHBhbmVsUGFyZW50VmlldykgeworICAgIHB1YmxpYyB2b2lkIHNldFZpZXcoVmlldyB2aWV3LCBXaW5kb3dNYW5hZ2VyLkxheW91dFBhcmFtcyBhdHRycywgVmlldyBwYW5lbFBhcmVudFZpZXcpIHsKICAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CiAgICAgICAgICAgICBpZiAobVZpZXcgPT0gbnVsbCkgewogICAgICAgICAgICAgICAgIG1WaWV3ID0gdmlldzsKICAgICAgICAgICAgICAgICBtV2luZG93QXR0cmlidXRlcy5jb3B5RnJvbShhdHRycyk7CiAgICAgICAgICAgICAgICAgYXR0cnMgPSBtV2luZG93QXR0cmlidXRlczsKKyAgICAgICAgICAgICAgICAKKyAgICAgICAgICAgICAgICBlbmFibGVIYXJkd2FyZUFjY2VsZXJhdGlvbihhdHRycyk7CisKICAgICAgICAgICAgICAgICBpZiAodmlldyBpbnN0YW5jZW9mIFJvb3RWaWV3U3VyZmFjZVRha2VyKSB7CiAgICAgICAgICAgICAgICAgICAgIG1TdXJmYWNlSG9sZGVyQ2FsbGJhY2sgPQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICgoUm9vdFZpZXdTdXJmYWNlVGFrZXIpdmlldykud2lsbFlvdVRha2VUaGVTdXJmYWNlKCk7CkBAIC01NzUsNiArNDYwLDIwIEBACiAgICAgICAgIH0KICAgICB9CiAKKyAgICBwcml2YXRlIHZvaWQgZW5hYmxlSGFyZHdhcmVBY2NlbGVyYXRpb24oV2luZG93TWFuYWdlci5MYXlvdXRQYXJhbXMgYXR0cnMpIHsKKyAgICAgICAgLy8gT25seSBlbmFibGUgaGFyZHdhcmUgYWNjZWxlcmF0aW9uIGlmIHdlIGFyZSBub3QgaW4gdGhlIHN5c3RlbSBwcm9jZXNzCisgICAgICAgIC8vIFRoZSB3aW5kb3cgbWFuYWdlciBjcmVhdGVzIFZpZXdSb290cyB0byBkaXNwbGF5IGFuaW1hdGVkIHByZXZpZXcgd2luZG93cworICAgICAgICAvLyBvZiBsYXVuY2hpbmcgYXBwcyBhbmQgd2UgZG9uJ3Qgd2FudCB0aG9zZSB0byBiZSBoYXJkd2FyZSBhY2NlbGVyYXRlZAorICAgICAgICBpZiAoUHJvY2Vzcy5teVVpZCgpICE9IFByb2Nlc3MuU1lTVEVNX1VJRCkgeworICAgICAgICAgICAgLy8gVHJ5IHRvIGVuYWJsZSBoYXJkd2FyZSBhY2NlbGVyYXRpb24gaWYgcmVxdWVzdGVkCisgICAgICAgICAgICBpZiAoYXR0cnMgIT0gbnVsbCAmJgorICAgICAgICAgICAgICAgICAgICAoYXR0cnMuZmxhZ3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c2liaWxpdHkgIT0gVmlldy5WSVNJQkxFIHx8IG1OZXdTdXJmYWNlTmVlZGVkKSB7Ci0gICAgICAgICAgICAgICAgaWYgKG1Vc2VHTCkgewotICAgICAgICAgICAgICAgICAgICBkZXN0cm95R0woKTsKKyAgICAgICAgICAgICAgICBpZiAobUh3UmVuZGVyZXIgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICBtSHdSZW5kZXJlci5kZXN0cm95KCk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogICAgICAgICAgICAgaWYgKHZpZXdWaXNpYmlsaXR5ID09IFZpZXcuR09ORSkgewpAQCAtODk3LDEwICs3OTQsMTIgQEAKIAogICAgICAgICBmaW5hbCBib29sZWFuIGNvbXB1dGVzSW50ZXJuYWxJbnNldHMgPQogICAgICAgICAgICAgICAgIGF0dGFjaEluZm8ubVRyZWVPYnNlcnZlci5oYXNDb21wdXRlSW50ZXJuYWxJbnNldHNMaXN0ZW5lcnMoKTsKKwogICAgICAgICBib29sZWFuIGluc2V0c1BlbmRpbmcgPSBmYWxzZTsKICAgICAgICAgaW50IHJlbGF5b3V0UmVzdWx0ID0gMDsKLSAgICAgICAgaWYgKG1GaXJzdCB8fCB3aW5kb3dTaG91bGRSZXNpemUgfHwgaW5zZXRzQ2hhbmdlZAotICAgICAgICAgICAgICAgIHx8IHZpZXdWaXNpYmlsaXR5Q2hhbmdlZCB8fCBwYXJhbXMgIT0gbnVsbCkgeworCisgICAgICAgIGlmIChtRmlyc3QgfHwgd2luZG93U2hvdWxkUmVzaXplIHx8IGluc2V0c0NoYW5nZWQgfHwKKyAgICAgICAgICAgICAgICB2aWV3VmlzaWJpbGl0eUNoYW5nZWQgfHwgcGFyYW1zICE9IG51bGwpIHsKIAogICAgICAgICAgICAgaWYgKHZpZXdWaXNpYmlsaXR5ID09IFZpZXcuVklTSUJMRSkgewogICAgICAgICAgICAgICAgIC8vIElmIHRoaXMgd2luZG93IGlzIGdpdmluZyBpbnRlcm5hbCBpbnNldHMgdG8gdGhlIHdpbmRvdwpAQCAtOTEyLDI2ICs4MTEsMTkgQEAKICAgICAgICAgICAgICAgICAvLyB3aW5kb3csIHdhaXRpbmcgdW50aWwgd2UgY2FuIGZpbmlzaCBsYXlpbmcgb3V0IHRoaXMgd2luZG93CiAgICAgICAgICAgICAgICAgLy8gYW5kIGdldCBiYWNrIHRvIHRoZSB3aW5kb3cgbWFuYWdlciB3aXRoIHRoZSB1bHRpbWF0ZWx5CiAgICAgICAgICAgICAgICAgLy8gY29tcHV0ZWQgaW5zZXRzLgotICAgICAgICAgICAgICAgIGluc2V0c1BlbmRpbmcgPSBjb21wdXRlc0ludGVybmFsSW5zZXRzCi0gICAgICAgICAgICAgICAgICAgICAgICAmJiAobUZpcnN0IHx8IHZpZXdWaXNpYmlsaXR5Q2hhbmdlZCk7Ci0KLSAgICAgICAgICAgICAgICBpZiAobVdpbmRvd0F0dHJpYnV0ZXMubWVtb3J5VHlwZSA9PSBXaW5kb3dNYW5hZ2VyLkxheW91dFBhcmFtcy5NRU1PUllfVFlQRV9HUFUpIHsKLSAgICAgICAgICAgICAgICAgICAgaWYgKHBhcmFtcyA9PSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBwYXJhbXMgPSBtV2luZG93QXR0cmlidXRlczsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBtR2xXYW50ZWQgPSB0cnVlOwotICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBpbnNldHNQZW5kaW5nID0gY29tcHV0ZXNJbnRlcm5hbEluc2V0cyAmJiAobUZpcnN0IHx8IHZpZXdWaXNpYmlsaXR5Q2hhbmdlZCk7CiAgICAgICAgICAgICB9CiAKICAgICAgICAgICAgIGlmIChtU3VyZmFjZUhvbGRlciAhPSBudWxsKSB7CiAgICAgICAgICAgICAgICAgbVN1cmZhY2VIb2xkZXIubVN1cmZhY2VMb2NrLmxvY2soKTsKICAgICAgICAgICAgICAgICBtRHJhd2luZ0FsbG93ZWQgPSB0cnVlOwogICAgICAgICAgICAgfQotICAgICAgICAgICAgCi0gICAgICAgICAgICBib29sZWFuIGluaXRpYWxpemVkID0gZmFsc2U7CisKKyAgICAgICAgICAgIGJvb2xlYW4gaHdJbnRpYWxpemVkID0gZmFsc2U7CiAgICAgICAgICAgICBib29sZWFuIGNvbnRlbnRJbnNldHNDaGFuZ2VkID0gZmFsc2U7CiAgICAgICAgICAgICBib29sZWFuIHZpc2libGVJbnNldHNDaGFuZ2VkOwogICAgICAgICAgICAgYm9vbGVhbiBoYWRTdXJmYWNlID0gbVN1cmZhY2UuaXNWYWxpZCgpOworCiAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgIGludCBmbCA9IDA7CiAgICAgICAgICAgICAgICAgaWYgKHBhcmFtcyAhPSBudWxsKSB7CkBAIC05OTEsOSArODgzLDggQEAKICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bGxSZWRyYXdOZWVkZWQgPSB0cnVlOwogICAgICAgICAgICAgICAgICAgICAgICAgbVByZXZpb3VzVHJhbnNwYXJlbnRSZWdpb24uc2V0RW1wdHkoKTsKIAotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1HbFdhbnRlZCAmJiAhbVVzZUdMKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5pdGlhbGl6ZUdMKCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5pdGlhbGl6ZWQgPSBtR2xDYW52YXMgIT0gbnVsbDsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtSHdSZW5kZXJlciAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaHdJbnRpYWxpemVkID0gbUh3UmVuZGVyZXIuaW5pdGlhbGl6ZShtSG9sZGVyKTsKICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoIW1TdXJmYWNlLmlzVmFsaWQoKSkgewpAQCAtMTA3MSw5ICs5NjIsOCBAQAogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KICAgICAgICAgICAgIAotICAgICAgICAgICAgaWYgKGluaXRpYWxpemVkKSB7Ci0gICAgICAgICAgICAgICAgbUdsQ2FudmFzLnNldFZpZXdwb3J0KChpbnQpIChtV2lkdGggKiBhcHBTY2FsZSArIDAuNWYpLAotICAgICAgICAgICAgICAgICAgICAgICAgKGludCkgKG1IZWlnaHQgKiBhcHBTY2FsZSArIDAuNWYpKTsKKyAgICAgICAgICAgIGlmIChod0ludGlhbGl6ZWQpIHsKKyAgICAgICAgICAgICAgICBtSHdSZW5kZXJlci5zZXR1cChtV2lkdGgsIG1IZWlnaHQsIG1BdHRhY2hJbmZvKTsKICAgICAgICAgICAgIH0KIAogICAgICAgICAgICAgYm9vbGVhbiBmb2N1c0NoYW5nZWREdWVUb1RvdWNoTW9kZSA9IGVuc3VyZVRvdWNoTW9kZUxvY2FsbHkoCkBAIC0xMzQ2LDcgKzEyMzYsOCBAQAogICAgICAgICBpZiAoIXNGaXJzdERyYXdDb21wbGV0ZSkgewogICAgICAgICAgICAgc3luY2hyb25pemVkIChzRmlyc3REcmF3SGFuZGxlcnMpIHsKICAgICAgICAgICAgICAgICBzRmlyc3REcmF3Q29tcGxldGUgPSB0cnVlOwotICAgICAgICAgICAgICAgIGZvciAoaW50IGk9MDsgaTxzRmlyc3REcmF3SGFuZGxlcnMuc2l6ZSgpOyBpKyspIHsKKyAgICAgICAgICAgICAgICBmaW5hbCBpbnQgY291bnQgPSBzRmlyc3REcmF3SGFuZGxlcnMuc2l6ZSgpOworICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpPCBjb3VudDsgaSsrKSB7CiAgICAgICAgICAgICAgICAgICAgIHBvc3Qoc0ZpcnN0RHJhd0hhbmRsZXJzLmdldChpKSk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQpAQCAtMTM4MCw1MyArMTI3MSwxNiBAQAogICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICB9CiAgICAgICAgIAotICAgICAgICBpZiAobVVzZUdMKSB7CisgICAgICAgIGlmIChtSHdSZW5kZXJlciAhPSBudWxsICYmIG1Id1JlbmRlcmVyLmlzRW5hYmxlZCgpKSB7CiAgICAgICAgICAgICBpZiAoIWRpcnR5LmlzRW1wdHkoKSkgewotICAgICAgICAgICAgICAgIENhbnZhcyBjYW52YXMgPSBtR2xDYW52YXM7Ci0gICAgICAgICAgICAgICAgaWYgKG1HTCAhPSBudWxsICYmIGNhbnZhcyAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIG1HTC5nbERpc2FibGUoR0xfU0NJU1NPUl9URVNUKTsKLSAgICAgICAgICAgICAgICAgICAgbUdMLmdsQ2xlYXJDb2xvcigwLCAwLCAwLCAwKTsKLSAgICAgICAgICAgICAgICAgICAgbUdMLmdsQ2xlYXIoR0xfQ09MT1JfQlVGRkVSX0JJVCk7Ci0gICAgICAgICAgICAgICAgICAgIG1HTC5nbEVuYWJsZShHTF9TQ0lTU09SX1RFU1QpOwotCi0gICAgICAgICAgICAgICAgICAgIG1BdHRhY2hJbmZvLm1EcmF3aW5nVGltZSA9IFN5c3RlbUNsb2NrLnVwdGltZU1pbGxpcygpOwotICAgICAgICAgICAgICAgICAgICBtQXR0YWNoSW5mby5tSWdub3JlRGlydHlTdGF0ZSA9IHRydWU7Ci0gICAgICAgICAgICAgICAgICAgIG1WaWV3Lm1Qcml2YXRlRmxhZ3MgfD0gVmlldy5EUkFXTjsKLQotICAgICAgICAgICAgICAgICAgICBpbnQgc2F2ZUNvdW50ID0gY2FudmFzLnNhdmUoQ2FudmFzLk1BVFJJWF9TQVZFX0ZMQUcpOwotICAgICAgICAgICAgICAgICAgICB0cnkgewotICAgICAgICAgICAgICAgICAgICAgICAgY2FudmFzLnRyYW5zbGF0ZSgwLCAteW9mZik7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAobVRyYW5zbGF0b3IgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1UcmFuc2xhdG9yLnRyYW5zbGF0ZUNhbnZhcyhjYW52YXMpOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgY2FudmFzLnNldFNjcmVlbkRlbnNpdHkoc2NhbGluZ1JlcXVpcmVkCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgID8gRGlzcGxheU1ldHJpY3MuREVOU0lUWV9ERVZJQ0UgOiAwKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIG1WaWV3LmRyYXcoY2FudmFzKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChDb25maWcuREVCVUcgJiYgVmlld0RlYnVnLmNvbnNpc3RlbmN5Q2hlY2tFbmFibGVkKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgbVZpZXcuZGlzcGF0Y2hDb25zaXN0ZW5jeUNoZWNrKFZpZXdEZWJ1Zy5DT05TSVNURU5DWV9EUkFXSU5HKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGNhbnZhcy5yZXN0b3JlVG9Db3VudChzYXZlQ291bnQpOwotICAgICAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICAgICAgbUF0dGFjaEluZm8ubUlnbm9yZURpcnR5U3RhdGUgPSBmYWxzZTsKLQotICAgICAgICAgICAgICAgICAgICBtRWdsLmVnbFN3YXBCdWZmZXJzKG1FZ2xEaXNwbGF5LCBtRWdsU3VyZmFjZSk7Ci0gICAgICAgICAgICAgICAgICAgIGNoZWNrRWdsRXJyb3JzKCk7Ci0KLSAgICAgICAgICAgICAgICAgICAgaWYgKFNIT1dfRlBTIHx8IENvbmZpZy5ERUJVRyAmJiBWaWV3RGVidWcuc2hvd0ZwcykgewotICAgICAgICAgICAgICAgICAgICAgICAgaW50IG5vdyA9IChpbnQpU3lzdGVtQ2xvY2suZWxhcHNlZFJlYWx0aW1lKCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoc0RyYXdUaW1lICE9IDApIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYXRpdmVTaG93RlBTKGNhbnZhcywgbm93IC0gc0RyYXdUaW1lKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgIHNEcmF3VGltZSA9IG5vdzsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBtSHdSZW5kZXJlci5kcmF3KG1WaWV3LCBtQXR0YWNoSW5mbywgeW9mZik7CiAgICAgICAgICAgICB9CisKICAgICAgICAgICAgIGlmIChzY3JvbGxpbmcpIHsKICAgICAgICAgICAgICAgICBtRnVsbFJlZHJhd05lZWRlZCA9IHRydWU7CiAgICAgICAgICAgICAgICAgc2NoZWR1bGVUcmF2ZXJzYWxzKCk7CiAgICAgICAgICAgICB9CisKICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgfQogCkBAIC0xNTA5LDcgKzEzNjMsNiBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiLCBtZXRyaWNzPSIgKyBjeHQuZ2V0UmVzb3VyY2VzKCkuZ2V0RGlzcGxheU1ldHJpY3MoKSArCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICIsIGNvbXBhdGliaWxpdHlJbmZvPSIgKyBjeHQuZ2V0UmVzb3VyY2VzKCkuZ2V0Q29tcGF0aWJpbGl0eUluZm8oKSk7CiAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgaW50IHNhdmVDb3VudCA9IGNhbnZhcy5zYXZlKENhbnZhcy5NQVRSSVhfU0FWRV9GTEFHKTsKICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgIGNhbnZhcy50cmFuc2xhdGUoMCwgLXlvZmYpOwogICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1UcmFuc2xhdG9yICE9IG51bGwpIHsKQEAgLTE1MjAsNyArMTM3Myw2IEBACiAgICAgICAgICAgICAgICAgICAgICAgICBtVmlldy5kcmF3KGNhbnZhcyk7CiAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBtQXR0YWNoSW5mby5tSWdub3JlRGlydHlTdGF0ZSA9IGZhbHNlOwotICAgICAgICAgICAgICAgICAgICAgICAgY2FudmFzLnJlc3RvcmVUb0NvdW50KHNhdmVDb3VudCk7CiAgICAgICAgICAgICAgICAgICAgIH0KIAogICAgICAgICAgICAgICAgICAgICBpZiAoQ29uZmlnLkRFQlVHICYmIFZpZXdEZWJ1Zy5jb25zaXN0ZW5jeUNoZWNrRW5hYmxlZCkgewpAQCAtMTczOCw4ICsxNTkwLDYgQEAKICAgICB9CiAKICAgICB2b2lkIGRpc3BhdGNoRGV0YWNoZWRGcm9tV2luZG93KCkgewotICAgICAgICBpZiAoQ29uZmlnLkxPR1YpIExvZy52KFRBRywgIkRldGFjaGluZyBpbiAiICsgdGhpcyArICIgb2YgIiArIG1TdXJmYWNlKTsKLQogICAgICAgICBpZiAobVZpZXcgIT0gbnVsbCkgewogICAgICAgICAgICAgbVZpZXcuZGlzcGF0Y2hEZXRhY2hlZEZyb21XaW5kb3coKTsKICAgICAgICAgfQpAQCAtMTc0OCw4ICsxNTk4LDggQEAKICAgICAgICAgbUF0dGFjaEluZm8ubVJvb3RWaWV3ID0gbnVsbDsKICAgICAgICAgbUF0dGFjaEluZm8ubVN1cmZhY2UgPSBudWxsOwogCi0gICAgICAgIGlmIChtVXNlR0wpIHsKLSAgICAgICAgICAgIGRlc3Ryb3lHTCgpOworICAgICAgICBpZiAobUh3UmVuZGVyZXIgIT0gbnVsbCkgeworICAgICAgICAgICAgbUh3UmVuZGVyZXIuZGVzdHJveSgpOwogICAgICAgICB9CiAgICAgICAgIG1TdXJmYWNlLnJlbGVhc2UoKTsKIApAQCAtMTkzMywxOCArMTc4Myw4IEBACiAgICAgICAgICAgICAgICAgICAgIGJvb2xlYW4gaW5Ub3VjaE1vZGUgPSBtc2cuYXJnMiAhPSAwOwogICAgICAgICAgICAgICAgICAgICBlbnN1cmVUb3VjaE1vZGVMb2NhbGx5KGluVG91Y2hNb2RlKTsKIAotICAgICAgICAgICAgICAgICAgICBpZiAobUdsV2FudGVkKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBjaGVja0VnbEVycm9ycygpOwotICAgICAgICAgICAgICAgICAgICAgICAgLy8gd2UgbG9zdCB0aGUgZ2wgY29udGV4dCwgc28gcmVjcmVhdGUgaXQuCi0gICAgICAgICAgICAgICAgICAgICAgICBpZiAobUdsV2FudGVkICYmICFtVXNlR0wpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbml0aWFsaXplR0woKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobUdsQ2FudmFzICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgYXBwU2NhbGUgPSBtQXR0YWNoSW5mby5tQXBwbGljYXRpb25TY2FsZTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUdsQ2FudmFzLnNldFZpZXdwb3J0KAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChpbnQpIChtV2lkdGggKiBhcHBTY2FsZSArIDAuNWYpLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChpbnQpIChtSGVpZ2h0ICogYXBwU2NhbGUgKyAwLjVmKSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBpZiAobUh3UmVuZGVyZXIgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgbUh3UmVuZGVyZXIuaW5pdGlhbGl6ZUlmTmVlZGVkKG1XaWR0aCwgbUhlaWdodCwgbUF0dGFjaEluZm8sIG1Ib2xkZXIpOwogICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgfQogCkBAIC0xOTk0LDggKzE4MzQsNyBAQAogICAgICAgICAgICAgaWYgKChldmVudC5nZXRGbGFncygpJktleUV2ZW50LkZMQUdfRlJPTV9TWVNURU0pICE9IDApIHsKICAgICAgICAgICAgICAgICAvLyBUaGUgSU1FIGlzIHRyeWluZyB0byBzYXkgdGhpcyBldmVudCBpcyBmcm9tIHRoZQogICAgICAgICAgICAgICAgIC8vIHN5c3RlbSEgIEJhZCBiYWQgYmFkIQotICAgICAgICAgICAgICAgIGV2ZW50ID0gS2V5RXZlbnQuY2hhbmdlRmxhZ3MoZXZlbnQsCi0gICAgICAgICAgICAgICAgICAgICAgICBldmVudC5nZXRGbGFncygpJn5LZXlFdmVudC5GTEFHX0ZST01fU1lTVEVNKTsKKyAgICAgICAgICAgICAgICBldmVudCA9IEtleUV2ZW50LmNoYW5nZUZsYWdzKGV2ZW50LCBldmVudC5nZXRGbGFncygpICYgfktleUV2ZW50LkZMQUdfRlJPTV9TWVNURU0pOwogICAgICAgICAgICAgfQogICAgICAgICAgICAgZGVsaXZlcktleUV2ZW50VG9WaWV3SGllcmFyY2h5KChLZXlFdmVudCltc2cub2JqLCBmYWxzZSk7CiAgICAgICAgIH0gYnJlYWs7CkBAIC0yNDgzLDggKzIzMjIsNyBAQAogICAgIHByaXZhdGUgdm9pZCBkZWxpdmVyS2V5RXZlbnQoS2V5RXZlbnQgZXZlbnQsIGJvb2xlYW4gc2VuZERvbmUpIHsKICAgICAgICAgLy8gSWYgbVZpZXcgaXMgbnVsbCwgd2UganVzdCBjb25zdW1lIHRoZSBrZXkgZXZlbnQgYmVjYXVzZSBpdCBkb2Vzbid0CiAgICAgICAgIC8vIG1ha2Ugc2Vuc2UgdG8gZG8gYW55dGhpbmcgZWxzZSB3aXRoIGl0LgotICAgICAgICBib29sZWFuIGhhbmRsZWQgPSBtVmlldyAhPSBudWxsCi0gICAgICAgICAgICAgICAgPyBtVmlldy5kaXNwYXRjaEtleUV2ZW50UHJlSW1lKGV2ZW50KSA6IHRydWU7CisgICAgICAgIGJvb2xlYW4gaGFuZGxlZCA9IG1WaWV3ID09IG51bGwgfHwgbVZpZXcuZGlzcGF0Y2hLZXlFdmVudFByZUltZShldmVudCk7CiAgICAgICAgIGlmIChoYW5kbGVkKSB7CiAgICAgICAgICAgICBpZiAoc2VuZERvbmUpIHsKICAgICAgICAgICAgICAgICBmaW5pc2hLZXlFdmVudChldmVudCk7CkBAIC0yNTE2LDcgKzIzNTQsNiBAQAogICAgICAgICAgICAgZmluYWwgYm9vbGVhbiBzZW5kRG9uZSA9IHNlcSA+PSAwOwogICAgICAgICAgICAgaWYgKCFoYW5kbGVkKSB7CiAgICAgICAgICAgICAgICAgZGVsaXZlcktleUV2ZW50VG9WaWV3SGllcmFyY2h5KGV2ZW50LCBzZW5kRG9uZSk7Ci0gICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgfSBlbHNlIGlmIChzZW5kRG9uZSkgewogICAgICAgICAgICAgICAgIGZpbmlzaEtleUV2ZW50KGV2ZW50KTsKICAgICAgICAgICAgIH0gZWxzZSB7CkBAIC0yNzEzLDcgKzI1NTAsNyBAQAogCiAgICAgdm9pZCBkb0RpZSgpIHsKICAgICAgICAgY2hlY2tUaHJlYWQoKTsKLSAgICAgICAgaWYgKENvbmZpZy5MT0dWKSBMb2cudihUQUcsICJESUUgaW4gIiArIHRoaXMgKyAiIG9mICIgKyBtU3VyZmFjZSk7CisgICAgICAgIGlmIChMT0NBTF9MT0dWKSBMb2cudihUQUcsICJESUUgaW4gIiArIHRoaXMgKyAiIG9mICIgKyBtU3VyZmFjZSk7CiAgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgewogICAgICAgICAgICAgaWYgKG1BZGRlZCAmJiAhbUZpcnN0KSB7CiAgICAgICAgICAgICAgICAgaW50IHZpZXdWaXNpYmlsaXR5ID0gbVZpZXcuZ2V0VmlzaWJpbGl0eSgpOwpAQCAtMjc5OSwxMyArMjYzNiwxMiBAQAogICAgICAgICAvL25vaW5zcGVjdGlvbiBDb25zdGFudENvbmRpdGlvbnMKICAgICAgICAgaWYgKGZhbHNlICYmIGV2ZW50LmdldEFjdGlvbigpID09IEtleUV2ZW50LkFDVElPTl9ET1dOKSB7CiAgICAgICAgICAgICBpZiAoZXZlbnQuZ2V0S2V5Q29kZSgpID09IEtleUV2ZW50LktFWUNPREVfQ0FNRVJBKSB7Ci0gICAgICAgICAgICAgICAgaWYgKENvbmZpZy5MT0dEKSBMb2cuZCgia2V5ZGlzcCIsCi0gICAgICAgICAgICAgICAgICAgICAgICAiPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Iik7Ci0gICAgICAgICAgICAgICAgaWYgKENvbmZpZy5MT0dEKSBMb2cuZCgia2V5ZGlzcCIsICJGb2N1c2VkIHZpZXcgSGllcmFyY2h5IGlzOiIpOworICAgICAgICAgICAgICAgIGlmIChEQkcpIExvZy5kKCJrZXlkaXNwIiwgIj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSIpOworICAgICAgICAgICAgICAgIGlmIChEQkcpIExvZy5kKCJrZXlkaXNwIiwgIkZvY3VzZWQgdmlldyBIaWVyYXJjaHkgaXM6Iik7CisKICAgICAgICAgICAgICAgICBkZWJ1ZygpOwogCi0gICAgICAgICAgICAgICAgaWYgKENvbmZpZy5MT0dEKSBMb2cuZCgia2V5ZGlzcCIsCi0gICAgICAgICAgICAgICAgICAgICAgICAiPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Iik7CisgICAgICAgICAgICAgICAgaWYgKERCRykgTG9nLmQoIm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yLkxheW91dFBhcmFtcy5GTEFHX0hBUkRXQVJFX0FDQ0VMRVJBVEVEOworICAgICAgICAgICAgfQogICAgICAgICAgICAgbVdpbmRvd01hbmFnZXIuYWRkVmlldyh2aWV3LCBwYXJhbXMpOwogICAgICAgICB9CiAKQEAgLTgxNyw2ICs4NzUsOCBAQAogCiAgICAgcHVibGljIGFic3RyYWN0IHZvaWQgdG9nZ2xlUGFuZWwoaW50IGZlYXR1cmVJZCwgS2V5RXZlbnQgZXZlbnQpOwogCisgICAgcHVibGljIGFic3RyYWN0IHZvaWQgaW52YWxpZGF0ZVBhbmVsTWVudShpbnQgZmVhdHVyZUlkKTsKKyAgICAKICAgICBwdWJsaWMgYWJzdHJhY3QgYm9vbGVhbiBwZXJmb3JtUGFuZWxTaG9ydGN1dChpbnQgZmVhdHVyZUlkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBrZXlDb2RlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEtleUV2ZW50IGV2ZW50LApAQCAtOTk2LDYgKzEwNTYsMTYgQEAKICAgICB7CiAgICAgICAgIHJldHVybiBtRmVhdHVyZXM7CiAgICAgfQorICAgIAorICAgIC8qKgorICAgICAqIFF1ZXJ5IGZvciB0aGUgYXZhaWxhYmlsaXR5IG9mIGEgY2VydGFpbiBmZWF0dXJlLgorICAgICAqIAorICAgICAqIEBwYXJhbSBmZWF0dXJlIFRoZSBmZWF0dXJlIElEIHRvIGNoZWNrCisgICAgICogQHJldHVybiB0cnVlIGlmIHRoZSBmZWF0dXJlIGlzIGVuYWJsZWQsIGZhbHNlIG90aGVyd2lzZS4KKyAgICAgKi8KKyAgICBwdWJsaWMgYm9vbGVhbiBoYXNGZWF0dXJlKGludCBmZWF0dXJlKSB7CisgICAgICAgIHJldHVybiAoZ2V0RmVhdHVyZXMoKSAmICgxIDw8IGZlYXR1cmUpKSAhPSAwOworICAgIH0KIAogIC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IHN0YXRpYyBBbmltYXRhYmxlIGxvYWRBbmltYXRvcihDb250ZXh0IGNvbnRleHQsIGludCBpZCkKKyAgICAgICAgICAgIHRocm93cyBOb3RGb3VuZEV4Y2VwdGlvbiB7CisKKyAgICAgICAgWG1sUmVzb3VyY2VQYXJzZXIgcGFyc2VyID0gbnVsbDsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIHBhcnNlciA9IGNvbnRleHQuZ2V0UmVzb3VyY2VzKCkuZ2V0QW5pbWF0aW9uKGlkKTsKKyAgICAgICAgICAgIHJldHVybiBjcmVhdGVBbmltYXRhYmxlRnJvbVhtbChjb250ZXh0LCBwYXJzZXIpOworICAgICAgICB9IGNhdGNoIChYbWxQdWxsUGFyc2VyRXhjZXB0aW9uIGV4KSB7CisgICAgICAgICAgICBOb3RGb3VuZEV4Y2VwdGlvbiBybmYgPSBuZXcgTm90Rm91bmRFeGNlcHRpb24oIkNhbid0IGxvYWQgYW5pbWF0aW9uIHJlc291cmNlIElEICMweCIgKworICAgICAgICAgICAgICAgICAgICBJbnRlZ2VyLnRvSGV4U3RyaW5nKGlkKSk7CisgICAgICAgICAgICBybmYuaW5pdENhdXNlKGV4KTsKKyAgICAgICAgICAgIHRocm93IHJuZjsKKyAgICAgICAgfSBjYXRjaCAoSU9FeGNlcHRpb24gZXgpIHsKKyAgICAgICAgICAgIE5vdEZvdW5kRXhjZXB0aW9uIHJuZiA9IG5ldyBOb3RGb3VuZEV4Y2VwdGlvbigiQ2FuJ3QgbG9hZCBhbmltYXRpb24gcmVzb3VyY2UgSUQgIzB4IiArCisgICAgICAgICAgICAgICAgICAgIEludGVnZXIudG9IZXhTdHJpbmcoaWQpKTsKKyAgICAgICAgICAgIHJuZi5pbml0Q2F1c2UoZXgpOworICAgICAgICAgICAgdGhyb3cgcm5mOworICAgICAgICB9IGZpbmFsbHkgeworICAgICAgICAgICAgaWYgKHBhcnNlciAhPSBudWxsKSBwYXJzZXIuY2xvc2UoKTsKKyAgICAgICA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RoKCk7CkBAIC0xMDAsNyArMTUxLDcgQEAKICAgICAgICAgICAgIH0KIAogICAgICAgICAgICAgU3RyaW5nICBuYW1lID0gcGFyc2VyLmdldE5hbWUoKTsKLSAgICAKKwogICAgICAgICAgICAgaWYgKG5hbWUuZXF1YWxzKCJzZXQiKSkgewogICAgICAgICAgICAgICAgIGFuaW0gPSBuZXcgQW5pbWF0aW9uU2V0KGMsIGF0dHJzKTsKICAgICAgICAgICAgICAgICBjcmVhdGVBbmltYXRpb25Gcm9tWG1sKGMsIHBhcnNlciwgKEFuaW1hdGlvblNldClhbmltLCBhdHRycyk7CkBAIC0xMjAsNyArMTcxLDY3IEBACiAgICAgICAgICAgICAgICAgcGFyZW50LmFkZEFuaW1hdGlvbihhbmltKTsKICAgICAgICAgICAgIH0KICAgICAgICAgfQotICAgIAorCisgICAgICAgIHJldHVybiBhbmltOworCisgICAgfQorCisgICAgcHJpdmF0ZSBzdGF0aWMgQW5pbWF0YWJsZSBjcmVhdGVBbmltYXRhYmxlRnJvbVhtbChDb250ZXh0IGMsIFhtbFB1bGxQYXJzZXIgcGFyc2VyLAorICAgICAgICAgICAgQXR0cmlidXRlU2V0IGF0dHJzLCBTZXF1ZW5jZXIgcGFyZW50LCBpbnQgc2VxdWVuY2VPcmRlcmluZykKKyAgICAgICAgICAgIHRocm93cyBYbWxQdWxsUGFyc2VyRXhjZXB0aW9uLCBJT0V4Y2VwdGlvbiB7CisKKyAgICAgICAgQW5pbWF0YWJsZSBhbmltID0gbnVsbDsKKyAgICAgICAgQXJyYXlMaXN0PEFuaW1hdGFibGU+IGNoaWxkQW5pbXMgPSBudWxsOworCisgICAgICAgIC8vIE1ha2Ugc3VyZSB3ZSBhcmUgb24gYSBzdGFydCB0YWcuCisgICAgICAgIGludCB0eXBlOworICAgICAgICBpbnQgZGVwdGggPSBwYXJzZXIuZ2V0RGVwdGgoKTsKKworICAgICAgICB3aGlsZSAoKCh0eXBlPXBhcnNlci5uZXh0KCkpICE9IFhtbFB1bGxQYXJzZXIuRU5EX1RBRyB8fCBwYXJzZXIuZ2V0RGVwdGgoKSA+IGRlcHRoKQorICAgICAgICAgICAgICAgJiYgdHlwZSAhPSBYbWxQdWxsUGFyc2VyLkVORF9ET0NVTUVOVCkgeworCisgICAgICAgICAgICBpZiAodHlwZSAhPSBYbWxQdWxsUGFyc2VyLlNUQVJUX1RBRykgeworICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBTdHJpbmcgIG5hbWUgPSBwYXJzZXIuZ2V0TmFtZSgpOworCisgICAgICAgICAgICBpZiAobmFtZS5lcXVhbHMoInByb3BlcnR5IikpIHsKKyAgICAgICAgICAgICAgICBhbmltID0gbmV3IFByb3BlcnR5QW5pbWF0b3IoYywgYXR0cnMpOworICAgICAgICAgICAgfSBlbHNlIGlmIChuYW1lLmVxdWFscygiYW5pbWF0b3IiKSkgeworICAgICAgICAgICAgICAgIGFuaW0gPSBuZXcgQW5pbWF0b3IoYywgYXR0cnMpOworICAgICAgICAgICAgfSBlbHNlIGlmIChuYW1lLmVxdWFscygic2VxdWVuY2VyIikpIHsKKyAgICAgICAgICAgICAgICBhbmltID0gbmV3IFNlcXVlbmNlcigpOworICAgICAgICAgICAgICAgIFR5cGVkQXJyYXkgYSA9IGMub2J0YWluU3R5bGVkQXR0cmlidXRlcyhhdHRycywKKyAgICAgICAgICAgICAgICAgICAgICAgIGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3R5bGVhYmxlLlNlcXVlbmNlcik7CisgICAgICAgICAgICAgICAgaW50IG9yZGVyaW5nID0gYS5nZXRJbnQoY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHlsZWFibGUuU2VxdWVuY2VyX29yZGVyaW5nLAorICAgICAgICAgICAgICAgICAgICAgICAgVE9HRVRIRVIpOworICAgICAgICAgICAgICAgIGNyZWF0ZUFuaW1hdGFibGVGcm9tWG1sKGMsIHBhcnNlciwgYXR0cnMsIChTZXF1ZW5jZXIpIGFuaW0sICBvcmRlcmluZyk7CisgICAgICAgICAgICAgICAgYS5yZWN5Y2xlKCk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBSdW50aW1lRXhjZXB0aW9uKCJVbmtub3duIGFuaW1hdG9yIG5hbWU6ICIgKyBwYXJzZXIuZ2V0TmFtZSgpKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKHBhcmVudCAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgaWYgKGNoaWxkQW5pbXMgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICBjaGlsZEFuaW1zID0gbmV3IEFycmF5TGlzdDxBbmltYXRhYmxlPigpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBjaGlsZEFuaW1zLmFkZChhbmltKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICBpZiAocGFyZW50ICE9IG51bGwgJiYgY2hpbGRBbmltcyAhPSBudWxsKSB7CisgICAgICAgICAgICBBbmltYXRhYmxlW10gYW5pbXNBcnJheSA9IG5ldyBBbmltYXRhYmxlW2NoaWxkQW5pbXMuc2l6ZSgpXTsKKyAgICAgICAgICAgIGludCBpbmRleCA9IDA7CisgICAgICAgICAgICBmb3IgKEFuaW1hdGFibGUgYSA6IGNoaWxkQW5pbXMpIHsKKyAgICAgICAgICAgICAgICBhbmltc0FycmF5W2luZGV4KytdID0gYTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmIChzZXF1ZW5jZU9yZGVyaW5nID09IFRPR0VUSEVSKSB7CisgICAgICAgICAgICAgICAgcGFyZW50LnBsYXlUb2dldGhlcihhbmltc0FycmF5KTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgcGFyZW50LnBsYXlTZXF1ZW50aWFsbHkoYW5pbXNBcnJheSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKwogICAgICAgICByZXR1c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dHJpbmcgbmFtZSwgaW50IGljb25JZCwgU3RyaW5nIGxvY2FsZSwgU3RyaW5nIG1vZGUsCisgICAgICAgICAgICAgICAgU3RyaW5nIGV4dHJhVmFsdWUpIHsKKyAgICAgICAgICAgIG1TdWJ0eXBlTmFtZSA9IG5hbWU7CisgICAgICAgICAgICBtU3VidHlwZUljb25JZCA9IGljb25JZDsKKyAgICAgICAgICAgIG1TdWJ0eXBlTG9jYWxlID0gbG9jYWxlOworICAgICAgICAgICAgbVN1YnR5cGVNb2RlID0gbW9kZTsKKyAgICAgICAgICAgIG1TdWJ0eXBlRXh0cmFWYWx1ZSA9IGV4dHJhVmFsdWU7CisgICAgICAgIH0KKworICAgICAgICBJbnB1dE1ldGhvZFN1YnR5cGUoUGFyY2VsIHNvdXJjZSkgeworICAgICAgICAgICAgbVN1YnR5cGVOYW1lID0gc291cmNlLnJlYWRTdHJpbmcoKTsKKyAgICAgICAgICAgIG1TdWJ0eXBlSWNvbklkID0gc291cmNlLnJlYWRJbnQoKTsKKyAgICAgICAgICAgIG1TdWJ0eXBlTG9jYWxlID0gc291cmNlLnJlYWRTdHJpbmcoKTsKKyAgICAgICAgICAgIG1TdWJ0eXBlTW9kZSA9IHNvdXJjZS5yZWFkU3RyaW5nKCk7CisgICAgICAgICAgICBtU3VidHlwZUV4dHJhVmFsdWUgPSBzb3VyY2UucmVhZFN0cmluZygpOworICAgICAgICB9CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIEByZXR1cm4gdGhlIG5hbWUgb2YgdGhlIHN1YnR5cGUKKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBTdHJpbmcgZ2V0TmFtZSgpIHsKKyAgICAgICAgICAgIHJldHVybiBtU3VidHlwZU5hbWU7CisgICAgICAgIH0KKworICAgICAgICAvKioKKyAgICAgICAgICogQHJldHVybiB0aGUgaWNvbiBvZiB0aGUgc3VidHlwZQorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIGludCBnZXRJY29uSWQoKSB7CisgICAgICAgICAgICByZXR1cm4gbVN1YnR5cGVJY29uSWQ7CisgICAgICAgIH0KKworICAgICAgICAvKioKKyAgICAgICAgICogQHJldHVybiB0aGUgbG9jYWxlIG9mIHRoZSBzdWJ0eXBlCisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgU3RyaW5nIGdldExvY2FsZSgpIHsKKyAgICAgICAgICAgIHJldHVybiBtU3VidHlwZUxvY2FsZTsKKyAgICAgICAgfQorCisgICAgICAgIC8qKgorICAgICAgICAgKiBAcmV0dXJuIHRoZSBtb2RlIG9mIHRoZSBzdWJ0eXBlCisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgU3RyaW5nIGdldE1vZGUoKSB7CisgICAgICAgICAgICByZXR1cm4gbVN1YnR5cGVNb2RlOworICAgICAgICB9CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIEByZXR1cm4gdGhlIGV4dHJhIHZhbHVlIG9mIHRoZSBzdWJ0eXBlCisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgU3RyaW5nIGdldEV4dHJhVmFsdWUoKSB7CisgICAgICAgICAgICByZXR1cm4gbVN1YnR5cGVFeHRyYVZhbHVlOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIGludCBkZXNjcmliZUNvbnRlbnRzKCkgeworICAgICAgICAgICAgcmV0dXJuIDA7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCB3cml0ZVRvUGFyY2VsKFBhcmNlbCBkZXN0LCBpbnQgcGFyY2VsYWJsZUZsYWdzKSB7CisgICAgICAgICAgICBkZXN0LndyaXRlU3RyaW5nKG1TdWJ0eXBlTmFtZSk7CisgICAgICAgICAgICBkZXN0LndyaXRlSW50KG1TdWJ0eXBlSWNvbklkKTsKKyAgICAgICAgICAgIGRlc3Qud3JpdGVTdHJpbmcobVN1YnR5cGVMb2NhbGUpOworICAgICAgICAgICAgZGVzdC53cml0ZVN0cmluZyhtU3VidHlwZU1vZGUpOworICAgICAgICAgICAgZGVzdC53cml0ZVN0cmluZyhtU3VidHlwZUV4dHJhVmFsdWUpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBQYXJjZWxhYmxlLkNyZWF0b3I8SW5wdXRNZXRob2RTdWJ0eXBlPiBDUkVBVE9SCisgICAgICAgICAgICAgICAgPSBuZXcgUGFyY2VsYWJsZS5DcmVhdG9yPElucHV0TWV0aG9kU3VidHlwZT4oKSB7CisgICAgICAgICAgICBwdWJsaWMgSW5wdXRNZXRob2RTdWJ0eXBlIGNyZWF0ZUZyb21QYXJjZWwoUGFyY2VsIHNvdXJjZSkgeworICAgICAgICAgICAgICAgIHJldHVybiBuZXcgSW5wdXRNZXRob2RTdWJ0eXBlKHNvdXJjZSk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHB1YmxpYyBJbnB1dE1ldGhvZFN1YnR5cGVbXSBuZXdBcnJheShpbnQgc2l6ZSkgeworICAgICAgICAgICAgICAgIHJldHVybiBuZXcgSW5wdXRNZXRob2RTdWJ0eXBlW3NpemVdOworICAgICAgICAgICAgfQorICAgICAgICB9OworICAgIH0KKworICAgIC8qKgorICAgICAqIFRoZSBhcnJheSBvZiB0aGUgc3VidHlwZXMuCisgICAgICovCisgICAgcHJpdmF0ZSBmaW5hbCBBcnJheUxpc3Q8SW5wdXRNZXRob2RTdWJ0eXBlPiBtU3VidHlwZXMgPSBuZXcgQXJyYXlMaXN0PElucHV0TWV0aG9kU3VidHlwZT4oKTsKKwogICAgIC8qKgogICAgICAqIENvbnN0cnVjdG9yLgogICAgICAqIApAQCAtODEsMTEgKzE4MywxMSBAQAogICAgICAgICBtU2VydmljZSA9IHNlcnZpY2U7CiAgICAgICAgIFNlcnZpY2VJbmZvIHNpID0gc2VydmljZS5zZXJ2aWNlSW5mbzsKICAgICAgICAgbUlkID0gbmV3IENvbXBvbmVudE5hbWUoc2kucGFja2FnZU5hbWUsIHNpLm5hbWUpLmZsYXR0ZW5Ub1Nob3J0U3RyaW5nKCk7Ci0gICAgICAgIAorCiAgICAgICAgIFBhY2thZ2VNYW5hZ2VyIHBtID0gY29udGV4dC5nZXRQYWNrYWdlTWFuYWdlcigpOwogICAgICAgICBTdHJpbmcgc2V0dGluZ3NBY3Rpdml0eUNvbXBvbmVudCA9IG51bGw7CiAgICAgICAgIGludCBpc0RlZmF1bHRSZXNJZCA9IDA7Ci0gICAgICAgIAorCiAgICAgICAgIFhtbFJlc291cmNlUGFyc2VyIHBhcnNlciA9IG51bGw7CiAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICBwYXJzZXIgPSBzaS5sb2FkWG1sTWV0YURhdGEocG0sIElucHV0TWV0aG9kLlNFUlZJQ0VfTUVUQV9EQVRBKTsKQEAgLTExNiwxMyArMjE4LDM2IEBACiAgICAgICAgICAgICBpc0RlZmF1bHRSZXNJZCA9IHNhLmdldFJlc291cmNlSWQoCiAgICAgICAgICAgICAgICAgICAgIGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3R5bGVhYmxlLklucHV0TWV0aG9kX2lzRGVmYXVsdCwgMCk7CiAgICAgICAgICAgICBzYS5yZWN5Y2xlKCk7CisKKyAgICAgICAgICAgIGZpbmFsIGludCBkZXB0aCA9IHBhcnNlci5nZXREZXB0aCgpOworICAgICAgICAgICAgLy8gUGFyc2UgYWxsIHN1YnR5cGVzCisgICAgICAgICAgICB3aGlsZSAoKCh0eXBlID0gcGFyc2VyLm5leHQoKSkgIT0gWG1sUHVsbFBhcnNlci5FTkRfVEFHIHx8IHBhcnNlci5nZXREZXB0aCgpID4gZGVwdGgpCisgICAgICAgICAgICAgICAgICAgICYmIHR5cGUgIT0gWG1sUHVsbFBhcnNlci5FTkRfRE9DVU1FTlQpIHsKKyAgICAgICAgICAgICAgICBub2RlTmFtZSA9IHBhcnNlci5nZXROYW1lKCk7CisgICAgICAgICAgICAgICAgaWYgKCEic3VidHlwZSIuZXF1YWxzKG5vZGVOYW1lKSkgeworICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgWG1sUHVsbFBhcnNlckV4Y2VwdGlvbigKKyAgICAgICAgICAgICAgICAgICAgICAgICJNZXRhLWRhdGEgaW4gaW5wdXQtbWV0aG9kIGRvZXMgbm90IHN0YXJ0IHdpdGggc3VidHlwZSB0YWciKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZmluYWwgVHlwZWRBcnJheSBhID0gcmVzLm9idGFpbkF0dHJpYnV0ZXMoCisgICAgICAgICAgICAgICAgICAgICAgICBhdHRycywgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHlsZWFibGUuSW5wdXRNZXRob2RfU3VidHlwZSk7CisgICAgICAgICAgICAgICAgSW5wdXRNZXRob2RTdWJ0eXBlIHN1YnR5cGUgPSBuZXcgSW5wdXRNZXRob2RTdWJ0eXBlKAorICAgICAgICAgICAgICAgICAgICAgICAgYS5nZXRTdHJpbmcoY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHlsZWFibGUuSW5wdXRNZXRob2RfU3VidHlwZV9sYWJlbCksCisgICAgICAgICAgICAgICAgICAgICAgICBhLmdldFJlc291cmNlSWQoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3R5bGVhYmxlLklucHV0TWV0aG9kX1N1YnR5cGVfaWNvbiwgMCksCisgICAgICAgICAgICAgICAgICAgICAgICBhLmdldFN0cmluZyhjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0eWxlYWJsZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAuSW5wdXRNZXRob2RfU3VidHlwZV9pbWVTdWJ0eXBlTG9jYWxlKSwKKyAgICAgICAgICAgICAgICAgICAgICAgIGEuZ2V0U3RyaW5nKGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3R5bGVhYmxlCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5JbnB1dE1ldGhvZF9TdWJ0eXBlX2ltZVN1YnR5cGVNb2RlKSwKKyAgICAgICAgICAgICAgICAgICAgICAgIGEuZ2V0U3RyaW5nKGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3R5bGVhYmxlCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5JbnB1dE1ldGhvZF9TdWJ0eXBlX2ltZVN1YnR5cGVFeHRyYVZhbHVlKSk7CisgICAgICAgICAgICAgICAgbVN1YnR5cGVzLmFkZChzdWJ0eXBlKTsKKyAgICAgICAgICAgIH0KICAgICAgICAgfSBjYXRjaCAoTmFtZU5vdEZvdW5kRXhjZXB0aW9uIGUpIHsKICAgICAgICAgICAgIHRocm93IG5ldyBYbWxQdWxsUGFyc2VyRXhjZXB0aW9uKAogICAgICAgICAgICAgICAgICAgICAiVW5hYmxlIHRvIGNyZWF0ZSBjb250ZXh0IGZvcjogIiArIHNpLnBhY2thZ2VOYW1lKTsKICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgIGlmIChwYXJzZXIgIT0gbnVsbCkgcGFyc2VyLmNsb3NlKCk7CiAgICAgICAgIH0KLSAgICAgICAgCiAgICAgICAgIG1TZXR0aW5nc0FjdGl2aXR5TmFtZSA9IHNldHRpbmdzQWN0aXZpdHlDb21wb25lbnQ7CiAgICAgICAgIG1Jc0RlZmF1bHRSZXNJZCA9IGlzRGVmYXVsdFJlc0lkOwogICAgIH0KQEAgLTEzMiw4ICsyNTcsOSBAQAogICAgICAgICBtU2V0dGluZ3NBY3Rpdml0eU5hbWUgPSBzb3VyY2UucmVhZFN0cmluZygpOwogICAgICAgICBtSXNEZWZhdWx0UmVzSWQgPSBzb3VyY2UucmVhZEludCgpOwogICAgICAgICBtU2VydmljZSA9IFJlc29sdmVJbmZvLkNSRUFUT1IuY3JlYXRlRnJvbVBhcmNlbChzb3VyY2UpOworICAgICAgICBzb3VyY2UucmVhZFR5cGVkTGlzdChtU3VidHlwZXMsIElucHV0TWV0aG9kU3VidHlwZS5DUkVBVE9SKTsKICAgICB9Ci0gICAgCisKICAgICAvKioKIC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FsIFdlYlZpZXcgbVdlYlZpZXc7CisKKyAgICAvKioKKyAgICAgKiBDcmVhdGVzIGEgbmV3IGluamVjdG9yIGFzc29jaWF0ZWQgd2l0aCBhIGdpdmVuIFZ3ZWJWaWV3LgorICAgICAqCisgICAgICogQHBhcmFtIHdlYlZpZXcgVGhlIGFzc29jaWF0ZWQgV2ViVmlldy4KKyAgICAgKi8KKyAgICBwdWJsaWMgQWNjZXNzaWJpbGl0eUluamVjdG9yKFdlYlZpZXcgd2ViVmlldykgeworICAgICAgICBtV2ViVmlldyA9IHdlYlZpZXc7CisgICAgfQorCisgICAgLyoqCisgICAgICogUHJvY2Vzc2VzIGEga2V5IGRvd24gPGNvZGU+ZXZlbnQ8L2NvZGU+LgorICAgICAqCisgICAgICogQHJldHVybiBUcnVlIGlmIHRoZSBldmVudCB3YXMgcHJvY2Vzc2VkLgorICAgICAqLworICAgIHB1YmxpYyBib29sZWFuIG9uS2V5RXZlbnQoS2V5RXZlbnQgZXZlbnQpIHsKKworICAgICAgICAvLyBhcyBhIHByb29mIG9mIGNvbmNlcHQgbGV0IHVzIGRvIHRoZSBzaW1wbGVzdCBleGFtcGxlCisKKyAgICAgICAgaWYgKGV2ZW50LmdldEFjdGlvbigpICE9IEtleUV2ZW50LkFDVElPTl9VUCkgeworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisKKyAgICAgICAgaW50IGtleUNvZGUgPSBldmVudC5nZXRLZXlDb2RlKCk7CisKKyAgICAgICAgc3dpdGNoIChrZXlDb2RlKSB7CisgICAgICAgICAgICBjYXNlIEtleUV2ZW50LktFWUNPREVfTjoKKyAgICAgICAgICAgICAgICBtb2RpZnlTZWxlY3Rpb24oImV4dGVuZCIsICJmb3J3YXJkIiwgInNlbnRlbmNlIik7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIEtleUV2ZW50LktFWUNPREVfUDoKKyAgICAgICAgICAgICAgICBtb2RpZnlTZWxlY3Rpb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gbnVsbDsKKyAgICAgICAgcmV0dXJuIG1DYWxsYmFja1Byb3h5LmNyZWF0ZVdpbmRvdyhkaWFsb2csIHVzZXJHZXN0dXJlKTsKICAgICB9CiAKICAgICAvKioKQEAgLTg0Niw2ICs4ODMsNyBAQAogICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBGSUxFX1VQTE9BRF9MQUJFTCA9IDQ7CiAgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IFJFU0VUX0xBQkVMID0gNTsKICAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgU1VCTUlUX0xBQkVMID0gNjsKKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgRklMRV9VUExPQURfTk9fRklMRV9DSE9TRU4gPSA3OwogCiAgICAgU3RyaW5nIGdldFJhd1Jlc0ZpbGVuYW1lKGludCBpZCkgewogICAgICAgICBpbnQgcmVzaWQ7CkBAIC04NzUsNiArOTEzLDEwIEBACiAgICAgICAgICAgICAgICAgcmV0dXJuIG1Db250ZXh0LmdldFJlc291cmNlcygpLmdldFN0cmluZygKICAgICAgICAgICAgICAgICAgICAgICAgIGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3RyaW5nLnN1Ym1pdCk7CiAKKyAgICAgICAgICAgIGNhc2UgRklMRV9VUExPQURfTk9fRklMRV9DSE9TRU46CisgICAgICAgICAgICAgICAgcmV0dXJuIG1Db250ZXh0LmdldFJlc291cmNlcygpLmdldFN0cmluZygKKyAgICAgICAgICAgICAgICAgICAgICAgIGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3RyaW5nLm5vX2ZpbGVfY2hvc2VuKTsKKwogICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICBMb2cuZShMT0dUQUcsICJnZXRSYXdSZXNGaWxlbmFtZSBnb3QgaW5jb21wYXRpYmxlIHJlc291cmNlIElEIik7CiAgICAgICAgICAgICAgICAgcmV0dXJuICIiOwpAQCAtMTAxMCw1ICsxM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yBhIHByb3h5IGNsYXNzIGZvciBoYW5kbGluZyBXZWJDb3JlIC0+IFVJIHRocmVhZCBtZXNzYWdpbmcuIEFsbApAQCAtMTEyLDYgKzExNCw3IEBACiAgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IEFERF9ISVNUT1JZX0lURU0gICAgICAgICAgICAgICAgICAgID0gMTM1OwogICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBISVNUT1JZX0lOREVYX0NIQU5HRUQgICAgICAgICAgICAgICA9IDEzNjsKICAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgQVVUSF9DUkVERU5USUFMUyAgICAgICAgICAgICAgICAgICAgPSAxMzc7CisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IFNFVF9JTlNUQUxMQUJMRV9XRUJBUFAgICAgICAgICAgICAgID0gMTM4OwogCiAgICAgLy8gTWVzc2FnZSB0cmlnZ2VyZWQgYnkgdGhlIGNsaWVudCB0byByZXN1bWUgZXhlY3V0aW9uCiAgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IE5PVElGWSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgID0gMjAwOwpAQCAtNTAwLDE4ICs1MDMsMzIgQEAKICAgICAgICAgICAgICAgICAgICAgU3RyaW5nIHVybCA9IG1zZy5nZXREYXRhKCkuZ2V0U3RyaW5nKCJ1cmwiKTsKICAgICAgICAgICAgICAgICAgICAgaWYgKCFtV2ViQ2hyb21lQ2xpZW50Lm9uSnNBbGVydChtV2ViVmlldywgdXJsLCBtZXNzYWdlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcykpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIG9ubHkgZGlzcGxheSB0aGUgYWxlcnQgZGlhbG9nIGlmIHRoZSBtQ29udGV4dCBpcworICAgICAgICAgICAgICAgICAgICAgICAgLy8gQWN0aXZpdHkgYW5kIGl0cyB3aW5kb3cgaGFzIHRoZSBmb2N1cy4KKyAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKG1Db250ZXh0IGluc3RhbmNlb2YgQWN0aXZpdHkpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHx8ICEoKEFjdGl2aXR5KSBtQ29udGV4dCkuaGFzV2luZG93Rm9jdXMoKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcy5jYW5jZWwoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXMuc2V0UmVhZHkoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgIG5ldyBBbGVydERpYWxvZy5CdWlsZGVyKG1Db250ZXh0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAuc2V0VGl0bGUoZ2V0SnNEaWFsb2dUaXRsZSh1cmwpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAuc2V0TWVzc2FnZShtZXNzYWdlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAuc2V0UG9zaXRpdmVCdXR0b24oUi5zdHJpbmcub2ssCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV3IEFsZXJ0RGlhbG9nLk9uQ2xpY2tMaXN0ZW5lcigpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXcgRGlhbG9nSW50ZXJmYWNlLk9uQ2xpY2tMaXN0ZW5lcigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHVibGljIHZvaWQgb25DbGljaygKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBEaWFsb2dJbnRlcmZhY2UgZGlhbG9nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCB3aGljaCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzLmNvbmZpcm0oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5zZXRDYW5jZWxhYmxlKGZhbHNlKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAuc2V0T25DYW5jZWxMaXN0ZW5lcigKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXcgRGlhbG9nSW50ZXJmYWNlLk9uQ2FuY2VsTGlzdGVuZXIoKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1YmxpYyB2b2lkIG9uQ2FuY2VsKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIERpYWxvZ0ludGVyZmFjZSBkaWFsb2cpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcy5jYW5jZWwoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5zaG93KCk7CiAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgcmVzLnNldFJlYWR5KCk7CkBAIC01MjUsNiArNTQyLDE0IEBACiAgICAgICAgICAgICAgICAgICAgIFN0cmluZyB1cmwgPSBtc2cuZ2V0RGF0YSgpLmdldFN0cmluZygidXJsIik7CiAgICAgICAgICAgICAgICAgICAgIGlmICghbVdlYkNocm9tZUNsaWVudC5vbkpzQ29uZmlybShtV2ViVmlldywgdXJsLCBtZXNzYWdlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcykpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIG9ubHkgZGlzcGxheSB0aGUgYWxlcnQgZGlhbG9nIGlmIHRoZSBtQ29udGV4dCBpcworICAgICAgICAgICAgICAgICAgICAgICAgLy8gQWN0aXZpdHkgYW5kIGl0cyB3aW5kb3cgaGFzIHRoZSBmb2N1cy4KKyAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKG1Db250ZXh0IGluc3RhbmNlb2YgQWN0aXZpdHkpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHx8ICEoKEFjdGl2aXR5KSBtQ29udGV4dCkuaGFzV2luZG93Rm9jdXMoKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcy5jYW5jZWwoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXMuc2V0UmVhZHkoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgIG5ldyBBbGVydERpYWxvZy5CdWlsZGVyKG1Db250ZXh0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAuc2V0VGl0bGUoZ2V0SnNEaWFsb2dUaXRsZSh1cmwpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAuc2V0TWVzc2FnZShtZXNzYWdlKQpAQCAtNTY1LDYgKzU5MCwxNCBAQAogICAgICAgICAgICAgICAgICAgICBTdHJpbmcgdXJsID0gbXNnLmdldERhdGEoKS5nZXRTdHJpbmcoInVybCIpOwogICAgICAgICAgICAgICAgICAgICBpZiAoIW1XZWJDaHJvbWVDbGllbnQub25Kc1Byb21wdChtV2ViVmlldywgdXJsLCBtZXNzYWdlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsLCByZXMpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAvLyBvbmx5IGRpc3BsYXkgdGhlIGFsZXJ0IGRpYWxvZyBpZiB0aGUgbUNvbnRleHQgaXMKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIEFjdGl2aXR5IGFuZCBpdHMgd2luZG93IGhhcyB0aGUgZm9jdXMuCisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIShtQ29udGV4dCBpbnN0YW5jZW9mIEFjdGl2aXR5KQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8fCAhKChBY3Rpdml0eSkgbUNvbnRleHQpLmhhc1dpbmRvd0ZvY3VzKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXMuY2FuY2VsKCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzLnNldFJlYWR5KCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICBmaW5hbCBMYXlvdXRJbmZsYXRlciBmYWN0b3J5ID0gTGF5b3V0SW5mbGF0ZXIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLmZyb20obUNvbnRleHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgZmluYWwgVmlldyB2aWV3ID0gZmFjdG9yeS5pbmZsYXRlKFIubGF5b3V0LmpzX3Byb21wdCwKQEAgLTYxNiw2ICs2NDksMTQgQEAKICAgICAgICAgICAgICAgICAgICAgU3RyaW5nIHVybCA9IG1zZy5nZXREYXRhKCkuZ2V0U3RyaW5nKCJ1cmwiKTsKICAgICAgICAgICAgICAgICAgICAgaWYgKCFtV2ViQ2hyb21lQ2xpZW50Lm9uSnNCZWZvcmVVbmxvYWQobVdlYlZpZXcsIHVybCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLCByZXMpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAvLyBvbmx5IGRpc3BsYXkgdGhlIGFsZXJ0IGRpYWxvZyBpZiB0aGUgbUNvbnRleHQgaXMKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIEFjdGl2aXR5IGFuZCBpdHMgd2luZG93IGhhcyB0aGUgZm9jdXMuCisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIShtQ29udGV4dCBpbnN0YW5jZW9mIEFjdGl2aXR5KQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8fCAhKChBY3Rpdml0eSkgbUNvbnRleHQpLmhhc1dpbmRvd0ZvY3VzKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXMuY2FuY2VsKCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzLnNldFJlYWR5KCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICBmaW5hbCBTdHJpbmcgbSA9IG1Db250ZXh0LmdldFN0cmluZygKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUi5zdHJpbmcuanNfZGlhbG9nX2JlZm9yZV91bmxvYWQsIG1lc3NhZ2UpOwogICAgICAgICAgICAgICAgICAgICAgICAgbmV3IEFsZXJ0RGlhbG9nLkJ1aWxkZXIobUNvbnRleHQpCkBAIC03MjUsNyArNzY2LDggQEAKIAogICAgICAgICAgICAgY2FzZSBPUEVOX0ZJTEVfQ0hPT1NFUjoKICAgICAgICAgICAgICAgICBpZiAobVdlYkNocm9tZUNsaWVudCAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIG1XZWJDaHJvbWVDbGllbnQub3BlbkZpbGVDaG9vc2VyKChVcGxvYWRGaWxlKSBtc2cub2JqKTsKKyAgICAgICAgICAgICAgICAgICAgVXBsb2FkRmlsZU1lc3NhZ2VEYXRhIGRhdGEgPSAoVXBsb2FkRmlsZU1lc3NhZ2VEYXRhKW1zZy5vYmo7CisgICAgICAgICAgICAgICAgICAgIG1XZWJDaHJvbWVDbGllbnQub3BlbkZpbGVDaG9vc2VyKGRhdGEuZ2V0VXBsb2FkRmlsZSgpLCBkYXRhLmdldEFjY2VwdFR5cGUoKSk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIGJyZWFrOwogCkBAIC03NTAsNiArNzkyLDkgQEAKICAgICAgICAgICAgICAgICBtV2ViVmlldy5zZXRIdHRwQXV0aFVzZXJuYW1lUGFzc3dvcmQoCiAgICAgICAgICAgICAgICAgICAgICAgICBob3N0LCByZWFsbSwgdXNlcm5hbWUsIHBhc3N3b3JkKTsKICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgU0VUX0lOU1RBTExBQkxFX1dFQkFQUDoKKyAgICAgICAgICAgICAgICBtV2ViQ2hyb21lQ2xpZW50LnNldEluc3RhbGxhYmxlV2ViQXBwKCk7CisgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgIH0KICAgICB9CiAKQEAgLTEwODcsMTAgKzExMzIsMTUgQEAKICAgICBwdWJsaWMgdm9pZCBvblByb2dyZXNzQ2hhbmdlZChpbnQgbmV3UHJvZ3Jlc3MpIHsKICAgICAgICAgLy8gU3luY2hyb25pemUgc28gdGhhdCBtTGF0ZXN0UHJvZ3Jlc3MgaXMgdXAtdG8tZGF0ZS4KICAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7Ci0gICAgICAgICAgICBpZiAobVdlYkNocm9tZUNsaWVudCA9PSBudWxsIHx8IG1MYXRlc3RQcm9ncmVzcyA9PSBuZXdQcm9ncmVzcykgeworICAgICAgICAgICAgLy8gdXBkYXRlIG1MYXRlc3RQcm9ncmVzcyBldmVuIG1XZWJDaHJvbWVDbGllbnQgaXMgbnVsbCBhcworICAgICAgICAgICAgLy8gV2ViVmlldy5nZXRQcm9ncmVzcygpIG5lZWRzIGl0CisgICAgICAgICAgICBpZiAobUxhdGVzdFByb2dyZXNzID09IG5ld1Byb2dyZXNzKSB7CiAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgfQogICAgICAgICAgICAgbUxhdGVzdFByb2dyZXNzID0gbmV3UHJvZ3Jlc3M7CisgICAgICAgICAgICBpZiAobVdlYkNocm9tZUNsaWVudCA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgfQogICAgICAgICAgICAgaWYgKCFtUHJvZ3Jlc3NVcGRhdGVQZW5kaW5nKSB7CiAgICAgICAgICAgICAgICAgc2VuZEVtcHR5TWVzc2FnZShQUk9HUkVTUyk7CiAgICAgICAgICAgICAgICAgbVByb2dyZXNzVXBkYXRlUGVuZGluZyA9IHRydWU7CkBAIC0xMDk4LDcgKzExNDgsNyBAQAogICAgICAgICB9CiAgICAgfQogCi0gICAgcHVibGljIFdlYlZpZXcgY3JlYXRlV2luZG93KGJvb2xlYW4gZGlhbG9nLCBib29sZWFuIHVzZXJHZXN0dXJlKSB7CisgICAgcHVibGljIEJyb3dzZXJGcmFtZSBjcmVhdGVXaW5kb3coYm9vbGVhbiBkaWFsb2csIGJvb2xlYW4gdXNlckdlc3R1cmUpIHsKICAgICAgICAgLy8gRG8gYW4gdW5zeW5jaHJvbml6ZWQgcXVpY2sgY2hlY2sgdG8gYXZvaWQgcG9zdGluZyBpZiBubyBjYWxsYmFjayBoYXMKICAgICAgICAgLy8gYmVlbiBzZXQuCiAgICAgICAgIGlmIChtV2ViQ2hyb21lQ2xpZW50ID09IG51bGwpIHsKQEAgLTExMjIsOSArMTE3MiwxNSBAQAogCiAgICAgICAgIFdlYlZpZXcgdyA9IHRyYW5zcG9ydC5nZXRXZWJWaWV3KCk7CiAgICAgICAgIGlmICh3ICE9IG51bGwpIHsKLSAgICAgICAgICAgIHcuZ2V0V2ViVmlld0NvcmUoKS5pbml0aWFsaXplU3Vid2luZG93KCk7CisgICAgICAgICAgICBXZWJWaWV3Q29yZSBjb3JlID0gdy5nZXRXZWJWaWV3Q29yZSgpOworICAgICAgICAgICAgLy8gSWYgV2ViVmlldy5kZXN0cm95KCkgaGFzIGJlZW4gY2FsbGVkLCBjb3JlIG1heSBiZSBudWxsLiAgU2tpcAorICAgICAgICAgICAgLy8gaW5pdGlhbGl6YXRpb24gaW4gdGhhdCBjYXNlIGFuZCByZXR1cm4gbnVsbC4KKyAgICAgICAgICAgIGlmIChjb3JlICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBjb3JlLmluaXRpYWxpemVTdWJ3aW5kb3coKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gY29yZS5nZXRCcm93c2VyRnJhbWUoKTsKKyAgICAgICAgICAgIH0KICAgICAgICAgfQotICAgICAgICByZXR1cm4gdzsKKyAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgfQogCiAgICAgcHVibGljIHZvaWQgb25SZXF1ZXN0Rm9jdXMoKSB7CkBAIC0xMTY2LDkgKzEyMjIsNyBAQAogICAgICAgICAvLyBmb3IgbnVsbC4KICAgICAgICAgV2ViSGlzdG9yeUl0ZW0gaSA9IG1CYWNrRm9yd2FyZExpc3QuZ2V0Q3VycmVudEl0ZW0oKTsKICAgICAgICAgaWYgKGkgIT0gbnVsbCkgewotICAgICAgICAgICAgaWYgKHByZWNvbXBvc2VkIHx8IGkuZ2V0VG91Y2hJY29uVXJsKCkgPT0gbnVsbCkgewotICAgICAgICAgICAgICAgIGkuc2V0VG91Y2hJY29uVXJsKHVybCk7Ci0gICAgICAgICAgICB9CisgICAgICAgICAgICBpLnNldFRvdWNoSWNvblVybCh1cmwsIHByZWNvbXBvc2VkKTsKICAgICAgICAgfQogICAgICAgICAvLyBEbyBhbiB1bnN5bmNocm9uaXplZCBxdWljayBjaGVjayB0byBhdm9pZCBwb3N0aW5nIGlmIG5vIGNhbGxiYWNrIGhhcwogICAgICAgICAvLyBiZWVuIHNldC4KQEAgLTE0MjYsNiArMTQ4MCwyNCBAQAogICAgICAgICBzZW5kTWVzc2FnZShtc2cpOwogICAgIH0KIAorICAgIHByaXZhdGUgc3RhdGljIGNsYXNzIFVwbG9hZEZpbGVNZXNzYWdlRGF0YSB7CisgICAgICAgIHByaXZhdGUgVXBsb2FkRmlsZSBtQ2FsbGJhY2s7CisgICAgICAgIHByaXZhdGUgU3RyaW5nIG1BY2NlcHRUeXBlOworCisgICAgICAgIHB1YmxpYyBVcGxvYWRGaWxlTWVzc2FnZURhdGEoVXBsb2FkRmlsZSB1cGxvYWRGaWxlLCBTdHJpbmcgYWNjZXB0VHlwZSkgeworICAgICAgICAgICAgbUNhbGxiYWNrID0gdXBsb2FkRmlsZTsKKyAgICAgICAgICAgIG1BY2NlcHRUeXBlID0gYWNjZXB0VHlwZTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBVcGxvYWRGaWxlIGdldFVwbG9hZEZpbGUoKSB7CisgICAgICAgICAgICByZXR1cm4gbUNhbGxiYWNrOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIFN0cmluZyBnZXRBY2NlcHRUeXBlKCkgeworICAgICAgICAgICAgcmV0dXJuIG1BY2NlcHRUeXBlOworICAgICAgICB9CisgICAgfQorCiAgICAgcHJpdmF0ZSBjbGFzcyBVcGxvYWRGaWxlIGltcGxlbWVudHMgVmFsdWVDYWxsYmFjazxVcmk+IHsKICAgICAgICAgcHJpdmF0ZSBVcmkgbVZhbHVlOwogICAgICAgICBwdWJsaWMgdm9pZCBvblJlY2VpdmVWYWx1ZShVcmkgdmFsdWUpIHsKQEAgLTE0NDIsMTMgKzE1MTQsMTQgQEAKICAgICAvKioKICAgICAgKiBDYWxsZWQgYnkgV2ViVmlld0NvcmUgdG8gb3BlbiBhIGZpbGUgY2hvb3Nlci4KICAgICAgKi8KLSAgICAvKiBwYWNrYWdlICovIFVyaSBvcGVuRmlsZUNob29zZXIoKSB7CisgICAgLyogcGFja2FnZSAqLyBVcmkgb3BlbkZpbGVDaG9vc2VyKFN0cmluZyBhY2NlcHRUeXBlKSB7CiAgICAgICAgIGlmIChtV2ViQ2hyb21lQ2xpZW50ID09IG51bGwpIHsKICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICB9CiAgICA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lYW4gbUlzUnVubmluZzsKKyAgICBwcml2YXRlIEhhbmRsZXIgbUhhbmRsZXI7CisKKyAgICBwdWJsaWMgRGV2aWNlT3JpZW50YXRpb25TZXJ2aWNlKERldmljZU9yaWVudGF0aW9uTWFuYWdlciBtYW5hZ2VyKSB7CisgICAgICAgIG1NYW5hZ2VyID0gbWFuYWdlcjsKKyAgICAgICAgYXNzZXJ0KG1NYW5hZ2VyICE9IG51bGwpOworICAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBzdGFydCgpIHsKKyAgICAgICAgbUlzUnVubmluZyA9IHRydWU7CisgICAgICAgIHJlZ2lzdGVyRm9yU2Vuc29ycygpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHN0b3AoKSB7CisgICAgICAgIG1Jc1J1bm5pbmcgPSBmYWxzZTsKKyAgICAgICAgdW5yZWdpc3RlckZyb21TZW5zb3JzKCk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgc3VzcGVuZCgpIHsKKyAgICAgICAgaWYgKG1Jc1J1bm5pbmcpIHsKKyAgICAgICAgICAgIHVucmVnaXN0ZXJGcm9tU2Vuc29ycygpOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHZvaWQgcmVzdW1lKCkgeworICAgICAgICBpZiAobUlzUnVubmluZykgeworICAgICAgICAgICAgcmVnaXN0ZXJGb3JTZW5zb3JzKCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcml2YXRlIHZvaWQgc2VuZEVycm9yRXZlbnQoKSB7CisgICAgICAgIGFzc2VydCBXZWJWaWV3Q29yZS5USFJFQURfTkFNRS5lcXVhbHMoVGhyZWFkLmN1cnJlbnRUaHJlYWQoKS5nZXROYW1lKCkpOworICAgICAgICBpZiAobUhhbmRsZXIgPT0gbnVsbCkgeworICAgICAgICAgICAgbUhhbmRsZXIgPSBuZXcgSGFuZGxlcigpOworICAgICAgICB9CisgICAgICAgIG1IYW5kbGVyLnBvc3QobmV3IFJ1bm5hYmxlKCkgeworICAgICAgICAgICAgQE92ZXJyaWRlCisgICAgICAgICAgICBwdWJsaWMgdm9pZCBydW4oKSB7CisgICAgICAgICAgICAgICAgYXNzZXJ0IFdlYlZpZXdDb3JlLlRIUkVBRF9OQU1FLmVxdWFscyhUaHJlYWQuY3VycmVudFRocmVhZCgpLmdldE5hbWUoKSk7CisgICAgICAgICAgICAgICAgaWYgKG1Jc1J1bm5pbmcpIHsKKyAgICAgICAgICAgICAgICAgICAgbU1hbmFnZXIub25PcmllbnRhdGlvbkNoYW5nZShudWxsLCBudWxsLCBudWxsKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0pOworICAgIH0KKworICAgIHByaXZhdGUgdm9pZCByZWdpc3RlckZvclNlbnNvcnMoKSB7CisgICAgICAgIC8vIFNlbmQgdGhlIGVycm9yIGV2ZW50IGZvciBub3cuCisgICAgICAgIC8vIEZJWE1FOiBJbXBsZW1lbnQuCisgICAgICAgIHNlbmRFcnJvckV2ZW50KCk7CisgICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIHVucmVnaXN0ZXJGcm9tU2Vuc29ycygpIHsKKyAgICAgICAgLy8gRklYTUU6IEltcGxlbWVudC4KKyAgICB9Cit9CmRpZmYgLS1naXQgYS9jb3JlL2phdmEvYW5kcm9pZC93ZWJraXQvR2VvbG9jYXRpb25TZXJ2aWNlLmphdmEgYi9jb3JlL2phdmEvYW5kcm9pZC93ZWJraXQvR2VvbG9jYXRpb25TZXJ2aWNlLmphdmEKaW5kZXggMjQzMDZmNC4uOTFkZTFkOCAxMDA3NTUKLS0tIGEvY29yZS9qYXZhL2FuZHJvaWQvd2Via2l0L0dlb2xvY2F0aW9uU2VydmljZS5qYXZhCisrKyBiL2NvcmUvamF2YS9hbmRyb2lkL3dlYmtpdC9HZW9sb2NhdGlvblNlcnZpY2UuamF2YQpAQCAtNDUsMTQgKzQ1LDEzIEBACiAKICAgICAvKioKICAgICAgKiBDb25zdHJ1Y3RvcgorICAgICAqIE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PbkNvbXBsZXRpb25MaXN0ZW5lcjsKKyAgICBwdWJsaWMgdm9pZCBvbkNvbXBsZXRpb24oTWVkaWFQbGF5ZXIgbXApIHsKKyAgICAgICAgcmVzZXRNZWRpYVBsYXllcigpOworICAgICAgICBtU3RhdGUgPSBJRExFOworICAgICAgICBuYXRpdmVPbkVuZGVkKG1OYXRpdmVQb2ludGVyKTsKKyAgICB9CisKKyAgICAvLyBNZWRpYVBsYXllci5PbkVycm9yTGlzdGVuZXIKKyAgICBwdWJsaWMgYm9vbGVhbiBvbkVycm9yKE1lZGlhUGxheWVyIG1wLCBpbnQgd2hhdCwgaW50IGV4dHJhKSB7CisgICAgICAgIG1TdGF0ZSA9IEVSUk9SOworICAgICAgICByZXNldE1lZGlhUGxheWVyKCk7CisgICAgICAgIG1TdGF0ZSA9IElETEU7CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisKKyAgICAvLyBNZWRpYVBsYXllci5PblByZXBhcmVkTGlzdGVuZXIKKyAgICBwdWJsaWMgdm9pZCBvblByZXBhcmVkKE1lZGlhUGxheWVyIG1wKSB7CisgICAgICAgIG1TdGF0ZSA9IFBSRVBBUkVEOworICAgICAgICBpZiAobVRpbWVyICE9IG51bGwpIHsKKyAgICAgICAgICAgIG1UaW1lci5zY2hlZHVsZShuZXcgVGltZXVwZGF0ZVRhc2soKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBUSU1FVVBEQVRFX1BFUklPRCwgVElNRVVQREFURV9QRVJJT0QpOworICAgICAgICB9CisgICAgICAgIG5hdGl2ZU9uUHJlcGFyZWQobXAuZ2V0RHVyYXRpb24oKSwgMCwgMCwgbU5hdGl2ZVBvaW50ZXIpOworICAgICAgICBpZiAobUFza1RvUGxheSkgeworICAgICAgICAgICAgbUFza1RvUGxheSA9IGZhbHNlOworICAgICAgICAgICAgcGxheSgpOworICAgICAgICB9CisgICAgfQorCisgICAgLy8gTWVkaWFQbGF5ZXIuT25TZWVrQ29tcGxldGVMaXN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iAobVRpbWVyICE9IG51bGwpIHsKKyAgICAgICAgICAgIG1UaW1lci5jYW5jZWwoKTsKKyAgICAgICAgfQorICAgICAgICBtVGltZXIgPSBuZXcgVGltZXIoKTsKKyAgICAgICAgbVN0YXRlID0gSURMRTsKKyAgICB9CisKKyAgICBwcml2YXRlIHZvaWQgc2V0RGF0YVNvdXJjZShTdHJpbmcgdXJsKSB7CisgICAgICAgIG1VcmwgPSB1cmw7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBpZiAobVN0YXRlICE9IElETEUpIHsKKyAgICAgICAgICAgICAgICByZXNldE1lZGlhUGxheWVyKCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBtTWVkaWFQbGF5ZXIuc2V0RGF0YVNvdXJjZSh1cmwpOworICAgICAgICAgICAgbVN0YXRlID0gSU5JVElBTElaRUQ7CisgICAgICAgICAgICBtTWVkaWFQbGF5ZXIucHJlcGFyZUFzeW5jKCk7CisgICAgICAgIH0gY2F0Y2ggKElPRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgIExvZy5lKExPR1RBRywgImNvdWxkbid0IGxvYWQgdGhlIHJlc291cmNlOiAiICsgdXJsICsgIiBleGM6ICIgKyBlKTsKKyAgICAgICAgICAgIHJlc2V0TWVkaWFQbGF5ZXIoKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgdm9pZCBwbGF5KCkgeworICAgICAgICBpZiAoKG1TdGF0ZSA9PSBFUlJPUiB8fCBtU3RhdGUgPT0gSURMRSkgJiYgbVVybCAhPSBudWxsKSB7CisgICAgICAgICAgICByZXNldE1lZGlhUGxheWVyKCk7CisgICAgICAgICAgICBzZXREYXRhU291cmNlKG1VcmwpOworICAgICAgICAgICAgbUFza1RvUGxheSA9IHRydWU7CisgICAgICAgIH0KKworICAgICAgICBpZiAobVN0YXRlID49IFBSRVBBUkVEKSB7CisgICAgICAgICAgICBtTWVkaWFQbGF5ZXIuc3RhcnQoKTsKKyAgICAgICAgICAgIG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lcmF0ZUtleVBhaXIgZXhwZWN0cyBvcmdhbml6YXRpb25zIHdoaWNoIHdlIGRvbid0IGhhdmUuIElnbm9yZQogICAgICAgICAgICAgLy8gdXJsLgogICAgICAgICAgICAgcmV0dXJuIENlcnRUb29sLmdldFNpZ25lZFB1YmxpY0tleSgKLSAgICAgICAgICAgICAgICAgICAgbUN1cnJlbnRNYWluV2ViVmlldy5nZXRDb250ZXh0KCksIGluZGV4LCBjaGFsbGVuZ2UpOworICAgICAgICAgICAgICAgICAgICBjdXJyZW50LmdldENvbnRleHQoKSwgaW5kZXgsIGNoYWxsZW5nZSk7CiAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICBMb2cuZShMT0dUQUcsICJUaGVyZSBpcyBubyBhY3RpdmUgV2ViVmlldyBmb3IgZ2V0U2lnbmVkUHVibGljS2V5Iik7CiAgICAgICAgICAgICByZXR1cm4gIiI7CiAgICAgICAgIH0KICAgICB9CiAKKyAgICAvLyBDYWxsZWQgb24gdGhlIFdlYkNvcmUgdGhyZWFkIHRocm91Z2ggSk5JLgorICAgIHByaXZhdGUgU3RyaW5nIHJlc29sdmVGaWxlUGF0aEZvckNvbnRlbnRVcmkoU3RyaW5nIHVyaSkgeworICAgICAgICBpZiAobUNvbnRlbnRVcmlUb0ZpbGVQYXRoTWFwICE9IG51bGwpIHsKKyAgICAgICAgICAgIFN0cmluZyBmaWxlTmFtZSA9IG1Db250ZW50VXJpVG9GaWxlUGF0aE1hcC5nZXQodXJpKTsKKyAgICAgICAgICAgIGlmIChmaWxlTmFtZSAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIGZpbGVOYW1lOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgLy8gRmFpbHNhZmUgZmFsbGJhY2sgdG8ganVzdCB1c2UgdGhlIGxhc3QgcGF0aCBzZWdtZW50LgorICAgICAgICAvLyAoU2VlIE9wZW5hYmxlQ29sdW1ucyBkb2N1bWVudGF0aW9uIGluIH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NlKCkgewogICAgICAgICBpbnQgbmF0aXZlUmVzcG9uc2UgPSBjcmVhdGVOYXRpdmVSZXNwb25zZSgpOwogICAgICAgICAvLyBUaGUgbmF0aXZlIGNvZGUgZGVsZXRlcyB0aGUgbmF0aXZlIHJlc3BvbnNlIG9iamVjdC4KICAgICAgICAgbmF0aXZlUmVjZWl2ZWRSZXNwb25zZShuYXRpdmVSZXNwb25zZSk7CisgICAgICAgIG1TZXROYXRpdmVSZXNwb25zZSA9IHRydWU7CiAgICAgfQogCiAgICAgLyoqCkBAIC0xMTI3LDYgKzExMzQsOSBAQAogICAgICAqLwogICAgIHByaXZhdGUgdm9pZCBjb21taXRMb2FkKCkgewogICAgICAgICBpZiAobUNhbmNlbGxlZCkgcmV0dXJuOworICAgICAgICBpZiAoIW1TZXROYXRpdmVSZXNwb25zZSkgeworICAgICAgICAgICAgc2V0TmF0aXZlUmVzcG9uc2UoKTsKKyAgICAgICAgfQogCiAgICAgICAgIGlmIChtSXNNYWluUGFnZUxvYWRlcikgewogICAgICAgICAgICAgU3RyaW5nIHR5cGUgPSBzQ2VydGlmaWNhdGVUeXBlTWFwLmdldChtTWltZVR5cGUpOwpAQCAtMTE5Nyw2ICsxMjA3LDEwIEBACiAgICAgICAgIH0KICAgICAgICAgaWYgKG1OYXRpdmVMb2FkZXIgIT0gMCkgewogICAgICAgICAgICAgUGVyZkNoZWNrZXIgY2hlY2tlciA9IG5ldyBQZXJmQ2hlY2tlcigpOworICAgICAgICAgICAgaWYgKCFtU2V0TmF0aXZlUmVzcG9uc2UpIHsKKyAgICAgICAgICAgICAgICBzZXROYXRpdmVSZXNwb25zZSgpOworICAgICAgICAgICAgfQorCiAgICAgICAgICAgICBuYXRpdmVGaW5pc2hlZCgpOwogICAgICAgICAgICAgY2hlY2tlci5yZXNwb25zZUFsZXJ0KCJyZXMgbmF0aXZlRmluaXNoZWQiKTsKICAgICAgICAgICAgIGNsZWFyTmF0aXZlTG9hZGVyKCk7CkBAIC0xMzEyLDY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gICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgKLSAgICAgICAgICAgICAgICAgICAgImFwcGxpY2F0aW9uL3ZuZC5vYXNpcy5vcGVuZG9jdW1lbnQuZGF0YWJhc2UiLCAib2RiIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KAotICAgICAgICAgICAgICAgICAgICAiYXBwbGljYXRpb24vdm5kLm9hc2lzLm9wZW5kb2N1bWVudC5mb3JtdWxhIiwgIm9kZiIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgKLSAgICAgICAgICAgICAgICAgICAgImFwcGxpY2F0aW9uL3ZuZC5vYXNpcy5vcGVuZG9jdW1lbnQuZ3JhcGhpY3MiLCAib2RnIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KAotICAgICAgICAgICAgICAgICAgICAiYXBwbGljYXRpb24vdm5kLm9hc2lzLm9wZW5kb2N1bWVudC5ncmFwaGljcy10ZW1wbGF0ZSIsCi0gICAgICAgICAgICAgICAgICAgICJvdGciKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoCi0gICAgICAgICAgICAgICAgICAgICJhcHBsaWNhdGlvbi92bmQub2FzaXMub3BlbmRvY3VtZW50LmltYWdlIiwgIm9kaSIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgKLSAgICAgICAgICAgICAgICAgICAgImFwcGxpY2F0aW9uL3ZuZC5vYXNpcy5vcGVuZG9jdW1lbnQuc3ByZWFkc2hlZXQiLCAib2RzIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KAotICAgICAgICAgICAgICAgICAgICAiYXBwbGljYXRpb24vdm5kLm9hc2lzLm9wZW5kb2N1bWVudC5zcHJlYWRzaGVldC10ZW1wbGF0ZSIsCi0gICAgICAgICAgICAgICAgICAgICJvdHMiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoCi0gICAgICAgICAgICAgICAgICAgICJhcHBsaWNhdGlvbi92bmQub2FzaXMub3BlbmRvY3VtZW50LnRleHQiLCAib2R0Iik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KAotICAgICAgICAgICAgICAgICAgICAiYXBwbGljYXRpb24vdm5kLm9hc2lzLm9wZW5kb2N1bWVudC50ZXh0LW1hc3RlciIsICJvZG0iKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoCi0gICAgICAgICAgICAgICAgICAgICJhcHBsaWNhdGlvbi92bmQub2FzaXMub3BlbmRvY3VtZW50LnRleHQtdGVtcGxhdGUiLCAib3R0Iik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KAotICAgICAgICAgICAgICAgICAgICAiYXBwbGljYXRpb24vdm5kLm9hc2lzLm9wZW5kb2N1bWVudC50ZXh0LXdlYiIsICJvdGgiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoImFwcGxpY2F0aW9uL21zd29yZCIsICJkb2MiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoImFwcGxpY2F0aW9uL21zd29yZCIsICJkb3QiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoCi0gICAgICAgICAgICAgICAgICAgICJhcHBsaWNhdGlvbi92bmQub3BlbnhtbGZvcm1hdHMtb2ZmaWNlZG9jdW1lbnQud29yZHByb2Nlc3NpbmdtbC5kb2N1bWVudCIsCi0gICAgICAgICAgICAgICAgICAgICJkb2N4Iik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KAotICAgICAgICAgICAgICAgICAgICAiYXBwbGljYXRpb24vdm5kLm9wZW54bWxmb3JtYXRzLW9mZmljZWRvY3VtZW50LndvcmRwcm9jZXNzaW5nbWwudGVtcGxhdGUiLAotICAgICAgICAgICAgICAgICAgICAiZG90eCIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXBwbGljYXRpb24vdm5kLm1zLWV4Y2VsIiwgInhscyIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXBwbGljYXRpb24vdm5kLm1zLWV4Y2VsIiwgInhsdCIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgKLSAgICAgICAgICAgICAgICAgICAgImFwcGxpY2F0aW9uL3ZuZC5vcGVueG1sZm9ybWF0cy1vZmZpY2Vkb2N1bWVudC5zcHJlYWRzaGVldG1sLnNoZWV0IiwKLSAgICAgICAgICAgICAgICAgICAgInhsc3giKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoCi0gICAgICAgICAgICAgICAgICAgICJhcHBsaWNhdGlvbi92bmQub3BlbnhtbGZvcm1hdHMtb2ZmaWNlZG9jdW1lbnQuc3ByZWFkc2hlZXRtbC50ZW1wbGF0ZSIsCi0gICAgICAgICAgICAgICAgICAgICJ4bHR4Iik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJhcHBsaWNhdGlvbi92bmQubXMtcG93ZXJwb2ludCIsICJwcHQiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoImFwcGxpY2F0aW9uL3ZuZC5tcy1wb3dlcnBvaW50IiwgInBvdCIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXBwbGljYXRpb24vdm5kLm1zLXBvd2VycG9pbnQiLCAicHBzIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KAotICAgICAgICAgICAgICAgICAgICAiYXBwbGljYXRpb24vdm5kLm9wZW54bWxmb3JtYXRzLW9mZmljZWRvY3VtZW50LnByZXNlbnRhdGlvbm1sLnByZXNlbnRhdGlvbiIsCi0gICAgICAgICAgICAgICAgICAgICJwcHR4Iik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KAotICAgICAgICAgICAgICAgICAgICAiYXBwbGljYXRpb24vdm5kLm9wZW54bWxmb3JtYXRzLW9mZmljZWRvY3VtZW50LnByZXNlbnRhdGlvbm1sLnRlbXBsYXRlIiwKLSAgICAgICAgICAgICAgICAgICAgInBvdHgiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoCi0gICAgICAgICAgICAgICAgICAgICJhcHBsaWNhdGlvbi92bmQub3BlbnhtbGZvcm1hdHMtb2ZmaWNlZG9jdW1lbnQucHJlc2VudGF0aW9ubWwuc2xpZGVzaG93IiwKLSAgICAgICAgICAgICAgICAgICAgInBwc3giKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoImFwcGxpY2F0aW9uL3ZuZC5yaW0uY29kIiwgImNvZCIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXBwbGljYXRpb24vdm5kLnNtYWYiLCAibW1mIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJhcHBsaWNhdGlvbi92bmQuc3RhcmRpdmlzaW9uLmNhbGMiLCAic2RjIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJhcHBsaWNhdGlvbi92bmQuc3RhcmRpdmlzaW9uLmRyYXciLCAic2RhIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KAotICAgICAgICAgICAgICAgICAgICAiYXBwbGljYXRpb24vdm5kLnN0YXJkaXZpc2lvbi5pbXByZXNzIiwgInNkZCIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgKLSAgICAgICAgICAgICAgICAgICAgImFwcGxpY2F0aW9uL3ZuZC5zdGFyZGl2aXNpb24uaW1wcmVzcyIsICJzZHAiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoImFwcGxpY2F0aW9uL3ZuZC5zdGFyZGl2aXNpb24ubWF0aCIsICJzbWYiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoImFwcGxpY2F0aW9uL3ZuZC5zdGFyZGl2aXNpb24ud3JpdGVyIiwKLSAgICAgICAgICAgICAgICAgICAgInNkdyIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXBwbGljYXRpb24vdm5kLnN0YXJkaXZpc2lvbi53cml0ZXIiLAotICAgICAgICAgICAgICAgICAgICAidm9yIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KAotICAgICAgICAgICAgICAgICAgICAiYXBwbGljYXRpb24vdm5kLnN0YXJkaXZpc2lvbi53cml0ZXItZ2xvYmFsIiwgInNnbCIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXBwbGljYXRpb24vdm5kLnN1bi54bWwuY2FsYyIsICJzeGMiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoCi0gICAgICAgICAgICAgICAgICAgICJhcHBsaWNhdGlvbi92bmQuc3VuLnhtbC5jYWxjLnRlbXBsYXRlIiwgInN0YyIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXBwbGljYXRpb24vdm5kLnN1bi54bWwuZHJhdyIsICJzeGQiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoCi0gICAgICAgICAgICAgICAgICAgICJhcHBsaWNhdGlvbi92bmQuc3VuLnhtbC5kcmF3LnRlbXBsYXRlIiwgInN0ZCIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXBwbGljYXRpb24vdm5kLn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ik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJhcHBsaWNhdGlvbi94LWd0YXIiLCAidGd6Iik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJhcHBsaWNhdGlvbi94LWd0YXIiLCAidGF6Iik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJhcHBsaWNhdGlvbi94LWhkZiIsICJoZGYiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoImFwcGxpY2F0aW9uL3gtaWNhIiwgImljYSIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXBwbGljYXRpb24veC1pbnRlcm5ldC1zaWdudXAiLCAiaW5zIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJhcHBsaWNhdGlvbi94LWludGVybmV0LXNpZ251cCIsICJpc3AiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoImFwcGxpY2F0aW9uL3gtaXBob25lIiwgImlpaSIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXBwbGljYXRpb24veC1pc285NjYwLWltYWdlIiwgImlzbyIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXBwbGljYXRpb24veC1qbW9sIiwgImpteiIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXBwbGljYXRpb24veC1rY2hhcnQiLCAiY2hydCIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXBwbGljYXRpb24veC1raWxsdXN0cmF0b3IiLCAia2lsIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJhcHBsaWNhdGlvbi94LWtvYW4iLCAic2twIik7Ci0gICAgICAgICAgICBzTWltZVR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ZXhpbmZvIiwgInRleGluZm8iKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoImFwcGxpY2F0aW9uL3gtdGV4aW5mbyIsICJ0ZXhpIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJhcHBsaWNhdGlvbi94LXRyb2ZmIiwgInQiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoImFwcGxpY2F0aW9uL3gtdHJvZmYiLCAicm9mZiIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXBwbGljYXRpb24veC10cm9mZi1tYW4iLCAibWFuIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJhcHBsaWNhdGlvbi94LXVzdGFyIiwgInVzdGFyIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJhcHBsaWNhdGlvbi94LXdhaXMtc291cmNlIiwgInNyYyIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXBwbGljYXRpb24veC13aW5neiIsICJ3eiIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXBwbGljYXRpb24veC13ZWJhcmNoaXZlIiwgIndlYmFyY2hpdmUiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoImFwcGxpY2F0aW9uL3gteDUwOS1jYS1jZXJ0IiwgImNydCIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXBwbGljYXRpb24veC14NTA5LXVzZXItY2VydCIsICJjcnQiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoImFwcGxpY2F0aW9uL3gteGNmIiwgInhjZiIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXBwbGljYXRpb24veC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wgIm00YSIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXVkaW8vbXBlZ3VybCIsICJtM3UiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoImF1ZGlvL3Bycy5zaWQiLCAic2lkIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJhdWRpby94LWFpZmYiLCAiYWlmIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJhdWRpby94LWFpZmYiLCAiYWlmZiIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXVkaW8veC1haWZmIiwgImFpZmMiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoImF1ZGlvL3gtZ3NtIiwgImdzbSIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXVkaW8veC1tcGVndXJsIiwgIm0zdSIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXVkaW8veC1tcy13bWEiLCAid21hIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJhdWRpby94LW1zLXdheCIsICJ3YXgiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoImF1ZGlvL3gtcG4tcmVhbGF1ZGlvIiwgInJhIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJhdWRpby94LXBuLXJlYWxhdWRpbyIsICJybSIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXVkaW8veC1wbi1yZWFsYXVkaW8iLCAicmFtIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJhdWRpby94LXJlYWxhdWRpbyIsICJyYSIpOwotICAgICAgICAgICAgc01pbWVUeXBl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sICJtc2giKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoIm1vZGVsL21lc2giLCAibWVzaCIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgibW9kZWwvbWVzaCIsICJzaWxvIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJ0ZXh0L2NhbGVuZGFyIiwgImljcyIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgidGV4dC9jYWxlbmRhciIsICJpY3oiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoInRleHQvY29tbWEtc2VwYXJhdGVkLXZhbHVlcyIsICJjc3YiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoInRleHQvY3NzIiwgImNzcyIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgidGV4dC9odG1sIiwgImh0bSIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgidGV4dC9odG1sIiwgImh0bWwiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoInRleHQvaDMyMyIsICIzMjMiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoInRleHQvaXVscyIsICJ1bHMiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoInRleHQvbWF0aG1sIiwgIm1tbCIpOwotICAgICAgICAgICAgLy8gYWRkIGl0IGZpcnN0IHNvIGl0IHdpbGwgYmUgdGhlIGRlZmF1bHQgZm9yIEV4dGVuc2lvbkZyb21NaW1lVHlwZQotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgidGV4dC9wbGFpbiIsICJ0eHQiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoIn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wIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJ0ZXh0L3gtYysraGRyIiwgImh4eCIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgidGV4dC94LWMrK2hkciIsICJoaCIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgidGV4dC94LWMrK3NyYyIsICJjKysiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoInRleHQveC1jKytzcmMiLCAiY3BwIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJ0ZXh0L3gtYysrc3JjIiwgImN4eCIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgidGV4dC94LWNoZHIiLCAiaCIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgidGV4dC94LWNvbXBvbmVudCIsICJodGMiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoInRleHQveC1jc2giLCAiY3NoIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJ0ZXh0L3gtY3NyYyIsICJjIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJ0ZXh0L3gtZHNyYyIsICJkIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJ0ZXh0L3gtaGFza2VsbCIsICJocyIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgidGV4dC94LWphdmEiLCAiamF2YSIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgidGV4dC94LWxpdGVyYXRlLWhhc2tlbGwiLCAibGhzIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJ0ZXh0L3gtbW9jIiwgIm1vYyI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C5sb2FkRW50cnkoInZpZGVvL3gtbGEtYXNmIiwgImxzeCIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgidmlkZW8veC1tbmciLCAibW5nIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJ2aWRlby94LW1zLWFzZiIsICJhc2YiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoInZpZGVvL3gtbXMtYXNmIiwgImFzeCIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgidmlkZW8veC1tcy13bSIsICJ3bSIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgidmlkZW8veC1tcy13bXYiLCAid212Iik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJ2aWRlby94LW1zLXdteCIsICJ3bXgiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoInZpZGVvL3gtbXMtd3Z4IiwgInd2eCIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgidmlkZW8veC1tc3ZpZGVvIiwgImF2aSIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgidmlkZW8veC1zZ2ktbW92aWUiLCAibW92aWUiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoIngtY29uZmVyZW5jZS94LWNvb2x0YWxrIiwgImljZSIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgieC1lcG9jL3gtc2lzeC1hcHAiLCAic2lzeCIpOwotICAgICAgICB9Ci0KICAgICAgICAgcmV0dXJuIHNNaW1lVHlwZU1hcDsKICAgICB9CiB9CmRpZmYgLS1naXQgYS9jb3JlL2phdmEvYW5kcm9pZC93ZWJraXQvTmV0d29yay5qYXZhIGIvY29yZS9qYXZhL2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dNb25pdG9yOworCiAgICAgLyoqCiAgICAgICogQHJldHVybiBUaGUgc2luZ2xldG9uIGluc3RhbmNlIG9mIHRoZSBuZXR3b3JrLgogICAgICAqLwpAQCAtMTA3LDYgKzEyNSw3IEBACiAgICAgICAgIGlmICgrK3NQbGF0Zm9ybU5vdGlmaWNhdGlvbkVuYWJsZVJlZkNvdW50ID09IDEpIHsKICAgICAgICAgICAgIGlmIChzTmV0d29yayAhPSBudWxsKSB7CiAgICAgICAgICAgICAgICAgc05ldHdvcmsubVJlcXVlc3RRdWV1ZS5lbmFibGVQbGF0Zm9ybU5vdGlmaWNhdGlvbnMoKTsKKyAgICAgICAgICAgICAgICBzTmV0d29yay5tb25pdG9yUm9hbWluZygpOwogICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICBzUGxhdGZvcm1Ob3RpZmljYXRpb25zID0gdHJ1ZTsKICAgICAgICAgICAgIH0KQEAgLTEyMSw2ICsxNDAsNyBAQAogICAgICAgICBpZiAoLS1zUGxhdGZvcm1Ob3RpZmljYXRpb25FbmFibGVSZWZDb3VudCA9PSAwKSB7CiAgICAgICAgICAgICBpZiAoc05ldHdvcmsgIT0gbnVsbCkgewogICAgICAgICAgICAgICAgIHNOZXR3b3JrLm1SZXF1ZXN0UXVldWUuZGlzYWJsZVBsYXRmb3JtTm90aWZpY2F0aW9ucygpOworICAgICAgICAgICAgICAgIHNOZXR3b3JrLnN0b3BNb25pdG9yaW5nUm9hbWluZygpOwogICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICBzUGxhdGZvcm1Ob3RpZmljYXRpb25zID0gZmFsc2U7CiAgICAgICAgICAgICB9CkBAIC0xMzYsMTIgKzE1NiwzOSBAQAogICAgICAgICAgICAgQXNzZXJ0LmFzc2VydFRydWUoVGhyZWFkLmN1cnJlbnRUaHJlYWQoKS4KICAgICAgICAgICAgICAgICAgICAgZ2V0TmFtZSgpLmVxdWFscyhXZWJWaWV3Q29yZS5USFJFQURfTkFNRSkpOwogICAgICAgICB9CisgICAgICAgIG1Db250ZXh0ID0gY29udGV4dDsKICAgICAgICAgbVNzbEVycm9ySGFuZGxlciA9IG5ldyBTc2xFcnJvckhhbmRsZXIoKTsKICAgICAgICAgbUh0dHBBdXRoSGFuZGxlciA9IG5ldyBIdHRwQXV0aEhhbmRsZXIodGhpcyk7CiAKICAgICAgICAgbVJlcXVlc3RRdWV1ZSA9IG5ldyBSZXF1ZXN0UXVldWUoY29udGV4dCk7CiAgICAgfQogCisgICAgcHJpdmF0ZSBjbGFzcyBSb2FtaW5nTW9uaXRvciBleHRlbmRzIEJyb2FkY2FzdFJlY2VpdmVyIHsKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyB2b2lkIG9uUmVjZWl2ZShDb250ZXh0IGNvbnRleHQsIEludGVudCBpbnRlbnQpIHsKKyAgICAgICAgICAgIGlmICghQ29ubmVjdGl2aXR5TWFuYWdlci5DT05ORUNUSVZJVFlfQUNUSU9OLmVxdWFscyhpbnRlbnQuZ2V0QWN0aW9uKCkpKQorICAgICAgICAgICAgICAgIHJldHVybjsKKworICAgICAgICAgICAgTmV0d29ya0luZm8gaW5mbyA9IChOZXR3b3JrSW5mbylpbnRlbnQuZ2V0UGFyY2VsYWJsZUV4dHJhKENvbm5lY3Rpdml0eU1hbmFnZXIuRVhUUkFfTkVUV09SS19JTkZPKTsKKyAgICAgICAgICAgIGlmIChpbmZvICE9IG51bGwpCisgICAgICAgICAgICAgICAgbVJvYW1pbmcgPSBpbmZvLmlzUm9hbWluZygpOworICAgICAgICB9OworICAgIH07CisKKyAgICBwcml2YXRlIHZvaWQgbW9uaXRvclJvYW1pbmcoKSB7CisgICAgICAgIG1Sb2FtaW5nTW9uaXRvciA9IG5ldyBSb2FtaW5nTW9uaXRvcigpOworICAgICAgICBJbnRlbnRGaWx0ZXIgZmlsdGVyID0gbmV3IEludGVudEZpbHRlcigpOworICAgICAgICBmaWx0ZXIuYWRkQWN0aW9uKENvbm5lY3Rpdml0eU1hbmFnZXIuQ09OTkVDVElWSVRZX0FDVElPTik7CisgICAgICAgIG1Db250ZXh0LnJlZ2lzdGVyUmVjZWl2ZXIoc05ldHdvcmsubVJvYW1pbmdNb25pdG9yLCBmaWx0ZXIpOworICAgIH0KKworICAgIHByaXZhdGUgdm9pZCBzdG9wTW9uaXRvcmluZ1JvYW1pbmcoKSB7CisgICAgICAgIGlmIChtUm9hbWluZ01vbml0b3IgIT0gbnVsbCkgeworICAgICAgICAgICAgbUNvbnRleHQudW5yZWdpc3RlclJlY2VpdmVyKG1Sb2FtaW5nTW9uaXRvcik7CisgICAgICAgICAgICBtUm9hbWluZ01vbml0b3IgPSBudWxsOworICAgICAgICB9CisgICAgfQorCiAgICAgLyoqCiAgICAgICogUmVxdWVzdCBhIHVybCBmcm9tIGVpdGhlciB0aGUgbmV0d29yayBvciB0aGUgZmlsZSBzeXN0ZW0uCiAgICAgICogQHBhcmFtIHVybCBUaGUgdXJsIHRvIGxvYWQuCkBAIC0xNzAsNiArMjE3LDExIEBACiAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgIH0KIAorICAgICAgICAvLyBJZiB0aGlzIGlzIGEgcHJlZmV0Y2gsIGFib3J0IGl0IGlmIHdlJ3JlIHJvYW1pbmcuCisgICAgICAgIGlmIChtUm9hbWluZyAmJiBoZWFkZXJzLmNvbnRhaW5zS2V5KCJYLU1veiIpICYmICJwcmVmZXRjaCIuZXF1YWxzKGhlYWRlcnMuZ2V0KCJYLU1veiIpKSkgeworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisKICAgICAgICAgLyogRklYTUU6IHRoaXMgaXMgbGFtZS4gIFBhc3MgYW4gSW5wdXRTdHJlYW0gaW4sIHJhdGhlciB0aGFuCiAgICAgICAgICAgIG1ha2luZyB0aGlzIGxhbWUgb25lIGhlcmUgKi8KICAgICAgICAgSW5wdXRTdHJlYW0gYm9keVByb3ZpZGVyID0gbnVsbDsKZ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gewotICAgICAgICByZXR1cm4gbVRvdWNoSWNvblVybDsKKyAgICAgICAgaWYgKG1Ub3VjaEljb25VcmxGcm9tTGluayAhPSBudWxsKSB7CisgICAgICAgICAgICByZXR1cm4gbVRvdWNoSWNvblVybEZyb21MaW5rOworICAgICAgICB9IGVsc2UgaWYgKG1Ub3VjaEljb25VcmxTZXJ2ZXJEZWZhdWx0ICE9IG51bGwpIHsKKyAgICAgICAgICAgIHJldHVybiBtVG91Y2hJY29uVXJsU2VydmVyRGVmYXVsdDsKKyAgICAgICAgfQorCisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBVUkwgdXJsID0gbmV3IFVSTChtT3JpZ2luYWxVcmwpOworICAgICAgICAgICAgbVRvdWNoSWNvblVybFNlcnZlckRlZmF1bHQgPSBuZXcgVVJMKHVybC5nZXRQcm90b2NvbCgpLCB1cmwuZ2V0SG9zdCgpLCB1cmwuZ2V0UG9ydCgpLAorICAgICAgICAgICAgICAgICAgICAiL2FwcGxlLXRvdWNoLWljb24ucG5nIikudG9TdHJpbmcoKTsKKyAgICAgICAgfSBjYXRjaCAoTWFsZm9ybWVkVVJMRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICB9CisgICAgICAgIHJldHVybiBtVG91Y2hJY29uVXJsU2VydmVyRGVmYXVsdDsKICAgICB9CiAKICAgICAvKioKQEAgLTE3MSwxMSArMTk2LDE0IEBACiAgICAgfQogCiAgICAgLyoqCi0gICAgICogU2V0IHRoZSB0b3VjaCBpY29uIHVybC4KKyAgICAgKiBTZXQgdGhlIHRvdWNoIGljb24gdXJsLiBXaWxsIG5vdCBvdmVyd3JpdGUgYW4gaWNvbiB0aGF0IGhhcyBiZWVuCisgICAgICogc2V0IGFscmVhZHkgZnJvbSBhIDxsaW5rPiB0YWcsIHVubGVzcyB0aGUgbmV3IGljb24gaXMgcHJlY29tcG9zZWQuCiAgICAgICogQGhpZGUKICAgICAgKi8KLSAgICAvKnBhY2thZ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TsKLSAgICAgICAgZmluYWwgU3RyaW5nIGxhbmd1YWdlID0gbG9jYWxlLmdldExhbmd1YWdlKCk7Ci0gICAgICAgIGlmIChsYW5ndWFnZSAhPSBudWxsKSB7Ci0gICAgICAgICAgICBidWZmZXIuYXBwZW5kKGxhbmd1YWdlKTsKLSAgICAgICAgICAgIGZpbmFsIFN0cmluZyBjb3VudHJ5ID0gbG9jYWxlLmdldENvdW50cnkoKTsKLSAgICAgICAgICAgIGlmIChjb3VudHJ5ICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICBidWZmZXIuYXBwZW5kKCItIik7Ci0gICAgICAgICAgICAgICAgYnVmZmVyLmFwcGVuZChjb3VudHJ5KTsKKyAgICAgICAgU3RyaW5nQnVpbGRlciBidWZmZXIgPSBuZXcgU3RyaW5nQnVpbGRlcigpOworICAgICAgICBhZGRMb2NhbGVUb0h0dHBBY2NlcHRMYW5ndWFnZShidWZmZXIsIGxvY2FsZSk7CisKKyAgICAgICAgaWYgKCFMb2NhbGUuVVMuZXF1YWxzKGxvY2FsZSkpIHsKKyAgICAgICAgICAgIGlmIChidWZmZXIubGVuZ3RoKCkgPiAwKSB7CisgICAgICAgICAgICAgICAgYnVmZmVyLmFwcGVuZCgiLCAiKTsKICAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgICAgICBpZiAoIWxvY2FsZS5lcXVhbHMoTG9jYWxlLlVTKSkgewotICAgICAgICAgICAgYnVmZmVyLmFwcGVuZCgiLCAiKTsKLSAgICAgICAgICAgIGphdmEudXRpbC5Mb2NhbGUgdXMgPSBMb2NhbGUuVVM7Ci0gICAgICAgICAgICBpZiAodXMuZ2V0TGFuZ3VhZ2UoKSAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgYnVmZmVyLmFwcGVuZCh1cy5nZXRMYW5ndWFnZSgpKTsKLSAgICAgICAgICAgICAgICBmaW5hbCBTdHJpbmcgY291bnRyeSA9IHVzLmdldENvdW50cnkoKTsKLSAgICAgICAgICAgICAgICBpZiAoY291bnRyeSAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIGJ1ZmZlci5hcHBlbmQoIi0iKTsKLSAgICAgICAgICAgICAgICAgICAgYnVmZmVyLmFwcGVuZChjb3VudHJ5KTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9CisgICAgICAgICAgICBidWZmZXIuYXBwZW5kKEFDQ0VQVF9MQU5HX0ZPUl9VU19MT0NBTEUpOwogICAgICAgICB9CiAKICAgICAgICAgcmV0dXJuIGJ1ZmZlci50b1N0cmluZygpOwogICAgIH0KLSAgICAKKworICAgIC8qKgorICAgICAqIENvbnZlcnQgb2Jzb2xldGUgbGFuZ3VhZ2UgY29kZXMsIGluY2x1ZGluZyBIZWJyZXcvSW5kb25lc2lhbi9ZaWRkaXNoLAorICAgICAqIHRvIG5ldyBzdGFuZGFyZC4KKyAgICAgKi8KKyAgICBwcml2YXRlIHN0YXRpYyBTdHJpbmcgY29udmVydE9ic29sZXRlTGFuZ3VhZ2VDb2RlVG9OZXcoU3RyaW5nIGxhbmdDb2RlKSB7CisgICAgICAgIGlmIChsYW5nQ29kZSA9PSBudWxsKSB7CisgICAgICAgICAgICByZXR1cm4gbnVsbDsKKyAgICAgICAgfQorICAgICAgICBpZiAoIml3Ii5lcXVhbHMobGFuZ0NvZGUpKSB7CisgICAgICAgICAgICAvLyBIZWJyZXcKKyAgICAgICAgICAgIHJldHVybiAiaGUiOworICAgICAgICB9IGVsc2UgaWYgKCJpbiIuZXF1YWxzKGxhbmdDb2RlKSkgeworICAgICAgICAgICAgLy8gSW5kb25lc2lhbgorICAgICAgICAgICAgcmV0dXJuICJpZCI7CisgICAgICAgIH0gZWxzZSBpZiAoImppIi5lcXVhbHMobGFuZ0NvZGUpKSB7CisgICAgICAgICAgICAvLyBZaWRkaXNoCisgICAgICAgICAgICByZXR1cm4gInlpIjsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gbGFuZ0NvZGU7CisgICAgfQorCisgICAgc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wYW5uaW5nIG9yCisgICAgICogem9vbWluZy4KKyAgICAgKi8KKyAgICBwdWJsaWMgYm9vbGVhbiBlbmFibGVTbW9vdGhUcmFuc2l0aW9uKCkgeworICAgICAgICByZXR1cm4gbUVuYWJsZVNtb290aFRyYW5zaXRpb247CisgICAgfQorCisgICAgLyoqCiAgICAgICogU3RvcmUgd2hldGhlciB0aGUgV2ViVmlldyBpcyBzYXZpbmcgZm9ybSBkYXRhLgogICAgICAqLwogICAgIHB1YmxpYyB2b2lkIHNldFNhdmVGb3JtRGF0YShib29sZWFuIHNhdmUpIHsKQEAgLTk4NCw4ICsxMDU0LDggQEAKIAogICAgIHByaXZhdGUgdm9pZCB2ZXJpZnlOZXR3b3JrQWNjZXNzKCkgewogICAgICAgICBpZiAoIW1CbG9ja05ldHdvcmtMb2FkcykgewotICAgICAgICAgICAgaWYgKG1Db250ZXh0LmNoZWNrUGVybWlzc2lvbigiYW5kcm9pZC5wZXJtaXNzaW9uLklOVEVSTkVUIiwgCi0gICAgICAgICAgICAgICAgICAgIGFuZHJvaWQub3MuUHJvY2Vzcy5teVBpZCgpLCBhbmRyb2lkLm9zLlByb2Nlc3MubXlVaWQoKSkgIT0gCisgICAgICAgICAgICBpZiAobUNvbnRleHQuY2hlY2tQZXJtaXNzaW9uKCJhbmRyb2lkLnBlcm1pc3Npb24uSU5URVJORVQiLAorICAgICAgICAgICAgICAgICAgICBhbmRyb2lkLm9zLlByb2Nlc3MubXlQaWQoKSwgYW5kcm9pZC5vcy5Qcm9jZXNzLm15VWlkKCkpICE9CiAgICAgICAgICAgICAgICAgICAgICAgICBQYWNrYWdlTWFuYWdlci5QRVJNSVNTSU9OX0dSQU5URUQpIHsKICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgU2VjdXJpdHlFeGNlcHRpb24KICAgICAgICAgICAgICAgICAgICAgICAgICgiUGVybWlzc2lvbiBkZW5pZWQgLSAiICsKQEAgLTEwMTEsNiArMTA4MSw3IEBACiAgICAgICogQGRlcHJ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yBhcmUgZW5hYmxlZC4KICAgICAgKiBAZGVwcmVjYXRlZCBUaGlzIG1ldGhvZCBoYXMgYmVlbiByZXBsYWNlZCBieSB7QGxpbmsgI2dldFBsdWdpblN0YXRlfQogICAgICAqLworICAgIEBEZXByZWNhdGVkCiAgICAgcHVibGljIHN5bmNocm9uaXplZCBib29sZWFuIGdldFBsdWdpbnNFbmFibGVkKCkgewogICAgICAgICByZXR1cm4gbVBsdWdpblN0YXRlID09IFBsdWdpblN0YXRlLk9OOwogICAgIH0KQEAgLTEyNTYsNyArMTM0MCw3IEBACiAgICAgcHVibGljIHN5bmNocm9uaXplZCB2b2lkIHNldFVzZXJBZ2VudFN0cmluZyhTdHJpbmcgdWEpIHsKICAgICAgICAgaWYgKHVhID09IG51bGwgfHwgdWEubGVuZ3RoKCkgPT0gMCkgewogICAgICAgICAgICAgc3luY2hyb25pemVkKHNMb2NrRm9yTG9jYWxlU2V0dGluZ3MpIHsKLSAgICAgICAgICAgICAgICBMb2NhbGUgY3VycmVudExvY2FsZSA9IExvY2FsZS5nZXREZWZhdWx0KCk7IAorICAgICAgICAgICAgICAgIExvY2FsZSBjdXJyZW50TG9jYWxlID0gTG9jYWxlLmdldERlZmF1bHQoKTsKICAgICAgICAgICAgICAgICBpZiAoIXNMb2NhbGUuZXF1YWxzKGN1cnJlbnRMb2NhbGUpKSB7CiAgICAgICAgICAgICAgICAgICAgIHNMb2NhbGUgPSBjdXJyZW50TG9jYWxlOwogICAgICAgICAgICAgICAgICAgICBtQWNjZXB0TGFuZ3VhZ2UgPSBnZXRDdXJyZW50QWNjZXB0TGFuZ3VhZ2UoKTsKQEAgLTEzMTEsMTEgKzEzOTUsMTEgQEAKICAgICAgICAgfQogICAgICAgICByZXR1cm4gbUFjY2VwdExhbmd1YWdlOwogICAgIH0KLSAgICAKKwogICAgIC8qKgogICAgICAqIFRlbGwgdGhlIFdlYlZpZXcgd2hldGhlciBpdCBuZWVkcyB0byBzZXQgYSBub2RlIHRvIGhhdmU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XJuYXRlbHkgc2hyaW5rcyBhbmQgZXhwYW5kcyBpbWFnZXMgdmlld2VkIG91dHNpZGUKICAgICAgKiBvZiBhbiBIVE1MIHBhZ2UgdG8gZml0IHRoZSBzY3JlZW4uIFRoaXMgY29uZmxpY3RzIHdpdGggYXR0ZW1wdHMgYnkKQEAgLTEzNzksNiArMTQ2Myw0NCBAQAogICAgICAgICB9CiAgICAgIH0KIAorICAgIC8qKgorICAgICAqIFNwZWNpZnkgdGhlIG1heGltdW0gZGVjb2RlZCBpbWFnZSBzaXplLiBUaGUgZGVmYXVsdCBpcworICAgICAqIDIgbWVncyBmb3Igc21hbGwgbWVtb3J5IGRldmljZXMgYW5kIDggbWVncyBmb3IgbGFyZ2UgbWVtb3J5IGRldmljZXMuCisgICAgICogQHBhcmFtIHNpemUgVGhlIG1heGltdW0gZGVjb2RlZCBzaXplLCBvciB6ZXJvIHRvIHNldCB0byB0aGUgZGVmYXVsdC4KKyAgICAgKiBAaGlkZSBwZW5kaW5nIGFwaSBjb3VuY2lsIGFwcHJvdmFsCisgICAgICovCisgICAgcHVibGljIHZvaWQgc2V0TWF4aW11bURlY29kZWRJbWFnZVNpemUobG9uZyBzaXplKSB7CisgICAgICAgIGlmIChtTWF4aW11bURlY29kZWRJbWFnZVNpemUgIT0gc2l6ZSkgeworICAgICAgICAgICAgbU1heGltdW1EZWNvZGVkSW1hZ2VTaXplID0gc2l6ZTsKKyAgICAgICAgICAgIHBvc3RTeW5jKCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBSZXR1cm5zIHdoZXRoZXIgdG8gdXNlIGZpeGVkIHZpZXdwb3J0LgorICAgICAqLworICAgIC8qIHBhY2thZ2UgKi8gYm9vbGVhbiBnZXRVc2VGaXhlZFZpZXdwb3J0KCkgeworICAgICAgICByZXR1cm4gbVVzZUZpeGVkVmlld3BvcnQ7CisgICAgfQorCisgICAgLyoqCisgICAgICogUmV0dXJucyB3aGV0aGVyIHByaXZhdGUgY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kNoYW5nZWQgc2VsU3RhcnQ9IiArIHNlbFN0YXJ0CiAgICAgICAgICAgICAgICAgICAgICAgICArICIgc2VsRW5kPSIgKyBzZWxFbmQpOwpAQCAtNDgxLDkgKzQ5NSwxMCBAQAogICAgICAgICAgICAgLy8gdG8gYmlnIGZvciB0aGUgY2FzZSBvZiBhIHNtYWxsIHRleHRmaWVsZC4KICAgICAgICAgICAgIGludCBzbWFsbGVyU2xvcCA9IHNsb3AvMjsKICAgICAgICAgICAgIGlmIChkeCA+IHNtYWxsZXJTbG9wIHx8IGR5ID4gc21hbGxlclNsb3ApIHsKLSAgICAgICAgICAgICAgICBpZiAobVdlYlZpZXcgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICBmbG9hdCBtYXhTY3JvbGxYID0gKGZsb2F0KSBUb3VjaC5nZXRNYXhTY3JvbGxYKHRoaXMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldExheW91dCgpLCBtU2Nyb2xsWSk7CisgICAgICAgICAgICAgICAgTGF5b3V0IGxheW91dCA9IGdldExheW91dCgpOworICAgICAgICAgICAgICAgIGlmIChtV2ViVmlldyAhPSBudWxsICYmIGxheW91dCAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIGZsb2F0IG1heFNjcm9sbFggPSAoZmxvYXQpIFRvdWNoLmdldE1heFNjcm9sbFgodGhpcywgbGF5b3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1TY3JvbGxZKTsKICAgICAgICAgICAgICAgICAgICAgaWYgKERlYnVnRmxhZ3MuV0VCX1RFWFRfVklFVykgewogICAgICAgICAgICAgICAgICAgICAgICAgTG9nLnYoTE9HVEFHLCAib25Ub3VjaEV2ZW50IHg9IiArIG1TY3JvbGxYICsgIiB5PSIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyBtU2Nyb2xsWSArICIgbWF4WD0iICsgbWF4U2Nyb2xsWCk7CkBAIC02NjcsNiArNjgyLDcgQEAKICAg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Wm9vbUNvbnRyb2xzID0gKFpvb21Db250cm9scykgZmluZFZpZXdCeUlkKAotICAgICAgICAgICAgICAgICAgICBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLmlkLnpvb21Db250cm9scyk7Ci0gICAgICAgICAgICBmaW5kVmlld0J5SWQoY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5pZC56b29tTWFnbmlmeSkuc2V0VmlzaWJpbGl0eSgKLSAgICAgICAgICAgICAgICAgICAgVmlldy5HT05FKTsKLSAgICAgICAgfQotCi0gICAgICAgIHB1YmxpYyB2b2lkIHNob3coYm9vbGVhbiBzaG93Wm9vbSwgYm9vbGVhbiBjYW5ab29tT3V0KSB7Ci0gICAgICAgICAgICBtUGx1c01pbnVzWm9vbUNvbnRyb2xzLnNldFZpc2liaWxpdHkoCi0gICAgICAgICAgICAgICAgICAgIHNob3dab29tID8gVmlldy5WSVNJQkxFIDogVmlldy5HT05FKTsKLSAgICAgICAgICAgIGZhZGUoVmlldy5WSVNJQkxFLCAwLjBmLCAxLjBmKTsKLSAgICAgICAgfQotCi0gICAgICAgIHB1YmxpYyB2b2lkIGhpZGUoKSB7Ci0gICAgICAgICAgICBmYWRlKFZpZXcuR09ORSwgMS4wZiwgMC4wZik7Ci0gICAgICAgIH0KLQotICAgICAgICBwcml2YXRlIHZvaWQgZmFkZShpbnQgdmlzaWJpbGl0eSwgZmxvYXQgc3RhcnRBbHBoYSwgZmxvYXQgZW5kQWxwaGEpIHsKLSAgICAgICAgICAgIEFscGhhQW5pbWF0aW9uIGFuaW0gPSBuZXcgQWxwaGFBbmltYXRpb24oc3RhcnRBbHBoYSwgZW5kQWxwaGEpOwotICAgICAgICAgICAgYW5pbS5zZXREdXJhdGlvbig1MDApOwotICAgICAgICAgICAgc3RhcnRBbmltYXRpb24oYW5pbSk7Ci0gICAgICAgICAgICBzZXRWaXNpYmlsaXR5KHZpc2liaWxpdHkpOwotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIGJvb2xlYW4gaGFzRm9jdXMoKSB7Ci0gICAgICAgICAgICByZXR1cm4gbVBsdXNNaW51c1pvb21Db250cm9scy5oYXNGb2N1cygpOwotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIHZvaWQgc2V0T25ab29tSW5DbGlja0xpc3RlbmVyKE9uQ2xpY2tMaXN0ZW5lciBsaXN0ZW5lcikgewotICAgICAgICAgICAgbVBsdXNNaW51c1pvb21Db250cm9scy5zZXRPblpvb21JbkNsaWNrTGlzdGVuZXIobGlzdGVuZXIpOwotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIHZvaWQgc2V0T25ab29tT3V0Q2xpY2tMaXN0ZW5lcihPbkNsaWNrTGlzdGVuZXIgbGlzdGVuZXIpIHsKLSAgICAgICAgICAgIG1QbHVzTWludXNab29tQ29udHJvbHMuc2V0T25ab29tT3V0Q2xpY2tMaXN0ZW5lcihsaXN0ZW5lcik7Ci0gICAgICAgIH0KLQotICAgICAgICBab29tQ29udHJvbHMgICAgbVBsdXNNaW51c1pvb21Db250cm9sczsKLSAgICB9CisgICAgcHJpdmF0ZSBab29tTWFuYWdlciBtWm9vbU1hbmFnZXI7CiAKICAgICAvKioKICAgICAgKiAgVHJhbnNwb3J0YXRpb24gb2JqZWN0IGZvciByZXR1cm5pbmcgV2ViVmlldyBhY3Jvc3MgdGhyZWFkIGJvdW5kYXJpZXMuCkBAIC0zOTgsNiArMzUzLDggQEAKICAgICAvLyBtb3JlIGtleSBldmVudHMuCiAgICAgcHJpdmF0ZSBpbnQgbVRleHRHZW5lcmF0aW9uOwogCisgICAgLyogcGFja2FnZSAqLyB2b2lkIGluY3JlbWVudFRleHRHZW5lcmF0aW9uKCkgeyBtVGV4dEdlbmVyYXRpb24rKzsgfQorCiAgICAgLy8gVXNlZCBieSBXZWJWaWV3Q29yZSB0byBjcmVhdGUgY2hpbGQgdmlld3MuCiAgICAgLyogcGFja2FnZSAqLyBmaW5hbCBWaWV3TWFuYWdlciBtVmlld01hbmFnZXI7CiAKQ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W50IG1Ub3VjaEhpZ2hsaWdodFg7CisgICAgcHJpdmF0ZSBpbnQgbVRvdWNoSGlnaGxpZ2h0WTsKIAogICAgIC8qCiAgICAgICogUHJpdmF0ZSBtZXNzYWdlIGlkcwpAQCAtNjA2LDcgKzU3Myw3IEBACiAgICAgc3RhdGljIGZpbmFsIGludCBXRUJDT1JFX0lOSVRJQUxJWkVEX01TR19JRCAgICAgICAgID0gMTA3OwogICAgIHN0YXRpYyBmaW5hbCBpbnQgVVBEQVRFX1RFWFRGSUVMRF9URVhUX01TR19JRCAgICAgICA9IDEwODsKICAgICBzdGF0aWMgZmluYWwgaW50IFVQREFURV9aT09NX1JBTkdFICAgICAgICAgICAgICAgICAgPSAxMDk7Ci0gICAgc3RhdGljIGZpbmFsIGludCBNT1ZFX09VVF9PRl9QTFVHSU4gICAgICAgICAgICAgICAgID0gMTEwOworICAgIHN0YXRpYyBmaW5hbCBpbnQgVU5IQU5ETEVEX05BVl9LRVkgICAgICAgICAgICAgICAgICA9IDExMDsKICAgICBzdGF0aWMgZmluYWwgaW50IENMRUFSX1RFWFRfRU5UUlkgICAgICAgICAgICAgICAgICAgPSAxMTE7CiAgICAgc3RhdGljIGZpbmFsIGludCBVUERBVEVfVEVYVF9TRUxFQ1RJT05fTVNHX0lEICAgICAgID0gMTEyOwogICAgIHN0YXRpYyBmaW5hbCBpbnQgU0hPV19SRUNUX01TR19JRCAgICAgICAgICAgICAgICAgICA9IDExMzsKQEAgLTYyMCwxNiArNTg3LDE5IEBACiAgICAgc3RhdGljIGZpbmFsIGludCBTSE9XX0ZVTExTQ1JFRU4gICAgICAgICAgICAgICAgICAgID0gMTIwOwogICAgIHN0YXRpYyBmaW5hbCBpbnQgSElERV9GVUxMU0NSRUVOICAgICAgICAgICAgICAgICAgICA9IDEyMTsKICAgICBzdGF0aWMgZmluYWwgaW50IERPTV9GT0NVU19DSEFOR0VEICAgICAgICAgICAgICAgICAgPSAxMjI7Ci0gICAgc3RhdGljIGZpbmFsIGludCBJTU1FRElBVEVfUkVQQUlOVF9NU0dfSUQgICAgICAgICAgID0gMTIzOwotICAgIHN0YXRpYyBmaW5hbCBpbnQgU0VUX1JPT1RfTEFZRVJfTVNHX0lEICAgICAgICAgICAgICA9IDEyNDsKKyAgICBzdGF0aWMgZmluYWwgaW50IFJFUExBQ0VfQkFTRV9DT05URU5UICAgICAgICAgICAgICAgPSAxMjM7CisgICAgLy8gMTI0OwogICAgIHN0YXRpYyBmaW5hbCBpbnQgUkVUVVJOX0xBQkVMICAgICAgICAgICAgICAgICAgICAgICA9IDEyNTsKICAgICBzdGF0aWMgZmluYWwgaW50IEZJTkRfQUdBSU4gICAgICAgICAgICAgICAgICAgICAgICAgPSAxMjY7CiAgICAgc3RhdGljIGZpbmFsIGludCBDRU5URVJfRklUX1JFQ1QgICAgICAgICAgICAgICAgICAgID0gMTI3OwogICAgIHN0YXRpYyBmaW5hbCBpbnQgUkVRVUVTVF9LRVlCT0FSRF9XSVRIX1NFTEVDVElPTl9NU0dfSUQgPSAxMjg7CiAgICAgc3RhdGljIGZpbmFsIGludCBTRVRfU0NST0xMQkFSX01PREVTICAgICAgICAgICAgICAgID0gMTI5OworICAgIHN0YXRpYyBmaW5hbCBpbnQgU0VMRUNUSU9OX1NUUklOR19DSEFOR0VEICAgICAgICAgICA9IDEzMDsKKyAgICBzdGF0aWMgZmluYWwgaW50IFNFVF9UT1VDSF9ISUdITElHSFRfUkVDVFMgICAgICAgICAgPSAxMzE7CisgICAgc3RhdGljIGZpbmFsIGludCBTQVZFX1dFQkFSQ0hJVkVfRklOSVNIRUQgICAgICAgICAgID0gMTMyOwogCiAgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IEZJUlNUX1BBQ0tBR0VfTVNHX0lEID0gU0NST0xMX1RPX01TR19JRDsKLSAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgTEFTVF9QQUNLQUdFX01TR19JRCA9IFNFVF9TQ1JPTExCQVJfTU9ERVM7CisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IExBU1RfUEFDS0FHRV9NU0dfSUQgPSBTRVRfVE9VQ0hfSElHSExJR0hUX1JFQ1RTOwogCiAgICAgc3RhdGljIGZpbmFsIFN0cmluZ1tdIEhhbmRsZXJQcml2YXRlRGVidWdTdHJpbmcgPSB7CiAgICAgICAgICJSRU1FTUJFUl9QQVNTV09SRCIsIC8vICAgICAgICAgICAgICA9IDE7CkBAIC02NTQsNyArNjI0LDcgQEAKICAgICAgICAgIldFQkNPUkVfSU5JVElBTElaRURfTVNHX0lEIiwgLy8gICAgID0gMTA3OwogICAgICAgICAiVVBEQVRFX1RFWFRGSUVMRF9URVhUX01TR19JRCIsIC8vICAgPSAxMDg7CiAgICAgICAgICJVUERBVEVfWk9PTV9SQU5HRSIsIC8vICAgICAgICAgICAgICA9IDEwOTsKLSAgICAgICAgIk1PVkVfT1VUX09GX1BMVUdJTiIsIC8vICAgICAgICAgICAgID0gMTEwOworICAgICAgICAiVU5IQU5ETEVEX05BVl9LRVkiLCAvLyAgICAgICAgICAgICAgPSAxMTA7CiAgICAgICAgICJDTEVBUl9URVhUX0VOVFJZIiwgLy8gICAgICAgICAgICAgICA9IDExMTsKICAgICAgICAgIlVQREFURV9URVhUX1NFTEVDVElPTl9NU0dfSUQiLCAvLyAgID0gMTEyOwogICAgICAgICAiU0hPV19SRUNUX01TR19JRCIsIC8vICAgICAgICAgICAgICAgPSAxMTM7CkBAIC02NjcsMTggKzYzNywyMSBAQAogICAgICAgICAiU0hPV19GVUxMU0NSRUVOIiwgLy8gICAgICAgICAgICAgICAgPSAxMjA7CiAgICAgICAgICJISURFX0ZVTExTQ1JFRU4iLCAvLyAgICAgICAgICAgICAgICA9IDEyMTsKICAgICAgICAgIkRPTV9GT0NVU19DSEFOR0VEIiwgLy8gICAgICAgICAgICAgID0gMTIyOwotICAgICAgICAiSU1NRURJQVRFX1JFUEFJTlRfTVNHX0lEIiwgLy8gICAgICAgPSAxMjM7Ci0gICAgICAgICJTRVRfUk9PVF9MQVlFUl9NU0dfSUQiLCAvLyAgICAgICAgICA9IDEyNDsKKyAgICAgICAgIlJFUExBQ0VfQkFTRV9DT05URU5UIiwgLy8gICAgICAgICAgID0gMTIzOworICAgICAgICAiMTI0IiwgLy8gICAgICAgICAgICAgICAgICAgICAgICAgICAgPSAxMjQ7CiAgICAgICAgICJSRVRVUk5fTEFCRUwiLCAvLyAgICAgICAgICAgICAgICAgICA9IDEyNTsKICAgICAgICAgIkZJTkRfQUdBSU4iLCAvLyAgICAgICAgICAgICAgICAgICAgID0gMTI2OwogICAgICAgICAiQ0VOVEVSX0ZJVF9SRUNUIiwgLy8gICAgICAgICAgICAgICAgPSAxMjc7CiAgICAgICAgICJSRVFVRVNUX0tFWUJPQVJEX1dJVEhfU0VMRUNUSU9OX01TR19JRCIsIC8vID0gMTI4OwotICAgICAgICAiU0VUX1NDUk9MTEJBUl9NT0RFUyIgLy8gICAgICAgICAgICAgPSAxMjk7CisgICAgICAgICJTRVRfU0NST0xMQkFSX01PREVTIiwgLy8gICAgICAgICAgICA9IDEyOTsKKyAgICAgICAgIlNFTEVDVElPTl9TVFJJTkdfQ0hBTkdFRCIsIC8vICAgICAgID0gMTMwOworICAgICAgICAiU0VUX1RPVUNIX0hJR0hMSUdIVF9SRUNUUyIsIC8vICAgICAgPSAxMzE7CisgICAgICAgICJTQVZFX1dFQkFSQ0hJVkVfRklOSVNIRUQiIC8vICAgICAgICA9IDEzMjsKICAgICB9OwogCiAgICAgLy8gSWYgdGhlIHNpdGUgZG9lc24ndCB1c2UgdGhlIHZpZXdwb3J0IG1ldGEgdGFnIHRvIHNwZWNpZnkgdGhlIHZpZXdwb3J0LAogICAgIC8vIHVzZSBERUZBVUxUX1ZJRVdQT1JUX1dJRFRIIGFzIHRoZSBkZWZhdWx0IHZpZXdwb3J0IHdpZHRoCi0gICAgc3RhdGljIGZpbmFsIGludCBERUZBVUxUX1ZJRVdQT1JUX1dJRFRIID0gODAwOworICAgIHN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21CdXR0b25zQ29udHJvbGxlci5nZXRab29tQ29udHJvbHMoKS5zZXRWaXNpYmlsaXR5KAotICAgICAgICAgICAgICAgICAgICAgICAgVmlldy5WSVNJQkxFKTsKLSAgICAgICAgICAgICAgICB1cGRhdGVab29tQnV0dG9uc0VuYWJsZWQoKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCi0gICAgICAgIHB1YmxpYyB2b2lkIG9uWm9vbShib29sZWFuIHpvb21JbikgewotICAgICAgICAgICAgaWYgKHpvb21JbikgewotICAgICAgICAgICAgICAgIHpvb21JbigpOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICB6b29tT3V0KCk7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIHVwZGF0ZVpvb21CdXR0b25zRW5hYmxlZCgpOwotICAgICAgICB9Ci0gICAgfTsKLQogICAgIC8qKgogICAgICAqIENvbnN0cnVjdCBhIG5ldyBXZWJWaWV3IHdpdGggYSBDb250ZXh0IG9iamVjdC4KICAgICAgKiBAcGFyYW0gY29udGV4dCBBIENvbnRleHQgb2JqZWN0IHVzZWQgdG8gYWNjZXNzIGFwcGxpY2F0aW9uIGFzc2V0cy4KQEAgLTkxNyw3ICs4MjYsMTggQEAKICAgICAgKiBAcGFyYW0gZGVmU3R5bGUgVGhlIGRlZmF1bHQgc3R5bGUgcmVzb3VyY2UgSUQuCiAgICAgICovCiAgICAgcHVibGljIFdlYlZpZXcoQ29udGV4dCBjb250ZXh0LCBBdHRyaWJ1dGVTZXQgYXR0cnMsIGludCBkZWZTdHlsZSkgewotICAgICAgICB0aGlzKGNvbnRleHQsIGF0dHJzLCBkZWZTdHlsZSwgbnVsbCk7CisgICAgICAgIHRoaXMoY29udGV4dCwgYXR0cnMsIGRlZlN0eWxlLCBmYWxzZSk7CisgICAgfQorCisgICAgLyoqCisgICAgICogQ29uc3RydWN0IGEgbmV3IFdlYlZpZXcgd2l0aCBsYXlvdXQgcGFyYW1ldGVycyBhb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VSRkFDRSkpIHsKKyAgICAgICAgICAgIExvZy53KExPR1RBRywgIkphdmFTY3JpcHQgaW50ZXJmYWNlIG1hcHBlZCB0byBcIiIgKyBBTElBU19BQ0NFU1NJQklMSVRZX0pTX0lOVEVSRkFDRQorICAgICAgICAgICAgICAgICAgICArICJcIiBvdmVycmlkZXMgdGhlIGFjY2Vzc2liaWxpdHkgQVBJIEphdmFTY3JpcHQgaW50ZXJmYWNlLiBObyBhY2Nlc3NpYmlsaXR5IgorICAgICAgICAgICAgICAgICAgICArICJBUEkgd2lsbCBiZSBleHBvc2VkIHRvIEphdmFTY3JpcHQhIik7CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKworICAgICAgICAvLyBleHBvc2UgdGhlIFRUUyBmb3Igbm93IC4uLgorICAgICAgICBqYXZhc2NyaXB0SW50ZXJmYWNlcy5wdXQoQUxJQVNfQUNDRVNTSUJJTElUWV9KU19JTlRFUkZBQ0UsCisgICAgICAgICAgICAgICAgbmV3IFRleHRUb1NwZWVjaChnZXRDb250ZXh0KCksIG51bGwpKTsKICAgICB9CiAKICAgICAvKiBwYWNrYWdlICovdm9pZCB1cGRhdGVEZWZhdWx0Wm9vbURlbnNpdHkoaW50IHpvb21EZW5zaXR5KSB7Ci0gICAgICAgIGZpbmFsIGZsb2F0IGRlbnNpdHkgPSBnZXRDb250ZXh0KCkuZ2V0UmVzb3VyY2VzKCkuZ2V0RGlzcGxheU1ldHJpY3MoKS5kZW5zaXR5CisgICAgICAgIGZpbmFsIGZsb2F0IGRlbnNpdHkgPSBtQ29udGV4dC5nZXRSZXNvdXJjZXMoKS5nZXREaXNwbGF5TWV0cmljcygpLmRlbnNpdHkKICAgICAgICAgICAgICAgICAqIDEwMCAvIHpvb21EZW5zaXR5OwotICAgICAgICBpZiAoTWF0aC5hYnMoZGVuc2l0eSAtIG1EZWZhdWx0U2NhbGUpID4gMC4wMSkgewotICAgICAgICAgICAgZmxvYXQgc2NhbGVGYWN0b3IgPSBkZW5zaXR5IC8gbURlZmF1bHRTY2FsZTsKLSAgICAgICAgICAgIC8vIGFkanVzdCB0aGUgbGltaXRzCi0gICAgICAgICAgICBtTmF2U2xvcCA9IChpbnQpICgxNiAqIGRlbnNpdHkpOwotICAgICAgICAgICAgREVGQVVMVF9TQ0FMRV9QRVJDRU5UID0gKGludCkgKDEwMCAqIGRlbnNpdHkpOwotICAgICAgICAgICAgREVGQVVMVF9NQVhfWk9PTV9TQ0FMRSA9IDQuMGYgKiBkZW5zaXR5OwotICAgICAgICAgICAgREVGQVVMVF9NSU5fWk9PTV9TQ0FMRSA9IDAuMjVmICogZGVuc2l0eTsKLSAgICAgICAgICAgIG1EZWZhdWx0U2NhbGUgPSBkZW5zaXR5OwotICAgICAgICAgICAgbU1heFpvb21TY2FsZSAqPSBzY2FsZUZhY3RvcjsKLSAgICAgICAgICAgIG1NaW5ab29tU2NhbGUgKj0gc2NhbGVGYWN0b3I7Ci0gICAgICAgICAgICBzZXROZXdab29tU2NhbGUobUFjdHVhbFNjYWxlICogc2NhbGVGYWN0b3IsIHRydWUsIGZhbHNlKTsKLSAgICAgICAgfQorICAgICAgICBtTmF2U2xvcCA9IChpbnQpICgxNiAqIGRlbnNpdHkpOworICAgICAgICBtWm9vbU1hbmFnZXIudXBkYXRlRGVmYXVsdFpvb21EZW5zaXR5KGRlbnNpdHkpOwogICAgIH0KIAogICAgIC8qIHBhY2thZ2UgKi8gYm9vbGVhbiBvblNhdmVQYXNzd29yZChTdHJpbmcgc2NoZW1lUGx1c0hvc3QsIFN0cmluZyB1c2VybmFtZSwKQEAgLTExMzYsMTQgKzEwNTAsMTYgQEAKICAgICAgKiByZXR1cm5zIHRoZSBoZWlnaHQgb2YgdGhlIHRpdGxlYmFydmlldyAoaWYgYW55KS4gRG9lcyBub3QgY2FyZSBhYm91dAogICAgICAqIHNjcm9sbGluZwogICAgICAqLwotICAgIHByaXZhdGUgaW50IGdldFRpdGxlSGVpZ2h0KCkgeworICAgIGludCBnZXRUaXRsZU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gICAgKi8KKyAgICBwdWJsaWMgYm9vbGVhbiBpc1ByaXZhdGVCcm93c2luZ0VuYWJsZWQgKCkgeworICAgICAgICByZXR1cm4gZ2V0U2V0dGluZ3MoKS5pc1ByaXZhdGVCcm93c2luZ0VuYWJsZWQoKTsKKyAgICB9CisKKyAgICBwcml2YXRlIHZvaWQgc3RhcnRQcml2YXRlQnJvd3NpbmcgKCkgeworICAgICAgICBib29sZWFuIHdhc1ByaXZhdGVCcm93c2luZ0VuYWJsZWQgPSBpc1ByaXZhdGVCcm93c2luZ0VuYWJsZWQoKTsKKworICAgICAgICBnZXRTZXR0aW5ncygpLnNldFByaXZhdGVCcm93c2luZ0VuYWJsZWQodHJ1ZSk7CisKKyAgICAgICAgaWYgKCF3YXNQcml2YXRlQnJvd3NpbmdFbmFibGVkKSB7CisgICAgICAgICAgICBTdHJpbmdCdWlsZGVyIGRhdGEgPSBuZXcgU3RyaW5nQnVpbGRlcigxMDI0KTsKKyAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgSW5wdXRTdHJlYW1SZWFkZXIgZmlsZSA9IG5ldyBJbnB1dFN0cmVhbVJlYWRlcihtQ29udGV4dC5nZXRSZXNvdXJjZXMoKS5vcGVuUmF3UmVzb3VyY2UoY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5yYXcuaW5jb2duaXRvX21vZGVfc3RhcnRfcGFnZSkpOworICAgICAgICAgICAgICAgIGludCBzaXplOworICAgICAgICAgICAgICAgIGNoYXJbXSBidWZmZXIgPSBuZXcgY2hhclsxMDI0XTsKKyAgICAgICAgICAgICAgICB3aGlsZSAoKHNpemUgPSBmaWxlLnJlYWQoYnVmZmVyKSkgIT0gLTEpIHsKKyAgICAgICAgICAgICAgICAgICAgZGF0YS5hcHBlbmQoYnVmZmVyLCAwLCBzaXplKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9IGNhdGNoIChJT0V4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgLy8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dldFNjYWxlKCk7CiAgICAgfQogCiAgICAgLyoqCkBAIC0xODYxLDcgKzE4MzgsNyBAQAogICAgICAqIEBwYXJhbSBzY2FsZUluUGVyY2VudCBUaGUgaW5pdGlhbCBzY2FsZSBpbiBwZXJjZW50LgogICAgICAqLwogICAgIHB1YmxpYyB2b2lkIHNldEluaXRpYWxTY2FsZShpbnQgc2NhbGVJblBlcmNlbnQpIHsKLSAgICAgICAgbUluaXRpYWxTY2FsZUluUGVyY2VudCA9IHNjYWxlSW5QZXJjZW50OworICAgICAgICBtWm9vbU1hbmFnZXIuc2V0SW5pdGlhbFNjYWxlSW5QZXJjZW50KHNjYWxlSW5QZXJjZW50KTsKICAgICB9CiAKICAgICAvKioKQEAgLTE4NzQsMTQgKzE4NTEsOCBAQAogICAgICAgICAgICAgTG9nLncoTE9HVEFHLCAiVGhpcyBXZWJWaWV3IGRvZXNuJ3Qgc3VwcG9ydCB6b29tLiIpOwogICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICB9Ci0gICAgICAgIGNsZWFyVGV4dEVudHJ5KGZhbHNlKTsKLSAgICAgICAgaWYgKGdldFNldHRpbmdzKCkuZ2V0QnVpbHRJblpvb21Db250cm9scygpKSB7Ci0gICAgICAgICAgICBnZXRab29tQnV0dG9uc0NvbnRyb2xsZXIoKS5zZXRWaXNpYmxlKHRydWUpOwotICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgbVByaXZhdGVIYW5kbGVyLnJlbW92ZUNhbGxiYWNrcyhtWm9vbUNvbnRyb2xSdW5uYWJsZSk7Ci0gICAgICAgICAgICBtUHJpdmF0ZUhhbmRsZXIucG9zdERlbGF5ZWQobVpvb21Db250cm9sUnVubmFibGUsCi0gICAgICAgICAgICAgICAgICAgIFpPT01fQ09OVFJPTFNfVElNRU9VVCk7Ci0gICAgICAgIH0KKyAgICAgICAgY2xlYXJUZXh0RW50cnkoKTsKKyAgICAgICAgbVpvb21NYW5hZ2VyLmludm9rZVpvb21QaWNrZXIoKTsKICAgICB9CiAKICAgICAvKioKQEAgLTE5OTYsNyArMTk2Nyw3IEBACiAgICAgICAgIG1zZy5zZW5kVG9UYXJnZXQoKTsKICAgICB9CiAKLSAgICBwcml2YXRlIHN0YXRpYyBpbnQgcGluTG9jKGludCB4LCBpbnQgdmlld01heCwgaW50IGRvY01heCkgeworICAgIHN0YXRpYyBpbnQgcGluTG9jKGludCB4LCBpbnQgdmlld01heCwgaW50IGRvY01heCkgewogLy8gICAgICAgIExvZy5kKExPR1RBRywgIi0tIHBpbkxvYyAiICsgeCArICIgIiArIHZpZXdNYXggKyAiICIgKyBkb2NNYXgpOwogICAgICAgICBpZiAoZG9jTWF4IDwgdmlld01heCkgeyAgIC8vIHRoZSBkb2MgaGFzIHJvb20gb24gdGhlIHNpZGVzIGZvciAiYmxhbmsiCiAgICAgICAgICAgICAvLyBwaW4gdGhlIHNob3J0IGRvY3VtZW50IHRvIHRoZSB0b3AvbGVmdCBvZiB0aGUgc2NyZWVuCkBAIC0yMDEzLDEyICsxOTg0LDEyIEBACiAgICAgfQogCiAgICAgLy8gRXhwZWN0cyB4IGluIHZpZXcgY29vcmRpbmF0ZXMKLSAgICBwcml2YXRlIGludCBwaW5Mb2NYKGludCB4KSB7CisgICAgaW50IHBpbkxvY1goaW50IHgpIHsKICAgICAgICAgcmV0dXJuIHBpbkxvYyh4LCBnZXRWaWV3V2lkdGgoKSwgY29tcHV0ZUhvcml6b250YWxTY3JvbGxSYW5nZSgpKTsKICAgICB9CiAKICAgICAvLyBFeHBlY3RzIHkgaW4gdmlldyBjb29yZGluYXRlcwotICAgIHByaXZhdGUgaW50IHBpbkxvY1koaW50IHkpIHsKKyAgICBpbnQgcGluTG9jWShpbnQgeSkgewogICAgICAgICByZXR1cm4gcGluTG9jKHksIGdldFZpZXdIZWlnaHRXaXRoVGl0bGUoKSwKICAgICAgICAgICAgICAgICAgICAgICBjb21wdXRlVmVydGljYWxTY3JvbGxSYW5nZSgpICsgZ2V0VGl0bGVIZWlnaHQoKSk7CiAgICAgfQpAQCAtMjA2OCw3ICsyMDM5LDcgQEAKICAgICAgKiBoZWlnaHQuCiAgICAgICovCiAgICAgcHJpdmF0ZSBpbnQgdmlld1RvQ29udGVudERpbWVuc2lvbihpbnQgZCkgewotICAgICAgICByZXR1cm4gTWF0aC5yb3VuZChkICogbUludkFjdHVhbFNjYWxlKTsKKyAgICAgICAgcmV0dXJuIE1hdGgucm91bmQoZCAqIG1ab29tTWFuYWdlci5nZXRJbnZTY2FsZSgpKTsKICAgICB9CiAKICAgICAvKioKQEAgLTIwOTQsNyArMjA2NSw3IEBACiAgICAgICogUmV0dXJucyB0aGUgcmVzdWx0IGFzIGEgZmxvYXQuCiAgICAgICovCiAgICAgcHJpdmF0ZSBmbG9hdCB2aWV3VG9Db250ZW50WGYoaW50IHgpIHsKLSAgICAgICAgcmV0dXJuIHggKiBtSW52QWN0dWFsU2NhbGU7CisgICAgICAgIHJldHVybiB4ICogbVpvb21NYW5hZ2VyLmdldEludlNjYWxlKCk7CiAgICAgfQogCiAgICAgLyoqCkBAIC0yMTAzLDcgKzIwNzQsNyBAQAogICAgICAqIGVtYmVkZGVkIGludG8gdGhlIFdlYlZpZXcuIFJldHVybnMgdGhlIHJlc3VsdCBhcyBhIGZsb2F0LgogICAgICAqLwogICAgIHByaXZhdGUgZmxvYXQgdmlld1RvQ29udGVudFlmKGludCB5KSB7Ci0gICAgICAgIHJldHVybiAoeSAtIGdldFRpdGxlSGVpZ2h0KCkpICogbUludkFjdHVhbFNjYWxlOworICAgICAgICByZXR1cm4gKHkgLSBnZXRUaXRsZUhlaWdodCgpKSAqIG1ab29tTWFuYWdlci5nZXRJbnZTY2FsZSgpOwogICAgIH0KIAogICAgIC8qKgpAQCAtMjExMyw3ICsyMDg0LDcgQEAKICAgICAgKiBoZWlnaHQuCiAgICAgICovCiAgICAgLypwYWNrYWdlKi8gaW50IGNvbnRlbnRUb1ZpZXdEaW1lbnNpb24oaW50IGQpIHsKLSAgICAgICAgcmV0dX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NYW5hZ2VyLmdldFNjYWxlKCk7CiAgICAgICAgIGZpbmFsIGludCBkeSA9IGdldFRpdGxlSGVpZ2h0KCk7CiAgICAgICAgIHBvc3RJbnZhbGlkYXRlRGVsYXllZChkZWxheSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChpbnQpTWF0aC5mbG9vcihsICogc2NhbGUpLApAQCAtMjIwMywxMyArMjE3NCw3IEBACiAgICAgICAgICAgICAvLyB1cGRhdGVkIHdoZW4gd2UgZ2V0IG91dCBvZiB0aGF0IG1vZGUuCiAgICAgICAgICAgICBpZiAoIW1EcmF3SGlzdG9yeSkgewogICAgICAgICAgICAgICAgIC8vIHJlcGluIG91ciBzY3JvbGwsIHRha2luZyBpbnRvIGFjY291bnQgdGhlIG5ldyBjb250ZW50IHNpemUKLSAgICAgICAgICAgICAgICBpbnQgb2xkWCA9IG1TY3JvbGxYOwotICAgICAgICAgICAgICAgIGludCBvbGRZID0gbVNjcm9sbFk7Ci0gICAgICAgICAgICAgICAgbVNjcm9sbFggPSBwaW5Mb2NYKG1TY3JvbGxYKTsKLSAgICAgICAgICAgICAgICBtU2Nyb2xsWSA9IHBpbkxvY1kobVNjcm9sbFkpOwotICAgICAgICAgICAgICAgIGlmIChvbGRYICE9IG1TY3JvbGxYIHx8IG9sZFkgIT0gbVNjcm9sbFkpIHsKLSAgICAgICAgICAgICAgICAgICAgb25TY3JvbGxDaGFuZ2VkKG1TY3JvbGxYLCBtU2Nyb2xsWSwgb2xkWCwgb2xkWSk7Ci0gICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHVwZGF0ZVNjcm9sbENvb3JkaW5hdGVzKHBpbkxvY1gobVNjcm9sbFgpLCBwaW5Mb2NZKG1TY3JvbGxZKSk7CiAgICAgICAgICAgICAgICAgaWYgKCFtU2Nyb2xsZXIuaXNGaW5pc2hlZCgpKSB7CiAgICAgICAgICAgICAgICAgICAgIC8vIFdlIGFyZSBpbiB0aGUgbWlkZGxlIG9mIGEgc2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ICAgICAgICAgICAgICAgICAgICogKG1ab29tQ2VudGVyWSAtIGdldFRpdGxlSGVpZ2h0KCkpOwotCi0gICAgICAgICAgICAgICAgLy8gbm93IHVwZGF0ZSBvdXIgbmV3IHNjYWxlIGFuZCBpbnZlcnNlCi0gICAgICAgICAgICAgICAgaWYgKHNjYWxlICE9IG1BY3R1YWxTY2FsZSAmJiAhbVByZXZpZXdab29tT25seSkgewotICAgICAgICAgICAgICAgICAgICBtQ2FsbGJhY2tQcm94eS5vblNjYWxlQ2hhbmdlZChtQWN0dWFsU2NhbGUsIHNjYWxlKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgbUFjdHVhbFNjYWxlID0gc2NhbGU7Ci0gICAgICAgICAgICAgICAgbUludkFjdHVhbFNjYWxlID0gMSAvIHNjYWxlOwotCi0gICAgICAgICAgICAgICAgLy8gU2NhbGUgYWxsIHRoZSBjaGlsZCB2aWV3cwotICAgICAgICAgICAgICAgIG1WaWV3TWFuYWdlci5zY2FsZUFsbCgpOwotCi0gICAgICAgICAgICAgICAgLy8gYXMgd2UgZG9uJ3QgaGF2ZSBhbmltYXRpb24gZm9yIHNjYWxpbmcsIGRvbid0IGRvIGFuaW1hdGlvbgotICAgICAgICAgICAgICAgIC8vIGZvciBzY3JvbGxpbmcsIGFzIGl0IGNhdXNlcyB3ZWlyZCBpbnRlcm1lZGlhdGUgc3RhdGUKLSAgICAgICAgICAgICAgICAvLyAgICAgICAgcGluU2Nyb2xsVG8oTWF0aC5yb3VuZChzeCksIE1hdGgucm91bmQoc3kpKTsKLSAgICAgICAgICAgICAgICBtU2Nyb2xsWCA9IHBpbkxvY1goTWF0aC5yb3VuZChzeCkpOwotICAgICAgICAgICAgICAgIG1TY3JvbGxZID0gcGluTG9jWShNYXRoLnJvdW5kKHN5KSk7Ci0KLSAgICAgICAgICAgICAgICAvLyB1cGRhdGUgd2Via2l0Ci0gICAgICAgICAgICAgICAgaWYgKG9sZFggIT0gbVNjcm9sbFgg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mU7CisgICAgICAgICAgICBkYXRhLm1BbmNob3JYID0gbVpvb21NYW5hZ2VyLmdldERvY3VtZW50QW5jaG9yWCgpOworICAgICAgICAgICAgZGF0YS5tQW5jaG9yWSA9IG1ab29tTWFuYWdlci5nZXREb2N1bWVudEFuY2hvclkoKTsKICAgICAgICAgICAgIG1XZWJWaWV3Q29yZS5zZW5kTWVzc2FnZShFdmVudEh1Yi5WSUVXX1NJWkVfQ0hBTkdFRCwgZGF0YSk7CiAgICAgICAgICAgICBtTGFzdFdpZHRoU2VudCA9IG5ld1dpZHRoOwogICAgICAgICAgICAgbUxhc3RIZWlnaHRTZW50ID0gbmV3SGVpZ2h0OwotICAgICAgICAgICAgbUFuY2hvclggPSBtQW5jaG9yWSA9IDA7CisgICAgICAgICAgICBtWm9vbU1hbmFnZXIuY2xlYXJEb2N1bWVudEFuY2hvcigpOwogICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgIH0KICAgICAgICAgcmV0dXJuIGZhbHNlOwpAQCAtMjQxOCwxMiArMjMxOSwxMiBAQAogICAgICAgICBpZiAobURyYXdIaXN0b3J5KSB7CiAgICAgICAgICAgICByZXR1cm4gbUhpc3RvcnlXaWR0aDsKICAgICAgICAgfSBlbHNlIGlmIChtSG9yaXpvbnRhbFNjcm9sbEJhck1vZGUgPT0gU0NST0xMQkFSX0FMV0FZU09GRgotICAgICAgICAgICAgICAgICYmIChtQWN0dWFsU2NhbGUgLSBtTWluWm9vbVNjYWxlIDw9IE1JTklNVU1fU0NBTEVfSU5DUkVNRU5UKSkgeworICAgICAgICAgICAgICAgICYmICFtWm9vbU1hbmFnZXIuY2FuWm9vbU91dCgpKSB7CiAgICAgICAgICAgICAvLyBvbmx5IGhvbm9yIHRoZSBzY3JvbGxiYXIgbW9kZSB3aGVuIGl0IGlzIGF0IG1pbmltdW0gem9vbSBsZXZlbAogICAgICAgICAgICAgcmV0dXJuIGNvbXB1dGVIb3Jpem9udGFsU2Nyb2xsRXh0ZW50KCk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jdHVhbFNjYWxlKTsKKyAgICAgICAgICAgIHJldHVybiAoaW50KSBNYXRoLmZsb29yKG1Db250ZW50SGVpZ2h0ICogbVpvb21NYW5hZ2VyLmdldFNjYWxlKCkpOwogICAgICAgICB9CiAgICAgfQogCkBAIC0yNTA1LDcgKzI0MDYsOSBAQAogICAgIH0KIAogICAgIC8qKgotICAgICAqIEdldCB0aGUgdG91Y2ggaWNvbiB1cmwgZm9yIHRoZSBhcHBsZS10b3VjaC1pY29uIDxsaW5rPiBlbGVtZW50LgorICAgICAqIEdldCB0aGUgdG91Y2ggaWNvbiB1cmwgZm9yIHRoZSBhcHBsZS10b3VjaC1pY29uIDxsaW5rPiBlbGVtZW50LCBvcgorICAgICAqIGEgVVJMIG9uIHRoaXMgc2l0ZSdzIHNlcnZlciBwb2ludGluZyB0byB0aGUgc3RhbmRhcmQgbG9jYXRpb24gb2YgYQorICAgICAqIHRvdWNoIGljb24uCiAgICAgICogQGhpZGUKICAgICAgKi8KICAgICBwdWJsaWMgU3RyaW5nIGdldFRvdWNoSWNvblVybCgpIHsKQEAgLTI2ODIsMTkgKzI1ODUsMjIgQEAKICAgICAgKi8KICAgICBwdWJsaWMgdm9pZCBzZXRGaW5kSXNVcChib29sZWFuIGlzVXApIHsKICAgICAgICAgbUZpbmRJc1VwID0gaXNVcDsKLSAgICAgICAgaWYgKGlzVXApIHsKLSAgICAgICAgICAgIHJlY29yZE5ld0NvbnRlbnRTaXplKG1Db250ZW50V2lkdGgsIG1Db250ZW50SGVpZ2h0ICsgbUZpbmRIZWlnaHQsCi0gICAgICAgICAgICAgICAgICAgIGZhbHNlKTsKLSAgICAgICAgfQogICAgICAgICBpZiAoMCA9PSBtTmF0aXZlQ2xhc3MpIHJldHVybjsgLy8gY2xpZW50IGlzbid0IGluaXRpYWxpemVkCiAgICAgICAgIG5hdGl2ZVNldEZpbmRJc1VwKGlzVXApOwogICAgIH0KIAorICAgIC8qKgorICAgICAqIEBoaWRlCisgICAgICovCisgICAgcHV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mVsb2FkcworICAgICAgICAgICAgbUFjY2Vzc2liaWxpdHlJbmplY3RvciA9IG51bGw7CisgICAgICAgIH0KICAgICB9CiAKICAgICAvKioKQEAgLTMwMTQsNyArMjk0Niw3IEBACiAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAvLyBJZiB3ZSBkb24ndCByZXF1ZXN0IGEgbGF5b3V0LCB0cnkgdG8gc2VuZCBvdXIgdmlldyBzaXplIHRvIHRoZQogICAgICAgICAgICAgLy8gbmF0aXZlIHNpZGUgdG8gZW5zdXJlIHRoYXQgV2ViQ29yZSBoYXMgdGhlIGNvcnJlY3QgZGltZW5zaW9ucy4KLSAgICAgICAgICAgIHNlbmRWaWV3U2l6ZVpvb20oKTsKKyAgICAgICAgICAgIHNlbmRWaWV3U2l6ZVpvb20oZmFsc2UpOwogICAgICAgICB9CiAgICAgfQogCkBAIC0zMTQ0LDcgKzMwNzYsNyBAQAogICAgICAqICAgICAgICAgc2V0dGluZ3MuCiAgICAgICovCiAgICAgcHVibGljIFdlYlNldHRpbmdzIGdldFNldHRpbmdzKCkgewotICAgICAgICByZXR1cm4gbVdlYlZpZXdDb3JlLmdldFNldHRpbmdzKCk7CisgICAgICAgIHJldHVybiAobVdlYlZpZXdDb3JlICE9IG51bGwpID8gbVdlYlZpZXdDb3JlLmdldFNldHRpbmdzKCkgOiBudWxsOwogICAgIH0KIAogICAgIC8qKgpAQCAtMzI4NSw3ICszMjE3LDQ3IEBACiAgICAgICAgIGlmIChBVVRPX1JFRFJBV19IQUNLICYmIG1BdXRvUmVkcmF3KSB7CiAgICAgICAgICAgICBpbnZhbGlkYXRlKCk7CiAgICAgICAgIH0KKyAgICAgICAgaWYgKGluRWRpdGluZ01vZGUoKSkgbVdlYlRleHRWaWV3Lm9uRHJhd1N1YnN0aXR1dGUoKTsKICAgICAgICAgbVdlYlZpZXdDb3JlLnNpZ25hbFJlcGFpbnREb25lKCk7CisKKyAgICAgICAgLy8gcGFpbnQgdGhlIGhpZ2hsaWdodCBpbiB0aGUgZW5kCisgICAgICAgIGlmICghbVRvdWNoSGlnaGxpZ2h0UmVnaW9uLmlzRW1wdHkoKSkgeworICAgICAgICAgICAgaWYgKG1Ub3VjaEhpZ2h0bGlnaHRQYWludCA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgbVRvdWNoSGlnaHRsaWdodFBhaW50ID0gbmV3IFBhaW50KCk7CisgICAgICAgICAgICAgICAgbVRvdWNoSGlnaHRsaWdodFBhaW50LnNldENvbG9yKG1IaWdodGxpZ2h0Q29sb3IpOworICAgICAgICAgICAgICAgIG1Ub3VjaEhpZ2h0bGlnaHRQYWludC5zZXRBbnRpQWxpYXModHJ1ZSk7CisgICAgICAgICAgICAgICAgbVRvdWNoSGlnaHRsaWdodFBhaW50LnNldFBhdGhFZmZlY3QobmV3IENvcm5lclBhdGhFZmZlY3QoCisgICAgICAgICAgICAgICAgICAgICAgICBUT1VDSF9ISUdITElHSFRfQVJDKSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYW52YXMuZHJhd1BhdGgobVRvdWNoSGlnaGxpZ2h0UmVnaW9uLmdldEJvdW5kYXJ5UGF0aCgpLAorICAgICAgICAgICAgICAgICAgICBtVG91Y2hIaWdodGxpZ2h0UGFpbnQpOworICAgICAgICB9CisgICAgICAgIGlmIChERUJVR19UT1VDSF9ISUdITElHSFQpIHsKKyAgICAgICAgICAgIGlmIChnZXRTZXR0aW5ncygpLmdldE5hdkR1bXAoKSkgeworICAgICAgICAgICAgICAgIGlmICgobVRvdWNoSGlnaGxpZ2h0WCB8IG1Ub3VjaEhpZ2hsaWdodFkpICE9IDApIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKG1Ub3VjaENyb3NzSGFpckNvbG9yID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1Ub3VjaENyb3NzSGFpckNvbG9yID0gbmV3IFBhaW50KCk7CisgICAgICAgICAgICAgICAgICAgICAgICBtVG91Y2hDcm9zc0hhaXJDb2xvci5zZXRDb2xvcihDb2xvci5SRUQpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGNhbnZhcy5kcmF3TGluZShtVG91Y2hIaWdobGlnaHRYIC0gbU5hdlNsb3AsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVRvdWNoSGlnaGxpZ2h0WSAtIG1OYXZTbG9wLCBtVG91Y2hIaWdobGlnaHRYCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIG1OYXZTbG9wICsgMSwgbVRvdWNoSGlnaGxpZ2h0WSArIG1OYXZTbG9wCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIDEsIG1Ub3VjaENyb3NzSGFpckNvbG9yKTsKKyAgICAgICAgICAgICAgICAgICAgY2FudmFzLmRyYXdMaW5lKG1Ub3VjaEhpZ2hsaWdodFggKyBtTmF2U2xvcCArIDEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVRvdWNoSGlnaGxpZ2h0WSAtIG1OYXZTbG9wLCBtVG91Y2hIaWdobGlnaHRYCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtIG1OYXZTbG9wLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1Ub3VjaEhpZ2hsaWdodFkgKyBtTmF2U2xvcCArIDEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVRvdWNoQ3Jvc3NIYWlyQ29sb3IpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgdm9pZCByZW1vdmVUb3VjaEhpZ2hsaWdodChib29sZWFuIHJlbW92ZVBlbmRpbmdNZXNzYWdlKSB7CisgICAgICAgIGlmIChyZW1vdmVQZW5kaW5nTWVzc2FnZSkgeworICAgICAgICAgICAgbVdlYlZpZXdDb3JlLnJlbW92ZU1lc3NhZ2VzKEV2ZW50SHViLkdFVF9UT1VDSF9ISUdITElHSFRfUkVDVFMpOworICAgICAgICB9CisgICAgICAgIG1XZWJWaWV3Q29yZS5zZW5kTWVzc2FnZShFdmVudEh1Yi5SRU1PVkVfVE9VQ0hfSElHSExJR0hUX1JFQ1RTKTsKICAgICB9CiAKICAgICBAT3ZlcnJpZGUKQEAgLTMzMDYsMjcgKzMyNzgsMzUgQEAKICAgICAgICAgICAgIC8vIFNlbmQgdGhlIGNsaWNrIHNvIHRoYXQgdGhlIHRleHRmaWVsZCBpcyBpbiBmb2N1cwogICAgICAgICAgICAgY2VudGVyS2V5UHJlc3NPblRleHRGaWVsZCgpOwogICAgICAgICAgICAgcmVidWlsZFdlYlRleHRWaWV3KCk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBjbGVhclRleHRFbnRyeSgpOwogICAgICAgICB9CiAgICAgICAgIGlmIChpbkVkaXRpbmdNb2RlKCkpIHsKICAgICAgICAgICAgIHJldHVybiBtV2ViVGV4dFZpZXcucGVyZm9ybUxvbmdDbGljaygpOwotICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgcmV0dXJuIHN1cGVyLnBlcmZvcm1Mb25nQ2xpY2soKTsKICAgICAgICAgfQorICAgICAgICAvKiBpZiBsb25nIGNsaWNrIGJyaW5ncyB1cCBhIGNvbnRleHQgbWVudSwgdGhlIHN1cGVyIGZ1bmN0aW9uCisgICAgICAgICAqIHJldHVybnMgdHJ1ZSBhbmQgd2UncmUgZG9uZS4gT3RoZXJ3aXNlLCBub3RoaW5nIGhhcHBlbmVkIHdoZW4KKyAgICAgICAgICogdGhlIHVzZXIgY2xpY2tlZC4gKi8KKyAgICAgICAgaWYgKHN1cGVyLnBlcmZvcm1Mb25nQ2xpY2soKSkgeworICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgIH0KKyAgICAgICAgLyogSW4gdGhlIGNhc2Ugd2hlcmUgdGhlIGFwcGxpY2F0aW9uIGhhc24ndCBhbHJlYWR5IGhhbmRsZWQgdGhlIGxvbmcKKyAgICAgICAg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YXJ0KCk7CisgICAgfQorCisgICAgdm9pZCBvbkZpeGVkTGVuZ3RoWm9vbUFuaW1hdGlvbkVuZCgpIHsKKyAgICAgICAgV2ViVmlld0NvcmUucmVzdW1lVXBkYXRlUGljdHVyZShtV2ViVmlld0NvcmUpOworICAgICAgICBvblpvb21BbmltYXRpb25FbmQoKTsKKyAgICB9CisKKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgWk9PTV9CSVRTID0gUGFpbnQuRklMVEVSX0JJVE1BUF9GTEFHIHwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUGFpbnQuRElUSEVSX0ZMQUcgfAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQYWludC5TVUJQSVhFTF9URVhUX0ZMQUc7CisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IFNDUk9MTF9CSVRTID0gUGFpbnQuRklMVEVSX0JJVE1BUF9GTEFHIHwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQYWludC5ESVRIRVJfRkxBRzsKKworICAgIHByaXZhdGUgZmluYWwgRHJhd0ZpbHRlciBtWm9vbUZpbHRlciA9CisgICAgICAgICAgICBuZXcgUGFpbnRGbGFnc0RyYXdGaWx0ZXIoWk9PTV9CSVRTLCBQYWludC5MSU5FQVJfVEVYVF9GTEFHKTsKKyAgICAvLyBJZiB3ZSBuZWVkIHRvIHRyYWRlIGJldHRlciBxdWFsaXR5IGZvciBzcGVlZCwgc2V0IG1TY3JvbGxGaWx0ZXIgdG8gbnVsbAorICAgIHByaXZhdGUgZmluYWwgRHJhd0ZpbHRlciBtU2Nyb2xsRmlsdGVyID0KKyAgICAgICAgICAgIG5ldyBQYWludEZsYWdzRHJhd0ZpbHRlcihTQ1JPTExfQklUUywgMCk7CisKICAgICBwcml2YXRlIHZvaWQgZHJhd0NvcmVBbmRDdXJzb3JSaW5nKENhbnZhcyBjYW52YXMsIGludCBjb2xvciwKICAgICAgICAgYm9vbGVhbiBkcmF3Q3Vyc29yUmluZykgewogICAgICAgICBpZiAobURyYXdIaXN0b3J5KSB7Ci0gICAgICAgICAgICBjYW52YXMuc2NhbGUobUFjdHVhbFNjYWxlLCBtQWN0dWFsU2NhbGUpOworICAgICAgICAgICAgY2FudmFzLnNjYWxlKG1ab29tTWFuYWdlci5nZXRTY2FsZSgpLCBtWm9vbU1hbmFnZXIuZ2V0U2NhbGUoKSk7CiAgICAgICAgICAgICBjYW52YXMuZHJhd1BpY3R1cmUobUhpc3RvcnlQaWN0dXJlKTsKICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgfQorICAgICAgICBpZiAobU5hdGl2ZUNsYXNzID09IDApIHJldHVybjsKIAotICAgICAgICBib29sZWFuIGFuaW1hdGVab29tID0gbVpvb21TY2FsZSAhPSAwOworICAgICAgICBib29sZWFuIGFuaW1hdGVab29tID0gbVpvb21NYW5hZ2VyLmlzRml4ZWRMZW5ndGhBbmltYXRpb25JblByb2dyZXNzKCk7CiAgICAgICAgIGJvb2xlYW4gYW5pbWF0ZVNjcm9sbCA9ICgoIW1TY3JvbGxlci5pc0ZpbmlzaGVkKCkKICAgICAgICAgICAgICAgICB8fCBtVmVsb2NpdHlUcmFja2VyICE9IG51bGwpCiAgICAgICAgICAgICAgICAgJiYgKG1Ub3VjaE1vZGUgIT0gVE9VQ0hfRFJBR19NT0RFIHx8CkBAIC0zMzkxLDU5ICszNDAwLDkgQEAKICAgICAgICAgICAgIH0KICAgICAgICAgfQogICAgICAgICBpZiAoYW5pbWF0ZVpvb20pIHsKLSAgICAgICAgICAgIGZsb2F0IHpvb21TY2FsZTsKLSAgICAgICAgICAgIGludCBpbnRlcnZhbCA9IChpbnQpIChTeXN0ZW1DbG9jay51cHRpbWVNaWxsaXMoKSAtIG1ab29tU3RhcnQpOwotICAgICAgICAgICAgaWYgKGludGVydmFsIDwgWk9PTV9BTklNQVRJT05fTEVOR1RIKSB7Ci0gICAgICAgICAgICAgICAgZmxvYXQgcmF0aW8gPSAoZmxvYXQpIGludGVydmFsIC8gWk9PTV9BTklNQVRJT05fTEVOR1RIOwotICAgICAgICAgICAgICAgIHpvb21TY2FsZSA9IDEuMGYgLyAobUludkluaXRpYWxab29tU2NhbGUKLSAgICAgICAgICAgICAgICAgICAgICAgICsgKG1JbnZGaW5hbFpvb21TY2FsZSAtIG1JbnZJbml0aWFsWm9vbVNjYWxlKSAqIHJhdGlvKTsKLSAgICAgICAgICAgICAgICBpbnZhbGlkYXRlKCk7Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIHpvb21TY2FsZSA9IG1ab29tU2NhbGU7Ci0gICAgICAgICAgICAgICAgLy8gc2V0IG1ab29tU2NhbGUgdG8gYmUgMCBhcyB3ZSBoYXZlIGRvbmUgYW5pbWF0aW9uCi0gICAgICAgICAgICAgICAgbVpvb21TY2FsZSA9IDA7Ci0gICAgICAgICAgICAgICAgV2ViVmlld0NvcmUucmVzdW1lVXBkYXRlUGljdHVyZShtV2ViVmlld0NvcmUpOwotICAgICAgICAgICAgICAgIC8vIGNhbGwgaW52YWxpZGF0ZSgpIGFnYWluIHRvIGRyYXcgd2l0aCB0aGUgZmluYWwgZmlsdGVycwotICAgICAgICAgICAgICAgIGludmFsaWRhdGUoKTsKLSAgICAgICAgICAgICAgICBpZiAobU5lZWRUb0FkanVzdFdlYlRleHRWaWV3KSB7Ci0gICAgICAgICAgICAgICAgICAgIG1OZWVkVG9BZGp1c3RXZWJUZXh0VmlldyA9IGZhbHNlOwotICAgICAgICAgICAgICAgICAgICBpZiAoZGlkVXBkYXRlVGV4dFZpZXdCb3VuZHMoZmFsc2UpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgJiYgbmF0aXZlRm9jdXNDYW5kaWRhdGVJc1Bhc3N3b3JkKCkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIC8vIElmIGl0IGlzIGEgcGFzc3dvcmQgZmllbGQsIHN0YXJ0IGRyYXdpbmcgdGhlCi0gICAgICAgICAgICAgICAgICAgICAgICAvLyBXZWJUZXh0VmlldyBvbmNlIGFnYWluLgotICAgICAgICAgICAgICAgICAgICAgICAgbVdlYlRleHRWaWV3LnNldEluUGFzc3dvcmQodHJ1ZSk7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICAvLyBjYWxjdWxhdGUgdGhlIGludGVybWVkaWF0ZSBzY3JvbGwgcG9zaXRpb24uIEFzIHdlIG5lZWQgdG8gdXNlCi0gICAgICAgICAgICAvLyB6b29tU2NhbGUsIHdlIGNhbid0IHVzZSBwaW5Mb2NYL1kgZGlyZWN0bHkuIENvcHkgdGhlIGxvZ2ljIGhlcmUuCi0gICAgICAgICAgICBmbG9hdCBzY2FsZSA9IHpvb21TY2FsZSAqIG1JbnZJbml0aWFsWm9vbVNjYWxlOwotICAgICAgICAgICAgaW50IHR4ID0gTWF0aC5yb3VuZChzY2FsZSAqIChtSW5pdGlhbFNjcm9sbFggKyBtWm9vbUNlbnRlclgpCi0gICAgICAgICAgICAgICAgICAgIC0gbVpvb21DZW50ZXJYKTsKLSAgICAgICAgICAgIHR4ID0gLXBpbkxvYyh0eCwgZ2V0Vmlld1dpZHRoKCksIE1hdGgucm91bmQobUNvbnRlbnRXaWR0aAotICAgICAgICAgICAgICAgICAgICAqIHpvb21TY2FsZSkpICsgbVNjcm9sbFg7Ci0gICAgICAgICAgICBpbnQgdGl0bGVIZWlnaHQgPSBnZXRUaXRsZUhlaWdodCgpOwotICAgICAgICAgICAgaW50IHR5ID0gTWF0aC5yb3VuZChzY2FsZQotICAgICAgICAgICAgICAgICAgICAqIChtSW5pdGlhbFNjcm9sbFkgKyBtWm9vbUNlbnRlclkgLSB0aXRsZUhlaWdodCkKLSAgICAgICAgICAgICAgICAgICAgLSAobVpvb21DZW50ZXJZIC0gdGl0bGVIZWlnaHQpKTsKLSAgICAgICAgICAgIHR5ID0gLSh0eSA8PSB0aXRsZUhlaWdodCA/IE1hdGgubWF4KHR5LCAwKSA6IHBpbkxvYyh0eQotICAgICAgICAgICAgICAgICAgICAtIHRpdGxlSGVpZ2h0LCBnZXRWaWV3SGVpZ2h0KCksIE1hdGgucm91bmQobUNvbnRlbnRIZWlnaHQKLSAgICAgICAgICAgICAgICAgICAgKiB6b29tU2NhbGUpKSArIHRpdGxlSGVpZ2h0KSArIG1TY3JvbGxZOwotICAgICAgICAgICAgY2FudmFzLnRyYW5zbGF0ZSh0eCwgdHkpOwotICAgICAgICAgICAgY2FudmFzLnNjYWxlKHpvb21TY2FsZSwgem9vbVNjYWxlKTsKLSAgICAgICAgICAgIGlmIChpbkVkaXRpbmdNb2RlKCkgJiYgIW1OZWVkVG9BZGp1c3RXZWJUZXh0VmlldwotICAgICAgICAgICAgICAgICAgICAmJiBtWm9vbVNjYWxlICE9IDApIHsKLSAgICAgICAgICAgICAgICAvLyBUaGUgV2ViVGV4dFZpZXcgaXMgdXAuICBLZWVwIHRyYWNrIG9mIHRoaXMgc28gd2UgY2FuIGFkanVzdAotICAgICAgICAgICAgICAgIC8vIGl0cyBzaXplIGFuZCBwbGFjZW1lbnQgd2hlbiB3ZSBmaW5pc2ggem9vbWluZwotICAgICAgICAgICAgICAgIG1OZWVkVG9BZGp1c3RXZWJUZXh0VmlldyA9IHRydWU7Ci0gICAgICAgICAgICAgICAgLy8gSWYgaXQgaXMgaW4gcGFzc3dvcmQgbW9kZSwgdHVybiBpdCBvZmYgc28gaXQgZG9lcyBub3QgZHJhdwotICAgICAgICAgICAgICAgIC8vIG1pc3BsYWNlZC4KLSAgICAgICAgICAgICAgICBpZiAobmF0aXZlRm9jdXNDYW5kaWRhdGVJc1Bhc3N3b3JkKCkpIHsKLSAgICAgICAgICAgICAgICAgICAgbVdlYlRleHRWaWV3LnNldEluUGFzc3dvcmQoZmFsc2UpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1ab29tTWFuYWdlci5hbmltYXRlWm9vbShjYW52YXMpOwogICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgY2FudmFzLnNjYWxlKG1BY3R1YWxTY2FsZSwgbUFjdHVhbFNjYWxlKTsKKyAgICAgICAgICAgIGNhbnZhcy5zY2FsZShtWm9vbU1hbmFnZXIuZ2V0U2NhbGUoKSwgbVpvb21NYW5hZ2VyLmdldFNjYWxlKCkpOwogICAgICAgICB9CiAKICAgICAgICAgYm9vbGVhbiBVSUFuaW1hdGlvbnNSdW5uaW5nID0gZmFsc2U7CkBAIC0zNDU1LDM5ICszNDE0LDQyIEBACiAgICAgICAgICAgICAvLyB3ZSBhc2sgZm9yIGEgcmVwYWludC4KICAgICAgICAgICAgIGludmFsaWRhdGUoKTsKICAgICAgICAgfQotICAgICAgICBtV2ViVmlld0NvcmUuZHJhd0NvbnRlbnRQaWN0dXJlKGNhbnZhcywgY29sb3IsCi0gICAgICAgICAgICAgICAgKGFuaW1hdGVab29tIHx8IG1QcmV2aWV3Wm9vbU9ubHkgfHwgVUlBbmltYXRpb25zUnVubmluZyksCi0gICAgICAgICAgICAgICAgYW5pbWF0ZVNjcm9sbCk7Ci0gICAgICAgIGlmIChtTmF0aXZlQ2xhc3MgPT0gMCkgcmV0dXJuOworCiAgICAgICAgIC8vIGRlY2lkZSB3aGljaCBhZG9ybm1lbnRzIHRvIGRyYXcKICAgICAgICAgaW50IGV4dHJhcyA9IERSQVdfRVhUUkFTX05PTkU7CisgICAgICAgIGlmIChEZWJ1Z0ZsYWdzLldFQl9WSUVXKSB7CisgICAgICAgICAgICBMb2cudihMT0dUQUcsICJtRmluZElzVXA9IiArIG1GaW5kSXNVcAorICAgICAgICAgICAgICAgICAgICArICIgbVNlbGVjdGluZ1RleHQ9IiArIG1TZWxlY3RpbmdUZXh0CisgICAgICAgICAgICAgICAgICAgICsgIiBuYXRpdmVQYWdlU2hvdWxkSGFuZGxlU2hpZnRBbmRBcnJvd3MoKT0iCisgIC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gICAgICAgIGV4dHJhcyA9IERSQVdfRVhUUkFTX0ZJTkQ7CisgICAgICAgIH0gZWxzZSBpZiAobVNlbGVjdGluZ1RleHQpIHsKKyAgICAgICAgICAgIGV4dHJhcyA9IERSQVdfRVhUUkFTX1NFTEVDVElPTjsKKyAgICAgICAgICAgIG5hdGl2ZVNldFNlbGVjdGlvblBvaW50ZXIobURyYXdTZWxlY3Rpb25Qb2ludGVyLAorICAgICAgICAgICAgICAgICAgICBtWm9vbU1hbmFnZXIuZ2V0SW52U2NhbGUoKSwKKyAgICAgICAgICAgICAgICAgICAgbVNlbGVjdFgsIG1TZWxlY3RZIC0gZ2V0VGl0bGVIZWlnaHQoKSk7CiAgICAgICAgIH0gZWxzZSBpZiAoZHJhd0N1cnNvclJpbmcpIHsKICAgICAgICAgICAgIGV4dHJhcyA9IERSQVdfRVhUUkFTX0NVUlNPUl9SSU5HOwogICAgICAgICB9Ci0gICAgICAgIGRyYXdFeHRyYXMoY2FudmFzLCBleHRyYXMsIFVJQW5pbWF0aW9uc1J1bm5pbmcpOworICAgICAgICBEcmF3RmlsdGVyIGRmID0gbnVsbDsKKyAgICAgICAgaWYgKG1ab29tTWFuYWdlci5pc1pvb21BbmltYXRpbmcoKSB8fCBVSUFuaW1hdGlvbnNSdW5uaW5nKSB7CisgICAgICAgICAgICBkZiA9IG1ab29tRmlsdGVyOworICAgICAgICB9IGVsc2UgaWYgKGFuaW1hdGVTY3JvbGwpIHsKKyAgICAgICAgICAgIGRmID0gbVNjcm9sbEZpbHRlcjsKKyAgICAgICAgfQorICAgICAgICBjYW52YXMuc2V0RHJhd0ZpbHRlcihkZik7CisgICAgICAgIGludCBjb250ZW50ID0gbmF0aXZlRHJhdyhjYW52YXMsIGNvbG9yLCBleHRyYXMsIHRydWUpOworICAgICAgICBjYW52YXMuc2V0RHJhd0ZpbHRlcihudWxsKTsKKyAgICAgICAgaWYgKGNvbnRlbnQgIT0gMCkgeworICAgICAgICAgICAgbVdlYlZpZXdDb3Jl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3RDZW50ZXJEb3duID0gZmFsc2U7CiAKICAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgYm9vbGVhbiBvbktleU11bHRpcGxlKGludCBrZXlDb2RlLCBpbnQgcmVwZWF0Q291bnQsIEtleUV2ZW50IGV2ZW50KSB7CisgICAgICAgIC8vIHNlbmQgY29tcGxleCBjaGFyYWN0ZXJzIHRvIHdlYmtpdCBmb3IgdXNlIGJ5IEpTIGFuZCBwbHVnaW5zCisgICAgICAgIGlmIChrZXlDb2RlID09IEtleUV2ZW50LktFWUNPREVfVU5LTk9XTiAmJiBldmVudC5nZXRDaGFyYWN0ZXJzKCkgIT0gbnVsbCkgeworICAgICAgICAgICAgLy8gcGFzcyB0aGUga2V5IHRvIERPTQorICAgICAgICAgICAgbVdlYlZpZXdDb3JlLnNlbmRNZXNzYWdlKEV2ZW50SHViLktFWV9ET1dOLCBldmVudCk7CisgICAgICAgICAgICBtV2ViVmlld0NvcmUuc2VuZE1lc3NhZ2UoRXZlbnRIdWIuS0VZX1VQLCBldmVudCk7CisgICAgICAgICAgICAvLyByZXR1cm4gdHJ1ZSBhcyBET00gaGFuZGxlcyB0aGUga2V5CisgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgQE92ZXJyaWRlCiAgICAgcHVibGljIGJvb2xlYW4gb25LZXlEb3duKGludCBrZXlDb2RlLCBLZXlFdmVudCBldmVudCkgewogICAgICAgICBpZiAoRGVidWdGbGFncy5XRUJfVklFVykgewogICAgICAgICAgICAgTG9nLnYoTE9HVEFHLCAia2V5RG93biBhdCAiICsgU3lzdGVtLmN1cnJlbnRUaW1lTWlsbGlzKCkKQEAgLTM4MTcsMTcgKzM4MTUsMTkgQEAKICAgICAgICAgLy8gQnViYmxlIHVwIHRoZSBrZXkgZXZlbnQgaWYKICAgICAgICAgLy8gMS4gaXQgaXMgYSBzeXN0ZW0ga2V5OyBvcgogICAgIC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zKCkgJiYgIW1TZWxlY3RpbmdUZXh0KSB7CisgICAgICAgICAgICAgICAgc2V0VXBTZWxlY3QoKTsKICAgICAgICAgICAgIH0KICAgICAgICAgfQogCkBAIC0zODQ0LDExICszODQ0LDExIEBACiAgICAgICAgIGlmIChrZXlDb2RlID49IEtleUV2ZW50LktFWUNPREVfRFBBRF9VUAogICAgICAgICAgICAgICAgICYmIGtleUNvZGUgPD0gS2V5RXZlbnQuS0VZQ09ERV9EUEFEX1JJR0hUKSB7CiAgICAgICAgICAgICBzd2l0Y2hPdXREcmF3SGlzdG9yeSgpOwotICAgICAgICAgICAgaWYgKG5hdGl2ZUZvY3VzSXNQbHVnaW4oKSkgewotICAgICAgICAgICAgICAgIGxldFBsdWdpbkhhbmRsZU5hdktleShrZXlDb2RlLCBldmVudC5nZXRFdmVudFRpbWUoKSwgdHJ1ZSk7CisgICAgICAgICAgICBpZiAobmF0aXZlUGFnZVNob3VsZEhhbmRsZVNoaWZ0QW5kQXJyb3dzKCkpIHsKKyAgICAgICAgICAgICAgICBsZXRQYWdlSGFuZGxlTmF2S2V5KGtleUNvZGUsIGV2ZW50LmdldEV2ZW50VGltZSgpLCB0cnVlKTsKICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmIChtU2hpZnRJc1ByZXNzZWQpIHsKKyAgICAgICAgICAgIGlmIChtU2VsZWN0aW5nVGV4dCkgewogICAgICAgICAgICAgICAgIGludCB4UmF0ZSA9IGtleUNvZGUgPT0gS2V5RXZlbnQuS0VZQ09ERV9EUEFEX0xFRlQKICAgICAgICAgICAgICAgICAgICAgPyAtMSA6IGtleUNvZGUgPT0gS2V5RXZlbnQuS0VZQ09ERV9EUEFEX1JJR0hUID8gMSA6IDA7CiAgICAgICAgICAgICAgICAgaW50IHlSYXRlID0ga2V5Q29kZSA9PSBLZXlFdmVudC5LRVlDT0RFX0RQQURfVVAgPwpAQCAtMzg2OCw3ICszODY4LDcgQEAKICAgICAgICAgaWYgKGtleUNvZGUgPT0gS2V5RXZlbnQuS0VZQ09ERV9EUEFEX0NFTlRFUikgewogICAgICAgICAgICAgc3dpdGNoT3V0RHJhd0hpc3RvcnkoKTsKICAgICAgICAgICAgIGlmIChldmVudC5nZXRSZXBlYXRDb3VudCgpID09IDApIHsKLSAgICAgICAgICAgICAgICBpZiAobVNoaWZ0SXNQcmVzc2VkICYmICFuYXRpdmVGb2N1c0lzUGx1Z2luKCkpIHsKKyAgICAgICAgICAgICAgICBpZiAobVNlbGVjdGluZ1RleHQpIHsKICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7IC8vIGRpc2NhcmQgcHJlc3MgaWYgY29weSBpbiBwcm9ncmVzcwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBtR290Q2VudGVyRG93biA9IHRydWU7CkBAIC0zODg2LDEwICszODg2LDggQEAKICAgICAgICAgaWYgKGtleUNvZGUgIT0gS2V5RXZlbnQuS0VZQ09ERV9TSElGVF9MRUZUCiAgICAgICAgICAgICAgICAgJiYga2V5Q29kZSAhPSBLZXlFdmVudC5LRVlDT0RFX1NISUZUX1JJR0hUKSB7CiAgICAgICAgICAgICAvLyB0dXJuIG9mZiBjb3B5IHNlbGVjdCBpZiBhIHNoaWZ0LWtleSBjb21ibyBpcyBwcmVzc2VkCi0gICAgICAgICAgICBtRXh0ZW5kU2VsZWN0aW9uID0gbVNoaWZ0SXNQcmVzc2VkID0gZmFsc2U7Ci0gICAgICAgICAgICBpZiAobVRvdWNoTW9kZSA9PSBUT1VDSF9TRUxFQ1RfTU9ERSkgewotICAgICAgICAgICAgICAgIG1Ub3VjaE1vZGUgPSBUT1VDSF9JTklUX01PREU7Ci0gICAgICAgICAgICB9CisgICAgICAgICAgICBzZWxlY3Rpb25Eb25lKCk7CisgICAgICAgICAgICBtU2hpZnRJc1ByZXNzZWQgPSBmYWxzZTsKICAgICAgICAgfQogCiAgICAgICAgIGlmIChnZXRTZXR0aW5ncygpLmdldE5hdkR1bXAoKSkgewpAQCAtMzk3MSwyMyArMzk2OSwyNyBAQAogICAgICAgICAvLyBCdWJibGUgdXAgdGhlIGtleSBldmVudCBpZgogICAgICAgICAvLyAxLiBpdCBpcyBhIHN5c3RlbSBrZXk7IG9yCiAgICAgICAgIC8vIDIuIHRoZSBob3N0IGFwcGxpY2F0aW9uIHdhbnRzIHRvIGhhbmRsZSBpdDsKLSAgICAgICAgaWYgKGV2ZW50LmlzU3lzdGVtKCkgfHwgbUNhbGxiYWNrUHJveHkudWlPdmVycmlkZUtleUV2ZW50KGV2ZW50KSkgeworICAgICAgICAvLyAzLiB0aGUgYWNjZXNzaWJpbGl0eSBpbmplY3RvciBpcyBwcmVzZW50IGFuZCB3YW50cyB0byBoYW5kbGUgaXQ7CisgICAgICAgIGlmIChldmVudC5pc1N5c3RlbSgpCisgICAgICAgICAgICAgICAgfHwgbUNhbGxiYWNrUHJveHkudWlPdmVycmlkZUtleUV2ZW50KGV2ZW50KQorICAgICAgICAgICAgICAgIHx8IChtQWNjZXNzaWJpbGl0eUluamVjdG9yICE9IG51bGwgJiYgbUFjY2Vzc2liaWxpdHlJbmplY3Rvci5vbktleUV2ZW50KGV2ZW50KSkpIHsKICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICAgfQogCiAgICAgICAgIGlmIChrZXlDb2RlID09IEtleUV2ZW50LktFWUNPREVfU0hJRlRfTEVGVAogICAgICAgICAgICAgICAgIHx8IGtleUNvZGUgPT0gS2V5RXZlbnQuS0VZQ09ERV9TSElGVF9SSUdIVCkgewotICAgICAgICAgICAgaWYgKG5hdGl2ZUZvY3VzSXNQbHVnaW4oKSkgeworICAgICAgICAgICAgaWYgKG5hdGl2ZVBhZ2VTaG91bGRIYW5kbGVTaGlmdEFuZEFycm93cygpKSB7CiAgICAgICAgICAgICAgICAgbVNoaWZ0SXNQcmVzc2VkID0gZmFsc2U7Ci0gICAgICAgICAgICB9IGVsc2UgaWYgKGNvbW1pdENvcHkoKSkgeworICAgICAgICAgICAgfSBlbHNlIGlmIChjb3B5U2VsZWN0aW9uKCkpIHsKKyAgICAgICAgICAgICAgICBzZWxlY3Rpb25Eb25lKCk7CiAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KIAogICAgICAgICBpZiAoa2V5Q29kZSA+PSBLZXlFdmVudC5LRVlDT0RFX0RQQURfVVAKICAgICAgICAgICAgICAgICAmJiBrZXlDb2RlIDw9IEtleUV2ZW50LktFWUNPREVfRFBBRF9SSUdIVCkgewotICAgICAgICAgICAgaWYgKG5hdGl2ZUZvY3VzSXNQbHVnaW4oKSkgewotICAgICAgICAgICAgICAgIGxldFBsdWdpbkhhbmRsZU5hdktleShrZXlDb2RlLCBldmVudC5nZXRFdmVudFRpbWUoKSwgZmFsc2UpOworICAgICAgICAgICAgaWYgKG5hdGl2ZVBhZ2VTaG91bGRIYW5kbGVTaGlmdEFuZEFycm93cygpKSB7CisgICAgICAgICAgICAgICAgbGV0UGFnZUhhbmRsZU5hdktleShrZXlDb2RlLCBldmVudC5nZXRFdmVudFRpbWUoKSwgZmFsc2UpOwogICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgICAgICAgfQogICAgICAgICAgICAgLy8gYWx3YXlzIGhhbmRsZSB0aGUgbmF2aWdhdGlvbiBrZXlzIGluIHRoZSBVSSB0aHJlYWQKQEAgLTQwMDAsMTEgKzQwMDIsMTMgQEAKICAgICAgICAgICAgIG1Qcml2YXRlSGFuZGxlci5yZW1vdmVNZXNzYWdlcyhMT05HX1BSRVNTX0NFTlRFUik7CiAgICAgICAgICAgICBtR290Q2VudGVyRG93biA9IGZhbHNlOwogCi0gICAgICAgICAgICBpZiAobVNoaWZ0SXNQcmVzc2VkICYmICFuYXRpdmVGb2N1c0lzUGx1Z2luKCkpIHsKKyAgICAgICAgICAgIGlmIChtU2VsZWN0aW5nVGV4dCkgewogICAgICAgICAgICAgICAgIGlmIChtRXh0ZW5kU2VsZWN0aW9uKSB7Ci0gICAgICAgICAgICAgICAgICAgIGNvbW1pdENvcHkoKTsKKyAgICAgICAgICAgICAgICAgICAgY29weVNlbGVjdGlvbigpOworICAgICAgICAgICAgICAgICAgICBzZWxlY3Rpb25Eb25lKCk7CiAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgbUV4dGVuZFNlbGVjdGlvbiA9IHRydWU7CisgICAgICAgICAgICAgICAgICAgIG5hdGl2ZVNldEV4dGVuZFNlbGVjdGlvbigpOwogICAgICAgICAgICAgICAgICAgICBpbnZhbGlkYXRlKCk7IC8vIGRyYXcgdGhlIGktYmVhbSBpbnN0ZWFkIG9mIHRoZSBhcnJvdwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsgLy8gZGlzY2FyZCBwcmVzcyBpZiBjb3B5IGluIHByb2dyZXNzCkBAIC00MDI4LDcgKzQwMzIsNyBAQAogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGNsZWFyVGV4dEVudHJ5KHRydWUpOworICAgICAgICAgICAgY2xlYXJUZXh0RW50cnkoKTsKICAgICAgICAgICAgIG5hdGl2ZVNldEZvbGxvd2VkTGluayh0cnVlKTsKICAgICAgICAgICAgIGlmICghbUNhbGxiYWNrUHJveHkudWlPdmVycmlkZVVybExvYWRpbmcobmF0aXZlQ3Vyc29yVGV4dCgpKSkgewogICAgICAgICAgICAgICAgIG1XZWJWaWV3Q29yZS5zZW5kTWVzc2FnZShFdmVudEh1Yi5DTElDSywgZGF0YS5tRnJhbWUsCkBAIC00MDQ5LDkgKzQwNTMsMTggQEAKICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgIH0KIAotICAgIHByaXZhdGUgdm9pZCBzZXRVcFNlbGVjdFhZKCkgeworICAgIC8qKgorICAgICAqIEBoa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IH0KKworICAgIC8qKgorICAgICAqIEBoaWRlIHBlbmRpbmcgQVBJIGNvdW5jaWwgYXBwcm92YWwuCisgICAgICovCisgICAgcHVibGljIHZvaWQgc2VsZWN0aW9uRG9uZSgpIHsKKyAgICAgICAgaWYgKG1TZWxlY3RpbmdUZXh0KSB7CisgICAgICAgICAgICBnZXRXZWJDaHJvbWVDbGllbnQoKS5vblNlbGVjdGlvbkRvbmUodGhpcyk7CisgICAgICAgICAgICBpbnZhbGlkYXRlKCk7IC8vIHJlZHJhdyB3aXRob3V0IHNlbGVjdGlvbgorICAgICAgICAgICAgbm90aWZ5U2VsZWN0RGlhbG9nRGlzbWlzc2VkKCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBAaGlkZSBwZW5kaW5nIEFQSSBjb3VuY2lsIGFwcHJvdmFsLgorICAgICAqLworICAgIHB1YmxpYyBib29sZWFuIGNvcHlTZWxlY3Rpb24oKSB7CiAgICAgICAgIGJvb2xlYW4gY29waWVkU29tZXRoaW5nID0gZmFsc2U7Ci0gICAgICAgIGlmIChtRXh0ZW5kU2VsZWN0aW9uKSB7Ci0gICAgICAgICAgICBTdHJpbmcgc2VsZWN0aW9uID0gbmF0aXZlR2V0U2VsZWN0aW9uKCk7Ci0gICAgICAgICAgICBpZiAoc2VsZWN0aW9uICE9ICIiKSB7Ci0gICAgICAgICAgICAgICAgaWYgKERlYnVnRmxhZ3MuV0VCX1ZJRVcpIHsKLSAgICAgICAgICAgICAgICAgICAgTG9nLnYoTE9HVEFHLCAiY29tbWl0Q29weSBcIiIgKyBzZWxlY3Rpb24gKyAiXCIiKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgVG9hc3QubWFrZVRleHQobUNvbnRleHQKLSAgICAgICAgICAgICAgICAgICAgICAgICwgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHJpbmcudGV4dF9jb3BpZWQKLSAgICAgICAgICAgICAgICAgICAgICAgICwgVG9hc3QuTEVOR1RIX1NIT1JUKS5zaG93KCk7Ci0gICAgICAgICAgICAgICAgY29waWVkU29tZXRoaW5nID0gdHJ1ZTsKLSAgICAgICAgICAgICAgICB0cnkgewotICAgICAgICAgICAgICAgICAgICBJQ2xpcGJvYXJkIGNsaXAgPSBJQ2xpcGJvYXJkLlN0dWIuYXNJbnRlcmZhY2UoCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgU2VydmljZU1hbmFnZXIuZ2V0U2VydmljZSgiY2xpcGJvYXJkIikpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsaXAuc2V0Q2xpcGJvYXJkVGV4dChzZWxlY3Rpb24pOwotICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGFuZHJvaWQub3MuUmVtb3RlRXhjZXB0aW9uIGUpIHsKLSAgICAgICAgICAgICAgICAgICAgTG9nLmUoTE9HVEFHLCAiQ2xpcGJvYXJkIGZhaWxlZCIsIGUpOwotICAgICAgICAgICAgICAgIH0KKyAgICAgICAgU3RyaW5nIHNlbGVjdGlvbiA9IGdldFNlbGVjdGlvbigpOworICAgICAgICBpZiAoc2VsZWN0aW9uICE9ICIiKSB7CisgICAgICAgICAgICBpZiAoRGVidWdGbGFncy5XRUJfVklFVykgeworICAgICAgICAgICAgICAgIExvZy52KExPR1RBRywgImNvcHlTZWxlY3Rpb24gXCIiICsgc2VsZWN0aW9uICsgIlwiIik7CiAgICAgICAgICAgICB9Ci0gICAgICAgICAgICBtRXh0ZW5kU2VsZWN0aW9uID0gZmFsc2U7CisgICAgICAgICAgICBUb2FzdC5tYWtlVGV4dChtQ29udGV4dAorICAgICAgICAgICAgICAgICAgICAsIGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3RyaW5nLnRleHRfY29waWVkCisgICAgICAgICAgICAgICAgICAgICwgVG9hc3QuTEVOR1RIX1NIT1JUKS5zaG93KCk7CisgICAgICAgICAgICBjb3BpZWRTb21ldGhpbmcgPSB0cnVlOworICAgICAgICAgICAgQ2xpcGJvYXJkTWFuYWdlciBjbSA9IChDbGlwYm9hcmRNYW5hZ2VyKWdldENvbnRleHQoKQorICAgICAgICAgICAgICAgICAgICAuZ2V0U3lzdGVtU2VydmljZShDb250ZXh0LkNMSVBCT0FSRF9TRVJWSUNFKTsKKyAgICAgICAgICAgIGNtLnNldFRleHQoc2VsZWN0aW9uKTsKICAgICAgICAgfQotICAgICAgICBtU2hpZnRJc1ByZXNzZWQgPSBmYWxzZTsKICAgICAgICAgaW52YWxpZGF0ZSgpOyAvLyByZW1vdmUgc2VsZWN0aW9uIHJlZ2lvbiBhbmQgcG9pbnRlcgotICAgICAgICBpZiAobVRvdWNoTW9kZSA9PSBUT1VDSF9TRUxFQ1RfTU9ERSkgewotICAgICAgICAgICAgbVRvdWNoTW9kZSA9IFRPVUNIX0lOSVRfTU9ERTsKLSAgICAgICAgfQogICAgICAgICByZXR1cm4gY29waWVkU29tZXRoaW5nOwogICAgIH0KIAorICAgIC8qKgorICAgICAqIEBoaWRlIHBlbmRpbmcgQVBJIGNvdW5jaWwgYXBwcm92YWwuCisgICAgICovCisgICAgcHVibGljIFN0cmluZyBnZXRTZWxlY3Rpb24oKSB7CisgICAgICAgIGlmIChtTmF0aXZlQ2xhc3MgPT0gMCkgcmV0dXJuICIiOworICAgICAgICByZXR1cm4gbmF0aXZlR2V0U2VsZWN0aW9uKCk7CisgICAgfQorCiAgICAgQE92ZXJyaWRlCiAgICAgcHJvdGVjdGVkIHZvaWQgb25BdHRhY2hlZFRvV2luZG93KCkgewogICAgICAgICBzdXBlci5vbkF0dGFjaGVkVG9XaW5kb3coKTsKQEAgLTQxMTMsMTIgKzQxNjQsMjIgQEAKIAogICAgIEBPdmVycmlkZQogICAgIHByb3RlY3RlZCB2b2lkIG9uRGV0YWNoZWRGcm9tV2luZG93KCkgewotICAgICAgICBjbGVhclRleHRFbnRyeShmYWxzZSk7Ci0gICAgICAgIGRpc21pc3Nab29tQ29udHJvbCgpOworICAgICAgICBjbGVhclRleHRFbnRye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2ZSBmb2N1cywgdGhlbiBiZWdpbgogICAgICAgICAgICAgICAgIC8vIGRyYXdpbmcgdGhlIGN1cnNvciByaW5nCiAgICAgICAgICAgICAgICAgbURyYXdDdXJzb3JSaW5nID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICBzZXRGb2N1c0NvbnRyb2xsZXJBY3RpdmUodHJ1ZSk7CiAgICAgICAgICAgICAgICAgaWYgKG1OYXRpdmVDbGFzcyAhPSAwKSB7CiAgICAgICAgICAgICAgICAgICAgIG5hdGl2ZVJlY29yZEJ1dHRvbnModHJ1ZSwgZmFsc2UsIHRydWUpOwotICAgICAgICAgICAgICAgICAgICBpZiAoaW5FZGl0aW5nTW9kZSgpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBtV2ViVmlld0NvcmUuc2VuZE1lc3NhZ2UoRXZlbnRIdWIuU0VUX0FDVElWRSwgMSwgMCk7Ci0gICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIC8vIElmIG91ciB3aW5kb3cgZ2FpbmVkIGZvY3VzLCBidXQgd2UgZG8gbm90IGhhdmUgaXQsIGRvIG5vdAotICAgICAgICAgICAgICAgIC8vIGRyYXcgdGhlIGN1cnNvciByaW5nLgotICAgICAgICAgICAgICAgIG1EcmF3Q3Vyc29yUmluZyA9IGZhbHNlOworICAgICAgICAgICAgICAgIGlmICghaW5FZGl0aW5nTW9kZSgpKSB7CisgICAgICAgICAgICAgICAgICAgIC8vIElmIG91ciB3aW5kb3cgZ2FpbmVkIGZvY3VzLCBidXQgd2UgZG8gbm90IGhhdmUgaXQsIGRvIG5vdAorICAgICAgICAgICAgICAgICAgICAvLyBkcmF3IHRoZSBjdXJzb3IgcmluZy4KKyAgICAgICAgICAgICAgICAgICAgbURyYXdDdXJzb3JSaW5nID0gZmFsc2U7CisgICAgICAgICAgICAgICAgICAgIHNldEZvY3VzQ29udHJvbGxlckFjdGl2ZShmYWxzZSk7CisgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIC8vIFdlIGRvIG5vdCBjYWxsIG5hdGl2ZVJlY29yZEJ1dHRvbnMgaGVyZSBiZWNhdXNlIHdlIGFzc3VtZQogICAgICAgICAgICAgICAgIC8vIHRoYXQgd2hlbiB3ZSBsb3N0IGZvY3VzLCBvciB3aW5kb3cgZm9jdXMsIGl0IGdvdCBjYWxsZWQgd2l0aAogICAgICAgICAgICAgICAgIC8vIGZhbHNlIGZvciB0aGUgZmlyc3QgcGFyYW1ldGVyCiAgICAgICAgICAgICB9CiAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICBpZiAobVdlYlZpZXdDb3JlICE9IG51bGwgJiYgZ2V0U2V0dGluZ3MoKS5nZXRCdWlsdEluWm9vbUNvbnRyb2xzKCkKLSAgICAgICAgICAgICAgICAgICAgJiYgKG1ab29tQnV0dG9uc0NvbnRyb2xsZXIgPT0gbnVsbCB8fAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICFtWm9vbUJ1dHRvbnNDb250cm9sbGVyLmlzVmlzaWJsZSgpKSkgeworICAgICAgICAgICAgaWYgKCFtWm9vbU1hbmFnZXIuaXNab29tUGlja2VyVmlzaWJsZSgpKSB7CiAgICAgICAgICAgICAgICAgLyoKLSAgICAgICAgICAgICAgICAgKiBUaGUgem9vbSBjb250cm9scyBjb21lIGluIHRoZWlyIG93biB3aW5kb3csIHNvIG91ciB3aW5kb3cKLSAgICAgICAgICAgICAgICAgKiBsb3NlcyBmb2N1cy4gT3VyIHBvbGljeSBpcyB0byBub3QgZHJhdyB0aGUgY3Vyc29yIHJpbmcgaWYKLSAgICAgICAgICAgICAgICAgKiBvdXIgd2luZG93IGlzIG5vdCBmb2N1c2VkLCBidXQgdGhpcyBpcyBhbiBleGNlcHRpb24gc2luY2UKKyAgICAgICAgICAgICAgICAgKiBUaGUgZXh0ZXJuYWwgem9vbSBjb250cm9scyBjb21lIGluIHRoZWlyIG93biB3aW5kb3csIHNvIG91cgorICAgICAgICAgICAgICAgICAqIHdpbmRvdyBsb3NlcyBmb2N1cy4gT3VyIHBvbGljeSBpcyB0byBub3QgZHJhdyB0aGUgY3Vyc29yIHJpbmcKKyAgICAgICAgICAgICAgICAgKiBpZiBvdXIgd2luZG93IGlzIG5vdCBmb2N1c2VkLCBidXQgdGhpcyBpcyBhbiBleGNlcHRpb24gc2luY2UKICAgICAgICAgICAgICAgICAgKiB0aGUgdXNlciBjYW4gc3RpbGwgbmF2aWdhdGUgdGhlIHdlYiBwYWdlIHdpdGggdGhlIHpvb20KICAgICAgICAgICAgICAgICAgKiBjb250cm9scyBzaG93aW5nLgogICAgICAgICAgICAgICAgICAqLwotICAgICAgICAgICAgICAgIC8vIElmIG91ciB3aW5kb3cgaGFzIGxvc3QgZm9jdXMsIHN0b3AgZHJhd2luZyB0aGUgY3Vyc29yIHJpbmcKICAgICAgICAgICAgICAgICBtRHJhd0N1cnNvclJpbmcgPSBmYWxzZTsKICAgICAgICAgICAgIH0KICAgICAgICAgICAgIG1Hb3RLZXlEb3duID0gZmFsc2U7CkBAIC00MTgzLDcgKzQyNDIsNyBAQAogICAgICAgICAgICAgaWYgKG1OYXRpdmVDbGFzcyAhPSAwKSB7CiAgICAgICAgICAgICAgICAgbmF0aXZlUmVjb3JkQnV0dG9ucyhmYWxzZSwgZmFsc2UsIHRydWUpOwogICAgICAgICAgICAgfQotICAgICAgICAgICAgc2V0Rm9jdXNDb250cm9sbGVySW5hY3RpdmUoKTsKKyAgICAgICAgICAgIHNldEZvY3VzQ29udHJvbGxlckFjdGl2ZShmYWxzZSk7CiAgICAgICAgIH0KICAgICAgICAgaW52YWxpZGF0ZSgpOwogICAgIH0KQEAgLTQxOTQsOSArNDI1Myw5IEBACiAgICAgcHVibGljIHZvaWQgb25XaW5kb3dGb2N1c0NoYW5nZWQoYm9vbGVhbiBoYXNXaW5kb3dGb2N1cykgewogICAgICAgICBzZXRBY3RpdmUoaGFzV2luZG93Rm9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pIHsKLSAgICAgICAgICAgIC8vIHdoZW4gY2hhbmdlIGZyb20gbmFycm93IHNjcmVlbiB0byB3aWRlIHNjcmVlbiwgdGhlIG5ldyB2aWV3V2lkdGgKLSAgICAgICAgICAgIC8vIGNhbiBiZSB3aWRlciB0aGFuIHRoZSBvbGQgY29udGVudCB3aWR0aC4gV2UgbGltaXQgdGhlIG1pbmltdW0KLSAgICAgICAgICAgIC8vIHNjYWxlIHRvIDEuMGYuIFRoZSBwcm9wZXIgbWluaW11bSBzY2FsZSB3aWxsIGJlIGNhbGN1bGF0ZWQgd2hlbgotICAgICAgICAgICAgLy8gdGhlIG5ldyBwaWN0dXJlIHNob3dzIHVwLgotICAgICAgICAgICAgbU1pblpvb21TY2FsZSA9IE1hdGgubWluKDEuMGYsIChmbG9hdCkgZ2V0Vmlld1dpZHRoKCkKLSAgICAgICAgICAgICAgICAgICAgLyAobURyYXdIaXN0b3J5ID8gbUhpc3RvcnlQaWN0dXJlLmdldFdpZHRoKCkKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICA6IG1ab29tT3ZlcnZpZXdXaWR0aCkpOwotICAgICAgICAgICAgaWYgKG1Jbml0aWFsU2NhbGVJblBlcmNlbnQgPiAwKSB7Ci0gICAgICAgICAgICAgICAgLy8gbGltaXQgdGhlIG1pblpvb21TY2FsZSB0byB0aGUgaW5pdGlhbFNjYWxlIGlmIGl0IGlzIHNldAotICAgICAgICAgICAgICAgIGZsb2F0IGluaXRpYWxTY2FsZSA9IG1Jbml0aWFsU2NhbGVJblBlcmNlbnQgLyAxMDAuMGY7Ci0gICAgICAgICAgICAgICAgaWYgKG1NaW5ab29tU2NhbGUgPiBpbml0aWFsU2NhbGUpIHsKLSAgICAgICAgICAgICAgICAgICAgbU1pblpvb21TY2FsZSA9IGluaXRpYWxTY2FsZTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQotICAgICAgICBkaXNtaXNzWm9vbUNvbnRyb2woKTsK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KSB7Ci0gICAgICAgICAgICAgICAgbVByZXZpZXdab29tT25seSA9IGZhbHNlOwotICAgICAgICAgICAgICAgIG1BbmNob3JYID0gdmlld1RvQ29udGVudFgoKGludCkgbVpvb21DZW50ZXJYICsgbVNjcm9sbFgpOwotICAgICAgICAgICAgICAgIG1BbmNob3JZID0gdmlld1RvQ29udGVudFkoKGludCkgbVpvb21DZW50ZXJZICsgbVNjcm9sbFkpOwotICAgICAgICAgICAgICAgIC8vIGRvbid0IHJlZmxvdyB3aGVuIHpvb20gaW47IHdoZW4gem9vbSBvdXQsIGRvIHJlZmxvdyBpZiB0aGUKLSAgICAgICAgICAgICAgICAvLyBuZXcgc2NhbGUgaXMgYWxtb3N0IG1pbmltdW0gc2NhbGU7Ci0gICAgICAgICAgICAgICAgYm9vbGVhbiByZWZsb3dOb3cgPSAobUFjdHVhbFNjYWxlIC0gbU1pblpvb21TY2FsZQotICAgICAgICAgICAgICAgICAgICAgICAgPD0gTUlOSU1VTV9TQ0FMRV9JTkNSRU1FTlQpCi0gICAgICAgICAgICAgICAgICAgICAgICB8fCAoKG1BY3R1YWxTY2FsZSA8PSAwLjggKiBtVGV4dFdyYXBTY2FsZSkpOwotICAgICAgICAgICAgICAgIC8vIGZvcmNlIHpvb20gYWZ0ZXIgbVByZXZpZXdab29tT25seSBpcyBzZXQgdG8gZmFsc2Ugc28gdGhhdCB0aGUKLSAgICAgICAgICAgICAgICAvLyBuZXcgdmlldyBzaXplIHdpbGwgYmUgcGFzc2VkIHRvIHRoZSBXZWJLaXQKLSAgICAgICAgICAgICAgICBzZXROZXdab29tU2NhbGUobUFjdHVhbFNjYWxlLCByZWZsb3dOb3csIHRydWUpOwotICAgICAgICAgICAgICAgIC8vIGNhbGwgaW52YWxpZGF0ZSgpIHRvIGRyYXcgd2l0aG91dCB6b29tIGZpbHRlcgotICAgICAgICAgICAgICAgIGludmFsaWRhdGUoKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIC8vIGFkanVzdCB0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3RvcikgewotICAgICAgICAgICAgZmxvYXQgc2NhbGUgPSAoZmxvYXQpIChNYXRoLnJvdW5kKGRldGVjdG9yLmdldFNjYWxlRmFjdG9yKCkKLSAgICAgICAgICAgICAgICAgICAgKiBtQWN0dWFsU2NhbGUgKiAxMDApIC8gMTAwLjApOwotICAgICAgICAgICAgaWYgKE1hdGguYWJzKHNjYWxlIC0gbUFjdHVhbFNjYWxlKSA+PSBNSU5JTVVNX1NDQUxFX0lOQ1JFTUVOVCkgewotICAgICAgICAgICAgICAgIG1QcmV2aWV3Wm9vbU9ubHkgPSB0cnVlOwotICAgICAgICAgICAgICAgIC8vIGxpbWl0IHRoZSBzY2FsZSBjaGFuZ2UgcGVyIHN0ZXAKLSAgICAgICAgICAgICAgICBpZiAoc2NhbGUgPiBtQWN0dWFsU2NhbGUpIHsKLSAgICAgICAgICAgICAgICAgICAgc2NhbGUgPSBNYXRoLm1pbihzY2FsZSwgbUFjdHVhbFNjYWxlICogMS4yNWYpOwotICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIHNjYWxlID0gTWF0aC5tYXgoc2NhbGUsIG1BY3R1YWxTY2FsZSAqIDAuOGYpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBtWm9vbUNlbnRlclggPSBkZXRlY3Rvci5nZXRGb2N1c1goKTsKLSAgICAgICAgICAgICAgICBtWm9vbUNlbnRlclkgPSBkZXRlY3Rvci5nZXRGb2N1c1koKTsKLSAgICAgICAgICAgICAgICBzZXROZXdab29tU2NhbGUoc2NhbGUsIGZhbHNlLCBmYWxzZSk7Ci0gICAgICAgICAgICAgICAgaW52YWxpZGF0ZSgpOwotICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwotICAgICAgICB9Ci0gICAgfQotCiAgICAgcHJpdmF0ZSBib29sZWFuIGhpdEZvY3VzZWRQbHVnaW4oaW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AoZHggKiAuNWYpOworICAgICAgICAgICAgICAgIGdlc3R1cmVZID0gZXYuZ2V0WSgwKSArIChkeSAqIC41Zik7CisgICAgICAgICAgICAgICAgLy8gTm93IHVzZSBhIGNvbnNpc3RlbnQgcG9pbnQgZm9yIHRyYWNraW5nIG1vdmVtZW50LgorICAgICAgICAgICAgICAgIGlmIChldi5nZXRYKDApIDwgZXYuZ2V0WCgxKSkgeworICAgICAgICAgICAgICAgICAgICB4ID0gZXYuZ2V0WCgwKTsKKyAgICAgICAgICAgICAgICAgICAgeSA9IGV2LmdldFkoMCk7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgeCA9IGV2LmdldFgoMSk7CisgICAgICAgICAgICAgICAgICAgIHkgPSBldi5nZXRZKDEpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBhY3Rpb24gPSBldi5nZXRBY3Rpb25NYXNrZWQoKTsKKyAgICAgICAgICAgICAgICBpZiAoZGlzdCA8IERSQUdfTEFZRVJfRklOR0VSX0RJU1RBTkNFKSB7CisgICAgICAgICAgICAgICAgICAgIHNraXBTY2FsZUdlc3R1cmUgPSB0cnVlOworICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAobVRvdWNoTW9kZSA9PSBUT1VDSF9EUkFHX0xBWUVSX01PREUpIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gRmluZ2VycyBtb3ZlZCB0b28gZmFyIGFwYXJ0IHdoaWxlIGRyYWdnaW5nLCB0aGUgdXNlcgorICAgICAgICAgICAgICAgICAgICAvLyBtaWdodCBiZSB0cnlpbmcgdG8gem9vbS4KKyAgICAgICAgICAgICAgICAgICAgbVRvdWNoTW9kZSA9IFRPVUNIX0lOSVRfTU9ERTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKwogICAgICAgICAvLyBGSVhNRTogd2UgbWF5IGNvbnNpZGVyIHRvIGdpdmUgV2ViS2l0IGFuIG9wdGlvbiB0byBoYW5kbGUgbXVsdGktdG91Y2gKICAgICAgICAgLy8gZXZlbnRzIGxhdGVyLgotICAgICAgICBpZiAobVN1cHBvcnRNdWx0aVRvdWNoICYmIGV2LmdldFBvaW50ZXJDb3VudCgpID4gMSkgewotICAgICAgICAgICAgaWYgKG1NaW5ab29tU2NhbGUgPCBtTWF4Wm9vbVNjYWxlKSB7Ci0gICAgICAgICAgICAgICAgbVNjYWxlRGV0ZWN0b3Iub25Ub3VjaEV2ZW50KGV2KTsKLSAgICAgICAgICAgICAgICBpZiAobVNjYWxlRGV0ZWN0b3IuaXNJblByb2dyZXNzKCkpIHsKLSAgICAgICAgICAgICAgICAgICAgbUxhc3RUb3VjaFRpbWUgPSBldmVudFRpbWU7Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB4ID0gbVNjYWxlRGV0ZWN0b3IuZ2V0Rm9jdXNYKCk7Ci0gICAgICAgICAgICAgICAgeSA9IG1TY2FsZURldGVjdG9yLmdldEZvY3VzWSgpOwotICAgICAgICAgICAgICAgIGFjdGlvbiA9IGV2LmdldEFjdGlvbigpICYgTW90aW9uRXZlbnQuQUNUSU9OX01BU0s7Ci0gICAgICAgICAgICAgICAgaWYgKGFjdGlvbiA9PSBNb3Rpb25FdmVudC5BQ1RJT05fUE9JTlRFUl9ET1dOKSB7Ci0gICAgICAgICAgICAgICAgICAgIGNhbmNlbFRvdWNoKCk7Ci0gICAgICAgICAgICAgICAgICAgIGFjdGlvbiA9IE1vdGlvbkV2ZW50LkFDVElPTl9ET1dOOwotICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoYWN0aW9uID09IE1vdGlvbkV2ZW50LkFDVElPTl9QT0lOVEVSX1VQKSB7Ci0gICAgICAgICAgICAgICAgICAgIC8vIHNldCBtTGFzdFRvdWNoWC9ZIHRvIHRoZSByZW1haW5pbmcgcG9pbnQKLSAgICAgICAgICAgICAgICAgICAgbUxhc3RUb3VjaFggPSB4OwotICAgICAgICAgICAgICAgICAgICBtTGFzdFRvdWNoWSA9IHk7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChhY3Rpb24gPT0gTW90aW9uRXZlbnQuQUNUSU9OX01PVkUpIHsKLSAgICAgICAgICAgICAgICAgICAgLy8gbmVnYXRpdmUgeCBvciB5IGluZGljYXRlIGl0IGlzIG9uIHRoZSBlZGdlLCBza2lwIGl0LgotICAgICAgICAgICAgICAgICAgICBpZiAoeCA8IDAgfHwgeSA8IDApIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAvLyBpZiB0aGUgcGFnZSBkaXNhbGxvdyB6b29tLCBza2lwIG11bHRpLXBvaW50ZXIgYWN0aW9uCisgICAgICAgIGlmIChtWm9vbU1hbmFnZXIuc3VwcG9ydHNNdWx0aVRvdWNoWm9vbSgpICYmIGV2LmdldFBvaW50ZXJDb3VudCgpID4gMSAmJgorICAgICAgICAgICAgICAgIG1Ub3VjaE1vZGUgIT0gVE9VQ0hfRFJBR19MQVlFUl9NT0RFICYmICFza2lwU2NhbGVHZXN0dXJlKSB7CisKKyAgICAgICAgICAgIC8vIGlmIHRoZSBwYWdlIGRpc2FsbG93cyB6b29tLCBza2lwIG11bHRpLXBvaW50ZXIgYWN0aW9uCisgICAgICAgICAgICBpZiAobVpvb21NYW5hZ2VyLmlzWm9vbVNjYWxlRml4ZWQoKSkgewogICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgICAgICAgfQotICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgYWN0aW9uID0gZXYuZ2V0QWN0aW9uKCk7Ci0gICAgICAgICAgICB4ID0gZXYuZ2V0WCgpOwotICAgICAgICAgICAgeSA9IGV2LmdldFkoKTsKKworICAgICAgICAgICAgaWYgKCFkZXRlY3Rvci5pc0luUHJvZ3Jlc3MoKSAmJgorICAgICAgICAgICAgICAgICAgICBldi5nZXRBY3Rpb25NYXNrZWQoKSAhPSBNb3Rpb25FdmVudC5BQ1RJT05fUE9JTlRFUl9ET1dOKSB7CisgICAgICAgICAgICAgICAgLy8gSW5zZXJ0IGEgZmFrZSBwb2ludGVyIGRvd24gZXZlbnQgaW4gb3JkZXIgdG8gc3RhcnQKKyAgICAgICAgICAgICAgICAvLyB0aGUgem9vbSBzY2FsZSBkZXRlY3Rvci4KKyAgICAgICAgICAgICAgICBNb3Rpb25FdmVudCB0ZW1wID0gTW90aW9uRXZlbnQub2J0YWluKGV2KTsKKyAgICAgICAgICAgICAgICAvLyBDbGVhciB0aGUgb3JpZ2luYWwgZXZlbnQgYW5kIHNldCBpdCB0bworICAgICAgICAgICAgICAgIC8vIEFDVElPTl9QT0lOVEVSX0RPV04uCisgICAgICAgICAgICAgICAgdGVtcC5zZXRBY3Rpb24odGVtcC5nZXRBY3Rpb24oKSAmCisgICAgICAgICAgICAgICAgICAgICAgICB+TW90aW9uRXZlbnQuQUNUSU9OX01BU0sgfAorICAgICAgICAgICAgICAgICAgICAgICAgTW90aW9uRXZlbnQuQUNUSU9OX1BPSU5URVJfRE9XTik7CisgICAgICAgICAgICAgICAgZGV0ZWN0b3Iub25Ub3VjaEV2ZW50KHRlbXApOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBkZXRlY3Rvci5vblRvdWNoRXZlbnQoZXYpOworCisgICAgICAgICAgICBpZiAoZGV0ZWN0b3IuaXNJblByb2dyZXNzKCkpIHsKKyAgICAgICAgICAgICAgICBtTGFzdFRvdWNoVGltZSA9IGV2ZW50VGltZTsKKyAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgeCA9IGRldGVjdG9yLmdldEZvY3VzWCgpOworICAgICAgICAgICAgeSA9IGRldGVjdG9yLmdldEZvY3VzWSgpOworICAgICAgICAgICAgYWN0aW9uID0gZXYuZ2V0QWN0aW9uKCkgJiBNb3Rpb25FdmVudC5BQ1RJT05fTUFTSzsKKyAgICAgICAgICAgIGlmIChhY3Rpb24gPT0gTW90aW9uRXZlbnQuQUNUSU9OX1BPSU5URVJfRE9XTikgeworICAgICAgICAgICAgICAgIGNhbmNlbFRvdWNoKCk7CisgICAgICAgICAgICAgICAgYWN0aW9uID0gTW90aW9uRXZlbnQuQUNUSU9OX0RPV047CisgICAgICAgICAgICB9IGVsc2UgaWYgKGFjdGlvbiA9PSBNb3Rpb25FdmVudC5BQ1RJT05fUE9JTlRFUl9VUCkgeworICAgICAgICAgICAgICAgIC8vIHNldCBtTGFzdFRvdWNoWC9ZIHRvIHRoZSByZW1haW5pbmcgcG9pbnQKKyAgICAgICAgICAgICAgICBtTGFzdFRvdWNoWCA9IHg7CisgICAgICAgICAgICAgICAgbUxhc3RUb3VjaFkgPSB5OworICAgICAgICAgICAgfSBlbHNlIGlmIChhY3Rpb24gPT0gTW90aW9uRXZlbnQuQUNUSU9OX01PVkUpIHsKKyAgICAgICAgICAgICAgICAvLyBuZWdhdGl2ZSB4IG9yIHkgaW5kaWNhdGUgaXQgaXMgb24gdGhlIGVkZ2UsIHNraXAgaXQuCisgICAgICAgICAgICAgICAgaWYgKHggPCAwIHx8IHkgPCAwKSB7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KICAgICAgICAgfQogCiAgICAgICAgIC8vIER1ZSB0byB0aGUgdG91Y2ggc2NyZWVuIGVkZ2UgZWZmZWN0LCBhIHRvdWNoIGNsb3NlciB0byB0aGUgZWRnZQogICAgICAgICAvLyBhbHdheXMgc25hcHBlZCB0byB0aGUgZWRnZS4gQXMgZ2V0Vmlld1dpZHRoKCkgY2FuIGJlIGRpZmZlcmVudCBmcm9tCiAgICAgICAgIC8vIGdldFdpZHRoKCkgZHVlIHRvIHRoZSBzY3J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TY3JvbGxZICsgKGludCkgeTsKLSAgICAgICAgICAgICAgICAgICAgbVRvdWNoTW9kZSA9IFRPVUNIX1NFTEVDVF9NT0RFOwotICAgICAgICAgICAgICAgICAgICBpZiAoRGVidWdGbGFncy5XRUJfVklFVykgewotICAgICAgICAgICAgICAgICAgICAgICAgTG9nLnYoTE9HVEFHLCAic2VsZWN0PSIgKyBtU2VsZWN0WCArICIsIiArIG1TZWxlY3RZKTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBuYXRpdmVNb3ZlU2VsZWN0aW9uKGNvbnRlbnRYLCBjb250ZW50WSwgZmFsc2UpOwotICAgICAgICAgICAgICAgICAgICBtVG91Y2hTZWxlY3Rpb24gPSBtRXh0ZW5kU2VsZWN0aW9uID0gdHJ1ZTsKLSAgICAgICAgICAgICAgICAgICAgaW52YWxpZGF0ZSgpOyAvLyBkcmF3IHRoZSBpLWJlYW0gaW5zdGVhZCBvZiB0aGUgYXJyb3cKICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKG1Qcml2YXRlSGFuZGxlci5oYXNNZXNzYWdlcyhSRUxFQVNFX1NJTkdMRV9UQVApKSB7CiAgICAgICAgICAgICAgICAgICAgIG1Qcml2YXRlSGFuZGxlci5yZW1vdmVNZXNzYWdlcyhSRUxFQVNFX1NJTkdMRV9UQVApOworICAgICAgICAgICAgICAgICAgICBpZiAoZ2V0U2V0dGluZ3MoKS5zdXBwb3J0VG91Y2hPbmx5KCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJlbW92ZVRvdWNoSGlnaGxpZ2h0KHRydWUpOworICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgIGlmIChkZWx0YVggKiBkZWx0YVggKyBkZWx0YVkgKiBkZWx0YVkgPCBtRG91YmxlVGFwU2xvcFNxdWFyZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgbVRvdWNoTW9kZSA9IFRPVUNIX0RPVUJMRV9UQVBfTU9ERTsKICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKQEAgLTQ3OTAsMTcgKzQ3OTUsNDUgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGVudFgsIGNvbnRlbnRZKSA6IGZhbHNlOwogICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgfSBlbHNlIHsgLy8gdGhlIG5vcm1hbCBjYXNlCi0gICAgICAgICAgICAgICAgICAgIG1QcmV2aWV3Wm9vbU9ubHkgPSBmYWxzZTsKICAgICAgICAgICAgICAgICAgICAgbVRvdWNoTW9kZSA9IFRPVUNIX0lOSVRfTU9ERTsKICAgICAgICAgICAgICAgICAgICAgbURlZmVyVG91Y2hQcm9jZXNzID0gKCFpbkZ1bGxTY3JlZW5Nb2RlKCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmJiBtRm9yd2FyZFRvdWNoRXZlbnRzKSA/IGhpdEZvY3VzZWRQbHVnaW4oCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGVudFgsIGNvbnRlbnRZKSA6IGZhbHNlOwogICAgICAgICAgICAgICAgICAgICBtV2ViVmlld0NvcmUuc2VuZE1lc3NhZ2UoCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRXZlbnRIdWIuVVBEQVRFX0ZSQU1FX0NBQ0hFX0lGX0xPQURJTkcpOworICAgICAgICAgICAgICAgICAgICBpZiAoZ2V0U2V0dGluZ3MoKS5zdXBwb3J0VG91Y2hPbmx5KCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIFRvdWNoSGlnaGxpZ2h0RGF0YSBkYXRhID0gbmV3IFRvdWNoSGlnaGxpZ2h0RGF0YSgpOworICAgICAgICAgICAgICAgICAgICAgICAgZGF0YS5tWCA9IGNvbnRlbnRYOworICAgICAgICAgICAgICAgICAgICAgICAgZGF0YS5tWSA9IGNvbnRlbnRZOworICAgICAgICAgICAgICAgICAgICAgICAgZGF0YS5tU2xvcCA9IHZpZXdUb0NvbnRlbnREaW1lbnNpb24obU5hdlNsb3ApOworICAgICAgICAgICAgICAgICAgICAgICAgbVdlYlZpZXdDb3JlLnNlbmRNZXNzYWdlRGVsYXllZCgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRXZlbnRIdWIuR0VUX1RPVUNIX0hJR0hMSUdIVF9SRUNUUywgZGF0YSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVmlld0NvbmZpZ3VyYXRpb24uZ2V0VGFwVGltZW91dCgpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChERUJVR19UT1VDSF9ISUdITElHSFQpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZ2V0U2V0dGluZ3MoKS5nZXROYXZEdW1wKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVRvdWNoSGlnaGxpZ2h0WCA9IChpbnQpIHggKyBtU2Nyb2xsWDsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVRvdWNoSGlnaGxpZ2h0WSA9IChpbnQpIHkgKyBtU2Nyb2xsWTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVByaXZhdGVIYW5kbGVyLnBvc3REZWxheWVkKG5ldyBSdW5uYWJsZSgpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1YmxpYyB2b2lkIHJ1bigpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtVG91Y2hIaWdobGlnaHRYID0gbVRvdWNoSGlnaGxpZ2h0WSA9IDA7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW52YWxpZGF0ZSgpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBUT1VDSF9ISUdITElHSFRfRUxBUFNFX1RJTUUpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICBpZiAobUxvZ0V2ZW50ICYmIGV2ZW50VGltZSAtIG1MYXN0VG91Y2hVcFRpbWUgPCAxMDAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBFdmVudExvZy53cml0ZUV2ZW50KEV2ZW50TG9nVGFncy5CUk9XU0VSX0RPVUJMRV9UQVBfRFVSQVRJT04sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChldmVudFRpbWUgLSBtTGFzdFRvdWNoVXBUaW1lKSwgZXZlbnRUaW1lKTsKICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBpZiAobVNlbGVjdGluZ1RleHQpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1EcmF3U2VsZWN0aW9uUG9pbnRlciA9IGZhbHNlOworICAgICAgICAgICAgICAgICAgICAgICAgbVNlbGVjdGlvblN0YXJ0ZWQgPSBuYXRpdmVTdGFydFNlbGVjdGlvbihjb250ZW50WCwgY29udGVudFkpOworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKERlYnVnRmxhZ3MuV0VCX1ZJRVcpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBMb2cudihMT0dUQUcsICJzZWxlY3Q9IiArIGNvbnRlbnRYICsgIiwiICsgY29udGVudFkpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgaW52YWxpZGF0ZSgpOworICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIC8vIFRyaWdnZXIgdGhlIGxpbmsKICAgICAgICAgICAgICAgICBpZiAobVRvdWNoTW9kZSA9PSBUT1VDSF9JTklUX01PREUKQEAgLTQ4MjQsMTcgKzQ4NTcsMTUgQEAKICAgICAgICAgICAgICAgICAgICAgICAgIHRlZC5tWSA9IGNvbnRlbnRZOwogICAgICAgICAgICAgICAgICAgICAgICAgdGVkLm1NZXRhU3RhdGUgPSBldi5nZXRNZXRhU3RhdGUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgIHRlZC5tUmVwcm9jZXNzID0gbURlZmVyVG91Y2hQcm9jZXNzOworICAgICAgICAgICAgICAgICAgICAgICAgbVdlYlZpZXdDb3JlLnNlbmRNZXNzYWdlKEV2ZW50SHViLlRPVUNIX0VWRU5ULCB0ZWQpOwogICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1EZWZlclRvdWNoUHJvY2VzcykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHN0aWxsIG5lZWRzIHRvIHNldCB0aGVtIGZvciBjb21wdXRlIGRlbHRhWC9ZCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUxhc3RUb3VjaFggPSB4OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1MYXN0VG91Y2hZID0geTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ZWQubVZpZXdYID0geDsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ZWQubVZpZXdZID0geTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBtV2ViVmlld0NvcmUuc2VuZE1lc3NhZ2UoRXZlbnRIdWIuVE9VQ0hfRVZFTlQsIHRlZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICBtV2ViVmlld0NvcmUuc2VuZE1lc3NhZ2UoRXZlbnRIdWIuVE9VQ0hfRVZFTlQsIHRlZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWluRnVsbFNjcmVlbk1vZGUoKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1Qcml2YXRlSGFuZGxlci5yZW1vdmVNZXNzYWdlcyhQUkVWRU5UX0RFRkFVTFRfVElNRU9VVCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVByaXZhdGVIYW5kbGVyLnNlbmRNZXNzYWdlRGVsYXllZChtUHJpdmF0ZUhhbmRsZXIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5vYnRhaW5NZXNzYWdlKFBSRVZFTlRfREVGQVVMVF9USU1FT1VULAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb24sIDApLCBUQVBfVElNRU9VVCk7CkBAIC00ODU1LDI0ICs0ODg2LDI0IEBACiAgICAgICAgICAgICAgICAgICAgIGlmIChtVG91Y2hNb2RlID09IFRPVUNIX0RPVUJMRV9UQVBfTU9ERSkgewogICAgICAgICAgICAgICAgICAgICAgICAgbVRvdWNoTW9kZSA9IFRPVUNIX0lOSVRfTU9ERTsKICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBpZiAoZ2V0U2V0dGluZ3MoKS5zdXBwb3J0VG91Y2hPbmx5KCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJlbW92ZVRvdWNoSGlnaGxpZ2h0KHRydWUpOworICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIC8vIHBhc3MgdGhlIHRvdWNoIGV2ZW50cyBmcm9tIFVJIHRocmVhZCB0byBXZWJDb3JlIHRocmVhZAogICAgICAgICAgICAgICAgIGlmIChzaG91bGRGb3J3YXJkVG91Y2hFdmVudCgpICYmIG1Db25maXJtTW92ZSAmJiAoZmlyc3RNb3ZlCiAgICAgICAgICAgICAgICAgICAgICAgICB8fCBldmVudFRpbWUgLSBtTGFzdFNlbnRUb3VjaFRpbWUgPiBtQ3VycmVudFRvdWNoSW50ZXJ2YWwpKSB7Ci0gICAgICAgICAgICAgICAgICAgIG1MYXN0U2VudFRvdWNoVGltZSA9IGV2ZW50VGltZTsKICAgICAgICAgICAgICAgICAgICAgVG91Y2hFdmVudERhdGEgdGVkID0gbmV3IFRvdWNoRXZlbnREYXRhKCk7CiAgICAgICAgICAgICAgICAgICAgIHRlZC5tQWN0aW9uID0gYWN0aW9uOwogICAgICAgICAgICAgICAgICAgICB0ZWQubVggPSBjb250ZW50WDsKICAgICAgICAgICAgICAgICAgICAgdGVkLm1ZID0gY29udGVudFk7CiAgICAgICAgICAgICAgICAgICAgIHRlZC5tTWV0YVN0YXRlID0gZXYuZ2V0TWV0YVN0YXRlKCk7CiAgICAgICAgICAgICAgICAgICAgIHRlZC5tUmVwcm9jZXNzID0gbURlZmVyVG91Y2hQcm9jZXNzOworICAgICAgICAgICAgICAgICAgICBtV2ViVmlld0NvcmUuc2VuZE1lc3NhZ2UoRXZlbnRIdWIuVE9VQ0hfRVZFTlQsIHRlZCk7CisgICAgICAgICAgICAgICAgICAgIG1MYXN0U2VudFRvdWNoVGltZSA9IGV2ZW50VGltZTsKICAgICAgICAgICAgICAgICAgICAgaWYgKG1EZWZlclRvdWNoUHJvY2VzcykgewotICAgICAgICAgICAgICAgICAgICAgICAgdGVkLm1WaWV3WCA9IHg7Ci0gICAgICAgICAgICAgICAgICAgICAgICB0ZWQubVZpZXdZID0geTsKLSAgICAgICAgICAgICAgICAgICAgICAgIG1XZWJWaWV3Q29yZS5zZW5kTWVzc2FnZShFdmVudEh1Yi5UT1VDSF9FVkVOVCwgdGVkKTsKICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIG1XZWJWaWV3Q29yZS5zZW5kTWVzc2FnZShFdmVudEh1Yi5UT1VDSF9FVkVOVCwgdGVkKTsKICAgICAgICAgICAgICAgICAgICAgaWYgKGZpcnN0TW92ZSAmJiAhaW5GdWxsU2NyZWVuTW9kZSgpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBtUHJpdmF0ZUhhbmRsZXIuc2VuZE1lc3NhZ2VEZWxheWVkKG1Qcml2YXRlSGFuZGxlcgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAub2J0YWluTWVzc2FnZShQUkVWRU5UX0RFRkFVTFRfVElNRU9VVCwKQEAgLTQ4OTIsMjAgKzQ5MjMsMjIgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICArICIgbVRvdWNoTW9kZSA9ICIgKyBtVG91Y2hNb2RlKTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgbVZlbG9jaXR5VHJhY2tlci5hZGRNb3ZlbWVudChldik7Ci0gICAgICAgICAgICAgICAgaWYgKG1Ub3VjaE1vZGUgIT0gVE9VQ0hfRFJBR19NT0RFKSB7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChtVG91Y2hNb2RlID09IFRPVUNIX1NFTEVDVF9NT0RFKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBtU2VsZWN0WCA9IG1TY3JvbGxYICsgKGludCkgeDsKLSAgICAgICAgICAgICAgICAgICAgICAgIG1TZWxlY3RZID0gbVNjcm9sbFkgKyAoaW50KSB5OwotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKERlYnVnRmxhZ3MuV0VCX1ZJRVcpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBMb2cudihMT0dUQUcsICJ4dGVuZD0iICsgbVNlbGVjdFggKyAiLCIgKyBtU2VsZWN0WSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICBuYXRpdmVNb3ZlU2VsZWN0aW9uKGNvbnRlbnRYLCBjb250ZW50WSwgdHJ1ZSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpbnZhbGlkYXRlKCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBpZiAobVNlbGVjdGluZ1RleHQgJiYgbVNlbGVjdGlvblN0YXJ0ZWQpIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKERlYnVnRmxhZ3MuV0VCX1ZJRVcpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIExvZy52KExPR1RBRywgImV4dGVuZD0iICsgY29udGVudFggKyAiLCIgKyBjb250ZW50WSk7CiAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgbmF0aXZlRXh0ZW5kU2VsZWN0aW9uKGNvbnRlbnRYLCBjb250ZW50WSk7CisgICAgICAgICAgICAgICAgICAgIGludmFsaWRhdGUoKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgaWYgKG1Ub3VjaE1vZGUgIT0gVE9VQ0hfRFJBR19NT0RFICYmCisgICAgICAgICAgICAgICAgICAgICAgICBtVG91Y2hNb2RlICE9IFRPVUNIX0RSQUdfTEFZRVJfTU9ERSkgeworCiAgICAgICAgICAgICAgICAgICAgIGlmICghbUNvbmZpcm1Nb3ZlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgfQorCiAgICAgICAgICAgICAgICAgICAgIGlmIChtUHJldmVudERlZmF1bHQgPT0gUFJFVkVOVF9ERUZBVUxUX01BWUJFX1lFUwogICAgICAgICAgICAgICAgICAgICAgICAgICAgIHx8IG1QcmV2ZW50RGVmYXVsdCA9PSBQUkVWRU5UX0RFRkFVTFRfTk9fRlJPTV9UT1VDSF9ET1dOKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAvLyB0cmFjayBtTGFzdFRvdWNoVGltZSBhcyB3ZSBtYXkgbmVlZCB0byBkbyBmbGluZyBhdApAQCAtNDkzMiw2ICs0OTY1LDkgQEAKICAgICAgICAgICAgICAgICAgICAgZGVsdGFYID0gMDsKICAgICAgICAgICAgICAgICAgICAgZGVsdGFZID0gMDsKIAorICAgICAgICAgICAgICAgICAgICBpZiAoc2tpcFNjYWxlR2VzdHVyZSkgeworICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnRTY3JvbGxpbmdMYXllcihnZXN0dXJlWCwgZ2VzdHVyZVkpOworICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgIHN0YXJ0RHJhZygpOwogICAgICAgICAgICAgICAgIH0KIApAQCAtNDk0MCwxNyArNDk3NiwxOSBAQAogICAgICAgICAgICAgICAgIH0KIAogICAgICAgICAgICAgICAgIC8vIGRvIHBhbgotICAgICAgICAgICAgICAgIGludCBuZXdTY3JvbGxYID0gcGluTG9jWChtU2Nyb2xsWCArIGRlbHRhWCk7Ci0gICAgICAgICAgICAgICAgaW50IG5ld0RlbHRhWCA9IG5ld1Njcm9sbFggLSBtU2Nyb2xsWDsKLSAgICAgICAgICAgICAgICBpZiAoZGVsdGFYICE9IG5ld0RlbHRhWCkgewotICAgICAgICAgICAgICAgICAgICBkZWx0YVggPSBuZXdEZWx0YVg7Ci0gICAgICAgICAgICAgICAgICAgIGZEZWx0YVggPSAoZmxvYXQpIG5ld0RlbHRhWDsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgaW50IG5ld1Njcm9sbFkgPSBwaW5Mb2NZKG1TY3JvbGxZICsgZGVsdGFZKTsKLSAgICAgICAgICAgICAgICBpbnQgbmV3RGVsdGFZID0gbmV3U2Nyb2xsWSAtIG1TY3JvbGxZOwotICAgICAgICAgICAgICAgIGlmIChkZWx0YVkgIT0gbmV3RGVsdGFZKSB7Ci0gICAgICAgICAgICAgICAgICAgIGRlbHRhWSA9IG5ld0RlbHRhWTsKLSAgICAgICAgICAgICAgICAgICAgZkRlbHRhWSA9IChmbG9hdCkgbmV3RGVsdGFZOworICAgICAgICAgICAgICAgIGlmIChtVG91Y2hNb2RlICE9IFRPVUNIX0RSQUdfTEFZRVJfTU9ERSkgeworICAgICAgICAgICAgICAgICAgICBpbnQgbmV3U2Nyb2xsWCA9IHBpbkxvY1gobVNjcm9sbFggKyBkZWx0YVgpOworICAgICAgICAgICAgICAgICAgICBpbnQgbmV3RGVsdGFYID0gbmV3U2Nyb2xsWCAtIG1TY3JvbGxYOworICAgICAgICAgICAgICAgICAgICBpZiAoZGVsdGFYICE9IG5ld0RlbHRhWCkgeworICAgICAgICAgICAgICAgICAgICAgICAgZGVsdGFYID0gbmV3RGVsdGFYOworICAgICAgICAgICAgICAgICAgICAgICAgZkRlbHRhWCA9IChmbG9hdCkgbmV3RGVsdGFYOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGludCBuZXdTY3JvbGxZID0gcGluTG9jWShtU2Nyb2xsWSArIGRlbHRhWSk7CisgICAgICAgICAgICAgICAgICAgIGludCBuZXdEZWx0YVkgPSBuZXdTY3JvbGxZIC0gbVNjcm9sbFk7CisgICAgICAgICAgICAgICAgICAgIGlmIChkZWx0YVkgIT0gbmV3RGVsdGFZKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBkZWx0YVkgPSBuZXdEZWx0YVk7CisgICAgICAgICAgICAgICAgICAgICAgICBmRGVsdGFZID0gKGZsb2F0KSBuZXdEZWx0YVk7CisgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgYm9vbGVhbiBkb25lID0gZmFsc2U7CiAgICAgICAgICAgICAgICAgYm9vbGVhbiBrZWVwU2Nyb2xsQmFyc1Zpc2libGUgPSBmYWxzZTsKQEAgLTUwMTgsNyArNTA1Niw5IEBACiAKICAgICAgICAgICAgICAgICBkb0RyYWcoZGVsdGFYLCBkZWx0YVkpOwogCi0gICAgICAgICAgICAgICAgaWYgKGtlZXBTY3JvbGxCYXJzVmlzaWJsZSkgeworICAgICAgICAgICAgICAgIC8vIFR1cm4gb2ZmIHNjcm9sbGJhcnMgd2hlbiBkcmFnZ2luZyBhIGxheWVyLgorICAgICAgICAgICAgICAgIGlmIChrZWVwU2Nyb2xsQmFyc1Zpc2libGUgJiYKKyAgICAgICAgICAgICAgICAgICAgICAgIG1Ub3VjaE1vZGUgIT0gVE9VQ0hfRFJBR19MQVlFUl9NT0RFKSB7CiAgICAgICAgICAgICAgICAgICAgIGlmIChtSGVsZE1vdGlvbmxlc3MgIT0gTU9USU9OTEVTU19UUlVFKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBtSGVsZE1vdGlvbmxlc3MgPSBNT1RJT05MRVNTX1RSVUU7CiAgICAgICAgICAgICAgICAgICAgICAgICBpbnZhbGlkYXRlKCk7CkBAIC01MDMzLDYgKzUwNzMsNyBAQAogICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgfQogICAgICAgICAgICAgY2FzZSBNb3Rpb25FdmVudC5BQ1RJT05fVVA6IHsKKyAgICAgICAgICAgICAgICBpZiAoIWlzRm9jdXNlZCgpKSByZXF1ZXN0Rm9jdXMoKTsKICAgICAgICAgICAgICAgICAvLyBwYXNzIHRoZSB0b3VjaCBldmVudHMgZnJvbSBVSSB0aHJlYWQgdG8gV2ViQ29yZSB0aHJlYWQKICAgICAgICAgICAgICAgICBpZiAoc2hvdWxkRm9yd2FyZFRvdWNoRXZlbnQoKSkgewogICAgICAgICAgICAgICAgICAgICBUb3VjaEV2ZW50RGF0YSB0ZWQgPSBuZXcgVG91Y2hFdmVudERhdGEoKTsKQEAgLTUwNDEsMTAgKzUwODIsNiBAQAogICAgICAgICAgICAgICAgICAgICB0ZWQubVkgPSBjb250ZW50WTsKICAgICAgICAgICAgICAgICAgICAgdGVkLm1NZXRhU3RhdGUgPSBldi5nZXRNZXRhU3RhdGUoKTsKICAgICAgICAgICAgICAgICAgICAgdGVkLm1SZXByb2Nlc3MgPSBtRGVmZXJUb3VjaFByb2Nlc3M7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChtRGVmZXJUb3VjaFByb2Nlc3MpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHRlZC5tVmlld1ggPSB4OwotICAgICAgICAgICAgICAgICAgICAgICAgdGVkLm1WaWV3WSA9IHk7Ci0gICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgbVdlYlZpZXdDb3JlLnNlbmRNZXNzYWdlKEV2ZW50SHViLlRPVUNIX0VWRU5ULCB0ZWQpOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBtTGFzdFRvdWNoVXBUaW1lID0gZXZlbnRUaW1lOwpAQCAtNTA1OSwyMCArNTA5NiwxMiBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRlZC5tWSA9IGNvbnRlbnRZOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRlZC5tTWV0YVN0YXRlID0gZXYuZ2V0TWV0YVN0YXRlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGVkLm1SZXByb2Nlc3MgPSBtRGVmZXJUb3VjaFByb2Nlc3M7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1EZWZlclRvdWNoUHJvY2VzcykgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ZWQubVZpZXdYID0geDsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGVkLm1WaWV3WSA9IHk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1XZWJWaWV3Q29yZS5zZW5kTWVzc2FnZShFdmVudEh1Yi5UT1VDSF9FVkVOVCwgdGVkKTsKICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAobVByZXZlbnREZWZhdWx0ICE9IFBSRVZFTlRfREVGQVVMVF9ZRVMpewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvRG91YmxlVGFwKCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVpvb21NYW5hZ2VyLmhhbmRsZURvdWJsZVRhcChtTGFzdFRvdWNoWCwgbUxhc3RUb3VjaFkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1Ub3VjaE1vZGUgPSBUT1VDSF9ET05FX01PREU7CiAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICAgICAgY2FzZSBUT1VDSF9TRUxFQ1RfTU9ERToKLSAgICAgICAgICAgICAgICAgICAgICAgIGNvbW1pdENvcHkoKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIG1Ub3VjaFNlbGVjdGlvbiA9IGZhbHNlOwotICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgIGNhc2UgVE9VQ0hfSU5JVF9NT0RFOiAvLyB0YXAKICAgICAgICAgICAgICAgICAgICAgY2FzZSBUT1VDSF9TSE9SVFBSRVNTX1NUQVJUX01PREU6CiAgICAgICAgICAgICAgICAgICAgIGNhc2UgVE9VQ0hfU0hPUlRQUkVTU19NT0RFOgpAQCAtNTA4NCw5ICs1MTEzLDE3IEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1QcmV2ZW50RGVmYXVsdCAhPSBQUkVWRU5UX0RFRkFVTFRfWUVTCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmJiAoY29tcHV0ZU1heFNjcm9sbFgoKSA+IDAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfHwgY29tcHV0ZU1heFNjcm9sbFkoKSA+IDApKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIFVJIHRha2VzIGNvbnRyb2wgYmFjaywgY2FuY2VsIFdlYkNvcmUgdG91Y2gKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FuY2VsV2ViQ29yZVRvdWNoRXZlbnQoY29udGVudFgsIGNvbnRlbnRZLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRydWUpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBJZiB0aGUgdXNlciBoYXMgcGVyZm9ybWVkIGEgdmVyeSBxdWljayB0b3VjaAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBzZXF1ZW5jZSBpdCBpcyBwb3NzaWJsZSB0aGF0IHdlIG1heSBnZXQgaGVyZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBiZWZvcmUgV2ViQ29yZSBoYXMgaGFkIGEgY2hhbmNlIHRvIHByb2Nlc3MgdGhlIGV2ZW50cy4KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gSW4gdGhpcyBjYXNlLCBhbnkgY2FsbCB0byBwcmV2ZW50RGVmYXVsdCBpbiB0aGUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gSlMgdG91Y2ggaGFuZGxlciB3aWxsIG5vdCBoYXZlIGJlZW4gZXhlY3V0ZWQgeWV0LgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBIZW5jZSB3ZSB3aWxsIHNlZSBib3RoIHRoZSBVSSAobm93KSBhbmQgV2ViQ29yZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyAod2hlbiBjb250ZXh0IHN3aXRjaGVzKSBoYW5kbGluZyB0aGUgZXZlbnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHJlZ2FyZGxlc3Mgb2Ygd2hldGhlciB0aGUgd2ViIGRldmVsb3BlciBhY3R1YWxseQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBkb2VzZXMgcHJldmVudERlZmF1bHQgaW4gdGhlaXIgdG91Y2ggaGFuZGxlci4gVGhpcworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBpcyB0aGUgbmF0dXJlIG9mIG91ciBhc3luY2hyb25vdXMgdG91Y2ggbW9kZWwuCisKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gd2Ugd2lsbCBub3QgcmV3cml0ZSBkcmFnIGNvZGUgaGVyZSwgYnV0IHdlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHdpbGwgdHJ5IGZsaW5nIGlmIGl0IGFwcGxpZXMuCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFdlYlZpZXdDb3JlLnJlZHVjZVByaW9yaXR5KCk7CkBAIC01MTAzLDcgKzUxNDAsMTcgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobVRvdWNoTW9kZSA9PSBUT1VDSF9JTklUX01PREUpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobVNlbGVjdGluZ1RleHQpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gdGFwcGluZyBvbiBzZWxlY3Rpb24gb3IgY29udHJvbHMgZG9lcyBub3RoaW5nCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghbmF0aXZlSGl0U2VsZWN0aW9uKGNvbnRlbnRYLCBjb250ZW50WSkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGVjdGlvbkRvbmUoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gb25seSB0cmlnZ2VyIGRvdWJsZSB0YXAgaWYgdGhlIFdlYlZpZXcgaXMKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBzY2FsYWJsZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtVG91Y2hNb2RlID09IFRPVUNIX0lOSVRfTU9ERQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJiYgKGNhblpvb21JbigpIHx8IGNhblpvb21PdXQoKSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVByaXZhdGVIYW5kbGVyLnNlbmRFbXB0eU1lc3NhZ2VEZWxheWVkKAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFJFTEVBU0VfU0lOR0xFX1RBUCwgVmlld0NvbmZpZ3VyYXRpb24KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5nZXREb3VibGVUYXBUaW1lb3V0KCkpOwpAQCAtNTEzOCw2ICs1MTg1LDcgQEAKICAgICAgICAgICAgICAgICAgICAgICAgIGludmFsaWRhdGUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGZhbGwgdGhyb3VnaAogICAgICAgICAgICAgICAgICAgICBjYXNlIFRPVUNIX0RSQUdfU1RBUlRfTU9ERToKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBUT1VDSF9EUkFHX0xBWUVSX01PREU6CiAgICAgICAgICAgICAgICAgICAgICAgICAvLyBUT1VDSF9EUkFHX1NUQVJUX01PREUgc2hvdWxkIG5vdCBoYXBwZW4gZm9yIHRoZSByZWFsCiAgICAgICAgICAgICAgICAgICAgICAgICAvLyBkZXZpY2UgYXMgd2UgYWxtb3N0IGNlcnRhaW4gd2lsbCBnZXQgYSBNT1ZFLiBCdXQgdGhpcwogICAgICAgICAgICAgICAgICAgICAgICAgLy8gaXMgcG9zc2libGUgb24gZW11bGF0b3IuCkBAIC01MTk0LDQwICs1MjQyLDI2IEBACiAgICAgICAgIGlmICghbURyYWdGcm9tVGV4dElucHV0KSB7CiAgICAgICAgICAgICBuYXRpdmVIaWRlQ3Vyc29yKCk7CiAgICAgICAgIH0KLSAgICAgICAgV2ViU2V0dGluZ3Mgc2V0dGluZ3MgPSBnZXRTZXR0aW5ncygpOwotICAgICAgICBpZiAoc2V0dGluZ3Muc3VwcG9ydFpvb20oKQotICAgICAgICAgICAgICAgICYmIHNldHRpbmdzLmdldEJ1aWx0SW5ab29tQ29udHJvbHMoKQotICAgICAgICAgICAgICAgICYmICFnZXRab29tQnV0dG9uc0NvbnRyb2xsZXIoKS5pc1Zpc2libGUoKQotICAgICAgICAgICAgICAgICYmIG1NaW5ab29tU2NhbGUgPCBtTWF4Wm9vbVNjYWxlCi0gICAgICAgICAgICAgICAgJiYgKG1Ib3Jpem9udGFsU2Nyb2xsQmFyTW9kZSAhPSBTQ1JPTExCQVJfQUxXQVlTT0ZGCi0gICAgICAgICAgICAgICAgICAgICAgICB8fCBtVmVydGljYWxTY3JvbGxCYXJNb2RlICE9IFNDUk9MTEJBUl9BTFdBWVNPRkYpKSB7Ci0gICAgICAgICAgICBtWm9vbUJ1dHRvbnNDb250cm9sbGVyLnNldFZpc2libGUodHJ1ZSk7Ci0gICAgICAgICAgICBpbnQgY291bnQgPSBzZXR0aW5ncy5nZXREb3VibGVUYXBUb2FzdENvdW50KCk7Ci0gICAgICAgICAgICBpZiAobUluWm9vbU92ZXJ2aWV3ICYmIGNvdW50ID4gMCkgewotICAgICAgICAgICAgICAgIHNldHRpbmdzLnNldERvdWJsZVRhcFRvYXN0Q291bnQoLS1jb3VudCk7Ci0gICAgICAgICAgICAgICAgVG9hc3QubWFrZVRleHQobUNvbnRleHQsCi0gICAgICAgICAgICAgICAgICAgICAgICBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0cmluZy5kb3VibGVfdGFwX3RvYXN0LAotICAgICAgICAgICAgICAgICAgICAgICAgVG9hc3QuTEVOR1RIX0xPTkcpLnNob3coKTsKLSAgICAgICAgICAgIH0KKworICAgICAgICBpZiAobUhvcml6b250YWxTY3JvbGxCYXJNb2RlICE9IFNDUk9MTEJBUl9BTFdBWVNPRkYKKyAgICAgICAgICAgICAgICB8fCBtVmVydGljYWxTY3JvbGxCYXJNb2RlICE9IFNDUk9MTEJBUl9BTFdBWVNPRkYpIHsKKyAgICAgICAgICAgIG1ab29tTWFuYWdlci5pbnZva2Vab29tUGlja2VyKCk7CiAgICAgICAgIH0KICAgICB9CiAKICAgICBwcml2YXRlIHZvaWQgZG9EcmFnKGludCBkZWx0YVgsIGludCBkZWx0YVkpIHsKICAgICAgICAgaWYgKChkZWx0YVggfCBkZWx0YVkpICE9IDApIHsKKyAgICAgICAgICAgIGlmIChtVG91Y2hNb2RlID09IFRPVUNIX0RSQUdfTEFZRVJfTU9ERSkgeworICAgICAgICAgICAgICAgIGRlbHRhWCA9IHZpZXdUb0NvbnRlbnREaW1lbnNpb24oZGVsdGFYKTsKKyAgICAgICAgICAgICAgICBkZWx0YVkgPSB2aWV3VG9Db250ZW50RGltZW5zaW9uKGRlbHRhWSk7CisgICAgICAgICAgICAgICAgaWYgKG5hdGl2ZVNjcm9sbExheWVyKG1TY3JvbGxpbmdMYXllciwgZGVsdGFYLCBkZWx0YVkpKSB7CisgICAgICAgICAgICAgICAgICAgIGludmFsaWRhdGUoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgfQogICAgICAgICAgICAgc2Nyb2xsQnkoZGVsdGFYLCBkZWx0YVkpOwogICAgICAgICB9Ci0gICAgICAgIGlmICghZ2V0U2V0dGluZ3MoKS5nZXRCdWlsdEluWm9vbUNvbnRyb2xzKCkpIHsKLSAgICAgICAgICAgIGJvb2xlYW4gc2hvd1BsdXNNaW51cyA9IG1NaW5ab29tU2NhbGUgPCBtTWF4Wm9vbVNjYWxlOwotICAgICAgICAgICAgaWYgKG1ab29tQ29udHJvbHMgIT0gbnVsbCAmJiBzaG93UGx1c01pbnVzKSB7Ci0gICAgICAgICAgICAgICAgaWYgKG1ab29tQ29udHJvbHMuZ2V0VmlzaWJpbGl0eSgpID09IFZpZXcuVklTSUJMRSkgewotICAgICAgICAgICAgICAgICAgICBtUHJpdmF0ZUhhbmRsZXIucmVtb3ZlQ2FsbGJhY2tzKG1ab29tQ29udHJvbFJ1bm5hYmxlKTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICBtWm9vbUNvbnRyb2xzLnNob3coc2hvd1BsdXNNaW51cywgZmFsc2UpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBtUHJpdmF0ZUhhbmRsZXIucG9zdERlbGF5ZWQobVpvb21Db250cm9sUnVubmFibGUsCi0gICAgICAgICAgICAgICAgICAgICAgICBaT09NX0NPTlRST0xTX1RJTUVPVVQpOwotICAgICAgICAgICAgfQotICAgICAgICB9CisgICAgICAgIG1ab29tTWFuYWdlci5rZWVwWm9vbVBpY2tlclZpc2libGUoKTsKICAgICB9CiAKICAgICBwcml2YXRlIHZvaWQgc3RvcFRvdWNoKCkgewpAQCAtNTI1NCw3ICs1Mjg4LDggQEAKICAgICAgICAgICAgIG1WZWxvY2l0eVRyYWNrZXIucmVjeWNsZSgpOwogICAgICAgICAgICAgbVZlbG9jaXR5VHJhY2tlciA9IG51bGw7CiAgICAgICAgIH0KLSAgICAgICAgaWYgKG1Ub3VjaE1vZGUgPT0gVE9VQ0hfRFJBR19NT0RFKSB7CisgICAgICAgIGlmIChtVG91Y2hNb2RlID09IFRPVUNIX0RSQUdfTU9ERSB8fAorICAgICAgICAgICAgICAgIG1Ub3VjaE1vZGUgPT0gVE9VQ0hfRFJBR19MQVlFUl9NT0RFKSB7CiAgICAgICAgICAgICBXZWJWaWV3Q29yZS5yZXN1bWVQcmlvcml0eSgpOwogICAgICAgICAgICAgV2ViVmlld0NvcmUucmVzdW1lVXBkYXRlUGljdHVyZShtV2ViVmlld0NvcmUpOwogICAgICAgICB9CkBAIC01MjYyLDYgKzUyOTcsOSBAQAogICAgICAgICBtUHJpdmF0ZUhhbmRsZXIucmVtb3ZlTWVzc2FnZXMoU1dJVENIX1RPX0xPTkdQUkVTUyk7CiAgICAgICAgIG1Qcml2YXRlSGFuZGxlci5yZW1vdmVNZXNzYWdlcyhEUkFHX0hFTERfTU9USU9OTEVTUyk7CiAgICAgICAgIG1Qcml2YXRlSGFuZGxlci5yZW1vdmVNZXNzYWdlcyhBV0FLRU5fU0NST0xMX0JBUlMpOworICA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BhZ2VVcCh0cnVlKTsKICAgICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgICB9Ci0gICAgICAgIGJvb2xlYW4gc2hpZnRQcmVzc2VkID0gbVNoaWZ0SXNQcmVzc2VkICYmIChtTmF0aXZlQ2xhc3MgPT0gMAotICAgICAgICAgICAgICAgIHx8ICFuYXRpdmVGb2N1c0lzUGx1Z2luKCkpOwogICAgICAgICBpZiAoZXYuZ2V0QWN0aW9uKCkgPT0gTW90aW9uRXZlbnQuQUNUSU9OX0RPV04pIHsKLSAgICAgICAgICAgIGlmIChzaGlmdFByZXNzZWQpIHsKKyAgICAgICAgICAgIGlmIChtU2VsZWN0aW5nVGV4dCkgewogICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOyAvLyBkaXNjYXJkIHByZXNzIGlmIGNvcHkgaW4gcHJvZ3Jlc3MKICAgICAgICAgICAgIH0KICAgICAgICAgICAgIG1UcmFja2JhbGxEb3duID0gdHJ1ZTsKQEAgLTUzNDEsMTEgKzUzNzksMTMgQEAKICAgICAgICAgICAgIG1Qcml2YXRlSGFuZGxlci5yZW1vdmVNZXNzYWdlcyhMT05HX1BSRVNTX0NFTlRFUik7CiAgICAgICAgICAgICBtVHJhY2tiYWxsRG93biA9IGZhbHNlOwogICAgICAgICAgICAgbVRyYWNrYmFsbFVwVGltZSA9IHRpbWU7Ci0gICAgICAgICAgICBpZiAoc2hpZnRQcmVzc2VkKSB7CisgICAgICAgICAgICBpZiAobVNlbGVjdGluZ1RleHQpIHsKICAgICAgICAgICAgICAgICBpZiAobUV4dGVuZFNlbGVjdGlvbikgewotICAgICAgICAgICAgICAgICAgICBjb21taXRDb3B5KCk7CisgICAgICAgICAgICAgICAgICAgIGNvcHlTZWxlY3Rpb24oKTsKKyAgICAgICAgICAgICAgICAgICAgc2VsZWN0aW9uRG9uZSgpOwogICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgIG1FeHRlbmRTZWxlY3Rpb24gPSB0cnVlOworICAgICAgICAgICAgICAgICAgICBuYXRpdmVTZXRFeHRlbmRTZWxlY3Rpb24oKTsKICAgICAgICAgICAgICAgICAgICAgaW52YWxpZGF0ZSgpOyAvLyBkcmF3IHRoZSBpLWJlYW0gaW5zdGVhZCBvZiB0aGUgYXJyb3cKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7IC8vIGRpc2NhcmQgcHJlc3MgaWYgY29weSBpbiBwcm9ncmVzcwpAQCAtNTQxMiw4ICs1NDUyLDcgQEAKICAgICAgICAgICAgICAgICAgICAgKyAiIHlSYXRlPSIgKyB5UmF0ZQogICAgICAgICAgICAgICAgICAgICApOwogICAgICAgICB9Ci0gICAgICAgIG5hdGl2ZU1vdmVTZWxlY3Rpb24odmlld1RvQ29udGVudFgobVNlbGVjdFgpLAotICAgICAgICAgICAgICAgIHZpZXdUb0NvbnRlbnRZKG1TZWxlY3RZKSwgbUV4dGVuZFNlbGVjdGlvbik7CisgICAgICAgIG5hdGl2ZU1vdmVTZWxlY3Rpb24odmlld1RvQ29udGVudFgobVNlbGVjdFgpLCB2aWV3VG9Db250ZW50WShtU2VsZWN0WSkpOwogICAgICAgICBpbnQgc2Nyb2xsWCA9IG1TZWxlY3RYIDwgbVNjcm9sbFggPyAtU0VMRUNUX0NVUlNPUl9PRkZTRVQKICAgICAgICAgICAgICAgICA6IG1TZWxlY3RYID4gbWF4WCAtIFNFTEVDVF9DVVJTT1JfT0ZGU0VUID8gU0VMRUNUX0NVUlNPUl9PRkZTRVQKICAgICAgICAgICAgICAgICA6IDA7CkBAIC01NDc5LDcgKzU1MTgsMTYgQEAKICAgICAgICAgZmxvYXQgeVJhdGUgPSBtVHJhY2tiYWxsUmVtYWluc1kgKiAxMDAwIC8gZWxhcHNlZDsKICAgICAgICAgaW50IHZpZXdXaWR0aCA9IGdldFZpZXdXaWR0aCgpOwogICAgICAgICBpbnQgdmlld0hlaWdodCA9IGdldFZpZXdIZWlnaHQoK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gKyAiIG1UcmFja2JhbGxSZW1haW5zWD0iICsgbVRyYWNrYmFsbFJlbWFpbnNYCiAgICAgICAgICAgICAgICAgICAgICAgICArICIgbVRyYWNrYmFsbFJlbWFpbnNZPSIgKyBtVHJhY2tiYWxsUmVtYWluc1kpOwogICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKG1OYXRpdmVDbGFzcyAhPSAwICYmIG5hdGl2ZUZvY3VzSXNQbHVnaW4oKSkgeworICAgICAgICAgICAgaWYgKG1OYXRpdmVDbGFzcyAhPSAwICYmIG5hdGl2ZVBhZ2VTaG91bGRIYW5kbGVTaGlmdEFuZEFycm93cygpKSB7CiAgICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBjb3VudDsgaSsrKSB7Ci0gICAgICAgICAgICAgICAgICAgIGxldFBsdWdpbkhhbmRsZU5hdktleShzZWxlY3RLZXlDb2RlLCB0aW1lLCB0cnVlKTsKKyAgICAgICAgICAgICAgICAgICAgbGV0UGFnZUhhbmRsZU5hdktleShzZWxlY3RLZXlDb2RlLCB0aW1lLCB0cnVlKTsKICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgbGV0UGx1Z2luSGFuZGxlTmF2S2V5KHNlbGVjdEtleUNvZGUsIHRpbWUsIGZhbHNlKTsKKyAgICAgICAgICAgICAgICBsZXRQYWdlSGFuZGxlTmF2S2V5KHNlbGVjdEtleUNvZGUsIHRpbWUsIGZhbHNlKTsKICAgICAgICAgICAgIH0gZWxzZSBpZiAobmF2SGFuZGxlZEtleShzZWxlY3RLZXlDb2RlLCBjb3VudCwgZmFsc2UsIHRpbWUpKSB7CiAgICAgICAgICAgICAgICAgcGxheVNvdW5kRWZmZWN0KGtleUNvZGVUb1NvdW5kc0VmZmVjdChzZWxlY3RLZXlDb2RlKSk7CiAgICAgICAgICAgICB9CkBAIC01NTYwLDYgKzU2MDgsMTkgQEAKICAgICAgICAgICAgICAgICAtIGdldFZpZXdIZWlnaHRXaXRoVG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eQorICAgICAgICAgICAgICAgID4gbUxhc3RWZWxvY2l0eSAqIE1JTklNVU1fVkVMT0NJVFlfUkFUSU9fRk9SX0FDQ0VMRVJBVElPTikgewogICAgICAgICAgICAgZmxvYXQgZGVsdGFSID0gKGZsb2F0KSAoTWF0aC5hYnMoTWF0aC5hdGFuMihtTGFzdFZlbFksIG1MYXN0VmVsWCkKICAgICAgICAgICAgICAgICAgICAgLSBNYXRoLmF0YW4yKHZ5LCB2eCkpKTsKICAgICAgICAgICAgIGZpbmFsIGZsb2F0IGNpcmNsZSA9IChmbG9hdCkgKE1hdGguUEkpICogMi4wZjsKICAgICAgICAgICAgIGlmIChkZWx0YVIgPiBjaXJjbGUgKiAwLjlmIHx8IGRlbHRhUiA8IGNpcmNsZSAqIDAuMWYpIHsKICAgICAgICAgICAgICAgICB2eCArPSBjdXJyZW50VmVsb2NpdHkgKiBtTGFzdFZlbFggLyBtTGFzdFZlbG9jaXR5OwogICAgICAgICAgICAgICAgIHZ5ICs9IGN1cnJlbnRWZWxvY2l0eSAqIG1MYXN0VmVsWSAvIG1MYXN0VmVsb2NpdHk7CisgICAgICAgICAgICAgICAgdmVsb2NpdHkgPSAoZmxvYXQpIE1hdGguaHlwb3QodngsIHZ5KTsKICAgICAgICAgICAgICAgICBpZiAoRGVidWdGbGFncy5XRUJfVklFVykgewogICAgICAgICAgICAgICAgICAgICBMb2cudihMT0dUQUcsICJkb0ZsaW5nIHZ4PSAiICsgdnggKyAiIHZ5PSIgKyB2eSk7CiAgICAgICAgICAgICAgICAgfQpAQCAtNTYxNyw0NSArNTY4MSwxNSBAQAogICAgICAgICB9CiAgICAgICAgIG1MYXN0VmVsWCA9IHZ4OwogICAgICAgICBtTGFzdFZlbFkgPSB2eTsKLSAgICAgICAgbUxhc3RWZWxvY2l0eSA9IChmbG9hdCkgTWF0aC5oeXBvdCh2eCwgdnkpOworICAgICAgICBtTGFzdFZlbG9jaXR5ID0gdmVsb2NpdHk7CiAKICAgICAgICAgbVNjcm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LncoTE9HVEFHLCAiVGhpcyBXZWJWaWV3IGRvZXNuJ3Qgc3VwcG9ydCB6b29tLiIpOwogICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgIH0KLSAgICAgICAgaWYgKG1ab29tQ29udHJvbHMgPT0gbnVsbCkgewotICAgICAgICAgICAgbVpvb21Db250cm9scyA9IGNyZWF0ZVpvb21Db250cm9scygpOwotCi0gICAgICAgICAgICAvKgotICAgICAgICAgICAgICogbmVlZCB0byBiZSBzZXQgdG8gVklTSUJMRSBmaXJzdCBzbyB0aGF0IGdldE1lYXN1cmVkSGVpZ2h0KCkgaW4KLSAgICAgICAgICAgICAqIHtAbGluayAjb25TaXplQ2hhbmdlZCgpfSBjYW4gcmV0dXJuIHRoZSBtZWFzdXJlZCB2YWx1ZSBmb3IgcHJvcGVyCi0gICAgICAgICAgICAgKiBsYXlvdXQuCi0gICAgICAgICAgICAgKi8KLSAgICAgICAgICAgIG1ab29tQ29udHJvbHMuc2V0VmlzaWJpbGl0eShWaWV3LlZJU0lCTEUpOwotICAgICAgICAgICAgbVpvb21Db250cm9sUnVubmFibGUgPSBuZXcgUnVubmFibGUoKSB7Ci0gICAgICAgICAgICAgICAgcHVibGljIHZvaWQgcnVuKCkgewotCi0gICAgICAgICAgICAgICAgICAgIC8qIERvbid0IGRpc21pc3MgdGhlIGNvbnRyb2xzIGlmIHRoZSB1c2VyIGhhcwotICAgICAgICAgICAgICAgICAgICAgKiBmb2N1cyBvbiB0aGVtLiBXYWl0IGFuZCBjaGVjayBhZ2FpbiBsYXRlci4KLSAgICAgICAgICAgICAgICAgICAgICovCi0gICAgICAgICAgICAgICAgICAgIGlmICghbVpvb21Db250cm9scy5oYXNGb2N1cygpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBtWm9vbUNvbnRyb2xzLmhpZGUoKTsKLSAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIG1Qcml2YXRlSGFuZGxlci5yZW1vdmVDYWxsYmFja3MobVpvb21Db250cm9sUnVubmFibGUpOwotICAgICAgICAgICAgICAgICAgICAgICAgbVByaXZhdGVIYW5kbGVyLnBvc3REZWxheWVkKG1ab29tQ29udHJvbFJ1bm5hYmxlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBaT09NX0NPTlRST0xTX1RJTUVPVVQpOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfTsKLSAgICAgICAgfQotICAgICAgICByZXR1cm4gbVpvb21Db250cm9sczsKKyAgICAgICAgcmV0dXJuIG1ab29tTWFuYWdlci5nZXRFeHRlcm5hbFpvb21QaWNrZXIoKTsKICAgICB9CiAKLSAgICBwcml2YXRlIEV4dGVuZGVkWm9vbUNvbnRyb2xzIGNyZWF0ZVpvb21Db250cm9scygpIHsKLSAgICAgICAgRXh0ZW5kZWRab29tQ29udHJvbHMgem9vbUNvbnRyb2xzID0gbmV3IEV4dGVuZGVkWm9vbUNvbnRyb2xzKG1Db250ZXh0Ci0gICAgICAgICAgICAsIG51bGwpOwotICAgICAgICB6b29tQ29udHJvbHMuc2V0T25ab29tSW5DbGlja0xpc3RlbmVyKG5ldyBPbkNsaWNrTGlzdGVuZXIoKSB7Ci0gICAgICAgICAgICBwdWJsaWMgdm9pZCBvbkNsaWNrKFZpZXcgdikgewotICAgICAgICAgICAgICAgIC8vIHJlc2V0IHRpbWUgb3V0Ci0gICAgICAgICAgICAgICAgbVByaXZhdGVIYW5kbGVyLnJlbW92ZUNhbGxiYWNrcyhtWm9vbUNvbnRyb2xSdW5uYWJsZSk7Ci0gICAgICAgICAgICAgICAgbVByaXZhdGVIYW5kbGVyLnBvc3REZWxheWVkKG1ab29tQ29udHJvbFJ1bm5hYmxlLAotICAgICAgICAgICAgICAgICAgICAgICAgWk9PTV9DT05UUk9MU19USU1FT1VUKTsKLSAgICAgICAgICAgICAgICB6b29tSW4oKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfSk7Ci0gICAgICAgIHpvb21Db250cm9scy5zZXRPblpvb21PdXRDbGlja0xpc3RlbmVyKG5ldyBPbkNsaWNrTGlzdGVuZXIoKSB7Ci0gICAgICAgICAgICBwdWJsaWMgdm9pZCBvbkNsaWNrKFZpZXcgdikgewotICAgICAgICAgICAgICAgIC8vIHJlc2V0IHRpbWUgb3V0Ci0gICAgICAgICAgICAgICAgbVByaXZhdGVIYW5kbGVyLnJlbW92ZUNhbGxiYWNrcyhtWm9vbUNvbnRyb2xSdW5uYWJsZSk7Ci0gICAgICAgICAgICAgICAgbVByaXZhdGVIYW5kbGVyLnBvc3REZWxheWVkKG1ab29tQ29udHJvbFJ1bm5hYmxlLAotICAgICAgICAgICAgICAgICAgICAgICAgWk9PTV9DT05UUk9MU19USU1FT1VUKTsKLSAgICAgICAgICAgICAgICB6b29tT3V0KCk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0pOwotICAgICAgICByZXR1cm4gem9vbUNvbnRyb2xzOworICAgIHZvaWQgZGlzbWlzc1pvb21Db250cm9sKCkgeworICAgICAgICBtWm9vbU1hbmFnZXIuZGlzbWlzc1pvb21QaWNrZXIoKTsKKyAgICB9CisKKyAgICBmbG9hdCBnZXREZWZhdWx0Wm9vbVNjYWxlKCkgeworICAgICAgICByZXR1cm4gbVpvb21NYW5hZ2VyLmdldERlZmF1bHRTY2FsZSgpOwogICAgIH0KIAogICAgIC8qKgotICAgICAqIEdldHMgdGhlIHtAbGluayBab29tQnV0dG9uc0NvbnRyb2xsZXJ9IHdoaWNoIGNhbiBiZSB1c2VkIHRvIGFkZAotICAgICAqIGFkZGl0aW9uYWwgYnV0dG9ucyB0byB0aGUgem9vbSBjb250cm9scyB3aW5kb3cuCi0gICAgICoKLSAgICAgKiBAcmV0dXJuIFRoZSBpbnN0YW5jZSBvZiB7QGxpbmsgWm9vbUJ1dHRvbnNDb250cm9sbGVyfSB1c2VkIGJ5IHRoaXMgY2xhc3MsCi0gICAgICogICAgICAgICBvciBudWxsIGlmIGl0IGlzIHVuYXZhaWxhYmxlLgotICAgICAqIEBoaWRlCisgICAgICogQHJldHVybiBUUlVFIGlmIHRoZSBXZWJWaWV3IGNhbiBiZSB6b29tZWQgaW4uCiAgICAgICovCi0gICAgcHVibGljIFpvb21CdXR0b25zQ29udHJvbGxlciBnZXRab29tQnV0dG9uc0NvbnRyb2xsZXIoKSB7Ci0gICAgICAgIGlmIChtWm9vbUJ1dHRvbnNDb250cm9sbGVyID09IG51bGwpIHsKLSAgICAgICAgICAgIG1ab29tQnV0dG9uc0NvbnRyb2xsZXIgPSBuZXcgWm9vbUJ1dHRvbnNDb250cm9sbGVyKHRoaXMpOwotICAgICAgICAgICAgbVpvb21CdXR0b25zQ29udHJvbGxlci5zZXRPblpvb21MaXN0ZW5lcihtWm9vbUxpc3RlbmVyKTsKLSAgICAgICAgICAgIC8vIFpvb21CdXR0b25zQ29udHJvbGxlciBwb3NpdGlvbnMgdGhlIGJ1dHRvbnMgYXQgdGhlIGJvdHRvbSwgYnV0IGluCi0gICAgICAgICAgICAvLyB0aGUgbWlkZGxlLiBDaGFuZ2UgdGhlaXIgbGF5b3V0IHBhcmFtZXRlcnMgc28gdGhleSBhcHBlYXIgb24gdGhlCi0gICAgICAgICAgICAvLyByaWdodC4KLSAgICAgICAgICAgIFZpZXcgY29udHJvbHMgPSBtWm9vbUJ1dHRvbnNDb250cm9sbGVyLmdldFpvb21Db250cm9scygpOwotICAgICAgICAgICAgVmlld0dyb3VwLkxheW91dFBhcmFtcyBwYXJhbXMgPSBjb250cm9scy5nZXRMYXlvdXRQYXJhbXMoKTsKLSAgICAgICAgICAgIGlmIChwYXJhbXMgaW5zdGFuY2VvZiBGcmFtZUxheW91dC5MYXlvdXRQYXJhbXMpIHsKLSAgICAgICAgICAgICAgICBGcmFtZUxheW91dC5MYXlvdXRQYXJhbXMgZnJhbWVQYXJhbXMgPSAoRnJhbWVMYXlvdXQuTGF5b3V0UGFyYW1zKSBwYXJhbXM7Ci0gICAgICAgICAgICAgICAgZnJhbWVQYXJhbXMuZ3Jhdml0eSA9IEdyYXZpdHkuUklHSFQ7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLSAgICAgICAgcmV0dXJuIG1ab29tQnV0dG9uc0NvbnRyb2xsZXI7CisgICAgcHVibGljIGJvb2xlYW4gY2FuWm9vbUluKCkgeworICAgICAgICByZXR1cm4gbVpvb21NYW5hZ2VyLmNhblpvb21JbigpOworICAgIH0KKworICAgIC8qKgorICAgICAqIEByZXR1cm4gVFJVRSBpZiB0aGUgV2ViVmlldyBjYW4gYmUgem9vbWVkIG91dC4KKyAgICAgKi8KKyAgICBwdWJsaWMgYm9vbGVhbiBjYW5ab29tT3V0KCkgeworICAgICAgICByZXR1cm4gbVpvb21NYW5hZ2VyLmNhblpvb21PdXQoKTsKICAgICB9CiAKICAgICAvKioKQEAgLTU3NTcsMTUgKzU3MzksNyBAQAogICAgICAqIEByZXR1cm4gVFJVRSBpZiB6b29tIGluIHN1Y2NlZWRzLiBGQUxTRSBpZiBubyB6b29tIGNoYW5nZXMuCiAgICAgICovCiAgICAgcHVibGljIGJvb2xlYW4gem9vbUluKCkgewotICAgICAgICAvLyBUT0RPOiBhbHRlcm5hdGl2ZWx5IHdlIGNhbiBkaXNhbGxvdyB0aGlzIGR1cmluZyBkcmF3IGhpc3RvcnkgbW9kZQotICAgICAgICBzd2l0Y2hPdXREcmF3SGlzdG9yeSgpOwotICAgICAgICBtSW5ab29tT3ZlcnZpZXcgPSBmYWxzZTsKLSAgICAgICAgLy8gQ2VudGVyIHpvb21pbmcgdG8gdGhlIGNlbnRlciBvZiB0aGUgc2NyZWVuLgotICAgICAgICBtWm9vbUNlbnRlclggPSBnZXRWaWV3V2lkdGgoKSAqIC41ZjsKLSAgICAgICAgbVpvb21DZW50ZXJZID0gZ2V0Vmlld0hlaWdodCgpICogLjVmOwotICAgICAgICBtQW5jaG9yWCA9IHZpZXdUb0NvbnRlbnRYKChpbnQpIG1ab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gPCBNSU5JTVVNX1NDQUxFX0lOQ1JFTUVOVCkgewotICAgICAgICAgICAgaWYgKGNvbnRlbnRUb1ZpZXdYKHZpZXcueCkgPj0gbVNjcm9sbFgKLSAgICAgICAgICAgICAgICAgICAgJiYgY29udGVudFRvVmlld1godmlldy54ICsgdmlldy53aWR0aCkgPD0gbVNjcm9sbFgKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICArIHZpZXdXaWR0aAotICAgICAgICAgICAgICAgICAgICAmJiBjb250ZW50VG9WaWV3WSh2aWV3LnkpID49IG1TY3JvbGxZCi0gICAgICAgICAgICAgICAgICAgICYmIGNvbnRlbnRUb1ZpZXdZKHZpZXcueSArIHZpZXcuaGVpZ2h0KSA8PSBtU2Nyb2xsWQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgdmlld0hlaWdodCkgewotICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgICAgIHJldHVybiBmYWxzZTsKKyAgICBib29sZWFuIGlzUGx1Z2luRml0T25TY3JlZW4oVmlld01hbmFnZXIuQ2hpbGRWaWV3IHZpZXcpIHsKKyAgICAgICAgZmluYWwgaW50IHZpZXdXaWR0aCA9IGdldFZpZXdXaWR0aCgpOworICAgICAgICBmaW5hbCBpbnQgdmlld0hlaWdodCA9IGdldFZpZXdIZWlnaHRXaXRoVGl0bGUoKTsKKyAgICAgICAgZmxvYXQgc2NhbGUgPSBNYXRoLm1pbigoZmxvYXQpIHZpZXdXaWR0aCAvIHZpZXcud2lkdGgsIChmbG9hdCkgdmlld0hlaWdodCAvIHZpZXcuaGVpZ2h0KTsKKyAgICAgICAgc2NhbGUgPSBtWm9vbU1hbmFnZXIuY29tcHV0ZVNjYWxlV2l0aExpbWl0cyhzY2FsZSk7CisgICAgICAgIHJldHVybiAhbVpvb21NYW5hZ2VyLndpbGxTY2FsZVRyaWdnZXJab29tKHNjYWxlKQorICAgICAgICAgICAgICAgICYmIGNvbnRlb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hIZWlnaHQgLSByZWN0Vmlld1kgLSByZWN0Vmlld0hlaWdodCkpIHsKICAgICAgICAgICAgICAgICBuZXdTY3JlZW5ZID0gdmlld0hlaWdodCAtIChuZXdNYXhIZWlnaHQgLSByZWN0Vmlld1kpOwogICAgICAgICAgICAgfQotICAgICAgICAgICAgbVpvb21DZW50ZXJZID0gKG9sZFNjcmVlblkgKiBzY2FsZSAtIG5ld1NjcmVlblkgKiBtQWN0dWFsU2NhbGUpCi0gICAgICAgICAgICAgICAgICAgIC8gKHNjYWxlIC0gbUFjdHVhbFNjYWxlKTsKLSAgICAgICAgICAgIHpvb21XaXRoUHJldmlldyhzY2FsZSwgZmFsc2UpOwotICAgICAgICB9Ci0gICAgfQotCi0gICAgdm9pZCBkaXNtaXNzWm9vbUNvbnRyb2woKSB7Ci0gICAgICAgIGlmIChtV2ViVmlld0NvcmUgPT0gbnVsbCkgewotICAgICAgICAgICAgLy8gbWF5YmUgY2FsbGVkIGFmdGVyIFdlYlZpZXcncyBkZXN0cm95KCkuIEFzIHdlIGNhbid0IGdldCBzZXR0aW5ncywKLSAgICAgICAgICAgIC8vIGp1c3QgaGlkZSB6b29tIGNvbnRyb2wgZm9yIGJvdGggc3R5bGVzLgotICAgICAgICAgICAgaWYgKG1ab29tQnV0dG9uc0NvbnRyb2xsZXIgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgIG1ab29tQnV0dG9uc0NvbnRyb2xsZXIuc2V0VmlzaWJsZShmYWxzZSk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAobVpvb21Db250cm9scyAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgbVpvb21Db250cm9scy5oaWRlKCk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICByZXR1cm47Ci0gICAgICAgIH0KLSAgICAgICAgV2ViU2V0dGluZ3Mgc2V0dGluZ3MgPSBnZXRTZXR0aW5ncygpOwotICAgICAgICBpZiAoc2V0dGluZ3MuZ2V0QnVpbHRJ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UpKQotICAgICAgICAgICAgICAgICAgICAgICAgLSBtU2Nyb2xsWDsKLSAgICAgICAgICAgICAgICAvLyBSZS1jYWxjdWxhdGUgdGhlIHpvb20gY2VudGVyIHNvIHRoYXQgdGhlIG5ldyBzY3JvbGwgeCB3aWxsIGJlCi0gICAgICAgICAgICAgICAgLy8gb24gdGhlIGxlZnQgZWRnZS4KLSAgICAgICAgICAgICAgICBpZiAodmlld0xlZnQgPiAwKSB7Ci0gICAgICAgICAgICAgICAgICAgIG1ab29tQ2VudGVyWCA9IHZpZXdMZWZ0ICogbURlZmF1bHRTY2FsZQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8gKG1EZWZhdWx0U2NhbGUgLSBtQWN0dWFsU2NhbGUpOwotICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIHNjcm9sbEJ5KHZpZXdMZWZ0LCAwKTsKLSAgICAgICAgICAgICAgICAgICAgbVpvb21DZW50ZXJYID0gMDsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICB6b29tV2l0aFByZXZpZXcobURlZmF1bHRTY2FsZSwgdHJ1ZSk7CisgICAgICAgICAgICBmbG9hdCB6b29tQ2VudGVyWSA9IChvbGRTY3JlZW5ZICogc2NhbGUgLSBuZXdTY3JlZW5ZICogYWN0dWFsU2NhbGUpCisgICAgICAgICAgICAgICAgICAgIC8gKHNjYWxlIC0gYWN0dWFsU2NhbGUpOworICAgICAgICAgICAgbVpvb21NYW5hZ2VyLnNldFpvb21DZW50ZXIoem9vbUNlbnRlclgsIHpvb21DZW50ZXJZKTsKKyAgICAgICAgICAgIG1ab29tTWFuYWdlci5zdGFydFpvb21BbmltYXRpb24oc2NhbGUsIGZhbHNlKTsKICAgICAgICAgfQogICAgIH0KIApAQCAtNjA5Miw2ICs1OTUzLDkgQEAKIAogICAgIEBPdmVycmlkZQogICAgIHB1YmxpYyBib29sZWFuIHJlcXVlc3RGb2N1cy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GlsZC5nZXRMZWZ0KCkgLSBjaGlsZC5nZXRTY3JvbGxYKCksCiAgICAgICAgICAgICAgICAgY2hpbGQuZ2V0VG9wKCkgLSBjaGlsZC5nZXRTY3JvbGxZKCkpOwogCkBAIC02MzIxLDcgKzYxOTEsOCBAQAogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBjYXNlIFNXSVRDSF9UT19TSE9SVFBSRVNTOiB7CiAgICAgICAgICAgICAgICAgICAgIGlmIChtVG91Y2hNb2RlID09IFRPVUNIX0lOSVRfTU9ERSkgewotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1QcmV2ZW50RGVmYXVsdCAhPSBQUkVWRU5UX0RFRkFVTFRfWUVTKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWdldFNldHRpbmdzKCkuc3VwcG9ydFRvdWNoT25seSgpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICYmIG1QcmV2ZW50RGVmYXVsdCAhPSBQUkVWRU5UX0RFRkFVTFRfWUVTKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVRvdWNoTW9kZSA9IFRPVUNIX1NIT1JUUFJFU1NfU1RBUlRfTU9ERTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cGRhdGVTZWxlY3Rpb24oKTsKICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CkBAIC02MzM1LDYgKzYyMDYsOSBAQAogICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgY2FzZSBTV0lUQ0hfVE9fTE9OR1BSRVNTOiB7CisgICAgICAgICAgICAgICAgICAgIGlmIChnZXRTZXR0aW5ncygpLnN1cHBvcnRUb3VjaE9ubHkoKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgcmVtb3ZlVG91Y2hIaWdobGlnaHQoZmFsc2UpOworICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgIGlmIChpbkZ1bGxTY3JlZW5Nb2RlKCkgfHwgbURlZmVyVG91Y2hQcm9jZXNzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBUb3VjaEV2ZW50RGF0YSB0ZWQgPSBuZXcgVG91Y2hFdmVudERhdGEoKTsKICAgICAgICAgICAgICAgICAgICAgICAgIHRlZC5tQWN0aW9uID0gV2ViVmlld0NvcmUuQUNUSU9OX0xPTkdQUkVTUzsKQEAgLTYzNDYsMTUgKzYyMjAsMTAgQEAKICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHNpbXBsaWNpdHkgZm9yIG5vdywgd2UgZG9uJ3Qgc2V0IGl0LgogICAgICAgICAgICAgICAgICAgICAgICAgdGVkLm1NZXRhU3RhdGUgPSAwOwogICAgICAgICAgICAgICAgICAgICAgICAgdGVkLm1SZXByb2Nlc3MgPSBtRGVmZXJUb3VjaFByb2Nlc3M7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAobURlZmVyVG91Y2hQcm9jZXNzKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGVkLm1WaWV3WCA9IG1MYXN0VG91Y2hYOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRlZC5tVmlld1kgPSBtTGFzdFRvdWNoWTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgIG1XZWJWaWV3Q29yZS5zZW5kTWVzc2FnZShFdmVudEh1Yi5UT1VDSF9FVkVOVCwgdGVkKTsKICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChtUHJldmVudERlZmF1bHQgIT0gUFJFVkVOVF9ERUZBVUxUX1lFUykgewogICAgICAgICAgICAgICAgICAgICAgICAgbVRvdWNoTW9kZSA9IFRPVUNIX0RPTkVfTU9ERTsKICAgICAgICAgICAgICAgICAgICAgICAgIHBlcmZvcm1Mb25nQ2xpY2soKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIHJlYnVpbGRXZWJUZXh0VmlldygpOwogICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgIH0KQEAgLTYzODcsNzAgKzYyNTYsMzYgQEAKICAgICAgICAgICAgICAgICAgICAgc3Bhd25Db250ZW50U2Nyb2xsVG8obXNnLmFyZzEsIG1zZy5hcmcyKTsKICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgY2FzZSBVUERBVEVfWk9PTV9SQU5HRTogewotICAgICAgICAgICAgICAgICAgICBXZWJWaWV3Q29yZS5SZXN0b3JlU3RhdGUgcmVzdG9yZVN0YXRlCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgPSAoV2ViVmlld0NvcmUuUmVzdG9yZVN0YXRlKSBtc2cub2JqOworICAgICAgICAgICAgICAgICAgICBXZWJWaWV3Q29yZS5WaWV3U3RhdGUgdmlld1N0YXRlID0gKFdlYlZpZXdDb3JlLlZpZXdTdGF0ZSkgbXNnLm9iajsKICAgICAgICAgICAgICAgICAgICAgLy8gbVNjcm9sbFggY29udGFpbnMgdGhlIG5ldyBtaW5QcmVmV2lkdGgKLSAgICAgICAgICAgICAgICAgICAgdXBkYXRlWm9vbVJhbmdlKHJlc3RvcmVTdGF0ZSwgZ2V0Vmlld1dpZHRoKCksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzdG9yZVN0YXRlLm1TY3JvbGxYLCBmYWxzZSk7CisgICAgICAgICAgICAgICAgICAgIG1ab29tTWFuYWdlci51cGRhdGVab29tUmFuZ2Uodmlld1N0YXRlLCBnZXRWaWV3V2lkdGgoKSwgdmlld1N0YXRlLm1TY3JvbGxYKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGNhc2UgUkVQTEFDRV9CQVNFX0NPTlRFTlQ6IHsKKyAgICAgICAgICAgICAgICAgICAgbmF0aXZlUmVwbGFjZUJhc2VDb250ZW50KG1zZy5hcmcxKTsKICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIGNhc2UgTkVXX1BJQ1RVUkVfTVNHX0lEOiB7Ci0gICAgICAgICAgICAgICAgICAgIC8vIElmIHdlJ3ZlIHByZXZpb3VzbHkgZGVsYXllZCBkZWxldGluZyBhIHJvb3QKLSAgICAgICAgICAgICAgICAgICAgLy8gbGF5ZXIsIGRvIGl0IG5vdy4KLSAgICAgICAgICAgICAgICAgICAgaWYgKG1EZWxheWVkRGVsZXRlUm9vdExheWVyKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBtRGVsYXllZERlbGV0ZVJvb3RMYXllciA9IGZhbHNlOwotICAgICAgICAgICAgICAgICAgICAgICAgbmF0aXZlU2V0Um9vdExheWVyKDApOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIFdlYlNldHRpbmdzIHNldHRpbmdzID0gbVdlYlZpZXdDb3JlLmdldFNldHRpbmdzKCk7CiAgICAgICAgICAgICAgICAgICAgIC8vIGNhbGxlZCBmb3IgbmV3IGNvbnRlbnQKLSAgICAgICAgICAgICAgICAgICAgZmluYWwgaW50IHZpZXdXaWR0aCA9IGdldFZpZXdXaWR0aCgpOwotICAgICAgICAgICAgICAgICAgICBmaW5hbCBXZWJWaWV3Q29yZS5EcmF3RGF0YSBkcmF3ID0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAoV2ViVmlld0NvcmUuRHJhd0RhdGEpIG1zZy5vYmo7CisgICAgICAgICAgICAgICAgICAgIGZpbmFsIFdlYlZpZXdDb3JlLkRyYXdEYXRhIGRyYXcgPSAoV2ViVmlld0NvcmUuRHJhd0RhdGEpIG1zZy5vYmo7CisgICAgICAgICAgICAgICAgICAgIG5hdGl2ZVNldEJhc2VMYXllcihkcmF3Lm1CYXNlTGF5ZXIpOwogICAgICAgICAgICAgICAgICAgICBmaW5hbCBQb2ludCB2aWV3U2l6ZSA9IGRyYXcubVZpZXdQb2ludDsKLSAgICAgICAgICAgICAgICAgICAgYm9vbGVhbiB1c2VXaWRlVmlld3BvcnQgPSBzZXR0aW5ncy5nZXRVc2VXaWRlVmlld1BvcnQoKTsKLSAgICAgICAgICAgICAgICAgICAgV2ViVmlld0NvcmUuUmVzdG9yZVN0YXRlIHJlc3RvcmVTdGF0ZSA9IGRyYXcubVJlc3RvcmVTdGF0ZTsKLSAgICAgICAgICAgICAgICAgICAgYm9vbGVhbiBoYXNSZXN0b3JlU3RhdGUgPSByZXN0b3JlU3RhdGUgIT0gbnVsbDsKLSAgICAgICAgICAgICAgICAgICAgaWYgKGhhc1Jlc3RvcmVTdGF0ZSkgewotICAgICAgICAgICAgICAgICAgICAgICAgdXBkYXRlWm9vbVJhbmdlKHJlc3RvcmVTdGF0ZSwgdmlld1NpemUueCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZHJhdy5tTWluUHJlZldpZHRoLCB0cnVlKTsKKyAgICAgICAgICAgICAgICAgICAgV2ViVmlld0NvcmUuVmlld1N0YXRlIHZpZXdTdGF0ZSA9IGRyYXcubVZpZXdTdGF0ZTsKKyAgICAgICAgICAgICAgICAgICAgYm9vbGVhbiBpc1BpY3R1cmVBZnRlckZpcnN0TGF5b3V0ID0gdmlld1N0YXRlICE9IG51bGw7CisgICAgICAgICAgICAgICAgICAgIGlmIChpc1BpY3R1cmVBZnRlckZpcnN0TGF5b3V0KSB7CisgICAgICAgICAgICAgICAgICAgICAgICAvLyBSZXNldCB0aGUgbGFzdCBzZW50IGRhdGEgaGVyZSBzaW5jZSBkZWFsaW5nIHdpdGggbmV3IHBhZ2UuCisgICAgICAgICAgICAgICAgICAgICAgICBtTGFzdFdpZHRoU2VudCA9IDA7CisgICAgICAgICAgICAgICAgICAgICAgICBtWm9vbU1hbmFnZXIub25GaXJzdExheW91dChkcmF3KTsKICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghbURyYXdIaXN0b3J5KSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgbUluWm9vbU92ZXJ2aWV3ID0gZmFsc2U7Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobUluaXRpYWxTY2FsZUluUGVyY2VudCA+IDApIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0TmV3Wm9vbVNjYWxlKG1Jbml0aWFsU2NhbGVJblBlcmNlbnQgLyAxMDAuMGYsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtSW5pdGlhbFNjYWxlSW5QZXJjZW50ICE9IG1UZXh0V3JhcFNjYWxlICogMTAwLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmFsc2UpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAocmVzdG9yZVN0YXRlLm1WaWV3U2NhbGUgPiAwKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1UZXh0V3JhcFNjYWxlID0gcmVzdG9yZVN0YXRlLm1UZXh0V3JhcFNjYWxlOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXROZXdab29tU2NhbGUocmVzdG9yZVN0YXRlLm1WaWV3U2NhbGUsIGZhbHNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmFsc2UpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1Jblpvb21PdmVydmlldyA9IHVzZVdpZGVWaWV3cG9ydAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJiYgc2V0dGluZ3MuZ2V0TG9hZFdpdGhPdmVydmlld01vZGUoKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgc2NhbGU7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtSW5ab29tT3ZlcnZpZXcpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjYWxlID0gKGZsb2F0KSB2aWV3V2lkdGgKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvIERFRkFVTFRfVklFV1BPUlRfV0lEVEg7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY2FsZSA9IHJlc3RvcmVTdGF0ZS5tVGV4dFdyYXBTY2FsZTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXROZXdab29tU2NhbGUoc2NhbGUsIE1hdGguYWJzKHNjYWxlCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtIG1UZXh0V3JhcFNjYWxlKSA+PSBNSU5JTVVNX1NDQUxFX0lOQ1JFTUVOVCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZhbHNlKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0Q29udGVudFNjcm9sbFRvKHJlc3RvcmVTdGF0ZS5tU2Nyb2xsWCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzdG9yZVN0YXRlLm1TY3JvbGxZKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXRDb250ZW50U2Nyb2xsVG8odmlld1N0YXRlLm1TY3JvbGxYLCB2aWV3U3RhdGUubVNjcm9sbFkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIEFzIHdlIGFyZSBvbiBhIG5ldyBwYWdlLCByZW1vdmUgdGhlIFdlYlRleHRWaWV3LiBUaGlzCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gaXMgbmVjZXNzYXJ5IGZvciBwYWdlIGxvYWRzIGRyaXZlbiBieSB3ZWJraXQsIGFuZCBpbgogICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHBhcnRpY3VsYXIgd2hlbiB0aGUgdXNlciB3YXMgb24gYSBwYXNzd29yZCBmaWVsZCwgc28KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyB0aGUgV2ViVGV4dFZpZXcgd2FzIHZpc2libGUuCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xlYXJUZXh0RW50cnkoZmFsc2UpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHVwZGF0ZSB0aGUgem9vbSBidXR0b25zIGFzIHRoZSBzY2FsZSBjYW4gYmUgY2hhbmdlZAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChnZXRTZXR0aW5ncygpLmdldEJ1aWx0SW5ab29tQ29udHJvbHMoKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cGRhdGVab29tQnV0dG9uc0VuYWJsZWQoKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xlYXJUZXh0RW50cnkoKTsKICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgfQorCiAgICAgICAgICAgICAgICAgICAgIC8vIFdlIHVwZGF0ZSB0aGUgbGF5b3V0IChpLmUuIHJlcXVlc3QgYSBsYXlvdXQgZnJvbSB0aGUKICAgICAgICAgICAgICAgICAgICAgLy8gdmlldyBzeXN0ZW0pIGlmIHRoZSBsYXN0IHZpZXcgc2l6ZSB0aGF0IHdlIHNlbnQgdG8KICAgICAgICAgICAgICAgICAgICAgLy8gV2ViQ29yZSBtYXRjaGVzIHRoZSB2aWV3IHNpemUgb2YgdGhlIHBpY3R1cmUgd2UganVzdApAQCAtNjQ1OCw0NSArNjI5MywyNSBAQAogICAgICAgICAgICAgICAgICAgICBmaW5hbCBib29sZWFuIHVwZGF0ZUxheW91dCA9IHZpZXdTaXplLnggPT0gbUxhc3RXaWR0aFNlbnQKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmJiB2aWV3U2l6ZS55ID09IG1MYXN0SGVpZ2h0U2VudDsKICAgICAgICAgICAgICAgICAgICAgcmVjb3JkTmV3Q29udGVudFNpemUoZHJhdy5tV2lkdGhIZWlnaHQueCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBkcmF3Lm1XaWR0aEhlaWdodC55Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgKyAobUZpbmRJc1VwID8gbUZpbmRIZWlnaHQgOiAwKSwgdXBkYXRlTGF5b3V0KTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBkcmF3Lm1XaWR0aEhlaWdodC55LCB1cGRhdGVMYXlvdXQpOwogICAgICAgICAgICAgICAgICAgICBpZiAoRGVidWdGbGFncy5XRUJfVklFVykgewogICAgICAgICAgICAgICAgICAgICAgICAgUmVjdCBiID0gZHJhdy5tSW52YWxSZWdpb24uZ2V0Qm91bmRzKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICBMb2cudihMT0dUQUcsICJORVdfUElDVFVSRV9NU0dfSUQgeyIgKwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiLmxlZnQrIiwiK2IudG9wKyIsIitiLnJpZ2h0KyIsIitiLmJvdHRvbSsifSIpOwogICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgIGludmFsaWRhdGVDb250ZW50UmVjdChkcmF3Lm1JbnZhbFJlZ2lvbi5nZXRCb3VuZHMoKSk7CisKICAgICAgICAgICAgICAgICAgICAgaWYgKG1QaWN0dXJlTGlzdGVuZXIgIT0gbnVsbCkgewogICAgICAgICAgICAgICAgICAgICAgICAgbVBpY3R1cmVMaXN0ZW5lci5vbk5ld1BpY3R1cmUoV2ViVmlldy50aGlzLCBjYXB0dXJlUGljdHVyZSgpKTsKICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBpZiAodXNlV2lkZVZpZXdwb3J0KSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAvLyBsaW1pdCBtWm9vbU92ZXJ2aWV3V2lkdGggdXBwZXIgYm91bmQgdG8KLSAgICAgICAgICAgICAgICAgICAgICAgIC8vIHNNYXhWaWV3cG9ydFdpZHRoIHNvIHRoYXQgaWYgdGhlIHBhZ2UgZG9lc24ndCBiZWhhdmUKLSAgICAgICAgICAgICAgICAgICAgICAgIC8vIHdlbGwsIHRoZSBXZWJWaWV3IHdvbid0IGdvIGluc2FuZS4gbGltaXQgdGhlIGxvd2VyCi0gICAgICAgICAgICAgICAgICAgICAgICAvLyBib3VuZCB0byBtYXRjaCB0aGUgZGVmYXVsdCBzY2FsZSBmb3IgbW9iaWxlIHNpdGVzLgotICAgICAgICAgICAgICAgICAgICAgICAgbVpvb21PdmVydmlld1dpZHRoID0gTWF0aC5taW4oc01heFZpZXdwb3J0V2lkdGgsIE1hdGgKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLm1heCgoaW50KSAodmlld1dpZHRoIC8gbURlZmF1bHRTY2FsZSksIE1hdGgKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAubWF4KGRyYXcubU1pblByZWZXaWR0aCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRyYXcubVZpZXdQb2ludC54KSkpOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIGlmICghbU1pblpvb21TY2FsZUZpeGVkKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBtTWluWm9vbVNjYWxlID0gKGZsb2F0KSB2aWV3V2lkdGggLyBtWm9vbU92ZXJ2aWV3V2lkdGg7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgaWYgKCFtRHJhd0hpc3RvcnkgJiYgbUluWm9vbU92ZXJ2aWV3KSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAvLyBmaXQgdGhlIGNvbnRlbnQgd2lkdGggdG8gdGhlIGN1cnJlbnQgdmlldy4gSWdub3JlCi0gICAgICAgICAgICAgICAgICAgICAgICAvLyB0aGUgcm91bmRpbmcgZXJyb3IgY2FzZS4KLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChNYXRoLmFicygodmlld1dpZHRoICogbUludkFjdHVhbFNjYWxlKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtIG1ab29tT3ZlcnZpZXdXaWR0aCkgPiAxKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0TmV3Wm9vbVNjYWxlKChmbG9hdCkgdmlld1dpZHRoCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvIG1ab29tT3ZlcnZpZXdXaWR0aCwgTWF0aC5hYnMobUFjdHVhbFNjYWxlCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtIG1UZXh0V3JhcFNjYWxlKSA8IE1JTklNVU1fU0NBTEVfSU5DUkVNRU5ULAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmFsc2UpOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgICAgLy8gdXBkYXRlIHRoZSB6b29tIGluZm9ybWF0aW9uIGJhc2VkIG9uIHRoZSBuZXcgcGljdHVyZQorICAgICAgICAgICAgICAgICAgICBtWm9vbU1hbmFnZXIub25OZXdQaWN0dXJlKGRyYXcpOworCiAgICAgICAgICAgICAgICAgICAgIGlmIChkcmF3Lm1Gb2N1c1NpemVDaGFuZ2VkICYmIGluRWRpdGluZ01vZGUoKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgbUZvY3VzU2l6ZUNoYW5nZWQgPSB0cnVlOwogICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIGlmIChoYXNSZXN0b3JlU3RhdGUpIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGlzUGljdHVyZUFmdGVyRmlyc3RMYXlvdXQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgIG1WaWV3TWFuYWdlci5wb3N0UmVhZHlUb0RyYXdBbGwoKTsKICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICBicmVhazsKQEAgLTY1MzAsMTQgKzYzNDUsOCBAQAogICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICBjYXNlIFJFUVVFU1RfS0VZQk9BUkRfV0lUSF9TRUxFQ1RJT05fTVNHX0lEOgogICAgICAgICAgICAgICAgICAgICBkaXNwbGF5U29mdEtleWJvYXJkKHRydWUpOwotICAgICAgICAgICAgICAgICAgICB1cGRhdGVUZXh0U2VsZWN0aW9uRnJvbU1lc3NhZ2UobXNnLmFyZzEsIG1zZy5hcmcyLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIChXZWJWaWV3Q29yZS5UZXh0U2VsZWN0aW9uRGF0YSkgbXNnLm9iaik7Ci0gICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICAvLyBmYWxsIHRocm91Z2ggdG8gVVBEQVRFX1RFWFRfU0VMRUNUSU9OX01TR19JRAogICAgICAgICAgICAgICAgIGNhc2UgVVBEQVRFX1RFWFRfU0VMRUNUSU9OX01TR19JRDoKLSAgICAgICAgICAgICAgICAgICAgLy8gSWYgbm8gdGV4dGZpZWxkIHdhcyBpbiBmb2N1cywgYW5kIHRoZSB1c2VyIHRvdWNoZWQgb25lLAotICAgICAgICAgICAgICAgICAgICAvLyBjYXVzaW5nIGl0IHRvIHNlbmQgdGhpcyBtZXNzYWdlLCB0aGVuIFdlYlRleHRWaWV3IGhhcyBub3QKLSAgICAgICAgICAgICAgICAgICAgLy8gYmVlbiBzZXQgdXAgeWV0LiAgUmVidWlsZCBpdCBzbyBpdCBjYW4gc2V0IGl0cyBzZWxlY3Rpb24uCi0gICAgICAgICAgICAgICAgICAgIHJlYnVpbGRXZWJUZXh0VmlldygpOwogICAgICAgICAgICAgICAgICAgICB1cGRhdGVUZXh0U2VsZWN0aW9uRnJvbU1lc3NhZ2UobXNnLmFyZzEsIG1zZy5hcmcyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIChXZWJWaWV3Q29yZS5UZXh0U2VsZWN0aW9uRGF0YSkgbXNnLm9iaik7CiAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwpAQCAtNjU1NSw3ICs2MzY0LDcgQEAKICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICBjYXNlIE1PVkVfT1VUX09GX1BMVUdJTjoKKyAgICAgICAgICAgICAgICBjYXNlIFVOSEFORExFRF9OQVZfS0VZOgogICAgICAgICAgICAgICAgICAgICBuYXZIYW5kbGVkS2V5KG1zZy5hcmcxLCAxLCBmYWxzZSwgMCk7CiAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgIGNhc2UgVVBEQVRFX1RFWFRfRU5UUllfTVNHX0lEOgpAQCAtNjU2Nyw3ICs2Mzc2LDcgQEAKICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICBjYXNlIENMRUFSX1RFWFRfRU5UUlk6Ci0gICAgICAgICAgICAgICAgICAgIGNsZWFyVGV4dEVudHJ5KGZhbHNlKTsKKyAgICAgICAgICAgICAgICAgICAgY2xlYXJUZXh0RW50cnkoKTsKICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgY2FzZSBJTlZBTF9SRUNUX01TR19JRDogewogICAgICAgICAgICAgICAgICAgICBSZWN0IHIgPSAoUmVjdCltc2cub2JqOwpAQCAtNjU4MCwyMyArNjM4OSw2IEBACiAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGNhc2UgSU1NRURJQVRFX1JFUEFJTlRfTVNHX0lEOiB7Ci0gICAgICAgICAgICAgICAgICAgIGludmFsaWRhdGUoKTsKLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGNhc2UgU0VUX1JPT1RfTEFZRVJfTVNHX0lEOiB7Ci0gICAgICAgICAgICAgICAgICAgIGlmICgwID09IG1zZy5hcmcxKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAvLyBOdWxsIGluZGljYXRlcyBkZWxldGluZyB0aGUgb2xkIGxheWVyLCBidXQKLSAgICAgICAgICAgICAgICAgICAgICAgIC8vIGRvbid0IGFjdHVhbGx5IGRvIHNvIHVudGlsIHdlJ3ZlIGdvdCB0aGUKLSAgICAgICAgICAgICAgICAgICAgICAgIC8vIG5ldyBwYWdlIHRvIGRpc3BsYXkuCi0gICAgICAgICAgICAgICAgICAgICAgICBtRGVsYXllZERlbGV0ZVJvb3RMYXllciA9IHRydWU7Ci0gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBtRGVsYXllZERlbGV0ZVJvb3RMYXllciA9IGZhbHNlOwotICAgICAgICAgICAgICAgICAgICAgICAgbmF0aXZlU2V0Um9vdExheWVyKG1zZy5hcmcxKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGludmFsaWRhdGUoKTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgY2FzZSBSRVFVRVNUX0ZPUk1fREFUQToKICAgICAgICAgICAgICAgICAgICAgQXV0b0NvbXBsZXRlQWRhcHRlciBhZGFwdGVyID0gKEF1dG9Db21wbGV0ZUFkYXB0ZXIpIG1zZy5vYmo7CiAgICAgICAgICAgICAgICAgICAgIGlmIChtV2ViVGV4dFZpZXcuaXNTYW1lVGV4dEZpZWxkKG1zZy5hcmcxKSkgewpAQCAtNjY0MCwzMyArNjQzMiw0MCBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1QcmV2ZW50RGVmYXVsdCA9IG1zZy5hcmcyID09IDEgPyBQUkVWRU5UX0RFRkFVTFRfWUVTCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6IFBSRVZFTlRfREVGQVVMVF9OTzsKICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtUHJldmVudERlZmF1bHQgPT0gUFJFVkVOVF9ERUZBVUxUX1lFUykgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1Ub3VjaEhpZ2hsaWdodFJlZ2lvbi5zZXRFbXB0eSgpOworICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKG1zZy5hcmcyID09IDApIHsKICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHByZXZlbnQgZGVmYXVsdCBpcyBub3QgY2FsbGVkIGluIFdlYkNvcmUsIHNvIHRoZQogICAgICAgICAgICAgICAgICAgICAgICAgLy8gbWVzc2FnZSBuZWVkcyB0byBiZSByZXByb2Nlc3NlZCBpbiBVSQogICAgICAgICAgICAgICAgICAgICAgICAgVG91Y2hFdmVudERhdGEgdGVkID0gKFRvdWNoRXZlbnREYXRhKSBtc2cub2JqOwogICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoICh0ZWQubUFjdGlvbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgTW90aW9uRXZlbnQuQUNUSU9OX0RPV046Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1MYXN0RGVmZXJUb3VjaFggPSB0ZWQubVZpZXdYOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtTGFzdERlZmVyVG91Y2hZID0gdGVkLm1WaWV3WTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUxhc3REZWZlclRvdWNoWCA9IGNvbnRlbnRUb1ZpZXdYKHRlZC5tWCkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtIG1TY3JvbGxYOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtTGFzdERlZmVyVG91Y2hZID0gY29udGVudFRvVmlld1kodGVkLm1ZKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0gbVNjcm9sbFk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1EZWZlclRvdWNoTW9kZSA9IFRPVUNIX0lOSVRfTU9ERTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBNb3Rpb25FdmVudC5BQ1RJT05fTU9WRTogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBubyBzbmFwcGluZyBpbiBkZWZlciBwcm9jZXNzCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCB4ID0gY29udGVudFRvVmlld1godGVkLm1YKSAtIG1TY3JvbGxYOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgeSA9IGNvbnRlbnRUb1ZpZXdZKHRlZC5tWSkgLSBtU2Nyb2xsWTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1EZWZlclRvdWNoTW9kZSAhPSBUT1VDSF9EUkFHX01PREUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1EZWZlclRvdWNoTW9kZSA9IFRPVUNIX0RSQUdfTU9ERTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1MYXN0RGVmZXJUb3VjaFggPSB0ZWQubVZpZXdYOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUxhc3REZWZlclRvdWNoWSA9IHRlZC5tVmlld1k7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtTGFzdERlZmVyVG91Y2hYID0geDsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1MYXN0RGVmZXJUb3VjaFkgPSB5OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnREcmFnKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGRlbHRhWCA9IHBpbkxvY1goKGludCkgKG1TY3JvbGxYCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyBtTGFzdERlZmVyVG91Y2hYIC0gdGVkLm1WaWV3WCkpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyBtTGFzdERlZmVyVG91Y2hYIC0geCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLSBtU2Nyb2xsWDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGRlbHRhWSA9IHBpbkxvY1koKGludCkgKG1TY3JvbGxZCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyBtTGFzdERlZmVyVG91Y2hZIC0gdGVkLm1WaWV3WSkpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyBtTGFzdERlZmVyVG91Y2hZIC0geSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLSBtU2Nyb2xsWTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9EcmFnKGRlbHRhWCwgZGVsdGFZKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGRlbHRhWCAhPSAwKSBtTGFzdERlZmVyVG91Y2hYID0gdGVkLm1WaWV3WDsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGRlbHRhWSAhPSAwKSBtTGFzdERlZmVyVG91Y2hZID0gdGVkLm1WaWV3WTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGRlbHRhWCAhPSAwKSBtTGFzdERlZmVyVG91Y2hYID0geDsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGRlbHRhWSAhPSAwKSBtTGFzdERlZmVyVG91Y2hZID0geTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgTW90aW9uRXZlbnQuQUNUSU9OX1VQOgpAQCAtNjY4MCw5ICs2NDc5LDkgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBXZWJWaWV3Q29yZS5BQ1RJT05fRE9VQkxFVEFQOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBkb0RvdWJsZVRhcCgpIG5lZWRzIG1MYXN0VG91Y2hYL1kgYXMgYW5jaG9yCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1MYXN0VG91Y2hYID0gdGVkLm1WaWV3WDsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUxhc3RUb3VjaFkgPSB0ZWQubVZpZXdZOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb0RvdWJsZVRhcCgpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtTGFzdFRvdWNoWCA9IGNvbnRlbnRUb1ZpZXdYKHRlZC5tWCkgLSBtU2Nyb2xsWDsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUxhc3RUb3VjaFkgPSBjb250ZW50VG9WaWV3WSh0ZWQubVkpIC0gbVNjcm9sbFk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ab29tTWFuYWdlci5oYW5kbGVEb3VibGVUYXAobUxhc3RUb3VjaFgsIG1MYXN0VG91Y2hZKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbURlZmVyVG91Y2hNb2RlID0gVE9VQ0hfRE9ORV9NT0RFOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFdlYlZpZXdDb3JlLkFDVElPTl9MT05HUFJFU1M6CkBAIC02NjkwLDcgKzY0ODksNiBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaGl0VGVzdCAhPSBudWxsICYmIGhpdFRlc3QubVR5cGUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAhPSBIaXRUZXN0UmVzdWx0LlVOS05PV05fVFlQRSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGVyZm9ybUxvbmdDbGljaygpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVidWlsZFdlYlRleHRWaWV3KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbURlZmVyVG91Y2hNb2RlID0gVE9VQ0hfRE9ORV9NT0RFOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKQEAgLTY4MTQsNyArNjYxMiw2IEBACiAKICAgICAgICAgICAgICAgICBjYXNlIENFTlRFUl9GSVRfUkVDVDoKICAgICAgICAgICAgICAgICAgICAgUmVjdCByID0gKFJlY3QpbXNnLm9iajsKLSAgICAgICAgICAgICAgICAgICAgbUluWm9vbU92ZXJ2aWV3ID0gZmFsc2U7CiAgICAgICAgICAgICAgICAgICAgIGNlbnRlckZpdFJlY3Qoci5sZWZ0LCByLnRvcCwgci53aWR0aCgpLCByLmhlaWdodCgpKTsKICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAKQEAgLTY4MjMsNiArNjYyMCw0MyBAQAogICAgICAgICAgICAgICAgICAgICBtVmVydGljYWxTY3JvbGxCYXJNb2RlID0gbXNnLmFyZzI7CiAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogCisgICAgICAgICAgICAgICAgY2FzZSBTRUxFQ1RJT05fU1RSSU5HX0NIQU5HRUQ6CisgICAgICAgICAgICAgICAgICAgIGlmIChtQWNjZXNzaWJpbGl0eUluamVjdG9yICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIFN0cmluZyBzZWxlY3Rpb25TdHJpbmcgPSAoU3RyaW5nKSBtc2cub2JqOworICAgICAgICAgICAgICAgICAgICAgICAgbUFjY2Vzc2liaWxpdHlJbmplY3Rvci5vblNlbGVjdGlvblN0cmluZ0NoYW5nZShzZWxlY3Rpb25TdHJpbmcpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICAgICAgY2FzZSBTRVRfVE9VQ0hfSElHSExJR0hUX1JFQ1RTOgorICAgICAgICAgICAgICAgICAgICBpbnZhbGlkYXRlKG1Ub3VjaEhpZ2hsaWdodFJlZ2lvbi5nZXRCb3VuZHMoKSk7CisgICAgICAgICAgICAgICAgICAgIG1Ub3VjaEhpZ2hsaWdodFJlZ2lvbi5zZXRFbXB0eSgpOworICAgICAgICAgICAgICAgICAgICBpZiAobXNnLm9iaiAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBBcnJheUxpc3Q8UmVjdD4gcmVjdHMgPSAoQXJyYXlMaXN0PFJlY3Q+KSBtc2cub2JqOworICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChSZWN0IHJlY3QgOiByZWN0cykgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIFJlY3Qgdmlld1JlY3QgPSBjb250ZW50VG9WaWV3UmVjdChyZWN0KTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBzb21lIHNpdGVzLCBsaWtlIHN0b3JpZXMgaW4gbnl0aW1lcy5jb20sIHNldAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIG1vdXNlIGV2ZW50IGhhbmRsZXIgaW4gdGhlIHRvcCBkaXYuIEl0IGlzIG5vdAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHVzZXIgZnJpZW5kbHkgdG8gaGlnaGxpZ2h0IHRoZSBkaXYgaWYgaXQgY292ZXJzCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gbW9yZSB0aGFuIGhhbGYgb2YgdGhlIHNjcmVlbi4KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodmlld1JlY3Qud2lkdGgoKSA8IGdldFdpZHRoKCkgPj4gMQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfHwgdmlld1JlY3QuaGVpZ2h0KCkgPCBnZXRIZWlnaHQoKSA+PiAxKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1Ub3VjaEhpZ2hsaWdodFJlZ2lvbi51bmlvbih2aWV3UmVjdCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludmFsaWRhdGUodmlld1JlY3QpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExvZy53KExPR1RBRywgIlNraXAgdGhlIGh1Z2Ugc2VsZWN0aW9uIHJlY3Q6IgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgdmlld1JlY3QpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBicmVhazsKKworICAgICAgICAgICAgICAgIGNhc2UgU0FWRV9XRUJBUkNISVZFX0ZJTklTSEVEOgorICAgICAgICAgICAgICAg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ByZWZXaWR0aDsKLSAgICAgICAgICAgICAgICAgICAgbU1pblpvb21TY2FsZUZpeGVkID0gZmFsc2U7Ci0gICAgICAgICAgICAgICAgICAgIGlmICh1cGRhdGVab29tT3ZlcnZpZXcpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIFdlYlNldHRpbmdzIHNldHRpbmdzID0gZ2V0U2V0dGluZ3MoKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIG1Jblpvb21PdmVydmlldyA9IHNldHRpbmdzLmdldFVzZVdpZGVWaWV3UG9ydCgpICYmCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzLmdldExvYWRXaXRoT3ZlcnZpZXdNb2RlKCk7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICBtTWluWm9vbVNjYWxlID0gcmVzdG9yZVN0YXRlLm1EZWZhdWx0U2NhbGU7Ci0gICAgICAgICAgICAgICAgICAgIG1NaW5ab29tU2NhbGVGaXhlZCA9IHRydWU7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBtTWluWm9vbVNjYWxlID0gREVGQVVMVF9NSU5fWk9PTV9TQ0FMRTsKLSAgICAgICAgICAgICAgICBtTWluWm9vbVNjYWxlRml4ZWQgPSBmYWxzZTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgIG1NaW5ab29tU2NhbGUgPSByZXN0b3JlU3RhdGUubU1pblNjYWxlOwotICAgICAgICAgICAgbU1pblpvb21TY2FsZUZpeGVkID0gdHJ1ZTsKLSAgICAgICAgfQotICAgICAgICBpZiAocmVzdG9yZVN0YXRlLm1NYXhTY2FsZSA9PSAwKSB7Ci0gICAgICAgICAgICBtTWF4Wm9vbVNjYWxlID0gREVGQVVMVF9NQVhfWk9PTV9TQ0FMRTsKLSAgICAgICAgfSBlb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1lZGlhU3RvcmUuSW1hZ2VzLk1lZGlhLkRBVEEKKyAgICAgICAgICAgIC8vIHNlZW1zIHRvIHdvcmsgZm9yIGFsbCBjb250ZW50IFVSSXMsIG5vdCBqdXN0IGltYWdlcworICAgICAgICAgICAgQ3Vyc29yIGN1cnNvciA9IG1Db250ZXh0LmdldENvbnRlbnRSZXNvbHZlcigpLnF1ZXJ5KAorICAgICAgICAgICAgICAgICAgICB1cmksCisgICAgICAgICAgICAgICAgICAgIG5ldyBTdHJpbmdbXSB7IE1lZGlhU3RvcmUuSW1hZ2VzLk1lZGlhLkRBVEEgfSwKKyAgICAgICAgICAgICAgICAgICAgbnVsbCwgbnVsbCwgbnVsbCk7CisgICAgICAgICAgICBpZiAoY3Vyc29yICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgICAgICBpZiAoY3Vyc29yLm1vdmVUb05leHQoKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgZmlsZVBhdGggPSBjdXJzb3IuZ2V0U3RyaW5nKDApOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKKyAgICAgICAgICAgICAgICAgICAgY3Vyc29yLmNsb3NlKCk7CiAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfSBmaW5hbGx5IHsKLSAgICAgICAgICAgICAgICBjdXJzb3IuY2xvc2UoKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgZmlsZVBhdGggPSB1cmkuZ2V0TGFzdFBhdGhTZWdtZW50KCk7CiAgICAgICAgICAgICB9CisgICAgICAgICAgICBTdHJpbmcgdXJpU3RyaW5nID0gdXJpLnRvU3RyaW5nKCk7CisgICAgICAgICAgICBCcm93c2VyRnJhbWUuc0phdmFCcmlkZ2Uuc3RvcmVGaWxlUGF0aEZvckNvbnRlbnRVcmkoZmlsZVBhdGgsIHVyaVN0cmluZyk7CisgICAgICAgICAgICByZXR1cm4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MT05HUFJFU1MgPSAweDEwMDsKQEAgLTcwOCw4ICs3MTQsNiBAQAogICAgICAgICBpbnQgbVk7CiAgICAgICAgIGludCBtTWV0YVN0YXRlOwogICAgICAgICBib29sZWFuIG1SZXByb2Nlc3M7Ci0gICAgICAgIGZsb2F0IG1WaWV3WDsKLSAgICAgICAgZmxvYXQgbVZpZXdZOwogICAgIH0KIAogICAgIHN0YXRpYyBjbGFzcyBHZW9sb2NhdGlvblBlcm1pc3Npb25zRGF0YSB7CkBAIC03MTgsNyArNzIyLDExIEBACiAgICAgICAgIGJvb2xlYW4gbVJlbWVtYmVyOwogICAgIH0KIAotCisgICAgc3RhdGljIGNsYXNzIE1vZGlmeVNlbGVjdGlvbkRhdGEgeworICAgICAgICBTdHJpbmcgbUFsdGVyOworICAgICAgICBTdHJpbmcgbURpcmVjdGlvbjsKKyAgICAgICAgU3RyaW5nIG1HcmFudWxhcml0eTsKKyAgICB9CiAKICAgICAgICAgc3RhdGljIGZpbmFsIFN0cmluZ1tdIEhhbmRsZXJEZWJ1Z1N0cmluZyA9IHsKICAgICAgICAgICAgICJSRVFVRVNUX0xBQkVMIiwgLy8gOTcKQEAgLTc3MSw2ICs3NzksNyBAQAogICAgICAgICAgICAgIk9OX1JFU1VNRSIsICAgIC8vID0gMTQ0CiAgICAgICAgICAgICAiRlJFRV9NRU1PUlkiLCAgLy8gPSAxNDUKICAgICAgICAgICAgICJWQUxJRF9OT0RFX0JPVU5EUyIsIC8vID0gMTQ2CisgICAgICAgICAgICAiU0FWRV9XRUJBUkNISVZFIiwgLy8gPSAxNDcKICAgICAgICAgfTsKIAogICAgIGNsYXNzIEV2ZW50SHViIHsKQEAgLTgzNyw2ICs4NDYsOSBAQAogICAgICAgICBzdGF0aWMgZmluYWwgaW50IEZSRUVfTUVNT1JZID0gMTQ1OwogICAgICAgICBzdGF0aWMgZmluYWwgaW50IFZBTElEX05PREVfQk9VTkRTID0gMTQ2OwogCisgICAgICAgIC8vIExvYWQgYW5kIHNhdmUgd2ViIGFyY2hpdmVzCisgICAgICAgIHN0YXRpYyBmaW5hbCBpbnQgU0FWRV9XRUJBUkNISVZFID0gMTQ3OworCiAgICAgICAgIC8vIE5ldHdvcmstYmFzZWQgbWVzc2FnaW5nCiAgICAgICAgIHN0YXRpYyBmaW5hbCBpbnQgQ0xFQVJfU1NMX1BSRUZfVEFCTEUgPSAxNTA7CiAKQEAgLTg2NSw2ICs4NzcsMTQgQEAKICAgICAgICAgc3RhdGljIGZpbmFsIGludCBBRERfUEFDS0FHRV9OQU1FID0gMTg1OwogICAgICAgICBzdGF0aWMgZmluYWwgaW50IFJFTU9WRV9QQUNLQUdFX05BTUUgPSAxODY7CiAKKyAgICAgICAgc3RhdGljIGZpbmFsIGludCBHRVRfVE9VQ0hfSElHSExJR0hUX1JFQ1RTID0gMTg3OworICAgICAgICBzdGF0aWMgZmluYWwgaW50IFJFTU9WRV9UT1VDSF9ISUdITElHSFRfUkVDVFMgPSAxODg7CisKKyAgICAgICAgLy8gYWNjZXNzaWJpbGl0eSBzdXBwb3J0CisgICAgICAgIHN0YXRpYyBmaW5hbCBpbnQgTU9ESUZZX1NFTEVDVElPTiA9IDE5MDsKKworICAgICAgICBzdGF0aWMgZmluYWwgaW50IFVTRV9NT0NLX0RFVklDRV9PUklFTlRBVElPTiA9IDE5MTsKKwogICAgICAgICAvLyBwcml2YXRlIG1lc3NhZ2UgaWRzCiAgICAgICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBERVNUUk9ZID0gICAgIDIwMDsKIApAQCAtMTIzOCw2ICsxMjU4LDE5IEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmF0aXZlU2V0U2VsZWN0aW9uKG1zZy5hcmcxLCBtc2cuYXJnMik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAKKyAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgTU9ESUZZX1NFTEVDVElPTjoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBNb2RpZnlTZWxlY3Rpb25EYXRhIG1vZGlmeVNlbGVjdGlvbkRhdGEgPQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoTW9kaWZ5U2VsZWN0aW9uRGF0YSkgbXNnLm9iajsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBTdHJpbmcgc2VsZWN0aW9uU3RyaW5nID0gbmF0aXZlTW9kaWZ5U2VsZWN0aW9uKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kaWZ5U2VsZWN0aW9uRGF0YS5tQWx0ZXIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2RpZnlTZWxlY3Rpb25EYXRhLm1EaXJlY3Rpb24sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2RpZnlTZWxlY3Rpb25EYXRhLm1HcmFudWxhcml0eSk7CisKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBtV2ViVmlldy5tUHJpdmF0ZUhhbmRsZXIub2J0YWluTWVzc2FnZSgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFdlYlZpZXcuU0VMRUNUSU9OX1NUUklOR19DSEFOR0VELCBzZWxlY3Rpb25TdHJpbmcpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAuc2VuZFRvVGFyZ2V0KCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisKICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgTElTVEJPWF9DSE9JQ0VTOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNwYXJzZUJvb2xlYW5BcnJheSBjaG9pY2VzID0gKFNwYXJzZUJvb2xlYW5BcnJheSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1zZy5vYmo7CkBAIC0xMjc4LDYgKzEzMTEsMTUgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYXRpdmVTZXRKc0ZsYWdzKChTdHJpbmcpbXNnLm9iaik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAKKyAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgU0FWRV9XRUJBUkNISVZFOgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIFdlYlZpZXcuU2F2ZVdlYkFyY2hpdmVNZXNzYWdlIHNhdmVNZXNzYWdlID0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKFdlYlZpZXcuU2F2ZVdlYkFyY2hpdmVNZXNzYWdlKW1zZy5vYmo7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2F2ZU1lc3NhZ2UubVJlc3VsdEZpbGUgPQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzYXZlV2ViQXJjaGl2ZShzYXZlTWVzc2FnZS5tQmFzZW5hbWUsIHNhdmVNZXNzYWdlLm1BdXRvbmFtZSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVdlYlZpZXcubVByaXZhdGVIYW5kbGVyLm9idGFpbk1lc3NhZ2UoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFdlYlZpZXcuU0FWRV9XRUJBUkNISVZFX0ZJTklTSEVELCBzYXZlTWVzc2FnZSkuc2VuZFRvVGFyZ2V0KCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisKICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgR0VPTE9DQVRJT05fUEVSTUlTU0lPTlNfUFJPVklERToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHZW9sb2NhdGlvblBlcm1pc3Npb25zRGF0YSBkYXRhID0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChHZW9sb2NhdGlvblBlcm1pc3Npb25zRGF0YSkgbXNnLm9iajsKQEAgLTEyOTEsNyArMTMzMyw5IEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAKICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgU1BMSVRfUElDVFVSRV9TRVQ6Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgbmF0aXZlU3BsaXRDb250ZW50KCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmF0aXZlU3BsaXRDb250ZW50KG1zZy5hcmcxKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBtV2ViVmlldy5tUHJpdmF0ZUhhbmRsZXIub2J0YWluTWVzc2FnZSgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFdlYlZpZXcuUkVQTEFDRV9CQVNFX0NPTlRFTlQsIG1zZy5hcmcxLCAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtU3BsaXRQaWN0dXJlSXNTY2hlZHVsZWQgPSBmYWxzZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKIApAQCAtMTM1Nyw2ICsxNDAxLDI1IEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQnJvd3NlckZyYW1lLnNKYXZhQnJpZGdlLnJlbW92ZVBhY2thZ2VOYW1lKAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKFN0cmluZykgbXNnLm9iaik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgR0VUX1RPVUNIX0hJR0hMSUdIVF9SRUNUUzoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBUb3VjaEhpZ2hsaWdodERhdGEgZCA9IChUb3VjaEhpZ2hsaWdodERhdGEpIG1zZy5vYmo7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgQXJyYXlMaXN0PFJlY3Q+IHJlY3RzID0gbmF0aXZlR2V0VG91Y2hIaWdobGlnaHRSZWN0cworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGQubVgsIGQubVksIGQubVNsb3ApOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1XZWJWaWV3Lm1Qcml2YXRlSGFuZGxlci5vYnRhaW5NZXNzYWdlKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgV2ViVmlldy5TRVRfVE9VQ0hfSElHSExJR0hUX1JFQ1RTLCByZWN0cykKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5zZW5kVG9UYXJnZXQoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKworICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBSRU1PVkVfVE9VQ0hfSElHSExJR0hUX1JFQ1RTOgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1XZWJWaWV3Lm1Qcml2YXRlSGFuZGxlci5vYnRhaW5NZXNzYWdlKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgV2ViVmlldy5TRVRfVE9VQ0hfSElHSExJR0hUX1JFQ1RTLCBudWxsKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLnNlbmRUb1RhcmdldCgpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFVTRV9NT0NLX0RFVklDRV9PUklFTlRBVElPTjoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB1c2VNb2NrRGV2aWNlT3JpZW50YXRpb24oKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH07CkBAIC0xNTYyLDI0ICsxNjI1LDM5IEBACiAgICAgICAgIG1Ccm93c2VyRnJhbWUubG9hZFVybCh1cmwsIGV4dHJhSGVhZGVycyk7CiAgICAgfQogCisgICAgcHJpdmF0ZSBTdHJpbmcgc2F2ZVdlYkFyY2hpdmUoU3RyaW5nIGZpbGVuYW1lLCBib29sZWFuIGF1dG9uYW1lKSB7CisgICAgICAgIGlmIChEZW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lIGluZGl2aWR1YWwgY29tcGxleCBjaGFyYWN0ZXJzCisgICAgICAgICAgICB1bmljb2RlQ2hhciA9IGV2dC5nZXRDaGFyYWN0ZXJzKCkuY29kZVBvaW50QXQoMCk7CisgICAgICAgIH0KKworICAgICAgICBpZiAoIW5hdGl2ZUtleShrZXlDb2RlLCB1bmljb2RlQ2hhciwgZXZ0LmdldFJlcGVhdENvdW50KCksIGV2dC5pc1NoaWZ0UHJlc3NlZCgpLAorICAgICAgICAgICAgICAgIGV2dC5pc0FsdFByZXNzZWQoKSwgZXZ0LmlzU3ltUHJlc3NlZCgpLAogICAgICAgICAgICAgICAgIGlzRG93bikgJiYga2V5Q29kZSAhPSBLZXlFdmVudC5LRVlDT0RFX0VOVEVSKSB7CiAgICAgICAgICAgICBpZiAoa2V5Q29kZSA+PSBLZXlFdmVudC5LRVlDT0RFX0RQQURfVVAKICAgICAgICAgICAgICAgICAgICAgJiYga2V5Q29kZSA8PSBLZXlFdmVudC5LRVlDT0RFX0RQQURfUklHSFQpIHsKICAgICAgICAgICAgICAgICBpZiAoRGVidWdGbGFncy5XRUJfVklFV19DT1JFKSB7Ci0gICAgICAgICAgICAgICAgICAgIExvZy52KExPR1RBRywgImtleTogYXJyb3cgdW51c2VkIGJ5IHBsdWdpbjogIiArIGtleUNvZGUpOworICAgICAgICAgICAgICAgICAgICBMb2cudihMT0dUQUcsICJrZXk6IGFycm93IHVudXNlZCBieSBwYWdlOiAiICsga2V5Q29kZSk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIGlmIChtV2ViVmlldyAhPSBudWxsICYmIGV2dC5pc0Rvd24oKSkgewogICAgICAgICAgICAgICAgICAgICBNZXNzYWdlLm9idGFpbihtV2ViVmlldy5tUHJpdmF0ZUhhbmRsZXIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgV2ViVmlldy5NT1ZFX09VVF9PRl9QTFVHSU4sIGtleUNvZGUpLnNlbmRUb1RhcmdldCgpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIFdlYlZpZXcuVU5IQU5ETEVEX05BVl9LRVksIGtleUNvZGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgMCkuc2VuZFRvVGFyZ2V0KCk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgIH0KQEAgLTE2MTAsNyArMTY4OCw3IEBACiAgICAgICAgIGlmIChtU2V0dGluZ3MuZ2V0VXNlV2lkZVZpZXdQb3J0KCkpIHsKICAgICAgICAgICAgIGlmIChtVmlld3BvcnRXaWR0aCA9PSAtMSkgewogICAgICAgICAgICAgICAgIGlmIChtU2V0dGluZ3MuZ2V0TGF5b3V0QWxnb3JpdGhtKCkgPT0KLSAgICAgICAgICAgICAgICAgICAgICAgIFdlYlNldHRpbmdzLkxheW91dEFsZ29yaXRobS5OT1JNQUwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIFdlYlNldHRpbmdzLkxheW91dEFsZ29yaXRobS5OT1JNQUwgfHwgbVNldHRpbmdzLmdldFVzZUZpeGVkVmlld3BvcnQoKSkgewogICAgICAgICAgICAgICAgICAgICB3aWR0aCA9IFdlYlZpZXcuREVGQVVMVF9WSUVXUE9SVF9XSURUSDsKICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAvKgpAQCAtMTY3NSw2ICsxNzUzLDE0IEBACiAgICAgICAgIHJldHVybiB1c2VkUXVvdGE7CiAgICAgfQogCisgICAgLy8gY2FsbGVkIGZyb20gVUkgdGhyZWFkCisgICAgdm9pZCBzcGxpdENvbnRlbnQoaW50IGNvbnRlbnQpIHsKKyAgICAgICAgaWYgKCFtU3BsaXRQaWN0dXJlSXNTY2hlZHVsZWQpIHsKKyAgICAgICAgICAgIG1TcGxpdFBpY3R1cmVJc1NjaGVkdWxlZCA9IHRydWU7CisgICAgICAgICAgICBzZW5kTWVzc2FnZShFdmVudEh1Yi5TUExJVF9QSUNUVVJFX1NFV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kcmF3Lm1CYXNlTGF5ZXIgPSBuYXRpdmVSZWNvcmRDb250ZW50KGRyYXcubUludmFsUmVnaW9uLCBkcmF3Lm1XaWR0aEhlaWdodCk7CisgICAgICAgIGlmIChkcmF3Lm1CYXNlTGF5ZXIgPT0gMCkgewogICAgICAgICAgICAgaWYgKERlYnVnRmxhZ3MuV0VCX1ZJRVdfQ09SRSkgTG9nLnYoTE9HVEFHLCAid2Via2l0RHJhdyBhYm9ydCIpOwogICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICB9CkBAIC0xNzM0LDkgKzE4MjIsOSBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDogbVZpZXdwb3J0V2lkdGgpLAogICAgICAgICAgICAgICAgICAgICAgICAgbmF0aXZlR2V0Q29udGVudE1pblByZWZXaWR0aCgpKTsKICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmIChtUmVzdG9yZVN0YXRlICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICBkcmF3Lm1SZXN0b3JlU3RhdGUgPSBtUmVzdG9yZVN0YXRlOwotICAgICAgICAgICAgICAgIG1SZXN0b3JlU3RhdGUgPSBudWxsOworICAgICAgICAgICAgaWYgKG1Jbml0aWFsVmlld1N0YXRlICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBkcmF3Lm1WaWV3U3RhdGUgPSBtSW5pdGlhbFZpZXdTdGF0ZTsKKyAgICAgICAgICAgICAgICBtSW5pdGlhbFZpZXdTdGF0ZSA9IG51bGw7CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBpZiAoRGVidWdGbGFncy5XRUJfVklFV19DT1JFKSBMb2cudihMT0dUQUcsICJ3ZWJraXREcmF3IE5FV19QSUNUVVJFX01TR19JRCIpOwogICAgICAgICAgICAgTWVzc2FnZS5vYnRhaW4obVdlYlZpZXcubVByaXZhdGVIYW5kbGVyLApAQCAtMTc1MSw1MSArMTgzOSw2IEBACiAgICAgICAgIH0KICAgICB9CiA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ICAgICAgIGlmIChjb3JlICE9IG51bGwpIHsKKyAgICAgICAgICAgIC8vIGlmIG1EcmF3SXNQYXVzZWQgaXMgdHJ1ZSwgaWdub3JlIHRoZSBzZXR0aW5nLCBjb250aW51ZSB0byByZXN1bWUKKyAgICAgICAgICAgIGlmICghY29yZS5tRHJhd0lzUGF1c2VkCisgICAgICAgICAgICAgICAgICAgICYmICFjb3JlLmdldFNldHRpbmdzKCkuZW5hYmxlU21vb3RoVHJhbnNpdGlvbigpKSByZXR1cm47CisKICAgICAgICAgICAgIHN5bmNocm9uaXplZCAoY29yZSkgewogICAgICAgICAgICAgICAgIGNvcmUubURyYXdJc1BhdXNlZCA9IGZhbHNlOwogICAgICAgICAgICAgICAgIGlmIChjb3JlLm1EcmF3SXNTY2hlZHVsZWQpIHsKQEAgLTE5NzEsMjQgKzIwMjAsNiBAQAogICAgICAgICBtUmVwYWludFNjaGVkdWxlZCA9IGZhbHNlOwogICAgIH0KIAotICAgIC8vIGNhbGxlZCBieSBKTkkKLSAgICBwcml2YXRlIHZvaWQgc2VuZEltbWVkaWF0ZVJlcGFpbnQoKSB7Ci0gICAgICAgIGlmIChtV2ViVmlldyAhPSBudWxsICYmICFtUmVwYWludFNjaGVkdWxlZCkgewotICAgICAgICAgICAgbVJlcGFpbnRTY2hlZHVsZWQgPSB0cnVlOwotICAgICAgICAgICAgTWVzc2FnZS5vYnRhaW4obVdlYlZpZXcubVByaXZhdGVIYW5kbGVyLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgV2ViVmlldy5JTU1FRElBVEVfUkVQQUlOVF9NU0dfSUQpLnNlbmRUb1RhcmdldCgpOwotICAgICAgICB9Ci0gICAgfQotCi0gICAgLy8gY2FsbGVkIGJ5IEpOSQotICAgIHByaXZhdGUgdm9pZCBzZXRSb290TGF5ZXIoaW50IGxheWVyKSB7Ci0gICAgICAgIGlmIChtV2ViVmlldyAhPSBudWxsKSB7Ci0gICAgICAgICAgICBNZXNzYWdlLm9idGFpbihtV2Vi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GRhdGVWaWV3U3RhdGUpIHsKICAgICAgICAgLy8gc2V0IHRoZSB2aWV3cG9ydCBzZXR0aW5ncyBmcm9tIFdlYktpdAogICAgICAgICBzZXRWaWV3cG9ydFNldHRpbmdzRnJvbU5hdGl2ZSgpOwogCiAgICAgICAgIC8vIGFkanVzdCB0aGUgZGVmYXVsdCBzY2FsZSB0byBtYXRjaCB0aGUgZGVuc2l0eURwaQogICAgICAgICBmbG9hdCBhZGp1c3QgPSAxLjBmOwogICAgICAgICBpZiAobVZpZXdwb3J0RGVuc2l0eURwaSA9PSAtMSkgewotICAgICAgICAgICAgaWYgKFdlYlZpZXcuREVGQVVMVF9TQ0FMRV9QRVJDRU5UICE9IDEwMCkgewotICAgICAgICAgICAgICAgIGFkanVzdCA9IFdlYlZpZXcuREVGQVVMVF9TQ0FMRV9QRVJDRU5UIC8gMTAwLjBmOworICAgICAgICAgICAgLy8gY29udmVydCBkZWZhdWx0IHpvb20gc2NhbGUgdG8gYSBpbnRlZ2VyIChwZXJjZW50YWdlKSB0byBhdm9pZCBhbnkKKyAgICAgICAgICAgIC8vIGlzc3VlcyB3aXRoIGZsb2F0aW5nIHBvaW50IGNvbXBhcmlzb25zCisgICAgICAgICAgICBpZiAobVdlYlZpZXcgIT0gbnVsbCAmJiAoaW50KShtV2ViVmlldy5nZXREZWZhdWx0Wm9vbVNjYWxlKCkgKiAxMDApICE9IDEwMCkgeworICAgICAgICAgICAgICAgIGFkanVzdCA9IG1XZWJWaWV3LmdldERlZmF1bHRab29tU2NhbGUoKTsKICAgICAgICAgICAgIH0KICAgICAgICAgfSBlbHNlIGlmIChtVmlld3BvcnREZW5zaXR5RHBpID4gMCkgewogICAgICAgICAgICAgYWRqdXN0ID0gKGZsb2F0KSBtQ29udGV4dC5nZXRSZXNvdXJjZXMoKS5nZXREaXNwbGF5TWV0cmljcygpLmRlbnNpdHlEcGkKQEAgLTIwODAsMTcgKzIxMTksMTcgQEAKICAgICAgICAgfQogCiAgICAgICAgIC8vI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ICAgICAgICAgICAgICAgICAgICA6IG1SZXN0b3JlU3RhdGUubVRleHRXcmFwU2NhbGUpCi0gICAgICAgICAgICAgICAgICAgICAgICA6IG1SZXN0b3JlU3RhdGUubVZpZXdTY2FsZTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOiBtSW5pdGlhbFZpZXdTdGF0ZS5tVGV4dFdyYXBTY2FsZSkKKyAgICAgICAgICAgICAgICAgICAgICAgIDogbUluaXRpYWxWaWV3U3RhdGUubVZpZXdTY2FsZTsKICAgICAgICAgICAgICAgICBpZiAoRGVidWdGbGFncy5XRUJfVklFV19DT1JFKSB7CiAgICAgICAgICAgICAgICAgICAgIExvZy52KExPR1RBRywgInNldHVwVmlld3BvcnQiCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgIiBtUmVzdG9yZWRTY2FsZT0iICsgbVJlc3RvcmVkU2NhbGUKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyAiIG1WaWV3U2NhbGU9IiArIG1SZXN0b3JlU3RhdGUubVZpZXdTY2FsZQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICArICIgbVRleHRXcmFwU2NhbGU9IiArIG1SZXN0b3JlU3RhdGUubVRleHRXcmFwU2NhbGUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyAiIG1WaWV3U2NhbGU9IiArIG1Jbml0aWFsVmlld1N0YXRlLm1WaWV3U2NhbGUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyAiIG1UZXh0V3JhcFNjYWxlPSIgKyBtSW5pdGlhbFZpZXdTdGF0ZS5tVGV4dFdyYXBTY2FsZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICApOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBkYXRhLm1XaWR0aCA9IE1hdGgucm91bmQod2ViVmlld1dpZHRoIC8gZGF0YS5tU2NhbGUpOwpAQCAtMjE5OCw3ICsyMjM2LDcgQEAKICAgICAgICAgICAgICAgICAg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mlld0RhdGFiYXNlLmphdmEKKysrIGIvY29yZS9qYXZhL2FuZHJvaWQvd2Via2l0L1dlYlZpZXdEYXRhYmFzZS5qYXZhCkBAIC0xNzMsMTEyICsxNzMsMTQwIEBACiAKICAgICBwcml2YXRlIHN0YXRpYyBpbnQgbUNhY2hlVHJhbnNhY3Rpb25SZWZjb3VudDsKIAotICAgIHByaXZhdGUgV2ViVmlld0RhdGFiYXNlKCkgeworICAgIC8vIEluaXRpYWxseSB0cnVlIHVudGlsIHRoZSBiYWNrZ3JvdW5kIHRocmVhZCBjb21wbGV0ZXMuCisgICAgcHJpdmF0ZSBib29sZWFuIG1Jbml0aWFsaXplZCA9IGZhbHNlOworCisgICAgcHJpdmF0ZSBXZWJWaWV3RGF0YWJhc2UoZmluYWwgQ29udGV4dCBjb250ZXh0KSB7CisgICAgICAgIG5ldyBUaHJlYWQoKSB7CisgICAgICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgICAgIHB1YmxpYyB2b2lkIHJ1bigpIHsKKyAgICAgICAgICAgICAgICBpbml0KGNvbnRleHQpOworICAgICAgICAgICAgfQorICAgICAgICB9LnN0YXJ0KCk7CisKICAgICAgICAgLy8gU2luZ2xldG9uIG9ubHksIHVzZSBnZXRJbnN0YW5jZSgpCiAgICAgfQogCiAgICAgcHVibGljIHN0YXRpYyBzeW5jaHJvbml6ZWQgV2ViVmlld0RhdGFiYXNlIGdldEluc3RhbmNlKENvbnRleHQgY29udGV4dCkgewogICAgICAgICBpZiAobUluc3RhbmNlID09IG51bGwpIHsKLSAgICAgICAgICAgIG1JbnN0YW5jZSA9IG5ldyBXZWJWaWV3RGF0YWJhc2UoKTsKLSAgICAgICAgICAgIHRyeSB7Ci0gICAgICAgICAgICAgICAgbURhdGFiYXNlID0gY29udGV4dAotICAgICAgICAgICAgICAgICAgICAgICAgLm9wZW5PckNyZWF0ZURhdGFiYXNlKERBVEFCQVNFX0ZJTEUsIDAsIG51bGwpOwotICAgICAgICAgICAgfSBjYXRjaCAoU1FMaXRlRXhjZXB0aW9uIGUpIHsKLSAgICAgICAgICAgICAgICAvLyB0cnkgYWdhaW4gYnkgZGVsZXRpbmcgdGhlIG9sZCBkYiBhbmQgY3JlYXRlIGEgbmV3IG9uZQotICAgICAgICAgICAgICAgIGlmIChjb250ZXh0LmRlbGV0ZURhdGFiYXNlKERBVEFCQVNFX0ZJTEUpKSB7Ci0gICAgICAgICAgICAgICAgICAgIG1EYXRhYmFzZSA9IGNvbnRleHQub3Blbk9yQ3JlYXRlRGF0YWJhc2UoREFUQUJBU0VfRklMRSwgMCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9CisgICAgICAgICAgICBtSW5zdGFuY2UgPSBuZXcgV2ViVmlld0RhdGFiYXNlKGNvbnRleHQpOworICAgICAgICB9CisgICAgICAgIHJldHVybiBtSW5zdGFuY2U7CisgICAgfQogCi0gICAgICAgICAgICAvLyBtRGF0YWJhc2Ugc2hvdWxkIG5vdCBiZSBudWxsLCAKLSAgICAgICAgICAgIC8vIHRoZSBvbmx5IGNhc2UgaXMgUmVxdWVzdEFQSSB0ZXN0IGhhcyBwcm9ibGVtIHRvIGNyZWF0ZSBkYiAKLSAgICAgICAgICAgIGlmIChtRGF0YWJhc2UgIT0gbnVsbCAmJiBtRGF0YWJhc2UuZ2V0VmVyc2lvbigpICE9IERBVEFCQVNFX1ZFUlNJT04pIHsKLSAgICAgICAgICAgICAgICBtRGF0YWJhc2UuYmVnaW5UcmFuc2FjdGlvbigpOwotICAgICAgICAgICAgICAgIHRyeSB7Ci0gICAgICAgICAgICAgICAgICAgIHVwZ3JhZGVEYXRhYmFzZSgpOwotICAgICAgICAgICAgICAgICAgICBtRGF0YWJhc2Uuc2V0VHJhbnNhY3Rpb25TdWNjZXNzZnVsKCk7Ci0gICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKLSAgICAgICAgICAgICAgICAgICAgbURhdGFiYXNlLmVuZFRyYW5zYWN0aW9uKCk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQorICAgIHByaXZhdGUgc3luY2hyb25pemVkIHZvaWQgaW5pdChDb250ZXh0IGNvbnRleHQpIHsKKyAgICAgICAgaWYgKG1Jbml0aWFsaXplZCkgeworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CiAKLSAgICAgICAgICAgIGlmIChtRGF0YWJhc2UgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgIC8vIHVzZSBwZXIgdGFibGUgTXV0ZXggbG9jaywgdHVybiBvZmYgZGF0YWJhc2UgbG9jaywgdGhpcwotICAgICAgICAgICAgICAgIC8vIGltcHJvdmVzIHBlcmZvcm1hbmNlIGFzIGRhdGFiYXNlJ3MgUmVlbnRyYW50TG9jayBpcyBleHBhbnNpdmUKLSAgICAgICAgICAgICAgICBtRGF0YWJhc2Uuc2V0TG9ja2luZ0VuYWJsZWQoZmFsc2UpOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICB0cnkgewotICAgICAgICAgICAgICAgIG1DYWNoZURhdGFiYXNlID0gY29udGV4dC5vcGVuT3JDcmVhdGVEYXRhYmFzZSgKLSAgICAgICAgICAgICAgICAgICAgICAgIENBQ0hFX0RBVEFCQVNFX0ZJTEUsIDAsIG51bGwpOwotICAgICAgICAgICAgfSBjYXRjaCAoU1FMaXRlRXhjZXB0aW9uIGUpIHsKLSAgICAgICAgICAgICAgICAvLyB0cnkgYWdhaW4gYnkgZGVsZXRpbmcgdGhlIG9sZCBkYiBhbmQgY3JlYXRlIGEgbmV3IG9uZQotICAgICAgICAgICAgICAgIGlmIChjb250ZXh0LmRlbGV0ZURhdGFiYXNlKENBQ0hFX0RBVEFCQVNFX0ZJTEUpKSB7Ci0gICAgICAgICAgICAgICAgICAgIG1DYWNoZURhdGFiYXNlID0gY29udGV4dC5vcGVuT3JDcmVhdGVEYXRhYmFzZSgKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBDQUNIRV9EQVRBQkFTRV9GSUxFLCAwLCBudWxsKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIC8vIG1DYWNoZURhdGFiYXNlIHNob3VsZCBub3QgYmUgbnVsbCwgCi0gICAgICAgICAgICAvLyB0aGUgb25seSBjYXNlIGlzIFJlcXVlc3RBUEkgdGVzdCBoYXMgcHJvYmxlbSB0byBjcmVhdGUgZGIgCi0gICAgICAgICAgICBpZiAobUNhY2hlRGF0YWJhc2UgIT0gbnVsbAotICAgICAgICAgICAgICAgICAgICAmJiBtQ2FjaGVEYXRhYmFzZS5nZXRWZXJzaW9uKCkgIT0gQ0FDSEVfREFUQUJBU0VfVkVSU0lPTikgewotICAgICAgICAgICAgICAgIG1DYWNoZURhdGFiYXNlLmJlZ2luVHJhbnNhY3Rpb24oKTsKLSAgICAgICAgICAgICAgICB0cnkgewotICAgICAgICAgICAgICAgICAgICB1cGdyYWRlQ2FjaGVEYXRhYmFzZSgpOwotICAgICAgICAgICAgICAgICAgICBib290c3RyYXBDYWNoZURhdGFiYXNlKCk7Ci0gICAgICAgICAgICAgICAgICAgIG1DYWNoZURhdGFiYXNlLnNldFRyYW5zYWN0aW9uU3VjY2Vzc2Z1bCgpOwotICAgICAgICAgICAgICAgIH0gZmluYWxseSB7Ci0gICAgICAgICAgICAgICAgICAgIG1DYWNoZURhdGFiYXNlLmVuZFRyYW5zYWN0aW9uKCk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIC8vIEVyYXNlIHRoZSBmaWxlcyBmcm9tIHRoZSBmaWxlIHN5c3RlbSBpbiB0aGUgCi0gICAgICAgICAgICAgICAgLy8gY2FzZSB0aGF0IHRoZSBkYXRhYmFzZSB3YXMgdXBkYXRlZCBhbmQgdGhlIAotICAgICAgICAgICAgICAgIC8vIHRoZXJlIHdlcmUgZXhpc3RpbmcgY2FjaGUgY29udGVudAotICAgICAgICAgICAgICAgIENhY2hlTWFuYWdlci5yZW1vdmVBbGxDYWNoZUZpbGVzKCk7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIGlmIChtQ2FjaGVEYXRhYmFzZSAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgLy8gdXNlIHJlYWRfdW5jb21taXR0ZWQgdG8gc3BlZWQgdXAgUkVBRAotICAgICAgICAgICAgICAgIG1DYWNoZURhdGFiYXNlLmV4ZWNTUUwoIlBSQUdNQSByZWFkX3VuY29tbWl0dGVkID0gdHJ1ZTsiKTsKLSAgICAgICAgICAgICAgICAvLyBhcyBvbmx5IFJFQUQgY2FuIGJlIGNhbGxlZCBpbiB0aGUgbm9uLVdlYlZpZXdXb3JrZXJUaHJlYWQsCi0gICAgICAgICAgICAgICAgLy8gYW5kIHJlYWRfdW5jb21taXR0ZWQgaXMgdXNlZCwgd2UgY2FuIHR1cm4gb2ZmIGRhdGFiYXNlIGxvY2sKLSAgICAgICAgICAgICAgICAvLyB0byB1c2UgdHJhbnNhY3Rpb24uCi0gICAgICAgICAgICAgICAgbUNhY2hlRGF0YWJhc2Uuc2V0TG9ja2luZ0VuYWJsZWQoZmFsc2UpOwotCi0gICAgICAgICAgICAgICAgLy8gdXNlIEluc2VydEhlbHBlciBmb3IgZmFzdGVyIGluc2VydGlvbgotICAgICAgICAgICAgICAgIG1DYWNoZUluc2VydGVyID0gbmV3IERhdGFiYXNlVXRpbHMuSW5zZXJ0SGVscGVyKG1DYWNoZURhdGFiYXNlLAotICAgICAgICAgICAgICAgICAgICAgICAgImNhY2hlIik7Ci0gICAgICAgICAgICAgICAgbUNhY2hlVXJsQ29sSW5kZXggPSBtQ2FjaGVJbnNlcnRlcgotICAgICAgICAgICAgICAgICAgICAgICAgLmdldENvbHVtbkluZGV4KENBQ0hFX1VSTF9DT0wpOwotICAgICAgICAgICAgICAgIG1DYWNoZUZpbGVQYXRoQ29sSW5kZXggPSBtQ2FjaGVJbnNlcnRlcgotICAgICAgICAgICAgICAgICAgICAgICAgLmdldENvbHVtbkluZGV4KENBQ0hFX0ZJTEVfUEFUSF9DT0wpOwotICAgICAgICAgICAgICAgIG1DYWNoZUxhc3RNb2RpZnlDb2xJbmRleCA9IG1DYWNoZUluc2VydGVyCi0gICAgICAgICAgICAgICAgICAgICAgICAuZ2V0Q29sdW1uSW5kZXgoQ0FDSEVfTEFTVF9NT0RJRllfQ09MKTsKLSAgICAgICAgICAgICAgICBtQ2FjaGVFVGFnQ29sSW5kZXggPSBtQ2FjaGVJbnNlcnRlcgotICAgICAgICAgICAgICAgICAgICAgICAgLmdldENvbHVtbkluZGV4KENBQ0hFX0VUQUdfQ09MKTsKLSAgICAgICAgICAgICAgICBtQ2FjaGVFeHBpcmVzQ29sSW5kZXggPSBtQ2FjaGVJbnNlcnRlcgotICAgICAgICAgICAgICAgICAgICAgICAgLmdldENvbHVtbkluZGV4KENBQ0hFX0VYUElSRVNfQ09MKTsKLSAgICAgICAgICAgICAgICBtQ2FjaGVFeHBpcmVzU3RyaW5nQ29sSW5kZXggPSBtQ2FjaGVJbnNlcnRlcgotICAgICAgICAgICAgICAgICAgICAgICAgLmdldENvbHVtbkluZGV4KENBQ0hFX0VYUElSRVNfU1RSSU5HX0NPTCk7Ci0gICAgICAgICAgICAgICAgbUNhY2hlTWltZVR5cGVDb2xJbmRleCA9IG1DYWNoZUluc2VydGVyCi0gICAgICAgICAgICAgICAgICAgICAgICAuZ2V0Q29sdW1uSW5kZXgoQ0FDSEVfTUlNRVRZUEVfQ09MKTsKLSAgICAgICAgICAgICAgICBtQ2FjaGVFbmNvZGluZ0NvbEluZGV4ID0gbUNhY2hlSW5zZXJ0ZXIKLSAgICAgICAgICAgICAgICAgICAgICAgIC5nZXRDb2x1bW5JbmRleChDQUNIRV9FTkNPRElOR19DT0wpOwotICAgICAgICAgICAgICAgIG1DYWNoZUh0dHBTdGF0dXNDb2xJbmRleCA9IG1DYWNoZUluc2VydGVyCi0gICAgICAgICAgICAgICAgICAgICAgICAuZ2V0Q29sdW1uSW5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3JlYXRlRGF0YWJhc2UoREFUQUJBU0VfRklMRSwgMCwKKyAgICAgICAgICAgICAgICAgICAgICAgIG51bGwpOwogICAgICAgICAgICAgfQogICAgICAgICB9CiAKLSAgICAgICAgcmV0dXJuIG1JbnN0YW5jZTsKKyAgICAgICAgLy8gbURhdGFiYXNlIHNob3VsZCBub3QgYmUgbnVsbCwKKyAgICAgICAgLy8gdGhlIG9ubHkgY2FzZSBpcyBSZXF1ZXN0QVBJIHRlc3QgaGFzIHByb2JsZW0gdG8gY3JlYXRlIGRiCisgICAgICAgIGlmIChtRGF0YWJhc2UgPT0gbnVsbCkgeworICAgICAgICAgICAgbUluaXRpYWxpemVkID0gdHJ1ZTsKKyAgICAgICAgICAgIG5vdGlmeSgpOworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisKKyAgICAgICAgaWYgKG1EYXRhYmFzZS5nZXRWZXJzaW9uKCkgIT0gREFUQUJBU0VfVkVSU0lPTikgeworICAgICAgICAgICAgbURhdGFiYXNlLmJlZ2luVHJhbnNhY3Rpb24oKTsKKyAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgdXBncmFkZURhdGFiYXNlKCk7CisgICAgICAgICAgICAgICAgbURhdGFiYXNlLnNldFRyYW5zYWN0aW9uU3VjY2Vzc2Z1bCgpOworICAgICAgICAgICAgfSBmaW5hbGx5IHsKKyAgICAgICAgICAgICAgICBtRGF0YWJhc2UuZW5kVHJhbnNhY3Rpb24oKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIC8vIHVzZSBwZXIgdGFibGUgTXV0ZXggbG9jaywgdHVybiBvZmYgZGF0YWJhc2UgbG9jaywgdGhpcworICAgICAgICAvLyBpbXByb3ZlcyBwZXJmb3JtYW5jZSBhcyBkYXRhYmFzZSdzIFJlZW50cmFudExvY2sgaXMKKyAgICAgICAgLy8gZXhwYW5zaXZlCisgICAgICAgIG1EYXRhYmFzZS5zZXRMb2NraW5nRW5hYmxlZChmYW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WxwZXIgZm9yIGZhc3RlciBpbnNlcnRpb24KKyAgICAgICAgbUNhY2hlSW5zZXJ0ZXIgPQorICAgICAgICAgICAgICAgIG5ldyBEYXRhYmFzZVV0aWxzLkluc2VydEhlbHBlcihtQ2FjaGVEYXRhYmFzZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICJjYWNoZSIpOworICAgICAgICBtQ2FjaGVVcmxDb2xJbmRleCA9IG1DYWNoZUluc2VydGVyCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLmdldENvbHVtbkluZGV4KENBQ0hFX1VSTF9DT0wpOworICAgICAgICBtQ2FjaGVGaWxlUGF0aENvbEluZGV4ID0gbUNhY2hlSW5zZXJ0ZXIKKyAgICAgICAgICAgICAgICAuZ2V0Q29sdW1uSW5kZXgoQ0FDSEVfRklMRV9QQVRIX0NPTCk7CisgICAgICAgIG1DYWNoZUxhc3RNb2RpZnlDb2xJbmRleCA9IG1DYWNoZUluc2VydGVyCisgICAgICAgICAgICAgICAgLmdldENvbHVtbkluZGV4KENBQ0hFX0xBU1RfTU9ESUZZX0NPTCk7CisgICAgICAgIG1DYWNoZUVUYWdDb2xJbmRleCA9IG1DYWNoZUluc2VydGVyCisgICAgICAgICAgICAgICAgLmdldENvbHVtbkluZGV4KENBQ0hFX0VUQUdfQ09MKTsKKyAgICAgICAgbUNhY2hlRXhwaXJlc0NvbEluZGV4ID0gbUNhY2hlSW5zZXJ0ZXIKKyAgICAgICAgICAgICAgICAuZ2V0Q29sdW1uSW5kZXgoQ0FDSEVfRVhQSVJFU19DT0wpOworICAgICAgICBtQ2FjaGVFeHBpcmVzU3RyaW5nQ29sSW5kZXggPSBtQ2FjaGVJbnNlcnRlcgorICAgICAgICAgICAgICAgIC5nZXRDb2x1bW5JbmRleChDQUNIRV9FWFBJUkVTX1NUUklOR19DT0wpOworICAgICAgICBtQ2FjaGVNaW1lVHlwZUNvbEluZGV4ID0gbUNhY2hlSW5zZXJ0ZXIKKyAgICAgICAgICAgICAgICAu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ggKzQxOSwyNSBAQAogICAgICAgICB9CiAgICAgfQogCisgICAgLy8gV2FpdCBmb3IgdGhlIGJhY2tncm91bmQgaW5pdGlhbGl6YXRpb24gdGhyZWFkIHRvIGNvbXBsZXRlIGFuZCBjaGVjayB0aGUKKyAgICAvLyBkYXRhYmFzZSBjcmVhdGlvbiBzdGF0dXMuCisgICAgcHJpdmF0ZSBib29sZWFuIGNoZWNrSW5pdGlhbGl6ZWQoKSB7CisgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgeworICAgICAgICAgICAgd2hpbGUgKCFtSW5pdGlhbGl6ZWQpIHsKKyAgICAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgICAgICB3YWl0KCk7CisgICAgICAgICAgICAgICAgfSBjYXRjaCAoSW50ZXJydXB0ZWRFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgICAgICBMb2cuZShMT0dUQUcsICJDYXVnaHQgZXhjZXB0aW9uIHdoaWxlIGNoZWNraW5nICIgKworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJpbml0aWFsaXphdGlvbiIpOworICAgICAgICAgICAgICAgICAgICBMb2cuZShMT0dUQUcsIExvZy5nZXRTdGFja1RyYWNlU3RyaW5nKGUpKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIG1EYXRhYmFzZSAhPSBudWxsOworICAgIH0KKwogICAgIHByaXZhdGUgYm9vbGVhbiBoYXNFbnRyaWVzKGludCB0YWJsZUlkKSB7Ci0gICAgICAgIGlmIChtRGF0YWJhc2UgPT0gbnVsbCkgeworICAgICAgICBpZiAoIWNoZWNrSW5pdGlhbGl6ZWQoKSkgewogICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICB9CiAKQEAgLTQyMiw3ICs0NjcsNyBAQAogICAgICAqLwogICAgIEFycmF5TGlzdDxDb29raWU+IGdldENvb2tpZXNGb3JEb21haW4oU3RyaW5nIGRvbWFpbikgewogICAgICAgICBBcnJheUxpc3Q8Q29va2llPiBsaXN0ID0gbmV3IEFycmF5TGlzdDxDb29raWU+KCk7Ci0gICAgICAgIGlmIChkb21haW4gPT0gbnVsbCB8fCBtRGF0YWJhc2UgPT0gbnVsbCkgeworICAgICAgICBpZiAoZG9tYWluID09IG51bGwgfHwgIWNoZWNrSW5pdGlhbGl6ZWQoKSkgewogICAgICAgICAgICAgcmV0dXJuIGxpc3Q7CiAgICAgICAgIH0KIApAQCAtNDgxLDcgKzUyNiw3IEBACiAgICAgICogICAgICAgICAgICBkZWxldGVkLgogICAgICAqLwogICAgIHZvaWQgZGVsZXRlQ29va2llcyhTdHJpbmcgZG9tYWluLCBTdHJpbmcgcGF0aCwgU3RyaW5nIG5hbWUpIHsKLSAgICAgICAgaWYgKGRvbWFpbiA9PSBudWxsIHx8IG1EYXRhYmFzZSA9PSBudWxsKSB7CisgICAgICAgIGlmIChkb21haW4gPT0gbnVsbCB8fCAhY2hlY2tJbml0aWFsaXplZCgpKSB7CiAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgIH0KIApAQCAtNTAxLDcgKzU0Niw3IEBACiAgICAgICovCiAgICAgdm9pZCBhZGRDb29raWUoQ29va2llIGNvb2tpZSkgewogICAgICAgICBpZiAoY29va2llLmRvbWFpbiA9PSBudWxsIHx8IGNvb2tpZS5wYXRoID09IG51bGwgfHwgY29va2llLm5hbWUgPT0gbnVsbAotICAgICAgICAgICAgICAgIHx8IG1EYXRhYmFzZSA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgfHwgIWNoZWNrSW5pdGlhbGl6ZWQoKSkgewogICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICB9CiAKQEAgLTUzNCw3ICs1NzksNyBAQAogICAgICAqIENsZWFyIGNvb2tpZSBkYXRhYmFzZQogICAgICAqLwogICAgIHZvaWQgY2xlYXJDb29raWVzKCkgewotICAgICAgICBpZiAobURhdGFiYXNlID09IG51bGwpIHsKKyAgICAgICAgaWYgKCFjaGVja0luaXRpYWxpemVkKCkpIHsKICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgfQogCkBAIC01NDcsNyArNTkyLDcgQEAKICAgICAgKiBDbGVhciBzZXNzaW9uIGNvb2tpZXMsIHdoaWNoIG1lYW5zIGNvb2tpZSBkb2Vzbid0IGhhdmUgRVhQSVJFUy4KICAgICAgKi8KICAgICB2b2lkIGNsZWFyU2Vzc2lvbkNvb2tpZXMoKSB7Ci0gICAgICAgIGlmIChtRGF0YWJhc2UgPT0gbnVsbCkgeworICAgICAgICBpZiAoIWNoZWNrSW5pdGlhbGl6ZWQoKSkgewogICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICB9CiAKQEAgLTU2NCw3ICs2MDksNyBAQAogICAgICAqIEBwYXJhbSBub3cgVGltZSBmb3Igbm93CiAgICAgICovCiAgICAgdm9pZCBjbGVhckV4cGlyZWRDb29raWVzKGxvbmcgbm93KSB7Ci0gICAgICAgIGlmIChtRGF0YWJhc2UgPT0gbnVsbCkgeworICAgICAgICBpZiAoIWNoZWNrSW5pdGlhbGl6ZWQoKSkgewogICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICB9CiAKQEAgLTYyMCw3ICs2NjUsNyBAQAogICAgICAqIEByZXR1cm4gQ2FjaGVSZXN1bHQgVGhlIENhY2hlTWFuYWdlci5DYWNoZVJlc3VsdAogICAgICAqLwogICAgIENhY2hlUmVzdWx0IGdldENhY2hlKFN0cmluZyB1cmwpIHsKLSAgICAgICAgaWYgKHVybCA9PSBudWxsIHx8IG1DYWNoZURhdGFiYXNlID09IG51bGwpIHsKKyAgICAgICAgaWYgKHVybCA9PSBudWxsIHx8ICFjaGVja0luaXRpYWxpemVkKCkpIHsKICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICB9CiAKQEAgLTY2MCw3ICs3MDUsNyBAQAogICAgICAqIEBwYXJhbSB1cmwgVGhlIHVybAogICAgICAqLwogICAgIHZvaWQgcmVtb3ZlQ2FjaGUoU3RyaW5nIHVybCkgewotICAgICAgICBpZiAodXJsID09IG51bGwgfHwgbUNhY2hlRGF0YWJhc2UgPT0gbnVsbCkgeworICAgICAgICBpZiAodXJsID09IG51bGwgfHwgIWNoZWNrSW5pdGlhbGl6ZWQoKSkgewogICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICB9CiAKQEAgLTY3NCw3ICs3MTksNyBAQAogICAgICAqIEBwYXJhbSBjIFRoZSBDYWNoZU1hbmFnZXIuQ2FjaGVSZXN1bHQKICAgICAgKi8KICAgICB2b2lkIGFkZENhY2hlKFN0cmluZyB1cmwsIENhY2hlUmVzdWx0IGMpIHsKLSAgICAgICAgaWYgKHVybCA9PSBudWxsIHx8IG1DYWNoZURhdGFiYXNlID09IG51bGwpIHsKKyAgICAgICAgaWYgKHVybCA9PSBudWxsIHx8ICFjaGVja0luaXRpYWxpemVkKCkpIHsKICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgfQogCkBAIC03MDAsNyArNzQ1LDcgQEAKICAgICAgKiBDbGVhciBjYWNoZSBkYXRhYmFzZQogICAgICAqLwogICAgIHZvaWQgY2xlYXJDYWNoZSgpIHsKLSAgICAgICAgaWYgKG1DYWNoZURhdGFiYXNlID09IG51bGwpIHsKKyAgICAgICAgaWYgKCFjaGVja0luaXRpYWxpemVkKCkpIHsKICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgfQogCkBAIC03MDgsNyArNzUzLDcgQEAKICAgICB9CiAKICAgICBib29sZWFuIGhhc0NhY2hlKCkgewotICAgICAgICBpZiAobUNhY2hlRGF0YWJhc2UgPT0gbnVsbCkgeworICAgICAgICBpZiAoIWNoZWNrSW5pdGlhbGl6ZWQoKSkgewogICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICB9CiAKQEAgLTgzNCw3ICs4NzksNyBAQAogICAgICAqLwogICAgIHZvaWQgc2V0VXNlcm5hbWVQYXNzd29yZChTdHJpbmcgc2NoZW1lUGx1c0hvc3QsIFN0cmluZyB1c2VybmFtZSwKICAgICAgICAgICAgICAgICBTdHJpbmcgcGFzc3dvcmQpIHsKLSAgICAgICAgaWYgKHNjaGVtZVBsdXNIb3N0ID09IG51bGwgfHwgbURhdGFiYXNlID09IG51bGwpIHsKKyAgICAgICAgaWYgKHNjaGVtZVBsdXNIb3N0ID09IG51bGwgfHwgIWNoZWNrSW5pdGlhbGl6ZWQoKSkgewogICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICB9CiAKQEAgLTg1Niw3ICs5MDEsNyBAQAogICAgICAqICAgICAgICAgU3RyaW5nWzFdIGlzIHBhc3N3b3JkLiBSZXR1cm4gbnVsbCBpZiBpdCBjYW4ndCBmaW5kIGFueXRoaW5nLgogICAgICAqLwogICAgIFN0cmluZ1tdIGdldFVzZXJuYW1lUGFzc3dvcmQoU3RyaW5nIHNjaGVtZVBsdXNIb3N0KSB7Ci0gICAgICAgIGlmIChzY2hlbWVQbHVzSG9zdCA9PSBudWxsIHx8IG1EYXRhYmFzZSA9PSBudWxsKSB7CisgICAgICAgIGlmIChzY2hlbWVQbHVzSG9zdCA9PSBudWxsIHx8ICFjaGVja0luaXRpYWxpemVkKCkpIHsKICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICB9CiAKQEAgLTkwMiw3ICs5NDcsNyBAQAogICAgICAqIENsZWFyIHBhc3N3b3JkIGRhdGFiYXNlCiAgICAgICovCiAgICAgcHVibGljIHZvaWQgY2xlYXJVc2VybmFtZVBhc3N3b3JkKCkgewotICAgICAgICBpZiAobURhdGFiYXNlID09IG51bGwpIHsKKyAgICAgICAgaWYgKCFjaGVja0luaXRpYWxpemVkKCkpIHsKICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgfQogCkBAIC05MjcsNyArOTcyLDcgQEAKICAgICAgKi8KICAgICB2b2lkIHNldEh0dHBBdXRoVXNlcm5hbWVQYXNzd29yZChTdHJpbmcgaG9zdCwgU3RyaW5nIHJlYWxtLCBTdHJpbmcgdXNlcm5hbWUsC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0gZGF0YSBpbiBIYXNoTWFwCiAgICAgICovCiAgICAgdm9pZCBzZXRGb3JtRGF0YShTdHJpbmcgdXJsLCBIYXNoTWFwPFN0cmluZywgU3RyaW5nPiBmb3JtZGF0YSkgewotICAgICAgICBpZiAodXJsID09IG51bGwgfHwgZm9ybWRhdGEgPT0gbnVsbCB8fCBtRGF0YWJhc2UgPT0gbnVsbCkgeworICAgICAgICBpZiAodXJsID09IG51bGwgfHwgZm9ybWRhdGEgPT0gbnVsbCB8fCAhY2hlY2tJbml0aWFsaXplZCgpKSB7CiAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgIH0KIApAQCAtMTA2OSw3ICsxMTE0LDcgQEAKICAgICAgKi8KICAgICBBcnJheUxpc3Q8U3RyaW5nPiBnZXRGb3JtRGF0YShTdHJpbmcgdXJsLCBTdHJpbmcgbmFtZSkgewogICAgICAgICBBcnJheUxpc3Q8U3RyaW5nPiB2YWx1ZXMgPSBuZXcgQXJyYXlMaXN0PFN0cmluZz4oKTsKLSAgICAgICAgaWYgKHVybCA9PSBudWxsIHx8IG5hbWUgPT0gbnVsbCB8fCBtRGF0YWJhc2UgPT0gbnVsbCkgeworICAgICAgICBpZiAodXJsID09IG51bGwgfHwgbmFtZSA9PSBudWxsIHx8ICFjaGVja0luaXRpYWxpemVkKCkpIHsKICAgICAgICAgICAgIHJldHVybiB2YWx1ZXM7CiAgICAgICAgIH0KIApAQCAtMTEyOSw3ICsxMTc0LDcgQEAKICAgICAgKiBDbGVhciBmb3JtIGRhdGFiYXNlCiAgICAgICovCiAgICAgcHVibGljIHZvaWQgY2xlYXJGb3JtRGF0YSgpIHsKLSAgICAgICAgaWYgKG1EYXRhYmFzZSA9PSBudWxsKSB7CisgICAgICAgIGlmICghY2hlY2tJbml0aWFsaXplZCgpKSB7CiAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgIH0KIApkaWZmIC0tZ2l0IGEvY29yZS9qYXZhL2FuZHJvaWQvd2Via2l0L1pvb21Db250cm9sQ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HRoZSBMaWNlbnNlLgorICovCitwYWNrYWdlIGFuZHJvaWQud2Via2l0OworCitpbnRlcmZhY2UgWm9vbUNvbnRyb2xCYXNlIHsKKworICAgIC8qKgorICAgICAqIENhdXNlcyB0aGUgb24tc2NyZWVuIHpvb20gY29udHJvbCB0byBiZSBtYWRlIHZpc2libGUKKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBzaG93KCk7CisKKyAgICAvKioKKyAgICAgKiBDYXVzZXMgdGhlIG9uLXNjcmVlbiB6b29tIGNvbnRyb2wgdG8gZGlzYXBwZWFyCisgICAgICovCisgICAgcHVibGljIHZvaWQgaGlkZSgpOworCisgICAgLyoqCisgICAgICogRW5hYmxlcyB0aGUgY29udHJvbCB0byB1cGRhdGUgaXRzIHN0YXRlIGlmIG5lY2Vzc2FyeSBpbiByZXNwb25zZSB0byBhCisgICAgICogY2hhbmdlIGluIHRoZSBwYWdlcyB6b29tIGxldmVsLiBGb3IgZXhhbXBsZSwgaWYgdGhlIG1heCB6b29tIGxldmVsIGlzCisgICAgICogcmVhY2hlZCB0aGVuIHRoZSBjb250cm9sIGNhbiBkaXNhYmxlIHRoZSBidXR0b24gZm9yIHpvb21pbmcgaW4uCisgICAgICovCisgICAgcHVibGljIHZvaWQgdXBkYXRlKCk7CisKKyAgICAvKioKKyAgICAgKiBDaGVja3MgdG8gc2VlIGlmIHRoZSBjb250cm9sIGlzIGN1cnJlbnRseSB2aXNpYmxlIHRvIHRoZSB1c2VyLgorICAgICAqLworICAgIHB1YmxpYyBib29sZWFuIGlzVmlzaWJsZSgpOworfQpkaWZmIC0tZ2l0IGEvY29yZS9qYXZhL2FuZHJvaWQvd2Via2l0L1pvb21Db250cm9sRW1iZWRkZWQuamF2YSBiL2NvcmUvamF2YS9hbmRyb2lkL3dlYmtpdC9ab29tQ29udHJvbEVtYmVkZGVkLmphdmEKbmV3IGZpbGUgbW9kZSAxMDA2NDQKaW5kZXggMDAwMDAwMC4uYzI5ZTcyYgotLS0gL2R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WV3R3JvdXA7CitpbXBvcnQgYW5kcm9pZC53aWRnZXQuRnJhbWVMYXlvdXQ7CitpbXBvcnQgYW5kcm9pZC53aWRnZXQuVG9hc3Q7CitpbXBvcnQgYW5kcm9pZC53aWRnZXQuWm9vbUJ1dHRvbnNDb250cm9sbGVyOworCitjbGFzcyBab29tQ29udHJvbEVtYmVkZGVkIGltcGxlbWVudHMgWm9vbUNvbnRyb2xCYXNlIHsKKworICAgIHByaXZhdGUgZmluYWwgWm9vbU1hbmFnZXIgbVpvb21NYW5hZ2VyOworICAgIHByaXZhdGUgZmluYWwgV2ViVmlldyBtV2ViVmlldzsKKworICAgIC8vIFRoZSBjb250cm9sbGVyIGlzIGxhemlseSBpbml0aWFsaXplZCBpbiBnZXRDb250cm9scygpIGZvciBwZXJmb3JtYW5jZS4KKyAgICBwcml2YXRlIFpvb21CdXR0b25zQ29udHJvbGxlciBtWm9vbUJ1dHRvbnNDb250cm9sbGVyOworCisgICAgcHVibGljIFpvb21Db250cm9sRW1iZWRkZWQoWm9vbU1hbmFnZXIgem9vbU1hbmFnZXIsIFdlYlZpZXcgd2ViVmlldykgeworICAgICAgICBtWm9vbU1hbmFnZXIgPSB6b29tTWFuYWdlcjsKKyAgICAgICAgbVdlYlZpZXcgPSB3ZWJWaWV3OworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHNob3coKSB7CisgICAgICAgIGlmICghZ2V0Q29udHJvbHMoKS5pc1Zpc2libGUoKSAmJiAhbVpvb21NYW5hZ2VyLmlzWm9vbVNjYWxlRml4ZWQoKSkgeworCisgICAgICAgICAgICBtWm9vbUJ1dHRvbnNDb250cm9sbGVyLnNldFZpc2libGUodHJ1ZSk7CisKKyAgICAgICAgICAgIFdlYlNldHRpbmdzIHNldHRpbmdzID0gbVdlYlZpZXcuZ2V0U2V0dGluZ3MoKTsKKyAgICAgICAgICAgIGludCBjb3VudCA9IHNldHRpbmdzLmdldERvdWJsZVRhcFRvYXN0Q291bnQoKTsKKyAgICAgICAgICAgIGlmIChtWm9vbU1hbmFnZXIuaXNJblpvb21PdmVydmlldygpICYmIGNvdW50ID4gMCkgeworICAgICAgICAgICAgICAgIHNldHRpbmdzLnNldERvdWJsZVRhcFRvYXN0Q291bnQoLS1jb3VudCk7CisgICAgICAgICAgICAgICAgVG9hc3QubWFrZVRleHQobVdlYlZpZXcuZ2V0Q29udGV4dCgpLAorICAgICAgICAgICAgICAgICAgICAgICAgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHJpbmcuZG91YmxlX3RhcF90b2FzdCwKKyAgICAgICAgICAgICAgICAgICAgICAgIFRvYXN0LkxFTkdUSF9MT05HKS5zaG93KCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBoaWRlKCkgeworICAgICAgICBpZiAobVpvb21CdXR0b25zQ29udHJvbGxlciAhPSBudWxsKSB7CisgICAgICAgICAgICBtWm9vbUJ1dHRvbnNDb250cm9sbGVyLnNldFZpc2libGUoZmFsc2UpOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIGJvb2xlYW4gaXNWaXNpYmxlKCkgeworICAgICAgICByZXR1cm4gbVpvb21CdXR0b25zQ29udHJvbGxlciAhPSBudWxsICYmIG1ab29tQnV0dG9uc0NvbnRyb2xsZXIuaXNWaXNpYmxlKCk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgdXBkYXRlKCkgeworICAgICAgICBpZiAobVpvb21CdXR0b25zQ29udHJvbGxlciA9PSBudWxsKSB7CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKworICAgICAgICBib29sZWFuIGNhblpvb21JbiA9IG1ab29tTWFuYWdlci5jYW5ab29tSW4oKTsKKyAgICAgICAgYm9vbGVhbiBjYW5ab29tT3V0ID0gbVpvb21NYW5hZ2VyLmNhblpvb21PdXQoKSAmJiAhbVpvb21NYW5hZ2VyLmlzSW5ab29tT3ZlcnZpZXcoKTsKKyAgICAgICAgaWYgKCFjYW5ab29tSW4gJiYgIWNhblpvb21PdXQpIHsKKyAgICAgICAgICAgIC8vIEhpZGUgdGhlIHpvb20gaW4gYW5kIG91dCBidXR0b25zIGlmIHRoZSBwYWdlIGNhbm5vdCB6b29tCisgICAgICAgICAgICBtWm9vbUJ1dHRvbnNDb250cm9sbGVyLmdldFpvb21Db250cm9scygpLnNldFZpc2liaWxpdHkoVmlldy5HT05FKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIC8vIFNldCBlYWNoIG9uZSBpbmRpdmlkdWFsbHksIGFzIGEgcGFnZSBtYXkgYmUgYWJsZSB0byB6b29tIGluIG9yIG91dAorICAgICAgICAgICAgbVpvb21CdXR0b25zQ29udHJvbGxlci5zZXRab29tSW5FbmFibGVkKGNhblpvb21Jbik7CisgICAgICAgICAgICBtWm9vbUJ1dHRvbnNDb250cm9sbGVyLnNldFpvb21PdXRFbmFibGVkKGNhblpvb21PdXQpOworICAgICAgICB9CisgICAgfQorCisgICAgcHJpdmF0ZSBab29tQnV0dG9uc0NvbnRyb2xsZXIgZ2V0Q29udHJvbHMoKSB7CisgICAgICAgIGlmIChtWm9vbUJ1dHRvbnNDb250cm9sbGVyID09IG51bGwpIHsKKyAgICAgICAgICAgIG1ab29tQnV0dG9uc0NvbnRyb2xsZXIgPSBuZXcgWm9vbUJ1dHRvbnNDb250cm9sbGVyKG1XZWJWaWV3KTsKKyAgICAgICAgICAgIG1ab29tQnV0dG9uc0NvbnRyb2xsZXIuc2V0T25ab29tTGlzdGVuZXIobmV3IFpvb21MaXN0ZW5lcigpKTsKKyAgICAgICAgICAgIC8vIFpvb21CdXR0b25zQ29udHJvbGxlciBwb3NpdGlvbnMgdGhlIGJ1dHRvbnMgYXQgdGhlIGJvdHRvbSwgYnV0IGluCisgICAgICAgICAgICAvLyB0aGUgbWlkZGxlLiBDaGFuZ2UgdGhlaXIgbGF5b3V0IHBhcmFtZXRlcnMgc28gdGhleSBhcHBlYXIgb24gdGhlCisgICAgICAgICAgICAvLyByaWdodC4KKyAgICAgICAgICAgIFZpZXcgY29udHJvbHMgPSBtWm9vbUJ1dHRvbnNDb250cm9sbGVyLmdldFpvb21Db250cm9scygpOworICAgICAgICAgICAgVmlld0dyb3VwLkxheW91dFBhcmFtcyBwYXJhbXMgPSBjb250cm9scy5nZXRMYXlvdXRQYXJhbXMoKTsKKyAgICAgICAgICAgIGlmIChwYXJhbXMgaW5zdGFuY2VvZiBGcmFtZUxheW91dC5MYXlvdXRQYXJhbXMpIHsKKyAgICAgICAgICAgICAgICAoKEZyYW1lTGF5b3V0LkxheW91dFBhcmFtcykgcGFyYW1zKS5ncmF2aXR5ID0gR3Jhdml0eS5SSUdIVDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICByZXR1cm4gbVpvb21CdXR0b25zQ29udHJvbGxlcjsKKyAgICB9CisKKyAgICBwcml2YXRlIGNsYXNzIFpvb21MaXN0ZW5lciBpbXBsZW1lbnRzIFpvb21CdXR0b25zQ29udHJvbGxlci5Pblpvb21MaXN0ZW5lciB7CisKKyAgICAgICAgcHVibGljIHZvaWQgb25WaXNpYmlsaXR5Q2hhbmdlZChib29sZWFuIHZpc2libGUpIHsKKyAgICAgICAgICAgIGlmICh2aXNpYmxlKSB7CisgICAgICAgICAgICAgICAgbVdlYlZpZXcuc3dpdGNoT3V0RHJhd0hpc3RvcnkoKTsKKyAgICAgICAgICAgICAgICAvLyBCcmluZyBiYWNrIHRoZSBoaWRkZW4gem9vbSBjb250cm9scy4KKyAgICAgICAgICAgICAgICBtWm9vbUJ1dHRvbnNDb250cm9sbGVyLmdldFpvb21Db250cm9scygpLnNldFZpc2liaWxpdHkoVmlldy5WSVNJQkxFKTsKKyAgICAgICAgICAgICAgICB1cGRhdGUoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyB2b2lkIG9uWm9vbShib29sZWFuIHpvb21JbikgeworICAgICAgICAgICAgaWYgKHpvb21JbikgeworICAgICAgICAg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ybmFsIHpvb20gY29udHJvbHMKKyAgICBwcml2YXRlIEV4dGVuZGVkWm9vbUNvbnRyb2xzIG1ab29tQ29udHJvbHM7CisgICAgcHJpdmF0ZSBSdW5uYWJsZSBtWm9vbUNvbnRyb2xSdW5uYWJsZTsKKyAgICBwcml2YXRlIGZpbmFsIEhhbmRsZXIgbVByaXZhdGVIYW5kbGVyID0gbmV3IEhhbmRsZXIoKTsKKworICAgIHByaXZhdGUgZmluYWwgV2ViVmlldyBtV2ViVmlldzsKKworICAgIHB1YmxpYyBab29tQ29udHJvbEV4dGVybmFsKFdlYlZpZXcgd2ViVmlldykgeworICAgICAgICBtV2ViVmlldyA9IHdlYlZpZXc7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgc2hvdygpIHsKKyAgICAgICAgaWYobVpvb21Db250cm9sUnVubmFibGUgIT0gbnVsbCkgeworICAgICAgICAgICAgbVByaXZhdGVIYW5kbGVyLnJlbW92ZUNhbGxiYWNrcyhtWm9vbUNvbnRyb2xSdW5uYWJsZSk7CisgICAgICAgIH0KKyAgICAgICAgZ2V0Q29udHJvbHMoKS5zaG93KHRydWUpOworICAgICAgICBtUHJpdmF0ZUhhbmRsZXIucG9zdERlbGF5ZWQobVpvb21Db250cm9sUnVubmFibGUsIFpPT01fQ09OVFJPTFNfVElNRU9VVCk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgaGlkZSgpIHsKKyAgICAgICAgaWYgKG1ab29tQ29udHJvbFJ1bm5hYmxlICE9IG51bGwpIHsKKyAgICAgICAgICAgIG1Qcml2YXRlSGFuZGxlci5yZW1vdmVDYWxsYmFja3MobVpvb21Db250cm9sUnVubmFibGUpOworICAgICAgICB9CisgICAgICAgIGlmIChtWm9vbUNvbnRyb2xzICE9IG51bGwpIHsKKyAgICAgICAgICAgIG1ab29tQ29udHJvbHMuaGlkZSgpOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIGJvb2xlYW4gaXNWaXNpYmxlKCkgeworICAgICAgICByZXR1cm4gbVpvb21Db250cm9scyAhPSBudWxsICYmIG1ab29tQ29udHJvbHMuaXNTaG93bigpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHVwZGF0ZSgpIHsgfQorCisgICAgcHVibGljIEV4dGVuZGVkWm9vbUNvbnRyb2xzIGdldENvbnRyb2xzKCkgeworICAgICAgICBpZiAobVpvb21Db250cm9scyA9PSBudWxsKSB7CisgICAgICAgICAgICBtWm9vbUNvbnRyb2xzID0gY3JlYXRlWm9vbUNvbnRyb2xzKCk7CisKKyAgICAgICAgICAgIC8qCisgICAgICAgICAgICAgKiBuZWVkIHRvIGJlIHNldCB0byBWSVNJQkxFIGZpcnN0IHNvIHRoYXQgZ2V0TWVhc3VyZWRIZWlnaHQoKSBpbgorICAgICAgICAgICAgICoge0BsaW5rICNvblNpemVDaGFuZ2VkKCl9IGNhbiByZXR1cm4gdGhlIG1lYXN1cmVkIHZhbHVlIGZvciBwcm9wZXIKKyAgICAgICAgICAgICAqIGxheW91dC4KKyAgICAgICAgICAgICAqLworICAgICAgICAgICAgbVpvb21Db250cm9scy5zZXRWaXNpYmlsaXR5KFZpZXcuVklTSUJMRSk7CisgICAgICAgICAgICBtWm9vbUNvbnRyb2xSdW5uYWJsZSA9IG5ldyBSdW5uYWJsZSgpIHsKKyAgICAgICAgICAgICAgICBwdWJsaWMgdm9pZCBydW4oKSB7CisgICAgICAgICAgICAgICAgICAgIC8qIERvbid0IGRpc21pc3MgdGhlIGNvbnRyb2xzIGlmIHRoZSB1c2VyIGhhcworICAgICAgICAgICAgICAgICAgICAgKiBmb2N1cyBvbiB0aGVtLiBXYWl0IGFuZCBjaGVjayBhZ2FpbiBsYXRlci4KKyAgICAgICAgICAgICAgICAgICAgICovCisgICAgICAgICAgICAgICAgICAgIGlmICghbVpvb21Db250cm9scy5oYXNGb2N1cygpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBtWm9vbUNvbnRyb2xzLmhpZGUoKTsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1Qcml2YXRlSGFuZGxlci5yZW1vdmVDYWxsYmFja3MobVpvb21Db250cm9sUnVubmFibGUpOworICAgICAgICAgICAgICAgICAgICAgICAgbVByaXZhdGVIYW5kbGVyLnBvc3REZWxheWVkKG1ab29tQ29udHJvbFJ1bm5hYmxlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBaT09NX0NPTlRST0xTX1RJTUVPVVQpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gbVpvb21Db250cm9sczsKKyAgICB9CisKKyAgICBwcml2YXRlIEV4dGVuZGVkWm9vbUNvbnRyb2xzIGNyZWF0ZVpvb21Db250cm9scygpIHsKKyAgICAgICAgRXh0ZW5kZWRab29tQ29udHJvbHMgem9vbUNvbnRyb2xzID0gbmV3IEV4dGVuZGVkWm9vbUNvbnRyb2xzKG1XZWJWaWV3LmdldENvbnRleHQoKSk7CisgICAgICAgIHpvb21Db250cm9scy5zZXRPblpvb21JbkNsaWNrTGlzdGVuZXIobmV3IE9uQ2xpY2tMaXN0ZW5lcigpIHsKKyAgICAgICAgICAgIHB1YmxpYyB2b2lkIG9uQ2xpY2soVmlldyB2KSB7CisgICAgICAgICAgICAgICAgLy8gcmVzZXQgdGltZSBvdXQKKyAgICAgICAgICAgICAgICBtUHJpdmF0ZUhhbmRsZXIucmVtb3ZlQ2FsbGJhY2tzKG1ab29tQ29udHJvbFJ1bm5hYmxlKTsKKyAgICAgICAgICAgICAgICBtUHJpdmF0ZUhhbmRsZXIucG9zdERlbGF5ZWQobVpvb21Db250cm9sUnVubmFibGUsIFpPT01fQ09OVFJPTFNfVElNRU9VVCk7CisgICAgICAgICAgICAgICAgbVdlYlZpZXcuem9vbUluKCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0pOworICAgICAgICB6b29tQ29udHJvbHMuc2V0T25ab29tT3V0Q2xpY2tMaXN0ZW5lcihuZXcgT25DbGlja0xpc3RlbmVyKCkgeworICAgICAgICAgICAgcHVibGljIHZvaWQgb25DbGljayhWaWV3IHYpIHsKKyAgICAgICAgICAgICAgICAvLyByZXNldCB0aW1lIG91dAorICAgICAgICAgICAgICAgIG1Qcml2YXRlSGFuZGxlci5yZW1vdmVDYWxsYmFja3MobVpvb21Db250cm9sUnVubmFibGUpOworICAgICAgICAgICAgICAgIG1Qcml2YXRlSGFuZGxlci5wb3N0RGVsYXllZChtWm9vbUNvbnRyb2xSdW5uYWJsZSwgWk9PTV9DT05UUk9MU19USU1FT1VUKTsKKyAgICAgICAgICAgICAgICBtV2ViVmlldy56b29tT3V0KCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0pOworICAgICAgICByZXR1cm4gem9vbUNvbnRyb2xzOworICAgIH0KKworICAgIHByaXZhdGUgc3RhdGljIGNsYXNzIEV4dGVuZGVkWm9vbUNvbnRyb2xzIGV4dGVuZHMgRnJhbWVMYXlvdXQgeworCisgICAgICAgIHByaXZhdGUgYW5kcm9pZC53aWRnZXQuWm9vbUNvbnRyb2xzIG1QbHVzTWludXNab29tQ29udHJvbHM7CisKKyAgICAgICAgcHVibGljIEV4dGVuZGVkWm9vbUNvbnRyb2xzKENvbnRleHQgY29udGV4dCkgeworICAgICAgICAgICAgc3VwZXIoY29udGV4dCwgbnVsbCk7CisgICAgICAgICAgICBMYXlvdXRJbmZsYXRlciBpbmZsYXRlciA9IChMYXlvdXRJbmZsYXRlcikKKyAgICAgICAgICAgICAgICAgICAgY29udGV4dC5nZXRTeXN0ZW1TZXJ2aWNlKENvbnRleHQuTEFZT1VUX0lORkxBVEVSX1NFUlZJQ0UpOworICAgICAgICAgICAgaW5mbGF0ZXIuaW5mbGF0ZShjb20uYW5kcm9pZC5pbnRlcm5hbC5SLmxheW91dC56b29tX21hZ25pZnksIHRoaXMsIHRydWUpOworICAgICAgICAgICAgbVBsdXNNaW51c1pvb21Db250cm9scyA9IChhbmRyb2lkLndpZGdldC5ab29tQ29udHJvbHMpIGZpbmRWaWV3QnlJZCgKKyAgICAgICAgICAgICAgICAgICAgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5pZC56b29tQ29udHJvbHMpOworICAgICAgICAgICAgZmluZFZpZXdCeUlkKGNvbS5hbmRyb2lkLmludGVybmFsLlIuaWQuem9vbU1hZ25pZnkpLnNldFZpc2liaWxpdHkoCisgICAgICAgICAgICAgICAgICAgIFZpZXcuR09ORSk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCBzaG93KGJvb2xlYW4gc2hvd1pvb20pIHsKKyAgICAgICAgICAgIG1QbHVzTWludXNab29tQ29udHJvbHMuc2V0VmlzaWJpbGl0eShzaG93Wm9vbSA/IFZpZXcuVklTSUJMRSA6IFZpZXcuR09ORSk7CisgICAgICAgICAgICBmYWRlKFZpZXcuVklTSUJMRSwgMC4wZiwgMS4wZik7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCBoaWRlKCkgeworICAgICAgICAgICAgZmFkZShWaWV3LkdPTkUsIDEuMGYsIDAuMGYpOworICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSB2b2lkIGZhZGUoaW50IHZpc2liaWxpdHksIGZsb2F0IHN0YXJ0QWxwaGEsIGZsb2F0IGVuZEFscGhhKSB7CisgICAgICAgICAgICBBbHBoYUFuaW1hdGlvbiBhbmltID0gbmV3IEFscGhhQW5pbWF0aW9uKHN0YXJ0QWxwaGEsIGVuZEFscGhhKTsKKyAgICAgICAgICAgIGFuaW0uc2V0RHVyYXRpb24oNTAwKTsKKyAgICAgICAgICAgIHN0YXJ0QW5pbWF0aW9uKGFuaW0pOworICAgICAgICAgICAgc2V0VmlzaWJpbGl0eSh2aXNpYmlsaXR5KTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBib29sZWFuIGhhc0ZvY3VzKCkgeworICAgICAgICAgICAgcmV0dXJuIG1QbHVzTWludXNab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2F0IGdldEludkRlZmF1bHRTY2FsZSgpIHsKKyAgICAgICAgcmV0dXJuIG1JbnZEZWZhdWx0U2NhbGU7CisgICAgfQorCisgICAgcHVibGljIGZpbmFsIGZsb2F0IGdldERlZmF1bHRNYXhab29tU2NhbGUoKSB7CisgICAgICAgIHJldHVybiBtRGVmYXVsdE1heFpvb21TY2FsZTsKKyAgICB9CisKKyAgICBwdWJsaWMgZmluYWwgZmxvYXQgZ2V0RGVmYXVsdE1pblpvb21TY2FsZSgpIHsKKyAgICAgICAgcmV0dXJuIG1EZWZhdWx0TWluWm9vbVNjYWxlOworICAgIH0KKworICAgIHB1YmxpYyBmaW5hbCBpbnQgZ2V0RG9jdW1lbnRBbmNob3JYKCkgeworICAgICAgICByZXR1cm4gbUFuY2hvclg7CisgICAgfQorCisgICAgcHVibGljIGZpbmFsIGludCBnZXREb2N1bWVudEFuY2hvclkoKSB7CisgICAgICAgIHJldHVybiBtQW5jaG9yWTsKKyAgICB9CisKKyAgICBwdWJsaWMgZmluYWwgdm9pZCBjbGVhckRvY3VtZW50QW5jaG9yKCkgeworICAgICAgICBtQW5jaG9yWCA9IG1BbmNob3JZID0gMDsKKyAgICB9CisKKyAgICBwdWJsaWMgZmluYWwgdm9pZCBzZXRab29tQ2VudGVyKGZsb2F0IHgsIGZsb2F0IHkpIHsKKyAgICAgICAgbVpvb21DZW50ZXJYID0geDsKKyAgICAgICAgbVpvb21DZW50ZXJZID0geTsKKyAgICB9CisKKyAgICBwdWJsaWMgZmluYWwgdm9pZCBzZXRJbml0aWFsU2NhbGVJblBlcmNlbnQoaW50IHNjYWxlSW5QZXJjZW50KSB7CisgICAgICAgIG1Jbml0aWFsU2NhbGUgPSBzY2FsZUluUGVyY2VudCAqIDAuMDFmOworICAgIH0KKworICAgIHB1YmxpYyBmaW5hbCBmbG9hdCBjb21wdXRlU2NhbGVXaXRoTGltaXRzKGZsb2F0IHNjYWxlKSB7CisgICAgICAgIGlmIChzY2FsZSA8IG1NaW5ab29tU2NhbGUpIHsKKyAgICAgICAgICAgIHNjYWxlID0gbU1pblpvb21TY2FsZTsKKyAgICAgICAgfSBlbHNlIGlmIChzY2FsZSA+IG1NYXhab29tU2NhbGUpIHsKKyAgICAgICAgICAgIHNjYWxlID0gbU1heFpvb21TY2FsZTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gc2NhbGU7CisgICAgfQorCisgICAgcHVibGljIGZpbmFsIGJvb2xlYW4gaXNab29tU2NhbGVGaXhlZCgpIHsKKyAgICAgICAgcmV0dXJuIG1NaW5ab29tU2NhbGUgPj0gbU1heFpvb21TY2FsZTsKKyAgICB9CisKKyAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGJvb2xlYW4gZXhjZWVkc01pblNjYWxlSW5jcmVtZW50KGZsb2F0IHNjYWxlQSwgZmxvYXQgc2NhbGVCKSB7CisgICAgICAgIHJldHVybiBNYXRoLmFicyhzY2FsZUEgLSBzY2FsZUIpID49IE1JTklNVU1fU0NBTEVfSU5DUkVNRU5UOworICAgIH0KKworICAgIHB1YmxpYyBib29sZWFuIHdpbGxTY2FsZVRyaWdnZXJab29tKGZsb2F0IHNjYWxlKSB7CisgICAgICAgIHJldHVybiBleGNlZWRzTWluU2NhbGVJbmNyZW1lbnQoc2NhbGUsIG1BY3R1YWxTY2FsZSk7CisgICAgfQorCisgICAgcHVibGljIGZpbmFsIGJvb2xlYW4gY2FuWm9vbUluKCkgeworICAgICAgICByZXR1cm4gbU1heFpvb21TY2FsZSAtIG1BY3R1YWxTY2FsZSA+IE1JTklNVU1fU0NBTEVfSU5DUkVNRU5UOworICAgIH0KKworICAgIHB1YmxpYyBmaW5hbCBib29sZWFuIGNhblpvb21PdXQoKSB7CisgICAgICAgIHJldHVybiBtQWN0dWFsU2NhbGUgLSBtTWluWm9vbVNjYWxlID4gTUlOSU1VTV9TQ0FMRV9JTkNSRU1FTlQ7CisgICAgfQorCisgICAgcHVibGljIGJvb2xlYW4gem9vbUluKCkgeworICAgICAgICByZXR1cm4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AgICAgKiBpbiBwcm9ncmVzcyBieSBjYWxsaW5nIGlzRml4ZWRMZW5ndGhBbmltYXRpb25JblByb2dyZXNzKCkuCisgICAgICovCisgICAgcHVibGljIHZvaWQgYW5pbWF0ZVpvb20oQ2FudmFzIGNhbnZhcykgeworICAgICAgICBpZiAobVpvb21TY2FsZSA9PSAwKSB7CisgICAgICAgICAgICBMb2cudyhMT0dUQUcsICJBIFdlYlZpZXcgaXMgYXR0ZW1wdGluZyB0byBwZXJmb3JtIGEgZml4ZWQgbGVuZ3RoICIKKyAgICAgICAgICAgICAgICAgICAgKyAiem9vbSBhbmltYXRpb24gd2hlbiBubyB6b29tIGlzIGluIHByb2dyZXNzIik7CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKworICAgICAgICBmbG9hdCB6b29tU2NhbGU7CisgICAgICAgIGludCBpbnRlcnZhbCA9IChpbnQpIChTeXN0ZW1DbG9jay51cHRpbWVNaWxsaXMoKSAtIG1ab29tU3RhcnQpOworICAgICAgICBpZiAoaW50ZXJ2YWwgPCBaT09NX0FOSU1BVElPTl9MRU5HVEgpIHsKKyAgICAgICAgICAgIGZsb2F0IHJhdGlvID0gKGZsb2F0KSBpbnRlcnZhbCAvIFpPT01fQU5JTUFUSU9OX0xFTkdUSDsKKyAgICAgICAgICAgIHpvb21TY2FsZSA9IDEuMGYgLyAobUludkluaXRpYWxab29tU2NhbGUKKyAgICAgICAgICAgICAgICAgICAgKyAobUludkZpbmFsWm9vbVNjYWxlIC0gbUludkluaXRpYWxab29tU2NhbGUpICogcmF0aW8pOworICAgICAgICAgICAgbVdlYlZpZXcuaW52YWxpZGF0ZSgpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgem9vbVNjYWxlID0gbVpvb21TY2FsZTsKKyAgICAgICAgICAgIC8vIHNldCBtWm9vbVNjYWxlIHRvIGJlIDAgYXMgd2UgaGF2ZSBmaW5pc2hlZCBhbmltYXRpbmcKKyAgICAgICAgICAgIG1ab29tU2NhbGUg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gbVdlYlZpZXcuZ2V0Vmlld0hlaWdodCgpLCBNYXRoLnJvdW5kKG1XZWJWaWV3LmdldENvbnRlbnRIZWlnaHQoKQorICAgICAgICAgICAgICAgICogem9vbVNjYWxlKSkgKyB0aXRsZUhlaWdodCkgKyBtV2ViVmlldy5nZXRTY3JvbGxZKCk7CisKKyAgICAgICAgY2FudmFzLnRyYW5zbGF0ZSh0eCwgdHkpOworICAgICAgICBjYW52YXMuc2NhbGUoem9vbVNjYWxlLCB6b29tU2NhbGUpOworICAgIH0KKworICAgIHB1YmxpYyBib29sZWFuIGlzWm9vbUFuaW1hdGluZygpIHsKKyAgICAgICAgcmV0dXJuIGlzRml4ZWRMZW5ndGhBbmltYXRpb25JblByb2dyZXNzKCkgfHwgbVBpbmNoVG9ab29tQW5pbWF0aW5nOworICAgIH0KKworICAgIHB1YmxpYyBib29sZWFuIGlzRml4ZWRMZW5ndGhBbmltYXRpb25JblByb2dyZXNzKCkgeworICAgICAgICByZXR1cm4gbVpvb21TY2FsZSAhPSAwOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHJlZnJlc2hab29tU2NhbGUoYm9vbGVhbiByZWZsb3dUZXh0KSB7CisgICAgICAgIHNldFpvb21TY2FsZShtQWN0dWFsU2NhbGUsIHJlZmxvd1RleHQsIHRydWUpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHNldFpvb21TY2FsZShmbG9hdCBzY2FsZSwgYm9vbGVhbiByZWZsb3dUZXh0KSB7CisgICAgICAgIHNldFpvb21TY2FsZShzY2FsZSwgcmVmbG93VGV4dCwgZmFsc2UpOworICAgIH0KKworICAgIHByaXZhdGUgdm9pZCBzZXRab29tU2NhbGUoZmxvYXQgc2NhbGUsIGJvb2xlYW4gcmVmbG93VGV4dCwgYm9vbGVhbiBmb3JjZSkgeworICAgICAgICBmaW5hbCBib29sZWFuIGlzU2NhbGVMZXNzVGhhbk1pblpvb20gPSBzY2FsZSA8IG1NaW5ab29tU2NhbGU7CisgICAgICAgIHNjYWxlID0gY29tcHV0ZVNjYWxlV2l0aExpbWl0cyhzY2FsZSk7CisKKyAgICAgICAgLy8gZGV0ZXJtaW5lIHdoZXRoZXIgb3Igbm90IHdlIGFyZSBpbiB0aGUgem9vbSBvdmVydmlldyBtb2RlCisgICAgICAgIGlmIChpc1NjYWxlTGVzc1RoYW5NaW5ab29tICYmIG1NaW5ab29tU2NhbGUgPCBtRGVmYXVsdFNjYWxlKSB7CisgICAgICAgICAgICBtSW5ab29tT3ZlcnZpZXcgPSB0cnVlOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgbUluWm9vbU92ZXJ2aWV3ID0gIWV4Y2VlZHNNaW5TY2FsZUluY3JlbWVudChzY2FsZSwgZ2V0Wm9vbU92ZXJ2aWV3U2NhbGUoKSk7CisgICAgICAgIH0KKworICAgICAgICBpZiAocmVmbG93VGV4dCkgeworICAgICAgICAgICAgbVRleHRXcmFwU2NhbGUgPSBzY2FsZTsKKyAgICAgICAgfQorCisgICAgICAgIGlmIChzY2FsZSAhPSBtQWN0dWFsU2NhbGUgfHwgZm9yY2UpIHsKKyAgICAgICAgICAgIGZsb2F0IG9sZFNjYWxlID0gbUFjdHVhbFNjYWxlOworICAgICAgICAgICAgZmxvYXQgb2xkSW52U2NhbGUgPSBtSW52QWN0dWFsU2NhbGU7CisKKyAgICAgICAgICAgIGlmIChzY2FsZSAhPSBtQWN0dWFsU2NhbGUgJiYgIW1QaW5jaFRvWm9vbUFuaW1hdGluZykgeworICAgICAgICAgICAgICAgIG1DYWxsYmFja1Byb3h5Lm9uU2NhbGVDaGFuZ2VkKG1BY3R1YWxTY2FsZSwgc2NhbGUpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBtQWN0dWFsU2NhbGUgPSBzY2FsZTsKKyAgICAgICAgICAgIG1JbnZBY3R1YWxTY2FsZSA9IDEgLyBzY2FsZTsKKworICAgICAgICAgICAgaWYgKCFtV2ViVmlldy5kcmF3SGlzdG9yeSgpKSB7CisKKyAgICAgICAgICAgICAgICAvLyBJZiBoaXN0b3J5IFBpY3R1cmUgaXMgZHJhd24sIGRvbid0IHVwZGF0ZSBzY3JvbGwuIFRoZXkgd2lsbAorICAgICAgICAgICAgICAgIC8vIGJlIHVwZGF0ZWQgd2hlbiB3ZSBnZXQgb3V0IG9mIHRoYXQgbW9kZS4KKyAgICAgICAgICAgICAgICAvLyB1cGRhdGUgb3VyIHNjcm9sbCBzbyB3ZSBkb24ndCBhcHBlYXIgdG8ganVtcAorICAgICAgICAgICAgICAgIC8vIGkuZS4ga2VlcCB0aGUgY2VudGVyIG9mIHRoZSBkb2MgaW4gdGhlIGNlbnRlciBvZiB0aGUgdmlldworICAgICAgICAgICAgICAgIGludCBvbGRYID0gbVdlYlZpZXcuZ2V0U2Nyb2xsWCgpOworICAgICAgICAgICAgICAgIGludCBvbGRZID0gbVdlYlZpZXcuZ2V0U2Nyb2xsWSgpOworICAgICAgICAgICAgICAgIGZsb2F0IHJhdGlvID0gc2NhbGUgKiBvbGRJbnZTY2FsZTsKKyAgICAgICAgICAgICAgICBmbG9hdCBzeCA9IHJhdGlvICogb2xkWCArIChyYXRpbyAtIDEpICogbVpvb21DZW50ZXJYOworICAgICAgICAgICAgICAgIGZsb2F0IHN5ID0gcmF0aW8gKiBvbGRZICsgKHJhdGlvIC0gMSkKKyAgICAgICAgICAgICAgICAgICAgICAgICogKG1ab29tQ2VudGVyWSAtIG1XZWJWaWV3LmdldFRpdGxlSGVpZ2h0KCkpOworCisgICAgICAgICAgICAgICAgLy8gU2NhbGUgYWxsIHRoZSBjaGlsZCB2aWV3cworICAgICAgICAgICAgICAgIG1XZWJWaWV3Lm1WaWV3TWFuYWdlci5zY2FsZUFsbCgpOworCisgICAgICAgICAgICAgICAgLy8gYXMgd2UgZG9uJ3QgaGF2ZSBhbmltYXRpb24gZm9yIHNjYWxpbmcsIGRvbid0IGRvIGFuaW1hdGlvbgorICAgICAgICAgICAgICAgIC8vIGZvciBzY3JvbGxpbmcsIGFzIGl0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ICAgem9vbVRvT3ZlcnZpZXcoKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgbVdlYlZpZXcuY2VudGVyRml0UmVjdChwbHVnaW4ueCwgcGx1Z2luLnksIHBsdWdpbi53aWR0aCwgcGx1Z2luLmhlaWdodCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKworICAgICAgICBpZiAoc2V0dGluZ3MuZ2V0TGF5b3V0QWxnb3JpdGhtKCkgPT0gV2ViU2V0dGluZ3MuTGF5b3V0QWxnb3JpdGhtLk5BUlJPV19DT0xVTU5TCisgICAgICAgICAgICAgICAgJiYgd2lsbFNjYWxlVHJpZ2dlclpvb20obVRleHRXcmFwU2NhbGUpCisgICAgICAgICAgICAgICAgLy8gRm9yIHRhYmxldCwgbm90IG11Y2ggbmVlZCB0byByZWZsb3cgdGV4dCB3L28gZG91YmxlIHRhcHBpbmcuCisgICAgICAgICAgICAgICAgJiYgIXNldHRpbmdzLmdldFVzZUZpeGVkVmlld3BvcnQoKSkgeworICAgICAgICAgICAgcmVmcmVzaFpvb21TY2FsZSh0cnVlKTsKKyAgICAgICAgfSBlbHNlIGlmICghbUluWm9vbU92ZXJ2aWV3KSB7CisgICAgICAgICAgICB6b29tVG9PdmVydmlldygpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgem9vbVRvUmVhZGluZ0xldmVsKCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcml2YXRlIHZvaWQgc2V0Wm9vbU92ZXJ2aWV3V2lkdGgoaW50IHdpZHRoKSB7CisgICAgICAgIG1ab29tT3ZlcnZpZXdXaWR0aCA9IHdpZHRoOworICAgICAgICBtSW52Wm9vbU92ZXJ2aWV3V2lkdGggPSAxLjBmIC8gd2lkdGg7CisgICAgfQorCisgICAgcHJpdmF0ZSBmbG9hdCBnZXRab29tT3ZlcnZpZXdTY2FsZSgpIHsKKyAgICAgICAgcmV0dXJuIG1XZWJWaWV3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ICAgICAgICAgICBpbnQgdmlld0xlZnQgPSBtV2ViVmlldy5jb250ZW50VG9WaWV3WChsZWZ0IDwgNSA/IDAgOiAobGVmdCAtIDUpKQorICAgICAgICAgICAgICAgICAgICAtIG1XZWJWaWV3LmdldFNjcm9sbFgoKTsKKyAgICAgICAgICAgIC8vIFJlLWNhbGN1bGF0ZSB0aGUgem9vbSBjZW50ZXIgc28gdGhhdCB0aGUgbmV3IHNjcm9sbCB4IHdpbGwgYmUKKyAgICAgICAgICAgIC8vIG9uIHRoZSBsZWZ0IGVkZ2UuCisgICAgICAgICAgICBpZiAodmlld0xlZnQgPiAwKSB7CisgICAgICAgICAgICAgICAgbVpvb21DZW50ZXJYID0gdmlld0xlZnQgKiByZWFkaW5nU2NhbGUgLyAocmVhZGluZ1NjYWxlIC0gbUFjdHVhbFNjYWxlKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgbVdlYlZpZXcuc2Nyb2xsQnkodmlld0xlZnQsIDApOworICAgICAgICAgICAgICAgIG1ab29tQ2VudGVyWCA9IDA7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgc3RhcnRab29tQW5pbWF0aW9uKHJlYWRpbmdTY2FsZSwgdHJ1ZSk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgdXBkYXRlTXVsdGlUb3VjaFN1cHBvcnQoQ29udGV4dCBjb250ZXh0KSB7CisgICAgICAgIC8vIGNoZWNrIHRoZSBwcmVjb25kaXRpb25zCisgICAgICAgIGFzc2VydCBtV2ViVmlldy5nZXRTZXR0aW5ncygpICE9IG51bGw7CisKKyAgICAgICAgV2ViU2V0dGluZ3Mgc2V0dGluZ3MgPSBtV2ViVmlldy5nZXRTZXR0aW5ncygpOworICAgICAgICBtU3VwcG9ydE11bHRpVG91Y2ggPSBjb250ZXh0LmdldFBhY2thZ2VNYW5hZ2VyKCkuaGFzU3lzdGVtRmVhdHVyZSgKKyAgICAgICAgICAgICAgICBQYWNrYWdl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0ZWN0b3IgZGV0ZWN0b3IpIHsKKyAgICAgICAgICAgIGZsb2F0IHNjYWxlID0gTWF0aC5yb3VuZChkZXRlY3Rvci5nZXRTY2FsZUZhY3RvcigpICogbUFjdHVhbFNjYWxlICogMTAwKSAqIDAuMDFmOworICAgICAgICAgICAgaWYgKHdpbGxTY2FsZVRyaWdnZXJab29tKHNjYWxlKSkgeworICAgICAgICAgICAgICAgIG1QaW5jaFRvWm9vbUFuaW1hdGluZyA9IHRydWU7CisgICAgICAgICAgICAgICAgLy8gbGltaXQgdGhlIHNjYWxlIGNoYW5nZSBwZXIgc3RlcAorICAgICAgICAgICAgICAgIGlmIChzY2FsZSA+IG1BY3R1YWxTY2FsZSkgeworICAgICAgICAgICAgICAgICAgICBzY2FsZSA9IE1hdGgubWluKHNjYWxlLCBtQWN0dWFsU2NhbGUgKiAxLjI1Zik7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgc2NhbGUgPSBNYXRoLm1heChzY2FsZSwgbUFjdHVhbFNjYWxlICogMC44Zik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHNldFpvb21DZW50ZXIoZGV0ZWN0b3IuZ2V0Rm9jdXNYKCksIGRldGVjdG9yLmdldEZvY3VzWSgpKTsKKyAgICAgICAgICAgICAgICBzZXRab29tU2NhbGUoc2NhbGUsIGZhbHNlKTsKKyAgICAgICAgICAgICAgICBtV2ViVmlldy5pbnZhbGlkYXRlKCk7CisgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCBvblNjYWxlRW5kKFNjYWxlR2VzdHVyZURldGVjdG9yIGRldGVjdG9yKSB7CisgICAgICAgICAgICBpZiAobVBpbmNoVG9ab29tQW5pbWF0aW5nKSB7CisgICAgICAgICAgICAgICAgbVBpbmNoVG9ab29tQW5pbWF0aW5nID0gZmFsc2U7CisgICAgICAgICAgICAgICAgbUFuY2hvclggPSBtV2ViVmlldy52aWV3VG9Db250ZW50WCgoaW50KSBtWm9vbUNlbnRlclggKyBtV2ViVmlldy5nZXRTY3JvbGxYKCkpOworICAgICAgICAgICAgICAgIG1BbmNob3JZID0gbVdlYlZpZXcudmlld1RvQ29udGVudFkoKGludCkgbVpvb21DZW50ZXJZICsgbVdlYlZpZXcuZ2V0U2Nyb2xsWSgpKTsKKyAgICAgICAgICAgICAgICAvLyBkb24ndCByZWZsb3cgd2hlbiB6b29tIGluOyB3aGVuIHpvb20gb3V0LCBkbyByZWZsb3cgaWYgdGhlCisgICAgICAgICAgICAgICAgLy8gbmV3IHNjYWxlIGlzIGFsbW9zdCBtaW5pbXVtIHNjYWxlOworICAgICAgICAgICAgICAgIGJvb2xlYW4gcmVmbG93Tm93ID0gIWNhblpvb21PdXQoKSB8fCAobUFjdHVhbFNjYWxlIDw9IDAuOCAqIG1UZXh0V3JhcFNjYWxlKTsKKyAgICAgICAgICAgICAgICAvLyBmb3JjZSB6b29tIGFmdGVyIG1QcmV2aWV3Wm9vbU9ubHkgaXMgc2V0IHRvIGZhbHNlIHNvIHRoYXQgdGhlCisgICAgICAgICAgICAgICAgLy8gbmV3IHZpZXcgc2l6ZSB3aWxsIGJlIHBhc3NlZCB0byB0aGUgV2ViS2l0CisgICAgICAgICAgICAgICAgcmVmcmVzaFpvb21TY2FsZShyZWZsb3dOb3cpOworICAgICAgICAgICAgICAgIC8vIGNhbGwgaW52YWxpZGF0ZSgpIHRvIGRyYXcgd2l0aG91dCB6b29tIGZpbHRlcgorICAgICAgICAgICAgICAgIG1XZWJWaWV3LmludmFsaWRhdGUoKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgbVdlYlZpZXcubVZpZXdNYW5hZ2VyLmVuZFpvb20oKTsKKyAgICAgICAgICAgIG1XZWJWaWV3Lm9uUGluY2hUb1pvb21BbmltYXRpb25FbmQoZGV0ZWN0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kCisgICAgICAgICAgICAgICAgdXBkYXRlWm9vbVBpY2tlcigpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHZvaWQgdXBkYXRlWm9vbVJhbmdlKFdlYlZpZXdDb3JlLlZpZXdTdGF0ZSB2aWV3U3RhdGUsCisgICAgICAgICAgICBpbnQgdmlld1dpZHRoLCBpbnQgbWluUHJlZldpZHRoKSB7CisgICAgICAgIGlmICh2aWV3U3RhdGUubU1pblNjYWxlID09IDApIHsKKyAgICAgICAgICAgIGlmICh2aWV3U3RhdGUubU1vYmlsZVNpdGUpIHsKKyAgICAgICAgICAgICAgICBpZiAobWluUHJlZldpZHRoID4gTWF0aC5tYXgoMCwgdmlld1dpZHRoKSkgeworICAgICAgICAgICAgICAgICAgICBtTWluWm9vbVNjYWxlID0gKGZsb2F0KSB2aWV3V2lkdGggLyBtaW5QcmVmV2lkdGg7CisgICAgICAgICAgICAgICAgICAgIG1NaW5ab29tU2NhbGVGaXhlZCA9IGZhbHNlOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIG1NaW5ab29tU2NhbGUgPSB2aWV3U3RhdGUubURlZmF1bHRTY2FsZTsKKyAgICAgICAgICAgICAgICAgICAgbU1pblpvb21TY2FsZUZpeGVkID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIG1NaW5ab29tU2NhbGUgPSBtRGVmYXVsdE1pblpvb21TY2FsZTsKKyAgICAgICAgICAgICAgICBtTWluWm9vbVNjYWxlRml4ZWQgPSBmYWxzZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIG1NaW5ab29tU2NhbGUgPSB2aWV3U3RhdGUubU1pblNjYWxlOworICAgICAgICAgICAgbU1pblpvb21TY2FsZUZpeGVkID0gdHJ1ZTsKKyAgICAgICAgfQorICAgICAgICBpZiAodmlld1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AgICAgICAgIHNldFpvb21PdmVydmlld1dpZHRoKE1hdGgubWluKFdlYlZpZXcuc01heFZpZXdwb3J0V2lkdGgsCisgICAgICAgICAgICAgICAgICAgIE1hdGgubWF4KChpbnQpICh2aWV3V2lkdGggKiBtSW52RGVmYXVsdFNjYWxlKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBNYXRoLm1heChkcmF3RGF0YS5tTWluUHJlZldpZHRoLCBkcmF3RGF0YS5tVmlld1BvaW50LngpKSkpOworICAgICAgICB9CisKKyAgICAgICAgZmluYWwgZmxvYXQgem9vbU92ZXJ2aWV3U2NhbGUgPSBnZXRab29tT3ZlcnZpZXdTY2FsZSgpOworICAgICAgICBpZiAoIW1NaW5ab29tU2NhbGVGaXhlZCkgeworICAgICAgICAgICAgbU1pblpvb21TY2FsZSA9IHpvb21PdmVydmlld1NjYWxlOworICAgICAgICB9CisgICAgICAgIC8vIGZpdCB0aGUgY29udGVudCB3aWR0aCB0byB0aGUgY3VycmVudCB2aWV3LiBJZ25vcmUgdGhlIHJvdW5kaW5nIGVycm9yIGNhc2UuCisgICAgICAgIGlmICghbVdlYlZpZXcuZHJhd0hpc3RvcnkoKSAmJiAobUluaXRpYWxab29tT3ZlcnZpZXcgfHwgKG1Jblpvb21PdmVydmlldworICAgICAgICAgICAgICAgICYmIE1hdGguYWJzKCh2aWV3V2lkdGggKiBtSW52QWN0dWFsU2NhbGUpIC0gbVpvb21PdmVydmlld1dpZHRoKSA+IDEpKSkgeworICAgICAgICAgICAgbUluaXRpYWxab29tT3ZlcnZpZXcgPSBmYWxzZTsKKyAgICAgICAgICAgIHNldFpvb21TY2FsZSh6b29tT3ZlcnZpZXdTY2FsZSwgIXdpbGxTY2FsZVRyaWdnZXJab29tKG1UZXh0V3JhcFNjYWxlKSk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBVcGRhdGVzIHpvb20gdmFsdWVzIGFmdGVyIFdlYmtpdCBjb21wbGV0ZXMgdGh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gICAgICAgIGZpbmFsIGJvb2xlYW4gcmVmbG93VGV4dDsKKworICAgICAgICAgICAgaWYgKG1Jbml0aWFsU2NhbGUgPiAwKSB7CisgICAgICAgICAgICAgICAgc2NhbGUgPSBtSW5pdGlhbFNjYWxlOworICAgICAgICAgICAgICAgIHJlZmxvd1RleHQgPSBleGNlZWRzTWluU2NhbGVJbmNyZW1lbnQobVRleHRXcmFwU2NhbGUsIHNjYWxlKTsKKyAgICAgICAgICAgIH0gZWxzZSBpZiAodmlld1N0YXRlLm1WaWV3U2NhbGUgPiAwKSB7CisgICAgICAgICAgICAgICAgbVRleHRXcmFwU2NhbGUgPSB2aWV3U3RhdGUubVRleHRXcmFwU2NhbGU7CisgICAgICAgICAgICAgICAgc2NhbGUgPSB2aWV3U3RhdGUubVZpZXdTY2FsZTsKKyAgICAgICAgICAgICAgICByZWZsb3dUZXh0ID0gZmFsc2U7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIFdlYlNldHRpbmdzIHNldHRpbmdzID0gbVdlYlZpZXcuZ2V0U2V0dGluZ3MoKTsKKyAgICAgICAgICAgICAgICBpZiAoc2V0dGluZ3MuZ2V0VXNlV2lkZVZpZXdQb3J0KCkKKyAgICAgICAgICAgICAgICAgICAgJiYgKHNldHRpbmdzLmdldExvYWRXaXRoT3ZlcnZpZXdNb2RlKCkgfHwgc2V0dGluZ3MuZ2V0VXNlRml4ZWRWaWV3cG9ydCgpKSkgeworICAgICAgICAgICAgICAgICAgICBtSW5pdGlhbFpvb21PdmVydmlldyA9IHRydWU7CisgICAgICAgICAgICAgICAgICAgIHNjYWxlID0gKGZsb2F0KSBtV2ViVmlldy5nZXRWaWV3V2lkdGgoKSAvIFdlYlZpZXcuREVGQVVMVF9WSUVXUE9SVF9XSURUSDsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICBzY2FsZSA9IHZpZXdTdGF0ZS5tVGV4dFdyYXBTY2FsZTsKKyAgICAg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ID0gYi5nZXRGbG9hdCgidGV4dHdyYXBTY2FsZSIsIG1BY3R1YWxTY2FsZSk7CisgICAgICAgIG1Jblpvb21PdmVydmlldyA9IGIuZ2V0Qm9vbGVhbigib3ZlcnZpZXciKTsKKyAgICB9CisKKyAgICBwcml2YXRlIFpvb21Db250cm9sQmFzZSBnZXRDdXJyZW50Wm9vbUNvbnRyb2woKSB7CisgICAgICAgIGlmIChtV2ViVmlldy5nZXRTZXR0aW5ncygpICE9IG51bGwgJiYgbVdlYlZpZXcuZ2V0U2V0dGluZ3MoKS5zdXBwb3J0Wm9vbSgpKSB7CisgICAgICAgICAgICBpZiAobVdlYlZpZXcuZ2V0U2V0dGluZ3MoKS5nZXRCdWlsdEluWm9vbUNvbnRyb2xzKCkpIHsKKyAgICAgICAgICAgICAgICBpZiAobUVtYmVkZGVkWm9vbUNvbnRyb2wgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICBtRW1iZWRkZWRab29tQ29udHJvbCA9IG5ldyBab29tQ29udHJvbEVtYmVkZGVkKHRoaXMsIG1XZWJWaWV3KTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgcmV0dXJuIG1FbWJlZGRlZFpvb21Db250cm9sOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBpZiAobUV4dGVybmFsWm9vbUNvbnRyb2wgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICBtRXh0ZXJuYWxab29tQ29udHJvbCA9IG5ldyBab29tQ29udHJvbEV4dGVybmFsKG1XZWJWaWV3KTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgcmV0dXJuIG1FeHRlcm5hbFpvb21Db250cm9sOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHJldHVybiBudWxsOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIGludm9rZVpvb21QaWNrZXIoKSB7CisgICAgICAgIFpvb21Db250cm9sQmFzZSBjb250cm9sID0gZ2V0Q3VycmVudFpvb21Db250cm9sKCk7CisgICAgICAgIGlmIChjb250cm9sICE9IG51bGwpIHsKKyAgICAgICAgICAgIGNvbnRyb2wuc2hvdygpOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHZvaWQgZGlzbWlzc1pvb21QaWNrZXIoKSB7CisgICAgICAgIFpvb21Db250cm9sQmFzZSBjb250cm9sID0gZ2V0Q3VycmVudFpvb21Db250cm9sKCk7CisgICAgICAgIGlmIChjb250cm9sICE9IG51bGwpIHsKKyAgICAgICAgICAgIGNvbnRyb2wuaGlkZSgpOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIGJvb2xlYW4gaXNab29tUGlja2VyVmlzaWJsZSgpIHsKKyAgICAgICAgWm9vbUNvbnRyb2xCYXNlIGNvbnRyb2wgPSBnZXRDdXJyZW50Wm9vbUNvbnRyb2woKTsKKyAgICAgICAgcmV0dXJuIChjb250cm9sICE9IG51bGwpID8gY29udHJvbC5pc1Zpc2libGUoKSA6IGZhbHNlOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHVwZGF0ZVpvb21QaWNrZXIoKSB7CisgICAgICAgIFpvb21Db250cm9sQmFzZSBjb250cm9sID0gZ2V0Q3VycmVudFpvb21Db250cm9sKCk7CisgICAgICAgIGlmIChjb250cm9sICE9IG51bGwpIHsKKyAgICAgICAgICAgIGNvbnRyb2wudXBkYXRlKCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBUaGUgZW1iZWRkZWQgem9vbSBjb250cm9sIGludGVyY2VwdHMgdG91Y2ggZXZlbnRzIGFuZCBhdXRvbWF0aWNhbGx5IHN0YXlzCisgICAgICogdmlzaWJsZS4gVGhlIGV4dGVybmFsIGNvbnRyb2wgbmVlZHMgdG8gY29uc3RhbnRseSByZWZyZXNoIGl0cyBpbnRlcm5hbAorICAgICAqIHRpbWVyIHRvIHN0YXkgdmlzaWJsZS4KKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBrZWVwWm9vbVBpY2tlclZpc2libGUoKSB7CisgICAgICAgIFpvb21Db250cm9sQmFzZSBjb250cm9sID0gZ2V0Q3VycmVudFpvb21Db250cm9sKCk7CisgICAgICAgIGlmIChjb250cm9sICE9IG51bGwgJiYgY29udHJvbCA9PSBtRXh0ZXJuYWxab29tQ29udHJvbCkgeworICAgICAgICAgICAgY29udHJvbC5zaG93KCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgVmlldyBnZXRFeHRlcm5hbFpvb21QaWNrZXIoKSB7CisgICAgICAgIFpvb21Db250cm9sQmFzZSBjb250cm9sID0gZ2V0Q3VycmVudFpvb21Db250cm9sKCk7CisgICAgICAgIGlmIChjb250cm9sICE9IG51bGwgJiYgY29udHJvbCA9PSBtRXh0ZXJuYWxab29tQ29udHJvbCkgeworICAgICAgICAgICAgcmV0dXJuIG1FeHRlcm5hbFpvb21Db250cm9sLmdldENvbnRyb2xzKCk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICByZXR1cm4gbnVsbDsKKyAgICAgICAgfQorICAgIH0KK30KZGlmZiAtLWdpdCBhL2NvcmUvamF2YS9hbmRyb2lkL3dlYnJ1bnRpbWUvV2ViUnVudGltZUFjdGl2aXR5LmphdmEgYi9jb3JlL2phdmEvYW5kcm9pZC93ZWJydW50aW1lL1dlYlJ1bnRpbWVBY3Rpdml0eS5qYXZhCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLmVjOGM2MGMKLS0tIC9kZXYvbnVsbAorKysgYi9jb3JlL2phdmEvYW5kcm9pZC93ZWJydW50aW1lL1dlYlJ1bnRpbWVBY3Rpdml0eS5qYXZhCkBAIC0wLDAgKzEsMjA0IEBACisvKgorICogQ29weXJpZ2h0IChDKSAyMDEwIFRoZSBBbmRyb2lkIE9wZW4gU291cmNlIFByb2plY3QKKyAqCisgKiBMaWNlbnNlZCB1bmRlciB0aGUgQXBhY2hlIExpY2Vuc2UsIFZlc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HBhc3MgR0VUX01FVEFfREFUQQorICAgICAgICBQYWNrYWdlTWFuYWdlciBwYWNrYWdlTWFuYWdlciA9IGdldFBhY2thZ2VNYW5hZ2VyKCk7CisgICAgICAgIENvbXBvbmVudE5hbWUgY29tcG9uZW50TmFtZSA9IG5ldyBDb21wb25lbnROYW1lKHRoaXMsIGdldENsYXNzKCkpOworICAgICAgICBBY3Rpdml0eUluZm8gYWN0aXZpdHlJbmZvID0gbnVsbDsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIGFjdGl2aXR5SW5mbyA9IHBhY2thZ2VNYW5hZ2VyLmdldEFjdGl2aXR5SW5mbyhjb21wb25lbnROYW1lLCBQYWNrYWdlTWFuYWdlci5HRVRfTUVUQV9EQVRBKTsKKyAgICAgICAgfSBjYXRjaCAoUGFja2FnZU1hbmFnZXIuTmFtZU5vdEZvdW5kRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgIExvZy5kKExPR1RBRywgIkZhaWxlZCB0byBmaW5kIGNvbXBvbmVudCIpOworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisgICAgICAgIGlmIChhY3Rpdml0eUluZm8gPT0gbnVsbCkgeworICAgICAgICAgICAgTG9nLmQoTE9HVEFHLCAiRmFpbGVkIHRvIGdldCBhY3Rpdml0eSBpbmZvIik7CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKworICAgICAgICBCdW5kbGUgbWV0YURhdGEgPSBhY3Rpdml0eUluZm8ubWV0YURhdGE7CisgICAgICAgIGlmIChtZXRhRGF0YSA9PSBudWxsKSB7CisgICAgICAgICAgICBMb2cuZChMT0dUQUcsICJObyBtZXRhIGRhdGEiKTsKKyAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfQorCisgICAgICAgIFN0cmluZyB1cmwgPSBtZXRhRGF0YS5nZXRTdHJpbmcoImFuZHJvaWQud2VicnVudGltZS51cmwiKTsKKyAgICAgICAgaWYgKHVybCA9PSBudWxsKSB7CisgICAgICA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JlZW4iLCAiZHJhd2FibGUiLCBnZXRQYWNrYWdlTmFtZSgpKSk7CisgICAgICAgIG1XZWJWaWV3LmdldFNldHRpbmdzKCkuc2V0SmF2YVNjcmlwdEVuYWJsZWQodHJ1ZSk7CisgICAgICAgIG1XZWJWaWV3LnNldFdlYlZpZXdDbGllbnQobmV3IFdlYlZpZXdDbGllbnQoKSB7CisgICAgICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgICAgIHB1YmxpYyBib29sZWFuIHNob3VsZE92ZXJyaWRlVXJsTG9hZGluZyhXZWJWaWV3IHZpZXcsIFN0cmluZyB1cmwpIHsKKyAgICAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgICAgICBVUkwgbmV3T3JpZ2luID0gbmV3IFVSTCh1cmwpOworICAgICAgICAgICAgICAgICAgICBpZiAoYXJlU2FtZU9yaWdpbihtQmFzZVVybCwgbmV3T3JpZ2luKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgLy8gSWYgc2ltcGxlIHNhbWUgb3JpZ2luIHRlc3QgcGFzc2VzLCBsb2FkIGluIHRoZSB3ZWJ2aWV3LgorICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfSBjYXRjaChNYWxmb3JtZWRVUkxFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgICAgICAvLyBEb24ndCBsb2FkIGFueXRoaW5nIGlmIHRoaXMgd2Fzbid0IGEgcHJvcGVyIFVSTC4KKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgLy8gT3RoZXJ3aXNlIHRoaXMgaXMgYSBVUkwgdGhhdCBpcyBub3Qgc2FtZSBvcmlnaW4gc28gcGFzcyBpdCB0byB0aGUKKyAgICAgICAgICAgICAgICAvLyBCcm93c2VyIHRvIGxvYWQuCisgICAgICAgICAgICAgICAgc3RhcnRBY3Rpdml0eShuZXcgSW50ZW50KEludGVudC5BQ1RJT05fVklFVywgVXJpLnBhcnNlKHVybCkpKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgQE92ZXJyaWRlCisgICAgICAgICAgICBwdWJsaWMgdm9pZCBvblBhZ2VGaW5pc2hlZChXZWJWaWV3IHZpZXcsIFN0cmluZyB1cmwpIHsKKyAgICAgICAgICAgICAgICBpZiAobVNwbGFzaFNjcmVlbiAhPSBudWxsICYmIG1TcGxhc2hTY3JlZW4uZ2V0VmlzaWJpbGl0eSgpID09IFZpZXcuVklTSUJMRSkgeworICAgICAgICAgICAgICAgICAgICBtU3BsYXNoU2NyZWVuLnNldFZpc2liaWxpdHkoVmlldy5HT05FKTsKKyAgICAgICAgICAgICAgICAgICAgbVNwbGFzaFNjcmVlbiA9IG51bGw7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9KTsKKworICAgICAgICAvLyBVc2UgYSBjdXN0b20gV2ViQ2hyb21lQ2xpZW50IHdpdGggZ2VvbG9jYXRpb24gcGVybWlzc2lvbnMgaGFuZGxpbmcuCisgICAgICAgIG1XZWJWaWV3LnNldFdlYkNocm9tZUNsaWVudChuZXcgV2ViQ2hyb21lQ2xpZW50KCkgeworICAgICAgICAgICAgcHVibGljIHZvaWQgb25HZW9sb2NhdGlvblBlcm1pc3Npb25zU2hvd1Byb21wdCgKKyAgICAgICAgICAgICAgICAgICAgICAgIFN0cmluZyBvcmlnaW4sIEdlb2xvY2F0aW9uUGVybWlzc2lvbnMuQ2FsbGJhY2sgY2FsbGJhY2spIHsKKyAgICAgICAgICAgICAgICAvLyBBbGxvdyB0aGlzIG9yaWdpbiBpZiBpdCBoYXMgR2VvbG9jYXRpb24gcGVybWlzc2lvbnMsIG90aGVyd2lzZSBkZW55LgorICAgICAgICAgICAgICAgIGJvb2xlYW4gYWxsb3dlZCA9IGZhbHNlOworICAgICAgICAgICAgICAgIGlmIChzZW5zaXRpdmVGZWF0dXJlcy5nZXRHZW9sb2NhdGlvbigpKSB7CisgICAgICAgICAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgICAgICAgICBVUkwgb3JpZ2luVXJsID0gbmV3IFVSTChvcmlnaW4pOworICAgICAgICAgICAgICAgICAgICAgICAgYWxsb3dlZCA9IGFyZVNhbWVPcmlnaW4obUJhc2VVcmwsIG9yaWdpblVybCk7CisgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2goTWFsZm9ybWVkVVJMRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBjYWxsYmFjay5pbnZva2Uob3JpZ2luLCBhbGxvd2VkLCBmYWxzZSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0pOworCisgICAgICAgIC8vIFNldCB0aGUgREIgbG9jYXRpb24uIE9wdGlvbmFsLiBHZW9sb2NhdGlvbiB3b3JrcyB3aXRob3V0IERCcy4KKyAgICAgICAgbVdlYlZpZXcuZ2V0U2V0dGluZ3MoKS5zZXRHZW9sb2NhdGlvbkRhdGFiYXNlUGF0aCgKKyAgICAgICAgICAgICAgICBnZXREaXIoImdlb2xvY2F0aW9uIiwgTU9ERV9QUklWQVRFKS5nZXRQYXRoKCkpOworCisgICAgICAgIFN0cmluZyB0aXRsZSA9IG1ldGFEYXRhLmdldFN0cmluZygiYW5kcm9pZC53ZWJydW50aW1lLnRpdGxlIik7CisgICAgICAgIC8vIFdlIHR1cm5lZCBvZmYgdGhlIHRpdGxlIGJhciB0byBnbyBmdWxsIHNjcmVlbiBzbyBkaXNwbGF5IHRoZQorICAgICAgICAvLyB3ZWJhcHAncyB0aXRsZSBhcyBhIHRvYXN0LgorICAgICAgICBpZiAodGl0bGUgIT0gbnVsbCkgeworICAgICAgICAgICAgVG9hc3QubWFrZVRleHQodGhpcywgdGl0bGUsIFRvYXN0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BpbnQgYWRhcHRlcklkID0gYS5nZXRSZXNvdXJjZUlkKFIuc3R5bGVhYmxlLkFic0xpc3RWaWV3X2FkYXB0ZXIsIDApOworICAgICAgICBpZiAoYWRhcHRlcklkICE9IDApIHsKKyAgICAgICAgICAgIGZpbmFsIENvbnRleHQgYyA9IGNvbnRleHQ7CisgICAgICAgICAgICBwb3N0KG5ldyBSdW5uYWJsZSgpIHsKKyAgICAgICAgICAgICAgICBwdWJsaWMgdm9pZCBydW4oKSB7CisgICAgICAgICAgICAgICAgICAgIHNldEFkYXB0ZXIoQWRhcHRlcnMubG9hZEFkYXB0ZXIoYywgYWRhcHRlcklkKSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSk7CisgICAgICAgIH0KKworICAgICAgICBzZXRDaG9pY2VNb2RlKGEuZ2V0SW50KFIuc3R5bGVhYmxlLkFic0xpc3RWaWV3X2Nob2ljZU1vZGUsIENIT0lDRV9NT0RFX05PTkUpKTsKIAogICAgICAgICBhLnJlY3ljbGUoKTsKICAgICB9CkBAIC01NzksNiArNjU1LDMxMSBAQAogICAgIH0KIAogICAgIC8qKgorICAgICAqIHtAaW5oZXJpdERvY30KKyAgICAgKi8KKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgdm9pZCBzZXRBZGFwdGVyKExpc3RBZGFwdGVyIGFkYXB0ZXIpIHsKKyAgICAgICAgaWYgKGFkYXB0ZXIgIT0gbnVsbCkgeworICAgICAgICAgICAgaWYgKG1DaG9pY2VNb2RlICE9IENIT0lDRV9NT0RFX05PTkUgJiYgbUFkYXB0ZXIuaGFzU3RhYmxlSWRzKCkgJiYKKyAgICAgICAgICAgICAgICAgICAgbUNoZWNrZWRJZFN0YXRlcyA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgbUNoZWNrZWRJZFN0YXRlcyA9IG5ldyBMb25nU3BhcnNlQXJyYXk8Qm9vbGVhbj4oKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICA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AgICAgKiB2YWxpZCBpZiB0aGUgY2hvaWNlIG1vZGUgaGFzIGJlZW4gc2V0IHRvIHtAbGluayAjQ0hPSUNFX01PREVfU0lOR0xFfQorICAgICAqIG9yIHtAbGluayAjQ0hPSUNFX01PREVfTVVMVElQTEV9LgorICAgICAqCisgICAgICogQHBhcmFtIHBvc2l0aW9uIFRoZSBpdGVtIHdob3NlIGNoZWNrZWQgc3RhdGUgdG8gcmV0dXJuCisgICAgICogQHJldHVybiBUaGUgaXRlbSdzIGNoZWNrZWQgc3RhdGUgb3IgPGNvZGU+ZmFsc2U8L2NvZGU+IGlmIGNob2ljZSBtb2RlCisgICAgICogICAgICAgICBpcyBpbnZhbGlkCisgICAgICoKKyAgICAgKiBAc2VlICNzZXRDaG9pY2VNb2RlKGludCkKKyAgICAgKi8KKyAgICBwdWJsaWMgYm9vbGVhbiBpc0l0ZW1DaGVja2VkKGludCBwb3NpdGlvbikgeworICAgICAgICBpZiAobUNob2ljZU1vZGUgIT0gQ0hPSUNFX01PREVfTk9ORSAmJiBtQ2hlY2tTdGF0ZXMgIT0gbnVsbCkgeworICAgICAgICAgICAgcmV0dXJuIG1DaGVja1N0YXRlcy5nZXQocG9zaXRpb24pOworICAgICAgICB9CisKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIC8qKgorICAgICAqIFJldHVybnMgdGhlIGN1cnJlbnRseSBjaGVja2VkIGl0ZW0uIFRoZSByZXN1bHQgaXMgb25seSB2YWxpZCBpZiB0aGUgY2hvaWNlCisgICAgICogbW9kZSBoYXMgYmVlbiBzZXQgdG8ge0BsaW5rICNDSE9JQ0VfTU9ERV9TSU5HTEV9LgorICAgICAqCisgICAgICogQHJldHVybiBUaGUgcG9zaXRpb24gb2YgdGhlIGN1cnJlbnRseSBjaGVja2VkIGl0ZW0gb3IKKyAgICAgKiAgICAgICAgIHtAbGluayAjSU5WQUxJRF9QT1NJVElPTn0gaWYgbm90aGluZyBpcyBzZWxlY3RlZAorICAgICAqCisgICAgICogQHNlZSAjc2V0Q2hvaWNlTW9kZShpbnQpCisgICAgICovCisgICAgcHVibGljIGludCBnZXRDaGVja2VkSXRlbVBvc2l0aW9uKCkgeworICAgICAgICBpZiAobUNob2ljZU1vZGUgPT0gQ0hPSUNFX01PREVfU0lOR0xFICYmIG1DaGVja1N0YXRlcyAhPSBudWxsICYmIG1DaGVja1N0YXRlcy5zaXplKCkgPT0gMSkgeworICAgICAgICAgICAgcmV0dXJuIG1DaGVja1N0YXRlcy5rZXlBdCgwKTsKKyAgICAgICAgfQorCisgICAgICAgIHJldHVybiBJTlZBTElEX1BPU0lUSU9OOworICAgIH0KKworICAgIC8qKgorICAgICAqIFJldHVybnMgdGhlIHNldCBvZiBjaGVja2VkIGl0ZW1zIGluIHRoZSBsaXN0LiBUaGUgcmVzdWx0IGlzIG9ubHkgdmFsaWQgaWYKKyAgICAgKiB0aGUgY2hvaWNlIG1vZGUgaGFzIG5vdCBiZWVuIHNldCB0byB7QGxpbmsgI0NIT0lDRV9NT0RFX05PTkV9LgorICAgICAqCisgICAgICogQHJldHVybiAgQSBTcGFyc2VCb29sZWFuQXJyYXkgd2hpY2ggd2lsbCByZXR1cm4gdHJ1ZSBmb3IgZWFjaCBjYWxsIHRvCisgICAgICogICAgICAgICAgZ2V0KGludCBwb3NpdGlvbikgd2hlcmUgcG9zaXRpb24gaXMgYSBwb3NpdGlvbiBpbiB0aGUgbGlzdCwKKyAgICAgKiAgICAgICAgICBvciA8Y29kZT5udWxsPC9jb2RlPiBpZiB0aGUgY2hvaWNlIG1vZGUgaXMgc2V0IHRvCisgICAgICogICAgICAgICAge0BsaW5rICNDSE9JQ0VfTU9ERV9OT05FfS4KKyAgICAgKi8KKyAgICBwdWJsaWMgU3BhcnNlQm9vbGVhbkFycmF5IGdldENoZWNrZWRJdGVtUG9zaXRpb25zKCkgeworICAgICAgICBpZiAobUNob2ljZU1vZGUgIT0gQ0hPSUNFX01PREVfTk9ORSkgeworICAgICAgICAgICAgcm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QXQoaSk7CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gaWRzOworICAgIH0KKworICAgIC8qKgorICAgICAqIENsZWFyIGFueSBjaG9pY2VzIHByZXZpb3VzbHkgc2V0CisgICAgICovCisgICAgcHVibGljIHZvaWQgY2xlYXJDaG9pY2VzKCkgeworICAgICAgICBpZiAobUNoZWNrU3RhdGVzICE9IG51bGwpIHsKKyAgICAgICAgICAgIG1DaGVja1N0YXRlcy5jbGVhcigpOworICAgICAgICB9CisgICAgICAgIGlmIChtQ2hlY2tlZElkU3RhdGVzICE9IG51bGwpIHsKKyAgICAgICAgICAgIG1DaGVja2VkSWRTdGF0ZXMuY2xlYXIoKTsKKyAgICAgICAgfQorICAgICAgICBtQ2hlY2tlZEl0ZW1Db3VudCA9IDA7CisgICAgfQorCisgICAgLyoqCisgICAgICogU2V0cyB0aGUgY2hlY2tlZCBzdGF0ZSBvZiB0aGUgc3BlY2lmaWVkIHBvc2l0aW9uLiBUaGUgaXMgb25seSB2YWxpZCBpZgorICAgICAqIHRoZSBjaG9pY2UgbW9kZSBoYXMgYmVlbiBzZXQgdG8ge0BsaW5rICNDSE9JQ0VfTU9ERV9TSU5HTEV9IG9yCisgICAgICoge0BsaW5rICNDSE9JQ0VfTU9ERV9NVUxUSVBMRX0uCisgICAgICoKKyAgICAgKiBAcGFyYW0gcG9zaXRpb24gVGhlIGl0ZW0gd2hvc2UgY2hlY2tlZCBzdGF0ZSBpcyB0byBiZSBjaGVja2VkCisgICAgICogQHBhcmFtIHZhbHVlIFRoZSBuZXcgY2hlY2tlZCBzdGF0ZSBmb3IgdGhlIGl0ZW0KKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBzZXRJdGVtQ2hlY2tlZChpbnQgcG9zaXRpb24sIGJvb2xlYW4gdmFsdWUpIHsKKyAgICAgICAgaWYgKG1DaG9pY2VNb2RlID09IENIT0lDRV9NT0RFX05PTkUpIHsKKyAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfQorCis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dmFsdWUpIHsKKyAgICAgICAgICAgICAgICBpZiAodmFsdWUpIHsKKyAgICAgICAgICAgICAgICAgICAgbUNoZWNrZWRJdGVtQ291bnQrKzsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICBtQ2hlY2tlZEl0ZW1Db3VudC0tOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmIChtQ2hvaWNlQWN0aW9uTW9kZSAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgZmluYWwgbG9uZyBpZCA9IG1BZGFwdGVyLmdldEl0ZW1JZChwb3NpdGlvbik7CisgICAgICAgICAgICAgICAgbU11bHRpQ2hvaWNlTW9kZUNhbGxiYWNrLm9uSXRlbUNoZWNrZWRTdGF0ZUNoYW5nZWQobUNob2ljZUFjdGlvbk1vZGUsCisgICAgICAgICAgICAgICAgICAgICAgICBwb3NpdGlvbiwgaWQsIHZhbHVlKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIGJvb2xlYW4gdXBkYXRlSWRzID0gbUNoZWNrZWRJZFN0YXRlcyAhPSBudWxsICYmIG1BZGFwdGVyLmhhc1N0YWJsZUlkcygpOworICAgICAgICAgICAgLy8gQ2xlYXIgYWxsIHZhbHVlcyBpZiB3ZSdyZSBjaGVja2luZyBzb21ldGhpbmcsIG9yIHVuY2hlY2tpbmcgdGhlIGN1cnJlbnRseQorICAgICAgICAgICAgLy8gc2VsZWN0ZWQgaXRlbQorICAgICAgICAgICAgaWYgKHZhbHVlIHx8IGlzSXRlbUNoZWNrZWQocG9zaXRpb24pKSB7CisgICAgICAgICAgICAgICAgbUNoZWNrU3RhdGVzLmNsZWFyKCk7CisgICAgICAgICAgICAgICAgaWYgKHVwZGF0ZUlkcykgeworICAgICAgICAgICAgICAgICAgICBtQ2hlY2tlZElkU3RhdGVzLmNsZWFyKCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgLy8gdGhpcyBtYXkgZW5kIHVwIHNlbGVjdGluZyB0aGUgdmFsdWUgd2UganVzdCBjbGVhcmVkIGJ1dCB0aGlzIHdheQorICAgICAgICAgICAgLy8gd2UgZW5zdXJlIGxlbmd0aCBvZiBtQ2hlY2tTdGF0ZXMgaXMgMSwgYSBmYWN0IGdldENoZWNrZWRJdGVtUG9zaXRpb24gcmVsaWVzIG9uCisgICAgICAgICAgICBpZiAodmFsdWUpIHsKKyAgICAgICAgICAgICAgICBtQ2hlY2tTdGF0ZXMucHV0KHBvc2l0aW9uLCB0cnVlKTsKKyAgICAgICAgICAgICAgICBpZiAodXBkYXRlSWRzKSB7CisgICAgICAgICAgICAgICAgICAgIG1DaGVja2VkSWRTdGF0ZXMucHV0KG1BZGFwdGVyLmdldEl0ZW1JZChwb3NpdGlvbiksIEJvb2xlYW4uVFJVRSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIG1DaGVja2VkSXRlbUNvdW50ID0gMTsKKyAgICAgICAgICAgIH0gZWxzZSBpZiAobUNoZWNrU3RhdGVzLnNpemUoKSA9PSAwIHx8ICFtQ2hlY2tTdGF0ZXMudmFsdWVBdCgwKSkgeworICAgICAgICAgICAgICAgIG1DaGVja2VkSXRlbUNvdW50ID0gMDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIC8vIERvIG5vdCBnZW5lcmF0ZSBhIGRhdGEgY2hhbmdlIHdoaWxlIHdlIGFyZSBpbiB0aGUgbGF5b3V0IHBoYXNlCisgICAgICAgIGlmICghbUluTGF5b3V0ICYmICFtQmxvY2tMYXlvdXRSZXF1ZXN0cykgeworICAgICAgICAgICAgbURhdGFDaGFuZ2VkID0gdHJ1ZTsKKyAgICAgICAgICAgIHJlbWVtYmVyU3luY1N0YXRlKCk7CisgICAgICAgICAgICByZXF1ZXN0TGF5b3V0KCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgYm9vbGVhbiBwZXJmb3JtSXRlbUNsaWNrKFZpZXcgdmlldywgaW50IHBvc2l0aW9uLCBsb25nIGlkKSB7CisgICAgICAgIGJvb2xlYW4gaGFuZGxlZCA9IGZhbHNlOworCisgICAgICAgIGlmIChtQ2hvaWNlTW9kZSAhPSBDSE9JQ0VfTU9ERV9OT05FKSB7CisgICAgICAgICAgICBoYW5kbGVkID0gdHJ1ZTsKKworICAgICAgICAgICAgaWYgKG1DaG9pY2VNb2RlID09IENIT0lDRV9NT0RFX01VTFRJUExFIHx8CisgICAgICAgICAgICAgICAgICAgIChtQ2hvaWNlTW9kZSA9PSBDSE9JQ0VfTU9ERV9NVUxUSVBMRV9NT0RBTCAmJiBtQ2hvaWNlQWN0aW9uTW9kZSAhPSBudWxsKSkgeworICAgICAgICAgICAgICAgIGJvb2xlYW4gbmV3VmFsdWUgPSAhbUNoZWNrU3RhdGVzLmdldChwb3NpdGlvbiwgZmFsc2UpOworICAgICAgICAgICAgICAgIG1DaGVja1N0YXRlcy5wdXQocG9zaXRpb24sIG5ld1ZhbHVlKTsKKyAgICAgICAgICAgICAgICBpZiAobUNoZWNrZWRJZFN0YXRlcyAhPSBudWxsICYmIG1BZGFwdGVyLmhhc1N0YWJsZUlkcygpKSB7CisgICAgICAgICAgICAgICAgICAgIGlmIChuZXdWYWx1ZSkgeworICAgICAgICAgICAgICAgICAgICAgICAgbUNoZWNrZWRJZFN0YXRlcy5wdXQobUFkYXB0ZXIuZ2V0SXRlbUlkKHBvc2l0aW9uKSwgQm9vbGVhbi5UUlVFKTsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1DaGVja2VkSWRTdGF0ZXMuZGVsZXRlKG1BZGFwdGVyLmdldEl0ZW1JZChwb3NpdGlvbikpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGlmIChuZXdWYWx1ZSkgeworICAgICAgICAgICAgICAgICAgICBtQ2hlY2tlZEl0ZW1Db3VudCsrOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIG1DaGVja2VkSXRlbUNvdW50LS07CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGlmIChtQ2hvaWNlQWN0aW9uTW9kZSAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIG1NdWx0aUNob2ljZU1vZGVDYWxsYmFjay5vbkl0ZW1DaGVja2VkU3RhdGVDaGFuZ2VkKG1DaG9pY2VBY3Rpb25Nb2RlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBvc2l0aW9uLCBpZCwgbmV3VmFsdWUpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0gZWxzZSBpZiAobUNob2ljZU1vZGUgPT0gQ0hPSUNFX01PREVfU0lOR0xFKSB7CisgICAgICAgICAgICAgICAgYm9vbGVhbiBuZXdWYWx1ZSA9ICFtQ2hlY2tTdGF0ZXMuZ2V0KHBvc2l0aW9uLCBmYWxzZSk7CisgICAgICAgICAgICAgICAgaWYgKG5ld1ZhbHVlKSB7CisgICAgICAgICAgICAgICAgICAgIG1DaGVja1N0YXRlcy5jbGVhcigpOworICAgICAgICAgICAgICAgICAgICBtQ2hlY2tTdGF0ZXMucHV0KHBvc2l0aW9uLCB0cnVlKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKG1DaGVja2VkSWRTdGF0ZXMgIT0gbnVsbCAmJiBtQWRhcHRlci5oYXNTdGFibGVJZHMoKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgbUNoZWNrZWRJZFN0YXRlcy5jbGVhcigpOworICAgICAgICAgICAgICAgICAgICAgICAgbUNoZWNrZWRJZFN0YXRlcy5wdXQobUFkYXB0ZXIuZ2V0SXRlbUlkKHBvc2l0aW9uKSwgQm9vbGVhbi5UUlVFKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBtQ2hlY2tlZEl0ZW1Db3VudCA9IDE7CisgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChtQ2hlY2tTdGF0ZXMuc2l6ZSgpID09IDAgfHwgIW1DaGVja1N0YXRlcy52YWx1ZUF0KDApKSB7CisgICAgICAgICAgICAgICAgICAgIG1DaGVja2VkSXRlbUNvdW50ID0gMDsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIG1EYXRhQ2hhbmdlZCA9IHRydWU7CisgICAgICAgICAgICByZW1lbWJlclN5bmNTdGF0ZSgpOworICAgICAgICAgICAgcmVxdWVzdExheW91dCgpOworICAgICAgICB9CisKKyAgICAgICAgaGFuZGxlZCB8PSBzdXBlci5wZXJmb3JtSXRlbUNsaWNrKHZpZXcsIHBvc2l0aW9uLCBpZCk7CisKKyAgICAgICAgcmV0dXJuIGhhbmRsZWQ7CisgICAgfQorCisgICAgLyoqCisgICAgICogQHNlZSAjc2V0Q2hvaWNlTW9kZShpbnQpCisgICAgICoKKyAgICAgKiBAcmV0dXJuIFRoZSBjdXJyZW50IGNob2ljZSBtb2RlCisgICAgICovCisgICAgcHVibGljIGludCBnZXRDaG9pY2VNb2RlKCkgeworICAgICAgICByZXR1cm4gbUNob2ljZU1vZGU7CisgICAgfQorCisgICAgLyoqCisgICAgICogRGVmaW5lcyB0aGUgY2hvaWNlIGJlaGF2aW9yIGZvciB0aGUgTGlzdC4gQnkgZGVmYXVsdCwgTGlzdHMgZG8gbm90IGhhdmUgYW55IGNob2ljZSBiZWhhdmlvcgorICAgICAqICh7QGxpbmsgI0NIT0lDRV9NT0RFX05PTkV9KS4gQnkgc2V0dGluZyB0aGUgY2hvaWNlTW9kZSB0byB7QGxpbmsgI0NIT0lDRV9NT0RFX1NJTkdMRX0sIHRoZQorICAgICAqIExpc3QgYWxsb3dzIHVwIHRvIG9uZSBpdGVtIHRvICBiZSBpbiBhIGNob3NlbiBzdGF0ZS4gQnkgc2V0dGluZyB0aGUgY2hvaWNlTW9kZSB0bworICAgICAqIHtAbGluayAjQ0hPSUNFX01PREVfTVVMVElQTEV9LCB0aGUgbGlzdCBhbGxvd3MgYW55IG51bWJlciBvZiBpdGVtcyB0byBiZSBjaG9zZW4uCisgICAgICoKKyAgICAgKiBAcGFyYW0gY2hvaWNlTW9kZSBPbmUgb2Yge0BsaW5rICNDSE9JQ0VfTU9ERV9OT05FfSwge0BsaW5rICNDSE9JQ0VfTU9ERV9TSU5HTEV9LCBvcgorICAgICAqIHtAbGluayAjQ0hPSUNFX01PREVfTVVMVElQTEV9CisgICAgICovCisgICAgcHVibGljIHZvaWQgc2V0Q2hvaWNlTW9kZShpbnQgY2hvaWNlTW9kZSkgeworICAgICAgICBtQ2hvaWNlTW9kZSA9IGNob2ljZU1vZGU7CisgICAgICAgIGlmIChtQ2hvaWNlQWN0aW9uTW9kZSAhPSBudWxsKSB7CisgICAgICAgICAgICBtQ2hvaWNlQWN0aW9uTW9kZS5maW5pc2goKTsKKyAgICAgICAgICAgIG1DaG9pY2VBY3Rpb25Nb2RlID0gbnVsbDsKKyAgICAgICAgfQorICAgICAgICBpZiAobUNob2ljZU1vZGUgIT0gQ0hPSUNFX01PREVfTk9ORSkgeworICAgICAgICAgICAgaWYgKG1DaGVja1N0YXRlcyA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgbUNoZWNrU3RhdGVzID0gbmV3IFNwYXJzZUJvb2xlYW5BcnJheSgpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKG1DaGVja2VkSWRTdGF0ZXMgPT0gbnVsbCAmJiBtQWRhcHRlciAhPSBudWxsICYmIG1BZGFwdGVyLmhhc1N0YWJsZUlkcygpKSB7CisgICAgICAgICAgICAgICAgbUNoZWNrZWRJZFN0YXRlcyA9IG5ldyBMb25nU3BhcnNlQXJyYXk8Qm9vbGVhbj4oKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIC8vIE1vZGFsIG11bHRpLWNob2ljZSBtb2RlIG9ubHkgaGFzIGNob2ljZXMgd2hlbiB0aGUgbW9kZSBpcyBhY3RpdmUuIENsZWFyIHRoZW0uCisgICAgICAgICAgICBpZiAobUNob2ljZU1vZGUgPT0gQ0hPSUNFX01PREVfTVVMVElQTEVfTU9EQUwpIHsKKyAgICAgICAgICAgICAgICBjbGVhckNob2ljZXMoKTsKKyAgICAgICAgICAgICAgICBzZXRMb25nQ2xpY2thYmxlKHRydWUpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogU2V0IGEge0BsaW5rIE11bHRpQ2hvaWNlTW9kZUxpc3RlbmVyfSB0aGF0IHdpbGwgbWFuYWdlIHRoZSBsaWZlY3ljbGUgb2YgdGhlCisgICAgICogc2VsZWN0aW9uIHtAbGluayBBY3Rpb25Nb2RlfS4gT25seSB1c2VkIHdoZW4gdGhlIGNob2ljZSBtb2RlIGlzIHNldCB0bworICAgICAqIHtAbGluayAjQ0hPSUNFX01PREVfTVVMVElQTEVfTU9EQUx9LgorICAgICAqCisgICAgICogQHBhcmFtIGxpc3RlbmVyIExpc3RlbmVyIHRoYXQgd2lsbCBtYW5hZ2UgdGhlIHNlbGVjdGlvbiBtb2RlCisgICAgICoKKyAgICAgKiBAc2VlICNzZXRDaG9pY2VNb2RlKGludCkKKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBzZXRNdWx0aUNob2ljZU1vZGVMaXN0ZW5lcihNdWx0aUNob2ljZU1vZGVMaXN0ZW5lciBsaXN0ZW5lcikgeworICAgICAgICBpZiAobU11bHRpQ2hvaWNlTW9kZUNhbGxiYWNrID09IG51bGwpIHsKKyAgICAgICAgICAgIG1NdWx0aUNob2ljZU1vZGVDYWxsYmFjayA9IG5ldyBNdWx0aUNob2ljZU1vZGVXcmFwcGVyKCk7CisgICAgICAgIH0KKyAgICAgICAgbU11bHRpQ2hvaWNlTW9kZUNhbGxiYWNrLnNldFdyYXBwZWQobGlzdGVuZXIpOwor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ZWNrSWRTdGF0ZSA9IG5ldyBMb25nU3BhcnNlQXJyYXk8Qm9vbGVhbj4oKTsKKyAgICAgICAgICAgICAgICBjaGVja0lkU3RhdGUuc2V0VmFsdWVzKGlkU3RhdGUsIEJvb2xlYW4uVFJVRSk7CisgICAgICAgICAgICB9CiAgICAgICAgIH0KIAogICAgICAgICBAT3ZlcnJpZGUKQEAgLTgyNiw2ICsxMjE2LDggQEAKICAgICAgICAgICAgIG91dC53cml0ZUludChwb3NpdGlvbik7CiAgICAgICAgICAgICBvdXQud3JpdGVJbnQoaGVpZ2h0KTsKICAgICAgICAgICAgIG91dC53cml0ZVN0cmluZyhmaWx0ZXIpOworICAgICAgICAgICAgb3V0LndyaXRlU3BhcnNlQm9vbGVhbkFycmF5KGNoZWNrU3RhdGUpOworICAgICAgICAgICAgb3V0LndyaXRlTG9uZ0FycmF5KGNoZWNrSWRTdGF0ZSAhPSBudWxsID8gY2hlY2tJZFN0YXRlLmdldEtleXMoKSA6IG5ldyBsb25nWzBdKTsKICAgICAgICAgfQogCiAgICAgICAgIEBPdmVycmlkZQpAQCAtODM3LDcgKzEyMjksOCBAQAogICAgICAgICAgICAgICAgICAgICArICIgdmlld1RvcD0iICsgdmlld1RvcAogICAgICAgICAgICAgICAgICAgICArICIgcG9zaXRpb249IiArIHBvc2l0aW9uCiAgICAgICAgICAgICAgICAgICAgICsgIiBoZWlnaHQ9IiArIGhlaWdodAotICAgICAgICAgICAgICAgICAgICArICIgZmlsdGVyPSIgKyBmaWx0ZXIgKyAifSI7CisgICAgICAgICAgICAgICAgICAgICsgIiBmaWx0ZXI9IiArIGZpbHRlcgorICAgICAgICAgICAgICAgICAgICArICIgY2hlY2tTdGF0ZT0iICsgY2hlY2tTdGF0ZSArICJ9IjsKICAgICAgICAgfQogCiAgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgUGFyY2VsYWJsZS5DcmVhdG9yPFNhdmVkU3RhdGU+IENSRUFUT1IKQEAgLTkwMSw2ICsxMjk0LDkgQEAKICAgICAgICAgICAgIH0KICAgICAgICAgfQogCisgICAgICAgIHNzLmNoZWNrU3RhdGUgPSBtQ2hlY2tTdGF0ZXM7CisgICAgICAgIHNzLmNoZWNrSWRTdGF0ZSA9IG1DaGVja2VkSWRTdGF0ZXM7CisKICAgICAgICAgcmV0dXJuIHNzOwogICAgIH0KIApAQCAtOTMyLDYgKzEzMjgsMTQgQEAKIAogICAgICAgICBzZXRGaWx0ZXJUZXh0KHNzLmZpbHRlcik7CiAKKyAgICAgICAgaWYgKHNzLmNoZWNrU3RhdGUgIT0gbnVsbCkgeworICAgICAgICAgICAgbUNoZWNrU3RhdGVzID0gc3MuY2hlY2tTdGF0ZTsKKyAgICAgICAgfQorCisgICAgICAgIGlmIChzcy5jaGVja0lkU3RhdGUgIT0gbnVsbCkgeworICAgICAgICAgICAgbUNoZWNrZWRJZFN0YXRlcyA9IHNzLmNoZWNrSWRTdGF0ZTsKKyAgICAgICAgfQorCiAgICAgICAgIHJlcXVlc3RMYXlvdXQoKTsKICAgICB9CiAKQEAgLTE1NzUsNiArMTk3OSwxMSBAQAogICAgICAgICAgICAgICAgIHRyZWVPYnNlcnZlci5hZGRPbkdsb2JhbExheW91dExpc3RlbmVyKHRoaXMpOwogICAgICAgICAgICAgfQogICAgICAgICB9CisgICAgICAgIAorICAgICAgICBpZiAobUFkYXB0ZXIgIT0gbnVsbCAmJiBtRGF0YVNldE9ic2VydmVyID09IG51bGwpIHsKKyAgICAgICAgICAgIG1EYXRhU2V0T2JzZXJ2ZXIgPSBuZXcgQWRhcHRlckRhdGFTZXRPYnNlcnZlcigpOworICAgICAgICAgICAgbUFkYXB0ZXIucmVnaXN0ZXJEYXRhU2V0T2JzZXJ2ZXIobURhdGFTZXRPYnNlcnZlcik7CisgICAgICAgIH0KICAgICB9CiAKICAgICBAT3ZlcnJpZGUKQEAgLTE1OTUsNiArMjAwNCwxMSBAQAogICAgICAgICAgICAgICAgIG1HbG9iYWxMYXlvdXRMaXN0ZW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GUgaW50IG1TY3JvbGxEdXJhdGlvbjsKICAgICAgICAgcHJpdmF0ZSBmaW5hbCBpbnQgbUV4dHJhU2Nyb2xsOworCisgICAgICAgIHByaXZhdGUgaW50IG1PZmZzZXRGcm9tVG9wOwogICAgICAgICAKICAgICAgICAgUG9zaXRpb25TY3JvbGxlcigpIHsKICAgICAgICAgICAgIG1FeHRyYVNjcm9sbCA9IFZpZXdDb25maWd1cmF0aW9uLmdldChtQ29udGV4dCkuZ2V0U2NhbGVkRmFkaW5nRWRnZUxlbmd0aCgpOwpAQCAtMjYxOSwxMiArMzA0Nyw0NiBAQAogICAgICAgICAgICAgCiAgICAgICAgICAgICBwb3N0KHRoaXMpOwogICAgICAgICB9Ci0gICAgICAgIAorCisgICAgICAgIHZvaWQgc3RhcnRXaXRoT2Zmc2V0KGludCBwb3NpdGlvbiwgaW50IG9mZnNldCkgeworICAgICAgICAgICAgbVRhcmdldFBvcyA9IHBvc2l0aW9uOworICAgICAgICAgICAgbU9mZnNldEZyb21Ub3AgPSBvZmZzZXQ7CisgICAgICAgICAgICBtQm91bmRQb3MgPSBJTlZBTElEX1BPU0lUSU9OOworICAgICAgICAgICAgbUxhc3RTZWVuUG9zID0gSU5WQUxJRF9QT1NJVElPTjsKKyAgICAgICAgICAgIG1Nb2RlID0gTU9WRV9PRkZTRVQ7CisKKyAgICAgICAgICAgIGZpbmFsIGludCBmaXJzdFBvcyA9IG1GaXJzdFBvc2l0aW9uOworICAgICAgICAgICAgZmluYWwgaW50IGNoaWxkQ291bnQgPSBnZXRDaGlsZENvdW50KCk7CisgICAgICAgICAgICBmaW5hbCBpbnQgbGFzdFBvcyA9IGZpcnN0UG9zICsgY2hpbGRDb3VudCAtIDE7CisKKyAgICAgICAgICAgIGludCB2aWV3VHJhdmVsQ291bnQgPSAwOworICAgICAgICAgICAgaWYgKHBvc2l0aW9uIDwgZmlyc3RQb3MpIHsKKyAgICAgICAgICAgICAgICB2aWV3VHJhdmVsQ291bnQgPSBmaXJzdFBvcyAtIHBvc2l0aW9uOworICAgICAgICAgICAgfSBlbHNlIGlmIChwb3NpdGlvbiA+IGxhc3RQb3MpIHsKKyAgICAgICAgICAgICAgICB2aWV3VHJhdmVsQ291bnQgPSBwb3NpdGlvbiAtIGxhc3RQb3M7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIC8vIE9uLXNjcmVlbiwganVzdCBzY3JvbGwuCisgICAgICAgICAgICAgICAgZmluYWwgaW50IHRhcmdldFRvcCA9IGdldENoaWxkQXQocG9zaXRpb24gLSBmaXJzdFBvcykuZ2V0VG9wKCk7CisgICAgICAgICAgICAgICAgc21vb3RoU2Nyb2xsQnkodGFyZ2V0VG9wIC0gb2Zmc2V0LCBTQ1JPTExfRFVSQVRJT04pOworICAgICAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgLy8gRXN0aW1hdGUgaG93IG1hbnkgc2NyZWVucyB3ZSBzaG91bGQgdHJhdmVsCisgICAgICAgICAgICBmaW5hbCBmbG9hdCBzY3JlZW5UcmF2ZWxDb3VudCA9IHZpZXdUcmF2ZWxDb3VudCAvIGNoaWxkQ291bnQ7CisgICAgICAgICAgICBtU2Nyb2xsRHVyYXRpb24gPSAoaW50KSAoU0NST0xMX0RVUkFUSU9OIC8gc2NyZWVuVHJhdmVsQ291bnQpOworICAgICAgICAgICAgbUxhc3RTZWVuUG9zID0gSU5WQUxJRF9QT1NJVElPTjsKKyAgICAgICAgICAgIHBvc3QodGhpcyk7CisgICAgICAgIH0KKwogICAgICAgICB2b2lkIHN0b3AoKSB7CiAgICAgICAgICAgICByZW1vdmVDYWxsYmFja3ModGhpcyk7CiAgICAgICAgIH0KLSAgICAgICAgCisKICAgICAgICAgcHVibGljIHZvaWQgcnVuKCkgeworICAgICAgICAgICAgaWYgKG1Ub3VjaE1vZGUgIT0gVE9VQ0hfTU9ERV9GTElORyAmJiBtTGFzdFNlZW5Qb3MgIT0gSU5WQUxJRF9QT1NJVElPTikgeworICAgICAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgICAgIH0KKwogICAgICAgICAgICAgZmluYWwgaW50IGxpc3RIZWlnaHQgPSBnZXRIZWlnaHQoKTsKICAgICAgICAgICAgIGZpbmFsIGludCBmaXJzdFBvcyA9IG1GaXJzdFBvc2l0aW9uOwogICAgICAgICAgICAgCkBAIC0yNzQ5LDYgKzMyMTEsMjcgQEAKICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgIH0KIAorICAgICAgICAgICAgY2FzZSBNT1ZFX09GRlNFVDogeworICAgICAgICAgICAgICAgIGZpbmFsIGludCBjaGlsZENvdW50ID0gZ2V0Q2hpbGRDb3VudCgpOworCisgICAgICAgICAgICAgICAgbUxhc3RTZWVuUG9zID0gZmlyc3RQb3M7CisgICAgICAgICAgICAgICAgZmluYWwgaW50IHBvc2l0aW9uID0gbVRhcmdldFBvczsKKyAgICAgICAgICAgICAgICBmaW5hbCBpbnQgbGFzdFBvcyA9IGZpcnN0UG9zICsgY2hpbGRDb3VudCAtIDE7CisKKyAgICAgICAgICAgICAgICBpZiAocG9zaXRpb24gPCBmaXJzdFBvcykgeworICAgICAgICAgICAgICAgICAgICBzbW9vdGhTY3JvbGxCeSgtZ2V0SGVpZ2h0KCksIG1TY3JvbGxEdXJhdGlvbik7CisgICAgICAgICAgICAgICAgICAgIHBvc3QodGhpcyk7CisgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChwb3NpdGlvbiA+IGxhc3RQb3MpIHsKKyAgICAgICAgICAgICAgICAgICAgc21vb3RoU2Nyb2xsQnkoZ2V0SGVpZ2h0KCksIG1TY3JvbGxEdXJhdGlvbik7CisgICAgICAgICAgICAgICAgICAgIHBvc3QodGhpcyk7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gT24tc2NyZWVuLCBqdXN0IHNjcm9sbC4KKyAgICAgICAgICAgICAgICAgICAgZmluYWwgaW50IHRhcmdldFRvcCA9IGdldENoaWxkQXQocG9zaXRpb24gLSBmaXJzdFBvcykuZ2V0VG9wKCk7CisgICAgICAgICAgICAgICAgICAgIHNtb290aFNjcm9sbEJ5KHRhcmdldFRvcCAtIG1PZmZzZXRGcm9tVG9wLCBtU2Nyb2xsRHVyYXRpb24pOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKwogICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgIH0KQEAgLTI3NjgsNiArMzI1MSwyNCBAQAogICAgIH0KICAgICAKICAgICAvKioKKyAgICAgKiBTbW9vdGhseSBzY3JvbGwgdG8gdGhlIHNwZWNpZmllZCBhZGFwdGVyIHBvc2l0aW9uLiBUaGUgdmlldyB3aWxsIHNjcm9sbAorICAgICAqIHN1Y2ggdGhhdCB0aGUgaW5kaWNhdGVkIHBvc2l0aW9uIGlzIGRpc3BsYXllZCA8Y29kZT5vZmZzZXQ8L2NvZGU+IHBpeGVscyBmcm9tCisgICAgICogdGhlIHRvcCBlZGdlIG9mIHRoZSB2aWV3LiBJZiB0aGlzIGlzIGltcG9zc2libGUsIChlLmcuIHRoZSBvZmZzZXQgd291bGQgc2Nyb2xsCisgICAgICogdGhlIGZpcnN0IG9yIGxhc3QgaXRlbSBiZXlvbmQgdGhlIGJvdW5kYXJpZXMgb2YgdGhlIGxpc3QpIGl0IHdpbGwgZ2V0IGFzIGNsb3NlCisgICAgICogYXMgcG9zc2libGUuCisgICAgICoKKyAgICAgKiBAcGFyYW0gcG9zaXRpb24gUG9zaXRpb24gdG8gc2Nyb2xsIHRvCisgICAgICogQHBhcmFtIG9mZnNldCBEZXNpcmVkIGRpc3RhbmNlIGluIHBpeGVscyBvZiA8Y29kZT5wb3NpdGlvbjwvY29kZT4gZnJvbSB0aGUgdG9wCisgICAgICogICAgICAgICAgICAgICBvZiB0aGUgdmlldyB3aGVuIHNjcm9sbGlu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KKyAgICAgICAgfSBlbHNlIGlmIChwb3NpdGlvbiA+IDApIHsKKyAgICAgICAgICAgIGluZGV4ID0gZ2V0TGFzdFZpc2libGVQb3NpdGlvbigpOworICAgICAgICB9CisKKyAgICAgICAgaWYgKGluZGV4ID4gLTEpIHsKKyAgICAgICAgICAgIFZpZXcgY2hpbGQgPSBnZXRDaGlsZEF0KGluZGV4IC0gZ2V0Rmlyc3RWaXNpYmxlUG9zaXRpb24oKSk7CisgICAgICAgICAgICBpZiAoY2hpbGQgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIFJlY3QgdmlzaWJsZVJlY3QgPSBuZXcgUmVjdCgpOworICAgICAgICAgICAgICAgIGlmIChjaGlsZC5nZXRHbG9iYWxWaXNpYmxlUmVjdCh2aXNpYmxlUmVjdCkpIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gdGhlIGNoaWxkIGlzIHBhcnRpYWxseSB2aXNpYmxlCisgICAgICAgICAgICAgICAgICAgIGludCBjaGlsZFJlY3RBcmVhID0gY2hpbGQuZ2V0V2lkdGgoKSAqIGNoaWxkLmdldEhlaWdodCgpOworICAgICAgICAgICAgICAgICAgICBpbnQgdmlzaWJsZVJlY3RBcmVhID0gdmlzaWJsZVJlY3Qud2lkdGgoKSAqIHZpc2libGVSZWN0LmhlaWdodCgpOworICAgICAgICAgICAgICAgICAgICBmbG9hdCB2aXNpYmxlQXJlYSA9ICh2aXNpYmxlUmVjdEFyZWEgLyAoZmxvYXQpIGNoaWxkUmVjdEFyZWEpOworICAgICAgICAgICAgICAgICAgICBmaW5hbCBmbG9hdCB2aXNpYmxlVGhyZXNob2xkID0gMC43NWY7CisgICAgICAgICAgICAgICAgICAgIGlmICgocG9zaXRpb24gPCAwKSAmJiAodmlzaWJsZUFyZWEgPCB2aXNpYmxlVGhyZXNob2xkKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgLy8gdGhlIHRvcCBpbmRleCBpcyBub3QgcGVyY2VpdmFibHkgdmlzaWJsZSBzbyBvZmZzZXQKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIHRvIGFjY291bnQgZm9yIHNob3dpbmcgdGhhdCB0b3AgaW5kZXggYXMgd2VsbAorICAgICAgICAgICAgICAgICAgICAgICAgKytpbmRleDsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICgocG9zaXRpb24gPiAwKSAmJiAodmlzaWJsZUFyZWEgPCB2aXNpYmxlVGhyZXNob2xkKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgLy8gdGhlIGJvdHRvbSBpbmRleCBpcyBub3QgcGVyY2VpdmFibHkgdmlzaWJsZSBzbyBvZmZzZXQKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIHRvIGFjY291bnQgZm9yIHNob3dpbmcgdGhhdCBib3R0b20gaW5kZXggYXMgd2VsbAorICAgICAgICAgICAgICAgICAgICAgICAgLS1pbmRleDsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBzbW9vdGhTY3JvbGxUb1Bvc2l0aW9uKE1hdGgubWF4KDAsIE1hdGgubWluKGdldENvdW50KCksIGluZGV4ICsgcG9zaXRpb24pKSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKICAgICBwcml2YXRlIHZvaWQgY3JlYXRlU2Nyb2xsaW5nQ2FjaGUoKSB7CiAgICAgICAgIGlmIChtU2Nyb2xsaW5nQ2FjaGVFbmFibGVkICYmICFtQ2FjaGluZ1N0YXJ0ZWQpIHsKICAgICAgICAgICAgIHNldENoaWxkcmVuRHJhd25XaXRoQ2FjaGVFbmFibGVkKHRydWUpOwpAQCAtMzE1NSw2ICszNjkyLDcgQEAKIAogICAgICAgICBtUmVzdXJyZWN0VG9Qb3NpdGlvbiA9IElOVkFMSURfUE9TSVRJT047CiAgICAgICAgIHJlbW92ZUNhbGxiYWNrcyhtRmxpbmdSdW5uYWJsZSk7CisgICAgICAgIHJlbW92ZUNhbGxiYWNrcyhtU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mFwcGVkLm9uRGVzdHJveUFjdGlvbk1vZGUobW9kZSk7CisgICAgICAgICAgICBtQ2hvaWNlQWN0aW9uTW9kZSA9IG51bGw7CisKKyAgICAgICAgICAgIC8vIEVuZGluZyBzZWxlY3Rpb24gbW9kZSBtZWFucyBkZXNlbGVjdGluZyBldmVyeXRoaW5nLgorICAgICAgICAgICAgY2xlYXJDaG9pY2VzKCk7CisKKyAgICAgICAgICAgIG1EYXRhQ2hhbmdlZCA9IHRydWU7CisgICAgICAgICAgICByZW1lbWJlclN5bmNTdGF0ZSgpOworICAgICAgICAgICAgcmVxdWVzdExheW91dCgpOworCisgICAgICAgICAgICBzZXRMb25nQ2xpY2thYmxlKHRydWUpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgb25JdGVtQ2hlY2tlZFN0YXRlQ2hhbmdlZChBY3Rpb25Nb2RlIG1vZGUsCisgICAgICAgICAgICAgICAgaW50IHBvc2l0aW9uLCBsb25nIGlkLCBib29sZWFuIGNoZWNrZWQpIHsKKyAgICAgICAgICAgIG1XcmFwcGVkLm9uSXRlbUNoZWNrZWRTdGF0ZUNoYW5nZWQobW9kZSwgcG9zaXRpb24sIGlkLCBjaGVja2VkKTsKKworICAgICAgICAgICAgLy8gSWYgdGhlcmUgYXJlIG5vIGl0ZW1zIHNlbGVjdGVkIHdlIG5vIGxvbmdlciBuZWVkIHRoZSBzZWxlY3Rpb24gbW9kZS4KKyAgICAgICAgICAgIGlmIChnZXRDaGVja2VkSXRlbUNvdW50KCkgPT0gMCkgeworICAgICAgICAgICAgICAgIG1vZGUuZmluaXNoKCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKICAgICAgKiBBYnNMaXN0VmlldyBleHRlbmRzIExheW91dFBhcmFtcyB0byBwcm92aWRlIGEgcGxhY2UgdG8gaG9sZCB0aGUgdmlldyB0eXBlLgogICAgICAqLwogICAgIHB1YmxpYyBzdGF0aWMgY2xhc3MgTGF5b3V0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lld0FuaW1hdG9yKENvbnRleHQgY29udGV4dCkgeworICAgICAgICBzdXBlcihjb250ZXh0KTsKKyAgICAgICAgaW5pdFZpZXdBbmltYXRvcigpOworICAgIH0KKworICAgIHB1YmxpYyBBZGFwdGVyVmlld0FuaW1hdG9yKENvbnRleHQgY29udGV4dCwgQXR0cmlidXRlU2V0IGF0dHJzKSB7CisgICAgICAgIHN1cGVyKGNvbnRleHQsIGF0dHJzKTsKKworICAgICAgICBUeXBlZEFycmF5IGEgPSBjb250ZXh0Lm9idGFpblN0eWxlZEF0dHJpYnV0ZXMoYXR0cnMsCisgICAgICAgICAgICAgICAgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHlsZWFibGUuVmlld0FuaW1hdG9yKTsKKyAgICAgICAgaW50IHJlc291cmNlID0gYS5nZXRSZXNvdXJjZUlkKAorICAgICAgICAgICAgICAgIGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3R5bGVhYmxlLlZpZXdBbmltYXRvcl9pbkFuaW1hdGlvbiwgMCk7CisgICAgICAgIGlmIChyZXNvdXJjZSA+IDApIHsKKyAgICAgICAgICAgIHNldEluQW5pbWF0aW9uKGNvbnRleHQsIHJlc291cmNlKTsKKyAgICAgICAgfQorCisgICAgICAgIHJlc291cmNlID0gYS5nZXRSZXNvdXJjZUlkKGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3R5bGVhYmxlLlZpZXdBbmltYXRvcl9vdXRBbmltYXRpb24sIDApOworICAgICAgICBpZiAocmVzb3VyY2UgPiAwKSB7CisgICAgICAgICAgICBzZXRPdXRBbmltYXRpb24oY29udGV4dCwgcmVzb3VyY2UpOworICAgICAgICB9CisKKyAgICAgICAgYm9vbGVhbiBmbGFnID0gYS5nZXRCb29sZWFuKAorICAgICAgICAgICAgICAgIGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3R5bGVhYmxlLlZpZXdBbmltYXRvcl9hbmltYXRlRmlyc3RWaWV3LCB0cnVlKTsKKyAgICAgICAgc2V0Q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GF5b3V0KCk7CisgICAgICAgIG1DdXJyZW50V2luZG93U3RhcnQgPSAwOworICAgICAgICBtQ3VycmVudFdpbmRvd0VuZCA9IC0xOworICAgICAgICBtU2hvdWxkTG9vcCA9IHNob3VsZExvb3A7CisgICAgfQorCisgICAgLyoqCisgICAgICogVGhpcyBjbGFzcyBzaG91bGQgYmUgb3ZlcnJpZGRlbiBieSBzdWJjbGFzc2VzIHRvIGN1c3RvbWl6ZSB2aWV3IHRyYW5zaXRpb25zIHdpdGhpbgorICAgICAqIHRoZSBzZXQgb2YgdmlzaWJsZSB2aWV3cworICAgICAqCisgICAgICogQHBhcmFtIGZyb21JbmRleCBUaGUgcmVsYXRpdmUgaW5kZXggd2l0aGluIHRoZSB3aW5kb3cgdGhhdCB0aGUgdmlldyB3YXMgaW4sIC0xIGlmIGl0IHdhc24ndAorICAgICAqICAgICAgICBpbiB0aGUgd2luZG93CisgICAgICogQHBhcmFtIHRvSW5kZXggVGhlIHJlbGF0aXZlIGluZGV4IHdpdGhpbiB0aGUgd2luZG93IHRoYXQgdGhlIHZpZXcgaXMgZ29pbmcgdG8sIC0xIGlmIGl0IGlzCisgICAgICogICAgICAgIGJlaW5nIHJlbW92ZWQKKyAgICAgKiBAcGFyYW0gdmlldyBUaGUgdmlldyB0aGF0IGlzIGJlaW5nIGFuaW1hdGVkCisgICAgICovCisgICAgdm9pZCBhbmltYXRlVmlld0ZvclRyYW5zaXRpb24oaW50IGZyb21JbmRleCwgaW50IHRvSW5kZXgsIFZpZXcgdmlldykgeworICAgICAgICBQcm9wZXJ0eUFuaW1hdG9yIHBhOworICAgICAgICBpZiAoZnJvbUluZGV4ID09IC0xKSB7CisgICAgICAgICAgICB2aWV3LnNldEFscGhhKDAuMGYpOworICAgICAgICAgICAgcGEgPSBuZXcgUHJvcGVydHlBbmltYXRvcig0MDAsIHZpZXcsICJhbHBoYSIsIDAuMGYsIDEuMGYpOworICAgICAgICAgICAgcGEuc3RhcnQoKTsKKyAgICAgICAgfSBlbHNlIGlmICh0b0luZGV4ID09IC0xKSB7CisgICAgICAgICAgICBwYSA9IG5ldyBQcm9wZXJ0eUFuaW1hdG9yKDQwMCwgdmlldywgImFscGhhIiwgMS4wZiwgMC4wZik7CisgICAgICAgICAgICBwYS5zdGFydCgpOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogU2V0cyB3aGljaCBjaGlsZCB2aWV3IHdpbGwgYmUgZGlzcGxheWVkLgorICAgICAqCisgICAgICogQHBhcmFtIHdoaWNoQ2hpbGQgdGhlIGluZGV4IG9mIHRoZSBjaGlsZCB2aWV3IHRvIGRpc3BsYXkKKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBzZXREaXNwbGF5ZWRDaGlsZChpbnQgd2hpY2hDaGlsZCkgeworICAgICAgICBpZiAobUFkYXB0ZXIgIT0gbnVsbCkgeworICAgICAgICAgICAgbVdoaWNoQ2hpbGQgPSB3aGljaENoaWxkOworICAgICAgICAgICAgaWYgKHdoaWNoQ2hpbGQgPj0gbUFkYXB0ZXIuZ2V0Q291bnQoKSkgeworICAgICAgICAgICAgICAgIG1XaGljaENoaWxkID0gbVNob3VsZExvb3AgPyAwIDogbUFkYXB0ZXIuZ2V0Q291bnQoKSAtIDE7CisgICAgICAgICAgICB9IGVsc2UgaWYgKHdoaWNoQ2hpbGQgPCAwKSB7CisgICAgICAgICAgICAgICAgbVdoaWNoQ2hpbGQgPSBtU2hvdWxkTG9vcCA/IG1BZGFwdGVyLmdldENvdW50KCkgLSAxIDogMDsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgYm9vbGVhbiBoYXNGb2N1cyA9IGdldEZvY3VzZWRDaGlsZCgpICE9IG51bGw7CisgICAgICAgICAgICAvLyBUaGlzIHdpbGwgY2xlYXIgb2xkIGZvY3VzIGlmIHdlIGhhZCBpdAorICAgICAgICAgICAgc2hvd09ubHkobVdoaWNoQ2hpbGQpOworICAgICAgICAgICAgaWYgKGhhc0ZvY3VzKSB7CisgICAgICAgICAgICAgICAgLy8gVHJ5IHRvIHJldGFrZSBmb2N1cyBpZiB3ZSBoYWQgaXQKKyAgICAgICAgICAgICAgICByZXF1ZXN0Rm9jdXMoRk9DVVNfRk9SV0FSRCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBSZXR1cm4gZGVmYXVsdCBpbkFuaW1hdGlvbi4gVG8gYmUgb3ZlcnJpZGVuIGJ5IHN1YmNsYXNzZXMuCisgICAgICovCisgICAgQW5pbWF0aW9uIGdldERlZmF1bHRJbkFuaW1hdGlvbigpIHsKKyAgICAgICAgcmV0dXJuIG51bGw7CisgICAgfQorCisgICAgLyoqCisgICAgICogUmV0dXJuIGRlZmF1bHQgb3V0QW5pbWF0aW9uLiBUbyBiZSBvdmVycmlkZGVuIGJ5IHN1YmNsYXNzZXMuCisgICAgICovCisgICAgQW5pbWF0aW9uIGdldERlZmF1bHRPdXRBbmltYXRpb24oKSB7CisgICAgICAgIHJldHVybiBudWxsOworICAgIH0KKworICAgIC8qKgorICAgICAqIFRvIGJlIG92ZXJyaWRkZW4gYnkgc3ViY2xhc3Nlcy4gVGhpcyBtZXRob2QgYXBwbGllcyBhIHZpZXcgLyBpbmRleCBzcGVjaWZpYworICAgICAqIHRyYW5zZm9ybSB0byB0aGUgY2hpbGQgdmlldy4KKyAgICAgKgorICAgICAqIEBwYXJhbSBjaGlsZAorICAgICAqIEBwYXJhbSByZWxhdGl2ZUluZGV4CisgICAgICovCisgICAgdm9pZCBhcHBseVRyYW5zZm9ybUZvckNoaWxkQXRJbmRleChWaWV3IGNoaWxkLCBpbnQgcmVsYXRpdmVJbmRleCkgeworICAgIH0KKworICAgIC8qKgorICAgICAqIFJldHVybnMgdGhlIGluZGV4IG9mIHRoZSBjdXJyZW50bHkgZGlzcGxheWVkIGNoaWxkIHZpZXcuCisgICAgICovCisgICAgcHVibGljIGludCBnZXREaXNwbGF5ZWRDaGlsZCgpIHsKKyAgICAgICAgcmV0dXJuIG1XaGljaENoaWxkOworICAgIH0KKworICAgIC8qKgorICAgICAqIE1hbnVhbGx5IHNob3dzIHRoZSBuZXh0IGNoaWxkLgorICAgICAqLworICAgIHB1YmxpYyB2b2lkIHNob3dOZXh0KCkgeworICAgICAgICBzZXREaXNwbGF5ZWRDaGlsZChtV2hpY2hDaGlsZCArIDEpOworICAgIH0KKworICAgIC8qKgorICAgICAqIE1hbnVhbGx5IHNob3dzIHRoZSBwcmV2aW91cyBjaGlsZC4KKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBzaG93UHJldmlvdXMoKSB7CisgICAgICAgIHNldERpc3BsYXllZENoaWxkKG1XaGljaENoaWxkIC0gMSk7CisgICAgfQorCisgICAgLyoqCisgICAgICogU2hvd3Mgb25seSB0aGUgc3BlY2lmaWVkIGNoaWxkLiBUaGUgb3RoZXIgZGlzcGxheXMgVmlld3MgZXhpdCB0aGUgc2NyZWVuLAorICAgICAqIG9wdGlvbmFsbHkgd2l0aCB0aGUgd2l0aCB0aGUge0BsaW5rICNnZXRPdXRBbmltYXRpb24oKSBvdXQgYW5pbWF0aW9ufSBhbmQKKyAgICAgKiB0aGUgc3BlY2lmaWVkIGNoaWxkIGVudGVycyB0aGUgc2NyZWVuLCBvcHRpb25hbGx5IHdpdGggdGhlCisgICAgICoge0BsaW5rICNnZXRJbkFuaW1hdGlvbigpIGluIGFuaW1hdGlvbn0uCisgICAgICoKKyAgICAgKiBAcGFyYW0gY2hpbGRJbmRleCBUaGUgaW5kZXggb2YgdGhlIGNoaWxkIHRvIGJlIHNob3duLgorICAgICAqIEBwYXJhbSBhbmltYXRlIFdoZXRoZXIgb3Igbm90IHRvIHVzZSB0aGUgaW4gYW5kIG91dCBhbmltYXRpb25zLCBkZWZhdWx0cworICAgICAqICAgICAgICAgICAgdG8gdHJ1ZS4KKyAgICAgKi8KKyAgICB2b2lkIHNob3dPbmx5KGludCBjaGlsZEluZGV4LCBib29sZWFuIGFuaW1hdGUpIHsKKyAgICA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zKCk7CisgICAgICAgIGlmIChjdXJyZW50THAgaW5zdGFuY2VvZiBMYXlvdXRQYXJhbXMpIHsKKyAgICAgICAgICAgIExheW91dFBhcmFtcyBscCA9IChMYXlvdXRQYXJhbXMpIGN1cnJlbnRMcDsKKyAgICAgICAgICAgIGxwLnNldEhvcml6b250YWxPZmZzZXQoMCk7CisgICAgICAgICAgICBscC5zZXRWZXJ0aWNhbE9mZnNldCgwKTsKKyAgICAgICAgICAgIHJldHVybiBscDsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gbmV3IExheW91dFBhcmFtcyh2KTsKKyAgICB9CisKKyAgICB2b2lkIHNob3dPbmx5KGludCBjaGlsZEluZGV4LCBib29sZWFuIGFuaW1hdGUsIGJvb2xlYW4gb25MYXlvdXQpIHsKKyAgICAgICAgaWYgKG1BZGFwdGVyID09IG51bGwpIHJldHVybjsKKworICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IG1QcmV2aW91c1ZpZXdzLnNpemUoKTsgaSsrKSB7CisgICAgICAgICAgICBWaWV3IHZpZXdUb1JlbW92ZSA9IG1QcmV2aW91c1ZpZXdzLmdldChpKTsKKyAgICAgICAgICAgIHZpZXdUb1JlbW92ZS5jbGVhckFuaW1hdGlvbigpOworICAgICAgICAgICAgaWYgKHZpZXdUb1JlbW92ZSBpbnN0YW5jZW9mIFZpZXdHcm91cCkgeworICAgICAgICAgICAgICAgIFZpZXdHcm91cCB2ZyA9IChWaWV3R3JvdXApIHZpZXdUb1JlbW92ZTsKKyAgICAgICAgICAgICAgICB2Zy5yZW1vdmVBbGxWaWV3c0luTGF5b3V0KCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICAvLyBhcHBseVRyYW5zZm9ybUZvckNoaWxkQXRJbmRleCBoZXJlIGp1c3QgYWxsb3dzIGZvciBhbnkgY2xlYW51cAorICAgICAgICAgICAgLy8gYXNzb2NpYXRlZCB3aXRoIHRoaXMgdmlldyB0aGF0IG1heSBuZWVkIHRvIGJlIGRvbmU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ib3VuZGVkOyBpIDwgbmV3V2luZG93RW5kVW5ib3VuZGVkOyBpKyspIHsKKyAgICAgICAgICAgIGlmIChpIDwgbmV3V2luZG93U3RhcnQgfHwgaSA+IG5ld1dpbmRvd0VuZCkgeworICAgICAgICAgICAgICAgIGludCBpbmRleCA9IG1vZHVsbyhpLCBtTnVtQWN0aXZlVmlld3MpOworICAgICAgICAgICAgICAgIGlmIChtQWN0aXZlVmlld3NbaW5kZXhdICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgVmlldyBwcmV2aW91c1ZpZXcgPSBtQWN0aXZlVmlld3NbaW5kZXhdOworICAgICAgICAgICAgICAgICAgICBtUHJldmlvdXNWaWV3cy5hZGQocHJldmlvdXNWaWV3KTsKKyAgICAgICAgICAgICAgICAgICAgaW50IHByZXZpb3VzVmlld1JlbGF0aXZlSW5kZXggPSBtb2R1bG8oaW5kZXggLSBtQ3VycmVudFdpbmRvd1N0YXJ0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1OdW1BY3RpdmVWaWV3cyk7CisgICAgICAgICAgICAgICAgICAgIGFuaW1hdGVWaWV3Rm9yVHJhbnNpdGlvbihwcmV2aW91c1ZpZXdSZWxhdGl2ZUluZGV4LCAtMSwgcHJldmlvdXNWaWV3KTsKKyAgICAgICAgICAgICAgICAgICAgbUFjdGl2ZVZpZXdzW2luZGV4XSA9IG51bGw7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgLy8gSWYgdGhlIHdpbmRvdyBoYXMgY2hhbmdlZAorICAgICAgICBpZiAoISAobmV3V2luZG93U3RhcnQgPT0gbUN1cnJlbnRXaW5kb3dTdGFydCAmJiBuZXdXaW5kb3dFbmQgPT0gbUN1cnJlbnRXaW5kb3dFbmQpKSB7CisgICAgICAgICAgICAvLyBSdW4gdGhyb3VnaCB0aGUgaW5kaWNlcyBpbiB0aGUgbmV3IHJhbmdlCisgICAgICAgICAgICBmb3IgKGludCBpID0gbmV3V2luZG93U3RhcnQ7IGkgPD0gbmV3V2luZG93RW5kOyBpKyspIHsKKworICAgICAgICAgICAgICAgIGludCBvbGRSZWxhdGl2ZUluZGV4ID0gaSAtIG1DdXJyZW50V2luZG93U3RhcnRVbmJvdW5kZWQ7CisgICAgICAgICAgICAgICAgaW50IG5ld1JlbGF0aXZlSW5kZXggPSBpIC0gbmV3V2luZG93U3RhcnRVbmJvdW5kZWQ7CisgICAgICAgICAgICAgICAgaW50IGluZGV4ID0gbW9kdWxvKGksIG1OdW1BY3RpdmVWaWV3cyk7CisKKyAgICAgICAgICAgICAgICAvLyBJZiB0aGlzIGl0ZW0gaXMgaW4gdGhlIGN1cnJlbnQgd2luZG93LCBncmVhdCwgd2UganVzdCBuZWVkIHRvIGFwcGx5CisgICAgICAgICAgICAgICAgLy8gdGhlIHRyYW5zZm9ybSBmb3IgaXQncyBuZXcgcmVsYXRpdmUgcG9zaXRpb24gaW4gdGhlIHdpbmRvdywgYW5kIGFuaW1hdGUKKyAgICAgICAgICAgICAgICAvLyBiZXR3ZWVuIGl0J3MgY3VycmVudCBhbmQgbmV3IHJlbGF0aXZlIHBvc2l0aW9ucworICAgICAgICAgICAgICAgIGlmIChpID49IG1DdXJyZW50V2luZG93U3RhcnQgJiYgaSA8PSBtQ3VycmVudFdpbmRvd0VuZCkgeworICAgICAgICAgICAgICAgICAgICBWaWV3IHZpZXcgPSBtQWN0aXZlVmlld3NbaW5kZXhdOworICAgICAgICAgICAgICAgICAgICBhcHBseVRyYW5zZm9ybUZvckNoaWxkQXRJbmRleCh2aWV3LCBuZXdSZWxhdGl2ZUluZGV4KTsKKyAgICAgICAgICAgICAgICAgICAgYW5pbWF0ZVZpZXdGb3JUcmFuc2l0aW9uKG9sZFJlbGF0aXZlSW5kZXgsIG5ld1JlbGF0aXZlSW5kZXgsIHZpZXcpOworCisgICAgICAgICAgICAgICAgLy8gT3RoZXJ3aXNlIHRoaXMgdmlldyBpcyBuZXcsIHNvIGZpcnN0IHdlIGhhdmUgdG8gZGlzcGxhY2UgdGhlIHZpZXcgdGhhdCdzCisgICAgICAgICAgICAgICAgLy8gdGFraW5nIHRoZSBuZXcgdmlldydzIHBsYWNlIHdpdGhpbiBvdXIgY2FjaGUgKGEgY2lyY3VsYXIgYXJyYXkpCisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKG1BY3RpdmVWaWV3c1tpbmRleF0gIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgVmlldyBwcmV2aW91c1ZpZXcgPSBtQWN0aXZlVmlld3NbaW5kZXhdOworICAgICAgICAgICAgICAgICAgICAgICAgbVByZXZpb3VzVmlld3MuYWRkKHByZXZpb3VzVmlldyk7CisgICAgICAgICAgICAgICAgICAgICAgICBpbnQgcHJldmlvdXNWaWV3UmVsYXRpdmVJbmRleCA9IG1vZHVsbyhpbmRleCAtIG1DdXJyZW50V2luZG93U3RhcnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1OdW1BY3RpdmVWaWV3cyk7CisgICAgICAgICAgICAgICAgICAgICAgICBhbmltYXRlVmlld0ZvclRyYW5zaXRpb24ocHJldmlvdXNWaWV3UmVsYXRpdmVJbmRleCwgLTEsIHByZXZpb3VzVmlldyk7CisKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtQ3VycmVudFdpbmRvd1N0YXJ0ID4gbmV3V2luZG93U3RhcnQpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBtVmlld3NUb0JyaW5nVG9Gcm9udC5hZGQocHJldmlvdXNWaWV3KTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgIC8vIFdlJ3ZlIGNsZWFyZWQgYSBzcG90IGZvciB0aGUgbmV3IHZpZXcuIEdldCBpdCBmcm9tIHRoZSBhZGFwdGVyLCBhZGQgaXQKKyAgICAgICAgICAgICAgICAgICAgLy8gYW5kIGFwcGx5IGFueSB0cmFuc2Zvcm0gLyBhbmltYXRpb24KKyAgICAgICAgICAgICAgICAgICAgVmlldyBuZXdWaWV3ID0gbUFkYXB0ZXIuZ2V0VmlldyhpLCBudWxsLCB0aGlzKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKG5ld1ZpZXcgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgLy8gV2Ugd3JhcCB0aGUgbmV3IHZpZXcgaW4gYSBGcmFtZUxheW91dCBzbyBhcyB0byByZXNwZWN0IHRoZSBjb250cmFjdAorICAgICAgICAgICAgICAgICAgICAgICAgLy8gd2l0aCB0aGUgYWRhcHRlciwgdGhhdCBpcywgdGhhdCB3ZSBkb24ndCBtb2RpZnkgdGhpcyB2aWV3IGRpcmVjdGx5CisgICAgICAgICAgICAgICAgICAgICAgICBGcmFtZUxheW91dCBmbCA9IG5ldyBGcmFtZUxheW91dChtQ29udGV4dCk7CisgICAgICAgICAgICAgICAgICAgICAgICBmbC5hZGRWaWV3KG5ld1ZpZXcpOworICAgICAgICAgICAgICAgICAgICAgICAgbUFjdGl2ZVZpZXdzW2luZGV4XSA9IGZsOworICAgICAgICAgICAgICAgICAgICAgICAgYWRkVmlld0luTGF5b3V0KGZsLCAtMSwgY3JlYXRlT3JSZXVzZUxheW91dFBhcmFtcyhmbCkpOworICAgICAgICAgICAgICAgICAgICAgICAgYXBwbHlUcmFuc2Zvcm1Gb3JDaGlsZEF0SW5kZXgoZmwsIG5ld1JlbGF0aXZlSW5kZXgpOworICAgICAgICAgICAgICAgICAgICAgICAgYW5pbWF0ZVZpZXdGb3JUcmFuc2l0aW9uKC0xLCBuZXdSZWxhdGl2ZUluZGV4LCBmbCk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgbUFjdGl2ZVZpZXdzW2luZGV4XS5icmluZ1RvRnJvbnQoKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBtVmlld3NUb0JyaW5nVG9Gcm9udC5zaXplKCk7IGkrKykgeworICAgICAgICAgICAgICAgIFZpZXcgdiA9IG1WaWV3c1RvQnJpbmdUb0Zyb250LmdldChpKTsKKyAgICAgICAgICAgICAgICB2LmJyaW5nVG9Gcm9udCgpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgbVZpZXdzVG9CcmluZ1RvRnJvbnQuY2xlYXIoKTsKKworICAgICAgICAgICAgbUN1cnJlbnRXaW5kb3dTdGFydCA9IG5ld1dpbmRvd1N0YXJ0OworICAgICAgICAgICAgbUN1cnJlbnRXaW5kb3dFbmQgPSBuZXdXaW5kb3dFbmQ7CisgICAgICAgICAgICBtQ3VycmVudFdpbmRvd1N0YXJ0VW5ib3VuZGVkID0gbmV3V2luZG93U3RhcnRVbmJvdW5kZWQ7CisgICAgICAgIH0KKworICAgICAgICBtRmlyc3RUaW1lID0gZmFsc2U7CisgICAgICAgIGlmICghb25MYXlvdXQpIHsKKyAgICAgICAgICAgIHJlcXVlc3RMYXlvdXQoKTsKKyAgICAgICAgICAgIGludmFsaWRhdGUoKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIC8vIElmIHRoZSBBZGFwdGVyIHRyaWVzIHRvIGxheW91dCB0aGUgY3VycmVudCB2aWV3IHdoZW4gd2UgZ2V0IGl0IHVzaW5nIGdldFZpZXcKKyAgICAgICAgICAgIC8vIGFib3ZlIHRoZSBsYXlvdXQgd2lsbCBlbmQgdXAgYmVpbmcgaWdub3JlZCBzaW5jZSB3ZSBhcmUgY3VycmVudGx5IGxheWluZyBvdXQsIHNvCisgICAgICAgICAgICAvLyB3ZSBwb3N0IGEgZGVsYXllZCByZXF1ZXN0TGF5b3V0IGFuZCBpbnZhbGlkYXRlCisgICAgICAgICAgICBtTWFpblF1ZXVlLnBvc3QobmV3IFJ1bm5hYmxlKCkgeworICAgICAgICAgICAgICAgIEBPdmVycmlkZQorICAgICAgICAgICAgICAgIHB1YmxpYyB2b2lkIHJ1bigpIHsKKyAgICAgICAgICAgICAgICAgICAgcmVxdWVzdExheW91dCgpOworICAgICAgICAgICAgICAgICAgICBpbnZhbGlkYXRlKCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwcm90ZWN0ZWQgdm9pZCBvbkxheW91dChib29sZWFuIGNoYW5nZWQsIGludCBsZWZ0LCBpbnQgdG9wLCBpbnQgcmlnaHQsIGludCBib3R0b20pIHsKKyAgICAgICAgYm9vbGVhbiBkYXRhQ2hhbmdlZCA9IG1EYXRhQ2hhbmdlZDsKKyAgICAgICAgaWYgKGRhdGFDaGFuZ2VkKSB7CisgICAgICAgICAgICBoYW5kbGVEYXRhQ2hhbmdlZCgpOworCisgICAgICAgICAgICAvLyBpZiB0aGUgZGF0YSBjaGFuZ2VzLCBtV2hpY2hDaGlsZCBtaWdodCBiZSBvdXQgb2YgdGhlIGJvdW5kcyBvZiB0aGUgYWRhcHRlcgorICAgICAgICAgICAgLy8gaW4gdGhpcyBjYXNlLCB3ZSByZXNldCBtV2hpY2hDaGlsZCB0byB0aGUgYmVnaW5uaW5nCisgICAgICAgICAgICBpZiAobVdoaWNoQ2hpbGQgPj0gbUFkYXB0ZXIuZ2V0Q291bnQoKSkKKyAgICAgICAgICAgICAgICBtV2hpY2hDaGlsZCA9IDA7CisKKyAgICAgICAgICAgIHNob3dPbmx5KG1XaGljaENoaWxkLCB0cnVlLCB0cnVlKTsKKyAgICAgICAgfQorCisgICAgICAgIGZpbmFsIGludCBjaGlsZENvdW50ID0gZ2V0Q2hpbGRDb3VudCgpOworICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGNoaWxkQ291bnQ7IGkrKykgeworICAgICAgICAgICAgZmluYWwgVmlldyBjaGlsZCA9IGdldENoaWxkQXQoaSk7CisKKyAgICAgICAgICAgIGludCBjaGl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ICAgICAgICAqLworICAgICAgICBwcml2YXRlIFNhdmVkU3RhdGUoUGFyY2VsIGluKSB7CisgICAgICAgICAgICBzdXBlcihpbik7CisgICAgICAgICAgICB3aGljaENoaWxkID0gaW4ucmVhZEludCgpOworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyB2b2lkIHdyaXRlVG9QYXJjZWwoUGFyY2VsIG91dCwgaW50IGZsYWdzKSB7CisgICAgICAgICAgICBzdXBlci53cml0ZVRvUGFyY2VsKG91dCwgZmxhZ3MpOworICAgICAgICAgICAgb3V0LndyaXRlSW50KHdoaWNoQ2hpbGQpOworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyBTdHJpbmcgdG9TdHJpbmcoKSB7CisgICAgICAgICAgICByZXR1cm4gIkFkYXB0ZXJWaWV3QW5pbWF0b3IuU2F2ZWRTdGF0ZXsgd2hpY2hDaGlsZCA9ICIgKyB3aGljaENoaWxkICsgIiB9IjsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgUGFyY2VsYWJsZS5DcmVhdG9yPFNhdmVkU3RhdGU+IENSRUFUT1IKKyAgICAgICAgICAgICAgICA9IG5ldyBQYXJjZWxhYmxlLkNyZWF0b3I8U2F2ZWRTdGF0ZT4oKSB7CisgICAgICAgICAgICBwdWJsaWMgU2F2ZWRTdGF0ZSBjcmVhdGVGcm9tUGFyY2VsKFBhcmNlbCBpbikgeworICAgICAgICAgICAgICAgIHJldHVybiBuZXcgU2F2ZWRTdGF0ZShpbik7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHB1YmxpYyBTYXZlZFN0YXRlW10gbmV3QXJyYXkoaW50IHNpemUpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gbmV3IFNhdmVkU3RhdGVbc2l6ZV07CisgICAgICAgICAgICB9CisgICAgICAgIH07CisgICAgfQorCisgICAgQE92ZXJyaWRlCisg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AcmV0dXJuIEFuIEFuaW1hdGlvbiBvciBudWxsIGlmIG5vbmUgaXMgc2V0LgorICAgICAqCisgICAgICogQHNlZSAjc2V0SW5BbmltYXRpb24oYW5kcm9pZC52aWV3LmFuaW1hdGlvbi5BbmltYXRpb24pCisgICAgICogQHNlZSAjc2V0SW5BbmltYXRpb24oYW5kcm9pZC5jb250ZW50LkNvbnRleHQsIGludCkKKyAgICAgKi8KKyAgICBwdWJsaWMgQW5pbWF0aW9uIGdldEluQW5pbWF0aW9uKCkgeworICAgICAgICByZXR1cm4gbUluQW5pbWF0aW9uOworICAgIH0KKworICAgIC8qKgorICAgICAqIFNwZWNpZmllcyB0aGUgYW5pbWF0aW9uIHVzZWQgdG8gYW5pbWF0ZSBhIFZpZXcgdGhhdCBlbnRlcnMgdGhlIHNjcmVlbi4KKyAgICAgKgorICAgICAqIEBwYXJhbSBpbkFuaW1hdGlvbiBUaGUgYW5pbWF0aW9uIHN0YXJ0ZWQgd2hlbiBhIFZpZXcgZW50ZXJzIHRoZSBzY3JlZW4uCisgICAgICoKKyAgICAgKiBAc2VlICNnZXRJbkFuaW1hdGlvbigpCisgICAgICogQHNlZSAjc2V0SW5BbmltYXRpb24oYW5kcm9pZC5jb250ZW50LkNvbnRleHQsIGludCkKKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBzZXRJbkFuaW1hdGlvbihBbmltYXRpb24gaW5BbmltYXRpb24pIHsKKyAgICAgICAgbUluQW5pbWF0aW9uID0gaW5BbmltYXRpb247CisgICAgfQorCisgICAgLyoqCisgICAgICogUmV0dXJucyB0aGUgY3VycmVudCBhbmltYXRpb24gdXNlZCB0byBhbmltYXRlIGEgVmlldyB0aGF0IGV4aXRzIHRoZSBzY3JlZW4uCisgICAgICoKKyAgICAgKiBAcmV0dXJuIEFuIEFuaW1hdGlvbiBvciBudWxsIGlmIG5vbmUgaXMgc2V0LgorICAgICAqCisgICAgICogQHNlZSAjc2V0T3V0QW5pbWF0aW9uKGFuZHJvaWQ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uKGFuZHJvaWQudmlldy5hbmltYXRpb24uQW5pbWF0aW9uKQorICAgICAqLworICAgIHB1YmxpYyB2b2lkIHNldEluQW5pbWF0aW9uKENvbnRleHQgY29udGV4dCwgaW50IHJlc291cmNlSUQpIHsKKyAgICAgICAgc2V0SW5BbmltYXRpb24oQW5pbWF0aW9uVXRpbHMubG9hZEFuaW1hdGlvbihjb250ZXh0LCByZXNvdXJjZUlEKSk7CisgICAgfQorCisgICAgLyoqCisgICAgICogU3BlY2lmaWVzIHRoZSBhbmltYXRpb24gdXNlZCB0byBhbmltYXRlIGEgVmlldyB0aGF0IGV4aXQgdGhlIHNjcmVlbi4KKyAgICAgKgorICAgICAqIEBwYXJhbSBjb250ZXh0IFRoZSBhcHBsaWNhdGlvbidzIGVudmlyb25tZW50LgorICAgICAqIEBwYXJhbSByZXNvdXJjZUlEIFRoZSByZXNvdXJjZSBpZCBvZiB0aGUgYW5pbWF0aW9uLgorICAgICAqCisgICAgICogQHNlZSAjZ2V0T3V0QW5pbWF0aW9uKCkKKyAgICAgKiBAc2VlICNzZXRPdXRBbmltYXRpb24oYW5kcm9pZC52aWV3LmFuaW1hdGlvbi5BbmltYXRpb24pCisgICAgICovCisgICAgcHVibGljIHZvaWQgc2V0T3V0QW5pbWF0aW9uKENvbnRleHQgY29udGV4dCwgaW50IHJlc291cmNlSUQpIHsKKyAgICAgICAgc2V0T3V0QW5pbWF0aW9uKEFuaW1hdGlvblV0aWxzLmxvYWRBbmltYXRpb24oY29udGV4dCwgcmVzb3VyY2VJRCkpOworICAgIH0KKworICAgIC8qKgorICAgICAqIEluZGljYXRlcyB3aGV0aGVyIHRoZSBjdXJyZW50IFZpZXcgc2hvdWxkIGJlIGFuaW1hdGVkIHRoZSBmaXJzdCB0aW1lCisgICAgICogdGhlIFZpZXdBbmltYXRpb24gaXMgZGlzcGxheWVkLgorICAgICAqCisgICAgICogQHBhcmFtIGFuaW1hdGUgVHJ1ZSB0byBhbmltYXRlIHRoZSBjdXJyZW50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m9pZCBvblJlbW90ZUFkYXB0ZXJDb25uZWN0ZWQoKSB7CisgICAgICAgIGlmIChtUmVtb3RlVmlld3NBZGFwdGVyICE9IG1BZGFwdGVyKSB7CisgICAgICAgICAgICBzZXRBZGFwdGVyKG1SZW1vdGVWaWV3c0FkYXB0ZXIpOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogQ2FsbGVkIGJhY2sgd2hlbiB0aGUgYWRhcHRlciBkaXNjb25uZWN0cyBmcm9tIHRoZSBSZW1vdGVWaWV3c1NlcnZpY2UuCisgICAgICovCisgICAgcHVibGljIHZvaWQgb25SZW1vdGVBZGFwdGVyRGlzY29ubmVjdGVkKCkgeworICAgICAgICBpZiAobVJlbW90ZVZpZXdzQWRhcHRlciAhPSBtQWRhcHRlcikgeworICAgICAgICAgICAgbVJlbW90ZVZpZXdzQWRhcHRlciA9IG51bGw7CisgICAgICAgICAgICBzZXRBZGFwdGVyKG1SZW1vdGVWaWV3c0FkYXB0ZXIpOworICAgICAgICB9CisgICAgfQorCisgICAgcHJpdmF0ZSBmaW5hbCBSZWN0IGRpcnR5UmVjdCA9IG5ldyBSZWN0KCk7CisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgcmVtb3ZlVmlld0luTGF5b3V0KFZpZXcgdmlldykgeworICAgICAgICAvLyBUT0RPOiBuZWVkIHRvIGludmVzdGlnYXRlIHRoaXMgYmxvY2sgYSBiaXQgbW9yZQorICAgICAgICAvLyBhbmQgcGVyaGFwcyBmaXggc29tZSBvdGhlciBpbnZhbGlkYXRpb25zIGlzc3Vlcy4KKyAgICAgICAgVmlldyBwYXJlbnQgPSBudWxsOworICAgICAgICB2aWV3LnNldFZpc2liaWxpdHkoSU5WSVNJQkxFKTsKKyAgICAgICAgaWYgKHZpZXcuZ2V0TGF5b3V0UGFyYW1zKCkgaW5zdGFuY2VvZiBMYXlvdXRQYXJhbXMpIHsKKyAgICAgICAgICAgIExheW91dFBhcmFtcyBscCA9IChMYXlvdXRQYXJhbXMpIHZpZXcuZ2V0TGF5b3V0UGFyYW1zKCk7CisgICAgICAgICAgICBwYXJlbnQgPSBscC5nZXRQYXJlbnRBbmREaXJ0eVJlZ2lvbihkaXJ0eVJlY3QpOworICAgICAgICB9CisKKyAgICAgICAgc3VwZXIucmVtb3ZlVmlld0luTGF5b3V0KHZpZXcpOworCisgICAgICAgIGlmIChwYXJlbnQgIT0gbnVsbCkKKyAgICAgICAgICAgIHBhcmVudC5pbnZhbGlkYXRlKGRpcnR5UmVjdC5sZWZ0LCBkaXJ0eVJlY3QudG9wLCBkaXJ0eVJlY3QucmlnaHQsIGRpcnR5UmVjdC5ib3R0b20pOworICAgIH0KKworICAgIHN0YXRpYyBjbGFzcyBMYXlvdXRQYXJhbXMgZXh0ZW5kcyBWaWV3R3JvdXAuTGF5b3V0UGFyYW1zIHsKKyAgICAgICAgaW50IGhvcml6b250YWxPZmZzZXQ7CisgICAgICAgIGludCB2ZXJ0aWNhbE9mZnNldDsKKyAgICAgICAgVmlldyBtVmlldzsKKworICAgICAgICBMYXlvdXRQYXJhbXMoVmlldyB2aWV3KSB7CisgICAgICAgICAgICBzdXBlcigwLCAwKTsKKyAgICAgICAgICAgIGhvcml6b250YWxPZmZzZXQgPSAwOworICAgICAgICAgICAgdmVydGljYWxPZmZzZXQgPSAwOworICAgICAgICAgICAgbVZpZXcgPSB2aWV3OworICAgICAgICB9CisKKyAgICAgICAgTGF5b3V0UGFyYW1zKENvbnRleHQgYywgQXR0cmlidXRlU2V0IGF0dHJzKSB7CisgICAgICAgICAgICBzdXBlcihjLCBhdHRycyk7CisgICAgICAgICAgICBob3Jpem9udGFsT2Zmc2V0ID0gMDsKKyAgICAgICAgICAgIHZlcnRpY2FsT2Zmc2V0ID0gMDsKKyAgICAgICAgfQorCisgICAgICAgIHByaXZhdGUgUmVjdCBwYXJlbnRSZWN0ID0gbmV3IFJlY3QoKTsKKyAgICAgICAgdm9pZCBpbnZhbGlkYXRlR2xvYmFsUmVnaW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wgbVZpZXcuZ2V0Qm90dG9tKCkpOworICAgICAgICAgICAgVmlldyBwID0gbVZpZXc7CisgICAgICAgICAgICBib29sZWFuIGZpcnN0UGFzcyA9IHRydWU7CisgICAgICAgICAgICBwYXJlbnRSZWN0LnNldCgwLCAwLCAwLCAwKTsKKyAgICAgICAgICAgIHdoaWxlIChwLmdldFBhcmVudCgpICE9IG51bGwgJiYgcC5nZXRQYXJlbnQoKSBpbnN0YW5jZW9mIFZpZXcKKyAgICAgICAgICAgICAgICAgICAgJiYgIXBhcmVudFJlY3QuY29udGFpbnMoZ2xvYmFsUmVjdCkpIHsKKyAgICAgICAgICAgICAgICBpZiAoIWZpcnN0UGFzcykgeworICAgICAgICAgICAgICAgICAgICBnbG9iYWxSZWN0Lm9mZnNldChwLmdldExlZnQoKSAtIHAuZ2V0U2Nyb2xsWCgpLCBwLmdldFRvcCgpIC0gcC5nZXRTY3JvbGxZKCkpOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIGZpcnN0UGFzcyA9IGZhbHNlOworICAgICAgICAgICAgICAgIHAgPSAoVmlldykgcC5nZXRQYXJlbnQoKTsKKyAgICAgICAgICAgICAgICBwYXJlbnRSZWN0LnNldChwLmdldExlZnQoKSAtIHAuZ2V0U2Nyb2xsWCgpLCBwLmdldFRvcCgpIC0gcC5nZXRTY3JvbGxZKCksCisgICAgICAgICAgICAgICAgICAgICAgICBwLmdldFJpZ2h0KCkgLSBwLmdldFNjcm9sbFgoKSwgcC5nZXRCb3R0b20oKSAtIHAuZ2V0U2Nyb2xsWSgpKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHJldHVybiBwOworICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSBSZWN0IGludmFsaWRhdGVSZWN0ID0gbmV3IFJlY3QoKTsKKyAgICAgICAgLy8gVGhpcyBpcyBwdWJsaWMgc28gdGhhdCBQcm9wZXJ0eUFuaW1hdG9yIGNhbiBhY2Nlc3MgaXQKKyAgICAgICAgcHVibGljIHZvaWQgc2V0VmVydGljYWxPZmZzZXQoaW50IG5ld1ZlcnRpY2FsT2Zmc2V0KSB7CisgICAgICAgICAgICBpbnQgb2Zmc2V0RGVsdGEgPSBuZXdWZXJ0aWNhbE9mZnNldCAtIHZlcnRpY2FsT2Zmc2V0OworICAgICAgICAgICAgdmVydGljYWxPZmZzZXQgPSBuZXdWZXJ0aWNhbE9mZnNldDsKKyAgICAgICAgICAgIGlmIChtVmlldyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgbVZpZXcucmVxdWVzdExheW91dCgpOworICAgICAgICAgICAgICAgIGludCB0b3AgPSBNYXRoLm1pbihtVmlldy5nZXRUb3AoKSArIG9mZnNldERlbHRhLCBtVmlldy5nZXRUb3AoKSk7CisgICAgICAgICAgICAgICAgaW50IGJvdHRvbSA9IE1hdGgubWF4KG1WaWV3LmdldEJvdHRvbSgpICsgb2Zmc2V0RGVsdGEsIG1WaWV3LmdldEJvdHRvbSgpKTsKKyAgICAgICAgICAgICAgICBpbnZhbGlkYXRlUmVjdC5zZXQobVZpZXcuZ2V0TGVmdCgpLCB0b3AsIG1WaWV3LmdldFJpZ2h0KCksIGJvdHRvbSk7CisgICAgICAgICAgICAgICAgaW52YWxpZGF0ZUdsb2JhbFJlZ2lvbihtVmlldywgaW52YWxpZGF0ZVJlY3QpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgc2V0SG9yaXpvbnRhbE9mZnNldChpbnQgbmV3SG9yaXpvbnRhbE9mZnNldCkgeworICAgICAgICAgICAgaW50IG9mZnNldERlbHRhID0gbmV3SG9yaXpvbnRhbE9mZnNldCAtIGhvcml6b250YWxPZmZzZXQ7CisgICAgICAgICAgICBob3Jpem9udGFsT2Zmc2V0ID0gbmV3SG9yaXpvbnRhbE9mZnNldDsKKyAgICAgICAgICAgIGlmIChtVmlldyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgbVZpZXcucmVxdWVzdExheW91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RvU3RhcnQsIGZhbHNlKTsKKyAgICAgICAgYS5yZWN5Y2xlKCk7CisgICAgICAgIGluaXREZWZhdWx0QW5pbWF0aW9ucygpOworICAgIH0KKworICAgIHByaXZhdGUgdm9pZCBpbml0RGVmYXVsdEFuaW1hdGlvbnMoKSB7CisgICAgICAgIC8vIFNldCB0aGUgZGVmYXVsdCBhbmltYXRpb25zIHRvIGJlIGZhZGUgaW4vb3V0CisgICAgICAgIGlmIChtSW5BbmltYXRpb24gPT0gbnVsbCkgeworICAgICAgICAgICAgbUluQW5pbWF0aW9uID0gbmV3IEFscGhhQW5pbWF0aW9uKDAuMGYsIDEuMGYpOworICAgICAgICAgICAgbUluQW5pbWF0aW9uLnNldER1cmF0aW9uKG1BbmltYXRpb25EdXJhdGlvbik7CisgICAgICAgIH0KKyAgICAgICAgaWYgKG1PdXRBbmltYXRpb24gPT0gbnVsbCkgeworICAgICAgICAgICAgbU91dEFuaW1hdGlvbiA9IG5ldyBBbHBoYUFuaW1hdGlvbigxLjBmLCAwLjBmKTsKKyAgICAgICAgICAgIG1PdXRBbmltYXRpb24uc2V0RHVyYXRpb24obUFuaW1hdGlvbkR1cmF0aW9uKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgZmluYWwgQnJvYWRjYXN0UmVjZWl2ZXIgbVJlY2VpdmVyID0gbmV3IEJyb2FkY2FzdFJlY2VpdmVyKCkgeworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIHZvaWQgb25SZWNlaXZlKENvbnRleHQgY29udGV4dCwgSW50ZW50IGludGVudCkgeworICAgICAgICAgICAgZmluYWwgU3RyaW5nIGFjdGlvbiA9IGludGVudC5nZXRBY3Rpb24oKTsKKyAgICAgICAgICAgIGlmIChJbnRlbnQuQUNUSU9OX1NDUkVFTl9PRkYuZXF1YWxzKGFjdGlvbikpIHsKKyAgICAgICAgICAgICAgICBtVXNlclByZXNlbnQgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICB1c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d2hldGhlciBvciBub3QgdG8gZXhlY3V0ZSB0aGUgYW5pbWF0aW9uIG5vdywgaW4KKyAgICAgKiAgICAgICAgICAgIGFkZGl0aW9uIHRvIHF1ZXVpbmcgZnV0dXJlIGZsaXBzLiBJZiBvbWl0dGVkLCBkZWZhdWx0cyB0bworICAgICAqICAgICAgICAgICAgdHJ1ZS4KKyAgICAgKi8KKyAgICBwcml2YXRlIHZvaWQgdXBkYXRlUnVubmluZyhib29sZWFuIGZsaXBOb3cpIHsKKyAgICAgICAgYm9vbGVhbiBydW5uaW5nID0gbVZpc2libGUgJiYgbVN0YXJ0ZWQgJiYgbVVzZXJQcmVzZW50ICYmIG1BZGFwdGVyICE9IG51bGw7CisgICAgICAgIGlmIChydW5uaW5nICE9IG1SdW5uaW5nKSB7CisgICAgICAgICAgICBpZiAocnVubmluZykgeworICAgICAgICAgICAgICAgIHNob3dPbmx5KG1XaGljaENoaWxkLCBmbGlwTm93KTsKKyAgICAgICAgICAgICAgICBNZXNzYWdlIG1zZyA9IG1IYW5kbGVyLm9idGFpbk1lc3NhZ2UoRkxJUF9NU0cpOworICAgICAgICAgICAgICAgIG1IYW5kbGVyLnNlbmRNZXNzYWdlRGVsYXllZChtc2csIG1GbGlwSW50ZXJ2YWwpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBtSGFuZGxlci5yZW1vdmVNZXNzYWdlcyhGTElQX01TRyk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBtUnVubmluZyA9IHJ1bm5pbmc7CisgICAgICAgIH0KKyAgICAgICAgaWYgKExPR0QpIHsKKyAgICAgICAgICAgIExvZy5kKFRBRywgInVwZGF0ZVJ1bm5pbmcoKSBtVmlzaWJsZT0iICsgbVZpc2libGUgKyAiLCBtU3RhcnRlZD0iICsgbVN0YXJ0ZWQKKyAgICAgICAgICAgICAgICAgICAgKyAiLCBtVXNlclByZXNlbnQ9IiArIG1Vc2VyUHJlc2VudCArICIsIG1SdW5uaW5nPSIgKyBtUnVubmluZyk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBSZXR1cm5zIHRydWUgaWYgdGhlIGNoaWxkIHZpZXdzIGFyZSBmbGlwcGluZy4KKyAgICAgKi8KKyAgICBwdWJsaWMgYm9vbGVhbiBpc0ZsaXBwaW5nKCkgeworICAgICAgICByZXR1cm4gbVN0YXJ0ZWQ7CisgICAgfQorCisgICAgLyoqCisgICAgICogU2V0IGlmIHRoaXMgdmlldyBhdXRvbWF0aWNhbGx5IGNhbGxzIHtAbGluayAjc3RhcnRGbGlwcGluZygpfSB3aGVuIGl0CisgICAgICogYmVjb21lcyBhdHRhY2hlZCB0byBhIHdpbmRvdy4KKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBzZXRBdXRvU3RhcnQoYm9vbGVhbiBhdXRvU3RhcnQpIHsKKyAgICAgICAgbUF1dG9TdGFydCA9IGF1dG9TdGFydDsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBSZXR1cm5zIHRydWUgaWYgdGhpcyB2aWV3IGF1dG9tYXRpY2FsbHkgY2FsbHMge0BsaW5rICNzdGFydEZsaXBwaW5nKCl9CisgICAgICogd2hlbiBpdCBiZWNvbWVzIGF0dGFjaGVkIHRvIGEgd2luZG93LgorICAgICAqLworICAgIHB1YmxpYyBib29sZWFuIGlzQXV0b1N0YXJ0KCkgeworICAgICAgICByZXR1cm4gbUF1dG9TdGFydDsKKyAgICB9CisKKyAgICBwcml2YXRlIGZpbmFsIGludCBGTElQX01TRyA9IDE7CisKKyAgICBwcml2YXRlIGZpbmFsIEhhbmRsZXIgbUhhbmRsZXIgPSBuZXcgSGFuZGxlcigpIHsKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyB2b2lkIGhhbmRsZU1lc3NhZ2UoTWVzc2FnZSBtc2cpIHsKKyAgICAgICAgICAgIGlmIChtc2cud2hhdCA9PSBGTElQX01TRykgeworICAgICAgICAgICAgICAgIGlmIChtU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cm90ZWN0ZWQgZmluYWwgQ29udGV4dCBtQ29udGV4dDsKKworICAgICAgICAvKioKKyAgICAgICAgICogPHA+VGhlIHRyYW5zZm9ybWF0aW9uIGFzc29jaWF0ZWQgd2l0aCB0aGlzIGJpbmRlci4gVGhpcyB0cmFuc2Zvcm1hdGlvbiBpcyBuZXZlcgorICAgICAgICAgKiBudWxsIGFuZCBtYXkgb3IgbWF5IG5vdCBiZSBhcHBsaWVkIHRvIHRoZSBDdXJzb3IgZGF0YSBkdXJpbmcgdGhlCisgICAgICAgICAqIHtAbGluayAjYmluZChhbmRyb2lkLnZpZXcuVmlldywgYW5kcm9pZC5kYXRhYmFzZS5DdXJzb3IsIGludCl9IG9wZXJhdGlvbi48L3A+CisgICAgICAgICAqIAorICAgICAgICAgKiBAc2VlICNiaW5kKGFuZHJvaWQudmlldy5WaWV3LCBhbmRyb2lkLmRhdGFiYXNlLkN1cnNvciwgaW50KSAKKyAgICAgICAgICovCisgICAgICAgIHByb3RlY3RlZCBmaW5hbCBDdXJzb3JUcmFuc2Zvcm1hdGlvbiBtVHJhbnNmb3JtYXRpb247CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIDxwPkNyZWF0ZXMgYSBuZXcgQ3Vyc29yIGJpbmRlci48L3A+IAorICAgICAgICAgKiAKKyAgICAgICAgICogQHBhcmFtIGNvbnRleHQgVGhlIGNvbnRleHQgYXNzb2NpYXRlZCB3aXRoIHRoaXMgYmluZGVyLgorICAgICAgICAgKiBAcGFyYW0gdHJhbnNmb3JtYXRpb24gVGhlIHRyYW5zZm9ybWF0aW9uIGFzc29jaWF0ZWQgd2l0aCB0aGlzIGJpbmRlci4gVGhpcworICAgICAgICAgKiAgICAgICAgdHJhbnNmb3JtYXRpb24gbWF5IG9yIG1heSBub3QgYmUgYXBwbGllZCBieSB0aGUgYmluZGVyIGFuZCBpcyBndWFyYW50ZWVkCisgICAgICAgICAqICAgICAgICB0byBub3QgYmUgbnVsbC4KKyAgICAgICAgICovCisgICAgIC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J9CisgICAgICogCisgICAgICogQHRocm93cyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24gSWYgdGhlIFhNTCByZXNvdXJjZSBkb2VzIG5vdCBjb250YWluCisgICAgICogICAgICAgICBhIHZhbGlkICZsdDtjdXJzb3ItYWRhcHRlciAvJmd0OyBkZWZpbml0aW9uLgorICAgICAqIAorICAgICAqIEBzZWUgYW5kcm9pZC5jb250ZW50LkNvbnRlbnRQcm92aWRlcgorICAgICAqIEBzZWUgYW5kcm9pZC53aWRnZXQuQ3Vyc29yQWRhcHRlcgorICAgICAqIEBzZWUgYW5kcm9pZC5kYXRhYmFzZS5DdXJzb3IKKyAgICAgKiBAc2VlICNsb2FkQWRhcHRlcihhbmRyb2lkLmNvbnRlbnQuQ29udGV4dCwgaW50LCBPYmplY3RbXSkgCisgICAgICovCisgICAgcHVibGljIHN0YXRpYyBDdXJzb3JBZGFwdGVyIGxvYWRDdXJzb3JBZGFwdGVyKENvbnRleHQgY29udGV4dCwgaW50IGlkLCBDdXJzb3IgY3Vyc29yLAorICAgICAgICAgICAgT2JqZWN0Li4uIHBhcmFtZXRlcnMpIHsKKworICAgICAgICBYbWxDdXJzb3JBZGFwdGVyIGFkYXB0ZXIgPSAoWG1sQ3Vyc29yQWRhcHRlcikgbG9hZEFkYXB0ZXIoY29udGV4dCwgaWQsIEFEQVBURVJfQ1VSU09SLAorICAgICAgICAgICAgICAgIHBhcmFtZXRlcnMpOworCisgICAgICAgIGlmIChjdXJzb3IgIT0gbnVsbCkgeworICAgICAgICAgICAgYWRhcHRlci5jaGFuZ2VDdXJzb3IoY3Vyc29yKTsKKyAgICAgICAgfQorCisgICAgICAgIHJldHVybiBhZGFwdGVyOworICAgIH0KKworICAgIC8qKgorICAgICAqIDxwPkxvYWRzIHRoZSBhZGFwdGVyIGRlZmluZWQgaW4gdGhlIHNwZWNpZmllZCBYTUwgcmVzb3VyY2UuIFRoZSBYTUwgZGVmaW5pdGlvbiBvZgorICAgICAqIHRoZSB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YW0gYXNzZXJ0TmFtZSBUaGUgbWFuZGF0b3J5IG5hbWUgb2YgdGhlIGFkYXB0ZXIgaW4gdGhlIFhNTCBkb2N1bWVudC4KKyAgICAgKiAgICAgICAgSWdub3JlZCBpZiBudWxsLgorICAgICAqIEBwYXJhbSBwYXJhbWV0ZXJzIE9wdGlvbmFsIHBhcmFtZXRlcnMgcGFzc2VkIHRvIHRoZSBhZGFwdGVyLgorICAgICAqIAorICAgICAqIEByZXR1cm4gQW4gaW5zdGFuY2Ugb2Yge0BsaW5rIGFuZHJvaWQud2lkZ2V0LkJhc2VBZGFwdGVyfS4KKyAgICAgKi8KKyAgICBwcml2YXRlIHN0YXRpYyBCYXNlQWRhcHRlciBsb2FkQWRhcHRlcihDb250ZXh0IGNvbnRleHQsIGludCBpZCwgU3RyaW5nIGFzc2VydE5hbWUsCisgICAgICAgICAgICBPYmplY3QuLi4gcGFyYW1ldGVycykgeworCisgICAgICAgIFhtbFJlc291cmNlUGFyc2VyIHBhcnNlciA9IG51bGw7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBwYXJzZXIgPSBjb250ZXh0LmdldFJlc291cmNlcygpLmdldFhtbChpZCk7CisgICAgICAgICAgICByZXR1cm4gY3JlYXRlQWRhcHRlckZyb21YbWwoY29udGV4dCwgcGFyc2VyLCBYbWwuYXNBdHRyaWJ1dGVTZXQocGFyc2VyKSwKKyAgICAgICAgICAgICAgICAgICAgaWQsIHBhcmFtZXRlcnMsIGFzc2VydE5hbWUpOworICAgICAgICB9IGNhdGNoIChYbWxQdWxsUGFyc2VyRXhjZXB0aW9uIGV4KSB7CisgICAgICAgICAgICBSZXNvdXJjZXMuTm90Rm91bmRFeGNlcHRpb24gcm5mID0gbmV3IFJlc291cmNlcy5Ob3RGb3VuZEV4Y2VwdGlvbigKKyAgICAgICAgICAgICAgICAgICAgIkNhbid0IGxvYWQgYWRhcHRlciByZXNvdXJjZSBJRCAiICsKKyAgICAgICAgICAgICAgICAgICAgY29udGV4dC5nZXRSZXNvdXJjZXMoKS5nZXRSZXNvdXJjZUVudHJ5TmFtZShpZCkpOworICAgICAgICAgICAgcm5mLmluaXRDYXVzZShleCk7CisgICAgICAgICAgICB0aHJvdyBybmY7CisgICAgICAgIH0gY2F0Y2ggKElPRXhjZXB0aW9uIGV4KSB7CisgICAgICAgICAgICBSZXNvdXJjZXMuTm90Rm91bmRFeGNlcHRpb24gcm5mID0gbmV3IFJlc291cmNlcy5Ob3RGb3VuZEV4Y2VwdGlvbigKKyAgICAgICAgICAgICAgICAgICAgIkNhbid0IGxvYWQgYWRhcHRlciByZXNvdXJjZSBJRCAiICsKKyAgICAgICAgICAgICAgICAgICAgY29udGV4dC5nZXRSZXNvdXJjZXMoKS5nZXRSZXNvdXJjZUVudHJ5TmFtZShpZCkpOworICAgICAgICAgICAgcm5mLmluaXRDYXVzZShleCk7CisgICAgICAgICAgICB0aHJvdyBybmY7CisgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICBpZiAocGFyc2VyICE9IG51bGwpIHBhcnNlci5jbG9zZSgpOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogR2VuZXJhdGVzIGFuIGFkYXB0ZXIgdXNpbmcgdGhlIHNwZWNpZmllZCBYTUwgcGFyc2VyLiBUaGlzIG1ldGhvZCBpcyByZXNwb25zaWJsZQorICAgICAqIGZvciBjaG9vc2luZyB0aGUgdHlwZSBvZiB0aGUgYWRhcHRlciB0byBjcmVhdGUgYmFzZWQgb24gdGhlIGNvbnRlbnQgb2YgdGhlCisgICAgICogWE1MIHBhcnNlci4KKyAgICAgKiAKKyAgICAgKiBUaGlzIG1ldGhvZCB3aWxsIGdlbmVyYXRlIGFuIHtAbGluayBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb259IGlmCisgICAgICogPGNvZGU+YXNzZXJ0TmFtZTwvY29kZT4gaXMgbm90IG51bGwgYW5kIGRvZXMgbm90IG1hdGNoIHRoZSByb290IHRhZyBvZiB0aGUgWE1MCisgICAgICogZG9jdW1lbnQuIAorICAgICAqLworICAgIHByaXZhdGUgc3RhdGljIEJhc2VBZGFwdGVyIGNyZWF0ZUFkYXB0ZXJGcm9tWG1sKENvbnRleHQgYywKKyAgICAgICAgICAgIFhtbFB1bGxQYXJzZXIgcGFyc2VyLCBBdHRyaWJ1dGVTZXQgYXR0cnMsIGludCBpZCwgT2JqZWN0W10gcGFyYW1ldGVycywKKyAgICAgICAgICAgIFN0cmluZyBhc3NlcnROYW1lKSB0aHJvd3MgWG1sUHVsbFBhcnNlckV4Y2VwdGlvbiwgSU9FeGNlcHRpb24geworCisgICAgICAgIEJhc2VBZGFwdGVyIGFkYXB0ZXIgPSBudWxsOworCisgICAgICAgIC8vIE1ha2Ugc3VyZSB3ZSBhcmUgb24gYSBzdGFydCB0YWcuCisgICAgICAgIGludCB0eXBlOworICAgICAgICBpbnQgZGVwdGggPSBwYXJzZXIuZ2V0RGVwdGgoKTsKKworICAgICAgICB3aGlsZSAoKCh0eXBlID0gcGFyc2VyLm5leHQoKSkgIT0gWG1sUHVsbFBhcnNlci5FTkRfVEFHIHx8IHBhcnNlci5nZXREZXB0aCgpID4gZGVwdGgpICYmCisgICAgICAgICAgICAgICAgdHlwZSAhPSBYbWxQdWxsUGFyc2VyLkVORF9ET0NVTUVOVCkgeworCisgICAgICAgICAgICBpZiAodHlwZSAhPSBYbWxQdWxsUGFyc2VyLlNUQVJUX1RBRykgeworICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBTdHJpbmcgbmFtZSA9IHBhcnNlci5nZXROYW1lKCk7CisgICAgICAgICAgICBpZiAoYXNzZXJ0TmFtZSAhPSBudWxsICYmICFhc3NlcnROYW1lLmVxdWFscyhuYW1lKSkgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oIlRoZSBhZGFwdGVyIGRlZmluZWQgaW4gIiArCisgICAgICAgICAgICAgICAgICAgIC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IChsYXlvdXQgPT0gMCkgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oIlRoZSBsYXlvdXQgc3BlY2lmaWVkIGluICIgKworICAgICAgICAgICAgICAgICAgICAgICAgcmVzb3VyY2VzLmdldFJlc291cmNlRW50cnlOYW1lKG1JZCkgKyAiIGRvZXMgbm90IGV4aXN0Iik7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGEucmVjeWNsZSgpOworCisgICAgICAgICAgICBYbWxQdWxsUGFyc2VyIHBhcnNlciA9IG1QYXJzZXI7CisgICAgICAgICAgICBpbnQgdHlwZTsKKyAgICAgICAgICAgIGludCBkZXB0aCA9IHBhcnNlci5nZXREZXB0aCgpOworCisgICAgICAgICAgICB3aGlsZSAoKCh0eXBlID0gcGFyc2VyLm5leHQoKSkgIT0gWG1sUHVsbFBhcnNlci5FTkRfVEFHIHx8IHBhcnNlci5nZXREZXB0aCgpID4gZGVwdGgpICYmCisgICAgICAgICAgICAgICAgICAgIHR5cGUgIT0gWG1sUHVsbFBhcnNlci5FTkRfRE9DVU1FTlQpIHsKKworICAgICAgICAgICAgICAgIGlmICh0eXBlICE9IFhtbFB1bGxQYXJzZXIuU1RBUlRfVEFHKSB7CisgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIFN0cmluZyBuYW1lID0gcGFyc2VyLmdldE5hbWUoKTsKKworICAgICAgICAgICAgICAgIGlmIChBREFQVEVSX0NVUlNPUl9CSU5ELmVxdWFscyhuYW1lKSkgeworICAgICAgICAgICAgICAgICAgICBwYXJzZUJpbmRUYWcoKTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKEFEQVBURVJfQ1VSU09SX1NFTEVDVC5lcXVhbHMobmFtZSkpIHsKKyAgICAgICAgICAgICAgICAgICAgcGFyc2VTZWxlY3RUYWcoKTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgUnVudGltZUV4Y2VwdGlvbigiVW5rbm93biB0YWcgbmFtZSAiICsgcGFyc2VyLmdldE5hbWUoKSArICIgaW4gIiArCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzb3VyY2VzLmdldFJlc291cmNlRW50cnlOYW1lKG1JZCkpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgU3RyaW5nW10gZnJvbUFycmF5ID0gbUZyb20udG9BcnJheShuZXcgU3RyaW5nW21Gcm9tLnNpemUoKV0pOworICAgICAgICAgICAgaW50W10gdG9BcnJheSA9IG5ldyBpbnRbbVRvLnNpemUoKV07CisgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IHRvQXJyYXkubGVuZ3RoOyBpKyspIHsKKyAgICAgICAgICAgICAgICB0b0FycmF5W2ldID0gbVRvLmdldChpKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgU3RyaW5nW10gc2VsZWN0aW9uQXJncyA9IG51bGw7CisgICAgICAgICAgICBpZiAocGFyYW1ldGVycyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgc2VsZWN0aW9uQXJncyA9IG5ldyBTdHJpbmdbcGFyYW1ldGVycy5sZW5ndGhdOworICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgc2VsZWN0aW9uQXJncy5sZW5ndGg7IGkrKykgeworICAgICAgICAgICAgICAgICAgICBzZWxlY3Rpb25BcmdzW2ldID0gKFN0cmluZykgcGFyYW1ldGVyc1tpXTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHJldHVybiBuZXcgWG1sQ3Vyc29yQWRhcHRlcihtQ29udGV4dCwgbGF5b3V0LCB1cmksIGZyb21BcnJheSwgdG9BcnJheSwgc2VsZWN0aW9uLAorICAgICAgICAgICAgICAgICAgICBzZWxlY3Rpb25BcmdzLC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51bGwpIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCJBIGJpbmQgaXRlbSBpbiAiICsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJlc291cmNlcy5nZXRSZXNvdXJjZUVudHJ5TmFtZShtSWQpICsgIiBkb2VzIG5vdCBoYXZlIGFuICdhcycgYXR0cmlidXRlIik7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIG1Gcm9tLmFkZChmcm9tTmFtZSk7CisgICAgICAgICAgICBtVG8uYWRkKHRvTmFtZSk7CisgICAgICAgICAgICBtQmluZGVycy5wdXQoZnJvbU5hbWUsIGZpbmRCaW5kZXIoYXNUeXBlKSk7CisKKyAgICAgICAgICAgIGEucmVjeWNsZSgpOworICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSBDdXJzb3JCaW5kZXIgZmluZEJpbmRlcihTdHJpbmcgdHlwZSkgdGhyb3dzIElPRXhjZXB0aW9uLCBYbWxQdWxsUGFyc2VyRXhjZXB0aW9uIHsKKyAgICAgICAgICAgIGZpbmFsIFhtbFB1bGxQYXJzZXIgcGFyc2VyID0gbVBhcnNlcjsKKyAgICAgICAgICAgIGZpbmFsIENvbnRleHQgY29udGV4dCA9IG1Db250ZXh0OworICAgICAgICAgICAgQ3Vyc29yVHJhbnNmb3JtYXRpb24gdHJhbnNmb3JtYXRpb24gPSBtSWRlbnRpdHk7CisKKyAgICAgICAgICAgIGludCB0YWdUeXBlOworICAgICAgICAgICAgaW50IGRlcHRoID0gcGFyc2VyLmdldERlcHRoKCk7CisKKyAgICAgICAgICAgIGZpbmFsIGJvb2xlYW4gaXNEcmF3YWJsZSA9IEFEQVBURVJfQ1VSU09SX0FTX0RSQVdBQkxFLmVxdWFscyh0eXBlKTsgICAgICAgICAgICAKKworICAgICAgICAgICAgd2hpbGUgKCgodGFnVHlwZSA9IHBhcnNlci5uZXh0KCkpICE9IFhtbFB1bGxQYXJzZXIuRU5EX1RBRyB8fCBwYXJzZXIuZ2V0RGVwdGgoKSA+IGRlcHRoKQorICAgICAgICAgICAgICAgICAgICAmJiB0YWdUeXBlICE9IFhtbFB1bGxQYXJzZXIuRU5EX0RPQ1VNRU5UKSB7CisKKyAgICAgICAgICAgICAgICBpZiAodGFnVHlwZSAhPSBYbWxQdWxsUGFyc2VyLlNUQVJUX1RBRykgeworICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICBTdHJpbmcgbmFtZSA9IHBhcnNlci5nZXROYW1lKCk7CisKKyAgICAgICAgICAgICAgICBpZiAoQURBUFRFUl9DVVJTT1JfVFJBTlNGT1JNLmVxdWFscyhuYW1lKSkgeworICAgICAgICAgICAgICAgICAgICB0cmFuc2Zvcm1hdGlvbiA9IGZpbmRUcmFuc2Zvcm1hdGlvbigpOworICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoQURBUFRFUl9DVVJTT1JfTUFQLmVxdWFscyhuYW1lKSkgeworICAgICAgICAgICAgICAgICAgICBpZiAoISh0cmFuc2Zvcm1hdGlvbiBpbnN0YW5jZW9mIE1hcFRyYW5zZm9ybWF0aW9uKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgdHJhbnNmb3JtYXRpb24gPSBuZXcgTWFwVHJhbnNmb3JtYXRpb24oY29udGV4dCk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgZmluZE1hcCgoKE1hcFRyYW5zZm9ybWF0aW9uKSB0cmFuc2Zvcm1hdGlvbiksIGlzRHJhd2FibGUpOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBSdW50aW1lRXhjZXB0aW9uKCJVbmtub3duIHRhZyBuYW1lICIgKyBwYXJzZXIuZ2V0TmFtZSgpICsgIiBpbiAiICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250ZXh0LmdldFJlc291cmNlcygpLmdldFJlc291cmNlRW50cnlOYW1lKG1JZCkpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKEFEQVBURVJfQ1VSU09SX0FTX1NUUklORy5lcXVhbHModHlwZSkpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gbmV3IFN0cmluZ0JpbmRlcihjb250ZXh0LCB0cmFuc2Zvcm1hdGlvbik7CisgICAgICAgICAgICB9IGVsc2UgaWYgKEFEQVBURVJfQ1VSU09SX0FTX1RBRy5lcXVhbHModHlwZSkpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gbmV3IFRhZ0JpbmRlcihjb250ZXh0LCB0cmFuc2Zvcm1hdGlvbik7CisgICAgICAgICAgICB9IGVsc2UgaWYgKEFEQVBURVJfQ1VSU09SX0FTX0lNQUdFLmVxdWFscyh0eXBlKSkgeworICAgICAgICAgICAgICAgIHJldHVybiBuZXcgSW1hZ2VCaW5kZXIoY29udGV4dCwgdHJhbnNmb3JtYXRpb24pOyAgICAgICAgICAgIAorICAgICAgICAgICAgfSBlbHNlIGlmIChBREFQVEVSX0NVUlNPUl9BU19JTUFHRV9VUkkuZXF1YWxzKHR5cGUpKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBJbWFnZVVyaUJpbmRlcihjb250ZXh0LCB0cmFuc2Zvcm1hdGlvbik7CisgICAgICAgICAgICB9IGVsc2UgaWYgKGlzRHJhd2FibGUpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gbmV3IERyYXdhYmxlQmluZGVyKGNvbnRleHQsIHRyYW5zZm9ybWF0aW9uKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIGNyZWF0ZUJpbmRlcih0eXBlLCB0cmFuc2Zvcm1hdGlvbik7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBwcml2YXRlIEN1cnNvckJpbmRlciBjcmVhdGVCaW5kZXIoU3RyaW5nIHR5cGUsIEN1cnNvclRyYW5zZm9ybWF0aW9uIHRyYW5zZm9ybWF0aW9uKSB7CisgICAgICAgICAgICBpZiAobUNvbnRleHQuaXNSZXN0cmljdGVkKCkpIHJldHVybiBudWxsOworCisgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIGZpbmFsIENsYXNzPD8+IGtsYXNzID0gQ2xhc3MuZm9yTmFtZSh0eXBlLCB0cnVlLCBtQ29udGV4dC5nZXRDbGFzc0xvYWRlcigpKTsKKyAgICAgICAgICAgICAgICBpZiAoQ3Vyc29yQmluZGVyLmNsYXNzLmlzQXNzaWduYWJsZUZyb20oa2xhc3MpKSB7CisgICAgICAgICAgICAgICAgICAgIGZpbmFsIENvbnN0cnVjdG9yPD8+IGMgPSBrbGFzcy5nZXREZWNsYXJlZENvbnN0cnVjdG9yKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIENvbnRleHQuY2xhc3MsIEN1cnNvclRyYW5zZm9ybWF0aW9uLmNsYXNzKTsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChDdXJzb3JCaW5kZXIpIGMubmV3SW5zdGFuY2UobUNvbnRleHQsIHRyYW5zZm9ybWF0aW9uKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9IGNhdGNoIChDbGFzc05vdEZvdW5kRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCJDYW5ub3QgaW5zdGFuY2lhdGUgYmluZGVyIHR5cGUgaW4gIiArCisgICAgICAgICAgICAgICAgICAgICAgICBtQ29udGV4dC5nZXRSZXNvdXJjZXMoKS5nZXRSZXNvdXJjZUVudHJ5TmFtZShtSWQpICsgIjogIiArIHR5cGUsIGUpOworICAgICAgICAgICAgfSBjYXRjaCAoTm9TdWNoTWV0aG9kRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCJDYW5ub3QgaW5zdGFuY2lhdGUgYmluZGVyIHR5cGUgaW4gIiArCisgICAgICAgICAgICAgICAgICAgICAgICBtQ29udGV4dC5nZXRSZXNvdXJjZXMoKS5nZXRSZXNvdXJjZUVudHJ5TmFtZShtSWQpICsgIjogIiArIHR5cGUsIGUpOworICAgICAgICAgICAgfSBjYXRjaCAoSW52b2NhdGlvblRhcmdldEV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigiQ2Fubm90IGluc3RhbmNpYXRlIGJpbmRlciB0eXBlIGluICIgKworICAgICAgICAgICAgICAgICAgICAgICAgbUNvbnRleHQuZ2V0UmVzb3VyY2VzKCkuZ2V0UmVzb3VyY2VFbnRyeU5hbWUobUlkKSArICI6ICIgKyB0eXBlLCBlKTsKKyAgICAgICAgICAgIH0gY2F0Y2ggKEluc3RhbnRpYXRpb25FeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oIkNhbm5vdCBpbnN0YW5jaWF0ZSBiaW5kZXIgdHlwZSBpbiAiICsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1Db250ZXh0LmdldFJlc291cmNlcygpLmdldFJlc291cmNlRW50cnlOYW1lKG1JZCkgKyAiOiAiICsgdHlwZSwgZSk7CisgICAgICAgICAgICB9IGNhdGNoIChJbGxlZ2FsQWNjZXNzRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCJDYW5ub3QgaW5zdGFuY2lhdGUgYmluZGVyIHR5cGUgaW4gIiArCisgICAgICAgICAgICAgICAgICAgICAgICBtQ29udGV4dC5nZXRSZXNvdXJjZXMoKS5nZXRSZXNvdXJjZUVudHJ5TmFtZShtSWQpICsgIjogIiArIHR5cGUsIGUpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICByZXR1cm4gbnVsbDsKKyAgICAgICAgfQorCisgICAgICAgIHByaXZhdGUgdm9pZCBmaW5kTWFwKE1hcFRyYW5zZm9ybWF0aW9uIHRyYW5zZm9ybWF0aW9uLCBib29sZWFuIGRyYXdhYmxlKSB7CisgICAgICAgICAgICBSZXNvdXJjZXMgcmVzb3VyY2VzID0gbVJlc291cmNlczsKKworICAgICAgICAgICAgVHlwZWRBcnJheSBhID0gcmVzb3VyY2VzLm9idGFpbkF0dHJpYnV0ZXMobUF0dHJzLAorICAgICAgICAgICAgICAgICAgICBhbmRyb2lkLlIuc3R5bGVhYmxlLkN1cnNvckFkYXB0ZXJfTWFwSXRlbSk7CisKKyAgICAgICAgICAgIFN0cmluZyBmcm9tID0gYS5nZXRTdHJpbmcoYW5kcm9pZC5SLnN0eWxlYWJsZS5DdXJzb3JBZGFwdGVyX01hcEl0ZW1fZnJvbVZhbHVlKTsKKyAgICAgICAgICAgIGlmIChmcm9tID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCJBIG1hcCBpdGVtIGluICIgKworICAgICAgICAgICAgICAgICAgICAgICAgcmVzb3VyY2VzLmdldFJlc291cmNlRW50cnlOYW1lKG1JZCkgKworICAgICAgICAgICAgICAgICAgICAgICAgIiBkb2VzIG5vdCBoYXZlIGEgJ2Zyb21WYWx1ZScgYXR0cmlidXRlIik7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmICghZHJhd2FibGUpIHsKKyAgICAgICAgICAgICAgICBTdHJpbmcgdG8gPSBhLmdldFN0cmluZyhhbmRyb2lkLlIuc3R5bGVhYmxlLkN1cnNvckFkYXB0ZXJfTWFwSXRlbV90b1ZhbHVlKTsKKyAgICAgICAgICAgICAgICBpZiAodG8gPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCJBIG1hcCBpdGVtIGluICIgKworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc291cmNlcy5nZXRSZXNvdXJjZUVudHJ5TmFtZShtSWQpICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAiIGRvZXMgbm90IGhhdmUgYSAndG9WYWx1ZScgYXR0cmlidXRlIik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHRyYW5zZm9ybWF0aW9uLmFkZFN0cmluZ01hcHBpbmcoZnJvbSwgdG8pOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBpbnQgdG8gPSBhLmdldFJlc291cmNlSWQoYW5kcm9pZC5SLnN0eWxlYWJsZS5DdXJzb3JBZGFwdGVyX01hcEl0ZW1fdG9WYWx1ZSwgMCk7CisgICAgICAgICAgICAgICAgaWYgKHRvID09IDApIHsKKyAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigiQSBtYXAgaXRlbSBpbiAiICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXNvdXJjZXMuZ2V0UmVzb3VyY2VFbnRyeU5hbWUobUlkKSArCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIiBkb2VzIG5vdCBoYXZlIGEgJ3RvVmFsdWUnIGF0dHJpYnV0ZSIpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB0cmFuc2Zvcm1hdGlvbi5hZGRSZXNvdXJjZU1hcHBpbmcoZnJvbSwgdG8pOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBhLnJlY3ljbGUoKTsKKyAgICAgICAgfQorCisgICAgICAgIHByaXZhdGUgQ3Vyc29yVHJhbnNmb3JtYXRpb24gZmluZFRyYW5zZm9ybWF0aW9uKCkgeworICAgICAgICAgICAgUmVzb3VyY2VzIHJlc291cmNlcyA9IG1SZXNvdXJjZXM7CisgICAgICAgICAgICBDdXJzb3JUcmFuc2Zvcm1hdGlvbiB0cmFuc2Zvcm1hdGlvbiA9IG51bGw7CisgICAgICAgICAgICBUeXBlZEFycmF5IGEgPSByZXNvdXJjZXMub2J0YWluQXR0cmlidXRlcyhtQXR0cnMsCisgICAgICAgICAgICAgICAgICAgIGFuZHJvaWQuUi5zdHlsZWFibGUuQ3Vyc29yQWRhcHRlcl9UcmFuc2Zvcm1JdGVtKTsKKworICAgICAgICAgICAgU3RyaW5nIGNsYXNzTmFtZSA9IGEuZ2V0U3RyaW5nKGFuZHJvaWQuUi5zdHlsZWFibGUuQ3Vyc29yQWRhcHRlcl9UcmFuc2Zvcm1JdGVtX3dpdGhDbGFzcyk7CisgICAgICAgICAgICBpZiAoY2xhc3NOYW1lID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICBTdHJpbmcgZXhwcmVzc2lvbiA9IGEuZ2V0U3RyaW5nKAorICAgICAgICAgICAgICAgICAgICAgICAgYW5kcm9pZC5SLnN0eWxlYWJsZS5DdXJzb3JBZGFwdGVyX1RyYW5zZm9ybUl0ZW1fd2l0aEV4cHJlc3Npb24pOworICAgICAgICAgICAgICAgIHRyYW5zZm9ybWF0aW9uID0gY3JlYXRlRXhwcmVzc2lvblRyYW5zZm9ybWF0aW9uKGV4cHJlc3Npb24pOworICAgICAgICAgICAgfSBlbHNlIGlmICghbUNvbnRleHQuaXNSZXN0cmljdGVkKCkpIHsKKyAgICAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgICAgICBmaW5hbCBDbGFzczw/PiBrbGFzID0gQ2xhc3MuZm9yTmFtZShjbGFzc05hbWUsIHRydWUsIG1Db250ZXh0LmdldENsYXNzTG9hZGVyKCkpOworICAgICAgICAgICAgICAgICAgICBpZiAoQ3Vyc29yVHJhbnNmb3JtYXRpb24uY2xhc3MuaXNBc3NpZ25hYmxlRnJvbShrbGFzKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgZmluYWwgQ29uc3RydWN0b3I8Pz4gYyA9IGtsYXMuZ2V0RGVjbGFyZWRDb25zdHJ1Y3RvcihDb250ZXh0LmNsYXNzKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHRyYW5zZm9ybWF0aW9uID0gKEN1cnNvclRyYW5zZm9ybWF0aW9uKSBjLm5ld0luc3RhbmNlKG1Db250ZXh0KTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0gY2F0Y2ggKENsYXNzTm90Rm91bmRFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCJDYW5ub3QgaW5zdGFuY2lhdGUgdHJhbnNmb3JtIHR5cGUgaW4gIiArCisgICAgICAgICAgICAgICAgICAgICAgICAgICBtQ29udGV4dC5nZXRSZXNvdXJjZXMoKS5nZXRSZXNvdXJjZUVudHJ5TmFtZShtSWQpICsgIjogIiArIGNsYXNzTmFtZSwgZSk7CisgICAgICAgICAgICAgICAgfSBjYXRjaCAoTm9TdWNoTWV0aG9kRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigiQ2Fubm90IGluc3RhbmNpYXRlIHRyYW5zZm9ybSB0eXBlIGluICIgKworICAgICAgICAgICAgICAgICAgICAgICAgICAgbUNvbnRleHQuZ2V0UmVzb3VyY2VzKCkuZ2V0UmVzb3VyY2VFbnRyeU5hbWUobUlkKSArICI6ICIgKyBjbGFzc05hbWUsIGUpOworICAgICAgICAgICAgICAgIH0gY2F0Y2ggKEludm9jYXRpb25UYXJnZXRFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCJDYW5ub3QgaW5zdGFuY2lhdGUgdHJhbnNmb3JtIHR5cGUgaW4gIiArCisgICAgICAgICAgICAgICAgICAgICAgICAgICBtQ29udGV4dC5nZXRSZXNvdXJjZXMoKS5nZXRSZXNvdXJjZUVudHJ5TmFtZShtSWQpICsgIjogIiArIGNsYXNzTmFtZSwgZSk7CisgICAgICAgICAgICAgICAgfSBjYXRjaCAoSW5zdGFudGlhdGlvbkV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oIkNhbm5vdCBpbnN0YW5jaWF0ZSB0cmFuc2Zvcm0gdHlwZSBpbiAiICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIG1Db250ZXh0LmdldFJlc291cmNlcygpLmdldFJlc291cmNlRW50cnlOYW1lKG1JZCkgKyAiOiAiICsgY2xhc3NOYW1lLCBlKTsKKyAgICAgICAgICAgICAgICB9IGNhdGNoIChJbGxlZ2FsQWNjZXNzRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigiQ2Fubm90IGluc3RhbmNpYXRlIHRyYW5zZm9ybSB0eXBlIGluICIgKworICAgICAgICAgICAgICAgICAgICAgICAgICAgbUNvbnRleHQuZ2V0UmVzb3VyY2VzKCkuZ2V0UmVzb3VyY2VFbnRyeU5hbWUobUlkKSArICI6ICIgKyBjbGFzc05hbWUsIGUpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgYS5yZWN5Y2xlKCk7CisKKyAgICAgICAgICAgIGlmICh0cmFuc2Zvcm1hdGlvbiA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigiQSB0cmFuc2Zvcm0gaXRlbSBpbiAiICsKKyAgICAgICAgICAgICAgICAgICAgcmVzb3VyY2VzLmdldFJlc291cmNlRW50cnlOYW1lKG1JZCkgKyAiIG11c3QgaGF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zIFNpbXBsZUN1cnNvckFkYXB0ZXIgaW1wbGVtZW50cyBNYW5hZ2VkQWRhcHRlciB7CisgICAgICAgIHByaXZhdGUgU3RyaW5nIG1Vcmk7CisgICAgICAgIHByaXZhdGUgZmluYWwgU3RyaW5nIG1TZWxlY3Rpb247CisgICAgICAgIHByaXZhdGUgZmluYWwgU3RyaW5nW10gbVNlbGVjdGlvbkFyZ3M7CisgICAgICAgIHByaXZhdGUgZmluYWwgU3RyaW5nIG1Tb3J0T3JkZXI7CisgICAgICAgIHByaXZhdGUgZmluYWwgU3RyaW5nW10gbUNvbHVtbnM7CisgICAgICAgIHByaXZhdGUgZmluYWwgQ3Vyc29yQmluZGVyW10gbUJpbmRlcnM7CisgICAgICAgIHByaXZhdGUgQXN5bmNUYXNrPFZvaWQsVm9pZCxDdXJzb3I+IG1Mb2FkVGFzazsKKworICAgICAgICBYbWxDdXJzb3JBZGFwdGVyKENvbnRleHQgY29udGV4dCwgaW50IGxheW91dCwgU3RyaW5nIHVyaSwgU3RyaW5nW10gZnJvbSwgaW50W10gdG8sCisgICAgICAgICAgICAgICAgU3RyaW5nIHNlbGVjdGlvbiwgU3RyaW5nW10gc2VsZWN0aW9uQXJncywgU3RyaW5nIHNvcnRPcmRlciwKKyAgICAgICAgICAgICAgICBIYXNoTWFwPFN0cmluZywgQ3Vyc29yQmluZGVyPiBiaW5kZXJzKSB7CisKKyAgICAgICAgICAgIHN1cGVyKGNvbnRleHQsIGxheW91dCwgbnVsbCwgZnJvbSwgdG8pOworICAgICAgICAgICAgbUNvbnRleHQgPSBjb250ZXh0OworICAgICAgICAgICAgbVVyaSA9IHVyaTsKKyAgICAgICAgICAgIG1TZWxlY3Rpb24gPSBzZWxlY3Rpb247CisgICAgICAgICAgICBtU2VsZWN0aW9uQXJncyA9IHNlbGVjdGlvbkFyZ3M7CisgICAgICAgICAgICBtU29ydE9yZGVyID0gc29ydE9yZGVyOworICAgICAgICAgICAgbUNvbHVtbnMgPSBuZXcgU3RyaW5nW2Zyb20ubGVuZ3RoICsgMV07CisgICAgICAgICAgICAvLyBUaGlzIGlzIG1hbmRhdG9yeSBpbiBDdXJzb3JBZGFwdGVyCisgICAgICAgICAgICBtQ29sdW1uc1swXSA9ICJfaWQiOworICAgICAgICAgICAgU3lzdGVtLmFycmF5Y29weShmcm9tLCAwLCBtQ29sdW1ucywgMSwgZnJvbS5sZW5ndGgpOworCisgICAgICAgICAgICBDdXJzb3JCaW5kZXIgYmFzaWMgPSBuZXcgU3RyaW5nQmluZGVyKGNvbnRleHQsIG5ldyBJZGVudGl0eVRyYW5zZm9ybWF0aW9uKGNvbnRleHQpKTsKKyAgICAgICAgICAgIGZpbmFsIGludCBjb3VudCA9IGZyb20ubGVuZ3RoOworICAgICAgICAgICAgbUJpbmRlcnMgPSBuZXcgQ3Vyc29yQmluZGVyW2NvdW50XTsKKworICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBjb3VudDsgaSsrKSB7CisgICAgICAgICAgICAgICAgQ3Vyc29yQmluZGVyIGJpbmRlciA9IGJpbmRlcnMuZ2V0KGZyb21baV0pOworICAgICAgICAgICAgICAgIGlmIChiaW5kZXIgPT0gbnVsbCkgYmluZGVyID0gYmFzaWM7CisgICAgICAgICAgICAgICAgbUJpbmRlcnNbaV0gPSBiaW5kZXI7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIHZvaWQgYmluZFZpZXcoVmlldyB2aWV3LCBDb250ZXh0IGNvbnRleHQsIEN1cnNvciBjdXJzb3IpIHsKKyAgICAgICAgICAgIGZpbmFsIGludCBjb3VudCA9IG1Uby5sZW5ndGg7CisgICAgICAgICAgICBmaW5hbCBpbnRbXSBmcm9tID0gbUZyb207CisgICAgICAgICAgICBmaW5hbCBpbnRbXSB0byA9IG1UbzsKKyAgICAgICAgICAgIGZpbmFsIEN1cnNvckJpbmRlcltdIGJpbmRlcnMgPSBtQmluZGVyczsKKworICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBjb3VudDsgaSsrKSB7CisgICAgICAgICAgICAgICAgZmluYWwgVmlldyB2ID0gdmlldy5maW5kVmlld0J5SWQodG9baV0pOworICAgICAgICAgICAgICAgIGlmICh2ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgYmluZGVyc1tpXS5iaW5kKHYsIGN1cnNvciwgZnJvbVtpXSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgbG9hZCgpIHsKKyAgICAgICAgICAgIGlmIChtVXJpICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBtTG9hZFRhc2sgPSBuZXcgUXVlcnlUYXNrKCkuZXhlY3V0ZSgpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgdm9pZCBzZXRVcmkoU3RyaW5nIHVyaSkgeworICAgICAgICAgICAgbVVyaSA9IHVyaTsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgdm9pZCBjaGFuZ2VDdXJzb3IoQ3Vyc29yIGMpIHsKKyAgICAgICAgICAgIGlmIChtTG9hZFRhc2sgIT0gbnVsbCAmJiBtTG9hZFRhc2suZ2V0U3RhdHVzKCkgIT0gUXVlcnlUYXNrLlN0YXR1cy5GSU5JU0hFRCkgeworICAgICAgICAgICAgICAgIG1Mb2FkVGFzay5jYW5jZWwodHJ1ZSk7CisgICAgICAgICAgICAgICAgbUxvYWRUYXNrID0gbnVsbDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHN1cGVyLmNoYW5nZUN1cnNvcihjKTsKKyAgICAgICAgfQorCisgICAgICAgIGNsYXNzIFF1ZXJ5VGFzayBleHRlbmRzIEFzeW5jVGFzazxWb2lkLCBWb2lkLCBDdXJzb3I+IHsKKyAgICAgICAgICAgIEBPdmVycmlkZQorICAgICAgICAgICAgcHJvdGVjdGVkIEN1cnNvciBkb0luQmFja2dyb3VuZChWb2lkLi4uIHBhcmFtcykgeworICAgICAgICAgICAgICAgIGlmIChtQ29udGV4dCBpbnN0YW5jZW9mIEFjdGl2aXR5KSB7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiAoKEFjdGl2aXR5KSBtQ29udGV4dCkubWFuYWdlZFF1ZXJ5KAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIFVyaS5wYXJzZShtVXJpKSwgbUNvbHVtbnMsIG1TZWxlY3Rpb24sIG1TZWxlY3Rpb25BcmdzLCBtU29ydE9yZGVyKTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICByZXR1cm4gbUNvbnRleHQuZ2V0Q29udGVudFJlc29sdmVyKCkucXVlcnkoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgVXJpLnBhcnNlKG1VcmkpLCBtQ29sdW1ucywgbVNlbGVjdGlvbiwgbVNlbGVjdGlvbkFyZ3MsIG1Tb3J0T3JkZXIpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgQE92ZXJyaWRlCisgICAgICAgICAgICBwcm90ZWN0ZWQgdm9pZCBvblBvc3RFeGVjdXRlKEN1cnNvciBjdXJzb3IpIHsKKyAgICAgICAgICAgICAgICBpZiAoIWlzQ2FuY2VsbGVkKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgWG1sQ3Vyc29yQWRhcHRlci5zdXBlci5jaGFuZ2VDdXJzb3IoY3Vyc29yKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBJZGVudGl0eSB0cmFuc2Zvcm1hdGlvbiwgcmV0dXJucyB0aGUgY29udGVudCBvZiB0aGUgc3BlY2lmaWVkIGNvbHVtbiBhcyBhIFN0cmluZywKKyAgICAgKiB3aXRob3V0IHBlcmZvcm1pbmcgYW55IG1hbmlwdWxhdG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pbGRlciBtQnVpbGRlciA9IG5ldyBTdHJpbmdCdWlsZGVyKCk7CisKKyAgICAgICAgcHVibGljIEV4cHJlc3Npb25UcmFuc2Zvcm1hdGlvbihDb250ZXh0IGNvbnRleHQsIFN0cmluZyBleHByZXNzaW9uKSB7CisgICAgICAgICAgICBzdXBlcihjb250ZXh0KTsKKworICAgICAgICAgICAgcGFyc2UoZXhwcmVzc2lvbik7CisgICAgICAgIH0KKworICAgICAgICBwcml2YXRlIHZvaWQgcGFyc2UoU3RyaW5nIGV4cHJlc3Npb24pIHsKKyAgICAgICAgICAgIEV4cHJlc3Npb25Ob2RlIG5vZGUgPSBtRmlyc3ROb2RlOworICAgICAgICAgICAgaW50IHNlZ21lbnRTdGFydDsKKyAgICAgICAgICAgIGludCBjb3VudCA9IGV4cHJlc3Npb24ubGVuZ3RoKCk7CisKKyAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgY291bnQ7IGkrKykgeworICAgICAgICAgICAgICAgIGNoYXIgYyA9IGV4cHJlc3Npb24uY2hhckF0KGkpOworICAgICAgICAgICAgICAgIC8vIFN0YXJ0IGEgY29sdW1uIG5hbWUgc2VnbWVudAorICAgICAgICAgICAgICAgIHNlZ21lbnRTdGFydCA9IGk7CisgICAgICAgICAgICAgICAgaWYgKGMgPT0gJ3snKSB7CisgICAgICAgICAgICAgICAgICAgIHdoaWxlIChpIDwgY291bnQgJiYgKGMgPSBleHByZXNzaW9uLmNoYXJBdChpKSkgIT0gJ30nKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBpKys7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgLy8gV2UndmUgcmVhY2hlZCB0aGUgZW5kLCBidXQgdGhlIGV4cHJlc3Npb24gZGlkbid0IGNsb3NlCisgICAgICAgICAgICAgICAgICAgIGlmIChjICE9ICd9JykgeworICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigiVGhlIHRyYW5zZm9ybSBleHByZXNzaW9uIGNvbnRhaW5zIGEgIiArCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJub24tY2xvc2VkIGNvbHVtbiBuYW1lOiAiICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXhwcmVzc2lvbi5zdWJzdHJpbmcoc2VnbWVudFN0YXJ0ICsgMSwgaSkpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIG5vZGUubmV4dCA9IG5ldyBDb2x1bW5FeHByZXNzaW9uTm9kZShleHByZXNzaW9uLnN1YnN0cmluZyhzZWdtZW50U3RhcnQgKyAxLCBpKSk7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgd2hpbGUgKGkgPCBjb3VudCAmJiAoYyA9IGV4cHJlc3Npb24uY2hhckF0KGkpKSAhPSAneycpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGkrKzsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBub2RlLm5leHQgPSBuZXcgQ29uc3RhbnRFeHByZXNzaW9uTm9kZShleHByZXNzaW9uLnN1YnN0cmluZyhzZWdtZW50U3RhcnQsIGkpKTsKKyAgICAgICAgICAgICAgICAgICAgLy8gUmV3aW5kIGlmIHdlJ3ZlIHJlYWNoZWQgYSBjb2x1bW4gZXhwcmVzc2lvbgorICAgICAgICAgICAgICAgICAgICBpZiAoYyA9PSAneycpIGktLTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgbm9kZSA9IG5vZGUubmV4dDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgU3RyaW5nIHRyYW5zZm9ybShDdXJzb3IgY3Vyc29yLCBpbnQgY29sdW1uSW5kZXgpIHsKKyAgICAgICAgICAgIGZpbmFsIFN0cmluZ0J1aWxkZXIgYnVpbGRlciA9IG1CdWlsZGVyOworICAgICAgICAgICAgYnVpbGRlci5kZWxldGUoMCwgYnVpbGRlci5sZW5ndGgoKSk7CisKKyAgICAgICAgICAgIEV4cHJlc3Npb25Ob2RlIG5vZGUgPSBtRmlyc3ROb2RlOworICAgICAgICAgICAgLy8gU2tpcCB0aGUgZmlyc3Qgbm9kZQorICAgICAgICAgICAgd2hpbGUgKChub2RlID0gbm9kZS5uZXh0KSAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgYnVpbGRlci5hcHBlbmQobm9kZS5hc1N0cmluZyhjdXJzb3IpKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcmV0dXJuIGJ1aWxkZXIudG9TdHJpbmcoKTsKKyAgICAgICAgfQorCisgICAgICAgIHN0YXRpYyBhYnN0cmFjdCBjbGFzcyBFeHByZXNzaW9uTm9kZSB7CisgICAgICAgICAgICBwdWJsaWMgRXhwcmVzc2lvbk5vZGUgbmV4dDsKKworICAgICAgICAgICAgcHVibGljIGFic3RyYWN0IFN0cmluZyBhc1N0cmluZyhDdXJzb3IgY3Vyc29yKTsKKyAgICAgICAgfQorCisgICAgICAgIHN0YXRpYyBjbGFzcyBDb25zdGFudEV4cHJlc3Npb25Ob2RlIGV4dGVuZHMgRXhwcmVzc2lvbk5vZGUgeworICAgICAgICAgICAgcHJpdmF0ZSBmaW5hbCBTdHJpbmcgbUNvbnN0YW50OworCisgICAgICAgICAgICBDb25zdGFudEV4cHJlc3Npb25Ob2RlKFN0cmluZyBjb25zdGFudCkgeworICAgICAgICAgICAgICAgIG1Db25zdGFudCA9IGNvbnN0YW50OworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgICAgIHB1YmxpYyBTdHJpbmcgYXNTdHJpbmcoQ3Vyc29yIGN1cnNvcikgeworICAgICAgICAgICAgICAgIHJldHVybiBtQ29uc3RhbnQ7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBzdGF0aWMgY2xhc3MgQ29sdW1uRXhwcmVzc2lvbk5vZGUgZXh0ZW5kcyBFeHByZXNzaW9uTm9kZSB7CisgICAgICAgICAgICBwcml2YXRlIGZpbmFsIFN0cmluZyBtQ29sdW1uTmFtZTsKKyAgICAgICAgICAgIHByaXZhdGUgQ3Vyc29yIG1TaWduYXR1cmU7CisgICAgICAgICAgICBwcml2YXRlIGludCBtQ29sdW1uSW5kZXggPSAtMTsKKworICAgICAgICAgICAgQ29sdW1uRXhwcmVzc2lvbk5vZGUoU3RyaW5nIGNvbHVtbk5hbWUpIHsKKyAgICAgICAgICAgICAgICBtQ29sdW1uTmFtZSA9IGNvbHVtbk5hbWU7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIEBPdmVycmlkZQorICAgICAgICAgICAgcHVibGljIFN0cmluZyBhc1N0cmluZyhDdXJzb3IgY3Vyc29yKSB7CisgICAgICAgICAgICAgICAgaWYgKGN1cnNvciAhPSBtU2lnbmF0dXJlIHx8IG1Db2x1bW5JbmRleCA9PSAtMSkgeworICAgICAgICAgICAgICAgICAgICBtQ29sdW1uSW5kZXggPSBjdXJzb3IuZ2V0Q29sdW1uSW5kZXgobUNvbHVtbk5hbWUpOworICAgICAgICAgICAgICAgICAgICBtU2lnbmF0dXJlID0gY3Vyc29yOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIHJldHVybiBjdXJzb3IuZ2V0U3RyaW5nKG1Db2x1bW5JbmRleCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBBIG1hcCB0cmFuc2Zvcm1hdGlvbiBvZmZlcnMgYSBzaW1wbGUgbWFwcGluZyBiZXR3ZWVuIHNwZWNpZmllZCBTdHJpbmcgdmFsdWVzCisgICAgICogdG8gU3RyaW5ncyBvciBpbnRlZ2Vycy4KKyAgICAgKi8KKyAgICBwcml2YXRlIHN0YXRpYyBjbGFzcyBNYXBUcmFuc2Zvcm1hdGlvbiB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worICAgICAgICAgICAgcmV0dXJuIHRyYW5zZm9ybWVkID09IG51bGwgPyB2YWx1ZSA6IHRyYW5zZm9ybWVkOworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyBpbnQgdHJhbnNmb3JtVG9SZXNvdXJjZShDdXJzb3IgY3Vyc29yLCBpbnQgY29sdW1uSW5kZXgpIHsKKyAgICAgICAgICAgIGZpbmFsIFN0cmluZyB2YWx1ZSA9IGN1cnNvci5nZXRTdHJpbmcoY29sdW1uSW5kZXgpOworICAgICAgICAgICAgZmluYWwgSW50ZWdlciB0cmFuc2Zvcm1lZCA9IG1SZXNvdXJjZU1hcHBpbmdzLmdldCh2YWx1ZSk7CisgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIHJldHVybiB0cmFuc2Zvcm1lZCA9PSBudWxsID8gSW50ZWdlci5wYXJzZUludCh2YWx1ZSkgOiB0cmFuc2Zvcm1lZDsKKyAgICAgICAgICAgIH0gY2F0Y2ggKE51bWJlckZvcm1hdEV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIDA7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBCaW5kcyBhIFN0cmluZyB0byBhIFRleHRWaWV3LgorICAgICAqLworICAgIHByaXZhdGUgc3RhdGljIGNsYXNzIFN0cmluZ0JpbmRlciBleHRlbmRzIEN1cnNvckJpbmRlciB7CisgICAgICAgIHB1YmxpYyBTdHJpbmdCaW5kZXIoQ29udGV4dCBjb250ZXh0LCBDdXJzb3JUcmFuc2Zvcm1hdGlvbiB0cmFuc2Zvcm1hdGlvbikgeworICAgICAgICAgICAgc3VwZXIoY29udGV4dCwgdHJhbnNmb3JtYXRpb24pOworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyBib29sZWFuIGJpbmQoVmlldyB2aWV3LCBDdXJzb3IgY3Vyc29yLCBpbnQgY29sdW1uSW5kZXgpIHsKKyAgICAgICAgICAgIGlmICh2aWV3IGluc3RhbmNlb2YgVGV4dFZpZXcpIHsKKyAgICAgICAgICAgICAgICBmaW5hbCBTdHJpbmcgdGV4dCA9IG1UcmFuc2Zvcm1hdGlvbi50cmFuc2Zvcm0oY3Vyc29yLCBjb2x1bW5JbmRleCk7CisgICAgICAgICAgICAgICAgKChUZXh0Vmlldykgdmlldykuc2V0VGV4dCh0ZXh0KTsKKyAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIEJpbmRzIGFuIGltYWdlIGJsb2IgdG8gYW4gSW1hZ2VWaWV3LgorICAgICAqLworICAgIHByaXZhdGUgc3RhdGljIGNsYXNzIEltYWdlQmluZGVyIGV4dGVuZHMgQ3Vyc29yQmluZGVyIHsKKyAgICAgICAgcHVibGljIEltYWdlQmluZGVyKENvbnRleHQgY29udGV4dCwgQ3Vyc29yVHJhbnNmb3JtYXRpb24gdHJhbnNmb3JtYXRpb24pIHsKKyAgICAgICAgICAgIHN1cGVyKGNvbnRleHQsIHRyYW5zZm9ybWF0aW9uKTsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgYm9vbGVhbiBiaW5kKFZpZXcgdmlldywgQ3Vyc29yIGN1cnNvciwgaW50IGNvbHVtbkluZGV4KSB7CisgICAgICAgICAgICBpZiAodmlldyBpbnN0YW5jZW9mIEltYWdlVmlldykgeworICAgICAgICAgICAgICAgIGZpbmFsIGJ5dGVbXSBkYXRhID0gY3Vyc29yLmdldEJsb2IoY29sdW1uSW5kZXgpOworICAgICAgICAgICAgICAgICgoSW1hZ2VWaWV3KSB2aWV3KS5zZXRJbWFnZUJpdG1hcChCaXRtYXBGYWN0b3J5LmRlY29kZUJ5dGVBcnJheShkYXRhLCAwLAorICAgICAgICAgICAgICAgICAgICAgICAgZGF0YS5sZW5ndGgpKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgc3RhdGljIGNsYXNzIFRhZ0JpbmRlciBleHRlbmRzIEN1cnNvckJpbmRlciB7CisgICAgICAgIHB1YmxpYyBUYWdCaW5kZXIoQ29udGV4dCBjb250ZXh0LCBDdXJzb3JUcmFuc2Zvcm1hdGlvbiB0cmFuc2Zvcm1hdGlvbikgeworICAgICAgICAgICAgc3VwZXIoY29udGV4dCwgdHJhbnNmb3JtYXRpb24pOworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyBib29sZWFuIGJpbmQoVmlldyB2aWV3LCBDdXJzb3IgY3Vyc29yLCBpbnQgY29sdW1uSW5kZXgpIHsKKyAgICAgICAgICAgIGZpbmFsIFN0cmluZyB0ZXh0ID0gbVRyYW5zZm9ybWF0aW9uLnRyYW5zZm9ybShjdXJzb3IsIGNvbHVtbkluZGV4KTsKKyAgICAgICAgICAgIHZpZXcuc2V0VGFnKHRleHQpOworICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBCaW5kcyBhbiBpbWFnZSBVUkkgdG8gYW4gSW1hZ2VWaWV3LgorICAgICAqLworICAgIHByaXZhdGUgc3RhdGljIGNsYXNzIEltYWdlVXJpQmluZGVyIGV4dGVuZHMgQ3Vyc29yQmluZGVyIHsKKyAgICAgICAgcHVibGljIEltYWdlVXJpQmluZGVyKENvbnRleHQgY29udGV4dCwgQ3Vyc29yVHJhbnNmb3JtYXRpb24gdHJhbnNmb3JtYXRpb24pIHsKKyAgICAgICAgICAgIHN1cGVyKGNvbnRleHQsIHRyYW5zZm9ybWF0aW9uKTsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgYm9vbGVhbiBiaW5kKFZpZXcgdmlldywgQ3Vyc29yIGN1cnNvciwgaW50IGNvbHVtbkluZGV4KSB7CisgICAgICAgICAgICBpZiAodmlldyBpbnN0YW5jZW9mIEltYWdlVmlldykgeworICAgICAgICAgICAgICAgICgoSW1hZ2VWaWV3KSB2aWV3KS5zZXRJbWFnZVVSSShVcmkucGFyc2UoCisgICAgICAgICAgICAgICAgICAgICAgICBtVHJhbnNmb3JtYXRpb24udHJhbnNmb3JtKGN1cnNvciwgY29sdW1uSW5kZXgpKSk7CisgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBCaW5kcyBhIGRyYXdhYmxlIHJlc291cmNlIGlkZW50aWZpZXIgdG8gYW4gSW1hZ2VWaWV3LgorICAgICAqLworICAgIHByaXZhdGUgc3RhdGljIGNsYXNzIERyYXdhYmxlQmluZGVyIGV4dGVuZHMgQ3Vyc29yQmluZGVyIHsKKyAgICAgICAgcHVibGljIERyYXdhYmxlQmluZGVyKENvbnRleHQgY29udGV4dCwgQ3Vyc29yVHJhbnNmb3JtYXRpb24gdHJhbnNmb3JtYXRpb24pIHsKKyAgICAgICAgICAgIHN1cGVyKGNvbnRleHQsIHRyYW5zZm9ybWF0aW9uKTsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgYm9vbGVhbiBiaW5kKFZpZXcgdmlldywgQ3Vyc29yIGN1cnNvciwgaW50IGNvbHVtbkluZGV4KSB7CisgICAgICAgICAgICBpZiAodmlldyBpbnN0YW5jZW9mIEltYWdlVmlldykgeworICAgICAgICAgICAgICAgIGZpbmFsIGludCByZXNvdXJjZSA9IG1UcmFuc2Zvcm1hdGlvbi50cmFuc2Zvcm1Ub1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CiAgICAgICAgIFR5cGVkQXJyYXkgYSA9CiAgICAgICAgICAgICBjb250ZXh0Lm9idGFpblN0eWxlZEF0dHJpYnV0ZXMoCkBAIC0xNjYsMTQgKzEzOCwxMSBAQAogICAgICAgICBtVGhyZXNob2xkID0gYS5nZXRJbnQoCiAgICAgICAgICAgICAgICAgUi5zdHlsZWFibGUuQXV0b0NvbXBsZXRlVGV4dFZpZXdfY29tcGxldGlvblRocmVzaG9sZCwgMik7CiAKLSAgICAgICAgbUhpbnRUZXh0ID0gYS5nZXRUZXh0KFIuc3R5bGVhYmxlLkF1dG9Db21wbGV0ZVRleHRWaWV3X2NvbXBsZXRpb25IaW50KTsKLQotICAgICAgICBtRHJvcERvd25MaXN0SGlnaGxpZ2h0ID0gYS5nZXREcmF3YWJsZSgKLSAgICAgICAgICAgICAgICBSLnN0eWxlYWJsZS5BdXRvQ29tcGxldGVUZXh0Vmlld19kcm9wRG93blNlbGVjdG9yKTsKLSAgICAgICAgbURyb3BEb3duVmVydGljYWxPZmZzZXQgPSAoaW50KQotICAgICAgICAgICAgICAgIGEuZ2V0RGltZW5zaW9uKFIuc3R5bGVhYmxlLkF1dG9Db21wbGV0ZVRleHRWaWV3X2Ryb3BEb3duVmVydGljYWxPZmZzZXQsIDAuMGYpOwotICAgICAgICBtRHJvcERvd25Ib3Jpem9udGFsT2Zmc2V0ID0gKGludCkKLSAgICAgICAgICAgICAgICBhLmdldERpbWVuc2lvbihSLnN0eWxlYWJsZS5BdXRvQ29tcGxldGVUZXh0Vmlld19kcm9wRG93bkhvcml6b250YWxPZmZzZXQsIDAuMGYpOworICAgICAgICBtUG9wdXAuc2V0TGlzdFNlbGVjdG9yKGEuZ2V0RHJhd2FibGUoUi5zdHlsZWFibGUuQXV0b0NvbXBsZXRlVGV4dFZpZXdfZHJvcERvd25TZWxlY3RvcikpOworICAgICAgICBtUG9wdXAuc2V0VmVydGljYWxPZmZzZXQoKGludCkKKyAgICAgICAgICAgICAgICBhLmdldERpbWVuc2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S5BdXRvQ29tcGxldGVUZXh0Vmlld19kcm9wRG93bkhlaWdodCwKLSAgICAgICAgICAgICAgICBWaWV3R3JvdXAuTGF5b3V0UGFyYW1zLldSQVBfQ09OVEVOVCk7CisgICAgICAgIG1Qb3B1cC5zZXRXaWR0aChhLmdldExheW91dERpbWVuc2lvbigKKyAgICAgICAgICAgICAgICBSLnN0eWxlYWJsZS5BdXRvQ29tcGxldGVUZXh0Vmlld19kcm9wRG93bldpZHRoLAorICAgICAgICAgICAgICAgIFZpZXdHcm91cC5MYXlvdXRQYXJhbXMuV1JBUF9DT05URU5UKSk7CisgICAgICAgIG1Qb3B1cC5zZXRIZWlnaHQoYS5nZXRMYXlvdXREaW1lbnNpb24oCisgICAgICAgICAgICAgICAgUi5zdHlsZWFibGUuQXV0b0NvbXBsZXRlVGV4dFZpZXdfZHJvcERvd25IZWlnaHQsCisgICAgICAgICAgICAgICAgVmlld0dyb3VwLkxheW91dFBhcmFtcy5XUkFQX0NPTlRFTlQpKTsKIAogICAgICAgICBtSGludFJlc291cmNlID0gYS5nZXRSZXNvdXJjZUlkKFIuc3R5bGVhYmxlLkF1dG9Db21wbGV0ZVRleHRWaWV3X2NvbXBsZXRpb25IaW50VmlldywKICAgICAgICAgICAgICAgICBSLmxheW91dC5zaW1wbGVfZHJvcGRvd25faGludCk7CisgICAgICAgIAorICAgICAgICBtUG9wdXAuc2V0T25JdGVtQ2xpY2tMaXN0ZW5lcihuZXcgRHJvcERvd25JdGVtQ2xpY2tMaXN0ZW5lcigpKTsKKyAgICAgICAgc2V0Q29tcGxldGlvbkhpbnQoYS5nZXRUZXh0KFIuc3R5bGVhYmxlLkF1dG9Db21wbGV0ZVRleHRWaWV3X2NvbXBsZXRpb25IaW50KSk7CiAKICAgICAgICAgLy8gQWx3YXlzIHR1cm4gb24gdGhlIGF1dG8gY29tcGxldGUgaW5wdXQgdHlwZSBmbGFnLCBzaW5jZSBpdAogICAgICAgICAvLyBtYWtlcyBubyBzZW5zZSB0byB1c2UgdGhpcyB3aWRnZXQgd2l0aG91dCBpdC4KQEAgLTIzOCw2ICsyMTIsMjAgQEAKICAgICAgKi8KICAgICBwdWJsaWMgdm9pZCBzZXRDb21wbGV0aW9uSGludChDaGFyU2VxdWVuY2UgaGludCkgewogICAgICAgICBtSGludFRleHQgPSBoaW50OworICAgICAgICBpZiAoaGludCAhPSBudWxsKSB7CisgICAgICAgICAgICBpZiAobUhpbnRWaWV3ID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICBmaW5hbCBUZXh0VmlldyBoaW50VmlldyA9IChUZXh0VmlldykgTGF5b3V0SW5mbGF0ZXIuZnJvbShnZXRDb250ZXh0KCkpLmluZmxhdGUoCisgICAgICAgICAgICAgICAgICAgICAgICBtSGludFJlc291cmNlLCBudWxsKS5maW5kVmlld0J5SWQoY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5pZC50ZXh0MSk7CisgICAgICAgICAgICAgICAgaGludFZpZXcuc2V0VGV4dChtSGludFRleHQpOworICAgICAgICAgICAgICAgIG1IaW50VmlldyA9IGhpbnRWaWV3OworICAgICAgICAgICAgICAgIG1Qb3B1cC5zZXRQcm9tcHRWaWV3KGhpbnRWaWV3KTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgbUhpbnRWaWV3LnNldFRleHQoaGludCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBtUG9wdXAuc2V0UHJvbXB0VmlldyhudWxsKTsKKyAgICAgICAgICAgIG1IaW50VmlldyA9IG51bGw7CisgICAgICAgIH0KICAgICB9CiAgICAgCiAgICAgLyoqCkBAIC0yNTAsNyArMjM4LDcgQEAKICAgICAgKiBAYXR0ciByZWYgYW5kcm9pZC5SLnN0eWxlYWJsZSNBdXRvQ29tcGxldGVUZXh0Vmlld19kcm9wRG93bldpZHRoCiAgICAgICovCiAgICAgcHVibGljIGludCBnZXREcm9wRG93bldpZHRoKCkgewotICAgICAgICByZXR1cm4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2hvcihpbnQgaWQpIHsKICAgICAgICAgbURyb3BEb3duQW5jaG9ySWQgPSBpZDsKLSAgICAgICAgbURyb3BEb3duQW5jaG9yVmlldyA9IG51bGw7CisgICAgICAgIG1Qb3B1cC5zZXRBbmNob3JWaWV3KG51bGwpOwogICAgIH0KICAgICAKICAgICAvKioKQEAgLTM1OCw3ICszNDYsNyBAQAogICAgICAqIEBwYXJhbSBvZmZzZXQgdGhlIHZlcnRpY2FsIG9mZnNldAogICAgICAqLwogICAgIHB1YmxpYyB2b2lkIHNldERyb3BEb3duVmVydGljYWxPZmZzZXQoaW50IG9mZnNldCkgewotICAgICAgICBtRHJvcERvd25WZXJ0aWNhbE9mZnNldCA9IG9mZnNldDsKKyAgICAgICAgbVBvcHVwLnNldFZlcnRpY2FsT2Zmc2V0KG9mZnNldCk7CiAgICAgfQogICAgIAogICAgIC8qKgpAQCAtMzY3LDcgKzM1NSw3IEBACiAgICAgICogQHJldHVybiB0aGUgdmVydGljYWwgb2Zmc2V0CiAgICAgICovCiAgICAgcHVibGljIGludCBnZXREcm9wRG93blZlcnRpY2FsT2Zmc2V0KCkgewotICAgICAgICByZXR1cm4gbURyb3BEb3duVmVydGljYWxPZmZzZXQ7CisgICAgICAgIHJldHVybiBtUG9wdXAuZ2V0VmVydGljYWxPZmZzZXQoKTsKICAgICB9CiAgICAgCiAgICAgLyoqCkBAIC0zNzYsNyArMzY0LDcgQEAKICAgICAgKiBAcGFyYW0gb2Zmc2V0IHRoZSBob3Jpem9udGFsIG9mZnNldAogICAgICAqLwogICAgIHB1YmxpYyB2b2lkIHNldERyb3BEb3duSG9yaXpvbnRhbE9mZnNldChpbnQgb2Zmc2V0KSB7Ci0gICAgICAgIG1Ecm9wRG93bkhvcml6b250YWxPZmZzZXQgPSBvZmZzZXQ7CisgICAgICAgIG1Qb3B1cC5zZXRIb3Jpem9udGFsT2Zmc2V0KG9mZnNldCk7CiAgICAgfQogICAgIAogICAgIC8qKgpAQCAtMzg1LDcgKzM3My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lbnQpOwotICAgICAgICAgICAgaWYgKGNvbnN1bWVkKSB7Ci0gICAgICAgICAgICAgICAgc3dpdGNoIChrZXlDb2RlKSB7Ci0gICAgICAgICAgICAgICAgICAgIC8vIGlmIHRoZSBsaXN0IGFjY2VwdHMgdGhlIGtleSBldmVudHMgYW5kIHRoZSBrZXkgZXZlbnQKLSAgICAgICAgICAgICAgICAgICAgLy8gd2FzIGEgY2xpY2ssIHRoZSB0ZXh0IHZpZXcgZ2V0cyB0aGUgc2VsZWN0ZWQgaXRlbQotICAgICAgICAgICAgICAgICAgICAvLyBmcm9tIHRoZSBkcm9wIGRvd24gYXMgaXRzIGNvbnRlbnQKLSAgICAgICAgICAgICAgICAgICAgY2FzZSBLZXlFdmVudC5LRVlDT0RFX0VOVEVSOgotICAgICAgICAgICAgICAgICAgICBjYXNlIEtleUV2ZW50LktFWUNPREVfRFBBRF9DRU5URVI6Ci0gICAgICAgICAgICAgICAgICAgICAgICBwZXJmb3JtQ29tcGxldGlvbigpOwotICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7Ci0gICAgICAgICAgICAgICAgfQorICAgICAgICBib29sZWFuIGNvbnN1bWVkID0gbVBvcHVwLm9uS2V5VXAoa2V5Q29kZSwgZXZlbnQpOworICAgICAgICBpZiAoY29uc3VtZWQpIHsKKyAgICAgICAgICAgIHN3aXRjaCAoa2V5Q29kZSkgeworICAgICAgICAgICAgLy8gaWYgdGhlIGxpc3QgYWNjZXB0cyB0aGUga2V5IGV2ZW50cyBhbmQgdGhlIGtleSBldmVudAorICAgICAgICAgICAgLy8gd2FzIGEgY2xpY2ssIHRoZSB0ZXh0IHZpZXcgZ2V0cyB0aGUgc2VsZWN0ZWQgaXRlbQorICAgICAgICAgICAgLy8gZnJvbSB0aGUgZHJvcCBkb3duIGFzIGl0cyBjb250ZW50CisgICAgICAgICAgICBjYXNlIEtleUV2ZW50LktFWUNPREVfRU5URVI6CisgICAgICAgICAgICBjYXNlIEtleUV2ZW50LktFWUNPREVfRFBBRF9DRU5URVI6CisgICAgICAgICAgICAgICAgcGVyZm9ybUNvbXBsZXRpb24oKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgICAgICAgIH0KICAgICAgICAgfQogICAgICAgICByZXR1cm4gc3VwZXIub25LZXlVcChrZXlDb2RlLCBldmVudCk7CkBAIC02NTIsODcgKzYzNiwxMSBAQAogCiAgICAgQE92ZXJyaWRlCiAgICAgcHVibGljIGJvb2xlYW4gb25LZXlEb3duKGludCBrZXlDb2RlLCBLZXlFdmVudCBldmVudCkgewotICAgICAgICAvLyB3aGVuIHRoZSBkcm9wIGRvd24gaXMgc2hvd24sIHdlIGRyaXZlIGl0IGRpcmVjdGx5Ci0gICAgICAgIGlmIChpc1BvcHVwU2hvd2luZygpKSB7Ci0gICAgICAgICAgICAvLyB0aGUga2V5IGV2ZW50cyBhcmUgZm9yd2FyZGVkIHRvIHRoZSBsaXN0IGluIHRoZSBkcm9wIGRvd24gdmlldwotICAgICAgICAgICAgLy8gbm90ZSB0aGF0IExpc3RWaWV3IGhhbmRsZXMgc3BhY2UgYnV0IHdlIGRvbid0IHdhbnQgdGhhdCB0byBoYXBwZW4KLSAgICAgICAgICAgIC8vIGFsc28gaWYgc2VsZWN0aW9uIGlzIG5vdCBjdXJyZW50bHkgaW4gdGhlIGRyb3AgZG93biwgdGhlbiBkb24ndAotICAgICAgICAgICAgLy8gbGV0IGNlbnRlciBvciBlbnRlciBwcmVzc2VzIGdvIHRoZXJlIHNpbmNlIHRoYXQgd291bGQgY2F1c2UgaXQKLSAgICAgICAgICAgIC8vIHRvIHNlbGVjdCBvbmUgb2YgaXRzIGl0ZW1zCi0gICAgICAgICAgICBpZiAoa2V5Q29kZSAhPSBLZXlFdmVudC5LRVlDT0RFX1NQQUNFCi0gICAgICAgICAgICAgICAgICAgICYmIChtRHJvcERvd25MaXN0LmdldFNlbGVjdGVkSXRlbVBvc2l0aW9uKCkgPj0gMAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHx8IChrZXlDb2RlICE9IEtleUV2ZW50LktFWUNPREVfRU5URVIKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICYmIGtleUNvZGUgIT0gS2V5RXZlbnQuS0VZQ09ERV9EUEFEX0NFTlRFUikpKSB7Ci0gICAgICAgICAgICAgICAgaW50IGN1ckluZGV4ID0gbURyb3BEb3duTGlzdC5nZXRTZWxlY3RlZEl0ZW1Qb3NpdGlvbigpOwotICAgICAgICAgICAgICAgIGJvb2xlYW4gY29uc3VtZWQ7Ci0KLSAgICAgICAgICAgICAgICBmaW5hbCBib29sZWFuIGJlbG93ID0gIW1Qb3B1cC5pc0Fib3ZlQW5jaG9yKCk7Ci0KLSAgICAgICAgICAgICAgICBmaW5hbCBMaXN0QWRhcHRlciBhZGFwdGVyID0gbUFkYXB0ZXI7Ci0gICAgICAgICAgICAgICAgCi0gICAgICAgICAgICAgICAgYm9vbGVhbiBhbGxFbmFibGVkOwotICAgICAgICAgICAgICAgIGludCBmaXJzdEl0ZW0gPSBJbnRlZ2VyLk1BWF9WQUxVRTsKLSAgICAgICAgICAgICAgICBpbnQgbGFzdEl0ZW0gPSBJbnRlZ2VyLk1JTl9WQUxVRTsKLQotICAgICAgICAgICAgICAgIGlmIChhZGFwdGVyICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgYWxsRW5hYmxlZCA9IGFkYXB0ZXIuYXJlQWxsSXRlbXNFbmFibGVkKCk7Ci0gICAgICAgICAgICAgICAgICAgIGZpcnN0SXRlbSA9IGFsbEVuYWJsZWQgPyAwIDoKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBtRHJvcERvd25MaXN0Lmxvb2tGb3JTZWxlY3RhYmxlUG9zaXRpb24oMCwgdHJ1ZSk7Ci0gICAgICAgICAgICAgICAgICAgIGxhc3RJdGVtID0gYWxsRW5hYmxlZCA/IGFkYXB0ZXIuZ2V0Q291bnQoKSAtIDEgOgotICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1Ecm9wRG93bkxpc3QubG9va0ZvclNlbGVjdGFibGVQb3NpdGlvbihhZGFwdGVyLmdldENvdW50KCkgLSAxLCBmYWxzZSk7ICAgICAgICAgICAgICAgICAgICAKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgCi0gICAgICAgICAgICAgICAgaWYgKChiZWxvdyAmJiBrZXlDb2RlID09IEtleUV2ZW50LktFWUNPREVfRFBBRF9VUCAmJiBjdXJJbmRleCA8PSBmaXJzdEl0ZW0pIHx8Ci0gICAgICAgICAgICAgICAgICAgICAgICAoIWJlbG93ICYmIGtleUNvZGUgPT0gS2V5RXZlbnQuS0VZQ09ERV9EUEFEX0RPV04gJiYgY3VySW5kZXggPj0gbGFzdEl0ZW0pKSB7Ci0gICAgICAgICAgICAgICAgICAgIC8vIFdoZW4gdGhlIHNlbGVjdGlvbiBpcyBhdCB0aGUgdG9wLCB3ZSBibG9jayB0aGUga2V5Ci0gICAgICAgICAgICAgICAgICAgIC8vIGV2ZW50IHRvIHByZXZlbnQgZm9jdXMgZnJvbSBtb3ZpbmcuCi0gICAgICAgICAgICAgICAgICAgIGNsZWFyTGlzdFNlbGVjdGlvbigpOwotICAgICAgICAgICAgICAgICAgICBtUG9wdXAuc2V0SW5wdXRNZXRob2RNb2RlKFBvcHVwV2luZG93LklOUFVUX01FVEhPRF9ORUVERUQpOwotICAgICAgICAgICAgICAgICAgICBzaG93RHJvcERvd24oKTsKLSAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgLy8gV0FSTklORzogUGxlYXNlIHJlYWQgdGhlIGNvbW1lbnQgd2hlcmUgbUxpc3RTZWxlY3Rpb25IaWRkZW4KLSAgICAgICAgICAgICAgICAgICAgLy8gICAgICAgICAgaXMgZGVjbGFyZWQKLSAgICAgICAgICAgICAgICAgICAgbURyb3BEb3duTGlzdC5tTGlzdFNlbGVjdGlvbkhpZGRlbiA9IGZhbHNlOwotICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgIGNvbnN1bWVkID0gbURyb3BEb3duTGlzdC5vbktleURvd24oa2V5Q29kZSwgZXZlbnQpOwotICAgICAgICAgICAgICAgIGlmIChERUJVRykgTG9nLnYoVEFHLCAiS2V5IGRvd246IGNvZGU9IiArIGtleUNvZGUgKyAiIGxpc3QgY29uc3VtZWQ9IiArIGNvbnN1bWVkKTsKLQotICAgICAgICAgICAgICAgIGlmIChjb25zdW1lZCkgewotICAgICAgICAgICAgICAgICAgICAvLyBJZiBpdCBoYW5kbGVkIHRoZSBrZXkgZXZlbnQsIHRoZW4gdGhlIHVzZXIgaXMKLSAgICAgICAgICAgICAgICAgICAgLy8gbmF2aWdhdGluZyBpbiB0aGUgbGlzdCwgc28gd2Ugc2hvdWxkIHB1dCBpdCBpbiBmcm9udC4KLSAgICAgICAgICAgICAgICAgICAgbVBvcHVwLnNldElucHV0TWV0aG9kTW9kZShQb3B1cFdpbmRvdy5JTlBVVF9NRVRIT0RfTk9UX05FRURFRCk7Ci0gICAgICAgICAgICAgICAgICAgIC8vIEhlcmUncyBhIGxpdHRsZSB0cmljayB3ZSBuZWVkIHRvIGRvIHRvIG1ha2Ugc3VyZSB0aGF0Ci0gICAgICAgICAgICAgICAgICAgIC8vIHRoZSBsaXN0IHZpZXcgaXMgYWN0dWFsbHkgc2hvd2luZyBpdHMgZm9jdXMgaW5kaWNhdG9yLAotICAgICAgICAgICAgICAgICAgICAvLyBieSBlbnN1cmluZyBpdCBoYXMgZm9jdXMgYW5kIGdldHRpbmcgaXRzIHdpbmRvdyBvdXQKLSAgICAgICAgICAgICAgICAgICAgLy8gb2YgdG91Y2ggbW9kZS4KLSAgICAgICAgICAgICAgICAgICAgbURyb3BEb3duTGlzdC5yZXF1ZXN0Rm9jdXNGcm9tVG91Y2goKTsKLSAgICAgICAgICAgICAgICAgICAgc2hvd0Ryb3BEb3duKCk7Ci0KLSAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChrZXlDb2RlKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAvLyBhdm9pZCBwYXNzaW5nIHRoZSBmb2N1cyBmcm9tIHRoZSB0ZXh0IHZpZXcgdG8gdGhlCi0gICAgICAgICAgICAgICAgICAgICAgICAvLyBuZXh0IGNvbXBvbmVudAotICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBLZXlFdmVudC5LRVlDT0RFX0VOVEVSOgotICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBLZXlFdmVudC5LRVlDT0RFX0RQQURfQ0VOVEVSOgotICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBLZXlFdmVudC5LRVlDT0RFX0RQQURfRE9XTjoKLSAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgS2V5RXZlbnQuS0VZQ09ERV9EUEFEX1VQOgotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgaWYgKGJlbG93ICYmIGtleUNvZGUgPT0gS2V5RXZlbnQuS0VZQ09ERV9EUEFEX0RPV04pIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIC8vIHdoZW4gdGhlIHNlbGVjdGlvbiBpcyBhdCB0aGUgYm90dG9tLCB3ZSBibG9jayB0aGUKLSAgICAgICAgICAgICAgICAgICAgICAgIC8vIGV2ZW50IHRvIGF2b2lkIGdvaW5nIHRvIHRoZSBuZXh0IGZvY3VzYWJsZSB3aWRnZXQKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjdXJJbmRleCA9PSBsYXN0SXRlbSkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKCFiZWxvdyAmJiBrZXlDb2RlID09IEtleUV2ZW50LktFWUNPREVfRFBBRF9VUCAmJgotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1ckluZGV4ID09IGZpcnN0SXRlbSkgewotICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0gZWxzZSB7CisgICAgICAgIGlmIChtUG9wdXAub25LZXlEb3duKGtleUNvZGUsIGV2ZW50KSkgeworICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIGlmICghaXNQb3B1cFNob3dpbmcoKSkgewogICAgICAgICAgICAgc3dpdGNoKGtleUNvZGUpIHsKICAgICAgICAgICAgIGNhc2UgS2V5RXZlbnQuS0VZQ09ERV9EUEFEX0RPV046CiAgICAgICAgICAgICAgICAgcGVyZm9ybVZhbGlkYXRpb24oKTsKQEAgLTc0Myw3ICs2NTEsNyBAQAogICAgICAgICBib29sZWFuIGhhbmRsZWQgPSBzdXBlci5vbktleURvd24oa2V5Q29kZSwgZXZlbnQpOwogICAgICAgICBtTGFzdEtleUNvZGUgPSBLZXlFdmVudC5LRVlDT0RFX1VOS05PV047CiAKLSAgICAgICAgaWYgKGhhbmRsZWQgJiYgaXNQb3B1cFNob3dpbmcoKSAmJiBtRHJvcERvd25MaXN0ICE9IG51bGwpIHsKKyAgICAgICAgaWYgKGhhbmRsZWQgJiYgaXNQb3B1cFNob3dpbmcoKSkgewogICAgICAgICAgICAgY2xlYXJMaXN0U2VsZWN0aW9uKCk7CiAgICAgICAgIH0KIApAQCAtODA0LDExICs3MTIsMTIgQEAKICAgICAgICAgaWYgKGVub3VnaFRvRmlsdGVyKCkpIHsKICAgICAgICAgICAgIGlmIChtRmlsdGVyICE9IG51bGwpIHsKICAgICAgICAgICAgICAgICBwZXJmb3JtRmlsdGVyaW5nKGdldFRleHQo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gIH0KIAogICAgIC8qKgpAQCAtOTExLDEzICs4MDcsNyBAQAogICAgICAgICAgICAgcmVwbGFjZVRleHQoY29tcGxldGlvbi5nZXRUZXh0KCkpOwogICAgICAgICAgICAgbUJsb2NrQ29tcGxldGlvbiA9IGZhbHNlOwogCi0gICAgICAgICAgICBpZiAobUl0ZW1DbGlja0xpc3RlbmVyICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICBmaW5hbCBEcm9wRG93bkxpc3RWaWV3IGxpc3QgPSBtRHJvcERvd25MaXN0OwotICAgICAgICAgICAgICAgIC8vIE5vdGUgdGhhdCB3ZSBkb24ndCBoYXZlIGEgVmlldyBoZXJlLCBzbyB3ZSB3aWxsIG5lZWQgdG8KLSAgICAgICAgICAgICAgICAvLyBzdXBwbHkgbnVsbC4gIEhvcGVmdWxseSBubyBleGlzdGluZyBhcHBzIGNyYXNoLi4uCi0gICAgICAgICAgICAgICAgbUl0ZW1DbGlja0xpc3RlbmVyLm9uSXRlbUNsaWNrKGxpc3QsIG51bGwsIGNvbXBsZXRpb24uZ2V0UG9zaXRpb24oKSwKLSAgICAgICAgICAgICAgICAgICAgICAgIGNvbXBsZXRpb24uZ2V0SWQoKSk7Ci0gICAgICAgICAgICB9CisgICAgICAgICAgICBtUG9wdXAucGVyZm9ybUl0ZW1DbGljayhjb21wbGV0aW9uLmdldFBvc2l0aW9uKCkpOwogICAgICAgICB9CiAgICAgfQogCkBAIC05MjUsNyArODE1LDcgQEAKICAgICAgICAgaWYgKGlzUG9wdXBTaG93aW5nKCkpIHsKICAgICAgICAgICAgIE9iamVjdCBzZWxlY3RlZEl0ZW07CiAgICAgICAgICAgICBpZiAocG9zaXRpb24gPCAwKSB7Ci0gICAgICAgICAgICAgICAgc2VsZWN0ZWRJdGVtID0gbURyb3BEb3duTGlzdC5nZXRTZWxlY3RlZEl0ZW0oKTsKKyAgICAgICAgICAgICAgICBzZWxlY3RlZEl0ZW0gPSBtUG9wdXAuZ2V0U2VsZWN0ZWRJdGVtKCk7CiAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgIHNlbGVjdGVkSXRlbSA9IG1BZGFwdGVyLmdldEl0ZW0ocG9zaXRpb24pOwogICAgICAgICAgICAgfQpAQCAtOTM5LDE4ICs4MjksMTggQEAKICAgICAgICAgICAgIG1CbG9ja0NvbXBsZXRpb24gPSBmYWxzZTsgICAgICAgICAgICAKIAogICAgICAgICAgICAgaWYgKG1JdGVtQ2xpY2tMaXN0ZW5lciAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgZmluYWwgRHJvcERvd25MaXN0VmlldyBsaXN0ID0gbURyb3BEb3duTGlzdDsKKyAgICAgICAgICAgICAgICBmaW5hbCBMaXN0UG9wdXBXaW5kb3cgbGlzdCA9IG1Qb3B1cDsKIAogICAgICAgICAgICAgICAgIGlmIChzZWxlY3RlZFZpZXcgPT0gbnVsbCB8fCBwb3NpdGlvbiA8IDApIHsKICAgICAgICAgICAgICAgICAgICAgc2VsZWN0ZWRWaWV3ID0gbGlzdC5nZXRTZWxlY3RlZFZpZXcoKTsKICAgICAgICAgICAgICAgICAgICAgcG9zaXRpb24gPSBsaXN0LmdldFNlbGVjdGVkSXRlbVBvc2l0aW9uKCk7CiAgICAgICAgICAgICAgICAgICAgIGlkID0gbGlzdC5nZXRTZWxlY3RlZEl0ZW1JZCgpOwogICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBtSXRlbUNsaWNrTGlzdGVuZXIub25JdGVtQ2xpY2sobGlzdCwgc2VsZWN0ZWRWaWV3LCBwb3NpdGlvbiwgaWQpOworICAgICAgICAgICAgICAgIG1JdGVtQ2xpY2tMaXN0ZW5lci5vbkl0ZW1DbGljayhsaXN0LmdldExpc3RWaWV3KCksIHNlbGVjdGVkVmlldywgcG9zaXRpb24sIGlkKTsKICAgICAgICAgICAgIH0KICAgICAgICAgfQogCi0gICAgICAgIGlmIChtRHJvcERvd25EaXNtaXNzZWRPbkNvbXBsZXRpb24gJiYgIW1Ecm9wRG93bkFsd2F5c1Zpc2libGUpIHsKKyAgICAgICAgaWYgKG1Ecm9wRG93bkRpc21pc3NlZE9uQ29tcGxldGlvbiAmJiAhbVBvcHVwLmlzRHJvcERvd25BbHdheXNWaXNpYmxlKCkpIHsKICAgICAgICAgICAgIGRpc21pc3NEcm9wRG93bigpOwogICAgICAgICB9CiAgICAgfQpAQCAtMTAwMCw3ICs4OTAsNiBAQAogICAgIC8qKiB7QGluaGVyaXREb2N9ICovCiAgICAgcHVibGljIHZvaWQgb25GaWx0ZXJDb21wbGV0ZShpbnQgY291bnQpIHsKICAgICAgICAgdXBkYXRlRHJvcERvd25Gb3JGaWx0ZXIoY291bnQpOwotCiAgICAgfQogCiAgICAgcHJpdmF0ZSB2b2lkIHVwZGF0ZURyb3BEb3duRm9yRmlsdGVyKGludCBjb3VudCkgewpAQCAtMTAxNCwxMSArOTAzLDEyIEBACiAgICAgICAgICAqIHRvIGZpbHRlci4KICAgICAgICAgICovCiAKLSAgICAgICAgaWYgKChjb3VudCA+IDAgfHwgbURyb3BEb3duQWx3YXlzVmlzaWJsZSkgJiYgZW5vdWdoVG9GaWx0ZXIoKSkgeworICAgICAgICBmaW5hbCBib29sZWFuIGRyb3BEb3duQWx3YXlzVmlzaWJsZSA9IG1Qb3B1cC5pc0Ryb3BEb3duQWx3YXlzVmlzaWJsZSgpOworICAgICAgICBpZiAoKGNvdW50ID4gMCB8fCBkcm9wRG93bkFsd2F5c1Zpc2libGUpICYmIGVub3VnaFRvRmlsdGVyKCkpIHsKICAgICAgICAgICAgIGlmIChoYXNGb2N1cygpICYmIGhhc1dpbmRvd0ZvY3VzKCkpIHsKICAgICAgICAgICAgICAgICBzaG93RHJvcERvd24oKTsKICAgICAgICAgICAgIH0KLSAgICAgICAgfSBlbHNlIGlmICghbURyb3BEb3duQWx3YXlzVmlzaWJsZSkgeworICAgICAgICB9IGVsc2UgaWYgKCFkcm9wRG93bkFsd2F5c1Zpc2libGUpIHsKICAgICAgICAgICAgIGRpc21pc3NEcm9wRG93bigpOwogICAgICAgICB9CiAgICAgfQpAQCAtMTAyNiw3ICs5MTYsNyBAQAogICAgIEBPdmVycmlkZQogICAgIHB1YmxpYyB2b2lkIG9uV2luZG93Rm9jdXNDaGFuZ2VkKGJvb2xlYW4gaGFzV2luZG93Rm9jdXMpIHsKICAgICAgICAgc3VwZXIub25XaW5kb3dGb2N1c0NoYW5nZWQoaGFzV2luZG93Rm9jdXMpOwotICAgICAgICBpZiAoIWhhc1dpbmRvd0ZvY3VzICYmICFtRHJvcERvd25BbHdheXNWaXNpYmxlKSB7CisgICAgICAgIGlmICghaGFzV2luZG93Rm9jdXMgJiYgIW1Qb3B1cC5pc0Ryb3BEb3duQWx3YXlzVmlzaWJsZSgpKSB7CiAgICAgICAgICAgICBkaXNtaXNzRHJvcERvd24oKTsKICAgICAgICAgfQogICAgIH0KQEAgLTEwMzYsNyArOTI2LDcgQEAKICAgICAgICAgc3VwZXIub25EaXNwbGF5SGludChoaW50KTsKICAgICAgICAgc3dpdGNoIChoaW50KSB7CiAgICAgICAgICAgICBjYXNlIElOVklTSUJMRToKLSAgICAgICAgICAgICAgICBpZiAoIW1Ecm9wRG93bkFsd2F5c1Zpc2libGUpIHsKKyAgICAgICAgICAgICAgICBpZiAoIW1Qb3B1cC5pc0Ryb3BEb3duQWx3YXlzVmlzaWJsZSgpKSB7CiAgICAgICAgICAgICAgICAgICAgIGRpc21pc3NEcm9wRG93bigpOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBicmVhazsKQEAgLTEwNTAsNyArOTQwLDcgQEAKICAgICAgICAgaWYgKCFmb2N1c2VkKSB7CiAgICAgICAgICAgICBwZXJmb3JtVmFsaWRhdGlvbigpOwogICAgICAgICB9Ci0gICAgICAgIGlmICghZm9jdXNlZCAmJiAhbURyb3BEb3duQWx3YXlzVmlzaWJsZSkgeworICAgICAgICBpZiAoIWZvY3VzZWQgJiYgIW1Qb3B1cC5pc0Ryb3BEb3duQWx3YXlzVmlzaWJsZSgpKSB7CiAgICAgICAgICAgICBkaXNtaXNzRHJvcERvd24oKTsKICAgICAgICAgfQogICAgIH0KQEAgLTEwNzUsOCArOTY1LDYgQEAKICAgICAgICAgICAgIGltbS5kaXNwbGF5Q29tcGxldGlvbnModGhpcywgbnVsbCk7CiAgICAgICAgIH0KICAgICAgICAgbVBvcHVwLmRpc21pc3MoKTsKLSAgICAgICAgbVBvcHVwLnNldENvbnRlbnRWaWV3KG51bGwpOwotICAgICAgICBtRHJvcERvd25MaXN0ID0gbnVsbDsKICAgICB9CiAKICAgICBAT3ZlcnJpZGUKQEAgLTEwODksMTggKzk3Nyw2IEBACiAKICAgICAgICAgcmV0dXJuIHJlc3VsdDsKICAgICB9Ci0gICAgCi0gICAgLyoqCi0gICAgICogPHA+VXNlZCBmb3IgbGF6eSBpbnN0YW50aWF0aW9uIG9mIHRoZSBhbmNob3IgdmlldyBmcm9tIHRoZSBpZCB3ZSBoYXZlLiBJZiB0aGUgdmFsdWUgb2YKLSAgICAgKiB0aGUgaWQgaXMgTk9fSUQgb3Igd2UgY2FuJ3QgZmluZCBhIHZpZXcgZm9yIHRoZSBnaXZlbiBpZCwgd2UgcmV0dXJuIHRoaXMgVGV4dFZpZXcgYXMKLSAgICAgKiB0aGUgZGVmYXVsdCBhbmNob3JpbmcgcG9pbnQuPC9wPgotICAgICAqLwotICAgIHByaXZhdGUgVmlldyBnZXREcm9wRG93bkFuY2hvclZpZXcoKSB7Ci0gICAgICAgIGlmIChtRHJvcERvd25BbmNob3JWaWV3ID09IG51bGwgJiYgbURyb3BEb3duQW5jaG9ySWQgIT0gVmlldy5OT19JRCkgewotICAgICAgICAgICAgbURyb3BEb3duQW5jaG9yVmlldyA9IGdldFJvb3RWaWV3KCkuZmluZFZpZXdCeUlkKG1Ecm9wRG93bkFuY2hvcklkKTsKLSAgICAgICAgfQotICAgICAgICByZXR1cm4gbURyb3BEb3duQW5jaG9yVmlldyA9PSBudWxsID8gdGhpcyA6I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oKTsKKyAgICAgICAgaWYgKG1Qb3B1cC5nZXRBbmNob3JWaWV3KCkgPT0gbnVsbCkgeworICAgICAgICAgICAgaWYgKG1Ecm9wRG93bkFuY2hvcklkICE9IFZpZXcuTk9fSUQpIHsKKyAgICAgICAgICAgICAgICBtUG9wdXAuc2V0QW5jaG9yVmlldyhnZXRSb290VmlldygpLmZpbmRWaWV3QnlJZChtRHJvcERvd25BbmNob3JJZCkpOwogICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICB3aWR0aFNwZWMgPSBtRHJvcERvd25XaWR0aDsKKyAgICAgICAgICAgICAgICBtUG9wdXAuc2V0QW5jaG9yVmlldyh0aGlzKTsKICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgaWYgKG1Ecm9wRG93bkhlaWdodCA9PSBWaWV3R3JvdXAuTGF5b3V0UGFyYW1zLk1BVENIX1BBUkVOVCkgewotICAgICAgICAgICAgICAgIC8vIFRoZSBjYWxsIHRvIFBvcHVwV2luZG93J3MgdXBkYXRlIG1ldGhvZCBiZWxvdyBjYW4gYWNjZXB0IC0xIGZvciBhbnkKLSAgICAgICAgICAgICAgICAvLyB2YWx1ZSB5b3UgZG8gbm90IHdhbnQgdG8gdXBkYXRlLgotICAgICAgICAgICAgICAgIGhlaWdodFNwZWMgPSBub0lucHV0TWV0aG9kID8gaGVpZ2h0IDogVmlld0dyb3VwLkxheW91dFBhcmFtcy5NQVRDSF9QQVJFTlQ7Ci0gICAgICAgICAgICAgICAgaWYgKG5vSW5wdXRNZXRob2QpIHsKLSAgICAgICAgICAgICAgICAgICAgbVBvcHVwLnNldFdpbmRvd0xheW91dE1vZGUoCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgbURyb3BEb3duV2lkdGggPT0gVmlld0dyb3VwLkxheW91dFBhcmFtcy5NQVRDSF9QQVJFTlQgPwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVmlld0dyb3VwLkxheW91dFBhcmFtcy5NQVRDSF9QQVJFTlQgOiAwLCAwKTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICBtUG9wdXAuc2V0V2luZG93TGF5b3V0TW9kZSgKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBtRHJvcERvd25XaWR0aCA9PSBWaWV3R3JvdXAuTGF5b3V0UGFyYW1zLk1BVENIX1BBUkVOVCA/Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBWaWV3R3JvdXAuTGF5b3V0UGFyYW1zLk1BVENIX1BBUkVOVCA6IDAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgVmlld0dyb3VwLkxheW91dFBhcmFtcy5NQVRDSF9QQVJFTlQpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0gZWxzZSBpZiAobURyb3BEb3duSGVpZ2h0ID09IFZpZXdHcm91cC5MYXlvdXRQYXJhbXMuV1JBUF9DT05URU5UKSB7Ci0gICAgICAgICAgICAgICAgaGVpZ2h0U3BlYyA9IGhlaWdodDsKLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgaGVpZ2h0U3BlYyA9IG1Ecm9wRG93bkhlaWdodDsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgbVBvcHVwLnNldE91dHNpZGVUb3VjaGFibGUoIW1Gb3JjZUlnbm9yZU91dHNpZGVUb3VjaCAmJiAhbURyb3BEb3duQWx3YXlzVmlzaWJsZSk7Ci0KLSAgICAgICAgICAgIG1Qb3B1cC51cGRhdGUoZ2V0RHJvcERvd25BbmNob3JWaWV3KCksIG1Ecm9wRG93bkhvcml6b250YWxPZmZzZXQsCi0gICAgICAgICAgICAgICAgICAgIG1Ecm9wRG93blZlcnRpY2FsT2Zmc2V0LCB3aWR0aFNwZWMsIGhlaWdodFNwZWMpOwotICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgaWYgKG1Ecm9wRG93bldpZHRoID09IFZpZXdHcm91cC5MYXlvdXRQYXJhbXMuTUFUQ0hfUEFSRU5UKSB7Ci0gICAgICAgICAgICAgICAgd2lkdGhTcGVjID0gVmlld0dyb3VwLkxheW91dFBhcmFtcy5NQVRDSF9QQVJFTlQ7Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIGlmIChtRHJvcERvd25XaWR0aCA9PSBWaWV3R3JvdXAuTGF5b3V0UGFyYW1zLldSQVBfQ09OVEVOVCkgewotICAgICAgICAgICAgICAgICAgICBtUG9wdXAuc2V0V2lkdGgoZ2V0RHJvcERvd25BbmNob3JWaWV3KCkuZ2V0V2lkdGgoKSk7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgbVBvcHVwLnNldFdpZHRoKG1Ecm9wRG93bldpZHRoKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIGlmIChtRHJvcERvd25IZWlnaHQgPT0gVmlld0dyb3VwLkxheW91dFBhcmFtcy5NQVRDSF9QQVJFTlQpIHsKLSAgICAgICAgICAgICAgICBoZWlnaHRTcGVjID0gVmlld0dyb3VwLkxheW91dFBhcmFtcy5NQVRDSF9QQVJFTlQ7Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIGlmIChtRHJvcERvd25IZWlnaHQgPT0gVmlld0dyb3VwLkxheW91dFBhcmFtcy5XUkFQX0NPTlRFTlQpIHsKLSAgICAgICAgICAgICAgICAgICAgbVBvcHVwLnNldEhlaWdodChoZWlnaHQpOwotICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIG1Qb3B1cC5zZXRIZWlnaHQobURyb3BEb3duSGVpZ2h0KTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIG1Qb3B1cC5zZXRXaW5kb3dMYXlvdXRNb2RlKHdpZHRoU3BlYywgaGVpZ2h0U3Bl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IT0gbnVsbCAmJiB2aWV3LmdldFdpbmRvd1Rva2VuKCkgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICAgICAgc2hvd0Ryb3BEb3duKCk7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9OwotCi0gICAgICAgICAgICBtRHJvcERvd25MaXN0ID0gbmV3IERyb3BEb3duTGlzdFZpZXcoY29udGV4dCk7Ci0gICAgICAgICAgICBtRHJvcERvd25MaXN0LnNldFNlbGVjdG9yKG1Ecm9wRG93bkxpc3RIaWdobGlnaHQpOwotICAgICAgICAgICAgbURyb3BEb3duTGlzdC5zZXRBZGFwdGVyKGFkYXB0ZXIpOwotICAgICAgICAgICAgbURyb3BEb3duTGlzdC5zZXRWZXJ0aWNhbEZhZGluZ0VkZ2VFbmFibGVkKHRydWUpOwotICAgICAgICAgICAgbURyb3BEb3duTGlzdC5zZXRPbkl0ZW1DbGlja0xpc3RlbmVyKG1Ecm9wRG93bkl0ZW1DbGlja0xpc3RlbmVyKTsKLSAgICAgICAgICAgIG1Ecm9wRG93bkxpc3Quc2V0Rm9jdXNhYmxlKHRydWUpOwotICAgICAgICAgICAgbURyb3BEb3duTGlzdC5zZXRGb2N1c2FibGVJblRvdWNoTW9kZSh0cnVlKTsKLSAgICAgICAgICAgIG1Ecm9wRG93bkxpc3Quc2V0T25JdGVtU2VsZWN0ZWRMaXN0ZW5lcihuZXcgQWRhcHRlclZpZXcuT25JdGVtU2VsZWN0ZWRMaXN0ZW5lcigpIHsKLSAgICAgICAgICAgICAgICBwdWJsaWMgdm9pZCBvbkl0ZW1TZWxlY3RlZChBZGFwdGVyVmlldzw/PiBwYXJlbnQsIFZpZXcgdmlldywKLSAgICAgICAgICAgICAgICAgICAgICAgIGludCBwb3NpdGlvbiwgbG9uZyBpZCkgewotCi0gICAgICAgICAgICAgICAgICAgIGlmIChwb3NpdGlvbiAhPSAtMSkgewotICAgICAgICAgICAgICAgICAgICAgICAgRHJvcERvd25MaXN0VmlldyBkcm9wRG93bkxpc3QgPSBtRHJvcERvd25MaXN0OwotCi0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoZHJvcERvd25MaXN0ICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBkcm9wRG93bkxpc3QubUxpc3RTZWxlY3Rpb25IaWRkZW4gPSBmYWxzZTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgIHB1YmxpYyB2b2lkIG9uTm90aGluZ1NlbGVjdGVkKEFkYXB0ZXJWaWV3PD8+IHBhcmVudCkgewotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0pOwotICAgICAgICAgICAgbURyb3BEb3duTGlzdC5zZXRPblNjcm9sbExpc3RlbmVyKG5ldyBQb3B1cFNjcm9sbExpc3RlbmVyKCkpOwotCi0gICAgICAgICAgICBpZiAobUl0ZW1TZWxlY3RlZExpc3RlbmVyICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICBtRHJvcERvd25MaXN0LnNldE9uSXRlbVNlbGVjdGVkTGlzdGVuZXIobUl0ZW1TZWxlY3RlZExpc3RlbmVyKTsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgZHJvcERvd25WaWV3ID0gbURyb3BEb3duTGlzdDsKLQotICAgICAgICAgICAgVmlldyBoaW50VmlldyA9IGdldEhpbnRWaWV3KGNvbnRleHQpOwotICAgICAgICAgICAgaWYgKGhpbnRWaWV3ICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICAvLyBpZiBhbiBoaW50IGhhcyBiZWVuIHNwZWNpZmllZCwgd2UgYWNjb21vZGF0ZSBtb3JlIHNwYWNlIGZvciBpdCBhbmQKLSAgICAgICAgICAgICAgICAvLyBhZGQgYSB0ZXh0IHZpZXcgaW4gdGhlIGRyb3AgZG93biBtZW51LCBhdCB0aGUgYm90dG9tIG9mIHRoZSBsaXN0Ci0gICAgICAgICAgICAgICAgTGluZWFyTGF5b3V0IGhpbnRDb250YWluZXIgPSBuZXcgTGluZWFyTGF5b3V0KGNvbnRleHQpOwotICAgICAgICAgICAgICAgIGhpbnRDb250YWluZXIuc2V0T3JpZW50YXRpb24oTGluZWFyTGF5b3V0LlZFUlRJQ0FMKTsKLQotICAgICAgICAgICAgICAgIExpbmVhckxheW91dC5MYXlvdXRQYXJhbXMgaGludFBhcmFtcyA9IG5ldyBMaW5lYXJMYXlvdXQuTGF5b3V0UGFyYW1zKAotICAgICAgICAgICAgICAgICAgICAgICAgVmlld0dyb3VwLkxheW91dFBhcmFtcy5NQVRDSF9QQVJFTlQsIDAsIDEuMGYKLSAgICAgICAgICAgICAgICApOwotICAgICAgICAgICAgICAgIGhpbnRDb250YWluZXIuYWRkVmlldyhkcm9wRG93blZpZXcsIGhpbnRQYXJhbXMpOwotICAgICAgICAgICAgICAgIGhpbnRDb250YWluZXIuYWRkVmlldyhoaW50Vmlldyk7Ci0KLSAgICAgICAgICAgICAgICAvLyBtZWFzdXJlIHRoZSBoaW50J3MgaGVpZ2h0IHRvIGZpbmQgaG93IG11Y2ggbW9yZSB2ZXJ0aWNhbCBzcGFjZQotICAgICAgICAgICAgICAgIC8vIHdlIG5lZWQgdG8gYWRkIHRvIHRoZSBkcm9wIGRvd24ncyBoZWlnaHQKLSAgICAgICAgICAgICAgICBpbnQgd2lkdGhTcGVjID0gTWVhc3VyZVNwZWMubWFrZU1lYXN1cmVTcGVjKGdldFdpZHRoKCksIE1lYXN1cmVTcGVjLkFUX01PU1QpOwotICAgICAgICAgICAgICAgIGludCBoZWlnaHRTcGVjID0gTWVhc3VyZVNwZWMuVU5TUEVDSUZJRUQ7Ci0gICAgICAgICAgICAgICAgaGludFZpZXcubWVhc3VyZSh3aWR0aFNwZWMsIGhlaWdodFNwZWMpOwotCi0gICAgICAgICAgICAgICAgaGludFBhcmFtcyA9IChMaW5lYXJMYXlvdXQuTGF5b3V0UGFyYW1zKSBoaW50Vmlldy5nZXRMYXlvdXRQYXJhbXMoKTsKLSAgICAgICAgICAgICAgICBvdGhlckhlaWdodHMgPSBoaW50Vmlldy5nZXRNZWFzdXJlZEhlaWdodCgpICsgaGludFBhcmFtcy50b3BNYXJnaW4KLSAgICAgICAgICAgICAgICAgICAgICAgICsgaGludFBhcmFtcy5ib3R0b21NYXJnaW47Ci0KLSAgICAgICAgICAgICAgICBkcm9wRG93blZpZXcgPSBoaW50Q29udGFpbmVyOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBtUG9wdXAuc2V0Q29udGVudFZpZXcoZHJvcERvd25WaWV3KTsKLSAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgIGRyb3BEb3duVmlldyA9IChWaWV3R3JvdXApIG1Qb3B1cC5nZXRDb250ZW50VmlldygpOwotICAgICAgICAgICAgZmluYWwgVmlldyB2aWV3ID0gZHJvcERvd25WaWV3LmZpbmRWaWV3QnlJZChISU5UX1ZJRVdfSUQpOwotICAgICAgICAgICAgaWYgKHZpZXcgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgIExpbmVhckxheW91dC5MYXlvdXRQYXJhbXMgaGludFBhcmFtcyA9Ci0gICAgICAgICAgICAgICAgICAgICAgICAoTGluZWFyTGF5b3V0LkxheW91dFBhcmFtcykgdmlldy5nZXRMYXlvdXRQYXJhbXMoKTsKLSAgICAgICAgICAgICAgICBvdGhlckhlaWdodHMgPSB2aWV3LmdldE1lYXN1cmVkSGVpZ2h0KCkgKyBoaW50UGFyYW1zLnRvcE1hcmdpbgotICAgICAgICAgICAgICAgICAgICAgICAgKyBoaW50UGFyYW1zLmJvdHRvbU1hcmdpbjsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCi0gICAgICAgIC8vIE1heCBoZWlnaHQgYXZhaWxhYmxlIG9uIHRoZSBzY3JlZW4gZm9yIGEgcG9wdXAuCi0gICAgICAgIGJvb2xlYW4gaWdub3JlQm90dG9t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kxpc3QubWVhc3VyZUhlaWdodE9mQ2hpbGRyZW4oTWVhc3VyZVNwZWMuVU5TUEVDSUZJRUQsCi0gICAgICAgICAgICAgICAgMCwgTGlzdFZpZXcuTk9fUE9TSVRJT04sIG1heEhlaWdodCAtIG90aGVySGVpZ2h0cywgMik7Ci0gICAgICAgIC8vIGFkZCBwYWRkaW5nIG9ubHkgaWYgdGhlIGxpc3QgaGFzIGl0ZW1zIGluIGl0LCB0aGF0IHdheSB3ZSBkb24ndCBzaG93Ci0gICAgICAgIC8vIHRoZSBwb3B1cCBpZiBpdCBpcyBub3QgbmVlZGVkCi0gICAgICAgIGlmIChsaXN0Q29udGVudCA+IDApIG90aGVySGVpZ2h0cyArPSBwYWRkaW5nOwotCi0gICAgICAgIHJldHVybiBsaXN0Q29udGVudCArIG90aGVySGVpZ2h0czsKLSAgICB9Ci0KLSAgICBwcml2YXRlIFZpZXcgZ2V0SGludFZpZXcoQ29udGV4dCBjb250ZXh0KSB7Ci0gICAgICAgIGlmIChtSGludFRleHQgIT0gbnVsbCAmJiBtSGludFRleHQubGVuZ3RoKCkgPiAwKSB7Ci0gICAgICAgICAgICBmaW5hbCBUZXh0VmlldyBoaW50VmlldyA9IChUZXh0VmlldykgTGF5b3V0SW5mbGF0ZXIuZnJvbShjb250ZXh0KS5pbmZsYXRlKAotICAgICAgICAgICAgICAgICAgICBtSGludFJlc291cmNlLCBudWxsKS5maW5kVmlld0J5SWQoY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5pZC50ZXh0MSk7Ci0gICAgICAgICAgICBoaW50Vmlldy5zZXRUZXh0KG1IaW50VGV4dCk7Ci0gICAgICAgICAgICBoaW50Vmlldy5zZXRJZChISU5UX1ZJRVdfSUQpOwotICAgICAgICAgICAgcmV0dXJuIGhpbnRWaWV3OwotICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgcmV0dXJuIG51bGw7Ci0gICAgICAgIH0KICAgICB9CiAKICAgICAvKioKQEAgLTE0NDAsNDcgKzExMTAsNiBAQAogICAgICAgICByZXR1cm4gbUZpbHRlcjsKICAgICB9CiAKLSAgICBwcml2YXRlIGNsYXNzIExpc3RTZWxlY3RvckhpZGVyIGltcGxlbWVudHMgUnVubmFibGUgewotICAgICAgICBwdWJsaWMgdm9pZCBydW4oKSB7Ci0gICAgICAgICAgICBjbGVhckxpc3RTZWxlY3Rpb24oKTsKLSAgICAgICAgfQotICAgIH0KLQotICAgIHByaXZhdGUgY2xhc3MgUmVzaXplUG9wdXBSdW5uYWJsZSBpbXBsZW1lbnRzIFJ1bm5hYmxlIHsKLSAgICAgICAgcHVibGljIHZvaWQgcnVuKCkgewotICAgICAgICAgICAgbVBvcHVwLnNldElucHV0TWV0aG9kTW9kZShQb3B1cFdpbmRvdy5JTlBVVF9NRVRIT0RfTk9UX05FRURFRCk7Ci0gICAgICAgICAgICBzaG93RHJvcERvd24oKTsKLSAgICAgICAgfQotICAgIH0KLQotICAgIHByaXZhdGUgY2xhc3MgUG9wdXBUb3VjaEludGVyY2VwdG9yIGltcGxlbWVudHMgT25Ub3VjaExpc3RlbmVyIHsKLSAgICAgICAgcHVibGljIGJvb2xlYW4gb25Ub3VjaChWaWV3IHYsIE1vdGlvbkV2ZW50IGV2ZW50KSB7Ci0gICAgICAgICAgICBmaW5hbCBpbnQgYWN0aW9uID0gZXZlbnQuZ2V0QWN0aW9uKCk7Ci0gICAgICAgICAgICBpZiAoYWN0aW9uID09IE1vdGlvbkV2ZW50LkFDVElPTl9ET1dOICYmCi0gICAgICAgICAgICAgICAgICAgIG1Qb3B1cCAhPSBudWxsICYmIG1Qb3B1cC5pc1Nob3dpbmcoKSkgewotICAgICAgICAgICAgICAgIHBvc3REZWxheWVkKG1SZXNpemVQb3B1cFJ1bm5hYmxlLCBFWFBBTkRfTElTVF9USU1FT1VUKTsKLSAgICAgICAgICAgIH0gZWxzZSBpZiAoYWN0aW9uID09IE1vdGlvbkV2ZW50LkFDVElPTl9VUCkgewotICAgICAgICAgICAgICAgIHJlbW92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YXlzCi0gICAgICAgICAqLwotICAgICAgICBAT3ZlcnJpZGUKLSAgICAgICAgcHVibGljIGJvb2xlYW4gaGFzV2luZG93Rm9jdXMoKSB7Ci0gICAgICAgICAgICByZXR1cm4gdHJ1ZTsKLSAgICAgICAgfQotCi0gICAgICAgIC8qKgotICAgICAgICAgKiA8cD5SZXR1cm5zIHRoZSBmb2N1cyBzdGF0ZSBpbiB0aGUgZHJvcCBkb3duLjwvcD4KLSAgICAgICAgICoKLSAgICAgICAgICogQHJldHVybiB0cnVlIGFsd2F5cwotICAgICAgICAgKi8KLSAgICAgICAgQE92ZXJyaWRlCi0gICAgICAgIHB1YmxpYyBib29sZWFuIGlzRm9jdXNlZCgpIHsKLSAgICAgICAgICAgIHJldHVybiB0cnVlOwotICAgICAgICB9Ci0KLSAgICAgICAgLyoqCi0gICAgICAgICAqIDxwPlJldHVybnMgdGhlIGZvY3VzIHN0YXRlIGluIHRoZSBkcm9wIGRvd24uPC9wPgotICAgICAgICAgKgotICAgICAgICAgKiBAcmV0dXJuIHRydWUgYWx3YXlzCi0gICAgICAgICAqLwotICAgICAgICBAT3ZlcnJpZGUKLSAgICAgICAgcHVibGljIGJvb2xlYW4gaGFzRm9jdXMoKSB7Ci0gICAgICAgICAgICByZXR1cm4gdHJ1ZTsKLSAgICAgICAgfQotICAgICAgICAKLSAgICAgICAgcHJvdGVjdGVkIGludFtdIG9uQ3JlYXRlRHJhd2FibGVTdGF0ZShpbnQgZXh0cmFTcGFjZSkgewotICAgICAgICAgICAgaW50W10gcmVzID0gc3VwZXIub25DcmVhdGVEcmF3YWJsZVN0YXRlKGV4dHJhU3BhY2UpOwotICAgICAgICAgICAgLy9ub2luc3BlY3Rpb24gQ29uc3RhbnRJZlN0YXRlbWVudAotICAgICAgICAgICAgaWYgKGZhbHNlKSB7Ci0gICAgICAgICAgICAgICAgU3RyaW5nQnVpbGRlciBzYiA9IG5ldyBTdHJpbmdCdWlsZGVyKCJDcmVhdGVkIGRyYXdhYmxlIHN0YXRlOiBbIik7Ci0gICAgICAgICAgICAgICAgZm9yIChpbnQgaT0wOyBpPHJlcy5sZW5ndGg7IGkrKykgewotICAgICAgICAgICAgICAgICAgICBpZiAoaSA+IDApIHNiLmFwcGVuZCgiLCAiKTsKLSAgICAgICAgICAgICAgICAgICAgc2IuYXBwZW5kKCIweCIpOwotICAgICAgICAgICAgICAgICAgICBzYi5hcHBlbmQoSW50ZWdlci50b0hleFN0cmluZyhyZXNbaV0pKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgc2IuYXBwZW5kKCJdIik7Ci0gICAgICAgICAgICAgICAgTG9nLmkoVEFHLCBzYi50b1N0cmluZygpKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHJldHVybiByZXM7Ci0gICAgICAgIH0KLSAgICB9Ci0KLSAgICAvKioKICAgICAgKiBUaGlzIGludGVyZmFjZSBpcyB1c2VkIHRvIG1ha2Ugc3VyZSB0aGF0IHRoZSB0ZXh0IGVudGVyZWQgaW4gdGhpcyBUZXh0VmlldyBjb21wbGllcyB0bwogICAgICAqIGEgY2VydGFpbiBmb3JtYXQuICBTaW5jZSB0aGVyZSBpcyBubyBmb29scHJvb2Ygd2F5IHRvIHByZXZlbnQgdGhlIHVzZXIgZnJvbSBsZWF2aW5nCiAgICAgICogdGhpcyBWaWV3IHdpdGggYW4gaW5jb3JyZWN0IHZhbHVlIGluIGl0LCBhbGwgd2UgY2FuIGRvIGlzIHRyeSB0byBmaXggaXQgb3Vyc2VsdmVzCkBAIC0xNjUyLDEwICsxMTY0LDcgQEAKICAgICBwcml2YXRlIGNsYXNzIFBvcHVwRGF0YVNldE9ic2VydmVyIGV4dGVuZHMgRGF0YVNldE9ic2VydmVyIHsKICAgICAgICAgQE92ZXJyaWRlCiAgICAgICAgIHB1YmxpYyB2b2lkIG9uQ2hhbmdlZCgpIHsKLSAgICAgICAgICAgIGlmIChpc1BvcHVwU2hvd2luZygpKSB7Ci0gICAgICAgICAgICA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leHQgY29udGV4dCwgQ3Vyc29yIGMsIGludCBmbGFncykgeworICAgICAgICBpbml0KGNvbnRleHQsIGMsIGZsYWdzKTsKICAgICB9CiAKICAgICBwcm90ZWN0ZWQgdm9pZCBpbml0KENvbnRleHQgY29udGV4dCwgQ3Vyc29yIGMsIGJvb2xlYW4gYXV0b1JlcXVlcnkpIHsKKyAgICAgICAgaW5pdChjb250ZXh0LCBjLCBhdXRvUmVxdWVyeSA/IEZMQUdfQVVUT19SRVFVRVJZIDogRkxBR19SRUdJU1RFUl9DT05URU5UX09CU0VSVkVSKTsKKyAgICB9CisKKyAgICBwcm90ZWN0ZWQgdm9pZCBpbml0KENvbnRleHQgY29udGV4dCwgQ3Vyc29yIGMsIGludCBmbGFncykgeworICAgICAgICBpZiAoKGZsYWdzICYgRkxBR19BVVRPX1JFUVVFUlkpID09IEZMQUdfQVVUT19SRVFVRVJZKSB7CisgICAgICAgICAgICBmbGFncyB8PSBGTEFHX1JFR0lTVEVSX0NPTlRFTlRfT0JTRVJWRVI7CisgICAgICAgICAgICBtQXV0b1JlcXVlcnkgPSB0cnVlOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgbUF1dG9SZXF1ZXJ5ID0gZmFsc2U7CisgICAgICAgIH0KICAgICAgICAgYm9vbGVhbiBjdXJzb3JQcmVzZW50ID0gYyAhPSBudWxsOwotICAgICAgICBtQXV0b1JlcXVlcnkgPSBhdXRvUmVxdWVyeTsKICAgICAgICAgbUN1cnNvciA9IGM7CiAgICAgICAgIG1EYXRhVmFsaWQgPSBjdXJzb3JQcmVzZW50OwogICAgICAgICBtQ29udGV4dCA9IGNvbnRleHQ7CiAgICAgICAgIG1Sb3dJRENvbHVtbiA9IGN1cnNvclByZXNlbnQgPyBjLmdldENvbHVtbkluZGV4T3JUaHJvdygiX2lkIikgOiAtMTsKLSAgICAgICAgbUNoYW5nZU9ic2VydmVyID0gbmV3IENoYW5nZU9ic2VydmVyKCk7CisgICAgICAgIGlmICgoZmxhZ3MgJiBGTEFHX1JFR0lTVEVSX0NPTlRFTlRfT0JTRVJWRVIpID09IEZMQUdfUkVHSVNURVJfQ09OVEVOVF9PQlNFUlZFUikgeworICAgICAgICAgICAgbUNoYW5nZU9ic2VydmVyID0gbmV3IENoYW5nZU9ic2VydmVyKCk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBtQ2hhbmdlT2JzZXJ2ZXIgPSBudWxsOworICAgICAgICB9CisKICAgICAgICAgaWYgKGN1cnNvclByZXNlbnQpIHsKLSAgICAgICAgICAgIGMucmVnaXN0ZXJDb250ZW50T2JzZXJ2ZXIobUNoYW5nZU9ic2VydmVyKTsKKyAgICAgICAgICAgIGlmIChtQ2hhbmdlT2JzZXJ2ZXIgIT0gbnVsbCkgYy5yZWdpc3RlckNvbnRlbnRPYnNlcnZlcihtQ2hhbmdlT2JzZXJ2ZXIpOwogICAgICAgICAgICAgYy5yZWdpc3RlckRhdGFTZXRPYnNlcnZlcihtRGF0YVNldE9ic2VydmVyKTsKICAgICAgICAgfQogICAgIH0KQEAgLTI0NiwxMyArMjgyLDEzIEBACiAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgIH0KICAgICAgICAgaWYgKG1DdXJzb3IgIT0gbnVsbCkgewotICAgICAgICAgICAgbUN1cnNvci51bnJlZ2lzdGVyQ29udGVudE9ic2VydmVyKG1DaGFuZ2VPYnNlcnZlcik7CisgICAgICAgICAgICBpZiAobUNoYW5nZU9ic2VydmVyICE9IG51bGwpIG1DdXJzb3IudW5yZWdpc3RlckNvbnRlbnRPYnNlcnZlcihtQ2hhbmdlT2JzZXJ2ZXIpOwogICAgICAgICAgICAgbUN1cnNvci51bnJlZ2lzdGVyRGF0YVNldE9ic2VydmVyKG1EYXRhU2V0T2JzZXJ2ZXIpOwogICAgICAgICAgICAgbUN1cnNvci5jbG9zZSgpOwogICAgICAgICB9CiAgICAgICAgIG1DdXJzb3IgPSBjdXJzb3I7CiAgICAgICAgIGlmIChjdXJzb3IgIT0gbn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bmRvdyhjb250ZXh0LCBhdHRycywgZGVmU3R5bGVBdHRyLCBkZWZTdHlsZVJlcyk7CisgICAgfQorCisgICAgLyoqCisgICAgICogU2V0cyB0aGUgYWRhcHRlciB0aGF0IHByb3ZpZGVzIHRoZSBkYXRhIGFuZCB0aGUgdmlld3MgdG8gcmVwcmVzZW50IHRoZSBkYXRhCisgICAgICogaW4gdGhpcyBwb3B1cCB3aW5kb3cuCisgICAgICoKKyAgICAgKiBAcGFyYW0gYWRhcHRlciBUaGUgYWRhcHRlciB0byB1c2UgdG8gY3JlYXRlIHRoaXMgd2luZG93J3MgY29udGVudC4KKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBzZXRBZGFwdGVyKExpc3RBZGFwdGVyIGFkYXB0ZXIpIHsKKyAgICAgICAgaWYgKG1PYnNlcnZlciA9PSBudWxsKSB7CisgICAgICAgICAgICBtT2JzZXJ2ZXIgPSBuZXcgUG9wdXBEYXRhU2V0T2JzZXJ2ZXIoKTsKKyAgICAgICAgfSBlbHNlIGlmIChtQWRhcHRlciAhPSBudWxsKSB7CisgICAgICAgICAgICBtQWRhcHRlci51bnJlZ2lzdGVyRGF0YVNldE9ic2VydmVyKG1PYnNlcnZlcik7CisgICAgICAgIH0KKyAgICAgICAgbUFkYXB0ZXIgPSBhZGFwdGVyOworICAgICAgICBpZiAobUFkYXB0ZXIgIT0gbnVsbCkgeworICAgICAgICAgICAgYWRhcHRlci5yZWdpc3RlckRhdGFTZXRPYnNlcnZlcihtT2JzZXJ2ZXIpOworICAgICAgICB9CisgICAgICAgIAorICAgICAgICBpZiAobURyb3BEb3duTGlzdCAhPSBudWxsKSB7CisgICAgICAgICAgICBtRHJvcERvd25MaXN0LnNldEFkYXB0ZXIobUFkYXB0ZXIpOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogU2V0IHdoZXJlIHRoZSBvcHRpb25hbCBwcm9tcHQgdmlldyBzaG91bGQgYXBwZWFyLiBUaGUgZGVmYXVsdCBpcworICAgICAqIHtAbGluayAjUE9TSVRJT05fUFJPTVBUX0FCT1ZFfS4KKyAgICAgKiAKKyAgICAgKiBAcGFyYW0gcG9zaXRpb24gQSBwb3NpdGlvbiBjb25zdGFudCBkZWNsYXJpbmcgd2hlcmUgdGhlIHByb21wdCBzaG91bGQgYmUgZGlzcGxheWVkLgorICAgICAqIAorICAgICAqIEBzZWUgI1BPU0lUSU9OX1BST01QVF9BQk9WRQorICAgICAqIEBzZWUgI1BPU0lUSU9OX1BST01QVF9CRUxPVworICAgICAqLworICAgIHB1YmxpYyB2b2lkIHNldFByb21wdFBvc2l0aW9uKGludCBwb3NpdGlvbikgeworICAgICAgICBtUHJvbXB0UG9zaXRpb24gPSBwb3NpdGlvbjsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBAcmV0dXJuIFdoZXJlIHRoZSBvcHRpb25hbCBwcm9tcHQgdmlldyBzaG91bGQgYXBwZWFyLgorICAgICAqIAorICAgICAqIEBzZWUgI1BPU0lUSU9OX1BST01QVF9BQk9WRQorICAgICAqIEBzZWUgI1BPU0lUSU9OX1BST01QVF9CRUxPVworICAgICAqLworICAgIHB1YmxpYyBpbnQgZ2V0UHJvbXB0UG9zaXRpb24oKSB7CisgICAgICAgIHJldHVybiBtUHJvbXB0UG9zaXRpb247CisgICAgfQorCisgICAgLyoqCisgICAgICogU2V0IHdoZXRoZXIgdGhpcyB3aW5kb3cgc2hvdWxkIGJlIG1vZGFsIHdoZW4gc2hvd24uCisgICAgICogCisgICAgICogPHA+SWYgYSBwb3B1cCB3aW5kb3cgaXMgbW9kYWwsIGl0IHdpbGwgcmVjZWl2ZSBhbGwgdG91Y2ggYW5kIGtleSBpbnB1dC4KKyAgICAgKiBJZiB0aGUgdXNlciB0b3VjaGVzIG91dHNpZGUgdGhlIHBvcHVwIHdpbmRvdydzIGNvbnRlbnQgYXJlYSB0aGUgcG9wdXAgd2luZG93CisgICAgICogd2lsbCBiZSBkaXNtaXNzZWQuCisgICAgICogCisgICAg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lY2lhbCBjYXNlcy4KKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBzZXRGb3JjZUlnbm9yZU91dHNpZGVUb3VjaChib29sZWFuIGZvcmNlSWdub3JlT3V0c2lkZVRvdWNoKSB7CisgICAgICAgIG1Gb3JjZUlnbm9yZU91dHNpZGVUb3VjaCA9IGZvcmNlSWdub3JlT3V0c2lkZVRvdWNoOworICAgIH0KKworICAgIC8qKgorICAgICAqIFNldHMgd2hldGhlciB0aGUgZHJvcC1kb3duIHNob3VsZCByZW1haW4gdmlzaWJsZSB1bmRlciBjZXJ0YWluIGNvbmRpdGlvbnMuCisgICAgICoKKyAgICAgKiBUaGUgZHJvcC1kb3duIHdpbGwgb2NjdXB5IHRoZSBlbnRpcmUgc2NyZWVuIGJlbG93IHtAbGluayAjZ2V0QW5jaG9yVmlld30gcmVnYXJkbGVzcworICAgICAqIG9mIHRoZSBzaXplIG9yIGNvbnRlbnQgb2YgdGhlIGxpc3QuICB7QGxpbmsgI2dldEJhY2tncm91bmQoKX0gd2lsbCBmaWxsIGFueSBzcGFjZQorICAgICAqIHRoYXQgaXMgbm90IHVzZWQgYnkgdGhlIGxpc3QuCisgICAgICoKKyAgICAgKiBAcGFyYW0gZHJvcERvd25BbHdheXNWaXNpYmxlIFdoZXRoZXIgdG8ga2VlcCB0aGUgZHJvcC1kb3duIHZpc2libGUuCisgICAgICoKKyAgICAgKiBAaGlkZSBPbmx5IHVzZWQgYnkgQXV0b0NvbXBsZXRlVGV4dFZpZXcgdW5kZXIgc3BlY2lhbCBjb25kaXRpb25zLgorICAgICAqLworICAgIHB1YmxpYyB2b2lkIHNldERyb3BEb3duQWx3YXlzVmlzaWJsZShib29sZWFuIGRyb3BEb3duQWx3YXlzVmlzaWJsZSkgeworICAgICAgICBtRHJvcERvd25BbHdheXNWaXNpYmxlID0gZHJvcERvd25BbHdheXNWaXNpYmxlOworICAgIH0KKworICAgIC8qKgorICAgICAqIEByZXR1cm4gV2hldGhlciB0aGUgZHJ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hcmFtcyNzb2Z0SW5wdXRNb2RlCisgICAgICovCisgICAgcHVibGljIGludCBnZXRTb2Z0SW5wdXRNb2RlKCkgeworICAgICAgICByZXR1cm4gbVBvcHVwLmdldFNvZnRJbnB1dE1vZGUoKTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBTZXRzIGEgZHJhd2FibGUgdG8gdXNlIGFzIHRoZSBsaXN0IGl0ZW0gc2VsZWN0b3IuCisgICAgICogCisgICAgICogQHBhcmFtIHNlbGVjdG9yIExpc3Qgc2VsZWN0b3IgZHJhd2FibGUgdG8gdXNlIGluIHRoZSBwb3B1cC4KKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBzZXRMaXN0U2VsZWN0b3IoRHJhd2FibGUgc2VsZWN0b3IpIHsKKyAgICAgICAgbURyb3BEb3duTGlzdEhpZ2hsaWdodCA9IHNlbGVjdG9yOworICAgIH0KKworICAgIC8qKgorICAgICAqIEByZXR1cm4gVGhlIGJhY2tncm91bmQgZHJhd2FibGUgZm9yIHRoZSBwb3B1cCB3aW5kb3cuCisgICAgICovCisgICAgcHVibGljIERyYXdhYmxlIGdldEJhY2tncm91bmQoKSB7CisgICAgICAgIHJldHVybiBtUG9wdXAuZ2V0QmFja2dyb3VuZCgpOworICAgIH0KKworICAgIC8qKgorICAgICAqIFNldHMgYSBkcmF3YWJsZSB0byBiZSB0aGUgYmFja2dyb3VuZCBmb3IgdGhlIHBvcHVwIHdpbmRvdy4KKyAgICAgKiAKKyAgICAgKiBAcGFyYW0gZCBBIGRyYXdhYmxlIHRvIHNldCBhcyB0aGUgYmFja2dyb3VuZC4KKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBzZXRCYWNrZ3JvdW5kRHJhd2FibGUoRHJhd2FibGUgZCkgeworICAgICAgICBtUG9wdXAuc2V0QmFja2dyb3VuZERyYXdhYmxlKGQpOworICAgIH0KKworICAgIC8qKgorICAgICAqIFNldCBhbiBhbmltYXRpb24gc3R5bGUgdG8gdXNlIHdoZW4gdGhlIHBvcHVwIHdpbmRvdyBpcyBzaG93biBvciBkaXNtaXNzZWQuCisgICAgICogCisgICAgICogQHBhcmFtIGFuaW1hdGlvblN0eWxlIEFuaW1hdGlvbiBzdHlsZSB0byB1c2UuCisgICAgICovCisgICAgcHVibGljIHZvaWQgc2V0QW5pbWF0aW9uU3R5bGUoaW50IGFuaW1hdGlvblN0eWxlKSB7CisgICAgICAgIG1Qb3B1cC5zZXRBbmltYXRpb25TdHlsZShhbmltYXRpb25TdHlsZSk7CisgICAgfQorCisgICAgLyoqCisgICAgICogUmV0dXJucyB0aGUgYW5pbWF0aW9uIHN0eWxlIHRoYXQgd2lsbCBiZSB1c2VkIHdoZW4gdGhlIHBvcHVwIHdpbmRvdyBpcworICAgICAqIHNob3duIG9yIGRpc21pc3NlZC4KKyAgICAgKiAKKyAgICAgKiBAcmV0dXJuIEFuaW1hdGlvbiBzdHlsZSB0aGF0IHdpbGwgYmUgdXNlZC4KKyAgICAgKi8KKyAgICBwdWJsaWMgaW50IGdldEFuaW1hdGlvblN0eWxlKCkgeworICAgICAgICByZXR1cm4gbVBvcHVwLmdldEFuaW1hdGlvblN0eWxlKCk7CisgICAgfQorCisgICAgLyoqCisgICAgICogUmV0dXJucyB0aGUgdmlldyB0aGF0IHdpbGwgYmUgdXNlZCB0byBhbmNob3IgdGhpcyBwb3B1cC4KKyAgICAgKiAKKyAgICAgKiBAcmV0dXJuIFRoZSBwb3B1cCdzIGFuY2hvciB2aWV3CisgICAgICovCisgICAgcHVibGljIFZpZXcgZ2V0QW5jaG9yVmlldygpIHsKKyAgICAgICAgcmV0dXJuIG1Ecm9wRG93bkFuY2hvclZpZXc7CisgICAgfQorCisgICAgLyoqCisgICAgICogU2V0cyB0aGUgcG9wdXAncyBhbmNob3Igdmlldy4gVGhpcyBwb3B1cCB3aWxsIGFsd2F5cyBiZSBwb3NpdGlvbmVkIHJlbGF0aXZlIHRvCisgICAgICogdGhlIGFuY2hvciB2aWV3IHdoZW4gc2hvd24uCisgICAgICogCisgICAgICogQHBhcmFtIGFuY2hvciBUaGUgdmlldyB0byB1c2UgYXMgYW4gYW5jaG9yLgorICAgICAqLworICAgIHB1YmxpYyB2b2lkIHNldEFuY2hvclZpZXcoVmlldyBhbmNob3IpIHsKKyAgICAgICAgbURyb3BEb3duQW5jaG9yVmlldyA9IGFuY2hvcjsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBAcmV0dXJuIFRoZSBob3Jpem9udGFsIG9mZnNldCBvZiB0aGUgcG9wdXAgZnJvbSBpdHMgYW5jaG9yIGluIHBpeGVscy4KKyAgICAgKi8KKyAgICBwdWJsaWMgaW50IGdldEhvcml6b250YWxPZmZzZXQoKSB7CisgICAgICAgIHJldHVybiBtRHJvcERvd25Ib3Jpem9udGFsT2Zmc2V0OworICAgIH0KKworICAgIC8qKgorICAgICAqIFNldCB0aGUgaG9yaXpvbnRhbCBvZmZzZXQgb2YgdGhpcyBwb3B1cCBmcm9tIGl0cyBhbmNob3IgdmlldyBpbiBwaXhlbHMuCisgICAgICogCisgICAgICogQHBhcmFtIG9mZnNldCBUaGUgaG9yaXpvbnRhbCBvZmZzZXQgb2YgdGhlIHBvcHVwIGZyb20gaXRzIGFuY2hvci4KKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBzZXRIb3Jpem9udGFsT2Zmc2V0KGludCBvZmZzZXQpIHsKKyAgICAgICAgbURyb3BEb3duSG9yaXpvbnRhbE9mZnNldCA9IG9mZnNldDsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBAcmV0dXJuIFRoZSB2ZXJ0aWNhbCBvZmZzZXQgb2YgdGhlIHBvcHVwIGZyb20gaXRzIGFuY2hvciBpbiBwaXhlbHMuCisgICAgICovCisgICAgcHVibGljIGludCBnZXRWZXJ0aWNhbE9mZnNldCgpIHsKKyAgICAgICAgcmV0dXJuIG1Ecm9wRG93blZlcnRpY2FsT2Zmc2V0OworICAgIH0KKworICAgIC8qKgorICAgICAqIFNldCB0aGUgdmVydGljYWwgb2Zmc2V0IG9mIHRoaXMgcG9wdXAgZnJvbSBpdHMgYW5jaG9yIHZpZXcgaW4gcGl4ZWxzLgorICAgICAqIAorICAgICAqIEBwYXJhbSBvZmZzZXQgVGhlIHZlcnRpY2FsIG9mZnNldCBvZiB0aGUgcG9wdXAgZnJvbSBpdHMgYW5jaG9yLgorICAgICAqLworICAgIHB1YmxpYyB2b2lkIHNldFZlcnRpY2FsT2Zmc2V0KGludCBvZmZzZXQpIHsKKyAgICAgICAgbURyb3BEb3duVmVydGljYWxPZmZzZXQgPSBvZmZzZXQ7CisgICAgfQorCisgICAgLyoqCisgICAgICogQHJldHVybiBUaGUgd2lkdGggb2YgdGhlIHBvcHVwIHdpbmRvdyBpbiBwaXhlbHMuCisgICAgICovCisgICAgcHVibGljIGludCBnZXRXaWR0aCgpIHsKKyAgICAgICAgcmV0dXJuIG1Ecm9wRG93bldpZHRoOworICAgIH0KKworICAgIC8qKgorICAgICAqIFNldHMgdGhlIHdpZHRoIG9mIHRoZSBwb3B1cCB3aW5kb3cgaW4gcGl4ZWxzLiBDYW4gYWxzbyBiZSB7QGxpbmsgI01BVENIX1BBUkVOVH0KKyAgICAgKiBvciB7QGxpbmsgI1dSQVBfQ09OVEVOVH0uCisgICAgICogCisgICAgICogQHBhcmFtIHdpZHRoIFdpZHRoIG9mIHRoZSBwb3B1cCB3aW5kb3cuCisgICAgICovCisgICAgcHVibGljIHZvaWQgc2V0V2lkdGgoaW50IHdpZHRoKSB7CisgICAgICAgIG1Ecm9wRG93bldpZHRoID0gd2lkdGg7CisgICAgfQorCisgICAgLyoqCisgICAgICogU2V0cyB0aGUgd2lkdGggb2YgdGhlIHBvcHVwIHdpbmRvdyBieSB0aGUgc2l6ZSBvZiBpdHMgY29udGVudC4gVGhlIGZpbmFsIHdpZHRoIG1heSBiZQorICAgICAqIGxhcmdlciB0byBhY2NvbW1vZGF0ZSBzdHlsZWQgd2luZG93IGRyZXNzaW5nLgorICAgICAqCisgICAgICogQHBhcmFtIHdpZHRoIERlc2lyZWQgd2lkdGggb2YgY29udGVudCBpbiBwaXhlbHMuCisgICAgICovCisgICAgcHVibGljIHZvaWQgc2V0Q29udGVudFdpZHRoKGludCB3aWR0aCkgeworICAgICAgICBEcmF3YWJsZSBwb3B1cEJhY2tncm91bmQgPSBtUG9wdXAuZ2V0QmFja2dyb3VuZCgpOworICAgICAgICBpZiAocG9wdXBCYWNrZ3JvdW5kICE9IG51bGwpIHsKKyAgICAgICAgICAgIG1Ecm9wRG93bldpZHRoID0gcG9wdXBCYWNrZ3JvdW5kLmdldEludHJpbnNpY1dpZHRoKCkgKyB3aWR0aDsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIEByZXR1cm4gVGhlIGhlaWdodCBvZiB0aGUgcG9wdXAgd2luZG93IGluIHBpeGVscy4KKyAgICAgKi8KKyAgICBwdWJsaWMgaW50IGdldEhlaWdodCgpIHsKKyAgICAgICAgcmV0dXJuIG1Ecm9wRG93bkhlaWdodDsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBTZXRzIHRoZSBoZWlnaHQgb2YgdGhlIHBvcHVwIHdpbmRvdyBpbiBwaXhlbHMuIENhbiBhbHNvIGJlIHtAbGluayAjTUFUQ0hfUEFSRU5UfS4KKyAgICAgKiAKKyAgICAgKiBAcGFyYW0gaGVpZ2h0IEhlaWdodCBvZiB0aGUgcG9wdXAgd2luZG93LgorICAgICAqLworICAgIHB1YmxpYyB2b2lkIHNldEhlaWdodChpbnQgaGVpZ2h0KSB7CisgICAgICAgIG1Ecm9wRG93bkhlaWdodCA9IGhlaWdodDsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBTZXRzIGEgbGlzdGVuZXIgdG8gcmVjZWl2ZSBldmVudHMgd2hlbiBhIGxpc3QgaXRlbSBpcyBjbGlja2VkLgorICAgICAqIAorICAgICAqIEBwYXJhbSBjbGlja0xpc3RlbmVyIExpc3RlbmVyIHRvIHJlZ2lzdGVyCisgICAgICog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Ajc2V0UHJvbXB0UG9zaXRpb24oaW50KX0uCisgICAgICogCisgICAgICogQHBhcmFtIHByb21wdCBWaWV3IHRvIHVzZSBhcyBhbiBpbmZvcm1hdGlvbmFsIHByb21wdC4KKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBzZXRQcm9tcHRWaWV3KFZpZXcgcHJvbXB0KSB7CisgICAgICAgIGJvb2xlYW4gc2hvd2luZyA9IGlzU2hvd2luZygpOworICAgICAgICBpZiAoc2hvd2luZykgeworICAgICAgICAgICAgcmVtb3ZlUHJvbXB0VmlldygpOworICAgICAgICB9CisgICAgICAgIG1Qcm9tcHRWaWV3ID0gcHJvbXB0OworICAgICAgICBpZiAoc2hvd2luZykgeworICAgICAgICAgICAgc2hvdygpOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogUG9zdCBhIHtAbGluayAjc2hvdygpfSBjYWxsIHRvIHRoZSBVSSB0aHJlYWQuCisgICAgICovCisgICAgcHVibGljIHZvaWQgcG9zdFNob3coKSB7CisgICAgICAgIG1IYW5kbGVyLnBvc3QobVNob3dEcm9wRG93blJ1bm5hYmxlKTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBTaG93IHRoZSBwb3B1cCBsaXN0LiBJZiB0aGUgbGlzdCBpcyBhbHJlYWR5IHNob3dpbmcsIHRoaXMgbWV0aG9kCisgICAgICogd2lsbCByZWNhbGN1bGF0ZSB0aGUgcG9wdXAncyBzaXplIGFuZCBwb3NpdGlvbi4KKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBzaG93KCkgeworICAgICAgICBpbnQgaGVpZ2h0ID0gYnVpbGREcm9wRG93bigpOworCisgICAgICAgIGludCB3aWR0aFNwZWMgPSAwOworICAgICAgICBpbnQgaGVpZ2h0U3BlYyA9IDA7CisKKyAgICAgICAgYm9vbGVhbiBub0lucHV0TWV0aG9kID0gaXNJbnB1dE1ldGhvZE5vdE5lZWRlZCgpOworCisgICAgICAgIGlmIChtUG9wdXAuaXNTaG93aW5nKCkpIHsKKyAgICAgICAgICAgIGlmIChtRHJvcERvd25XaWR0aCA9PSBWaWV3R3JvdXAuTGF5b3V0UGFyYW1zLk1BVENIX1BBUkVOVCkgeworICAgICAgICAgICAgICAgIC8vIFRoZSBjYWxsIHRvIFBvcHVwV2luZG93J3MgdXBkYXRlIG1ldGhvZCBiZWxvdyBjYW4gYWNjZXB0IC0xIGZvciBhbnkKKyAgICAgICAgICAgICAgICAvLyB2YWx1ZSB5b3UgZG8gbm90IHdhbnQgdG8gdXBkYXRlLgorICAgICAgICAgICAgICAgIHdpZHRoU3BlYyA9IC0xOworICAgICAgICAgICAgfSBlbHNlIGlmIChtRHJvcERvd25XaWR0aCA9PSBWaWV3R3JvdXAuTGF5b3V0UGFyYW1zLldSQVBfQ09OVEVOVCkgeworICAgICAgICAgICAgICAgIHdpZHRoU3BlYyA9IGdldEFuY2hvclZpZXcoKS5nZXRXaWR0aCgpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICB3aWR0aFNwZWMgPSBtRHJvcERvd25XaWR0aDsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKG1Ecm9wRG93bkhlaWdodCA9PSBWaWV3R3JvdXAuTGF5b3V0UGFyYW1zLk1BVENIX1BBUkVOVCkgeworICAgICAgICAgICAgICAgIC8vIFRoZSBjYWxsIHRvIFBvcHVwV2luZG93J3MgdXBkYXRlIG1ldGhvZCBiZWxvdyBjYW4gYWNjZXB0IC0xIGZvciBhbnkKKyAgICAgICAgICAgICAgICAvLyB2YWx1ZSB5b3UgZG8gbm90IHdhbnQgdG8gdXBkYXRlLgorICAgICAgICAgICAgICAgIGhlaWdodFNwZWMgPSBub0lucHV0TWV0aG9kID8gaGVpZ2h0IDogVmlld0dyb3VwLkxheW91dFBhcmFtcy5NQVRDSF9QQVJFTlQ7CisgICAgICAgICAgICAgICAgaWYgKG5vSW5wdXRNZXRob2QpIHsKKyAgICAgICAgICAgICAgICAgICAgbVBvcHVwLnNldFdpbmRvd0xheW91dE1vZGUoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbURyb3BEb3duV2lkdGggPT0gVmlld0dyb3VwLkxheW91dFBhcmFtcy5NQVRDSF9QQVJFTlQgPworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVmlld0dyb3VwLkxheW91dFBhcmFtcy5NQVRDSF9QQVJFTlQgOiAwLCAwKTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICBtUG9wdXAuc2V0V2luZG93TGF5b3V0TW9kZSgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBtRHJvcERvd25XaWR0aCA9PSBWaWV3R3JvdXAuTGF5b3V0UGFyYW1zLk1BVENIX1BBUkVOVCA/CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBWaWV3R3JvdXAuTGF5b3V0UGFyYW1zLk1BVENIX1BBUkVOVCA6IDAsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgVmlld0dyb3VwLkxheW91dFBhcmFtcy5NQVRDSF9QQVJFTlQpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0gZWxzZSBpZiAobURyb3BEb3duSGVpZ2h0ID09IFZpZXdHcm91cC5MYXlvdXRQYXJhbXMuV1JBUF9DT05URU5UKSB7CisgICAgICAgICAgICAgICAgaGVpZ2h0U3BlYyA9IGhlaWdodDsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgaGVpZ2h0U3BlYyA9IG1Ecm9wRG93bkhlaWdodDsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgbVBvcHVwLnNldE91dHNpZGVUb3VjaGFibGUoIW1Gb3JjZUlnbm9yZU91dHNpZGVUb3VjaCAmJiAhbURyb3BEb3duQWx3YXlzVmlzaWJsZSk7CisKKyAgICAgICAgICAgIG1Qb3B1cC51cGRhdGUoZ2V0QW5jaG9yVmlldygpLCBtRHJvcERvd25Ib3Jpem9udGFsT2Zmc2V0LAorICAgICAgICAgICAgICAgICAgICBtRHJvcERvd25WZXJ0aWNhbE9mZnNldCwgd2lkdGhTcGVjLCBoZWlnaHRTcGVjKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIGlmIChtRHJvcERvd25XaWR0aCA9PSBWaWV3R3JvdXAuTGF5b3V0UGFyYW1zLk1BVENIX1BBUkVOVCkgeworICAgICAgICAgICAgICAgIHdpZHRoU3BlYyA9IFZpZXdHcm91cC5MYXlvdXRQYXJhbXMuTUFUQ0hfUEFSRU5UOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBpZiAobURyb3BEb3duV2lkdGggPT0gVmlld0dyb3VwLkxheW91dFBhcmFtcy5XUkFQX0NPTlRFTlQpIHsKKyAgICAgICAgICAgICAgICAgICAgbVBvcHVwLnNldFdpZHRoKGdldEFuY2hvclZpZXcoKS5nZXRXaWR0aCgpKTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICBtUG9wdXAuc2V0V2lkdGgobURyb3BEb3duV2lkdGgpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKG1Ecm9wRG93bkhlaWdodCA9PSBWaWV3R3JvdXAuTGF5b3V0UGFyYW1zLk1BVENIX1BBUkVOVCkgeworICAgICAgICAgICAgICAgIGhlaWdodFNwZWMgPSBWaWV3R3JvdXAuTGF5b3V0UGFyYW1zLk1BVENIX1BBUkVOVDsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgaWYgKG1Ecm9wRG93bkhlaWdodCA9PSBWaWV3R3JvdXAuTGF5b3V0UGFyYW1zLldSQVBfQ09OVEVOVCkgeworICAgICAgICAgICAgICAgICAgICBtUG9wdXAuc2V0SGVpZ2h0KGhlaWdodCk7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgbVBvcHVwLnNldEhlaWdodChtRHJvcERvd25IZWlnaHQpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgbVBvcHVwLnNldFdpbmRvd0xheW91dE1vZGUod2lkdGhTcGVjLCBoZWlnaHRTcGVjKTsKKyAgICAgICAgICAgIG1Qb3B1cC5zZXRJbnB1dE1ldGhvZE1vZGUoUG9wdXBXaW5kb3cuSU5QVVRfTUVUSE9EX05FRURFRCk7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIC8vIHVzZSBvdXRzaWRlIHRvdWNoYWJsZSB0byBkaXNtaXNzIGRyb3AgZG93biB3aGVuIHRvdWNoaW5nIG91dHNpZGUgb2YgaXQsIHNvCisgICAgICAgICAgICAvLyBvbmx5IHNldCB0aGlzIGlmIHRoZSBkcm9wZG93biBpcyBub3QgYWx3YXlzIHZpc2libGUKKyAgICAgICAgICAgIG1Qb3B1cC5zZXRPdXRzaWRlVG91Y2hhYmxlKCFtRm9yY2VJZ25vcmVPdXRzaWRlVG91Y2ggJiYgIW1Ecm9wRG93bkFsd2F5c1Zpc2libGUpOworICAgICAgICAgICAgbVBvcHVwLnNldFRvdWNoSW50ZXJjZXB0b3IobVRvdWNoSW50ZXJjZXB0b3IpOworICAgICAgICAgICAgbVBvcHVwLnNob3dBc0Ryb3BEb3duKGdldEFuY2hvclZpZXcoKSwKKyAgICAgICAgICAgICAgICAgICAgbURyb3BEb3duSG9yaXpvbnRhbE9mZnNldCwgbURyb3BEb3duVmVydGljYWxPZmZzZXQpOworICAgICAgICAgICAgbURyb3BEb3duTGlzdC5zZXRTZWxlY3Rpb24oTGlzdFZpZXcuSU5WQUxJRF9QT1NJVElPTik7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIGlmICghbU1vZGFsIHx8IG1Ecm9wRG93bkxpc3QuaXNJblRvdWNoTW9kZSgpKSB7CisgICAgICAgICAgICAgICAgY2xlYXJMaXN0U2VsZWN0aW9uKCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoIW1Nb2RhbCkgeworICAgICAgICAgICAgICAgIG1IYW5kbGVyLnBvc3QobUhpZGVTZWxlY3Rvcik7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBEaXNtaXNzIHRoZSBwb3B1cCB3aW5kb3cuCisgICAgICovCisgICAgcHVibGljIHZvaWQgZGlzbWlzcygpIHsKKyAgICAgICAgbVBvcHVwLmRpc21pc3MoKTsKKyAgICAgICAgcmVtb3ZlUHJvbXB0VmlldygpOworICAgICAgICBtUG9wdXAuc2V0Q29udGVudFZpZXcobnVsbCk7CisgICAgICAgIG1Ecm9wRG93bkxpc3QgPSBudWxsOworICAgIH0KKworICAgIHByaXZhdGUgdm9pZCByZW1vdmVQcm9tcHRWaWV3KCkgeworICAgICAgICBpZiAobVByb21wdFZpZXcgIT0gbnVsbCkgeworICAgICAgICAgICAgZmluYWwgVmlld1BhcmVudCBwYXJlbnQgPSBtUHJvbXB0Vmlldy5nZXRQYXJlbnQoKTsKKyAgICAgICAgICAgIGlmIChwYXJlbnQgaW5zdGFuY2VvZiBWaWV3R3JvdXApIHsKKyAgICAgICAgICAgICAgICBmaW5hbCBWaWV3R3JvdXAgZ3JvdXAgPSAoVmlld0dyb3VwKSBwYXJlbnQ7CisgICAgICAgICAgICAgICAgZ3JvdXAucmVtb3ZlVmlldyhtUHJvbXB0Vmlldyk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBDb250cm9sIGhvdyB0aGUgcG9wdXAgb3BlcmF0ZXMgd2l0aCBhbiBpbnB1dCBtZXRob2Q6IG9uZSBvZgorICAgICAqIHtAbGluayAjSU5QVVRfTUVUSE9EX0ZST01fRk9DVVNBQkxFfSwge0BsaW5rICNJTlBVVF9NRVRIT0RfTkVFREVEfSwKKyAgICAgKiBvciB7QGxpbmsgI0lOUFVUX01FVEhPRF9OT1RfTkVFREVEfS4KK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KKyAgICAgICAgRHJvcERvd25MaXN0VmlldyBsaXN0ID0gbURyb3BEb3duTGlzdDsKKyAgICAgICAgaWYgKGlzU2hvd2luZygpICYmIGxpc3QgIT0gbnVsbCkgeworICAgICAgICAgICAgbGlzdC5tTGlzdFNlbGVjdGlvbkhpZGRlbiA9IGZhbHNlOworICAgICAgICAgICAgbGlzdC5zZXRTZWxlY3Rpb24ocG9zaXRpb24pOworICAgICAgICAgICAgaWYgKGxpc3QuZ2V0Q2hvaWNlTW9kZSgpICE9IExpc3RWaWV3LkNIT0lDRV9NT0RFX05PTkUpIHsKKyAgICAgICAgICAgICAgICBsaXN0LnNldEl0ZW1DaGVja2VkKHBvc2l0aW9uLCB0cnVlKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIENsZWFyIGFueSBjdXJyZW50IGxpc3Qgc2VsZWN0aW9uLgorICAgICAqIE9ubHkgdmFsaWQgd2hlbiB7QGxpbmsgI2lzU2hvd2luZygpfSA9PSB7QGNvZGUgdHJ1ZX0uCisgICAgICovCisgICAgcHVibGljIHZvaWQgY2xlYXJMaXN0U2VsZWN0aW9uKCkgeworICAgICAgICBmaW5hbCBEcm9wRG93bkxpc3RWaWV3IGxpc3QgPSBtRHJvcERvd25MaXN0OworICAgICAgICBpZiAobGlzdCAhPSBudWxsKSB7CisgICAgICAgICAgICAvLyBXQVJOSU5HOiBQbGVhc2UgcmVhZCB0aGUgY29tbWVudCB3aGVyZSBtTGlzdFNlbGVjdGlvbkhpZGRlbiBpcyBkZWNsYXJlZAorICAgICAgICAgICAgbGlzdC5tTGlzdFNlbGVjdGlvbkhpZGRlbiA9IHRydWU7CisgICAgICAgICAgICBsaXN0LmhpZGVTZWxlY3RvcigpOworICAgICAgICAgICAgbGlzdC5yZXF1ZXN0TGF5b3V0KCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBAcmV0dXJuIHtAY29kZSB0cnVlfSBpZiB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b3JtSXRlbUNsaWNrKGludCBwb3NpdGlvbikgeworICAgICAgICBpZiAoaXNTaG93aW5nKCkpIHsKKyAgICAgICAgICAgIGlmIChtSXRlbUNsaWNrTGlzdGVuZXIgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIGZpbmFsIERyb3BEb3duTGlzdFZpZXcgbGlzdCA9IG1Ecm9wRG93bkxpc3Q7CisgICAgICAgICAgICAgICAgZmluYWwgVmlldyBjaGlsZCA9IGxpc3QuZ2V0Q2hpbGRBdChwb3NpdGlvbiAtIGxpc3QuZ2V0Rmlyc3RWaXNpYmxlUG9zaXRpb24oKSk7CisgICAgICAgICAgICAgICAgbUl0ZW1DbGlja0xpc3RlbmVyLm9uSXRlbUNsaWNrKGxpc3QsIGNoaWxkLCBwb3NpdGlvbiwgY2hpbGQuZ2V0SWQoKSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgLyoqCisgICAgICogQHJldHVybiBUaGUgY3VycmVudGx5IHNlbGVjdGVkIGl0ZW0gb3IgbnVsbCBpZiB0aGUgcG9wdXAgaXMgbm90IHNob3dpbmcuCisgICAgICovCisgICAgcHVibGljIE9iamVjdCBnZXRTZWxlY3RlZEl0ZW0oKSB7CisgICAgICAgIGlmICghaXNTaG93aW5nKCkpIHsKKyAgICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICB9CisgICAgICAgIHJldHVybiBtRHJvcERvd25MaXN0LmdldFNlbGVjdGVkSXRlbSgpOworICAgIH0KKworICAgIC8qKgorICAgICAqIEByZXR1cm4gVGhlIHBvc2l0aW9uIG9mIHRoZSBjdXJyZW50bHkgc2VsZWN0ZWQgaXRlbSBvciB7QGxpbmsgTGlzdFZpZXcjSU5WQUxJRF9QT1NJVElPTn0KKyAgICAgKiBpZiB7QGxpbmsgI2lzU2hvd2luZygpfSA9PSB7QGNvZGUgZmFsc2V9LgorICAgICAqIAorICAgICAqIEBzZWUgTGlzdFZpZXcjZ2V0U2VsZWN0ZWRJdGVtUG9zaXRpb24oKQorICAgICAqLworICAgIHB1YmxpYyBpbnQgZ2V0U2VsZWN0ZWRJdGVtUG9zaXRpb24oKSB7CisgICAgICAgIGlmICghaXNTaG93aW5nKCkpIHsKKyAgICAgICAgICAgIHJldHVybiBMaXN0Vmlldy5JTlZBTElEX1BPU0lUSU9OOworICAgICAgICB9CisgICAgICAgIHJldHVybiBtRHJvcERvd25MaXN0LmdldFNlbGVjdGVkSXRlbVBvc2l0aW9uKCk7CisgICAgfQorCisgICAgLyoqCisgICAgICogQHJldHVybiBUaGUgSUQgb2YgdGhlIGN1cnJlbnRseSBzZWxlY3RlZCBpdGVtIG9yIHtAbGluayBMaXN0VmlldyNJTlZBTElEX1JPV19JRH0KKyAgICAgKiBpZiB7QGxpbmsgI2lzU2hvd2luZygpfSA9PSB7QGNvZGUgZmFsc2V9LgorICAgICAqIAorICAgICAqIEBzZWUgTGlzdFZpZXcjZ2V0U2VsZWN0ZWRJdGVtSWQoKQorICAgICAqLworICAgIHB1YmxpYyBsb25nIGdldFNlbGVjdGVkSXRlbUlkKCkgeworICAgICAgICBpZiAoIWlzU2hvd2luZygpKSB7CisgICAgICAgICAgICByZXR1cm4gTGlzdFZpZXcuSU5WQUxJRF9ST1dfSUQ7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIG1Ecm9wRG93bkxpc3QuZ2V0U2VsZWN0ZWRJdGVtSWQoKTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBAcmV0dXJuIFRoZSBWaWV3IGZvciB0aGUgY3VycmVudGx5IHNlbGVjdGVkIGl0ZW0gb3IgbnVsbCBpZgorICAgICAqIHtAbGluayAjaXNTaG93aW5nKCl9ID09IHtAY29kZSBmYWxzZX0uCisgICAgICogCisgICAgICogQHNlZSBMaXN0VmlldyNnZXRTZWxlY3RlZFZpZXcoKQorICAgICAqLworICAgIHB1YmxpYyBWaWV3IGdldFNlbGVjdGVkVmlldygpIHsKKyAgICAgICAgaWYgKCFpc1Nob3dpbmcoKSkgeworICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIG1Ecm9wRG93bkxpc3QuZ2V0U2VsZWN0ZWRWaWV3KCk7CisgICAgfQorCisgICAgLyoqCisgICAgICogQHJldHVybiBUaGUge0BsaW5rIExpc3RWaWV3fSBkaXNwbGF5ZWQgd2l0aGluIHRoZSBwb3B1cCB3aW5kb3cuCisgICAgICogT25seSB2YWxpZCB3aGVuIHtAbGluayAjaXNTaG93aW5nKCl9ID09IHtAY29kZSB0cnVlfS4KKyAgICAgKi8KKyAgICBwdWJsaWMgTGlzdFZpZXcgZ2V0TGlzdFZpZXcoKSB7CisgICAgICAgIHJldHVybiBtRHJvcERvd25MaXN0OworICAgIH0KKworICAgIC8qKgorICAgICAqIEZpbHRlciBrZXkgZG93biBldmVudHMuIEJ5IGZvcndhcmRpbmcga2V5IHVwIGV2ZW50cyB0byB0aGlzIGZ1bmN0aW9uLAorICAgICAqIHZpZXdzIHVzaW5nIG5vbi1tb2RhbCBMaXN0UG9wdXBXaW5kb3cgY2FuIGhhdmUgaXQgaGFuZGxlIGtleSBzZWxlY3Rpb24gb2YgaXRlbXMuCisgICAgICogIAorICAgICAqIEBwYXJhbSBrZXlDb2RlIGtleUNvZGUgcGFyYW0gcGFzc2VkIHRvIHRoZSBob3N0IHZpZXcncyBvbktleURvd24KKyAgICAgKiBAcGFyYW0gZXZlbnQgZXZlbnQgcGFyYW0gcGFzc2VkIHRvIHRoZSBob3N0IHZpZXcncyBvbktleURvd24KKyAgICAgKiBAcmV0dXJuIHRydWUgaWYgdGhlIGV2ZW50IHdhcyBoYW5kbGVkLCBmYWxzZSBpZiBpdCB3YXMgaWdub3JlZC4KKyAgICAgKiAKKyAgICAgKiBAc2VlICNzZXRNb2RhbChib29sZWFuKQorICAgICAqLworICAgIHB1YmxpYyBib29sZWFuIG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isgICAgICAgICAgICAgICAgYm9vbGVhbiBjb25zdW1lZDsKKworICAgICAgICAgICAgICAgIGZpbmFsIGJvb2xlYW4gYmVsb3cgPSAhbVBvcHVwLmlzQWJvdmVBbmNob3IoKTsKKworICAgICAgICAgICAgICAgIGZpbmFsIExpc3RBZGFwdGVyIGFkYXB0ZXIgPSBtQWRhcHRlcjsKKyAgICAgICAgICAgICAgICAKKyAgICAgICAgICAgICAgICBib29sZWFuIGFsbEVuYWJsZWQ7CisgICAgICAgICAgICAgICAgaW50IGZpcnN0SXRlbSA9IEludGVnZXIuTUFYX1ZBTFVFOworICAgICAgICAgICAgICAgIGludCBsYXN0SXRlbSA9IEludGVnZXIuTUlOX1ZBTFVFOworCisgICAgICAgICAgICAgICAgaWYgKGFkYXB0ZXIgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICBhbGxFbmFibGVkID0gYWRhcHRlci5hcmVBbGxJdGVtc0VuYWJsZWQoKTsKKyAgICAgICAgICAgICAgICAgICAgZmlyc3RJdGVtID0gYWxsRW5hYmxlZCA/IDAgOgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1Ecm9wRG93bkxpc3QubG9va0ZvclNlbGVjdGFibGVQb3NpdGlvbigwLCB0cnVlKTsKKyAgICAgICAgICAgICAgICAgICAgbGFzdEl0ZW0gPSBhbGxFbmFibGVkID8gYWRhcHRlci5nZXRDb3VudCgpIC0gMSA6CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbURyb3BEb3duTGlzdC5sb29rRm9yU2VsZWN0YWJsZVBvc2l0aW9uKGFkYXB0ZXIuZ2V0Q291bnQoKSAtIDEsIGZhbHNlKTsgICAgICAgICAgICAgICAgICAgIAorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAKKyAgICAgICAgICAgICAgICBpZiAoKGJlbG93ICYmIGtleUNvZGUgPT0gS2V5RXZlbnQuS0VZQ09ERV9EUEFEX1VQICYmIGN1ckluZGV4IDw9IGZpcnN0SXRlbSkgfHwKKyAgICAgICAgICAgICAgICAgICAgICAgICghYmVsb3cgJiYga2V5Q29kZSA9PSBLZXlFdmVudC5LRVlDT0RFX0RQQURfRE9XTiAmJiBjdXJJbmRleCA+PSBsYXN0SXRlbSkpIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gV2hlbiB0aGUgc2VsZWN0aW9uIGlzIGF0IHRoZSB0b3AsIHdlIGJsb2NrIHRoZSBrZXkKKyAgICAgICAgICAgICAgICAgICAgLy8gZXZlbnQgdG8gcHJldmVudCBmb2N1cyBmcm9tIG1vdmluZy4KKyAgICAgICAgICAgICAgICAgICAgY2xlYXJMaXN0U2VsZWN0aW9uKCk7CisgICAgICAgICAgICAgICAgICAgIG1Qb3B1cC5zZXRJbnB1dE1ldGhvZE1vZGUoUG9wdXBXaW5kb3cuSU5QVVRfTUVUSE9EX05FRURFRCk7CisgICAgICAgICAgICAgICAgICAgIHNob3coKTsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gV0FSTklORzogUGxlYXNlIHJlYWQgdGhlIGNvbW1lbnQgd2hlcmUgbUxpc3RTZWxlY3Rpb25IaWRkZW4KKyAgICAgICAgICAgICAgICAgICAgLy8gICAgICAgICAgaXMgZGVjbGFyZWQKKyAgICAgICAgICAgICAgICAgICAgbURyb3BEb3duTGlzdC5tTGlzdFNlbGVjdGlvbkhpZGRlbiA9IGZhbHNlOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIGNvbnN1bWVkID0gbURyb3BEb3duTGlzdC5vbktleURvd24oa2V5Q29kZSwgZXZlbnQpOworICAgICAgICAgICAgICAgIGlmIChERUJVRykgTG9nLnYoVEFHLCAiS2V5IGRvd246IGNvZGU9IiArIGtleUNvZGUgKyAiIGxpc3QgY29uc3VtZWQ9IiArIGNvbnN1bWVkKTsKKworICAgICAgICAgICAgICAgIGlmIChjb25zdW1lZCkgeworICAgICAgICAgICAgICAgICAgICAvLyBJZiBpdCBoYW5kbGVkIHRoZSBrZXkgZXZlbnQsIHRoZW4gdGhlIHVzZXIgaXMKKyAgICAgICAgICAgICAgICAgICAgLy8gbmF2aWdhdGluZyBpbiB0aGUgbGlzdCwgc28gd2Ugc2hvdWxkIHB1dCBpdCBpbiBmcm9udC4KKyAgICAgICAgICAgICAgICAgICAgbVBvcHVwLnNldElucHV0TWV0aG9kTW9kZShQb3B1cFdpbmRvdy5JTlBVVF9NRVRIT0RfTk9UX05FRURFRCk7CisgICAgICAgICAgICAgICAgICAgIC8vIEhlcmUncyBhIGxpdHRsZSB0cmljayB3ZSBuZWVkIHRvIGRvIHRvIG1ha2Ugc3VyZSB0aGF0CisgICAgICAgICAgICAgICAgICAgIC8vIHRoZSBsaXN0IHZpZXcgaXMgYWN0dWFsbHkgc2hvd2luZyBpdHMgZm9jdXMgaW5kaWNhdG9yLAorICAgICAgICAgICAgICAgICAgICAvLyBieSBlbnN1cmluZyBpdCBoYXMgZm9jdXMgYW5kIGdldHRpbmcgaXRzIHdpbmRvdyBvdXQKKyAgICAgICAgICAgICAgICAgICAgLy8gb2YgdG91Y2ggbW9kZS4KKyAgICAgICAgICAgICAgICAgICAgbURyb3BEb3duTGlzdC5yZXF1ZXN0Rm9jdXNGcm9tVG91Y2goKTsKKyAgICAgICAgICAgICAgICAgICAgc2hvdygpOworCisgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoa2V5Q29kZSkgeworICAgICAgICAgICAgICAgICAgICAgICAgLy8gYXZvaWQgcGFzc2luZyB0aGUgZm9jdXMgZnJvbSB0aGUgdGV4dCB2aWV3IHRvIHRoZQorICAgICAgICAgICAgICAgICAgICAgICAgLy8gbmV4dCBjb21wb25lbnQKKyAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgS2V5RXZlbnQuS0VZQ09ERV9FTlRFUjoKKyAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgS2V5RXZlbnQuS0VZQ09ERV9EUEFEX0NFTlRFUjoKKyAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgS2V5RXZlbnQuS0VZQ09ERV9EUEFEX0RPV046CisgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIEtleUV2ZW50LktFWUNPREVfRFBBRF9VUDoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIGlmIChiZWxvdyAmJiBrZXlDb2RlID09IEtleUV2ZW50LktFWUNPREVfRFBBRF9ET1dOKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAvLyB3aGVuIHRoZSBzZWxlY3Rpb24gaXMgYXQgdGhlIGJvdHRvbSwgd2UgYmxvY2sgdGhlCisgICAgICAgICAgICAgICAgICAgICAgICAvLyBldmVudCB0byBhdm9pZCBnb2luZyB0byB0aGUgbmV4dCBmb2N1c2FibGUgd2lkZ2V0CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoY3VySW5kZXggPT0gbGFzdEl0ZW0pIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICghYmVsb3cgJiYga2V5Q29kZSA9PSBLZXlFdmVudC5LRVlDT0RFX0RQQURfVVAgJiYKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXJJbmRleCA9PSBmaXJzdEl0ZW0pIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIC8qKgorICAgICAqIEZpbHRlciBrZXkgZG93biBldmVudHMuIEJ5IGZvcnd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ICAgLy8gZnJvbSB0aGUgZHJvcCBkb3duIGFzIGl0cyBjb250ZW50CisgICAgICAgICAgICAgICAgICAgIGNhc2UgS2V5RXZlbnQuS0VZQ09ERV9FTlRFUjoKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBLZXlFdmVudC5LRVlDT0RFX0RQQURfQ0VOVEVSOgorICAgICAgICAgICAgICAgICAgICAgICAgZGlzbWlzcygpOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuIGNvbnN1bWVkOworICAgICAgICB9CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBGaWx0ZXIgcHJlLUlNRSBrZXkgZXZlbnRzLiBCeSBmb3J3YXJkaW5nIHtAbGluayBWaWV3I29uS2V5UHJlSW1lKGludCwgS2V5RXZlbnQpfQorICAgICAqIGV2ZW50cyB0byB0aGlzIGZ1bmN0aW9uLCB2aWV3cyB1c2luZyBMaXN0UG9wdXBXaW5kb3cgY2FuIGhhdmUgaXQgZGlzbWlzcyB0aGUgcG9wdXAKKyAgICAgKiB3aGVuIHRoZSBiYWNrIGtleSBpcyBwcmVzc2VkLgorICAgICAqICAKKyAgICAgKiBAcGFyYW0ga2V5Q29kZSBrZXlDb2RlIHBhcmFtIHBhc3NlZCB0byB0aGUgaG9zdCB2aWV3J3Mgb25LZXlQcmVJbWUKKyAgICAgKiBAcGFyYW0gZXZlbnQgZXZlbnQgcGFyYW0gcGFzc2VkIHRvIHRoZSBob3N0IHZpZXcncyBvbktleVByZUltZQorICAgICAqIEByZXR1cm4gdHJ1ZSBpZiB0aGUgZXZlbnQgd2FzIGhhbmRsZWQsIGZhbHNlIGlmIGl0IHdhcyBpZ25vcmVkLgorICAgICAqIAorICAgICAqIEBzZWUgI3NldE1vZGFsKGJvb2xlYW4pCisgICAgICovCisgICAgcHVibGljIGJvb2xlYW4gb25LZXlQcmVJbWUoaW50IGtleUNvZGUsIEtleUV2ZW50IGV2ZW50KSB7CisgICAgICAgIGlmIChrZXlDb2RlID09IEtleUV2ZW50LktFWUNPREVfQkFDSyAmJiBpc1Nob3dpbmcoKSkgeworICAgICAgICAgICAgLy8gc3BlY2lhbCBjYXNlIGZvciB0aGUgYmFjayBrZXksIHdlIGRvIG5vdCBldmVuIHRyeSB0byBzZW5kIGl0CisgICAgICAgICAgICAvLyB0byB0aGUgZHJvcCBkb3duIGxpc3QgYnV0IGluc3RlYWQsIGNvbnN1bWUgaXQgaW1tZWRpYXRlbHkKKyAgICAgICAgICAgIGZpbmFsIFZpZXcgYW5jaG9yVmlldyA9IG1Ecm9wRG93bkFuY2hvclZpZXc7CisgICAgICAgICAgICBpZiAoZXZlbnQuZ2V0QWN0aW9uKCkgPT0gS2V5RXZlbnQuQUNUSU9OX0RPV04gJiYgZXZlbnQuZ2V0UmVwZWF0Q291bnQoKSA9PSAwKSB7CisgICAgICAgICAgICAgICAgYW5jaG9yVmlldy5nZXRLZXlEaXNwYXRjaGVyU3RhdGUoKS5zdGFydFRyYWNraW5nKGV2ZW50LCB0aGlzKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgICAgIH0gZWxzZSBpZiAoZXZlbnQuZ2V0QWN0aW9uKCkgPT0gS2V5RXZlbnQuQUNUSU9OX1VQKSB7CisgICAgICAgICAgICAgICAgYW5jaG9yVmlldy5nZXRLZXlEaXNwYXRjaGVyU3RhdGUoKS5oYW5kbGVVcEV2ZW50KGV2ZW50KTsKKyAgICAgICAgICAgICAgICBpZiAoZXZlbnQuaXNUcmFja2luZygpICYmICFldmVudC5pc0NhbmNlbGVkKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgZGlzbWlzcygpOworICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJ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yBtZXRob2QuCisgICAgICAgICAgICAgKi8KKyAgICAgICAgICAgIG1TaG93RHJvcERvd25SdW5uYWJsZSA9IG5ldyBSdW5uYWJsZSgpIHsKKyAgICAgICAgICAgICAgICBwdWJsaWMgdm9pZCBydW4oKSB7CisgICAgICAgICAgICAgICAgICAgIC8vIFZpZXcgbGF5b3V0IHNob3VsZCBiZSBhbGwgZG9uZSBiZWZvcmUgZGlzcGxheWluZyB0aGUgZHJvcCBkb3duLgorICAgICAgICAgICAgICAgICAgICBWaWV3IHZpZXcgPSBnZXRBbmNob3JWaWV3KCk7CisgICAgICAgICAgICAgICAgICAgIGlmICh2aWV3ICE9IG51bGwgJiYgdmlldy5nZXRXaW5kb3dUb2tlbigpICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHNob3coKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH07CisKKyAgICAgICAgICAgIG1Ecm9wRG93bkxpc3QgPSBuZXcgRHJvcERvd25MaXN0Vmlldyhjb250ZXh0LCAhbU1vZGFsKTsKKyAgICAgICAgICAgIGlmIChtRHJvcERvd25MaXN0SGlnaGxpZ2h0ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBtRHJvcERvd25MaXN0LnNldFNlbGVjdG9yKG1Ecm9wRG93bkxpc3RIaWdobGlnaHQpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgbURyb3BEb3duTGlzdC5zZXRBZGFwdGVyKG1BZGFwdGVyKTsKKyAgICAgICAgICAgIG1Ecm9wRG93bkxpc3Quc2V0VmVydGljYWxGYWRpbmdFZGdlRW5hYmxlZCh0cnVlKTsKKyAgICAgICAgICAgIG1Ecm9wRG93bkxpc3Quc2V0T25JdGVtQ2xpY2tMaXN0ZW5lcihtSXRlbUNsaWNrTGlzdGVuZXIpOworICAgICAgICAgICAgbURyb3BEb3duTGlzdC5zZXRGb2N1c2FibGUodHJ1ZSk7CisgICAgICAgICAgICBtRHJvcERvd25MaXN0LnNldEZvY3VzYWJsZUluVG91Y2hNb2RlKHRydWUpOworICAgICAgICAgICAgbURyb3BEb3duTGlzdC5zZXRPbkl0ZW1TZWxlY3RlZExpc3RlbmVyKG5ldyBBZGFwdGVyVmlldy5Pbkl0ZW1TZWxlY3RlZExpc3RlbmVyKCkgeworICAgICAgICAgICAgICAgIHB1YmxpYyB2b2lkIG9uSXRlbVNlbGVjdGVkKEFkYXB0ZXJWaWV3PD8+IHBhcmVudCwgVmlldyB2aWV3LAorICAgICAgICAgICAgICAgICAgICAgICAgaW50IHBvc2l0aW9uLCBsb25nIGlkKSB7CisKKyAgICAgICAgICAgICAgICAgICAgaWYgKHBvc2l0aW9uICE9IC0xKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBEcm9wRG93bkxpc3RWaWV3IGRyb3BEb3duTGlzdCA9IG1Ecm9wRG93bkxpc3Q7CisKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkcm9wRG93bkxpc3QgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRyb3BEb3duTGlzdC5tTGlzdFNlbGVjdGlvbkhpZGRlbiA9IGZhbHNlOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgcHVibGljIHZvaWQgb25Ob3RoaW5nU2VsZWN0ZWQoQWRhcHRlclZpZXc8Pz4gcGFyZW50KSB7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSk7CisgICAgICAgICAgICBtRHJvcERvd25MaXN0LnNldE9uU2Nyb2xsTGlzdGVuZXIobVNjcm9sbExpc3RlbmVyKTsKKworICAgICAgICAgICAgaWYgKG1JdGVtU2VsZWN0ZWRMaXN0ZW5lciAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgbURyb3BEb3duTGlzdC5zZXRPbkl0ZW1TZWxlY3RlZExpc3RlbmVyKG1JdGVtU2VsZWN0ZWRMaXN0ZW5lcik7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGRyb3BEb3duVmlldyA9IG1Ecm9wRG93bkxpc3Q7CisKKyAgICAgICAgICAgIFZpZXcgaGludFZpZXcgPSBtUHJvbXB0VmlldzsKKyAgICAgICAgICAgIGlmIChoaW50VmlldyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgLy8gaWYgYW4gaGludCBoYXMgYmVlbiBzcGVjaWZpZWQsIHdlIGFjY29tb2RhdGUgbW9yZSBzcGFjZSBmb3IgaXQgYW5kCisgICAgICAgICAgICAgICAgLy8gYWRkIGEgdGV4dCB2aWV3IGluIHRoZSBkcm9wIGRvd24gbWVudSwgYXQgdGhlIGJvdHRvbSBvZiB0aGUgbGlzdAorICAgICAgICAgICAgICAgIExpbmVhckxheW91dCBoaW50Q29udGFpbmVyID0gbmV3IExpbmVhckxheW91dChjb250ZXh0KTsKKyAgICAgICAgICAgICAgICBoaW50Q29udGFpbmVyLnNldE9yaWVudGF0aW9uKExpbmVhckxheW91dC5WRVJUSUNBTCk7CisKKyAgICAgICAgICAgICAgICBMaW5lYXJMYXlvdXQuTGF5b3V0UGFyYW1zIGhpbnRQYXJhbXMgPSBuZXcgTGluZWFyTGF5b3V0LkxheW91dFBhcmFtcygKKyAgICAgICAgICAgICAgICAgICAgICAgIFZpZXdHcm91cC5MYXlvdXRQYXJhbXMuTUFUQ0hfUEFSRU5ULCAwLCAxLjBmCisgICAgICAgICAgICAgICAgKTsKKyAgICAgICAgICAgICAgICAKKyAgICAgICAgICAgICAgICBzd2l0Y2ggKG1Qcm9tcHRQb3NpdGlvbikgeworICAgICAgICAgICAgICAgIGNhc2UgUE9TSVRJT05fUFJPTVBUX0JFTE9XOgorICAgICAgICAgICAgICAgICAgICBoaW50Q29udGFpbmVyLmFkZFZpZXcoZHJvcERvd25WaWV3LCBoaW50UGFyYW1zKTsKKyAgICAgICAgICAgICAgICAgICAgaGludENvbnRhaW5lci5hZGRWaWV3KGhpbnRWaWV3KTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIAorICAgICAgICAgICAgICAgIGNhc2UgUE9TSVRJT05fUFJPTVBUX0FCT1ZFOgorICAgICAgICAgICAgICAgICAgICBoaW50Q29udGFpbmVyLmFkZFZpZXcoaGludFZpZXcpOworICAgICAgICAgICAgICAgICAgICBoaW50Q29udGFpbmVyLmFkZFZpZXcoZHJvcERvd25WaWV3LCBoaW50UGFyYW1zKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIAorICAgICAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgICAgIExvZy5lKFRBRywgIkludmFsaWQgaGludCBwb3NpdGlvbiAiICsgbVByb21wdFBvc2l0aW9uKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgLy8gbWVhc3VyZSB0aGUgaGludCdzIGhlaWdodCB0byBmaW5kIGhvdyBtdWNoIG1vcmUgdmVydGljYWwgc3BhY2UKKyAgICAgICAgICAgICAgICAvLyB3ZSBuZWVkIHRvIGFkZCB0byB0aGUgZHJvcCBkb3duJ3MgaGVpZ2h0CisgICAgICAgICAgICAgICAgaW50IHdpZHRoU3BlYyA9IE1lYXN1cmVTcGVjLm1ha2VNZWFzdXJlU3BlYyhtRHJvcERvd25XaWR0aCwgTWVhc3VyZVNwZWMuQVRfTU9TVCk7CisgICAgICAgICAgICAgICAgaW50IGhlaWdodFNwZWMgPSBNZWFzdXJlU3BlYy5VTlNQRUNJRklFRDsKKyAgICAgICAgICAgICAgICBoaW50Vmlldy5tZWFzdXJlKHdpZHRoU3BlYywgaGVpZ2h0U3BlYyk7CisKKyAgICAgICAgICAgICAgICBoaW50UGFyYW1zID0gKExpbmVhckxheW91dC5MYXlvdXRQYXJhbXMpIGhpbnRWaWV3LmdldExheW91dFBhcmFtcygpOworICAgICAgICAgICAgICAgIG90aGVySGVpZ2h0cyA9IGhpbnRWaWV3LmdldE1lYXN1cmVkSGVpZ2h0KCkgKyBoaW50UGFyYW1zLnRvcE1hcmdpbgorICAgICAgICAgICAgICAgICAgICAgICAgKyBoaW50UGFyYW1zLmJvdHRvbU1hcmdpbjsKKworICAgICAgICAgICAgICAgIGRyb3BEb3duVmlldyA9IGhpbnRDb250YWluZXI7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIG1Qb3B1cC5zZXRDb250ZW50Vmlldyhkcm9wRG93blZpZXcpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgZHJvcERvd25WaWV3ID0gKFZpZXdHcm91cCkgbVBvcHVwLmdldENvbnRlbnRWaWV3KCk7CisgICAgICAgICAgICBmaW5hbCBWaWV3IHZpZXcgPSBtUHJvbXB0VmlldzsKKyAgICAgICAgICAgIGlmICh2aWV3ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBMaW5lYXJMYXlvdXQuTGF5b3V0UGFyYW1zIGhpbnRQYXJhbXMgPQorICAgICAgICAgICAgICAgICAgICAgICAgKExpbmVhckxheW91dC5MYXlvdXRQYXJhbXMpIHZpZXcuZ2V0TGF5b3V0UGFyYW1zKCk7CisgICAgICAgICAgICAgICAgb3RoZXJIZWlnaHRzID0gdmlldy5nZXRNZWFzdXJlZEhlaWdodCgpICsgaGludFBhcmFtcy50b3BNYXJnaW4KKyAgICAgICAgICAgICAgICAgICAgICAgICsgaGludFBhcmFtcy5ib3R0b21NYXJnaW47CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICAvLyBNYXggaGVpZ2h0IGF2YWlsYWJsZSBvbiB0aGUgc2NyZWVuIGZvciBhIHBvcHVwLgorICAgICAgICBib29sZWFuIGlnbm9yZUJvdHRvbURlY29yYXRpb25zID0KKyAgICAgICAgICAgICAgICBtUG9wdXAuZ2V0SW5wdXRNZXRob2RNb2RlKCkgPT0gUG9wdXBXaW5kb3cuSU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gYSBuZXcgbGlzdCB2aWV3IHdyYXBwZXIuPC9wPgorICAgICAgICAgKgorICAgICAgICAgKiBAcGFyYW0gY29udGV4dCB0aGlzIHZpZXcncyBjb250ZXh0CisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgRHJvcERvd25MaXN0VmlldyhDb250ZXh0IGNvbnRleHQsIGJvb2xlYW4gaGlqYWNrRm9jdXMpIHsKKyAgICAgICAgICAgIHN1cGVyKGNvbnRleHQsIG51bGwsIGNvbS5hbmRyb2lkLmludGVybmFsLlIuYXR0ci5kcm9wRG93bkxpc3RWaWV3U3R5bGUpOworICAgICAgICAgICAgbUhpamFja0ZvY3VzID0gaGlqYWNrRm9jdXM7CisgICAgICAgIH0KKworICAgICAgICAvKioKKyAgICAgICAgICogPHA+QXZvaWRzIGphcnJpbmcgc2Nyb2xsaW5nIGVmZmVjdCBieSBlbnN1cmluZyB0aGF0IGxpc3QgZWxlbWVudHMKKyAgICAgICAgICogbWFkZSBvZiBhIHRleHQgdmlldyBmaXQgb24gYSBzaW5nbGUgbGluZS48L3A+CisgICAgICAgICAqCisgICAgICAgICAqIEBwYXJhbSBwb3NpdGlvbiB0aGUgaXRlbSBpbmRleCBpbiB0aGUgbGlzdCB0byBnZXQgYSB2aWV3IGZvcgorICAgICAgICAgKiBAcmV0dXJuIHRoZSB2aWV3IGZvciB0aGUgc3BlY2lmaWVkIGl0ZW0KKyAgICAgICAgICovCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBWaWV3IG9idGFpblZpZXcoaW50IHBvc2l0aW9uLCBib29sZWFuW10gaXNTY3JhcCkgeworICAgICAgICAgICAgVmlldyB2aWV3ID0gc3VwZXIub2J0YWluVmlldyhwb3NpdGlvbiwgaXNTY3JhcCk7CisKKyAgICAgICAgICAgIGlmICh2aWV3IGluc3RhbmNlb2YgVGV4dFZpZXcpIHsKKyAgICAgICAgICAgICAgICAoKFRleHRWaWV3KSB2aWV3KS5zZXRIb3Jpem9udGFsbHlTY3JvbGxpbmcodHJ1ZSk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHJldHVybiB2aWV3OworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyBib29sZWFuIGlzSW5Ub3VjaE1vZGUoKSB7CisgICAgICAgICAgICAvLyBXQVJOSU5HOiBQbGVhc2UgcmVhZCB0aGUgY29tbWVudCB3aGVyZSBtTGlzdFNlbGVjdGlvbkhpZGRlbiBpcyBkZWNsYXJlZAorICAgICAgICAgICAgcmV0dXJuIChtSGlqYWNrRm9jdXMgJiYgbUxpc3RTZWxlY3Rpb25IaWRkZW4pIHx8IHN1cGVyLmlzSW5Ub3VjaE1vZGUoKTsKKyAgICAgICAgfQorCisgICAgICAgIC8qKgorICAgICAgICAgKiA8cD5SZXR1cm5zIHRoZSBmb2N1cyBzdGF0ZSBpbiB0aGUgZHJvcCBkb3duLjwvcD4KKyAgICAgICAgICoKKyAgICAgICAgICogQHJldHVybiB0cnVlIGFsd2F5cyBpZiBoaWphY2tpbmcgZm9jdXMKKyAgICAgICAgICovCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgYm9vbGVhbiBoYXNXaW5kb3dGb2N1cygpIHsKKyAgICAgICAgICAgIHJldHVybiBtSGlqYWNrRm9jdXMgfHwgc3VwZXIuaGFzV2luZG93Rm9jdXMoKTsKKyAgICAgICAgfQorCisgICAgICAgIC8qKgorICAgICAgICAgKiA8cD5SZXR1cm5zIHRoZSBmb2N1cyBzdGF0ZSBpbiB0aGUgZHJvcCBkb3duLjwvcD4KKyAgICAgICAgICoKKyAgICAgICAgICogQHJldHVybiB0cnVlIGFsd2F5cyBpZiBoaWphY2tpbmcgZm9jdXMKKyAgICAgICAgICovCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgYm9vbGVhbiBpc0ZvY3VzZWQoKSB7CisgICAgICAgICAgICByZXR1cm4gbUhpamFja0ZvY3VzIHx8IHN1cGVyLmlzRm9jdXNlZCgpOworICAgICAgICB9CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIDxwPlJldHVybnMgdGhlIGZvY3VzIHN0YXRlIGluIHRoZSBkcm9wIGRvd24uPC9wPgorICAgICAgICAgKgorICAgICAgICAgKiBAcmV0dXJuIHRydWUgYWx3YXlzIGlmIGhpamFja2luZyBmb2N1cworICAgICAgICAgKi8KKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyBib29sZWFuIGhhc0ZvY3VzKCkgeworICAgICAgICAgICAgcmV0dXJuIG1IaWphY2tGb2N1cyB8fCBzdXBlci5oYXNGb2N1cygpOworICAgICAgICB9CisgICAgfQorCisgICAgcHJpdmF0ZSBjbGFzcyBQb3B1cERhdGFTZXRPYnNlcnZlciBleHRlbmRzIERhdGFTZXRPYnNlcnZlciB7CisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgdm9pZCBvbkNoYW5nZWQoKSB7CisgICAgICAgICAgICBpZiAoaXNTaG93aW5nKCkpIHsKKyAgICAgICAgICAgICAgICAvLyBSZXNpemUgdGhlIHBvcHVwIHRvIGZpdCBuZXcgY29udGVudAorICAgICAgICAgICAgICAgIHNob3coKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyB2b2lkIG9uSW52YWxpZGF0ZWQoKSB7CisgICAgICAgICAgICBkaXNtaXNzKCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcml2YXRlIGNsYXNzIExpc3RTZWxlY3RvckhpZGVyIGltcGxlbWVudHMgUnVubmFibGUgeworICAgICAgICBwdWJsaWMgdm9pZCBydW4oKSB7CisgICAgICAgICAgICBjbGVhckxpc3RTZWxlY3Rpb24oKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgY2xhc3MgUmVzaXplUG9wdXBSdW5uYWJsZSBpbXBsZW1lbnRzIFJ1bm5hYmxlIHsKKyAgICAgICAgcHVibGljIHZvaWQgcnVuKCkgeworICAgICAgICAgICAgbVBvcHVwLnNldElucHV0TWV0aG9kTW9kZShQb3B1cFdpbmRvdy5JTlBVVF9NRVRIT0RfTk9UX05FRURFRCk7CisgICAgICAgICAgICBzaG93KCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcml2YXRlIGNsYXNzIFBvcHVwVG91Y2hJbnRlcmNlcHRvciBpbXBsZW1lbnRzIE9uVG91Y2hMaXN0ZW5lciB7CisgICAgICAgIHB1YmxpYyBib29sZWFuIG9uVG91Y2goVmlldyB2LCBNb3Rpb25FdmVudCBldmVudCkgeworICAgICAgICAgICAgZmluYWwgaW50IGFjdGlvbiA9IGV2ZW50LmdldEFjdGlvbigpOworICAgICAgICAgICAgZmluYWwgaW50IHggPSAoaW50KSBldmVudC5nZXRYKCk7CisgICAgICAgICAgICBmaW5hbCBpbnQgeSA9IChpbnQpIGV2ZW50LmdldFkoKTsKKyAgICAgICAgICAgIAorICAgICAgICAgICAgaWYgKGFjdGlvbiA9PSBNb3Rpb25FdmVudC5BQ1RJT05fRE9XTiAmJgorICAgICAgICAgICAgICAgICAgICBtUG9wdXAgIT0gbnVsbCAmJiBtUG9wdXAuaXNTaG93aW5nKCkgJiYKKyAgICAgICAgICAgICAgICAgICAgKHggPj0gMCAmJiB4IDwgZ2V0V2lkdGgoKSAmJiB5ID49IDAgJiYgeSA8IGdldEhlaWdodCgpKSkgeworICAgICAgICAgICAgICAgIG1IYW5kbGVyLnBvc3REZWxheWVkKG1SZXNpemVQb3B1cFJ1bm5hYmxlLCBFWFBBTkRfTElTVF9USU1FT1VUKTsKKyAgICAgICAgICAgIH0gZWxzZSBpZiAoYWN0aW9uID09IE1vdGlvbkV2ZW50LkFDVElPTl9VUCkgeworICAgICAgICAgICAgICAgIG1IYW5kbGVyLnJlbW92ZUNhbGxiYWNrcyhtUmVzaXplUG9wdXBSdW5uYWJsZSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZX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QKICAgICAgICAgICAgICAgICBjaGVja1NlbGVjdGlvbkNoYW5nZWQoKTsKICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgaWYgKG1DaG9pY2VNb2RlICE9IENIT0lDRV9NT0RFX05PTkUgJiYKLSAgICAgICAgICAgICAgICAgICAgbUFkYXB0ZXIuaGFzU3RhYmxlSWRzKCkgJiYKLSAgICAgICAgICAgICAgICAgICAgbUNoZWNrZWRJZFN0YXRlcyA9PSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgbUNoZWNrZWRJZFN0YXRlcyA9IG5ldyBMb25nU3BhcnNlQXJyYXk8Qm9vbGVhbj4oKTsKLSAgICAgICAgICAgIH0KLQogICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgbUFyZUFsbEl0ZW1zU2VsZWN0YWJsZSA9IHRydWU7CiAgICAgICAgICAgICBjaGVja0ZvY3VzKCk7CkBAIC00NjgsMTQgKzQ1Miw2IEBACiAgICAgICAgICAgICBjaGVja1NlbGVjdGlvbkNoYW5nZWQoKTsKICAgICAgICAgfQogCi0gICAgICAgIGlmIChtQ2hlY2tTdGF0ZXMgIT0gbnVsbCkgewotICAgICAgICAgICAgbUNoZWNrU3RhdGVzLmNsZWFyKCk7Ci0gICAgICAgIH0KLSAgICAgICAgCi0gICAgICAgIGlmIChtQ2hlY2tlZElkU3RhdGVzICE9IG51bGwpIHsKLSAgICAgICAgICAgIG1DaGVja2VkSWRTdGF0ZXMuY2xlYXIoKTsKLSAgICAgICAgfQotCiAgICAgICAgIHJlcXVlc3RMYXlvdXQoKTsKICAgICB9CiAKQEAgLTg2Myw2ICs4MzksMjUgQEAKICAgICAgICAgcmV0dXJuIHRvcFNlbGVjdGlvblBpeGVsOwogICAgIH0KIAorICAgIC8qKgorICAgICAqIFNtb290aGx5IHNjcm9sbCB0byB0aGUgc3BlY2lmaWVkIGFkYXB0ZXIgcG9zaXRpb24uIFRoZSB2aWV3IHdpbGwKKyAgICAgKiBzY3JvbGwgc3VjaCB0a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4ICsyOTgyLDE2IEBACiAgICAgICAgICAgICAgICAgICAgICAgICBWaWV3IGNoaWxkID0gZ2V0Q2hpbGRBdChpKTsKICAgICAgICAgICAgICAgICAgICAgICAgIGJvdHRvbSA9IGNoaWxkLmdldEJvdHRvbSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgLy8gRG9uJ3QgZHJhdyBkaXZpZGVycyBuZXh0IHRvIGl0ZW1zIHRoYXQgYXJlIG5vdCBlbmFibGVkCi0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoZHJhd0RpdmlkZXJzKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKChhcmVBbGxJdGVtc1NlbGVjdGFibGUgfHwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChhZGFwdGVyLmlzRW5hYmxlZChmaXJzdCArIGkpICYmIChpID09IGNvdW50IC0gMSB8fAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZGFwdGVyLmlzRW5hYmxlZChmaXJzdCArIGkgKyAxKSkpKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib3VuZHMudG9wID0gYm90dG9tOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib3VuZHMuYm90dG9tID0gYm90dG9tICsgZGl2aWRlckhlaWdodDsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZHJhd0RpdmlkZXIoY2FudmFzLCBib3VuZHMsIGkpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoZmlsbEZvck1pc3NpbmdEaXZpZGVycykgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib3VuZHMudG9wID0gYm90dG9tOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib3VuZHMuYm90dG9tID0gYm90dG9tICsgZGl2aWRlckhlaWdodDsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FudmFzLmRyYXdSZWN0KGJvdW5kcywgcGFpbnQpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIGlmICgoYXJlQWxsSXRlbXNTZWxlY3RhYmxlIHx8CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChhZGFwdGVyLmlzRW5hYmxlZChmaXJzdCArIGkpICYmIChpID09IGNvdW50IC0gMSB8fAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFkYXB0ZXIuaXNFbmFibGVkKGZpcnN0ICsgaSArIDEpKSkpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm91bmRzLnRvcCA9IGJvdHRvbTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBib3VuZHMuYm90dG9tID0gYm90dG9tICsgZGl2aWRlckhlaWdodDsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBkcmF3RGl2aWRlcihjYW52YXMsIGJvdW5kcywgaSk7CisgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGZpbGxGb3JNaXNzaW5nRGl2aWRlcnMpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBib3VuZHMudG9wID0gYm90dG9tOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvdW5kcy5ib3R0b20gPSBib3R0b20gKyBkaXZpZGVySGVpZ2h0OworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhbnZhcy5kcmF3UmVjdChib3VuZHMsIHBhaW50KTsKICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIH0KQEAgLTMwMTQsNyArMzAwNyw3IEBACiAgICAgICAgICAgICAgICAgICAgICAgICBWaWV3IGNoaWxkID0gZ2V0Q2hpbGRBdChpKTsKICAgICAgICAgICAgICAgICAgICAgICAgIHRvcCA9IGNoaWxkLmdldFRvcCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgLy8gRG9uJ3QgZHJhdyBkaXZpZGVycyBuZXh0IHRvIGl0ZW1zIHRoYXQgYXJlIG5vdCBlbmFibGVkCi0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoZHJhd0RpdmlkZXJzICYmIHRvcCA+IGxpc3RUb3ApIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0b3AgPiBsaXN0VG9wKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKChhcmVBbGxJdGVtc1NlbGVjdGFibGUgfHwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChhZGFwdGVyLmlzRW5hYmxlZChmaXJzdCArIGkpICYmIChpID09IGNvdW50IC0gMSB8fAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZGFwdGVyLmlzRW5hYmxlZChmaXJzdCArIGkgKyAxKSkpKSkgewpAQCAtMzAzNCw3ICszMDI3LDcgQEAKICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAKLSAgICAgICAgICAgICAgICBpZiAoY291bnQgPiAwICYmIHNjcm9sbFkgPiAwICYmIGRyYXdEaXZpZGVycykgeworICAgICAgICAgICAgICAgIGlmIChjb3VudCA+IDAgJiYgc2Nyb2xsWSA+IDApIHsKICAgICAgICAgICAgICAgICAgICAgYm91bmRzLnRvcCA9IGxpc3RCb3R0b207CiAgICAgICAgICAgICAgICAgICAgIGJvdW5kcy5ib3R0b20gPSBsaXN0Qm90dG9tICsgZGl2aWRlckhlaWdodDsKICAgICAgICAgICAgICAgICAgICAgZHJhd0RpdmlkZXIoY2FudmFzLCBib3VuZHMsIC0xKTsKQEAgLTMzMTYsMTc3ICszMzA5LDYgQEAKICAgICB9CiAKICAgICAvKioKLSAgICAgKiBAc2VlICNzZXRDaG9pY2VNb2RlKGludCkKLSAgICAgKgotICAgICAqIEByZXR1cm4gVGhlIGN1cnJlbnQgY2hvaWNlIG1vZGUKLSA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WFuLlRSVUUpOwotICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICAgICAgbUNoZWNrZWRJZFN0YXRlcy5kZWxldGUobUFkYXB0ZXIuZ2V0SXRlbUlkKHBvc2l0aW9uKSk7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIGJvb2xlYW4gbmV3VmFsdWUgPSAhbUNoZWNrU3RhdGVzLmdldChwb3NpdGlvbiwgZmFsc2UpOwotICAgICAgICAgICAgICAgIGlmIChuZXdWYWx1ZSkgewotICAgICAgICAgICAgICAgICAgICBtQ2hlY2tTdGF0ZXMuY2xlYXIoKTsKLSAgICAgICAgICAgICAgICAgICAgbUNoZWNrU3RhdGVzLnB1dChwb3NpdGlvbiwgdHJ1ZSk7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChtQ2hlY2tlZElkU3RhdGVzICE9IG51bGwgJiYgbUFkYXB0ZXIuaGFzU3RhYmxlSWRzKCkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIG1DaGVja2VkSWRTdGF0ZXMuY2xlYXIoKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIG1DaGVja2VkSWRTdGF0ZXMucHV0KG1BZGFwdGVyLmdldEl0ZW1JZChwb3NpdGlvbiksIEJvb2xlYW4uVFJVRSk7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9IAotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBtRGF0YUNoYW5nZWQgPSB0cnVlOwotICAgICAgICAgICAgcmVtZW1iZXJTeW5jU3RhdGUoKTsKLSAgICAgICAgICAgIHJlcXVlc3RMYXlvdXQoKTsKLSAgICAgICAgfQotCi0gICAgICAgIGhhbmRsZWQgfD0gc3VwZXIucGVyZm9ybUl0ZW1DbGljayh2aWV3LCBwb3NpdGlvbiwgaWQpOwotCi0gICAgICAgIHJldH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Bwb3NpdGlvbikgewotICAgICAgICBpZiAobUNob2ljZU1vZGUgIT0gQ0hPSUNFX01PREVfTk9ORSAmJiBtQ2hlY2tTdGF0ZXMgIT0gbnVsbCkgewotICAgICAgICAgICAgcmV0dXJuIG1DaGVja1N0YXRlcy5nZXQocG9zaXRpb24pOwotICAgICAgICB9Ci0KLSAgICAgICAgcmV0dXJuIGZhbHNlOwotICAgIH0KLQotICAgIC8qKgotICAgICAqIFJldHVybnMgdGhlIGN1cnJlbnRseSBjaGVja2VkIGl0ZW0uIFRoZSByZXN1bHQgaXMgb25seSB2YWxpZCBpZiB0aGUgY2hvaWNlCi0gICAgICogbW9kZSBoYXMgYmVlbiBzZXQgdG8ge0BsaW5rICNDSE9JQ0VfTU9ERV9TSU5HTEV9LgotICAgICAqCi0gICAgICogQHJldHVybiBUaGUgcG9zaXRpb24gb2YgdGhlIGN1cnJlbnRseSBjaGVja2VkIGl0ZW0gb3IKLSAgICAgKiAgICAgICAgIHtAbGluayAjSU5WQUxJRF9QT1NJVElPTn0gaWYgbm90aGluZyBpcyBzZWxlY3RlZAotICAgICAqCi0gICAgICogQHNlZSAjc2V0Q2hvaWNlTW9kZShpbnQpCi0gICAgICovCi0gICAgcHVibGljIGludCBnZXRDaGVja2VkSXRlbVBvc2l0aW9uKCkgewotICAgICAgICBpZiAobUNob2ljZU1vZGUgPT0gQ0hPSUNFX01PREVfU0lOR0xFICYmIG1DaGVja1N0YXRlcyAhPSBudWxsICYmIG1DaGVja1N0YXRlcy5zaXplKCkgPT0gMSkgewotICAgICAgICAgICAgcmV0dXJuIG1DaGVja1N0YXRlcy5rZXlBdCgwKTsKLSAgICAgICAgfQotCi0gICAgICAgIHJldHVybiBJTlZBTElEX1BPU0lUSU9OOwotICAgIH0KLQotICAgIC8qKgotICAgICAqIFJldHVybnMgdGhlIHNldCBvZiBjaGVja2VkIGl0ZW1zIGluIHRoZSBsaXN0LiBUaGUgcmVzdWx0IGlzIG9ubHkgdmFsaWQgaWYKLSAg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ci0gICAgICAgIH0KLQotICAgICAgICAvKioKLSAgICAgICAgICogQ29uc3RydWN0b3IgY2FsbGVkIGZyb20ge0BsaW5rICNDUkVBVE9SfQotICAgICAgICAgKi8KLSAgICAgICAgcHJpdmF0ZSBTYXZlZFN0YXRlKFBhcmNlbCBpbikgewotICAgICAgICAgICAgc3VwZXIoaW4pOwotICAgICAgICAgICAgY2hlY2tTdGF0ZSA9IGluLnJlYWRTcGFyc2VCb29sZWFuQXJyYXkoKTsKLSAgICAgICAgICAgIGxvbmdbXSBpZFN0YXRlID0gaW4uY3JlYXRlTG9uZ0FycmF5KCk7Ci0KLSAgICAgICAgICAgIGlmIChpZFN0YXRlLmxlbmd0aCA+IDApIHsKLSAgICAgICAgICAgICAgICBjaGVja0lkU3RhdGUgPSBuZXcgTG9uZ1NwYXJzZUFycmF5PEJvb2xlYW4+KCk7Ci0gICAgICAgICAgICAgICAgY2hlY2tJZFN0YXRlLnNldFZhbHVlcyhpZFN0YXRlLCBCb29sZWFuLlRSVUUpOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgQE92ZXJyaWRlCi0gICAgICAgIHB1YmxpYyB2b2lkIHdyaXRlVG9QYXJjZWwoUGFyY2VsIG91dCwgaW50IGZsYWdzKSB7Ci0gICAgICAgICAgICBzdXBlci53cml0ZVRvUGFyY2VsKG91dCwgZmxhZ3MpOwotICAgICAgICAgICAgb3V0LndyaXRlU3BhcnNlQm9vbGVhbkFycmF5KGNoZWNrU3RhdGUpOwotICAgICAgICAgICAgb3V0LndyaXRlTG9uZ0FycmF5KGNoZWNrSWRTdGF0ZSAhPSBudWxsID8gY2hlY2tJZFN0YXRlLmdldEtleXMoKSA6IG5ldyBsb25nWzBdKTsKLSAgICAgICAgfQotCi0gICAgICAgIEBPdmVycmlkZQotICAgICAgICBwdWJsaWMgU3RyaW5nIHRvU3RyaW5nKCkgewotICAgICAgICAgICAgcmV0dXJuICJMaXN0Vmlldy5TYXZlZFN0YXRleyIKLS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KCkKKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBzaG93KCkgeworICAgICAgICBtUG9wdXAuc2hvdygpOworICAgIH0KKworICAgIC8qKgorICAgICAqIERpc21pc3MgdGhlIG1lbnUgcG9wdXAuCisgICAgICogQHNlZSAjc2hvdygpCisgICAgICovCisgICAgcHVibGljIHZvaWQgZGlzbWlzcygpIHsKKyAgICAgICAgbVBvcHVwLmRpc21pc3MoKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBzZXRPbk1lbnVJdGVtQ2xpY2tMaXN0ZW5lcihPbk1lbnVJdGVtQ2xpY2tMaXN0ZW5lciBsaXN0ZW5lcikgeworICAgICAgICBtTWVudUl0ZW1DbGlja0xpc3RlbmVyID0gbGlzdGVuZXI7CisgICAgfQorCisgICAgLyoqCisgICAgICogQGhpZGUKKyAgICAgKi8KKyAgICBwdWJsaWMgYm9vbGVhbiBvbk1lbnVJdGVtU2VsZWN0ZWQoTWVudUJ1aWxkZXIgbWVudSwgTWVudUl0ZW0gaXRlbSkgeworICAgICAgICBpZiAobU1lbnVJdGVtQ2xpY2tMaXN0ZW5lciAhPSBudWxsKSB7CisgICAgICAgICAgICByZXR1cm4gbU1lbnVJdGVtQ2xpY2tMaXN0ZW5lci5vbk1lbnVJdGVtQ2xpY2soaXRlbSk7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIC8qKgorICAgICAqIEBoaWRlCisgICAgICovCisgICAgcHVibGljIHZvaWQgb25DbG9zZU1lbnUoTWVudUJ1aWxkZXIgbWVudSwgYm9vbGVhbiBhbGxNZW51c0FyZUNsb3NpbmcpIHsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBAaGlkZQorICAgICAqLworICAgIHB1YmxpYyBib29sZWFuIG9uU3ViTWVudVNlbGVjdGVkKFN1Yk1lbnVCdWlsZGVyIHN1Yk1lbnUpIHsKKyAgICAgICAgaWYgKCFzdWJNZW51Lmhhc1Zpc2libGV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bCBpbikgeworICAgICAgICAgICAgdGhpcy52aWV3SWQgPSBpbi5yZWFkSW50KCk7CisgICAgICAgICAgICB0aGlzLm1ldGhvZE5hbWUgPSBpbi5yZWFkU3RyaW5nKCk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCB3cml0ZVRvUGFyY2VsKFBhcmNlbCBvdXQsIGludCBmbGFncykgeworICAgICAgICAgICAgb3V0LndyaXRlSW50KFRBRyk7CisgICAgICAgICAgICBvdXQud3JpdGVJbnQodGhpcy52aWV3SWQpOworICAgICAgICAgICAgb3V0LndyaXRlU3RyaW5nKHRoaXMubWV0aG9kTmFtZSk7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIHZvaWQgYXBwbHkoVmlldyByb290KSB7CisgICAgICAgICAgICBmaW5hbCBWaWV3IHZpZXcgPSByb290LmZpbmRWaWV3QnlJZCh2aWV3SWQpOworICAgICAgICAgICAgaWYgKHZpZXcgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBBY3Rpb25FeGNlcHRpb24oImNhbid0IGZpbmQgdmlldzogMHgiICsgSW50ZWdlci50b0hleFN0cmluZyh2aWV3SWQpKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgQ2xhc3Mga2xhc3MgPSB2aWV3LmdldENsYXNzKCk7CisgICAgICAgICAgICBNZXRob2QgbWV0aG9kOworICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICBtZXRob2QgPSBrbGFzcy5nZXRNZXRob2QodGhpcy5tZXRob2ROYW1lKTsKKyAgICAgICAgICAgIH0gY2F0Y2ggKE5vU3VjaE1ldGhvZEV4Y2VwdGlvbiBleCkgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBBY3Rpb25FeGNlcHRpb24oInZpZXc6ICIgKyBrbGFzcy5nZXROYW1lKCkgKyAiIGRvZXNuJ3QgaGF2ZSBtZXRob2Q6ICIKKyAgICAgICAgICAgICAgICAgICAgICAgICsgdGhpcy5tZXRob2ROYW1lICsgIigpIik7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmICghbWV0aG9kLmlzQW5ub3RhdGlvblByZXNlbnQoUmVtb3RhYmxlVmlld01ldGhvZC5jbGFzcykpIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgQWN0aW9uRXhjZXB0aW9uKCJ2aWV3OiAiICsga2xhc3MuZ2V0TmFtZSgpCisgICAgICAgICAgICAgICAgICAgICAgICArICIgY2FuJ3QgdXNlIG1ldGhvZCB3aXRoIFJlbW90ZVZpZXdzOiAiCisgICAgICAgICAgICAgICAgICAgICAgICArIHRoaXMubWV0aG9kTmFtZSArICIoKSIpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIC8vbm9pbnNwZWN0aW9uIENvbnN0YW50SWZTdGF0ZW1lbnQKKyAgICAgICAgICAgICAgICBpZiAoZmFsc2UpIHsKKyAgICAgICAgICAgICAgICAgICAgTG9nLmQoIlJlbW90ZVZpZXdzIiwgInZpZXc6ICIgKyBrbGFzcy5nZXROYW1lKCkgKyAiIGNhbGxpbmcgbWV0aG9kOiAiCisgICAgICAgICAgICAgICAgICAgICAgICArIHRoaXMubWV0aG9kTmFtZSArICIoKSIpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBtZXRob2QuaW52b2tlKHZpZXcpOworICAgICAgICAgICAgfSBjYXRjaCAoRXhjZXB0aW9uIGV4KSB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEFjdGlvbkV4Y2VwdGlvbihleCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKICAgICAvKioKICAgICAgKiBCYXNlIGNsYXNzIGZvciB0aGUgcmVmbGVjdGlvbiBhY3Rpb25zLgogICAgICAqLwpAQCAtMjg1LDYgKzM0Miw3IEBACiAgICAgICAgIHN0YXRpYyBmaW5hbCBpbnQgVVJJID0gMTE7CiAgICAgICAgIHN0YXRpYyBmaW5hbCBpbnQgQklUTUFQID0gMTI7CiAgICAgICAgIHN0YXRpYyBmaW5hbCBpbnQgQlVORExFID0gMTM7CisgICAgICAgIHN0YXRpYyBmaW5hbCBpbnQgSU5URU5UID0gMTQ7CiAKICAgICAgICAgaW50IHZpZXdJZDsKICAgICAgICAgU3RyaW5nIG1ldGhvZE5hbWU7CkBAIC0zNDcsNiArNDA1LDkgQEAKICAgICAgICAgICAgICAgICBjYXNlIEJVTkRMRToKICAgICAgICAgICAgICAgICAgICAgdGhpcy52YWx1ZSA9IGluLnJlYWRCdW5kbGUoKTsKICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBJTlRFTlQ6CisgICAgICAgICAgICAgICAgICAgIHRoaXMudmFsdWUgPSBJbnRlbnQuQ1JFQVRPUi5jcmVhdGVGcm9tUGFyY2VsKGluKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICB9CkBAIC00MDIsNiArNDYzLDkgQEAKICAgICAgICAgICAgICAgICBjYXNlIEJVTkRMRToKICAgICAgICAgICAgICAgICAgICAgb3V0LndyaXRlQnVuZGxlKChCdW5kbGUpIHRoaXMudmFsdWUpOwogICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIElOVEVOVDoKKyAgICAgICAgICAgICAgICAgICAgKChJbnRlbnQpdGhpcy52YWx1ZSkud3JpdGVUb1BhcmNlbChvdXQsIGZsYWdzKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICB9CkBAIC00MzUsNiArNDk5LDggQEAKICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEJpdG1hcC5jbGFzczsKICAgICAgICAgICAgICAgICBjYXNlIEJVTkRMRToKICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEJ1bmRsZS5jbGFzczsKKyAgICAgICAgICAgICAgICBjYXNlIElOVEVOVDoKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEludGVudC5jbGFzczsKICAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgIH0KQEAgLTU2Miw2ICs2MjgsOSBAQAogICAgICAgICAgICAgICAgIGNhc2UgVmlld0dyb3VwQWN0aW9uLlRBRzoKICAgICAgICAgICAgICAgICAgICAgbUFjdGlvbnMuYWRkKG5ldyBWaWV3R3JvdXBBY3Rpb24ocGFyY2VsKSk7CiAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgUmVmbGVjdGlvbkFjdGlvbldpdGhvdXRQYXJhbXMuVEFHOgorICAgICAgICAgICAgICAgICAgICBtQWN0aW9ucy5hZGQobmV3IFJlZmxlY3Rpb25BY3Rpb25XaXRob3V0UGFyYW1zKHBhcmNlbCkpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgQWN0aW9uRXhjZXB0aW9uKCJUYWcgIiArIHRhZyArICIgbm90IGZvdW5kIik7CiAgICAgICAgICAgICAgICAgfQpAQCAtNTY5LDYgKzYzOCw3IEBACiAgICAgICAgIH0KICAgICB9CiAKKyAgICBAT3ZlcnJpZGUKICAgICBwdWJsaWMgUmVtb3RlVmlld3MgY2xvbmUoKSB7CiAgICAgICAgIGZpbmFsIFJlbW90ZVZpZXdzIHRoYXQgPSBuZXcgUmVtb3RlVmlld3MobVBhY2thZ2UsIG1MYXlvdXRJZCk7CiAgICAgICAgIGlmIChtQWN0aW9ucyAhPSBudWxsKSB7CkBAIC02MjIsNiArNjk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tZSBuYW1lLCBJQmluZGVyIHNlcnZpY2UpIHsKKyAgICAgICAgICAgIG1SZW1vdGVWaWV3c0ZhY3RvcnkgPSBJUmVtb3RlVmlld3NGYWN0b3J5LlN0dWIuYXNJbnRlcmZhY2Uoc2VydmljZSk7CisgICAgICAgICAgICBtQ29ubmVjdGVkID0gdHJ1ZTsKKworICAgICAgICAgICAgLy8gbm90aWZ5RGF0YVNldENoYW5nZWQgc2hvdWxkIGJlIGNhbGxlZCBmaXJzdCwgdG8gZW5zdXJlIHRoYXQgdGhlCisgICAgICAgICAgICAvLyB2aWV3cyBhcmUgbm90IHVwZGF0ZWQgdHdpY2UKKyAgICAgICAgICAgIG5vdGlmeURhdGFTZXRDaGFuZ2VkKCk7CisKKyAgICAgICAgICAgIC8vIHBvc3QgYSBuZXcgcnVubmFibGUgdG8gbG9hZCB0aGUgYXBwcm9wcmlhdGUgZGF0YSwgdGhlbiBjYWxsYmFjaworICAgICAgICAgICAgbVdvcmtlclByaW9yaXR5UXVldWUucG9zdChuZXcgUnVubmFibGUoKSB7CisgICAgICAgICAgICAgICAgQE92ZXJyaWRlCisgICAgICAgICAgICAgICAgcHVibGljIHZvaWQgcnVuKCkgeworICAgICAgICAgICAgICAgICAgICAvLyB3ZSBuZWVkIHRvIGdldCB0aGUgdmlld1R5cGVDb3VudCBzcGVjaWZpY2FsbHksIHNvIGp1c3QgZ2V0IGFsbCB0aGUKKyAgICAgICAgICAgICAgICAgICAgLy8gbWV0YWRhdGEKKyAgICAgICAgICAgICAgICAgICAgbVZpZXdDYWNoZS5yZXF1ZXN0TWV0YURhdGEoKTsKKworICAgICAgICAgICAgICAgICAgICAvLyBwb3N0IGEgcnVubmFibGUgdG8gY2FsbCB0aGUgY2FsbGJhY2sgb24gdGhlIG1haW4gdGhyZWFkCisgICAgICAgICAgICAgICAgICAgIG1NYWluUHJpb3JpdHlRdWV1ZS5wb3N0KG5ldyBSdW5uYWJsZSgpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIEBPdmVycmlkZQorICAgICAgICAgICAgICAgICAgICAgICAgcHVibGljIHZvaWQgcnVuKCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtQ2FsbGJhY2sgIT0gbnVsbCkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUNhbGxiYWNrLm9uUmVtb3RlQWRhcHRlckNvbm5lY3RlZCgpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9KTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9KTsKKworICAgICAgICAgICAgLy8gc3RhcnQgdGhlIGJhY2tncm91bmQgbG9hZGVyCisgICAgICAgICAgICBtVmlld0NhY2hlLnN0YXJ0QmFja2dyb3VuZExvYWRlcigpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgb25TZXJ2aWNlRGlzY29ubmVjdGVkKENvbXBvbmVudE5hbWUgbmFtZSkgeworICAgICAgICAgICAgbVJlbW90ZVZpZXdzRmFjdG9yeSA9IG51bGw7CisgICAgICAgICAgICBtQ29ubmVjdGVkID0gZmFsc2U7CisKKyAgICAgICAgICAgIC8vIGNsZWFyIHRoZSBtYWluL3dvcmtlciBxdWV1ZXMKKyAgICAgICAgICAgIG1NYWluUXVldWUucmVtb3ZlTWVzc2FnZXMoMCk7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIC8vIHN0b3AgdGhlIGJhY2tncm91bmQgbG9hZGVyCisgICAgICAgICAgICBtVmlld0NhY2hlLnN0b3BCYWNrZ3JvdW5kTG9hZGVyKCk7CisKKyAgICAgICAgICAgIGlmIChtQ2FsbGJhY2sgIT0gbnVsbCkKKyAgICAgICAgICAgICAgICBtQ2FsbGJhY2sub25SZW1vdGVBZGFwdGVyRGlzY29ubmVjdGVkKCk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgSVJlbW90ZVZpZXdzRmFjdG9yeSBnZXRSZW1vdGVWaWV3c0ZhY3RvcnkoKS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lZHMgdG8gYmUgdXBkYXRlZCB3aXRoIG5ldworICAgICAgICAvLyBpdGVtcyAoaWUuIHdoZW4gdGhlcmUgaXMgbm90IGVub3VnaCBzbGFjaykKKyAgICAgICAgcHJpdmF0ZSBpbnQgbVZpZXdDYWNoZVN0YXJ0UG9zaXRpb247CisgICAgICAgIHByaXZhdGUgaW50IG1WaWV3Q2FjaGVFbmRQb3NpdGlvbjsKKyAgICAgICAgcHJpdmF0ZSBpbnQgbUhhbGZDYWNoZVNpemU7CisgICAgICAgIHByaXZhdGUgaW50IG1DYWNoZVNsYWNrOworICAgICAgICBwcml2YXRlIGZpbmFsIGZsb2F0IG1DYWNoZVNsYWNrUGVyY2VudGFnZSA9IDAuNzVmOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBUaGUgZGF0YSBzdHJ1Y3R1cmUgc3RvcmVkIGF0IGVhY2ggaW5kZXggb2YgdGhlIGNhY2hlLiBBbnkgbWVtYmVyIAorICAgICAgICAgKiB0aGF0IGlzIG5vdCBpbnZhbGlkYXRlZCBwZXJzaXN0cyB0aHJvdWdob3V0IHRoZSBsaWZldGltZSBvZiB0aGUgY2FjaGUuCisgICAgICAgICAqLworICAgICAgICBwcml2YXRlIGNsYXNzIFJlbW90ZVZpZXdzSW5kZXhJbmZvIHsKKyAgICAgICAgICAgIEZyYW1lTGF5b3V0IGZsaXBwZXI7CisgICAgICAgICAgICBSZW1vdGVWaWV3cyB2aWV3OworICAgICAgICAgICAgbG9uZyBpdGVtSWQ7CisgICAgICAgICAgICBpbnQgdHlwZUlkOworCisgICAgICAgICAgICBSZW1vdGVWaWV3c0luZGV4SW5mbygpIHsKKyAgICAgICAgICAgICAgICBpbnZhbGlkYXRlKCk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHZvaWQgc2V0KFJlbW90ZVZpZXdzIHYsIGxvbmcgaWQpIHsKKyAgICAgICAgICAgICAgICB2aWV3ID0gdjsKKyAgICAgICAgICAgICAgICBpdGVtSWQgPSBpZDsKKyAgICAgICAgICAgICAgICBpZiAodiAhPSBudWxsKQorICAgICAgICAgICAgICAgICAgICB0eXBlSWQgPSB2LmdldExheW91dElkKCk7CisgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgICAgICB0eXBlSWQgPSAwOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICB2b2lkIGludmFsaWRhdGUoKSB7CisgICAgICAgICAgICAgICAgdmlldyA9IG51bGw7CisgICAgICAgICAgICAgICAgaXRlbUlkID0gMDsKKyAgICAgICAgICAgICAgICB0eXBlSWQgPSAwOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBmaW5hbCBib29sZWFuIGlzVmFsaWQoKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuICh2aWV3ICE9IG51bGwpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFJlbW90ZSBhZGFwdGVyIG1ldGFkYXRhLiBVc2VmdWwgZm9yIHdoZW4gd2UgaGF2ZSB0byBsb2NrIG9uIHNvbWV0aGluZworICAgICAgICAgKiBiZWZvcmUgdXBkYXRpbmcgdGhlIG1ldGFkYXRhLgorICAgICAgICAgKi8KKyAgICAgICAgcHJpdmF0ZSBjbGFzcyBSZW1vdGVWaWV3c0luZm8geworICAgICAgICAgICAgaW50IGNvdW50OworICAgICAgICAgICAgaW50IHZpZXdUeXBlQ291bnQ7CisgICAgICAgICAgICBib29sZWFuIGhhc1N0YWJsZUlkczsKKyAgICAgICAgICAgIGJvb2xlYW4gaXNEYXRhRGlydHk7CisgICAgICAgICAgICBNYXA8SW50ZWdlciwgSW50ZWdlcj4gbVR5cGVJZEluZGV4TWFwOworCisgICAgICAgICAgICBSZW1vdGVWaWV3c0luZm8oKSB7CisgICAgICAgICAgICAgICAgY291bnQgPSAwOworICAgICAgICAgICAgICAgIC8vIGJ5IGRlZmF1bHQgdGhlcmUgaXMgYXQgbGVhc3Qgb25lIGR1bW15IHZpZXcgdHlwZQorICAgICAgICAgICAgICAgIHZpZXdUeXBlQ291bnQgPSAxOworICAgICAgICAgICAgICAgIGhhc1N0YWJsZUlkcyA9IHRydWU7CisgICAgICAgICAgICAgICAgaXNEYXRhRGlydHkgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICBtVHlwZUlkSW5kZXhNYXAgPSBuZXcgSGFzaE1hcDxJbnRlZ2VyLCBJbnRlZ2VyPigpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIFJlbW90ZVZpZXdzQ2FjaGUoaW50IGhhbGZDYWNoZVNpemUpIHsKKyAgICAgICAgICAgIG1IYWxmQ2FjaGVTaXplID0gaGFsZkNhY2hlU2l6ZTsKKyAgICAgICAgICAgIG1DYWNoZVNsYWNrID0gTWF0aC5yb3VuZChtQ2FjaGVTbGFja1BlcmNlbnRhZ2UgKiBtSGFsZkNhY2hlU2l6ZSk7CisgICAgICAgICAgICBtVmlld0NhY2hlU3RhcnRQb3NpdGlvbiA9IDA7CisgICAgICAgICAgICBtVmlld0NhY2hlRW5kUG9zaXRpb24gPSAtMTsKKyAgICAgICAgICAgIG1CYWNrZ3JvdW5kTG9hZGVyRW5hYmxlZCA9IGZhbHNlOworCisgICAgICAgICAgICAvLyBpbml0aWFsaXplIHRoZSBjYWNoZQorICAgICAgICAgICAgaW50IGNhY2hlU2l6ZSA9IDIgKiBtSGFsZkNhY2hlU2l6ZSArIDE7CisgICAgICAgICAgICBtVmlld0NhY2hlSW5mbyA9IG5ldyBSZW1vdGVWaWV3c0luZm8oKTsKKyAgICAgICAgICAgIG1WaWV3Q2FjaGUgPSBuZXcgUmVtb3RlVmlld3NJbmRleEluZm9bY2FjaGVTaXplXTsKKyAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbVZpZXdDYWNoZS5sZW5ndGg7ICsraSkgeworICAgICAgICAgICAgICAgIG1WaWV3Q2FjaGVbaV0gPSBuZXcgUmVtb3RlVmlld3NJbmRleEluZm8oKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1UbXBWaWV3Q2FjaGVMb2FkSW5kaWNlcyA9IG5ldyBpbnRbY2FjaGVTaXplXTsKKyAgICAgICAgICAgIG1WaWV3Q2FjaGVMb2FkSW5kaWNlcyA9IG5ldyBMaW5rZWRMaXN0PEludGVnZXI+KCk7CisgICAgICAgIH0KKworICAgICAgICBwcml2YXRlIGZpbmFsIGJvb2xlYW4gY29udGFpbnMoaW50IHBvc2l0aW9uKSB7CisgICAgICAgICAgICByZXR1cm4gKG1WaWV3Q2FjaGVTdGFydFBvc2l0aW9uIDw9IHBvc2l0aW9uKSAmJiAocG9zaXRpb24gPD0gbVZpZXdDYWNoZUVuZFBvc2l0aW9uKTsKKyAgICAgICAgfQorCisgICAgICAgIHByaXZhdGUgZmluYWwgYm9vbGVhbiBjb250YWluc0FuZElzVmFsaWQoaW50IHBvc2l0aW9uKSB7CisgICAgICAgICAgICBpZiAoY29udGFpbnMocG9zaXRpb24pKSB7CisgICAgICAgICAgICAgICAgUmVtb3RlVmlld3NJbmRleEluZm8gaW5kZXhJbmZvID0gbVZpZXdDYWNoZVtnZXRDYWNoZUluZGV4KHBvc2l0aW9uKV07CisgICAgICAgICAgICAgICAgaWYgKGluZGV4SW5mby5pc1ZhbGlkKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSBmaW5hbCBpbnQgZ2V0Q2FjaGVJbmRleChpbnQgcG9zaXRpb24pIHsKKyAgICAgICAgICAgIC8vIHRha2UgdGhlIG1vZHVsbyBvZiB0aGUgcG9zaXRpb24KKyAgICAgICAgICAgIHJldHVybiAobVZpZXdDYWNoZS5sZW5ndGggKyAocG9zaXRpb24gJSBtVmlld0NhY2hlLmxlbmd0aCkpICUgbVZpZXdDYWNoZS5sZW5ndGg7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCByZXF1ZXN0TWV0YURhdGEoKSB7CisgICAgICAgICAgICBpZiAobVNlcnZpY2VDb25uZWN0aW9uLmlzQ29ubmVjdGVkKCkpIHsKKyAgICAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgICAgICBJUmVtb3RlVmlld3NGYWN0b3J5IGZhY3RvcnkgPSBtU2VydmljZUNvbm5lY3Rpb24uZ2V0UmVtb3RlVmlld3NGYWN0b3J5KCk7CisKKyAgICAgICAgICAgICAgICAgICAgLy8gZ2V0IHRoZSBwcm9wZXJ0aWVzL2ZpcnN0IHZpZXcgKHNvIHRoYXQgd2UgY2FuIHVzZSBpdCB0bworICAgICAgICAgICAgICAgICAgICAvLyBtZWFzdXJlIG91ciBkdW1teSB2aWV3cykKKyAgICAgICAgICAgICAgICAgICAgYm9vbGVhbiBoYXNTdGFibGVJZHMgPSBmYWN0b3J5Lmhhc1N0YWJsZUlkcygpOworICAgICAgICAgICAgICAgICAgICBpbnQgdmlld1R5cGVDb3VudCA9IGZhY3RvcnkuZ2V0Vmlld1R5cGVDb3VudCgpOworICAgICAgICAgICAgICAgICAgICBpbnQgY291bnQgPSBmYWN0b3J5LmdldENvdW50KCk7CisgICAgICAgICAgICAgICAgICAgIFJlbW90ZVZpZXdzIGxvYWRpbmdWaWV3ID0gZmFjdG9yeS5nZXRMb2FkaW5nVmlldygpOworICAgICAgICAgICAgICAgICAgICBSZW1vdGVWaWV3cyBmaXJzdFZpZXcgPSBudWxsOworICAgICAgICAgICAgICAgICAgICBpZiAoKGNvdW50ID4gMCkgJiYgKGxvYWRpbmdWaWV3ID09IG51bGwpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBmaXJzdFZpZXcgPSBmYWN0b3J5LmdldFZpZXdBdCgwKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBzeW5jaHJvbml6ZWQgKG1WaWV3Q2FjaGVJbmZvKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBSZW1vdGVWaWV3c0luZm8gaW5mbyA9IG1WaWV3Q2FjaGVJbmZvOworICAgICAgICAgICAgICAgICAgICAgICAgaW5mby5oYXNTdGFibGVJZHMgPSBoYXNTdGFibGVJZHM7CisgICAgICAgICAgICAgICAgICAgICAgICBpbmZvLnZpZXdUeXBlQ291bnQgPSB2aWV3VHlwZUNvdW50ICsgMTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGluZm8uY291bnQgPSBjb3VudDsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1Vc2VyTG9hZGluZ1ZpZXcgPSBsb2FkaW5nVmlldzsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChmaXJzdFZpZXcgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1GaXJzdFZpZXcgPSBmaXJzdFZpZXc7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUZpcnN0Vmlld0hlaWdodCA9IC0xOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICAgICAgZS5wcmludFN0YWNrVHJhY2UoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBwcm90ZWN0ZWQgdm9pZCBvbk5vdGlmeURhdGFTZXRDaGFuZ2VkKCkgeworICAgICAgICAgICAgLy8gd2UgbWFyayB0aGUgZGF0YSBhcyBkaXJ0eSBzbyB0aGF0IHRoZSBuZXh0IGNhbGwgdG8gZmV0Y2ggdmlld3Mgd2lsbCByZXN1bHQgaW4KKyAgICAgICAgICAgIC8vIGFuIG9uRGF0YVNldERpcnR5KCkgY2FsbCBmcm9tIHRoZSBhZGFwdGVyCisgICAgICAgICAgICBzeW5jaHJvbml6ZWQgKG1WaWV3Q2FjaGVJbmZvKSB7CisgICAgICAgICAgICAgICAgbVZpZXdDYWNoZUluZm8uaXNEYXRhRGlydHkgPSB0cnVlOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSB2b2lkIHVwZGF0ZU5vdGlmeURhdGFTZXRDaGFuZ2VkKCkgeworICAgICAgICAgICAgLy8gYWN0dWFsbHkgY2FsbHMgdGhyb3VnaCB0byB0aGUgZmFjdG9yeSB0byBub3RpZnkgaXQgdG8gdXBkYXRlCisgICAgICAgICAgICBpZiAobVNlcnZpY2VDb25uZWN0aW9uLmlzQ29ubmVjdGVkKCkpIHsKKyAgICAgICAgICAgICAgICBJUmVtb3RlVmlld3NGYWN0b3J5IGZhY3RvcnkgPSBtU2VydmljZUNvbm5lY3Rpb24uZ2V0UmVtb3RlVmlld3NGYWN0b3J5KCk7CisgICAgICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICAgICAgZmFjdG9yeS5vbkRhdGFTZXRDaGFuZ2VkKCk7CisgICAgICAgICAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICAgICAgZS5wcmludFN0YWNrVHJhY2UoKTsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgLy8gcmUtcmVxdWVzdCB0aGUgbmV3IG1ldGFkYXRhIChvbmx5IGFmdGVyIHRoZSBub3RpZmljYXRpb24gdG8gdGhlIGZhY3RvcnkpCisgICAgICAgICAgICByZXF1ZXN0TWV0YURhdGEoKTsKKworICAgICAgICAgICAgLy8gcG9zdCBhIG5ldyBydW5uYWJsZSBvbiB0aGUgbWFpbiB0aHJlYWQgdG8gcHJvcGFnYXRlIHRoZSBub3RpZmljYXRpb24gYmFjaworICAgICAgICAgICAgLy8gdG8gdGhlIGJhc2UgYWRhcHRlcgorICAgICAgICAgICAgbU1haW5RdWV1ZS5wb3N0KG5ldyBSdW5uYWJsZSgpIHsKKyAgICAgICAgICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgICAgICAgICBwdWJsaWMgdm9pZCBydW4oKSB7CisgICAgICAgICAgICAgICAgICAgY29tcGxldGVOb3RpZnlEYXRhU2V0Q2hhbmdlZCgpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0pOworICAgICAgICB9CisKKyAgICAgICAgcHJvdGVjdGVkIHZvaWQgdXBkYXRlUmVtb3RlVmlld3NJbmZvKGludCBwb3NpdGlvbikgeworICAgICAgICAgICAgaWYgKG1TZXJ2aWNlQ29ubmVjdGlvbi5pc0Nvbm5lY3RlZCgpKSB7CisgICAgICAgICAgICAgICAgSVJlbW90ZVZpZXdzRmFjdG9yeSBmYWN0b3J5ID0gbVNlcnZpY2VDb25uZWN0aW9uLmdldFJlbW90ZVZpZXdzRmFjdG9yeSgpOworCisgICAgICAgICAgICAgICAgLy8gbG9hZCB0aGUgaXRlbSBpbmZvcm1hdGlvbgorICAgICAgICAgICAgICAgIFJlbW90ZVZpZXdzIHJlbW90ZVZpZXcgPSBudWxsOworICAgICAgICAgICAgICAgIGxvbmcgaXRlbUlkID0gMDsKKyAgICAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgICAgICByZW1vdGVWaWV3ID0gZmFjdG9yeS5nZXRWaWV3QXQocG9zaXRpb24pOworICAgICAgICAgICAgICAgICAgICBpdGVtSWQgPSBmYWN0b3J5LmdldEl0ZW1JZChwb3NpdGlvbik7CisgICAgICAgICAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICAgICAgZS5wcmludFN0YWNrVHJhY2UoKTsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICBzeW5jaHJvbml6ZWQgKG1WaWV3Q2FjaGUpIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gc2tpcCBpZiB0aGUgd2luZG93IGhhcyBtb3ZlZAorICAgICAgICAgICAgICAgICAgICBpZiAocG9zaXRpb24gPCBtVmlld0NhY2hlU3RhcnRQb3NpdGlvbiB8fCBwb3NpdGlvbiA+IG1WaWV3Q2FjaGVFbmRQb3NpdGlvbikKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKKworICAgICAgICAgICAgICAgICAgICBmaW5hbCBpbnQgcG9zaXRpb25JbmRleCA9IHBvc2l0aW9uOworICAgICAgICAgICAgICAgICAgICBmaW5hbCBpbnQgY2FjaGVJbmRleCA9IGdldENhY2hlSW5kZXgocG9zaXRpb24pOworICAgICAgICAgICAgICAgICAgICBtVmlld0NhY2hlW2NhY2hlSW5kZXhdLnNldChyZW1vdGVWaWV3LCBpdGVtSWQpOworCisgICAgICAgICAgICAgICAgICAgIC8vIG5vdGlmeSB0aGUgbWFpbiB0aHJlYWQgd2hlbiBkb25lIGxvYWRpbmcKKyAgICAgICAgICAgICAgICAgICAgLy8gZmx1c2ggcGVuZGluZyB1cGRhdGVzCisgICAgICAgICAgICAgICAgICAgIG1NYWluUXVldWUucG9zdChuZXcgUnVubmFibGUoKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgICAgICAgICAgICAgICAgIHB1YmxpYyB2b2lkIHJ1bigpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBzd2FwIHRoZSBsb2FkZXIgdmlldyBmb3IgdGhpcyB2aWV3CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3luY2hyb25pemVkIChtVmlld0NhY2hlKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjb250YWluc0FuZElzVmFsaWQocG9zaXRpb25JbmRleCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFJlbW90ZVZpZXdzSW5kZXhJbmZvIGluZGV4SW5mbyA9IG1WaWV3Q2FjaGVbY2FjaGVJbmRleF07CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBGcmFtZUxheW91dCBmbGlwcGVyID0gaW5kZXhJbmZvLmZsaXBwZXI7CisKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHVwZGF0ZSB0aGUgZmxpcHBlcgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxpcHBlci5nZXRDaGlsZEF0KDApLnNldFZpc2liaWxpdHkoVmlldy5HT05FKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2xlYW4gYWRkTmV3VmlldyA9IHRydWU7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZmxpcHBlci5nZXRDaGlsZENvdW50KCkgPiAxKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVmlldyB2ID0gZmxpcHBlci5nZXRDaGlsZEF0KDEpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCB0eXBlSWQgPSAoKEludGVnZXIpIHYuZ2V0VGFnKCkpLmludFZhbHVlKCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVJZCA9PSBpbmRleEluZm8udHlwZUlkKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHdlIGNhbiByZWFwcGx5IHNpbmNlIGl0IGlzIHRoZSBzYW1lIHR5cGUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5kZXhJbmZvLnZpZXcucmVhcHBseShtQ29udGV4dCwgdik7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHYuc2V0VmlzaWJpbGl0eShWaWV3LlZJU0lCTEUpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodi5nZXRBbmltYXRpb24oKSAhPSBudWxsKSAKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHYuYnVpbGREcmF3aW5nQ2FjaGUoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRkTmV3VmlldyA9IGZhbHNlOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsaXBwZXIucmVtb3ZlVmlld0F0KDEpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhZGROZXdWaWV3KSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVmlldyB2ID0gaW5kZXhJbmZvLnZpZXcuYXBwbHkobUNvbnRleHQsIGZsaXBwZXIpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHYuc2V0VGFnKG5ldyBJbnRlZ2VyKGluZGV4SW5mby50eXBlSWQpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbGlwcGVyLmFkZFZpZXcodik7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0pOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHByaXZhdGUgUmVtb3RlVmlld3NJbmRleEluZm8gcmVxdWVzdENhY2hlZEluZGV4SW5mbyhmaW5hbCBpbnQgcG9zaXRpb24pIHsKKyAgICAgICAgICAgIGludCBpbmRpY2VzVG9Mb2FkQ291bnQgPSAwOworCisgICAgICAgICAgICBzeW5jaHJvb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ICAgICAgICAgICAgICAgLy8gcHJ1bmUvYWRkIGJlZm9yZSB0aGUgY3VycmVudCBzdGFydCBwb3NpdGlvbgorICAgICAgICAgICAgICAgICAgICBpbnQgZWZmZWN0aXZlU3RhcnQgPSBNYXRoLm1heChuZXdTdGFydFBvc2l0aW9uLCAwKTsKKyAgICAgICAgICAgICAgICAgICAgaW50IGVmZmVjdGl2ZUVuZCA9IE1hdGgubWluKG5ld0VuZFBvc2l0aW9uLCBnZXRDb3VudCgpIC0gMSk7CisKKyAgICAgICAgICAgICAgICAgICAgLy8gaW52YWxpZGF0ZSBpdGVtcyBpbiB0aGUgcXVldWUKKyAgICAgICAgICAgICAgICAgICAgaW50IG92ZXJsYXBTdGFydCA9IE1hdGgubWF4KG1WaWV3Q2FjaGVTdGFydFBvc2l0aW9uLCBlZmZlY3RpdmVTdGFydCk7CisgICAgICAgICAgICAgICAgICAgIGludCBvdmVybGFwRW5kID0gTWF0aC5taW4oTWF0aC5tYXgobVZpZXdDYWNoZVN0YXJ0UG9zaXRpb24sIG1WaWV3Q2FjaGVFbmRQb3NpdGlvbiksIGVmZmVjdGl2ZUVuZCk7CisgICAgICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgKGZyYW1lU2l6ZSAqIGZyYW1lQ291bnQpOyArK2kpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGludCBpbmRleCA9IG5ld1N0YXJ0UG9zaXRpb24gKyAoKGkgJSBmcmFtZVNpemUpICogZnJhbWVDb3VudCArIChpIC8gZnJhbWVTaXplKSk7CisgICAgICAgICAgICAgICAgICAgICAgICAKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpbmRleCA8PSBuZXdFbmRQb3NpdGlvbikgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgob3ZlcmxhcFN0YXJ0IDw9IGluZGV4KSAmJiAoaW5kZXggPD0gb3ZlcmxhcEVuZCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gbG9hZCB0aGUgc3R1ZmYgaW4gdGhlIG1pZGRsZSB0aGF0IGhhcyBub3QgYWxyZWFkeQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBiZWVuIGxvYWRlZAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIW1WaWV3Q2FjaGVbZ2V0Q2FjaGVJbmRleChpbmRleCldLmlzVmFsaWQoKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVRtcFZpZXdDYWNoZUxvYWRJbmRpY2VzW2luZGljZXNUb0xvYWRDb3VudCsrXSA9IGluZGV4OworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICgoZWZmZWN0aXZlU3RhcnQgPD0gaW5kZXgpICYmIChpbmRleCA8PSBlZmZlY3RpdmVFbmQpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGludmFsaWRhdGUgYW5kIGxvYWQgYWxsIG5ldyBlZmZlY3RpdmUgaXRlbXMKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVZpZXdDYWNoZVtnZXRDYWNoZUluZGV4KGluZGV4KV0uaW52YWxpZGF0ZSgpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtVG1wVmlld0NhY2hlTG9hZEluZGljZXNbaW5kaWNlc1RvTG9hZENvdW50KytdID0gaW5kZXg7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gaW52YWxpZGF0ZSBhbGwgb3RoZXIgY2FjaGUgaW5kaWNlcyAob3V0c2lkZSB0aGUgZWZmZWN0aXZlIHN0YXJ0L2VuZCkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gYnV0IGRvbid0IGxvYWQKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVZpZXdDYWNoZVtnZXRDYWNoZUluZGV4KGluZGV4KV0uaW52YWxpZGF0ZSgpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgIG1WaWV3Q2FjaGVTdGFydFBvc2l0aW9uID0gbmV3U3RhcnRQb3NpdGlvbjsKKyAgICAgICAgICAgICAgICAgICAgbVZpZXdDYWNoZUVuZFBvc2l0aW9uID0gbmV3RW5kUG9zaXRpb247CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorCisgICAgICAgICAgICAvLyBwb3N0IGl0ZW1zIHRvIGJlIGxvYWRlZAorICAgICAgICAgICAgaW50IGxlbmd0aCA9IDA7CisgICAgICAgICAgICBzeW5jaHJvbml6ZWQgKG1WaWV3Q2FjaGVJbmZvKSB7CisgICAgICAgICAgICAgICAgbGVuZ3RoID0gbVZpZXdDYWNoZUluZm8uY291bnQ7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoaW5kaWNlc1RvTG9hZENvdW50ID4gMCkgeworICAgICAgICAgICAgICAgIHN5bmNocm9uaXplZCAobVZpZXdDYWNoZUxvYWRJbmRpY2VzKSB7CisgICAgICAgICAgICAgICAgICAgIG1WaWV3Q2FjaGVMb2FkSW5kaWNlcy5jbGVhcigpOworICAgICAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGluZGljZXNUb0xvYWRDb3VudDsgKytpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBmaW5hbCBpbnQgaW5kZXggPSBtVG1wVmlld0NhY2hlTG9hZEluZGljZXNbaV07CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMCA8PSBpbmRleCAmJiBpbmRleCA8IGxlbmd0aCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1WaWV3Q2FjaGVMb2FkSW5kaWNlcy5hZGRMYXN0KGluZGV4KTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgLy8gcmV0dXJuIG51bGwgc28gdGhhdCBhIGR1bW15IHZpZXcgY2FuIGJlIHJldHJpZXZlZAorICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgVmlldyBnZXRWaWV3KGludCBwb3NpdGlvbiwgVmlldyBjb252ZXJ0VmlldywgVmlld0dyb3VwIHBhcmVudCkgeworICAgICAgICAgICAgaWYgKG1TZXJ2aWNlQ29ubmVjdGlvbi5pc0Nvbm5lY3RlZCgpKSB7CisgICAgICAgICAgICAgICAgLy8gY3JlYXRlIHRoZSBmbGlwcGVyIHZpZXdzIGlmIG5lY2Vzc2FyeSAod2UgaGF2ZSB0byBkbyB0aGlzIG5vdworICAgICAgICAgICAgICAgIC8vIGZvciBhbGwgdGhlIGZsaXBwZXJzIHdoaWxlIHdlIGhhdmUgdGhlIHJlZmVyZW5jZSB0byB0aGUgcGFyZW50KQorICAgICAgICAgICAgICAgIGluaXRpYWxpemVMb2FkaW5nVmlld3MocGFyZW50KTsKKworICAgICAgICAgICAgICAgIC8vIHJlcXVlc3QgdGhlIGl0ZW0gZnJvbSB0aGUgY2FjaGUgKHF1ZXVlaW5nIGl0IHRvIGxvYWQgaWYgbm90CisgICAgICAgICAgICAgICAgLy8gaW4gdGhlIGNhY2hlIGFscmVhZHkpCisgICAgICAgICAgICAgICAgUmVtb3RlVmlld3NJbmRleEluZm8gaW5kZXhJbmZvID0gcmVxdWVzdENhY2hlZEluZGV4SW5mbyhwb3NpdGlvbik7CisKKyAgICAgICAgICAgICAgICAvLyB1cGRhdGUgdGhlIGZsaXBwZXIgYXBwcm9wcmlhdGVseQorICAgICAgICAgICAgICAgIHN5bmNocm9uaXplZCAobVZpZXdDYWNoZSkgeworICAgICAgICAgICAgICAgICAgICBpbnQgY2FjaGVJbmRleCA9IGdldENhY2hlSW5kZXgocG9zaXRpb24pOworICAgICAgICAgICAgICAgICAgICBGcmFtZUxheW91dCBmbGlwcGVyID0gbVZpZXdDYWNoZVtjYWNoZUluZGV4XS5mbGlwcGVyOworICAgICAgICAgICAgICAgICAgICBmbGlwcGVyLnNldFZpc2liaWxpdHkoVmlldy5WSVNJQkxFKTsKKyAgICAgICAgICAgICAgICAgICAgZmxpcHBlci5zZXRBbHBoYSgxLjBmKTsKKworICAgICAgICAgICAgICAgICAgICBpZiAoaW5kZXhJbmZvID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIGhpZGUgdGhlIGl0ZW0gdmlldyBhbmQgc2hvdyB0aGUgbG9hZGluZyB2aWV3CisgICAgICAgICAgICAgICAgICAgICAgICBmbGlwcGVyLmdldENoaWxkQXQoMCkuc2V0VmlzaWJpbGl0eShWaWV3LlZJU0lCTEUpOworICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDE7IGkgPCBmbGlwcGVyLmdldENoaWxkQ291bnQoKTsgKytpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxpcHBlci5nZXRDaGlsZEF0KGkpLnNldFZpc2liaWxpdHkoVmlldy5HT05FKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIGhpZGUgdGhlIGxvYWRpbmcgdmlldyBhbmQgc2hvdyB0aGUgaXRlbSB2aWV3CisgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGZsaXBwZXIuZ2V0Q2hpbGRDb3VudCgpIC0gMTsgKytpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxpcHBlci5nZXRDaGlsZEF0KGkpLnNldFZpc2liaWxpdHkoVmlldy5HT05FKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIGZsaXBwZXIuZ2V0Q2hpbGRBdChmbGlwcGVyLmdldENoaWxkQ291bnQoKSAtIDEpLnNldFZpc2liaWxpdHkoVmlldy5WSVNJQkxFKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmxpcHBlcjsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gbmV3IFZpZXcobUNvbnRleHQpOworICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSB2b2lkIGluaXRpYWxpemVMb2FkaW5nVmlld3MoVmlld0dyb3VwIHBhcmVudCkgeworICAgICAgICAgICAgLy8gZW5zdXJlIHRoYXQgdGhlIGNhY2hlIGhhcyB0aGUgYXBwcm9wcmlhdGUgaW5pdGlhbCBmbGlwcGVyCisgICAgICAgICAgICBzeW5jaHJvbml6ZWQgKG1WaWV3Q2FjaGUpIHsKKyAgICAgICAgICAgICAgICBpZiAobVZpZXdDYWNoZVswXS5mbGlwcGVyID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBtVmlld0NhY2hlLmxlbmd0aDsgKytpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBGcmFtZUxheW91dCBmbGlwcGVyID0gbmV3IEZyYW1lTGF5b3V0KG1Db250ZXh0KTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtVXNlckxvYWRpbmdWaWV3ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyB1c2UgdGhlIHVzZXItc3BlY2lmaWVkIGxvYWRpbmcgdmlldworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsaXBwZXIuYWRkVmlldyhtVXNlckxvYWRpbmdWaWV3LmFwcGx5KG1Db250ZXh0LCBwYXJlbnQpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gY2FsY3VsYXRlIHRoZSBvcmlnaW5hbCBzaXplIG9mIHRoZSBmaXJzdCByb3cgZm9yIHRoZSBsb2FkZXIgdmlldworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN5bmNocm9uaXplZCAobVZpZXdDYWNoZUluZm8pIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1GaXJzdFZpZXdIZWlnaHQgPCAwKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBWaWV3IGZpcnN0VmlldyA9IG1GaXJzdFZpZXcuYXBwbHkobUNvbnRleHQsIHBhcmVudCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaXJzdFZpZXcubWVhc3VyZShNZWFzdXJlU3BlYy5tYWtlTWVhc3VyZVNwZWMoMCwgTWVhc3VyZVNwZWMuVU5TUEVDSUZJRUQpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNZWFzdXJlU3BlYy5tYWtlTWVhc3VyZVNwZWMoMCwgTWVhc3VyZVNwZWMuVU5TUEVDSUZJRUQpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1GaXJzdFZpZXdIZWlnaHQgPSBmaXJzdFZpZXcuZ2V0TWVhc3VyZWRIZWlnaHQoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGNvbnN0cnVjdCBhIG5ldyBsb2FkZXIgYW5kIGFkZCBpdCB0byB0aGUgZmxpcHBlciBhcyB0aGUgZmFsbGJhY2sKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBkZWZhdWx0IHZpZXcKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBUZXh0VmlldyB0ZXh0VmlldyA9IG5ldyBUZXh0VmlldyhtQ29udGV4dCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGV4dFZpZXcuc2V0VGV4dCgiTG9hZGluZy4uLiIpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRleHRWaWV3LnNldEhlaWdodChtRmlyc3RWaWV3SGVpZ2h0KTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ZXh0Vmlldy5zZXRHcmF2aXR5KEdyYXZpdHkuQ0VOVEVSX0hPUklaT05UQUwgfCBHcmF2aXR5LkNFTlRFUl9WRVJUSUNBTCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGV4dFZpZXcuc2V0VGV4dFNpemUoMTguMGYpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRleHRWaWV3LnNldFRleHRDb2xvcihDb2xvci5hcmdiKDk2LCAyNTUsIDI1NSwgMjU1KSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGV4dFZpZXcuc2V0U2hhZG93TGF5ZXIoMi4wZiwgMC4wZiwgMS4wZiwgQ29sb3IuQkxBQ0spOworCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxpcHBlci5hZGRWaWV3KHRleHRWaWV3KTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIG1WaWV3Q2FjaGVbaV0uZmxpcHBlciA9IGZsaXBwZXI7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCBzdGFydEJhY2tncm91bmRMb2FkZXIoKSB7CisgICAgICAgICAgICAvLyBpbml0aWFsaXplIHRoZSB3b3JrZXIgcnVubmFibGUKKyAgICAgICAgICAgIG1CYWNrZ3JvdW5kTG9hZGVyRW5hYmxlZCA9IHRydWU7CisgICAgICAgICAgICBtV29ya2VyUXVldWUucG9zdChuZXcgUnVubmFibGUoKSB7CisgICAgICAgICAgICAgICAgQE92ZXJyaWRlCisgICAgICAgICAgICAgICAgcHVibGljIHZvaWQgcnVuKCkgeworICAgICAgICAgICAgICAgICAgICB3aGlsZSAobUJhY2tncm91bmRMb2FkZXJFbmFibGVkKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAvLyBub3RpZnkgdGhlIFJlbW90ZVZpZXdzIGZhY3RvcnkgaWYgbmVjZXNzYXJ5CisgICAgICAgICAgICAgICAgICAgICAgICBib29sZWFuIGlzRGF0YURpcnR5ID0gZmFsc2U7CisgICAgICAgICAgICAgICAgICAgICAgICBzeW5jaHJvbml6ZWQgKG1WaWV3Q2FjaGVJbmZvKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNEYXRhRGlydHkgPSBtVmlld0NhY2hlSW5mby5pc0RhdGFEaXJ0eTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBtVmlld0NhY2hlSW5mby5pc0RhdGFEaXJ0eSA9IGZhbHNlOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGlzRGF0YURpcnR5KSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXBkYXRlTm90aWZ5RGF0YVNldENoYW5nZWQoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICAgICAgaW50IGluZGV4ID0gLTE7CisgICAgICAgICAgICAgICAgICAgICAgICBzeW5jaHJvbml6ZWQgKG1WaWV3Q2FjaGVMb2FkSW5kaWNlcykgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghbVZpZXdDYWNoZUxvYWRJbmRpY2VzLmlzRW1wdHkoKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbmRleCA9IG1WaWV3Q2FjaGVMb2FkSW5kaWNlcy5yZW1vdmVGaXJzdCgpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpbmRleCA8IDApIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyB0aGVyZSB3ZXJlIG5vIGl0ZW1zIHRvIGxvYWQsIHNvIHNsZWVwIGZvciBhIGJpdAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRocmVhZC5zbGVlcCgxMCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoSW50ZXJydXB0ZWRFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnByaW50U3RhY2tUcmFjZSgpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gb3RoZXJ3aXNlLCB0cnkgYW5kIGxvYWQgdGhlIGl0ZW0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cGRhdGVSZW1vdGVWaWV3c0luZm8oaW5kZXgpOworCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gc2xlZXAgZm9yIGEgYml0IHRvIGFsbG93IHRoaW5ncyB0byBjYXRjaCB1cCBhZnRlciB0aGUgbG9hZAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRocmVhZC5zbGVlcCg1MCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoSW50ZXJydXB0ZWRFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnByaW50U3RhY2tUcmFjZSgpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0pOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgc3RvcEJhY2tncm91bmRMb2FkZXIoKSB7CisgICAgICAgICAgICAvLyBjbGVhciB0aGUgaXRlbXMgdG8gYmUgbG9hZGVkCisgICAgICAgICAgICBtQmFja2dyb3VuZExvYWRlckVuYWJsZWQgPSBmYWxzZTsKKyAgICAgICAgICAgIHN5bmNocm9uaXplZCAobVZpZXdDYWNoZUxvYWRJbmRpY2VzKSB7CisgICAgICAgICAgICAgICAgbVZpZXdDYWNoZUxvYWRJbmRpY2VzLmNsZWFyKCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgbG9uZyBnZXRJdGVtSWQoaW50IHBvc2l0aW9uKSB7CisgICAgICAgICAgICBzeW5jaHJvbml6ZWQgKG1WaWV3Q2FjaGUpIHsKKyAgICAgICAgICAgICAgICBpZiAoY29udGFpbnNBbmRJc1ZhbGlkKHBvc2l0aW9uKSkgeworICAgICAgICAgICAgICAgICAgICByZXR1cm4gbVZpZXdDYWNoZVtnZXRDYWNoZUluZGV4KHBvc2l0aW9uKV0uaXRlbUlkOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHJldHVybiAwOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIGludCBnZXRJdGVtVmlld1R5cGUoaW50IHBvc2l0aW9uKSB7CisgICAgICAgICAgICAvLyBzeW5jaHJvbml6ZSB0byBlbnN1cmUgdGhhdCB0aGUgdHlwZSBpZC9pbmRleCBtYXAgaXMgdXBkYXRlZCBzeW5jaHJvbm91c2x5CisgICAgICAgICAgICBzeW5jaHJvbml6ZWQgKG1WaWV3Q2FjaGUpIHsKKyAgICAgICAgICAgICAgICBpZiAoY29udGFpbnNBbmRJc1ZhbGlkKHBvc2l0aW9uKSkgeworICAgICAgICAgICAgICAgICAgICBpbnQgdmlld0lkID0gbVZpZXdDYWNoZVtnZXRDYWNoZUluZGV4KHBvc2l0aW9uKV0udHlwZUlkOworICAgICAgICAgICAgICAgICAgICBNYXA8SW50ZWdlciwgSW50ZWdlcj4gdHlwZU1hcCA9IG1WaWV3Q2FjaGVJbmZvLm1UeXBlSWRJbmRleE1hcDsKKyAgICAgICAgICAgICAgICAgICAgLy8gd2UgKzEgYmVjYXVzZSB0aGUgZGVmYXVsdCBkdW1teSB2aWV3IGdldCB2aWV3IHR5cGUgMAorICAgICAgICAgICAgICAgICAgICBpZiAodHlwZU1hcC5jb250YWluc0tleSh2aWV3SWQpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHlwZU1hcC5nZXQodmlld0lkKTsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGludCBuZXdJbmRleCA9IHR5cGVNYXAuc2l6ZSgpICsgMTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHR5cGVNYXAucHV0KHZpZXdJZCwgbmV3SW5kZXgpOworICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ld0luZGV4OworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgLy8gcmV0dXJuIHRoZSB0eXBlIG9mIHRoZSBkZWZhdWx0IGl0ZW0KKyAgICAgICAgICAgIHJldHVybiAwOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIGludCBnZXRDb3VudCgpIHsKKyAgICAgICAgICAgIHN5bmNocm9uaXplZCAobVZpZXdDYWNoZUluZm8pIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gbVZpZXdDYWNoZUluZm8uY291bnQ7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgaW50IGdldFZpZXdUeXBlQ291bnQoKSB7CisgICAgICAgICAgICBzeW5jaHJvbml6ZWQgKG1WaWV3Q2FjaGVJbmZvKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIG1WaWV3Q2FjaGVJbmZvLnZpZXdUeXBlQ291bnQ7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgYm9vbGVhbiBoYXNTdGFibGVJZHMoKSB7CisgICAgICAgICAgICBzeW5jaHJvbml6ZWQgKG1WaWV3Q2FjaGVJbmZvKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIG1WaWV3Q2FjaGVJbmZvLmhhc1N0YWJsZUlkczsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyB2b2lkIGZsdXNoQ2FjaGUoKSB7CisgICAgICAgICAgICAvLyBjbGVhciB0aGUgaXRlbXMgdG8gYmUgbG9hZGVkCisgICAgICAgICAgICBzeW5jaHJvbml6ZWQgKG1WaWV3Q2FjaGVMb2FkSW5kaWNlcykgeworICAgICAgICAgICAgICAgIG1WaWV3Q2FjaGVMb2FkSW5kaWNlcy5jbGVhcigpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBzeW5jaHJvbml6ZWQgKG1WaWV3Q2FjaGUpIHsKKyAgICAgICAgICAgICAgICAvLyBmbHVzaCB0aGUgaW50ZXJuYWwgY2FjaGUgYW5kIGludmFsaWRhdGUgdGhlIGFkYXB0ZXIgZm9yIGZ1dHVyZSBsb2FkcworICAgICAgICAgICAgICAgIG1NYWluUXVldWUucmVtb3ZlTWVzc2FnZXMoMCk7CisKKyAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IG1WaWV3Q2FjaGUubGVuZ3RoOyArK2kpIHsKKyAgICAgICAgICAgICAgICAgICAgbVZpZXdDYWNoZVtpXS5pbnZhbGlkYXRlKCk7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgbVZpZXdDYWNoZVN0YXJ0UG9zaXRpb24gPSAwOworICAgICAgICAgICAgICAgIG1WaWV3Q2FjaGVFbmRQb3NpdGlvbiA9IC0xOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgcH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93cyBUaHJvd2FibGUgeworICAgICAgICAvLyByZW1lbWJlciB0byB1bmJpbmQgZnJvbSB0aGUgc2VydmljZSB3aGVuIGZpbmFsaXppbmcKKyAgICAgICAgdW5iaW5kU2VydmljZSgpOworICAgIH0KKworICAgIHB1YmxpYyBpbnQgZ2V0Q291bnQoKSB7CisgICAgICAgIHJlcXVlc3RCaW5kU2VydmljZSgpOworICAgICAgICByZXR1cm4gbVZpZXdDYWNoZS5nZXRDb3VudCgpOworICAgIH0KKworICAgIHB1YmxpYyBPYmplY3QgZ2V0SXRlbShpbnQgcG9zaXRpb24pIHsKKyAgICAgICAgLy8gZGlzYWxsb3cgYXJiaXRyYXJ5IG9iamVjdCB0byBiZSBhc3NvY2lhdGVkIHdpdGggYW4gaXRlbSBmb3IgdGhlIHRpbWUgYmVpbmcKKyAgICAgICAgcmV0dXJuIG51bGw7CisgICAgfQorCisgICAgcHVibGljIGxvbmcgZ2V0SXRlbUlkKGludCBwb3NpdGlvbikgeworICAgICAgICByZXF1ZXN0QmluZFNlcnZpY2UoKTsKKyAgICAgICAgcmV0dXJuIG1WaWV3Q2FjaGUuZ2V0SXRlbUlkKHBvc2l0aW9uKTsKKyAgICB9CisKKyAgICBwdWJsaWMgaW50IGdldEl0ZW1WaWV3VHlwZShpbnQgcG9zaXRpb24pIHsKKyAgICAgICAgcmVxdWVzdEJpbmRTZXJ2aWNlKCk7CisgICAgICAgIHJldHVybiBtVmlld0NhY2hlLmdldEl0ZW1WaWV3VHlwZShwb3NpdGlvbik7CisgICAgfQorCisgICAgcHVibGljIFZpZXcgZ2V0VmlldyhpbnQgcG9zaXRpb24sIFZpZXcgY29udmVydFZpZXcsIFZpZXdHcm91cCBwYXJlbnQpIHsKKyAgICAgICAgcmVxdWVzdEJpbmRTZXJ2aWNlKCk7CisgICAgICAgIHJldHVybiBtVmlld0NhY2hlLmdldFZpZXcocG9zaXRpb24sIGNvbnZlcnRWaWV3LCBwYXJlbnQpOworICAgIH0KKworICAgIHB1Ym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ICAgICAgICogQ2FsbGVkIHdoZW4geW91ciBmYWN0b3J5IGlzIGZpcnN0IGNvbnN0cnVjdGVkLiBUaGUgc2FtZSBmYWN0b3J5IG1heSBiZSBzaGFyZWQgYWNyb3NzCisgICAgICAgICAqIG11bHRpcGxlIFJlbW90ZVZpZXdBZGFwdGVycyBkZXBlbmRpbmcgb24gdGhlIGludGVudCBwYXNzZWQuCisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgdm9pZCBvbkNyZWF0ZSgpOworICAgICAgICAvKioKKyAgICAgICAgICogQ2FsbGVkIHdoZW4gbm90aWZ5RGF0YVNldENoYW5nZWQoKSBpcyB0cmlnZ2VyZWQgb24gdGhlIHJlbW90ZSBhZGFwdGVyLiBUaGlzIGFsbG93cyBhCisgICAgICAgICAqIFJlbW90ZVZpZXdzRmFjdG9yeSB0byByZXNwb25kIHRvIGRhdGEgY2hhbmdlcyBieSB1cGRhdGluZyBhbnkgaW50ZXJuYWwgcmVmZXJlbmNlcy4KKyAgICAgICAgICoKKyAgICAgICAgICogQHNlZSBhbmRyb2lkLmFwcHdpZGdldC5BcHBXaWRnZXRNYW5hZ2VyI25vdGlmeUFwcFdpZGdldFZpZXdEYXRhQ2hhbmdlZChpbnRbXSwgaW50KQorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHZvaWQgb25EYXRhU2V0Q2hhbmdlZCgpOworICAgICAgICAvKioKKyAgICAgICAgICogQ2FsbGVkIHdoZW4gdGhlIGxhc3QgUmVtb3RlVmlld3NBZGFwdGVyIHRoYXQgaXMgYXNzb2NpYXRlZCB3aXRoIHRoaXMgZmFjdG9yeSBpcworICAgICAgICAgKiB1bmJvdW5kLgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHZvaWQgb25EZXN0cm95KCk7CisKKyAgICAgICAgcHVibGljIGludCBnZXRDb3VudCgpOworICAgICAgICBwdWJsaWMgUmVtb3RlVmlld3MgZ2V0Vmlld0F0KGludCBwb3NpdGlvbik7CisgICAgICAgIHB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0TG9hZGluZ1ZpZXcoKSB7CisgICAgICAgICAgICByZXR1cm4gbUZhY3RvcnkuZ2V0TG9hZGluZ1ZpZXcoKTsKKyAgICAgICAgfQorICAgICAgICBwdWJsaWMgaW50IGdldFZpZXdUeXBlQ291bnQoKSB7CisgICAgICAgICAgICByZXR1cm4gbUZhY3RvcnkuZ2V0Vmlld1R5cGVDb3VudCgpOworICAgICAgICB9CisgICAgICAgIHB1YmxpYyBsb25nIGdldEl0ZW1JZChpbnQgcG9zaXRpb24pIHsKKyAgICAgICAgICAgIHJldHVybiBtRmFjdG9yeS5nZXRJdGVtSWQocG9zaXRpb24pOworICAgICAgICB9CisgICAgICAgIHB1YmxpYyBib29sZWFuIGhhc1N0YWJsZUlkcygpIHsKKyAgICAgICAgICAgIHJldHVybiBtRmFjdG9yeS5oYXNTdGFibGVJZHMoKTsKKyAgICAgICAgfQorCisgICAgICAgIHByaXZhdGUgUmVtb3RlVmlld3NGYWN0b3J5IG1GYWN0b3J5OworICAgIH0KKworICAgIHB1YmxpYyBSZW1vdGVWaWV3c1NlcnZpY2UoKSB7CisgICAgICAgIG1SZW1vdGVWaWV3RmFjdG9yaWVzID0gbmV3IEhhc2hNYXA8SW50ZW50LCBQYWlyPFJlbW90ZVZpZXdzRmFjdG9yeSwgSW50ZWdlcj4+KCk7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIElCaW5kZXIgb25CaW5kKEludGVudCBpbnRlbnQpIHsKKyAgICAgICAgc3luY2hyb25pemVkIChtTG9jaykgeworICAgICAgICAgICAgLy8gaW5jcmVtZW50IHRoZSByZWZlcmVuY2UgY291bnQgdG8gdGhlIHBhcnRpY3VsYXIgZmFjdG9yeSBhc3NvY2lhdGVkIHdpdGggdGhpcyBpbnRlbnQKKyAgICAgICAgICAgIFBhaXI8UmVtb3RlVmlld3NGYWN0b3J5LCBJbnRlZ2VyPiBmYWN0b3J5UmVmID0gbnVsbDsKKyAgICAgICAgICAgIFJlbW90ZVZpZXdzRmFjdG9yeSBmYWN0b3J5ID0gbnVsbDsKKyAgICAgICAgICAgIGlmICghbVJlbW90ZVZpZXdGYWN0b3JpZXMuY29udGFpbnNLZXkoaW50ZW50KSkgeworICAgICAgICAgICAgICAgIGZhY3RvcnkgPSBvbkdldFZpZXdGYWN0b3J5KGludGVudCk7CisgICAgICAgICAgICAgICAgZmFjdG9yeVJlZiA9IG5ldyBQYWlyPFJlbW90ZVZpZXdzRmFjdG9yeSwgSW50ZWdlcj4oZmFjdG9yeSwgMSk7CisgICAgICAgICAgICAgICAgbVJlbW90ZVZpZXdGYWN0b3JpZXMucHV0KGludGVudCwgZmFjdG9yeVJlZik7CisgICAgICAgICAgICAgICAgZmFjdG9yeS5vbkNyZWF0ZSgpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBQYWlyPFJlbW90ZVZpZXdzRmFjdG9yeSwgSW50ZWdlcj4gb2xkRmFjdG9yeVJlZiA9IG1SZW1vdGVWaWV3RmFjdG9yaWVzLmdldChpbnRlbnQpOworICAgICAgICAgICAgICAgIGZhY3RvcnkgPSBvbGRGYWN0b3J5UmVmLmZpcnN0OworICAgICAgICAgICAgICAgIGludCBuZXdSZWZDb3VudCA9IG9sZEZhY3RvcnlSZWYuc2Vjb25kLmludFZhbHVlKCkgKyAxOworICAgICAgICAgICAgICAgIGZhY3RvcnlSZWYgPSBuZXcgUGFpcjxSZW1vdGVWaWV3c0ZhY3RvcnksIEludGVnZXI+KG9sZEZhY3RvcnlSZWYuZmlyc3QsIG5ld1JlZkNvdW50KTsKKyAgICAgICAgICAgICAgICBtUmVtb3RlVmlld0ZhY3Rvcmllcy5wdXQoaW50ZW50LCBmYWN0b3J5UmVmKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHJldHVybiBuZXcgUmVtb3RlVmlld3NGYWN0b3J5QWRhcHRlcihmYWN0b3J5KTsKKyAgICAgICAgfQorICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyBib29sZWFuIG9uVW5iaW5kKEludGVudCBpbnRlbnQpIHsKKyAgICAgICAgc3luY2hyb25pemVkIChtTG9jaykgeworICAgICAgICAgICAgaWYgKG1SZW1vdGVWaWV3RmFjdG9yaWVzLmNvbnRhaW5zS2V5KGludGVudCkpIHsKKyAgICAgICAgICAgICAgICAvLyB0aGlzIGFsbGV2aWF0ZXMgdGhlIHVzZXIncyByZXNwb25zaWJpbGl0eSBvZiBoYXZpbmcgdG8gY2xlYXIgYWxsIGZhY3RvcmllcworICAgICAgICAgICAgICAgIFBhaXI8UmVtb3RlVmlld3NGYWN0b3J5LCBJbnRlZ2VyPiBvbGRGYWN0b3J5UmVmID0gbVJlbW90ZVZpZXdGYWN0b3JpZXMuZ2V0KGludGVudCk7CisgICAgICAgICAgICAgICAgaW50IG5ld1JlZkNvdW50ID0gb2xkRmFjdG9yeVJlZi5zZWNvbmQuaW50VmFsdWUoKSAtIDE7CisgICAgICAgICAgICAgICAgaWYgKG5ld1JlZkNvdW50IDw9IDApIHsKKyAgICAgICAgICAgICAgICAgICAgb2xkRmFjdG9yeVJlZi5maXJzdC5vbkRlc3Ryb3koKTsKKyAgICAgICAgICAgICAgICAgICAgbVJlbW90ZVZpZXdGYWN0b3JpZXMucmVtb3ZlKGludGVudCk7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgUGFpcjxSZW1vdGVWaWV3c0ZhY3RvcnksIEludGVnZXI+IGZhY3RvcnlSZWYgPSBuZXcgUGFpcjxSZW1vdGVWaWV3c0ZhY3RvcnksIEludGVnZXI+KG9sZEZhY3RvcnlSZWYuZmlyc3QsIG5ld1JlZkNvdW50KTsKKyAgICAgICAgICAgICAgICAgICAgbVJlbW90ZVZpZXdGYWN0b3JpZXMucHV0KGludGVudCwgZmFjdG9yeVJlZik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHJldHVybiBzdXBlci5vblVuYmluZCh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ludChjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0eWxlYWJsZS5TcGlubmVyX3NwaW5uZXJNb2RlLAorICAgICAgICAgICAgICAgIE1PREVfRElBTE9HKTsKKyAgICAgICAgCisgICAgICAgIHN3aXRjaCAobW9kZSkgeworICAgICAgICBjYXNlIE1PREVfRElBTE9HOiB7CisgICAgICAgICAgICBtUG9wdXAgPSBuZXcgRGlhbG9nUG9wdXAoKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgICAgIAorICAgICAgICBjYXNlIE1PREVfRFJPUERPV046IHsKKyAgICAgICAgICAgIGZpbmFsIGludCBoaW50UmVzb3VyY2UgPSBhLmdldFJlc291cmNlSWQoCisgICAgICAgICAgICAgICAgICAgIGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3R5bGVhYmxlLlNwaW5uZXJfcG9wdXBQcm9tcHRWaWV3LCAwKTsKKworICAgICAgICAgICAgRHJvcGRvd25Qb3B1cCBwb3B1cCA9IG5ldyBEcm9wZG93blBvcHVwKGNvbnRleHQsIGF0dHJzLCBkZWZTdHlsZSwgaGludFJlc291cmNlKTsKKworICAgICAgICAgICAgcG9wdXAuc2V0QmFja2dyb3VuZERyYXdhYmxlKGEuZ2V0RHJhd2FibGUoCisgICAgICAgICAgICAgICAgICAgIGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3R5bGVhYmxlLlNwaW5uZXJfcG9wdXBCYWNrZ3JvdW5kKSk7CisgICAgICAgICAgICBwb3B1cC5zZXRWZXJ0aWNhbE9mZnNldChhLmdldERpbWVuc2lvblBpeGVsT2Zmc2V0KAorICAgICAgICAgICAgICAgICAgICBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0eWxlYWJsZS5TcGlubmVyX2Ryb3BEb3duVmVydGljYWxPZmZzZXQsIDApKTsKKyAgICAgICAgICAgIHBvcHVwLnNldEhvcml6b250YWxPZmZzZXQoYS5nZXREaW1lbnNpb25QaXhlbE9mZnNldCgKKyAgICAgICAgICAgICAgICAgICAgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHlsZWFibGUuU3Bpbm5lcl9kcm9wRG93bkhvcml6b250YWxPZmZzZXQsIDApKTsKKworICAgICAgICAgICAgbVBvcHVwID0gcG9wdXA7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIAorICAgICAgICBtUG9wdXAuc2V0UHJvbXB0VGV4dChhLmdldFN0cmluZyhjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0eWxlYWJsZS5TcGlubmVyX3Byb21wdCkpOwogCiAgICAgICAgIGEucmVjeWNsZSgpOworCisgICAgICAgIC8vIEJhc2UgY29uc3RydWN0b3IgY2FuIGNhbGwgc2V0QWRhcHRlciBiZWZvcmUgd2UgaW5pdGlhbGl6ZSBtUG9wdXAuCisgICAgICAgIC8vIEZpbmlzaCBzZXR0aW5nIHRoaW5ncyB1cCBpZiB0aGlzIGhhcHBlbmVkLgorICAgICAgICBpZiAobVRlbXBBZGFwdGVyICE9IG51bGwpIHsKKyAgICAgICAgICAgIG1Qb3B1cC5zZXRBZGFwdGVyKG1UZW1wQWRhcHRlcik7CisgICAgICAgICAgICBtVGVtcEFkYXB0ZXIgPSBudWxsOworICAgICAgICB9CisgICAgfQorICAgIAorICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIHNldEFkYXB0ZXIoU3Bpbm5lckFkYXB0ZXIgYWRhcHRlcikgeworICAgICAgICBzdXBlci5zZXRBZGFwdGVyKGFkYXB0ZXIpOworCisgICAgICAgIGlmIChtUG9wdXAgIT0gbnVsbCkgeworICAgICAgICAgICAgbVBvcHVwLnNldEFkYXB0ZXIobmV3IERyb3BEb3duQWRhcHRlcihhZGFwdGVyKSk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBtVGVtcEFkYXB0ZXIgPSBuZXcgRHJvcERvd25BZGFwdGVyKGFkYXB0ZXIpOworICAgICAgICB9CiAgICAgfQogCiAgICAgQE92ZXJyaWRlCkBAIC0xOTQsOCArMjUxLDYgQEAKICAgICAgICAgcmV0dXJuIGNoaWxkOwogICAgIH0KIAotCi0KICAgICAvKioKICAgICAgKiBIZWxwZXIgZm9yIG1ha2VBbmRBZGRWaWV3IHRvIHNldCB0aGUgcG9zaXRpb24gb2YgYSB2aWV3CiAgICAgICogYW5kIGZpbGwgb3V0IGl0cyBsYXlvdXQgcGFyYW10ZXJzLgpAQCAtMjQ2LDE1ICszMDEsMTAgQEAKICAgICAgICAgCiAgICAgICAgIGlmICghaGFuZGxlZCkgewogICAgICAgICAgICAgaGFuZGxlZCA9IHRydWU7Ci0gICAgICAgICAgICBDb250ZXh0IGNvbnRleHQgPSBnZXRDb250ZXh0KCk7Ci0gICAgICAgICAgICAKLSAgICAgICAgICAgIGZpbmFsIERyb3BEb3duQWRhcHRlciBhZGFwdGVyID0gbmV3IERyb3BEb3duQWRhcHRlcihnZXRBZGFwdGVyKCkpOwogCi0gICAgICAgICAgICBBbGVydERpYWxvZy5CdWlsZGVyIGJ1aWxkZXIgPSBuZXcgQWxlcnREaWFsb2cuQnVpbGRlcihjb250ZXh0KTsKLSAgICAgICAgICAgIGlmIChtUHJvbXB0ICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICBidWlsZGVyLnNldFRpdGxlKG1Qcm9tcHQpOworICAgICAgICAgICAgaWYgKCFtUG9wdXAuaXNTaG93aW5nKCkpIHsKKyAgICAgICAgICAgICAgICBtUG9wdXAuc2hvdygpOwogICAgICAgICAgICAgfQotICAgICAgICAgICAgbVBvcHVwID0gYnVpbGRlci5zZXRTaW5nbGVDaG9pY2VJdGVtcyhhZGFwdGVyLCBnZXRTZWxlY3RlZEl0ZW1Qb3NpdGlvbigpLCB0aGlzKS5zaG93KCk7CiAgICAgICAgIH0KIAogICAgICAgICByZXR1cm4gaGFuZGxlZDsKQEAgLTI3MSw3ICszMjEsNyBAQAogICAgICAqIEBwYXJhbSBwcm9tcHQgdGhlIHByb21wdCB0byBzZXQKICAgICAgKi8KICAgICBwdWJsaWMgdm9pZCBzZXRQcm9tcHQoQ2hhclNlcXVlbmNlIHByb21wdCkgewotICAgICAgICBtUHJvbXB0ID0gcHJvbXB0OworICAgICAgICBtUG9wdXAuc2V0UHJvbXB0VGV4dChwcm9tcHQpOwogICAgIH0KIAogICAgIC8qKgpAQCAtMjc5LDE0ICszMjksMTQgQEAKICAgICAgKiBAcGFyYW0gcHJvbXB0SWQgdGhlIHJlc291cmNlIElEIG9mIHRoZSBwcm9tcHQgdG8gZGlzcGxheSB3aGVuIHRoZSBkaWFsb2cgaXMgc2hvd24KICAgICAgKi8KICAgICBwdWJsaWMgdm9pZCBzZXRQcm9tcHRJZChpbnQgcHJvbXB0SWQpIHsKLSAgICAgICAgbVByb21wdCA9IGdldENvbnRleHQoKS5nZXRUZXh0KHByb21wdElkKTsKKyAgICAgICAgc2V0UHJvbXB0KGdldENvbnRleHQoKS5nZXRUZXh0KHByb21wdElkKSk7CiAgICAgfQogCiAgICAgLyoqCiAgICAgICogQHJldHVybiBUaGUgcHJvbXB0IHRvIGRpc3BsYXkgd2hlbiB0aGUgZGlhbG9nIGlzIHNob3duCiAgICAgICovCiAgICAgcHVibGljIENoYXJTZXF1ZW5jZSBnZXRQcm9tcHQoKSB7Ci0gICAgICAgIHJldHVybiBtUHJvbXB0OworICAgICAgICByZXR1cm4gbVBvcHVwLmdldEhpbnRUZXh0KCk7CiAgICAgfQogICAgIAogICAgIC8qKgpAQCAtMzg0LDQgKzQzNCwxMjMgQEAKICAgICAgICAgICAgIHJldHVybiBnZXRDb3VudCgpID09IDA7CiAgICAgICAgIH0KICAgICB9CisgICAgCisgICAgLyoqCisgICAgICogSW1wbGVtZW50cyBzb21lIHNvcnQgb2YgcG9wdXAgc2VsZWN0aW9uIGludGVyZmFjZSBmb3Igc2VsZWN0aW5nIGEgc3Bpbm5lciBvcHRpb24uCisgICAgICogQWxsb3dzIGZvciBkaWZmZXJlbnQgc3Bpbm5lciBtb2Rlcy4KKyAgICAgKi8KKyAgICBwcml2YXRlIGludGVyZmFjZSBTcGlubmVyUG9wdXAgeworICAgICAgICBwdWJsaWMgdm9pZCBzZXRBZGFwdGVyKExpc3RBZGFwdGVyIGFkYXB0ZXIpOworICAgICAgICAKKyAgICAgICAgLyoqCisgICAgICAgICAqIFNob3cgdGhlIHBvcHVwCisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgdm9pZCBzaG93KCk7CisgICAgICAgIAorICAgICAgICAvKioKKyAgICAgICAgICogRGlzbWlzcyB0aGUgcG9wdXAKKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyB2b2lkIGRpc21pc3MoKTsKKyAgICAgICAgCisgICAgICAgIC8qKgorICAgICAgICAgKiBAcmV0dXJuIHRydWUgaWYgdGhlIHBvcHVwIGlzIHNob3dpbmcsIGZhbHNlIG90aGVyd2lzZS4KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBib29sZWFuIGlzU2hvd2luZygpOworICAgICAgICAKKyAgICAgICAgLyoqCisgICAgICAgICAqIFNldCBoaW50IHRleHQgdG8gYmUgZGlzcGxheWVkIHRvIHRoZSB1c2VyLiBUaGlzIHNob3VsZCBwcm92aWRlCisgICAgICAgICAqIGEgZGVzY3JpcHRpb24gb2YgdGhlIGNob2ljZSBiZWluZyBtYWRlLgorICAgICAgICAgKiBAcGFyYW0gaGludFRleHQgSGludCB0ZXh0IHRvIHNldC4KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyB2b2lkIHNldFByb21wdFRleHQoQ2hhclNlcXVlbmNlIGhpbnRUZXh0KTsKKyAgICAgICAgcHVibGljIENoYXJTZXF1ZW5jZSBnZXRIaW50VGV4dCgpOworICAgIH0KKyAgICAKKyAgICBwcml2YXRlIGNsYXNzIERpYWxvZ1BvcHVwIGltcGxlbWVudHMgU3Bpbm5lclBvcHVwLCBEaWFsb2dJbnRlcmZhY2UuT25DbGlja0xpc3RlbmVyIHsKKyAgICAgICAgcHJpdmF0ZSBBbGVydERpYWxvZyBtUG9wdXA7CisgICAgICAgIHByaXZhdGUgTGlzdEFkYXB0ZXIgbUxpc3RBZGFwdGVyOworICAgICAgICBwcml2YXRlIENoYXJTZXF1ZW5jZSBtUHJvbXB0OworCisgICAgICAgIHB1YmxpYyB2b2lkIGRpc21pc3MoKSB7CisgICAgICAgICAgICBtUG9wdXAuZGlzbWlzcygpOworICAgICAgICAgICAgbVBvcHVwID0gbnVsbDsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBib29sZWFuIGlzU2hvd2luZygpIHsKKyAgICAgICAgICAgIHJldHVybiBtUG9wdXAgIT0gbnVsbCA/IG1Qb3B1cC5pc1Nob3dpbmcoKSA6IGZhbHNlOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgc2V0QWRhcHRlcihMaXN0QWRhcHRlciBhZGFwdGVyKSB7CisgICAgICAgICAgICBtTGlzdEFkYXB0ZXIgPSBhZGFwdGVyOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgc2V0UHJvbXB0VGV4dChDaGFyU2VxdWVuY2UgaGludFRleHQpIHsKKyAgICAgICAgICAgIG1Qcm9tcHQgPSBoaW50VGV4dDsKKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgcHVibGljIENoYXJTZXF1ZW5jZSBnZXRIaW50VGV4dCgpIHsKKyAgICAgICAgICAgIHJldHVybiBtUHJvbXB0OworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgc2hvdygpIHsKKyAgICAgICAgICAgIEFsZXJ0RGlhbG9nLkJ1aWxkZXIgYnVpbGRlciA9IG5ldyBBbGVydERpYWxvZy5CdWlsZGVyKGdldENvbnRleHQoKSk7CisgICAgICAgICAgICBpZiAobVByb21wdCAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgYnVpbGRlci5zZXRUaXRsZShtUHJvbXB0KTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1Qb3B1cCA9IGJ1aWxkZXIuc2V0U2luZ2xlQ2hvaWNlSXRlbXMobUxpc3RBZGFwdGVyLAorICAgICAgICAgICAgICAgICAgICBnZXRTZWxlY3RlZEl0ZW1Qb3NpdGlvbigpLCB0aGlzKS5zaG93KCk7CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIHB1YmxpYyB2b2lkIG9uQ2xpY2soRGlhbG9nSW50ZXJmYWNlIGRpYWxvZywgaW50IHdoaWNoKSB7CisgICAgICAgICAgICBzZXRTZWxlY3Rpb24od2hpY2gpOworICAgICAgICAgICAgZGlzbWlzcygpOworICAgICAgICB9CisgICAgfQorICAgIAorICAgIHByaXZhdGUgY2xhc3MgRHJvcGRvd25Qb3B1cCBleHRlbmRzIExpc3RQb3B1cFdpbmRvdyBpbXBsZW1lbnRzIFNwaW5uZXJQb3B1cCB7CisgICAgICAgIHByaXZhdGUgQ2hhclNlcXVlbmNlIG1IaW50VGV4dDsKKyAgICAgICAgcHJpdmF0ZSBUZXh0VmlldyBtSGludFZpZXc7CisgICAgICAgIHByaXZhdGUgaW50IG1IaW50UmVzb3VyY2U7CisgICAgICAgIAorICAgICAgICBwdWJsaWMgRHJvcGRvd25Qb3B1cChDb250ZXh0IGNvbnRleHQsIEF0dHJpYnV0ZVNldCBhdHRycywKKyAgICAgICAgICAgICAgICBpbnQgZGVmU3R5bGVSZXMsIGludCBoaW50UmVzb3VyY2UpIHsKKyAgICAgICAgICAgIHN1cGVyKGNvbnRleHQsIGF0dHJzLCAwLCBkZWZTdHlsZVJlcyk7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIG1IaW50UmVzb3VyY2UgPSBoaW50UmVzb3VyY2U7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIHNldEFuY2hvclZpZXcoU3Bpbm5lci50aGlzKTsKKyAgICAgICAgICAgIHNldE1vZGFsKHRydWUpOworICAgICAgICAgICAgc2V0UHJvbXB0UG9zaXRpb24oUE9TSVRJT05fUFJPTVBUX0JFTE9XKTsKKyAgICAgICAgICAgIHNldE9uSXRlbUNsaWNrTGlzdGVuZXIobmV3IE9uSXRlbUNsaWNrTGlzdGVuZXIoKSB7CisgICAgICAgICAgICAgICAgcHVibGljIHZvaWQgb25JdGVtQ2xpY2soQWRhcHRlclZpZXcgcGFyZW50LCBWaWV3IHYsIGludCBwb3NpdGlvbiwgbG9uZyBpZCkgeworICAgICAgICAgICAgICAgICAgICBTcGlubmVyLnRoaXMuc2V0U2VsZWN0aW9uKHBvc2l0aW9uKTsKKyAgICAgICAgICAgICAgICAgICAgZGlzbWlzcygpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0pOworICAgICAgICB9CisgICAgICAgIAorICAgICAgICBwdWJsaWMgQ2hhclNlcXVlbmNlIGdldEhpbnRUZXh0KCkgeworICAgICAgICAgICAgcmV0dXJuIG1IaW50VGV4dDsKKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgcHVibGljIHZvaWQgc2V0UHJvbXB0VGV4dChDaGFyU2VxdWVuY2UgaGludFRleHQpIHsKKyAgICAgICAgICAgIG1IaW50VGV4dCA9IGhpbnRUZXh0OworICAgICAgICAgICAgaWYgKG1IaW50VmlldyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgbUhpbnRWaWV3LnNldFRleHQoaGludFRleHQpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIAorICAgICAgICBwdWJsaWMgdm9pZCBzaG93KCkgeworICAgICAgICAgICAgaWYgKG1IaW50VmlldyA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgZmluYWwgVGV4dFZpZXcgdGV4dFZpZXcgPSAoVGV4dFZpZXcpIExheW91dEluZmxhdGVyLmZyb20oZ2V0Q29udGV4dCgpKS5pbmZsYXRlKAorICAgICAgICAgICAgICAgICAgICAgICAgbUhpbnRSZXNvdXJjZSwgbnVsbCkuZmluZFZpZXdCeUlkKGNvbS5hbmRyb2lkLmludGVybmFsLlIuaWQudGV4dDEpOworICAgICAgICAgICAgICAgIHRleHRWaWV3LnNldFRleHQob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LyBGYWRlIGl0ZW0gaW4KKyAgICAgICAgICAgIGlmICh2aWV3LmdldEFscGhhKCkgPT0gMSkgeworICAgICAgICAgICAgICAgIHZpZXcuc2V0QWxwaGEoMCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICB2aWV3LnNldFZpc2liaWxpdHkoVklTSUJMRSk7CisKKyAgICAgICAgICAgIFByb3BlcnR5QW5pbWF0b3IgZmFkZUluID0gbmV3IFByb3BlcnR5QW5pbWF0b3IoREVGQVVMVF9BTklNQVRJT05fRFVSQVRJT04sCisgICAgICAgICAgICAgICAgICAgIHZpZXcsICJhbHBoYSIsIHZpZXcuZ2V0QWxwaGEoKSwgMS4wZik7CisgICAgICAgICAgICBmYWRlSW4uc3RhcnQoKTsKKyAgICAgICAgfSBlbHNlIGlmIChmcm9tSW5kZXggPT0gbU51bUFjdGl2ZVZpZXdzIC0gMSAmJiB0b0luZGV4ID09IG1OdW1BY3RpdmVWaWV3cyAtIDIpIHsKKyAgICAgICAgICAgIC8vIFNsaWRlIGl0ZW0gaW4KKyAgICAgICAgICAgIHZpZXcuc2V0VmlzaWJpbGl0eShWSVNJQkxFKTsKKworICAgICAgICAgICAgTGF5b3V0UGFyYW1zIGxwID0gKExheW91dFBhcmFtcykgdmlldy5nZXRMYXlvdXRQYXJhbXMoKTsKKyAgICAgICAgICAgIGludCBsYXJnZXN0RHVyYXRpb24gPQorICAgICAgICAgICAgICAgIE1hdGgucm91bmQobVN0YWNrU2xpZGVyLmdldER1cmF0aW9uRm9yTmV1dHJhbFBvc2l0aW9uKCkqREVGQVVMVF9BTklNQVRJT05fRFVSQVRJT04pOworCisgICAgICAgICAgICBpbnQgZHVyYXRpb24gPSBsYXJnZXN0RHVyYXRpb247CisgICAgICAgICAgICBpZiAobVlWZWxvY2l0eSAhPSAwKSB7CisgICAgICAgICAgICAgICAgZHVyYXRpb24gPSAxMDAwKigwIC0gbHAudmVydGljYWxPZmZzZXQpL01hdGguYWJzKG1ZVmVsb2NpdHkpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBkdXJhdGlvbiA9IE1hdGgubWluKGR1cmF0aW9uLCBsYXJnZXN0RHVyYXRpb24pOworICAgICAgICAgICAgZHVyYXRpb24gPSBNYXRoLm1heChkdXJhdGlvbiwgTUlOSU1VTV9BTklNQVRJT05fRFVSQVRJT04pOworCisgICAgICAgICAgICBTdGFja1NsaWRlciBhbmltYXRpb25TbGlkZXIgPSBuZXcgU3RhY2tTbGlkZXIobVN0YWNrU2xpZGVyKTsKKyAgICAgICAgICAgIFByb3BlcnR5QW5pbWF0b3Igc2xpZGVJblkgPSBuZXcgUHJvcGVydHlBbmltYXRvcihkdXJhdGlvbiwgYW5pbWF0aW9uU2xpZGVyLAorICAgICAgICAgICAgICAgICAgICAiWVByb2dyZXNzIiwgbVN0YWNrU2xpZGVyLmdldFlQcm9ncmVzcygpLCAwKTsKKyAgICAgICAgICAgIHNsaWRlSW5ZLnNldEludGVycG9sYXRvcihuZXcgTGluZWFySW50ZXJwb2xhdG9yKCkpOworICAgICAgICAgICAgc2xpZGVJblkuc3RhcnQoKTsKKyAgICAgICAgICAgIFByb3BlcnR5QW5pbWF0b3Igc2xpZGVJblggPSBuZXcgUHJvcGVydHlBbmltYXRvcihkdXJhdGlvbiwgYW5pbWF0aW9uU2xpZGVyLAorICAgICAgICAgICAgICAgICAgICAiWFByb2dyZXNzIiwgbVN0YWNrU2xpZGVyLmdldFhQcm9ncmVzcygpLCAwKTsKKyAgICAgICAgICAgIHNsaWRlSW5YLnNldEludGVycG9sYXRvcihuZXcgTGluZWFySW50ZXJwb2xhdG9yKCkpOworICAgICAgICAgICAgc2xpZGVJblguc3RhcnQoKTsKKyAgICAgICAgfSBlbHNlIGlmIChmcm9tSW5kZXggPT0gbU51bUFjdGl2ZVZpZXdzIC0gMiAmJiB0b0luZGV4ID09IG1OdW1BY3RpdmVWaWV3cyAtIDEpIHsKKyAgICAgICAgICAgIC8vIFNsaWRlIGl0ZW0gb3V0CisgICAgICAgICAgICBMYXlvdXRQYXJhbXMgbHAgPSAoTGF5b3V0UGFyYW1zKSB2aWV3LmdldExheW91dFBhcmFtcygpOworCisgICAgICAgICAgICBpbnQgbGFyZ2VzdER1cmF0aW9uID0gTWF0aC5yb3VuZChtU3RhY2tTbGlkZXIuZ2V0RHVyYXRpb25Gb3JPZmZzY3JlZW5Qb3NpdGlvbigpKgorICAgICAgICAgICAgICAgICAgICBERUZBVUxUX0FOSU1BVElPTl9EVVJBVElPTik7CisgICAgICAgICAgICBpbnQgZHVyYXRpb24gPSBsYXJnZXN0RHVyYXRpb247CisgICAgICAgICAgICBpZiAobVlWZWxvY2l0eSAhPSAwKSB7CisgICAgICAgICAgICAgICAgZHVyYXRpb24gPSAxMDAwKihscC52ZXJ0aWNhbE9mZnNldCArIG1WaWV3SGVpZ2h0KS9NYXRoLmFicyhtWVZlbG9jaXR5KTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgZHVyYXRpb24gPSBNYXRoLm1pbihkdXJhdGlvbiwgbGFyZ2VzdER1cmF0aW9uKTsKKyAgICAgICAgICAgIGR1cmF0aW9uID0gTWF0aC5tYXgoZHVyYXRpb24sIE1JTklNVU1fQU5JTUFUSU9OX0RVUkFUSU9OKTsKKworICAgICAgICAgICAgU3RhY2tTbGlkZXIgYW5pbWF0aW9uU2xpZGVyID0gbmV3IFN0YWNrU2xpZGVyKG1TdGFja1NsaWRlcik7CisgICAgICAgICAgICBQcm9wZXJ0eUFuaW1hdG9yIHNsaWRlT3V0WSA9IG5ldyBQcm9wZXJ0eUFuaW1hdG9yKGR1cmF0aW9uLCBhbmltYXRpb25TbGlkZXIsCisgICAgICAgICAgICAgICAgICAgICJZUHJvZ3Jlc3MiLCBtU3RhY2tTbGlkZXIuZ2V0WVByb2dyZXNzKCksIDEpOworICAgICAgICAgICAgc2xpZGVPdXRZLnNldEludGVycG9sYXRvcihuZXcgTGluZWFySW50ZXJwb2xhdG9yKCkpOworICAgICAgICAgICAgc2xpZGVPdXRZLnN0YXJ0KCk7CisgICAgICAgICAgICBQcm9wZXJ0eUFuaW1hdG9yIHNsaWRlT3V0WCA9IG5ldyBQcm9wZXJ0eUFuaW1hdG9yKGR1cmF0aW9uLCBhbmltYXRpb25TbGlkZXIsCisgICAgICAgICAgICAgICAgICAgICJYUHJvZ3Jlc3MiLCBtU3RhY2tTbGlkZXIuZ2V0WFByb2dyZXNzKCksIDApOworICAgICAgICAgICAgc2xpZGVPdXRYLnNldEludGVycG9sYXRvcihuZXcgTGluZWFySW50ZXJwb2xhdG9yKCkpOworICAgICAgICAgICAgc2xpZGVPdXRYLnN0YXJ0KCk7CisgICAgICAgIH0gZWxzZSBpZiAoZnJvbUluZGV4ID09IC0xICYmIHRvSW5kZXggPT0gbU51bUFjdGl2ZVZpZXdzIC0gMSkgeworICAgICAgICAgICAgLy8gTWFrZSBzdXJlIHRoaXMgdmlldyB0aGF0IGlzICJ3YWl0aW5nIGluIHRoZSB3aW5ncyIgaXMgaW52aXNpYmxlCisgICAgICAgICAgICB2aWV3LnNldEFscGhhKDAuMGYpOworICAgICAgICAgICAgdmlldy5zZXRWaXNpYmlsaXR5KElOVklTSUJMRSk7CisgICAgICAgICAgICBMYXlvdXRQYXJhbXMgbHAgPSAoTGF5b3V0UGFyYW1zKSB2aWV3LmdldExheW91dFBhcmFtcygpOworICAgICAgICAgICAgbHAuc2V0VmVydGljYWxPZmZzZXQoLW1WaWV3SGVpZ2h0KTsKKyAgICAgICAgfSBlbHNlIGlmICh0b0luZGV4ID09IC0xKSB7CisgICAgICAgICAgICAvLyBGYWRlIGl0ZW0gb3V0CisgICAgICAgICAgICBQcm9wZXJ0eUFuaW1hdG9yIGZhZGVPdXQgPSBuZXcgUHJvcGVydHlBbmltYXRvcihERUZBVUxUX0FOSU1BVElPTl9EVVJBVElPTiwKKyAgICAgICAgICAgICAgICAgICAgdmlldywgImFscGhhIiwgdmlldy5nZXRBbHBoYSgpLCAwKTsKKyAgICAgICAgICAgIGZhZGVPdXQuc3RhcnQoKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIEFwcGx5IGFueSBuZWNlc3NhcnkgdHJhbmZvcm1zIGZvciB0aGUgY2hpbGQgdGhhdCBpcyBiZWluZyBhZGRlZC4KKyAgICAgKi8KKyAgICB2b2lkIGFwcGx5VHJhbnNmb3JtRm9yQ2hpbGRBdEluZGV4KFZpZXcgY2hpbGQsIGludCByZWxhdGl2ZUluZGV4KSB7CisgICAgICAgIGlmICghbVJvdGF0aW9ucy5jb250YWluc0tleShjaGlsZCkpIHsKKyAgICAgICAgICAgIGZsb2F0IHJvdGF0aW9uID0gKGZsb2F0KSAoTWF0aC5yYW5kb20oKSoyNiAtIDEzKTsKKyAgICAgICAgICAgIG1Sb3RhdGlvbnMucHV0KGNoaWxkLCByb3RhdGlvbik7CisgICAgICAgIH0KKworICAgICAgICAvLyBDaGlsZCBoYXMgYmVlbiByZW1vdmVkCisgICAgICAgIGlmIChyZWxhdGl2ZUluZGV4ID09IC0xKSB7CisgICAgICAgICAgICBpZiAobVJvdGF0aW9ucy5jb250YWluc0tleShjaGlsZCkpIHsKKyAgICAgICAgICAgICAgICBtUm90YXRpb25zLnJlbW92ZShjaGlsZCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAobUNoaWxkcmVuVG9BcHBseVRyYW5zZm9ybXNUby5jb250YWluc0tleShjaGlsZCkpIHsKKyAgICAgICAgICAgICAgICBtQ2hpbGRyZW5Ub0FwcGx5VHJhbnNmb3Jtc1RvLnJlbW92ZShjaGlsZCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICAvLyBpZiB0aGlzIHZpZXcgaXMgYWxyZWFkeSBpbiB0aGUgbGF5b3V0LCB3ZSBuZWVkIHRvCisgICAgICAgIC8vIHdhaXQgdW50aWwgbGF5b3V0IGhhcyBmaW5pc2hlZCBpbiBvcmRlciB0byBzZXQgdGhlCisgICAgICAgIC8vIHBpdm90IHBvaW50IG9mIHRoZSByb3RhdG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X1JBVElPKmdldE1lYXN1cmVkSGVpZ2h0KCkpOworICAgICAgICAgICAgbVN3aXBlVGhyZXNob2xkID0gTWF0aC5yb3VuZChTV0lQRV9USFJFU0hPTERfUkFUSU8qbVZpZXdIZWlnaHQpOworCisgICAgICAgICAgICAvLyBUT0RPOiBSaWdodCBub3cgdGhpcyB3YWxrcyBhbGwgdGhlIHdheSB1cCB0aGUgdmlldyBoaWVyYXJjaHkgYW5kIGRpc2FibGVzCisgICAgICAgICAgICAvLyBDbGlwQ2hpbGRyZW4gYW5kIENsaXBUb1BhZGRpbmcuIFdlJ3JlIHByb2JhYmx5IGdvaW5nICB0byB3YW50IHRvIHJlc2V0CisgICAgICAgICAgICAvLyB0aGVzZSBmbGFncyBhcyB3ZWxsLgorICAgICAgICAgICAgc2V0Q2xpcENoaWxkcmVuKGZhbHNlKTsKKyAgICAgICAgICAgIHNldENsaXBUb1BhZGRpbmcoZmFsc2UpOworICAgICAgICAgICAgVmlld0dyb3VwIHZpZXcgPSB0aGlzOworICAgICAgICAgICAgd2hpbGUgKHZpZXcuZ2V0UGFyZW50KCkgIT0gbnVsbCAmJiB2aWV3LmdldFBhcmVudCgpIGluc3RhbmNlb2YgVmlld0dyb3VwKSB7CisgICAgICAgICAgICAgICAgdmlldyA9IChWaWV3R3JvdXApIHZpZXcuZ2V0UGFyZW50KCk7CisgICAgICAgICAgICAgICAgdmlldy5zZXRDbGlwQ2hpbGRyZW4oZmFsc2UpOworICAgICAgICAgICAgICAgIHZpZXcuc2V0Q2xpcFRvUGFkZGluZyhmYWxzZSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBtRmlyc3RMYXlvdXRIYXBwZW5lZCA9IHRydWU7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgYm9vbGVhbiBvbkludGVyY2VwdFRvdWNoRXZlbnQoTW90aW9uRXZlbnQgZXYpIHsKKyAgICAgICAgaW50IGFjdGlvbiA9IGV2LmdldEFjdGlvbigpOworICAgICAgICBzd2l0Y2goYWN0aW9uICYgTW90aW9uRXZlbnQuQUNUSU9OX01BU0spIHsKKworICAgICAgICAgICAgY2FzZSBNb3Rpb25FdmVudC5BQ1RJT05fRE9XTjogeworICAgICAgICAgICAgICAgIGlmIChtQWN0aXZlUG9pbnRlcklkID09IElOVkFMSURfUE9JTlRFUikgeworICAgICAgICAgICAgICAgICAgICBtSW5pdGlhbFggPSBldi5nZXRYKCk7CisgICAgICAgICAgICAgICAgICAgIG1Jbml0aWFsWSA9IGV2LmdldFkoKTsKKyAgICAgICAgICAgICAgICAgICAgbUFjdGl2ZVBvaW50ZXJJZCA9IGV2LmdldFBvaW50ZXJJZCgwKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXNlIE1vdGlvbkV2ZW50LkFDVElPTl9NT1ZFOiB7CisgICAgICAgICAgICAgICAgaW50IHBvaW50ZXJJbmRleCA9IGV2LmZpbmRQb2ludGVySW5kZXgobUFjdGl2ZVBvaW50ZXJJZCk7CisgICAgICAgICAgICAgICAgaWYgKHBvaW50ZXJJbmRleCA9PSBJTlZBTElEX1BPSU5URVIpIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gbm8gZGF0YSBmb3Igb3VyIHByaW1hcnkgcG9pbnRlciwgdGhpcyBzaG91bGRuJ3QgaGFwcGVuLCBsb2cgaXQKKyAgICAgICAgICAgICAgICAgICAgTG9nLmQoVEFHLCAiRXJyb3I6IE5vIGRhdGEgZm9yIG91ciBwcmltYXJ5IHBvaW50ZXIuIik7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZmxvYXQgbmV3WSA9IGV2LmdldFkocG9pbnRlckluZGV4KTsKKyAgICAgICAgICAgICAgICBmbG9hdCBkZWx0YVkgPSBuZXdZIC0gbUluaXRpYWxZOworCisgICAgICAgICAgICAgICAgYmVnaW5HZXN0dXJlSWZOZWVkZWQoZGVsdGFZKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhc2UgTW90aW9uRXZlbnQuQUNUSU9OX1BPSU5URVJfVVA6IHsKKyAgICAgICAgICAgICAgICBvblNlY29uZGFyeVBvaW50ZXJVcChldik7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXNlIE1vdGlvbkV2ZW50LkFDVElPTl9VUDoKKyAgICAgICAgICAgIGNhc2UgTW90aW9uRXZlbnQuQUNUSU9OX0NBTkNFTDogeworICAgICAgICAgICAgICAgIG1BY3RpdmVQb2ludGVySWQgPSBJTlZBTElEX1BPSU5URVI7CisgICAgICAgICAgICAgICAgbVN3aXBlR2VzdHVyZVR5cGUgPSBHRVNUVVJFX05PTkU7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gbVN3aXBlR2VzdHVyZVR5cGUgIT0gR0VTVFVSRV9OT05FOworICAgIH0KKworICAgIHByaXZhdGUgdm9pZCBiZWdpbkdlc3R1cmVJZk5lZWRlZChmbG9hdCBkZWx0YVkpIHsKKyAgICAgICAgaWYgKChpbnQpIE1hdGguYWJzKGRlbHRhWSkgPiBtVG91Y2hTbG9wICYmIG1Td2lwZUdlc3R1cmVUeXBlID09IEdFU1RVUkVfTk9ORSkgeworICAgICAgICAgICAgaW50IHN3aXBlR2VzdHVyZVR5cGUgPSBkZWx0YVkgPCAwID8gR0VTVFVSRV9TTElERV9VUCA6IEdFU1RVUkVfU0xJREVfRE9XTjsKKyAgICAgICAgICAgIGNhbmNlbExvbmdQcmVzcygpOworICAgICAgICAgICAgcmVxdWVzdERpc2FsbG93SW50ZXJjZXB0VG91Y2hFdmVudCh0cnVlKTsKKworICAgICAgICAgICAgaW50IGFjdGl2ZUluZGV4ID0gc3dpcGVHZXN0dXJlVHlwZSA9PSBHRVNUVVJFX1NMSURFX0RPV04gPyBtTnVtQWN0aXZlVmlld3MgLSAxCisgICAgICAgICAgICAgICAgICAgIDogbU51bUFjdGl2ZVZpZXdzIC0gMjsKKworICAgICAgICAgICAgaWYgKG1BZGFwdGVyID09IG51bGwpIHJldHVybjsKKworICAgICAgICAgICAgaWYgKG1DdXJyZW50V2luZG93U3RhcnRVbmJvdW5kZWQgKyBhY3RpdmVJbmRleCA9PSAwKSB7CisgICAgICAgICAgICAgICAgbVN0YWNrU2xpZGVyLnNldE1vZGUoU3RhY2tTbGlkZXIuQkVHSU5OSU5HX09GX1NUQUNLX01PREUpOworICAgICAgICAgICAgfSBlbHNlIGlmIChtQ3VycmVudFdpbmRvd1N0YXJ0VW5ib3VuZGVkICsgYWN0aXZlSW5kZXggPT0gbUFkYXB0ZXIuZ2V0Q291bnQoKSkgeworICAgICAgICAgICAgICAgIGFjdGl2ZUluZGV4LS07CisgICAgICAgICAgICAgICAgbVN0YWNrU2xpZGVyLnNldE1vZGUoU3RhY2tTbGlkZXIuRU5EX09GX1NUQUNLX01PREUpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBtU3RhY2tTbGlkZXIuc2V0TW9kZShTdGFja1NsaWRlci5OT1JNQUxfTU9ERSk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIFZpZXcgdiA9IGdldFZpZXdBdFJlbGF0aXZlSW5kZXgoYWN0aXZlSW5kZXgpOworICAgICAgICAgICAgaWYgKHYgPT0gbnVsbCkgcmV0dXJuOworCisgICAgICAgICAgICBtSGlnaGxpZ2h0LnNldEltYWdlQml0bWFwKGNyZWF0ZU91dGxpbmUodikpOworICAgICAgICAgICAgbUhpZ2hsaWdodC5icmluZ1RvRnJvbnQoKTsKKyAgICAgICAgICAgIHYuYnJpbmdUb0Zyb250KCk7CisgICAgICAgICAgICBtU3RhY2tTbGlkZXIuc2V0Vmlldyh2KTsKKworICAgICAgICAgICAgaWYgKHN3aXBlR2VzdHVyZVR5cGUgPT0gR0VTVFVSRV9TTElERV9ET1dOKQorICAgICAgICAgICAgICAgIHYuc2V0VmlzaWJpbGl0eShWSVNJQkxFKTsKKworICAgICAgICAgICAgLy8gV2Ugb25seSByZWdpc3RlciB0aGlzIGdlc3R1cmUgaWYgd2UndmUgbWFkZSBpdCB0aGlzIGZhciB3aXRob3V0IGEgcHJvYmxlbQorICAgICAgICAgICAgbVN3aXBlR2VzdHVyZVR5cGUgPSBzd2lwZUdlc3R1cmVUeXBlOworICAgICAgICB9CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIGJvb2xlYW4gb25Ub3VjaEV2ZW50KE1vdGlvbkV2ZW50IGV2KSB7CisgICAgICAgIGludCBhY3Rpb24gPSBldi5nZXRBY3Rpb24oKTsKKyAgICAgICAgaW50IHBvaW50ZXJJbmRleCA9IGV2LmZpbmRQb2ludGVySW5kZXgobUFjdGl2ZVBvaW50ZXJJZCk7CisgICAgICAgIGlmIChwb2ludGVySW5kZXggPT0gSU5WQUxJRF9QT0lOVEVSKSB7CisgICAgICAgICAgICAvLyBubyBkYXRhIGZvciBvdXIgcHJpbWFyeSBwb2ludGVyLCB0aGlzIHNob3VsZG4ndCBoYXBwZW4sIGxvZyBpdAorICAgICAgICAgICAgTG9nLmQoVEFHLCAiRXJyb3I6IE5vIGRhdGEgZm9yIG91ciBwcmltYXJ5IHBvaW50ZXIuIik7CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKworICAgICAgICBmbG9hdCBuZXdZID0gZXYuZ2V0WShwb2ludGVySW5kZXgpOworICAgICAgICBmbG9hdCBuZXdYID0gZXYuZ2V0WChwb2ludGVySW5kZXgpOworICAgICAgICBmbG9hdCBkZWx0YVkgPSBuZXdZIC0gbUluaXRpYWxZOworICAgICAgICBmbG9hdCBkZWx0YVggPSBuZXdYIC0gbUluaXRpYWxYOworICAgICAgICBpZiAobVZlbG9jaXR5VHJhY2tlciA9PSBudWxsKSB7CisgICAgICAgICAgICBtVmVsb2NpdHlUcmFja2VyID0gVmVsb2NpdHlUcmFja2VyLm9idGFpbigpOworICAgICAgICB9CisgICAgICAgIG1WZWxvY2l0eVRyYWNrZXIuYWRkTW92ZW1lbnQoZXYpOworCisgICAgICAgIHN3aXRjaCAoYWN0aW9uICYgTW90aW9uRXZlbnQuQUNUSU9OX01BU0spIHsKKyAgICAgICAgICAgIGNhc2UgTW90aW9uRXZlbnQuQUNUSU9OX01PVkU6IHsKKyAgICAgICAgICAgICAgICBiZWdpbkdlc3R1cmVJZk5lZWRlZChkZWx0YVkpOworCisgICAgICAgICAgICAgICAgZmxvYXQgcnggPSBkZWx0YVgvKG1WaWV3SGVpZ2h0KjEuMGYpOworICAgICAgICAgICAgICAgIGlmIChtU3dpcGVHZXN0dXJlVHlwZSA9PSBHRVNUVVJFX1NMSURFX0RPV04pIHsKKyAgICAgICAgICAgICAgICAgICAgZmxvYXQgciA9IChkZWx0YVktbVRvdWNoU2xvcCoxLjBmKS9tVmlld0hlaWdodCoxLjBmOworICAgICAgICAgICAgICAgICAgICBtU3RhY2tTbGlkZXIuc2V0WVByb2dyZXNzKDEgLSByKTsKKyAgICAgICAgICAgICAgICAgICAgbVN0YWNrU2xpZGVyLnNldFhQcm9ncmVzcyhyeCk7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAobVN3aXBlR2VzdHVyZVR5cGUgPT0gR0VTVFVSRV9TTElERV9VUCkgeworICAgICAgICAgICAgICAgICAgICBmbG9hdCByID0gLShkZWx0YVkgKyBtVG91Y2hTbG9wKjEuMGYpL21WaWV3SGVpZ2h0KjEuMGY7CisgICAgICAgICAgICAgICAgICAgIG1TdGFja1NsaWRlci5zZXRZUHJvZ3Jlc3Mocik7CisgICAgICAgICAgICAgICAgICAgIG1TdGFja1NsaWRlci5zZXRYUHJvZ3Jlc3MocngpOworICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXNlIE1vdGlvbkV2ZW50LkFDVElPTl9VUDogeworICAgICAgICAgICAgICAgIGhhbmRsZVBvaW50ZXJVcChldik7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXNlIE1vdGlvbkV2ZW50LkFDVElPTl9QT0lOVEVSX1VQOiB7CisgICAgICAgICAgICAgICAgb25TZWNvbmRhcnlQb2ludGVyVXAoZXYpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2FzZSBNb3Rpb25FdmVudC5BQ1RJT05fQ0FOQ0VMOiB7CisgICAgICAgICAgICAgICAgbUFjdGl2ZVBvaW50ZXJJZCA9IElOVkFMSURfUE9JTlRFUjsKKyAgICAgICAgICAgICAgICBtU3dpcGVHZXN0dXJlVHlwZSA9IEdFU1RVUkVfTk9ORTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICB9CisKKyAgICBwcml2YXRlIGZpbmFsIFJlY3QgdG91Y2hSZWN0ID0gbmV3IFJlY3QoKTsKKyAgICBwcml2YXRlIHZvaWQgb25TZWNvbmRhcnlQb2ludGVyVXAoTW90aW9uRXZlbnQgZXYpIHsKKyAgICAgICAgZmluYWwgaW50IGFjdGl2ZVBvaW50ZXJJbmRleCA9IGV2LmdldEFjdGlvbkluZGV4KCk7CisgICAgICAgIGZpbmFsIGludCBwb2ludGVySWQgPSBldi5nZXRQb2ludGVySWQoYWN0aXZlUG9pbnRlckluZGV4KTsKKyAgICAgICAgaWYgKHBvaW50ZXJJZCA9PSBtQWN0aXZlUG9pbnRlcklkKSB7CisKKyAgICAgICAgICAgIGludCBhY3RpdmVWaWV3SW5kZXggPSAobVN3aXBlR2VzdHVyZVR5cGUgPT0gR0VTVFVSRV9TTElERV9ET1dOKSA/IG1OdW1BY3RpdmVWaWV3cyAtIDEKKyAgICAgICAgICAgICAgICAgICAgOiBtTnVtQWN0aXZlVmlld3MgLSAyOworCisgICAgICAgICAgICBWaWV3IHYgPSBnZXRWaWV3QXRSZWxhdGl2ZUluZGV4KGFjdGl2ZVZpZXdJbmRleCk7CisgICAgICAgICAgICBpZiAodiA9PSBudWxsKSByZXR1cm47CisKKyAgICAgICAgICAgIC8vIE91ciBwcmltYXJ5IHBvaW50ZXIgaGFzIGdvbmUgdXAgLS0gbGV0J3Mgc2VlIGlmIHdlIGNhbiBmaW5kCisgICAgICAgICAgICAvLyBhbm90aGVyIHBvaW50ZXIgb24gdGhlIHZpZXcuIElmIHNvLCB0aGVuIHdlIHNob3VsZCByZXBsYWNlCisgICAgICAgICAgICAvLyBvdXIgcHJpbWFyeSBwb2ludGVyIHdpdGggdGhpcyBuZXcgcG9pbnRlciBhbmQgYWRqdXN0IHRoaW5ncworICAgICAgICAgICAgLy8gc28gdGhhdCB0aGUgdmlldyBkb2Vzbid0IGp1bXAKKyAgICAgICAgICAgIGZvciAoaW50IGluZGV4ID0gMDsgaW5kZXggPCBldi5nZXRQb2ludGVyQ291bnQoKTsgaW5kZXgrKykgeworICAgICAgICAgICAgICAgIGlmIChpbmRleCAhPSBhY3RpdmVQb2ludGVySW5kZXgpIHsKKworICAgICAgICAgICAgICAgICAgICBmbG9hdCB4ID0gZXYuZ2V0WChpbmRleCk7CisgICAgICAgICAgICAgICAgICAgIGZsb2F0IHkgPSBldi5nZXRZKGluZGV4KTsKKworICAgICAgICAgICAgICAgICAgICB0b3VjaFJlY3Quc2V0KHYuZ2V0TGVmdCgpLCB2LmdldFRvcCgpLCB2LmdldFJpZ2h0KCksIHYuZ2V0Qm90dG9tKCkpOworICAgICAgICAgICAgICAgICAgICBpZiAodG91Y2hSZWN0LmNvbnRhaW5zKE1hdGgucm91bmQoeCksIE1hdGgucm91bmQoeSkpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCBvbGRYID0gZXYuZ2V0WChhY3RpdmVQb2ludGVySW5kZXgpOworICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgb2xkWSA9IGV2LmdldFkoYWN0aXZlUG9pbnRlckluZGV4KTsKKworICAgICAgICAgICAgICAgICAgICAgICAgLy8gYWRqdXN0IG91ciBmcmFtZSBvZiByZWZlcmVuY2UgdG8gYXZvaWQgYSBqdW1wCisgICAgICAgICAgICAgICAgICAgICAgICBtSW5pdGlhbFkgKz0gKHkgLSBvbGRZKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1Jbml0aWFsWCArPSAoeCAtIG9sZFgpOworCisgICAgICAgICAgICAgICAgICAgICAgICBtQWN0aXZlUG9pbnRlcklkID0gZXYuZ2V0UG9pbnRlcklkKGluZGV4KTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtVmVsb2NpdHlUcmFja2VyICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBtVmVsb2NpdHlUcmFja2VyLmNsZWFyKCk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICAvLyBvaywgd2UncmUgZ29vZCwgd2UgZm91bmQgYSBuZXcgcG9pbnRlciB3aGljaCBpcyB0b3VjaGluZyB0aGUgYWN0aXZlIHZpZXcKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIC8vIGlmIHdlIG1hZGUgaXQgdGhpcyBmYXIsIGl0IG1lYW5zIHdlIGRpZG4ndCBmaW5kIGEgc2F0aXNmYWN0b3J5IG5ldyBwb2ludGVyIDooLAorICAgICAgICAgICAgLy8gc28gZW5kIHRoZSBnZXN0dXJlCisgICAgICAgICAgICBoYW5kbGVQb2ludGVyVXAoZXYpOworICAgICAgICB9CisgICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIGhhbmRsZVBvaW50ZXJVcChNb3Rpb25FdmVudCBldikgeworICAgICAgICBpbnQgcG9pbnRlckluZGV4ID0gZXYuZmluZFBvaW50ZXJJbmRleChtQWN0aXZlUG9pbnRlcklkKTsKKyAgICAgICAgZmxvYXQgbmV3WSA9IGV2LmdldFkocG9pbnRlckluZGV4KTsKKyAgICAgICAgaW50IGRlbHRhWSA9IChpbnQpIChuZXdZIC0gbUluaXRpYWxZKTsKKworICAgICAgICBpZiAobVZlbG9jaXR5VHJhY2tlciAhPSBudWxsKSB7CisgICAgICAgICAgICBtVmVsb2NpdHlUcmFja2VyLmNvbXB1dGVDdXJyZW50VmVsb2NpdHkoMTAwMCwgbU1heGltdW1WZWxvY2l0eSk7CisgICAgICAgICAgICBtWVZlbG9jaXR5ID0gKGludCkgbVZlbG9jaXR5VHJhY2tlci5nZXRZVmVsb2NpdHkobUFjdGl2ZVBvaW50ZXJJZCk7CisgICAgICAgIH0KKworICAgICAgICBpZiAobVZlbG9jaXR5VHJhY2tlciAhPSBudWxsKSB7CisgICAgICAgICAgICBtVmVsb2NpdHlUcmFja2VyLnJlY3ljbGUoKTsKKyAgICAgICAgICAgIG1WZWxvY2l0eVRyYWNrZXIgPSBudWxsOworICAgICAgICB9CisKKyAgICAgICAgaWYgKGRlbHRhWSA+IG1Td2lwZVRocmVzaG9sZCAmJiBtU3dpcGVHZXN0dXJlVHlwZSA9PSBHRVNUVVJFX1NMSURFX0RPV04KKyAgICAgICAgICAgICAgICAmJiBtU3RhY2tTbGlkZXIubU1vZGUgPT0gU3RhY2tTbGlkZXIuTk9STUFMX01PREUpIHsKKyAgICAgICAgICAgIC8vIFN3aXBlIHRocmVzaG9sZCBleGNlZWRlZCwgc3dpcGUgZG93bgorICAgICAgICAgICAgc2hvd05leHQoKTsKKyAgICAgICAgICAgIG1IaWdobGlnaHQuYnJpbmdUb0Zyb250KCk7CisgICAgICAgIH0gZWxzZSBpZiAoZGVsdGFZIDwgLW1Td2lwZVRocmVzaG9sZCAmJiBtU3dpcGVHZXN0dXJlVHlwZSA9PSBHRVNUVVJFX1NMSURFX1VQCisgICAgICAgICAgICAgICAgJiYgbVN0YWNrU2xpZGVyLm1Nb2RlID09IFN0YWNrU2xpZGVyLk5PUk1BTF9NT0RFKSB7CisgICAgICAgICAgICAvLyBTd2lwZSB0aHJlc2hvbGQgZXhjZWVkZWQsIHN3aXBlIHVwCisgICAgICAgICAgICBzaG93UHJldmlvdXMoKTsKKyAgICAgICAgICAgIG1IaWdobGlnaHQuYnJpbmdUb0Zyb250KCk7CisgICAgICAgIH0gZWxzZSBpZiAobVN3aXBlR2VzdHVyZVR5cGUgPT0gR0VTVFVSRV9TTElERV9VUCkgeworICAgICAgICAgICAgLy8gRGlkbid0IHN3aXBlIHVwIGZhciBlbm91Z2gsIHNuYXAgYmFjayBkb3duCisgICAgICAgICAgICBpbnQgZHVyYXRpb24gPQorICAgICAgICAgICAgICAgIE1hdGgucm91bmQobVN0YWNrU2xpZGVyLmdldER1cmF0aW9uRm9yTmV1dHJhbFBvc2l0aW9uKCkqREVGQVVMVF9BTklNQVRJT05fRFVSQVRJT04pOworCisgICAgICAgICAgICBTdGFja1NsaWRlciBhbmltYXRpb25TbGlkZXIgPSBuZXcgU3RhY2tTbGlkZXIobVN0YWNrU2xpZGVyKTsKKyAgICAgICAgICAgIFByb3BlcnR5QW5pbWF0b3Igc25hcEJhY2tZID0gbmV3IFByb3BlcnR5QW5pbWF0b3IoZHVyYXRpb24sIGFuaW1hdGlvblNsaWRlciwKKyAgICAgICAgICAgICAgICAgICAgIllQcm9ncmVzcyIsIG1TdGFja1NsaWRlci5nZXRZUHJvZ3Jlc3MoKSwgMCk7CisgICAgICAgICAgICBzbmFwQmFja1kuc2V0SW50ZXJwb2xhdG9yKG5ldyBMaW5lYXJJbnRlcnBvbGF0b3IoKSk7CisgICAgICAgICAgICBzbmFwQmFja1kuc3RhcnQoKTsKKyAgICAgICAgICAgIFByb3BlcnR5QW5pbWF0b3Igc25hcEJhY2tYID0gbmV3IFByb3BlcnR5QW5pbWF0b3IoZHVyYXRpb24sIGFuaW1hdGlvblNsaWRlciwKKyAgICAgICAgICAgICAgICAgICAgIlhQcm9ncmVzcyIsIG1TdGFja1NsaWRlci5nZXRYUHJvZ3Jlc3MoKSwgMCk7CisgICAgICAgICAgICBzbmFwQmFja1guc2V0SW50ZXJwb2xhdG9yKG5ldyBMaW5lYXJJbnRlcnBvbGF0b3IoKSk7CisgICAgICAgICAgICBzbmFwQmFja1guc3RhcnQoKTsKKyAgICAgICAgfSBlbHNlIGlmIChtU3dpcGVHZXN0dXJlVHlwZSA9PSBHRVNUVVJFX1NMSURFX0RPV04pIHsKKyAgICAgICAgICAgIC8vIERpZG4ndCBzd2lwZSBkb3duIGZhciBlbm91Z2gsIHNuYXAgYmFjayB1cAorICAgICAgICAgICAgaW50IGR1cmF0aW9uID0gTWF0aC5yb3VuZChtU3RhY2tTbGlkZXIuZ2V0RHVyYXRpb25Gb3JPZmZzY3JlZW5Qb3NpdGlvbigpKgorICAgICAgICAgICAgICAgICAgICBERUZBVUxUX0FOSU1BVElPTl9EVVJBVElPTik7CisKKyAgICAgICAgICAgIFN0YWNrU2xpZGVyIGFuaW1hdGlvblNsaWRlciA9IG5ldyBTdGFja1NsaWRlcihtU3RhY2tTbGlkZXIpOworICAgICAgICAgICAgUHJvcGVydHlBbmltYXRvciBzbmFwQmFja1kgPSBuZXcgUHJvcGVydHlBbmltYXRvcihkdXJhdGlvbiwgYW5pbWF0aW9uU2xpZGVyLAorICAgICAgICAgICAgICAgICAgICAiWVByb2dyZXNzIiwgbVN0YWNrU2xpZGVyLmdldFlQcm9ncmVzcygpLCAxKTsKKyAgICAgICAgICAgIHNuYXBCYWNrWS5zZXRJbnRlcnBvbGF0b3IobmV3IExpbmVhckludGVycG9sYXRvcigpKTsKKyAgICAgICAgICAgIHNuYXBCYWNrWS5zdGFydCgpOworICAgICAgICAgICAgUHJvcGVydHlBbmltYXRvciBzbmFwQmFja1ggPSBuZXcgUHJvcGVydHlBbmltYXRvcihkdXJhdGlvbiwgYW5pbWF0aW9uU2xpZGVyLAorICAgICAgICAgICAgICAgICAgICAiWFByb2dyZXNzIiwgbVN0YWNrU2xpZGVyLmdldFhQcm9ncmVzcygpLCAwKTsKKyAgICAgICAgICAgIHNuYXBCYWNrWC5zZXRJbnRlcnBvbGF0b3IobmV3IExpbmVhckludGVycG9sYXRvcigpKTsKKyAgICAgICAgICAgIHNuYXBCYWNrWC5zdGFydCgpOworICAgICAgICB9CisKKyAgICAgICAgbUFjdGl2ZVBvaW50ZXJJZCA9IElOVkFMSURfUE9JTlRFUjsKKyAgICAgICAgbVN3aXBlR2VzdHVyZVR5cGUgPSBHRVNUVVJFX05PTkU7CisgICAgfQorCisgICAgcHJpdmF0ZSBjbGFzcyBTdGFja1NsaWRlciB7CisgICAgICAgIFZpZXcgbVZpZXc7CisgICAgICAgIGZsb2F0IG1ZUHJvZ3Jlc3M7CisgICAgICAgIGZsb2F0IG1YUHJvZ3Jlc3M7CisKKyAgICAgICAgc3RhdGljIGZpbmFsIGludCBOT1JNQUxfTU9ERSA9IDA7CisgICAgICAgIHN0YXRpYyBmaW5hbCBpbnQgQkVHSU5OSU5HX09GX1NUQUNLX01PREUgPSAxOworICAgICAgICBzdGF0aWMgZmluYWwgaW50IEVORF9PRl9TVEFDS19NT0RFID0gMjsKKworICAgICAgICBpbnQgbU1vZGUgPSBOT1JNQUxfTU9ERTsKKworICAgICAgICBwdWJsaWMgU3RhY2tTbGlkZXIoKSB7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgU3RhY2tTbGlkZXIoU3RhY2tTbGlkZXIgY29weSkgeworICAgICAgICAgICAgbVZpZXcgPSBjb3B5Lm1WaWV3OworICAgICAgICAgICAgbVlQcm9ncmVzcyA9IGNvcHkubVlQcm9ncmVzczsKKyAgICAgICAgICAgIG1YUHJvZ3Jlc3MgPSBjb3B5Lm1YUHJvZ3Jlc3M7CisgICAgICAgICAgICBtTW9kZSA9IGNvcHkubU1vZGU7CisgICAgICAgIH0KKworICAgICAgICBwcml2YXRlIGZsb2F0IGN1YmljKGZsb2F0IHIpIHsKKyAgICAgICAgICAgIHJldHVybiAoZmxvYXQpIChNYXRoLnBvdygyKnItMSwgMykgKyAxKS8yLjBmOworICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSBmbG9hdCBoaWdobGlnaHRBbHBoYUludGVycG9sYXRvcihmbG9hdCByKSB7CisgICAgICAgICAgICBmbG9hdCBwaXZvdCA9IDAuNGY7CisgICAgICAgICAgICBpZiAociA8IHBpdm90KSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIDAuODVmKmN1YmljKHIvcGl2b3QpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gMC44NWYqY3ViaWMoMSAtIChyLXBpdm90KS8oMS1waXZvdCkpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSBmbG9hdCB2aWV3QWxwaGFJbnRlcnBvbGF0b3IoZmxvYXQgcikgeworICAgICAgICAgICAgZmxvYXQgcGl2b3QgPSAwLjNmOworICAgICAgICAgICAgaWYgKHIgPiBwaXZvdCkgeworICAgICAgICAgICAgICAgIHJldHVybiAociAtIHBpdm90KS8oMSAtIHBpdm90KTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIDA7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBwcml2YXRlIGZsb2F0IHJvdGF0aW9uSW50ZXJwb2xhdG9yKGZsb2F0IHIpIHsKKyAgICAgICAgICAgIGZsb2F0IHBpdm90ID0gMC4yZjsKKyAgICAgICAgICAgIGlmIChyIDwgcGl2b3QpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gMDsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIChyLXBpdm90KS8oMS1waXZvdCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICB2b2lkIHNldFZpZXcoVmlldyB2KSB7CisgICAgICAgICAgICBtVmlldyA9IHY7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCBzZXRZUHJvZ3Jlc3MoZmxvYXQgcikgeworICAgICAgICAgICAgLy8gZW5mb3JjZSByIGJldHdlZW4gMCBhbmQgMQorICAgICAgICAgICAgciA9IE1hdGgubWluKDEuMGYsIHIpOworICAgICAgICAgICAgciA9IE1hdGgubWF4KDAsIHIpOworCisgICAgICAgICAgICBtWVByb2dyZXNzID0gcjsKKyAgICAgICAgICAgIGZpbmFsIExheW91dFBhcmFtcyB2aWV3THAgPSAoTGF5b3V0UGFyYW1zKSBtVmlldy5nZXRMYXlvdXRQYXJhbXMoKTsKKyAgICAgICAgICAgIGZpbmFsIExheW91dFBhcmFtcyBoaWdobGlnaHRMcCA9IChMYXlvdXRQYXJhbXMpIG1IaWdobGlnaHQuZ2V0TGF5b3V0UGFyYW1zKCk7CisKKyAgICAgICAgICAgIHN3aXRjaCAobU1vZGUpIHsKKyAgICAgICAgICAgICAgICBjYXNlIE5PUk1BTF9NT0RFOgorICAgICAgICAgICAgICAgICAgICB2aWV3THAuc2V0VmVydGljYWxPZmZzZXQoTWF0aC5yb3VuZCgtciptVmlld0hlaWdodCkpOworICAgICAgICAgICAgICAgICAgICBoaWdobGlnaHRMcC5zZXRWZXJ0aWNhbE9mZnNldChNYXRoLnJvdW5kKC1yKm1WaWV3SGVpZ2h0KSk7CisgICAgICAgICAgICAgICAgICAgIG1IaWdobGlnaHQuc2V0QWxwaGEoaGlnaGxpZ2h0QWxwaGFJbnRlcnBvbGF0b3IocikpOworCisgICAgICAgICAgICAgICAgICAgIGZsb2F0IGFscGhhID0gdmlld0FscGhhSW50ZXJwb2xhdG9yKDEtcik7CisKKyAgICAgICAgICAgICAgICAgICAgLy8gV2UgbWFrZSBzdXJlIHRoYXQgdmlld3Mgd2hpY2ggY2FuJ3QgYmUgc2VlbiAoaGF2ZSAwIGFscGhhKSBhcmUgYWxzbyBpbnZpc2libGUKKyAgICAgICAgICAgICAgICAgICAgLy8gc28gdGhhdCB0aGV5IGRvbid0IGludGVyZmVyZSB3aXRoIGNsaWNrIGV2ZW50cy4KKyAgICAgICAgICAgICAgICAgICAgaWYgKG1WaWV3LmdldEFscGhhKCkgPT0gMCAmJiBhbHBoYSAhPSAwICYmIG1WaWV3LmdldFZpc2liaWxpdHkoKSAhPSBWSVNJQkxFKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBtVmlldy5zZXRWaXNpYmlsaXR5KFZJU0lCTEUpOworICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGFscGhhID09IDAgJiYgbVZpZXcuZ2V0QWxwaGEoKSAhPSAwCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgJiYgbVZpZXcuZ2V0VmlzaWJpbGl0eSgpID09IFZJU0lCTEUpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1WaWV3LnNldFZpc2liaWxpdHkoSU5WSVNJQkxFKTsKKyAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgIG1WaWV3LnNldEFscGhhKGFscGhhKTsKKyAgICAgICAgICAgICAgICAgICAgbVZpZXcuc2V0Um90YXRpb25YKDkwLjBmKnJvdGF0aW9uSW50ZXJwb2xhdG9yKHIpKTsKKyAgICAgICAgICAgICAgICAgICAgbUhpZ2hsaWdodC5zZXRSb3RhdGlvblgoOTAuMGYqcm90YXRpb25JbnRlcnBvbGF0b3IocikpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIEJFR0lOTklOR19PRl9TVEFDS19NT0RFOgorICAgICAgICAgICAgICAgICAgICByID0gciowLjJmOworICAgICAgICAgICAgICAgICAgICB2aWV3THAuc2V0VmVydGljYWxPZmZzZXQoTWF0aC5yb3VuZCgtciptVmlld0hlaWdodCkpOworICAgICAgICAgICAgICAgICAgICBoaWdobGlnaHRMcC5zZXRWZXJ0aWNhbE9mZnNldChNYXRoLnJvdW5kKC1yKm1WaWV3SGVpZ2h0KSk7CisgICAgICAgICAgICAgICAgICAgIG1IaWdobGlnaHQuc2V0QWxwaGEoaGlnaGxpZ2h0QWxwaGFJbnRlcnBvbGF0b3IocikpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIEVORF9PRl9TVEFDS19NT0RFOgorICAgICAgICAgICAgICAgICAgICByID0gKDEtcikqMC4yZjsKKyAgICAgICAgICAgICAgICAgICAgdmlld0xwLnNldFZlcnRpY2FsT2Zmc2V0KE1hdGgucm91bmQociptVmlld0hlaWdodCkpOworICAgICAgICAgICAgICAgICAgICBoaWdobGlnaHRMcC5zZXRWZXJ0aWNhbE9mZnNldChNYXRoLnJvdW5kKHIqbVZpZXdIZWlnaHQpKTsKKyAgICAgICAgICAgICAgICAgICAgbUhpZ2hsaWdodC5zZXRBbHBoYShoaWdobGlnaHRBbHBoYUludGVycG9sYXRvcihyKSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgc2V0WFByb2dyZXNzKGZsb2F0IHIpIHsKKyAgICAgICAgICAgIC8vIGVuZm9yY2UgciBiZXR3ZWVuIDAgYW5kIDEKKyAgICAgICAgICAgIHIgPSBNYXRoLm1pbigyLjBmLCByKTsKKyAgICAgICAgICAgIHIgPSBNYXRoLm1heCgtMi4wZiwgcik7CisKKyAgICAgICAgICAgIG1YUHJvZ3Jlc3MgPSByOworCisgICAgICAgICAgICBmaW5hbCBMYXlvdXRQYXJhbXMgdmlld0xwID0gKExheW91dFBhcmFtcykgbVZpZXcuZ2V0TGF5b3V0UGFyYW1zKCk7CisgICAgICAgICAgICBmaW5hbCBMYXlvdXRQYXJhbXMgaGlnaGxpZ2h0THAgPSAoTGF5b3V0UGFyYW1zKSBtSGlnaGxpZ2h0LmdldExheW91dFBhcmFtcygpOworCisgICAgICAgICAgICByICo9IDAuMmY7CisgICAgICAgICAgICB2aWV3THAuc2V0SG9yaXpvbnRhbE9mZnNldChNYXRoLnJvdW5kKHIqbVZpZXdIZWlnaHQpKTsKKyAgICAgICAgICAgIGhpZ2hsaWdodExwLnNldEhvcml6b250YWxPZmZzZXQoTWF0aC5yb3VuZChyKm1WaWV3SGVpZ2h0KSk7CisgICAgICAgIH0KKworICAgICAgICB2b2lkIHNldE1vZGUoaW50IG1vZGUpIHsKKyAgICAgICAgICAgIG1Nb2RlID0gbW9kZTsKKyAgICAgICAgfQorCisgICAgICAgIGZsb2F0IGdldER1cmF0aW9uRm9yTmV1dHJhbFBvc2l0aW9uKCkgeworICAgICAgICAgICAgcmV0dXJuIGdldER1cmF0aW9uKGZhbHNlKTsKKyAgICAgICAgfQorCisgICAgICAgIGZsb2F0IGdldER1cmF0aW9uRm9yT2Zmc2NyZWVuUG9zaXRpb24oKSB7CisgICAgICAgICAgICByZXR1cm4gZ2V0RHVyYXRpb24obU1vZGUgPT0gRU5EX09GX1NUQUNLX01PREUgPyBmYWxzZSA6IHRydWUpOworICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSBmbG9hdCBnZXREdXJhdGlvbihib29sZWFuIGludmVydCkgeworICAgICAgICAgICAgaWYgKG1WaWV3ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBmaW5hbCBMYXlvdXRQYXJhbXMgdmlld0xwID0gKExheW91dFBhcmFtcykgbVZpZXcuZ2V0TGF5b3V0UGFyYW1zKCk7CisKKyAgICAgICAgICAgICAgICBmbG9hdCBkID0gKGZsb2F0KSBNYXRoLnNxcnQoTWF0aC5wb3codmlld0xwLmhvcml6b250YWxPZmZzZXQsMikgKworICAgICAgICAgICAgICAgICAgICAgICAgTWF0aC5wb3codmlld0xwLnZlcnRpY2FsT2Zmc2V0LDIpKTsKKyAgICAgICAgICAgICAgICBmbG9hdCBtYXhkID0gKGZsb2F0KSBNYXRoLnNxcnQoTWF0aC5wb3cobVZpZXdIZWlnaHQsIDIpICsKKyAgICAgICAgICAgICAgICAgICAgICAgIE1hdGgucG93KDAuNGYqbVZpZXdIZWlnaHQsIDIpKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gaW52ZXJ0ID8gKDEtZC9tYXhkKSA6IGQvbWF4ZDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHJldHVybiAwOworICAgICAgICB9CisKKyAgICAgICAgZmxvYXQgZ2V0WVByb2dyZXNzKCkgeworICAgICAgICAgICAgcmV0dXJuIG1ZUHJvZ3Jlc3M7CisgICAgICAgIH0KKworICAgICAgICBmbG9hdCBnZXRYUHJvZ3Jlc3MoKSB7CisgICAgICAgICAgICByZXR1cm4gbVhQcm9ncmVzczsKKyAgICAgICAgfQorCisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgb25SZW1vdGVBZGFwdGVyQ29ubmVjdGVkKCkgeworICAgICAgICBzdXBlci5vblJlbW90ZUFkYXB0ZXJDb25uZWN0ZWQoKTsKKyAgICAgICAgc2V0RGlzcGxheWVkQ2hpbGQobVdoaWNoQ2hpbGQpOworICAgIH0KKworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIFBhaW50IHNIb2xvZ3JhcGhpY1BhaW50ID0gbmV3IFBhaW50KCk7CisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgUGFpbnQgc0VyYXNlUGFpbnQgPSBuZXcgUGFpbnQoKTsKKyAgICBwcml2YXRlIHN0YXRpYyBib29sZWFuIHNQYWludHNJbml0aWFsaXplZCA9IGZhbHNlOworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGZsb2F0IFNUUk9LRV9XSURUSCA9IDMuMGY7CisKKyAgICBzdGF0aWMgdm9pZCBpbml0aWFsaXplUGFpbnRzKCkgeworICAgICAgICBzSG9sb2dyYXBoaWNQYWludC5zZXRDb2xvcigweGZmNjY5OWZmKTsKKyAgICAgICAgc0hvbG9ncmFwaGljUGFpbnQuc2V0RmlsdGVyQml0bWFwKHRydWUpOworICAgICAgICBzRXJhc2VQYWludC5zZXRYZmVybW9kZShuZXcgUG9ydGVyRHVmZlhmZXJtb2RlKFBvcnRlckR1ZmYuTW9kZS5EU1RfT1VUKSk7CisgICAgICAgIHNFcmFzZVBhaW50LnNldEZpbHRlckJpdG1hcCh0cnVlKTsKKyAgICAgICAgc1BhaW50c0luaXRpYWxpemVkID0gdHJ1ZTsKKyAgICB9CisKKyAgICBzdGF0aWMgQml0bWFwIGNyZWF0ZU91dGxpbmUoVmlldyB2KSB7CisgICAgICAgIGlmICh2LmdldE1lYXN1cmVkV2lkdGgoKSA9PSAwIHx8IHYuZ2V0TWVhc3VyZWRIZWlnaHQoKSA9PSAwKSB7CisgICAgICAgICAgICByZXR1cm4gbnVsbDsKKyAgICAgICAgfQorCisgICAgICAgIEJpdG1hcCBiaXRtYXAgPSBCaXRtYXAuY3JlYXRlQml0bWFwKHYuZ2V0TWVhc3VyZWRXaWR0aCgpLCB2LmdldE1lYXN1cmVkSGVpZ2h0KCksCisgICAgICAgICAgICAgICAgQml0bWFwLkNvbmZpZy5BUkdCXzg4ODgpOworICAgICAgICBDYW52YXMgY2FudmFzID0gbmV3IENhbnZhcyhiaXRtYXApOworCisgICAgICAgIGZsb2F0IHJvdGF0aW9uWCA9IHYuZ2V0Um90YXRpb25YKCk7CisgICAgICAgIHYuc2V0Um90YXRpb25YKDApOworICAgICAgICBjYW52YXMuY29uY2F0KHYuZ2V0TWF0cml4KCkpOworICAgICAgICB2LmRyYXcoY2FudmFzKTsKKyAgICAgICAgdi5zZXRSb3RhdGlvblgocm90YXRpb25YKTsKKworICAgICAgICBCaXRtYXAgb3V0bGluZUJpdG1hcCA9IEJpdG1hcC5jcmVhdGVCaXRtYXAodi5nZXRNZWFzdXJlZFdpZHRoKCksIHYuZ2V0TWVhc3VyZWRIZWlnaHQoKSwKKyAgICAgICA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A9IGZhbHNlOwogICAgIAotICAgIHByaXZhdGUgc3RhdGljIGludCBQUklPUklUWSA9IDEwMDsKKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgUFJJT1JJVFkgPSAxMDA7CiAKKyAgICBwcml2YXRlIGludCBtQ3VycmVudEFscGhhID0gMjU1OyAgICAKICAgICBwcml2YXRlIENvbG9yU3RhdGVMaXN0IG1UZXh0Q29sb3I7CiAgICAgcHJpdmF0ZSBpbnQgbUN1clRleHRDb2xvcjsKICAgICBwcml2YXRlIENvbG9yU3RhdGVMaXN0IG1IaW50VGV4dENvbG9yOwpAQCAtMzIxLDYgKzMyOSw3IEBACiAgICAgICAgIHRoaXMoY29udGV4dCwgYXR0cnMsIGNvbS5hbmRyb2lkLmludGVybmFsLlIuYXR0ci50ZXh0Vmlld1N0eWxlKTsKICAgICB9CiAKKyAgICBAU3VwcHJlc3NXYXJuaW5ncygiZGVwcmVjYXRpb24iKQogICAgIHB1YmxpYyBUZXh0VmlldyhDb250ZXh0IGNvbnRleHQsCiAgICAgICAgICAgICAgICAgICAgIEF0dHJpYnV0ZVNldCBhdHRycywKICAgICAgICAgICAgICAgICAgICAgaW50IGRlZlN0eWxlKSB7CkBAIC02OTUsOSArNzA0LDkgQEAKICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICBzZXRJbnB1dEV4dHJhcyhhLmdldFJlc291cmNlSWQoYXR0ciwgMCkpOwogICAgICAgICAgICAgICAgIH0gY2F0Y2ggKFhtbFB1bGxQYXJzZXJFeGNlcHRpb24gZSkgewotICAgICAgICAgICAgICAgICAgICBMb2cudygiVGV4dFZpZXciLCAiRmFpbHVyZSByZWFkaW5nIGlucHV0IGV4dHJhcyIsIGUpOworICAgICAgICAgICAgICAgICAgICBMb2cudyhMT0dfVEFHLCAiRmFpbHVyZSByZWFkaW5nIGlucHV0IGV4dHJhcyIsIGUpOwogICAgICAgICAgICAgICAgIH0gY2F0Y2ggKElPRXhjZXB0aW9uIGUpIHsKLSAgICAgICAgICAgICAgICAgICAgTG9nLncoIlRleHRWaWV3IiwgIkZhaWx1cmUgcmVhZGluZyBpbnB1dCBleHRyYXMiLCBlKTsKKyAgICAgICAgICAgICAgICAgICAgTG9nLncoTE9HX1RBRywgIkZhaWx1cmUgcmVhZGluZyBpbnB1dCBleHRyYXMiLCBlKTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICB9CkBAIC03MTQsNyArNzIzLDcgQEAKICAgICAgICAgfQogCiAgICAgICAgIGlmIChpbnB1dE1ldGhvZCAhPSBudWxsKSB7Ci0gICAgICAgICAgICBDbGFzcyBjOworICAgICAgICAgICAgQ2xhc3M8Pz4gYzsKIAogICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICBjID0gQ2xhc3MuZm9yTmFtZShpbnB1dE1ldGhvZC50b1N0cmluZygpKTsKQEAgLTkyMyw2ICs5MzIsOCBAQAogICAgICAgICBzZXRGb2N1c2FibGUoZm9jdXNhYmxlKTsKICAgICAgICAgc2V0Q2xpY2thYmxlKGNsaWNrYWJsZSk7CiAgICAgICAgIHNldExvbmdDbGlja2FibGUobG9uZ0NsaWNrYWJsZSk7CisKKyAgICAgICAgcHJlcGFyZUN1cnNvckNvbnRyb2xsZXJzKCk7CiAgICAgfQogCiAgICAgcHJpdmF0ZSB2b2lkIHNldFR5cGVmYWNlQnlJbmRleChpbnQgdHlwZWZhY2VJbmRleCwgaW50IHN0eWxlSW5kZXgpIHsKQEAgLTExMjgsNiArMTEzOSw5IEBACiAgICAgICAgICAgICBzZXRUZXh0KG1UZXh0KTsKIAogICAgICAgICBmaXhGb2N1c2FibGVBbmRDbGlja2FibGVTZXR0aW5ncygpOworCisgICAgICAgIC8vIFNlbGVjdGlvbk1vZGlmaWVyQ3Vyc29yQ29udHJvbGxlciBkZXBlbmRzIG9uIGNhblNlbGVjdFRleHQsIHdoaWNoIGRlcGVuZHMgb24gbU1vdmVtZW50CisgICAgICAgIHByZXBhcmVDdXJzb3JDb250cm9sbGVycygpOwogICAgIH0KIAogICAgIHByaXZhdGUgdm9pZCBmaXhGb2N1c2FibGVBbmRDbGlja2FibGVTZXR0aW5ncygpIHsKQEAgLTIzMzUsNiArMjM0OSw3IEBACiAgICAgICAgICAgICByZXR1cm4gc3RyICsgIn0iOwogICAgICAgICB9CiAKKyAgICAgICAgQFN1cHByZXNzV2FybmluZ3MoImhpZGluZyIpCiAgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgUGFyY2VsYWJsZS5DcmVhdG9yPFNhdmVkU3RhdGU+IENSRUFUT1IKICAgICAgICAgICAgICAgICA9IG5ldyBQYXJjZWxhYmxlLkNyZWF0b3I8U2F2ZWRTdGF0ZT4oKSB7CiAgICAgICAgICAgICBwdWJsaWMgU2F2ZWRTdGF0ZSBjcmVhdGVGcm9tUGFyY2VsKFBhcmNlbCBpbikgewpAQCAtMjM2OSw4ICsyMzg0LDggQEAKICAgICAgICAgaW50IGVuZCA9IDA7CiAKICAgICAgICAgaWYgKG1UZXh0ICE9IG51bGwpIHsKLSAgICAgICAgICAgIHN0YXJ0ID0gU2VsZWN0aW9uLmdldFNlbGVjdGlvblN0YXJ0KG1UZXh0KTsKLSAgICAgICAgICAgIGVuZCA9IFNlbGVjdGlvbi5nZXRTZWxlY3Rpb25FbmQobVRleHQpOworICAgICAgICAgICAgc3RhcnQgPSBnZXRTZWxlY3Rpb25TdGFydCgpOworICAgICAgICAgICAgZW5kID0gZ2V0U2VsZWN0aW9uRW5kKCk7CiAgICAgICAgICAgICBpZiAoc3RhcnQgPj0gMCB8fCBlbmQgPj0gMCkgewogICAgICAgICAgICAgICAgIC8vIE9yIHNhdmUgc3RhdGUgaWYgdGhlcmUgaXMgYSBzZWxlY3Rpb24KICAgICAgICAgICAgICAgICBzYXZlID0gdHJ1ZTsKQEAgLTI0NDIsNyArMjQ1Nyw3IEBACiAgICAgICAgICAgICAgICAgICAgICAgICByZXN0b3JlZCA9ICIocmVzdG9yZWQpICI7CiAgICAgICAgICAgICAgICAgICAgIH0KIAotICAgICAgICAgICAgICAgICAgICBMb2cuZSgiVGV4dFZpZXciLCAiU2F2ZWQgY3Vyc29yIHBvc2l0aW9uICIgKyBzcy5zZWxTdGFydCArCisgICAgICAgICAgICAgICAgICAgIExvZy5lKExPR19UQUcsICJTYXZlZCBjdXJzb3IgcG9zaXRpb24gIiArIHNzLnNlbFN0YXJ0ICsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIi8iICsgc3Muc2VsRW5kICsgIiBvdXQgb2YgcmFuZ2UgZm9yICIgKyByZXN0b3JlZCArCiAgICAgICAgICAgICAgICAgICAgICAgICAgICJ0ZXh0ICIgKyBtVGV4dCk7CiAgICAgICAgICAgICAgICAgfSBlbHNlIHsKQEAgLTI2OTQsNiArMjcwOSw5IEBACiAgICAgICAgIGlmIChuZWVkRWRpdGFibGVGb3JOb3RpZmljYXRpb24pIHsKICAgICAgICAgICAgIHNlbmRBZnRlclRleHRDaGFuZ2VkKChFZGl0YWJsZSkgdGV4dCk7CiAgICAgICAgIH0KKworICAgICAgICAvLyBTZWxlY3Rpb25Nb2RpZmllckN1cnNvckNvbnRyb2xsZXIgZGVwZW5kcyBvbiBjYW5TZWxlY3RUZXh0LCB3aGljaCBkZXBlbmRzIG9uIHRleHQKKyAgICAgICAgcHJlcGFyZUN1cnNvckNvbnRyb2xsZXJzKCk7CiAgICAgfQogCiAgICAgLyoqCkBAIC0yNzU2LDYgKzI3NzQsNyBAQAogICAgICAgICAgICAgcmV0dXJuIG1DaGFyc1tvZmYgKyBtU3RhcnRdOwogICAgICAgICB9CiAKKyAgICAgICAgQE92ZXJyaWRlCiAgICAgICAgIHB1YmxpYyBTdHJpbmcgdG9TdHJpbmcoKSB7CiAgICAgICAgICAgICByZXR1cm4gbmV3IFN0cmluZyhtQ2hhcnMsIG1TdGFydCwgbUxlbmd0aCk7CiAgICAgICAgIH0KQEAgLTI3ODEsNiArMjgwMCwxNCBAQAogICAgICAgICAgICAgYy5kcmF3VGV4dChtQ2hhcnMsIHN0YXJ0ICsgbVN0YXJ0LCBlbmQgLSBzdGFydCwgeCwgeSwgcCk7CiAgICAgICAgIH0KIAorICAgICAgICBwdWJsaWMgdm9pZCBkcmF3VGV4dFJ1bihDYW52YXMgYywgaW50IHN0YXJ0LCBpbnQgZW5kLAorICAgICAgICAgICAgICAgIGludCBjb250ZXh0U3RhcnQsIGludCBjb250ZXh0RW5kLCBmbG9hdCB4LCBmbG9hdCB5LCBpbnQgZmxhZ3MsIFBhaW50IHApIHsKKyAgICAgICAgICAgIGludCBjb3VudCA9IGVuZCAtIHN0YXJ0OworICAgICAgICAgICAgaW50IGNvbnRleHRDb3VudCA9IGNvbnRleHRFbmQgLSBjb250ZXh0U3RhcnQ7CisgICAgICAgICAgICBjLmRyYXdUZXh0UnVuKG1DaGFycywgc3RhcnQgKyBtU3RhcnQsIGNvdW50LCBjb250ZXh0U3RhcnQgKyBtU3RhcnQsCisgICAgICAgICAgICAgICAgICAgIGNvbnRleHRDb3VudCwgeCwgeSwgZmxhZ3MsIHApOworICAgICAgICB9CisKICAgICAgICAgcHVibGljIGZsb2F0IG1lYXN1cmVUZXh0KGludCBzdGFydCwgaW50IGVuZCwgUGFpbnQgcCkgewogICAgICAgICAgICAgcmV0dXJuIHAubWVhc3VyZVRleHQobUNoYXJzLCBzdGFydCArIG1TdGFydCwgZW5kIC0gc3RhcnQpOwogICAgICAgICB9CkBAIC0yNzg4LDYgKzI4MTUsMjMgQEAKICAgICAgICAgcHVibGljIGludCBnZXRUZXh0V2lkdGhzKGludCBzdGFydCwgaW50IGVuZCwgZmxvYXRbXSB3aWR0aHMsIFBhaW50IHApIHsKICAgICAgICAgICAgIHJldHVybiBwLmdldFRleHRXaWR0aHMobUNoYXJzLCBzdGFydCArIG1TdGFydCwgZW5kIC0gc3RhcnQsIHdpZHRocyk7CiAgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgZmxvYXQgZ2V0VGV4dFJ1bkFkdmFuY2VzKGludCBzdGFydCwgaW50IGVuZCwgaW50IGNvbnRleHRTdGFydCwKKyAgICAgICAgICAgICAgICBpbnQgY29udGV4dEVuZCwgaW50IGZsYWdzLCBmbG9hdFtdIGFkdmFuY2VzLCBpbnQgYWR2YW5jZXNJbmRleCwKKyAgICAgICAgICAgICAgICBQYWludCBwKSB7CisgICAgICAgICAgICBpbnQgY291bnQgPSBlbmQgLSBzdGFydDsKKyAgICAgICAgICAgIGludCBjb250ZXh0Q291bnQgPSBjb250ZXh0RW5kIC0gY29udGV4dFN0YXJ0OworICAgICAgICAgICAgcmV0dXJuIHAuZ2V0VGV4dFJ1bkFkdmFuY2VzKG1DaGFycywgc3RhcnQgKyBtU3RhcnQsIGNvdW50LAorICAgICAgICAgICAgICAgICAgICBjb250ZXh0U3RhcnQgKyBtU3RhcnQsIGNvbnRleHRDb3VudCwgZmxhZ3MsIGFkdmFuY2VzLAorICAgICAgICAgICAgICAgICAgICBhZHZhbmNlc0luZGV4KTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBpbnQgZ2V0VGV4dFJ1bkN1cnNvcihpbnQgY29udGV4dFN0YXJ0LCBpbnQgY29udGV4dEVuZCwgaW50IGZsYWdzLAorICAgICAgICAgICAgICAgIGludCBvZmZzZXQsIGludCBjdXJzb3JPcHQsIFBhaW50IHApIHsKKyAgICAgICAgICAgIGludCBjb250ZXh0Q291bnQgPSBjb250ZXh0RW5kIC0gY29udGV4dFN0YXJ0OworICAgICAgICAgICAgcmV0dXJuIHAuZ2V0VGV4dFJ1bkN1cnNvcihtQ2hhcnMsIGNvbnRleHRTdGFydCArIG1TdGFydCwKKyAgICAgICAgICAgICAgICAgICAgY29udGV4dENvdW50LCBmbGFncywgb2Zmc2V0ICsgbVN0YXJ0LCBjdXJzb3JPcHQpOworICAgICAgICB9CiAgICAgfQogCiAgICAgLyoqCkBAIC0yOTgxLDcgKzMwMjUsNyBAQAogICAgICAgICB9IGVsc2U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HNlbGVjdGlvbkNvbnRyb2xsZXIgPQorICAgICAgICAgICAgICAgICAgICAoU2VsZWN0aW9uTW9kaWZpZXJDdXJzb3JDb250cm9sbGVyKSBtU2VsZWN0aW9uTW9kaWZpZXJDdXJzb3JDb250cm9sbGVyOworICAgICAgICAgICAgICAgIGlmIChzZWxlY3Rpb25Db250cm9sbGVyLmlzU2VsZWN0aW9uU3RhcnREcmFnZ2VkKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgY3VycyA9IGdldFNlbGVjdGlvblN0YXJ0KCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQogCiAgICAgICAgICAgICAvKgogICAgICAgICAgICAgICogVE9ETzogVGhpcyBzaG91bGQgcmVhbGx5IG9ubHkga2VlcCB0aGUgZW5kIGluIHZpZXcgaWYKQEAgLTM2ODAsNiArMzczNSwxMCBAQAogICAgICAgICAgICAgY2hhbmdlZCA9IGJyaW5nVGV4dEludG9WaWV3KCk7CiAgICAgICAgIH0KIAorICAgICAgICBpZiAobVNob3VsZFN0YXJ0U2VsZWN0aW9uQWN0aW9uTW9kZSkgeworICAgICAgICAgICAgc3RhcnRTZWxlY3Rpb25BY3Rpb25Nb2RlKCk7CisgICAgICAgICAgICBtU2hvdWxkU3RhcnRTZWxlY3Rpb25BY3Rpb25Nb2RlID0gZmFsc2U7CisgICAgICAgIH0KICAgICAgICAgbVByZURyYXdTdGF0ZSA9IFBSRURSQVdfRE9ORTsKICAgICAgICAgcmV0dXJuICFjaGFuZ2VkOwogICAgIH0KQEAgLTM3OTksNiArMzg1OCwyMiBAQAogICAgIH0KIAogICAgIEBPdmVycmlkZQorICAgIHByb3RlY3RlZCBib29sZWFuIG9uU2V0QWxwaGEoaW50IGFscGhhKSB7CisgICAgICAgIGlmIChtTW92ZW1lbnQgPT0gbnVsbCAmJiBnZXRCYWNrZ3JvdW5kKCkgPT0gbnVsbCkgeworICAgICAgICAgICAgbUN1cnJlbnRBbHBoYSA9IGFscGhhOworICAgICAgICAgICAgZmluYWwgRHJhd2FibGVzIGRyID0gbURyYXdhYmxlczsKKyAgICAgICAgICAgIGlmIChkciAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgaWYgKGRyLm1EcmF3YWJsZUxlZnQgIT0gbnVsbCkgZHIubURyYXdhYmxlTGVmdC5zZXRBbHBoYShhbHBoYSk7CisgICAgICAgICAgICAgICAgaWYgKGRyLm1EcmF3YWJsZVRvcCAhPSBudWxsKSBkci5tRHJhd2FibGVUb3Auc2V0QWxwaGEoYWxwaGEpOworICAgICAgICAgICAgICAgIGlmIChkci5tRHJhd2FibGVSaWdodCAhPSBudWxsKSBkci5tRHJhd2FibGVSaWdodC5zZXRBbHBoYShhbHBoYSk7CisgICAgICAgICAgICAgICAgaWYgKGRyLm1EcmF3YWJsZUJvdHRvbSAhPSBudWxsKSBkci5tRHJhd2FibGVCb3R0b20uc2V0QWxwaGEoYWxwaGEpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIEBPdmVycmlkZQogICAgIHByb3RlY3RlZCB2b2lkIG9uRHJhdyhDYW52YXMgY2FudmFzKSB7CiAgICAgICAgIHJlc3RhcnRNYXJxdWVlSWZOZWVkZWQoKTsKIApAQCAtMzg5NSw2ICszOTcwLDcgQEAKICAgICAgICAgfQogCiAgICAgICAgIG1UZXh0UGFpbnQuc2V0Q29sb3IoY29sb3IpOworICAgICAgICBtVGV4dFBhaW50LnNldEFscGhhKG1DdXJyZW50QWxwaGEpOwogICAgICAgICBtVGV4dFBhaW50LmRyYXdhYmxlU3RhdGUgPSBnZXREcmF3YWJsZVN0YXRlKCk7CiAKICAgICAgICAgY2FudmFzLnNhdmUoKTsKQEAgLTM5NTQsOCArNDAzMCw4IEBACiAgICAgICAgIC8vICBYWFggVGhpcyBpcyBub3Qgc3RyaWN0bHkgdHJ1ZSAtLSBhIHByb2dyYW0gY291bGQg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5vbktleVVwKGtleUNvZGUsIGV2ZW50KTsKICAgICAgICAgfQogCisgICAgICAgIGhpZGVDb250cm9sbGVycygpOworICAgICAgICAKICAgICAgICAgc3dpdGNoIChrZXlDb2RlKSB7CiAgICAgICAgICAgICBjYXNlIEtleUV2ZW50LktFWUNPREVfRFBBRF9DRU5URVI6CiAgICAgICAgICAgICAgICAgLyoKQEAgLTQ0NzUsOCArNDU2MCw4IEBACiAgICAgICAgICAgICBvdXRBdHRycy5oaW50VGV4dCA9IG1IaW50OwogICAgICAgICAgICAgaWYgKG1UZXh0IGluc3RhbmNlb2YgRWRpdGFibGUpIHsKICAgICAgICAgICAgICAgICBJbnB1dENvbm5lY3Rpb24gaWMgPSBuZXcgRWRpdGFibGVJbnB1dENvbm5lY3Rpb24odGhpcyk7Ci0gICAgICAgICAgICAgICAgb3V0QXR0cnMuaW5pdGlhbFNlbFN0YXJ0ID0gU2VsZWN0aW9uLmdldFNlbGVjdGlvblN0YXJ0KG1UZXh0KTsKLSAgICAgICAgICAgICAgICBvdXRBdHRycy5pbml0aWFsU2VsRW5kID0gU2VsZWN0aW9uLmdldFNlbGVjdGlvbkVuZChtVGV4dCk7CisgICAgICAgICAgICAgICAgb3V0QXR0cnMuaW5pdGlhbFNlbFN0YXJ0ID0gZ2V0U2VsZWN0aW9uU3RhcnQoKTsKKyAgICAgICAgICAgICAgICBvdXRBdHRycy5pbml0aWFsU2VsRW5kID0gZ2V0U2VsZWN0aW9uRW5kKCk7CiAgICAgICAgICAgICAgICAgb3V0QXR0cnMuaW5pdGlhbENhcHNNb2RlID0gaWMuZ2V0Q3Vyc29yQ2Fwc01vZGUobUlucHV0VHlwZSk7CiAgICAgICAgICAgICAgICAgcmV0dXJuIGljOwogICAgICAgICAgICAgfQpAQCAtNDU2MSw4ICs0NjQ2LDggQEAKICAgICAgICAgICAgICAgICBvdXRUZXh0LmZsYWdzIHw9IEV4dHJhY3RlZFRleHQuRkxBR19TSU5HTEVfTElORTsKICAgICAgICAgICAgIH0KICAgICAgICAgICAgIG91dFRleHQuc3RhcnRPZmZzZXQgPSAwOwotICAgICAgICAgICAgb3V0VGV4dC5zZWxlY3Rpb25TdGFydCA9IFNlbGVjdGlvbi5nZXRTZWxlY3Rpb25TdGFydChjb250ZW50KTsKLSAgICAgICAgICAgIG91dFRleHQuc2VsZWN0aW9uRW5kID0gU2VsZWN0aW9uLmdldFNlbGVjdGlvbkVuZChjb250ZW50KTsKKyAgICAgICAgICAgIG91dFRleHQuc2VsZWN0aW9uU3RhcnQgPSBnZXRTZWxlY3Rpb25TdGFydCgpOworICAgICAgICAgICAgb3V0VGV4dC5zZWxlY3Rpb25FbmQgPSBnZXRTZWxlY3Rpb25FbmQoKTsKICAgICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgICB9CiAgICAgICAgIHJldHVybiBmYWxzZTsKQEAgLTQ1NzksNyArNDY2NCw3IEBACiAgICAgICAgICAgICAgICAgaWYgKHJlcSAhPSBudWxsKSB7CiAgICAgICAgICAgICAgICAgICAgIElucHV0TWV0aG9kTWFuYWdlciBpbW0gPSBJbnB1dE1ldGhvZE1hbmFnZXIucGVla0luc3RhbmNlKCk7CiAgICAgICAgICAgICAgICAgICAgIGlmIChpbW0gIT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKERFQlVHX0VYVFJBQ1QpIExvZy52KFRBRywgIlJldHJpZXZpbmcgZXh0cmFjdGVkIHN0YXJ0PSIKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChERUJVR19FWFRSQUNUKSBMb2cudihMT0dfVEFHLCAiUmV0cmlldmluZyBleHRyYWN0ZWQgc3RhcnQ9IgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIGltcy5tQ2hhbmdlZFN0YXJ0ICsgIiBlbmQ9IiArIGltcy5tQ2hhbmdlZEVuZAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArICIgZGVsdGE9IiArIGltcy5tQ2hhbmdlZERlbHRhKTsKICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpbXMubUNoYW5nZWRTdGFydCA8IDAgJiYgIWNvbnRlbnRDaGFuZ2VkKSB7CkBAIC00NTg3LDcgKzQ2NzIsNyBAQAogICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGV4dHJhY3RUZXh0SW50ZXJuYWwocmVxLCBpbXMubUNoYW5nZWRTdGFydCwgaW1zLm1DaGFuZ2VkRW5kLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbXMubUNoYW5nZWREZWx0YSwgaW1zLm1UbXBFeHRyYWN0ZWQpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKERFQlVHX0VYVFJBQ1QpIExvZy52KFRBRywgIlJlcG9ydGluZyBleHRyYWN0ZWQgc3RhcnQ9IgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChERUJVR19FWFRSQUNUKSBMb2cudihMT0dfVEFHLCAiUmVwb3J0aW5nIGV4dHJhY3RlZCBzdGFydD0iCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIGltcy5tVG1wRXh0cmFjdGVkLnBhcnRpYWxTdGFydE9mZnNldAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyAiIGVuZD0iICsgaW1zLm1UbXBFeHRyYWN0ZWQucGFydGlhbEVuZE9mZnNldAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyAiOiAiICsgaW1zLm1UbXBFeHRyYWN0ZWQudGV4dCk7CkBAIC00NzQxLDcgKzQ4MjYsNyBAQAogICAgIAogICAgIHZvaWQgdXBkYXRlQWZ0ZXJFZGl0KCkgewogICAgICAgICBpbnZhbGlkYXRlKCk7Ci0gICAgICAgIGludCBjdXJzID0gU2VsZWN0aW9uLmdldFNlbGVjdGlvblN0YXJ0KG1UZXh0KTsKKyAgICAgICAgaW50IGN1cnMgPSBnZXRTZWxlY3Rpb25TdGFydCgpOwogCiAgICAgICAgIGlmIChjdXJzID49IDAgfHwgKG1HcmF2aXR5ICYgR3Jhdml0eS5WRVJUSUNBTF9HUkFWSVRZX01BU0spID09CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdyYXZpdHkuQk9UVE9NKSB7CkBAIC00NzU2LDcgKzQ4NDEsNyBAQAogICAgICAgICAgICAgICAgIG1ha2VCbGluaygpOwogICAgICAgICAgICAgfQogICAgICAgICB9Ci0gICAgICAgIAorCiAgICAgICAgIGNoZWNrRm9yUmVzaXplKCk7CiAgICAgfQogICAgIApAQCAtNDg0Nyw2ICs0OTMyLDggQEAKICAgICAgICAgICAgICAgICBicmVhazsKIAogICAgICAgICAgICAgY2FzZSBHcmF2aXR5LlJJR0hUOgorICAgICAgICAgICAgICAgIC8vIE5vdGUsIExheW91dCByZXNvbHZlcyBBTElHTl9PUFBPU0lURSB0byBsZWZ0IG9yCisgICAgICAgICAgICAgICAgLy8gcmlnaHQgYmFzZWQgb24gdGhlIHBhcmFncmFwaCBkaXJlY3Rpb24uCiAgICAgICAgICAgICAgICAgYWxpZ25tZW50ID0gTGF5b3V0LkFsaWdubWVudC5BTElHTl9PUFBPU0lURTsKICAgICAgICAgICAgICAgICBicmVhazsKIApAQCAtNDg4Myw3ICs0OTcwLDYgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdywgYWxpZ25tZW50LCBtU3BhY2luZ011bHQsIG1TcGFjaW5nQWRkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib3JpbmcsIG1JbmNsdWRlUGFkKTsKICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAvLyBMb2cuZSgiYWFhIiwgIkJvcmluZzogIiArIG1UcmFuc2Zvcm1lZCk7CiAKICAgICAgICAgICAgICAgICAgICAgbVNhdmVkTGF5b3V0ID0gKEJvcmluZ0xheW91dCkgbUxheW91dDsKICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHNob3VsZEVsbGlwc2l6ZSAmJiBib3Jpbmcud2lkdGggPD0gdykgewpAQCAtNDkwOSw3ICs0OTk1LDYgQEAKICAgICAgICAgICAgICAgICAgICAgbUxheW91dCA9IG5ldyBTdGF0aWNMYXlvdXQobVRyYW5zZm9ybWVkLCBtVGV4dFBhaW50LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIHcsIGFsaWdubWVudCwgbVNwYWNpbmdNdWx0LCBtU3BhY2luZ0FkZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtSW5jbHVkZVBhZCk7Ci0gICAgICAgICAgICAgICAgICAgIC8vIExvZy5lKCJhYWEiLCAiQm9yaW5nIGJ1dCB3aWRlOiAiICsgbVRyYW5zZm9ybWVkKTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9IGVsc2UgaWYgKHNob3VsZEVsbGlwc2l6ZSkgewogICAgICAgICAgICAgICAgIG1MYXlvdXQgPSBuZXcgU3RhdGljTGF5b3V0KG1UcmFuc2Zvcm1lZCwKQEAgLTUwMDcsNiArNTA5Miw5IEBACiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogICAgICAgICB9CisKKyAgICAgICAgLy8gQ3Vyc29yQ29udHJvbGxlcnMgbmVlZCBhIG5vbi1udWxsIG1MYXlvdXQKKyAgICAgICAgcHJlcGFyZUN1cnNvckNvbnRyb2xsZXJzKCk7CiAgICAgfQogCiAgICAgcHJpdmF0ZSBib29sZWFuIGNvbXByZXNzVGV4dChmbG9hdCB3aWR0aCkgewpAQCAtNTQ3OCw3ICs1NTY2LDcgQEAKICAgICAgICAgLy8gRklYTUU6IElzIGl0IG9rYXkgdG8gdHJ1bmNhdGUgdGhpcywgb3Igc2hvdWxkIHdlIHJvdW5kPwogICAgICAgICBmaW5hbCBpbnQgeCA9IChpbnQpbUxheW91dC5nZXRQcmltYXJ5SG9yaXpvbnRhbChvZmZzZXQpOwogICAgICAgICBmaW5hbCBpbnQgdG9wID0gbUxheW91dC5nZXRMaW5lVG9wKGxpbmUpOwotICAgICAgICBmaW5hbCBpbnQgYm90dG9tID0gbUxheW91dC5nZXRMaW5lVG9wKGxpbmUrMSk7CisgICAgICAgIGZpbmFsIGludCBib3R0b20gPSBtTGF5b3V0LmdldExpbmVUb3AobGluZSArIDEpOwogCiAgICAgICAgIGludCBsZWZ0ID0gKGludCkgRmxvYXRNYXRoLmZsb29yKG1MYXlvdXQuZ2V0TGluZUxlZnQobGluZSkpOwogICAgICAgICBpbnQgcmlnaHQgPSAoaW50KSBGbG9hdE1hdGguY2VpbChtTGF5b3V0LmdldExpbmVSaWdodChsaW5lKSk7CkBAIC01NjE1LDggKzU3MDMsOCBAQAogICAgICAgICAgICAgLy8gdmlld3BvcnQgY29vcmRpbmF0ZXMsIGJ1dCByZXF1ZXN0UmVjdGFuZ2xlT25TY3JlZW4oKQogICAgICAgICAgICAgLy8gaXMgaW4gdGVybXMgb2YgY29udGVudCBjb29yZGluYXRlcy4KIAotICAgICAgICAgICAgUmVjdCByID0gbmV3IFJlY3QoKTsKLSAgICAgICAgICAgIGdldEludGVyZXN0aW5nUmVjdChyLCB4LCB0b3AsIGJvdHRvbSwgbGluZSk7CisgICAgICAgICAgICBSZWN0IHIgPSBuZXcgUmVjdCh4LCB0b3AsIHggKyAxLCBib3R0b20pOworICAgICAgICAgICAgZ2V0SW50ZXJlc3RpbmdSZWN0KHIsIGxpbmUpOwogICAgICAgICAgICAgci5vZmZzZXQobVNjcm9sbFgsIG1TY3JvbGxZKTsKIAogICAgICAgICAgICAgaWYgKHJlcXVlc3RSZWN0YW5nbGVPblNjcmVlbihyKSkgewpAQCAtNTYzMiwxMyArNTcyMCwxNSBAQAogICAgICAqIHRvIHRoZSB1c2VyLiAgVGhpcyB3aWxsIG5vdCBtb3ZlIHRoZSBjdXJzb3IgaWYgaXQgcmVwcmVzZW50cyBtb3JlIHRoYW4KICAgICAgKiBvbmUgY2hhcmFjdGVyIChhIHNlbGVjdGlvbiByYW5nZSkuICBUaGlzIHdpbGwgb25seSB3b3JrIGlmIHRoZQogICAgICAqIFRleHRWaWV3IGNvbnRhaW5zIHNwYW5uYWJsZSB0ZXh0OyBvdGhlcndpc2UgaXQgd2lsbCBkbyBub3RoaW5nLgorICAgICAqCisgICAgICogQHJldHVybiBUcnVlIGlmIHRoZSBjdXJzb3Igd2FzIGFjdHVhbGx5IG1vdmVkLCBmYWxzZSBvdGhlcndpc2UuCiAgICAgICovCiAgICAgcHVibGljIGJvb2xlYW4gbW92ZUN1cnNvclRvVmlzaWJsZU9mZnNldCgpIHsKICAgICAgICAgaWYgKCEobVRleHQgaW5zdGFuY2VvZiBTcGFubmFibGUpKSB7CiAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgIH0KLSAgICAgICAgaW50IHN0YXJ0ID0gU2VsZWN0aW9uLmdldFNlbGVjdGlvblN0YXJ0KG1UZXh0KTsKLSAgICAgICAgaW50IGVuZCA9IFNlbGVjdGlvbi5nZXRTZWxlY3Rpb25FbmQobVRleHQpOworICAgICAgICBpbnQgc3RhcnQgPSBnZXRTZWxlY3Rpb25TdGFydCgpOworICAgICAgICBpbnQgZW5kID0gZ2V0U2VsZWN0aW9uRW5kKCk7CiAgICAgICAgIGlmIChzdGFydCAhPSBlbmQpIHsKICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICAgfQpAQCAtNTY0OCw3ICs1NzM4LDcgQEAKICAgICAgICAgaW50IGxpbmUgPSBtTGF5b3V0LmdldExpbmVGb3JPZmZzZXQoc3RhcnQpOwogCiAgICAgICAgIGZpbmFsIGludCB0b3AgPSBtTGF5b3V0LmdldExpbmVUb3AobGluZSk7Ci0gICAgICAgIGZpbmFsIGludCBib3R0b20gPSBtTGF5b3V0LmdldExpbmVUb3AobGluZSsxKTsKKyAgICAgICAgZmluYWwgaW50IGJvdHRvbSA9IG1MYXlvdXQuZ2V0TGluZVRvcChsaW5lICsgMSk7CiAgICAgICAgIGZpbmFsIGludCB2c3BhY2UgPSBtQm90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gbmV3U3RhcnQgPSBoaWdoQ2hhcjsKICAgICAgICAgfQogICAgICAgICAKICAgICAgICAgaWYgKG5ld1N0YXJ0ICE9IHN0YXJ0KSB7CkBAIC01Njk0LDIyICs1Nzg4LDI4IEBACiAgICAgICAgIH0KICAgICB9CiAKLSAgICBwcml2YXRlIHZvaWQgZ2V0SW50ZXJlc3RpbmdSZWN0KFJlY3QgciwgaW50IGgsIGludCB0b3AsIGludCBib3R0b20sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgbGluZSkgeworICAgIHByaXZhdGUgdm9pZCBnZXRJbnRlcmVzdGluZ1JlY3QoUmVjdCByLCBpbnQgbGluZSkgeworICAgICAgICBjb252ZXJ0RnJvbVZpZXdwb3J0VG9Db250ZW50Q29vcmRpbmF0ZXMocik7CisKKyAgICAgICAgLy8gUmVjdGFuZ2xlIGNhbiBjYW4gYmUgZXhwYW5kZWQgb24gZmlyc3QgYW5kIGxhc3QgbGluZSB0byB0YWtlCisgICAgICAgIC8vIHBhZGRpbmcgaW50byBhY2NvdW50LgorICAgICAgICAvLyBUT0RPIFRha2UgbGVmdC9yaWdodCBwYWRkaW5nIGludG8gYWNjb3VudCB0b28/CisgICAgICAgIGlmIChsaW5lID09IDApIHIudG9wIC09IGdldEV4dGVuZGVkUGFkZGluZ1RvcCgpOworICAgICAgICBpZiAobGluZSA9PSBtTGF5b3V0LmdldExpbmVDb3VudCgpIC0gMSkgci5ib3R0b20gKz0gZ2V0RXh0ZW5kZWRQYWRkaW5nQm90dG9tKCk7CisgICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIGNvbnZlcnRGcm9tVmlld3BvcnRUb0NvbnRlbnRDb29yZGluYXRlcyhSZWN0IHIpIHsKICAgICAgICAgaW50IHBhZGRpbmdUb3AgPSBnZXRFeHRlbmRlZFBhZGRpbmdUb3AoKTsKICAgICAgICAgaWYgKChtR3Jhdml0eSAmIEdyYXZpdHkuVkVSVElDQUxfR1JBVklUWV9NQVNLKSAhPSBHcmF2aXR5LlRPUCkgewogICAgICAgICAgICAgcGFkZGluZ1RvcCArPSBnZXRWZXJ0aWNhbE9mZnNldChmYWxzZSk7CiAgICAgICAgIH0KLSAgICAgICAgdG9wICs9IHBhZGRpbmdUb3A7Ci0gICAgICAgIGJvdHRvbSArPSBwYWRkaW5nVG9wOwotICAgICAgICBoICs9IGdldENvbXBvdW5kUGFkZGluZ0xlZnQoKTsKKyAgICAgICAgci50b3AgKz0gcGFkZGluZ1RvcDsKKyAgICAgICAgci5ib3R0b20gKz0gcGFkZGluZ1RvcDsKIAotICAgICAgICBpZiAobGluZSA9PSAwKQotICAgICAgICAgICAgdG9wIC09IGdldEV4dGVuZGVkUGFkZGluZ1RvcCgpOwotICAgICAgICBpZiAobGluZSA9PSBtTGF5b3V0LmdldExpbmVDb3VudCgpIC0gMSkKLSAgICAgICAgICAgIGJvdHRvbSArPSBnZXRFeHRlbmRlZFBhZGRpbmdCb3R0b20oKTsKKyAgICAgICAgaW50IHBhZGRpbmdMZWZ0ID0gZ2V0Q29tcG91bmRQYWRkaW5nTGVmdCgpOworICAgICAgICByLmxlZnQgKz0gcGFkZGluZ0xlZnQ7CisgICAgICAgIHIucmlnaHQgKz0gcGFkZGluZ0xlZnQ7CiAKLSAgICAgICAgci5zZXQoaCwgdG9wLCBoKzEsIGJvdHRvbSk7CiAgICAgICAgIHIub2Zmc2V0KC1tU2Nyb2xsWCwgLW1TY3JvbGxZKTsKICAgICB9CiAKQEAgLTU4NzcsNiArNTk3Nyw5IEBACiAgICAgICAgIH0gZWxzZSBpZiAobUJsaW5rICE9IG51bGwpIHsKICAgICAgICAgICAgIG1CbGluay5yZW1vdmVDYWxsYmFja3MobUJsaW5rKTsKICAgICAgICAgfQorCisgICAgICAgIC8vIEluc2VydGlvblBvaW50Q3Vyc29yQ29udHJvbGxlciBkZXBlbmRzIG9uIG1DdXJzb3JWaXNpYmxlCisgICAgICAgIHByZXBhcmVDdXJzb3JDb250cm9sbGVycygpOw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mVmb3JlLCBhZnRlcik7CiAgICAgICAgIG9uVGV4dENoYW5nZWQoYnVmZmVyLCBzdGFydCwgYmVmb3JlLCBhZnRlcik7CisgICAgICAgIGhpZGVDb250cm9sbGVycygpOwogICAgIH0KICAgICAKICAgICAvKioKQEAgLTYyOTEsNyArNjM5NSw3IEBACiAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICBpZiAoREVCVUdfRVhUUkFDVCkgTG9nLnYoVEFHLCAiU3BhbiBjaGFuZ2Ugb3V0c2lkZSBvZiBiYXRjaDogIgorICAgICAgICAgICAgICAgICAgICBpZiAoREVCVUdfRVhUUkFDVCkgTG9nLnYoTE9HX1RBRywgIlNwYW4gY2hhbmdlIG91dHNpZGUgb2YgYmF0Y2g6ICIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIG9sZFN0YXJ0ICsgIi0iICsgb2xkRW5kICsgIiwiCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyBuZXdTdGFydCArICItIiArIG5ld0VuZCArIHdoYXQpOwogICAgICAgICAgICAgICAgICAgICBpbXMubUNvbnRlbnRDaGFuZ2VkID0gdHJ1ZTsKQEAgLTYzMDcsNyArNjQxMSw3IEBACiAKICAgICAgICAgcHVibGljIHZvaWQgYmVmb3JlVGV4dENoYW5nZWQoQ2hhclNlcXVlbmNlIGJ1ZmZlciwgaW50IHN0YXJ0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgYmVmb3JlLCBpbnQgYWZ0ZXIpIHsKLSAgICAgICAgICAgIGlmIChERUJVR19FWFRSQUNUKSBMb2cudihUQUcsICJiZWZvcmVUZXh0Q2hhbmdlZCBzdGFydD0iICsgc3RhcnQKKyAgICAgICAgICAgIGlmIChERUJVR19FWFRSQUNUKSBMb2cudihMT0dfVEFHLCAiYmVmb3JlVGV4dENoYW5nZWQgc3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VFJBQ1QpIExvZy52KFRBRywgIm9uU3BhbkNoYW5nZWQgcz0iICsgcyArICIgZT0iICsgZQorICAgICAgICAgICAgaWYgKERFQlVHX0VYVFJBQ1QpIExvZy52KExPR19UQUcsICJvblNwYW5DaGFuZ2VkIHM9IiArIHMgKyAiIGU9IiArIGUKICAgICAgICAgICAgICAgICAgICAgKyAiIHN0PSIgKyBzdCArICIgZW49IiArIGVuICsgIiB3aGF0PSIgKyB3aGF0ICsgIjogIiArIGJ1Zik7CiAgICAgICAgICAgICBUZXh0Vmlldy50aGlzLnNwYW5DaGFuZ2UoYnVmLCB3aGF0LCBzLCBzdCwgZSwgZW4pOwogICAgICAgICB9CiAKICAgICAgICAgcHVibGljIHZvaWQgb25TcGFuQWRkZWQoU3Bhbm5hYmxlIGJ1ZiwgT2JqZWN0IHdoYXQsIGludCBzLCBpbnQgZSkgewotICAgICAgICAgICAgaWYgKERFQlVHX0VYVFJBQ1QpIExvZy52KFRBRywgIm9uU3BhbkFkZGVkIHM9IiArIHMgKyAiIGU9IiArIGUKKyAgICAgICAgICAgIGlmIChERUJVR19FWFRSQUNUKSBMb2cudihMT0dfVEFHLCAib25TcGFuQWRkZWQgcz0iICsgcyArICIgZT0iICsgZQogICAgICAgICAgICAgICAgICAgICArICIgd2hhdD0iICsgd2hhdCArICI6ICIgKyBidWYpOwogICAgICAgICAgICAgVGV4dFZpZXcudGhpcy5zcGFuQ2hhbmdlKGJ1Ziwgd2hhdCwgLTEsIHMsIC0xLCBlKTsKICAgICAgICAgfQogCiAgICAgICAgIHB1YmxpYyB2b2lkIG9uU3BhblJlbW92ZWQoU3Bhbm5hYmxlIGJ1ZiwgT2JqZWN0IHdoYXQsIGludCBzLCBpbnQgZSkgewotICAgICAgICAgICAgaWYgKERFQlVHX0VYVFJBQ1QpIExvZy52KFRBRywgIm9uU3BhblJlbW92ZWQgcz0iICsgcyArICIgZT0iICsgZQorICAgICAgICAgICAgaWYgKERFQlVHX0VYVFJBQ1QpIExvZy52KExPR19UQUcsICJvblNwYW5SZW1vdmVkIHM9IiArIHMgKyAiIGU9IiArIGUKICAgICAgICAgICAgICAgICAgICAgKyAiIHdoYXQ9IiArIHdoYXQgKyAiOiAiICsgYnVmKTsKICAgICAgICAgICAgIFRleHRWaWV3LnRoaXMuc3BhbkNoYW5nZShidWYsIHdoYXQsIHMsIC0xLCBlLCAtMSk7CiAgICAgICAgIH0KQEAgLTY0NjAsMTIgKzY1NjksMjIgQEAKICAgICAgICAgICAgIGlmIChtRXJyb3IgIT0gbnVsbCkgewogICAgICAgICAgICAgICAgIHNob3dFcnJvcigpOwogICAgICAgICAgICAgfQorCisgICAgICAgICAgICAvLyBXZSBjYW5ub3Qgc3RhcnQgdGhlIHNlbGVjdGlvbiBtb2RlIGltbWVkaWF0ZWx5LiBUaGUgbGF5b3V0IG1heSBiZSBudWxsIGhlcmUgYW5kIGlzCisgICAgICAgICAgICAvLyBuZWVkZWQgYnkgdGhlIGN1cnNvciBjb250cm9sbGVyLiBMYXlvdXQgY3JlYXRpb24gaXMgZGVmZXJyZWQgdXAgdG8gZHJhd2luZy4gVGhlCisgICAgICAgICAgICAvLyBzZWxlY3Rpb24gYWN0aW9uIG1vZGUgd2lsbCBiZSBzdGFydGVkIGluIG9uUHJlRHJhdygpLgorICAgICAgICAgICAgaWYgKHNlbFN0YXJ0ICE9IHNlbEVuZCkgeworICAgICAgICAgICAgICAgIG1TaG91bGRTdGFydFNlbGVjdGlvbkFjdGlvbk1vZGUgPSB0cnVlOworICAgICAgICAgICAgfQogICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgaWYgKG1FcnJvciAhPSBudWxsKSB7CiAgICAgICAgICAgICAgICAgaGlkZUVycm9yKCk7CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICAvLyBEb24ndCBsZWF2ZSB1cyBpbiB0aGUgbWlkZGxlIG9mIGEgYmF0Y2ggZWRpdC4KICAgICAgICAgICAgIG9uRW5kQmF0Y2hFZGl0KCk7CisKKyAgICAgICA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ICAgaWYgKHJlc3VsdENvZGUgIT0gSW5wdXRNZXRob2RNYW5hZ2VyLlJFU1VMVF9TSE9XTikgewotICAgICAgICAgICAgICAgIGZpbmFsIGludCBsZW4gPSBtVGV4dC5sZW5ndGgoKTsKLSAgICAgICAgICAgICAgICBpZiAobU5ld1N0YXJ0ID4gbGVuKSB7Ci0gICAgICAgICAgICAgICAgICAgIG1OZXdTdGFydCA9IGxlbjsKKyAgICAgICAgICAgIGludCBzdGFydCA9IG1OZXdTdGFydDsKKyAgICAgICAgICAgIGludCBlbmQgPSBtTmV3RW5kOworCisgICAgICAgICAgICAvLyBNb3ZlIHRoZSBjdXJzb3IgdG8gdGhlIG5ldyBwb3NpdGlvbiwgdW5sZXNzIHRoaXMgdGFwIHdhcyBhY3R1YWxseQorICAgICAgICAgICAgLy8gdXNlIHRvIHNob3cgdGhlIElNTS4gTGVhdmUgY3Vyc29yIHVuY2hhbmdlZCBpbiB0aGF0IGNhc2UuCisgICAgICAgICAgICBpZiAocmVzdWx0Q29kZSA9PSBJbnB1dE1ldGhvZE1hbmFnZXIuUkVTVUxUX1NIT1dOKSB7CisgICAgICAgICAgICAgICAgc3RhcnQgPSBtUHJldlN0YXJ0OworICAgICAgICAgICAgICAgIGVuZCA9IG1QcmV2RW5kOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBpZiAoKG1QcmV2U3RhcnQgIT0gbVByZXZFbmQpICYmIChzdGFydCA9PSBlbmQpKSB7CisgICAgICAgICAgICAgICAgICAgIGlmICgoc3RhcnQgPj0gbVByZXZTdGFydCkgJiYgKHN0YXJ0IDw9IG1QcmV2RW5kKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgLy8gVGFwcGluZyBpbnNpZGUgdGhlIHNlbGVjdGlvbiBkb2VzIG5vdGhpbmcKKyAgICAgICAgICAgICAgICAgICAgICAgIFNlbGVjdGlvbi5zZXRTZWxlY3Rpb24oKFNwYW5uYWJsZSkgbVRleHQsIG1QcmV2U3RhcnQsIG1QcmV2RW5kKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIFRhcHBpbmcgb3V0c2lkZSBzdG9wcyBzZWxlY3Rpb24gbW9kZSwgaWYgYW55CisgICAgICAgICAgICAgICAgICAgICAgICBzdG9wU2VsZWN0aW9uQWN0aW9uTW9kZSgpOworICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGlmIChtTmV3RW5kID4gbGVuKSB7Ci0gICAgICAgICAgICAgICAgICAgIG1OZXdFbmQgPSBsZW47CisKKyAgICAgICAgICAgICAgICBpZiAobUluc2VydGlvblBvaW50Q3Vyc29yQ29udHJvbGxlciAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIG1JbnNlcnRpb25Qb2ludEN1cnNvckNvbnRyb2xsZXIuc2hvdygpOwogICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBTZWxlY3Rpb24uc2V0U2VsZWN0aW9uKChTcGFubmFibGUpbVRleHQsIG1OZXdTdGFydCwgbU5ld0VuZCk7CiAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGZpbmFsIGludCBsZW4gPSBtVGV4dC5sZW5ndGgoKTsKKyAgICAgICAgICAgIGlmIChzdGFydCA+IGxlbikgeworICAgICAgICAgICAgICAgIHN0YXJ0ID0gbGVuOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKGVuZCA+IGxlbikgeworICAgICAgICAgICAgICAgIGVuZCA9IGxlbjsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIFNlbGVjdGlvbi5zZXRTZWxlY3Rpb24oKFNwYW5uYWJsZSltVGV4dCwgc3RhcnQsIGVuZCk7CiAgICAgICAgIH0KICAgICB9CiAgICAgCkBAIC02NTYyLDcgKzY3MDksNyBAQAogICAgICAgICAgICAgbVRvdWNoRm9jdXNTZWxlY3RlZCA9IGZhbHNlOwogICAgICAgICAgICAgbVNjcm9sbGVkID0gZmFsc2U7CiAgICAgICAgIH0KLSAgICAgICAgCisKICAgICAgICAgZmluYWwgYm9vbGVhbiBzdXBlclJlc3VsdCA9IHN1cGVyLm9uVG91Y2hFdmVudChldmVudCk7CiAKICAgICAgICAgLyoKQEAgLTY1NzUsNDQgKzY3MjIsNDAgQEAKICAgICAgICAgICAgIHJldHVybiBzdXBlclJlc3VsdDsKICAgICAgICAgfQogCi0gICAgICAgIGlmICgobU1vdmVtZW50ICE9IG51bGwgfHwgb25DaGVja0lzVGV4dEVkaXRvcigpKSAmJiBtVGV4dCBpbnN0YW5jZW9mIFNwYW5uYWJsZSAmJiBtTGF5b3V0ICE9IG51bGwpIHsKKyAgICAgICAgaWYgKChtTW92ZW1lbnQgIT0gbnVsbCB8fCBvbkNoZWNrSXNUZXh0RWRpdG9yKCkpICYmCisgICAgICAgICAgICAgICAgbVRleHQgaW5zdGFuY2VvZiBTcGFubmFibGUgJiYgbUxheW91dCAhPSBudWxsKSB7CiAgICAgICAgICAgICAKKyAgICAgICAgICAgIGludCBvbGRTZWxTdGFydCA9IGdldFNlbGVjdGlvblN0YXJ0KCk7CisgICAgICAgICAgICBpbnQgb2xkU2VsRW5kID0gZ2V0U2VsZWN0aW9uRW5kKCk7CisKKyAgICAgICAgICAgIGlmIChtSW5zZXJ0aW9uUG9pbnRDdXJzb3JDb250cm9sbGVyICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBtSW5zZXJ0aW9uUG9pbnRDdXJzb3JDb250cm9sbGVyLm9uVG91Y2hFdmVudChldmVudCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAobVNlbGVjdGlvbk1vZGlmaWVyQ3Vyc29yQ29udHJvbGxlciAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgbVNlbGVjdGlvbk1vZGlmaWVyQ3Vyc29yQ29udHJvbGxlci5vblRvdWNoRXZlbnQoZXZlbnQpOworICAgICAgICAgICAgfQorCiAgICAgICAgICAgICBib29sZWFuIGhhbmRsZWQgPSBmYWxzZTsKLSAgICAgICAgICAgIAotICAgICAgICAgICAgaW50IG9sZFNlbFN0YXJ0ID0gU2VsZWN0aW9uLmdldFNlbGVjdGlvblN0YXJ0KG1UZXh0KTsKLSAgICAgICAgICAgIGludCBvbGRTZWxFbmQgPSBTZWxlY3Rpb24uZ2V0U2VsZWN0aW9uRW5kKG1UZXh0KTsKLSAgICAgICAgICAgIAorCiAgICAgICAgICAgICBpZiAobU1vdmVtZW50ICE9IG51bGwpIHsKICAgICAgICAgICAgICAgICBoYW5kbGVkIHw9IG1Nb3ZlbWVudC5vblRvdWNoRXZlbnQodGhpcywgKFNwYW5uYWJsZSkgbVRleHQsIGV2ZW50KTsKICAgICAgICAgICAgIH0KIAotICAgICAgICAgICAgaWYgKG1UZXh0IGluc3RhbmNlb2YgRWRpdGFibGUgJiYgb25DaGVja0lzVGV4dEVkaXRvcigpKSB7CisgICAgICAgICAgICBpZiAoaXNUZXh0RWRpdGFibGUoKSkgewogICAgICAgICAgICAgICAgIGlmIChhY3Rpb24gPT0gTW90aW9uRXZlbnQuQUNUSU9OX1VQICYmIGlzRm9jdXNlZCgpICYmICFtU2Nyb2xsZWQpIHsKICAgICAgICAgICAgICAgICAgICAgSW5wdXRNZXRob2RNYW5hZ2VyIGltbSA9IChJbnB1dE1ldGhvZE1hbmFnZXIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0Q29udGV4dCgpLmdldFN5c3RlbVNlcnZpY2UoQ29udGV4dC5JTlBVVF9NRVRIT0RfU0VSVklDRSk7Ci0gICAgICAgICAgICAgICAgICAgIAotICAgICAgICAgICAgICAgICAgICAvLyBUaGlzIGlzIGdvaW5nIHRvIGJlIGdyb3NzLi4uICBpZiB0YXBwaW5nIG9uIHRoZSB0ZXh0IHZpZXcKLSAgICAgICAgICAgICAgICAgICAgLy8gY2F1c2VzIHRoZSBJTUUgdG8gYmUgZGlzcGxheWVkLCB3ZSBkb24ndCB3YW50IHRoZSBzZWxlY3Rpb24KLSAgICAgICAgICAgICAgICAgICAgLy8gdG8gY2hhbmdlLiAgQnV0IHRoZSBzZWxlY3Rpb24gaGFzIGFscmVhZHkgY2hhbmdlZCwgYW5kCi0gICAgICAgICAgICAgICAgICAgIC8vIHdlIHdvbid0IGtub3cgcmlnaHQgYXdheSB3aGV0aGVyIHRoZSBJTUUgaXMgZ2V0dGluZwotICAgICAgICAgICAgICAgICAgICAvLyBkaXNwbGF5ZWQsIHNvLi4uCi0gICAgICAgICAgICAgICAgICAgIAotICAgICAgICAgICAgICAgICAgICBpbnQgbmV3U2VsU3RhcnQgPSBTZWxlY3Rpb24uZ2V0U2VsZWN0aW9uU3RhcnQobVRleHQpOwotICAgICAgICAgICAgICAgICAgICBpbnQgbmV3U2VsRW5kID0gU2VsZWN0aW9uLmdldFNlbGVjdGlvbkVuZChtVGV4dCk7CisKKyAgICAgICAgICAgICAgICAgICAgZmluYWwgaW50IG5ld1NlbFN0YXJ0ID0gZ2V0U2VsZWN0aW9uU3RhcnQoKTsKKyAgICAgICAgICAgICAgICAgICAgZmluYWwgaW50IG5ld1NlbEVuZCA9IGdldFNlbGVjdGlvbkVuZCgpOworCiAgICAgICAgICAgICAgICAgICAgIENvbW1pdFNlbGVjdGlvblJlY2VpdmVyIGNzciA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgIGlmIChuZXdTZWxTdGFydCAhPSBvbGRTZWxTdGFydCB8fCBuZXdTZWxFbmQgIT0gb2xkU2VsRW5kKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBjc3IgPSBuZXcgQ29tbWl0U2VsZWN0aW9uUmVjZWl2ZXIoKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGNzci5tTmV3U3RhcnQgPSBuZXdTZWxTdGFydDsKLSAgICAgICAgICAgICAgICAgICAgICAgIGNzci5tTmV3RW5kID0gbmV3U2VsRW5kOworICAgICAgICAgICAgICAgICAgICAgICAgY3NyID0gbmV3IENvbW1pdFNlbGVjdGlvblJlY2VpdmVyKG9sZFNlbFN0YXJ0LCBvbGRTZWxFbmQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5ld1NlbFN0YXJ0LCBuZXdTZWxFbmQpOwogICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIAotICAgICAgICAgICAgICAgICAgICBpZiAoaW1tLnNob3dTb2Z0SW5wdXQodGhpcywgMCwgY3NyKSAmJiBjc3IgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICAgICAgLy8gVGhlIElNRSBtaWdodCBnZXQgc2hvd24gLS0gcmV2ZXJ0IHRvIHRoZSBvbGQKLSAgICAgICAgICAgICAgICAgICAgICAgIC8vIHNlbGVjdGlvbiwgYW5kIGNoYW5nZSB0byB0aGUgbmV3IHdoZW4gd2UgZmluYWxseQotICAgICAgICAgICAgICAgICAgICAgICAgLy8gZmluZCBvdXQgb2YgaXQgaXMgb2theS4KLSAgICAgICAgICAgICAgICAgICAgICAgIFNlbGVjdGlvbi5zZXRTZWxlY3Rpb24oKFNwYW5uYWJsZSltVGV4dCwgb2xkU2VsU3RhcnQsIG9sZFNlbEVuZCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBoYW5kbGVkID0gdHJ1ZTsKLSAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgIGhhbmRsZWQgfD0gaW1tLnNob3dTb2Z0SW5wdXQodGhpcywgMCwgY3NyKSAmJiAoY3NyICE9IG51bGwpOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KIApAQCAtNjYyNCw2ICs2NzY3LDM0IEBACiAgICAgICAgIHJldHVybiBzdXBlclJlc3VsdDsKICAgICB9CiAKKyAgICBwcml2YXRlIHZvaWQgcHJlcGFyZUN1cnNvckNvbnRyb2xsZXJzKCkgeworICAgICAgICAvLyBUT0RPIEFkZCBhbiBleHRyYSBhbmRyb2lkOmN1cnNvckNvbnRyb2xsZXIgZmxhZyB0byBkaXNhYmxlIHRoZSBjb250cm9sbGVyPworICAgICAgICBpZiAobUN1cnNvclZpc2libGUgJiYgbUxheW91dCAhPSBudWxsKSB7CisgICAgICAgICAgICBpZiAobUluc2VydGlvblBvaW50Q3Vyc29yQ29udHJvbGxlciA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgbUluc2VydGlvblBvaW50Q3Vyc29yQ29udHJvbGxlciA9IG5ldyBJbnNlcnRpb25Qb2ludEN1cnNvckNvbnRyb2xsZXIoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIG1JbnNlcnRpb25Qb2ludEN1cnNvckNvbnRyb2xsZXIgPSBudWxsOworICAgICAgICB9CisKKyAgICAgICAgaWYgKGNhblNlbGVjdFRleHQoKSAmJiBtTGF5b3V0ICE9IG51bGwpIHsKKyAgICAgICAgICAgIGlmIChtU2VsZWN0aW9uTW9kaWZpZXJDdXJzb3JDb250cm9sbGVyID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICBtU2VsZWN0aW9uTW9kaWZpZXJDdXJzb3JDb250cm9sbGVyID0gbmV3IFNlbGVjdGlvbk1vZGlmaWVyQ3Vyc29yQ29udHJvbGxlcigpOworICAgICAgICAgICAgfQorICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgLy8gU3RvcCBzZWxlY3Rpb24gbW9kZSBpZiB0aGUgY29udHJvbGxlciBiZWNvbWVzIHVuYXZhaWxhYmxlLgorICAgICAgICAgICAgc3RvcFNlbGVjdGlvbkFjdGlvbk1vZGUoKTsKKyAgICAgICAgICAgIG1TZWxlY3Rpb25Nb2RpZmllckN1cnNvckNvbnRyb2xsZXIgPSBudWxsOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogQHJldHVybiBUcnVlIGlmZiB0aGlzIFRleHRWaWV3IGNvbnRhaW5zIGEgdGV4dCB0aGF0IGNhbiBiZSBlZGl0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pbnQgc3QgPSB0di5nZXRTZWxlY3Rpb25TdGFydCgpOworICAgICAgICAgICAgICAgIGludCBlbiA9IHR2LmdldFNlbGVjdGlvbkVuZCgpOwogCiAgICAgICAgICAgICAgICAgaWYgKHN0ID09IGVuICYmIHN0ID49IDAgJiYgZW4gPj0gMCkgewogICAgICAgICAgICAgICAgICAgICBpZiAodHYubUxheW91dCAhPSBudWxsKSB7CkBAIC02NzUyLDggKzY5MjMsMTAgQEAKIAogICAgIEBPdmVycmlkZQogICAgIHByb3RlY3RlZCBpbnQgY29tcHV0ZUhvcml6b250YWxTY3JvbGxSYW5nZSgpIHsKLSAgICAgICAgaWYgKG1MYXlvdXQgIT0gbnVsbCkKLSAgICAgICAgICAgIHJldHVybiBtTGF5b3V0LmdldFdpZHRoKCk7CisgICAgICAgIGlmIChtTGF5b3V0ICE9IG51bGwpIHsKKyAgICAgICAgICAgIHJldHVybiBtU2luZ2xlTGluZSAmJiAobUdyYXZpdHkgJiBHcmF2aXR5LkhPUklaT05UQUxfR1JBVklUWV9NQVNLKSA9PSBHcmF2aXR5LkxFRlQgPworICAgICAgICAgICAgICAgICAgICAoaW50KSBtTGF5b3V0LmdldExpbmVXaWR0aCgwKSA6IG1MYXlvdXQuZ2V0V2lkdGgoKTsKKyAgICAgICAgfQogCiAgICAgICAgIHJldHVybiBzdXBlci5jb21wdXRlSG9yaXpvbnRhbFNjcm9sbFJhbmdlKCk7CiAgICAgfQpAQCAtNjg1NiwyMSArNzAyOSwxNiBAQAogICAgIH0KIAogICAgIHByaXZhdGUgYm9vbGVhbiBjYW5TZWxlY3RBbGwoKSB7Ci0gICAgICAgIGlmIChtVGV4dCBpbnN0YW5jZW9mIFNwYW5uYWJsZSAmJiBtVGV4dC5sZW5ndGgoKSAhPSAwICYmCi0gICAgICAgICAgICBtTW92ZW1lbnQgIT0gbnVsbCAmJiBtTW92ZW1lbnQuY2FuU2VsZWN0QXJiaXRyYXJpbHkoKSkgewotICAgICAgICAgICAgcmV0dXJu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V0dXJuIC0xOwogICAgICAgICB9CiAKICAgICAgICAgaW50IHZhcmlhdGlvbiA9IG1JbnB1dFR5cGUgJiBJbnB1dFR5cGUuVFlQRV9NQVNLX1ZBUklBVElPTjsKQEAgLTY5MzQsMTMgKzcxMDIsMTMgQEAKICAgICAgICAgICAgIHZhcmlhdGlvbiA9PSBJbnB1dFR5cGUuVFlQRV9URVhUX1ZBUklBVElPTl9WSVNJQkxFX1BBU1NXT1JEIHx8CiAgICAgICAgICAgICB2YXJpYXRpb24gPT0gSW5wdXRUeXBlLlRZUEVfVEVYVF9WQVJJQVRJT05fRU1BSUxfQUREUkVTUyB8fAogICAgICAgICAgICAgdmFyaWF0aW9uID09IElucHV0VHlwZS5UWVBFX1RFWFRfVkFSSUFUSU9OX0ZJTFRFUikgewotICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgICAgICByZXR1cm4gLTE7CiAgICAgICAgIH0KIAotICAgICAgICBpbnQgZW5kID0gZ2V0U2VsZWN0aW9uRW5kKCk7CisgICAgICAgIGludCBlbmQgPSBvZmZzZXQ7CiAKICAgICAgICAgaWYgKGVuZCA8IDApIHsKLSAgICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICAgICAgcmV0dXJuIC0xOwogICAgICAgICB9CiAKICAgICAgICAgaW50IHN0YXJ0ID0gZW5kOwpAQCAtNjk3NCw2ICs3MTQyLDE0IEBACiAgICAgICAgICAgICB9CiAgICAgICAgIH0KIAorICAgICAgICBpZiAoc3RhcnQgPT0gZW5kKSB7CisgICAgICAgICAgICByZXR1cm4gLTE7CisgICAgICAgIH0KKworICAgICAgICBpZiAoZW5kIC0gc3RhcnQgPiA0OCkgeworICAgICAgICAgICAgcmV0dXJuIC0xOworICAgICAgICB9CisKICAgICAgICAgYm9vbGVhbiBoYXNMZXR0ZXIgPSBmYWxzZTsKICAgICAgICAgZm9yIChpbnQgaSA9IHN0YXJ0OyBpIDwgZW5kOyBpKyspIHsKICAgICAgICAgICAgIGlmIChDaGFyYWN0ZXIuaXNMZXR0ZXIobVRyYW5zZm9ybWVkLmNoYXJBdChpKSkpIHsKQEAgLTY5ODEsMTkgKzcxNTcsMTMgQEAKICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgIH0KICAgICAgICAgfQorCiAgICAgICAgIGlmICghaGFzTGV0dGVyKSB7Ci0gICAgICAgICAgICByZXR1cm4gbnVsbDsKKyAgICAgICAgICAgIHJldHVybiAtMTsKICAgICAgICAgfQogCi0gICAgICAgIGlmIChzdGFydCA9PSBlbmQpIHsKLSAgICAgICAgICAgIHJldHVybiBudWxsOwotICAgICAgICB9Ci0KLSAgICAgICAgaWYgKGVuZCAtIHN0YXJ0ID4gNDgpIHsKLSAgICAgICAgICAgIHJldHVybiBudWxsOwotICAgICAgICB9Ci0KLSAgICAgICAgcmV0dXJuIFRleHRVdGlscy5zdWJzdHJpbmcobVRyYW5zZm9ybWVkLCBzdGFydCwgZW5kKTsKKyAgICAgICAgLy8gVHdvIGludHMgcGFja2VkIGluIGEgbG9uZworICAgICAgICByZXR1cm4gKCgobG9uZykgc3RhcnQpIDw8IDMyKSB8IGVuZDsKICAgICB9CiAKICAgICBAT3ZlcnJpZGUKQEAgLTcwMzcsODQgKzcyMDcsOCBAQAogICAgICAgICBzdXBlci5vbkNyZWF0ZUNvbnRleHRNZW51KG1lbnUpOwogICAgICAgICBib29sZWFuIGFkZGVkID0gZmFsc2U7CiAKLSAgICAgICAgaWYgKCFpc0ZvY3VzZWQoKSkgewotICAgICAgICAgICAgaWYgKGlzRm9jdXNhYmxlKCkgJiYgbUlucHV0ICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICBpZiAoY2FuQ29weSgpKSB7Ci0gICAgICAgICAgICAgICAgICAgIE1lbnVIYW5kbGVyIGhhbmRsZXIgPSBuZXcgTWVudUhhbmRsZXIoKTsKLSAgICAgICAgICAgICAgICAgICAgaW50IG5hbWUgPSBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0cmluZy5jb3B5QWxsOwotCi0gICAgICAgICAgICAgICAgICAgIG1lbnUuYWRkKDAsIElEX0NPUFksIDAsIG5hbWUpLgotICAgICAgICAgICAgICAgICAgICAgICAgc2V0T25NZW51SXRlbUNsaWNrTGlzdGVuZXIoaGFuZGxlcikuCi0gICAgICAgICAgICAgICAgICAgICAgICBzZXRBbHBoYWJldGljU2hvcnRjdXQoJ2MnKTsKLSAgICAgICAgICAgICAgICAgICAgbWVudS5zZXRIZWFkZXJUaXRsZShjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0cmluZy4KLSAgICAgICAgICAgICAgICAgICAgICAgIGVkaXRUZXh0TWVudVRpdGxlKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgfQotCiAgICAgICAgIE1lbnVIYW5kbGVyIGhhbmRsZXIgPSBuZXcgTWVudUhhbmRsZXIoKTsKIAotICAgICAgICBpZiAoY2FuU2VsZWN0QWxsKCkpIHsKLSAgICAgICAgICAgIG1lbnUuYWRkKDAsIElEX1NFTEVDVF9BTEwsIDAsCi0gICAgICAgICAgICAgICAgICAgIGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3RyaW5nLnNlbGVjdEFsbCkuCi0gICAgICAgICAgICAgICAgc2V0T25NZW51SXRlbUNsaWNrTGlzdGVuZXIoaGFuZGxlcikuCi0gICAgICAgICAgICAgICAgc2V0QWxwaGFiZXRpY1Nob3J0Y3V0KCdhJyk7Ci0gICAgICAgICAgICBhZGRlZCA9IHRydWU7Ci0gICAgICAgIH0KLQotICAgICAgICBib29sZWFuIHNlbGVjdGlvbiA9IGdldFNlbGVjdGlvblN0YXJ0KCkgIT0gZ2V0U2VsZWN0aW9uRW5kKCk7Ci0KLSAgICAgICAgaWYgKGNhblNlbGVjdFRleHQoKSkgewotICAgICAgICAgICAgaWYgKE1ldGFLZXlLZXlMaXN0ZW5lci5nZXRNZXRhU3RhdGUobVRleHQsIE1ldGFLZXlLZXlMaXN0ZW5lci5NRVRBX1NFTEVDVElORykgIT0gMCkgewotICAgICAgICAgICAgICAgIG1lbnUuYWRkKDAsIElEX1NUT1BfU0VMRUNUSU5HX1RFWFQsIDAsCi0gICAgICAgICAgICAgICAgICAgICAgICBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0cmluZy5zdG9wU2VsZWN0aW5nVGV4dCkuCi0gICAgICAgICAgICAgICAgICAgIHNldE9uTWVudUl0ZW1DbGlja0xpc3RlbmVyKGhhbmRsZXIpOwotICAgICAgICAgICAgICAgIGFkZGVkID0gdHJ1ZTsKLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgbWVudS5hZGQoMCwgSURfU1RBUlRfU0VMRUNUSU5HX1RFWFQsIDAsCi0gICAgICAgICAgICAgICAgICAgICAgICBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0cmluZy5zZWxlY3RUZXh0KS4KLSAgICAgICAgICAgICAgICAgICAgc2V0T25NZW51SXRlbUNsaWNrTGlzdGVuZXIoaGFuZGxlcik7Ci0gICAgICAgICAgICAgICAgYWRkZWQgPSB0cnVlOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgaWYgKGNhbkN1dCgpKSB7Ci0gICAgICAgICAgICBpbnQgbmFtZTsKLSAgICAgICAgICAgIGlmIChzZWxlY3Rpb24pIHsKLSAgICAgICAgICAgICAgICBuYW1lID0gY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHJpbmcuY3V0OwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBuYW1lID0gY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHJpbmcuY3V0QWxsOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBtZW51LmFkZCgwLCBJRF9DVVQsIDAsIG5hbWUpLgotICAgICAgICAgICAgICAgIHNldE9uTWVudUl0ZW1DbGlja0xpc3RlbmVyKGhhbmRsZXIpLgotICAgICAgICAgICAgICAgIHNldEFscGhhYmV0aWNTaG9ydGN1dCgneCcpOwotICAgICAgICAgICAgYWRkZWQgPSB0cnVlOwotICAgICAgICB9Ci0KLSAgICAgICAgaWYgKGNhbkNvcHkoKSkgewotICAgICAgICAgICAgaW50IG5hbWU7Ci0gICAgICAgICAgICBpZiAoc2VsZWN0aW9uKSB7Ci0gICAgICAgICAgICAgICAgbmFtZSA9IGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3RyaW5nLmNvcHk7Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIG5hbWUgPSBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0cmluZy5jb3B5QWxsOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBtZW51LmFkZCgwLCBJRF9DT1BZLCAwLCBuYW1lKS4KLSAgICAgICAgICAgICAgICBzZXRPbk1lbnVJdGVtQ2xpY2tMaXN0ZW5lcihoYW5kbGVyKS4KLSAgICAgICAgICAgICAgICBzZXRBbHBoYWJldGljU2hvcnRjdXQoJ2MnKTsKLSAgICAgICAgICAgIGFkZGVkID0gdHJ1ZTsKLSAgICAgICAgfQotCi0gICAgICAgIGlmIChjYW5QYXN0ZSgpKSB7Ci0gICAgICAgICAgICBtZW51LmFkZCgwLCBJRF9QQVNURSwgMCwgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHJpbmcucGFzdGUpLgotICAgICAgICAgICAgICAgICAgICBzZXRPbk1lbnVJdGVtQ2xpY2tMaXN0ZW5lcihoYW5kbGVyKS4KLSAgICAgICAgICAgICAgICAgICAgc2V0QWxwaGFiZXRpY1Nob3J0Y3V0KCd2Jyk7Ci0gICAgICAgICAgICBhZGRlZCA9IHRydWU7Ci0gICAgICAgIH0KLQogICAgICAgICBpZiAobVRleHQgaW5zdGFuY2VvZiBTcGFubmVkKSB7CiAgICAgICAgICAgICBpbnQgc2VsU3RhcnQgPSBnZXRTZWxlY3Rpb25TdGFydCgpOwogICAgICAgICAgICAgaW50IHNlbEVuZCA9IGdldFNlbGVjdGlvbkVuZCgpOwpAQCAtNzEyOCwyNSArNzIyMiwyMSBAQAogICAgICAgICAgICAgICAgIG1lbnUuYWRkKDAsIElEX0NPUFlfVVJMLCAwLAogICAgICAgICAgICAgICAgICAgICAgICAgIGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3RyaW5nLmNvcHlVcmwpLgogICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldE9uTWVudUl0ZW1DbGlja0xpc3RlbmVyKGhhbmRsZXIpOworCiAgICAgICAgICAgICAgICAgYWRkZWQgPSB0cnVlOwogICAgICAgICAgICAgfQogICAgICAgICB9Ci0KLSAgICAgICAgaWYgKGlzSW5wdXRNZXRob2RUYXJnZXQoKSkgewotICAgICAgICAgICAgbWVudS5hZGQoMSwgSURfU1dJVENIX0lOUFVUX01FVEhPRCwgMCwgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHJpbmcuaW5wdXRNZXRob2QpLgotICAgICAgICAgICAgICAgICAgICBzZXRPbk1lbnVJdGVtQ2xpY2tMaXN0ZW5lcihoYW5kbGVyKTsKKyAgICAgICAgCisgICAgICAgIC8vIFRoZSBjb250ZXh0IG1lbnUgaXMgbm90IGVtcHR5LCB3aGljaCB3aWxsIHByZXZlbnQgdGhlIHNlbGVjdGlvbiBtb2RlIGZyb20gc3RhcnRpbmcuCisgICAgICAgIC8vIEFkZCBhIGVudHJ5IHRvIHN0YXJ0IGl0IGluIHRoZSBjb250ZXh0IG1lbnUuCisgICAgICAgIC8vIFRPRE8gRG9lcyBub3QgaGFuZGxlIHRoZSBjYXNlIHdoZXJlIGEgc3ViY2xhc3MgZG9lcyBub3QgY2FsbCBzdXBlci50aGlzTWV0aG9kIG9yCisgICAgICAgIC8vIHBvcHVsYXRlcyB0aGUgbWVudSBBRlRFUiB0aGlzIGNhbGwuCisgICAgICAgIGlmIChtZW51LnNpemUoKSA+IDApIHsKKyAgICAgICAgICAgIG1lbnUuYW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codGhpcywgKFNwYW5uYWJsZSkgbVRleHQpOwotICAgICAgICAgICAgICAgIFNlbGVjdGlvbi5zZXRTZWxlY3Rpb24oKFNwYW5uYWJsZSkgbVRleHQsIGdldFNlbGVjdGlvbkVuZCgpKTsKLSAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKLQotICAgICAgICAgICAgY2FzZSBJRF9DVVQ6Ci0gICAgICAgICAgICAgICAgTWV0YUtleUtleUxpc3RlbmVyLnN0b3BTZWxlY3RpbmcodGhpcywgKFNwYW5uYWJsZSkgbVRleHQpOwotCi0gICAgICAgICAgICAgICAgaWYgKG1pbiA9PSBtYXgpIHsKLSAgICAgICAgICAgICAgICAgICAgbWluID0gMDsKLSAgICAgICAgICAgICAgICAgICAgbWF4ID0gbVRleHQubGVuZ3RoKCk7Ci0gICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgY2xpcC5zZXRUZXh0KG1UcmFuc2Zvcm1lZC5zdWJTZXF1ZW5jZShtaW4sIG1heCkpOwotICAgICAgICAgICAgICAgICgoRWRpdGFibGUpIG1UZXh0KS5kZWxldGUobWluLCBtYXgpOwotICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwotCi0gICAgICAgICAgICBjYXNlIElEX0NPUFk6Ci0gICAgICAgICAgICAgICAgTWV0YUtleUtleUxpc3RlbmVyLnN0b3BTZWxlY3RpbmcodGhpcywgKFNwYW5uYWJsZSkgbVRleHQpOwotCi0gICAgICAgICAgICAgICAgaWYgKG1pbiA9PSBtYXgpIHsKLSAgICAgICAgICAgICAgICAgICAgbWluID0gMDsKLSAgICAgICAgICAgICAgICAgICAgbWF4ID0gbVRleHQubGVuZ3RoKCk7Ci0gICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgY2xpcC5zZXRUZXh0KG1UcmFuc2Zvcm1lZC5zdWJTZXF1ZW5jZShtaW4sIG1heCkpOwotICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwotCi0gICAgICAgICAgICBjYXNlIElEX1BBU1RFOgotICAgICAgICAgICAgICAgIE1ldGFLZXlLZXlMaXN0ZW5lci5zdG9wU2VsZWN0aW5nKHRoaXMsIChTcGFubmFibGUpIG1UZXh0KTsKLQotICAgICAgICAgICAgICAgIENoYXJTZXF1ZW5jZSBwYXN0ZSA9IGNsaXAuZ2V0VGV4dCgpOwotCi0gICAgICAgICAgICAgICAgaWYgKHBhc3RlICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgU2VsZWN0aW9uLnNldFNlbGVjdGlvbigoU3Bhbm5hYmxlKSBtVGV4dCwgbWF4KTsKLSAgICAgICAgICAgICAgICAgICAgKChFZGl0YWJsZSkgbVRleHQpLnJlcGxhY2UobWluLCBtYXgsIHBhc3RlKTsKLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKLQogICAgICAgICAgICAgY2FzZSBJRF9DT1BZX1VSTDoKICAgICAgICAgICAgICAgICBNZXRhS2V5S2V5TGlzdGVuZXIuc3RvcFNlbGVjdGluZyh0aGlzLCAoU3Bhbm5hYmxlKSBtVGV4dCk7CiAKLSAgICAgICAgICAgICAgICBVUkxTcGFuW10gdXJscyA9ICgoU3Bhbm5lZCkgbVRleHQpLmdldFNwYW5zKG1pbiwgbWF4LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFVSTFNwYW4uY2xhc3MpOwotICAgICAgICAgICAgICAgIGlmICh1cmxzLmxlbmd0aCA9PSAxKSB7Ci0gICAgICAgICAgICAgICAgICAgIGNsaXAuc2V0VGV4dCh1cmxzWzBdLmdldFVSTCgpKTsKLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKLQotICAgICAgICAgICAgY2FzZSBJRF9TV0lUQ0hfSU5QVVRfTUVUSE9EOgotICAgICAgICAgICAgICAgIElucHV0TWV0aG9kTWFuYWdlciBpbW0gPSBJbnB1dE1ldGhvZE1hbmFnZXIucGVla0luc3RhbmNlKCk7Ci0gICAgICAgICAgICAgICAgaWYgKGltbSAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIGltbS5zaG93SW5wdXRNZXRob2RQaWNrZXIoKTsKKyAgICAgICAgICAgICAgICBVUkxTcGFuW10gdXJscyA9ICgoU3Bhbm5lZCkgbVRleHQpLmdldFNwYW5zKG1pbiwgbWF4LCBVUkxTcGFuLmNsYXNzKTsKKyAgICAgICAgICAgICAgICBpZiAodXJscy5sZW5ndGggPj0gMSkgeworICAgICAgICAgICAgICAgICAgICBDbGlwcGVkRGF0YSBjbGlwID0gbnVsbDsKKyAgICAgICAgICAgICAgICAgICAgZm9yIChpbnQgaT0wOyBpPHVybHMubGVuZ3RoOyBpKyspIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIFVyaSB1cmkgPSBVcmkucGFyc2UodXJsc1swXS5nZXRVUkwoKSk7CisgICAgICAgICAgICAgICAgICAgICAgICBDbGlwcGVkRGF0YS5JdGVtIGl0ZW0gPSBuZXcgQ2xpcHBlZERhdGEuSXRlbSh1cmkpOworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNsaXAgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsaXAgPSBuZXcgQ2xpcHBlZERhdGEobnVsbCwgbnVsbCwgaXRlbSk7CisgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsaXAuYWRkSXRlbShpdGVtKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBjbGlwYm9hcmQuc2V0UHJpbWFyeUNsaXAoY2xpcCk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwogCi0gICAgICAgICAgICBjYXNlIElEX0FERF9UT19ESUNUSU9OQVJZOgotICAgICAgICAgICAgICAgIFN0cmluZyB3b3JkID0gZ2V0V29yZEZvckRpY3Rpb25hcnkoKTsKLQotICAgICAgICAgICAgICAgIGlmICh3b3JkICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgSW50ZW50IGkgPSBuZXcgSW50ZW50KCJjb20uYW5kcm9pZC5zZXR0aW5ncy5VU0VSX0RJQ1RJT05BUllfSU5TRVJUIik7Ci0gICAgICAgICAgICAgICAgICAgIGkucHV0RXh0cmEoIndvcmQiLCB3b3JkKTsKLSAgICAgICAgICAgICAgICAgICAgaS5zZXRGbGFncyhpLmdldEZsYWdzKCkgfCBJbnRlbnQuRkxBR19BQ1RJVklUWV9ORVdfVEFTSyk7Ci0gICAgICAgICAgICAgICAgICAgIGdldENvbnRleHQoKS5zdGFydEFjdGl2aXR5KGkpOwotICAgICAgICAgICAgICAgIH0KLQorICAgICAgICAgICAgY2FzZSBJRF9TRUxFQ1RJT05fTU9ERToKKyAgICAgICAgICAgICAgICBzdGFydFNlbGVjdGlvbkFjdGlvbk1vZGUoKTsKICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgICAgICAgIH0KIAogICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgfQogCisgICAgQE92ZXJyaWRlCiAgICAgcHVibGljIGJvb2xlYW4gcGVyZm9ybUxvbmdDbGljaygpIHsKICAgICAgICAgaWYgKHN1cGVyLnBlcmZvcm1Mb25nQ2xpY2soKSkgewogICAgICAgICAgICAgbUVhdFRvdWNoUmVsZWFzZSA9IHRydWU7CiAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgaWYgKHN0YXJ0U2VsZWN0aW9uQWN0aW9uTW9kZSgpKSB7CisgICAgICAgICAgICBwZXJmb3JtSGFwdGljRmVlZGJhY2soSGFwdGljRmVlZGJhY2tDb25zdGFudHMuTE9OR19QUkVTUyk7CisgICAgICAgICAgICBtRWF0VG91Y2hSZWxlYXNlID0gdHJ1ZTsKKyAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICB9CiAKICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgIH0KIAorICAgIHByaXZhdGUgYm9vbGVhbiB0b3VjaFBvc2l0aW9uSXNJblNlbGVjdGlvbigpIHsKKyAgICAgICAgaW50IHNlbGVjdGlvblN0YXJ0ID0gZ2V0U2VsZWN0aW9uU3RhcnQoKTsKKyAgICAgICAgaW50IHNlbGVjdGlvbkVuZCA9IGdldFNlbGVjdGlvbkVuZCgpOworCisgICAgICAgIGlmIChzZWxlY3Rpb25TdGFydCA9PSBzZWxlY3Rpb25FbmQpIHsKKyAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgfQorCisgICAgICAgIGlmIChzZWxlY3Rpb25TdGFydCA+IHNlbGVjdGlvbkVuZCkgeworICAgICAgICAgICAgaW50IHRtcCA9IHNlbGVjdGlvblN0YXJ0OworICAgICAgICAgICAgc2VsZWN0aW9uU3RhcnQgPSBzZWxlY3Rpb25FbmQ7CisgICAgICAgICAgICBzZWxlY3Rpb25FbmQgPSB0bXA7CisgICAgICAgICAgICBTZWxlY3Rpb24uc2V0U2VsZWN0aW9uKChTcGFubmFibGUpIG1UZXh0LCBzZWxlY3Rpb25TdGFydCwgc2VsZWN0aW9uRW5kKTsKKyAgICAgICAgfQorCisgICAgICAgIFNlbGVjdGlvbk1vZGlmaWVyQ3Vyc29yQ29udHJvbGxlciBzZWxlY3Rpb25Nb2RpZmllckN1cnNvckNvbnRyb2xsZXIgPQorICAgICAgICAgICAgKChTZWxlY3Rpb25Nb2RpZmllckN1cnNvckNvbnRyb2xsZXIpIG1TZWxlY3Rpb25Nb2RpZmllckN1cnNvckNvbnRyb2xsZXIpOworICAgICAgICBpbnQgbWluT2Zmc2V0ID0gc2VsZWN0aW9uTW9kaWZpZXJDdXJzb3JDb250cm9sbGVyLmdldE1pblRvdWNoT2Zmc2V0KCk7CisgICAgICAgIGludCBt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V3IGhhcyBubyBzZWxlY3Rpb24gY29udHJvbGxlci4gQWN0aW9uIG1vZGUgY2FuY2VsbGVkLiIpOworICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKCFyZXF1ZXN0Rm9jdXMoKSkgeworICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgbW9kZS5zZXRUaXRsZShtQ29udGV4dC5nZXRTdHJpbmcoY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHJpbmcudGV4dFNlbGVjdGlvbkNBQlRpdGxlKSk7CisgICAgICAgICAgICBtb2RlLnNldFN1YnRpdGxlKG51bGwpOworCisgICAgICAgICAgICBzZWxlY3RDdXJyZW50V29yZCgpOworCisgICAgICAgICAgICBib29sZWFuIGF0TGVhc3RPbmUgPSBmYWxzZTsKKworICAgICAgICAgICAgaWYgKGNhblNlbGVjdEFsbCgpKSB7CisgICAgICAgICAgICAgICAgbWVudS5hZGQoMCwgSURfU0VMRUNUX0FMTCwgMCwgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHJpbmcuc2VsZWN0QWxsKS4KKyAgICAgICAgICAgICAgICAgICAgc2V0SWNvbihjb20uYW5kcm9pZC5pbnRlcm5hbC5SLmRyYXdhYmxlLmljX21lbnVfY2hhdF9kYXNoYm9hcmQpLgorICAgICAgICAgICAgICAgICAgICBzZXRBbHBoYWJldGljU2hvcnRjdXQoJ2EnKTsKKyAgICAgICAgICAgICAgICBhdExlYXN0T25lID0gdHJ1ZTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKGNhbkN1dCgpKSB7CisgICAgICAgICAgICAgICAgbWVudS5hZGQoMCwgSURfQ1VULCAwLCBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0cmluZy5jdXQpLgorICAgICAgICAgICAgICAgICAgICBzZXRJY29uKGNvbS5hbmRyb2lkLmludGVybmFsLlIuZHJhd2FibGUuaWNfbWVudV9jb21wb3NlKS4KKyAgICAgICAgICAgICAgICAgICAgc2V0QWxwaGFiZXRpY1Nob3J0Y3V0KCd4Jyk7CisgICAgICAgICAgICAgICAgYXRMZWFzdE9uZSA9IHRydWU7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmIChjYW5Db3B5KCkpIHsKKyAgICAgICAgICAgICAgICBtZW51LmFkZCgwLCBJRF9DT1BZLCAwLCBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0cmluZy5jb3B5KS4KKyAgICAgICAgICAgICAgICAgICAgc2V0SWNvbihjb20uYW5kcm9pZC5pbnRlcm5hbC5SLmRyYXdhYmxlLmljX21lbnVfYXR0YWNobWVudCkuCisgICAgICAgICAgICAgICAgICAgIHNldEFscGhhYmV0aWNTaG9ydGN1dCgnYycpOworICAgICAgICAgICAgICAgIGF0TGVhc3RPbmUgPSB0cnVlOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpZiAoY2FuUGFzdGUoKSkgeworICAgICAgICAgICAgICAgIG1lbnUuYWRkKDAsIElEX1BBU1RFLCAwLCBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0cmluZy5wYXN0ZSkuCisgICAgICAgICAgICAgICAgICAgICAgICBzZXRJY29uKGNvbS5hbmRyb2lkLmludGVybmFsLlIuZHJhd2FibGUuaWNfbWVudV9jYW1lcmEpLgorICAgICAgICAgICAgICAgICAgICAgICAgc2V0QWxwaGFiZXRpY1Nob3J0Y3V0KCd2Jyk7CisgICAgICAgICAgICAgICAgYXRMZWFzdE9uZSA9IHRydWU7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmIChhdExlYXN0T25lKSB7CisgICAgICAgICAgICAgICAgbVNlbGVjdGlvbk1vZGlmaWVyQ3Vyc29yQ29udHJvbGxlci5zaG93KCk7CisgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHByaXZhdGUgdm9pZCBzZWxlY3RDdXJyZW50V29yZCgpIHsKKyAgICAgICAgICAgIC8vIEluIGNhc2Ugc2VsZWN0aW9uIG1vZGUgaXMgc3RhcnRlZCBhZnRlciBhbiBvcmllbnRhdGlvbiBjaGFuZ2UsIHVzZSB0aGUgY3VycmVudAorICAgICAgICAgICAgLy8gc2VsZWN0aW9uIGluc3RlYWQgb2YgY3JlYXRpbmcgb25lCisgICAgICAgICAgICBpZiAoaGFzU2VsZWN0aW9uKCkpIHsKKyAgICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGludCBzZWxlY3Rpb25TdGFydCwgc2VsZWN0aW9uRW5kOworCisgICAgICAgICAgICBTZWxlY3Rpb25Nb2RpZmllckN1cnNvckNvbnRyb2xsZXIgc2VsZWN0aW9uTW9kaWZpZXJDdXJzb3JDb250cm9sbGVyID0KKyAgICAgICAgICAgICAgICAoKFNlbGVjdGlvbk1vZGlmaWVyQ3Vyc29yQ29udHJvbGxlcikgbVNlbGVjdGlvbk1vZGlmaWVyQ3Vyc29yQ29udHJvbGxlcik7CisgICAgICAgICAgICBpbnQgbWluT2Zmc2V0ID0gc2VsZWN0aW9uTW9kaWZpZXJDdXJzb3JDb250cm9sbGVyLmdldE1pblRvdWNoT2Zmc2V0KCk7CisgICAgICAgICAgICBpbnQgbWF4T2Zmc2V0ID0gc2VsZWN0aW9uTW9kaWZpZXJDdXJzb3JDb250cm9sbGVyLmdldE1heFRvdWNoT2Zmc2V0KCk7CisKKyAgICAgICAgICAgIGxvbmcgd29yZExpbWl0cyA9IGdldFdvcmRMaW1pdHNBdChtaW5PZmZzZXQpOworICAgICAgICAgICAgaWYgKHdvcmRMaW1pdHMgPj0gMCkgeworICAgICAgICAgICAgICAgIHNlbGVjdGlvblN0YXJ0ID0gKGludCkgKHdvcmRMaW1pdHMgPj4+IDMyKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgc2VsZWN0aW9uU3RhcnQgPSBNYXRoLm1heChtaW5PZmZzZXQgLSA1LCAwKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgd29yZExpbWl0cyA9IGdldFdvcmRMaW1pdHNBdChtYXhPZmZzZXQpOworICAgICAgICAgICAgaWYgKHdvcmRMaW1pdHMgPj0gMCkgeworICAgICAgICAgICAgICAgIHNlbGVjdGlvbkVuZCA9IChpbnQpICh3b3JkTGltaXRzICYgMHgwMDAwMDAwMEZGRkZGRkZGTCk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIHNlbGVjdGlvbkVuZCA9IE1hdGgubWluKG1heE9mZnNldCArIDUsIG1UZXh0Lmxlbmd0aCgpKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgU2VsZWN0aW9uLnNldFNlbGVjdGlvbigoU3Bhbm5hYmxlKSBtVGV4dCwgc2VsZWN0aW9uU3RhcnQsIHNlbGVjdGlvbkVuZCk7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIGJvb2xlYW4gb25QcmVwYXJlQWN0aW9uTW9kZShBY3Rpb25Nb2RlIG1vZGUsIE1lbnUgbWVudSkgeworICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIGJvb2xlYW4gb25BY3Rpb25JdGVtQ2xpY2tlZChBY3Rpb25Nb2RlIG1vZGUsIE1lbnVJdGVtIGl0ZW0pIHsKKyAgICAgICAgICAgIGZpbmFsIGludCBpdGVtSWQgPSBpdGVtLmdldEl0ZW1JZCgpOworCisgICAgICAgICAgICBpZiAoaXRlbUlkID09IElEX1NFTEVDVF9BTEwpIHsKKyAgICAgICAgICAgICAgICBTZWxlY3Rpb24uc2V0U2VsZWN0aW9uKChTcGFubmFibGUpIG1UZXh0LCAwLCBtVGV4dC5sZW5ndGgoKSk7CisgICAgICAgICAgICAgICAgLy8gVXBkYXRlIGNvbnRyb2xsZXIgcG9zaXRpb25zIGFmdGVyIHNlbGVjdGlvbiBjaGFuZ2UuCisgICAgICAgICAgICAgICAgaWYgKG1TZWxlY3Rpb25Nb2RpZmllckN1cnNvckNvbnRyb2xsZXIgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICBtU2VsZWN0aW9uTW9kaWZpZXJDdXJzb3JDb250cm9sbGVyLnNob3coKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIENsaXBib2FyZE1hbmFnZXIgY2xpcGJvYXJkID0gKENsaXBib2FyZE1hbmFnZXIpIGdldENvbnRleHQoKS4KKyAgICAgICAgICAgICAgICAgICAgZ2V0U3lzdGVtU2VydmljZShDb250ZXh0LkNMSVBCT0FSRF9TRVJWSUNFKTsKKworICAgICAgICAgICAgaW50IG1pbiA9IDA7CisgICAgICAgICAgICBpbnQgbWF4ID0gbVRleHQubGVuZ3RoKCk7CisKKyAgICAgICAgICAgIGlmIChpc0ZvY3VzZWQoKSkgeworICAgICAgICAgICAgICAgIGZpbmFsIGludCBzZWxTdGFydCA9IGdldFNlbGVjdGlvblN0YXJ0KCk7CisgICAgICAgICAgICAgICAgZmluYWwgaW50IHNlbEVuZCA9IGdldFNlbGVjdGlvbkVuZCgpOworCisgICAgICAgICAgICAgICAgbWluID0gTWF0aC5tYXgoMCwgTWF0aC5taW4oc2VsU3RhcnQsIHNlbEVuZCkpOworICAgICAgICAgICAgICAgIG1heCA9IE1hdGgubWF4KDAsIE1hdGgubWF4KHNlbFN0YXJ0LCBzZWxFbmQpKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgc3dpdGNoIChpdGVtLmdldEl0ZW1JZCgpKSB7CisgICAgICAgICAgICAgICAgY2FzZSBJRF9QQVNURToKKyAgICAgICAgICAgICAgICAgICAgQ2xpcHBlZERhdGEgY2xpcCA9IGNsaXBib2FyZC5nZXRQcmltYXJ5Q2xpcCgpOworICAgICAgICAgICAgICAgICAgICBpZiAoY2xpcCAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBib29sZWFuIGRpZGZpcnN0ID0gZmFsc2U7CisgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGludCBpPTA7IGk8Y2xpcC5nZXRJdGVtQ291bnQoKTsgaSsrKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ2hhclNlcXVlbmNlIHBhc3RlID0gY2xpcC5nZXRJdGVtKGkpLmNvZXJjZVRvVGV4dChnZXRDb250ZXh0KCkpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChwYXN0ZSAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZGlkZmlyc3QpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNlbGVjdGlvbi5zZXRTZWxlY3Rpb24oKFNwYW5uYWJsZSkgbVRleHQsIG1heCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoKEVkaXRhYmxlKSBtVGV4dCkucmVwbGFjZShtaW4sIG1heCwgcGFzdGUpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKChFZGl0YWJsZSkgbVRleHQpLmluc2VydChnZXRTZWxlY3Rpb25FbmQoKSwgIlxuIik7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoKEVkaXRhYmxlKSBtVGV4dCkuaW5zZXJ0KGdldFNlbGVjdGlvbkVuZCgpLCBwYXN0ZSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBzdG9wU2VsZWN0aW9uQWN0aW9uTW9kZSgpOworICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisKKyAgICAgICAgICAgICAgICBjYXNlIElEX0NVVDoKKyAgICAgICAgICAgICAgICAgICAgY2xpcGJvYXJkLnNldFByaW1hcnlDbGlwKG5ldyBDbGlwcGVkRGF0YShudWxsLCBudWxsLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5ldyBDbGlwcGVkRGF0YS5JdGVtKG1UcmFuc2Zvcm1lZC5zdWJTZXF1ZW5jZShtaW4sIG1heCkpKSk7CisgICAgICAgICAgICAgICAgICAgICgoRWRpdGFibGUpIG1UZXh0KS5kZWxldGUobWluLCBtYXgpOworICAgICAgICAgICAgICAgICAgICBzdG9wU2VsZWN0aW9uQWN0aW9uTW9kZSgpOworICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKworICAgICAgICAgICAgICAgIGNhc2UgSURfQ09QWToKKyAgICAgICAgICAgICAgICAgICAgY2xpcGJvYXJkLnNldFByaW1hcnlDbGlwKG5ldyBDbGlwcGVkRGF0YShudWxsLCBudWxsLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5ldyBDbGlwcGVkRGF0YS5JdGVtKG1UcmFuc2Zvcm1lZC5zdWJTZXF1ZW5jZShtaW4sIG1heCkpKSk7CisgICAgICAgICAgICAgICAgICAgIHN0b3BTZWxlY3Rpb25BY3Rpb25Nb2RlKCk7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIHZvaWQgb25EZXN0cm95QWN0aW9uTW9kZShBY3Rpb25Nb2RlIG1vZGUpIHsKKyAgICAgICAgICAgIFNlbGVjdGlvbi5zZXRTZWxlY3Rpb24oKFNwYW5uYWJsZSkgbVRleHQsIGdldFNlbGVjdGlvblN0YXJ0KCkpOworICAgICAgICAgICAgaWYgKG1TZWxlY3Rpb25Nb2RpZmllckN1cnNvckNvbnRyb2xsZXIgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIG1TZWxlY3Rpb25Nb2RpZmllckN1cnNvckNvbnRyb2xsZXIuaGlkZSgpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgbVNlbGVjdGlvbkFjdGlvbk1vZGUgPSBudWxsOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogQSBDdXJzb3JDb250cm9sbGVyIGluc3RhbmNlIGNhbiBiZSB1c2VkIHRvIGNvbnRyb2wgYSBjdXJzb3IgaW4gdGhlIHRleHQuCisgICAgICoKKyAgICAgKiBJdCBjYW4gYmUgcGFzc2VkIHRvIGFuIHtAbGluayBBcnJvd0tleU1vdmVtZW50TWV0aG9kfSB3aGljaCBjYW4gaW50ZXJjZXB0cyBldmVudHMKKyAgICAgKiBhbmQgc2VuZCB0aGVtIHRvIHRoaXMgb2JqZWN0IGluc3RlYWQgb2YgdGhlIGN1cnNvci4KKyAgICAgKi8KKyAgICBwdWJsaWMgaW50ZXJmYWNlIEN1cnNvckNvbnRyb2xsZXIgeworICAgICAgICAvKiBDdXJzb3IgZmFkZS1vdXQgYW5pbWF0aW9uIGR1cmF0aW9uLCBpbiBtaWxsaXNlY29uZHMuICovCisgICAgICAgIHN0YXRpYyBmaW5hbCBpbnQgRkFERV9PVVRfRFVSQVRJT04gPSA0MDA7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIE1ha2VzIHRoZSBjdXJzb3IgY29udHJvbGxlciB2aXNpYmxlIG9uIHNjcmVlbi4gV2lsbCBiZSBkcmF3biBieSB7QGxpbmsgI2RyYXcoQ2FudmFzKX0uCisgICAgICAgICAqIFNlZSBhbHNvIHtAbGluayAjaGlkZSgpfS4KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyB2b2lkIHNob3coKTsKKworICAgICAgICAvKioKKyAgICAgICAgICogSGlkZSB0aGUgY3Vyc29yIGNvbnRyb2xsZXIgZnJvbSBzY3JlZW4uCisgICAgICAgICAqIFNlZSBhbHNvIHtAbGluayAjc2hvdygpfS4KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyB2b2lkIGhpZGUoKTsKKworICAgICAgICAvKioKKyAgICAgICAgICogVXBkYXRlIHRoZSBjb250cm9sbGVyJ3MgcG9zaXRpb24uCisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgdm9pZCB1cGRhdGVQb3NpdGlvbihpbnQgb2Zmc2V0KTsKKworICAgICAgICAvKioKKyAgICAgICAgICogVGhlIGNvbnRyb2xsZXIgYW5kIHRoZSBjdXJzb3IncyBwb3NpdGlvbnMgY2FuIGJlIGxpbmsgYnkgYSBmaXhlZCBvZmZzZXQsCisgICAgICAgICAqIGNvbXB1dGVkIHdoZW4gdGhlIGNvbnRyb2xsZXIgaXMgdG91Y2hlZCwgYW5kIHRoZW4gbWFpbnRhaW5lZCBhcyBpdCBtb3ZlcworICAgICAgICAgKiBAcmV0dXJuIEhvcml6b250YWwgb2Zmc2V0IGJldHdlZW4gdGhlIGNvbnRyb2xsZXIgYW5kIHRoZSBjdXJzb3IuCisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgZmxvYXQgZ2V0T2Zmc2V0WCgpOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBAcmV0dXJuIFZlcnRpY2FsIG9mZnNldCBiZXR3ZWVuIHRoZSBjb250cm9sbGVyIGFuZCB0aGUgY3Vyc29yLgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIGZsb2F0IGdldE9mZnNldFkoKTsKKworICAgICAgICAvKioKKyAgICAgICAgICogVGhpcyBtZXRob2QgaXMgY2FsbGVkIGJ5IHtAbGluayAjb25Ub3VjaEV2ZW50KE1vdGlvbkV2ZW50KX0gYW5kIGdpdmVzIHRoZSBjb250cm9sbGVyCisgICAgICAgICAqIGEgY2hhbmNlIHRvIGJlY29tZSBhY3RpdmUgYW5kL29yIHZpc2libGUuCisgICAgICAgICAqIEBwYXJhbSBldmVudCBUaGUgdG91Y2ggZXZlbnQKKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyB2b2lkIG9uVG91Y2hFdmVudChNb3Rpb25FdmVudCBldmVudCk7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIERyYXdzIGEgdmlzdWFsIHJlcHJlc2VudGF0aW9uIG9mIHRoZSBjb250cm9sbGVyIG9uIHRoZSBjYW52YXMuCisgICAgICAgICAqCisgICAgICAgICAqIENhbGxlZCBhdCB0aGUgZW5kIG9mIHtAbGluayAjZHJhdyhDYW52YXMpfSwgaW4gdGhlIGNvbnRlbnQgY29vcmRpbmF0ZXMgc3lzdGVtLgorICAgICAgICAgKiBAcGFyYW0gY2FudmFzIFRoZSBDYW52YXMgdXNlZCBieSB0aGlzIFRleHRWaWV3LgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHZvaWQgZHJhdyhDYW52YXMgY2FudmFzKTsKKyAgICB9CisKKyAgICBwcml2YXRlIGNsYXNzIEhhbmRsZSB7CisgICAgICAgIERyYXdhYmxlIG1EcmF3YWJsZTsKKyAgICAgICAgLy8gVmVydGljYWwgZXh0ZW5zaW9uIG9mIHRoZSB0b3VjaCByZWdpb24KKyAgICAgICAgaW50IG1Ub3BFeHRlbnNpb24sIG1Cb3R0b21FeHRlbnNpb247CisgICAgICAgIC8vIFBvc2l0aW9uIG9mIHRoZSB2aXJ0dWFsIGZpbmdlciBwb3NpdGlvbiBvbiBzY3JlZW4KKyAgICAgICAgaW50IG1Ib3BTcG90VmVydGNhbFBvc2l0aW9uOworICAgICAgICAKKyAgICAgICAgSGFuZGxlKERyYXdhYmxlIGRyYXdhYmxlKSB7CisgICAgICAgICAgICBtRHJhd2FibGUgPSBkcmF3YWJsZTsKKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgdm9pZCBwb3NpdGlvbkF0Q3Vyc29yKGZpbmFsIGludCBvZmZzZXQsIGJvb2xlYW4gYm90dG9tKSB7CisgICAgICAgICAgICBmaW5hbCBpbnQgZHJhd2FibGVXaWR0aCA9IG1EcmF3YWJsZS5nZXRJbnRyaW5zaWNXaWR0aCgpOworICAgICAgICAgICAgZmluYWwgaW50IGRyYXdhYmxlSGVpZ2h0ID0gbURyYXdhYmxlLmdldEludHJpbnNpY0hlaWdodCgpOworICAgICAgICAgICAgZmluYWwgaW50IGxpbmUgPSBtTGF5b3V0LmdldExpbmVGb3JPZmZzZXQob2Zmc2V0KTsKKyAgICAgICAgICAgIGZpbmFsIGludCBsaW5lVG9wID0gbUxheW91dC5nZXRMaW5lVG9wKGxpbmUpOworICAgICAgICAgICAgZmluYWwgaW50IGxpbmVCb3R0b20gPSBtTGF5b3V0LmdldExpbmVCb3R0b20obGluZSk7CisKKyAgICAgICAgICAgIG1Ib3BTcG90VmVydGNhbFBvc2l0aW9uID0gbGluZVRvcCArIChib3R0b20gPyAoMyAqIChsaW5lQm90dG9tIC0gbGluZVRvcCkpIC8gNCA6CisgICAgICAgICAgICAgICAgKGxpbmVCb3R0b20gLSBsaW5lVG9wKSAvIDQpOworCisgICAgICAgICAgICBmaW5hbCBSZWN0IGJvdW5kcyA9IHNDdXJzb3JDb250cm9sbGVyVGVtcFJlY3Q7CisgICAgICAgICAgICBib3VuZHMubGVmdCA9IChpbnQpIChtTGF5b3V0LmdldFByaW1hcnlIb3Jpem9udGFsKG9mZnNldCkgLSBkcmF3YWJsZVdpZHRoIC8gMi4wKTsKKyAgICAgICAgICAgIGJvdW5kcy50b3AgPSAoYm90dG9tID8gbGluZUJvdHRvbSA6IGxpbmVUb3ApIC0gZHJhd2FibGVIZWlnaHQgLyAyOworCisgICAgICAgICAgICBtVG9wRXh0ZW5zaW9uID0gYm90dG9tID8gMCA6IGRyYXdhYmxlSGVpZ2h0IC8gMjsKKyAgICAgICAgICAgIG1Cb3R0b21FeHRlbnNpb24gPSBkcmF3YWJsZUhlaWdodDsKKworICAgICAgICAgICAgLy8gRXh0ZW5kIHRvdWNoIHJlZ2lvbiB1cCB3aGVuIGVkaXRpbmcgdGhlIGxhc3QgbGluZSBvZiB0ZXh0IChvciBhIHNpbmdsZSBsaW5lKSBzbyB0aGF0CisgICAgICAgICAgICAvLyBpdCBpcyBlYXNpZXIgdG8gZ3JhYi4KKyAgICAgICAgICAgIGlmIChsaW5lID09IG1MYXlvdXQuZ2V0TGluZUNvdW50KCkgLSAxKSB7CisgICAgICAgICAgICAgICAgICBtVG9wRXh0ZW5zaW9uID0gKGxpbmVCb3R0b20gLSBsaW5lVG9wKSAtIGRyYXdhYmxlSGVpZ2h0IC8gMjsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgYm91bmRzLnJpZ2h0ID0gYm91bmRzLmxlZnQgKyBkcmF3YWJsZVdpZHRoOworICAgICAgICAgICAgYm91bmRzLmJvdHRvbSA9IGJvdW5kcy50b3AgKyBkcmF3YWJsZUhlaWdodDsKKworICAgICAgICAgICAgaW50IGJvdW5kVG9wQmVmb3JlID0gYm91bmRzLnRvcDsKKyAgICAgICAgICAgIGNvbnZlcnRGcm9tVmlld3BvcnRUb0NvbnRlbnRDb29yZGluYXRlcyhib3VuZHMpOworICAgICAgICAgICAgbUhvcFNwb3RWZXJ0Y2FsUG9zaXRpb24gKz0gYm91bmRzLnRvcCAtIGJvdW5kVG9wQmVmb3JlOworICAgICAgICAgICAgbURyYXdhYmxlLnNldEJvdW5kcyhib3VuZHMpOworICAgICAgICAgICAgcG9zdEludmFsaWRhdGUoKTsKKyAgICAgICAgfQorCisgICAgICAgIGJvb2xlYW4gaGFzRmluZ2VyT24oZmxvYXQgeCwgZmxvYXQgeSkgeworICAgICAgICAgICAgLy8gU2ltdWxhdGUgYSAnZmF0IGZpbmdlcicgdG8gZWFzZSBncmFiYmluZyBvZiB0aGUgY29udHJvbGxlci4KKyAgICAgICAgICAgIC8vIEV4cGFuZHMgYWNjb3JkaW5nIHRvIGNvbnRyb2xsZXIgaW1hZ2Ugc2l6ZSBpbnN0ZWFkIG9mIHVzaW5nIGRpcCBkaXN0YW5jZS4KKyAgICAgICAgICAgIC8vIEFzc3VtZXMgY29udHJvbGxlciBpbWFnZXIgaGFzIGEgc2Vuc2libGUgc2l6ZSwgcHJvcG9ydGlvbm5hbCB0byBzY3JlZW4gZGVuc2l0eS4KKyAgICAgICAgICAgIGZpbmFsIGludCBkcmF3YWJsZVdpZHRoID0gbURyYXdhYmxlLmdldEludHJpbnNpY1dpZHRoKCk7CisgICAgICAgICAgICBmaW5hbCBSZWN0IGZpbmdlclJlY3QgPSBzQ3Vyc29yQ29udHJvbGxlclRlbXBSZWN0OworICAgICAgICAgICAgZmluZ2VyUmVjdC5zZXQoKGludCkgKHggLSBkcmF3YWJsZVdpZHRoIC8gMi4wKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIChpbnQpICh5IC0gbUJvdHRvbUV4dGVuc2lvbiksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAoaW50KSAoeCArIGRyYXdhYmxlV2lkdGggLyAyLjApLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgKGludCkgKHkgKyBtVG9wRXh0ZW5zaW9uKSk7CisgICAgICAgICAgICByZXR1cm4gUmVjdC5pbnRlcnNlY3RzKG1EcmF3YWJsZS5nZXRCb3VuZHMoKSwgZmluZ2VyUmVjdCk7CisgICAgICAgIH0KKworICAgICAgICB2b2lkIHBvc3RJbnZhbGlkYXRlKCkgeworICAgICAgICAgICAgZmluYWwgUmVjdCBib3VuZHMgPSBtRHJhd2FibGUuZ2V0Qm91bmRzKCk7CisgICAgICAgICAgICBUZXh0Vmlldy50aGlzLnBvc3RJbnZhbGlkYXRlKGJvdW5kcy5sZWZ0LCBib3VuZHMudG9wLCBib3VuZHMucmlnaHQsIGJvdW5kcy5ib3R0b20pOworICAgICAgICB9CisKKyAgICAgICAgdm9pZCBwb3N0SW52YWxpZGF0ZURlbGF5ZWQobG9uZyBkZWxheSkgeworICAgICAgICAgICAgZmluYWwgUmVjdCBib3VuZHMgPSBtRHJhd2FibGUuZ2V0Qm91bmRzKCk7CisgICAgICAgICAgICBUZXh0Vmlldy50aGlzLnBvc3RJbnZhbGlkYXRlRGVsYXllZChkZWxheSwgYm91bmRzLmxlZnQsIGJvdW5kcy50b3AsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm91bmRzLnJpZ2h0LCBib3VuZHMuYm90dG9tKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIGNsYXNzIEluc2VydGlvblBvaW50Q3Vyc29yQ29udHJvbGxlciBpbXBsZW1lbnRzIEN1cnNvckNvbnRyb2xsZXIgeworICAgICAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgREVMQVlfQkVGT1JFX0ZBREVfT1VUID0gMjEwMDsKKworICAgICAgICAvLyBXaGV0aGVyIG9yIG5vdCB0aGUgY3Vyc29yIGNvbnRyb2wgaXMgY3VycmVudGx5IHZpc2libGUKKyAgICAgICAgcHJpdmF0ZSBib29sZWFuIG1Jc1Zpc2libGUgPSBmYWxzZTsKKyAgICAgICAgLy8gU3RhcnRpbmcgdGltZSBvZiB0aGUgZmFkZSB0aW1lcgorICAgICAgICBwcml2YXRlIGxvbmcgbUZhZGVPdXRUaW1lclN0YXJ0OworICAgICAgICAvLyBUaGUgY3Vyc29yIGNvbnRyb2xsZXIgaW1hZ2UKKyAgICAgICAgcHJpdmF0ZSBmaW5hbCBIYW5kbGUgbUhhbmRsZTsKKyAgICAgICAgLy8gVXNlZCB0byBkZXRlY3QgYSB0YXAgKHZzIGRyYWcpIG9uIHRoZSBjb250cm9sbGVyCisgICAgICAgIHByaXZhdGUgbG9uZyBtT25Eb3duVGltZXJTdGFydDsKKyAgICAgICAgLy8gT2Zmc2V0IGJldHdlZW4gZmluZ2VyIGhvdCBwb2ludCBvbiBjdXJzb3IgY29udHJvbGxlciBhbmQgYWN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URFX09VVDsKKyAgICAgICAgICAgICAgICAgICAgbUhhbmRsZS5wb3N0SW52YWxpZGF0ZSgpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyB2b2lkIGRyYXcoQ2FudmFzIGNhbnZhcykgeworICAgICAgICAgICAgaWYgKG1Jc1Zpc2libGUpIHsKKyAgICAgICAgICAgICAgICBpbnQgdGltZSA9IChpbnQpIChTeXN0ZW0uY3VycmVudFRpbWVNaWxsaXMoKSAtIG1GYWRlT3V0VGltZXJTdGFydCk7CisgICAgICAgICAgICAgICAgaWYgKHRpbWUgPD0gREVMQVlfQkVGT1JFX0ZBREVfT1VUKSB7CisgICAgICAgICAgICAgICAgICAgIG1IYW5kbGUucG9zdEludmFsaWRhdGVEZWxheWVkKERFTEFZX0JFRk9SRV9GQURFX09VVCAtIHRpbWUpOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIHRpbWUgLT0gREVMQVlfQkVGT1JFX0ZBREVfT1VUOworICAgICAgICAgICAgICAgICAgICBpZiAodGltZSA8PSBGQURFX09VVF9EVVJBVElPTikgeworICAgICAgICAgICAgICAgICAgICAgICAgZmluYWwgaW50IGFscGhhID0gKGludCkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKCgyNTUuMCAqIChGQURFX09VVF9EVVJBVElPTiAtIHRpbWUpKSAvIEZBREVfT1VUX0RVUkFUSU9OKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1IYW5kbGUubURyYXdhYmxlLnNldEFscGhhKGFscGhhKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1IYW5kbGUucG9zdEludmFsaWRhdGVEZWxheWVkKDMwKTsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1IYW5kbGUubURyYXdhYmxlLnNldEFscGhhKDApOworICAgICAgICAgICAgICAgICAgICAgICAgbUlzVmlzaWJsZSA9IGZhbHNlOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIG1IYW5kbGUubURyYXdhYmxlLmRyYXcoY2FudmFzKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyB2b2lkIHVwZGF0ZVBvc2l0aW9uKGludCBvZmZzZXQpIHsKKyAgICAgICAgICAgIGlmIChvZmZzZXQgPT0gZ2V0U2VsZWN0aW9uU3RhcnQoKSkgeworICAgICAgICAgICAgICAgIHJldHVybjsgLy8gTm8gY2hhbmdlLCBubyBuZWVkIHRvIHJlZHJhdworICAgICAgICAgICAgfQorICAgICAgICAgICAgU2VsZWN0aW9uLnNldFNlbGVjdGlvbigoU3Bhbm5hYmxlKSBtVGV4dCwgb2Zmc2V0KTsKKyAgICAgICAgICAgIHVwZGF0ZURyYXdhYmxlUG9zaXRpb24oKTsKKyAgICAgICAgfQorCisgICAgICAgIHByaXZhdGUgdm9pZCB1cGRhdGVEcmF3YWJsZVBvc2l0aW9uKCkgeworICAgICAgICAgICAgaWYgKG1Jc1Zpc2libGUpIHsKKyAgICAgICAgICAgICAgICAvLyBDbGVhciBwcmV2aW91cyBjdXJzb3IgY29udHJvbGxlciBiZWZvcmUgYm91bmRzIGFyZSB1cGRhdGVkCisgICAgICAgICAgICAgICAgbUhhbmRsZS5wb3N0SW52YWxpZGF0ZSgpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBmaW5hbCBpbnQgb2Zmc2V0ID0gZ2V0U2VsZWN0aW9uU3RhcnQoKTsKKworICAgICAgICAgICAgaWYgKG9mZnNldCA8IDApIHsKKyAgICAgICAgICAgICAgICAvLyBTaG91bGQgbmV2ZXIgaGFwcGVuLCBzYWZldHkgY2hlY2suCisgICAgICAgICAgICAgICAgTG9nLncoTE9HX1RBRywgIlVwZGF0ZSBjdXJzb3IgY29udHJvbGxlciBwb3NpdGlvbiBjYWxsZWQgd2l0aCBubyBjdXJzb3IiKTsKKyAgICAgICAgICAgICAgICBtSXNWaXNpYmxlID0gZmFsc2U7CisgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBtSGFuZGxlLnBvc2l0aW9uQXRDdXJzb3Iob2Zmc2V0LCB0cnVlKTsKKworICAgICAgICAgICAgbUZhZGVPdXRUaW1lclN0YXJ0ID0gU3lzdGVtLmN1cnJlbnRUaW1lTWlsbGlzKCk7CisgICAgICAgICAgICBtSGFuZGxlLm1EcmF3YWJsZS5zZXRBbHBoYSgyNTUpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgb25Ub3VjaEV2ZW50KE1vdGlvbkV2ZW50IGV2ZW50KSB7CisgICAgICAgICAgICBpZiAoaXNGb2N1c2VkKCkgJiYgaXNUZXh0RWRpdGFibGUoKSAmJiBtSXNWaXNpYmxlKSB7CisgICAgICAgICAgICAgICAgc3dpdGNoIChldmVudC5nZXRBY3Rpb25NYXNrZWQoKSkgeworICAgICAgICAgICAgICAgICAgICBjYXNlIE1vdGlvbkV2ZW50LkFDVElPTl9ET1dOIDogeworICAgICAgICAgICAgICAgICAgICAgICAgZmluYWwgZmxvYXQgeCA9IGV2ZW50LmdldFgoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGZpbmFsIGZsb2F0IHkgPSBldmVudC5nZXRZKCk7CisKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtSGFuZGxlLmhhc0Zpbmdlck9uKHgsIHkpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2hvdygpOworCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1Nb3ZlbWVudCBpbnN0YW5jZW9mIEFycm93S2V5TW92ZW1lbnRNZXRob2QpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKChBcnJvd0tleU1vdmVtZW50TWV0aG9kKW1Nb3ZlbWVudCkuc2V0Q3Vyc29yQ29udHJvbGxlcih0aGlzKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobVBhcmVudCAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIFByZXZlbnQgcG9zc2libGUgc2Nyb2xsVmlldyBwYXJlbnQgZnJvbSBzY3JvbGxpbmcsIHNvIHRoYXQKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gd2UgY2FuIHVzZSBhdXRvLXNjcm9sbGluZy4KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVBhcmVudC5yZXF1ZXN0RGlzYWxsb3dJbnRlcmNlcHRUb3VjaEV2ZW50KHRydWUpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZpbmFsIFJlY3QgYm91bmRzID0gbUhhbmRsZS5tRHJhd2FibGUuZ2V0Qm91bmRzKCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbU9mZnNldFggPSAoYm91bmRzLmxlZnQgKyBib3VuZHMucmlnaHQpIC8gMi4wZiAtIHg7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbU9mZnNldFkgPSBtSGFuZGxlLm1Ib3BTcG90VmVydGNhbFBvc2l0aW9uIC0geTsKKworICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1PbkRvd25UaW1lclN0YXJ0ID0gZXZlbnQuZ2V0RXZlbnRUaW1lKCk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgIGNhc2UgTW90aW9uRXZlbnQuQUNUSU9OX1VQIDogeworICAgICAgICAgICAgICAgICAgICAgICAgaW50IHRpbWUgPSAoaW50KSAoZXZlbnQuZ2V0RXZlbnRUaW1lKCkgLSBtT25Eb3duVGltZXJTdGFydCk7CisKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0aW1lIDw9IFZpZXdDb25maWd1cmF0aW9uLmdldFRhcFRpbWVvdXQoKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIEEgdGFwIG9uIHRoZSBjb250cm9sbGVyIChub3QgYSBkcmFnKSB3aWxsIG1vdmUgdGhlIGN1cnNvcgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBvZmZzZXQgPSBnZXRPZmZzZXQoKGludCkgZXZlbnQuZ2V0WCgpLCAoaW50KSBldmVudC5nZXRZKCkpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNlbGVjdGlvbi5zZXRTZWxlY3Rpb24oKFNwYW5uYWJsZSkgbVRleHQsIG9mZnNldCk7CisKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBNb2RpZmllZCBieSBjYW5jZWxMb25nUHJlc3MgYW5kIHByZXZlbnRzIHRoZSBjdXJzb3IgZnJvbSBjaGFuZ2luZworICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1TY3JvbGxlZCA9IGZhbHNlOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgZmxvYXQgZ2V0T2Zmc2V0WCgpIHsKKyAgICAgICAgICAgIHJldHVybiBtT2Zmc2V0WDsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBmbG9hdCBnZXRPZmZzZXRZKCkgeworICAgICAgICAgICAgcmV0dXJuIG1PZmZzZXRZOworICAgICAgICB9CisgICAgfQorCisgICAgY2xhc3MgU2VsZWN0aW9uTW9kaWZpZXJDdXJzb3JDb250cm9sbGVyIGltcGxlbWVudHMgQ3Vyc29yQ29udHJvbGxlciB7CisgICAgICAgIC8vI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cgSGFuZGxlKHJlcy5nZXREcmF3YWJsZShjb20uYW5kcm9pZC5pbnRlcm5hbC5SLmRyYXdhYmxlLnRleHRfc2VsZWN0X2hhbmRsZSkpOworICAgICAgICAgICAgbUVuZEhhbmRsZSA9IG5ldyBIYW5kbGUocmVzLmdldERyYXdhYmxlKGNvbS5hbmRyb2lkLmludGVybmFsLlIuZHJhd2FibGUudGV4dF9zZWxlY3RfaGFuZGxlKSk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCBzaG93KCkgeworICAgICAgICAgICAgdXBkYXRlRHJhd2FibGVzUG9zaXRpb25zKCk7CisgICAgICAgICAgICAvLyBIYXMgdG8gYmUgZG9uZSBhZnRlciB1cGRhdGVQb3NpdGlvbiwgc28gdGhhdCBwcmV2aW91cyBwb3NpdGlvbiBpbnZhbGlkYXRlCisgICAgICAgICAgICAvLyBpbiBvbmx5IGRvbmUgaWYgbmVjZXNzYXJ5LgorICAgICAgICAgICAgbUlzVmlzaWJsZSA9IHRydWU7CisgICAgICAgICAgICBtRmFkZU91dFRpbWVyU3RhcnQgPSAtMTsKKyAgICAgICAgICAgIGhpZGVJbnNlcnRpb25Qb2ludEN1cnNvckNvbnRyb2xsZXIoKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyB2b2lkIGhpZGUoKSB7CisgICAgICAgICAgICBpZiAobUlzVmlzaWJsZSAmJiAobUZhZGVPdXRUaW1lclN0YXJ0IDwgMCkpIHsKKyAgICAgICAgICAgICAgICBtRmFkZU91dFRpbWVyU3RhcnQgPSBTeXN0ZW0uY3VycmVudFRpbWVNaWxsaXMoKTsKKyAgICAgICAgICAgICAgICBtU3RhcnRIYW5kbGUucG9zdEludmFsaWRhdGUoKTsKKyAgICAgICAgICAgICAgICBtRW5kSGFuZGxlLnBvc3RJbnZhbGlkYXRlKCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCBjYW5jZWxGYWRlT3V0QW5pbWF0aW9uKCkgeworICAgICAgICAgICAgbUlzVmlzaWJsZSA9IGZhbHNlOworICAgICAgICAgICAgbVN0YXJ0SGFuZGxlLnBvc3RJbnZhbGlkYXRlKCk7CisgICAgICAgICAgICBtRW5kSGFuZGxlLnBvc3RJbnZhbGlkYXRlKCk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCBkcmF3KENhbnZhcyBjYW52YXMpIHsKKyAgICAgICAgICAgIGlmIChtSXNWaXNpYmxlKSB7CisgICAgICAgICAgICAgICAgaWYgKG1GYWRlT3V0VGltZXJTdGFydCA+PSAwKSB7CisgICAgICAgICAgICAgICAgICAgIGludCB0aW1lID0gKGludCkgKFN5c3RlbS5jdXJyZW50VGltZU1pbGxpcygpIC0gbUZhZGVPdXRUaW1lclN0YXJ0KTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKHRpbWUgPD0gRkFERV9PVVRfRFVSQVRJT04pIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGZpbmFsIGludCBhbHBoYSA9IDI1NSAqIChGQURFX09VVF9EVVJBVElPTiAtIHRpbWUpIC8gRkFERV9PVVRfRFVSQVRJT047CisgICAgICAgICAgICAgICAgICAgICAgICBtU3RhcnRIYW5kbGUubURyYXdhYmxlLnNldEFscGhhKGFscGhhKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1FbmRIYW5kbGUubURyYXdhYmxlLnNldEFscGhhKGFscGhhKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1TdGFydEhhbmRsZS5wb3N0SW52YWxpZGF0ZURlbGF5ZWQoMzApOworICAgICAgICAgICAgICAgICAgICAgICAgbUVuZEhhbmRsZS5wb3N0SW52YWxpZGF0ZURlbGF5ZWQoMzApOworICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAgICAgbVN0YXJ0SGFuZGxlLm1EcmF3YWJsZS5zZXRBbHBoYSgwKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1FbmRIYW5kbGUubURyYXdhYmxlLnNldEFscGhhKDApOworICAgICAgICAgICAgICAgICAgICAgICAgbUlzVmlzaWJsZSA9IGZhbHNlOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIG1TdGFydEhhbmRsZS5tRHJhd2FibGUuZHJhdyhjYW52YXMpOworICAgICAgICAgICAgICAgIG1FbmRIYW5kbGUubURyYXdhYmxlLmRyYXcoY2FudmFzKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyB2b2lkIHVwZGF0ZVBvc2l0aW9uKGludCBvZmZzZXQpIHsKKyAgICAgICAgICAgIGludCBzZWxlY3Rpb25TdGFydCA9IGdldFNlbGVjdGlvblN0YXJ0KCk7CisgICAgICAgICAgICBpbnQgc2VsZWN0aW9uRW5kID0gZ2V0U2VsZWN0aW9uRW5kKCk7CisKKyAgICAgICAgICAgIC8vIEhhbmRsZSB0aGUgY2FzZSB3aGVyZSBzdGFydCBhbmQgZW5kIGFyZSBzd2FwcGVkLCBtYWtpbmcgc3VyZSBzdGFydCA8PSBlbmQKKyAgICAgICAgICAgIGlmIChtU3RhcnRJc0RyYWdnZWQpIHsKKyAgICAgICAgICAgICAgICBpZiAob2Zmc2V0IDw9IHNlbGVjdGlvbkVuZCkgeworICAgICAgICAgICAgICAgICAgICBpZiAoc2VsZWN0aW9uU3RhcnQgPT0gb2Zmc2V0KSB7CisgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47IC8vIG5vIGNoYW5nZSwgbm8gbmVlZCB0byByZWRyYXc7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgc2VsZWN0aW9uU3RhcnQgPSBvZmZzZXQ7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgc2VsZWN0aW9uU3RhcnQgPSBzZWxlY3Rpb25FbmQ7CisgICAgICAgICAgICAgICAgICAgIHNlbGVjdGlvbkVuZCA9IG9mZnNldDsKKyAgICAgICAgICAgICAgICAgICAgbVN0YXJ0SXNEcmFnZ2VkID0gZmFsc2U7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBpZiAob2Zmc2V0ID49IHNlbGVjdGlvblN0YXJ0KSB7CisgICAgICAgICAgICAgICAgICAgIGlmIChzZWxlY3Rpb25FbmQgPT0gb2Zmc2V0KSB7CisgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47IC8vIG5vIGNoYW5nZSwgbm8gbmVlZCB0byByZWRyYXc7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgc2VsZWN0aW9uRW5kID0gb2Zmc2V0OworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIHNlbGVjdGlvbkVuZCA9IHNlbGVjdGlvblN0YXJ0OworICAgICAgICAgICAgICAgICAgICBzZWxlY3Rpb25TdGFydCA9IG9mZnNldDsKKyAgICAgICAgICAgICAgICAgICAgbVN0YXJ0SXNEcmFnZ2VkID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIFNlbGVjdGlvbi5zZXRTZWxlY3Rpb24oKFNwYW5uYWJsZSkgbVRleHQsIHNlbGVjdGlvblN0YXJ0LCBzZWxlY3Rpb25FbmQpOworICAgICAgICAgICAgdXBkYXRlRHJhd2FibGVzUG9zaXRpb25zKCk7CisgICAgICAgIH0KKworICAgICAgICBwcml2YXRlIHZvaWQgdXBkYXRlRHJhd2FibGVzUG9zaXRpb25zKCkgeworICAgICAgICAgICAgaWYgKG1Jc1Zpc2libGUpIHsKKyAgICAgICAgICAgICAgICAvLyBDbGVhciBwcmV2aW91cyBjdXJzb3IgY29udHJvbGxlciBiZWZvcmUgYm91bmRzIGFyZSB1cGRhdGVkCisgICAgICAgICAgICAgICAgbVN0YXJ0SGFuZGxlLnBvc3RJbnZhbGlkYXRlKCk7CisgICAgICAgICAgICAgICAgbUVuZEhhbmRsZS5wb3N0SW52YWxpZGF0ZSgpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBmaW5hbCBpbnQgc2VsZWN0aW9uU3RhcnQgPSBnZXRTZWxlY3Rpb25TdGFydCgpOworICAgICAgICAgICAgZmluYWwgaW50IHNlbGVjdGlvbkVuZCA9IGdldFNlbGVjdGlvbkVuZCgpOworCisgICAgICAgICAgICBpZiAoKHNlbGVjdGlvblN0YXJ0IDwgMCkgfHwgKHNlbGVjdGlvbkVuZCA8IDApKSB7CisgICAgICAgICAgICAgICAgLy8gU2hvdWxkIG5ldmVyIGhhcHBlbiwgc2FmZXR5IGNoZWNrLgorICAgICAgICAgICAgICAgIExvZy53KExPR19UQUcsICJVcGRhdGUgc2VsZWN0aW9uIGNvbnRyb2xsZXIgcG9zaXRpb24gY2FsbGVkIHdpdGggbm8gY3Vyc29yIik7CisgICAgICAgICAgICAgICAgbUlzVmlzaWJsZSA9IGZhbHNlOworICAgICAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgYm9vbGVhbiBvbmVMaW5lU2VsZWN0aW9uID0gbUxheW91dC5nZXRMaW5lRm9yT2Zmc2V0KHNlbGVjdGlvblN0YXJ0KSA9PSBtTGF5b3V0LmdldExpbmVGb3JPZmZzZXQoc2VsZWN0aW9uRW5kKTsgCisgICAgICAgICAgICBtU3RhcnRIYW5kbGUucG9zaXRpb25BdEN1cnNvcihzZWxlY3Rpb25TdGFydCwgb25lTGluZVNlbGVjdGlvbik7CisgICAgICAgICAgICBtRW5kSGFuZGxlLnBvc2l0aW9uQXRDdXJzb3Ioc2VsZWN0aW9uRW5kLCB0cnVlKTsKKworICAgICAgICAgICAgbVN0YXJ0SGFuZGxlLm1EcmF3YWJsZS5zZXRBbHBoYSgyNTUpOworICAgICAgICAgICAgbUVuZEhhbmRsZS5tRHJhd2FibGUuc2V0QWxwaGEoMjU1KTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyB2b2lkIG9uVG91Y2hFdmVudChNb3Rpb25FdmVudCBldmVudCkgeworICAgICAgICAgICAgaWYgKGlzVGV4dEVkaXRhYmxlKCkpIHsKKyAgICAgICAgICAgICAgICBzd2l0Y2ggKGV2ZW50LmdldEFjdGlvbk1hc2tlZCgpKSB7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgTW90aW9uRXZlbnQuQUNUSU9OX0RPV046CisgICAgICAgICAgICAgICAgICAgICAgICBmaW5hbCBpbnQgeCA9IChpbnQpIGV2ZW50LmdldFgoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGZpbmFsIGludCB5ID0gKGludCkgZXZlbnQuZ2V0WSgpOworCisgICAgICAgICAgICAgICAgICAgICAgICAvLyBSZW1lbWJlciBmaW5nZXIgZG93biBwb3NpdGlvbiwgdG8gYmUgYWJsZSB0byBzdGFydCBzZWxlY3Rpb24gZnJvbSB0aGVyZQorICAgICAgICAgICAgICAgICAgICAgICAgbU1pblRvdWNoT2Zmc2V0ID0gbU1heFRvdWNoT2Zmc2V0ID0gZ2V0T2Zmc2V0KHgsIHkpOworCisgICAgICAgICAgICAgICAgICAgICAgICBpZiAobUlzVmlzaWJsZSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtTW92ZW1lbnQgaW5zdGFuY2VvZiBBcnJvd0tleU1vdmVtZW50TWV0aG9kKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2xlYW4gaXNPblN0YXJ0ID0gbVN0YXJ0SGFuZGxlLmhhc0Zpbmdlck9uKHgsIHkpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sZWFuIGlzT25FbmQgPSBtRW5kSGFuZGxlLmhhc0Zpbmdlck9uKHgsIHkpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaXNPblN0YXJ0IHx8IGlzT25FbmQpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtUGFyZW50ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBQcmV2ZW50IHBvc3NpYmxlIHNjcm9sbFZpZXcgcGFyZW50IGZyb20gc2Nyb2xsaW5nLCBzbworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHRoYXQgd2UgY2FuIHVzZSBhdXRvLXNjcm9sbGluZy4KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtUGFyZW50LnJlcXVlc3REaXNhbGxvd0ludGVyY2VwdFRvdWNoRXZlbnQodHJ1ZSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIEluIGNhc2UgYm90aCBjb250cm9sbGVycyBhcmUgdW5kZXIgZmluZ2VyICh2ZXJ5IHNtYWxsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBzZWxlY3Rpb24gcmVnaW9uKSwgYXJiaXRyYXJpbHkgcGljayBlbmQgY29udHJvbGxlci4KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1TdGFydElzRHJhZ2dlZCA9ICFpc09uRW5kOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmluYWwgSGFuZGxlIGRyYWdnZWRIYW5kbGUgPSBtU3RhcnRJc0RyYWdnZWQgPyBtU3RhcnRIYW5kbGUgOiBtRW5kSGFuZGxlOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmluYWwgUmVjdCBib3VuZHMgPSBkcmFnZ2VkSGFuZGxlLm1EcmF3YWJsZS5nZXRCb3VuZHMoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1PZmZzZXRYID0gKGJvdW5kcy5sZWZ0ICsgYm91bmRzLnJpZ2h0KSAvIDIuMGYgLSB4OworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbU9mZnNldFkgPSBkcmFnZ2VkSGFuZGxlLm1Ib3BTcG90VmVydGNhbFBvc2l0aW9uIC0geTsKKworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKChBcnJvd0tleU1vdmVtZW50TWV0aG9kKW1Nb3ZlbWVudCkuc2V0Q3Vyc29yQ29udHJvbGxlcih0aGlzKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICAgICAgICAgIGNhc2UgTW90aW9uRXZlbnQuQUNUSU9OX1BPSU5URVJfRE9XTjoKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBNb3Rpb25FdmVudC5BQ1RJT05fUE9JTlRFUl9VUDoKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIEhhbmRsZSBtdWx0aS1wb2ludCBnZXN0dXJlcy4gS2VlcCBtaW4gYW5kIG1heCBvZmZzZXQgcG9zaXRpb25zLgorICAgICAgICAgICAgICAgICAgICAgICAgLy8gT25seSBhY3RpdmF0ZWQgZm9yIGRldmljZXMgdGhhdCBjb3JyZWN0bHkgaGFuZGxlIG11bHRpLXRvdWNoLgorICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1Db250ZXh0LmdldFBhY2thZ2VNYW5hZ2VyKCkuaGFzU3lzdGVtRmVhdHVyZSgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUGFja2FnZU1hbmFnZXIuRkVBVFVSRV9UT1VDSFNDUkVFTl9NVUxUSVRPVUNIX0RJU1RJTkNUKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVwZGF0ZU1pbkFuZE1heE9mZnNldHMoZXZlbnQpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIEBwYXJhbSBldmVudAorICAgICAgICAgKi8KKyAgICAgICAgcHJpdmF0ZSB2b2lkIHVwZGF0ZU1pbkFuZE1heE9mZnNldHMoTW90aW9uRXZlbnQgZXZlbnQpIHsKKyAgICAgICAgICAgIGludCBwb2ludGVyQ291bnQgPSBldmVudC5nZXRQb2ludGVyQ291bnQoKTsKKyAgICAgICAgICAgIGZvciAoaW50IGluZGV4ID0gMDsgaW5kZXggPCBwb2ludGVyQ291bnQ7IGluZGV4KyspIHsKKyAgICAgICAgICAgICAgICBmaW5hbCBpbnQgeCA9IChpbnQpIGV2ZW50LmdldFgoaW5kZXgpOworICAgICAgICAgICAgICAgIGZpbmFsIGludCB5ID0gKGludCkgZXZlbnQuZ2V0WShpbmRleCk7CisgICAgICAgICAgICAgICAgaW50IG9mZnNldCA9IGdldE9mZnNldCh4LCB5KTsKKyAgICAgICAgICAgICAgICBpZiAob2Zmc2V0IDwgbU1pblRvdWNoT2Zmc2V0KSBtTWluVG91Y2hPZmZzZXQgPSBvZmZzZXQ7CisgICAgICAgICAgICAgICAgaWYgKG9mZnNldCA+IG1NYXhUb3VjaE9mZnNldCkgbU1heFRvdWNoT2Zmc2V0ID0gb2Zmc2V0OworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIGludCBnZXRNaW5Ub3VjaE9mZnNldCgpIHsKKyAgICAgICAgICAgIHJldHVybiBtTWluVG91Y2hPZmZzZXQ7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgaW50IGdldE1heFRvdWNoT2Zmc2V0KCkgeworICAgICAgICAgICAgcmV0dXJuIG1NYXhUb3VjaE9mZnNldDsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBmbG9hdCBnZXRPZmZzZXRYKCkgeworICAgICAgICAgICAgcmV0dXJuIG1PZmZzZXRYOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIGZsb2F0IGdldE9mZnNldFkoKSB7CisgICAgICAgICAgICByZXR1cm4gbU9mZnNldFk7CisgICAgICAgIH0KKworICAgICAgICAvKioKKyAgICAgICAgICogQHJldHVybiB0cnVlIGlmZiB0aGlzIGNvbnRyb2xsZXIgaXMgY3VycmVudGx5IHVzZWQgdG8gbW92ZSB0aGUgc2VsZWN0aW9uIHN0YXJ0LgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIGJvb2xlYW4gaXNTZWxlY3Rpb25TdGFydERyYWdnZWQoKSB7CisgICAgICAgICAgICByZXR1cm4gbUlzVmlzaWJsZSAmJiBtU3RhcnRJc0RyYWdnZWQ7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcml2YXRlIHZvaWQgaGlkZUluc2VydGlvblBvaW50Q3Vyc29yQ29udHJvbGxlcigpIHsKKyAgICAgICAgaWYgKG1JbnNlcnRpb25Qb2ludEN1cnNvckNvbnRyb2xsZXIgIT0gbnVsbCkgeworICAgICAgICAgICAgbUluc2VydGlvblBvaW50Q3Vyc29yQ29udHJvbGxlci5oaWRlKCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcml2YXRlIHZvaWQgaGlkZUNvbnRyb2xsZXJzKCkgeworICAgICAgICBoaWRlSW5zZXJ0aW9uUG9pbnRDdXJzb3JDb250cm9sbGVyKCk7CisgICAgICAgIHN0b3BTZWxlY3Rpb25BY3Rpb25Nb2RlKCk7CisgICAgfQorCisgICAgLyoqCisgICAgICogR2V0IHRoZSBvZmZzZXQgY2hhcmFjdGVyIGNsb3Nlc3QgdG8gdGhlIHNwZWNpZmllZCBhYnNvbHV0ZSBwb3NpdGlvbi4KKyAgICAgKgorICAgICAqIEBwYXJhbSB4IFRoZSBob3Jpem9udGFsIGFic29sdXRlIHBvc2l0aW9uIG9mIGEgcG9pbnQgb24gc2NyZWVuCisgIC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ICAgICAgTGF5b3V0IGxheW91dCA9IGdldExheW91dCgpOworICAgICAgICBpZiAobGF5b3V0ICE9IG51bGwpIHsKKyAgICAgICAgICAgIGZpbmFsIGludCBsaW5lID0gbGF5b3V0LmdldExpbmVGb3JWZXJ0aWNhbCh5KTsKKyAgICAgICAgICAgIGZpbmFsIGludCBvZmZzZXQgPSBsYXlvdXQuZ2V0T2Zmc2V0Rm9ySG9yaXpvbnRhbChsaW5lLCB4KTsKKyAgICAgICAgICAgIHJldHVybiBvZmZzZXQ7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICByZXR1cm4gLTE7CisgICAgICAgIH0KKyAgICB9CisKKwogICAgIEBWaWV3RGVidWcuRXhwb3J0ZWRQcm9wZXJ0eShjYXRlZ29yeSA9ICJ0ZXh0IikKICAgICBwcml2YXRlIENoYXJTZXF1ZW5jZSAgICAgICAgICAgIG1UZXh0OwogICAgIHByaXZhdGUgQ2hhclNlcXVlbmNlICAgICAgICAgICAgbVRyYW5zZm9ybWVkOwpAQCAtNzMxOCwxNiArODExOCwyNSBAQAogICAgIHByaXZhdGUgQXJyYXlMaXN0PFRleHRXYXRjaGVyPiAgbUxpc3RlbmVycyA9IG51bGw7CiAKICAgICAvLyBkaXNwbGF5IGF0dHJpYnV0ZXMKLSAgICBwcml2YXRlIFRleHRQYWludCAgICAgICAgICAgICAgIG1UZXh0UGFpbnQ7CisgICAgcHJpdmF0ZSBmaW5hbCBUZXh0UGFpbnQgICAgICAgICBtVGV4dFBhaW50OwogICAgIHByaXZhdGUgYm9vbGVhbiAgICAgICAgICAgICAgICAgbVVzZXJTZXRUZXh0U2NhbGVYOwotICAgIHByaXZhdGUgUGFpbnQgICAgICAgICAgICAgICAgICAgbUhpZ2hsaWdodFBhaW50OwotICAgIHByaXZhdGUgaW50ICAgICAgICAgICAgICAgICAgICAgbUhpZ2hsaWdodENvbG9yID0gMHhGRkJCRERGRjsKKyAgICBwcml2YXRlIGZpbmFsIFBhaW50ICAgICAgICAgICAgIG1IaWdobGlnaHRQYWludDsKKyAgICBwcml2YXRlIGludCAgICAgICAgICAgICAgICAgICAgIG1IaWdobGlnaHRDb2xvciA9IDB4Q0M0NzU5MjU7CiAgICAgcHJpdmF0ZSBMYXlvdXQgICAgICAgICAgICAgICAgICBtTGF5b3V0OwogCiAgICAgcHJpdmF0ZSBsb25nICAgICAgICAgICAgICAgICAgICBtU2hvd0N1cnNvcjsKICAgICBwcml2YXRlIEJsaW5rICAgICAgICAgICAgICAgICAgIG1CbGluazsKICAgICBwcml2YXRlIGJvb2xlYW4gICAgICAgICAgICAgICAgIG1DdXJzb3JWaXNpYmxlID0gdHJ1ZTsKIAorICAgIC8vIEN1cnNvciBDb250cm9sbGVycy4gTnVsbCB3aGVuIGRpc2FibGVkLgorICAgIHByaXZhdGUgQ3Vyc29yQ29udHJvbGxlciAgICAgICAgbUluc2VydGlvblBvaW50Q3Vyc29yQ29udHJvbGxlcjsKKyAgICBwcml2YXRlIEN1cnNvckNvbnRyb2xsZXIgICAgICAgIG1TZWxlY3Rpb25Nb2RpZmllckN1cnNvckNvbnRyb2xsZXI7CisgICAgcHJpdmF0ZSBib29sZWFuICAgICAgICAgICAgICAgICBtU2hvdWxkU3RhcnRTZWxlY3Rpb25BY3Rpb25Nb2RlID0gZmFsc2U7CisgICAgcHJpdmF0ZSBBY3Rpb25Nb2RlICAgICAgICAgICAgICBtU2VsZWN0aW9uQWN0aW9uTW9kZTsKKyAgICAvLyBDcmVhdGVkIG9uY2UgYW5kIHNoYXJlZCBieSBkaWZmZXJlbnQgQ3Vyc29yQ29udHJvbGxlciBoZWxwZXIgbWV0aG9kcy4KKyAgICAvLyBPbmx5IG9uZSBjdXJzb3IgY29udHJvbGxlciBpcyBhY3RpdmUgYXQgYW55IHRpbWUgd2hpY2ggcHJldmVudCByYWNlIGNvbmRpdGlvbnMuCisgICAgcHJpdmF0ZSBzdGF0aWMgUmVjdCAgICAgICAgICAgICBzQ3Vyc29yQ29udHJvbGxlclRlbXB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ocmVzb3VyY2UgPiAwKSB7CiAgICAgICAgICAgICBzZXRPdXRBbmltYXRpb24oY29udGV4dCwgcmVzb3VyY2UpOwogICAgICAgICB9CisKKyAgICAgICAgYm9vbGVhbiBmbGFnID0gYS5nZXRCb29sZWFuKGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3R5bGVhYmxlLlZpZXdBbmltYXRvcl9hbmltYXRlRmlyc3RWaWV3LCB0cnVlKTsKKyAgICAgICAgc2V0QW5pbWF0ZUZpcnN0VmlldyhmbGFnKTsKKwogICAgICAgICBhLnJlY3ljbGUoKTsKIAogICAgICAgICBpbml0Vmlld0FuaW1hdG9yKGNvbnRleHQsIGF0dHJzKTsKQEAgLTg0LDEwICs5MCwxMCBAQAogICAgICAgICBzZXRNZWFzdXJlQWxsQ2hpbGRyZW4obWVhc3VyZUFsbENoaWxkcmVuKTsKICAgICAgICAgYS5yZWN5Y2xlKCk7CiAgICAgfQotICAgIAorCiAgICAgLyoqCiAgICAgICogU2V0cyB3aGljaCBjaGlsZCB2aWV3IHdpbGwgYmUgZGlzcGxheWVkLgotICAgICAqIAorICAgICAqCiAgICAgICogQHBhcmFtIHdoaWNoQ2hpbGQgdGhlIGluZGV4IG9mIHRoZSBjaGlsZCB2aWV3IHRvIGRpc3BsYXkKICAgICAgKi8KICAgICBwdWJsaWMgdm9pZCBzZXREaXNwbGF5ZWRDaGlsZChpbnQgd2hpY2hDaGlsZCkgewpAQCAtMTA1LDE0ICsxMTEsMTQgQEAKICAgICAgICAgICAgIHJlcXVlc3RGb2N1cyhGT0NVU19GT1JXQVJEKTsKICAgICAgICAgfQogICAgIH0KLSAgICAKKwogICAgIC8qKgogICAgICAqIFJldHVybnMgdGhlIGluZGV4IG9mIHRoZSBjdXJyZW50bHkgZGlzcGxheWVkIGNoaWxkIHZpZXcuCiAgICAgICovCiAgICAgcHVibGljIGludCBnZXREaXNwbGF5ZWRDaGlsZCgpIHsKICAgICAgICAgcmV0dXJuIG1XaGljaENoaWxkOwogICA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IT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICBjaGlsZC5zdGFydEFuaW1hdGlvbihtSW5BbmltYXRpb24pOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBjaGlsZC5zZXRWaXNpYmlsaXR5KFZpZXcuVklTSUJMRSk7CisgICAgICAgICAgICAgICAgbUZpcnN0VGltZSA9IGZhbHNlOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBpZiAoYW5pbWF0ZSAmJiBtT3V0QW5pbWF0aW9uICE9IG51bGwgJiYgY2hpbGQuZ2V0VmlzaWJpbGl0eSgpID09IFZpZXcuVklTSUJMRSkgeworICAgICAgICAgICAgICAgICAgICBjaGlsZC5zdGFydEFuaW1hdGlvbihtT3V0QW5pbWF0aW9uKTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGNoaWxkLmdldEFuaW1hdGlvbigpID09IG1JbkFuaW1hdGlvbikKKyAgICAgICAgICAgICAgICAgICAgY2hpbGQuY2xlYXJBbmltYXRpb24oKTsKKyAgICAgICAgICAgICAgICBjaGlsZC5zZXRWaXNpYmlsaXR5KFZpZXcuR09ORSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisgICAgLyoqCiAgICAgICogU2hvd3Mgb25seSB0aGUgc3BlY2lmaWVkIGNoaWxkLiBUaGUgb3RoZXIgZGlzcGxheXMgVmlld3MgZXhpdCB0aGUgc2NyZWVuCiAgICAgICogd2l0aCB0aGUge0BsaW5rICNnZXRPdXRBbmltYXRpb24oKSBvdXQgYW5pbWF0aW9ufSBhbmQgdGhlIHNwZWNpZmllZCBjaGlsZAogICAgICAqIGVudGVycyB0aGUgc2NyZWVuIHdpdGggdGhlIHtAbGluayAjZ2V0SW5BbmltYXRpb24oKSBpbiBhbmltYXRpb259LgpAQCAtMTM1LDI0ICsxNzAsOCBAQAogICAgICAqIEBwYXJhbSBjaGlsZEluZGV4IFRoZSBpbmRleCBvZiB0aGUgY2hpbGQgdG8gYmUgc2hvd24uCiAgICAgICovCiAgICAgdm9pZCBzaG93T25seShpbnQgY2hpbGRJbmRleCkgewotICAgICAgICBmaW5hbCBpbnQgY291bnQgPSBnZXRDaGlsZENvdW50KCk7Ci0gICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgY291bnQ7IGkrKykgewotICAgICAgICAgICAgZmluYWwgVmlldyBjaGlsZCA9IGdldENoaWxkQXQoaSk7Ci0gICAgICAgICAgICBmaW5hbCBib29sZWFuIGNoZWNrRm9yRmlyc3QgPSAoIW1GaXJzdFRpbWUgfHwgbUFuaW1hdGVGaXJzdFRpbWUpOwotICAgICAgICAgICAgaWYgKGkgPT0gY2hpbGRJbmRleCkgewotICAgICAgICAgICAgICAgIGlmIChjaGVja0ZvckZpcnN0ICYmIG1JbkFuaW1hdGlvbiAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIGNoaWxkLnN0YXJ0QW5pbWF0aW9uKG1JbkFuaW1hdGlvbik7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGNoaWxkLnNldFZpc2liaWxpdHkoVmlldy5WSVNJQkxFKTsKLSAgICAgICAgICAgICAgICBtRmlyc3RUaW1lID0gZmFsc2U7Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIGlmIChjaGVja0ZvckZpcnN0ICYmIG1PdXRBbmltYXRpb24gIT0gbnVsbCAmJiBjaGlsZC5nZXRWaXNpYmlsaXR5KCkgPT0gVmlldy5WSVNJQkxFKSB7Ci0gICAgICAgICAgICAgICAgICAgIGNoaWxkLnN0YXJ0QW5pbWF0aW9uKG1PdXRBbmltYXRpb24pOwotICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoY2hpbGQuZ2V0QW5pbWF0aW9uKCkgPT0gbUluQW5pbWF0aW9uKQotICAgICAgICAgICAgICAgICAgICBjaGlsZC5jbGVhckFuaW1hdGlvbigpOwotICAgICAgICAgICAgICAgIGNoaWxkLnNldFZ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liaWxpdHkgPT0gVklTSUJMRTsKLSAgICAgICAgdXBkYXRlUnVubmluZygpOworICAgICAgICB1cGRhdGVSdW5uaW5nKGZhbHNlKTsKICAgICB9CiAKICAgICAvKioKQEAgLTE0NCwxMCArMTQ0LDIyIEBACiAgICAgICogb24ge0BsaW5rICNtUnVubmluZ30gYW5kIHtAbGluayAjbVZpc2libGV9IHN0YXRlLgogICAgICAqLwogICAgIHByaXZhdGUgdm9pZCB1cGRhdGVSdW5uaW5nKCkgeworICAgICAgICB1cGRhdGVSdW5uaW5nKHRydWUpOworICAgIH0KKworICAgIC8qKgorICAgICAqIEludGVybmFsIG1ldGhvZCB0byBzdGFydCBvciBzdG9wIGRpc3BhdGNoaW5nIGZsaXAge0BsaW5rIE1lc3NhZ2V9IGJhc2VkCisgICAgICogb24ge0BsaW5rICNtUnVubmluZ30gYW5kIHtAbGluayAjbVZpc2libGV9IHN0YXRlLgorICAgICAqCisgICAgICogQHBhcmFtIGZsaXBOb3cgRGV0ZXJtaW5lcyB3aGV0aGVyIG9yIG5vdCB0byBleGVjdXRlIHRoZSBhbmltYXRpb24gbm93LCBpbgorICAgICAqICAgICAgICAgICAgYWRkaXRpb24gdG8gcXVldWluZyBmdXR1cmUgZmxpcHMuIElmIG9taXR0ZWQsIGRlZmF1bHRzIHRvCisgICAgICogICAgICAgICAgICB0cnVlLgorICAgICAqLworICAgIHByaXZhdGUgdm9pZCB1cGRhdGVSdW5uaW5nKGJvb2xlYW4gZmxpcE5vdykgewogICAgICAgICBib29sZWFuIHJ1bm5pbmcgPSBtVmlzaWJsZSAmJiBtU3RhcnRlZCAmJiBtVXNlclByZXNlbnQ7CiAgICAgICAgIGlmIChydW5uaW5nICE9IG1SdW5uaW5nKSB7CiAgICAgICAgICAgICBpZiAocnVubmluZykgewotICAgICAgICAgICAgICAgIHNob3dPbmx5KG1XaGljaENoaWxkKTsKKyAgICAgICAgICAgICAgICBzaG93T25seShtV2hpY2hDaGlsZCwgZmxpcE5vdyk7CiA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mluYWwgUnVubmFibGUgbUNsb3NlQ29udGV4dCA9IG5ldyBSdW5uYWJsZSgpIHsKKyAgICAgICAgcHVibGljIHZvaWQgcnVuKCkgeworICAgICAgICAgICAgbVVwcGVyQ29udGV4dFZpZXcuY2xvc2VNb2RlKCk7CisgICAgICAgICAgICBpZiAobUxvd2VyQ29udGV4dFZpZXcgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIG1Mb3dlckNvbnRleHRWaWV3LnJlbW92ZUFsbFZpZXdzKCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBtQ2xvc2luZ0NvbnRleHQgPSBmYWxzZTsKKyAgICAgICAgfQorICAgIH07CisKKyAgICBwdWJsaWMgQWN0aW9uQmFySW1wbChBY3Rpdml0eSBhY3Rpdml0eSkgeworICAgICAgICBtQWN0aXZpdHkgPSBhY3Rpdml0eTsKKyAgICAgICAgaW5pdChhY3Rpdml0eS5nZXRXaW5kb3coKS5nZXREZWNvclZpZXcoKSk7CisgICAgfQorCisgICAgcHVibGljIEFjdGlvbkJhckltcGwoRGlhbG9nIGRpYWxvZykgeworICAgICAgICBtRGlhbG9nID0gZGlhbG9nOworICAgICAgICBpbml0KGRpYWxvZy5nZXRXaW5kb3coKS5nZXREZWNvclZpZXcoKSk7CisgICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIGluaXQoVmlldyBkZWNvcikgeworICAgICAgICBtQ29udGV4dCA9IGRlY29yLmdldENvbnRleHQoKTsKKyAgICAgICAgbUFjdGlvblZpZXcgPSAoQWN0aW9uQmFyVmlldykgZGVjb3IuZmluZFZpZXdCeUlkKGNvbS5hbmRyb2lkLmludGVybmFsLlIuaWQuYWN0aW9uX2Jhcik7CisgICAgICAgIG1VcHBlckNvbnRleHRWaWV3ID0gKEFjdGlvbkJhckNvbnRleHRWaWV3KSBkZWNvci5maW5kVmlld0J5SWQoCisgICAgICAgICAgICAgICAgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5pZC5hY3Rpb25fY29udGV4dF9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lKENoYXJTZXF1ZW5jZSB0aXRsZSwgQ2hhclNlcXVlbmNlIHN1YnRpdGxlKSB7CisgICAgICAgIGNsZWFudXBUYWJzKCk7CisgICAgICAgIG1BY3Rpb25WaWV3LnNldE5hdmlnYXRpb25Nb2RlKE5BVklHQVRJT05fTU9ERV9TVEFOREFSRCk7CisgICAgICAgIG1BY3Rpb25WaWV3LnNldFRpdGxlKHRpdGxlKTsKKyAgICAgICAgbUFjdGlvblZpZXcuc2V0U3VidGl0bGUoc3VidGl0bGUpOworICAgICAgICBtQWN0aW9uVmlldy5zZXRDYWxsYmFjayhudWxsKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBzZXRTZWxlY3RlZE5hdmlnYXRpb25JdGVtKGludCBwb3NpdGlvbikgeworICAgICAgICBzd2l0Y2ggKG1BY3Rpb25WaWV3LmdldE5hdmlnYXRpb25Nb2RlKCkpIHsKKyAgICAgICAgY2FzZSBOQVZJR0FUSU9OX01PREVfVEFCUzoKKyAgICAgICAgICAgIHNlbGVjdFRhYihtVGFicy5nZXQocG9zaXRpb24pKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIE5BVklHQVRJT05fTU9ERV9EUk9QRE9XTl9MSVNUOgorICAgICAgICAgICAgbUFjdGlvblZpZXcuc2V0RHJvcGRvd25TZWxlY3RlZFBvc2l0aW9uKHBvc2l0aW9uKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigKKyAgICAgICAgICAgICAgICAgICAgInNldFNlbGVjdGVkTmF2aWdhdGlvbkl0ZW0gbm90IHZhbGlkIGZvciBjdXJyZW50IG5hdmlnYXRpb24gbW9kZSIpOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIGludCBnZXRTZWxlY3RlZE5hdmlnYXRpb25JdGVtKCkgeworICAgICAgICBzd2l0Y2ggKG1BY3Rpb25WaWV3LmdldE5hdmlnYXRpb25Nb2RlKCkpIHsKKyAgICAgICAgY2FzZSBOQVZJR0FUSU9OX01PREVfVEFCUzoKKyAgICAgICAgICAgIHJldHVybiBtU2VsZWN0ZWRUYWIuZ2V0UG9zaXRpb24oKTsKKyAgICAgICAgY2FzZSBOQVZJR0FUSU9OX01PREVfRFJPUERPV05fTElTVDoKKyAgICAgICAgICAgIHJldHVybiBtQWN0aW9uVmlldy5nZXREcm9wZG93blNlbGVjdGVkUG9zaXRpb24oKTsKKyAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgIHJldHVybiAtMTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgdm9pZCBjbGVhbnVwVGFicygpIHsKKyAgICAgICAgaWYgKG1TZWxlY3RlZFRhYiAhPSBudWxsKSB7CisgICAgICAgICAgICBzZWxlY3RUYWIobnVsbCk7CisgICAgICAgIH0KKyAgICAgICAgaWYgKCFtVGFicy5pc0VtcHR5KCkpIHsKKyAgICAgICAgICAgIGlmIChtVGFiU3dpdGNoTW9kZSA9PSBUQUJfU1dJVENIX1NIT1dfSElERSkgeworICAgICAgICAgICAgICAgIGZpbmFsIEZyYWdtZW50VHJhbnNhY3Rpb24gdHJhbnMgPSBtQWN0aXZpdHkub3BlbkZyYWdtZW50VHJhbnNhY3Rpb24oKTsKKyAgICAgICAgICAgICAgICBmaW5hbCBpbnQgdGFiQ291bnQgPSBtVGFicy5zaXplKCk7CisgICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCB0YWJDb3VudDsgaSsrKSB7CisgICAgICAgICAgICAgICAgICAgIHRyYW5zLnJlbW92ZShtVGFicy5nZXQoaSkuZ2V0RnJhZ21lbnQoKSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHRyYW5zLmNvbW1pdCgpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgbVRhYnMuY2xlYXIoKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB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WVuY2UgZ2V0U3VidGl0bGUoKSB7CisgICAgICAgIHJldHVybiBtQWN0aW9uVmlldy5nZXRTdWJ0aXRsZSgpOworICAgIH0KKworICAgIHB1YmxpYyBpbnQgZ2V0TmF2aWdhdGlvbk1vZGUoKSB7CisgICAgICAgIHJldHVybiBtQWN0aW9uVmlldy5nZXROYXZpZ2F0aW9uTW9kZSgpOworICAgIH0KKworICAgIHB1YmxpYyBpbnQgZ2V0RGlzcGxheU9wdGlvbnMoKSB7CisgICAgICAgIHJldHVybiBtQWN0aW9uVmlldy5nZXREaXNwbGF5T3B0aW9ucygpOworICAgIH0KKworICAgIHB1YmxpYyBBY3Rpb25Nb2RlIHN0YXJ0QWN0aW9uTW9kZShBY3Rpb25Nb2RlLkNhbGxiYWNrIGNhbGxiYWNrKSB7CisgICAgICAgIGlmIChtQWN0aW9uTW9kZSAhPSBudWxsKSB7CisgICAgICAgICAgICBtQWN0aW9uTW9kZS5maW5pc2goKTsKKyAgICAgICAgfQorCisgICAgICAgIC8vIERvbid0IHdhaXQgZm9yIHRoZSBjbG9zZSBjb250ZXh0IG1vZGUgYW5pbWF0aW9uIHRvIGZpbmlzaC4KKyAgICAgICAgaWYgKG1DbG9zaW5nQ29udGV4dCkgeworICAgICAgICAgICAgbUFuaW1hdG9yVmlldy5jbGVhckFuaW1hdGlvbigpOworICAgICAgICAgICAgbUhhbmRsZXIucmVtb3ZlQ2FsbGJhY2tzKG1DbG9zZUNvbnRleHQpOworICAgICAgICAgICAgbUNsb3NlQ29udGV4dC5ydW4oKTsKKyAgICAgICAgfQorCisgICAgICAgIEFjdGlvbk1vZGUgbW9kZSA9IG5ldyBBY3Rpb25Nb2RlSW1wbChjYWxsYmFjayk7CisgICAgICAgIGlmIChjYWxsYmFjay5vbkNyZWF0ZUFjdGlvbk1vZGUobW9kZSwgbW9kZS5nZXRNZW51KCkpKSB7CisgICAgICAgICAgICBtb2RlLmludmFsaWRhdGUoKTsKKyAgICAgICAgICAgIG1VcHBlckNvbnRleHRWaWV3LmluaXRGb3JNb2RlKG1vZGUpOworICAgICAgICAgICAgbUFuaW1hdG9yVmlldy5zZXREaXNwbGF5ZWRDaGlsZChDT05URVhUX1ZJRVcpOworICAgICAgICAgICAgaWYgKG1Mb3dlckNvbnRleHRWaWV3ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAvLyBUT0RPIGFuaW1hdGUgdGhpcworICAgICAgICAgICAgICAgIG1Mb3dlckNvbnRleHRWaWV3LnNldFZpc2liaWxpdHkoVmlldy5WSVNJQkxFKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1BY3Rpb25Nb2RlID0gbW9kZTsKKyAgICAgICAgICAgIHJldHVybiBtb2RlOworICAgICAgICB9CisgICAgICAgIHJldHVybiBudWxsOworICAgIH0KKworICAgIHByaXZhdGUgdm9pZCBjb25maWd1cmVUYWIoVGFiIHRhYiwgaW50IHBvc2l0aW9uKSB7CisgICAgICAgIGZpbmFsIFRhYkltcGwgdGFiaSA9IChUYWJJbXBsKSB0YWI7CisgICAgICAgIGZpbmFsIGJvb2xlYW4gaXNGaXJzdFRhYiA9IG1UYWJzLmlzRW1wdHkoKTsKKyAgICAgICAgZmluYWwgRnJhZ21lbnRUcmFuc2FjdGlvbiB0cmFucyA9IG1BY3Rpdml0eS5vcGVuRnJhZ21lbnRUcmFuc2FjdGlvbigpOworICAgICAgICBmaW5hbCBGcmFnbWVudCBmcmFnID0gdGFiaS5nZXRGcmFnbWVudCgpOworCisgICAgICAgIHRhYmkuc2V0UG9zaXRpb24ocG9zaXRpb24pOworICAgICAgICBtVGFicy5hZGQocG9zaXRpb24sIHRhYmkpOworCisgICAgICAgIGlmIChtVGFiU3dpdGNoTW9kZSA9PSBUQUJfU1dJVENIX1NIT1dfSElERSkgeworICAgICAgICAgICAgaWYgKCFmcmFnLmlzQWRkZWQoKSkgeworICAgICAgICAgICAgICAgIHRyYW5zLmFkZChtVGFiQ29udGFpbmVyVmlld0lkLCBmcmFnKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIGlmIChpc0ZpcnN0VGFiKSB7CisgICAgICAgICAgICBpZiAobVRhYlN3aXRjaE1vZGUgPT0gVEFCX1NXSVRDSF9TSE9XX0hJREUpIHsKKyAgICAgICAgICAgICAgICB0cmFucy5zaG93KGZyYWcpOworICAgICAgICAgICAgfSBlbHNlIGlmIChtVGFiU3dpdGNoTW9kZSA9PSBUQUJfU1dJVENIX0FERF9SRU1PVkUpIHsKKyAgICAgICAgICAgICAgICB0cmFucy5hZGQobVRhYkNvbnRhaW5lclZpZXdJZCwgZnJhZyk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBtU2VsZWN0ZWRUYWIgPSB0YWJpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgaWYgKG1UYWJTd2l0Y2hNb2RlID09IFRBQl9TV0lUQ0hfU0hPV19ISURFKSB7CisgICAgICAgICAgICAgICAgdHJhbnMuaGlkZShmcmFnKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICB0cmFucy5jb21taXQoKTsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgdm9pZCBhZGRUYWIoVGFiIHRhYikgeworICAgICAgICBtQWN0aW9uVmlldy5hZGRUYWIodGFiKTsKKyAgICAgICAgY29uZmlndXJlVGFiKHRhYiwgbVRhYnMuc2l6ZSgpKTsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgdm9pZCBpbnNlcnRUYWIoVGFiIHRhYiwgaW50IHBvc2l0aW9uKSB7CisgICAgICAgIG1BY3Rpb25WaWV3Lmluc2VydFRhYih0YWIsIHBvc2l0aW9uKTsKKyAgICAgICAgY29uZmlndXJlVGFiKHRhYiwgcG9zaXRpb24pOworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyBUYWIgbmV3VGFiKCkgeworICAgICAgICByZXR1cm4gbmV3IFRhYkltcGwoKTsKKyAgICB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5hdmlnYXRpb25Nb2RlKGludCBjb250YWluZXJWaWV3SWQpIHsKKyAgICAgICAgbVRhYkNvbnRhaW5lclZpZXdJZCA9IGNvbnRhaW5lclZpZXdJZDsKKyAgICAgICAgc2V0VGFiTmF2aWdhdGlvbk1vZGUoKTsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgdm9pZCBzZWxlY3RUYWIoVGFiIHRhYikgeworICAgICAgICBpZiAobVNlbGVjdGVkVGFiID09IHRhYikgeworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisKKyAgICAgICAgbUFjdGlvblZpZXcuc2V0VGFiU2VsZWN0ZWQodGFiICE9IG51bGwgPyB0YWIuZ2V0UG9zaXRpb24oKSA6IFRhYi5JTlZBTElEX1BPU0lUSU9OKTsKKyAgICAgICAgZmluYWwgRnJhZ21lbnRUcmFuc2FjdGlvbiB0cmFucyA9IG1BY3Rpdml0eS5vcGVuRnJhZ21lbnRUcmFuc2FjdGlvbigpOworICAgICAgICBpZiAobVNlbGVjdGVkVGFiICE9IG51bGwpIHsKKyAgICAgICAgICAgIGlmIChtVGFiU3dpdGNoTW9kZSA9PSBUQUJfU1dJVENIX1NIT1dfSElERSkgeworICAgICAgICAgICAgICAgIHRyYW5zLmhpZGUobVNlbGVjdGVkVGFiLmdldEZyYWdtZW50KCkpOworICAgICAgICAgICAgfSBlbHNlIGlmIChtVGFiU3dpdGNoTW9kZSA9PSBUQUJfU1dJVENIX0FERF9SRU1PVkUpIHsKKyAgICAgICAgICAgICAgICB0cmFucy5yZW1vdmUobVNlbGVjdGVkVGFiLmdldEZyYWdtZW50KCkpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIGlmICh0YWIgIT0gbnVsbCkgeworICAgICAgICAgICAgaWYgKG1UYWJTd2l0Y2hNb2RlID09IFRBQl9TV0lUQ0hfU0hPV19ISURFKSB7CisgICAgICAgICAgICAgICAgdHJhbnMuc2hvdyh0YWIuZ2V0RnJhZ21lbnQoKSk7CisgICAgICAgICAgICB9IGVsc2UgaWYgKG1UYWJTd2l0Y2hNb2RlID09IFRBQl9TV0lUQ0hfQUREX1JFTU9WRSkgeworICAgICAgICAgICAgICAgIHRyYW5zLmFkZChtVGFiQ29udGFpbmVyVmlld0lkLCB0YWIuZ2V0RnJhZ21lbnQoKSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgbVNlbGVjdGVkVGFiID0gKFRhYkltcGwpIHRhYjsKKyAgICAgICAgdHJhbnMuY29tbWl0KCk7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIGludCBnZXRIZWlnaHQoKSB7CisgICAgICAgIHJldHVybiBtQWN0aW9uVmlldy5nZXRIZWlnaHQoKTsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgdm9pZCBzaG93KCkgeworICAgICAgICAvLyBUT0RPIGFuaW1hdGUhCisgICAgICAgIG1BbmltYXRvclZpZXcuc2V0VmlzaWJpbGl0eShWaWV3LlZJU0lCTEUpOworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIGhpZGUoKSB7CisgICAgICAgIC8vIFRPRE8gYW5pbWF0ZSEKKyAgICAgICAgbUFuaW1hdG9yVmlldy5zZXRWaXNpYmlsaXR5KFZpZXcuR09ORSk7CisgICAgfQorCisgICAgcHVibGljIGJvb2xlYW4gaXNTaG93aW5nKCkgeworICAgICAgICByZXR1cm4gbUFuaW1hdG9yVmlldy5nZXRWaXNpYmlsaXR5KCkgPT0gVmlldy5WSVNJQkxFOworICAgIH0KKworICAgIC8qKgorICAgICAqIEBoaWRlIAorICAgICAqLworICAgIHB1YmxpYyBjbGFzcyBBY3Rpb25Nb2RlSW1wbCBleHRlbmRzIEFjdGlvbk1vZGUgaW1wbGVtZW50cyBNZW51QnVpbGRlci5DYWxsYmFjayB7CisgICAgICAgIHByaXZhdGUgQWN0aW9uTW9kZS5DYWxsYmFjayBtQ2FsbGJhY2s7CisgICAgICAgIHByaXZhdGUgTWVudUJ1aWxkZXIgbU1lbnU7CisgICAgICAgIHByaXZhdGUgV2Vha1JlZmVyZW5jZTxWaWV3PiBtQ3VzdG9tVmlldzsKKyAgICAgICAgCisgICAgICAgIHB1YmxpYyBBY3Rpb25Nb2RlSW1wbChBY3Rpb25Nb2RlLkNhbGxiYWNrIGNhbGxiYWNrKSB7CisgICAgICAgICAgICBtQ2FsbGJhY2sgPSBjYWxsYmFjazsKKyAgICAgICAgICAgIG1NZW51ID0gbmV3IE1lbnVCdWlsZGVyKG1BY3Rpb25WaWV3LmdldENvbnRleHQoKSkKKyAgICAgICAgICAgICAgICAgICAgLnNldERlZmF1bHRTaG93QXNBY3Rpb24oTWVudUl0ZW0uU0hPV19BU19BQ1RJT05fSUZfUk9PTSk7CisgICAgICAgICAgICBtTWVudS5zZXRDYWxsYmFjayh0aGlzKTsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgTWVudUluZmxhdGVyIGdldE1lbnVJbmZsYXRlcigpIHsKKyAgICAgICAgICAgIHJldHVybiBuZXcgTWVudUluZmxhdGVyKG1Db250ZXh0KTsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgTWVudSBnZXRNZW51KCkgeworICAgICAgICAgICAgcmV0dXJuIG1NZW51OworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyB2b2lkIGZpbmlzaCgpIHsKKyAgICAgICAgICAgIGlmIChtQWN0aW9uTW9kZSAhPSB0aGlzKSB7CisgICAgICAgICAgICAgICAgLy8gTm90IHRoZSBhY3RpdmUgYWN0aW9uIG1vZGUgLSBuby1vcAorICAgICAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgbUNhbGxiYWNrLm9uRGVzdHJveUFjdGlvbk1vZGUodGhpcyk7CisgICAgICAgICAgICBtQW5pbWF0b3JWaWV3LnNldERpc3BsYXllZENoaWxkKE5PUk1BTF9WSUVXKTsKKworICAgICAgICAgICAgLy8gQ2xlYXIgb3V0IHRoZSBjb250ZXh0IG1vZGUgdmlld3MgYWZ0ZXIgdGhlIGFuaW1hdGlvbiBmaW5pc2hlcworICAgICAgICAgICAgbUNsb3NpbmdDb250ZXh0ID0gdHJ1ZTsKKyAgICAgICAgICAgIG1IYW5kbGVyLnBvc3REZWxheWVkKG1DbG9zZUNvbnRleHQsIG1BbmltYXRvclZpZXcuZ2V0T3V0QW5pbWF0aW9uKCkuZ2V0RHVyYXRpb24oKSk7CisKKyAgICAgICAgICAgIGlmIChtTG93ZXJDb250ZXh0VmlldyAhPSBudWxsICYmIG1Mb3dlckNvbnRleHRWaWV3LmdldFZpc2liaWxpdHkoKSAhPSBWaWV3LkdPTkUpIHsKKyAgICAgICAgICAgICAgICAvLyBUT0RPIEFuaW1hdGUgdGhpcworICAgICAgICAgICAgICAgIG1Mb3dlckNvbnRleHRWaWV3LnNldFZpc2liaWxpdHkoVmlldy5HT05FKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1BY3Rpb25Nb2RlID0gbnVsbDsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgdm9pZCBpbnZhbGlkYXRlKCkgeworICAgICAgICAgICAgaWYgKG1DYWxsYmFjay5vblByZXBhcmVBY3Rpb25Nb2RlKHRoaXMsIG1NZW51KSkgeworICAgICAgICAgICAgICAgIC8vIFJlZnJlc2ggY29udGVudCBpbiBib3RoIGNvbnRleHQgdmlld3MKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgdm9pZCBzZXRDdXN0b21WaWV3KFZpZXcgdmlldykgeworICAgICAgICAgICAgbVVwcGVyQ29udGV4dFZpZXcuc2V0Q3VzdG9tVmlldyh2aWV3KTsKKyAgICAgICAgICAgIG1DdXN0b21WaWV3ID0gbmV3IFdlYWtSZWZlcmVuY2U8Vmlldz4odmlldyk7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIHZvaWQgc2V0U3VidGl0bGUoQ2hhclNlcXVlbmNlIHN1YnRpdGxlKSB7CisgICAgICAgICAgICBtVXBwZXJDb250ZXh0Vmlldy5zZXRTdWJ0aXRsZShzdWJ0aXRsZSk7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIHZvaWQgc2V0VGl0bGUoQ2hhclNlcXVlbmNlIHRpdGxlKSB7CisgICAgICAgICAgICBtVXBwZXJDb250ZXh0Vmlldy5zZXRUaXRsZSh0aXRsZSk7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIHZvaWQgc2V0VGl0bGUoaW50IHJlc0lkKSB7CisgICAgICAgICAgICBzZXRUaXRsZShtQWN0aXZpdHkuZ2V0U3RyaW5nKHJlc0lkKSk7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIHZvaWQgc2V0U3VidGl0bGUoaW50IHJlc0lkKSB7CisgICAgICAgICAgICBzZXRTdWJ0aXRsZShtQWN0aXZpdHkuZ2V0U3RyaW5nKHJlc0lkKSk7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIENoYXJTZXF1ZW5jZSBnZXRUaXRsZSgpIHsKKyAgICAgICAgICAgIHJldHVybiBtVXBwZXJDb250ZXh0Vmlldy5nZXRUaXRsZSgpOworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyBDaGFyU2VxdWVuY2UgZ2V0U3VidGl0bGUoKSB7CisgICAgICAgICAgICByZXR1cm4gbVVwcGVyQ29udGV4dFZpZXcuZ2V0U3VidGl0bGUoKTsKKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyBWaWV3IGdldEN1c3RvbVZpZXcoKSB7CisgICAgICAgICAgICByZXR1cm4gbUN1c3RvbVZpZXcgIT0gbnVsbCA/IG1DdXN0b21WaWV3LmdldCgpIDogbnVsbDsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBib29sZWFuIG9uTWVudUl0ZW1TZWxlY3RlZChNZW51QnVpbGRlciBtZW51LCBNZW51SXRlbSBpdGVtKSB7CisgICAgICAgICAgICByZXR1cm4gbUNhbGxiYWNrLm9uQWN0aW9uSXRlbUNsaWNrZWQodGhpcywgaXRlbSk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCBvbkNsb3NlTWVudShNZW51QnVpbGRlciBtZW51LCBib29sZWFuIGFsbE1lbnVzQXJlQ2xvc2luZykgeworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIGJvb2xlYW4gb25TdWJNZW51U2VsZWN0ZWQoU3ViTWVudUJ1aWxkZXIgc3ViTWVudSkgeworICAgICAgICAgICAgaWYgKCFzdWJNZW51Lmhhc1Zpc2libGVJdGVtcygpKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIG5ldyBNZW51UG9wdXBIZWxwZXIobUNvbnRleHQsIHN1Yk1lbnUpLnNob3coKTsKKyAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgb25DbG9zZVN1Yk1lbnUoU3ViTWVudUJ1aWxkZXIgbWVudSkgeworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgb25NZW51TW9kZUNoYW5nZShNZW51QnVpbGRlciBtZW51KSB7CisgICAgICAgICAgICBpbnZhbGlkYXRlKCk7CisgICAgICAgICAgICBtVXBwZXJDb250ZXh0Vmlldy5zaG93T3ZlcmZsb3dNZW51KCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBAaGlkZQorICAgICAqLworICAgIHB1YmxpYyBjbGFzcyBUYWJJbXBsIGV4dGVuZHMgQWN0aW9uQmFyLlRhYiB7CisgICAgICAgIHByaXZhdGUgRnJhZ21lbnQgbUZyYWdtZW50OworICAgICAgICBwcml2YXRlIERyYXdhYmxlIG1JY29uOworICAgICAgICBwcml2YXRlIENoYXJTZXF1ZW5jZSBtVGV4dDsKKyAgICAgICAgcHJpdmF0ZSBpbnQgbVBvc2l0aW9uOworCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgRnJhZ21lbnQgZ2V0RnJhZ21lbnQoKSB7CisgICAgICAgICAgICByZXR1cm4gbUZyYWdtZW50OworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyBEcmF3YWJsZSBnZXRJY29uKCkgeworICAgICAgICAgICAgcmV0dXJuIG1JY29uOworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyBpbnQgZ2V0UG9zaXRpb24oKSB7CisgICAgICAgICAgICByZXR1cm4gbVBvc2l0aW9uOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgc2V0UG9zaXRpb24oaW50IHBvc2l0aW9uKSB7CisgICAgICAgICAgICBtUG9zaXRpb24gPSBwb3NpdGlvbjsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgQ2hhclNlcXVlbmNlIGdldFRleHQoKSB7CisgICAgICAgICAgICByZXR1cm4gbVRleHQ7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIHZvaWQgc2V0RnJhZ21lbnQoRnJhZ21lbnQgZnJhZ21lbnQpIHsKKyAgICAgICAgICAgIG1GcmFnbWVudCA9IGZyYWdtZW50OworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpY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RoZXIKKyAgICAgICAgICogSWYgd2UncmUgYWxyZWFkeSB3cml0aW5nIGEgc25hcHNob3QsIGRvbid0IGJvdGhlciBlbnF1ZXVlaW5nIGFub3RoZXIKICAgICAgICAgICogcmVxdWVzdCByaWdodCBub3cuIFRoaXMgd2lsbCByZWR1Y2UgdGhlIG51bWJlciBvZiBpbmRpdmlkdWFsCiAgICAgICAgICAqIHNuYXBzaG90cyBhbmQgaW4gdHVybiB0aGUgdG90YWwgYW1vdW50IG9mIG1lbW9yeSBjb25zdW1lZCAob25lIGJpZwogICAgICAgICAgKiBzbmFwc2hvdCBpcyBzbWFsbGVyIHRoYW4gTiBzdWJzZXQgc25hcHNob3RzKS4KICAgICAgICAgICovCi0gICAgICAgIGlmICghcGVuZGluZykgewotICAgICAgICAgICAgcGVuZGluZyA9IHRydWU7CisgICAgICAgIGlmIChwZW5kaW5nLmNvbXBhcmVBbmRTZXQoZmFsc2UsIHRydWUpKSB7CiAgICAgICAgICAgICBzbmFwc2hvdFdyaXRlci5leGVjdXRlKG5ldyBSdW5uYWJsZSgpIHsKICAgICAgICAgICAgICAgICBwdWJsaWMgdm9pZCBydW4oKSB7Ci0gICAgICAgICAgICAgICAgICAgIFN0cmluZyBkaXIgPQotICAgICAgICAgICAgICAgICAgICAgICAgRW52aXJvbm1lbnQuZ2V0RXh0ZXJuYWxTdG9yYWdlRGlyZWN0b3J5KCkuZ2V0UGF0aCgpICsgIi9zbmFwc2hvdHMiOwogICAgICAgICAgICAgICAgICAgICBpZiAoIWRpck1hZGUpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIG5ldyBGaWxlKGRpcikubWtkaXJzKCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAobmV3IEZpbGUoZGlyKS5pc0RpcmVjdG9yeSgpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBGaWxlIGRpciA9IG5ldyBGaWxlKFNOQVBTSE9UX0RJUik7CisgICAgICAgICAgICAgICAgICAgICAgICBkaXIubWtkaXJzKCk7CisgICAgICAgICAgICAgICAgICAgICAgICAvLyB0aGUgZGlyZWN0b3J5IG5lZWRzIHRvIGJlIHdyaXRhYmxlIHRvIGFueWJvZHkKKyAgICAgICAgICAgICAgICAgICAgICAgIGRpci5zZXRXcml0YWJsZSh0cnVlLCBmYWxzZSk7CisgICAgICAgICAgICAgICAgICAgICAgICAvLyB0aGUgZGlyZWN0b3J5IG5lZWRzIHRvIGJlIGV4ZWN1dGFibGUgdG8gYW55Ym9keQorICAgICAgICAgICAgICAgICAgICAgICAgLy8gZG9uJ3Qga25vdyB3aHkgeWV0LCBidXQgbW9kZSA3MjMgd291bGQgd29yaywgd2hpbGUKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIG1vZGUgNzIyIHRocm93cyBGaWxlTm90Rm91bmRFeGVjcHRpb24gYXQgbGluZSAxNTEKKyAgICAgICAgICAgICAgICAgICAgICAgIGRpci5zZXRFeGVjdXRhYmxlKHRydWUsIGZhbHNlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuZXcgRmlsZShTTkFQU0hPVF9ESVIpLmlzRGlyZWN0b3J5KCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXJNYWRlID0gdHJ1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgTG9nLncoVEFHLCAiQ3JlYXRpb24gb2YgIiArIGRpciArICIgZmFpbGVkLiIpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIExvZy53KFRBRywgIkNyZWF0aW9uIG9mICIgKyBTTkFQU0hPVF9ESVIgKyAiIGZhaWxlZC4iKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBwZW5kaW5nLnNldChmYWxzZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgIHRyeSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICB3cml0ZVNuYXBzaG90KGRpciwgbmFtZSk7CisgICAgICAgICAgICAgICAgICAgICAgICB3cml0ZVNuYXBzaG90KFNOQVBTSE9UX0RJUiwgcHJvY2Vzc05hbWUsIHBhY2thZ2VJbmZvKTsKICAgICAgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHBlbmRpbmcgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHBlbmRpbmcuc2V0KGZhbHNlKTsKICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0pOwpAQCAtMTExLDEzICsxMjMsMTMgQEAKICAgICAgKi8KICAgICBwdWJsaWMgc3RhdGljIHZvaWQgd3JpdGVaeWdvdGVTbmFwc2hvdCgpIHsKICAgICAgICAgaWYgKCFlbmFibGVkKSByZXR1cm47Ci0KLSAgICAgICAgU3RyaW5nIGRpciA9ICIvZGF0YS96eWdvdGUvc25hcHNob3RzIjsKLSAgICAgICAgbmV3IEZpbGUoZGlyKS5ta2RpcnMoKTsKLSAgICAgICAgd3JpdGVTbmFwc2hvdChkaXIsICJ6eWdvdGUiKTsKKyAgICAgICAgd3JpdGVTbmFwc2hvdCgienlnb3RlIiwgbnVsbCk7CiAgICAgfQogCi0gICAgcHJpdmF0ZSBzdGF0aWMgdm9pZCB3cml0ZVNuYXBzaG90KFN0cmluZyBkaXIsIFN0cmluZyBuYW1lKSB7CisgICAgLyoqCisgICAgICogcGFzcyBpbiBQYWNrYWdlSW5mbyB0byByZXRyaWV2ZSB2YXJpb3VzIHZhbHVlcyBmb3Igc25hcHNob3QgaGVhZGVyCisgICAgICovCisgICAgcHJpdmF0ZSBzdGF0aWMgdm9pZCB3cml0ZVNuYXBzaG90KFN0cmluZyBkaXIsIFN0cmluZyBwcm9jZXNzTmFtZSwgUGFja2FnZUluZm8gcGFja2FnZUluZm8pIHsKICAgICAgICAgYnl0ZVtdIHNuYXBzaG90ID0gU2FtcGxpbmdQcm9maWxlci5nZXRJbnN0YW5jZSgpLnNuYXBzaG90KCk7CiAgICAgICAgIGlmIChzbmFwc2hvdCA9PSBudWxsKSB7CiAgICAgICAgICAgICByZXR1cm47CkBAIC0xMjksMzkgKzE0MSw1NCBAQAogICAgICAgICAgKiB3ZSBjYXB0dXJlIHR3byBzbmFwc2hvdHMgaW4gcmFwaWQgc3VjY2Vzc2lvbi4KICAgICAgICAgICovCiAgICAgICAgIGxvbmcgc3RhcnQgPSBTeXN0ZW0uY3VycmVudFRpbWVNaWxsaXMoKTsKLSAgICAgICAgU3RyaW5nIHBhdGggPSBkaXIgKyAiLyIgKyBuYW1lLnJlcGxhY2UoJzonLCAnLicpICsgIi0iICsKLSAgICAgICAgICAgICAgICArIFN5c3RlbS5jdXJyZW50VGltZU1pbGxpcygpICsgIi5zbmFwc2hvdCI7CisgICAgICAgIFN0cmluZyBuYW1lID0gcHJvY2Vzc05hbWUucmVwbGFjZUFsbCgiOiIsICIuIik7CisgICAgICAgIFN0cmluZyBwYXRoID0gZGlyICsgIi8iICsgbmFtZSArICItIiArU3lzdGVtLmN1cnJlbnRUaW1lTWlsbGlzKCkgKyAiLnNuYXBzaG90IjsKKyAgICAgICAgRmlsZU91dHB1dFN0cmVhbSBvdXQgPSBudWxsOwogICAgICAgICB0cnkgewotICAgICAgICAgICAgLy8gVHJ5IHRvIG9wZW4gdGhlIGZpbGUgYSBmZXcgdGltZXMuIFRoZSBTRCBjYXJkIG1heSBub3QgYmUgbW91bnRlZC4KLSAgICAgICAgICAgIEZpbGVPdXRwdXRTdHJlYW0gb3V0OwotICAgICAgICAgICAgaW50IGNvdW50ID0gMDsKLSAgICAgICAgICAgIHdoaWxlICh0cnVlKSB7Ci0gICAgICAgICAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgICAgICAgICAgb3V0ID0gbmV3IEZpbGVPdXRwdXRTdHJlYW0ocGF0aCk7Ci0gICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgIH0gY2F0Y2ggKEZpbGVOb3RGb3VuZEV4Y2VwdGlvbiBlKSB7Ci0gICAgICAgICAgICAgICAgICAgIGlmICgrK2NvdW50ID4gMykgewotICAgICAgICAgICAgICAgICAgICAgICAgTG9nLmUoVEFHLCAiQ291bGQgbm90IG9wZW4gIiArIHBhdGggKyAiLiIpOwotICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwotICAgICAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICAgICAgLy8gU2xlZXAgZm9yIGEgYml0IGFuZCB0aGVuIHRyeSBhZ2Fpbi4KLSAgICAgICAgICAgICAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgICAgICAgICAgICAgIFRocmVhZC5zbGVlcCgyNTAwKTsKLSAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoSW50ZXJydXB0ZWRFeGNlcHRpb24gZTEpIHsgLyogaWdub3JlICovIH0KLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIHRyeSB7Ci0gICAgICAgICAgICAgICAgb3V0LndyaXRlKHNuYXBzaG90KTsKLSAgICAgICAgICAgIH0gZmluYWxseSB7Ci0gICAgICAgICAgICAgICAgb3V0LmNsb3NlKCk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBsb25nIGVsYXBzZWQgPSBTeXN0ZW0uY3VycmVudFRpbWVNaWxsaXMoKSAtIHN0YXJ0OwotICAgICAgICAgICAgTG9nLmkoVEFHLCAiV3JvdGUgc25hcHNob3QgZm9yICIgKyBuYW1lCi0gICAgICAgICAgICAgICAgICAgICsgIiBpbiAiICsgZWxhcHNlZCArICJtcy4iKTsKKyAgICAgICAgICAgIG91dCA9IG5ldyBGaWxlT3V0cHV0U3RyZWFtKHBhdGgpOworICAgICAgICAgICAgZ2VuZXJhdGVTbmFwc2hvdEhlYWRlcihuYW1lLCBwYWNrYWdlSW5mbywgb3V0KTsKKyAgICAgICAgICAgIG91dC53cml0ZShzbmFwc2hvdCk7CiAgICAgICAgIH0gY2F0Y2ggKElPRXhjZXB0aW9uIGUpIHsKICAgICAgICAgICAgIExvZy5lKFRBRywgIkVycm9yIHdyaXRpbmcgc25hcHNob3QuIiwgZSk7CisgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIGlmKG91dCAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIG91dC5jbG9zZSgpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0gY2F0Y2ggKElPRXhjZXB0aW9uIGV4KSB7CisgICAgICAgICAgICAgICAgLy8gbGV0IGl0IGdvLgorICAgICAgICAgICAgfQogICAgICAgICB9CisgICAgICAgIC8vIHNldCBmaWxlIHJlYWRhYmxlIHRvIHRoZSB3b3JsZCBzbyB0aGF0IFNhbXBsaW5nUHJvZmlsZXJTZXJ2aWNlCisgICAgICAgIC8vIGNhbiBwdXQgaXQgdG8gZHJvcGJveAorICAgICAgICBuZXcgRmlsZShwYXRoKS5zZXRSZWFkYWJsZSh0cnVlLCBmYWxzZSk7CisKKyAgICAgICAgbG9uZyBlbGFwc2VkID0gU3lzdGVtLmN1cnJlbnRUaW1lTWlsbGlzKCkgLSBzdGFydDsKKyAgICAgICAgTG9nLmkoVEFHLCAiV3JvdGUgc25hcHNob3QgZm9yICIgKyBuYW1lICsgIiBpbiAiICsgZWxhcHNlZCArICJtcy4iKTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBnZW5lcmF0ZSBoZWFkZXIgZm9yIHNuYXBzaG90cywgd2l0aCB0aGUgZm9sbG93aW5nIGZvcm1hdCAobGlrZSBodHRwIGhlYWRlcik6CisgICAgICoKKyAgICAgKiBWZXJzaW9uOiA8dmVyc2lvbiBudW1iZXIgb2YgcHJvZmlsZXI+XG4KKyAgICAgKiBQcm9jZXNzOiA8cHJv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Bwcm9jZXNzTWVzc2FnZShNZXNzYWdlIG1lc3NhZ2UpIHsKICAgICAgICAgICAgIExvZy5kKFRBRywgIkhlbGxvIFdvcmxkIik7CiAgICAgICAgICAgICByZXR1cm4gSEFORExFRDsKICAgICAgICAgfQpAQCAtMjU3LDEwICsyNTcsMTAgQEAKICAgICB9CiAKICAgICBjbGFzcyBQMSBleHRlbmRzIEhpZXJhcmNoaWNhbFN0YXRlIHsKLSAgICAgICAgQE92ZXJyaWRlIHB1YmxpYyB2b2lkIGVudGVyKCkgeworICAgICAgICBcQE92ZXJyaWRlIHB1YmxpYyB2b2lkIGVudGVyKCkgewogICAgICAgICAgICAgTG9nLmQoVEFHLCAibVAxLmVudGVyIik7CiAgICAgICAgIH0KLSAgICAgICAgQE92ZXJyaWRlIHB1YmxpYyBib29sZWFuIHByb2Nlc3NNZXNzYWdlKE1lc3NhZ2UgbWVzc2FnZSkgeworICAgICAgICBcQE92ZXJyaWRlIHB1YmxpYyBib29sZWFuIHByb2Nlc3NNZXNzYWdlKE1lc3NhZ2UgbWVzc2FnZSkgewogICAgICAgICAgICAgYm9vbGVhbiByZXRWYWw7CiAgICAgICAgICAgICBMb2cuZChUQUcsICJtUDEucHJvY2Vzc01lc3NhZ2Ugd2hhdD0iICsgbWVzc2FnZS53aGF0KTsKICAgICAgICAgICAgIHN3aXRjaChtZXNzYWdlLndoYXQpIHsKQEAgLTI3OCwxNiArMjc4LDE2IEBACiAgICAgICAgICAgICB9CiAgICAgICAgICAgICByZXR1cm4gcmV0VmFsOwogICAgICAgICB9Ci0gICAgICAgIEBPdmVycmlkZSBwdWJsaWMgdm9pZCBleGl0KCkgeworICAgICAgICBcQE92ZXJyaWRlIHB1YmxpYyB2b2lkIGV4aXQoKSB7CiAgICAgICAgICAgICBMb2cuZChUQUcsICJtUDEuZXhpdCIpOwogICAgICAgICB9CiAgICAgfQogCiAgICAgY2xhc3MgUzEgZXh0ZW5kcyBIaWVyYXJjaGljYWxTdGF0ZSB7Ci0g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1lc3NhZ2UpIHsKICAgICAgICAgICAgIExvZy5kKFRBRywgIlAyLnByb2Nlc3NNZXNzYWdlIHdoYXQ9IiArIG1lc3NhZ2Uud2hhdCk7CiAgICAgICAgICAgICBzd2l0Y2gobWVzc2FnZS53aGF0KSB7CiAgICAgICAgICAgICBjYXNlKENNRF8zKToKQEAgLTM0OSwxMiArMzQ5LDEyIEBACiAgICAgICAgICAgICB9CiAgICAgICAgICAgICByZXR1cm4gSEFORExFRDsKICAgICAgICAgfQotICAgICAgICBAT3ZlcnJpZGUgcHVibGljIHZvaWQgZXhpdCgpIHsKKyAgICAgICAgXEBPdmVycmlkZSBwdWJsaWMgdm9pZCBleGl0KCkgewogICAgICAgICAgICAgTG9nLmQoVEFHLCAibVAyLmV4aXQiKTsKICAgICAgICAgfQogICAgIH0KIAotICAgIEBPdmVycmlkZQorICAgIFxAT3ZlcnJpZGUKICAgICB2b2lkIGhhbHRpbmcoKSB7CiAgICAgICAgIExvZy5kKFRBRywgImhhbHRpbmciKTsKICAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CkBAIC0xMTk3LDYgKzExOTcsMzUgQEAKICAgICB9CiAKICAgICAvKioKKyAgICAgKiBHZXQgYSBtZXNzYWdlIGFuZCBzZXQgTWVzc2FnZS50YXJnZXQgPSB0aGlzLAorICAgICAqIHdoYXQsIGFyZzEgYW5kIGFyZzIKKyAgICAgKgorICAgICAqIEBwYXJhbSB3aGF0ICBpcyBhc3NpZ25lZCB0byBNZXNzYWdlLndoYXQKKyAgICAgKiBAcGFyYW0gYXJnMSAgaXMgYXNzaWduZWQgdG8gTWVzc2FnZS5hcmcxCisgICAgICogQHBhcmFtIGFyZzIgIGlzIGFzc2lnbmVkIHRvIE1lc3NhZ2UuYXJnMgorICAgICAqIEByZXR1cm4gIEEgTWVzc2FnZSBvYmplY3QgZnJvbSB0aGUgZ2xvYmFsIHBvb2wuCisgICAgICovCisgICAgcHVibGljIGZpbmFsIE1lc3NhZ2Ugb2J0YWluT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dC5hdHRyaWJ1dGUobnVsbCwgIm5hbWUiLCBuYW1lKTsKKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgZm9yIChPYmplY3QgdiA6IHZhbCkgeworICAgICAgICAgICAgd3JpdGVWYWx1ZVhtbCh2LCBudWxsLCBvdXQpOworICAgICAgICB9CisgICAgICAgIAorICAgICAgICBvdXQuZW5kVGFnKG51bGwsICJzZXQiKTsKKyAgICB9CiAKICAgICAvKioKICAgICAgKiBGbGF0dGVuIGEgYnl0ZVtdIGludG8gYW4gWG1sU2VyaWFsaXplci4gIFRoZSBsaXN0IGNhbiBsYXRlciBiZSByZWFkIGJhY2sKQEAgLTQyNiw2ICs0NDcsOSBAQAogICAgICAgICB9IGVsc2UgaWYgKHYgaW5zdGFuY2VvZiBMaXN0KSB7CiAgICAgICAgICAgICB3cml0ZUxpc3RYbWwoKExpc3QpdiwgbmFtZSwgb3V0KTsKICAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfSBlbHNlIGlmICh2IGluc3RhbmNlb2YgU2V0KSB7CisgICAgICAgICAgICB3cml0ZVNldFhtbCgoU2V0KXYsIG5hbWUsIG91dCk7CisgICAgICAgICAgICByZXR1cm47CiAgICAgICAgIH0gZWxzZSBpZiAodiBpbnN0YW5jZW9mIENoYXJTZXF1ZW5jZSkgewogICAgICAgICAgICAgLy8gWFhYIFRoaXMgaXMgdG8gYWxsb3cgdXMgdG8gYXQgbGVhc3Qgd3JpdGUgc29tZXRoaW5nIGlmCiAgICAgICAgICAgICAvLyB3ZSBlbmNvdW50ZXIgc3R5bGVkIHRleHQuLi4gIGJ1dCBpdCBtZWFucyB3ZSB3aWxsIGRyb3AgYWxsCkBAIC00NzYsNyArNTAwLDcgQEAKICAgICAgKgogICAgICAqIEBwYXJhbSBpbiBUaGUgSW5wdXRTdHJlYW0gZnJvbSB3aGljaCB0byByZWFkLgogICAgICAqCi0gICAgICogQHJldHVybiBIYXNoTWFwIFRoZSByZXN1bHRpbmcgbGlzdC4KK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2YgdGhlIHNldCdzIHRhZy4KKyAgICAgKgorICAgICAqIEByZXR1cm4gSGFzaFNldCBUaGUgbmV3bHkgZ2VuZXJhdGVkIHNldC4KKyAgICAgKiAKKyAgICAgKiBAdGhyb3dzIFhtbFB1bGxQYXJzZXJFeGNlcHRpb24KKyAgICAgKiBAdGhyb3dzIGphdmEuaW8uSU9FeGNlcHRpb24KKyAgICAgKiAKKyAgICAgKiBAc2VlICNyZWFkU2V0WG1sCisgICAgICovCisgICAgcHVibGljIHN0YXRpYyBmaW5hbCBIYXNoU2V0IHJlYWRUaGlzU2V0WG1sKFhtbFB1bGxQYXJzZXIgcGFyc2VyLCBTdHJpbmcgZW5kVGFnLCBTdHJpbmdbXSBuYW1lKQorICAgICAgICAgICAgdGhyb3dzIFhtbFB1bGxQYXJzZXJFeGNlcHRpb24sIGphdmEuaW8uSU9FeGNlcHRpb24geworICAgICAgICBIYXNoU2V0IHNldCA9IG5ldyBIYXNoU2V0KCk7CisgICAgICAgIAorICAgICAgICBpbnQgZXZlbnRUeXBlID0gcGFyc2VyLmdldEV2ZW50VHlwZSgpOworICAgICAgICBkbyB7CisgICAgICAgICAgICBpZiAoZXZlbnRUeXBlID09IHBhcnNlci5TVEFSVF9UQUcpIHsKKyAgICAgICAgICAgICAgICBPYmplY3QgdmFsID0gcmVhZFRoaXNWYWx1ZVhtbChwYXJzZXIsIG5hbWUpOworICAgICAgICAgICAgICAgIHNldC5hZGQodmFsKTsKKyAgICAgICAgICAgICAgICAvL1N5c3RlbS5vdXQucHJpbnRsbigiQWRkaW5nIHRvIHNldDogIiArIHZhbCk7CisgICAgICAgICAgICB9IGVsc2UgaWYgKGV2ZW50VHlwZSA9PSBwYXJzZXIuRU5EX1RBRykgeworICAgICAgICAgICAgICAgIGlmIChwYXJzZXIuZ2V0TmFtZSgpLmVxdWFscyhlbmRUYWcpKSB7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBzZXQ7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHRocm93IG5ldyBYbWxQdWxsUGFyc2VyRXhjZXB0aW9uKAorICAgICAgICAgICAgICAgICAgICAgICAgIkV4cGVjdGVkICIgKyBlbmRUYWcgKyAiIGVuZCB0YWcgYXQ6ICIgKyBwYXJzZXIuZ2V0TmFtZSgpKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGV2ZW50VHlwZSA9IHBhcnNlci5uZXh0KCk7CisgICAgICAgIH0gd2hpbGUgKGV2ZW50VHlwZSAhPSBwYXJzZXIuRU5EX0RPQ1VNRU5UKTsKKyAgICAgICAgCisgICAgICAgIHRocm93IG5ldyBYbWxQdWxsUGFyc2VyRXhjZXB0aW9uKAorICAgICAgICAgICAgICAgICJEb2N1bWVudCBlbmRlZCBiZWZvcmUgIiArIGVuZFRhZyArICIgZW5kIHRhZyIpOworICAgIH0KIAogICAgIC8qKgogICAgICAqIFJlYWQgYW4gaW50W10gb2JqZWN0IGZyb20gYW4gWG1sUHVsbFBhcnNlci4gIFRoZSBYTUwgZGF0YSBjb3VsZApAQCAtNzQwLDYgKzgyOCwxMiBAQAogICAgICAgICAgICAgbmFtZVswXSA9IHZhbHVlTmFtZTsKICAgICAgICAgICAgIC8vU3lzdGVtLm91dC5wcmludGxuKCJSZXR1cm5pbmcgdmFsdWUgZm9yICIgKyB2YWx1ZU5hbWUgKyAiOiAiICsgcmVzKTsKICAgICAgICAgICAgIHJldHVybiByZXM7CisgICAgICAgIH0gZWxzZSBpZiAodGFnTmFtZS5lcXVhbHMoInNldCIpKSB7CisgICAgICAgICAgICBwYXJzZXIubmV4dCgpOworICAgICAgICAgICAgcmVzID0gcmVhZFRoaXNTZXRYbWwocGFyc2VyLCAic2V0IiwgbmFtZSk7CisgICAgICAgICAgICBuYW1lWzBdID0gdmFsdWVOYW1lOworICAgICAgICAgICAgLy9TeXN0ZW0ub3V0LnByaW50bG4oIlJldHVybmluZyB2YWx1ZSBmb3IgIiArIHZhbHVlTmFtZSArICI6ICIgKyByZXMpO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V0VGl0bGUoaW50IHJlc0lkKSB7CisgICAgICAgIHNldFRpdGxlKG1Db250ZXh0LmdldFN0cmluZyhyZXNJZCkpOworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIHNldFN1YnRpdGxlKGludCByZXNJZCkgeworICAgICAgICBzZXRTdWJ0aXRsZShtQ29udGV4dC5nZXRTdHJpbmcocmVzSWQpKTsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgdm9pZCBzZXRDdXN0b21WaWV3KFZpZXcgdmlldykgeworICAgICAgICBtQ29udGV4dFZpZXcuc2V0Q3VzdG9tVmlldyh2aWV3KTsKKyAgICAgICAgbUN1c3RvbVZpZXcgPSB2aWV3ICE9IG51bGwgPyBuZXcgV2Vha1JlZmVyZW5jZTxWaWV3Pih2aWV3KSA6IG51bGw7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgaW52YWxpZGF0ZSgpIHsKKyAgICAgICAgbUNhbGxiYWNrLm9uUHJlcGFyZUFjdGlvbk1vZGUodGhpcywgbU1lbnUpOworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIGZpbmlzaCgpIHsKKyAgICAgICAgaWYgKG1GaW5pc2hlZCkgeworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisgICAgICAgIG1GaW5pc2hlZCA9IHRydWU7CisKKyAgICAgICAgbUNhbGxiYWNrLm9uRGVzdHJveUFjdGlvbk1vZGUodGhpcyk7CisgICAgICAgIG1Db250ZXh0Vmlldy5zZXRWaXNpYmlsaXR5KFZpZXcuR09ORSk7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIE1lbnUgZ2V0TWVudSgpIHsKKyAgICAgICAgcmV0dXJuIG1NZW51OworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyBDaGFyU2VxdWVuY2UgZ2V0VGl0bGUoKSB7CisgICAgICAgIHJldHVybiBtQ29udGV4dFZpZXcuZ2V0VGl0bGUoKTsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgQ2hhclNlcXVlbmNlIGdldFN1YnRpdGxlKCkgeworICAgICAgICByZXR1cm4gbUNvbnRleHRWaWV3LmdldFN1YnRpdGxlKCk7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIFZpZXcgZ2V0Q3VzdG9tVmlldygpIHsKKyAgICAgICAgcmV0dXJuIG1DdXN0b21WaWV3ICE9IG51bGwgPyBtQ3VzdG9tVmlldy5nZXQoKSA6IG51bGw7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIE1lbnVJbmZsYXRlciBnZXRNZW51SW5mbGF0ZXIoKSB7CisgICAgICAgIHJldHVybiBuZXcgTWVudUluZmxhdGVyKG1Db250ZXh0KTsKKyAgICB9CisKKyAgICBwdWJsaWMgYm9vbGVhbiBvbk1lbnVJdGVtU2VsZWN0ZWQoTWVudUJ1aWxkZXIgbWVudSwgTWVudUl0ZW0gaXRlbSkgeworICAgICAgICByZXR1cm4gbUNhbGxiYWNrLm9uQWN0aW9uSXRlbUNsaWNrZWQodGhpcywgaXRlbSk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgb25DbG9zZU1lbnUoTWVudUJ1aWxkZXIgbWVudSwgYm9vbGVhbiBhbGxNZW51c0FyZUNsb3NpbmcpIHsKKyAgICB9CisKKyAgICBwdWJsaWMgYm9vbGVhbiBvblN1Yk1lbnVTZWxlY3RlZChTdWJNZW51QnVpbGRlciBzdWJNZW51KSB7CisgICAgICAgIGlmICghc3ViTWVudS5oYXNWaXNpYmxlSXRlbXMoKSkgeworICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgIH0KKworICAgICAgICBuZXcgTWVudVBvcHVwSGVscGVyKG1Db250ZXh0LCBzdWJNZW51KS5zaG93KCk7CisgICAgICAgIHJldHVybiB0cnVlOworICAgIH0KKwor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gICAKKyAgICBwcml2YXRlIEFycmF5TGlzdDxBY3Rpb25NZW51SXRlbT4gbUl0ZW1zOworICAgIAorICAgIHB1YmxpYyBBY3Rpb25NZW51KENvbnRleHQgY29udGV4dCkgeworICAgICAgICBtQ29udGV4dCA9IGNvbnRleHQ7CisgICAgICAgIG1JdGVtcyA9IG5ldyBBcnJheUxpc3Q8QWN0aW9uTWVudUl0ZW0+KCk7CisgICAgfQorICAgIAorICAgIHB1YmxpYyBDb250ZXh0IGdldENvbnRleHQoKSB7CisgICAgICAgIHJldHVybiBtQ29udGV4dDsKKyAgICB9CisKKyAgICBwdWJsaWMgTWVudUl0ZW0gYWRkKENoYXJTZXF1ZW5jZSB0aXRsZSkgeworICAgICAgICByZXR1cm4gYWRkKDAsIDAsIDAsIHRpdGxlKTsKKyAgICB9CisKKyAgICBwdWJsaWMgTWVudUl0ZW0gYWRkKGludCB0aXRsZVJlcykgeworICAgICAgICByZXR1cm4gYWRkKDAsIDAsIDAsIHRpdGxlUmVzKTsKKyAgICB9CisKKyAgICBwdWJsaWMgTWVudUl0ZW0gYWRkKGludCBncm91cElkLCBpbnQgaXRlbUlkLCBpbnQgb3JkZXIsIGludCB0aXRsZVJlcykgeworICAgICAgICByZXR1cm4gYWRkKGdyb3VwSWQsIGl0ZW1JZCwgb3JkZXIsIG1Db250ZXh0LmdldFJlc291cmNlcygpLmdldFN0cmluZyh0aXRsZVJlcykpOworICAgIH0KKyAgICAKKyAgICBwdWJsaWMgTWVudUl0ZW0gYWRkKGludCBncm91cElkLCBpbnQgaXRlbUlkLCBpbnQgb3JkZXIsIENoYXJTZXF1ZW5jZSB0aXRsZSkgeworICAgICAgICBBY3Rpb25NZW51SXRlbSBpdGVtID0gbmV3IEFjdGlvbk1lbnVJdGVtKGdldENvbnRleHQoKSwKKyAgICAgICAgICAgICAgICBncm91cElkLCBpdGVtSWQsIDAsIG9yZGVyLCB0aXRsZSk7CisgICAgICAgIG1JdGVtcy5hZGQob3JkZXIsIGl0ZW0pOworICAgICAgICByZXR1cm4gaXRlbTsKKyAgICB9CisKKyAgICBwdWJsaWMgaW50IGFkZEludGVudE9wdGlvbnMoaW50IGdyb3VwSWQsIGludCBpdGVtSWQsIGludCBvcmRlciwKKyAgICAgICAgICAgIENvbXBvbmVudE5hbWUgY2FsbGVyLCBJbnRlbnRbXSBzcGVjaWZpY3MsIEludGVudCBpbnRlbnQsIGludCBmbGFncywKKyAgICAgICAgICAgIE1lbnVJdGVtW10gb3V0U3BlY2lmaWNJdGVtcykgeworICAgICAgICBQYWNrYWdlTWFuYWdlciBwbSA9IG1Db250ZXh0LmdldFBhY2thZ2VNYW5hZ2VyKCk7CisgICAgICAgIGZpbmFsIExpc3Q8UmVzb2x2ZUluZm8+IGxyaSA9CisgICAgICAgICAgICAgICAgcG0ucXVlcnlJbnRlbnRBY3Rpdml0eU9wdGlvbnMoY2FsbGVyLCBzcGVjaWZpY3MsIGludGVudCwgMCk7CisgICAgICAgIGZpbmFsIGludCBOID0gbHJpICE9IG51bGwgPyBscmkuc2l6ZSgpIDogMDsKKworICAgICAgICBpZiAoKGZsYWdzICYgRkxBR19BUFBFTkRfVE9fR1JPVVApID09IDApIHsKKyAgICAgICAgICAgIHJlbW92ZUdyb3VwKGdyb3VwSWQpOworICAgICAgICB9CisKKyAgICAgICAgZm9yIChpbnQgaT0wOyBpPE47IGkrKykgeworICAgICAgICAgICAgZmluYWwgUmVzb2x2ZUluZm8gcmkgPSBscmkuZ2V0KGkpOworICAgICAgICAgICAgSW50ZW50IHJpbnRlbnQgPSBuZXcgSW50ZW50KAorICAgICAgICAgICAgICAgIHJpLnNwZWNpZmljSW5kZXggPCAwID8gaW50ZW50IDogc3BlY2lmaWNzW3JpLnNwZWNpZmljSW5kZXhdKTsKKyAgICAgICAgICAgIHJpbnRlbnQuc2V0Q29tcG9uZW50KG5ldyBDb21wb25lbnROYW1lKAorICAgICAgICAgICAgICAgICAgICByaS5hY3Rpdml0eUluZm8uYXBwbGljYXRpb25JbmZvLnBhY2thZ2VOYW1lLAorICAgICAgICAgICAgICAgICAgICByaS5hY3Rpdml0eUluZm8ubmFtZSkpOworICAgICAgICAgICAgZmluYWwgTWVudUl0ZW0gaXRlbSA9IGFkZChncm91cElkLCBpdGVtSWQsIG9yZGVyLCByaS5sb2FkTGFiZWwocG0pKQorICAgICAgICAgICAgICAgICAgICAuc2V0SWNvbihyaS5sb2FkSWNvbihwbSkpCisgICAgICAgICAgICAgICAgICAgIC5zZXRJbnRlbnQocmludGVudCk7CisgICAgICAgICAgICBpZiAob3V0U3BlY2lmaWNJdGVtcyAhPSBudWxsICYmIHJpLnNwZWNpZmljSW5kZXggPj0gMCkgeworICAgICAgICAgICAgICAgIG91dFNwZWNpZmljSXRlbXNbcmkuc3BlY2lmaWNJbmRleF0gPSBpdGVtOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcmV0dXJuIE47CisgICAgfQorCisgICAgcHVibGljIFN1Yk1lbnUgYWRkU3ViTWVudShDaGFyU2VxdWVuY2UgdGl0bGUpIHsKKyAgICAgICAgLy8gVE9ETyBJbXBsZW1lbnQgc3VibWVudXMKKyAgICAgICAgcmV0dXJuIG51bGw7CisgICAgfQorCisgICAgcHVibGljIFN1Yk1lbnUgYWRkU3ViTWVudShpbnQgdGl0bGVSZXMpIHsKKyAgICAgICAgLy8gVE9ETyBJbXBsZW1lbnQgc3VibWVudXMKKyAgICAgICAgcmV0dXJuIG51bGw7CisgICAgfQorCisgICAgcHVibGljIFN1Yk1lbnUgYWRkU3ViTWVudShpbnQgZ3JvdXBJZCwgaW50IGl0ZW1JZCwgaW50IG9yZGVyLAorICAgICAgICAgICAgQ2hhclNlcXVlbmNlIHRpdGxlKSB7CisgICAgICAgIC8vIFRPRE8gSW1wbGVtZW50IHN1Ym1lbnVzCisgICAgICAgIHJldHVybiBudWxsOworICAgIH0KKworICAgIHB1YmxpYyBTdWJNZW51IGFkZFN1Yk1lbnUoaW50IGdyb3VwSWQsIGludCBpdGVtSWQsIGludCBvcmRlciwgaW50IHRpdGxlUmVzKSB7CisgICAgICAgIC8vIFRPRE8gSW1wbGVtZW50IHN1Ym1lbnVzCisgICAgICAgIHJldHVybiBudWxsOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIGNsZWFyKCkgeworICAgICAgICBtSXRlbXMuY2xlYXIoKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBjbG9zZSgpIHsKKyAgICB9CisgICAgCisgICAgcHJpdmF0ZSBpbnQgZmluZEl0ZW1JbmRleChpbnQgaWQpIHsKKyAgICAgICAgZmluYWwgQXJyYXlMaXN0PEFjdGlvbk1lbnVJdGVtPiBpdGVtcyA9IG1JdGVtczsKKyAgICAgICAgZmluYWwgaW50IGl0ZW1Db3VudCA9IGl0ZW1zLnNpemUoKTsKKyAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBpdGVtQ291bnQ7IGkrKykgeworICAgICAgICAgICAgaWYgKGl0ZW1zLmdldChpKS5nZXRJdGVtSWQoKSA9PSBpZCkgeworICAgICAgICAgICAgICAgIHJldHVybiBpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIAorICAgICAgICByZXR1cm4gLTE7CisgICAgfQorCisgICAgcHVibGljIE1lbnVJdGVtIGZpbmRJdGVtKGludCBpZCkgeworICAgICAgICByZXR1cm4gbUl0ZW1zLmdldChmaW5kSXRlbUluZGV4KGlkKSk7CisgICAgfQorCisgICAgcHVibGljIE1lbnVJdGVtIGdldEl0ZW0oaW50IGluZGV4KSB7CisgICAgICAgIHJldHVybiBtSXRlbXMuZ2V0KGluZGV4KTsKKyAgICB9CisKKyAgICBwdWJsaWMgYm9vbGVhbiBoYXNWaXNpYmxlSXRlbXMoKSB7CisgICAgICAgIGZpbmFsIEFycmF5TGlzdDxBY3Rpb25NZW51SXRlbT4gaXRlbXMgPSBtSXRlbXM7CisgICAgICAgIGZpbmFsIGludCBpdGVtQ291bnQgPSBpdGVtcy5zaXplKCk7CisgICAgICAgIAorICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGl0ZW1Db3VudDsgaSsrKSB7CisgICAgICAgICAgICBpZiAoaXRlbXMuZ2V0KGkpLmlzVmlzaWJsZSgpKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisgICAgCisgICAgcHJpdmF0ZSBBY3Rpb25NZW51SXRlbSBmaW5kSXRlbVdpdGhTaG9ydGN1dChpbnQga2V5Q29kZSwgS2V5RXZlbnQgZXZlbnQpIHsKKyAgICAgICAgLy8gVE9ETyBNYWtlIHRoaXMgc21hcnRlci4KKyAgICAgICAgZmluYWwgYm9vbGVhbiBxd2VydHkgPSBtSXNRd2VydHk7CisgICAgICAgIGZpbmFsIEFycmF5TGlzdDxBY3Rpb25NZW51SXRlbT4gaXRlbXMgPSBtSXRlbXM7CisgICAgICAgIGZpbmFsIGludCBpdGVtQ291bnQgPSBpdGVtcy5zaXplKCk7CisgICAgICAgIAorICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGl0ZW1Db3VudDsgaSsrKSB7CisgICAgICAgICAgICBBY3Rpb25NZW51SXRlbSBpdGVtID0gaXRlbXMuZ2V0KGkpOworICAgICAgICAgICAgZmluYWwgY2hhciBzaG9ydGN1dCA9IHF3ZXJ0eSA/IGl0ZW0uZ2V0QWxwaGFiZXRpY1Nob3J0Y3V0KCkgOgorICAgICAgICAgICAgICAgICAgICBpdGVtLmdldE51bWVyaWNTaG9ydGN1dCgpOworICAgICAgICAgICAgaWYgKGtleUNvZGUgPT0gc2hvcnRjdXQpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gaXRlbTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICByZXR1cm4gbnVsbDsKKyAgICB9CisKKyAgICBwdWJsaWMgYm9vbGVhbiBpc1Nob3J0Y3V0S2V5KGludCBrZXlDb2RlLCBLZXlFdmVudCBldmVudCkgeworICAgICAgICByZXR1cm4gZmluZEl0ZW1XaXRoU2hvcnRjdXQoa2V5Q29kZSwgZXZlbnQpICE9IG51bGw7CisgICAgfQorCisgICAgcHVibGljIGJvb2xlYW4gcGVyZm9ybUlkZW50aWZpZXJBY3Rpb24oaW50IGlkLCBpbnQgZmxhZ3MpIHsKKyAgICAgICAgZmluYWwgaW50IGluZGV4ID0gZmluZEl0ZW1JbmRleChpZCk7CisgICAgICAgIGlmIChpbmRleCA8IDApIHsKKyAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgfQorCisgICAgICAgIHJldHVybiBtSXRlbXMuZ2V0KGluZGV4KS5pbnZva2UoKTsKKyAgICB9CisKKyAgICBwdWJsaWMgYm9vbGVhbiBwZXJmb3JtU2hvcnRjdXQoaW50IGtleUNvZGUsIEtleUV2ZW50IGV2ZW50LCBpbnQgZmxhZ3MpIHsKKyAgICAgICAgQWN0aW9uTWVudUl0ZW0gaXRlbSA9IGZpbmRJdGVtV2l0aFNob3J0Y3V0KGtleUNvZGUsIGV2ZW50KTsKKyAgICAgICAgaWYgKGl0ZW0gPT0gbnVsbCkgeworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisgICAgICAgIAorICAgICAgICByZXR1cm4gaXRlbS5pbnZva2UoKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCByZW1vdmVHcm91cChpbnQgZ3JvdXBJZCkgeworICAgICAgICBmaW5hbCBBcnJheUxpc3Q8QWN0aW9uTWVudUl0ZW0+IGl0ZW1zID0gbUl0ZW1zOworICAgICAgICBpbnQgaXRlbUNvdW50ID0gaXRlbXMuc2l6ZSgpOworICAgICAgICBpbnQgaSA9IDA7CisgICAgICAgIHdoaWxlIChpIDwgaXRlbUNvdW50KSB7CisgICAgICAgICAgICBpZiAoaXRlbXMuZ2V0KGkpLmdldEdyb3VwSWQoKSA9PSBncm91cElkKSB7CisgICAgICAgICAgICAgICAgaXRlbXMucmVtb3ZlKGkpOworICAgICAgICAgICAgICAgIGl0ZW1Db3VudC0tOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBpKys7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCByZW1vdmVJdGVtKGludCBpZCkgeworICAgICAgICBtSXRlbXMucmVtb3ZlKGZpbmRJdGVtSW5kZXgoaWQpKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBzZXRHcm91cENoZWNrYWJsZShpbnQgZ3JvdXAsIGJvb2xlYW4gY2hlY2thYmxlLAorICAgICAgICAgICAgYm9vbGVhbiBleGNsdXNpdmUpIHsKKyAgICAgICAgZmluYWwgQXJyYXlMaXN0PEFjdGlvbk1lbnVJdGVtPiBpdGVtcyA9IG1JdGVtczsKKyAgICAgICAgZmluYWwgaW50IGl0ZW1Db3VudCA9IGl0ZW1zLnNpemUoKTsKKyAgICAgICAgCisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgaXRlbUNvdW50OyBpKyspIHsKKyAgICAgICAgICAgIEFjdGlvbk1lbnVJdGVtIGl0ZW0gPSBpdGVtcy5nZXQoaSk7CisgICAgICAgICAgICBpZiAoaXRlbS5nZXRHcm91cElkKCkgPT0gZ3JvdXApIHsKKyAgICAgICAgICAgICAgICBpdGVtLnNldENoZWNrYWJsZShjaGVja2FibGUpOworICAgICAgICAgICAgICAgIGl0ZW0uc2V0RXhjbHVzaXZlQ2hlY2thYmxlKGV4Y2x1c2l2ZSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBzZXRHcm91cEVuYWJsZWQoaW50IGdyb3VwLCBib29sZWFuIGVuYWJsZWQpIHsKKyAgICAgICAgZmluYWwgQXJyYXlMaXN0PEFjdGlvbk1lbnVJdGVtPiBpdGVtcyA9IG1JdGVtczsKKyAgICAgICAgZmluYWwgaW50IGl0ZW1Db3VudCA9IGl0ZW1zLnNpemUoKTsKKyAgICAgICAgCisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgaXRlbUNvdW50OyBpKyspIHsKKyAgICAgICAgICAgIEFjdGlvbk1lbnVJdGVtIGl0ZW0gPSBpdGVtcy5nZXQoaSk7CisgICAgICAgICAgICBpZiAoaXRlbS5nZXRHcm91cElkKCkgPT0gZ3JvdXApIHsKKyAgICAgICAgICAgICAgICBpdGVtLnNldEVuYWJsZWQoZW5hYmxlZCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBzZXRHcm91cFZpc2libGUoaW50IGdyb3VwLCBib29sZWFuIHZpc2libGUpIHsKKyAgICAgICAgZmluYWwgQXJyYXlMaXN0PEFjdGlvbk1lbnVJdGVtPiBpdGVtcyA9IG1JdGVtczsKKyAgICAgICAgZmluYWwgaW50IGl0ZW1Db3VudCA9IGl0ZW1zLnNpemUoKTsKKyAgICAgICAgCisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgaXRlbUNvdW50OyBpKyspIHsKKyAgICAgICAgICAgIEFjdGlvbk1lbnVJdGVtIGl0ZW0gPSBpdGVtcy5nZXQoaSk7CisgICAgICAgICAgICBpZiAoaXRlbS5nZXRHcm91cElkKCkgPT0gZ3JvdXApIHsKKyAgICAgICAgICAgICAgICBpdGVtLnNldFZpc2libGUodmlzaWJsZSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBzZXRRd2VydHlNb2RlKGJvb2xlYW4gaXNRd2VydHkpIHsKKyAgICAgICAgbUlzUXdlcnR5ID0gaXNRd2VydHk7CisgICAgfQorCisgICAgcHVibGljIGludCBzaXplKCkgeworICAgICAgICByZXR1cm4gbUl0ZW1zLnNpemUoKTsKKyAgICB9Cit9CmRpZmYgLS1naXQgYS9jb3JlL2phdmEvY29tL2FuZHJvaWQvaW50ZXJuYWwvdmlldy9tZW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h0IG1Db250ZXh0OworICAgIAorICAgIHByaXZhdGUgTWVudUl0ZW0uT25NZW51SXRlbUNsaWNrTGlzdGVuZXIgbUNsaWNrTGlzdGVuZXI7CisgICAgCisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IE5PX0lDT04gPSAwOworICAgIAorICAgIHByaXZhdGUgaW50IG1GbGFncyA9IEVOQUJMRUQ7CisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IENIRUNLQUJMRSAgICAgID0gMHgwMDAwMDAwMTsKKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgQ0hFQ0tFRCAgICAgICAgPSAweDAwMDAwMDAyOworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBFWENMVVNJVkUgICAgICA9IDB4MDAwMDAwMDQ7CisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IEhJRERFTiAgICAgICAgID0gMHgwMDAwMDAwODsKKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgRU5BQkxFRCAgICAgICAgPSAweDAwMDAwMDEwOworICAgIAorICAgIHB1YmxpYyBBY3Rpb25NZW51SXRlbShDb250ZXh0IGNvbnRleHQsIGludCBncm91cCwgaW50IGlkLCBpbnQgY2F0ZWdvcnlPcmRlciwgaW50IG9yZGVyaW5nLAorICAgICAgICAgICAgQ2hhclNlcXVlbmNlIHRpdGxlKSB7CisgICAgICAgIG1Db250ZXh0ID0gY29udGV4dDsKKyAgICAgICAgbUlkID0gaWQ7CisgICAgICAgIG1Hcm91cCA9IGdyb3VwOworICAgICAgICBtQ2F0ZWdvcnlPcmRlciA9IGNhdGVnb3J5T3JkZXI7CisgICAgICAgIG1PcmRlcmluZyA9IG9yZGVyaW5nOworICAgICAgICBtVGl0bGUgPSB0aXRsZTsKKyAgICB9CisgICAgCisgICAgcHVibGljIGNoYXIgZ2V0QWxwaGFiZXRpY1Nob3J0Y3V0KCkgeworICAgICAgICByZXR1cm4gbVNob3J0Y3V0QWxwaGFiZXRpY0NoYXI7CisgICAgfQorCisgICAgcHVibGljIGludCBnZXRHcm91cElkKCkgeworICAgICAgICByZXR1cm4gbUdyb3VwOworICAgIH0KKworICAgIHB1YmxpYyBEcmF3YWJsZSBnZXRJY29uKCkgeworICAgICAgICByZXR1cm4gbUljb25EcmF3YWJsZTsKKyAgICB9CisKKyAgICBwdWJsaWMgSW50ZW50IGdldEludGVudCgpIHsKKyAgICAgICAgcmV0dXJuIG1JbnRlbnQ7CisgICAgfQorCisgICAgcHVibGljIGludCBnZXRJdGVtSWQoKSB7CisgICAgICAgIHJldHVybiBtSWQ7CisgICAgfQorCisgICAgcHVibGljIENvbnRleHRNZW51SW5mbyBnZXRNZW51SW5mbygpIHsKKyAgICAgICAgcmV0dXJuIG51bGw7CisgICAgfQorCisgICAgcHVibGljIGNoYXIgZ2V0TnVtZXJpY1Nob3J0Y3V0KCkgeworICAgICAgICByZXR1cm4gbVNob3J0Y3V0TnVtZXJpY0NoYXI7CisgICAgfQorCisgICAgcHVibGljIGludCBnZXRPcmRlcigpIHsKKyAgICAgICAgcmV0dXJuIG1PcmRlcmluZzsKKyAgICB9CisKKyAgICBwdWJsaWMgU3ViTWVudSBnZXRTdWJNZW51KCkgeworICAgICAgICByZXR1cm4gbnVsbDsKKyAgICB9CisKKyAgICBwdWJsaWMgQ2hhclNlcXVlbmNlIGdldFRpdGxlKCkgeworICAgICAgICByZXR1cm4gbVRpdGxlOworICAgIH0KKworICAgIHB1YmxpYyBDaGFyU2VxdWVuY2UgZ2V0VGl0bGVDb25kZW5zZWQoKSB7CisgICAgICAgIHJldHVybiBtVGl0bGVDb25kZW5zZWQ7CisgICAgfQorCisgICAgcHVibGljIGJvb2xlYW4gaGFzU3ViTWVudSgpIHsKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIHB1YmxpYyBib29sZWFuIGlzQ2hlY2thYmxlKCkgeworICAgICAgICByZXR1cm4gKG1GbGFncyAmIENIRUNLQUJMRSkgIT0gMDsgCisgICAgfQorCisgICAgcHVibGljIGJvb2xlYW4gaXNDaGVja2VkKCkgeworICAgICAgICByZXR1cm4gKG1GbGFncyAmIENIRUNLRUQpICE9IDA7CisgICAgfQorCisgICAgcHVibGljIGJvb2xlYW4gaXNFbmFibGVkKCkgeworICAgICAgICByZXR1cm4gKG1GbGFncyAmIEVOQUJMRUQpICE9IDA7CisgICAgfQorCisgICAgcHVibGljIGJvb2xlYW4gaXNWaXNpYmxlKCkgeworICAgICAgICByZXR1cm4gKG1GbGFncyAmIEhJRERFTikgPT0gMDsKKyAgICB9CisKKyAgICBwdWJsaWMgTWVudUl0ZW0gc2V0QWxwaGFiZXRpY1Nob3J0Y3V0KGNoYXIgYWxwaGFDaGFyKSB7CisgICAgICAgIG1TaG9ydGN1dEFscGhhYmV0aWNDaGFyID0gYWxwaGFDaGFyOworICAgICAgICByZXR1cm4gdGhpczsKKyAgICB9CisKKyAgICBwdWJsaWMgTWVudUl0ZW0gc2V0Q2hlY2thYmxlKGJvb2xlYW4gY2hlY2thYmxlKSB7CisgICAgICAgIG1GbGFncyA9IChtRmxhZ3MgJiB+Q0hFQ0tBQkxFKSB8IChjaGVja2FibGUgPyBDSEVDS0FCTEUgOiAwKTsKKyAgICAgICAgcmV0dXJuIHRoaXM7CisgICAgfQorICAgIAorICAgIHB1YmxpYyBBY3Rpb25NZW51SXRlbSBzZXRFeGNsdXNpdmVDaGVja2FibGUoYm9vbGVhbiBleGNsdXNpdmUpIHsKKyAgICAgICAgbUZsYWdzID0gKG1GbGFncyAmIH5FWENMVVNJVkUpIHwgKGV4Y2x1c2l2ZSA/IEVYQ0xVU0lWRSA6IDApOworICAgICAgICByZXR1cm4gdGhpczsKKyAgICB9CisKKyAgICBwdWJsaWMgTWVudUl0ZW0gc2V0Q2hlY2tlZChib29sZWFuIGNoZWNrZWQpIHsKKyAgICAgICAgbUZsYWdzID0gKG1GbGFncyAmIH5DSEVDS0VEKSB8IChjaGVja2VkID8gQ0hFQ0tFRCA6IDApOworICAgICAgICByZXR1cm4gdGhpczsKKyAgICB9CisKKyAgICBwdWJsaWMgTWVudUl0ZW0gc2V0RW5hYmxlZChib29sZWFuIGVuYWJsZWQpIHsKKyAgICAgICAgbUZsYWdzID0gKG1GbGFncyAmIH5FTkFCTEVEKSB8IChlbmFibGVkID8gRU5BQkxFRCA6IDApOworICAgICAgICByZXR1cm4gdGhpczsKKyAgICB9CisKKyAgICBwdWJsaWMgTWVudUl0ZW0gc2V0SWNvbihEcmF3YWJsZSBpY29uKSB7CisgICAgICAgIG1JY29uRHJhd2FibGUgPSBpY29uOworICAgICAgICBtSWNvblJlc0lkID0gTk9fSUNPTjsKKyAgICAgICAgcmV0dXJuIHRoaXM7CisgICAgfQorCisgICAgcHVibGljIE1lbnVJdGVtIHNldEljb24oaW50IGljb25SZXMpIHsKKyAgICAgICAgbUljb25SZXNJZCA9IGljb25SZXM7CisgICAgICAgIG1JY29uRHJhd2FibGUgPSBtQ29udGV4dC5nZXRSZXNvdXJjZXMoKS5nZXREcmF3YWJsZShpY29uUmVzKTsKKyAgICAgICAgcmV0dXJuIHRoaXM7CisgICAgfQorCisgICAgcHVibGljIE1lbnVJdGVtIHNldEludGVudChJbnRlbnQgaW50ZW50KSB7CisgICAgICAgIG1JbnRlbnQgPSBpbnRlbnQ7CisgICAgICAgIHJldHVybiB0aGlzOworICAgIH0KKworICAgIHB1YmxpYyBNZW51SXRlbSBzZXROdW1lcmljU2hvcnRjdXQoY2hhciBudW1lcmljQ2hhcikgeworICAgICAgICBtU2hvcnRjdXROdW1lcmljQ2hhciA9IG51bWVyaWNDaGFyOworICAgICAgICByZXR1cm4gdGhpczsKKyAgICB9CisKKyAgICBwdWJsaWMgTWVudUl0ZW0gc2V0T25NZW51SXRlbUNsaWNrTGlzdGVuZXIoT25NZW51SXRlbUNsaWNrTGlzdGVuZXIgbWVudUl0ZW1DbGlja0xpc3RlbmVyKSB7CisgICAgICAgIG1DbGlja0xpc3RlbmVyID0gbWVudUl0ZW1DbGlja0xpc3RlbmVyOworICAgICAgICByZXR1cm4gdGhpczsKKyAgICB9CisKKyAgICBwdWJsaWMgTWVudUl0ZW0gc2V0U2hvcnRjdXQoY2hhciBudW1lcmljQ2hhciwgY2hhciBhbHBoYUNoYXIpIHsKKyAgICAgICAgbVNob3J0Y3V0TnVtZXJpY0NoYXIgPSBudW1lcmljQ2hhcjsKKyAgICAgICAgbVNob3J0Y3V0QWxwaGFiZXRpY0NoYXIgPSBhbHBoYUNoYXI7CisgICAgICAgIHJldHVybiB0aGlzOworICAgIH0KKworICAgIHB1YmxpYyBNZW51SXRlbSBzZXRUaXRsZShDaGFyU2VxdWVuY2UgdGl0bGUpIHsKKyAgICAgICAgbVRpdGxlID0gdGl0bGU7CisgICAgICAgIHJldHVybiB0aGlzOworICAgIH0KKworICAgIHB1YmxpYyBNZW51SXRlbSBzZXRUaXRsZShpbnQgdGl0bGUpIHsKKyAgICAgICAgbVRpdGxlID0gbUNvbnRleHQuZ2V0UmVzb3VyY2VzKCkuZ2V0U3RyaW5nKHRpdGxlKTsKKyAgICAgICAgcmV0dXJuIHRoaXM7CisgICAgfQorCisgICAgcHVibGljIE1lbnVJdGVtIHNldFRpdGxlQ29uZGVuc2VkKENoYXJTZXF1ZW5jZSB0aXRsZSkgeworICAgICAgICBtVGl0bGVDb25kZW5zZWQgPSB0aXRsZTsKKyAgICAgICAgcmV0dXJuIHRoaXM7CisgICAgfQorCisgICAgcHVibGljIE1lbnVJdGVtIHNldFZpc2libGUoYm9vbGVhbiB2aXNpYmxlKSB7CisgICAgICAgIG1GbGFncyA9IChtRmxhZ3MgJiBISURERU4pIHwgKHZpc2libGUgPyAwIDogSElEREVOKTsKKyAgICAgICAgcmV0dXJuIHRoaXM7CisgICAgfQorCisgICAgcHVibGljIGJvb2xlYW4gaW52b2tlKCkgeworICAgICAgICBpZiAobUNsaWNrTGlzdGVuZXIgIT0gbnVsbCAmJiBtQ2xpY2tMaXN0ZW5lci5vbk1lbn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7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBzZXRJdGVtSW52b2tlcihNZW51QnVpbGRlci5JdGVtSW52b2tlciBpbnZva2VyKSB7CisgICAgICAgIG1JdGVtSW52b2tlciA9IGludm9rZXI7CisgICAgfQorCisgICAgcHVibGljIGJvb2xlYW4gcHJlZmVyc0NvbmRlbnNlZFRpdGxlKCkgeworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgc2V0Q2hlY2thYmxlKGJvb2xlYW4gY2hlY2thYmxlKSB7CisgICAgICAgIC8vIFRPRE8gU3VwcG9ydCBjaGVja2FibGUgYWN0aW9uIGl0ZW1zCisgICAgfQorCisgICAgcHVibGljIHZvaWQgc2V0Q2hlY2tlZChib29sZWFuIGNoZWNrZWQpIHsKKyAgICAgICAgLy8gVE9ETyBTdXBwb3J0IGNoZWNrYWJsZSBhY3Rpb24gaXRlbXMKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBzZXRJY29uKERyYXdhYmxlIGljb24pIHsKKyAgICAgICAgbUltYWdlQnV0dG9uLnNldEltYWdlRHJhd2FibGUoaWNvbik7CisgICAgICAgIGlmIChpY29uICE9IG51bGwpIHsKKyAgICAgICAgICAgIG1JbWFnZUJ1dHRvbi5zZXRWaXNpYmlsaXR5KFZJU0lCTEUpOworICAgICAgICAgICAgbVRleHRCdXR0b24uc2V0VmlzaWJpbGl0eShHT05FKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIG1JbWFnZUJ1dHRvbi5zZXRWaXNpYmlsaXR5KEdPTkUpOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHZvaWQgc2V0U2hvcnRjdXQoYm9vbGVhbiBzaG93U2hvcnRjdXQsIGNoYXIgc2hvcnRjdXRLZXkpIHsKKyAgICAgICAgLy8gQWN0aW9uIGJ1dHRvbnMgZG9uJ3Qgc2hvdyB0ZXh0IGZvciBzaG9ydGN1dCBr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gICAgICAgICAgICAgICAgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHlsZWFibGUuVGhlbWUpOworICAgICAgICBtSXRlbVBhZGRpbmcgPSBhLmdldERpbWVuc2lvblBpeGVsT2Zmc2V0KAorICAgICAgICAgICAgICAgIGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3R5bGVhYmxlLlRoZW1lX2FjdGlvbkJ1dHRvblBhZGRpbmcsIDApOworICAgICAgICBtSXRlbU1hcmdpbiA9IG1JdGVtUGFkZGluZyAvIDI7CisgICAgICAgIGEucmVjeWNsZSgpOworCisgICAgICAgIC8vIE1lYXN1cmUgZm9yIGluaXRpYWwgY29uZmlndXJhdGlvbgorICAgICAgICBtTWF4SXRlbXMgPSBtZWFzdXJlTWF4QWN0aW9uQnV0dG9ucygpOworCisgICAgICAgIC8vIFRPRE8gVGhlcmUgaGFzIHRvIGJlIGEgYmV0dGVyIHdheSB0byBpbmRpY2F0ZSB0aGF0IHdlIGRvbid0IGhhdmUgYSBoYXJkIG1lbnUga2V5LgorICAgICAgICBmaW5hbCBpbnQgc2NyZWVuID0gZ2V0UmVzb3VyY2VzKCkuZ2V0Q29uZmlndXJhdGlvbigpLnNjcmVlbkxheW91dDsKKyAgICAgICAgbVJlc2VydmVPdmVyZmxvdyA9IChzY3JlZW4gJiBDb25maWd1cmF0aW9uLlNDUkVFTkxBWU9VVF9TSVpFX01BU0spID09CisgICAgICAgICAgICAgICAgQ29uZmlndXJhdGlvbi5TQ1JFRU5MQVlPVVRfU0laRV9YTEFSR0U7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgb25Db25maWd1cmF0aW9uQ2hhbmdlZChDb25maWd1cmF0aW9uIG5ld0NvbmZpZykgeworICAgICAgICBmaW5hbCBpbnQgc2NyZWVuID0gbmV3Q29uZmlnLnNjcmVlbkxheW91dDsKKyAgICAgICAgbVJlc2VydmVPdmVyZmxvdyA9IChzY3JlZW4gJiBDb25maWd1cmF0aW9uLlNDUkVFTkxBWU9VV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Uw7CisgICAgICAgIHJldHVybiBwYXJhbXM7CisgICAgfQorICAgIAorICAgIEBPdmVycmlkZQorICAgIHByb3RlY3RlZCBMYXlvdXRQYXJhbXMgZ2VuZXJhdGVMYXlvdXRQYXJhbXMoVmlld0dyb3VwLkxheW91dFBhcmFtcyBwKSB7CisgICAgICAgIHJldHVybiBnZW5lcmF0ZURlZmF1bHRMYXlvdXRQYXJhbXMoKTsKKyAgICB9CisgICAgCisgICAgcHVibGljIGludCBnZXRJdGVtTWFyZ2luKCkgeworICAgICAgICByZXR1cm4gbUl0ZW1NYXJnaW47CisgICAgfQorCisgICAgcHVibGljIGJvb2xlYW4gaW52b2tlSXRlbShNZW51SXRlbUltcGwgaXRlbSkgeworICAgICAgICByZXR1cm4gbU1lbnUucGVyZm9ybUl0ZW1BY3Rpb24oaXRlbSwgMCk7CisgICAgfQorCisgICAgcHVibGljIGludCBnZXRXaW5kb3dBbmltYXRpb25zKCkgeworICAgICAgICByZXR1cm4gMDsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBpbml0aWFsaXplKE1lbnVCdWlsZGVyIG1lbnUsIGludCBtZW51VHlwZSkgeworICAgICAgICBtZW51LnNldE1heEFjdGlvbkl0ZW1zKG1NYXhJdGVtcyk7CisgICAgICAgIG1NZW51ID0gbWVudTsKKyAgICAgICAgdXBkYXRlQ2hpbGRyZW4odHJ1ZSk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgdXBkYXRlQ2hpbGRyZW4oYm9vbGVhbiBjbGVhcmVkKSB7CisgICAgICAgIGZpbmFsIGJvb2xlYW4gcmVzZXJ2ZU92ZXJmbG93ID0gbVJlc2VydmVPdmVyZmxvdzsKKyAgICAgICAgcmVtb3ZlQWxsVmlld3MoKTsKKyAgICAgICAgCisgICAgICAgIGZpbmFsIEFycmF5TGlzdDxNZW51SXRlbUltcGw+IGl0ZW1zVG9TaG93ID0gbU1lbnUuZ2V0QWN0aW9uSXRlbXMocmVzZXJ2ZU92ZXJmbG93KTsKKyAgICAgICAgZmluYWwgaW50IGl0ZW1Db3VudCA9IGl0ZW1zVG9TaG93LnNpemUoKTsKKyAgICAgICAgCisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgaXRlbUNvdW50OyBpKyspIHsKKyAgICAgICAgICAgIGZpbmFsIE1lbnVJdGVtSW1wbCBpdGVtRGF0YSA9IGl0ZW1zVG9TaG93LmdldChpKTsKKyAgICAgICAgICAgIGFkZEl0ZW1WaWV3KChBY3Rpb25NZW51SXRlbVZpZXcpIGl0ZW1EYXRhLmdldEl0ZW1WaWV3KE1lbnVCdWlsZGVyLlRZUEVfQUNUSU9OX0JVVFRPTiwKKyAgICAgICAgICAgICAgICAgICAgdGhpcykpOworICAgICAgICB9CisKKyAgICAgICAgaWYgKHJlc2VydmVPdmVyZmxvdykgeworICAgICAgICAgICAgaWYgKG1NZW51LmdldE5vbkFjdGlvbkl0ZW1zKHRydWUpLnNpemUoKSA+IDApIHsKKyAgICAgICAgICAgICAgICBPdmVyZmxvd01lbnVCdXR0b24gYnV0dG9uID0gbmV3IE92ZXJmbG93TWVudUJ1dHRvbihtQ29udGV4dCk7CisgICAgICAgICAgICAgICAgYWRkVmlldyhidXR0b24pOworICAgICAgICAgICAgICAgIG1PdmVyZmxvd0J1dHRvbiA9IGJ1dHRvbjsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgbU92ZXJmbG93QnV0dG9uID0gbnVsbDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyBib29sZWFuIHNob3dPdmVyZmxvd01lbnUoKSB7CisgICAgICAgIGlmIChtT3ZlcmZsb3dCdXR0b24gIT0gbnVsbCkgeworICAgICAgICAgICAgZmluYWwgTWVudVBvcHVwSGVscGVyIHBvcHVwID0KKyAgICAgICAgICAgICAgICAgICAgbmV3IE1lbnVQb3B1cEhlbHBlcihnZXRDb250ZXh0KCksIG1NZW51LCBtT3ZlcmZsb3dCdXR0b24sIHRydWUpOworICAgICAgICAgICAgLy8gUG9zdCB0aGlzIGZvciBsYXRlcjsgd2UgbWlnaHQgc3RpbGwgbmVlZCBhIGxheW91dCBmb3IgdGhlIGFuY2hvciB0byBiZSByaWdodC4KKyAgICAgICAgICAgIHBvc3QobmV3IFJ1bm5hYmxlKCkgeworICAgICAgICAgICAgICAgIHB1YmxpYyB2b2lkIHJ1bigpIHsKKyAgICAgICAgICAgICAgICAgICAgcG9wdXAuc2hvdygpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0pOworICAgICAgICAgICAgbU92ZXJmbG93UG9wdXAgPSBuZXcgV2Vha1JlZmVyZW5jZTxNZW51UG9wdXBIZWxwZXI+KHBvcHVwKTsKKyAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICB9CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisKKyAgICBwdWJsaWMgYm9vbGVhbiBpc092ZXJmbG93TWVudVNob3dpbmcoKSB7CisgICAgICAgIE1lbnVQb3B1cEhlbHBlciBwb3B1cCA9IG1PdmVyZmxvd1BvcHVwICE9IG51bGwgPyBtT3ZlcmZsb3dQb3B1cC5nZXQoKSA6IG51bGw7CisgICAgICAgIGlmIChwb3B1cCAhPSBudWxsKSB7CisgICAgICAgICAgICByZXR1cm4gcG9wdXAuaXNTaG93aW5nKCk7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIHB1YmxpYyBib29sZWFuIGhpZGVPdmVyZmxvd01lbnUoKSB7CisgICAgICAgIE1lbnVQb3B1cEhlbHBlciBwb3B1cCA9IG1PdmVyZmxvd1BvcHVwICE9IG51bGwgPyBtT3ZlcmZsb3dQb3B1cC5nZXQoKSA6IG51bGw7CisgICAgICAgIGlmIChwb3B1cCAhPSBudWxsKSB7CisgICAgICAgICAgICBwb3B1cC5kaXNtaXNzKCk7CisgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIGFkZEl0ZW1WaWV3KEFjdGlvbk1lbnVJdGVtVmlldyB2aWV3KSB7CisgICAgICAgIHZpZXcuc2V0SXRlbUludm9rZXIodGhpcyk7CisgICAgICAgIGFkZFZpZXcodmlldyk7CisgICAgfQorCisgICAgcHJpdmF0ZSBjbGFzcyBPdmVyZmxvd01lbnVCdXR0b24gZXh0ZW5kcyBJbWFnZUJ1dHRvbiB7CisgICAgICAgIHB1YmxpYyBPdmVyZmxvd01lbnVCdXR0b24oQ29udGV4dCBjb250ZXh0KSB7CisgICAgICAgICAgICBzdXBlcihjb250ZXh0LCBudWxsLCBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLmF0dHIuYWN0aW9uQnV0dG9uU3R5bGUpOworCisgICAgICAgICAgICBmaW5hbCBSZXNvdXJjZXMgcmVzID0gY29udGV4dC5nZXRSZXNvdXJjZXMoKTsKKyAgICAgICAgICAgIHNldENsaWNrYWJsZSh0cnVlKTsKKyAgICAgICAgICAgIHNldEZvY3VzYWJsZSh0cnVlKTsKKyAgICAgICAgICAgIHNldENvbnRlbnREZXNjcmlwdGlvbihyZXMuZ2V0U3RyaW5nKGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3RyaW5nLm1vcmVfaXRlbV9sYWJlbCkpOworICAgICAgICAgICAgc2V0SW1hZ2VEcmF3YWJsZShyZXMuZ2V0RHJhd2FibGUoY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5kcmF3YWJsZS5pY19tZW51X21vcmUpKTsKKyAgICAgICAgICAgIHNldFZpc2liaWxpdHkoVklTSUJMRSk7CisgICAgICAgICAgICBzZXRFbmFibGVkKHRydWUpOworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyBib29sZWFuIHBlcmZvcm1DbGljaygpIHsKKyAgICAgICAgICAgIGlmIChzdXBlci5wZXJmb3JtQ2xpY2soKSkgewor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OwogICAgICAgICAKQEAgLTkzNCw5ICsxMDAzLDgzIEBACiAgICAgICAgIH0KICAgICAgICAgCiAgICAgICAgIG1Jc1Zpc2libGVJdGVtc1N0YWxlID0gZmFsc2U7CisgICAgICAgIG1Jc0FjdGlvbkl0ZW1zU3RhbGUgPSB0cnVlOwogICAgICAgICAKICAgICAgICAgcmV0dXJuIG1WaXNpYmxlSXRlbXM7CiAgICAgfQorICAgIAorICAgIHByaXZhdGUgdm9pZCBmbGFnQWN0aW9uSXRlbXMoYm9vbGVhbiByZXNlcnZlQWN0aW9uT3ZlcmZsb3cpIHsKKyAgICAgICAgaWYgKHJlc2VydmVBY3Rpb25PdmVyZmxvdyAhPSBtUmVzZXJ2ZUFjdGlvbk92ZXJmbG93KSB7CisgICAgICAgICAgICBtUmVzZXJ2ZUFjdGlvbk92ZXJmbG93ID0gcmVzZXJ2ZUFjdGlvbk92ZXJmbG93OworICAgICAgICAgICAgbUlzQWN0aW9uSXRlbXNTdGFsZSA9IHRydWU7CisgICAgICAgIH0KKworICAgICAgICBpZiAoIW1Jc0FjdGlvbkl0ZW1zU3RhbGUpIHsKKyAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfQorCisgICAgICAgIGZpbmFsIEFycmF5TGlzdDxNZW51SXRlbUltcGw+IHZpc2libGVJdGVtcyA9IGdldFZpc2libGVJdGVtcygpOworICAgICAgICBmaW5hbCBpbnQgaXRlbXNTaXplID0gdmlzaWJsZUl0ZW1zLnNpemUoKTsKKyAgICAgICAgaW50IG1heEFjdGlvbnMgPSBtTWF4QWN0aW9uSXRlbXM7CisKKyAgICAgICAgaW50IHJlcXVpcmVkSXRlbXMgPSAwOworICAgICAgICBpbnQgcmVxdWVzdGVkSXRlbXMgPSAwOworICAgICAgICBib29sZWFuIGhhc092ZXJmbG93ID0gZmFsc2U7CisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgaXRlbXNTaXplOyBpKyspIHsKKyAgICAgICAgICAgIE1lbnVJdGVtSW1wbCBpdGVtID0gdmlzaWJsZUl0ZW1zLmdldChpKTsKKyAgICAgICAgICAgIGlmIChpdGVtLnJlcXVpcmVzQWN0aW9uQnV0dG9uKCkpIHsKKyAgICAgICAgICAgICAgICByZXF1aXJlZEl0ZW1zKys7CisgICAgICAgICAgICB9IGVsc2UgaWYgKGl0ZW0ucmVxdWVzdHNBY3Rpb25CdXR0b24oKSkgeworICAgICAgICAgICAgICAgIHJlcXVlc3RlZEl0ZW1zKys7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIGhhc092ZXJmbG93ID0gdHJ1ZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIC8vIFJlc2VydmUgYSBzcG90IGZvciB0aGUgb3ZlcmZsb3cgaXRlbSBpZiBuZWVkZWQuCisgICAgICAgIGlmIChyZXNlcnZlQWN0aW9uT3ZlcmZsb3cgJiYKKyAgICAgICAgICAgICAgICAoaGFzT3ZlcmZsb3cgfHwgcmVxdWlyZWRJdGVtcyArIHJlcXVlc3RlZEl0ZW1zID4gbWF4QWN0aW9ucykpIHsKKyAgICAgICAgICAgIG1heEFjdGlvbnMtLTsKKyAgICAgICAgfQorICAgICAgICBtYXhBY3Rpb25zIC09IHJlcXVpcmVkSXRlbXM7CisKKyAgICAgICAgLy8gRmxhZyBhcyBtYW55IG1vcmUgcmVxdWVzdGVkIGl0ZW1zIGFzIHdpbGwgZml0LgorICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGl0ZW1zU2l6ZTsgaSsrKSB7CisgICAgICAgICAgICBNZW51SXRlbUltcGwgaXRlbSA9IHZpc2libGVJdGVtcy5nZXQoaSk7CisgICAgICAgICAgICBpZiAoaXRlbS5yZXF1ZXN0c0FjdGlvbkJ1dHRvbigpKSB7CisgICAgICAgICAgICAgICAgaXRlbS5zZXRJc0FjdGlvbkJ1dHRvbihtYXhBY3Rpb25zID4gMCk7CisgICAgICAgICAgICAgICAgbWF4QWN0aW9ucy0tOworICAgIC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c2l0aW9uKSkuZ2V0SXRlbVZpZXcobU1lbnVUeXBlLCBwYXJlbnQpOworICAgICAgICAgICAgaWYgKGNvbnZlcnRWaWV3ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBNZW51Vmlldy5JdGVtVmlldyBpdGVtVmlldyA9IChNZW51Vmlldy5JdGVtVmlldykgY29udmVydFZpZXc7CisgICAgICAgICAgICAgICAgaXRlbVZpZXcuZ2V0SXRlbURhdGEoKS5zZXRJdGVtVmlldyhtTWVudVR5cGUsIG51bGwpOworCisgICAgICAgICAgICAgICAgTWVudUl0ZW1JbXBsIGl0ZW0gPSAoTWVudUl0ZW1JbXBsKSBnZXRJdGVtKHBvc2l0aW9uKTsKKyAgICAgICAgICAgICAgICBpdGVtVmlldy5pbml0aWFsaXplKGl0ZW0sIG1NZW51VHlwZSk7CisgICAgICAgICAgICAgICAgaXRlbS5zZXRJdGVtVmlldyhtTWVudVR5cGUsIGl0ZW1WaWV3KTsKKyAgICAgICAgICAgICAgICByZXR1cm4gY29udmVydFZpZXc7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIE1lbnVJdGVtSW1wbCBpdGVtID0gKE1lbnVJdGVtSW1wbCkgZ2V0SXRlbShwb3NpdGlvbik7CisgICAgICAgICAgICAgICAgaXRlbS5zZXRJdGVtVmlldyhtTWVudVR5cGUsIG51bGwpOworICAgICAgICAgICAgICAgIHJldHVybiBpdGVtLmdldEl0ZW1WaWV3KG1NZW51VHlwZSwgcGFyZW50KTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIEFuIGFkYXB0ZXIgdGhhdCBhbGxvd3MgYW4ge0BsaW5rIEFkYXB0ZXJWaWV3fSB0byB1c2UgdGhpcyB7QGxpbmsgTWVudUJ1aWxkZXJ9IGFzIGEgZGF0YQorICAgICAqIHNvdXJjZSBmb3Igb3ZlcmZsb3cgbWVudSBpdGVtcyB0aGF0IGRvIG5vdCBmaX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HlwZSA9PSBNZW51QnVpbGRlci5UWVBFX0lDT04gfHwKKyAgICAgICAgICAgICAgICBtZW51VHlwZSA9PSBNZW51QnVpbGRlci5UWVBFX0FDVElPTl9CVVRUT04gfHwKKyAgICAgICAgICAgICAgICBtZW51VHlwZSA9PSBNZW51QnVpbGRlci5UWVBFX1BPUFVQIHx8CisgICAgICAgICAgICAgICAgbU1lbnUuZ2V0T3B0aW9uYWxJY29uc1Zpc2libGUoKTsKKyAgICB9CisgICAgCisgICAgcHVibGljIGJvb2xlYW4gaXNBY3Rpb25CdXR0b24oKSB7CisgICAgICAgIHJldHVybiAobUZsYWdzICYgSVNfQUNUSU9OKSA9PSBJU19BQ1RJT04gfHwgcmVxdWlyZXNBY3Rpb25CdXR0b24oKTsKKyAgICB9CisgICAgCisgICAgcHVibGljIGJvb2xlYW4gcmVxdWVzdHNBY3Rpb25CdXR0b24oKSB7CisgICAgICAgIHJldHVybiBtU2hvd0FzQWN0aW9uID09IFNIT1dfQVNfQUNUSU9OX0lGX1JPT007CisgICAgfQorICAgIAorICAgIHB1YmxpYyBib29sZWFuIHJlcXVpcmVzQWN0aW9uQnV0dG9uKCkgeworICAgICAgICByZXR1cm4gbVNob3dBc0FjdGlvbiA9PSBTSE9XX0FTX0FDVElPTl9BTFdBWVM7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgc2V0SXNBY3Rpb25CdXR0b24oYm9vbGVhbiBpc0FjdGlvbkJ1dHRvbikgeworICAgICAgICBpZiAoaXNBY3Rpb25CdXR0b24pIHsKKyAgICAgICAgICAgIG1GbGFncyB8PSBJU19BQ1RJT047CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBtRmxhZ3MgJj0gfklTX0FDVElPTjsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHNldFNob3dBc0FjdGlvbihpbnQgYWN0aW9uRW51bSkgeworICAgICAgICBtU2hvd0FzQWN0aW9uID0gYWN0aW9uRW51bTsKKyAgICAgICAg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VmlldyhpdGVtSW1wbC5nZXRJdGVtVmlldyhNZW51QnVpbGRlci5UWVBFX0FDVElPTl9CVVRUT04sIG51bGwpKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oIk1lbnVQb3B1cEhlbHBlciBjYW5ub3QgYmUgdXNlZCB3aXRob3V0IGFuIGFuY2hvciIpOworICAgICAgICB9CisKKyAgICAgICAgbVBvcHVwLnNldENvbnRlbnRXaWR0aChNYXRoLm1pbihtZWFzdXJlQ29udGVudFdpZHRoKGFkYXB0ZXIpLCBtUG9wdXBNYXhXaWR0aCkpOworICAgICAgICBtUG9wdXAuc2hvdygpOworICAgICAgICBtUG9wdXAuZ2V0TGlzdFZpZXcoKS5zZXRPbktleUxpc3RlbmVyKHRoaXMpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIGRpc21pc3MoKSB7CisgICAgICAgIGlmIChpc1Nob3dpbmcoKSkgeworICAgICAgICAgICAgbVBvcHVwLmRpc21pc3MoKTsKKyAgICAgICAgfQorICAgICAgICBtUG9wdXAgPSBudWxsOworICAgIH0KKworICAgIHB1YmxpYyBib29sZWFuIGlzU2hvd2luZygpIHsKKyAgICAgICAgcmV0dXJuIG1Qb3B1cCAhPSBudWxsICYmIG1Qb3B1cC5pc1Nob3dpbmcoKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBvbkl0ZW1DbGljayhBZGFwdGVyVmlldzw/PiBwYXJlbnQsIFZpZXcgdmlldywgaW50IHBvc2l0aW9uLCBsb25nIGlkKSB7CisgICAgICAgIE1lbnVJdGVtIGl0ZW0gPSBudWxsOworICAgICAgICBpZiAobU92ZXJmbG93T25seSkgeworICAgICAgICAgICAgaXRlbSA9IG1NZW51LmdldE92ZXJmbG93SXRlbShwb3NpdGlvbik7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBpdGVtID0gbU1lbnUuZ2V0SXRlbShwb3NpdGlvbik7CisgICAgICAgIH0KKyAgICAgICAgbU1lbnUucGVyZm9ybUl0ZW1BY3Rpb24oaXRlbSwgMCk7CisgICAgICAgIG1Qb3B1cC5kaXNtaXNzKCk7CisgICAgfQorCisgICAgcHVibGljIGJvb2xlYW4gb25LZXkoVmlldyB2LCBpbnQga2V5Q29kZSwgS2V5RXZlbnQgZXZlbnQpIHsKKyAgICAgICAgaWYgKGV2ZW50LmdldEFjdGlvbigpID09IEtleUV2ZW50LkFDVElPTl9VUCAmJiBrZXlDb2RlID09IEtleUV2ZW50LktFWUNPREVfTUVOVSkgeworICAgICAgICAgICAgZGlzbWlzcygpOworICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIHByaXZhdGUgaW50IG1lYXN1cmVDb250ZW50V2lkdGgoTWVudUFkYXB0ZXIgYWRhcHRlcikgeworICAgICAgICAvLyBNZW51cyBkb24ndCB0ZW5kIHRvIGJlIGxvbmcsIHNvIHRoaXMgaXMgbW9yZSBzYW5lIHRoYW4gaXQgbG9va3MuCisgICAgICAgIGludCB3aWR0aCA9IDA7CisgICAgICAgIFZpZXcgaXRlbVZpZXcgPSBudWxsOworICAgICAgICBmaW5hbCBpbnQgd2lkdGhNZWFzdXJlU3BlYyA9CisgICAgICAgICAgICBNZWFzdXJlU3BlYy5tYWtlTWVhc3VyZVNwZWMoMCwgTWVhc3VyZVNwZWMuVU5TUEVDSUZJRUQpOworICAgICAgICBmaW5hbCBpbnQgaGVpZ2h0TWVhc3VyZVNwZWMgPQorICAgICAgICAgICAgTWVhc3VyZVNwZWMubWFrZU1lYXN1cmVTcGVjKDAsIE1lYXN1cmVTcGVjLlVOU1BFQ0lGSUVEKTsKKyAgICAgICAgZmluYWwgaW50IGNvdW50ID0gYWRhcHRlci5nZXRDb3VudCgpOworICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGNvdW50OyBpKyspIHsKKyAgICAgICA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FuZHJvaWQudmlldy5WaWV3Lk1lYXN1cmVTcGVjOworaW1wb3J0IGFuZHJvaWQud2lkZ2V0LkltYWdlQnV0dG9uOworaW1wb3J0IGFuZHJvaWQud2lkZ2V0LkxpbmVhckxheW91dDsKK2ltcG9ydCBhbmRyb2lkLndpZGdldC5UZXh0VmlldzsKKworLyoqCisgKiBAaGlkZQorICovCitwdWJsaWMgY2xhc3MgQWN0aW9uQmFyQ29udGV4dFZpZXcgZXh0ZW5kcyBWaWV3R3JvdXAgeworICAgIHByaXZhdGUgaW50IG1JdGVtUGFkZGluZzsKKyAgICBwcml2YXRlIGludCBtSXRlbU1hcmdpbjsKKyAgICBwcml2YXRlIGludCBtQWN0aW9uU3BhY2luZzsKKyAgICBwcml2YXRlIGludCBtQ29udGVudEhlaWdodDsKKyAgICAKKyAgICBwcml2YXRlIENoYXJTZXF1ZW5jZSBtVGl0bGU7CisgICAgcHJpdmF0ZSBDaGFyU2VxdWVuY2UgbVN1YnRpdGxlOworICAgIAorICAgIHByaXZhdGUgSW1hZ2VCdXR0b24gbUNsb3NlQnV0dG9uOworICAgIHByaXZhdGUgVmlldyBtQ3VzdG9tVmlldzsKKyAgICBwcml2YXRlIExpbmVhckxheW91dCBtVGl0bGVMYXlvdXQ7CisgICAgcHJpdmF0ZSBUZXh0VmlldyBtVGl0bGVWaWV3OworICAgIHByaXZhdGUgVGV4dFZpZXcgbVN1YnRpdGxlVmlldzsKKyAgICBwcml2YXRlIERyYXdhYmxlIG1DbG9zZURyYXdhYmxlOworICAgIHByaXZhdGUgQWN0aW9uTWVudVZpZXcgbU1lbnVWaWV3OworICAgIAorICAgIHB1YmxpYyBBY3Rpb25CYXJDb250ZXh0VmlldyhDb250ZXh0IGNvbnRleHQpIHsKKyAgICAgICAgdGhpcyhjb250ZXh0LCBudWxsLCAwKTsKKyAgICB9CisgICAgCisgICAgcHVibGljIEFjdGlvbkJhckNvbnRleHRWaWV3KENvbnRleHQgY29udGV4dCwgQXR0cmlidXRlU2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fd2luZG93QWN0aW9uQmFyU2l6ZSwgMCk7CisgICAgICAgIGEucmVjeWNsZSgpOworICAgIH0KKyAgICAKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgQWN0aW9uTW9kZSBzdGFydEFjdGlvbk1vZGVGb3JDaGlsZChWaWV3IGNoaWxkLCBBY3Rpb25Nb2RlLkNhbGxiYWNrIGNhbGxiYWNrKSB7CisgICAgICAgIC8vIE5vIHN0YXJ0aW5nIGFuIGFjdGlvbiBtb2RlIGZvciBhbiBleGlzdGluZyBhY3Rpb24gbW9kZSBVSSBjaGlsZCEgKFdoZXJlIHdvdWxkIGl0IGdvPykKKyAgICAgICAgcmV0dXJuIG51bGw7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgc2V0SGVpZ2h0KGludCBoZWlnaHQpIHsKKyAgICAgICAgbUNvbnRlbnRIZWlnaHQgPSBoZWlnaHQ7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgc2V0Q3VzdG9tVmlldyhWaWV3IHZpZXcpIHsKKyAgICAgICAgaWYgKG1DdXN0b21WaWV3ICE9IG51bGwpIHsKKyAgICAgICAgICAgIHJlbW92ZVZpZXcobUN1c3RvbVZpZXcpOworICAgICAgICB9CisgICAgICAgIG1DdXN0b21WaWV3ID0gdmlldzsKKyAgICAgICAgaWYgKG1UaXRsZUxheW91dCAhPSBudWxsKSB7CisgICAgICAgICAgICByZW1vdmVWaWV3KG1UaXRsZUxheW91dCk7CisgICAgICAgICAgICBtVGl0bGVMYXlvdXQgPSBudWxsOworICAgICAgICB9CisgICAgICAgIGlmICh2aWV3ICE9IG51bGwpIHsKKyAgICAgICAgICAgIGFkZFZpZXcodmlldyk7CisgICAgICAgIH0KKyAgICAgICAgcmVxdWVzdExheW91dCgpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHNldFRpdGxlKENoYXJTZXF1ZW5jZSB0aXRsZSkgeworICAgICAgICBtVGl0bGUgPSB0aXRsZTsKKyAgICAgICAgaW5pdFRpdGxlKCk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgc2V0U3VidGl0bGUoQ2hhclNlcXVlbmNlIHN1YnRpdGxlKSB7CisgICAgICAgIG1TdWJ0aXRsZSA9IHN1YnRpdGxlOworICAgICAgICBpbml0VGl0bGUoKTsKKyAgICB9CisKKyAgICBwdWJsaWMgQ2hhclNlcXVlbmNlIGdldFRpdGxlKCkgeworICAgICAgICByZXR1cm4gbVRpdGxlOworICAgIH0KKworICAgIHB1YmxpYyBDaGFyU2VxdWVuY2UgZ2V0U3VidGl0bGUoKSB7CisgICAgICAgIHJldHVybiBtU3VidGl0bGU7CisgICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIGluaXRUaXRsZSgpIHsKKyAgICAgICAgaWYgKG1UaXRsZUxheW91dCA9PSBudWxsKSB7CisgICAgICAgICAgICBMYXlvdXRJbmZsYXRlciBpbmZsYXRlciA9IExheW91dEluZmxhdGVyLmZyb20oZ2V0Q29udGV4dCgpKTsKKyAgICAgICAgICAgIG1UaXRsZUxheW91dCA9IChMaW5lYXJMYXlvdXQpIGluZmxhdGVyLmluZmxhdGUoUi5sYXlvdXQuYWN0aW9uX2Jhcl90aXRsZV9pdGVtLCBudWxsKTsKKyAgICAgICAgICAgIG1UaXRsZVZpZXcgPSAoVGV4dFZpZXcpIG1UaXRsZUxheW91dC5maW5kVmlld0J5SWQoUi5pZC5hY3Rpb25fYmFyX3RpdGxlKTsKKyAgICAgICAgICAgIG1TdWJ0aXRsZVZpZXcgPSAoVGV4dFZpZXcpIG1UaXRsZUxheW91dC5maW5kVmlld0J5SWQoUi5pZC5hY3Rpb25fYmFyX3N1YnRpdGxlKTsKKyAgICAgICAgICAgIGlmIChtVGl0bGUgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIG1UaXRsZVZpZXcuc2V0VGV4dChtVGl0bGUpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKG1TdWJ0aXRsZSAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgbVN1YnRpdGxlVmlldy5zZXRUZXh0KG1TdWJ0aXRsZSk7CisgICAgICAgICAgICAgICAgbVN1YnRpdGxlVmlldy5zZXRWaXNpYmlsaXR5KFZJU0lCTEUpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgYWRkVmlldyhtVGl0bGVMYXlvdXQpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgbVRpdGxlVmlldy5zZXRUZXh0KG1UaXRsZSk7CisgICAgICAgICAgICBtU3VidGl0bGVWaWV3LnNldFRleHQobVN1YnRpdGxlKTsKKyAgICAgICAgICAgIG1TdWJ0aXRsZVZpZXcuc2V0VmlzaWJpbGl0eShtU3VidGl0bGUgIT0gbnVsbCA/IFZJU0lCTEUgOiBHT05FKTsKKyAgICAgICAgICAgIGlmIChtVGl0bGVMYXlvdXQuZ2V0UGFyZW50KCkgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgIGFkZFZpZXcobVRpdGxlTGF5b3V0KTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyB2b2lkIGluaXRGb3JNb2RlKGZpbmFsIEFjdGlvbk1vZGUgbW9kZSkgeworICAgICAgICBpZiAobUNsb3NlQnV0dG9uID09IG51bGwpIHsKKyAgICAgICAgICAgIG1DbG9zZUJ1dHRvbiA9IG5ldyBJbWFnZUJ1dHRvbihnZXRDb250ZXh0KCkpOworICAgICAgICAgICAgbUNsb3NlQnV0dG9uLnNldEltYWdlRHJhd2FibGUobUNsb3NlRHJhd2FibGUpOworICAgICAgICAgICAgbUNsb3NlQnV0dG9uLnNldEJhY2tncm91bmREcmF3YWJsZShudWxsKTsKKyAgICAgICAgfQorICAgICAgICBtQ2xvc2VCdXR0b24uc2V0T25DbGlja0xpc3RlbmVyKG5ldyBPbkNsaWNrTGlzdGVuZXIoKSB7CisgICAgICAgICAgICBwdWJsaWMgdm9pZCBvbkNsaWNrKFZpZXcgdikgeworICAgICAgICAgICAgICAgIG1vZGUuZmluaXNoKCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0pOworICAgICAgICBhZGRWaWV3KG1DbG9zZUJ1dHRvbik7CisKKyAgICAgICAgZmluYWwgTWVudUJ1aWxkZXIgbWVudSA9IChNZW51QnVpbGRlcikgbW9kZS5nZXRNZW51KCk7CisgICAgICAgIG1NZW51VmlldyA9IChBY3Rpb25NZW51VmlldykgbWVudS5nZXRNZW51VmlldyhNZW51QnVpbGRlci5UWVBFX0FDVElPTl9CVVRUT04sIHRoaXMpOworICAgICAgICBtTWVudVZpZXcuc2V0T3ZlcmZsb3dSZXNlcnZlZCh0cnVlKTsKKyAgICAgICAgbU1lbnVWaWV3LnVwZGF0ZUNoaWxkcmVuKGZhbHNlKTsKKyAgICAgICAgYWRkVmlldyhtTWVudVZpZXcpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIGNsb3NlTW9kZSgpIHsKKyAgICAgICAgcmVtb3ZlQWxsVmlld3MoKTsKKyAgICAgICAgbUN1c3RvbVZpZXcgPSBudWxsOworICAgICAgICBtTWVudVZpZXcgPSBudWxsOworICAgIH0KKworICAgIHB1YmxpYyBib29sZWFuIHNob3dPdmVyZmxvd01lbnUoKSB7CisgICAgICAgIGlmIChtTWVudVZpZXcgIT0gbnVsbCkgeworICAgICAgICAgICAgcmV0dXJuIG1NZW51Vmlldy5zaG93T3ZlcmZsb3dNZW51KCk7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIHB1YmxpYyBib29sZWFuIGhpZGVPdmVyZmxvd01lbnUoKSB7CisgICAgICAgIGlmIChtTWVudVZpZXcgIT0gbnVsbCkgeworICAgICAgICAgICAgcmV0dXJuIG1NZW51Vmlldy5oaWRlT3ZlcmZsb3dNZW51KCk7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIHB1YmxpYyBib29sZWFuIGlzT3ZlcmZsb3dNZW51U2hvd2luZygpIHsKKyAgICAgICAga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AgICAgICAgfQorCisgICAgICAgIGlmIChtQ3VzdG9tVmlldyAhPSBudWxsKSB7CisgICAgICAgICAgICBMYXlvdXRQYXJhbXMgbHAgPSBtQ3VzdG9tVmlldy5nZXRMYXlvdXRQYXJhbXMoKTsKKyAgICAgICAgICAgIGZpbmFsIGludCBjdXN0b21XaWR0aE1vZGUgPSBscC53aWR0aCAhPSBMYXlvdXRQYXJhbXMuV1JBUF9DT05URU5UID8KKyAgICAgICAgICAgICAgICAgICAgTWVhc3VyZVNwZWMuRVhBQ1RMWSA6IE1lYXN1cmVTcGVjLkFUX01PU1Q7CisgICAgICAgICAgICBmaW5hbCBpbnQgY3VzdG9tV2lkdGggPSBscC53aWR0aCA+PSAwID8KKyAgICAgICAgICAgICAgICAgICAgTWF0aC5taW4obHAud2lkdGgsIGF2YWlsYWJsZVdpZHRoKSA6IGF2YWlsYWJsZVdpZHRoOworICAgICAgICAgICAgZmluYWwgaW50IGN1c3RvbUhlaWdodE1vZGUgPSBscC5oZWlnaHQgIT0gTGF5b3V0UGFyYW1zLldSQVBfQ09OVEVOVCA/CisgICAgICAgICAgICAgICAgICAgIE1lYXN1cmVTcGVjLkVYQUNUTFkgOiBNZWFzdXJlU3BlYy5BVF9NT1NUOworICAgICAgICAgICAgZmluYWwgaW50IGN1c3RvbUhlaWdodCA9IGxwLmhlaWdodCA+PSAwID8KKyAgICAgICAgICAgICAgICAgICAgTWF0aC5taW4obHAuaGVpZ2h0LCBoZWlnaHQpIDogaGVpZ2h0OworICAgICAgICAgICAgbUN1c3RvbVZpZXcubWVhc3VyZShNZWFzdXJlU3BlYy5tYWtlTWVhc3VyZVNwZWMoY3VzdG9tV2lkdGgsIGN1c3RvbVdpZHRoTW9kZSksCisgICAgICAgICAgICAgICAgICAgIE1lYXN1cmVTcGVjLm1ha2VNZWFzdXJlU3BlYyhjdXN0b21IZWlnaHQsIGN1c3RvbUhlaWdodE1vZGUpKTsKKyAgICAgICAgfQorCisgICAgICAgIGlmIChtQ29udGVudEhlaWdodCA8PSAwKSB7CisgICAgICAgICAgICBpbnQgbWVhc3VyZWRIZWlnaHQgPSAwOworICAgICAgICAgICAgZmluYWwgaW50IGNvdW50ID0gZ2V0Q2hpbGRDb3VudCgpOworICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBjb3VudDsgaSsrKSB7CisgICAgICAgICAgICAgICAgVmlldyB2ID0gZ2V0Q2hpbGRBdChpKTsKKyAgICAgICAgICAgICAgICBpbnQgcGFkZGVkVmlld0hlaWdodCA9IHYuZ2V0TWVhc3VyZWRIZWlnaHQoKSArIHZlcnRpY2FsUGFkZGluZzsKKyAgICAgICAgICAgICAgICBpZiAocGFkZGVkVmlld0hlaWdodCA+IG1lYXN1cmVkSGVpZ2h0KSB7CisgICAgICAgICAgICAgICAgICAgIG1lYXN1cmVkSGVpZ2h0ID0gcGFkZGVkVmlld0hlaWdodDsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBzZXRNZWFzdXJlZERpbWVuc2lvbihjb250ZW50V2lkdGgsIG1lYXN1cmVkSGVpZ2h0KTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIHNldE1lYXN1cmVkRGltZW5zaW9uKGNvbnRlbnRXaWR0aCwgbWF4SGVpZ2h0KTsKKyAgICAgICAgfQorICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHByb3RlY3RlZCB2b2lkIG9uTGF5b3V0KGJvb2xlYW4gY2hhbmdlZCwgaW50IGwsIGludCB0LCBpbnQgciwgaW50IGIpIHsKKyAgICAgICAgaW50IHggPSBnZXRQYWRkaW5nTGVmdCgpOworICAgICAgICBmaW5hbCBpbnQgeSA9IGdldFBhZGRpbmdUb3AoKTsKKyAgICAgICAgZmluYWwgaW50IGNvbnRlbnRIZWlnaHQgPSBiIC0gdCAtIGdldFBhZGRpbmdUb3AoKSAtIGdldFBhZGRpbmdCb3R0b20oKTsKKyAgICAgICAgZmluYWwgaW50IGl0ZW1NYXJnaW4gPSBtSXRlbVBhZGRpbmc7CisgICAgICAgIAorICAgICAgICBpZiAobUNsb3NlQnV0dG9uICE9IG51bGwgJiYgbUNsb3NlQnV0dG9uLmdldFZpc2liaWxpdHkoKSAhPSBHT05FKSB7CisgICAgICAgICAgICB4ICs9IHBvc2l0aW9uQ2hpbGQobUNsb3NlQnV0dG9uLCB4LCB5LCBjb250ZW50SGVpZ2h0KTsKKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgaWYgKG1UaXRsZUxheW91dCAhPSBudWxsICYmIG1DdXN0b21WaWV3ID09IG51bGwpIHsKKyAgICAgICAgICAgIHggKz0gcG9zaXRpb25DaGlsZChtVGl0bGVMYXlvdXQsIHgsIHksIGNvbnRlbnRIZWlnaHQpICsgaXRlbU1hcmdpbjsKKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgaWYgKG1DdXN0b21WaWV3ICE9IG51bGwpIHsKKyAgICAgICAgICAgIHggKz0gcG9zaXRpb25DaGlsZChtQ3VzdG9tVmlldywgeCwgeSwgY29udGVudEhlaWdodCkgKyBpdGVtTWFyZ2luOworICAgICAgICB9CisgICAgICAgIAorICAgICAgICB4ID0gciAtIGwgLSBnZXRQYWRkaW5nUmlnaHQoKTsKKworICAgICAgICBpZiAobU1lbnVWaWV3ICE9IG51bGwpIHsKKyAgICAgICAgICAgIHggLT0gcG9zaXRpb25DaGlsZEludmVyc2UobU1lbnVWaWV3LCB4ICsgbUFjdGlvblNwYWNpbmcsIHksIGNvbnRlbnRIZWlnaHQpCisgICAgICAgICAgICAgICAgICAgIC0gbUFjdGlvblNwYWNpbmc7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcml2YXRlIGludCBtZWFzdXJlQ2hpbGRWaWV3KFZpZXcgY2hpbGQsIGludCBhdmFpbGFibGVXaWR0aCwgaW50IGNoaWxkU3BlY0hlaWdodCwgaW50IHNwYWNpbmcpIHsKKyAgICAgICAgY2hpbGQubWVhc3VyZShNZWFzdXJlU3BlYy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AobUNhbGxiYWNrICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBtQ2FsbGJhY2sub25OYXZpZ2F0aW9uSXRlbVNlbGVjdGVkKHBvc2l0aW9uLCBpZCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgcHVibGljIHZvaWQgb25Ob3RoaW5nU2VsZWN0ZWQoQWRhcHRlclZpZXcgcGFyZW50KSB7CisgICAgICAgICAgICAvLyBEbyBub3RoaW5nCisgICAgICAgIH0KKyAgICB9OworCisgICAgcHJpdmF0ZSBPbkNsaWNrTGlzdGVuZXIgbUhvbWVDbGlja0xpc3RlbmVyID0gbnVsbDsKKworICAgIHB1YmxpYyBBY3Rpb25CYXJWaWV3KENvbnRleHQgY29udGV4dCwgQXR0cmlidXRlU2V0IGF0dHJzKSB7CisgICAgICAgIHN1cGVyKGNvbnRleHQsIGF0dHJzKTsKKworICAgICAgICBmaW5hbCBEaXNwbGF5TWV0cmljcyBtZXRyaWNzID0gY29udGV4dC5nZXRSZXNvdXJjZXMoKS5nZXREaXNwbGF5TWV0cmljcygpOworCisgICAgICAgIFR5cGVkQXJyYXkgYSA9IGNvbnRleHQub2J0YWluU3R5bGVkQXR0cmlidXRlcyhhdHRycywgUi5zdHlsZWFibGUuQWN0aW9uQmFyKTsKKworICAgICAgICBmaW5hbCBpbnQgY29sb3JGaWx0ZXIgPSBhLmdldENvbG9yKFIuc3R5bGVhYmxlLkFjdGlvbkJhcl9jb2xvckZpbHRlciwgMCk7CisKKyAgICAgICAgaWYgKGNvbG9yRmlsdGVyICE9IDApIHsKKyAgICAgICAgICAgIGZpbmFsIERyYXdhYmxlIGQgPSBnZXRCYWNrZ3JvdW5kKCk7CisgICAgICAgICAgICBkLnNldERpdGhlcih0cnVlKTsKKyAgICAgICAgICAgIGQuc2V0Q29sb3JGaWx0ZXIobmV3IFBvcnRlckR1ZmZDb2xvckZpbHRlcihjb2xvckZpbHRlciwgUG9ydGVyRHVmZi5Nb2RlLk9WRVJMQ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N0aW9uQmFyX2JhY2tncm91bmQpOworICAgICAgICBpZiAoYmFja2dyb3VuZCAhPSBudWxsKSB7CisgICAgICAgICAgICBzZXRCYWNrZ3JvdW5kRHJhd2FibGUoYmFja2dyb3VuZCk7CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIG1UaXRsZVN0eWxlUmVzID0gYS5nZXRSZXNvdXJjZUlkKFIuc3R5bGVhYmxlLkFjdGlvbkJhcl90aXRsZVRleHRTdHlsZSwgMCk7CisgICAgICAgIG1TdWJ0aXRsZVN0eWxlUmVzID0gYS5nZXRSZXNvdXJjZUlkKFIuc3R5bGVhYmxlLkFjdGlvbkJhcl9zdWJ0aXRsZVRleHRTdHlsZSwgMCk7CisKKyAgICAgICAgZmluYWwgaW50IGN1c3RvbU5hdklkID0gYS5nZXRSZXNvdXJjZUlkKFIuc3R5bGVhYmxlLkFjdGlvbkJhcl9jdXN0b21OYXZpZ2F0aW9uTGF5b3V0LCAwKTsKKyAgICAgICAgaWYgKGN1c3RvbU5hdklkICE9IDApIHsKKyAgICAgICAgICAgIExheW91dEluZmxhdGVyIGluZmxhdGVyID0gTGF5b3V0SW5mbGF0ZXIuZnJvbShjb250ZXh0KTsKKyAgICAgICAgICAgIG1DdXN0b21OYXZWaWV3ID0gKFZpZXcpIGluZmxhdGVyLmluZmxhdGUoY3VzdG9tTmF2SWQsIG51bGwpOworICAgICAgICAgICAgbU5hdmlnYXRpb25Nb2RlID0gQWN0aW9uQmFyLk5BVklHQVRJT05fTU9ERV9DVVNUT007CisgICAgICAgIH0KKworICAgICAgICBtQ29udGVudEhlaWdodCA9IGEuZ2V0TGF5b3V0RGltZW5zaW9uKFIuc3R5bGVhYmxlLkFjdGlvbkJhcl9oZWlnaHQsIDApOworCisgICAgICAgIGEucmVjeWNsZSgpOworCisgICAgICAgIC8vIFRPRE86IFNldCB0aGlzIGluIHRoZSB0aGVtZQorICAgICAgICBtU3BhY2luZyA9IChpbnQpIChDT05URU5UX1NQQUNJTkdfRElQICogbWV0cmljcy5kZW5zaXR5ICsgMC41Zik7CisgICAgICAgIG1BY3Rpb25TcGFjaW5nID0gKGludCkgKENPTlRFTlRfQUNUSU9OX1NQQUNJTkdfRElQICogbWV0cmljcy5kZW5zaXR5ICsgMC41Zik7CisgICAgICAgIAorICAgICAgICBpZiAobUxvZ28gIT0gbnVsbCB8fCBtSWNvbiAhPSBudWxsIHx8IG1UaXRsZSAhPSBudWxsKSB7CisgICAgICAgICAgICBtTG9nb05hdkl0ZW0gPSBuZXcgQWN0aW9uTWVudUl0ZW0oY29udGV4dCwgMCwgYW5kcm9pZC5SLmlkLmhvbWUsIDAsIDAsIG1UaXRsZSk7CisgICAgICAgICAgICBtSG9tZUNsaWNrTGlzdGVuZXIgPSBuZXcgT25DbGlja0xpc3RlbmVyKCkgeworICAgICAgICAgICAgICAgIHB1YmxpYyB2b2lkIG9uQ2xpY2soVmlldyB2KSB7CisgICAgICAgICAgICAgICAgICAgIENvbnRleHQgY29udGV4dCA9IGdldENvbnRleHQoKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGNvbnRleHQgaW5zdGFuY2VvZiBBY3Rpdml0eSkgeworICAgICAgICAgICAgICAgICAgICAgICAgQWN0aXZpdHkgYWN0aXZpdHkgPSAoQWN0aXZpdHkpIGNvbnRleHQ7CisgICAgICAgICAgICAgICAgICAgICAgICBhY3Rpdml0eS5vbk9wdGlvbnNJdGVtU2VsZWN0ZWQobUxvZ29OYXZJdGVtKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH07CisgICAgICAgIH0KKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgQWN0aW9uTW9kZSBzdGFydEFjdGlvbk1vZGVGb3JDaGlsZChWaWV3IGNoaWxkLCBBY3Rpb25Nb2RlLkNhbGxiYWNrIGNhbGxiYWNrKSB7CisgICAgICAgIC8vIE5vIHN0YXJ0aW5nIGFuIGFjdGlvbiBtb2RlIGZvciBhbiBhY3Rpb24gYmFyIGNoaWxkISAoV2hlcmUgd291bGQgaXQgZ28/KQorICAgICAgICByZXR1cm4gbnVsbDsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBzZXRDYWxsYmFjayhOYXZpZ2F0aW9uQ2FsbGJhY2sgY2FsbGJhY2spIHsKKyAgICAgICAgbUNhbGxiYWNrID0gY2FsbGJhY2s7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgc2V0TWVudShNZW51IG1lbnUpIHsKKyAgICAgICAgTWVudUJ1aWxkZXIgYnVpbGRlciA9IChNZW51QnVpbGRlcikgbWVudTsKKyAgICAgICAgbU9wdGlvbnNNZW51ID0gYnVpbGRlcjsKKyAgICAgICAgaWYgKG1NZW51VmlldyAhPSBudWxsKSB7CisgICAgICAgICAgICByZW1vdmVWaWV3KG1NZW51Vmlldyk7CisgICAgICAgIH0KKyAgICAgICAgZmluYWwgQWN0aW9uTWVudVZpZXcgbWVudVZpZXcgPSAoQWN0aW9uTWVudVZpZXcpIGJ1aWxkZXIuZ2V0TWVudVZpZXcoCisgICAgICAgICAgICAgICAgTWVudUJ1aWxkZXIuVFlQRV9BQ1RJT05fQlVUVE9OLCBudWxsKTsKKyAgICAgICAgbUFjdGlvblNwYWNpbmcgPSBtZW51Vmlldy5nZXRJdGVtTWFyZ2luKCk7CisgICAgICAgIGZpbmFsIExheW91dFBhcmFtcyBsYXlvdXRQYXJhbXMgPSBuZXcgTGF5b3V0UGFyYW1zKExheW91dFBhcmFtcy5XUkFQX0NPTlRFTlQsCisgICAgICAgICAgICAgICAgTGF5b3V0UGFyYW1zLk1BVENIX1BBUkVOVCk7CisgICAgICAgIG1lbnVWaWV3LnNldExheW91dFBhcmFtcyhsYXlvdXRQYXJhbXMpOworICAgICAgICBhZGRWaWV3KG1lbnVWaWV3KTsKKyAgICAgICAgbU1lbnVWaWV3ID0gbWVudVZpZXc7CisgICAgfQorCisgICAgcHVibGljIGJvb2xlYW4gc2hvd092ZXJmbG93TWVudSgpIHsKKyAgICAgICAgaWYgKG1NZW51VmlldyAhPSBudWxsKSB7CisgICAgICAgICAgICByZXR1cm4gbU1lbnVWaWV3LnNob3dPdmVyZmxvd01lbnUoKTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgcHVibGljIGJvb2xlYW4gaGlkZU92ZXJmbG93TWVudSgpIHsKKyAgICAgICAgaWYgKG1NZW51VmlldyAhPSBudWxsKSB7CisgICAgICAgICAgICByZXR1cm4gbU1lbnVWaWV3LmhpZGVPdmVyZmxvd01lbnUoKTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgcHVibGljIGJvb2xlYW4gaXNPdmVyZmxvd01lbnVTaG93aW5nKCkgeworICAgICAgICBpZiAobU1lbnVWaWV3ICE9IG51bGwpIHsKKyAgICAgICAgICAgIHJldHVybiBtTWVudVZpZXcuaXNPdmVyZmxvd01lbnVTaG93aW5nKCk7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIHB1YmxpYyBib29sZWFuIGlzT3ZlcmZsb3dSZXNlcnZlZCgpIHsKKyAgICAgICAgcmV0dXJuIG1NZW51VmlldyAhPSBudWxsICYmIG1NZW51Vmlldy5pc092ZXJmbG93UmVzZXJ2ZWQoKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBzZXRDdXN0b21OYXZpZ2F0aW9uVmlldyhWaWV3IHZpZXcpIHsKKyAgICAgICAgbUN1c3RvbU5hdlZpZXcgPSB2aWV3OworICAgICAgICBpZiAodmlldyAhPSBudWxsKSB7CisgICAgICAgICAgICBzZXROYXZpZ2F0aW9uTW9kZShBY3Rpb25CYXIuTkFWSUdBVElPTl9NT0RFX0NVU1RPTSk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgQ2hhclNlcXVlbmNlIGdldFRpdGxlKCkgeworICAgICAgICByZXR1cm4g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E9IG51bGwpIHsKKyAgICAgICAgICAgIG1Mb2dvTmF2SXRlbS5zZXRUaXRsZSh0aXRsZSk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgQ2hhclNlcXVlbmNlIGdldFN1YnRpdGxlKCkgeworICAgICAgICByZXR1cm4gbVN1YnRpdGxlOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHNldFN1YnRpdGxlKENoYXJTZXF1ZW5jZSBzdWJ0aXRsZSkgeworICAgICAgICBtU3VidGl0bGUgPSBzdWJ0aXRsZTsKKyAgICAgICAgaWYgKG1TdWJ0aXRsZVZpZXcgIT0gbnVsbCkgeworICAgICAgICAgICAgbVN1YnRpdGxlVmlldy5zZXRUZXh0KHN1YnRpdGxlKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHNldERpc3BsYXlPcHRpb25zKGludCBvcHRpb25zKSB7CisgICAgICAgIGZpbmFsIGludCBmbGFnc0NoYW5nZWQgPSBvcHRpb25zIF4gbURpc3BsYXlPcHRpb25zOworICAgICAgICBtRGlzcGxheU9wdGlvbnMgPSBvcHRpb25zOworICAgICAgICBpZiAoKGZsYWdzQ2hhbmdlZCAmIERJU1BMQVlfUkVMQVlPVVRfTUFTSykgIT0gMCkgeworICAgICAgICAgICAgZmluYWwgaW50IHZpcyA9IChvcHRpb25zICYgQWN0aW9uQmFyLkRJU1BMQVlfSElERV9IT01FKSAhPSAwID8gR09ORSA6IFZJU0lCTEU7CisgICAgICAgICAgICBpZiAobUxvZ29WaWV3ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBtTG9nb1ZpZXcuc2V0VmlzaWJpbGl0eSh2aXMpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKG1JY29uVmlldyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgbUljb25WaWV3LnNldFZpc2liaWxpdHkodmlzKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIAorICAgICAgICAgICAgcmVxdWVzdExheW91dCgpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgaW52YWxpZGF0ZSgpOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHZvaWQgc2V0TmF2aWdhdGlvbk1vZGUoaW50IG1vZGUpIHsKKyAgICAgICAgZmluYWwgaW50IG9sZE1vZGUgPSBtTmF2aWdhdGlvbk1vZGU7CisgICAgICAgIGlmIChtb2RlICE9IG9sZE1vZGUpIHsKKyAgICAgICAgICAgIHN3aXRjaCAob2xkTW9kZSkgeworICAgICAgICAgICAgY2FzZSBBY3Rpb25CYXIuTkFWSUdBVElPTl9NT0RFX1NUQU5EQVJEOgorICAgICAgICAgICAgICAgIGlmIChtVGl0bGVMYXlvdXQgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICByZW1vdmVWaWV3KG1UaXRsZUxheW91dCk7CisgICAgICAgICAgICAgICAgICAgIG1UaXRsZUxheW91dCA9IG51bGw7CisgICAgICAgICAgICAgICAgICAgIG1UaXRsZVZpZXcgPSBudWxsOworICAgICAgICAgICAgICAgICAgICBtU3VidGl0bGVWaWV3ID0gbnVsbDsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIEFjdGlvbkJhci5OQVZJR0FUSU9OX01PREVfRFJPUERPV05fTElTVDoKKyAgICAgICAgICAgICAgICBpZiAobVNwaW5uZXIgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICByZW1vdmVWaWV3KG1TcGlubmVyKTsKKyAgICAgICAgICAgICAgICAgICAgbVNwaW5uZXIgPSBudWxsOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgQWN0aW9uQmFyLk5BVklHQVRJT05fTU9ERV9DVVNUT006CisgICAgICAgICAgICAgICAgaWYgKG1DdXN0b21OYXZWaWV3ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgcmVtb3ZlVmlldyhtQ3VzdG9tTmF2Vmlldyk7CisgICAgICAgICAgICAgICAgICAgIG1DdXN0b21OYXZWaWV3ID0gbnVsbDsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIEFjdGlvbkJhci5OQVZJR0FUSU9OX01PREVfVEFCUzoKKyAgICAgICAgICAgICAgICBpZiAobVRhYkxheW91dCAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIHJlbW92ZVZpZXcobVRhYkxheW91dCk7CisgICAgICAgICAgICAgICAgICAgIG1UYWJMYXlvdXQgPSBudWxsOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIAorICAgICAgICAgICAgc3dpdGNoIChtb2RlKSB7CisgICAgICAgICAgICBjYXNlIEFjdGlvbkJhci5OQVZJR0FUSU9OX01PREVfU1RBTkRBUkQ6CisgICAgICAgICAgICAgICAgaW5pdFRpdGxlKCk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIEFjdGlvbkJhci5OQVZJR0FUSU9OX01PREVfRFJPUERPV05fTElTVDoKKyAgICAgICAgICAgICAgICBtU3Bpbm5lciA9IG5ldyBTcGlubmVyKG1Db250ZXh0LCBudWxsLAorICAgICAgICAgICAgICAgICAgICAgICAgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5hdHRyLmRyb3BEb3duU3Bpbm5lclN0eWxlKTsKKyAgICAgICAgICAgICAgICBtU3Bpbm5lci5zZXRPbkl0ZW1TZWxlY3RlZExpc3RlbmVyKG1OYXZJdGVtU2VsZWN0ZWRMaXN0ZW5lcik7CisgICAgICAgICAgICAgICAgYWRkVmlldyhtU3Bpbm5lcik7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIEFjdGlvbkJhci5OQVZJR0FUSU9OX01PREVfQ1VTVE9NOgorICAgICAgICAgICAgICAgIGFkZFZpZXcobUN1c3RvbU5hdlZpZXcpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBBY3Rpb25CYXIuTkFWSUdBVElPTl9NT0RFX1RBQlM6CisgICAgICAgICAgICAgICAgbVRhYkxheW91dCA9IG5ldyBMaW5lYXJMYXlvdXQoZ2V0Q29udGV4dCgpKTsKKyAgICAgICAgICAgICAgICBhZGRWaWV3KG1UYWJMYXlvdXQpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgbU5hdmlnYXRpb25Nb2RlID0gbW9kZTsKKyAgICAgICAgICAgIHJlcXVlc3RMYXlvdXQoKTsKKyAgICAgICAgfQorICAgIH0KKyAgICAKKyAgICBwdWJsaWMgdm9pZCBzZXREcm9wZG93bkFkYXB0ZXIoU3Bpbm5lckFkYXB0ZXIgYWRhcHRlcikgeworICAgICAgICBtU3Bpbm5lci5zZXRBZGFwdGVyKGFkYXB0ZXIpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHNldERyb3Bkb3duU2VsZWN0ZWRQb3NpdGlvbihpbnQgcG9zaXRpb24pIHsKKyAgICAgICAgbVNwaW5uZXIuc2V0U2VsZWN0aW9uKHBvc2l0aW9uKTsKKyAgICB9CisKKyAgICBwdWJsaWMgaW50IGdldERyb3Bkb3duU2VsZWN0ZWRQb3NpdGlvbigpIHsKKyAgICAgICAgcmV0dXJuIG1TcGlubmVyLmdldFNlbGVjdGVkSXRlbVBvc2l0aW9uKCk7CisgICAgfQorCisgICAgcHVibGljIFZpZXcgZ2V0Q3VzdG9tTmF2aWdhdGlvblZpZXcoKSB7CisgICAgICAgIHJldHVybiBtQ3VzdG9tTmF2VmlldzsKKyAgICB9CisgICAgCisgICAgcHVibGljIGludCBnZXROYXZpZ2F0aW9uTW9kZSgpIHsKKyAgICAgICAgcmV0dXJuIG1OYXZpZ2F0aW9uTW9kZTsKKyAgICB9CisgICAgCisgICAgcHVibGljIGludCBnZXREaXNwbGF5T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VzdFZpZXdCb3VuZHModHJ1ZSk7CisgICAgICAgICAgICAgICAgbUxvZ29WaWV3LnNldExheW91dFBhcmFtcyhuZXcgTGF5b3V0UGFyYW1zKExheW91dFBhcmFtcy5XUkFQX0NPTlRFTlQsCisgICAgICAgICAgICAgICAgICAgICAgICBMYXlvdXRQYXJhbXMuTUFUQ0hfUEFSRU5UKSk7CisgICAgICAgICAgICAgICAgbUxvZ29WaWV3LnNldEltYWdlRHJhd2FibGUobUxvZ28pOworICAgICAgICAgICAgICAgIG1Mb2dvVmlldy5zZXRDbGlja2FibGUodHJ1ZSk7CisgICAgICAgICAgICAgICAgbUxvZ29WaWV3LnNldEZvY3VzYWJsZSh0cnVlKTsKKyAgICAgICAgICAgICAgICBtTG9nb1ZpZXcuc2V0T25DbGlja0xpc3RlbmVyKG1Ib21lQ2xpY2tMaXN0ZW5lcik7CisgICAgICAgICAgICAgICAgYWRkVmlldyhtTG9nb1ZpZXcpOworICAgICAgICAgICAgfSBlbHNlIGlmIChtSWNvbiAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgbUljb25WaWV3ID0gbmV3IEltYWdlVmlldyhnZXRDb250ZXh0KCkpOworICAgICAgICAgICAgICAgIG1JY29uVmlldy5zZXRBZGp1c3RWaWV3Qm91bmRzKHRydWUpOworICAgICAgICAgICAgICAgIG1JY29uVmlldy5zZXRMYXlvdXRQYXJhbXMobmV3IExheW91dFBhcmFtcyhMYXlvdXRQYXJhbXMuV1JBUF9DT05URU5ULAorICAgICAgICAgICAgICAgICAgICAgICAgTGF5b3V0UGFyYW1zLk1BVENIX1BBUkVOVCkpOworICAgICAgICAgICAgICAgIG1JY29uVmlldy5zZXRJbWFnZURyYXdhYmxlKG1JY29uKTsKKyAgICAgICAgICAgICAgICBtSWNvblZpZXcuc2V0Q2xpY2thYmxlKHRydWUpOworICAgICAgICAgICAgICAgIG1JY29uVmlldy5zZXRGb2N1c2FibGUodHJ1ZSk7CisgICAgICAgICAgICAgICAgbUljb25WaWV3LnNldE9uQ2xpY2tMaXN0ZW5lcihtSG9tZUNsaWNrTGlzdGVuZXIpOworICAgICAgICAgICAgICAgIGFkZFZpZXcobUljb25WaWV3KTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHN3aXRjaCAobU5hdmlnYXRpb25Nb2RlKSB7CisgICAgICAgIGNhc2UgQWN0aW9uQmFyLk5BVklHQVRJT05fTU9ERV9TVEFOREFSRDoKKyAgICAgICAgICAgIGlmIChtTG9nb1ZpZXcgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgIGluaXRUaXRsZSgpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAKKyAgICAgICAgY2FzZSBBY3Rpb25CYXIuTkFWSUdBVElPTl9NT0RFX0RST1BET1dOX0xJU1Q6CisgICAgICAgICAgICB0aHJvdyBuZXcgVW5zdXBwb3J0ZWRPcGVyYXRpb25FeGNlcHRpb24oCisgICAgICAgICAgICAgICAgICAgICJJbmZsYXRpbmcgZHJvcGRvd24gbGlzdCBuYXZpZ2F0aW9uIGlzbid0IHN1cHBvcnRlZCB5ZXQhIik7CisgICAgICAgICAgICAKKyAgICAgICAgY2FzZSBBY3Rpb25CYXIuTkFWSUdBVElPTl9NT0RFX1RBQlM6CisgICAgICAgICAgICB0aHJvdyBuZXcgVW5zdXBwb3J0ZWRPcGVyYXRpb25FeGNlcHRpb24oCisgICAgICAgICAgICAgICAgICAgICJJbmZsYXRpbmcgdGFiIG5hdmlnYXRpb24gaXNuJ3Qgc3VwcG9ydGVkIHlldCEiKTsKKyAgICAgICAgICAgIAorICAgICAgICBjYXNlIEFjdGlvbkJhci5OQVZJR0FUSU9OX01PREVfQ1VTVE9NOgorICAgICAgICAgICAgaWYgKG1DdXN0b21OYXZWaWV3ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBhZGRWaWV3KG1DdXN0b21OYXZWaWV3KTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgfQorICAgIAorICAgIHByaXZhdGUgdm9pZCBpbml0VGl0bGUoKSB7CisgICAgICAgIExheW91dEluZmxhdGVyIGluZmxhdGVyID0gTGF5b3V0SW5mbGF0ZXIuZnJvbShnZXRDb250ZXh0KCkpOworICAgICAgICBtVGl0bGVMYXlvdXQgPSAoTGluZWFyTGF5b3V0KSBpbmZsYXRlci5pbmZsYXRlKFIubGF5b3V0LmFjdGlvbl9iYXJfdGl0bGVfaXRlbSwgbnVsbCk7CisgICAgICAgIG1UaXRsZVZpZXcgPSAoVGV4dFZpZXcpIG1UaXRsZUxheW91dC5maW5kVmlld0J5SWQoUi5pZC5hY3Rpb25fYmFyX3RpdGxlKTsKKyAgICAgICAgbVN1YnRpdGxlVmlldyA9IChUZXh0VmlldykgbVRpdGxlTGF5b3V0LmZpbmRWaWV3QnlJZChSLmlkLmFjdGlvbl9iYXJfc3VidGl0bGUpOworCisgICAgICAgIGlmIChtVGl0bGVTdHlsZVJlcyAhPSAwKSB7CisgICAgICAgICAgICBtVGl0bGVWaWV3LnNldFRleHRBcHBlYXJhbmNlKG1Db250ZXh0LCBtVGl0bGVTdHlsZVJlcyk7CisgICAgICAgIH0KKyAgICAgICAgaWYgKG1UaXRsZSAhPSBudWxsKSB7CisgICAgICAgICAgICBtVGl0bGVWaWV3LnNldFRleHQobVRpdGxlKTsKKyAgICAgICAgfQorCisgICAgICAgIGlmIChtU3VidGl0bGVTdHlsZVJlcyAhPSAwKSB7CisgICAgICAgICAgICBtU3VidGl0bGVWaWV3LnNldFRleHRBcHBlYXJhbmNlKG1Db250ZXh0LCBtU3VidGl0bGVTdHlsZVJlcyk7CisgICAgICAgIH0KKyAgICAgICAgaWYgKG1TdWJ0aXRsZSAhPSBudWxsKSB7CisgICAgICAgICAgICBtU3VidGl0bGVWaWV3LnNldFRleHQobVN1YnRpdGxlKTsKKyAgICAgICAgICAgIG1TdWJ0aXRsZVZpZXcuc2V0VmlzaWJpbGl0eShWSVNJQkxFKTsKKyAgICAgICAgfQorCisgICAgICAgIGFkZFZpZXcobVRpdGxlTGF5b3V0KTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBzZXRUYWJTZWxlY3RlZChpbnQgcG9zaXRpb24pIHsKKyAgICAgICAgZmluYWwgaW50IHRhYkNvdW50ID0gbVRhYkxheW91dC5nZXRDaGlsZENvdW50KCk7CisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgdGFiQ291bnQ7IGkrKykgeworICAgICAgICAgICAgZmluYWwgVmlldyBjaGlsZCA9IG1UYWJMYXlvdXQuZ2V0Q2hpbGRBdChpKTsKKyAgICAgICAgICAgIGNoaWxkLnNldFNlbGVjdGVkKGkgPT0gcG9zaXRpb24pOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHZvaWQgc2V0Q29udGV4dFZpZXcoQWN0aW9uQmFyQ29udGV4dFZpZXcgdmlldykgeworICAgICAgICBtQ29udGV4dFZpZXcgPSB2aWV3OworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHByb3RlY3RlZCB2b2lkIG9uTWVhc3VyZShpbnQgd2lkdGhNZWFzdXJlU3BlYywgaW50IGhlaWdodE1lYXN1cmVTcGVjKSB7CisgICAgICAgIGludCB3aWR0aE1vZGUgPSBNZWFzdXJlU3BlYy5nZXRNb2RlKHdpZHRoTWVhc3VyZVNwZWMpOworICAgICAgICBpZiAod2lkdGhNb2RlICE9IE1lYXN1cmVTcGVjLkVYQUNUTFkpIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oZ2V0Q2xhc3MoKS5nZXRTaW1wbGVOYW1lKCkgKyAiIGNhbiBvbmx5IGJlIHVzZWQgIiArCisgICAgICAgICAgICAgICAgICAgICJ3aXRoIGFuZHJvaWQ6bGF5b3V0X3dpZHRoPVwibWF0Y2hfcGFyZW50XCIgKG9yIGZpbGxfcGFyZW50KSIpOworICAgICAgICB9CisgICAgICAgIA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gbnVsbCAmJiBtTG9nb1ZpZXcuZ2V0VmlzaWJpbGl0eSgpICE9IEdPTkUpIHsKKyAgICAgICAgICAgIGF2YWlsYWJsZVdpZHRoID0gbWVhc3VyZUNoaWxkVmlldyhtTG9nb1ZpZXcsIGF2YWlsYWJsZVdpZHRoLCBjaGlsZFNwZWNIZWlnaHQsIG1TcGFjaW5nKTsKKyAgICAgICAgfQorICAgICAgICBpZiAobUljb25WaWV3ICE9IG51bGwgJiYgbUljb25WaWV3LmdldFZpc2liaWxpdHkoKSAhPSBHT05FKSB7CisgICAgICAgICAgICBhdmFpbGFibGVXaWR0aCA9IG1lYXN1cmVDaGlsZFZpZXcobUljb25WaWV3LCBhdmFpbGFibGVXaWR0aCwgY2hpbGRTcGVjSGVpZ2h0LCBtU3BhY2luZyk7CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIGlmIChtTWVudVZpZXcgIT0gbnVsbCkgeworICAgICAgICAgICAgYXZhaWxhYmxlV2lkdGggPSBtZWFzdXJlQ2hpbGRWaWV3KG1NZW51VmlldywgYXZhaWxhYmxlV2lkdGgsCisgICAgICAgICAgICAgICAgICAgIGNoaWxkU3BlY0hlaWdodCwgMCk7CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIHN3aXRjaCAobU5hdmlnYXRpb25Nb2RlKSB7CisgICAgICAgIGNhc2UgQWN0aW9uQmFyLk5BVklHQVRJT05fTU9ERV9TVEFOREFSRDoKKyAgICAgICAgICAgIGlmIChtVGl0bGVMYXlvdXQgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIG1lYXN1cmVDaGlsZFZpZXcobVRpdGxlTGF5b3V0LCBhdmFpbGFibGVXaWR0aCwgY2hpbGRTcGVjSGVpZ2h0LCBtU3BhY2luZyk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBBY3Rpb25CYXIuTkFWSUdBVElPTl9NT0RFX0RST1BET1dOX0xJU1Q6CisgICAgICAgICAgICBpZiAobVNwaW5uZXIgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIG1TcGlubmVyLm1lYXN1cmUoCisgICAgICAgICAgICAgICAgICAgICAgICBNZWFzdXJlU3BlYy5tYWtlTWVhc3VyZVNwZWMoYXZhaWxhYmxlV2lkdGgsIE1lYXN1cmVTcGVjLkFUX01PU1QpLAorICAgICAgICAgICAgICAgICAgICAgICAgTWVhc3VyZVNwZWMubWFrZU1lYXN1cmVTcGVjKGhlaWdodCwgTWVhc3VyZVNwZWMuQVRfTU9TVCkpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgQWN0aW9uQmFyLk5BVklHQVRJT05fTU9ERV9DVVNUT006CisgICAgICAgICAgICBpZiAobUN1c3RvbU5hdlZpZXcgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIExheW91dFBhcmFtcyBscCA9IG1DdXN0b21OYXZWaWV3LmdldExheW91dFBhcmFtcygpOworICAgICAgICAgICAgICAgIGZpbmFsIGludCBjdXN0b21OYXZXaWR0aE1vZGUgPSBscC53aWR0aCAhPSBMYXlvdXRQYXJhbXMuV1JBUF9DT05URU5UID8KKyAgICAgICAgICAgICAgICAgICAgICAgIE1lYXN1cmVTcGVjLkVYQUNUTFkgOiBNZWFzdXJlU3BlYy5BVF9NT1NUOworICAgICAgICAgICAgICAgIGZpbmFsIGludCBjdXN0b21OYXZXaWR0aCA9IGxwLndpZHRoID49IDAgPworICAgICAgICAgICAgICAgICAgICAgICAgTWF0aC5taW4obHAud2lkdGgsIGF2YWlsYWJsZVdpZHRoKSA6IGF2YWlsYWJsZVdpZHRoOworCisgICAgICAgICAgICAgICAgLy8gSWYgdGhlIGFjdGlvbiBiYXIgaXMgd3JhcHBpbmcgdG8gaXRzIGNvbnRlbnQgaGVpZ2h0LCBkb24ndCBhbGxvdyBhIGN1c3RvbQorICAgICAgICAgICAgICAgIC8vIHZpZXcgdG8gTUFUQ0hfUEFSRU5ULgorICAgICAgICAgICAgICAgIGludCBjdXN0b21OYXZIZWlnaHRNb2RlOworICAgICAgICAgICAgICAgIGlmIChtQ29udGVudEhlaWdodCA8PSAwKSB7CisgICAgICAgICAgICAgICAgICAgIGN1c3RvbU5hdkhlaWdodE1vZGUgPSBNZWFzdXJlU3BlYy5BVF9NT1NUOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIGN1c3RvbU5hdkhlaWdodE1vZGUgPSBscC5oZWlnaHQgIT0gTGF5b3V0UGFyYW1zLldSQVBfQ09OVEVOVCA/CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgTWVhc3VyZVNwZWMuRVhBQ1RMWSA6IE1lYXN1cmVTcGVjLkFUX01PU1Q7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGZpbmFsIGludCBjdXN0b21OYXZIZWlnaHQgPSBscC5oZWlnaHQgPj0gMCA/CisgICAgICAgICAgICAgICAgICAgICAgICBNYXRoLm1pbihscC5oZWlnaHQsIGhlaWdodCkgOiBoZWlnaHQ7CisgICAgICAgICAgICAgICAgbUN1c3RvbU5hdlZpZXcubWVhc3VyZSgKKyAgICAgICAgICAgICAgICAgICAgICAgIE1lYXN1cmVTcGVjLm1ha2VNZWFzdXJlU3BlYyhjdXN0b21OYXZXaWR0aCwgY3VzdG9tTmF2V2lkdGhNb2RlKSwKKyAgICAgICAgICAgICAgICAgICAgICAgIE1lYXN1cmVTcGVjLm1ha2VNZWFzdXJlU3BlYyhjdXN0b21OYXZIZWlnaHQsIGN1c3RvbU5hdkhlaWdodE1vZGUpKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIEFjdGlvbkJhci5OQVZJR0FUSU9OX01PREVfVEFCUzoKKyAgICAgICAgICAgIGlmIChtVGFiTGF5b3V0ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBtVGFiTGF5b3V0Lm1lYXN1cmUoCisgICAgICAgICAgICAgICAgICAgICAgICBNZWFzdXJlU3BlYy5tYWtlTWVhc3VyZVNwZWMoYXZhaWxhYmxlV2lkdGgsIE1lYXN1cmVTcGVjLkFUX01PU1QpLAorICAgICAgICAgICAgICAgICAgICAgICAgTWVhc3VyZVNwZWMubWFrZU1lYXN1cmVTcGVjKGhlaWdodCwgTWVhc3VyZVNwZWMuQVRfTU9TVCkpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKworICAgICAgICBpZiAobUNvbnRlbnRIZWlnaHQgPD0gMCkgeworICAgICAgICAgICAgaW50IG1lYXN1cmVkSGVpZ2h0ID0gMDsKKyAgICAgICAgICAgIGZpbmFsIGludCBjb3VudCA9IGdldENoaWxkQ291bnQoKTsKKyAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgY291bnQ7IGkrKykgeworICAgICAgICAgICAgICAgIFZpZXcgdiA9IGdldENoaWxkQXQoaSk7CisgICAgICAgICAgICAgICAgaW50IHBhZGRlZFZpZXdIZWlnaHQgPSB2LmdldE1lYXN1cmVkSGVpZ2h0KCkgKyB2ZXJ0aWNhbFBhZGRpbmc7CisgICAgICAgICAgICAgICAgaWYgKHBhZGRlZFZpZXdIZWlnaHQgPiBtZWFzdXJlZEhlaWdodCkgeworICAgICAgICAgICAgICAgICAgICBtZWFzdXJlZEhlaWdodCA9IHBhZGRlZFZpZXdIZWlnaHQ7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgc2V0TWVhc3VyZWREaW1lbnNpb24oY29udGVudFdpZHRoLCBtZWFzdXJlZEhlaWdodCk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBzZXRNZWFzdXJlZERpbWVuc2lvbihjb250ZW50V2lkdGgsIG1heEhlaWdodCk7CisgICAgICAgIH0KKworICAgICAgICBpZiAobUNvbnRleHRWaWV3ICE9IG51bGwpIHsKKyAgICAgICAgICAgIG1Db250ZXh0Vmlldy5zZXRIZWlnaHQ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iYgbUljb25WaWV3LmdldFZpc2liaWxpdHkoKSAhPSBHT05FKSB7CisgICAgICAgICAgICB4ICs9IHBvc2l0aW9uQ2hpbGQobUljb25WaWV3LCB4LCB5LCBjb250ZW50SGVpZ2h0KSArIG1TcGFjaW5nOworICAgICAgICB9CisgICAgICAgIAorICAgICAgICBzd2l0Y2ggKG1OYXZpZ2F0aW9uTW9kZSkgeworICAgICAgICBjYXNlIEFjdGlvbkJhci5OQVZJR0FUSU9OX01PREVfU1RBTkRBUkQ6CisgICAgICAgICAgICBpZiAobVRpdGxlTGF5b3V0ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICB4ICs9IHBvc2l0aW9uQ2hpbGQobVRpdGxlTGF5b3V0LCB4LCB5LCBjb250ZW50SGVpZ2h0KSArIG1TcGFjaW5nOworICAgICAgICAgICAgfQorICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgQWN0aW9uQmFyLk5BVklHQVRJT05fTU9ERV9EUk9QRE9XTl9MSVNUOgorICAgICAgICAgICAgaWYgKG1TcGlubmVyICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICB4ICs9IHBvc2l0aW9uQ2hpbGQobVNwaW5uZXIsIHgsIHksIGNvbnRlbnRIZWlnaHQpICsgbVNwYWNpbmc7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBBY3Rpb25CYXIuTkFWSUdBVElPTl9NT0RFX0NVU1RPTToKKyAgICAgICAgICAgIGlmIChtQ3VzdG9tTmF2VmlldyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgeCArPSBwb3NpdGlvbkNoaWxkKG1DdXN0b21OYXZWaWV3LCB4LCB5LCBjb250ZW50SGVpZ2h0KSArIG1TcGFjaW5nOworICAgICAgICAgICAgfQorICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgQWN0aW9uQmFyLk5BVklHQVRJT05fTU9ERV9UQUJTOgorICAgICAgICAgICAgaWYgKG1UYWJMYXlvdXQgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIHggKz0gcG9zaXRpb25DaGlsZChtVGFiTGF5b3V0LCB4LCB5LCBjb250ZW50SGVpZ2h0KSArIG1TcGFjaW5nOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgeCA9IHIgLSBsIC0gZ2V0UGFkZGluZ1JpZ2h0KCk7CisKKyAgICAgICAgaWYgKG1NZW51VmlldyAhPSBudWxsKSB7CisgICAgICAgICAgICB4IC09IHBvc2l0aW9uQ2hpbGRJbnZlcnNlKG1NZW51VmlldywgeCArIG1BY3Rpb25TcGFjaW5nLCB5LCBjb250ZW50SGVpZ2h0KQorICAgICAgICAgICAgICAgICAgICAtIG1BY3Rpb25TcGFjaW5nOworICAgICAgICB9CisgICAgfQorCisgICAgcHJpdmF0ZSBpbnQgcG9zaXRpb25DaGlsZChWaWV3IGNoaWxkLCBpbnQgeCwgaW50IHksIGludCBjb250ZW50SGVpZ2h0KSB7CisgICAgICAgIGludCBjaGlsZFdpZHRoID0gY2hpbGQuZ2V0TWVhc3VyZWRXaWR0aCgpOworICAgICAgICBpbnQgY2hpbGRIZWlnaHQgPSBjaGlsZC5nZXRNZWFzdXJlZEhlaWdodCgpOworICAgICAgICBpbnQgY2hpbGRUb3AgPSB5ICsgKGNvbnRlbnRIZWlnaHQgLSBjaGlsZEhlaWdodCkgLyAyOworCisgICAgICAgIGNoaWxkLmxheW91dCh4LCBjaGlsZFRvcCwgeCArIGNoaWxkV2lkdGgsIGNoaWxkVG9wICsgY2hpbGRIZWlnaHQpOworCisgICAgICAgIHJldHVybiBjaGlsZFdpZHRoOworICAgIH0KKyAgICAKKyAgICBwcml2YXRlIGludCBwb3NpdGlvbkNoaWxkSW52ZXJzZShWaWV3IGNoaWxkLCBpbnQgeCwgaW50IHksIGludCBjb250ZW50SGVpZ2h0KSB7CisgICAgICAgIGludCBjaGlsZFdpZHRoID0gY2hpbGQuZ2V0TWVhc3VyZWRXaWR0aCgpOworICAgICAgICBpbnQgY2hpbGRIZWlnaHQgPSBjaGlsZC5nZXRNZWFzdXJlZEhlaWdodCgpOworICAgICAgICBpbnQgY2hpbGRUb3AgPSB5ICsgKGNvbnRlbnRIZWlnaHQgLSBjaGlsZEhlaWdodCkgLyAyOworCisgICAgICAgIGNoaWxkLmxheW91dCh4IC0gY2hpbGRXaWR0aCwgY2hpbGRUb3AsIHgsIGNoaWxkVG9wICsgY2hpbGRIZWlnaHQpOworCisgICAgICAgIHJldHVybiBjaGlsZFdpZHRoOworICAgIH0KKworICAgIHByaXZhdGUgc3RhdGljIGNsYXNzIFRhYlZpZXcgZXh0ZW5kcyBMaW5lYXJMYXlvdXQgeworICAgICAgICBwcml2YXRlIEFjdGlvbkJhci5UYWIgbVRhYjsKKworICAgICAgICBwdWJsaWMgVGFiVmlldyhDb250ZXh0IGNvbnRleHQsIEFjdGlvbkJhci5UYWIgdGFiKSB7CisgICAgICAgICAgICBzdXBlcihjb250ZXh0KTsKKyAgICAgICAgICAgIG1UYWIgPSB0YWI7CisKKyAgICAgICAgICAgIC8vIFRPRE8gU3R5bGUgdGFicyBiYXNlZCBvbiB0aGUgdGhlbWUKKworICAgICAgICAgICAgZmluYWwgRHJhd2FibGUgaWNvbiA9IHRhYi5nZXRJY29uKCk7CisgICAgICAgICAgICBmaW5hbCBDaGFyU2VxdWVuY2UgdGV4dCA9IHRhYi5nZXRUZXh0KCk7CisKKyAgICAgICAgICAgIGlmIChpY29uICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBJbWFnZVZpZXcgaWNvblZpZXcgPSBuZXcgSW1hZ2VWaWV3KGNvbnRleHQpOworICAgICAgICAgICAgICAgIGljb25WaWV3LnNldEltYWdlRHJhd2FibGUoaWNvbik7CisgICAgICAgICAgICAgICAgTGF5b3V0UGFyYW1zIGxwID0gbmV3IExheW91dFBhcmFtcyhMYXlvdXRQYXJhbXMuV1JBUF9DT05URU5ULAorICAgICAgICAgICAgICAgICAgICAgICAgTGF5b3V0UGFyYW1zLldSQVBfQ09OVEVOVCk7CisgICAgICAgICAgICAgICAgbHAuZ3Jhdml0eSA9IEdyYXZpdHkuQ0VOVEVSX1ZFUlRJQ0FMOworICAgICAgICAgICAgICAgIGljb25WaWV3LnNldExheW91dFBhcmFtcyhscCk7CisgICAgICAgICAgICAgICAgYWRkVmlldyhpY29uVmlldyk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmICh0ZXh0ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBUZXh0VmlldyB0ZXh0VmlldyA9IG5ldyBUZXh0Vmlldyhjb250ZXh0KTsKKyAgICAgICAgICAgICAgICB0ZXh0Vmlldy5zZXRUZXh0KHRleHQpOworICAgICAgICAgICAgICAgIHRleHRWaWV3LnNldFNpbmdsZUxpbmUoKTsKKyAgICAgICAgICAgICAgICB0ZXh0Vmlldy5zZXRFbGxpcHNpemUoVHJ1bmNhdGVBdC5FTkQpOworICAgICAgICAgICAgICAgIExheW91dFBhcmFtcyBscCA9IG5ldyBMYXlvdXRQYXJhbXMoTGF5b3V0UGFyYW1zLldSQVBfQ09OVEVOVCwKKyAgICAgICAgICAgICAgICAgICAgICAgIExheW91dFBhcmFtcy5XUkFQX0NPTlRFTlQpOworICAgICAgICAgICAgICAgIGxwLmdyYXZpdHkgPSBHcmF2aXR5LkNFTlRFUl9WRVJUSUNBTDsKKyAgICAgICAgICAgICAgICB0ZXh0Vmlldy5zZXRMYXlvdXRQYXJhbXMobHApOworICAgICAgICAgICAgICAgIGFkZFZpZXcodGV4dFZpZXcpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBzZXRMYXlvdXRQYXJhbXMobmV3IExheW91dFBhcmFtcyhMYXlvdXRQYXJhbXMuV1JBUF9DT05URU5ULAorICAgICAgICAgICAgICAgICAgICBMYXlvdXRQYXJhbXMuTUFUQ0hfUEFSRU5ULCAxKSk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgQWN0aW9uQmFyLlRhYiBnZXRU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sbGJhY2s7CisgICAgcHJpdmF0ZSBmbG9hdFtdIG1FeWVQb2ludCA9IG5ldyBmbG9hdFszXTsKKyAgICBwcml2YXRlIGZsb2F0W10gbUF0UG9pbnQgPSBuZXcgZmxvYXRbM107CisgICAgcHJpdmF0ZSBmbG9hdFtdIG1VcCA9IG5ldyBmbG9hdFszXTsKKyAgICAKKyAgICBwdWJsaWMgc3RhdGljIGludGVyZmFjZSBDYXJvdXNlbENhbGxiYWNrIHsKKyAgICAgICAgLyoqCisgICAgICAgICAqIENhbGxlZCB3aGVuIGEgY2FyZCBpcyBzZWxlY3RlZAorICAgICAgICAgKiBAcGFyYW0gbiB0aGUgaWQgb2YgdGhlIGNhcmQKKyAgICAgICAgICovCisgICAgICAgIHZvaWQgb25DYXJkU2VsZWN0ZWQoaW50IG4pOworICAgICAgICAKKyAgICAgICAgLyoqCisgICAgICAgICAqIENhbGxlZCB3aGVuIHRleHR1cmUgaXMgbmVlZGVkIGZvciBjYXJkIG4uICBUaGlzIGhhcHBlbnMgd2hlbiB0aGUgZ2l2ZW4gY2FyZCBiZWNvbWVzCisgICAgICAgICAqIHZpc2libGUuCisgICAgICAgICAqIEBwYXJhbSBuIHRoZSBpZCBvZiB0aGUgY2FyZAorICAgICAgICAgKi8KKyAgICAgICAgdm9pZCBvblJlcXVlc3RUZXh0dXJlKGludCBuKTsKKyAgICAgICAgCisgICAgICAgIC8qKgorICAgICAgICAgKiBDYWxsZWQgd2hlbiBhIHRleHR1cmUgaXMgbm8gbG9uZ2VyIG5lZWRlZCBmb3IgY2FyZCBuLiAgVGhpcyBoYXBwZW5zIHdoZW4gdGhlIGNhcmQKKyAgICAgICAgICogZ29lcyBvdXQgb2Ygdmlldy4KKyAgICAgICAgICogQHBhcmFtIG4gdGhlIGlkIG9mIHRoZSBjYXJkCisgICAgICAgICAqLworICAgICAgICB2b2lkIG9uSW52YWxpZGF0ZVRleHR1cmUoaW50IG4pOworICAgICAgICAKKyAgICAgICAgLyoqCisgICAgICAgICAqIENhbGxlZCB3aGVuIGdlb21ldHJ5IGlzIG5lZWRlZCBmb3IgY2FyZCBuLgorICAgICAgICAgKiBAcGFyYW0gbiB0aGUgaWQgb2YgdGhlIGNhcmQuCisgICAgICAgICAqLworICAgICAgICB2b2lkIG9uUmVxdWVzdEdlb21ldHJ5KGludCBuKTsKKyAgICAgICAgCisgICAgICAgIC8qKgorICAgICAgICAgKiBDYWxsZWQgd2hlbiBnZW9tZXRyeSBpcyBubyBsb25nZXIgbmVlZGVkIGZvciBjYXJkIG4uIFRoaXMgaGFwcGVucyB3aGVuIHRoZSBjYXJkIGdvZXMgCisgICAgICAgICAqIG91dCBvZiB2aWV3LgorICAgICAgICAgKiBAcGFyYW0gbiB0aGUgaWQgb2YgdGhlIGNhcmQKKyAgICAgICAgICovCisgICAgICAgIHZvaWQgb25JbnZhbGlkYXRlR2VvbWV0cnkoaW50IG4pOworICAgICAgICAKKyAgICAgICAgLyoqCisgICAgICAgICAqIENhbGxlZCB3aGVuIGNhcmQgYW5pbWF0aW9uIChlLmcuIGEgZmxpbmcpIGhhcyBzdGFydGVkLgorICAgICAgICAgKi8KKyAgICAgICAgdm9pZCBvbkFuaW1hdGlvblN0YXJ0ZWQoKTsKKyAgICAgICAgCisgICAgICAgIC8qKgorICAgICAgICAgKiBDYWxsZWQgd2hlbiBjYXJkIGFuaW1hdGlvbiBoYXMgc3RvcHBlZC4KKyAgICAgICAgICovCisgICAgICAgIHZvaWQgb25BbmltYXRpb25GaW5pc2hlZCgpOworICAgIH07CisgICAgCisgICAgcHJpdmF0ZSBSU01lc3NhZ2UgbVJzTWVzc2FnZSA9IG5ldyBSU01lc3NhZ2UoKSB7CisgICAgICAgIHB1YmxpYyB2b2lkIHJ1bigpIHsKKyAgICAgICAgICAgIGlmIChtQ2FsbGJhY2sgPT0gbnVsbCkgcmV0dXJuOworICAgICAgICAgICAgc3dpdGNoIChtSUQpIHsKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9DQVJEX1NFTEVDVEVEOgorICAgICAgICAgICAgICAgICAgICBtQ2FsbGJhY2sub25DYXJkU2VsZWN0ZWQobURhdGFbMF0pOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgCisgICAgICAgICAgICAgICAgY2FzZSBDTURfUkVRVUVTVF9URVhUVVJFOgorICAgICAgICAgICAgICAgICAgICBtQ2FsbGJhY2sub25SZXF1ZXN0VGV4dHVyZShtRGF0YVswXSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgIAorICAgICAgICAgICAgICAgIGNhc2UgQ01EX0lOVkFMSURBVEVfVEVYVFVSRToKKyAgICAgICAgICAgICAgICAgICAgbUNhbGxiYWNrLm9uSW52YWxpZGF0ZVRleHR1cmUobURhdGFbMF0pOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgCisgICAgICAgICAgICAgICAgY2FzZSBDTURfUkVRVUVTVF9HRU9NRVRSWToKKyAgICAgICAgICAgICAgICAgICAgbUNhbGxiYWNrLm9uUmVxdWVzdEdlb21ldHJ5KG1EYXRhWzBdKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIAorICAgICAgICAgICAgICAgIGNhc2UgQ01EX0lOVkFMSURBVEVfR0VPTUVUUlk6CisgICAgICAgICAgICAgICAgICAgIG1DYWxsYmFjay5vbkludmFsaWRhdGVHZW9tZXRyeShtRGF0YVswXSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICAKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9BTklNQVRJT05fU1RBUlRFRDoKKyAgICAgICAgICAgICAgICAgICAgbUNhbGxiYWNrLm9uQW5pbWF0aW9uU3RhcnRlZCgpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgCisgICAgICAgICAgICAgICAgY2FzZSBDTURfQU5JTUFUSU9OX0ZJTklTSEVEOgorICAgICAgICAgICAgICAgICAgICBtQ2FsbGJhY2sub25BbmltYXRpb25GaW5pc2hlZCgpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgCisgICAgICAgICAgICAgICAgY2FzZSBDTURfUElORzoKKyAgICAgICAgICAgICAgICAgICAgTG9nLnYoVEFHLCAiUElORy4uLiIpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgCisgICAgICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICAgICAgTG9nLmUoVEFHLCAiVW5rbm93biBSU01lc3NhZ2U6ICIgKyBtSUQpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfTsKKyAgICAKKyAgICBwdWJsaWMgdm9pZCBpbml0KFJlbmRlclNjcmlwdEdMIHJzLCBSZXNvdXJjZXMgcmVzKSB7CisgICAgICAgIG1SUyA9IHJzOworICAgICAgICBtUmVzID0gcmVzOworCisgICAgICAgIC8vIGNyZWF0ZSB0aGUgc2NyaXB0IG9iamVjdAorICAgICAgICBtU2NyaXB0ID0gbmV3IFNjcmlwdENfQ2Fyb3VzZWwobVJTLCBtUmVzLCBSLnJhdy5jYXJvdXNlbCwgdHJ1ZSk7CisgICAgICAgIG1SUy5tTWVzc2FnZUNhbGxiYWNrID0gbVJzTWVzc2FnZTsKKworICAgICAgICBpbml0UHJvZ3JhbVN0b3JlKCk7CisgICAgICAgIGluaXRGcmFnbWVudFByb2dyYW0oKTsKKyAgICAgICAgaW5pdFJhc3RlclByb2dyYW0oKTsKKyAgICAgICAgaW5pdFZlcnRleFByb2dyYW0oKTsKKyAgICAgICAgCisgICAgICAgIHNldFNsb3RDb3VudChERUZBVUxUX1NMT1RfQ09VTlQpOworICAgICAgICBzZXRWaXNpYmxlU2xvdHMoREVGQVVMVF9WSVNJQkxFX1NMT1RTKTsKKyAgICAgICAgY3JlYXRlQ2FyZHMoREVGQVVMVF9DQVJEX0NPVU5UKTsKKyAgICAgICAgCisgICAgICAgIHNldFN0YXJ0QW5nbGUoMC4wZik7CisgICAgICAgIHNldFJhZGl1cygxLjBmKTsKKyAgICAgICAgCisgICAgICAgIC8vIHVwZGF0ZSB0aGUgY2FtZXJhCisgICAgICAgIGJvb2xlYW4gcGNhbSA9IHRydWU7CisgICAgICAgIGlmIChwY2FtKSB7CisgICAgICAgICAgICBmbG9hdCBleWVbXSA9IHsgMjAuNjgyOWYsIDIuNzcwODFmLCAxNi43MzE0ZiB9OworICAgICAgICAgICAgZmxvYXQgYXRbXSA9IHsgMTQuNzI1NWYsIC0zLjQwMDAxZiwgLTEuMzAxODRmIH07CisgICAgICAgICAgICBmbG9hdCB1cFtdID0geyAwLjBmLCAxLjBmLCAwLjBmIH07CisgICAgICAgICAgICBzZXRMb29rQXQoZXllLCBhdCwgdXApOworICAgICAgICAgICAgc2V0UmFkaXVzKDIwLjBmKTsKKyAgICAgICAgICAgIC8vIEZvdjogMjUKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIG1TY3JpcHQuaW52b2tlX2xvb2tBdCgyLjVmLCAyLjBmLCAyLjVmLCAwLjBmLCAtMC43NWYsIDAuMGYsICAwLjBmLCAxLjBmLCAwLjBmKTsKKyAgICAgICAgICAgIG1TY3JpcHQuc2V0X2NhcmRSb3RhdGlvbigwLjBmKTsKKyAgICAgICAgICAgIHNldFJhZGl1cygxLjVmKTsKKyAgICAgICAgfQorCisgICAgICAgIHJlc3VtZVJlbmRlcmluZygpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHNldExvb2tBdChmbG9hdFtdIGV5ZSwgZmxvYXRbXSBhdCwgZmxvYXRbXSB1cCkgeworICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IDM7IGkrKykgeworICAgICAgICAgICAgbUV5ZVBvaW50W2ldID0gZXllW2ldOworICAgICAgICAgICAgbUF0UG9pbnRbaV0gPSBhdFtpXTsKKyAgICAgICAgICAgI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dHMoaW50IGNvdW50KQorICAgIHsKKyAgICAgICAgbVNjcmlwdC5zZXRfdmlzaWJsZVNsb3RDb3VudChjb3VudCk7CisgICAgfQorICAgIAorICAgIHB1YmxpYyB2b2lkIHNldERlZmF1bHRCaXRtYXAoQml0bWFwIGJpdG1hcCkKKyAgICB7CisgICAgICAgIG1TY3JpcHQuc2V0X2RlZmF1bHRUZXh0dXJlKGFsbG9jYXRpb25Gcm9tQml0bWFwKGJpdG1hcCwgTUlQTUFQKSk7CisgICAgfQorICAgIAorICAgIHB1YmxpYyB2b2lkIHNldExvYWRpbmdCaXRtYXAoQml0bWFwIGJpdG1hcCkKKyAgICB7CisgICAgICAgIG1TY3JpcHQuc2V0X2xvYWRpbmdUZXh0dXJlKGFsbG9jYXRpb25Gcm9tQml0bWFwKGJpdG1hcCwgTUlQTUFQKSk7CisgICAgfQorICAgIAorICAgIHB1YmxpYyB2b2lkIHNldERlZmF1bHRHZW9tZXRyeShNZXNoIG1lc2gpCisgICAgeworICAgICAgICBtU2NyaXB0LnNldF9kZWZhdWx0R2VvbWV0cnkobWVzaCk7CisgICAgfQorICAgIAorICAgIHB1YmxpYyB2b2lkIHNldExvYWRpbmdHZW9tZXRyeShNZXNoIG1lc2gpCisgICAgeworICAgICAgICBtU2NyaXB0LnNldF9sb2FkaW5nR2VvbWV0cnkobWVzaCk7CisgICAgfQorICAgIAorICAgIHB1YmxpYyB2b2lkIHNldFN0YXJ0QW5nbGUoZmxvYXQgdGhldGEpCisgICAgeworICAgICAgICBtU2NyaXB0LnNldF9zdGFydEFuZ2xlKHRoZXRhKTsKKyAgICB9CisgICAgCisgICAgcHVibGljIHZvaWQgc2V0Q2FsbGJhY2soQ2Fyb3VzZWxDYWxsYmFjayBjYWxsYmFjaykKKyAgICB7CisgICAgICAgIG1DYWxsYmFjayA9IGNhbGxiYWNrOworICAgIH0KKyAgICAKKyAgICBwcml2YXRlIEFsbG9jYXRpb24gYWxsb2NhdGlvbkZyb21CaXRtYXAoQml0bWFwIGJpdG1hcCwgYm9vbGVhbiBtaXBtYXApCisgICAgeworICAgICAgICBpZiAoYml0bWFwID09IG51bGwpIHJldHVybiBudWxsOworICAgICAgICBBbGxvY2F0aW9uIGFsbG9jYXRpb24gPSBBbGxvY2F0aW9uLmNyZWF0ZUZyb21CaXRtYXAobVJTLCBiaXRtYXAsIFJHQl81NjUobVJTKSwgbWlwbWFwKTsKKyAgICAgICAgYWxsb2NhdGlvbi51cGxvYWRUb1RleHR1cmUoMCk7CisgICAgICAgIHJldHVybiBhbGxvY2F0aW9uOworICAgIH0KKyAgICAKKyAgICBwdWJsaWMgdm9pZCBzZXRUZXh0dXJlKGludCBuLCBCaXRtYXAgYml0bWFwKQorICAgIHsKKyAgICAgICAgU2NyaXB0RmllbGRfQ2FyZC5JdGVtIGl0ZW0gPSBtQ2FyZHMuZ2V0KG4pOworICAgICAgICBpZiAoaXRlbSA9PSBudWxsKSB7CisgICAgICAgICAgICBMb2cudihUQUcsICJzZXRUZXh0dXJlKCk6IG5vIGl0ZW0gYXQgaW5kZXggIiArIG4pOworICAgICAgICAgICAgaXRlbSA9IG5ldyBTY3JpcHRGaWVsZF9DYXJkLkl0ZW0oKTsKKyAgICAgICAgfQorICAgICAgICBpZiAoYml0bWFwICE9IG51bGwpIHsKKyAgICAgICAgICAgIExvZy52KFRBRywgImNyZWF0aW5nIG5ldyBiaXRtYXAiKTsKKyAgICAgICAgICAgIGl0ZW0udGV4dHVyZSA9IEFsbG9jYXRpb24uY3JlYXRlRnJvbUJpdG1hcChtUlMsIGJpdG1hcCwgUkdCXzU2NShtUlMpLCBNSVBNQVApOworICAgICAgICAgICAgTG9nLnYoVEFHLCAidXBsb2FkVG9UZXh0dXJlKCIgKyBuICsgIikiKTsKKyAgICAgICAgICAgIGl0ZW0udGV4dHVyZS51cGxvYWRUb1RleHR1cmUoMCk7CisgICAgICAgICAgICBMb2cudihUQUcsICJkb25lLi4uIik7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgIC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XRyeTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIExvZy52KFRBRywgInVubG9hZGluZyBnZW9tZXRyeSAiICsgbik7CisgICAgICAgICAgICBpZiAoaXRlbS5nZW9tZXRyeSAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgLy8gaXRlbS5nZW9tZXRyeS5kZXN0cm95KCk7IAorICAgICAgICAgICAgICAgIGl0ZW0uZ2VvbWV0cnkgPSBudWxsOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIG1DYXJkcy5zZXQoaXRlbSwgbiwgZmFsc2UpOworICAgICAgICBtU2NyaXB0Lmludm9rZV9zZXRHZW9tZXRyeShuLCBpdGVtLmdlb21ldHJ5KTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBwYXVzZVJlbmRlcmluZygpIHsKKyAgICAgICAgLy8gVXNlZCB0byB1cGRhdGUgbXVsdGlwbGUgc3RhdGVzIGF0IG9uY2Ugdy9vIHJlZHJhd2luZyBmb3IgZWFjaC4KKyAgICAgICAgbVJTLmNvbnRleHRCaW5kUm9vdFNjcmlwdChudWxsKTsKKyAgICB9CisgICAgCisgICAgcHVibGljIHZvaWQgcmVzdW1lUmVuZGVyaW5nKCkgeworICAgICAgICBtUlMuY29udGV4dEJpbmRSb290U2NyaXB0KG1TY3JpcHQpOworICAgIH0KKyAgICAKKyAgICBwdWJsaWMgdm9pZCBkb01vdGlvbihmbG9hdCB4LCBmbG9hdCB5KSB7CisgICAgICAgIG1TY3JpcHQuaW52b2tlX2RvTW90aW9uKHgseSk7CisgICAgfQorICAgIAorICAgIHB1YmxpYyB2b2lkIGRvU2VsZWN0aW9uKGZsb2F0IHgsIGZsb2F0IHkpIHsKKyAgICAgICAgbVNjcmlwdC5pbnZva2VfZG9TZWxlY3Rpb24oeCwgeSk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgZG9TdGFydChmbG9hdCB4LCBmbG9hdCB5KSB7CisgICAgICAgIG1TY3JpcHQuaW52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ICAgIG1SZW5kZXJTY3JpcHQuc2V0U2xvdENvdW50KG4pOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHZvaWQgc2V0VmlzaWJsZVNsb3RzKGludCBuKSB7CisgICAgICAgIG1WaXNpYmxlU2xvdHMgPSBuOworICAgICAgICBpZiAobVJlbmRlclNjcmlwdCAhPSBudWxsKSB7CisgICAgICAgICAgICBtUmVuZGVyU2NyaXB0LnNldFZpc2libGVTbG90cyhuKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyB2b2lkIGNyZWF0ZUNhcmRzKGludCBuKSB7CisgICAgICAgIG1DYXJkQ291bnQgPSBuOworICAgICAgICBpZiAobVJlbmRlclNjcmlwdCAhPSBudWxsKSB7CisgICAgICAgICAgICBtUmVuZGVyU2NyaXB0LmNyZWF0ZUNhcmRzKG4pOworICAgICAgICB9CisgICAgfQorICAgIAorICAgIHB1YmxpYyB2b2lkIHNldFRleHR1cmVGb3JJdGVtKGludCBuLCBCaXRtYXAgYml0bWFwKSB7CisgICAgICAgIGlmIChtUmVuZGVyU2NyaXB0ICE9IG51bGwpIHsKKyAgICAgICAgICAgIExvZy52KFRBRywgInNldFRleHR1cmVGb3JJdGVtKCIgKyBuICsgIikiKTsKKyAgICAgICAgICAgIG1SZW5kZXJTY3JpcHQuc2V0VGV4dHVyZShuLCBiaXRtYXApOyAKKyAgICAgICAgICAgIExvZy52KFRBRywgImRvbmUiKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHNldERlZmF1bHRCaXRtYXAoQml0bWFwIGJpdG1hcCkgeworICAgICAgICBtRGVmYXVsdEJpdG1hcCA9IGJpdG1hcDsgCisgICAgICAgIGlmIChtUmVuZGVyU2NyaXB0ICE9IG51bGwpIHsKKyAgICAgICAgICAgIG1SZW5kZXJTY3JpcHQuc2V0RGVmYXVsdEJpdG1hcChiaXRtYXApOworICAgICAgICB9CisgICAgfQorICAgIAorICAgIHB1YmxpYyB2b2lkIHNldExvYWRpbmdCaXRtYXAoQml0bWFwIGJpdG1hcCkgeworICAgICAgICBtTG9hZGluZ0JpdG1hcCA9IGJpdG1hcDsKKyAgICAgICAgaWYgKG1SZW5kZXJTY3JpcHQgIT0gbnVsbCkgeworICAgICAgICAgICAgbVJlbmRlclNjcmlwdC5zZXRMb2FkaW5nQml0bWFwKGJpdG1hcCk7CisgICAgICAgIH0KKyAgICB9CisgICAgCisgICAgcHVibGljIHZvaWQgc2V0RGVmYXVsdEdlb21ldHJ5KE1lc2ggbWVzaCkgeworICAgICAgICBtRGVmYXVsdEdlb21ldHJ5ID0gbWVzaDsKKyAgICAgICAgaWYgKG1SZW5kZXJTY3JpcHQgIT0gbnVsbCkgeworICAgICAgICAgICAgbVJlbmRlclNjcmlwdC5zZXREZWZhdWx0R2VvbWV0cnkobWVzaCk7CisgICAgICAgIH0KKyAgICB9CisgICAgCisgICAgcHVibGljIHZvaWQgc2V0TG9hZGluZ0dlb21ldHJ5KE1lc2ggbWVzaCkgeworICAgICAgICBtTG9hZGluZ0dlb21ldHJ5ID0gbWVzaDsKKyAgICAgICAgaWYgKG1SZW5kZXJTY3JpcHQgIT0gbnVsbCkgeworICAgICAgICAgICAgbVJlbmRlclNjcmlwdC5zZXRMb2FkaW5nR2VvbWV0cnkobWVzaCk7CisgICAgICAgIH0KKyAgICB9CisgICAgCisgICAgcHVibGljIHZvaWQgc2V0Q2FsbGJhY2soQ2Fyb3VzZWxDYWxsYmFjayBjYWxsYmFjaykKKyAgICB7CisgICAgICAgIG1DYXJvdXNlbENhbGxiYWNrID0gY2FsbGJhY2s7CisgICAgICAgIGlmIChtUmVuZGVyU2NyaXB0ICE9IG51bGwpIHsKKyAgICAgICAgICAgIG1SZW5kZXJTY3JpcHQuc2V0Q2FsbGJhY2soY2FsbGJhY2spOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHZvaWQgc2V0U3RhcnRBbmdsZShmbG9hdCBhbmdsZSkKKyAgICB7CisgICAgICAgIG1TdGFydEFuZ2xlID0gYW5nbGU7CisgICAgICAgIGlmIChtUmVuZGVyU2NyaXB0ICE9IG51bGwpIHsKKyAgICAgICAgICAgIG1SZW5kZXJTY3JpcHQuc2V0U3RhcnRBbmdsZShhbmdsZSk7CisgICAgICAgIH0KKyAgICB9CisgICAgCisgICAgQE92ZXJyaWRlCisgICAgcHJvdGVjdGVkIHZvaWQgb25EZXRhY2hlZEZyb21XaW5kb3coKSB7CisgICAgICAgIGlmKG1SUyAhPSBudWxsKSB7CisgICAgICAgICAgICBtUlMgPSBudWxsOworICAgICAgICAgICAgZGVzdHJveVJlbmRlclNjcmlwdCgpOworICAgICAgICB9CisgICAgfQorICAgIAorICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyBib29sZWFuIG9uVG91Y2hFdmVudChNb3Rpb25FdmVudCBldmVudCkgeworICAgICAgICBmaW5hbCBpbnQgYWN0aW9uID0gZXZlbnQuZ2V0QWN0aW9uKCk7CisgICAgICAgIGZpbmFsIGZsb2F0IHggPSBldmVudC5nZXRYKCk7CisgICAgICAgIGZpbmFsIGZsb2F0IHkgPSBldmVudC5nZXRZKCk7CisgICAgICAgIAorICAgICAgICBpZiAobVJlbmRlclNjcmlwdCA9PSBudWxsKSB7CisgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgfQorCisgICAgICAgIHN3aXRjaCAoYWN0aW9uKSB7CisgICAgICAgICAgICBjYXNlIE1vdGlvbkV2ZW50LkFDVElPTl9ET1dOOgorICAgICAgICAgICAgICAgIG1UcmFja2luZyA9IHRydWU7CisgICAgICAgICAgICAgICAgbVJlbmRlclNjcmlwdC5kb1N0YXJ0KHgsIHkpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIAorICAgICAgICAgICAgY2FzZSBNb3Rpb25FdmVudC5BQ1RJT05fTU9WRToKKyAgICAgICAgICAgICAgICBpZiAobVRyYWNraW5nKSB7CisgICAgICAgICAgICAgICAgICAgIG1SZW5kZXJTY3JpcHQuZG9Nb3Rpb24oeCwgeSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIAorICAgICAgICAgICAgY2FzZSBNb3Rpb25FdmVudC5BQ1RJT05fVVA6CisgICAgICAgICAgICAgICAgbVJlbmRlclNjcmlwdC5kb1N0b3AoeCwgeSk7CisgICAgICAgICAgICAgICAgbVRyYWNraW5nID0gZmFsc2U7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICB9CisgICAgCisgICAgcHJpdmF0ZSBmaW5hbCBDYXJvdXNlbENhbGxiYWNrIERFQlVHX0NBTExCQUNLID0gbmV3IENhcm91c2VsQ2FsbGJhY2soKSB7CisgICAgICAgIHB1YmxpYyB2b2lkIG9uQW5pbWF0aW9uU3RhcnRlZCgpIHsKKyAgICAgICAgICAgIExvZy52KFRBRywgIm9uQW5pbWF0aW9uU3RhcnRlZCgpIik7CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIHB1YmxpYyB2b2lkIG9uQW5pbWF0aW9uRmluaXNoZWQoKSB7CisgICAgICAgICAgICBMb2cudihUQUcsICJvbkFuaW1hdGlvbkZpbmlzaGVkKCkiKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyB2b2lkIG9uQ2FyZFNlbGVjdGVkKGludCBuKSB7CisgICAgICAgICAgICBMb2cudihUQUcsICJvbkNhcmRTZWxlY3RlZCgiICsgbiArICIpIik7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCBvblJlcXVlc3RHZW9tZXRyeShpbnQgbikgeworICAgICAgICAgICAgTG9nLnYoVEFHLCAib25SZXF1ZXN0R2VvbWV0cnkoIiArIG4gKyAiKSIpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgb25JbnZhbGlkYXRlR2VvbWV0cnkoaW50IG4pIHsKKyAgICAgICAgICAgIExvZy52KF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GlzdGVuZXI7Ci0KLQotICAgIHByaXZhdGUgaW50ZXJmYWNlIENvbnRhY3RRdWVyeSB7Ci0gICAgICAgIC8vUHJvamVjdGlvbiB1c2VkIGZvciB0aGUgc3VtbWFyeSBpbmZvIGluIHRoZSBoZWFkZXIuCi0gICAgICAgIFN0cmluZ1tdIENPTFVNTlMgPSBuZXcgU3RyaW5nW10gewotICAgICAgICAgICAgQ29udGFjdHMuX0lELAotICAgICAgICAgICAgQ29udGFjdHMuTE9PS1VQX0tFWSwKLSAgICAgICAgICAgIENvbnRhY3RzLlBIT1RPX0lELAotICAgICAgICAgICAgQ29udGFjdHMuRElTUExBWV9OQU1FLAotICAgICAgICAgICAgQ29udGFjdHMuUEhPTkVUSUNfTkFNRSwKLSAgICAgICAgICAgIENvbnRhY3RzLlNUQVJSRUQsCi0gICAgICAgICAgICBDb250YWN0cy5DT05UQUNUX1BSRVNFTkNFLAotICAgICAgICAgICAgQ29udGFjdHMuQ09OVEFDVF9TVEFUVVMsCi0gICAgICAgICAgICBDb250YWN0cy5DT05UQUNUX1NUQVRVU19USU1FU1RBTVAsCi0gICAgICAgICAgICBDb250YWN0cy5DT05UQUNUX1NUQVRVU19SRVNfUEFDS0FHRSwKLSAgICAgICAgICAgIENvbnRhY3RzLkNPTlRBQ1RfU1RBVFVTX0xBQkVMLAotICAgICAgICB9OwotICAgICAgICBpbnQgX0lEID0gMDsKLSAgICAgICAgaW50IExPT0tVUF9LRVkgPSAxOwotICAgICAgICBpbnQgUEhPVE9fSUQgPSAyOwotICAgICAgICBpbnQgRElTUExBWV9OQU1FID0gMzsKLSAgICAgICAgaW50IFBIT05FVElDX05BTUUgPSA0OwotICAgICAgICAvL1RPRE86IFdlIG5lZWQgdG8gZmlndXJlIG91dCBob3cgd2UncmUgZ29pbmcgdG8gZ2V0IHRoZSBwaG9uZXRpYyBuYW1lLgotICAgICAgICAvL3N0YXRpYyBmaW5hbCBpbnQgSEVBREVSX1BIT05FVElDX05BTUVfQ09MVU1O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lld0J5SWQoUi5pZC5waG90byk7Ci0KLSAgICAgICAgbVByZXNlbmNlVmlldyA9IChJbWFnZVZpZXcpIGZpbmRWaWV3QnlJZChSLmlkLnByZXNlbmNlKTsKLQotICAgICAgICBtU3RhdHVzVmlldyA9IChUZXh0VmlldylmaW5kVmlld0J5SWQoUi5pZC5zdGF0dXMpOwotICAgICAgICBtU3RhdHVzQXR0cmlidXRpb25WaWV3ID0gKFRleHRWaWV3KWZpbmRWaWV3QnlJZChSLmlkLnN0YXR1c19kYXRlKTsKLQotICAgICAgICAvLyBTZXQgdGhlIHBob3RvIHdpdGggYSByYW5kb20gIm5vIGNvbnRhY3QiIGltYWdlCi0gICAgICAgIGxvbmcgbm93ID0gU3lzdGVtQ2xvY2suZWxhcHNlZFJlYWx0aW1lKCk7Ci0gICAgICAgIGludCBudW0gPSAoaW50KSBub3cgJiAweGY7Ci0gICAgICAgIGlmIChudW0gPCA5KSB7Ci0gICAgICAgICAgICAvLyBMZWFuaW5nIGluIGZyb20gcmlnaHQsIGNvbW1vbgotICAgICAgICAgICAgbU5vUGhvdG9SZXNvdXJjZSA9IFIuZHJhd2FibGUuaWNfY29udGFjdF9waWN0dXJlOwotICAgICAgICB9IGVsc2UgaWYgKG51bSA8IDE0KSB7Ci0gICAgICAgICAgICAvLyBMZWFuaW5nIGluIGZyb20gbGVmdCB1bmNvbW1vbgotICAgICAgICAgICAgbU5vUGhvdG9SZXNvdXJjZSA9IFIuZHJhd2FibGUuaWNfY29udGFjdF9waWN0dXJlXzI7Ci0gICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAvLyBDb21pbmcgaW4gZnJvbSB0aGUgdG9wLCByYXJlCi0gICAgICAgICAgICBtTm9QaG90b1Jlc291cmNlID0gUi5kcmF3YWJsZS5pY19jb250YWN0X3BpY3R1cmVfMzsKLSAgICAgICAgfQotCi0gICAgICAgIHJlc2V0QXN5bmNRdWVyeUhhbmRsZXIoKTsKLSAgICB9Ci0KLSAgICBwdWJsaWM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cm90ZWN0ZWQgdm9pZCBvblF1ZXJ5Q29tcGxldGUoaW50IHRva2VuLCBPYmplY3QgY29va2llLCBDdXJzb3IgY3Vyc29yKSB7Ci0gICAgICAgICAgICB0cnl7Ci0gICAgICAgICAgICAgICAgaWYgKHRoaXMgIT0gbVF1ZXJ5SGFuZGxlcikgewotICAgICAgICAgICAgICAgICAgICBMb2cuZChUQUcsICJvblF1ZXJ5Q29tcGxldGU6IGRpc2NhcmQgcmVzdWx0LCB0aGUgcXVlcnkgaGFuZGxlciBpcyByZXNldCEiKTsKLSAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwotICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgIHN3aXRjaCAodG9rZW4pIHsKLSAgICAgICAgICAgICAgICAgICAgY2FzZSBUT0tFTl9QSE9UT19RVUVSWTogewotICAgICAgICAgICAgICAgICAgICAgICAgLy9TZXQgdGhlIHBob3RvCi0gICAgICAgICAgICAgICAgICAgICAgICBCaXRtYXAgcGhvdG9CaXRtYXAgPSBudWxsOwotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGN1cnNvciAhPSBudWxsICYmIGN1cnNvci5tb3ZlVG9GaXJzdCgpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICYmICFjdXJzb3IuaXNOdWxsKFBob3RvUXVlcnkuUEhPVE8pKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnl0ZVtdIHBob3RvRGF0YSA9IGN1cnNvci5nZXRCbG9iKFBob3RvUXVlcnkuUEhPVE8pOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBob3RvQml0bWFwID0gQml0bWFwRmFjdG9yeS5kZWNvZGVCeXRlQXJyYXkocGhvdG9EYXRhLCAwLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGhvdG9EYXRhLmxlbmd0aCwgbnVsbCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChwaG90b0JpdG1hcCA9PSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgcGhvdG9CaXRtYXAgPSBsb2FkUGxhY2Vob2xkZXJQaG90byhudWxsKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgIG1QaG90b1ZpZXcuc2V0SW1hZ2VCaXRtYXAocGhvdG9CaXRtYXApOwotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNvb2tpZSAhPSBudWxsICYmIGNvb2tpZSBpbnN0YW5jZW9mIFVyaSkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1QaG90b1ZpZXcuYXNzaWduQ29udGFjdFVyaSgoVXJpKSBjb29raWUpOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgaW52YWxpZGF0ZSgpOwotICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgY2FzZSBUT0tFTl9DT05UQUNUX0lORk86IHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjdXJzb3IgIT0gbnVsbCAmJiBjdXJzb3IubW92ZVRvRmlyc3QoKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJpbmRDb250YWN0SW5mbyhjdXJzb3IpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIFVyaSBsb29rdXBVcmkgPSBDb250YWN0cy5nZXRMb29rdXBVcmkoY3Vyc29yLmdldExvbmcoQ29udGFjdFF1ZXJ5Ll9JRCksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXJzb3IuZ2V0U3RyaW5nKENvbnRhY3RRdWVyeS5MT09LVVBfS0VZKSk7Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaW5hbCBsb25nIHBob3RvSWQgPSBjdXJzb3IuZ2V0TG9uZyhDb250YWN0UXVlcnkuUEhPVE9fSUQpOwotCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHBob3RvSWQgPT0gMCkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtUGhvdG9WaWV3LnNldEltYWdlQml0bWFwKGxvYWRQbGFjZWhvbGRlclBob3RvKG51bGwpKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNvb2tpZSAhPSBudWxsICYmIGNvb2tpZSBpbnN0YW5jZW9mIFVyaSkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVBob3RvVmlldy5hc3NpZ25Db250YWN0VXJpKChVcmkpIGNvb2tpZSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW52YWxpZGF0ZSgpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXJ0UGhvdG9RdWVyeShwaG90b0lkLCBsb29rdXBVcmksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmFsc2UgLyogZG9uJ3QgcmVzZXQgcXVlcnkgaGFuZGxlciAqLyk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBzaG91bGRuJ3QgcmVhbGx5IGhhcHBlbgotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldERpc3BsYXlOYW1lKG51bGwsIG51bGwpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldFNvY2lhbFNuaXBwZXQobnVsbCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0UGhvdG8obG9hZFBsYWNlaG9sZGVyUGhvdG8obnVsbCkpOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgY2FzZSBUT0tFTl9QSE9ORV9MT09LVVA6IHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjdXJzb3IgIT0gbnVsbCAmJiBjdXJzb3IubW92ZVRvRmlyc3QoKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxvbmcgY29udGFjdElkID0gY3Vyc29yLmdldExvbmcoUEhPTkVfTE9PS1VQX0NPTlRBQ1RfSURfQ09MVU1OX0lOREVYKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBTdHJpbmcgbG9va3VwS2V5ID0gY3Vyc29yLmdldFN0cmluZygKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBIT05FX0xPT0tVUF9DT05UQUNUX0xPT0tVUF9LRVlfQ09MVU1OX0lOREVYKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBiaW5kRnJvbUNvbnRhY3RVcmlJbnRlcm5hbChDb250YWN0cy5nZXRMb29rdXBVcmkoY29udGFjdElkLCBsb29rdXBLZXkpLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmFsc2UgLyogZG9uJ3QgcmVzZXQgcXVlcnkgaGFuZGxlciAqLyk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIFN0cmluZyBwaG9uZU51bWJlciA9IChTdHJpbmcpIGNvb2tpZTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXREaXNwbGF5TmFtZShwaG9uZU51bWJlciwgbnVsbCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0U29jaWFsU25pcHBldChudWxsKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXRQaG90byhsb2FkUGxhY2Vob2xkZXJQaG90byhudWxsKSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgbVBob3RvVmlldy5hc3NpZ25Db250YWN0RnJvbVBob25lKHBob25lTnVtYmVyLCB0cnVlKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIGNhc2UgVE9LRU5fRU1BSUxfTE9PS1VQOiB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoY3Vyc29yICE9IG51bGwgJiYgY3Vyc29yLm1vdmVUb0ZpcnN0KCkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBsb25nIGNvbnRhY3RJZCA9IGN1cnNvci5nZXRMb25nKEVNQUlMX0xPT0tVUF9DT05UQUNUX0lEX0NPTFVNTl9JTkRFWCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgU3RyaW5nIGxvb2t1cEtleSA9IGN1cnNvci5nZXRTdHJpbmcoCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBFTUFJTF9MT09LVVBfQ09OVEFDVF9MT09LVVBfS0VZX0NPTFVNTl9JTkRFWCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgYmluZEZyb21Db250YWN0VXJpSW50ZXJuYWwoQ29udGFjdHMuZ2V0TG9va3VwVXJpKGNvbnRhY3RJZCwgbG9va3VwS2V5KSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZhbHNlIC8qIGRvbid0IHJlc2V0IHF1ZXJ5IGhhbmRsZXIgKi8pOwotICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBTdHJpbmcgZW1haWxBZGRyZXNzID0gKFN0cmluZykgY29va2llOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldERpc3BsYXlOYW1lKGVtYWlsQWRkcmVzcywgbnVsbCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0U29jaWFsU25pcHBldChudWxsKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXRQaG90byhsb2FkUGxhY2Vob2xkZXJQaG90byhudWxsKSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgbVBob3RvVmlldy5hc3NpZ25Db250YWN0RnJvbUVtYWlsKGVtYWlsQWRkcmVzcywgdHJ1ZSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0gZmluYWxseSB7Ci0gICAgICAgICAgICAgICAgaWYgKGN1cnNvciAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIGN1cnNvci5jbG9zZSgpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgIH0KLQotICAgIC8qKgotICAgICAqIFR1cm4gb24vb2ZmIHNob3dpbmcgb2YgdGhlIGFnZ3JlZ2F0ZSBiYWRnZSBlbGVtZW50LgotICAgICAqLwotICAgIHB1YmxpYyB2b2lkIHNob3dBZ2dyZWdhdGVCYWRnZShib29sZWFuIHNob3dCYWdkZSkgewotICAgICAgICBtQWdncmVnYXRlQmFkZ2Uuc2V0VmlzaWJpbGl0eShzaG93QmFnZGUgPyBWaWV3LlZJU0lCTEUgOiBWaWV3LkdPTkUpOwotICAgIH0KLQotICAgIC8qKgotICAgICAqIFR1cm4gb24vb2ZmIHNob3dpbmcgb2YgdGhlIHN0YXIgZWxlbWVudC4KLSAgICAgKi8KLSAgICBwdWJsaWMgdm9pZCBzaG93U3Rhcihib29sZWFuIHNob3dTdGFyKSB7Ci0gICAgICAgIG1TdGFycmVkVmlldy5zZXRWaXNpYmlsaXR5KHNob3dTdGFyID8gVmlldy5WSVNJQkxFIDogVmlldy5HT05FKTsKLSAgICB9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Q09OVEFDVF9TVEFUVVNfUkVTX1BBQ0tBR0UpOwotICAgICAgICAgICAgICAgIGludCBsYWJlbFJlc291cmNlID0gYy5nZXRJbnQoQ29udGFjdFF1ZXJ5LkNPTlRBQ1RfU1RBVFVTX0xBQkVMKTsKLSAgICAgICAgICAgICAgICBSZXNvdXJjZXMgcmVzb3VyY2VzOwotICAgICAgICAgICAgICAgIGlmIChUZXh0VXRpbHMuaXNFbXB0eShyZXNQYWNrYWdlKSkgewotICAgICAgICAgICAgICAgICAgICByZXNvdXJjZXMgPSBnZXRSZXNvdXJjZXMoKTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICBQYWNrYWdlTWFuYWdlciBwbSA9IGdldENvbnRleHQoKS5nZXRQYWNrYWdlTWFuYWdlcigpOwotICAgICAgICAgICAgICAgICAgICB0cnkgewotICAgICAgICAgICAgICAgICAgICAgICAgcmVzb3VyY2VzID0gcG0uZ2V0UmVzb3VyY2VzRm9yQXBwbGljYXRpb24ocmVzUGFja2FnZSk7Ci0gICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKE5hbWVOb3RGb3VuZEV4Y2VwdGlvbiBlKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBMb2cudyhUQUcsICJDb250YWN0IHN0YXR1cyB1cGRhdGUgcmVzb3VyY2UgcGFja2FnZSBub3QgZm91bmQ6ICIKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyByZXNQYWNrYWdlKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIHJlc291cmNlcyA9IG51bGw7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICBpZiAocmVzb3VyY2VzICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGxhYmVsID0gcmVzb3VyY2VzLmdldFN0cmluZyhsYWJlbFJlc291cmNlKTsKLSAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoTm90Rm91bmRFeGNlcHRpb24gZSkgewotICAgICAgICAgICAgICAgICAgICAgICAgTG9nLncoVEFHLCAiQ29udGFjdCBzdGF0dXMgdXBkYXRlIHJlc291cmNlIG5vdCBmb3VuZDogIiArIHJlc1BhY2thZ2UgKyAiQCIKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyBsYWJlbFJlc291cmNlKTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgQ2hhclNlcXVlbmNlIGF0dHJpYnV0aW9uOwotICAgICAgICAgICAgaWYgKHRpbWVzdGFtcCAhPSBudWxsICYmIGxhYmVsICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICBhdHRyaWJ1dGlvbiA9IGdldENvbnRleHQoKS5nZXRTdHJpbmcoCi0gICAgICAgICAgICAgICAgICAgICAgICBSLnN0cmluZy5jb250YWN0X3N0YXR1c191cGRhdGVfYXR0cmlidXRpb25fd2l0aF9kYXRlLAotICAgICAgICAgICAgICAgICAgICAgICAgdGltZXN0YW1wLCBsYWJlbCk7Ci0gICAgICAgICAgICB9IGVsc2UgaWYgKHRpbWVzdGFtcCA9PSBudWxsICYmIGxhYmVsICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICBhdHRyaWJ1dGlvbiA9IGdldENvbnRleHQoKS5nZXRTdHJpbmcoCi0gICAgICAgICAgICAgICAgICAgICAgICBSLnN0cmluZy5jb250YWN0X3N0YXR1c191cGRhdGVfYXR0cmlidXRpb24sCi0gICAgICAgICAgICAgICAgICAgICAgICBsYWJlbCk7Ci0gICAgICAgICAgICB9IGVsc2UgaWYgKHRpbWVzdGFtcCAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgYXR0cmlidXRpb24gPSB0aW1lc3RhbXA7Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIGF0dHJpYnV0aW9uID0gbnVsbDsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmIChhdHRyaWJ1dGlvbiAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgbVN0YXR1c0F0dHJpYnV0aW9uVmlldy5zZXRUZXh0KGF0dHJpYnV0aW9uKTsKLSAgICAgICAgICAgICAgICBtU3RhdHVzQXR0cmlidXRpb25WaWV3LnNldFZpc2liaWxpdHkoVmlldy5WSVNJQkxFKTsKLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgbVN0YXR1c0F0dHJpYnV0aW9uVmlldy5zZXRWaXNpYmlsaXR5KFZpZXcuR09ORSk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICBtU3RhdHVzVmlldy5zZXRWaXNpYmlsaXR5KFZpZXcuR09ORSk7Ci0gICAgICAgICAgICBtU3RhdHVzQXR0cmlidXRpb25WaWV3LnNldFZpc2liaWxpdHkoVmlldy5HT05FKTsKLSAgICAgICAgfQotICAgIH0KLQotICAgIHB1YmxpYyB2b2lkIG9uQ2xpY2soVmlldyB2aWV3KSB7Ci0gICAgICAgIHN3aXRjaCAodmlldy5nZXRJZCgpKSB7Ci0gICAgICAgICAgICBjYXNlIFIuaWQuc3RhcjogewotICAgICAgICAgICAgICAgIC8vIFRvZ2dsZSAic3RhcnJlZCIgc3RhdGUKLSAgICAgICAgICAgICAgICAvLyBNYWtlIHN1cmUgdGhlcmUgaXMgYSBjb250YWN0Ci0gICAgICAgICAgICAgICAgaWYgKG1Db250YWN0VXJpICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgZmluYWwgQ29udGVudFZhbHVlcyB2YWx1ZXMgPSBuZXcgQ29udGVudFZhbHVlcygxKTsKLSAgICAgICAgICAgICAgICAgICAgdmFsdWVzLnB1dChDb250YWN0cy5TVEFSUkVELCBtU3RhcnJlZFZpZXcuaXNDaGVja2VkKCkpOwotICAgICAgICAgICAgICAgICAgICBtQ29udGVudFJlc29sdmVyLnVwZGF0ZShtQ29udGFjdFVyaSwgdmFsdWVzLCBudWxsLCBudWxsKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBjYXNlIFIuaWQucGhvdG86IHsKLSAgICAgICAgICAgICAgICBwZXJmb3JtUGhvdG9DbGljaygpOwotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgY2FzZSBSLmlkLm5hbWU6IHsKLSAgICAgICAgICAgICAgICBwZXJmb3JtRGlzcGxheU5hbWVDbGljaygpOwotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgfQotCi0gICAgcHJpdmF0ZSBCaXRtYXAgbG9hZFBsYWNlaG9sZGVyUGhvdG8oQml0bWFwRmFjdG9yeS5PcHRpb25zIG9wdGlvbnMpIHsKLSAgICAgICAgaWYgKG1Ob1Bob3RvUmVzb3VyY2UgPT0gMCkgewotICAgICAgICAgICAgcmV0dXJuIG51bGw7Ci0gICAgICAgIH0KLSAgICAgICAgcmV0dXJuIEJpdG1hcEZhY3RvcnkuZGVjb2RlUmVzb3VyY2UobUNvbnRleHQuZ2V0UmVzb3VyY2VzKCksCi0gICAgICAgICAgICAgICAgbU5vUGhvdG9SZXNvdXJjZSwgb3B0aW9ucyk7Ci0gICAgfQotfQpkaWZmIC0tZ2l0IGEvY29yZS9qYXZhL2NvbS9hbmRyb2lkL2ludGVybmFsL3dpZGdldC9EaWdpdGFsQ2xvY2suamF2YSBiL2NvcmUvamF2YS9jb20vYW5kcm9pZC9pbnRlcm5hbC93aWRnZXQvRGlnaXRhbENsb2NrLmphdmEKaW5kZXggZmE0N2ZmNi4uMjNlMjI3NyAxMDA2NDQKLS0tIGEvY29yZS9qYXZhL2NvbS9hbmRyb2lkL2ludGVybmFsL3dpZGd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LgotICAgICAqLwotICAgIHB1YmxpYyBFZGl0U3R5bGVkVGV4dChDb250ZXh0IGNvbnRleHQsIEF0dHJpYnV0ZVNldCBhdHRycywgaW50IGRlZlN0eWxlKSB7Ci0gICAgICAgIHN1cGVyKGNvbnRleHQsIGF0dHJzLCBkZWZTdHlsZSk7Ci0gICAgICAgIGluaXQoKTsKLSAgICB9Ci0KLSAgICBwdWJsaWMgRWRpdFN0eWxlZFRleHQoQ29udGV4dCBjb250ZXh0LCBBdHRyaWJ1dGVTZXQgYXR0cnMpIHsKLSAgICAgICAgc3VwZXIoY29udGV4dCwgYXR0cnMpOwotICAgICAgICBpbml0KCk7Ci0gICAgfQotCi0gICAgcHVibGljIEVkaXRTdHlsZWRUZXh0KENvbnRleHQgY29udGV4dCkgewotICAgICAgICBzdXBlcihjb250ZXh0KTsKLSAgICAgICAgaW5pdCgpOwotICAgIH0KLQotICAgIC8qKgotICAgICAqIFNldCBOb3RpZmllci4KLSAgICAgKi8KLSAgICBwdWJsaWMgdm9pZCBzZXROb3RpZmllcihFZGl0U3R5bGVkVGV4dE5vdGlmaWVyIGVzdEludGVyZmFjZSkgewotICAgICAgICBtRVNUSW50ZXJmYWNlID0gZXN0SW50ZXJmYWNlOwotICAgIH0KLQotICAgIC8qKgotICAgICAqIFNldCBCdWlsZGVyIGZvciBBbGVydERpYWxvZy4KLSAgICAgKiAKLSAgICAgKiBAcGFyYW0gYnVpbGRlcgotICAgICAqICAgICAgICAgICAgQnVpbGRlciBmb3Igb3BlbmluZyBBbGVydCBEaWFsb2cuCi0gICAgICovCi0gICAgcHVibGljIHZvaWQgc2V0QnVpbGRlcihCdWlsZGVyIGJ1aWxkZXIpIHsKLSAgICAgICAgbURpYWxvZy5zZXRCdWlsZGVyKGJ1aWxkZXIpOwotICAgIH0KLQotICAgIC8qKgotICAgICAqIFNldCBQYXJhbWV0ZXJzIGZvciBDb2xvckFsZXJ0RGlhbG9nLgotICAgICAqIAotICAgICAqIEBwYXJhbSBjb2xv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0UGFyYW1zKENoYXJTZXF1ZW5jZSBzaXpldGl0bGUsCi0gICAgICAgICAgICBDaGFyU2VxdWVuY2VbXSBzaXplbmFtZXMsIENoYXJTZXF1ZW5jZVtdIHNpemVkaXNwbGF5aW50cywKLSAgICAgICAgICAgIENoYXJTZXF1ZW5jZVtdIHNpemVzZW5kaW50cykgewotICAgICAgICBtRGlhbG9nLnNldFNpemVBbGVydFBhcmFtcyhzaXpldGl0bGUsIHNpemVuYW1lcywgc2l6ZWRpc3BsYXlpbnRzLAotICAgICAgICAgICAgICAgIHNpemVzZW5kaW50cyk7Ci0gICAgfQotCi0gICAgcHVibGljIHZvaWQgc2V0QWxpZ25BbGVydFBhcmFtcyhDaGFyU2VxdWVuY2UgYWxpZ250aXRsZSwKLSAgICAgICAgICAgIENoYXJTZXF1ZW5jZVtdIGFsaWdubmFtZXMpIHsKLSAgICAgICAgbURpYWxvZy5zZXRBbGlnbkFsZXJ0UGFyYW1zKGFsaWdudGl0bGUsIGFsaWdubmFtZXMpOwotICAgIH0KLQotICAgIEBPdmVycmlkZQotICAgIHB1YmxpYyBib29sZWFuIG9uVG91Y2hFdmVudChNb3Rpb25FdmVudCBldmVudCkgewotICAgICAgICBpZiAobU1hbmFnZXIuaXNTb2Z0S2V5QmxvY2tlZCgpICYmCi0gICAgICAgICAgICAgICAgZXZlbnQuZ2V0QWN0aW9uKCkgPT0gTW90aW9uRXZlbnQuQUNUSU9OX1VQKSB7Ci0gICAgICAgICAgICBjYW5jZWxMb25nUHJlc3MoKTsKLSAgICAgICAgfQotICAgICAgICBmaW5hbCBib29sZWFuIHN1cGVyUmVzdWx0ID0gc3VwZXIub25Ub3VjaEV2ZW50KGV2ZW50KTsKLSAgICAgICAgaWYgKGV2ZW50LmdldEFjdGlvbigpID09IE1vdGlvbkV2ZW50LkFDVElPTl9VUCkgewotICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgIExvZy5kKExPR19UQUcsICItLS0gb25Ub3VjaEV2Z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RlbS4KLSAgICAgKi8KLSAgICBwdWJsaWMgdm9pZCBzZXRJdGVtU2l6ZShpbnQgc2l6ZSkgewotICAgICAgICBtTWFuYWdlci5zZXRJdGVtU2l6ZShzaXplKTsKLSAgICB9Ci0KLSAgICAvKioKLSAgICAgKiBTZXQgQ29sb3Igb2YgdGhlIEl0ZW0uCi0gICAgICogCi0gICAgICogQHBhcmFtIGNvbG9yCi0gICAgICogICAgICAgICAgICBUaGUgY29sb3Igb2YgdGhlIEl0ZW0uCi0gICAgICovCi0gICAgcHVibGljIHZvaWQgc2V0SXRlbUNvbG9yKGludCBjb2xvcikgewotICAgICAgICBtTWFuYWdlci5zZXRJdGVtQ29sb3IoY29sb3IpOwotICAgIH0KLQotICAgIC8qKgotICAgICAqIFNldCBBbGlnbm1lbnQgb2YgdGhlIEl0ZW0uCi0gICAgICogCi0gICAgICogQHBhcmFtIGNvbG9yCi0gICAgICogICAgICAgICAgICBUaGUgY29sb3Igb2YgdGhlIEl0ZW0uCi0gICAgICovCi0gICAgcHVibGljIHZvaWQgc2V0QWxpZ25tZW50KExheW91dC5BbGlnbm1lbnQgYWxpZ24pIHsKLSAgICAgICAgbU1hbmFnZXIuc2V0QWxpZ25tZW50KGFsaWduKTsKLSAgICB9Ci0KLSAgICAvKioKLSAgICAgKiBTZXQgQmFja2dyb3VuZCBjb2xvciBvZiBWaWV3LgotICAgICAqIAotICAgICAqIEBwYXJhbSBjb2xvcgotICAgICAqICAgICAgICAgICAgVGhlIGJhY2tncm91bmQgY29sb3Igb2Ygdmlldy4KLSAgICAgKi8KLSAgICBAT3ZlcnJpZGUKLSAgICBwdWJsaWMgdm9pZCBzZXRCYWNrZ3JvdW5kQ29sb3IoaW50IGNvbG9yKSB7Ci0gICAgICAgIHN1cGVyLnNldEJhY2tncm91bmRDb2xvcihjb2xvcik7Ci0gICAgICAgIG1CYWNrZ3JvdW5kQ29sb3IgPSBjb2xvcjsKLSAgICB9Ci0KLSAgICAvKioKLSAgICAgKiBTZXQ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SAgICAgKi8KLSAgICBwdWJsaWMgU3RyaW5nIGdldEh0bWwoKSB7Ci0gICAgICAgIHJldHVybiBtQ29udmVydGVyLmdldEh0bWwoKTsKLSAgICB9Ci0KLSAgICAvKioKLSAgICAgKiBHZXQgdGhlIHN0YXRlIG9mIHRoZSBzZWxlY3Rpb24uCi0gICAgICogCi0gICAgICogQHBhcmFtIHVyaXMKLSAgICAgKiAgICAgICAgICAgIFRoZSBhcnJheSBvZiB1c2VkIHVyaXMuCi0gICAgICogQHJldHVybiBUaGUgc3RhdGUgb2YgdGhlIHNlbGVjdGlvbi4KLSAgICAgKi8KLSAgICBwdWJsaWMgU3RyaW5nIGdldEh0bWwoQXJyYXlMaXN0PFVyaT4gdXJpcykgewotICAgICAgICBtQ29udmVydGVyLmdldFVyaUFycmF5KHVyaXMsIGdldFRleHQoKSk7Ci0gICAgICAgIHJldHVybiBtQ29udmVydGVyLmdldEh0bWwoKTsKLSAgICB9Ci0KLSAgICAvKioKLSAgICAgKiBHZXQgQmFja2dyb3VuZCBjb2xvciBvZiBWaWV3LgotICAgICAqIAotICAgICAqIEByZXR1cm4gVGhlIGJhY2tncm91bmQgY29sb3Igb2YgVmlldy4KLSAgICAgKi8KLSAgICBwdWJsaWMgaW50IGdldEJhY2tncm91bmRDb2xvcigpIHsKLSAgICAgICAgcmV0dXJuIG1CYWNrZ3JvdW5kQ29sb3I7Ci0gICAgfQotCi0gICAgLyoqCi0gICAgICogR2V0IEZvcmVncm91bmQgY29sb3Igb2YgVmlldy4KLSAgICAgKiAKLSAgICAgKiBAcmV0dXJuIFRoZSBiYWNrZ3JvdW5kIGNvbG9yIG9mIFZpZXcuCi0gICAgICovCi0gICAgcHVibGljIGludCBnZXRGb3JlR3JvdW5kQ29sb3IoaW50IHBvcykgewotICAgICAgICBpZiAoREJHKSB7Ci0gICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tZ2V0Rm9yZUdyb3VuZENvbG9yOiAiICsgcG9zKTsKLSAgICAgIC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PSBuZXcgU3R5bGVkVGV4dENvbnZlcnRlcih0aGlzKTsKLSAgICAgICAgbURpYWxvZyA9IG5ldyBTdHlsZWRUZXh0RGlhbG9nKHRoaXMpOwotICAgICAgICBzZXRNb3ZlbWVudE1ldGhvZChuZXcgU3R5bGVkVGV4dEFycm93S2V5TWV0aG9kKG1NYW5hZ2VyKSk7Ci0gICAgICAgIG1NYW5hZ2VyLmJsb2NrU29mdEtleSgpOwotICAgICAgICBtTWFuYWdlci51bmJsb2NrU29mdEtleSgpOwotICAgIH0KLQotICAgIC8qKgotICAgICAqIFNob3cgRm9yZWdyb3VuZCBDb2xvciBTZWxlY3RpbmcgRGlhbG9nLgotICAgICAqLwotICAgIHByaXZhdGUgdm9pZCBvblNob3dGb3JlZ3JvdW5kQ29sb3JBbGVydCgpIHsKLSAgICAgICAgbURpYWxvZy5vblNob3dGb3JlZ3JvdW5kQ29sb3JBbGVydERpYWxvZygpOwotICAgIH0KLQotICAgIC8qKgotICAgICAqIFNob3cgQmFja2dyb3VuZCBDb2xvciBTZWxlY3RpbmcgRGlhbG9nLgotICAgICAqLwotICAgIHByaXZhdGUgdm9pZCBvblNob3dCYWNrZ3JvdW5kQ29sb3JBbGVydCgpIHsKLSAgICAgICAgbURpYWxvZy5vblNob3dCYWNrZ3JvdW5kQ29sb3JBbGVydERpYWxvZygpOwotICAgIH0KLQotICAgIC8qKgotICAgICAqIFNob3cgU2l6ZSBTZWxlY3RpbmcgRGlhbG9nLgotICAgICAqLwotICAgIHByaXZhdGUgdm9pZCBvblNob3dTaXplQWxlcnQoKSB7Ci0gICAgICAgIG1EaWFsb2cub25TaG93U2l6ZUFsZXJ0RGlhbG9nKCk7Ci0gICAgfQotCi0gICAgLyoqCi0gICAgICogU2hvdyBBbGlnbm1lbnQgU2VsZWN0aW5nIERpYWxvZy4KLSAgICAgKi8KLSAgICBwcml2YXRlIHZvaWQgb25TaG93QWxpZ25BbGVydCgpIHsKLSAgICAgICAgbURpYWxvZy5vblNob3dBb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vdGlmeVN0YXRlQ2hhbmdlZChtTW9kZSwgbVN0YXRlKTsKLSAgICAgICAgfQotCi0gICAgICAgIHB1YmxpYyB2b2lkIG9uU3RhcnRDb3B5KCkgewotICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgIExvZy5kKExPR19UQUcsICItLS0gb25TdGFydENvcHkiKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGhhbmRsZUNvcHkoKTsKLSAgICAgICAgICAgIG1FU1Qubm90aWZ5U3RhdGVDaGFuZ2VkKG1Nb2RlLCBtU3RhdGUpOwotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIHZvaWQgb25TdGFydEN1dCgpIHsKLSAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIG9uU3RhcnRDdXQiKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGhhbmRsZUN1dCgpOwotICAgICAgICAgICAgbUVTVC5ub3RpZnlTdGF0ZUNoYW5nZWQobU1vZGUsIG1TdGF0ZSk7Ci0gICAgICAgIH0KLQotICAgICAgICBwdWJsaWMgdm9pZCBvblN0YXJ0UGFzdGUoKSB7Ci0gICAgICAgICAgICBpZiAoREJHKSB7Ci0gICAgICAgICAgICAgICAgTG9nLmQoTE9HX1RBRywgIi0tLSBvblN0YXJ0UGFzdGUiKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGhhbmRsZVBhc3RlKCk7Ci0gICAgICAgICAgICBtRVNULm5vdGlmeVN0YXRlQ2hhbmdlZChtTW9kZSwgbVN0YXRlKTsKLSAgICAgICAgfQotCi0gICAgICAgIHB1YmxpYyB2b2lkIG9uU3RhcnRTaXplKCkgewotICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgIExvZy5kKExPR19UQUcsICItLS0gb25TdGFydFNpemUiKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGhhbmRsZVNpemUoKTsKLSAgICAgICAgICAgIG1FU1Qubm90aWZ5U3RhdGVDaGFuZ2VkKG1Nb2RlLCBtU3RhdGUpOwotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIHZvaWQgb25TdGFydEFsaWduKCkgewotICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgIExvZy5kKExPR19UQUcsICItLS0gb25TdGFydEFsaWduUmlnaHQiKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGhhbmRsZUFsaWduKCk7Ci0gICAgICAgICAgICBtRVNULm5vdGlmeVN0YXRlQ2hhbmdlZChtTW9kZSwgbVN0YXRlKTsKLSAgICAgICAgfQotCi0gICAgICAgIHB1YmxpYyB2b2lkIG9uU3RhcnRDb2xvcigpIHsKLSAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIG9uQ2xpY2tDb2xvciIpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaGFuZGxlQ29sb3IoKTsKLSAgICAgICAgICAgIG1FU1Qubm90aWZ5U3RhdGVDaGFuZ2VkKG1Nb2RlLCBtU3RhdGUpOwotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIHZvaWQgb25TdGFydEJhY2tncm91bmRDb2xvcigpIHsKLSAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIG9uQ2xpY2tDb2xvciIpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgbUVTVC5vblNob3dCYWNrZ3JvdW5kQ29sb3JBbGVydCgpOwotICAgICAgICAgICAgbUVTVC5ub3RpZnlTdGF0ZUNoYW5nZWQobU1vZGUsIG1TdGF0ZSk7Ci0gICAgICAgIH0KLQotICAgICAgICBwdWJsaWMgdm9pZCBvblN0YXJ0U2VsZWN0KCkgewotICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgIExvZy5kKExPR19UQUcsICItLS0gb25DbGlja1NlbGVjdCIpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgbU1vZGUgPSBNT0RFX1NFTEVDVDsKLSAgICAgICAgICAgIGlmIChtU3RhdGUgPT0gU1RBVEVfU0VMRUNUX09GRikgewotICAgICAgICAgICAgICAgIGhhbmRsZVNlbGVjdCgpOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICB1bnNldFNlbGVjdCgpOwotICAgICAgICAgICAgICAgIGhhbmRsZVNlbGVjdCgpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgbUVTVC5ub3RpZnlTdGF0ZUNoYW5nZWQobU1vZGUsIG1TdGF0ZSk7Ci0gICAgICAgIH0KLQotICAgICAgICBwdWJsaWMgdm9pZCBvbkN1cnNvck1vdmVkKCkgewotICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgIExvZy5kKExPR19UQUcsICItLS0gb25DbGlja1ZpZXciKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmIChtU3RhdGUgPT0gU1RBVEVfU0VMRUNUX09OIHx8IG1TdGF0ZSA9PSBTVEFURV9TRUxFQ1RFRCkgewotICAgICAgICAgICAgICAgIGhhbmRsZVNlbGVjdCgpOwotICAgICAgICAgICAgICAgIG1FU1Qubm90aWZ5U3RhdGVDaGFuZ2VkKG1Nb2RlLCBtU3RhdGUpOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIHZvaWQgb25TdGFydFNlbGVjdEFsbCgpIHsKLSAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIG9uQ2xpY2tTZWxlY3RBbGwiKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGhhbmRsZVNlbGVjdEFsbCgpOwotICAgICAgICAgICAgbUVTVC5ub3RpZnlTdGF0ZUNoYW5nZWQobU1vZGUsIG1TdGF0ZSk7Ci0gICAgICAgIH0KLQotICAgICAgICBwdWJsaWMgdm9pZCBvbkZpeFNlbGVjdGVkSXRlbSgpIHsKLSAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIG9uQ2xpY2tDb21wbGV0ZSIpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaGFuZGxlQ29tcGxldGUoKTsKLSAgICAgICAgICAgIG1FU1Qubm90aWZ5U3RhdGVDaGFuZ2VkKG1Nb2RlLCBtU3RhdGUpOwotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIHZvaWQgb25JbnNlcnRJbWFnZShVcmkgdXJpKSB7Ci0gICAgICAgICAgICBpZiAoREJHKSB7Ci0gICAgICAgICAgICAgICAgTG9nLmQoTE9HX1RBRywgIi0tLSBvbkluc2VydEltYWdlIGJ5IFVSSTogIiArIHVyaS5nZXRQYXRoKCkKLSAgICAgICAgICAgICAgICAgICAgICAgICsgIiwiICsgdXJpLnRvU3RyaW5nKCkpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaW5zZXJ0SW1hZ2VTcGFuKG5ldyBJbWFnZVNwYW4obUVTVC5nZXRDb250ZXh0KCksIHVyaSkpOwotICAgICAgICAgICAgbUVTVC5ub3RpZnlTdGF0ZUNoYW5nZWQobU1vZGUsIG1TdGF0ZSk7Ci0gICAgICAgIH0KLQotICAgICAgICBwdWJsaWMgdm9pZCBvbkluc2VydEltYWdlKGludCByZXNJRCkgewotICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgIExvZy5kKExPR19UQUcsICItLS0gb25JbnNlcnRJbWFnZSBieSByZXNJRCIpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaW5zZXJ0SW1hZ2VTcGFuKG5ldyBJbWFnZVNwYW4obUVTVC5nZXRDb250ZXh0KCksIHJlc0lEKSk7Ci0gICAgICAgICAgICBtRVNULm5vdGlmeVN0YXRlQ2hhbmdlZChtTW9kZSwgbVN0YXRlKTsKLSAgICAgICAgfQotCi0gICAgICAgIHB1YmxpYyB2b2lkIG9uSW5zZXJ0SG9yaXpvbnRhbExpbmUoKSB7Ci0gICAgICAgICAgICBpZiAoREJHKSB7Ci0gICAgICAgICAgICAgICAgTG9nLmQoTE9HX1RBRywgIi0tLSBvbkluc2VydEhvcml6b250YWxMaW5lOiIpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaW5zZXJ0SW1hZ2VTcGFuKG5ldyBIb3Jpem9udGFsTGluZVNwYW4oMHhGRjAwMDAwMCwgbUVTVCkpOwotICAgICAgICAgICAgbUVTVC5ub3RpZnlTdGF0ZUNoYW5nZWQobU1vZGUsIG1TdGF0ZSk7Ci0gICAgICAgIH0KLQotICAgICAgICBwdWJsaWMgdm9pZCBvbkNsZWFyU3R5bGVzKCkgewotICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgIExvZy5kKExPR19UQUcsICItLS0gb25DbGVhclN0eWxlcyIpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgRWRpdGFibGUgdHh0ID0gbUVTVC5nZXRUZXh0KCk7Ci0gICAgICAgICAgICBpbnQgbGVuID0gdHh0Lmxlbmd0aCgpOwotICAgICAgICAgICAgT2JqZWN0W10gc3R5bGVzID0gdHh0LmdldFNwYW5zKDAsIGxlbiwgT2JqZWN0LmNsYXNzKTsKLSAgICAgICAgICAgIGZvciAoT2JqZWN0IHN0eWxlIDogc3R5bGVzKSB7Ci0gICAgICAgICAgICAgICAgaWYgKHN0eWxlIGluc3RhbmNlb2YgUGFyYWdyYXBoU3R5bGUgfHwKLSAgICAgICAgICAgICAgICAgICAgICAgIHN0eWxlIGluc3RhbmNlb2YgUXVvdGVTcGFuIHx8Ci0gICAgICAgICAgICAgICAgICAgICAgICBzdHlsZSBpbnN0YW5jZW9mIENoYXJhY3RlclN0eWxlKSB7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChzdHlsZSBpbnN0YW5jZW9mIEltYWdlU3BhbikgewotICAgICAgICAgICAgICAgICAgICAgICAgaW50IHN0YXJ0ID0gdHh0LmdldFNwYW5TdGFydChzdHlsZSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpbnQgZW5kID0gdHh0LmdldFNwYW5FbmQoc3R5bGUpOwotICAgICAgICAgICAgICAgICAgICAgICAgdHh0LnJlcGxhY2Uoc3RhcnQsIGVuZCwgIiIpOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIHR4dC5yZW1vdmVTcGFuKHN0eWxlKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBtRVNULnNldEJhY2tncm91bmREcmF3YWJsZShtRVNULm1EZWZhdWx0QmFja2dyb3VuZCk7Ci0gICAgICAgICAgICBtRVNULm1CYWNrZ3JvdW5kQ29sb3IgPSBERUZBVUxUX0JBQ0tHUk9VTkRfQ09MT1I7Ci0gICAgICAgIH0KLQotICAgICAgICBwdWJsaWMgdm9pZCBzZXRJdGVtU2l6ZShpbnQgc2l6ZSkgewotICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgIExvZy5kKExPR19UQUcsICItLS0gb25DbGlja1NpemVJdGVtIik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAobVN0YXRlID09IFNUQVRFX1NFTEVDVEVEIHx8IG1TdGF0ZSA9PSBTVEFURV9TRUxFQ1RfRklYKSB7Ci0gICAgICAgICAgICAgICAgY2hhbmdlU2l6ZVNlbGVjdGVkVGV4dChzaXplKTsKLSAgICAgICAgICAgICAgICBoYW5kbGVSZXNldEVkaXQoKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCi0gICAgICAgIHB1YmxpYyB2b2lkIHNldEl0ZW1Db2xvcihpbnQgY29sb3IpIHsKLSAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIG9uQ2xpY2tDb2xvckl0ZW0iKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmIChtU3RhdGUgPT0gU1RBVEVfU0VMRUNURUQgfHwgbVN0YXRlID09IFNUQVRFX1NFTEVDVF9GSVgpIHsKLSAgICAgICAgICAgICAgICBjaGFuZ2VDb2xvclNlbGVjdGVkVGV4dChjb2xvcik7Ci0gICAgICAgICAgICAgICAgaGFuZGxlUmVzZXRFZGl0KCk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQotICAgICAgICBwdWJsaWMgdm9pZCBzZXRBbGlnbm1lbnQoTGF5b3V0LkFsaWdubWVudCBhbGlnbikgewotICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgIExvZy5kKExPR19UQUcsICItLS0gb25DbGlja0NvbG9ySXRlbSIpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKG1TdGF0ZSA9PSBTVEFURV9TRUxFQ1RFRCB8fCBtU3RhdGUgPT0gU1RBVEVfU0VMRUNUX0ZJWCkgewotICAgICAgICAgICAgICAgIGNoYW5nZUFsaWduKGFsaWduKTsKLSAgICAgICAgICAgICAgICBoYW5kbGVSZXNldEVkaXQoKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCi0gICAgICAgIHB1YmxpYyBib29sZWFuIGlzRWRpdHRpbmcoKSB7Ci0gICAgICAgICAgICByZXR1cm4gbUVkaXRGbGFnOwotICAgICAgICB9Ci0KLSAgICAgICAgLyogSWYgdGhlIHN0eWxlIG9mIHRoZSBzcGFuIGlzIGFkZGVkLCBhZGQgY2hlY2sgY2FzZSBmb3IgdGhhdCBzdHlsZSAqLwotICAgICAgICBwdWJsaWMgYm9vbGVhbiBpc1N0eWxlZFRleHQoKSB7Ci0gICAgICAgICAgICBFZGl0YWJsZSB0eHQgPSBtRVNULmdldFRleHQoKTsKLSAgICAgICAgICAgIGludCBsZW4gPSB0eHQubGVuZ3RoKCk7Ci0gICAgICAgICAgICBpZiAodHh0LmdldFNwYW5zKDAsIGxlbiAtMSwgUGFyYWdyYXBoU3R5bGUuY2xhc3MpLmxlbmd0aCA+IDAgfHwKLSAgICAgICAgICAgICAgICAgICAgdHh0LmdldFNwYW5zKDAsIGxlbiAtMSwgUXVvdGVTcGFuLmNsYXNzKS5sZW5ndGggPiAwIHx8Ci0gICAgICAgICAgICAgICAgICAgIHR4dC5nZXRTcGFucygwLCBsZW4gLTEsIENoYXJhY3RlclN0eWxlLmNsYXNzKS5sZW5ndGggPiAwIHx8Ci0gICAgICAgICAgICAgICAgICAgIG1FU1QubUJhY2tncm91bmRDb2xvciAhPSBERUZBVUxUX0JBQ0tHUk9VTkRfQ09MT1IpIHsKLSAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHJldHVybiBmYWxzZTsKLSAgICAgICAgfQotCi0gICAgICAgIHB1YmxpYyBib29sZWFuIGlzU29mdEtleUJsb2NrZWQoKSB7Ci0gICAgICAgICAgICByZXR1cm4gbVNvZnRLZXlCbG9ja0ZsYWc7Ci0gICAgICAgIH0KLQotICAgICAgICBwdWJsaWMgaW50IGdldEVkaXRNb2RlKCkgewotICAgICAgICAgICAgcmV0dXJuIG1Nb2RlOwotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIGludCBnZXRTZWxlY3RTdGF0ZSgpIHsKLSAgICAgICAgICAgIHJldHVybiBtU3RhdGU7Ci0gICAgICAgIH0KLQotICAgICAgICBwdWJsaWMgaW50IGdldFNlbGVjdGlvblN0YXJ0KCkgewotICAgICAgICAgICAgcmV0dXJuIG1DdXJTdGFydDsKLSAgICAgICAgfQotCi0gICAgICAgIHB1YmxpYyBpbnQgZ2V0U2VsZWN0aW9uRW5kKCkgewotICAgICAgICAgICAgcmV0dXJuIG1DdXJFbmQ7Ci0gICAgICAgIH0KLQotICAgICAgICBwcml2YXRlIHZvaWQgZG9OZXh0SGFuZGxlKCkgewotICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgIExvZy5kKExPR19UQUcsICItLS0gZG9OZXh0SGFuZGxlOiAiICsgbU1vZGUgKyAiLCIgKyBtU3RhdGUpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgc3dpdGNoIChtTW9kZSkgewotICAgICAgICAgICAgY2FzZSBNT0RFX0NPUFk6Ci0gICAgICAgICAgICAgICAgaGFuZGxlQ29weSgpOwotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgY2FzZSBNT0RFX0NVVDoKLSAgICAgICAgICAgICAgICBoYW5kbGVDdXQoKTsKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIGNhc2UgTU9ERV9QQVNURToKLSAgICAgICAgICAgICAgICBoYW5kbGVQYXN0ZSgpOwotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgY2FzZSBNT0RFX1NJWkU6Ci0gICAgICAgICAgICAgICAgaGFuZGxlU2l6ZSgpOwotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgY2FzZSBNT0RFX0NPTE9SOgotICAgICAgICAgICAgICAgIGhhbmRsZUNvbG9yKCk7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICBjYXNlIE1PREVfQUxJR046Ci0gICAgICAgICAgICAgICAgaGFuZGxlQWxpZ24oKTsKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIGRlZmF1bHQ6Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQotICAgICAgICBwcml2YXRlIHZvaWQgaGFuZGxlQ2FuY2VsKCkgewotICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgIExvZy5kKExPR19UQUcsICItLS0gaGFuZGxlQ2FuY2VsIik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBtTW9kZSA9IE1PREVfTk9USElORzsKLSAgICAgICAgICAgIG1TdGF0ZSA9IFNUQVRFX1NFTEVDVF9PRkY7Ci0gICAgICAgICAgICBtRWRpdEZsYWcgPSBmYWxzZTsKLSAgICAgICAgICAgIExvZy5kKExPR19UQUcsICItLS0gaGFuZGxlQ2FuY2VsOiIgKyBtRVNULmdldElucHV0VHlwZSgpKTsKLSAgICAgICAgICAgIHVuYmxvY2tTb2Z0S2V5KCk7Ci0gICAgICAgICAgICB1bnNldFNlbGVjdCgpOwotICAgICAgICB9Ci0KLSAgICAgICAgcHJpdmF0ZSB2b2lkIGhhbmRsZUNvbXBsZXRlKCkgewotICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgIExvZy5kKExPR19UQUcsICItLS0gaGFuZGxlQ29tcGxldGUiKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmICghbUVkaXRGbGFnKSB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKG1TdGF0ZSA9PSBTVEFURV9TRUxFQ1RFRCkgewotICAgICAgICAgICAgICAgIG1TdGF0ZSA9IFNUQVRFX1NFTEVDVF9GSVg7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBkb05leHRIYW5kbGUoKTsKLSAgICAgICAgfQotCi0gICAgICAgIHByaXZhdGUgdm9pZCBoYW5kbGVUZXh0Vmlld0Z1bmMoaW50IG1vZGUsIGludCBpZCkgewotICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgIExvZy5kKExPR19UQUcsICItLS0gaGFuZGxlVGV4dFZpZXc6ICIgKyBtTW9kZSArICIsIiArIG1TdGF0ZSArCi0gICAgICAgICAgICAgICAgICAgICAgICAiLCIgKyBpZCk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAoIW1FZGl0RmxhZykgewotICAgICAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmIChtTW9kZSA9PSBNT0RFX05PVEhJTkcgfHwgbU1vZGUgPT0gTU9ERV9TRUxFQ1QpIHsKLSAgICAgICAgICAgICAgICBtTW9kZSA9IG1vZGU7Ci0gICAgICAgICAgICAgICAgaWYgKG1TdGF0ZSA9PSBTVEFURV9TRUxFQ1RFRCkgewotICAgICAgICAgICAgICAgICAgICBtU3RhdGUgPSBTVEFURV9TRUxFQ1RfRklYOwotICAgICAgICAgICAgICAgICAgICBoYW5kbGVUZXh0Vmlld0Z1bmMobW9kZSwgaWQpOwotICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIGhhbmRsZVNlbGVjdCgpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0gZWxzZSBpZiAobU1vZGUgIT0gbW9kZSkgewotICAgICAgICAgICAgICAgIGhhbmRsZUNhbmNlbCgpOwotICAgICAgICAgICAgICAgIG1Nb2RlID0gbW9kZTsKLSAgICAgICAgICAgICAgICBoYW5kbGVUZXh0Vmlld0Z1bmMobW9kZSwgaWQpOwotICAgICAgICAgICAgfSBlbHNlIGlmIChtU3RhdGUgPT0gU1RBVEVfU0VMRUNUX0ZJWCkgewotICAgICAgICAgICAgICAgIG1FU1Qub25UZXh0Q29udGV4dE1lbnVJdGVtKGlkKTsKLSAgICAgICAgICAgICAgICBoYW5kbGVSZXNldEVkaXQoKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCi0gICAgICAgIHByaXZhdGUgdm9pZCBoYW5kbGVDb3B5KCkgewotICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgIExvZy5kKExPR19UQUcsICItLS0gaGFuZGxlQ29weTogIiArIG1Nb2RlICsgIiwiICsgbVN0YXRlKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGhhbmRsZVRleHRWaWV3RnVuYyhNT0RFX0NPUFksIGFuZHJvaWQuUi5pZC5jb3B5KTsKLSAgICAgICAgfQotCi0gICAgICAgIHByaXZhdGUgdm9pZCBoYW5kbGVDdXQoKSB7Ci0gICAgICAgICAgICBpZiAoREJHKSB7Ci0gICAgICAgICAgICAgICAgTG9nLmQoTE9HX1RBRywgIi0tLSBoYW5kbGVDb3B5OiAiICsgbU1vZGUgKyAiLCIgKyBtU3RhdGUpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaGFuZGxlVGV4dFZpZXdGdW5jKE1PREVfQ1VULCBhbmRyb2lkLlIuaWQuY3V0KTsKLSAgICAgICAgfQotCi0gICAgICAgIHByaXZhdGUgdm9pZCBoYW5kbGVQYXN0ZSgpIHsKLSAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIGhhbmRsZVBhc3RlIik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAoIW1FZGl0RmxhZykgewotICAgICAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIG1FU1Qub25UZXh0Q29udGV4dE1lbnVJdGVtKGFuZHJvaWQuUi5pZC5wYXN0ZSk7Ci0gICAgICAgIH0KLQotICAgICAgICBwcml2YXRlIHZvaWQgaGFuZGxlU2V0U3BhbihpbnQgbW9kZSkgewotICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgIExvZy5kKExPR19UQUcsICItLS0gaGFuZGxlU2V0U3BhbjoiICsgbUVkaXRGbGFnICsgIiwiCi0gICAgICAgICAgICAgICAgICAgICAgICArIG1TdGF0ZSArICcsJyArIG1Nb2RlKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmICghbUVkaXRGbGFnKSB7Ci0gICAgICAgICAgICAgICAgTG9nLmUoTE9HX1RBRywgIi0tLSBoYW5kbGVTZXRTcGFuOiBFZGl0aW5nIGlzIG5vdCBzdGFydGVkLiIpOwotICAgICAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmIChtTW9kZSA9PSBNT0RFX05PVEhJTkcgfHwgbU1vZGUgPT0gTU9ERV9TRUxFQ1QpIHsKLSAgICAgICAgICAgICAgICBtTW9kZSA9IG1vZGU7Ci0gICAgICAgICAgICAgICAgaWYgKG1TdGF0ZSA9PSBTVEFURV9TRUxFQ1RFRCkgewotICAgICAgICAgICAgICAgICAgICBtU3RhdGUgPSBTVEFURV9TRUxFQ1RfRklYOwotICAgICAgICAgICAgICAgICAgICBoYW5kbGVTZXRTcGFuKG1vZGUpOwotICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIGhhbmRsZVNlbGVjdCgpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0gZWxzZSBpZiAobU1vZGUgIT0gbW9kZSkgewotICAgICAgICAgICAgICAgIGhhbmRsZUNhbmNlbCgpOwotICAgICAgICAgICAgICAgIG1Nb2RlID0gbW9kZTsKLSAgICAgICAgICAgICAgICBoYW5kbGVTZXRTcGFuKG1vZGUpOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBpZiAobVN0YXRlID09IFNUQVRFX1NFTEVDVF9GSVgpIHsKLSAgICAgICAgICAgICAgICAgICAgbUVTVC5zZXRIaW50TWVzc2FnZShISU5UX01TR19OVUxMKTsKLSAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChtb2RlKSB7Ci0gICAgICAgICAgICAgICAgICAgIGNhc2UgTU9ERV9DT0xPUjoKLSAgICAgICAgICAgICAgICAgICAgICAgIG1FU1Qub25TaG93Rm9yZWdyb3VuZENvbG9yQWxlcnQoKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgICAgICBjYXNlIE1PREVfU0laRToKLSAgICAgICAgICAgICAgICAgICAgICAgIG1FU1Qub25TaG93U2l6ZUFsZXJ0KCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICAgICAgY2FzZSBNT0RFX0FMSUdOOgotICAgICAgICAgICAgICAgICAgICAgICAgbUVTVC5vblNob3dBbGlnbkFsZXJ0KCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKLSAgICAgICAgICAgICAgICAgICAgICAgIExvZy5lKExPR19UQUcsICItLS0gaGFuZGxlU2V0U3BhbjogaW52YWxpZCBtb2RlLiIpOwotICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIGhhbmRsZVNldFNwYW46IGRvIG5vdGhpbmcuIik7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgcHJpdmF0ZSB2b2lkIGhhbmRsZVNpemUoKSB7Ci0gICAgICAgICAgICBoYW5kbGVTZXRTcGFuKE1PREVfU0laRSk7Ci0gICAgICAgIH0KLQotICAgICAgICBwcml2YXRlIHZvaWQgaGFuZGxlQ29sb3IoKSB7Ci0gICAgICAgICAgICBoYW5kbGVTZXRTcGFuKE1PREVfQ09MT1IpOwotICAgICAgICB9Ci0KLSAgICAgICAgcHJpdmF0ZSB2b2lkIGhhbmRsZUFsaWduKCkgewotICAgICAgICAgICAgaGFuZGxlU2V0U3BhbihNT0RFX0FMSUdOKTsKLSAgICAgICAgfQotCi0gICAgICAgIHByaXZhdGUgdm9pZCBoYW5kbGVTZWxlY3QoKSB7Ci0gICAgICAgICAgICBpZiAoREJHKSB7Ci0gICAgICAgICAgICAgICAgTG9nLmQoTE9HX1RBRywgIi0tLSBoYW5kbGVTZWxlY3Q6IiArIG1FZGl0RmxhZyArICIsIiArIG1TdGF0ZSk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAoIW1FZGl0RmxhZykgewotICAgICAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmIChtU3RhdGUgPT0gU1RBVEVfU0VMRUNUX09GRikgewotICAgICAgICAgICAgICAgIGlmIChpc1RleHRTZWxlY3RlZCgpKSB7Ci0gICAgICAgICAgICAgICAgICAgIExvZy5lKExPR19UQUcsICJTZWxlY3Rpb24gaXMgb2ZmLCBidXQgc2VsZWN0ZWQiKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgc2V0U2VsZWN0U3RhcnRQb3MoKTsKLSAgICAgICAgICAgICAgICBibG9ja1NvZnRLZXkoKTsKLSAgICAgICAgICAgICAgICBtRVNULnNldEhpbnRNZXNzYWdlKEhJTlRfTVNHX1NFTEVDVF9FTkQpOwotICAgICAgICAgICAgfSBlbHNlIGlmIChtU3RhdGUgPT0gU1RBVEVfU0VMRUNUX09OKSB7Ci0gICAgICAgICAgICAgICAgaWYgKGlzVGV4dFNlbGVjdGVkKCkpIHsKLSAgICAgICAgICAgICAgICAgICAgTG9nLmUoTE9HX1RBRywgIlNlbGVjdGlvbiBub3cgc3RhcnQsIGJ1dCBzZWxlY3RlZCIpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBzZXRTZWxlY3RlZEVuZFBvcygpOwotICAgICAgICAgICAgICAgIG1FU1Quc2V0SGludE1lc3NhZ2UoSElOVF9NU0dfUFVTSF9DT01QRVRFKTsKLSAgICAgICAgICAgICAgICBkb05leHRIYW5kbGUoKTsKLSAgICAgICAgICAgIH0gZWxzZSBpZiAobVN0YXRlID09IFNUQVRFX1NFTEVDVEVEKSB7Ci0gICAgICAgICAgICAgICAgaWYgKCFpc1RleHRTZWxlY3RlZCgpKSB7Ci0gICAgICAgICAgICAgICAgICAgIExvZy5lKExPR19UQUcsICJTZWxlY3Rpb24gaXMgZG9uZSwgYnV0IG5vdCBzZWxlY3RlZCIpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBzZXRTZWxlY3RlZEVuZFBvcygpOwotICAgICAgICAgICAgICAgIGRvTmV4dEhhbmRsZSgpOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgcHJpdmF0ZSB2b2lkIGhhbmRsZVNlbGVjdEFsbCgpIHsKLSAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIGhhbmRsZVNlbGVjdEFsbCIpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKCFtRWRpdEZsYWcpIHsKLSAgICAgICAgICAgICAgICByZXR1cm47Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBtRVNULnNlbGVjdEFsbCgpOwotICAgICAgICAgICAgbVN0YXRlID0gU1RBVEVfU0VMRUNURUQ7Ci0gICAgICAgIH0KLQotICAgICAgICBwcml2YXRlIHZvaWQgaGFuZGxlUmVzZXRFZGl0KCkgewotICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgIExvZy5kKExPR19UQUcsICJSZXNldCBFZGl0b3IiKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGJsb2NrU29mdEtleSgpOwotICAgICAgICAgICAgaGFuZGxlQ2FuY2VsKCk7Ci0gICAgICAgICAgICBtRWRpdEZsYWcgPSB0cnVlOwotICAgICAgICAgICAgbUVTVC5zZXRIaW50TWVzc2FnZShISU5UX01TR19TRUxFQ1RfU1RBUlQpOwotICAgICAgICB9Ci0KLSAgICAgICAgcHJpdmF0ZSB2b2lkIHNldFNlbGVjdGlvbigpIHsKLSAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIG9uU2VsZWN0OiIgKyBtQ3VyU3RhcnQgKyAiLCIgKyBtQ3VyRW5kKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmIChtQ3VyU3RhcnQgPj0gMCAmJiBtQ3VyU3RhcnQgPD0gbUVTVC5nZXRUZXh0KCkubGVuZ3RoKCkKLSAgICAgICAgICAgICAgICAgICAgJiYgbUN1ckVuZCA+PSAwICYmIG1DdXJFbmQgPD0gbUVTVC5nZXRUZXh0KCkubGVuZ3RoKCkpIHsKLSAgICAgICAgICAgICAgICBpZiAobUN1clN0YXJ0IDwgbUN1ckVuZCkgewotICAgICAgICAgICAgICAgICAgICBtRVNULnNldFNlbGVjdGlvbihtQ3VyU3RhcnQsIG1DdXJFbmQpOwotICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIG1FU1Quc2V0U2VsZWN0aW9uKG1DdXJFbmQsIG1DdXJTdGFydCk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIG1TdGF0ZSA9IFNUQVRFX1NFTEVDVEVEOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBMb2cuZShMT0dfVEFHLAotICAgICAgICAgICAgICAgICAgICAgICAgIlNlbGVjdCBpcyBvbiwgYnV0IGN1cnNvciBwb3NpdGlvbnMgYXJlIGlsbGlnYWwuOiIKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyBtRVNULmdldFRleHQoKS5sZW5ndGgoKSArICIsIiArIG1DdXJTdGFydAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArICIsIiArIG1DdXJFbmQpOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgcHJpdmF0ZSB2b2lkIHVuc2V0U2VsZWN0KCkgewotICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgIExvZy5kKExPR19UQUcsICItLS0gb2ZmU2VsZWN0Iik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpbnQgY3VycnBvcyA9IG1FU1QuZ2V0U2VsZWN0aW9uU3RhcnQoKTsKLSAgICAgICAgICAgIG1FU1Quc2V0U2VsZWN0aW9uKGN1cnJwb3MsIGN1cnJwb3MpOwotICAgICAgICAgICAgbVN0YXRlID0gU1RBVEVfU0VMRUNUX09GRjsKLSAgICAgICAgfQotCi0gICAgICAgIHByaXZhdGUgdm9pZCBzZXRTZWxlY3RTdGFydFBvcygpIHsKLSAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIHNldFNlbGVjdFN0YXJ0UG9zIik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBtQ3VyU3RhcnQgPSBtRVNULmdldFNlbGVjdGlvblN0YXJ0KCk7Ci0gICAgICAgICAgICBtU3RhdGUgPSBTVEFURV9TRUxFQ1RfT047Ci0gICAgICAgIH0KLQotICAgICAgICBwcml2YXRlIHZvaWQgc2V0U2VsZWN0ZWRFbmRQb3MoKSB7Ci0gICAgICAgICAgICBpZiAoREJHKSB7Ci0gICAgICAgICAgICAgICAgTG9nLmQoTE9HX1RBRywgIi0tLSBzZXRTZWxlY3RFbmRQb3M6Iik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAobUVTVC5nZXRTZWxlY3Rpb25TdGFydCgpID09IG1DdXJTdGFydCkgewotICAgICAgICAgICAgICAgIHNldFNlbGVjdGVkRW5kUG9zKG1FU1QuZ2V0U2VsZWN0aW9uRW5kKCkpOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBzZXRTZWxlY3RlZEVuZFBvcyhtRVNULmdldFNlbGVjdGlvblN0YXJ0KCkpOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIHZvaWQgc2V0U2VsZWN0ZWRFbmRQb3MoaW50IHBvcykgewotICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgIExvZy5kKExPR19UQUcsICItLS0gc2V0U2VsZWN0ZWRFbmRQb3M6Iik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBtQ3VyRW5kID0gcG9zOwotICAgICAgICAgICAgc2V0U2VsZWN0aW9uKCk7Ci0gICAgICAgIH0KLQotICAgICAgICBwcml2YXRlIGJvb2xlYW4gaXNUZXh0U2VsZWN0ZWQoKSB7Ci0gICAgICAgICAgICBpZiAoREJHKSB7Ci0gICAgICAgICAgICAgICAgTG9nLmQoTE9HX1RBRywgIi0tLSBpc1RleHRTZWxlY3RlZDoiICsgbUN1clN0YXJ0ICsgIiwiCi0gICAgICAgICAgICAgICAgICAgICAgICArIG1DdXJFbmQpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgcmV0dXJuIChtQ3VyU3RhcnQgIT0gbUN1ckVuZCkKLSAgICAgICAgICAgICAgICAgICAgJiYgKG1TdGF0ZSA9PSBTVEFURV9TRUxFQ1RFRCB8fAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1TdGF0ZSA9PSBTVEFURV9TRUxFQ1RfRklYKTsKLSAgICAgICAgfQotCi0gICAgICAgIHByaXZhdGUgdm9pZCBzZXRTdHlsZWRUZXh0U3BhbihPYmplY3Qgc3BhbiwgaW50IHN0YXJ0LCBpbnQgZW5kKSB7Ci0gICAgICAgICAgICBpZiAoREJHKSB7Ci0gICAgICAgICAgICAgICAgTG9nLmQoTE9HX1RBRywgIi0tLSBzZXRTdHlsZWRUZXh0U3BhbjoiICsgbU1vZGUgKyAiLCIKLSAgICAgICAgICAgICAgICAgICAgICAgICsgc3RhcnQgKyAiLCIgKyBlbmQpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKHN0YXJ0IDwgZW5kKSB7Ci0gICAgICAgICAgICAgICAgbUVTVC5nZXRUZXh0KCkuc2V0U3BhbihzcGFuLCBzdGFydCwgZW5kLAotICAgICAgICAgICAgICAgICAgICAgICAgU3Bhbm5hYmxlLlNQQU5fRVhDTFVTSVZFX0VYQ0xVU0lWRSk7Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIG1FU1QuZ2V0VGV4dCgpLnNldFNwYW4oc3BhbiwgZW5kLCBzdGFydCwKLSAgICAgICAgICAgICAgICAgICAgICAgIFNwYW5uYWJsZS5TUEFOX0VYQ0xVU0lWRV9FWENMVVNJVkUpOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgcHJpdmF0ZSB2b2lkIGNoYW5nZVNpemVTZWxlY3RlZFRleHQoaW50IHNpemUpIHsKLSAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIGNoYW5nZVNpemU6IiArIHNpemUpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgc2V0U3R5bGVkVGV4dFNwYW4obmV3IEFic29sdXRlU2l6ZVNwYW4oc2l6ZSksCi0gICAgICAgICAgICAgICAgbUN1clN0YXJ0LCBtQ3VyRW5kKTsKLSAgICAgICAgfQotCi0gICAgICAgIHByaXZhdGUgdm9pZCBjaGFuZ2VDb2xvclNlbGVjdGVkVGV4dChpbnQgY29sb3IpIHsKLSAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIGNoYW5nZUNvbG9yOiIgKyBjb2xvcik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBzZXRTdHlsZWRUZXh0U3BhbihuZXcgRm9yZWdyb3VuZENvbG9yU3Bhbihjb2xvciksCi0gICAgICAgICAgICAgICAgbUN1clN0YXJ0LCBtQ3VyRW5kKTsKLSAgICAgICAgfQotCi0gICAgICAgIHByaXZhdGUgdm9pZCBjaGFuZ2VBbGlnbihMYXlvdXQuQWxpZ25tZW50IGFsaWduKSB7Ci0gICAgICAgICAgICBpZiAoREJHKSB7Ci0gICAgICAgICAgICAgICAgTG9nLmQoTE9HX1RBRywgIi0tLSBjaGFuZ2VBbGlnbjoiICsgYWxpZ24pOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgc2V0U3R5bGVkVGV4dFNwYW4obmV3IEFsaWdubWVudFNwYW4uU3RhbmRhcmQoYWxpZ24pLAotICAgICAgICAgICAgICAgICAgICBmaW5kTGluZVN0YXJ0KG1FU1QuZ2V0VGV4dCgpLCBtQ3VyU3RhcnQpLAotICAgICAgICAgICAgICAgICAgICBmaW5kTGluZUVuZChtRVNULmdldFRleHQoKSwgbUN1ckVuZCkpOwotICAgICAgICB9Ci0KLSAgICAgICAgcHJpdmF0ZSBpbnQgZmluZExpbmVTdGFydChFZGl0YWJsZSB0ZXh0LCBpbnQgY3VycmVudCkgewotICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgIExvZy5kKExPR19UQUcsICItLS0gZmluZExpbmVTdGFydDogY3VycjoiICsgY3VycmVudCArCi0gICAgICAgICAgICAgICAgICAgICAgICAiLCBsZW5ndGg6IiArIHRleHQubGVuZ3RoKCkpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaW50IHBvcyA9IGN1cnJlbnQ7Ci0gICAgICAgICAgICBmb3IgKDsgcG9zID4gMDsgcG9zLS0pIHsKLSAgICAgICAgICAgICAgICBpZiAodGV4dC5jaGFyQXQocG9zIC0gMSkgPT0gJ1xuJykgewotICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICByZXR1cm4gcG9zOwotICAgICAgICB9Ci0KLSAgICAgICAgcHJpdmF0ZSB2b2lkIGluc2VydEltYWdlU3BhbihJbWFnZVNwYW4gc3BhbikgewotICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgIExvZy5kKExPR19UQUcsICItLS0gaW5zZXJ0SW1hZ2VTcGFuIik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAoc3BhbiAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgTG9nLmQoTE9HX1RBRywgIi0tLSBpbnNlcnRpbWFnZXNwYW46IiArIHNwYW4uZ2V0RHJhd2FibGUoKS5nZXRJbnRyaW5zaWNIZWlnaHQoKSArICIsIiArIHNwYW4uZ2V0RHJhd2FibGUoKS5nZXRJbnRyaW5zaWNXaWR0aCgpKTsKLSAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIGluc2VydGltYWdlc3BhbjoiICsgc3Bhbi5nZXREcmF3YWJsZSgpLmdldENsYXNzKCkpOwotICAgICAgICAgICAgICAgIGludCBjdXJwb3MgPSBtRVNULmdldFNlbGVjdGlvblN0YXJ0KCk7Ci0gICAgICAgICAgICAgICAgbUVTVC5nZXRUZXh0KCkuaW5zZXJ0KGN1cnBvcywgIlx1RkZGQyIpOwotICAgICAgICAgICAgICAgIG1FU1QuZ2V0VGV4dCgpLnNldFNwYW4oc3BhbiwgY3VycG9zLCBjdXJwb3MgKyAxLAotICAgICAgICAgICAgICAgICAgICAgICAgU3Bhbm5hYmxlLlNQQU5fRVhDTFVTSVZFX0VYQ0xVU0lWRSk7Ci0gICAgICAgICAgICAgICAgbUVTVC5ub3RpZnlTdGF0ZUNoYW5nZWQobU1vZGUsIG1TdGF0ZSk7Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIExvZy5lKExPR19UQUcsICItLS0gaW5zZXJ0SW1hZ2VTcGFuOiBudWxsIHNwYW4gd2FzIGluc2VydGVkIik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQotICAgICAgICBwcml2YXRlIGludCBmaW5kTGluZUVuZChFZGl0YWJsZSB0ZXh0LCBpbnQgY3VycmVudCkgewotICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgIExvZy5kKExPR19UQUcsICItLS0gZmluZExpbmVFbmQ6IGN1cnI6IiArIGN1cnJlbnQgKwotICAgICAgICAgICAgICAgICAgICAgICAgIiwgbGVuZ3RoOiIgKyB0ZXh0Lmxlbmd0aCgpKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGludCBwb3MgPSBjdXJyZW50OwotICAgICAgICAgICAgZm9yICg7IHBvcyA8IHRleHQubGVuZ3RoKCk7IHBvcysrKSB7Ci0gICAgICAgICAgICAgICAgaWYgKHBvcyA+IDAgJiYgdGV4dC5jaGFyQXQocG9zIC0gMSkgPT0gJ1xuJykgewotICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICByZXR1cm4gcG9zOwotICAgICAgICB9Ci0KLSAgICAgICAgcHJpdmF0ZSB2b2lkIGJsb2NrU29mdEtleSgpIHsKLSAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIGJsb2NrU29mdEtleToiKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIElucHV0TWV0aG9kTWFuYWdlciBpbW0gPSAoSW5wdXRNZXRob2RNYW5hZ2VyKSBtRVNULmdldENvbnRleHQoKS4KLSAgICAgICAgICAgIGdldFN5c3RlbVNlcnZpY2UoQ29udGV4dC5JTlBVVF9NRVRIT0RfU0VSVklDRSk7Ci0gICAgICAgICAgICBpbW0uaGlkZVNvZnRJbnB1dEZyb21XaW5kb3cobUVTVC5nZXRXaW5kb3dUb2tlbigpLCAwKTsKLSAgICAgICAgICAgIG1FU1Quc2V0T25DbGlja0xpc3RlbmVyKAotICAgICAgICAgICAgICAgICAgICBuZXcgT25DbGlja0xpc3RlbmVyKCkgewotICAgICAgICAgICAgICAgICAgICAgICAgcHVibGljIHZvaWQgb25DbGljayhWaWV3IHYpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIG9udHJhY2tiYWxsY2xpY2s6Iik7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgb25GaXhTZWxlY3RlZEl0ZW0oKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0pOwotICAgICAgICAgICAgbVNvZnRLZXlCbG9ja0ZsYWcgPSB0cnVlOwotICAgICAgICB9Ci0KLSAgICAgICAgcHJpdmF0ZSB2b2lkIHVuYmxvY2tTb2Z0S2V5KCkgewotICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgIExvZy5kKExPR19UQUcsICItLS0gdW5ibG9ja1NvZnRLZXk6Iik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBtRVNULnNldE9uQ2xpY2tMaXN0ZW5lcihudWxsKTsKLSAgICAgICAgICAgIG1Tb2Z0S2V5QmxvY2tGbGFnID0gZmFsc2U7Ci0gICAgICAgIH0KLSAgICB9Ci0KLSAgICBwcml2YXRlIGNsYXNzIFN0eWxlZFRleHRDb252ZXJ0ZXIgewotICAgICAgICBwcml2YXRlIEVkaXRTdHlsZWRUZXh0IG1FU1Q7Ci0KLSAgICAgICAgcHVibGljIFN0eWxlZFRleHRDb252ZXJ0ZXIoRWRpdFN0eWxlZFRleHQgZXN0KSB7Ci0gICAgICAgICAgICBtRVNUID0gZXN0OwotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIFN0cmluZyBnZXRIdG1sKCkgewotICAgICAgICAgICAgU3RyaW5nIGh0bWxCb2R5ID0gSHRtbC50b0h0bWwobUVTVC5nZXRUZXh0KCkpOwotICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgIExvZy5kKExPR19UQUcsICItLS0gZ2V0Q29udmVydGVkQm9keToiICsgaHRtbEJvZHkpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgcmV0dXJuIGh0bWxCb2R5OwotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIHZvaWQgZ2V0VXJpQXJyYXkoQXJyYXlMaXN0PFVyaT4gdXJpcywgRWRpdGFibGUgdGV4dCkgewotICAgICAgICAgICAgdXJpcy5jbGVhcigpOwotICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgIExvZy5kKExPR19UQUcsICItLS0gZ2V0VXJpQXJyYXk6Iik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpbnQgbGVuID0gdGV4dC5sZW5ndGgoKTsKLSAgICAgICAgICAgIGludCBuZXh0OwotICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCB0ZXh0Lmxlbmd0aCgpOyBpID0gbmV4dCkgewotICAgICAgICAgICAgICAgIG5leHQgPSB0ZXh0Lm5leHRTcGFuVHJhbnNpdGlvbihpLCBsZW4sIEltYWdlU3Bhbi5jbGFzcyk7Ci0gICAgICAgICAgICAgICAgSW1hZ2VTcGFuW10gaW1hZ2VzID0gdGV4dC5nZXRTcGFucyhpLCBuZXh0LCBJbWFnZVNwYW4uY2xhc3MpOwotICAgICAgICAgICAgICAgIGZvciAoaW50IGogPSAwOyBqIDwgaW1hZ2VzLmxlbmd0aDsgaisrKSB7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIExvZy5kKExPR19UQUcsICItLS0gZ2V0VXJpQXJyYXk6IGZvdW5kQXJyYXkiICsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKChJbWFnZVNwYW4pIGltYWdlc1tqXSkuZ2V0U291cmNlKCkpOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIHVyaXMuYWRkKFVyaS5wYXJzZSgKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAoKEltYWdlU3BhbikgaW1hZ2VzW2pdKS5nZXRTb3VyY2UoKSkpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCi0gICAgICAgIHB1YmxpYyB2b2lkIFNldEh0bWwgKFN0cmluZyBodG1sKSB7Ci0gICAgICAgICAgICBmaW5hbCBTcGFubmVkIHNwYW5uZWQgPSBIdG1sLmZyb21IdG1sKGh0bWwsIG5ldyBIdG1sLkltYWdlR2V0dGVyKCkgewotICAgICAgICAgICAgICAgIHB1YmxpYyBEcmF3YWJsZSBnZXREcmF3YWJsZShTdHJpbmcgc3JjKSB7Ci0gICAgICAgICAgICAgICAgICAgIExvZy5kKExPR19UQUcsICItLS0gc2V0aHRtbDogc3JjPSIrc3JjKTsKLSAgICAgICAgICAgICAgICAgICAgaWYgKHNyYy5zdGFydHNXaXRoKCJjb250ZW50Oi8vIikpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIFVyaSB1cmkgPSBVcmkucGFyc2Uoc3JjKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgSW5wdXRTdHJlYW0gaXMgPSBtRVNULmdldENvbnRleHQoKS5nZXRDb250ZW50UmVzb2x2ZXIoKS5vcGVuSW5wdXRTdHJlYW0odXJpKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBCaXRtYXAgYml0bWFwID0gQml0bWFwRmFjdG9yeS5kZWNvZGVTdHJlYW0oaXMpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIERyYXdhYmxlIGRyYXdhYmxlID0gbmV3IEJpdG1hcERyYXdhYmxlKAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0Q29udGV4dCgpLmdldFJlc291cmNlcygpLCBiaXRtYXApOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRyYXdhYmxlLnNldEJvdW5kcygwLCAwLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZHJhd2FibGUuZ2V0SW50cmluc2ljV2lkdGgoKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRyYXdhYmxlLmdldEludHJpbnNpY0hlaWdodCgpKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBpcy5jbG9zZSgpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkcmF3YWJsZTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKEV4Y2VwdGlvbiBlKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgTG9nLmUoTE9HX1RBRywgIi0tLSBzZXQgaHRtbDogRmFpbGVkIHRvIGxvYWRlZCBjb250ZW50ICIgKyB1cmksIGUpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIExvZy5kKExPR19UQUcsICIgIHVua25vd24gc3JjPSIrc3JjKTsKLSAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfSwgbnVsbCk7Ci0gICAgICAgICAgICBtRVNULnNldFRleHQoc3Bhbm5lZCk7Ci0gICAgICAgIH0KLSAgICB9Ci0KLSAgICBwcml2YXRlIGNsYXNzIFN0eWxlZFRleHREaWFsb2cgewotICAgICAgICBCdWlsZGVyIG1CdWlsZGVyOwotICAgICAgICBDaGFyU2VxdWVuY2UgbUNvbG9yVGl0bGU7Ci0gICAgICAgIENoYXJTZXF1ZW5jZSBtU2l6ZVRpdGxlOwotICAgICAgICBDaGFyU2VxdWVuY2UgbUFsaWduVGl0bGU7Ci0gICAgICAgIENoYXJTZXF1ZW5jZVtdIG1Db2xvck5hbWVzOwotICAgICAgICBDaGFyU2VxdWVuY2VbXSBtQ29sb3JJbnRzOwotICAgICAgICBDaGFyU2VxdWVuY2VbXSBtU2l6ZU5hbWVzOwotICAgICAgICBDaGFyU2VxdWVuY2VbXSBtU2l6ZURpc3BsYXlJbnRzOwotICAgICAgICBDaGFyU2VxdWVuY2VbXSBtU2l6ZVNlbmRJbnRzOwotICAgICAgICBDaGFyU2VxdWVuY2VbXSBtQWxpZ25OYW1lczsKLSAgICAgICAgRWRpdFN0eWxlZFRleHQgbUVTVDsKLQotICAgICAgICBwdWJsaWMgU3R5bGVkVGV4dERpYWxvZyhFZGl0U3R5bGVkVGV4dCBlc3QpIHsKLSAgICAgICAgICAgIG1FU1QgPSBlc3Q7Ci0gICAgICAgIH0KLQotICAgICAgICBwdWJsaWMgdm9pZCBzZXRCdWlsZGVyKEJ1aWxkZXIgYnVpbGRlcikgewotICAgICAgICAgICAgbUJ1aWxkZXIgPSBidWlsZGVyOwotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIHZvaWQgc2V0Q29sb3JBbGVydFBhcmFtcyhDaGFyU2VxdWVuY2UgY29sb3J0aXRsZSwKLSAgICAgICAgICAgICAgICBDaGFyU2VxdWVuY2VbXSBjb2xvcm5hbWVzLCBDaGFyU2VxdWVuY2VbXSBjb2xvcmludHMpIHsKLSAgICAgICAgICAgIG1Db2xvclRpdGxlID0gY29sb3J0aXRsZTsKLSAgICAgICAgICAgIG1Db2xvck5hbWVzID0gY29sb3JuYW1lczsKLSAgICAgICAgICAgIG1Db2xvckludHMgPSBjb2xvcmludHM7Ci0gICAgICAgIH0KLQotICAgICAgICBwdWJsaWMgdm9pZCBzZXRTaXplQWxlcnRQYXJhbXMoQ2hhclNlcXVlbmNlIHNpemV0aXRsZSwKLSAgICAgICAgICAgICAgICBDaGFyU2VxdWVuY2VbXSBzaXplbmFtZXMsIENoYXJTZXF1ZW5jZVtdIHNpemVkaXNwbGF5aW50cywKLSAgICAgICAgICAgICAgICBDaGFyU2VxdWVuY2VbXSBzaXplc2VuZGludHMpIHsKLSAgICAgICAgICAgIG1TaXplVGl0bGUgPSBzaXpldGl0bGU7Ci0gICAgICAgICAgICBtU2l6ZU5hbWVzID0gc2l6ZW5hbWVzOwotICAgICAgICAgICAgbVNpemVEaXNwbGF5SW50cyA9IHNpemVkaXNwbGF5aW50czsKLSAgICAgICAgICAgIG1TaXplU2VuZEludHMgPSBzaXplc2VuZGludHM7Ci0gICAgICAgIH0KLQotICAgICAgICBwdWJsaWMgdm9pZCBzZXRBbGlnbkFsZXJ0UGFyYW1zKENoYXJTZXF1ZW5jZSBhbGlnbnRpdGxlLAotICAgICAgICAgICAgICAgIENoYXJTZXF1ZW5jZVtdIGFsaWdubmFtZXMpIHsKLSAgICAgICAgICAgIG1BbGlnblRpdGxlID0gYWxpZ250aXRsZTsKLSAgICAgICAgICAgIG1BbGlnbk5hbWVzID0gYWxpZ25uYW1lczsKLSAgICAgICAgfQotCi0gICAgICAgIHByaXZhdGUgYm9vbGVhbiBjaGVja0NvbG9yQWxlcnRQYXJhbXMoKSB7Ci0gICAgICAgICAgICBpZiAoREJHKSB7Ci0gICAgICAgICAgICAgICAgTG9nLmQoTE9HX1RBRywgIi0tLSBjaGVja1BhcmFtcyIpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKG1CdWlsZGVyID09IG51bGwpIHsKLSAgICAgICAgICAgICAgICBMb2cuZShMT0dfVEFHLCAiLS0tIGJ1aWxkZXIgaXMgbnVsbC4iKTsKLSAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7Ci0gICAgICAgICAgICB9IGVsc2UgaWYgKG1Db2xvclRpdGxlID09IG51bGwgfHwgbUNvbG9yTmFtZXMgPT0gbnVsbAotICAgICAgICAgICAgICAgICAgICB8fCBtQ29sb3JJbnRzID09IG51bGwpIHsKLSAgICAgICAgICAgICAgICBMb2cuZShMT0dfVEFHLCAiLS0tIGNvbG9yIGFsZXJ0IHBhcmFtcyBhcmUgbnVsbC4iKTsKLSAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7Ci0gICAgICAgICAgICB9IGVsc2UgaWYgKG1Db2xvck5hbWVzLmxlbmd0aCAhPSBtQ29sb3JJbnRzLmxlbmd0aCkgewotICAgICAgICAgICAgICAgIExvZy5lKExPR19UQUcsICItLS0gdGhlIGxlbmd0aCBvZiBjb2xvciBhbGVydCBwYXJhbXMgYXJlICIKLSAgICAgICAgICAgICAgICAgICAgICAgICsgImRpZmZlcmVudC4iKTsKLSAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICByZXR1cm4gdHJ1ZTsKLSAgICAgICAgfQotCi0gICAgICAgIHByaXZhdGUgYm9vbGVhbiBjaGVja1NpemVBbGVydFBhcmFtcygpIHsKLSAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIGNoZWNrUGFyYW1zIik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAobUJ1aWxkZXIgPT0gbnVsbCkgewotICAgICAgICAgICAgICAgIExvZy5lKExPR19UQUcsICItLS0gYnVpbGRlciBpcyBudWxsLiIpOwotICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKLSAgICAgICAgICAgIH0gZWxzZSBpZiAobVNpemVUaXRsZSA9PSBudWxsIHx8IG1TaXplTmFtZXMgPT0gbnVsbAotICAgICAgICAgICAgICAgICAgICB8fCBtU2l6ZURpc3BsYXlJbnRzID09IG51bGwgfHwgbVNpemVTZW5kSW50cyA9PSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgTG9nLmUoTE9HX1RBRywgIi0tLSBzaXplIGFsZXJ0IHBhcmFtcyBhcmUgbnVsbC4iKTsKLSAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7Ci0gICAgICAgICAgICB9IGVsc2UgaWYgKG1TaXplTmFtZXMubGVuZ3RoICE9IG1TaXplRGlzcGxheUludHMubGVuZ3RoCi0gICAgICAgICAgICAgICAgICAgICYmIG1TaXplU2VuZEludHMubGVuZ3RoICE9IG1TaXplRGlzcGxheUludHMubGVuZ3RoKSB7Ci0gICAgICAgICAgICAgICAgTG9nLmUoTE9HX1RBRywgIi0tLSB0aGUgbGVuZ3RoIG9mIHNpemUgYWxlcnQgcGFyYW1zIGFyZSAiCi0gICAgICAgICAgICAgICAgICAgICAgICArICJkaWZmZXJlbnQuIik7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgcmV0dXJuIHRydWU7Ci0gICAgICAgIH0KLQotICAgICAgICBwcml2YXRlIGJvb2xlYW4gY2hlY2tBbGlnbkFsZXJ0UGFyYW1zKCkgewotICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgIExvZy5kKExPR19UQUcsICItLS0gY2hlY2tBbGlnbkFsZXJ0UGFyYW1zIik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAobUJ1aWxkZXIgPT0gbnVsbCkgewotICAgICAgICAgICAgICAgIExvZy5lKExPR19UQUcsICItLS0gYnVpbGRlciBpcyBudWxsLiIpOwotICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKLSAgICAgICAgICAgIH0gZWxzZSBpZiAobUFsaWduVGl0bGUgPT0gbnVsbCkgewotICAgICAgICAgICAgICAgIExvZy5lKExPR19UQUcsICItLS0gYWxpZ24gYWxlcnQgcGFyYW1zIGFyZSBudWxsLiIpOwotICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHJldHVybiB0cnVlOwotICAgICAgICB9Ci0KLSAgICAgICAgcHJpdmF0ZSB2b2lkIG9uU2hvd0ZvcmVncm91bmRDb2xvckFsZXJ0RGlhbG9nKCkgewotICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgIExvZy5kKExPR19UQUcsICItLS0gb25TaG93Rm9yZWdyb3VuZENvbG9yQWxlcnREaWFsb2ciKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmICghY2hlY2tDb2xvckFsZXJ0UGFyYW1zKCkpIHsKLSAgICAgICAgICAgICAgICByZXR1cm47Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBtQnVpbGRlci5zZXRUaXRsZShtQ29sb3JUaXRsZSk7Ci0gICAgICAgICAgICBtQnVpbGRlci5zZXRJY29uKDApOwotICAgICAgICAgICAgbUJ1aWxkZXIuCi0gICAgICAgICAgICBzZXRJdGVtcyhtQ29sb3JOYW1lcywKLSAgICAgICAgICAgICAgICAgICAgbmV3IERpYWxvZ0ludGVyZmFjZS5PbkNsaWNrTGlzdGVuZXIoKSB7Ci0gICAgICAgICAgICAgICAgcHVibGljIHZvaWQgb25DbGljayhEaWFsb2dJbnRlcmZhY2UgZGlhbG9nLCBpbnQgd2hpY2gpIHsKLSAgICAgICAgICAgICAgICAgICAgTG9nLmQoIkVFVFZNIiwgIm1CdWlsZGVyLm9uY2xpY2s6IiArIHdoaWNoKTsKLSAgICAgICAgICAgICAgICAgICAgaW50IGNvbG9yID0gSW50ZWdlci5wYXJzZUludCgKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAoU3RyaW5nKSBtQ29sb3JJbnRzW3doaWNoXSwgMTYpIC0gMHgwMTAwMDAwMDsKLSAgICAgICAgICAgICAgICAgICAgbUVTVC5zZXRJdGVtQ29sb3IoY29sb3IpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0pOwotICAgICAgICAgICAgbUJ1aWxkZXIuc2hvdygpOwotICAgICAgICB9Ci0KLSAgICAgICAgcHJpdmF0ZSB2b2lkIG9uU2hvd0JhY2tncm91bmRDb2xvckFsZXJ0RGlhbG9nKCkgewotICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgIExvZy5kKExPR19UQUcsICItLS0gb25TaG93QmFja2dyb3VuZENvbG9yQWxlcnREaWFsb2ciKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmICghY2hlY2tDb2xvckFsZXJ0UGFyYW1zKCkpIHsKLSAgICAgICAgICAgICAgICByZXR1cm47Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBtQnVpbGRlci5zZXRUaXRsZShtQ29sb3JUaXRsZSk7Ci0gICAgICAgICAgICBtQnVpbGRlci5zZXRJY29uKDApOwotICAgICAgICAgICAgbUJ1aWxkZXIuCi0gICAgICAgICAgICBzZXRJdGVtcyhtQ29sb3JOYW1lcywKLSAgICAgICAgICAgICAgICAgICAgbmV3IERpYWxvZ0ludGVyZmFjZS5PbkNsaWNrTGlzdGVuZXIoKSB7Ci0gICAgICAgICAgICAgICAgcHVibGljIHZvaWQgb25DbGljayhEaWFsb2dJbnRlcmZhY2UgZGlhbG9nLCBpbnQgd2hpY2gpIHsKLSAgICAgICAgICAgICAgICAgICAgTG9nLmQoIkVFVFZNIiwgIm1CdWlsZGVyLm9uY2xpY2s6IiArIHdoaWNoKTsKLSAgICAgICAgICAgICAgICAgICAgaW50IGNvbG9yID0gSW50ZWdlci5wYXJzZUludCgKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAoU3RyaW5nKSBtQ29sb3JJbnRzW3doaWNoXSwgMTYpIC0gMHgwMTAwMDAwMDsKLSAgICAgICAgICAgICAgICAgICAgbUVTVC5zZXRCYWNrZ3JvdW5kQ29sb3IoY29sb3IpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0pOwotICAgICAgICAgICAgbUJ1aWxkZXIuc2hvdygpOwotICAgICAgICB9Ci0KLSAgICAgICAgcHJpdmF0ZSB2b2lkIG9uU2hvd1NpemVBbGVydERpYWxvZygpIHsKLSAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIG9uU2hvd1NpemVBbGVydERpYWxvZyIpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKCFjaGVja1NpemVBbGVydFBhcmFtcygpKSB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgbUJ1aWxkZXIuc2V0VGl0bGUobVNpemVUaXRsZSk7Ci0gICAgICAgICAgICBtQnVpbGRlci5zZXRJY29uKDApOwotICAgICAgICAgICAgbUJ1aWxkZXIuCi0gICAgICAgICAgICBzZXRJdGVtcyhtU2l6ZU5hbWVzLAotICAgICAgICAgICAgICAgICAgICBuZXcgRGlhbG9nSW50ZXJmYWNlLk9uQ2xpY2tMaXN0ZW5lcigpIHsKLSAgICAgICAgICAgICAgICBwdWJsaWMgdm9pZCBvbkNsaWNrKERpYWxvZ0ludGVyZmFjZSBkaWFsb2csIGludCB3aGljaCkgewotICAgICAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAibUJ1aWxkZXIub25jbGljazoiICsgd2hpY2gpOwotICAgICAgICAgICAgICAgICAgICBpbnQgc2l6ZSA9IEludGVnZXIKLSAgICAgICAgICAgICAgICAgICAgLnBhcnNlSW50KChTdHJpbmcpIG1TaXplRGlzcGxheUludHNbd2hpY2hdKTsKLSAgICAgICAgICAgICAgICAgICAgbUVTVC5zZXRJdGVtU2l6ZShzaXplKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9KTsKLSAgICAgICAgICAgIG1CdWlsZGVyLnNob3coKTsKLSAgICAgICAgfQotCi0gICAgICAgIHByaXZhdGUgdm9pZCBvblNob3dBbGlnbkFsZXJ0RGlhbG9nKCkgewotICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgIExvZy5kKExPR19UQUcsICItLS0gb25TaG93QWxpZ25BbGVydERpYWxvZyIpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKCFjaGVja0FsaWduQWxlcnRQYXJhbXMoKSkgewotICAgICAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIG1CdWlsZGVyLnNldFRpdGxlKG1BbGlnblRpdGxlKTsKLSAgICAgICAgICAgIG1CdWlsZGVyLnNldEljb24oMCk7Ci0gICAgICAgICAgICBtQnVpbGRlci4KLSAgICAgICAgICAgIHNldEl0ZW1zKG1BbGlnbk5hbWVzLAotICAgICAgICAgICAgICAgICAgICBuZXcgRGlhbG9nSW50ZXJmYWNlLk9uQ2xpY2tMaXN0ZW5lcigpIHsKLSAgICAgICAgICAgICAgICBwdWJsaWMgdm9pZCBvbkNsaWNrKERpYWxvZ0ludGVyZmFjZSBkaWFsb2csIGludCB3aGljaCkgewotICAgICAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAibUJ1aWxkZXIub25jbGljazoiICsgd2hpY2gpOwotICAgICAgICAgICAgICAgICAgICBMYXlvdXQuQWxpZ25tZW50IGFsaWduID0gTGF5b3V0LkFsaWdubWVudC5BTElHTl9OT1JNQUw7Ci0gICAgICAgICAgICAgICAgICAgIHN3aXRjaCAod2hpY2gpIHsKLSAgICAgICAgICAgICAgICAgICAgY2FzZSAwOgotICAgICAgICAgICAgICAgICAgICAgICAgYWxpZ24gPSBMYXlvdXQuQWxpZ25tZW50LkFMSUdOX05PUk1BTDsKLSAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgICAgICBjYXNlIDE6Ci0gICAgICAgICAgICAgICAgICAgICAgICBhbGlnbiA9IExheW91dC5BbGlnbm1lbnQuQUxJR05fQ0VOVEVSOwotICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgICAgIGNhc2UgMjoKLSAgICAgICAgICAgICAgICAgICAgICAgIGFsaWduID0gTGF5b3V0LkFsaWdubWVudC5BTElHTl9PUFBPU0lURTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgotICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgbUVTVC5zZXRBbGlnbm1lbnQoYWxpZ24pOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0pOwotICAgICAgICAgICAgbUJ1aWxkZXIuc2hvdygpOwotICAgICAgICB9Ci0gICAgfQotCi0gICAgcHJpdmF0ZSBjbGFzcyBTdHlsZWRUZXh0QXJyb3dLZXlNZXRob2QgZXh0ZW5kcyBBcnJvd0tleU1vdmVtZW50TWV0aG9kIHsKLSAgICAgICAgRWRpdG9yTWFuYWdlciBtTWFuYWdlcjsKLSAgICAgICAgU3R5bGVkVGV4dEFycm93S2V5TWV0aG9kKEVkaXRvck1hbmFnZXIgbWFuYWdlcikgewotICAgICAgICAgICAgc3VwZXIoKTsKLSAgICAgICAgICAgIG1NYW5hZ2VyID0gbWFuYWdlcjsKLSAgICAgICAgfQotCi0gICAgICAgIEBPdmVycmlkZQotICAgICAgICBwdWJsaWMgYm9vbGVhbiBvbktleURvd24oVGV4dFZpZXcgd2lkZ2V0LCBTcGFubmFibGUgYnVmZmVyLAotICAgICAgICAgICAgICAgIGludCBrZXlDb2RlLCBLZXlFdmVudCBldmVudCkgewotICAgICAgICAgICAgaWYgKCFtTWFuYWdlci5pc1NvZnRLZXlCbG9ja2VkKCkpIHsKLSAgICAgICAgICAgICAgICByZXR1cm4gc3VwZXIub25LZXlEb3duKHdpZGdldCwgYnVmZmVyLCBrZXlDb2RlLCBldmVudCk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAoZXhlY3V0ZURvd24od2lkZ2V0LCBidWZmZXIsIGtleUNvZGUpKSB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICByZXR1cm4gZmFsc2U7Ci0gICAgICAgIH0KLQotICAgICAgICBwcml2YXRlIGludCBnZXRFbmRQb3MoVGV4dFZpZXcgd2lkZ2V0KSB7Ci0gICAgICAgICAgICBpbnQgZW5kOwotICAgICAgICAgICAgaWYgKHdpZGdldC5nZXRTZWxlY3Rpb25TdGFydCgpID09IG1NYW5hZ2VyLmdldFNlbGVjdGlvblN0YXJ0KCkpIHsKLSAgICAgICAgICAgICAgICBlbmQgPSB3aWRnZXQuZ2V0U2VsZWN0aW9uRW5kKCk7Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIGVuZCA9IHdpZGdldC5nZXRTZWxlY3Rpb25TdGFydCgpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgcmV0dXJuIGVuZDsKLSAgICAgICAgfQotCi0gICAgICAgIHByaXZhdGUgYm9vbGVhbiB1cChUZXh0VmlldyB3aWRnZXQsIFNwYW5uYWJsZSBidWZmZXIpIHsKLSAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIHVwOiIpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgTGF5b3V0IGxheW91dCA9IHdpZGdldC5nZXRMYXlvdXQoKTsKLSAgICAgICAgICAgIGludCBlbmQgPSBnZXRFbmRQb3Mod2lkZ2V0KTsKLSAgICAgICAgICAgIGludCBsaW5lID0gbGF5b3V0LmdldExpbmVGb3JPZmZzZXQoZW5kKTsKLSAgICAgICAgICAgIGlmIChsaW5lID4gMCkgewotICAgICAgICAgICAgICAgIGludCB0bzsKLSAgICAgICAgICAgICAgICBpZiAobGF5b3V0LmdldFBhcmFncmFwaERpcmVjdGlvbihsaW5lKSA9PQotICAgICAgICAgICAgICAgICAgICBsYXlvdXQuZ2V0UGFyYWdyYXBoRGlyZWN0aW9uKGxpbmUgLSAxKSkgewotICAgICAgICAgICAgICAgICAgICBmbG9hdCBoID0gbGF5b3V0LmdldFByaW1hcnlIb3Jpem9udGFsKGVuZCk7Ci0gICAgICAgICAgICAgICAgICAgIHRvID0gbGF5b3V0LmdldE9mZnNldEZvckhvcml6b250YWwobGluZSAtIDEsIGgpOwotICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIHRvID0gbGF5b3V0LmdldExpbmVTdGFydChsaW5lIC0gMSk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIG1NYW5hZ2VyLnNldFNlbGVjdGVkRW5kUG9zKHRvKTsKLSAgICAgICAgICAgICAgICBtTWFuYWdlci5vbkN1cnNvck1vdmVkKCk7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICByZXR1cm4gZmFsc2U7Ci0gICAgICAgIH0KLQotICAgICAgICBwcml2YXRlIGJvb2xlYW4gZG93bihUZXh0VmlldyB3aWRnZXQsIFNwYW5uYWJsZSBidWZmZXIpIHsKLSAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIGRvd246Iik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBMYXlvdXQgbGF5b3V0ID0gd2lkZ2V0LmdldExheW91dCgpOwotICAgICAgICAgICAgaW50IGVuZCA9IGdldEVuZFBvcyh3aWRnZXQpOwotICAgICAgICAgICAgaW50IGxpbmUgPSBsYXlvdXQuZ2V0TGluZUZvck9mZnNldChlbmQpOwotICAgICAgICAgICAgaWYgKGxpbmUgPCBsYXlvdXQuZ2V0TGluZUNvdW50KCkgLSAxKSB7Ci0gICAgICAgICAgICAgICAgaW50IHRvOwotICAgICAgICAgICAgICAgIGlmIChsYXlvdXQuZ2V0UGFyYWdyYXBoRGlyZWN0aW9uKGxpbmUpID09Ci0gICAgICAgICAgICAgICAgICAgIGxheW91dC5nZXRQYXJhZ3JhcGhEaXJlY3Rpb24obGluZSArIDEpKSB7Ci0gICAgICAgICAgICAgICAgICAgIGZsb2F0IGggPSBsYXlvdXQuZ2V0UHJpbWFyeUhvcml6b250YWwoZW5kKTsKLSAgICAgICAgICAgICAgICAgICAgdG8gPSBsYXlvdXQuZ2V0T2Zmc2V0Rm9ySG9yaXpvbnRhbChsaW5lICsgMSwgaCk7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgdG8gPSBsYXlvdXQuZ2V0TGluZVN0YXJ0KGxpbmUgKyAxKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgbU1hbmFnZXIuc2V0U2VsZWN0ZWRFbmRQb3ModG8pOwotICAgICAgICAgICAgICAgIG1NYW5hZ2VyLm9uQ3Vyc29yTW92ZWQoKTsKLSAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHJldHVybiBmYWxzZTsKLSAgICAgICAgfQotCi0gICAgICAgIHByaXZhdGUgYm9vbGVhbiBsZWZ0KFRleHRWaWV3IHd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2V5Q29kZSkgewotICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgIExvZy5kKExPR19UQUcsICItLS0gZXhlY3V0ZURvd246ICIgKyBrZXlDb2RlKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGJvb2xlYW4gaGFuZGxlZCA9IGZhbHNlOwotCi0gICAgICAgICAgICBzd2l0Y2ggKGtleUNvZGUpIHsKLSAgICAgICAgICAgIGNhc2UgS2V5RXZlbnQuS0VZQ09ERV9EUEFEX1VQOgotICAgICAgICAgICAgICAgIGhhbmRsZWQgfD0gdXAod2lkZ2V0LCBidWZmZXIpOwotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgY2FzZSBLZXlFdmVudC5LRVlDT0RFX0RQQURfRE9XTjoKLSAgICAgICAgICAgICAgICBoYW5kbGVkIHw9IGRvd24od2lkZ2V0LCBidWZmZXIpOwotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgY2FzZSBLZXlFdmVudC5LRVlDT0RFX0RQQURfTEVGVDoKLSAgICAgICAgICAgICAgICBoYW5kbGVkIHw9IGxlZnQod2lkZ2V0LCBidWZmZXIpOwotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgY2FzZSBLZXlFdmVudC5LRVlDT0RFX0RQQURfUklHSFQ6Ci0gICAgICAgICAgICAgICAgaGFuZGxlZCB8PSByaWdodCh3aWRnZXQsIGJ1ZmZlcik7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgY2FzZSBLZXlFdmVudC5LRVlDT0RFX0RQQURfQ0VOVEVSOgotICAgICAgICAgICAgICAgICAgICBtTWFuYWdlci5vbkZpeFNlbGVjdGVkSXRlbSgpOwotICAgICAgICAgICAgICAgICAgICBoYW5kbGVkID0gdHJ1ZTsKLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICByZXR1cm4gaGFuZGxlZDsKLSAgICAgICAgfQotICAgIH0KLQotICAgIHB1YmxpYyBjbGFzcyBIb3Jpem9udGFsTGluZVNwYW4gZXh0ZW5kcyBJbWFnZVNwYW4gewotICAgICAgICBwdWJsaWMgSG9yaXpvbnRhbExpbmVTcGFuKGludCBjb2xvciwgVmlldyB2aWV3KSB7Ci0gICAgICAgICAgICBzdXBlcihuZXcgSG9yaXpvbnRhbExpbmVEcmF3YWJsZShjb2xvciwgdmlldykpOwotICAgICAgICB9Ci0gICAgfQotICAgIHB1YmxpYyBjbGFzcyBIb3Jpem9udGFsTGluZURyYXdhYmxlIGV4dGVuZHMgU2hhcGVEcmF3YWJsZSB7Ci0gICAgICAgIHByaXZhdGUgVmlldyBtVmlldzsKLSAgICAgICAgcHVibGljIEhvcml6b250YWxMaW5lRHJhd2FibGUoaW50IGNvbG9yLCBWaWV3IHZpZXcpIHsKLSAgICAgICAgICAgIHN1cGVyKG5ldyBSZWN0U2hhcGUoKSk7Ci0gICAgICAgICAgICBtVmlldyA9IHZpZXc7Ci0gICAgICAgICAgICByZW5ld0NvbG9yKGNvbG9yKTsKLSAgICAgICAgICAgIHJlbmV3Qm91bmRzKHZpZXcpOwotICAgICAgICB9Ci0gICAgICAgIEBPdmVycmlkZQotICAgICAgICBwdWJsaWMgdm9pZCBkcmF3KENhbnZhcyBjYW52YXMpIHsKLSAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIGRyYXc6Iik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICByZW5ld0NvbG9yKCk7Ci0gICAgICAgICAgICByZW5ld0JvdW5kcyhtVmlldyk7Ci0gICAgICAgICAgICBzdXBlci5kcmF3KGNhbnZhcyk7Ci0gICAgICAgIH0KLQotICAgICAgICBwcml2YXRlIHZvaWQgcmVuZXdCb3VuZHMoVmlldyB2aWV3KSB7Ci0gICAgICAgICAgICBpZiAoREJHKSB7Ci0gICAgICAgICAgICAgICAgaW50IHdpZHRoID0gbVZpZXcuZ2V0QmFja2dyb3VuZCgpLmdldEJvdW5kcygpLndpZHRoKCk7Ci0gICAgICAgICAgICAgICAgaW50IGhlaWdodCA9IG1WaWV3LmdldEJhY2tncm91bmQoKS5nZXRCb3VuZHMoKS5oZWlnaHQoKTsKLSAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIHJlbmV3Qm91bmRzOiIgKyB3aWR0aCArICIsIiArIGhlaWdodCk7Ci0gICAgICAgICAgICAgICAgTG9nLmQoTE9HX1RBRywgIi0tLSByZW5ld0JvdW5kczoiICsgbVZpZXcuZ2V0Q2xhc3MoKSk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpbnQgd2lkdGggPSBtVmlldy5nZXRXaWR0aCgpOwotICAgICAgICAgICAgaWYgKHdpZHRoID4gMjApIHsKLSAgICAgICAgICAgICAgICB3aWR0aCAtPSAyMDsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHNldEJvdW5kcygwLCAwLCB3aWR0aCwgMik7Ci0gICAgICAgIH0KLSAgICAgICAgcHJpdmF0ZSB2b2lkIHJlbmV3Q29sb3IoaW50IGNvbG9yKSB7Ci0gICAgICAgICAgICBpZiAoREJHKSB7Ci0gICAgICAgICAgICAgICAgTG9nLmQoTE9HX1RBRywgIi0tLSByZW5ld0NvbG9yOiIgKyBjb2xvcik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBnZXRQYWludCgpLnNldENvbG9yKGNvbG9yKTsKLSAgICAgICAgfQotICAgICAgICBwcml2YXRlIHZvaWQgcmVuZXdDb2xvcigpIHsKLSAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIHJlbmV3Q29sb3I6Iik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAobVZpZXcgaW5zdGFuY2VvZiBWaWV3KSB7Ci0gICAgICAgICAgICAgICAgSW1hZ2VTcGFuIHBhcmVudCA9IGdldFBhcmVudFNwYW4oKTsKLSAgICAgICAgICAgICAgICBFZGl0YWJsZSB0ZXh0ID0gKChFZGl0U3R5bGVkVGV4dCltVmlldykuZ2V0VGV4dCgpOwotICAgICAgICAgICAgICAgIGludCBzdGFydCA9IHRleHQuZ2V0U3BhblN0YXJ0KHBhcmVudCk7Ci0gICAgICAgICAgICAgICAgRm9yZWdyb3VuZENvbG9yU3BhbltdIHNwYW5zID0gdGV4dC5nZXRTcGFucyhzdGFydCwgc3RhcnQsIEZvcmVncm91bmRDb2xvclNwYW4uY2xhc3MpOwotICAgICAgICAgICAgICAgIGlmIChzcGFucy5sZW5ndGggPiAwKSB7Ci0gICAgICAgICAgICAgICAgICAgIHJlbmV3Q29sb3Ioc3BhbnNbc3BhbnMubGVuZ3RoIC0gMV0uZ2V0Rm9yZWdyb3VuZENvbG9yKCkpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgICAgICBwcml2YXRlIEltYWdlU3BhbiBnZXRQYXJlbnRTcGFuKCkgewotICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgIExvZy5kKExPR19UQUcsICItLS0gZ2V0UGFyZW50U3BhbjoiKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmIChtVmlldyBpbnN0YW5jZW9mIEVkaXRTdHlsZWRUZXh0KSB7Ci0gICAgICAgICAgICAgICAgRWRpdGFibGUgdGV4dCA9ICgoRWRpdFN0eWxlZFRleHQpbVZpZXcpLmdldFRleHQoKTsKLSAgICAgICAgICAgICAgICBJbWFnZVNwYW5bXSBpbWFnZXMgPSB0ZXh0LmdldFNwYW5zKDAsIHRleHQubGVuZ3RoKCksIEltYWdlU3Bhbi5jbGFzcyk7Ci0gICAgICAgICAgICAgICAgaWYgKGltYWdlcy5sZW5ndGggPiAwKSB7Ci0gICAgICAgICAgICAgICAgICAgIGZvciAoSW1hZ2VTcGFuIGltYWdlO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AgICAgICAgICAgIERldmljZVBvbGljeU1hbmFnZXIgZHBtID0gZ2V0RGV2aWNlUG9saWN5TWFuYWdlcigpOwogICAgICAgICAgICAgaWYgKHBhc3N3b3JkICE9IG51bGwpIHsKICAgICAgICAgICAgICAgICBpbnQgY29tcHV0ZWRRdWFsaXR5ID0gY29tcHV0ZVBhc3N3b3JkUXVhbGl0eShwYXNzd29yZCk7Ci0gICAgICAgICAgICAgICAgc2V0TG9uZyhQQVNTV09SRF9UWVBFX0tFWSwgY29tcHV0ZWRRdWFsaXR5KTsKKyAgICAgICAgICAgICAgICBzZXRMb25nKFBBU1NXT1JEX1RZUEVfS0VZLCBNYXRoLm1heChxdWFsaXR5LCBjb21wdXRlZFF1YWxpdHkpKTsKICAgICAgICAgICAgICAgICBpZiAoY29tcHV0ZWRRdWFsaXR5ICE9IERldmljZVBvbGljeU1hbmFnZXIuUEFTU1dPUkRfUVVBTElUWV9VTlNQRUNJRklFRCkgewotICAgICAgICAgICAgICAgICAgICBkcG0uc2V0QWN0aXZlUGFzc3dvcmRTdGF0ZShjb21wdXRlZFF1YWxpdHksIHBhc3N3b3JkLmxlbmd0aCgpKTsKKyAgICAgICAgICAgICAgICAgICAgaW50IGxldHRlcnMgPSAwOworICAgICAgICAgICAgICAgICAgICBpbnQgdXBwZXJjYXNlID0gMDsKKyAgICAgICAgICAgICAgICAgICAgaW50IGxvd2VyY2FzZSA9IDA7CisgICAgICAgICAgICAgICAgICAgIGludCBudW1iZXJzID0gMDsKKyAgICAgICAgICAgICAgICAgICAgaW50IHN5bWJvbHMgPSAwOworICAgICAgICAgICAgICAgICAgICBpbnQgbm9ubGV0dGVyID0gMDsKKyAgICAgICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBwYXNzd29yZC5sZW5ndGgoKTsgaSsrKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBjaGFyIGMgPSBwYXNzd29yZC5jaGFyQXQoaSk7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYyA+PSAnQScgJiYgYyA8PSAnWicpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXR0ZXJzKys7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXBwZXJjYXNlKys7CisgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGMgPj0gJ2EnICYmIGMgPD0gJ3onKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0dGVycysrOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxvd2VyY2FzZSsrOworICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChjID49ICcwJyAmJiBjIDw9ICc5JykgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bWJlcnMrKzsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBub25sZXR0ZXIrKzsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3ltYm9scysrOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5vbmxldHRlcisrOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGRwbS5zZXRBY3RpdmVQYXNzd29yZFN0YXRlKE1hdGgubWF4KHF1YWxpdHksIGNvbXB1dGVkUXVhbGl0eSksIHBhc3N3b3JkCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLmxlbmd0aCgpLCBsZXR0ZXJzLCB1cHBlcmNhc2UsIGxvd2VyY2FzZSwgbnVtYmVycywgc3ltYm9scywgbm9ubGV0dGVyKTsKICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAvLyBUaGUgcGFzc3dvcmQgaXMgbm90IGFueXRoaW5nLgogICAgICAgICAgICAgICAgICAgICBkcG0uc2V0QWN0aXZlUGFzc3dvcmRTdGF0ZSgKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBEZXZp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AgICAgICAgICAgIC8vIEN1dCBpdCB0byBjb250YWluIHBhc3N3b3JkSGlzdG9yeUxlbmd0aCBoYXNoZXMKKyAgICAgICAgICAgICAgICAgICAgLy8gYW5kIHBhc3N3b3JkSGlzdG9yeUxlbmd0aCAtMSBjb21tYXMuCisgICAgICAgICAgICAgICAgICAgIHBhc3N3b3JkSGlzdG9yeSA9IHBhc3N3b3JkSGlzdG9yeS5zdWJzdHJpbmcoMCwgTWF0aC5taW4oaGFzaC5sZW5ndGgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAqIHBhc3N3b3JkSGlzdG9yeUxlbmd0aCArIHBhc3N3b3JkSGlzdG9yeUxlbmd0aCAtIDEsIHBhc3N3b3JkSGlzdG9yeQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5sZW5ndGgoKSkpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBzZXRTdHJpbmcoUEFTU1dPUkRfSElTVE9SWV9LRVksIHBhc3N3b3JkSGlzdG9yeSk7CiAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgIGRwbS5zZXRBY3RpdmVQYXNzd29yZFN0YXRlKAotICAgICAgICAgICAgICAgICAgICAgICAgRGV2aWNlUG9saWN5TWFuYWdlci5QQVNTV09SRF9RVUFMSVRZX1VOU1BFQ0lGSUVELCAwKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIERldmljZVBvbGljeU1hbmFnZXIuUEFTU1dPUkRfUVVBTElUWV9VTlNQRUNJRklFRCwgMCwgMCwgMCwgMCwgMCwgMCwgMCk7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0gY2F0Y2ggKEZpbGVOb3RGb3VuZEV4Y2VwdGlvbiBmbmZlKSB7CiAgICAgICAgICAgICAvLyBDYW50IGRvIG11Y2gsIHVubGVzcyB3ZSB3YW50IHRvIGZhaWwgb3ZlciB0byB1c2luZyB0aGUgc2V0dGluZ3MgcHJvdmlkZXIKQEAgLTUyNiw3ICs2Mjks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ldywgdHJ1ZSk7CisgICAgfQorCisgICAgcHVibGljIFBhc3N3b3JkRW50cnlLZXlib2FyZEhlbHBlcihDb250ZXh0IGNvbnRleHQsIEtleWJvYXJkVmlldyBrZXlib2FyZFZpZXcsIFZpZXcgdGFyZ2V0VmlldywKKyAgICAgICAgICAgIGJvb2xlYW4gdXNlRnVsbFNjcmVlbldpZHRoKSB7CiAgICAgICAgIG1Db250ZXh0ID0gY29udGV4dDsKICAgICAgICAgbVRhcmdldFZpZXcgPSB0YXJnZXRWaWV3OwogICAgICAgICBtS2V5Ym9hcmRWaWV3ID0ga2V5Ym9hcmRWaWV3OwotICAgICAgICBjcmVhdGVLZXlib2FyZHMoKTsKKyAgICAgICAgaWYgKHVzZUZ1bGxTY3JlZW5XaWR0aCB8fCBtS2V5Ym9hcmRWaWV3LmdldExheW91dFBhcmFtcygpLndpZHRoID09IC0xKSB7CisgICAgICAgICAgICBjcmVhdGVLZXlib2FyZHMoKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIGNyZWF0ZUtleWJvYXJkc1dpdGhTcGVjaWZpY1NpemUobUtleWJvYXJkVmlldy5nZXRMYXlvdXRQYXJhbXMoKS53aWR0aCwKKyAgICAgICAgICAgICAgICAgICAgbUtleWJvYXJkVmlldy5nZXRMYXlvdXRQYXJhbXMoKS5oZWlnaHQpOworICAgICAgICB9CiAgICAgICAgIG1LZXlib2FyZFZpZXcuc2V0T25LZXlib2FyZEFjdGlvbkxpc3RlbmVyKHRoaXMpOwogICAgICAgICBtVmlicmF0b3IgPSBuZXcgVmlicmF0b3IoKTsKICAgICB9CkBAIC02Niw2ICs3NiwyOSBAQAogICAgICAgICByZXR1cm4gbUtleWJvYXJkTW9kZSA9PSBLRVlCT0FSRF9NT0RFX0FMUEhBOwogICAgIH0KIAorICAgIHByaXZhdGUgdm9pZCBjcmVhdGVLZXlib2FyZHNXaXRoU3BlY2lmaWNTaXplKGludCB2aWV3V2lkdGgsIGludCB2aWV3SGVpZ2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ICAgICAgICAgIExvZy5lKCJTbGlkaW5nVGFiIiwgIlNsaWRpbmdUYWIgY2Fubm90IGhhdmUgVU5TUEVDSUZJRUQgTWVhc3VyZVNwZWMiCi0gICAgICAgICAgICAgICAgICAgICsiKHdzcGVjPSIgKyB3aWR0aFNwZWNNb2RlICsgIiwgaHNwZWM9IiArIGhlaWdodFNwZWNNb2RlICsgIikiLAotICAgICAgICAgICAgICAgICAgICBuZXcgUnVudGltZUV4Y2VwdGlvbihMT0dfVEFHICsgInN0YWNrOiIpKTsKKyAgICAgICAgaWYgKERCRykgeworICAgICAgICAgICAgaWYgKHdpZHRoU3BlY01vZGUgPT0gTWVhc3VyZVNwZWMuVU5TUEVDSUZJRUQgCisgICAgICAgICAgICAgICAgICAgIHx8IGhlaWdodFNwZWNNb2RlID09IE1lYXN1cmVTcGVjLlVOU1BFQ0lGSUVEKSB7CisgICAgICAgICAgICAgICAgTG9nLmUoIlNsaWRpbmdUYWIiLCAiU2xpZGluZ1RhYiBjYW5ub3QgaGF2ZSBVTlNQRUNJRklFRCBNZWFzdXJlU3BlYyIKKyAgICAgICAgICAgICAgICAgICAgICAgICsiKHdzcGVjPSIgKyB3aWR0aFNwZWNNb2RlICsgIiwgaHNwZWM9IiArIGhlaWdodFNwZWNNb2RlICsgIikiLAorICAgICAgICAgICAgICAgICAgICAgICAgbmV3IFJ1bnRpbWVFeGNlcHRpb24oTE9HX1RBRyArICJzdGFjazoiKSk7CisgICAgICAgICAgICB9CiAgICAgICAgIH0KIAogICAgICAgICBtTGVmdFNsaWRlci5tZWFzdXJlKCk7CkBAIC02MDgsMTQgKzYxMCw3IEBACiAKICAgICAgICAgICAgICAgICBjYXNlIE1vdGlvbkV2ZW50LkFDVElPTl9VUDoKICAgICAgICAgICAgICAgICBjYXNlIE1vdGlvbkV2ZW50LkFDVElPTl9DQU5DRUw6Ci0gICAgICAgICAgICAgICAgICAgIG1UcmFja2luZyA9IGZhbHNlOwotICAgICAgICAgICAgICAgICAgICBtVHJpZ2dlcmVkID0gZmFsc2U7Ci0gICAgICAgICAgICAgICAgICAgIG1PdGhlclNsaWRlci5zaG93KHRydWUpOwotICAgICAgICAgICAgICAgICAgICBtQ3VycmVudFNsaWRlci5yZXNldChmYWxzZSk7Ci0gICAgICAgICAgICAgICAgICAgIG1DdXJyZW50U2xpZGVyLmhpZGVUYXJnZXQoKTsKLSAgICAgICAgICAgICAgICAgICAgbUN1cnJlbnRTbGlkZXIgPSBudWxsOwotICAgICAgICAgICAgICAgICAgICBtT3RoZXJTbGlkZXIgPSBudWxsOwotICAgICAgICAgICAgICAgICAgICBzZXRHcmFiYmVkU3RhdGUoT25UcmlnZ2VyTGlzdGVuZXIuTk9fSEFORExFKTsKKyAgICAgICAgICAgICAgICAgICAgY2FuY2VsR3JhYigpOwogICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgIH0KICAgICAgICAgfQpAQCAtNjIzLDYgKzYxOCwxNyBAQAogICAgICAgICByZXR1cm4gbVRyYWNraW5nIHx8IHN1cGVyLm9uVG91Y2hFdmVudChldmVudCk7CiAgICAgfQogCisgICAgcHJpdmF0ZSB2b2lkIGNhbmNlbEdyYWIoKSB7CisgICAgICAgIG1UcmFja2luZyA9IGZhbHNlOworICAgICAgICBtVHJpZ2dlcmVkID0gZmFsc2U7CisgICAgICAgIG1PdGhlclNsaWRlci5zaG93KHRydWUpOworICAgICAgICBtQ3VycmVudFNsaWRlci5yZXNldChmYWxzZSk7CisgICAgICAgIG1DdXJyZW50U2xpZGVyLmhpZGVUYXJnZXQoKTsKKyAgICAgICAgbUN1cnJlbnRTbGlkZXIgPSBudWxsOworICAgICAgICBtT3RoZXJTbGlkZXIgPSBudWxsOworICAgICAgICBzZXRHcmFiYmVkU3RhdGUoT25UcmlnZ2VyTGlzdGVuZXIuTk9fSEFORExFKTsKKyAgICB9CisKICAgICB2b2lkIHN0YXJ0QW5pbWF0aW5nKGZpbmFsIGJvb2xlYW4gaG9sZEFmdGVyKSB7CiAgICA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6ZShjcm9zcyhmLCB1cCkpOworICAgIGZsb2F0MyB1ID0gY3Jvc3MocywgZik7CisgICAgZmxvYXQgbVsxNl07CisgICAgbVswXSA9IHMueDsKKyAgICBtWzRdID0gcy55OworICAgIG1bOF0gPSBzLno7CisgICAgbVsxMl0gPSAwLjBmOworICAgIG1bMV0gPSB1Lng7CisgICAgbVs1XSA9IHUueTsKKyAgICBtWzldID0gdS56OworICAgIG1bMTNdID0gMC4wZjsKKyAgICBtWzJdID0gLWYueDsKKyAgICBtWzZdID0gLWYueTsKKyAgICBtWzEwXSA9IC1mLno7CisgICAgbVsxNF0gPSAwLjBmOworICAgIG1bM10gPSBtWzddID0gbVsxMV0gPSAwLjBmOworICAgIG1bMTVdID0gMS4wZjsKKyAgICByc01hdHJpeExvYWQobWF0cml4LCBtKTsKKyAgICByc01hdHJpeFRyYW5zbGF0ZShtYXRyaXgsIC1leWUueCwgLWV5ZS55LCAtZXllLnopOworfQorCit2b2lkIHNldFRleHR1cmUoaW50IG4sIHJzX2FsbG9jYXRpb24gdGV4dHVyZSkKK3sKKyAgICBjYXJkc1tuXS50ZXh0dXJlID0gdGV4dHVyZTsKKyAgICBpZiAoY2FyZHNbbl0udGV4dHVyZS5wICE9IDApCisgICAgICAgIGNhcmRzW25dLnRleHR1cmVTdGF0ZSA9IFNUQVRFX0xPQURFRDsKKyAgICBlbHNlCisgICAgICAgIGNhcmRzW25dLnRleHR1cmVTdGF0ZSA9IFNUQVRFX0lOVkFMSUQ7Cit9CisKK3ZvaWQgc2V0R2VvbWV0cnkoaW50IG4sIHJzX21lc2ggZ2VvbWV0cnkpCit7CisgICAgY2FyZHNbbl0uZ2VvbWV0cnkgPSBnZW9tZXRyeTsKKyAgICBpZiAoY2FyZHNbbl0uZ2VvbWV0cnkucCAhPSAwKQorICAgICAgICBjYXJkc1tuXS5nZW9tZXRyeVN0YXRlID0gU1RBVEVfTE9BREVEOworICAgIGVsc2UKKyAgICAgICAgY2FyZHNbbl0uZ2VvbWV0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ZyYWdtZW50UHJvZ3JhbSwgMCwgZGVmYXVsdFRleHR1cmUpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICAvLyBEcmF3IGdlb21ldHJ5CisgICAgICAgICAgICByc19tYXRyaXg0eDQgbWF0cml4ID0gbW9kZWx2aWV3TWF0cml4OworICAgICAgICAgICAgZ2V0TWF0cml4Rm9yQ2FyZCgmbWF0cml4LCBpKTsKKyAgICAgICAgICAgIHJzZ1Byb2dyYW1WZXJ0ZXhMb2FkTW9kZWxNYXRyaXgoJm1hdHJpeCk7CisgICAgICAgICAgICBpZiAoY2FyZHNbaV0uZ2VvbWV0cnlTdGF0ZSA9PSBTVEFURV9MT0FERUQgJiYgY2FyZHNbaV0uZ2VvbWV0cnkucCAhPSAwKSB7CisgICAgICAgICAgICAgICAgcnNnRHJhd01lc2goY2FyZHNbaV0uZ2VvbWV0cnkpOworICAgICAgICAgICAgfSBlbHNlIGlmIChjYXJkc1tpXS5nZW9tZXRyeVN0YXRlID09IFNUQVRFX0xPQURJTkcgJiYgbG9hZGluZ0dlb21ldHJ5LnAgIT0gMCkgeworICAgICAgICAgICAgICAgIHJzZ0RyYXdNZXNoKGxvYWRpbmdHZW9tZXRyeSk7CisgICAgICAgICAgICB9IGVsc2UgaWYgKGRlZmF1bHRHZW9tZXRyeS5wICE9IDApIHsKKyAgICAgICAgICAgICAgICByc2dEcmF3TWVzaChkZWZhdWx0R2VvbWV0cnkpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAvLyBEcmF3IHBsYWNlLWhvbGRlciBnZW9tZXRyeQorICAgICAgICAgICAgICAgIHJzZ0RyYXdRdWFkKAorICAgICAgICAgICAgICAgICAgICBjYXJkVmVydGljZXNbMF0ueCwgY2FyZFZlcnRpY2VzWzBdLnksIGNhcmRWZXJ0aWNlc1swXS56LAorICAgICAgICAgICAgICAgICAgICBjYXJkVmVydGljZXNbMV0ueCwgY2FyZFZlcnRpY2VzWzFdLnksIGNhcmRWZXJ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IC8vIGF2ZyB2ZWxvY2l0eQorICAgIGlmIChmYWJzKHZlbG9jaXR5KSA+IHZlbG9jaXR5VGhyZXNob2xkKSB7CisgICAgICAgIGFuaW1hdGluZyA9IHRydWU7CisgICAgICAgIHJzU2VuZFRvQ2xpZW50KENNRF9BTklNQVRJT05fU1RBUlRFRCk7CisgICAgfSBlbHNlIHsKKyAgICAgICAgY29uc3QgaW50IHNlbGVjdGlvbiA9IGRvU2VsZWN0aW9uKHgsIHkpOyAgLy8gdmVsb2NpdHkgdG9vIHNtYWxsOyB0cmVhdCBhcyBhIHRhcAorICAgICAgICBpZiAoc2VsZWN0aW9uICE9IC0xKSB7CisgICAgICAgICAgICByc0RlYnVnKCJISVQhIiwgc2VsZWN0aW9uKTsKKyAgICAgICAgICAgIGludCBkYXRhWzFdOworICAgICAgICAgICAgZGF0YVswXSA9IHNlbGVjdGlvbjsKKyAgICAgICAgICAgIHJzU2VuZFRvQ2xpZW50KENNRF9DQVJEX1NFTEVDVEVELCBkYXRhLCBzaXplb2YoZGF0YSkpOworICAgICAgICB9CisgICAgfQorICAgIGxhc3RUaW1lID0gcnNVcHRpbWVNaWxsaXMoKTsKK30KKwordm9pZCBkb01vdGlvbihmbG9hdCB4LCBmbG9hdCB5KQoreworICAgIGludDY0X3QgY3VycmVudFRpbWUgPSByc1VwdGltZU1pbGxpcygpOworICAgIGZsb2F0IGRlbHRhT21lZ2EgPSBkcmFnRnVuY3Rpb24oeCwgeSk7CisgICAgYmlhcyArPSBkZWx0YU9tZWdhOworICAgIGxhc3RQb3NpdGlvbi54ID0geDsKKyAgICBsYXN0UG9zaXRpb24ueSA9IHk7CisgICAgZmxvYXQgZHQgPSBkZWx0YVRpbWVJblNlY29uZHMoY3VycmVudFRpbWUpOworICAgIGlmIChkdCA+IDAuMGYpIHsKKyAgICAgICAgZmxvYXQgdiA9IGRlbHRhT21lZ2EgLyBkdDsKKyAgICAgICAgLy9pZiAoKHZlbG9jaXR5VHJhY2tlciA+IDAuMGY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0geyBleWUueCwgZXllLnksIGV5ZS56IH07CisgICAgICAgIGNvbnN0IGZsb2F0MyBhdFBvaW50ID0geyBhdC54LCBhdC55LCBhdC56IH07CisgICAgICAgIGNvbnN0IGZsb2F0MyByYXlEaXIgPSBub3JtYWxpemUoYXRQb2ludCAtIHJheVBvaW50KTsKKyAgICAgICAgaWYgKGRlYnVnQ2FtZXJhKSB7CisgICAgICAgICAgICByc0RlYnVnKCJ3aW54OiAiLCB3aW54KTsKKyAgICAgICAgICAgIHJzRGVidWcoIndpbnk6ICIsIHdpbnkpOworICAgICAgICAgICAgcnNEZWJ1ZygiUmF5IHBvc2l0aW9uICh0cmFuc2Zvcm1lZCkgPSAiLCBleWUpOworICAgICAgICAgICAgcnNEZWJ1ZygiUmF5IGRpcmVjdGlvbiAodHJhbnNmb3JtZWQpID0gIiwgcmF5RGlyKTsKKyAgICAgICAgfQorICAgICAgICByYXktPnBvc2l0aW9uID0gIHJheVBvaW50OworICAgICAgICByYXktPmRpcmVjdGlvbiA9IHJheURpcjsKKyAgICB9CisKKyAgICByZXR1cm4gdHJ1ZTsKK30KKworc3RhdGljIGludCBpbnRlcnNlY3RHZW9tZXRyeShSYXkqIHJheSwgZmxvYXQgKmJlc3RUaW1lKQoreworICAgIGludCBoaXQgPSAtMTsKKyAgICBmb3IgKGludCBpZCA9IDA7IGlkIDwgY2FyZENvdW50OyBpZCsrKSB7CisgICAgICAgIGlmIChjYXJkc1tpZF0udmlzaWJsZSkgeworICAgICAgICAgICAgcnNfbWF0cml4NHg0IG1hdHJpeDsKKyAgICAgICAgICAgIGZsb2F0MyBwWzRdOworCisgICAgICAgICAgICAvLyBUcmFuc2Zvcm0gY2FyZCB2ZXJ0aWNlcyB0byB3b3JsZCBzcGFjZQorICAgICAgICAgICAgcnNNYXRyaXhMb2FkSWRlbnRpdHkoJm1hdHJpeCk7CisgICAgICAgICAgICBnZXRNYXRyaXhGb3JDYXJkKCZtYXRyaXgsIGlkKTsKKyAgICAgICAgICAgIGZvciAoaW50IHZlcnRleCA9IDA7IHZlcnRleCA8IDQ7IHZlcnRleCsrKSB7CisgICAgICAgICAgICAgICAgZmxvYXQ0IHRtcCA9IHJzTWF0cml4TXVsdGlwbHkoJm1hdHJpeCwgY2FyZFZlcnRpY2VzW3ZlcnRleF0pOworICAgICAgICAgICAgICAgIGlmICh0bXAudyAhPSAwLjBmKSB7CisgICAgICAgICAgICAgICAgICAgIHBbdmVydGV4XS54ID0gdG1wLng7CisgICAgICAgICAgICAgICAgICAgIHBbdmVydGV4XS55ID0gdG1wLnk7CisgICAgICAgICAgICAgICAgICAgIHBbdmVydGV4XS56ID0gdG1wLno7CisgICAgICAgICAgICAgICAgICAgIHBbdmVydGV4XSAqPSAxLjBmIC8gdG1wLnc7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgcnNEZWJ1ZygiQmFkIHcgY29vcmQ6ICIsIHRtcCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorCisgICAgICAgICAgICAvLyBJbnRlcnNlY3QgY2FyZCBnZW9tZXRyeQorICAgICAgICAgICAgaWYgKHJheVRyaWFuZ2xlSW50ZXJzZWN0KHJheSwgcFswXSwgcFsxXSwgcFsyXSwgYmVzdFRpbWUpCisgICAgICAgICAgICAgICAgfHwgcmF5VHJpYW5nbGVJbnRlcnNlY3QocmF5LCBwWzJdLCBwWzNdLCBwWzBdLCBiZXN0VGltZSkpIHsKKyAgICAgICAgICAgICAgICBoaXQgPSBpZDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKyAgICByZXR1cm4gaGl0OworfQorCisvLyBUaGlzIG1ldGhvZCBjb21wdXRlcyB0aGUgcG9zaXRpb24gb2YgYWxsIHRoZSBjYXJkcyBieSB1cGRhdGluZyBiaWFzIGJhc2VkIG9uIGEKKy8vIHNpbXBsZSBwaHlzaWNzIG1vZGVsLgorLy8gSWYgdGhlIGNhcmRzIGFyZSBzdGlsbCBpbiBt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ZyYWN0aW9uYWwgcG9zaXRpb24gYmV0d2VlbiBzbG90cworICAgICAgICAgICAgZmxvYXQgeDsKKyAgICAgICAgICAgIGlmIChmcmFjdGlvbiA+IDAuNWYpIHsKKyAgICAgICAgICAgICAgICB4ID0gLSAoMS4wZiAtIGZyYWN0aW9uKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgeCA9IGZyYWN0aW9uOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY29uc3QgZmxvYXQgRnIgPSAtIHNwcmluZ0NvbnN0YW50ICogeDsKKworICAgICAgICAgICAgLy8gY29tcHV0ZSB2ZWxvY2l0eQorICAgICAgICAgICAgY29uc3QgZmxvYXQgbW9tZW50dW0gPSBtYXNzICogdmVsb2NpdHkgKyAoRmYgKyBGcikqZHQ7CisgICAgICAgICAgICB2ZWxvY2l0eSA9IG1vbWVudHVtIC8gbWFzczsKKyAgICAgICAgICAgIGJpYXMgKz0gdmVsb2NpdHkgKiBkdDsKKyAgICAgICAgfQorCisgICAgICAgIC8vIFRPRE86IEFkZCBhbmltYXRpb24gdG8gc21vb3RobHkgbW92ZSBiYWNrIHRvIHNsb3RzLiBDdXJyZW50bHkgc25hcHMgdG8gbG9jYXRpb24uCisgICAgICAgIGlmIChjYXJkQ291bnQgPD0gdmlzaWJsZVNsb3RDb3VudCkgeworICAgICAgICAgICAgLy8gVE9ETzogdGhpcyBhbGlnbnMgdGhlIGNhcmRzIHRvIHRoZSBmaXJzdCBzbG90ICh0aGV0YSA9IHN0YXJ0QW5nbGUpIHdoZW4gdGhlcmUgYXJlbid0CisgICAgICAgICAgICAvLyBlbm91Z2ggdmlzaWJsZSBjYXJkcy4gSXQgc2hvdWxkIGJlIGdlbmVyYWxpemVkIHRvIGFsbG93IGFsaWdubWVudCB0byBmcm9udCwKKyAgICAgICAgICAgIC8vIG1pZGRsZSBvciBiYWNrIG9mIHRoZSBzdGFjay4KKyAgICAgICAgICAgIGlmIChjYXJkUG9zaXRpb24oMCkgIT0gc2xvdFBvc2l0aW9uKDApKSB7CisgICAgICAgICAgICAgICAgYmlhcyA9IDAuMGY7CisgICAgICAgICAgICB9CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBpZiAoY2FyZFBvc2l0aW9uKGNhcmRDb3VudCkgPCAwLjBmKSB7CisgICAgICAgICAgICAgICAgYmlhcyA9IC1zbG90UG9zaXRpb24oY2FyZENvdW50KTsKKyAgICAgICAgICAgIH0gZWxzZSBpZiAoY2FyZFBvc2l0aW9uKDApID4gc2xvdFBvc2l0aW9uKDApKSB7CisgICAgICAgICAgICAgICAgYmlhcyA9IDAuMGY7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBhbmltYXRpbmcgPSBmYWJzKHZlbG9jaXR5KSA+IHZlbG9jaXR5VGhyZXNob2xkOworICAgICAgICBpZiAoIWFuaW1hdGluZykgeworICAgICAgICAgICAgY29uc3QgZmxvYXQgZHRoZXRhID0gMi4wZiAqIE1fUEkgLyBzbG90Q291bnQ7CisgICAgICAgICAgICBiaWFzID0gcm91bmQoKHN0YXJ0QW5nbGUgKyBiaWFzKSAvIGR0aGV0YSkgKiBkdGhldGEgLSBzdGFydEFuZ2xlOworICAgICAgICAgICAgcnNTZW5kVG9DbGllbnQoQ01EX0FOSU1BVElPTl9GSU5JU0hFRCk7CisgICAgICAgIH0KKyAgICB9CisgICAgbGFzdFRpbWUgPSBjdXJyZW50VGltZTsKKworICAgIHJldHVybiBhbmltYXRpbmc7Cit9CisKKy8vIEN1bGwgY2FyZHMgYmFzZWQgb24gdmlzaWJpbGl0eSBhbmQgdmlzaWJsZVNsb3RDb3VudC4KKy8vIElmIHZpc2libGVTbG90Q291bnQgaXMgPiAwLCB0aGVuIG9ubHkgc2hvdyB0aG9zZSBzbG90cyBhbmQgY3VsbCB0aGUgcmVzdC4KKy8vIE90aGVyd2lzZSwgaXQgc2hvdWxkIGN1bGwgYmFzZWQgb24gYm91bmRzIG9mIGdlb21ldHJ5Lgorc3RhdGljIGludCBjdWxsQ2FyZHMoKQoreworICAgIGNvbnN0IGZsb2F0IHRoZXRhRmlyc3QgPSBzbG90UG9zaXRpb24oLTEpOyAvLyAtMSBrZWVwcyB0aGUgY2FyZCBpbiBmcm9udCBhcm91bmQgYSBiaXQgbG9uZ2VyCisgICAgY29uc3QgZmxvYXQgdGhldGFMYXN0ID0gc2xvdFBvc2l0aW9uKHZpc2libGVTbG90Q291bnQpOworCisgICAgaW50IGNvdW50ID0gMDsKKyAgICBmb3IgKGludCBpID0gMDsgaSA8IGNhcmRDb3VudDsgaSsrKSB7CisgICAgICAgIGlmICh2aXNpYmxlU2xvdENvdW50ID4gMCkgeworICAgICAgICAgICAgLy8gSWYgdmlzaWJsZVNsb3RDb3VudCBpcyBzcGVjaWZpZWQsIHRoZW4gb25seSBzaG93IHVwIHRvIHZpc2libGVTbG90Q291bnQgY2FyZHMuCisgICAgICAgICAgICBmbG9hdCBwID0gY2FyZFBvc2l0aW9uKGkpOworICAgICAgICAgICAgaWYgKHAgPj0gdGhldGFGaXJzdCAmJiBwIDwgdGhldGFMYXN0KSB7CisgICAgICAgICAgICAgICAgY2FyZHNbaV0udmlzaWJsZSA9IHRydWU7CisgICAgICAgICAgICAgICAgY291bnQrKzsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgY2FyZHNbaV0udmlzaWJsZSA9IGZhbHNlOworICAgICAgICAgICAgfQorICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgLy8gQ3VsbCB0aGUgcmVzdCBvZiB0aGUgY2FyZHMgdXNpbmcgYm91bmRpbmcgYm94IG9mIGdlb21ldHJ5LgorICAgICAgICAgICAgLy8gVE9ETworICAgICAgICAgICAgY2FyZHNbaV0udmlzaWJsZSA9IHRydWU7CisgICAgICAgICAgICBjb3VudCsrOworICAgICAgICB9CisgICAgfQorICAgIHJldHVybiBjb3VudDsKK30KKworLy8gUmVxdWVzdCB0ZXh0dXJlL2dlb21ldHJ5IGZvciBpdGVtcyB0aGF0IGhhdmUgY29tZSBpbnRvIHZpZXcKKy8vIG9yIGRvZXNuJ3QgaGF2ZSBhIHRleHR1cmUgeWV0Lgorc3RhdGljIHZvaWQgdXBkYXRlQ2FyZFJlc291cmNlcygpCit7CisgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBjYXJkQ291bnQ7IGkrKykgeworICAgICAgICBpbnQgZGF0YVsxXTsKKyAgICAgICAgaWYgKGNhcmRzW2ldLnZpc2libGUpIHsKKyAgICAgICAgICAgIC8vIHJlcXVlc3QgdGV4dHVyZSBmcm9tIGNsaWVudCBpZiBub3QgbG9hZGVkCisgICAgICAgICAgICBpZiAoY2FyZHNbaV0udGV4dHVyZVN0YXRlID09IFNUQVRFX0lOVkFMSUQpIHsKKyAgICAgICAgICAgICAgICBkYXRhWzBdID0gaTsKKyAgICAgICAgICAgICAgICBib29sIGVucXVldWVkID0gcnNTZW5kVG9DbGllbnQoQ01EX1JFUVVFU1RfVEVYVFVSRSwgZGF0YSwgc2l6ZW9mKGRhdGEpKTsKKyAgICAgICAgICAgICAgICBpZiAoZW5xdWV1ZWQpIHsKKyAgICAgICAgICAgICAgICAgICAgY2FyZHNbaV0udGV4dHVyZVN0YXRlID0gU1RBVEVfTE9BRElORzsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICByc0RlYnVnKCJDb3VsZG4ndCBzZW5kIENNRF9SRVFVRVNUX1RFWFRVUkUiLCAwKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICAvLyByZXF1ZXN0IGdlb21ldHJ5IGZyb20gY2xpZW50IGlmIG5vdCBsb2FkZWQKKyAgICAgICAgICAgIGlmIChjYXJkc1tpXS5nZW9tZXRyeVN0YXRlID09IFNUQVRFX0lOVkFMSUQpIHsKKyAgICAgICAgICAgICAgICBkYXRhWzBdID0gaTsKKyAgICAgICAgICAgICAgICBib29sIGVucXVldWVkID0gcnNTZW5kVG9DbGllbnQoQ01EX1JFUVVFU1RfR0VPTUVUUlksIGRhdGEsIHNpemVvZihkYXRhKSk7CisgICAgICAgICAgICAgICAgaWYgKGVucXVldWVkKSB7CisgICAgICAgICAgICAgICAgICAgIGNhcmRzW2ldLmdlb21ldHJ5U3RhdGUgPSBTVEFURV9MT0FESU5HOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIHJzRGVidWcoIkNvdWxkbid0IHNlbmQgQ01EX1JFUVVFU1RfR0VPTUVUUlkiLCAwKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAvLyBhc2sgdGhlIGhvc3QgdG8gcmVtb3ZlIHRoZSB0ZXh0dXJlCisgICAgICAgICAgICBpZiAoY2FyZHNbaV0udGV4dHVyZVN0YXRlID09IFNUQVRFX0xPQURFRCkgeworICAgICAgICAgICAgICAgIGRhdGFbMF0gPSBpOworICAgICAgICAgICAgICAgIGJvb2wgZW5xdWV1ZWQgPSB0cnVlOworICAgICAgICAgICAgICAgIHJzU2VuZFRvQ2xpZW50QmxvY2tpbmcoQ01EX0lOVkFMSURBVEVfVEVYVFVSRSwgZGF0YSwgc2l6ZW9mKGRhdGEpKTsKKyAgICAgICAgICAgICAgICBpZiAoZW5xdWV1ZWQpIHsKKyAgICAgICAgICAgICAgICAgICAgY2FyZHNbaV0udGV4dHVyZVN0YXRlID0gU1RBVEVfSU5WQUxJRDsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICByc0RlYnVnKCJDb3VsZG4ndCBzZW5kIENNRF9JTlZBTElEQVRFX1RFWFRVUkUiLCAwKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICAvLyBhc2sgdGhlIGhvc3QgdG8gcmVtb3ZlIHRoZSBnZW9tZXRyeQorICAgICAgICAgICAgaWYgKGNhcmRzW2ldLmdlb21ldHJ5U3RhdGUgPT0gU1RBVEVfTE9BREVEKSB7CisgICAgICAgICAgICAgICAgZGF0YVswXSA9IGk7CisgICAgICAgICAgICAgICAgYm9vbCBlbnF1ZXVlZCA9IHRydWU7CisgICAgICAgICAgICAgICAgcnNTZW5kVG9DbGllbnRCbG9ja2luZyhDTURfSU5WQUxJREFURV9HRU9NRVRSWSwgZGF0YSwgc2l6ZW9mKGRhdGEpKTsKKyAgICAgICAgICAgICAgICBpZiAoZW5xdWV1ZWQpIHsKKyAgICAgICAgICAgICAgICAgICAgY2FyZHNbaV0uZ2VvbWV0cnlTdGF0ZSA9IFNUQVRFX0lOVkFMSUQ7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgcnNEZWJ1ZygiQ291bGRuJ3Qgc2VuZCBDTURfSU5WQUxJREFURV9HRU9NRVRSWSIsIDApOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKworICAgICAgICB9CisgICAgfQorfQorCisvLyBQbGFjZXMgZG90cyBvbiBnZW9tZXRyeSB0byB2aXN1YWxseSBpbnNwZWN0IHRoYXQgb2JqZWN0cyBjYW4gYmUgc2VlbiBieSByYXlzLgorLy8gTk9URTogdGhlIGNvbG9yIG9mIHRoZSBkb3QgaXMgc29tZXdoYXQgcmFuZG9tLCBhcyBpdCBkZXBlbmRzIG9uIHRleHR1cmUgb2YgcHJldmlvdXNseS1yZW5kZXJlZAorLy8gY2FyZC4KK3N0YXRpYyB2b2lkIHJlbmRlcldpdGhSYXlzKCkKK3sKKyAgICBjb25zdCBmbG9hdCB3ID0gcnNnR2V0V2lkdGgoKTsKKyAgICBjb25zdCBmbG9hdCBoID0gcnNnR2V0SGVpZ2h0KCk7CisgICAgY29uc3QgaW50IHNraXAgPSA4OworICAgIGNvbG9yKDEuMGYsIDAuMGYsIDAuMGYsIDEuMGYpOworICAgIGZvciAoaW50IGogPSAwOyBqIDwgKGludCkgaDsgais9c2tpcCkgeworICAgICAgICBmbG9hdCBwb3NZID0gKGZsb2F0KSBqOworICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IChpbnQpIHc7IGkrPXNraXApIHsKKyAgICAgICAgICAgIGZsb2F0IHBvc1ggPSAoZmxvYXQpIGk7CisgICAgICAgICAgICBSYXkgcmF5OworICAgICAgICAgICAgaWYgKG1ha2VSYXlGb3JQaXhlbEF0KCZyYXksIHBvc1gsIHBvc1kpKSB7CisgICAgICAgICAgICAgICAgZmxvYXQgYmVzdFRpbWUgPSBGTFRfTUFYOworICAgICAgICAgICAgICAgIGlmIChpbnRlcnNlY3RHZW9tZXRyeSgmcmF5LCAmYmVzdFRpbWUpICE9IC0xKSB7CisgICAgICAgICAgICAgICAgICAgIHJzZ0RyYXdTcHJpdGVTY3JlZW5zcGFjZShwb3NYLCBwb3NZLCAwLjBmLCAyLjBmLCAyLjBmKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9Cit9CisKK2ludCByb290KCkgeworICAgIHJzZ0NsZWFyRGVwdGgoMS4wZik7CisKKyAgICByc2dCaW5kUHJvZ3JhbVZlcnRleCh2ZXJ0ZXhQcm9ncmFtKTsKKyAgICByc2dCaW5kUHJvZ3JhbUZyYWdtZW50KGZyYWdtZW50UHJvZ3JhbSk7CisgICAgcnNnQmluZFByb2dyYW1TdG9yZShwcm9ncmFtU3RvcmUpOworICAgIHJzZ0JpbmRQcm9ncmFtUmFzdGVyKHJhc3RlclByb2dyYW0pOworCisgICAgdXBkYXRlQWxsb2NhdGlvblZhcnMoKTsKKworICAgIGlmICghaW5pdGlhbGl6ZWQpIHsKKyAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBjYXJkQ291bnQ7IGkrKykKKyAgICAgICAgICAgIGNhcmRzW2ldLnRleHR1cmVTdGF0ZSA9IFNUQVRFX0lOVkFMSUQ7CisgICAgICAgIGluaXRpYWxpemVkID0gdHJ1ZTsKKyAgICB9CisKKyAgICBpZiAoZmFsc2UpIHsgLy8gZm9yIGRlYnVnZ2luZyAtIGZsYXNoIHRoZSBzY3JlZW4gc28gd2Uga25vdyB3ZSdyZSBzdGlsbCByZW5kZXJpbmcKKyAgICAgICAgc3RhdGljIGJvb2wgdG9nZ2xlOworICAgICAgICBpZiAodG9nZ2xlKQorICAgICAgICAgICAgcnNnQ2xlYXJDb2xvcihiYWNrZ3JvdW5kQ29sb3IueCwgYmFja2dyb3VuZENvbG9yLnksIGJhY2tncm91bmRDb2xvci56LCAxLjApOworICAgICAgICBlbHNlCisgICAgICAgICAgICByc2dDbGVhckNvbG9yKDEuMGYsIDAuMGYsIDAuMGYsIDEuZik7CisgICAgICAgIHRvZ2dsZSA9ICF0b2dnbGU7CisgICAgfSBlbHNlIHsKKyAgICAgICAgcnNnQ2xlYXJDb2xvcihiYWNrZ3JvdW5kQ29sb3IueCwgYmFja2dyb3VuZENvbG9yLnksIGJhY2tncm91bmRDb2xvci56LCAxLjApOworICAgIH0KKworICAgIHVwZGF0ZUNhbWVyYU1hdHJpeChyc2dHZXRXaWR0aCgpLCByc2dHZXRIZWlnaHQoKSk7CisKKyAgICBib29sIHN0aWxsQW5pbWF0aW5nID0gdXBkYXRlTmV4dFBvc2l0aW9uKCk7CisKKyAgICBjdWxsQ2FyZHMoKTsKKworICAgIHVwZGF0ZUNhcmRSZXNvdXJjZXMoKTsKKworICAgIGRyYXdDYXJkcygpOworCisgICAgaWYgKGRlYnVnUGlja2luZykgeworICAgICAgICByZW5kZXJXaXRoUmF5cygpOworICAgIH0KKworICAgIC8vcnNTZW5kVG9DbGllbnQoQ01EX1BJTkcpOworCisgICAgcmV0dXJuIHN0aWxsQW5pbWF0aW5nID8gMSA6IDA7Cit9CmRpZmYgLS1naXQgYS9jb3JlL2puaS9BbmRyb2lkLm1rIGIvY29yZS9qbmkvQW5kcm9pZC5tawppbmRleCA0MjEzNWM1Li5jYjBiZGQzIDEwMDY0NAotLS0gYS9jb3JlL2puaS9BbmRyb2lkLm1rCisrKy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ICByZXR1cm4gTlVMTDsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHJvd0NodW5rID0gb2Zmc2V0VG9QdHIobmV4dENodW5rT2Zmc2V0KTsKLUxPR19XSU5ET1coImFsbG9jYXRlZCBuZXcgY2h1bmsgYXQgJWQsIHJvd0NodW5rID0gJXAiLCBuZXh0Q2h1bmtPZmZzZXQsIHJvd0NodW5rKTsKLSAgICAgICAgICAgICooKHVpbnQzMl90ICopKG1EYXRhICsgY2h1bmtQdHJPZmZzZXQpKSA9IHJvd0NodW5rIC0gbURhdGE7Ci0gICAgICAgICAgICAvLyBNYXJrIHRoZSBuZXcgY2h1bmsncyBuZXh0ICdwb2ludGVyJyBhcyBudWxsCi0gICAgICAgICAgICAqKCh1aW50MzJfdCAqKShyb3dDaHVuayArIFJPV19TTE9UX0NIVU5LX1NJWkUgLSBzaXplb2YodWludDMyX3QpKSkgPSAwOwotICAgICAgICB9IGVsc2UgewotTE9HX1dJTkRPVygiZm9sbHdpbmcgJ3BvaW50ZXInIHRvIG5leHQgY2h1bmssIG9mZnNldCBvZiBuZXh0IHBvaW50ZXIgaXMgJWQiLCBjaHVua1B0ck9mZnNldCk7Ci0gICAgICAgICAgICByb3dDaHVuayA9IG9mZnNldFRvUHRyKG5leHRDaHVua09mZnNldCk7Ci0gICAgICAgICAgICBjaHVua1B0ck9mZnNldCA9IHJvd0NodW5rIC0gbURhdGEgKyAoUk9XX1NMT1RfQ0hVTktfTlVNX1JPV1MgKiBzaXplb2Yocm93X3Nsb3RfdCkpOwotICAgICAgICB9Ci0gICAgfQotICAgIG1IZWFkZXItPm51bVJvd3MrKzsKLQotICAgIHJldHVybiAocm93X3Nsb3RfdCAqKShyb3dDaHVuayArIChjaHVua1BvcyAqIHNpemVvZihyb3dfc2xvdF90KSkpOwotfQotCi1maWVsZF9zbG90X3QgKiBDdXJzb3JXaW5kb3c6OmdldEZpZWxkU2xvdFdpdGhDaGVjayhpbnQgcm93LCBpbnQgY29sdW1uKQotew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Pbmx5KTsKLSAgICBzcDxJTWVtb3J5PiAgICAgICAgIGdldE1lbW9yeSgpIHtyZXR1cm4gbU1lbW9yeTt9Ci0KLSAgICBzaXplX3QgICAgICAgICAgICAgIHNpemUoKSB7cmV0dXJuIG1TaXplO30KLSAgICB1aW50OF90ICogICAgICAgICAgIGRhdGEoKSB7cmV0dXJuIG1EYXRhO30KLSAgICB1aW50MzJfdCAgICAgICAgICAgIGdldE51bVJvd3MoKSB7cmV0dXJuIG1IZWFkZXItPm51bVJvd3M7fQotICAgIHVpbnQzMl90ICAgICAgICAgICAgZ2V0TnVtQ29sdW1ucygpIHtyZXR1cm4gbUhlYWRlci0+bnVtQ29sdW1uczt9Ci0gICAgdm9pZCAgICAgICAgICAgICAgICBmcmVlTGFzdFJvdygpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobUhlYWRlci0+bnVtUm93cyA+IDApIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUhlYWRlci0+bnVtUm93cy0tOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICBib29sICAgICAgICAgICAgICAgIHNldE51bUNvbHVtbnModWludDMyX3QgbnVtQ29sdW1ucykKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMl90IGN1ciA9IG1IZWFkZXItPm51bUNvbHVtbnM7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjdXIgPiAwICYmIGN1ciAhPSBudW1Db2x1bW5zKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMT0dFKCJUcnlpbmcgdG8gZ28gZnJvbSAlZCBjb2x1bW5zIHRvICVkIiwgY3VyLCBudW1Db2x1bW5zKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtSGVhZGVyLT5udW1Db2x1bW5zID0gbnVtQ29sdW1uczsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgfQotCi0gICAgaW50MzJfdCAgICAgICAgICAgICBmcmVlU3BhY2UoKTsKLQotICAgIHZvaWQgICAgICAgICAgICAgICAgY2xlYXIoKTsKLQotICAgICAgICAgICAgICAgICAgICAgICAgLyoqCi0gICAgICAgICAgICAgICAgICAgICAgICAgKiBBbGxvY2F0ZSBhIHJvdyBzbG90IGFuZCBpdHMgZGlyZWN0b3J5LiBUaGUgcmV0dXJuZWQKLSAgICAgICAgICAgICAgICAgICAgICAgICAqIHBvaW50ZXIgcG9pbnRzIHRvIHRoZSBiZWdpbmluZyBvZiB0aGUgcm93J3MgZGlyZWN0b3J5Ci0gICAgICAgICAgICAgICAgICAgICAgICAgKiBvciBOVUxMIGlmIHRoZXJlIHdhc24ndCByb29tLiBUaGUgZGlyZWN0b3J5IGlzCi0gICAgICAgICAgICAgICAgICAgICAgICAgKiBpbml0aWFsaWVkIHdpdGggTlVMTCBlbnRyaWVzIGZvciBlYWNoIGZpZWxkLgotICAgICAgICAgICAgICAgICAgICAgICAgICovCi0gICAgZmllbGRfc2xvdF90ICogICAgICBhbGxvY1JvdygpOwotCi0gICAgICAgICAgICAgICAgICAgICAgICAvKioKLSAgICAgICAgICAgICAgICAgICAgICAgICAqIEFsbG9jYXRlIGEgcG9ydGlvbiBvZiB0aGUgd2luZG93LiBSZXR1cm5zIHRoZSBvZmZzZXQKLSAgICAgICAgICAgICAgICAgICAgICAgICAqIG9mIHRoZSBhbGxvY2F0aW9uLCBvciAwIGlmIHRoZXJlIGlzbid0IGVub3VnaCBzcGFjZS4KLSAgICAgICAgICAgICAgICAgICAgICAgICAqIElmIGFsaWduZWQgaXMgdHJ1ZSwgdGhlIGFsbG9jYXRpb24gZ2V0cyA0IGJ5dGUgYWxpZ25tZW50LgotICAgICAgICAgICAgICAgICAgICAgICAgICovCi0gICAgdWludDMyX3QgICAgICAgICAgICBhbGxvYyhzaXplX3Qgc2l6ZSwgYm9vbCBhbGlnbmVkID0gZmFsc2UpOwotCi0gICAgdWludDMyX3QgICAgICAgICAgICByZWFkX2ZpZWxkX3Nsb3QoaW50IHJvdywgaW50IGNvbHVtbiwgZmllbGRfc2xvdF90ICogc2xvdCk7Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgIC8qKgotICAgICAgICAgICAgICAgICAgICAgICAgICogQ29weSBkYXRhIGludG8gdGhlIHdpbmRvdyBhdCB0aGUgZ2l2ZW4gb2Zmc2V0LgotICAgICAgICAgICAgICAgICAgICAgICAgICovCi0gICAgdm9pZCAgICAgICAgICAgICAgICBjb3B5SW4odWludDMyX3Qgb2Zmc2V0LCB1aW50OF90IGNvbnN0ICogZGF0YSwgc2l6ZV90IHNpemUpOwotICAgIHZvaWQgICAgICAgICAgICAgICAgY29weUluKHVpbnQzMl90IG9mZnNldCwgaW50NjRfdCBkYXRhKTsKLSAgICB2b2lkICAgICAgICAgICAgICAgIGNvcHlJbih1aW50MzJfdCBvZmZzZXQsIGRvdWJsZSBkYXRhKTsKLQotICAgIHZvaWQgICAgICAgICAgICAgICAgY29weU91dCh1aW50MzJfdCBvZmZzZXQsIHVpbnQ4X3QgKiBkYXRhLCBzaXplX3Qgc2l6ZSk7Ci0gICAgaW50NjRfdCAgICAgICAgICAgICBjb3B5T3V0TG9uZyh1aW50MzJfdCBvZmZzZXQpOwotICAgIGRvdWJsZSAgICAgICAgICAgICAgY29weU91dERvdWJsZSh1aW50MzJfdCBvZmZzZXQpOwotCi0gICAgYm9vbCAgICAgICAgICAgICAgICBwdXRMb25nKHVuc2lnbmVkIGludCByb3csIHVuc2lnbmVkIGludCBjb2wsIGludDY0X3QgdmFsdWUpOwotICAgIGJvb2wgICAgICAgICAgICAgICAgcHV0RG91YmxlKHVuc2lnbmVkIGludCByb3csIHVuc2lnbmVkIGludCBjb2wsIGRvdWJsZSB2YWx1ZSk7Ci0gICAgYm9vbCAgICAgICAgICAgICAgICBwdXROdWxsKHVuc2lnbmVkIGludCByb3csIHVuc2lnbmVkIGludCBjb2wpOwotCi0gICAgYm9vbCAgICAgICAgICAgICAgICBnZXRMb25nKHVuc2lnbmVkIGludCByb3csIHVuc2lnbmVkIGludCBjb2wsIGludDY0X3QgKiB2YWx1ZU91dCk7Ci0gICAgYm9vbCAgICAgICAgICAgICAgICBnZXREb3VibGUodW5zaWduZWQgaW50IHJvdywgdW5zaWduZWQgaW50IGNvbCwgZG91YmxlICogdmFsdWVPdXQpOwotICAgIGJvb2wgICAgICAgICAgICAgICAgZ2V0TnVsbCh1bnNpZ25lZCBpbnQgcm93LCB1bnNpZ25lZCBpbnQgY29sLCBib29sICogdmFsdWVPdXQpOwotCi0gICAgdWludDhfdCAqICAgICAgICAgICBvZmZzZXRUb1B0cih1aW50MzJfdCBvZmZzZXQpIHtyZXR1cm4gbURhdGEgKyBvZmZzZXQ7fQotCi0gICAgcm93X3Nsb3RfdCAqICAgICAgICBhbGxvY1Jvd1Nsb3QoKTsKLQotICAgIHJvd19zbG90X3QgKiAgICAgICAgZ2V0Um93U2xvdChpbnQgcm93KTsKLSAgICAKLSAgICAgICAgICAgICAgICAgICAgICAgIC8qKgotICAgICAgICAgICAgICAgICAgICAgICAgICogcmV0dXJuIE5VTEwgaWYgRmFpbGVkIHRvIGZpbmQgcm93U2xvdCBvcgotICAgICAgICAgICAgICAgICAgICAgICAgICogSW52YWxpZCByb3dTbG90Ci0gICAgICAgICAgICAgICAgICAgICAgICAgKi8KLSAgICBmaWVsZF9zbG90X3QgKiAgICAgIGdldEZpZWxkU2xvdFdpdGhDaGVjayhpbnQgcm93LCBpbnQgY29sdW1uKTsKLSAgICBmaWVsZF9zbG90X3QgKiAgICAgIGdldEZpZWxkU2xvdChpbnQgcm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KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5kaWNlcywgaW5kZXhDb3VudCwgKnBhaW50KTsKICAgICB9Ci0gICAgCi0gICAgc3RhdGljIHZvaWQgZHJhd1RleHRfX19DSUlGRlBhaW50KEpOSUVudiogZW52LCBqb2JqZWN0LCBTa0NhbnZhcyogY2FudmFzLAorCisKKyAgICBzdGF0aWMgdm9pZCBkcmF3VGV4dF9fX0NJSUZGSVBhaW50KEpOSUVudiogZW52LCBqb2JqZWN0LCBTa0NhbnZhcyogY2FudmFzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqY2hhckFycmF5IHRleHQsIGludCBpbmRleCwgaW50IGNvdW50LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqZmxvYXQgeCwgamZsb2F0IHksIFNrUGFpbnQqIHBhaW50KSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpmbG9hdCB4LCBqZmxvYXQgeSwgaW50IGZsYWdzLCBTa1BhaW50KiBwYWludCkgewogICAgICAgICBqY2hhciogdGV4dEFycmF5ID0gZW52LT5HZXRDaGFyQXJyYXlFbGVtZW50cyh0ZXh0LCBOVUxMKTsKLSAgICAgICAganNpemUgdGV4dENvdW50ID0gZW52LT5HZXRBcnJheUxlbmd0aCh0ZXh0KTsKLSAgICAgICAgU2tTY2FsYXIgeF8gPSBTa0Zsb2F0VG9TY2FsYXIoeCk7Ci0gICAgICAgIFNrU2NhbGFyIHlfID0gU2tGbG9hdFRvU2NhbGFyKHkpOwotICAgICAgICBjYW52YXMtPmRyYXdUZXh0KHRleHRBcnJheSArIGluZGV4LCBjb3VudCA8PCAxLCB4XywgeV8sICpwYWludCk7Ci0gICAgICAgIGVudi0+UmVsZWFzZUNoYXJBcnJheUVsZW1lbnRzKHRleHQsIHRleHRBcnJheSwgMCk7CisgICAgICAgIFRleHRMYXlvdXQ6OmRyYXdUZXh0KHBhaW50LCB0ZXh0QXJyYXkgKyBpbmRleCwgY291bnQsIGZsYWdzLCB4LCB5LCBjYW52YXMpOworICAgICAgICBlbnYtPlJlbGVhc2VDaGFyQXJyYXlFbGVtZW50cyh0ZXh0LCB0ZXh0QXJyYXksIEpOSV9BQk9SVCk7CiAgICAgfQotIAotICAgIHN0YXRpYyB2b2lkIGRyYXdUZXh0X19TdHJpbmdJSUZGUGFpbnQoSk5JRW52KiBlbnYsIGpvYmplY3QsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgU2tDYW52YXMqIGNhbnZhcywganN0cmluZyB0ZXh0LCBpbnQgc3RhcnQsIGludCBlbmQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqZmxvYXQgeCwgamZsb2F0IHksIFNrUGFpbnQqIHBhaW50KSB7Ci0gICAgICAgIGNvbnN0IHZvaWQqIHRleHRfID0gZW52LT5HZXRTdHJpbmdDaGFycyh0ZXh0LCBOVUxMKTsKLSAgICAgICAgU2tTY2FsYXIgeF8gPSBTa0Zsb2F0VG9TY2FsYXIoeCk7Ci0gICAgICAgIFNrU2NhbGFyIHlfID0gU2tGbG9hdFRvU2NhbGFyKHkpOwotICAgICAgICBjYW52YXMtPmRyYXdUZXh0KChjb25zdCB1aW50MTZfdCopdGV4dF8gKyBzdGFydCwgKGVuZCAtIHN0YXJ0KSA8PCAxLAotICAgICAgICAgICAgICAgICAgICAgICAgIHhfLCB5XywgKnBhaW50KTsKLSAgICAgICAgZW52LT5SZWxlYXNlU3RyaW5nQ2hhcnModGV4dCwgKGNvbnN0IGpjaGFyKikgdGV4dF8pOworCisgICAgc3RhdGljIHZvaWQgZHJhd1RleHRfX1N0cmluZ0lJRkZJUGFpbnQoSk5JRW52KiBlbnYsIGpvYmplY3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTa0NhbnZhcyogY2FudmFzLCBqc3RyaW5nIHRleHQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg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7Ci0gICAgICAgIGMtPmRyYXdUZXh0KHRleHRfLCBjb3VudCA8PCAxLCBTa0Zsb2F0VG9TY2FsYXIoeCksIFNrRmxvYXRUb1NjYWxhcih5KSwKLSAgICAgICAgICAgICAgICAgICAgKkdyYXBoaWNzSk5JOjpnZXROYXRpdmVQYWludChlbnYsIHBhaW50KSk7Ci0gICAgICAgIGVudi0+UmVsZWFzZVN0cmluZ0NoYXJzKHRleHQsIHRleHRfKTsKKworICAgIHN0YXRpYyB2b2lkIGRyYXdUZXh0UnVuX19fQ0lJSUlGRklQYWludCgKKyAgICAgICAgSk5JRW52KiBlbnYsIGpvYmplY3QsIFNrQ2FudmFzKiBjYW52YXMsIGpjaGFyQXJyYXkgdGV4dCwgaW50IGluZGV4LAorICAgICAgICBpbnQgY291bnQsIGludCBjb250ZXh0SW5kZXgsIGludCBjb250ZXh0Q291bnQsCisgICAgICAgIGpmbG9hdCB4LCBqZmxvYXQgeSwgaW50IGRpckZsYWdzLCBTa1BhaW50KiBwYWludCkgeworCisgICAgICAgIGpjaGFyKiBjaGFycyA9IGVudi0+R2V0Q2hhckFycmF5RWxlbWVudHModGV4dCwgTlVMTCk7CisgICAgICAgIFRleHRMYXlvdXQ6OmRyYXdUZXh0UnVuKHBhaW50LCBjaGFycyArIGNvbnRleHRJbmRleCwgaW5kZXggLSBjb250ZXh0SW5kZXgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvdW50LCBjb250ZXh0Q291bnQsIGRpckZsYWdzLCB4LCB5LCBjYW52YXMpOworICAgICAgICBlbnYtPlJlbGVhc2VDaGFyQXJyYXlFbGVtZW50cyh0ZXh0LCBjaGFycywgSk5JX0FCT1JUKTsKICAgICB9Ci0gICAgCisKKyAgICBzdGF0aWMgdm9pZCBkcmF3VGV4dFJ1bl9fU3RyaW5nSUlJSUZGSVBhaW50KAorICAgICAgICBKTklFbnYqIGVudiwgam9iamVjdCBvYmosIFNrQ2FudmFzKiBjYW52YXMsIGpzdHJpbmcgdGV4dCwgamludCBzdGFydCwKKyAgICAgICAgamludCBlbmQsIGppbnQgY29udGV4dFN0YXJ0LCBqaW50IGNvbnRleHRFbmQsCisgICAgICAgIGpmbG9hdCB4LCBqZmxvYXQgeSwgamludCBkaXJGbGFncywgU2tQYWludCogcGFpbnQpIHsKKworICAgICAgICBqaW50IGNvdW50ID0gZW5kIC0gc3RhcnQ7CisgICAgICAgIGppbnQgY29udGV4dENvdW50ID0gY29udGV4dEVuZCAtIGNvbnRleHRTdGFydDsKKyAgICAgICAgY29uc3QgamNoYXIqIGNoYXJzID0gZW52LT5HZXRTdHJpbmdDaGFycyh0ZXh0LCBOVUxMKTsKKyAgICAgICAgVGV4dExheW91dDo6ZHJhd1RleHRSdW4ocGFpbnQsIGNoYXJzICsgY29udGV4dFN0YXJ0LCBzdGFydCAtIGNvbnRleHRTdGFydCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY291bnQsIGNvbnRleHRDb3VudCwgZGlyRmxhZ3MsIHgsIHksIGNhbnZhcyk7CisgICAgICAgIGVudi0+UmVsZWFzZVN0cmluZ0NoYXJzKHRleHQsIGNoYXJzKTsKKyAgICB9CisKICAgICBzdGF0aWMgdm9pZCBkcmF3UG9zVGV4dF9fX0NJSV9GUGFpbnQoSk5JRW52KiBlbnYsIGpvYmplY3QsIFNrQ2FudmFzKiBjYW52YXMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpjaGFyQXJyYXkgdGV4dCwgaW50IGluZGV4LCBpbnQgY291bnQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpmbG9hdEFycmF5IHBvcywgU2tQYWludCogcGFpbnQpIHsKQEAgLTgwNCwxMCArODA0LDExIEBACiAgICAgICAgIH0KICAgICAgICAgZGVsZXRlW10gcG9zUHRyOwogICAgIH0KLSAKKwogICAgIHN0YXRpYyB2b2lkIGRyYXdQb3NUZXh0X19TdHJpbmdfRlBhaW50KEpOSUVudiogZW52LCBqb2JqZWN0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNrQ2FudmFzKiBjYW52YXMsIGpzdHJpbmcgdGV4dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqZmxvYXRBcnJheSBwb3MsIFNrUGFpbnQqIHBhaW50KSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgamZsb2F0QXJyYXkgcG9zLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNrUGFpbnQqIHBhaW50KSB7CiAgICAgICAgIGNvbnN0IHZvaWQqIHRleHRfID0gdGV4dCA/IGVudi0+R2V0U3RyaW5nQ2hhcnModGV4dCwgTlVMTCkgOiBOVUxMOwogICAgICAgICBpbnQgYnl0ZUxlbmd0aCA9IHRleHQgPyBlbnYtPkdldFN0cmluZ0xlbmd0aCh0ZXh0KSA6IDA7CiAgICAgICAgIGZsb2F0KiBwb3NBcnJheSA9IHBvcyA/IGVudi0+R2V0RmxvYXRBcnJheUVsZW1lbnRzKHBvcywgTlVMTCkgOiBOVUxMOwpAQCAtODI3LDI3ICs4MjgsMjcgQEAKICAgICAgICAgfQogICAgICAgICBkZWxldGVbXSBwb3NQdHI7CiAgICAgfQotIAorCiAgICAgc3RhdGljIHZvaWQgZHJhd1RleHRPblBhdGhfX19DSUlQYXRoRkZQYWludChKTklFbnYqIGVudiwgam9iamVjdCwKLSAgICAgICAgICAgICAgICAgICAgICAgIFNrQ2FudmFzKiBjYW52YXMsIGpjaGFyQXJyYXkgdGV4dCwgaW50IGluZGV4LCBpbnQgY291bnQsCi0gICAgICAgICAgICAgICAgU2tQYXRoKiBwYXRoLCBqZmxvYXQgaE9mZnNldCwgamZsb2F0IHZPZmZzZXQsIFNrUGFpbnQqIHBhaW50KSB7CisgICAgICAgICAgICBTa0NhbnZhcyogY2FudmFzLCBqY2hhckFycmF5IHRleHQsIGludCBpbmRleCwgaW50IGNvdW50LAorICAgICAgICAgICAgU2tQYXRoKiBwYXRoLCBqZmxvYXQgaE9mZnNldCwgamZsb2F0IHZPZmZzZXQsIGppbnQgYmlkaUZsYWdzLCBTa1BhaW50KiBwYWludCkgewogCiAgICAgICAgIGpjaGFyKiB0ZXh0QXJyYXkgPSBlbnYtPkdldENoYXJBcnJheUVsZW1lbnRzKHRleHQsIE5VTEwpOwotICAgICAgICBjYW52YXMtPmRyYXdUZXh0T25QYXRoSFYodGV4dEFycmF5ICsgaW5kZXgsIGNvdW50IDw8IDEsICpwYXRoLAotICAgICAgICAgICAgICAgICAgICBTa0Zsb2F0VG9TY2FsYXIoaE9mZnNldCksIFNrRmxvYXRUb1NjYWxhcih2T2Zmc2V0KSwgKnBhaW50KTsKKyAgICAgICAgVGV4dExheW91dDo6ZHJhd1RleHRPblBhdGgocGFpbnQsIHRleHRBcnJheSwgY291bnQsIGJpZGlGbGFncywgaE9mZnNldCwgdk9mZnNldCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGF0aCwgY2FudmFzKTsKICAgICAgICAgZW52LT5SZWxlYXNlQ2hhckFycmF5RWxlbWVudHModGV4dCwgdGV4dEFycmF5LCAwKTsKICAgICB9Ci0gCisKICAgICBzdGF0aWMgdm9pZCBkcmF3VGV4dE9uUGF0aF9fU3RyaW5nUGF0aEZGUGFpbnQoSk5JRW52KiBlbnYsIGpvYmplY3QsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgU2tDYW52YXMqIGNhbnZhcywganN0cmluZyB0ZXh0LCBTa1BhdGgqIHBhdGgsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgamZsb2F0IGhPZmZzZXQsIGpmbG9hdCB2T2Zmc2V0LCBTa1BhaW50KiBwYWludCkgeworICAgICAgICAgICAgU2tDYW52YXMqIGNhbnZhcywganN0cmluZyB0ZXh0LCBTa1BhdGgqIHBhdGgsCisgICAgICAgICAgICBqZmxvYXQgaE9mZnN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0LCBqZmxvYXRBcnJheSBqYXJyYXkpIHsKKyNpZmRlZiBVU0VfT1BFTkdMX1JFTkRFUkVSCisgICAgICAgIEF1dG9KYXZhRmxvYXRBcnJheSBhdXRvQXJyYXkoZW52LCBqYXJyYXksIDIwKTsKKyAgICAgICAgY29uc3QgZmxvYXQqIHNyYyA9IGF1dG9BcnJheS5wdHIoKTsKKworICAgICAgICBmbG9hdCogY29sb3JNYXRyaXggPSBuZXcgZmxvYXRbMTZdOworICAgICAgICBtZW1jcHkoY29sb3JNYXRyaXgsIHNyYywgNCAqIHNpemVvZihmbG9hdCkpOworICAgICAgICBtZW1jcHkoJmNvbG9yTWF0cml4WzRdLCAmc3JjWzVdLCA0ICogc2l6ZW9mKGZsb2F0KSk7CisgICAgICAgIG1lbWNweSgmY29sb3JNYXRyaXhbOF0sICZzcmNbMTBdLCA0ICogc2l6ZW9mKGZsb2F0KSk7CisgICAgICAgIG1lbWNweSgmY29sb3JNYXRyaXhbMTJdLCAmc3JjWzE1XSwgNCAqIHNpemVvZihmbG9hdCkpOworCisgICAgICAgIGZsb2F0KiBjb2xvclZlY3RvciA9IG5ldyBmbG9hdFs0XTsKKyAgICAgICAgY29sb3JWZWN0b3JbMF0gPSBzcmNbNF07CisgICAgICAgIGNvbG9yVmVjdG9yWzFdID0gc3JjWzldOworICAgICAgICBjb2xvclZlY3RvclsyXSA9IHNyY1sxNF07CisgICAgICAgIGNvbG9yVmVjdG9yWzNdID0gc3JjWzE5XTsKKworICAgICAgICByZXR1cm4gbmV3IFNraWFDb2xvck1hdHJpeEZpbHRlcihjb2xvck1hdHJpeCwgY29sb3JWZWN0b3IpOworI2Vsc2UKKyAgICAgICAgcmV0dXJuIE5VTEw7CisjZW5kaWYKKyAgICB9CisKKyAgICBzdGF0aWMgU2tDb2xvckZpbHRlciogQ3JlYXRlUG9ydGVyRHVmZkZpbHRlcihKTklFbnYqIGVudiwgam9iamVjdCwgamludCBzcmNDb2xvciwKKyAgICAgICAgICAgIFNrUG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XJyYXkgKyBpbmRleCwgY291bnQgPDwgMSwgU2tGbG9hdFRvU2NhbGFyKHgpLCBTa0Zsb2F0VG9TY2FsYXIoeSksIHBhdGgpOwotICAgICAgICBlbnYtPlJlbGVhc2VDaGFyQXJyYXlFbGVtZW50cyh0ZXh0LCBjb25zdF9jYXN0PGpjaGFyKj4odGV4dEFycmF5KSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSk5JX0FCT1JUKTsKKworICAgIHN0YXRpYyBqZmxvYXQgZG9UZXh0UnVuQWR2YW5jZXMoSk5JRW52ICplbnYsIFNrUGFpbnQgKnBhaW50LCBjb25zdCBqY2hhciAqdGV4dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGppbnQgc3RhcnQsIGppbnQgY291bnQsIGppbnQgY29udGV4dENvdW50LCBqaW50IGZsYWdzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgamZsb2F0QXJyYXkgYWR2YW5jZXMsIGppbnQgYWR2YW5jZXNJbmRleCkgeworICAgICAgICBqZmxvYXQgYWR2YW5jZXNBcnJheVtjb3VudF07CisgICAgICAgIGpmbG9hdCB0b3RhbEFkdmFuY2U7CisKKyAgICAgICAgVGV4dExheW91dDo6Z2V0VGV4dFJ1bkFkdmFuY2VzKHBhaW50LCB0ZXh0LCBzdGFydCwgY291bnQsIGNvbnRleHRDb3VudCwgZmxhZ3MsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZHZhbmNlc0FycmF5LCB0b3RhbEFkdmFuY2UpOworCisgICAgICAgIGlmIChhZHZhbmNlcyAhPSBOVUxMKSB7CisgICAgICAgICAgICBlbnYtPlNldEZsb2F0QXJyYXlSZWdpb24oYWR2YW5jZXMsIGFkdmFuY2VzSW5kZXgsIGNvdW50LCBhZHZhbmNlc0FycmF5KTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gdG90YWxBZHZhbmNlOwogICAgIH0KLSAKLSA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bnQsCisgICAgICAgICAgICBqc3RyaW5nIHRleHQsIGppbnQgc3RhcnQsIGppbnQgZW5kLCBqaW50IGNvbnRleHRTdGFydCwgamludCBjb250ZXh0RW5kLCBqaW50IGZsYWdzLAorICAgICAgICAgICAgamZsb2F0QXJyYXkgYWR2YW5jZXMsIGppbnQgYWR2YW5jZXNJbmRleCkgewogICAgICAgICBjb25zdCBqY2hhciogdGV4dEFycmF5ID0gZW52LT5HZXRTdHJpbmdDaGFycyh0ZXh0LCBOVUxMKTsKLSAgICAgICAgcGFpbnQtPmdldFRleHRQYXRoKHRleHRBcnJheSArIHN0YXJ0LCAoZW5kIC0gc3RhcnQpIDw8IDEsIFNrRmxvYXRUb1NjYWxhcih4KSwgU2tGbG9hdFRvU2NhbGFyKHkpLCBwYXRoKTsKKyAgICAgICAgamZsb2F0IHJlc3VsdCA9IGRvVGV4dFJ1bkFkdmFuY2VzKGVudiwgcGFpbnQsIHRleHRBcnJheSArIGNvbnRleHRTdGFydCwKKyAgICAgICAgICAgIHN0YXJ0IC0gY29udGV4dFN0YXJ0LCBlbmQgLSBzdGFydCwgY29udGV4dEVuZCAtIGNvbnRleHRTdGFydCwgZmxhZ3MsIGFkdmFuY2VzLAorICAgICAgICAgICAgYWR2YW5jZXNJbmRleCk7CisgICAgICAgIGVudi0+UmVsZWFzZVN0cmluZ0NoYXJzKHRleHQsIHRleHRBcnJheSk7CisgICAgICAgIHJldHVybiByZXN1bHQ7CisgICAgfQorCisgICAgc3RhdGljIGppbnQgZG9UZXh0UnVuQ3Vyc29yKEpOSUVudiAqZW52LCBTa1BhaW50KiBwYWludCwgY29uc3QgamNoYXIgKnRleHQsIGppbnQgc3RhcnQsCisgICAgICAgICAgICBqaW50IGNvdW50LCBqaW50IGZsYWdzLCBqaW50IG9mZnNldCwgamludCBvcHQpIHsKKyAgICAgICAgU2tTY2FsYXIgc2NhbGFyQXJyYXlbY291bnRdOworICAgICAgICBqY2hhciBidWZmZXJbY291bnRdOworCisgICAgICAg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EKKyAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgd2lkdGhzID0gcGFpbnQtPmdldFRleHRXaWR0aHMoYnVmZmVyLCBjb3VudCA8PCAxLCBzY2FsYXJBcnJheSk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICB3aWR0aHMgPSBwYWludC0+Z2V0VGV4dFdpZHRocyh0ZXh0ICsgc3RhcnQsIGNvdW50IDw8IDEsIHNjYWxhckFycmF5KTsKKyAgICAgICAgfQorCisgICAgICAgIGlmICh3aWR0aHMgPCBjb3VudCkgeworICAgICAgICAgICAgLy8gU2tpYSBvcGVyYXRlcyBvbiBjb2RlIHBvaW50cywgbm90IGNvZGUgdW5pdHMsIHNvIHN1cnJvZ2F0ZSBwYWlycyByZXR1cm4gb25seSBvbmUKKyAgICAgICAgICAgIC8vIHZhbHVlLiBFeHBhbmQgdGhlIHJlc3VsdCBzbyB3ZSBoYXZlIG9uZSB2YWx1ZSBwZXIgVVRGLTE2IGNvZGUgdW5pdC4KKworICAgICAgICAgICAgLy8gTm90ZSwgc2tpYSdzIGdldFRleHRXaWR0aCBnZXRzIGNvbmZ1c2VkIGlmIGl0IGVuY291bnRlcnMgYSBzdXJyb2dhdGUgcGFpciwKKyAgICAgICAgICAgIC8vIGxlYXZpbmcgdGhlIHJlbWFpbmluZyB3aWR0aHMgemVyby4gIE5vdCBuaWNlLgorICAgICAgICAgICAgY29uc3QgamNoYXIgKmNoYXJzID0gdGV4dCArIHN0YXJ0OworICAgICAgICAgICAgZm9yIChpbnQgaSA9IGNvdW50LCBwID0gd2lkdGhzIC0gMTsgLS1pID4gcDspIHsKKyAgICAgICAgICAgICAgICBpZiAoY2hhcnNbaV0gPj0gMHhkYzAwICYmIGNoYXJzW2ldIDwgMHhlMDAwICYmCisgICAgICAgICAgICAgICAgICAgICAgICBjaGFyc1tpLTFdID49IDB4ZDgwMCAmJiBjaGFyc1tpLTFdIDwgMHhkYzAwKSB7CisgICAgICAgICAgICAgICAgICAgIHNjYWxhckFycmF5W2ldID0gMDsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgc2NhbGFyQXJyYXlbaV0gPSBzY2FsYXJBcnJheVstLXBdOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIGppbnQgcG9zID0gb2Zmc2V0IC0gc3RhcnQ7CisgICAgICAgIHN3aXRjaCAob3B0KSB7CisgICAgICAgIGNhc2UgQUZURVI6CisgICAgICAgICAgaWYgKHBvcyA8IGNvdW50KSB7CisgICAgICAgICAgICBwb3MgKz0gMTsKKyAgICAgICAgICB9CisgICAgICAgICAgLy8gZmFsbCB0aHJvdWdoCisgICAgICAgIGNhc2UgQVRfT1JfQUZURVI6CisgICAgICAgICAgd2hpbGUgKHBvcyA8IGNvdW50ICYmIHNjYWxhckFycmF5W3Bvc10gPT0gMCkgeworICAgICAgICAgICAgKytwb3M7CisgICAgICAgICAgfQorICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIEJFRk9SRToKKyAgICAgICAgICBpZiAocG9zID4gMCkgeworICAgICAgICAgICAgLS1wb3M7CisgICAgICAgICAgfQorICAgICAgICAgIC8vIGZhbGwgdGhyb3VnaAorICAgICAgICBjYXNlIEFUX09SX0JFRk9SRToKKyAgICAgICAgICB3aGlsZSAocG9zID4gMCAmJiBzY2FsYXJBcnJheVtwb3NdID09IDApIHsKKyAgICAgICAgICAgIC0tcG9zOworICAgICAgICAgIH0KKyAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBBVDoKKyAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICBpZiAoc2NhbGFyQXJyYXlbcG9zXSA9PSAwKSB7CisgICAgICAgICAgICBwb3MgPSAtMTsKKyAgICAgICAgICB9CisgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKworICAgICAgICBpZiAocG9zICE9IC0xKSB7CisgICAgICAgICAgcG9zICs9IHN0YXJ0OworICAgICAgICB9CisKKyAgICAgICAgcmV0dXJuIHBvczsKKyAgICB9CisKKyAgICBzdGF0aWMgamludCBnZXRUZXh0UnVuQ3Vyc29yX19fQyhKTklFbnYqIGVudiwgam9iamVjdCBjbGF6eiwgU2tQYWludCogcGFpbnQsIGpjaGFyQXJyYXkgdGV4dCwKKyAgICAgICAgICAgIGppbnQgY29udGV4dFN0YXJ0LCBqaW50IGNvbnRleHRDb3VudCwgamludCBmbGFncywgamludCBvZmZzZXQsIGppbnQgY3Vyc29yT3B0KSB7CisgICAgICAgIGpjaGFyKiB0ZXh0QXJyYXkgPSBlbnYtPkdldENoYXJBcnJheUVsZW1lbnRzKHRleHQsIE5VTEwpOworICAgICAgICBqaW50IHJlc3VsdCA9IGRvVGV4dFJ1bkN1cnNvcihlbnYsIHBhaW50LCB0ZXh0QXJyYXksIGNvbnRleHRTdGFydCwgY29udGV4dENvdW50LCBmbGFncywKKyAgICAgICAgICAgICAgICBvZmZzZXQsIGN1cnNvck9wdCk7CisgICAgICAgIGVudi0+UmVsZWFzZUNoYXJBcnJheUVsZW1lbnRzKHRleHQsIHRleHRBcnJheSwgSk5JX0FCT1JUKTsKKyAgICAgICAgcmV0dXJuIHJlc3VsdDsKKyAgICB9CisKKyAgICBzdGF0aWMgamludCBnZXRUZXh0UnVuQ3Vyc29yX19TdHJpbmcoSk5JRW52KiBlbnYsIGpvYmplY3QgY2xhenosIFNrUGFpbnQqIHBhaW50LCBqc3RyaW5nIHRleHQsCisgICAgICAgICAgICBqaW50IGNvbnRleHRTdGFydCwgamludCBjb250ZXh0RW5kLCBqaW50IGZsYWdzLCBqaW50IG9mZnNldCwgamludCBjdXJzb3JPcHQpIHsKKyAgICAgICAgY29uc3QgamNoYXIqIHRleHRBcnJheSA9IGVudi0+R2V0U3RyaW5nQ2hhcnModGV4dCwgTlVMTCk7CisgICAgICAgIGppbnQgcmVzdWx0ID0gZG9UZXh0UnVuQ3Vyc29yKGVudiwgcGFpbnQsIHRleHRBcnJheSwgY29udGV4dFN0YXJ0LAorICAgICAgICAgICAgICAgIGNvbnRleHRFbmQgLSBjb250ZXh0U3RhcnQsIGZsYWdzLCBvZmZzZXQsIGN1cnNvck9wdCk7CisgICAgICAgIGVudi0+UmVsZWFzZVN0cmluZ0NoYXJzKHRleHQsIHRleHRBcnJheSk7CisgICAgICAgIHJldHVybiByZXN1bHQ7CisgICAgfQorCisgICAgc3RhdGljIHZvaWQgZ2V0VGV4dFBhdGgoSk5JRW52KiBlbnYsIFNrUGFpbnQqIHBhaW50LCBjb25zdCBqY2hhciogdGV4dCwgamludCBjb3VudCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBqaW50IGJpZGlGbGFncywgamZsb2F0IHgsIGpmbG9hdCB5LCBTa1BhdGggKnBhdGgpIHsKKyAgICAgICAgVGV4dExheW91dDo6Z2V0VGV4dFBhdGgocGFpbnQsIHRleHQsIGNvdW50LCBiaWRpRmxhZ3MsIHgsIHksIHBhdGgpOworICAgIH0KKworICAgIHN0YXRpYyB2b2lkIGdldFRleHRQYXRoX19fQyhKTklFbnYqIGVudiwgam9iamVjdCBjbGF6eiwgU2tQYWludCogcGFpbnQsIGppbnQgYmlkaUZsYWdzLAorICAgICAgICAgICAgamNoYXJBcnJheSB0ZXh0LCBpbnQgaW5kZXgsIGludCBjb3VudCwgamZsb2F0IHgsIGpmbG9hdCB5LCBTa1BhdGgqIHBhdGgpIHsKKyAgICAgICAgY29uc3QgamNoYXIqIHRleHRBcnJheSA9IGVudi0+R2V0Q2hhckFycmF5RWxlbWVudHModGV4dCwgTlVMTCk7CisgICAgICAgIGdldFRleHRQYXRoKGVudiwgcGFpbnQsIHRleHRBcnJheSArIGluZGV4LCBjb3VudCwgYmlkaUZsYWdzLCB4LCB5LCBwYXRoKTsKKyAgICAgICAgZW52LT5SZWxlYXNlQ2hhckFycmF5RWxlbWVudHModGV4dCwgY29uc3RfY2FzdDxqY2hhcio+KHRleHRBcnJheSksIEpOSV9BQk9SVCk7CisgICA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52LCBqb2JqZWN0LAorc3RhdGljIFNrU2hhZGVyKiBMaW5lYXJHcmFkaWVudF9jcmVhdGUxKEpOSUVudiogZW52LCBqb2JqZWN0IG8sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgeDAsIGZsb2F0IHkwLCBmbG9hdCB4MSwgZmxvYXQgeTEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgamludEFycmF5IGNvbG9yQXJyYXksIGpmbG9hdEFycmF5IHBvc0FycmF5LCBpbnQgdGlsZU1vZGUpCiB7CkBAIC04NSwzMSArMTEyLDk1IEBACiAgICAgcHRzWzBdLnNldChTa0Zsb2F0VG9TY2FsYXIoeDApLCBTa0Zsb2F0VG9TY2FsYXIoeTApKTsKICAgICBwdHNbMV0uc2V0KFNrRmxvYXRUb1NjYWxhcih4MSksIFNrRmxvYXRUb1NjYWxhcih5MSkpOwogCi0gICAgc2l6ZV90ICAgICAgY291bnQgPSBlbnYtPkdldEFycmF5TGVuZ3RoKGNvbG9yQXJyYXkpOworICAgIHNpemVfdCBjb3VudCA9IGVudi0+R2V0QXJyYXlMZW5ndGgoY29sb3JBcnJheSk7CiAgICAgY29uc3QgamludCogY29sb3JWYWx1ZXMgPSBlbnYtPkdldEludEFycmF5RWxlbWVudHMoY29sb3JBcnJheSwgTlVMTCk7CiAKICAgICBTa0F1dG9TVE1hbGxvYzw4LCBTa1NjYWxhcj4gc3RvcmFnZShwb3NBcnJheSA/IGNvdW50IDogMCk7CiAgICAgU2tTY2FsYXIqICAgICAgICAgICAgICAgICAgIHBvcyA9IE5VTEw7Ci0gICAgCisKICAgICBpZiAocG9zQXJyYXkpIHsKICAgICAgICAgQXV0b0phdmFGbG9hdEFycmF5IGF1dG9Qb3MoZW52LCBwb3NBcnJheSwgY291bnQpOwogICAgICAgICBjb25zdCBmbG9hdCogcG9zVmFsdWVzID0gYXV0b1Bvcy5wdHIoKTsKICAgICAgICAgcG9zID0gKFNrU2NhbGFyKilzdG9yYWdlLmdldCgpOwotICAgICAgICBmb3IgKHNpemVfdCBpID0gMDsgaSA8IGNvdW50OyBpKyspCisgICAgICAgIGZvciAoc2l6ZV90IGkgPSAwOyBpIDwgY291bnQ7IGkrKykgewogICAgICAgICAgICAgcG9zW2ldID0gU2tGbG9hdFRvU2NhbGFyKHBvc1ZhbHVlc1tpXSk7CisgICAgICAgIH0KICAgICB9Ci0KKyAgICAKICAgICBTa1NoYWRlciogc2hhZGVyID0gU2tHcmFkaWVudFNoYWRlcjo6Q3JlYXRlTGluZWFyKHB0cywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVpbnRlcnByZXRfY2FzdDxjb25zdCBTa0NvbG9yKj4oY29sb3JWYWx1ZXMpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwb3MsIGNvdW50LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0aWNfY2FzdDxTa1NoYWRlcjo6VGlsZU1vZGU+KHRpbGVNb2RlKSk7Ci0gICAgZW52LT5SZWxlYXNlSW50QXJyYXlFbGVtZW50cyhjb2xvckFycmF5LCBjb25zdF9jYXN0PGppbnQqPihjb2xvclZhbHVlcyksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBKTklfQUJPUlQpOworCisgICAgZW52LT5SZWxlYXNlSW50QXJyYXlFbGVtZW50cyhjb2xvckFycmF5LCBjb25zdF9jYXN0PGppbnQqPihjb2xvclZhbHVlcyksIEpOSV9BQk9SVCk7CiAgICAgVGhyb3dJQUVfSWZOdWxsKGVudiwgc2hhZGVyKTsKICAgICByZXR1cm4gc2hhZGVyOwogfQogCi1zdGF0aWMgU2tTaGFkZXIqIExpbmVhckdyYWRpZW50X2NyZWF0ZTIoSk5JRW52KiBlbnYsIGpvYmplY3QsCitzdGF0aWMgU2tpYVNoYWRlciogTGluZWFyR3JhZGllbnRfcG9zdENyZWF0ZTEoSk5JRW52KiBlbnYsIGpvYmplY3QgbywgU2tTaGFkZXIqIHNoYWRlciwKKyAgICAgICAgZmxvYXQgeDAsIGZsb2F0IHkwLCBmbG9hdCB4MSwgZmxvYXQgeTEsIGppbnRBcnJheSBjb2xvckFycmF5LAorICAgICAgICBqZmxvYXRBcnJheSBwb3NBcnJheSwgaW50IHRpbGVNb2RlKSB7CisjaWZkZWYgVVNFX09QRU5HTF9SRU5ERVJFUgorICAgIHNpemVfdCBjb3VudCA9IGVudi0+R2V0QXJyYXlMZW5ndGgoY29sb3JBcnJheSk7CisgICAgY29uc3QgamludCogY29sb3JWYWx1ZXMgPSBlbnYtPkdldEludEFycmF5RWxlbWVudHMoY29sb3JBcnJheSwgTlVMTCk7CisKKyAgICBqZmxvYXQqIHN0b3JlZEJvdW5kcyA9IG5ldyBqZmxvYXRbNF07CisgICAgc3RvcmVkQm91bmRzWzBdID0geDA7IHN0b3JlZEJvdW5kc1sxXSA9IHkwOworICAgIHN0b3JlZEJvdW5kc1syXSA9IHgxOyBzdG9yZWRCb3VuZHNbM10gPSB5MTsKKyAgICBqZmxvYXQqIHN0b3JlZFBvc2l0aW9ucyA9IG5ldyBqZmxvYXRbY291bnRdOworICAgIHVpbnQzMl90KiBzdG9yZWRDb2xvcnMgPSBuZXcgdWludDMyX3RbY291bnRdOworICAgIGZvciAoc2l6ZV90IGkgPSAwOyBpIDwgY291bnQ7IGkrKykgeworICAgICAgICBzdG9yZWRDb2xvcnNbaV0gPSBzdGF0aWNfY2FzdDx1aW50MzJfdD4oY29sb3JWYWx1ZXNbaV0pOworICAgIH0KKworICAgIGlmIChwb3NBcnJheSkgeworICAgICAgICBBdXRvSmF2YUZsb2F0QXJyYXkgYXV0b1BvcyhlbnYsIHBvc0FycmF5LCBjb3VudCk7CisgICAgICAgIGNvbnN0IGZsb2F0KiBwb3NWYWx1ZXMgPSBhdXRvUG9zLnB0cigpOworICAgICAgICBmb3IgKHNpemVfdCBpID0gMDsgaSA8IGNvdW50OyBpKyspIHsKKyAgICAgICAgICAgIHN0b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MDsgc3RvcmVkQm91bmRzWzFdID0geTA7CisgICAgc3RvcmVkQm91bmRzWzJdID0geDE7IHN0b3JlZEJvdW5kc1szXSA9IHkxOworCisgICAgZmxvYXQqIHN0b3JlZFBvc2l0aW9ucyA9IG5ldyBmbG9hdFsyXTsKKyAgICBzdG9yZWRQb3NpdGlvbnNbMF0gPSAwLjBmOworICAgIHN0b3JlZFBvc2l0aW9uc1sxXSA9IDEuMGY7CisKKyAgICB1aW50MzJfdCogc3RvcmVkQ29sb3JzID0gbmV3IHVpbnQzMl90WzJdOworICAgIHN0b3JlZENvbG9yc1swXSA9IHN0YXRpY19jYXN0PHVpbnQzMl90Pihjb2xvcjApOworICAgIHN0b3JlZENvbG9yc1sxXSA9IHN0YXRpY19jYXN0PHVpbnQzMl90Pihjb2xvcjEpOworCisgICAgU2tpYVNoYWRlciogc2tpYVNoYWRlciA9IG5ldyBTa2lhTGluZWFyR3JhZGllbnRTaGFkZXIoc3RvcmVkQm91bmRzLCBzdG9yZWRDb2xvcnMsCisgICAgICAgICAgICBzdG9yZWRQb3NpdGlvbnMsIDIsIHNoYWRlciwgc3RhdGljX2Nhc3Q8U2tTaGFkZXI6OlRpbGVNb2RlPih0aWxlTW9kZSksIE5VTEwsCisgICAgICAgICAgICAoc2hhZGVyLT5nZXRGbGFncygpICYgU2tTaGFkZXI6OmtPcGFxdWVBbHBoYV9GbGFnKSA9PSAwKTsKKworICAgIHJldHVybiBza2lhU2hhZGVyOworI2Vsc2UKKyAgICByZXR1cm4gTlVMTDsKKyNlbmRpZgorfQorCitzdGF0aWMgU2tTaGFkZXIqIExpbmVhckdyYWRpZW50X2NyZWF0ZTIoSk5JRW52KiBlbnYsIGpvYmplY3QgbywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCB4MCwgZmxvYXQgeTAsIGZsb2F0IHgxLCBmbG9hdCB5MSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgY29s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bFRleHQoY29uc3QgamNoYXIqIGNvbnRleHQsIGpzaXplIHN0YXJ0LCBqc2l6ZSBjb3VudCwganNpemUgY29udGV4dENvdW50LAorICAgICAgICAgICAgICAgICAgICAgICAgamNoYXIqIHNoYXBlZCwgVUVycm9yQ29kZSAmc3RhdHVzKSB7CisgICAgamNoYXIgYnVmZmVyW2NvbnRleHRDb3VudF07CisKKyAgICAvLyBVc2UgZml4ZWQgbGVuZ3RoIHNpbmNlIHdlIG5lZWQgdG8ga2VlcCBzdGFydCBhbmQgY291bnQgdmFsaWQKKyAgICB1X3NoYXBlQXJhYmljKGNvbnRleHQsIGNvbnRleHRDb3VudCwgYnVmZmVyLCBjb250ZXh0Q291bnQsCisgICAgICAgICAgICAgICAgICAgVV9TSEFQRV9MRU5HVEhfRklYRURfU1BBQ0VTX05FQVIgfAorICAgICAgICAgICAgICAgICAgIFVfU0hBUEVfVEVYVF9ESVJFQ1RJT05fTE9HSUNBTCB8IFVfU0hBUEVfTEVUVEVSU19TSEFQRSB8CisgICAgICAgICAgICAgICAgICAgVV9TSEFQRV9YX0xBTUFMRUZfU1VCX0FMVEVSTkFURSwgJnN0YXR1cyk7CisKKyAgICBpZiAoVV9TVUNDRVNTKHN0YXR1cykpIHsKKyAgICAgICAgLy8gdHJpbSBvdXQgMHhmZmZmIGZvbGxvd2luZyBsaWdhdHVyZXMsIGlmIGFueQorICAgICAgICBpbnQgZW5kID0gMDsKKyAgICAgICAgZm9yIChpbnQgaSA9IHN0YXJ0LCBlID0gc3RhcnQgKyBjb3VudDsgaSA8IGU7ICsraSkgeworICAgICAgICAgICAgaWYgKGJ1ZmZlcltpXSAhPSAweGZmZmYpIHsKKyAgICAgICAgICAgICAgICBidWZmZXJbZW5kKytdID0gYnVmZmVyW2ldOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIGNvdW50ID0gZW5kOworICAgICAgICAvLyBMT0coTE9HX0lORk8sICJDU1JUTCIsICJzdGFydCAlZCBjb3VudCAlZCBj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fb3BlbigpOworICAgIGlmIChiaWRpKSB7CisgICAgICAgIHViaWRpX3NldFBhcmEoYmlkaSwgdGV4dCwgbGVuLCBiaWRpUmVxLCBOVUxMLCAmc3RhdHVzKTsKKyAgICAgICAgaWYgKFVfU1VDQ0VTUyhzdGF0dXMpKSB7CisgICAgICAgICAgICBkaXIgPSB1YmlkaV9nZXRQYXJhTGV2ZWwoYmlkaSkgJiAweDE7IC8vIDAgaWYgbHRyLCAxIGlmIHJ0bAorCisgICAgICAgICAgICBpbnQgcmMgPSB1YmlkaV9jb3VudFJ1bnMoYmlkaSwgJnN0YXR1cyk7CisgICAgICAgICAgICBpZiAoVV9TVUNDRVNTKHN0YXR1cykpIHsKKyAgICAgICAgICAgICAgICAvLyBMT0coTE9HX0lORk8sICJMQVlPVVQiLCAicGFyYSBiaWRpUmVxPSVkIGRpcj0lZCByYz0lZFxuIiwgYmlkaVJlcSwgZGlyLCByYyk7CisKKyAgICAgICAgICAgICAgICBpbnQzMl90IHNsZW4gPSAwOworICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgcmM7ICsraSkgeworICAgICAgICAgICAgICAgICAgICBpbnQzMl90IHN0YXJ0OworICAgICAgICAgICAgICAgICAgICBpbnQzMl90IGxlbmd0aDsKKyAgICAgICAgICAgICAgICAgICAgVUJpRGlEaXJlY3Rpb24gcnVuRGlyID0gdWJpZGlfZ2V0VmlzdWFsUnVuKGJpZGksIGksICZzdGFydCwgJmxlbmd0aCk7CisKKyAgICAgICAgICAgICAgICAgICAgaWYgKHJ1bkRpciA9PSBVQklESV9SVEwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHNsZW4gKz0gc2hhcGVSdGxUZXh0KHRleHQgKyBzdGFydCwgMCwgbGVuZ3RoLCBsZW5ndGgsIGJ1ZmZlciArIHNsZW4sIHN0YXR1cyk7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICBtZW1jcHkoYnVmZmVyICsgc2xlbiwgdGV4dCArIHN0YXJ0LCBsZW5ndGggKiBzaXplb2YoamNoYXIpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHNsZW4gKz0gbGVuZ3RoOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGlmIChVX1NVQ0NFU1Moc3RhdHVzKSkgeworICAgICAgICAgICAgICAgICAgICByZXN1bHQgPSBzbGVuOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICB1YmlkaV9jbG9zZShiaWRpKTsKKyAgICB9CisKKyAgICByZXR1cm4gcmVzdWx0OworfQorCitib29sIFRleHRMYXlvdXQ6OnByZXBhcmVUZXh0KFNrUGFpbnQgKnBhaW50LCBjb25zdCBqY2hhciogdGV4dCwganNpemUgbGVuLCBqaW50IGJpZGlGbGFncywKKyAgICAgICAgY29uc3QgamNoYXIqKiBvdXRUZXh0LCBpbnQzMl90KiBvdXRCeXRlcywgamNoYXIqKiBvdXRCdWZmZXIpIHsKKyAgICBjb25zdCBqY2hhciAqd29ya1RleHQgPSB0ZXh0OworICAgIGpjaGFyICpidWZmZXIgPSBOVUxMOworICAgIGludCBkaXIgPSBrRGlyZWN0aW9uX0xUUjsKKyAgICBpZiAobmVlZHNMYXlvdXQodGV4dCwgbGVuLCBiaWRpRmxhZ3MpKSB7CisgICAgICAgIGJ1ZmZlciA9KGpjaGFyICopIG1hbGxvYyhsZW4gKiBzaXplb2YoamNoYXIpKTsKKyAgICAgICAgaWYgKCFidWZmZXIpIHsKKyAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgfQorICAgICAgICBVRXJyb3JDb2RlIHN0YXR1cyA9IFVfWkVST19FUlJPUjsKKyAgICAgICAgbGVuID0gbGF5b3V0TGluZSh0ZXh0LCBsZW4sIGJpZGlGbGFncywgZGlyLCBidWZmZXIsIHN0YXR1cyk7IC8vIG1pZ2h0IGNoY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0gU2tGbG9hdFRvU2NhbGFyKHgpOworICAgICAgICBTa1NjYWxhciB5XyA9IFNrRmxvYXRUb1NjYWxhcih5KTsKKyAgICAgICAgaWYgKGNhbnZhcykgeworICAgICAgICAgICAgY2FudmFzLT5kcmF3VGV4dCh3b3JrVGV4dCwgd29ya0J5dGVzLCB4XywgeV8sICpwYWludCk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBwYWludC0+Z2V0VGV4dFBhdGgod29ya1RleHQsIHdvcmtCeXRlcywgeF8sIHlfLCBwYXRoKTsKKyAgICAgICAgfQorICAgICAgICBmcmVlKGJ1ZmZlcik7CisgICAgfQorfQorCitib29sIFRleHRMYXlvdXQ6OnByZXBhcmVSdGxUZXh0UnVuKGNvbnN0IGpjaGFyKiBjb250ZXh0LCBqc2l6ZSBzdGFydCwganNpemUmIGNvdW50LAorICAgICAgICBqc2l6ZSBjb250ZXh0Q291bnQsIGpjaGFyKiBzaGFwZWQpIHsKKyAgICBVRXJyb3JDb2RlIHN0YXR1cyA9IFVfWkVST19FUlJPUjsKKyAgICBjb3VudCA9IHNoYXBlUnRsVGV4dChjb250ZXh0LCBzdGFydCwgY291bnQsIGNvbnRleHRDb3VudCwgc2hhcGVkLCBzdGF0dXMpOworICAgIGlmIChVX1NVQ0NFU1Moc3RhdHVzKSkgeworICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICB9IGVsc2UgeworICAgICAgICBMT0coTE9HX1dBUk4sICJMQVlPVVQiLCAiZHJhd1RleHRSdW4gZXJyb3IgJWRcbiIsIHN0YXR1cyk7CisgICAgfQorICAgIHJldHVybiBmYWxzZTsKK30KKwordm9pZCBUZXh0TGF5b3V0OjpkcmF3VGV4dFJ1bihTa1BhaW50KiBwYWludCwgY29uc3QgamNoYXIqIGNoYXJzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqaW50IHN0YXJ0LCBqaW50IGNvdW50LCBqaW50IGNvbnRleHRDb3VudCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGRpckZsYWdzLCBqZmxvYXQgeCwgamZsb2F0IHksIFNrQ2FudmFzKiBjYW52YXMpIHsKKworICAgICBTa1NjYWxhciB4XyA9IFNrRmxvYXRUb1NjYWxhcih4KTsKKyAgICAgU2tTY2FsYXIgeV8gPSBTa0Zsb2F0VG9TY2FsYXIoeSk7CisKKyAgICAgdWludDhfdCBydGwgPSBkaXJGbGFncyAmIDB4MTsKKyAgICAgaWYgKHJ0bCkgeworICAgICAgICAgU2tBdXRvU1RNYWxsb2M8ODAsIGpjaGFyPiBidWZmZXIoY29udGV4dENvdW50KTsKKyAgICAgICAgIGlmIChwcmVwYXJlUnRsVGV4dFJ1bihjaGFycywgc3RhcnQsIGNvdW50LCBjb250ZXh0Q291bnQsIGJ1ZmZlci5nZXQoKSkpIHsKKyAgICAgICAgICAgICBjYW52YXMtPmRyYXdUZXh0KGJ1ZmZlci5nZXQoKSwgY291bnQgPDwgMSwgeF8sIHlfLCAqcGFpbnQpOworICAgICAgICAgfQorICAgICB9IGVsc2UgeworICAgICAgICAgY2FudmFzLT5kcmF3VGV4dChjaGFycyArIHN0YXJ0LCBjb3VudCA8PCAxLCB4XywgeV8sICpwYWludCk7CisgICAgIH0KKyB9CisKK3ZvaWQgVGV4dExheW91dDo6Z2V0VGV4dFJ1bkFkdmFuY2VzKFNrUGFpbnQgKnBhaW50LCBjb25zdCBqY2hhciAqY2hhcnMsIGppbnQgc3RhcnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqaW50IGNvdW50LCBqaW50IGNvbnRleHRDb3VudCwgamludCBkaXJGbGFncywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpmbG9hdCAqcmVzdWx0QWR2YW5jZXMsIGpmbG9hdCAmcmVzdWx0VG90YWxBZHZhbmNlKSB7CisgICAgamNoYXIgYnVmZmVyW2NvbnRleHRDb3VudF07CisKKyAgICBTa1NjYWxhciogc2NhbGFyQXJyYXkgPSAo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V4dFtwXSA+PSAweGRjMDAgJiYgdGV4dFtwXSA8IDB4ZTAwMCAmJgorICAgICAgICAgICAgICAgICAgICB0ZXh0W3AtMV0gPj0gMHhkODAwICYmIHRleHRbcC0xXSA8IDB4ZGMwMCkgeworICAgICAgICAgICAgICAgIHJlc3VsdEFkdmFuY2VzW3ArK10gPSAwOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfSBlbHNlIHsKKyAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBjb3VudDsgaSsrKSB7CisgICAgICAgICAgICByZXN1bHRUb3RhbEFkdmFuY2UgKz0gcmVzdWx0QWR2YW5jZXNbaV0gPSBTa1NjYWxhclRvRmxvYXQoc2NhbGFyQXJyYXlbaV0pOworICAgICAgICB9CisgICAgfQorfQorCisKKy8vIERyYXdzIGEgcGFyYWdyYXBoIG9mIHRleHQgb24gYSBzaW5nbGUgbGluZSwgcnVubmluZyBiaWRpIGFuZCBzaGFwaW5nCit2b2lkIFRleHRMYXlvdXQ6OmRyYXdUZXh0KFNrUGFpbnQqIHBhaW50LCBjb25zdCBqY2hhciogdGV4dCwganNpemUgbGVuLAorICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgYmlkaUZsYWdzLCBqZmxvYXQgeCwgamZsb2F0IHksIFNrQ2FudmFzKiBjYW52YXMpIHsKKworICAgIGhhbmRsZVRleHQocGFpbnQsIHRleHQsIGxlbiwgYmlkaUZsYWdzLCB4LCB5LCBjYW52YXMsIE5VTEwpOworfQorCit2b2lkIFRleHRMYXlvdXQ6OmdldFRleHRQYXRoKFNrUGFpbnQgKnBhaW50LCBjb25zdCBqY2hhciAqdGV4dCwganNpemUgbGVuLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqaW50IGJpZGlGbGFncywgamZsb2F0IHgsIGpmbG9hdCB5LCBTa1BhdGggKnBhdGgpIHsKKyAgICBoYW5kbGVUZXh0KHBhaW50LCB0ZXh0LCBsZW4sIGJpZGlGbGFncywgeCwgeSwgTlVMTCwgcGF0aCk7Cit9CisKKwordm9pZCBUZXh0TGF5b3V0OjpkcmF3VGV4dE9uUGF0aChTa1BhaW50KiBwYWludCwgY29uc3QgamNoYXIqIHRleHQsIGludCBjb3VudCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGJpZGlGbGFncywgamZsb2F0IGhPZmZzZXQsIGpmbG9hdCB2T2Zmc2V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTa1BhdGgqIHBhdGgsIFNrQ2FudmFzKiBjYW52YXMpIHsKKworICAgIFNrU2NhbGFyIGhfID0gU2tGbG9hdFRvU2NhbGFyKGhPZmZzZXQpOworICAgIFNrU2NhbGFyIHZfID0gU2tGbG9hdFRvU2NhbGFyKHZPZmZzZXQpOworCisgICAgaWYgKCFuZWVkc0xheW91dCh0ZXh0LCBjb3VudCwgYmlkaUZsYWdzKSkgeworICAgICAgICBjYW52YXMtPmRyYXdUZXh0T25QYXRoSFYodGV4dCwgY291bnQgPDwgMSwgKnBhdGgsIGhfLCB2XywgKnBhaW50KTsKKyAgICAgICAgcmV0dXJuOworICAgIH0KKworICAgIFNrQXV0b1NUTWFsbG9jPDgwLCBqY2hhcj4gYnVmZmVyKGNvdW50KTsKKyAgICBpbnQgZGlyID0ga0RpcmVjdGlvbl9MVFI7CisgICAgVUVycm9yQ29kZSBzdGF0dXMgPSBVX1pFUk9fRVJST1I7CisgICAgY291bnQgPSBsYXlvdXRMaW5lKHRleHQsIGNvdW50LCBiaWRpRmxhZ3MsIGRpciwgYnVmZmVyLmdldCgpLCBzdGF0dXMpOworICAgIGlmIChVX1NVQ0NFU1Moc3RhdHVzKSkgeworICAgICAgICBjYW52YXMtPmRyYXdUZXh0T25QYXRoSFYoYnVmZmVyLmdldCgpLCBjb3VudCA8PCAxLCAqcGF0aCwgaF8sIHZfLCAqcGFpbnQpOworICAgIH0KK30KKworfQpkaWZmIC0tZ2l0IGEvY29yZS9qbmkvYW5kcm9pZC9ncmFwaG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nNlLgorICovCisKKyNpbmNsdWRlICJqbmkuaCIKKworI2luY2x1ZGUgIlNrQ2FudmFzLmgiCisjaW5jbHVkZSAiU2tQYWludC5oIgorI2luY2x1ZGUgInVuaWNvZGUvdXR5cGVzLmgiCisKK25hbWVzcGFjZSBhbmRyb2lkIHsKKworY2xhc3MgVGV4dExheW91dCB7CitwdWJsaWM6CisKKyAgICBlbnVtIHsKKyAgICAgICAga0RpcmVjdGlvbl9MVFIgPSAwLAorICAgICAgICBrRGlyZWN0aW9uX1JUTCA9IDEsCisKKyAgICAgICAga0RpcmVjdGlvbl9NYXNrID0gMHgxCisgICAgfTsKKworICAgIGVudW0geworICAgICAgICBrQmlkaV9MVFIgPSAwLAorICAgICAgICBrQmlkaV9SVEwgPSAxLAorICAgICAgICBrQmlkaV9EZWZhdWx0X0xUUiA9IDIsCisgICAgICAgIGtCaWRpX0RlZmF1bHRfUlRMID0gMywKKyAgICAgICAga0JpZGlfRm9yY2VfTFRSID0gNCwKKyAgICAgICAga0JpZGlfRm9yY2VfUlRMID0gNSwKKworICAgICAgICBrQmlkaV9NYXNrID0gMHg3CisgICAgfTsKKworICAgIC8qCisgICAgICogRHJhd3MgYSB1bmlkaXJlY3Rpb25hbCBydW4gb2YgdGV4dC4KKyAgICAgKi8KKyAgICBzdGF0aWMgdm9pZCBkcmF3VGV4dFJ1bihTa1BhaW50KiBwYWludCwgY29uc3QgamNoYXIqIGNoYXJzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGppbnQgc3RhcnQsIGppbnQgY291bnQsIGppbnQgY29udGV4dENvdW50LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBkaXJGbGFncywgamZsb2F0IHgsIGpmbG9hdCB5LCBTa0NhbnZhcyogY2FudmFzKTsKKworICAgIHN0YXRpYyB2b2lkIGdldFRleHRSdW5BZHZhbmNlcyhTa1BhaW50ICpwYWludCwgY29uc3QgamNoYXIgKmNoYXJzLCBqaW50IHN0YXJ0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqaW50IGNvdW50LCBqaW50IGNvbnRleHRDb3VudCwgamludCBkaXJGbGFncywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgamZsb2F0ICpyZXN1bHRBZHZhbmNlcywgamZsb2F0ICZyZXN1bHRUb3RhbEFkdmFuY2UpOworCisgICAgc3RhdGljIHZvaWQgZHJhd1RleHQoU2tQYWludCogcGFpbnQsIGNvbnN0IGpjaGFyKiB0ZXh0LCBqc2l6ZSBsZW4sCisgICAgICAgICAgICAgICAgICAgICAgICAgamludCBiaWRpRmxhZ3MsIGpmbG9hdCB4LCBqZmxvYXQgeSwgU2tDYW52YXMqIGNhbnZhcyk7CisKKyAgICBzdGF0aWMgdm9pZCBnZXRUZXh0UGF0aChTa1BhaW50ICpwYWludCwgY29uc3QgamNoYXIgKnRleHQsIGpzaXplIGxlbiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBqaW50IGJpZGlGbGFncywgamZsb2F0IHgsIGpmbG9hdCB5LCBTa1BhdGggKnBhdGgpOworCisgICAgc3RhdGljIHZvaWQgZHJhd1RleHRPblBhdGgoU2tQYWludCogcGFpbnQsIGNvbnN0IGpjaGFyKiB0ZXh0LCBqc2l6ZSBsZW4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGJpZGlGbGFncywgamZsb2F0IGhPZmZzZXQsIGpmbG9hdCB2T2Zmc2V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNrUGF0aCogcGF0aCwgU2tDYW52YXMqIGNhbnZhcyk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCisgICBzdGF0aWMgYm9vbCBwcmVwYXJlVGV4dChTa1BhaW50ICpwYWludCwgY29uc3QgamNoYXIqIHRleHQsIGpzaXplIGxlbiwgamludCBiaWRpRmxhZ3MsCisgICAgICAgIGNvbnN0IGpjaGFyKiogb3V0VGV4dCwgaW50MzJfdCogb3V0Qnl0ZXMsIGpjaGFyKiogb3V0QnVmZmVyKTsKKyAgICBzdGF0aWMgYm9vbCBwcmVwYXJlUnRsVGV4dFJ1bihjb25zdCBqY2hhciogY29udGV4dCwganNpemUgc3RhcnQsIGpzaXplJiBjb3VudCwKKyAgICAgICAganNpemUgY29udGV4dENvdW50LCBqY2hhciogc2hhcGVkKTsKKyAgICAgICAgCisKK3ByaXZhdGU6CisgICAgc3RhdGljIGJvb2wgbmVlZHNMYXlvdXQoY29uc3QgamNoYXIqIHRleHQsIGppbnQgbGVuLCBqaW50IGJpZGlGbGFncyk7CisgICAgc3RhdGljIGludCBzaGFwZVJ0bFRleHQoY29uc3QgamNoYXIqIGNvbnRleHQsIGpzaXplIHN0YXJ0LCBqc2l6ZSBjb3VudCwganNpemUgY29udGV4dENvdW50LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpjaGFyKiBzaGFwZWQsIFVFcnJvckNvZGUgJnN0YXR1cyk7CisgICAgc3RhdGljIGppbnQgbGF5b3V0TGluZShjb25zdCBqY2hhciogdGV4dCwgamludCBsZW4sIGppbnQgZmxhZ3MsIGludCAmZGlyLCBqY2hhciogYnVmZmVyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgVUVycm9yQ29kZSAmc3RhdHVzKTsKKyAgICBzdGF0aWMgdm9pZCBoYW5kbGVUZXh0KFNrUGFpbnQgKnBhaW50LCBjb25zdCBqY2hhciogdGV4dCwganNpemUgbGVuLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGJpZGlGbGFncywgamZsb2F0IHgsIGpmbG9hdCB5LFNrQ2FudmFzICpjYW52YXMsIFNrUGF0aCAqcGF0aCk7Cit9OworCit9CmRpZmYgLS1naXQgYS9jb3JlL2puaS9hbmRyb2lkL2dyYXBoaWNzL1R5cGVmYWNlLmNwcCBiL2NvcmUvam5pL2FuZHJvaWQvZ3JhcGhpY3MvVHlwZWZhY2UuY3BwCmluZGV4IDdjN2JmZWIuLjFmZTcyZTYgMTAwNjQ0Ci0tLSB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IGlmKCFmcCkgewotICAgICAgICBMT0dFKCJFcnJvciglcylvcGVuaW5nIGJsYWNrbGlzdCBmaWxlIiwgc3RyZXJyb3IoZXJybm8pKTsKLSAgICAgICAgcmV0dXJuOwotICAgIH0KLQotICAgIHdoaWxlIChmZ2V0cyhsaW5lLCBNQVhfTElORSwgZnApICE9IE5VTEwpIHsKLSAgICAgICAgaWYgKChDT01QQVJFX1NUUklORyhsaW5lLCAiLy8iKSkgfHwgKCFzdHJjbXAobGluZSwgIiIpKSkKLSAgICAgICAgICAgIGNvbnRpbnVlOwotICAgICAgICBjaGFyICptb2R1bGUgPSBzdHJ0b2sobGluZSwiOiIpOwotICAgICAgICBpZiAoQ09NUEFSRV9TVFJJTkcobW9kdWxlLCBTQ09fQkxBQ0tMSVNUX01PRFVMRV9OQU1FKSkgewotICAgICAgICAgICAgbmV3ZWxlbSA9IChzY29CbGFja2xpc3RfdCAqKWNhbGxvYygxLCBzaXplb2Yoc2NvQmxhY2tsaXN0X3QpKTsKLSAgICAgICAgICAgIGlmIChuZXdlbGVtID09IE5VTEwpIHsKLSAgICAgICAgICAgICAgICBMT0dFKCIlczogb3V0IG9mIG1lbW9yeSEiLCBfX0ZVTkNUSU9OX18pOwotICAgICAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIC8vIHBhcnNlIGxpbmUKLSAgICAgICAgICAgIGNoYXIgKnR5cGUgPSBzdHJ0b2soTlVMTCwgIiwiKTsKLSAgICAgICAgICAgIGNoYXIgKnZhbHVlTGlzdCA9IHN0cnRvayhOVUxMLCAiLCIpOwotICAgICAgICAgICAgY2hhciAqcGFyYW1MaXN0ID0gc3RydG9rKE5VTEwsICIsIik7Ci0gICAgICAgICAgICBpZiAoQ09NUEFSRV9TVFJJTkcodHlwZSwgQkxBQ0tMSVNUX0JZX05BTUUpKSB7Ci0gICAgICAgICAgICAgICAgLy8gRXh0cmFjdCBOYW1lIGZyb20gVmFsdWUgbGlzdAotICAgICAgICAgICAgICAgIG5ld2VsZW0tPmZpZWxkVHlwZSA9IEJMX1RZUEVfTkFNRTsKLSAgICAgICAgICAgICAgICBuZXdlbGVtLT52YWx1ZSA9IChjaGFyICopY2FsbG9jKDEsIHN0cmxlbih2YWx1ZUxpc3QpKTsKLSAgICAgICAgICAgICAgICBpZiAobmV3ZWxlbS0+dmFsdWUgPT0gTlVMTCkgewotICAgICAgICAgICAgICAgICAgICBMT0dFKCIlczogb3V0IG9mIG1lbW9yeSEiLCBfX0ZVTkNUSU9OX18pOwotICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgdmFsdWVMaXN0Kys7ICAvLyBTa2lwIG9wZW4gcXVvdGUKLSAgICAgICAgICAgICAgICBzdHJuY3B5KG5ld2VsZW0tPnZhbHVlLCB2YWx1ZUxpc3QsIHN0cmxlbih2YWx1ZUxpc3QpIC0gMSk7Ci0KLSAgICAgICAgICAgICAgICAvLyBHZXQgU2NvIFNldHRpbmdzIGZyb20gUGFyYW1ldGVycwotICAgICAgICAgICAgICAgIGNoYXIgKnBhcmFtID0gc3RydG9rKHBhcmFtTGlzdCwgIjsiKTsKLSAgICAgICAgICAgICAgICB1aW50MTZfdCBzY29UeXBlcyA9IDA7Ci0gICAgICAgICAgICAgICAgd2hpbGUgKHBhcmFtICE9IE5VTEwpIHsKLSAgICAgICAgICAgICAgICAgICAgdWludDE2X3Qgc2NvOwotICAgICAgICAgICAgICAgICAgICBpZiAocGFyYW1bMF0gPT0gJy0nKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBwYXJhbSsrOwotICAgICAgICAgICAgICAgICAgICAgICAgc2NvID0gc3RyMnNjb1R5cGUocGFyYW0pOwotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHNjbyAhPSAwKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjb1R5cGVzICY9IH5zY287Ci0gICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAocGFyYW1bMF0gPT0gJysnKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBwYXJhbSsrOwotICAgICAgICAgICAgICAgICAgICAgICAgc2NvID0gc3RyMnNjb1R5cGUocGFyYW0pOwotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHNjbyAhPSAwKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjb1R5cGVzIHw9IHNjbzsKLSAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChwYXJhbVswXSA9PSAnPScpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtKys7Ci0gICAgICAgICAgICAgICAgICAgICAgICBzY28gPSBzdHIyc2NvVHlwZShwYXJhbSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoc2NvICE9IDApCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NvVHlwZXMgPSBzY287Ci0gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBMT0dFKCJJbnZhbGlkIFNDTyB0eXBlIG11c3QgYmUgPSwgKyBvciAtIik7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgcGFyYW0gPSBzdHJ0b2soTlVMTCwgIjsiKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgbmV3ZWxlbS0+c2NvVHlwZSA9IHNjb1R5cGVzOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBMT0dFKCJVbmtub3duIFNDTyB0eXBlIGVudHJ5IGluIEJsYWNrbGlzdCBmaWxlIik7Ci0gICAgICAgICAgICAgICAgY29udGludWU7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAobGlzdCkgewotICAgICAgICAgICAgICAgIGxpc3QtPm5leHQgPSBuZXdlbGVtOwotICAgICAgICAgICAgICAgIGxpc3QgPSBuZXdlbGVtOwotICAgICAgICAgICAgfSB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gICAgdmFfc3RhcnQobHN0LCBmaXJzdF9hcmdfdHlwZSk7CisKICAgICByZXQgPSBkYnVzX2Z1bmNfYXJnc19hc3luY192YWxpc3QoZW52LCBjb25uLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aW1lb3V0X21zLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXBseSwgdXNlciwgbmF0LApAQCAtNjk5LDYgKzcxMCwxNiBAQAogICAgICAgICAgICAgICAgICAgICBzaXplb2YocmVtb3RlX2RldmljZV9wcm9wZXJ0aWVzKSAvIHNpemVvZihQcm9wZXJ0aWVzKSk7CiB9CiAKK2pvYmplY3RBcnJheSBwYXJzZV9pbnB1dF9wcm9wZXJ0eV9jaGFuZ2UoSk5JRW52ICplbnYsIERCdXNNZXNzYWdlICptc2cpIHsKKyAgICByZXR1cm4gcGFyc2VfcHJvcGVydHlfY2hhbmdlKGVudiwgbXNnLCAoUHJvcGVydGllcyAqKSAmaW5wdXRfcHJvcGVydGllcywKKyAgICAgICAgICAgICAgICAgICAgc2l6ZW9mKGlucHV0X3Byb3BlcnRpZXMpIC8gc2l6ZW9mKFByb3BlcnRpZXMpKTsKK30KKworam9iamVjdEFycmF5IHBhcnNlX3Bhbl9wcm9wZXJ0eV9jaGFuZ2UoSk5JRW52ICplbnYsIERCdXNNZXNzYWdlICptc2cpIHsKKyAgICByZXR1cm4gcGFyc2VfcHJvcGVydHlfY2hhbmdlKGVudiwgbXNnLCAoUHJvcGVydGllcyAqKSAmcGFuX3Byb3BlcnRpZXMsCisgICAgICAgICAgICAgICAgICAgIHNpemVvZihwYW5fcHJvcGVydGllcykgLyBzaXplb2YoUHJvcGVydGllcykpOworfQorCiBqb2JqZWN0QXJyYXkgcGFyc2VfYWRhcHRlcl9wcm9wZXJ0aWVzKEpOSUVudiAqZW52LCBEQnVzTWVzc2FnZUl0ZXIgKml0ZXIpIHsKICAgICByZXR1cm4gcGFyc2VfcHJvcGVydGllcyhlb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CBpc051bGxfbmF0aXZlKEN1cnNvcldpbmRvdyAqd2luZG93LCBqaW50IHJvdywgamludCBjb2x1bW4pCiB7Ci0gICAgQ3Vyc29yV2luZG93ICogd2luZG93ID0gR0VUX1dJTkRPVyhlbnYsIG9iamVjdCk7Ci1MT0dfV0lORE9XKCJDaGVja2luZyBmb3IgTlVMTCBhdCAlZCwlZCBmcm9tICVwIiwgcm93LCBjb2x1bW4sIHdpbmRvdyk7CisgICAgTE9HX1dJTkRPVygiQ2hlY2tpbmcgZm9yIE5VTEwgYXQgJWQsJWQgZnJvbSAlcCIsIHJvdywgY29sdW1uLCB3aW5kb3cpOwogCiAgICAgYm9vbCBpc051bGw7CiAgICAgaWYgKHdpbmRvdy0+Z2V0TnVsbChyb3csIGNvbHVtbiwgJmlzTnVsbCkpIHsKQEAgLTY1Miw2ICs1ODcsMjYgQEAKICAgICB3aW5kb3ctPmZyZWVMYXN0Um93KCk7CiB9CiAKK3N0YXRpYyBqaW50IGdldFR5cGVfbmF0aXZlKEpOSUVudiogZW52LCBqb2JqZWN0IG9iamVjdCwgamludCByb3csIGppbnQgY29sdW1uKQoreworICAgIGludDMyX3QgZXJyOworICAgIEN1cnNvcldpbmRvdyAqIHdpbmRvdyA9IEdFVF9XSU5ET1coZW52LCBvYmplY3QpOworICAgIExPR19XSU5ET1coInJldHVybmluZyBjb2x1bW4gdHlwZSBhZmZpbml0eSBmb3IgJWQsJWQgZnJvbSAlcCIsIHJvdywgY29sdW1uLCB3aW5kb3cpOworCisgICAgaWYgKGlzTnVsbF9uYXRpdmUod2luZG93LCByb3csIGNvbHVtbikpIHsKKyAgICAgIHJldHVybiBGSUVMRF9UWVBFX05VTEw7CisgICAgfQorCisgICAgZmllbGRfc2xvdF90IGZpZWxkOworICAgIGVyciA9IHdpbmRvdy0+cmVhZF9maWVsZF9zbG90KHJvdywgY29sdW1uLCAmZmllbGQpOworICAgIGlmIChlcnIgIT0gMCkgeworICAgICAgICB0aHJvd0V4Y2VwdGlvbld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udiwgam9iamVjdCBvYmplY3QsIGppbnQgc3RhdGVtZW50SWQpCit7CisgICAgaWYgKHN0YXRlbWVudElkID4gMCkgeworICAgICAgICBzcWxpdGUzX2ZpbmFsaXplKChzcWxpdGUzX3N0bXQgKilzdGF0ZW1lbnRJZCk7CisgICAgfQorfQorCitzdGF0aWMgdm9pZCBjdXN0b21fZnVuY3Rpb25fY2FsbGJhY2soc3FsaXRlM19jb250ZXh0ICogY29udGV4dCwgaW50IGFyZ2MsIHNxbGl0ZTNfdmFsdWUgKiogYXJndikgeworICAgIEpOSUVudiogZW52ID0gQW5kcm9pZFJ1bnRpbWU6OmdldEpOSUVudigpOworICAgIGlmICghZW52KSB7CisgICAgICAgIExPR0UoImN1c3RvbV9mdW5jdGlvbl9jYWxsYmFjayBjYW5ub3QgY2FsbCBpbnRvIEphdmEgb24gdGhpcyB0aHJlYWQiKTsKKyAgICAgICAgcmV0dXJuOworICAgIH0KKyAgICAvLyBnZXQgZ2xvYmFsIHJlZiB0byBDdXN0b21GdW5jdGlvbiBvYmplY3QgZnJvbSBvdXIgdXNlciBkYXRhCisgICAgam9iamVjdCBmdW5jdGlvbiA9IChqb2JqZWN0KXNxbGl0ZTNfdXNlcl9kYXRhKGNvbnRleHQpOworCisgICAgLy8gcGFjayB1cCB0aGUgYXJndW1lbnRzIGludG8gYSBzdHJpbmcgYXJyYXkKKyAgICBpZiAoIXN0cmluZ19jbGFzcykKKyAgICAgICAgc3RyaW5nX2NsYXNzID0gKGpjbGFzcyllbnYtPk5ld0dsb2JhbFJlZihlbnYtPkZpbmRDbGFzcygiamF2YS9sYW5nL1N0cmluZyIpKTsKKyAgICBqb2JqZWN0QXJyYXkgc3RyQXJyYXkgPSBlbnYtPk5ld09iamVjdEFycmF5KGFyZ2MsIHN0cmluZ19jbGFzcywgTlVMTCk7CisgICAgaWYgKCFzdHJBcnJheSkKKyAgICAgICAgZ290byBkb25lOworICAgIGZvciAoaW50IGkgPSAwOyBpIDwgYXJnYzsgaSsrKSB7CisgICAgICAgIGNoYXIqIGFyZyA9IChjaGFyICopc3FsaXRlM192YWx1ZV90ZXh0KGFyZ3ZbaV0pOworICAgICAgICBpZiAoIWFyZykgeworICAgICAgICAgICAgTE9HRSgiTlVMTCBhcmd1bWVudCBpbiBjdXN0b21fZnVuY3Rpb25fY2FsbGJhY2suICBUaGlzIHNob3VsZCBub3QgaGFwcGVuLiIpOworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisgICAgICAgIGpvYmplY3Qgb2JqID0gZW52LT5OZXdTdHJpbmdVVEYoYXJnKTsKKyAgICAgICAgaWYgKCFvYmopCisgICAgICAgICAgICBnb3RvIGRvbmU7CisgICAgICAgIGVudi0+U2V0T2JqZWN0QXJyYXlFbGVtZW50KHN0ckFycmF5LCBpLCBvYmopOworICAgICAgICBlbnYtPkRlbGV0ZUxvY2FsUmVmKG9iaik7CisgICAgfQorCisgICAgZW52LT5DYWxsVm9pZE1ldGhvZChmdW5jdGlvbiwgbWV0aG9kX2N1c3RvbV9mdW5jdGlvbl9jYWxsYmFjaywgc3RyQXJyYXkpOworCitkb25lOgorICAgIGlmIChlbnYtPkV4Y2VwdGlvbkNoZWNrKCkpIHsKKyAgICAgICAgTE9HRSgiQW4gZXhjZXB0aW9uIHdhcyB0aHJvd24gYnkgY3VzdG9tIHNxbGl0ZTMgZnVuY3Rpb24uIik7CisgICAgICAgIExPR0VfRVgoZW52KTsKKyAgICAgICAgZW52LT5FeGNlcHRpb25DbGVhcigpOworICAgIH0KK30KKworc3RhdGljIGppbnQgbmF0aXZlX2FkZEN1c3RvbUZ1bmN0aW9uKEpOSUVudiogZW52LCBqb2JqZWN0IG9iamVjdCwKKyAgICAgICAganN0cmluZyBuYW1lLCBqaW50IG51bUFyZ3MsIGpvYmplY3QgZnVuY3Rpb24pCit7CisgICAgc3FsaXRlMyAqIGhhbmRsZSA9IChzcWxpdGUzICopZW52LT5HZXRJbnRGaWVsZChvYmplY3QsIG9mZnNldF9kYl9oYW5kbG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zaXplX3QqIHJlYzIgPSAoY29uc3Qgc2l6ZV90KikgdnJlYzI7CisgICAgc2l6ZV90IHNpemUxID0gKnJlYzE7CisgICAgc2l6ZV90IHNpemUyID0gKnJlYzI7CisKKyAgICBpZiAoc2l6ZTEgPCBzaXplMikgeworICAgICAgICByZXR1cm4gMTsKKyAgICB9IGVsc2UgaWYgKHNpemUxID4gc2l6ZTIpIHsKKyAgICAgICAgcmV0dXJuIC0xOworICAgIH0KKworICAgIGludHB0cl90KiBidDEgPSAoaW50cHRyX3QqKShyZWMxICsgMik7CisgICAgaW50cHRyX3QqIGJ0MiA9IChpbnRwdHJfdCopKHJlYzIgKyAyKTsKKyAgICBmb3IgKHNpemVfdCBpZHggPSAwOyBpZHggPCBCQUNLVFJBQ0VfU0laRTsgaWR4KyspIHsKKyAgICAgICAgaW50cHRyX3QgYWRkcjEgPSBidDFbaWR4XTsKKyAgICAgICAgaW50cHRyX3QgYWRkcjIgPSBidDJbaWR4XTsKKyAgICAgICAgaWYgKGFkZHIxID09IGFkZHIyKSB7CisgICAgICAgICAgICBpZiAoYWRkcjEgPT0gMCkKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICB9CisgICAgICAgIGlmIChhZGRyMSA8IGFkZHIyKSB7CisgICAgICAgICAgICByZXR1cm4gLTE7CisgICAgICAgIH0gZWxzZSBpZiAoYWRkcjEgPiBhZGRyMikgeworICAgICAgICAgICAgcmV0dXJuIDE7CisgICAgICAgIH0KKyAgICB9CisKKyAgICByZXR1cm4gMDsKK30KKworLyoKKyAqIFRoZSBnZXRfbWFsbG9jX2xlYWtfaW5mbygpIGNhbGwgcmV0dXJucyBhbiBhcnJheSBvZiBzdHJ1Y3RzIHRoYXQKKyAqIGxvb2sgbGlrZSB0aGlzOgorICoKKyAqICAgc2l6ZV90IHNpemUKKyAqICAgc2l6ZV90IGFsbG9jYXRpb25zCisgKiAgIGludHB0cl90IGJhY2t0cmFjZVszMl0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wgIk5hdGl2ZSBoZWFwIGR1bXAgbm90IGF2YWlsYWJsZS4gVG8gZW5hYmxlLCBydW4gdGhlc2UiCisgICAgICAgICAgICAgICAgICAgICIgY29tbWFuZHMgKHJlcXVpcmVzIHJvb3QpOlxuIik7CisgICAgICAgIGZwcmludGYoZnAsICIkIGFkYiBzaGVsbCBzZXRwcm9wIGxpYmMuZGVidWcubWFsbG9jIDFcbiIpOworICAgICAgICBmcHJpbnRmKGZwLCAiJCBhZGIgc2hlbGwgc3RvcFxuIik7CisgICAgICAgIGZwcmludGYoZnAsICIkIGFkYiBzaGVsbCBzdGFydFxuIik7CisgICAgICAgIHJldHVybjsKKyAgICB9CisgICAgYXNzZXJ0KGluZm9TaXplICE9IDApOworICAgIGFzc2VydChvdmVyYWxsU2l6ZSAlIGluZm9TaXplID09IDApOworCisgICAgZnByaW50ZihmcCwgIkFuZHJvaWQgTmF0aXZlIEhlYXAgRHVtcCB2MS4wXG5cbiIpOworCisgICAgc2l6ZV90IHJlY29yZENvdW50ID0gb3ZlcmFsbFNpemUgLyBpbmZvU2l6ZTsKKyAgICBmcHJpbnRmKGZwLCAiVG90YWwgbWVtb3J5OiAlenVcbiIsIHRvdGFsTWVtb3J5KTsKKyAgICBmcHJpbnRmKGZwLCAiQWxsb2NhdGlvbiByZWNvcmRzOiAlemRcbiIsIHJlY29yZENvdW50KTsKKyAgICBpZiAoYmFja3RyYWNlU2l6ZSAhPSBCQUNLVFJBQ0VfU0laRSkgeworICAgICAgICBmcHJpbnRmKGZwLCAiV0FSTklORzogbWlzbWF0Y2hlZCBiYWNrdHJhY2Ugc2l6ZXMgKCVkIHZzLiAlZClcbiIsCisgICAgICAgICAgICBiYWNrdHJhY2VTaXplLCBCQUNLVFJBQ0VfU0laRSk7CisgICAgfQorICAgIGZwcmludGYoZnAsICJcbiIpOworCisgICAgLyogcmUtc29ydCB0aGUgZW50cmllcyAqLworICAgIHFzb3J0KGluZm8sIHJlY29yZENvdW50LCBpbmZvU2l6ZSwgY29tcGFyZUhlYXBSZWNvcmRzKTsKKworICAgIC8qIGR1bXAgdGhlIGVudHJpZXMgdG8gdGhlIGZpbGUgKi8KKyAgICBjb25zdCB1aW50OF90KiBwdHIgPSBpbmZvOworICAgIGZvciAoc2l6ZV90IGlkeCA9IDA7IGlkeCA8IHJlY29yZENvdW50OyBpZHgrKykgeworICAgICAgICBzaXplX3Qgc2l6ZSA9ICooc2l6ZV90KikgcHRyOworICAgICAgICBzaXplX3QgYWxsb2NhdGlvbnMgPSAqKHNpemVfdCopIChwdHIgKyBzaXplb2Yoc2l6ZV90KSk7CisgICAgICAgIGludHB0cl90KiBiYWNrdHJhY2UgPSAoaW50cHRyX3QqKSAocHRyICsgc2l6ZW9mKHNpemVfdCkgKiAyKTsKKworICAgICAgICBmcHJpbnRmKGZwLCAieiAlZCAgc3ogJTh6dSAgbnVtICU0enUgIGJ0IiwKKyAgICAgICAgICAgICAgICAoc2l6ZSAmIFNJWkVfRkxBR19aWUdPVEVfQ0hJTEQpICE9IDAsCisgICAgICAgICAgICAgICAgc2l6ZSAmIH5TSVpFX0ZMQUdfWllHT1RFX0NISUxELAorICAgICAgICAgICAgICAgIGFsbG9jYXRpb25zKTsKKyAgICAgICAgZm9yIChzaXplX3QgYnQgPSAwOyBidCA8IGJhY2t0cmFjZVNpemU7IGJ0KyspIHsKKyAgICAgICAgICAgIGlmIChiYWNrdHJhY2VbYnRdID09IDApIHsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgZnByaW50ZihmcCwgIiAlMDh4IiwgYmFja3RyYWNlW2J0XSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgZnByaW50ZihmcCwgIlxuIik7CisKKyAgICAgICAgcHRyICs9IGluZm9TaXplOworICAgIH0KKworICAgIGZwcmludGYoZnAsICJFTkRcbiIpOworICAgIGZyZWVfbWFsbG9jX2xlYWtfaW5mbyhpbmZvKTsKK30KK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yAgICBqb2JqZWN0IGNsYXp6LCBqb2JqZWN0QXJyYXkgb3V0RmRzKQoreworICAgIGludCBmZHNbMl07CisgICAgaWYgKHBpcGUoZmRzKSA8IDApIHsKKyAgICAgICAgcmV0dXJuIC1lcnJubzsKKyAgICB9CisKKyAgICBmb3IgKGludCBpPTA7IGk8MjsgaSsrKSB7CisgICAgICAgIGpvYmplY3QgZmRPYmogPSBlbnYtPk5ld09iamVjdChnRmlsZURlc2NyaXB0b3JPZmZzZXRzLm1DbGFzcywKKyAgICAgICAgICAgICAgICBnRmlsZURlc2NyaXB0b3JPZmZzZXRzLm1Db25zdHJ1Y3Rvcik7CisgICAgICAgIGlmIChmZE9iaiAhPSBOVUxMKSB7CisgICAgICAgICAgICBlbnYtPlNldEludEZpZWxkKGZkT2JqLCBnRmlsZURlc2NyaXB0b3JPZmZzZXRzLm1EZXNjcmlwdG9yLCBmZHNbaV0pOworICAgICAgICB9CisgICAgICAgIGVudi0+U2V0T2JqZWN0QXJyYXlFbGVtZW50KG91dEZkcywgaSwgZmRPYmopOworICAgIH0KKworICAgIHJldHVybiAwOworfQorCiBzdGF0aWMgamludCBnZXRGZChKTklFbnYqIGVudiwgam9iamVjdCBjbGF6eikKIHsKICAgICBqb2JqZWN0IGRlc2NyaXB0b3IgPSBlbnYtPkdldE9iamVjdEZpZWxkKGNsYXp6LCBnUGFyY2VsRmlsZURlc2NyaXB0b3JPZmZzZXRzLm1GaWxlRGVzY3JpcHRvcik7CkBAIC0xMDksNiArMTI5LDggQEAKIHN0YXRpYyBjb25zdCBKTklOYXRpdmVNZXRob2QgZ1BhcmNlbEZpbGVEZXNjcmlwdG9yTWV0aG9kc1tdID0gewogICAgIHsiZ2V0RmlsZURlc2NyaXB0b3JGcm9tU29ja2V0IiwgIihMamF2YS9uZXQvU29ja2V0OylMamF2YS9pby9GaWxlRGVzY3JpcHRvcjsiLAogICAgICAgICAodm9pZCopYW5kcm9pZF9vc19QYXJjZWxGaWxlRGVzY3JpcHRvcl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ldmljZUNvbm5lY3Rpb25SZXN1bHQ7CisKIHR5cGVkZWYgZXZlbnRfbG9vcF9uYXRpdmVfZGF0YV90IG5hdGl2ZV9kYXRhX3Q7CiAKICNkZWZpbmUgRVZFTlRfTE9PUF9SRUZTIDEwCkBAIC0xMTYsNiArMTIxLDE0IEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICIoTGphdmEvbGFuZy9TdHJpbmc7SSlWIik7CiAgICAgbWV0aG9kX29uRGlzcGxheVBhc3NrZXkgPSBlbnYtPkdldE1ldGhvZElEKGNsYXp6LCAib25EaXNwbGF5UGFzc2tleSIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICIoTGphdmEvbGFuZy9TdHJpbmc7SUkpViIpOworICAgIG1ldGhvZF9vbklucHV0RGV2aWNlUHJvcGVydHlDaGFuZ2VkID0gZW52LT5HZXRNZXRob2RJRChjbGF6eiwgIm9uSW5wdXREZXZpY2VQcm9wZXJ0eUNoYW5nZWQiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiKExqYXZhL2xhbmcvU3RyaW5nO1tMamF2YS9sYW5nL1N0cmluZzspViIpOworICAgIG1ldGhvZF9vbklucHV0RGV2aWNlQ29ubmVjdGlvblJlc3VsdCA9IGVudi0+R2V0TWV0aG9kSUQoY2xhenosICJvbklucHV0RGV2aWNlQ29ubmVjdGlvblJlc3VsdCIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICIoTGphdmEvbGFuZy9TdHJpbmc7WilWIik7CisgICAgbWV0aG9kX29uUGFuRGV2aWNlUHJvcGVydHlDaGFuZ2VkID0gZW52LT5HZXRNZXRob2RJRChjbGF6eiwgIm9uUGFuRGV2aWNlUHJvcGVydHlDaGFuZ2VkIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIihMamF2YS9sYW5nL1N0cmluZztbTGphdmEvbGFuZy9TdHJpbmc7KVYiKTsKKyAgICBtZXRob2Rfb25QYW5EZXZpY2VDb25uZWN0aW9uUmVzdWx0ID0gZW52LT5HZXRNZXRob2RJRChjbGF6eiwgIm9uUGFuRGV2aWNlQ29ubmVjdGlvblJlc3VsdCIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICIoTGphdmEvbGFuZy9TdHJpbmc7WilWIik7CiAKICAgICBmaWVsZF9tTmF0aXZlRGF0YSA9IGVudi0+R2V0RmllbGRJRChjbGF6eiwgIm1OYXRpdmVEYXRhIiwgIkkiKTsKICNlbmRpZgpAQCAtMjI2LDYgKzIzOSwyMCBAQAogICAgICAgICAgICAgcmV0dXJuIEpOSV9GQUxTRTsKICAgICAgICAgfQogICAgICAgICBkYnVzX2J1c19hZGRfbWF0Y2gobmF0LT5jb25uLAorICAgICAgICAgICAgICAgICJ0eXBlPSdzaWduYWwnLGludGVyZmFjZT0nIkJMVUVaX0RCVVNfQkFTRV9JRkMiLklucHV0JyIsCisgICAgICAgICAgICAgICAgJmVycik7CisgICAgICAgIGlmIChkYnVzX2Vycm9yX2lzX3NldCgmZXJyKSkgeworICAgICAgICAgICAgTE9HX0FORF9GUkVFX0RCVVNfRVJST1IoJmVycik7CisgICAgICAgICAgICByZXR1cm4gSk5JX0ZBTFNFOworICAgICAgICB9CisgICAgICAgIGRidXNfYnVzX2FkZF9tYXRjaChuYXQtPmNvbm4sCisgICAgICAgICAgICAgICAgInR5cGU9J3NpZ25hbCcsaW50ZXJmYWNlPSciQkxVRVpfREJVU19CQVNFX0lGQyIuTmV0d29yayciLAorICAgICAgICAgICAgICAgICZlcnIpOworICAgICAgICBpZiAoZGJ1c19lcnJvcl9pc19zZXQoJmVycikpIHsKKyAgICAgICAgICAgIExPR19BTkRfRlJFRV9EQlVTX0VSUk9SKCZlcnIpOworICAgICAgICAgICAgcmV0dXJuIEpOSV9GQUxTRTsKKyAgICAgICAgfQorICAgICAgICBkYnVzX2J1c19hZGRfbWF0Y2gobmF0LT5jb25uLAogICAgICAgICAgICAgICAgICJ0eXBlPSdzaWduYWwnLGludGVyZmFjZT0nb3JnLmJsdWV6LkF1ZGlvU2luayciLAogICAgICAgICAgICAgICAgICZlcnIpOwogICAgICAgICBpZiAoZGJ1c19lcnJvcl9pc19zZXQoJmVycikpIHsKQEAgLTg1Myw3ICs4ODAsMzkgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXRob2Rfb25EZXZpY2VEaXNjb25uZWN0UmVxdWVzdGVkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVudi0+TmV3U3RyaW5nVVRGKHJlbW90ZV9kZXZpY2VfcGF0aCkpOwogICAgICAgICBnb3RvIHN1Y2Nlc3M7Ci0gICAgfQorICAgIH0gZWxzZSBpZiAoZGJ1c19tZXNzYWdlX2lzX3NpZ25hbChtc2csCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJvcmcuYmx1ZXouSW5wdXQiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiUHJvcGVydHlDaGFuZ2VkIikpIHsKKworICAgICAgICBqb2JqZWN0QXJyYXkgc3RyX2FycmF5ID0KKyAgICAgICAgICAgICAgICAgICAgcGFyc2VfaW5wdXRfcHJvcGVydHlfY2hhbmdlKGVudiwgbXNnKTsKKyAgICAgICAgaWYgKHN0cl9hcnJheSAhPSBOVUxMKSB7CisgICAgICAgICAgICBjb25zdCBjaGFyICpjX3BhdGggPSBkYnVzX21lc3NhZ2VfZ2V0X3BhdGgobXNnKTsKKyAgICAgICAgICAgIGVudi0+Q2FsbFZvaWRNZXRob2QobmF0LT5tZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWV0aG9kX29uSW5wdXREZXZpY2VQcm9wZXJ0eUNoYW5nZWQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVudi0+TmV3U3RyaW5nVVRGKGNfcGF0aCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cl9hcnJheSk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBMT0dfQU5EX0ZSRUVfREJVU19FUlJPUl9XSVRIX01TRygmZXJyLCBtc2cpOworICAgICAgICB9CisgICAgICAgIGdvdG8gc3VjY2VzczsKKyAgICB9IGVsc2UgaWYgKGRidXNfbWVzc2FnZV9pc19zaWduYWwobXNnLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJvcmcuYmx1ZXouTmV0d29yayIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIlByb3BlcnR5Q2hhbmdlZCIpKSB7CisKKyAgICAgICBqb2JqZWN0QXJyYXkgc3RyX2FycmF5ID0KKyAgICAgICAgICAgICAgICAgICBwYXJzZV9wYW5fcHJvcGVydHlfY2hhbmdlKGVudiwgbXNnKTsKKyAgICAgICBpZiAoc3RyX2FycmF5ICE9IE5VTEwpIHsKKyAgICAgICAgICAgY29uc3QgY2hhciAqY19wYXRoID0gZGJ1c19tZXNzYWdlX2dldF9wYXRoKG1zZyk7CisgICAgICAgICAgIGVudi0+Q2FsbFZvaWRNZXRob2QobmF0LT5tZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXRob2Rfb25QYW5EZXZpY2VQcm9wZXJ0eUNoYW5nZWQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW52LT5OZXdTdHJpbmdVVEYoY19wYXRoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJfYXJyYXkpOworICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgIExPR19BTkRfRlJFRV9EQlVTX0VSUk9SX1dJVEhfTVNHKCZlcnIsIG1zZyk7CisgICAgICAgfQorICAgICAgIGdvdG8gc3VjY2VzczsKKyAgIH0KIAogICAgIHJldCA9IGEyZHBfZXZlbnRfZmlsdGVyKG1zZywgZW52KTsKICAgICBlbnYtPlBvcExvY2FsRnJhbWUoTlVMTCk7CkBAIC0xMjEwLDYgKzEyNjksNTcgQEAKICAgICBlbnYtPkRlbGV0ZUxvY2FsUmVmKGFkZHIpOwogICAgIGZyZWUodXNlcik7CiB9CisKK3ZvaWQgb25JbnB1dERldmljZUNvbm5lY3Rpb25SZXN1bHQoREJ1c01lc3NhZ2UgKm1zZywgdm9pZCAqdXNlciwgdm9pZCAqbikgeworICAgIExPR1YoX19GVU5DVElPTl9fKTsKKworICAgIG5hdGl2ZV9kYXRhX3QgKm5hdCA9IChuYXRpdmVfZGF0YV90ICopbjsKKyAgICBjb25zdCBjaGFyICpwYXRoID0gKGNvbnN0IGNoYXIgKil1c2VyOworICAgIERCdXNFcnJvciBlcnI7CisgICAgZGJ1c19lcnJvcl9pbml0KCZlcnIpOworICAgIEpOSUVudiAqZW52OworICAgIG5hdC0+dm0tPkdldEVudigodm9pZCoqKSZlbnYsIG5hdC0+ZW52VmVyKTsKKworICAgIGJvb2wgcmVzdWx0ID0gSk5JX1RSVUU7CisgICAgaWYgKGRidXNfc2V0X2Vycm9yX2Zyb21fbWVzc2FnZSgmZXJyLCBtc2cpKSB7CisgICAgICAgIExPR19BTkRfRlJFRV9EQlVTX0VSUk9SKCZlcnIpOworICAgICAgICByZXN1bHQgPSBKTklfRkFMU0U7CisgICAgfQorICAgIExPR1YoIi4uLiBEZXZpY2UgUGF0aCA9ICVzLCByZXN1bHQgPSAlZCIsIHBhdGgsIHJlc3VsdCk7CisgICAganN0cmluZyBqUGF0aCA9IGVudi0+TmV3U3RyaW5nVVRGKHBhdGgpOworICAgIGVudi0+Q2FsbFZvaWRNZXRob2QobmF0LT5tZSwKKyAgICAgICAgICAgICAgICAgICAgICAgIG1ldGhvZF9vbklucHV0RGV2aWNlQ29ubmVjdGlvblJlc3VsdCwKKyAgICAgICAgICAgICAgICAgICAgICAgIGpQYXRoLAorICAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0KTsKKyAgICBlbnYtPkRlbGV0ZUxvY2FsUmVmKGpQYXRoKTsKKyAgICBmcmVlKHVzZXIpOworfQorCit2b2lkIG9uUGFuRGV2aWNlQ29ubmVjdGlvblJlc3VsdChEQnVzTWVzc2FnZSAqbXNnLCB2b2lkICp1c2VyLCB2b2lkICpuKSB7CisgICAgTE9HVihfX0ZVTkNUSU9OX18pOworCisgICAgbmF0aXZlX2RhdGFfdCAqbmF0ID0gKG5hdGl2ZV9kYXRhX3QgKiluOworICAgIGNvbnN0IGNoYXIgKnBhdGggPSAoY29uc3QgY2hhciAqKXVzZXI7CisgICAgREJ1c0Vycm9yIGVycjsKKyAgICBkYnVzX2Vycm9yX2luaXQoJmVycik7CisgICAgSk5JRW52ICplbnY7CisgICAgbmF0LT52bS0+R2V0RW52KCh2b2lkKiopJmVudiwgbmF0LT5lbnZWZXIpOworCisgICAgYm9vbCByZXN1bHQgPSBKTklfVFJVRTsKKyAgICBpZiAoZGJ1c19zZXRfZXJyb3JfZnJvbV9tZXNzYWdlKCZlcnIsIG1zZykpIHsKKyAgICAgICAgTE9HX0FORF9GUkVFX0RCVVNfRVJST1IoJmVycik7CisgICAgICAgIHJlc3VsdCA9IEpOSV9GQUxTRTsKKyAgICB9CisgICAgTE9HVigiLi4uIFBhbiBEZXZpY2UgUGF0aCA9ICVzLCByZXN1bHQgPSAlZCIsIHBhdGgsIHJlc3VsdCk7CisgICAganN0cmluZyBqUGF0aCA9IGVudi0+TmV3U3RyaW5nVVRGKHBhdGgpOworICAgIGVudi0+Q2FsbFZvaWRNZXRob2QobmF0LT5tZSwKKyAgICAgICAgICAgICAgICAgICAgICAgIG1ldGhvZF9vblBhbkRldmljZUNvbm5lY3Rpb25SZXN1bHQsCisgICAgICAgICAgICAgICAgICAgICAgICBqUGF0aCwKKyAgICAgICAgICAgICAgICAgICAgICAgIHJlc3VsdCk7CisgICAgZW52LT5EZWxldGVMb2NhbFJlZihqUGF0aCk7CisgICAgZnJlZSh1c2VyKTsKK30KKwogI2VuZGlm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0V2ZW50TG9vcF9uYXRpdmVfZGF0YShlbnYsIGV2ZW50TG9vcCk7CisKKyAgICBpZiAobmF0ICYmIGV2ZW50TG9vcE5hdCkgeworICAgICAgICBjb25zdCBjaGFyICpjX3BhdGggPSBlbnYtPkdldFN0cmluZ1VURkNoYXJzKHBhdGgsIE5VTEwpOworCisgICAgICAgIGludCBsZW4gPSBlbnYtPkdldFN0cmluZ0xlbmd0aChwYXRoKSArIDE7CisgICAgICAgIGNoYXIgKmNvbnRleHRfcGF0aCA9IChjaGFyICopY2FsbG9jKGxlbiwgc2l6ZW9mKGNoYXIpKTsKKyAgICAgICAgc3RybGNweShjb250ZXh0X3BhdGgsIGNfcGF0aCwgbGVuKTsgIC8vIGZvciBjYWxsYmFjaworCisgICAgICAgIGJvb2wgcmV0ID0gZGJ1c19mdW5jX2FyZ3NfYXN5bmMoZW52LCBuYXQtPmNvbm4sIC0xLCBvbklucHV0RGV2aWNlQ29ubmVjdGlvblJlc3VsdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250ZXh0X3BhdGgsIGV2ZW50TG9vcE5hdCwgY19wYXRoLCBEQlVTX0lOUFVUX0lGQUNFLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJDb25uZWN0IiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBEQlVTX1RZUEVfSU5WQUxJRCk7CisKKyAgICAgICAgZW52LT5SZWxlYXNlU3RyaW5nVVRGQ2hhcnMocGF0aCwgY19wYXRoKTsKKyAgICAgICAgcmV0dXJuIHJldCA/IEpOSV9UUlVFIDogSk5JX0ZBTFNFOworICAgIH0KKyNlbmRpZgorICAgIHJldHVybiBKTklfRkFMU0U7Cit9CisKK3N0YXRpYyBqYm9vbGVhbiBkaXNjb25uZWN0SW5wdXREZXZpY2VOYXRpdmUoSk5JRW52ICplbnYsIGpvYmplY3Qgb2JqZWN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpzdHJpbmcgcGF0aCkgeworICAgIExPR1YoX19GVU5DVElPTl9fKTsKKyNpZmRlZiBIQVZFX0JMVUVUT09USAorICAgIG5hdGl2ZV9kYXRhX3QgKm5hdCA9IGdldF9uYXRpdmVfZGF0YShlbnYsIG9iamVjdCk7CisgICAgam9iamVjdCBldmVudExvb3AgPSBlbnYtPkdldE9iamVjdEZpZWxkKG9iamVjdCwgZmllbGRfbUV2ZW50TG9vcCk7CisgICAgc3RydWN0IGV2ZW50X2xvb3BfbmF0aXZlX2RhdGFfdCAqZXZlbnRMb29wTmF0ID0KKyAgICAgICAgICAgIGdldF9FdmVudExvb3BfbmF0aXZlX2RhdGEoZW52LCBldmVudExvb3ApOworCisgICAgaWYgKG5hdCAmJiBldmVudExvb3BOYXQpIHsKKyAgICAgICAgY29uc3QgY2hhciAqY19wYXRoID0gZW52LT5HZXRTdHJpbmdVVEZDaGFycyhwYXRoLCBOVUxMKTsKKworICAgICAgICBpbnQgbGVuID0gZW52LT5HZXRTdHJpbmdMZW5ndGgocGF0aCkgKyAxOworICAgICAgICBjaGFyICpjb250ZXh0X3BhdGggPSAoY2hhciAqKWNhbGxvYyhsZW4sIHNpemVvZihjaGFyKSk7CisgICAgICAgIHN0cmxjcHkoY29udGV4dF9wYXRoLCBjX3BhdGgsIGxlbik7ICAvLyBmb3IgY2FsbGJhY2sKKworICAgICAgICBib29sIHJldCA9IGRidXNfZnVuY19hcmdzX2FzeW5jKGVudiwgbmF0LT5jb25uLCAtMSwgb25JbnB1dERldmljZUNvbm5lY3Rpb25SZXN1bHQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGV4dF9wYXRoLCBldmVudExvb3BOYXQsIGNfcGF0aCwgREJVU19JTlBVVF9JRkFDRSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiRGlzY29ubmVjdCIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgREJVU19UWVBFX0lOVkFMSUQpOworCisgICAgICAgIGVudi0+UmVsZWFzZVN0cmluZ1VURkNoYXJzKHBhdGgsIGNfcGF0aCk7CisgICAgICAgIHJldHVybiByZXQgPyBKTklfVFJVRSA6IEpOSV9GQUxTRTsKKyAgICB9CisjZW5kaWYKKyAgICByZXR1cm4gSk5JX0ZBTFNFOworfQorCitzdGF0aWMgamJvb2xlYW4gc2V0Qmx1ZXRvb3RoVGV0aGVyaW5nTmF0aXZlKEpOSUVudiAqZW52LCBqb2JqZWN0IG9iamVjdCwgamJvb2xlYW4gdmFsdWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpzdHJpbmcgc3JjX3JvbGUsIGpzdHJpbmcgYnJpZGdlKSB7CisgICAgTE9HVihfX0ZVTkNUSU9OX18pOworI2lmZGVmIEhBVkVfQkxVRVRPT1RICisgICAgbmF0aXZlX2RhdGFfdCAqbmF0ID0gZ2V0X25hdGl2ZV9kYXRhKGVudiwgb2JqZWN0KTsKKyAgICBpZiAobmF0KSB7CisgICAgICAgIERCdXNNZXNzYWdlICpyZXBseTsKKyAgICAgICAgY29uc3QgY2hhciAqY19yb2xlID0gZW52LT5HZXRTdHJpbmdVVEZDaGFycyhzcmNfcm9sZSwgTlVMTCk7CisgICAgICAgIGNvbnN0IGNoYXIgKmNfYnJpZGdlID0gZW52LT5HZXRTdHJpbmdVVEZDaGFycyhicmlkZ2UsIE5VTEwpOworICAgICAgICBpZiAodmFsdWUpIHsKKyAgICAgICAgICAgIExPR0UoInNldEJsdWV0b290aFRldGhlcmluZ05hdGl2ZSB0cnVlIik7CisgICAgICAgICAgICByZXBseSA9IGRidXNfZnVuY19hcmdzKGVudiwgbmF0LT5jb25uLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldF9hZGFwdGVyX3BhdGgoZW52LCBvYmplY3QpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIERCVVNfTkVUV09SS1NFUlZFUl9JRkFDRSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiUmVnaXN0ZXIiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIERCVVNfVFlQRV9TVFJJTkcsICZjX3JvbGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgREJVU19UWVBFX1NUUklORywgJmNfYnJpZGdlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIERCVVNfVFlQRV9JTlZBTElEKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIExPR0UoInNldEJsdWV0b290aFRldGhlcmluZ05hdGl2ZSBmYWxzZSIpOworICAgICAgICAgICAgcmVwbHkgPSBkYnVzX2Z1bmNfYXJncyhlbnYsIG5hdC0+Y29ubiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRfYWRhcHRlcl9wYXRoKGVudiwgb2JqZWN0KSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBEQlVTX05FVFdPUktTRVJWRVJfSUZBQ0UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIlVucmVnaXN0ZXIiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIERCVVNfVFlQRV9TVFJJTkcsICZjX3JvbGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgREJVU19UWVBFX0lOVkFMSUQpOworICAgICAgICB9CisgICAgICAgIGVudi0+UmVsZWFzZVN0cmluZ1VURkNoYXJzKHNyY19yb2xlLCBjX3JvbGUpOworICAgICAgICBlbnYtPlJlbGVhc2VTdHJpbmdVVEZDaGFycyhicmlkZ2UsIGNfYnJpZGdlKTsKKyAgICAgICAgcmV0dXJuIHJlcGx5ID8gSk5JX1RSVUUgOiBKTklfRkFMU0U7CisgICAgfQorI2VuZGlmCisgICAgcmV0dXJuIEpOSV9GQUxTRTsKK30KKworc3RhdGljIGpib29sZWFuIGNv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0aCwgY19wYXRoLCBsZW4pOyAgLy8gZm9yIGNhbGxiYWNrCisKKyAgICAgICAgYm9vbCByZXQgPSBkYnVzX2Z1bmNfYXJnc19hc3luYyhlbnYsIG5hdC0+Y29ubiwgLTEsb25QYW5EZXZpY2VDb25uZWN0aW9uUmVzdWx0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGV4dF9wYXRoLCBldmVudExvb3BOYXQsIGNfcGF0aCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIERCVVNfTkVUV09SS19JRkFDRSwgIkNvbm5lY3QiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgREJVU19UWVBFX1NUUklORywgJnNyYywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIERCVVNfVFlQRV9TVFJJTkcsICZkc3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBEQlVTX1RZUEVfSU5WQUxJRCk7CisKKyAgICAgICAgZW52LT5SZWxlYXNlU3RyaW5nVVRGQ2hhcnMocGF0aCwgY19wYXRoKTsKKyAgICAgICAgZW52LT5SZWxlYXNlU3RyaW5nVVRGQ2hhcnMoc3JjUm9sZSwgc3JjKTsKKyAgICAgICAgZW52LT5SZWxlYXNlU3RyaW5nVVRGQ2hhcnMoZHN0Um9sZSwgZHN0KTsKKyAgICAgICAgcmV0dXJuIHJldCA/IEpOSV9UUlVFIDogSk5JX0ZBTFNFOworICAgIH0KKyNlbmRpZgorICAgIHJldHVybiBKTklfRkFMU0U7Cit9CisKK3N0YXRpYyBqYm9vbGVhbiBkaXNjb25uZWN0UGFuRGV2aWNlTmF0aXZlKEpOSUVudiAqZW52LCBqb2JqZWN0IG9iamVjdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqc3RyaW5nIHBhdGgpIHsKKyAgICBMT0dWKF9fRlVOQ1RJT05fXyk7CisjaWZkZWYgSEFWRV9CTFVFVE9PVEgKKyAgICBMT0dFKCJkaXNjb25uZWN0UGFuRGV2aWNlTmF0aXZlIik7CisgICAgbmF0aXZlX2RhdGFfdCAqbmF0ID0gZ2V0X25hdGl2ZV9kYXRhKGVudiwgb2JqZWN0KTsKKyAgICBqb2JqZWN0IGV2ZW50TG9vcCA9IGVudi0+R2V0T2JqZWN0RmllbGQob2JqZWN0LCBmaWVsZF9tRXZlbnRMb29wKTsKKyAgICBzdHJ1Y3QgZXZlbnRfbG9vcF9uYXRpdmVfZGF0YV90ICpldmVudExvb3BOYXQgPQorICAgICAgICAgICAgZ2V0X0V2ZW50TG9vcF9uYXRpdmVfZGF0YShlbnYsIGV2ZW50TG9vcCk7CisKKyAgICBpZiAobmF0ICYmIGV2ZW50TG9vcE5hdCkgeworICAgICAgICBjb25zdCBjaGFyICpjX3BhdGggPSBlbnYtPkdldFN0cmluZ1VURkNoYXJzKHBhdGgsIE5VTEwpOworCisgICAgICAgIGludCBsZW4gPSBlbnYtPkdldFN0cmluZ0xlbmd0aChwYXRoKSArIDE7CisgICAgICAgIGNoYXIgKmNvbnRleHRfcGF0aCA9IChjaGFyICopY2FsbG9jKGxlbiwgc2l6ZW9mKGNoYXIpKTsKKyAgICAgICAgc3RybGNweShjb250ZXh0X3BhdGgsIGNfcGF0aCwgbGVuKTsgIC8vIGZvciBjYWxsYmFjaworCisgICAgICAgIGJvb2wgcmV0ID0gZGJ1c19mdW5jX2FyZ3NfYXN5bmMoZW52LCBuYXQtPmNvbm4sIC0xLG9uUGFuRGV2aWNlQ29ubmVjdGlvblJlc3VsdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250ZXh0X3BhdGgsIGV2ZW50TG9vcE5hdCwgY19wYXRoLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIERCVVNfTkVUV09SS19JRkFDRSwgIkRpc2Nvbm5lY3QiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIERCVVNfV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FyKikgc2hhcGVkLCBjb3VudCA8PCAxLCBjb3VudCwgeCwgeSwgcGFpbnQpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgTE9HVygiZHJhd1RleHRSdW4gZXJyb3IiKTsKKyAgICAgICAgfQorICAgIH0gZWxzZSB7CisgICAgICAgIHJlbmRlcmVyLT5kcmF3VGV4dCgoY29uc3QgY2hhciopICh0ZXh0ICsgc3RhcnQpLCBjb3VudCA8PCAxLCBjb3VudCwgeCwgeSwgcGFpbnQpOworICAgIH0KK30KKworc3RhdGljIHZvaWQgYW5kcm9pZF92aWV3X0dMRVMyMENhbnZhc19kcmF3VGV4dEFycmF5KEpOSUVudiogZW52LCBqb2JqZWN0IGNhbnZhcywKKyAgICAgICAgT3BlbkdMUmVuZGVyZXIqIHJlbmRlcmVyLCBqY2hhckFycmF5IHRleHQsIGludCBpbmRleCwgaW50IGNvdW50LAorICAgICAgICBqZmxvYXQgeCwgamZsb2F0IHksIGludCBmbGFncywgU2tQYWludCogcGFpbnQpIHsKKyAgICBqY2hhciogdGV4dEFycmF5ID0gZW52LT5HZXRDaGFyQXJyYXlFbGVtZW50cyh0ZXh0LCBOVUxMKTsKKyAgICByZW5kZXJUZXh0KHJlbmRlcmVyLCB0ZXh0QXJyYXkgKyBpbmRleCwgY291bnQsIHgsIHksIGZsYWdzLCBwYWludCk7CisgICAgZW52LT5SZWxlYXNlQ2hhckFycmF5RWxlbWVudHModGV4dCwgdGV4dEFycmF5LCBKTklfQUJPUlQpOworfQorCitzdGF0aWMgdm9pZCBhbmRyb2lkX3ZpZXdfR0xFUzIwQ2FudmFzX2RyYXdUZXh0KEpOSUVudiogZW52LCBqb2JqZWN0IGNhbnZhcywKKyAgICAgICAgT3BlbkdMUmVuZGVyZXIqIHJlbmRlcmVyLCBqc3RyaW5nIHRleHQsIGludCBzdGFydCwgaW50IGVuZCwKKyAgICAgICAgamZsb2F0IHgsIGpmbG9hdCB5LCBpbnQgZmxhZ3MsIFNrUGFpbnQqIHBhaW50KSB7CisgICAgY29uc3QgamNoYXIqIHRleHRBcnJheSA9IGVudi0+R2V0U3RyaW5nQ2hhcnModGV4dCwgTlVMTCk7CisgICAgcmVuZGVyVGV4dChyZW5kZXJlciwgdGV4dEFycmF5ICsgc3RhcnQsIGVuZCAtIHN0YXJ0LCB4LCB5LCBmbGFncywgcGFpbnQpOworICAgIGVudi0+UmVsZWFzZVN0cmluZ0NoYXJzKHRleHQsIHRleHRBcnJheSk7Cit9CisKK3N0YXRpYyB2b2lkIGFuZHJvaWRfdmlld19HTEVTMjBDYW52YXNfZHJhd1RleHRSdW5BcnJheShKTklFbnYqIGVudiwgam9iamVjdCBjYW52YXMsCisgICAgICAgIE9wZW5HTFJlbmRlcmVyKiByZW5kZXJlciwgamNoYXJBcnJheSB0ZXh0LCBpbnQgaW5kZXgsIGludCBjb3VudCwKKyAgICAgICAgaW50IGNvbnRleHRJbmRleCwgaW50IGNvbnRleHRDb3VudCwgamZsb2F0IHgsIGpmbG9hdCB5LCBpbnQgZGlyRmxhZ3MsCisgICAgICAgIFNrUGFpbnQqIHBhaW50KSB7CisgICAgamNoYXIqIHRleHRBcnJheSA9IGVudi0+R2V0Q2hhckFycmF5RWxlbWVudHModGV4dCwgTlVMTCk7CisgICAgcmVuZGVyVGV4dFJ1bihyZW5kZXJlciwgdGV4dEFycmF5ICsgY29udGV4dEluZGV4LCBpbmRleCAtIGNvbnRleHRJbmRleCwKKyAgICAgICAgICAgIGNvdW50LCBjb250ZXh0Q291bnQsIHgsIHksIGRpckZsYWdzLCBwYWludCk7CisgICAgZW52LT5SZWxlYXNlQ2hhckFycmF5RWxlbWVudHModGV4dCwgdGV4dEFycmF5LCBKTklfQUJPUlQpOworIH0KKworc3RhdGljIHZvaWQgYW5kcm9pZF92aWV3X0dMRVMyMENhbnZhc19kcmF3VGV4dFJ1bihKTklFbnYqIGVudiwgam9iamVjdCBjYW52YXMsCisgICAgICAgIE9wZW5HTFJlbmRlcmVyKiByZW5kZXJlciwganN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gICAgICAgICAgICAgIihJSSlJIiwgICAgICAgICAgICh2b2lkKikgYW5kcm9pZF92aWV3X0dMRVMyMENhbnZhc19zYXZlIH0sCisgICAgeyAiblJlc3RvcmUiLCAgICAgICAgICAgIihJKVYiLCAgICAgICAgICAgICh2b2lkKikgYW5kcm9pZF92aWV3X0dMRVMyMENhbnZhc19yZXN0b3JlIH0sCisgICAgeyAiblJlc3RvcmVUb0NvdW50IiwgICAgIihJSSlWIiwgICAgICAgICAgICh2b2lkKikgYW5kcm9pZF92aWV3X0dMRVMyMENhbnZhc19yZXN0b3JlVG9Db3VudCB9LAorICAgIHsgIm5HZXRTYXZlQ291bnQiLCAgICAgICIoSSlJIiwgICAgICAgICAgICAodm9pZCopIGFuZHJvaWRfdmlld19HTEVTMjBDYW52YXNfZ2V0U2F2ZUNvdW50IH0sCisKKyAgICB7ICJuU2F2ZUxheWVyIiwgICAgICAgICAiKElGRkZGSUkpSSIsICAgICAgKHZvaWQqKSBhbmRyb2lkX3ZpZXdfR0xFUzIwQ2FudmFzX3NhdmVMYXllciB9LAorICAgIHsgIm5TYXZlTGF5ZXJBbHBoYSIsICAgICIoSUZGRkZJSSlJIiwgICAgICAodm9pZCopIGFuZHJvaWRfdmlld19HTEVTMjBDYW52YXNfc2F2ZUxheWVyQWxwaGEgfSwKKworICAgIHsgIm5RdWlja1JlamVjdCIsICAgICAgICIoSUZGRkZJKVoiLCAgICAgICAodm9pZCopIGFuZHJvaWRfdmlld19HTEVTMjBDYW52YXNfcXVpY2tSZWplY3QgfSwKKyAgICB7ICJuQ2xpcFJlY3QiLCAgICAgICAgICAiKElGRkZGSSlaIiwgICAgICAgKHZvaWQqKSBhbmRyb2lkX3ZpZXdfR0xFUzIwQ2FudmFzX2NsaXBSZWN0RiB9LAorICAgIHsgIm5DbGlwUmVjdCIsICAgICAgICAgICIoSUlJSUlJKVoiLCAgICAgICAodm9pZCopIGFuZHJvaWRfdmlld19HTEVTMjBDYW52YXNfY2xpcFJlY3QgfSwKKworICAgIHsgIm5UcmFuc2xhdGUiLCAgICAgICAgICIoSUZGKVYiLCAgICAgICAgICAodm9pZCopIGFuZHJvaWRfdmlld19HTEVTMjBDYW52YXNfdHJhbnNsYXRlIH0sCisgICAgeyAiblJvdGF0ZSIsICAgICAgICAgICAgIihJRilWIiwgICAgICAgICAgICh2b2lkKikgYW5kcm9pZF92aWV3X0dMRVMyMENhbnZhc19yb3RhdGUgfSwKKyAgICB7ICJuU2NhbGUiLCAgICAgICAgICAgICAiKElGRilWIiwgICAgICAgICAgKHZvaWQqKSBhbmRyb2lkX3ZpZXdfR0xFUzIwQ2FudmFzX3NjYWxlIH0sCisKKyAgICB7ICJuU2V0TWF0cml4IiwgICAgICAgICAiKElJKVYiLCAgICAgICAgICAgKHZvaWQqKSBhbmRyb2lkX3ZpZXdfR0xFUzIwQ2FudmFzX3NldE1hdHJpeCB9LAorICAgIHsgIm5HZXRNYXRyaXgiLCAgICAgICAgICIoSUkpViIsICAgICAgICAgICAodm9pZCopIGFuZHJvaWRfdmlld19HTEVTMjBDYW52YXNfZ2V0TWF0cml4IH0sCisgICAgeyAibkNvbmNhdE1hdHJpeCIsICAgICAgIihJSSlWIiwgICAgICAgICAgICh2b2lkKikgYW5kcm9pZF92aWV3X0dMRVMyMENhbnZhc19jb25jYXRNYXRyaXggfSwKKworICAgIHsgIm5EcmF3Qml0bWFwIiwgICAgICAgICIoSUlGRkkpViIsICAgICAgICAodm9pZCopIGFuZHJvaWRfdmlld19HTEVTMjBDYW52YXNfZHJhd0JpdG1hcCB9LAorICAgIHsgIm5EcmF3Qml0bWFwIiwgICAgICAgICIoSUlGRkZGRkZGRkkpViIsICAodm9pZCopIGFuZHJvaWRfdmlld19HTEVTMjBDYW52YXNfZHJhd0JpdG1hcFJlY3QgfSwKKyAgICB7ICJuRHJhd0JpdG1hcCIsICAgICAgICAiKElJSUkpViIsICAgICAgICAgKHZvaWQqKSBhbmRyb2lkX3ZpZXdfR0xFUzIwQ2FudmFzX2RyYXdCaXRtYXBNYXRyaXggfSwKKyAgICB7ICJuRHJhd1BhdGNoIiwgICAgICAgICAiKElJW0JGRkZGSSlWIiwgICAgKHZvaWQqKSBhbmRyb2lkX3ZpZXdfR0xFUzIwQ2FudmFzX2RyYXdQYXRjaCB9LAorICAgIHsgIm5EcmF3Q29sb3IiLCAgICAgICAgICIoSUlJKVYiLCAgICAgICAgICAodm9pZCopIGFuZHJvaWRfdmlld19HTEVTMjBDYW52YXNfZHJhd0NvbG9yIH0sCisgICAgeyAibkRyYXdSZWN0IiwgICAgICAgICAgIihJRkZGRkkpViIsICAgICAgICh2b2lkKikgYW5kcm9pZF92aWV3X0dMRVMyMENhbnZhc19kcmF3UmVjdCB9LAorICAgIHsgIm5EcmF3UmVjdHMiLCAgICAgICAgICIoSUlJKVYiLCAgICAgICAgICAodm9pZCopIGFuZHJvaWRfdmlld19HTEVTMjBDYW52YXNfZHJhd1JlY3RzIH0sCisgICAgeyAibkRyYXdQYXRoIiwgICAgICAgICAgIihJSUkpViIsICAgICAgICAgICh2b2lkKikgYW5kcm9pZF92aWV3X0dMRVMyMENhbnZhc19kcmF3UGF0aCB9LAorCisgICAgeyAiblJlc2V0TW9kaWZpZXJzIiwgICAgIihJKVYiLCAgICAgICAgICAgICh2b2lkKikgYW5kcm9pZF92aWV3X0dMRVMyMENhbnZhc19yZXNldE1vZGlmaWVycyB9LAorICAgIHsgIm5TZXR1cFNoYWRlciIsICAgICAgICIoSUkpViIsICAgICAgICAgICAodm9pZCopIGFuZHJvaWRfdmlld19HTEVTMjBDYW52YXNfc2V0dXBTaGFkZXIgfSwKKyAgICB7ICJuU2V0dXBDb2xvckZpbHRlciIsICAiKElJKVYiLCAgICAgICAgICAgKHZvaWQqKSBhbmRyb2lkX3ZpZXdfR0xFUzIwQ2FudmFzX3NldHVwQ29sb3JGaWx0ZXIgfSwKKyAgICB7ICJuU2V0dXBTaGFkb3ciLCAgICAgICAiKElGRkZJKVYiLCAgICAgICAgKHZvaWQqKSBhbmR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Q0bAorLjJpZAorLmlkb2wzCisuaTFkbworLmltM20KKy5pbTVwMWkybgorLmk0bTFwCisuaW0ycGkKKy5pbjEKKy5pbjNjaQorLjJpbmUyCisuNGk0bjJrMgorLjJpMm4zczIKKy5pcjVyNAorLjRpcgorLmlzNGkKKy5qdTNyCisubGE0Y3kKKy5sYTRtCisubGF0NWVyCisubDRhdGg1CisubGUyCisubGVnNWUKKy5sZW40CisubGVwNQorLmxldjEKKy5sMmk0ZworLmxpMWc1YQorLmxpMm4KKy5sMmkzbworLmwxaTR0CisubWExZzVhNQorLjFtYQorLm1hbDVvCisubWExbjVhCisubWEybgorLm1hcjV0aQorLm0yYTJyCisubWUyCisubWVyM2MKKy5tZTV0ZXIKKy5tZTF0ZQorLm0yaXMxCisubWlzNHQ1aQorLm1vbjNlCisuMW1vCisubW8ybgorLm1vM3JvCisubW8ycgorLm11NXRhCisuMW11CisubXUydGE1YgorLm5pNGMKKy5vZDIKKy5vZDFkNQorLm9mNXRlCisubzJmdAorLm9yNWExdG8KKy5vMXJhCisub3IzYworLm9yMWQKKy5vcjN0Cisub3MzCisub3M0dGwKKy40b3RoMworLm91dDMKKy5vdTIKKy5wZWQ1YWwKKy4ycDJlZAorLnAyZTJkMmEKKy5wZTV0ZQorLnBlMnQKKy5wZTV0aXQKKy5wMmk0ZTQKKy5waW81bjQKKy4zcDJpMW8KKy5waTJ0CisucHJlM20KKy5wcjIKKy5yYTRjCisucmFuNHQKKy5yYTJuCisucmF0aW81bjFhCisucmF0aW8ybjQKKy5yYTF0MmlvCisucmVlMgorLnJlNW1pdAorLnJlczIKKy5yZTVzdGF0CisucmVzMnQKKy5yZXMxdGEKKy5yMmk0ZworLnJpMnQ1dQorLnJvNHEKKy5yb3M1dAorLnJvdzVkCisucnU0ZAorLjNzNGMyaTNlNAorLnMxY2kKKy41c2UybDJmNQorLnNlbDFsNQorLnNlMm4KKy5zZTVyMmllNAorLnNlcjFpCisuczJoMgorLnNpMgorLnMzaW5nNAorLjJzMWluCisuc3Q0Cisuc3RhNWIybDIKKy5zMXRhCisuczJ0YWIKKy5zNHkyCisuMXRhNAorLnRlNAorLjN0ZW41YTJuCisudGUxbmEKKy50aDIKKy50aTIKKy50aWw0CisudGkxbTVvNQorLjF0aW0KKy50aW5nNAorLjJ0MWluCisudDRpNG41azIKKy50bzFuNGEKKy4xdG8KKy50bzJuCisudG80cAorLnRvcDVpCisudG8ydTVzCisudG91MgorLnRyaWI1dXQKKy50cjRpYgorLnUxbjFhCisudW4zY2UKKy51bmRlcjUKKy51bjFkZQorLnUybjFlCisudTRuNWsyCisudW41bworLnVuM3U0CisudXAzCisudXJlMworLnVzNWEyCisuMnVzCisudmVuNGRlCisudmU1cjFhCisud2lsNWkKKy53aTIKKy53aWwyCisueWU0Cis0YWIuCithNWJhbAorYTViYTJuCithYmUyCithYjVlcmQKK2FiMmk1YQorYWI1aTJ0NWFiCithYmkydAorYWJpMXRhCithYjVsYXQKK2FiMmwyCithYjVvNWwxaXoKK2Fib2wyaQorNGFicgorYWI1cm9nCithYjN1bAorYTRjMmEycgorYTFjYQorYWM1YXJkCithYzVhcm8KK2E1Y2VvdTIKK2FjMWVyCithNWNoZTR0CithMmNoCithY2hlMgorNGEyY2kKK2EzYzJpZTQKK2EyYzFpbgorYTNjMmlvCithYzVyb2IKK2FjdDVpZjIKK2EyYzF0CithYzN1bAorYWM0dW0KK2EyZAorYWQ0ZDFpbgorYWQxZDQKK2FkNWVyLgorMmFkaQorYTNkNGkzYQorYWQzaTFjYQorYWRpNGVyCithZDJpZTQKK2EzZDJpbworYTNkaXQKK2E1ZGkxdQorYWQ0bGUKK2FkM293CithMWRvCithZDVyYTJuCithMWRyCithZDRzdQorYTJkMXMyCis0YTFkdQorYTNkdTJjCithZDV1bQorYWU0cgorYWVyMmk0ZTQKK2FlcjFpCithMmYKK2E0ZjFmNAorYTRnYWIKK2ExZ2EKK2FnYTRuCithZzVlbDFsCithMWdlNG8KKzRhZzRldQorYWcxaQorNGFnNGwyCithZzFuCithMmdvCiszYTNnNG80ZworYWczbzNuaQorYWdvMm4yCithNWd1ZXIKK2EyZ3VlCithZzV1bAorYTRneQorYTNoYQorYTNoZQorYTRoNGw0CithM2hvCithaTIKK2E1aTFhCithM2ljLgorYWk1bHkKK2E0aTRuCithaW41aW4KK2EyaW5pCithMmkxbjVvCithaXQ1ZW4KK2EyaXRlCithMWoKK2FrMWVuCithbDVhYgorYWwzYTJkCithNGwyYTJyCis0YWxkaTQKK2EybGQKKzJhbGUKK2FsM2VuZAorYTRsZW50MmkKK2ExbGVuMXQKK2E1bGU1bworYWwxaQorYWw0aWEuCithbDJpMWEKK2FsMmk0ZTQKK2FsNWxldgorYWwxbAorYWwybGUKKzRhbGxpYworYWxsMmkKKzRhMmxtCithNWxvZy4KK2E0bHkuCithMWx5Cis0YTJseXM0Cis1YTVseXMxdAorNWFseXQKKzNhbHl6Cis0YTFtYQorYTJtNWFiCithbTNhZworYW1hNXJhCithbTJhMnIKK2FtNWFzYworYTRtYTN0aXMKK2E0bTVhMXRvCithbTVlcjFhCithbTNpYworYW01aWYKK2FtNWkxbHkKK2FtMWluCithbTJpNG5vCithMm1vCithNW1vMm4KK2Ftb3I1aQorYW1vMnIKK2FtcDVlbgorYTRtMXAKK2EybgorYW4zYWdlCithMW5hCiszYW5hMWx5CithM24yYTJyCithbjNhcjNjCithbmFyNGkKK2EzbmF0aQorYW4yYXQKKzRhbmQKK2FuZGU0czIKK2FuMWRlCithbjNkaXMxCithbjFkbAorYW40ZG93CithbjFkbworYTVuZWUKK2EzbmVuCithbjVlMnN0LgorYTFuZXMKK2EybmVzdAorYTNuNGV1CisyYW5nCithbmc1aWU0CithbjFnbDIKK2E0bjFpYworYTNuaWVzCithbjJpZTQKK2FuM2kzZgorYW40aW1lCithbjFpbQorYTVuaW0xaQorYTVuMmluZQorYW4xaW4KK2FuM2k0bworYTNuMmlwCithbjNpczJoCithbjNpdAorYTNuaTF1CithbjRrbGkKK2E0bmsyCithbjFrMWwKKzVhbm5pegorYTRuMW4yCithbm80CithbjVvdAorYW40b3RoNQorYW4yc2EyCithMm4xczIKK2FuNHMxY28KK2FuczRjCithbjRzMW40CithbjJzcAorYW5zM3BvCithbjRzdAorYW40c3UycgorYW4xc3UKK2FudGEybDQKK2FuMXQKK2FuMXRhCithbjR0MmllNAorYW50MmkKKzRhbjF0bworYW4ydHIKK2FuNHR3NAorYW4zdTFhCithbjN1bAorYTVudXIKKzRhbworYXAyYTJyNAorYTFwYQorYXA1YXQKK2FwNWVyM28KK2EzcGg0ZXIKKzRhcGhpCithNHBpbGxhCithcGlsMWwKK2FwNWlsbDJhMnIKK2FwM2kybgorYXAzaTF0YQorYTNwaTJ0dQorYTJwMmwyCithcG80YzUKK2FwNW8xbGEKK2Fwb3I1aQorYTFwNG9yCithcG9zM3QKK2ExcG9zCithcHM1ZTRzCithMnAxczIKK2FwMnNlCithM3B1CithcXVlNQorYXF1MgorMmEycgorYXIzYTJjMXQKK2E1cmFkZQorYXJhMmQKK2FyNWFkaXMxCithcjJhZGkKK2FyM2FsCithNXJhbWUxdGUKK2FyYW0zZXQKK2FyMmFuNGcKK2FyYTJuCithcmEzcAorYXI0YXQKK2E1cmExdDJpbworYXI1YTF0Mml2CithNXJhdQorYXI1YXY0CithcmF3NAorYXJiYWw0CithcjFiCithcjRjaGEybgorYXIxYworYXIzY2hhCithcjJjaAorYXI1ZDJpbmUKK2FyZDJpCithcmQxaW40CithcjRkcgorYXI1ZWFzCithM3JlZQorYXIzZW4xdAorYTVyMmUyc3MKK2FyNGZpCithcjFmCithcjRmNGwyCithcjFpCithcjVpMmFsCithcjJpM2EKK2FyM2kyYTJuCithM3JpNWV0CithcjJpZTQKK2FyNGltCithcjVpbjJhdAorYXIyaTFuYQorYXIzaTFvCithcjJpegorYXIybWkKK2FyMW0KK2FyNW81ZAorYTVyb25pCithcm8ybgorYTNyb28yCithcjJwCithcjNxCithcnJlNAorYXIxcjQKK2FyNHNhMgorYTRyczIKK2FyMnMyaAorNGFzLgorYTJzNGFiCithc2EyCithczNhbjF0Cithc2EybgorYXNoaTQKK2FzMmgKK2E1c2lhLgorYXMyaTFhCithM3NpMWIKK2Ezc2ljCis1YTVzaTR0Cithc2szaQorYXNrMgorYXM0bDIKK2E0c29jCithMXNvCithczVwaAorYXM0czJoCithMnNzCithczN0ZW4KK2FzMXQ0cgorYXN1MXI1YQorYTFzdQorYXN1MnIKK2EydGEKK2F0M2FiMmwyCithMnRhYgorYXQ1YWMKK2F0M2FsbworYXRhMmwKK2F0NWFwCithdGU1YworYXQ1ZTJjaAorYXQzZTFnbworYXRlZzQKK2F0M2VuLgorYXQzZXIxYQorYXRlcjVuCithNXRlcjFuYQorYXQzZXN0CithdDVldgorNGF0aAorYXRoNWVtCithdGgyZQorYTV0aGUybgorYXQ0aG8KK2F0aDVvbQorNGF0aS4KK2E1dDJpMWEKK2EydDVpNWIKK2F0MWljCithdDNpZjIKK2F0aW9uNWEycgorYTF0MmlvCithdGlvMm4KK2F0aW8xbjFhCithdDNpMXR1CithNHRvZworYTF0bworYTJ0b20KK2F0NW9tMml6CithNHRvcAorYTR0b3MyCithMXRyCithdDVyb3AKK2F0NHNrMgorYTR0MXMyCithdDR0YWcKK2E0dDN0MgorYXQxdGEKK2F0NXRlCithdDR0aAorYTJ0dQorYXQ1dTFhCithNHQ1dWUKK2F0M3VsCithdDN1MXJhCithMnR5CithdTRiCithdWdoMworYXUzZ3UKK2F1NGwyCithdW41ZAorYXUzcgorYXU1c2kxYgorYTJ1cworYTR1dDVlbgorYXUxdGgKK2EydmEKK2F2M2FnNAorYTV2YTJuCithdjRlNG5vCithdjNlcjFhCithdjVlcm4KK2F2NWVyeQorYXYxaQorYXZpNGVyCithdjJpZTQKK2F2M2lnCithdjVvYworYTF2b3IKKzNhd2F5CithdzNpMgorYXc0bHkKK2F3czQKK2F4NGk1YworYXgzaQorYXg0aWQKK2F5NWFsCitheWU0CitheXM0Cithemk0ZXIKK2EyejFpCithejJpZTQKK2F6Mno1aQorYTR6MXoyCis1YmEuCitiYWQ1Z2VyCitiYTJkCitiYTRnZQorYmFsMWEKK2JhbjVkYWcKK2JhMm4KK2I0YW5kCitiYW4xZDJhCitiYW40ZQorYmFuM2kKK2JhcmJpNQorYjJhMnIKK2JhcjFiCitiYXIyaTRhCitiYXIxaQorYmFzNHNpCitiYTJzcworMWJhdAorYmE0egorMmIxYgorYjJiZQorYjNiZXIKK2JiaTRuYQorNGIxZAorNGJlLgorYmVhazQKK2JlYTJ0MworNGJlMmQKK2IyZTNkMmEKK2JlM2RlCitiNGUzZGkKK2JlM2dpCitiZTVndQorMWJlbAorYmUxbDJpCitiZTNsbworNGJlNW0KK2JlNW4yaWcKK2JlNW51Cis0YmVzNAorYmUzc3AKK2IyZTVzdDRyCiszYmV0CitiZTF0NWl6CitiZTV0cgorYmUzdHc0CitiZTN3CitiZTV5MW80CisyYmYKKzRiM2gKK2JpMmIKK2IyaTRkCiszYjJpZTQKK2JpNWVuCitiaTRlcgorMmIzaWYKKzFiaWwKK2JpM2wyaXoKK2JpbDFpCitiaW4yYTVyNAorYmkxbmEKK2I0aW40ZAorYmk1bmV0CitiMmluZQorYmkzbzJncgorYjJpbworYmk1b3UyCitiaTJ0CiszYjJpM3QyaW8KK2JpMXRpCitiaTN0cgorM2JpdDV1MWEKK2JpMXR1CitiNWk0dHoKK2IxagorYms0CitiMmwyCitibDRhdGg1CitiNGxlLgorYmxlbjQKKzVibGUxc3AKK2JsZXMyCitiM2xpcworYjRsbworYmx1bjR0Cis0YjFtCis0YjNuCitibmU1ZworM2JvZAorYm9kM2kKK2JvNGUKK2JvbDNpYworYm9sMmkKK2JvbTRiaQorYm80bTFiCitibzFuNGEKK2JvMm4KK2JvbjVhdAorM2JvbzIKKzVib3IuCis0YjFvMXJhCitib3I1ZAorNWJvcmUKKzVib3JpCis1Ym9zNAorYjVvMXRhCitiNG90aDUKK2JvNHRvCitib3VuMmQzCitib3UyCis0YnAKKzRicml0CiticjRvdGgzCisyYjVzMgorYnNvcjQKK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K2VsM29wLgorZWwyczJoCitlMmwxczIKK2VsNHRhCitlNGx0CitlNWx1ZAorZWw1dWcKK2U0bWFjCitlMW1hCitlNG1hZworZTVtYTJuCitlbTVhMW5hCitlNG01YgorZTFtZQorZTJtZWwKK2U0bWV0CitlbTNpMWNhCitlbTJpNGU0CitlbTVpZ3JhCitlbTJpZzQKK2VtaTFncgorZW0xaW4yCitlbTVpbmUKK2VtM2kzbmkKK2U0bTJpcworZW01aXMyaAorZTVtNGkyczFzCitlbTNpegorNWVtbml6CitlNG0xbgorZW1vNGcKK2UxbW8KK2VtbzNuMmk1bworZW1vMm4KK2VtM3BpCitlNG0xcAorZTRtdWwKK2UxbXUKK2VtNXUxbGEKK2VtdTNuMgorZTNteQorZW41YTJtbworZTFuYQorZTRuYW4xdAorZW4yYTJuCitlbmNoNGVyCitlbjJjaAorZW5jaGUyCitlbjNkaWMKK2U1bmVhCitlNW5lZQorZW4zZW0KK2VuNWVybworZW4xZXIKK2VuNWUxc2kKK2UxbmVzCitlMm41ZXN0CitlbjNldHIKK2UzbmU0dworZW41aTRjM3MyCitlNW4yaWU0CitlNW5pbAorZTNuMmk0bworZW4zaXMyaAorZW4zaXQKK2U1bmkxdQorNWVuaXoKKzRlNG4xbjIKKzRlbm8KK2U0bm80ZworZTRub3MKK2VuM292CitlbjRzdzIKK2UybjFzMgorZW50NWFnZQorZW4xdAorZW4xdGEKKzRlbnRoMWVzCitlbnRoMmUKK2VuM3UxYQorZW41dWYKK2UzbnkuCis0ZTRuM3oKK2U1b2YKK2VvMmcKK2U0b2k0CitlM29sCitlb3AzYTJyCitlbzJwYQorZTFvcgorZW8zcmUKK2VvNXJvbAorZW9zNAorZTRvdAorZW80dG8KK2U1b3V0Citlb3UyCitlNW93CitlMnBhCitlM3A0YWkyCitlcDVhbmMKK2VwYTJuCitlNXBlbAorZTNwZW4xdAorZXA1ZTV0MmkxdDJpbworZXBlMnQKK2VwZXRpMXRpCitlcGhlNAorZTRwbGkKK2UxcDJsMgor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raGU0dAoraGUydDRlZAoraDRldTQKK2gxZgoraDFoCitoaTVhMm4KK2gyaTFhCitoaTRjbworaGlnaDUKK2gyaWcKK2g0aWwyCitoaW1lcjQKK2g0aTFuYQoraGlvbjRlCitoMmlvCitoaW8ybgoraDJpNHAKK2hpcjRsCitoNGlyCitoaTNybworaGlyNHAKK2hpcjRyNAoraGlzM2VsCitoNGlzZQoraDRpMnM0cworaGl0aDVlcgoraDJpdGgKK2hpdGgyZQoraDJpMnYKKzRoaworNGgxbDQKK2hsYTJuNAoraDJsbworaGxvM3JpCis0aDFtCitobWV0NAorMmgxbgoraDVvZGl6CitoNW8yZDFzMgoraG80ZworaG8xZ2U0Citob2w1YTJyCitobzFsYQorM2hvbDRlCitobzRtYQoraG8ybWUzCitobzFuNGEKK2hvMm4KK2hvNW55CiszaG9vZAoraG9vMgoraG9vMm40Citob3I1YXQKK2hvMXJhCitobzVyMmlzCitob3J0M2UKK2hvNXJ1Citob3M0ZQoraG81c2VuCitob3MxcAorMWhvMnVzCitob3UyCitob3VzZTMKK2hvdjVlbAorNGg1cAorNGhyNAoraHJlZTUKK2hybzVuaXoKK2hybzJuCitocm8zcG8KKzRoMXMyCitoNHMyaAoraDR0MmEycgoraDF0YQoraHQxZW4KK2h0NWVzCitoNHR5CitodTRnCitodTRtaW4KK2h1MW1pCitodW41a2UKK2h1NG5rMgoraHVuNHQKK2h1czN0NAoraDJ1cworaHU0dAoraDF3CitoNHdhcjR0CitodzJhMnIKK2h5M3BlCitoeTNwaAoraHkycworMmkxYQoraTJhbAoraWFtNAoraWFtNWUxdGUKK2kyYTJuCis0aWFuYworaWFuM2kKKzRpYW40dAoraWE1cGUKK2lhMnNzNAoraTRhMXQyaXYKK2lhNHRyaWMKK2lhMXRyCitpNGEydHUKK2liZTQKK2liM2VyMWEKK2liNWVydAoraWI1aTFhCitpYjNpbgoraWI1aXQuCitpYmkydAoraWI1aXRlCitpMWIybDIKK2liM2xpCitpNWJvCitpMWJyCitpMmI1cmkKK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RpMnM0bQoraTJ0NW81bQoraTF0bworNGl0bzJuCitpNHRyYW0KK2kxdHJhCitpdDVyeQorNGk0dDN0MgoraXQzdTFhdAoraTF0dQoraXR1MWEKK2k1dHVkMgoraXQzdWwKKzRpdHouCitpNHR6CitpMXUKKzJpdgoraXYzZWwxbAoraXYzZW4uCitpNHYzZXIuCitpNHZlcnMuCitpdmU0cjFzMgoraXY1aWwuCitpMnZpbAoraXY1aW8KK2l2MWl0CitpNXZvcmUKK2l2M28zcm8KK2k0djNvdAorNGk1dworaXg0bworNGl5Cis0aXoyYTJyMgoraXphMQoraTJ6MWk0Cis1aXpvbjF0CitpMXpvCitpem8ybgorNWphCitqYWM0cQoramE0cAorMWplCitqZTRyNXMyCis0amVzNHQyaWU0CitqZXN0MmkKKzRqZXMydHkKK2pldzMKK2pvNHAKKzVqdWRnCisza2EuCitrM2FiCitrNWFnCitrYWlzNAora2FpMgora2FsNAorazFiCitrMmVkCisxa2VlCitrZTRnCitrZTVsMmkKK2szZW40ZAorazFlcgora2VzNAorazNlMnN0Lgora2U0dHkKK2szZgora2g0CitrMWkKKzVraS4KKzVrMmljCitrNGlsMWwKK2tpbG81CitrNGltCitrNGluLgora2luNGRlCitrNGluZAorazVpNW4yZTJzcworazJpbmUKK2tpMW5lcwora2luNGcKK2syaTRwCitraXM0CitrNWlzMmgKK2trNAorazFsCis0azNsZXkKKzRrMWx5CitrMW0KK2s1bmVzCisxazJubwora281cgora29zMmg0CitrM291Mgora3JvNW4KKzRrMXMyCitrNHNjCitrczRsMgorazRzNHkKK2s1dAorazF3CitsYWIzaWMKK2w0YWJvCitsNGEyY2k0CitsNGFkZQorbGEyZAorbGEzZDJ5CitsYWc0bgorbGEybTNvCiszbDRhbmQKK2xhMm4KK2xhbjRkbAorbGFuNWV0CitsYW40dGUKK2xhbjF0CitsYXI0ZzIKK2wyYTJyCitsYXIzaQorbGFzNGUKK2xhNXRhMm4KK2xhMnRhCis0bGF0ZWwyaTQKKzRsYTF0Mml2C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dW0zbjRpMWEKK2x1M28KK2x1bzNyCis0bHVwCitsdTJzczQKK2wydXMKK2x1czN0ZQorMWx1dAorbDV2ZW4KK2w1dmV0NAorMmwxdworMWx5Cis0bHlhCis0bHkxYgorbHk1bWU0CitseTNubworMmx5czQKK2w1eTNzMmUKKzFtYQorMm1hYgorbWEyY2EKK21hNWNoMmluZQorbWEyY2gKK21hNGNoMWluCittYTRjNGw0CittYWc1aW4KK21hZzFpCis1bWFnMW4KKzJtYWgKK21hMmlkNQorbWFpMgorNG1hMmxkCittYTNsMmlnCittYWwxaQorbWE1bGluCittYWw0bDJpCittYWwxbAorbWFsNHR5CittYTRsdAorNW1hM240aTFhCittYTJuCittYW41aXMKK21hbjNpegorNG1hcAorbWE1cmkybmUuCittMmEycgorbWFyMWkKK21hcjJpbjRlCittYTVyMml6CittYXI0bHkKK21hcjFsCittYXIzdgorbWE1c2NlCittYXM0ZQorbWFzMXQKKzVtYXRlCittNGF0aDMKK21hM3RpcworNG1hdGkzemExCittYTF0aXoKKzRtMWIKK20xYmE0dDUKK201YmlsCittNGIzaW5nCittYjJpNHYKKzRtNWMKKzRtZS4KKzJtZWQKKzRtZWQuCis1bWUzZDRpM2EKK200ZWRpCittZTNkMmllNAorbTVlNWQyeQorbWUyZworbWVsNW8ybgorbWU0bDR0CittZTJtCittZTFtMW8zCisxbWVuCittZTFuNGEKK21lbjVhYworbWVuNGRlCis0bWVuZQorbWVuNGkKK21lMm4xczQKK21lbjFzdTUKKzNtZW4xdAorbWVuNHRlCittZTVvMm4KK201ZXIxc2EyCittZTRyMXMyCisybWVzCiszbWVzdDJpCittZTR0YQorbWV0M2EybAorbWUxdGUKK21lNXRoaQorbTRldHIKKzVtZXQzcmljCittZTV0cjJpZTQKK21lM3RyeQorbWU0dgorNG0xZgorMm1oCis1bWkuCittMmkzYQorbWkxZDRhCittMmlkCittaWQ0ZworbTJpZzQKKzNtaWwzaTFhCittaWwxaQorbTVpNWwyaWU0CittNGlsMWwKK21pMW40YQorM200aW5kCittNWkzbmVlCittMmluZQorbTRpbmdsMgorbWluNWdsaQorbTVpbmcxbHkKK21pbjR0CittNGluMXUKK21pb3Q0CittMmlvCittMmlzCittaTRzNGVyLgorbTRpc2UKK21pczNlcgorbWlzNWwyCittaXM0dDJpCittNWk0c3RyeQorbWlzdDRyCis0bTJpdGgKK20yaXoKKzRtaworNG0xbAorbTFtCittbWE1cnkKK20xbWEKK21tMmEycgorNG0xbgorbTFuNGEKK200bjFpbgorbW40bworMW1vCis0bW9jcgorNW1vYzVyYTF0aXoKK21vMmQxCittbzRnbworbW9pczIKK21vaTIKK21vNGk1c2UKKzRtMm9rCittbzVsZXN0Cittb2xlczIKK21vM21lCittb241ZXQKK21vMm4KK21vbjVnZQorbW8zbjRpM2EKK21vbjRpMnMxbQorbW9uMWlzCittb240aXN0CittbzNuaXoKK21vbm9sNAorbW8zbnkuCittbzJyCis0bW81cmEuCittbzFyYQorbW9zMgorbW81c2V5CittbzNzcAorbTRvdGgzCittNW91ZgorbW91MgorM21vMnVzCittbzJ2Cis0bTFwCittcGFyYTUKK20xcGEKK21wMmEycgorbXBhNXJhYgorbXA0YTRyNWkKK20zcGUydAorbXBoYXM0CittMnBpCittcDJpNGEKK21wNWllcworbXAyaWU0CittNHAxaTJuCittNXA0aXIKK21wNWlzCittcG8zcmkKK20xcDRvcgorbXBvczVpdGUKK20xcG9zCittNHBvMnVzCittcG91MgorbXBvdjUKK21wNHRyCittMnAxdAorbTJweQorNG0zcgorNG0xczIKK200czJoCittNXNpCis0bXQKKzFtdQorbXVsMmE1cjQKK211MWxhCis1bXU0bHQKK211bDF0aTMKKzNtdW0KK211bjIKKzRtdXAKK211NHUKKzRtdworMW5hCisybjFhMmIKK240YWJ1Cis0bmFjLgorbmE0Y2EKK241YTJjMXQKK25hZzVlci4KK25hazQKK25hNGwxaQorbmE1bDJpMWEKKzRuYTRsdAorbmE1bWl0CituMmEybgorbmFuMWNpNAorbmFuNGl0CituYTRuazQKK25hcjNjCituMmEycgorNG5hcmUKK25hcjNpCituYXI0bAorbjVhcjFtCituNGFzCituYXM0YworbmFzNXQyaQorbjJhdAorbmEzdGEybAorbmEydGEKK25hdDVvNW0yaXoKK25hMnRvbQorbmExdG8KK24yYXUKK25hdTNzZQorbmEydXMKKzNuYXV0CituYXY0ZQorNG4xYjQKK25jMmEycjUKK24xY2EKK240Y2VzLgorbjNjaGEKK24yY2gKK241Y2hlbworbmNoZTIKK241Y2g0aWwyCituM2NoaXMKK24yYzFpbgorbjFjaQorbjJjNGl0CituY291MXI1YQorbjFjbworbmNvdTIKK24xY3IKK24xY3UKK240ZGFpMgorbjFkMmEKK241ZGEybgorbjFkZQorbmQ1ZTJzdC4KK25kZXMyCituZGk0YgorbjVkMmlmCituMWRpdAorbjNkaXoKK241ZHUyYworbjFkdQorbmR1NHIKK25kMndlCituZDF3CisybmUuCituM2UyYTJyCituMmUyYgorbmViM3UKK25lMmMKKzVuZWNrMQorMm5lZAorbmU0Z2F0CituZTFnYQorbmU0ZzVhMXQyaXYKKzVuZWdlCituZTRsYQorbmVsNWl6CituZWwyaQorbmU1bWkKK25lNG1vCisxbmVuCis0bmVuZQorM25lbworbmU0cG8KK25lMnEKK24xZXIKK25lMnJhNWIKK25lcjFhCituNGVyM2EycgorbjJlcmUKK240ZXI1aQorbmVyNHI0CisxbmVzCisybmVzLgorNG5lMXNwCisybmVzdAorNG5lczR3MgorM25ldDFpYworbmU0dgorbjVldmUKK25lNHcKK24zZgorbjRnYWIKK24xZ2EKK24zZ2VsCituZ2U0bjRlCituMWdlbgorbjVnZXJlCituM2dlcjFpCituZzVoYQorbjNnaWIKK25nMWluCituNWdpdAorbjRnbGE0CituZ2wyCituZ292NAorbjFnbworbmc1czJoCituZ3MyCituMWd1CituNGd1bQorbjJneQorNG4xaDQKK25oYTQKK25oYWIzCituaGU0CiszbjRpMWEKK25pM2Eybgorbmk0YXAKK25pM2JhCituaTRiMmwyCituMmk0ZAorbmk1ZGkKK25pNGVyCituMmllNAorbmkyZmkKK25pNWZpY2F0CituaWZpMWNhCituNWkxZ3IKK24yaWcKK240aWs0CituMWltCituaTNtMml6CituaW0xaQorbjFpbgorNW5pMm5lLgorbjJpbmUKK25pbjRnCituMmk0bworNW4yaXMuCituaXM0dGEKK24yaXQKK240aXRoCiszbjJpMXQyaW8KK25pMXRpCituM2l0b3IKK25pMXRvCituaTN0cgorbjFqCis0bmsyCituNWsyZXJvCituazFlcgorbjNrZXQKK25rM2luCituazFpCituMWsxbAorNG4xbAorbjVtCitubWU0CitubWV0NAorNG4xbjIKK25uZTQKK25uaTNhbAorbjNuNGkxYQorbm4yaTR2Citub2I0bDIKK25vM2JsZQorbjVvMWM0bDQKKzRuM28yZAorM25vZQorNG5vZworbm8xZ2U0Citub2lzNWkKK25vaTIKK25vNWw0aQorNW5vbDFvMWdpcworM25vbWljCituNW81bTJpegorbm80bW8KK25vM215CitubzRuCitub240YWcKK25vMW4xYQorbm9uNWkKK241b25pegorNG5vcAorNW5vcDVvNWwyaQorbm8ycjVhYgorbm8xcmEKK25vNHJhcnkKK25vcjJhMnIKKzRub3MyYworbm9zNGUKK25vczV0CitubzV0YQorMW5vdTIKKzNub3VuCitub3YzZWwzCitub3dsMworbjFwNAorbnBpNAorbnByZTRjCitucHIyCituMXEKK24xcgorbnJ1NAorMm4xczIKK24yczVhYgorbnNhMgorbnNhdGk0CituczRjCituMnNlCituNHMzZTRzCituczJpZDEKK25zMmlnNAorbjJzMWwyCituMnMzbQorbjRzb2MKK24xc28KK25zNHBlCituNXNwaQorbnN0YTViMmwyCituczF0YQorbnMydGFiCituMXQKK24ydGE0YgorbjF0YQorbnRlNHIzczIKK250MmkKK241dGkyYgorbnRpNGVyCitudDJpZTQKK250aTJmMgorbjN0MmluZQorbjJ0MWluCituNHQzaW5nCitudDJpNHAKK250cm9sNWwyaQorbnRyb2wxbAorbjR0NHMyCitudHUzbWUKK24xdHUKK24zdHVtCitudTFhCitudTRkCitudTVlbgorbnVmNGZlCitudTRmMWYKK24zdWk0bgorbjJ1aTIKKzNudTNpdAorbjR1bQorbnUxbWUKK241dTFtaQorM251NG4KK24zdW8KK251M3RyCituMXYyCituMXc0CitueW00CitueXA0Cis0bnoKK24zemExCis0b2EKK29hMmQzCitvNWE1bGVzMgorbzJhbGUKK29hcmQzCitvMmEycgorb2FzNGUKK29hc3Q1ZQorb2F0NWkKK29iM2EzYgorbzViMmEycgorbzFiZTRsCitvMWJpCitvMmJpbgorb2I1aW5nCitvM2JyCitvYjN1bAorbzFjZQorbzJjaDQKK28zY2hlNHQKK29jaGUyCitvY2lmMworbzFjaQorbzRjaWwKK280Y2xhbQorbzFjNGw0CitvNGNvZAorbzFjbworb2MzcmFjCitvYzVyYTF0aXoKK29jcmUzCis1b2NyaXQKK29jcmkyCitvY3RvMnI1YQorbzJjMXQKK29jMXRvCitvYzN1MWxhCitvNWN1cmUKK29kNWQxZWQKK29kMWQ0CitvZDNpYworbzFkMmkzbworbzJkbzQKK29kNG9yMworbzRkNXVjdC4KK28xZHUKK29kdTJjCitvZHUyYzF0CitvNGQ1dWM0dDFzMgorbzRlbAorbzVlbmcKK28zZXIKK29lNHRhCitvM2V2CitvMmZpCitvZjVpdGUKK29mNGk0dDR0MgorbzJnNWE1cgorbzFnYQorbzRnNWExdDJpdgorbzRnYTF0bworbzFnZQorbzVnZW5lCitvMWdlbgorbzVnZW8KK280Z2VyCitvM2cyaWU0CisxbzFnaXMKK29nM2l0CitvNGdsMgorbzVnMmx5Ciszb2duaXoKK29nMW5pCitvNGc0cm8KK28xZ3IKK29nMnU1aTIKKzFvMWd5CisybzJnNXkzbgorbzFoMgorb2hhYjUKK29pMgorb2ljM2VzCitvaTNkZXIKK28yaWQKK29pNGYxZjQKK28yaWc0CitvaTVsZXQKK28zaW5nCitvaW50NWVyCitvaW4xdAorbzVpMnMxbQorb2k1c28ybgorb2kyc28KK29pc3Q1ZW4KK29pczF0ZQorb2kzdGVyCitvMml0ZQorbzVqCisyb2sKK28za2VuCitvazVpZTQKK29rMWkKK28xbGEKK280bGEybgorb2xhMnNzNAorbzJsMmQKK29sMmQxZQorb2wzZXIKK28zbGVzMmMKK29sZXMyCitvM2xldAorb2w0ZmkKK28ybGYKK29sMmkKK28zbDJpMWEKK28zbGljZQorb2w1aWQuCitvbDJpZAorbzNsaTRmCitvNWw0aTRsCitvbDNpbmcKK281bDJpbworbzVsMmlzLgorb2wzaXMyaAorbzVsMml0ZQorb2wxaXQKK281bDJpMXQyaW8KK29saTF0aQorbzVsMml2CitvbGwyaTRlNAorb2wxbAorb2xsMmkKK29sNW8zZ2l6CitvbG80cgorb2w1cDJsMgorbzJscAorbzRsMnQKK29sM3ViCitvbDN1bWUKK29sM3VuCitvNWwydXMKK29sMnYKK28ybHkKK28ybTVhaAorbzFtYQorb21hNWwKK29tNWExdGl6CitvbTJiZQorbzRtMWIKK29tNGIybDIKK28ybWUKK29tM2UxbjRhCitvMW1lbgorb201ZXIyc2UKK29tZTRyMXMyCitvNG1ldAorb201ZTN0cnkKK29tNGV0cgorbzNtMmkzYQorb20zaWMuCitvbTNpMWNhCitvNW0yaWQKK29tMWluCitvNW0yaW5pCis1b21tZW5kCitvbTFtCitvbTFtZW4KK29tbzRnZQorbzFtbworbzRtbzJuCitvbTNwaQorbzRtMXAKK29tcHJvNQorb21wcjIKK28ybgorbzFuMWEKK29uNGFjCitvM24yYTJuCitvbjFjCiszb25jaWwKK29uMWNpCisyb25kCitvbjVkbworbzNuZW4KK28ybjVlc3QKK28xbmVzCitvbjRndQorb24xaWMKK28zbjJpNG8KK29uMWlzCitvNW5pMXUKK29uM2tleQorbzRuazIKK29uNG9kaQorbzRuM28yZAorb24zbzNteQorbzJuM3MyCitvbjVzcGk0CitvbnNwaTFyNWEKK29uc3A0aXIKK29uMXN1NAorb250ZW40CitvbjF0CitvbjN0NGkKK29udGkyZjUKK29uNXVtCitvbjF2YTUKK29uMXYyCitvbzIKK29vZDVlCitvb2Q1aQorbzJvNGsKK29vcDNpCitvM29yZAorb29zdDUKK28ycGEKK28ycDJlNWQKK29wMWVyCiszb3BlcjFhCis0b3A0ZXJhZworMm9waAorbzVwaGEybgorbzVwaDRlcgorb3AzaW5nCitvcGkybgorbzNwaXQKK281cG8ybgorbzRwb3NpCitvMXBvcworbzFwcjIKK29wMXUKK29weTUKK28xcQorbzFyYQorbzVyYS4KK280cjNhZworb3I1YWwxaXoKK29yYWwxaQorb3I1YW40Z2UKK29yYTJuCitvcjJhbmcKK29yZTVhCitvNXJlMWE0bAorb3IzZWkyCitvcjRlNXMyaAorb3I1ZTJzdC4KK29yZXMydAorb3JldzQKK29yNGd1CitvcmcyCis0bzVyMmkzYQorb3IzaTFjYQorbzVyaWwKK29yMWluCitvMXIyaTFvCitvcjNpMXR5CitvM3JpMXUKK29yMm1pCitvcjFtCitvcm4yZQorbzVyb2YKK29yM291Zworb3JvdTIKK29yNXBlCitvcjFwCiszb3JyaDQKK29yMXI0CitvcjRzZQorbzRyczIKK29yczVlbgorb3JzdDQKK29yM3RoaQorb3IzdGh5CitvcjR0eQorbzVydW0KK28xcnkKK29zM2FsCitvc2EyCitvczJjCitvczRjZQorbzNzY29wCitvczFjbworNG9zY29waQorbzVzY3IKK29zNGk0ZTQKK29zNWkxdDJpdgorb3NpMXRpCitvczNpMXRvCitvczNpMXR5CitvNXNpNHUKK29zNGwyCitvMnNvCitvMnM0cGEKK29zNHBvCitvczJ0YQorbzVzdGF0aQorb3M1dGlsCitvc3QyaQorb3M1dGl0CitvNHRhMm4KK28xdGEKK290ZWxlNGcKK290M2VyLgorb3Q1ZTRyMXMyCitvNHRlcworNG90aAorb3RoNWUxc2kKK290aDJlCitvdGgxZXMKK290aDNpNAorb3QzaWMuCitvdDVpMWNhCitvM3RpY2UKK28zdGlmMgorbzN0aXMKK290bzVzMgorbzF0bworb3UyCitvdTNiMmwyCitvdWNoNWkKK291MmNoCitvdTVldAorb3U0bAorb3VuYzVlcgorb3VuMmQKK291NXYyCitvdjRlbgorb3ZlcjRuZQorb3ZlNHIzczIKK292NGVyd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ob25pCitwaG80cgorNHA0aDFzMgorcGgzdAorNXBodQorMXBoeQorcDJpM2EKK3BpMmEybjQKK3BpNGMyaWU0CitwMmkxY2kKK3BpNGN5CitwNGlkCitwNWkxZDJhCitwaTNkZQorNXBpMmRpCiszcGllYworcDJpZTQKK3BpM2VuCitwaTRncmFwCitwMmlnCitwaTFncgorcGkzbG8KK3BpMm4KK3A0aW4uCitwNGluZDQKK3A0aTFubworM3AyaTFvCitwaW8ybjQKK3AzaXRoCitwaTV0aGEKK3BpMnR1CisycDNrMgorMXAybDIKKzNwbGEybgorcGxhczV0CitwbDJpM2EKK3BsaTVlcgorcGwyaWU0Cis0cGwyaWcKK3BsaTRuCitwbG9pNAorcGx1NG0KK3BsdTRtNGIKKzRwMW0KKzJwM24KK3BvNGMKKzVwb2QuCitwbzVlbQorcG8zZXQ1Cis1cG80ZworcG9pbjIKK3BvaTIKKzVwb2luMXQKK3BvbHk1dAorcG8ybHkKK3BvNG5pCitwbzJuCitwbzRwCisxcDRvcgorcG80cnkKKzFwb3MKK3BvMnMxcworcDRvdAorcG80dGEKKzVwb3VuCitwb3UyCis0cDFwCitwcGE1cmEKK3AxcGEKK3BwMmEycgorcDJwZQorcDRwMmVkCitwNXBlbAorcDNwZW4KK3AzcGVyCitwM3BlMnQKK3BwbzVzMml0ZQorcDFwb3MKK3ByMgorcHJheTRlNAorNXByZTFjMmkKK3ByZTVjbworcHJlM2UybQorcHJlNGY1YWMKK3ByZTFmCitwcmUxZmEKK3ByZTRsYQorcHIxZTNyNAorcDNyZTFzMmUKKzNwcjJlMnNzCitwcmU1dGVuCitwcmUzdjIKKzVwcjJpNGU0CitwcmluNHQzCitwcjJpNHMKK3ByaTJzM28KK3Azcm8xY2EKK3ByMm9jCitwcm9mNWl0Citwcm8yZmkKK3BybzNsCitwcm9zM2UKK3BybzF0CisycDFzMgorcDJzZQorcHM0aAorcDRzaTFiCisycDF0CitwMnQ1YTRiCitwMXRhCitwMnRlCitwMnRoCitwMXRpM20KK3B0dTRyCitwMXR1CitwNHR3NAorcHViMworcHVlNAorcHVmNAorcHU0bDNjMgorcHU0bQorcHUybgorcHVyNHI0Cis1cDJ1cworcHUydAorNXB1dGUKK3B1dDNlcgorcHUzdHIKK3B1dDR0MWVkCitwdTR0M3QyCitwdXQ0dDFpbgorcDN3CitxdTIKK3F1YTV2NAorMnF1ZS4KKzNxdWVyCiszcXVldAorMnJhYgorcmEzYmkKK3JhY2g0ZTIKK3JhMmNoCityNWExYzRsNAorcmFmNWZpCityYTJmCityYTRmMWY0CityYTJmNHQKK3IyYWkyCityYTRsbworcmFtM2V0CityMmFtaQorcmEzbmU1bworcmEybgorcmFuNGdlCityMmFuZworcjRhbmkKK3JhNW5vNAorcmFwM2VyCiszcmExcGh5CityYXI1YworcjJhMnIKK3JhcmU0CityYXI1ZTFmCis0cmFyaWwKK3JhcjFpCityMmFzCityYXRpbzJuNAorcmExdDJpbworcmF1NHQKK3JhNXZhaTIKK3JhMnZhCityYXYzZWwKK3JhNXoyaWU0CityYTJ6MWkKK3IxYgorcjRiYWIKK3I0YmFnCityYmkyCityMmIzaTRmCityMmJpbgorcjViMmluZQorcmI1aW5nLgorcmI0bworcjFjCityMmNlCityMWNlbjQKK3IzY2hhCityMmNoCityY2g0ZXIKK3JjaGUyCityNGNpNGIKK3IxY2kKK3IyYzRpdAorcmN1bTMKK3I0ZGFsCityMWQyYQorcmQyaQorcjFkNGk0YQorcmRpNGVyCityZDJpZTQKK3JkMWluNAorcmQzaW5nCisycmUuCityZTFhNGwKK3JlM2EybgorcmU1YXIxcjQKK3JlMmEycgorNXJlYTJ2CityZTRhdworcjVlYnJhdAorcjJlMWIKK3JlM2JyCityZWM1b2wxbAorcmUyY29sCityZTFjbworcmU0YzVvbXBlCityZWNvNG0xcAorcmU0Y3JlCityZTFjcgorMnIyZWQKK3JlMWRlCityZTNkaXMxCityNGVkaQorcmVkNWl0CityZTRmYWMKK3JlMWYKK3JlMWZhCityZTJmZQorcmU1ZmVyLgorcmVmZXIxCityZTNmaQorcmU0ZnkKK3JlZzNpcworcmU1aXQKK3JlaTIKK3JlMWwyaQorcmU1bHUKK3I0ZW40dGEKK3JlbjF0CityZW40dGUKK3JlMW8KK3JlNXBpMm4KK3JlNHBvc2kKK3JlMXBvCityZTFwb3MKK3JlMXB1CityMWVyNAorcjRlcjFpCityMmVybzQKK3I0ZTVydQorcjRlcy4KK3JlNHNwaQorcmUxc3AKK3JlczRzNWk0YgorcjJlMnNzCityZXMxc2kKK3JlczJ0CityZTVzMnRhMmwKK3JlczF0YQorcjJlM3N0NHIKK3JlNHRlcgorcmU0dGk0egorcmUzdHJpCityNGV1MgorcmU1dTF0MmkKK3JldjIKK3JlNHZhbAorcmUxdmEKK3JldjNlbAorcjVldjVlci4KK3JldjFlcgorcmU1dmU0cjFzMgorcmU1dmVydAorcmU1dmk0bAorcmUxdmkKK3JldjVvbHUKK3JlNHdoCityMWYKK3IzZnU0CityNGZ5CityZzIKK3JnM2VyCityM2dldAorcjNnMWljCityZ2k0bgorcmczaW5nCityNWdpcworcjVnaXQKK3IxZ2wyCityZ280bjIKK3IxZ28KK3IzZ3UKK3JoNAorNHJoLgorNHJoYWwKK3IyaTNhCityaWE0Ygorcmk0YWcKK3I0aWIKK3JpYjNhCityaWM1YXM1CityaTFjYQorcjRpY2UKKzRyMmkxY2kKKzVyaTVjMmlkCityaTRjMmllNAorcjRpMWNvCityaWQ1ZXIKK3IyaWQKK3JpM2VuYworcjJpZTQKK3JpM2VuMXQKK3JpMWVyCityaTVldAorcmlnNWEybgorcjJpZworcmkxZ2EKKzVyNGlnaQorcmlsM2l6CityaWwxaQorNXJpbWEybgorcmkxbWEKK3JpbTVpCiszcmkxbW8KK3JpbTRwZQorcmk0bTFwCityMmkxbmEKKzVyaW5hLgorcjRpbjRkCityMmluNGUKK3JpbjRnCityMmkxbworNXJpcGgKK3IyaXAKK3JpcGg1ZQorcmkycDJsMgorcmlwNWxpYworcjRpcQorcjJpcworcjRpcy4KK3IyaXM0YworcjNpczJoCityaXM0cAorcmkzdGEzYgorcmkxdGEKK3I1aXRlZC4KK3IyaXRlCityaTJ0MWVkCityaXQ1ZXIuCityaXQ1ZTRyMXMyCityNGkydDNpYworcmkxdGkKK3JpMnR1CityaXQ1dXIKK3JpdjVlbAorcjJpdgorcml2M2V0CityaXYzaQorcjNqCityM2tldAorcms0bGUKK3JrMWwKK3JrNGxpbgorcjFsCitybGU0CityMmxlZAorcjRsMmlnCityNGxpcworcmw1aXMyaAorcjNsbzQKK3IxbQorcm1hNWMKK3IxbWEKK3IybWUKK3IzbWVuCitybTVlNHIxczIKK3JtM2luZworcjRtaW5nLgorcjRtMmlvCityM21pdAorcjRteQorcjRuMmEycgorcjFuYQorcjNuZWwKK3I0bjFlcgorcjVuZXQKK3IzbmV5CityNW5pYworcjFuaXM0CityM24yaXQKK3IzbjJpdgorcm5vNAorcjRub3UyCityM251Cityb2IzbDIKK3Iyb2MKK3JvM2NyCitybzRlCitybzFmZQorcm81ZmlsCitybzJmaQorcjJvazIKK3JvNWsxZXIKKzVyb2xlLgorcm9tNWUxdGUKK3JvMm1lCitybzRtZXQKK3JvbTRpCitybzRtNHAKK3JvbjRhbAorcm8ybgorcm8xbjFhCityb240ZQorcm81bjRpcworcm9uNHRhCityb24xdAorMXJvb20KK3JvbzIKKzVyb290CitybzNwZWwKK3JvcDNpYworcm9yM2kKK3JvNXJvCitybzJzNXBlcgorcm8yczRzCitybzR0aDJlCityNG90aAorcm80dHkKK3JvNHZhCityb3Y1ZWwKK3JveDUKK3IxcAorcjRwZTRhCityNXBlbjF0CitycDVlci4KK3IzcGUydAorcnA0aDQKK3JwM2luZworcnBpMm4KK3IzcG8KK3IxcjQKK3JyZTRjCitycmU0ZgorcjRyZTFvCitycmU0czJ0CitycjJpNG8KK3JyMmk0dgorcnJvMm40Citycm9zNAorcnJ5czQKKzRyczIKK3Ixc2EyCityc2E1dGkKK3JzNGMKK3Iyc2UKK3Izc2VjCityc2U0Y3IKK3I0czVlci4KK3J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MmMzbworM3NlMmMxdAorNHM0ZWQKK3NlNGQ0ZQorczVlZGwKK3NlMmcKK3NlMWczcgorNXNlaTIKK3NlMWxlCis1c2UybDJmCis1c2VsdgorNHNlMW1lCitzZTRtb2wKK3NlMW1vCitzZW41YXQKK3NlMW5hCis0c2VuYworc2VuNGQKK3M1ZTJuZWQKK3NlbjVnCitzNWVuMWluCis0c2VuNHQxZAorc2VuMXQKKzRzZW4ydGwKK3NlMnAzYTMKKzRzMWVyLgorczRlcjFsCitzMmVyNG8KKzRzZXIzdm8KK3MxZTRzCitzNGU1czJoCitzZXM1dAorNXNlNXVtCitzNGV1Cis1c2V2CitzZXYzZW4KK3NldzRpMgorNXNleAorNHMzZgorMnMzZworczJoCisyc2guCitzaDFlcgorNXNoZXYKK3NoMWluCitzaDNpbworM3NoMmk0cAorc2gyaTJ2NQorc2hvNAorc2g1bzJsMmQKK3NobzJuMworc2hvcjQKK3Nob3J0NQorNHNoMXcKK3NpMWIKK3M1aWMzYworM3NpMmRlLgorczJpZAorNXNpZGU0czIKKzVzaTJkaQorc2k1ZGl6Cis0c2lnMW40YQorczJpZworc2lsNGUKKzRzaTFseQorMnMxaW4KK3MyaTFuYQorNXNpMm5lLgorczJpbmUKK3MzaW5nCisxczJpbworNXNpbzJuCitzaW8xbjVhCitzNGkycgorc2kxcjVhCisxc2lzCiszczJpMXQyaW8KK3NpMXRpCis1c2kxdQorMXMyaXYKKzVzaXoKK3NrMgorNHNrZQorczNrZXQKK3NrNWluZQorc2sxaQorc2s1aW40ZworczFsMgorczNsYXQKK3MybGUKK3NsMml0aDUKK3NsMWl0CisyczFtCitzM21hCitzbWFsMWwzCitzbWEybjMKK3NtZWw0CitzNW1lbgorNXM0bTJpdGgKK3NtbzJsNWQ0CitzMW1vCitzMW40Cisxc28KK3NvNGNlCitzbzJmdDMKK3NvNGxhYgorc28xbGEKK3NvMmwzZDIKK3NvM2xpYworc29sMmkKKzVzb2wydgorM3NvbQorM3M0b24uCitzbzJuCitzbz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1M2Y0bDIKK3VnaDNlMm4KK3VnNWluCisydWkyCit1aWw1aXoKK3VpbDFpCit1aTRuCit1MWluZwordWlyNG0KK3U0aXIKK3VpMXRhNAordTJpdjMKK3VpNHY0ZXIuCit1NWoKKzR1awordTFsYQordWxhNWIKK3U1bGF0aQordWwyY2g0Cit1NGwxYzIKKzV1bGNoZTIKK3VsM2RlcgordTJsZAordWwyZGUKK3VsNGUKK3UxbGVuCit1bDRnaQordTRsMWc0Cit1bDJpCit1NWwyaTFhCit1bDNpbmcKK3VsNWlzMmgKK3VsNGwyYTJyCit1bDFsCit1bDRsaTRiCit1bGwyaQordWw0bGlzCis0dTJsM20KK3UxbDRvCis0dTJsMXMyCit1bHM1ZTRzCit1bDJzZQordWwxdGkKK3U0bHQKK3VsMXRyYTMKK3VsMXRyCis0dWwxdHUyCit1M2x1Cit1bDV1bAordWw1dgordTJtNWFiCit1MW1hCit1bTRiaQordTRtMWIKK3VtNGIxbHkKK3VtYjJsMgordTFtaQordTRtM2luZwordW1vcjVvCit1MW1vCit1bW8ycgordTRtMnAKK3VuMmF0NAordTFuYQordTJuZQordW40ZXIKK3UxbmkKK3VuNGltCit1Mm4xaW4KK3VuNWlzMmgKK3VuMmkzdgordTJuM3M0Cit1bjRzdzIKK3VuMnQzYTRiCit1bjF0Cit1bjF0YQordW40dGVyLgordW40dGVzCit1bnU0Cit1bjV5Cit1NG41egordTRvNHJzMgordTVvcwordTFvdTIKK3UxcGUKK3VwZTRyNXMyCit1NXAyaTNhCit1cDNpbmcKK3VwaTJuCit1M3AybDIKK3U0cDNwCit1cHBvcnQ1Cit1cDFwNG9yCit1cDJ0NWkyYgordTJwMXQKK3VwMXR1NAordTFyYQorNHVyYS4KK3U0cmFnCit1NHIyYXMKK3VyNGJlCit1cjFiCit1cjFjNAordXIxZAordXJlNWEydAordXI0ZmVyMQordXIxZgordXI0ZnIKK3UzcmlmCit1cmk0ZmljCit1cmkxZmkKK3VyMWluCit1M3IyaTFvCit1MXJpdAordX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it4YWM1ZQoreDRhMmdvCit4YW0zCit4NGFwCit4YXM1Cit4M2MyCit4MWUKK3hlNGN1MXRvCit4ZTFjdQoreGUzYzR1dAoreDJlZAoreGVyNGkKK3gyZTVybworeDFoCit4aGkyCit4aDRpbDUKK3hodTQKK3gzaQoreDJpNWEKK3hpNWMKK3hpNWRpCit4MmlkCit4NGltZQoreGk1bTJpegoreGltMWkKK3gzbworeDRvYgoreDNwCit4cDRhbjRkCit4MXBhCit4cGEybgoreHBlYzF0bzUKK3hwZTJjCit4cGUyYzF0Cit4MnAyZTNkCit4MXQyCit4M3RpCit4MXUKK3h1M2EKK3h4NAoreTVhYworM3kyYTJyNAoreTVhdAoreTFiCit5MWMKK3kyY2UKK3ljNWVyCit5M2NoCit5Y2g0ZTIKK3ljb200Cit5MWNvCit5Y290NAoreTFkCit5NWVlCit5MWVyCit5NGVyMWYKK3llczQKK3llNHQKK3k1Z2kKKzR5M2gKK3kxaQoreTNsYQoreWxsYTViMmwyCit5bDFsCit5M2xvCit5NWx1Cit5bWJvbDUKK3k0bTFiCit5bWU0Cit5bTFwYTMKK3k0bTFwCit5bjNjNGhyNAoreW4yY2gKK3luNWQKK3luNWcKK3luNWljCis1eW54Cit5MW80Cit5bzVkCit5NG81ZworeW9tNAoreW81bmV0Cit5bzJuCit5NG8ybjNzMgoreTRvcworeTRwMmVkCit5cGVyNQoreXAzaQoreTNwbworeTRwbzRjCit5cDJ0YQoreTJwMXQKK3k1cHUKK3lyYTVtCit5cjVpM2EKK3kzcm8KK3lyNHI0Cit5czRjCit5M3MyZQoreXMzaTFjYQoreTFzM2lvCiszeTFzaXMKK3k0c28KK3kyc3M0Cit5czF0Cit5czN0YQoreXN1MnI0Cit5MXN1Cit5M3RoaW4KK3l0M2ljCit5MXcKK3phMQorejVhMmIKK3oyYTJyMgorNHpiCisyemUKK3plNG4KK3plNHAKK3oxZXIKK3oyZTNybworemV0NAorMnoxaQorejRpbAorejRpcworNXpsCis0em0KKzF6bworem80bQorem81b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5dzhlOGk4ZzhoOHQuCisuM2xpZ2gKKy5saWdodHc0CisubGlnaHR3ZWkyCisubDJpZ2h0d2UyaWcyCisubGk4bTlvOHU5czhpOG44ZThzLgorLmxpNG1vCisubGkzbW8ydXMKKy5saW1vdTIKKy5saW1vdTJzMWluCisubGltb3VzMmluZQorLmxpbW91c2kxbmVzCisubGk4bjhlOWI4YThjOGs4ZThyLgorLjFsNGluZQorLmxpbjJlMmIKKy5saW5lYmFjazEKKy5saW5lYmFjazFlcgorLmxpOG44ZTlzOHA4YThjOGk4bjhnLgorLmxpMW5lcworLmxpNG5lMXNwCisubGluZTJzMXBhCisubGluZXNwNGEyY2kKKy5saW5lc3BhMmMxaW4KKy5saW5lc3BhYzFpbmcKKy5saTlvOG45ZThzOHMuCisubGlvMm4KKy5saW8xbmVzCisubGlvbjJlMnNzCisubGk4dDhoOW85ZzhyOGE4cDhoOGU4ZC4KKy5sMml0aAorLmxpdGhvNGcKKy5saXRobzFncgorLmxpdGhvZ3JhcGg0ZWQKKy5saTh0OGg5bzlnOHI4YThwOGg4cy4KKy5saXRob2dyYTRwNGgxczIKKy5sbzliOG84dDlvOG04eS4KKy5sb2JvNHRvCisubG9ib3RvM215CisubG85YjhvOHQ5bzhtOWk4ejhlLgorLmxvYm90b20yaXoKKy5sb2JvdG9taTJ6ZQorLmxvOGc4ZThzLgorLmxvMWdlCisubG84bjhnOWU4czh0LgorLjVsb25nCisubG8ybgorLmxvOXE4dThhOGM5aTh0OHkuCisubG8xcQorLmxvcXUyCisubG9xdWFjNAorLmxvcXU0YTJjaQorLmxvcXVhMmMxaXQKKy5sb3F1YWNpMXR5CisubG84djhlOXM4dDhyOHU4YzhrLgorLjRsb3YKKy5sb3Y0ZTJzCisubG92MmVzdDRyCisubG92ZXN0cnVjNQorLmxvdmVzdHJ1Y2sxCisubWE4YzhyOG85ZThjOG85bjhvOG04aThjOHMuCisubWFjcm80ZQorLm1hY3JvZTFjbworLm1hY3JvZWNvMm4KKy5tYWNyb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oOW85ZzhlOG45aThjLgorLnA0YXRoCisucGF0NGhvCisucGF0aG80ZworLnBhdGhvMWdlNAorLnBhdGhvMWdlbgorLnBlOGU4djlpOHM4aC4KKy5wNGVlCisucGVlMXZpCisucGVldmlzMmgKKy5wZThlOHY5aThzOGg5bjhlOHM4cy4KKy5wZWV2aXMyaDFuCisucGVldmlzaDFuZXMKKy5wZWV2aXNobjJlMnNzCisucGU4bjl0OGE5ZzhvOG4uCisucGVuMXQKKy5wZW4xdGEKKy5wZW50YTJnbworLnBlbnRhZ28ybjIKKy5wZThuOXQ4YTlnOG84bjhzLgorLnBlbnRhZ28ybjNzMgorLnBlOXQ4cjhvOWw4ZTl1OG0uCisucGV0cm9sNGV1CisucGg4ZTluOG84bTllOW44bzhuLgorLnBoNGUzbm8KKy5waGUybgorLnBoZW5vMm1lCisucGhlbm8xbWVuCisucGhlbm9tNGVubworLnBoZW5vbWVubzRuCisucGg4ZThuOHk4bDlhOGw4YTluOGk4bjhlLgorLnBoZW55M2xhCisucGhlbnlsYWxhMm4KKy5waGVueWxhbGE1bjJpbmUKKy5waGVueWxhbGFuMWluCisucGg4aTlsOGE4dDllOWw4aThzOHQuCisucGhpNGxhdGVsMmk0CisucGhpbGF0ZTJsaXMKKy5waDhpOWw4YTh0OWU5bDhpOHM4dDhzLgorLnBoaWxhdGVsaXM0dDFzMgorLnBoOG85bjhlOG04ZS4KKy4zcGhvbmUKKy5waG8ybgorLnBob25lMW1lCisucGg4bzluOGU4bThlOHMuCisucGhvbmUybWVzCisucGg4bzluOGU5bThpOGMuCisucGhvbmU1bWkKKy5waDhvOHM5cDhoOG84cjlpOGMuCisucGhvczFwCisucGhvc3BobzUKKy5waG9zcGhvNHIKKy5waDhvOXQ4bzlnOHI4YThwOGg4cy4KKy5waG8xdG8KKy5waG90bzJncgorLnBob3RvZ3JhNHA0aDFzMgorLnBoOG85dDhvOW84ZjhmOXM4ZTh0LgorLnBob3RvbzIKKy5waG90b280ZjFmCisucGhvdG9vZjJ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uOWk5ejhhOXQ4aThvOG4uCisucG9seTFnbworLnBvbHlnbzJuMgorLnBvbHlnbzNuaQorLnBvbHlnb25pemExCisucG9seWdvbml6YTF0MmlvCisucG9seWdvbml6YXRpbzJuCisucG85bDh5OHA4aDlvOW44bzh1OHMuCisucG9seXBobzJuCisucG9seXBobzFub3UyCisucG9seXBob25vMnVzCisucG84bDh5OXM4dDh5OHI4ZThuOGUuCisucG8ybHlzNAorLnBvbHlzMXQKKy5wb2x5czJ0eQorLnBvOG04ZTlnOHI4YThuOWE4dDhlLgorLnBvMm1lCisucG9tZTJnCisucG9tZTFncgorLnBvbWVncmEybjIKKy5wb21lZ3JhMW5hCisucG9tZWdyYW4yYXQKKy5wbzhyOG85ZThsOGE4czl0OGk4Yy4KKy4xcDRvcgorLnBvcm80ZQorLnBvcm80ZWwKKy5wb3JvZTFsYQorLnBvcm9lbGFzdDJpCisucG9yb2VsYXMxdGljCisucG84cjlvOHU4cy4KKy5wb3JvdTIKKy5wb3JvMnVzCisucG84cjl0OGE5YjhsOGUuCisucG9yMXRhCisucG9yMnRhYgorLnBvcnRhYjJsMgorLnBvOHM4dDlhOG05YjhsOGUuCisuMXBvcworLnBvczJ0YQorLnBvc3RhNG0xYgorLnBvc3RhbWIybDIKKy5wbzhzOHQ5YThtOWI4bDhlOHMuCisucG9zdGFtYmxlczIKKy5wbzhzOHQ5aDh1OW04bzh1OHMuCisucG9zdGh1MW1vCisucG9zdGh1M21vMnVzCisucG9zdGh1bW91MgorLnBvOHM4dDlzOGM4cjhpOHA4dC4KKy5wb3M0dDFzMgorLnBvc3Q0c2MKKy5wb3N0c2NyaTIKKy5wb3N0c2NyMmlwCisucG9zdHNjcmkycDF0CisucG84czh0OXM4YzhyOGk4cDh0OHMuCisucG9zdHNjcmlwNHQxczIKKy5wbzhzOXQ4dThyOWE4bC4KKy5wb3MxdHUKKy5wb3N0dTFyYQorLnByOGU5YThtOWI4bDhlLgorLnByZWE0bTFiCisucHJlYW1iMmwyCisucHI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5wcm9jZWR1MXJhCisucHI4bzhjOGU4czhzLgorLnByb2MyZTJzcworLnByOG85Yzh1OHI5YThuOGM4ZS4KKy5wcm9jdTFyYQorLnByb2N1cmEybgorLnByOG84ZzllOW44aThlOHMuCisucHJvMWdlCisucHJvMWdlbgorLnByb2dlNW4yaWU0CisucHI4bzhnOWU5bjh5LgorLnBybzRnZW55CisucHI4bzlnOHI4YThtOW04YThiOGw4ZS4KKy5wcm8xZ3IKKy5wcm9ncmFtMW0KKy5wcm9ncmFtMW1hCisucHJvZ3JhbTJtYWIKKy5wcm9ncmFtbWFiMmwyCisucHI4bzhtOWk5bjhlOG44dC4KKy5wcm9tNGkKKy5wcm9tMWluCisucHJvbTJpbmUKKy5wcm9taTFuZW4KKy5wcm9taW5lbjF0CisucHI4bzltOGk4czljOHU5bzh1OHMuCisucHJvbTJpcworLnByb20yaXMxYworLnByb21pczFjdQorLnByb21pc2N1MW91MgorLnByb21pc2N1bzJ1cworLnByOG84bTlpOHM5czhvOHI4eS4KKy5wcm9tNGkyczFzCisucHJvbWlzMXNvCisucHJvbWlzc28xcnkKKy5wcjhvOG05aThzOGUuCisucHJvbTRpc2UKKy5wcjhvOG05aThzOGU4cy4KKy5wcm9taXMxZTRzCisucHI4bzlwOGU4bDlsOGU4ci4KKy5wcm8zcGVsCisucHJvcGVsMWwKKy5wcm9wZWwybGUKKy5wcjhvOXA4ZThsOWw4ZThyOHMuCisucHJvcGVsbGU0cjFzMgorLnByOG85cDhlOGw5bDhpOG44Zy4KKy5wcm9wZWxsMmkKKy5wcm9wZWwybGluNAorLnByOG85aDhpOGI5aTl0OGk4djhlLgorLnBybzFoMgorLnByb2hpYmkydAorLnByb2hpYmkxdGkKKy5wcm9oaWJpMXQyaXYKKy5wcjhvOWg4aThiOWk5dDhpOHY4ZTlsOHkuCisucHJvaGliaXRpdjRlMWx5CisucHI4bzlzOGM4aTh1OHQ5dDhvLgorLnByb3MyYworLnByb3MxY2kKKy5wcm9zY2kxdQorLnByb3N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ZThnOXI4YTlwOGg4ZThyOHMuCisudGVsZWdyYXBoZTRyMXMyCisudGU4bDhlOWs4aTluOGU4dDlpOGMuCisudGVsZWtpNG4KKy50ZWxlazFpCisudGVsZWsyaW5lCisudGVsZWtpM25ldDFpYworLnRlOGw4ZTlrOGk5bjhlOHQ5aThjOHMuCisudGVsZWtpbmV0aTRjM3MyCisudGU4bDhlOXI4bzliOG84dDlpOGM4cy4KKy50ZTRsMWVyCisudGVsNGVybworLnRlbGVyNW9iCisudGVsZXJvYm90aTRjM3MyCisudGU4bDhsOWU4ci4KKy50ZWwxbAorLnRlbDJsZQorLnRlOGw4bDllOHI4cy4KKy50ZWxsZTRyMXMyCisudGU4bTlwOG85cjhhOHI5aThsOHkuCisudGU0bTFwCisudGVtMXA0b3IKKy50ZW1wbzFyYQorLnRlbXBvNHJhcmlsCisudGVtcG9yMmEycgorLnRlbXBvcmFyMWkKKy50ZW1wb3JhcmkxbHkKKy50ZThuOXU4cjhlLgorLnRlOHM4dDliOGU4ZC4KKy50ZXMydDFiCisudGVzdDRiZTJkCisudGU4eDh0OXc4aThkOHQ4aC4KKy4zdGV4CisudGV4MXQyCisudGV4dHc0CisudGV4dHdpMgorLnRleHR3MmlkCisudGV4dHdpZDJ0aAorLnRoOGE4bDlhOW04dThzLgorLnRoYTNsYQorLnRoYWxhM20KKy50aGFsYTFtdQorLnRoYWxhbTJ1cworLnRoOGU4cjltOG85ZThsOGE4czl0OGk4Yy4KKy50aDJlCisudGhlcjNtNAorLnRoZXIxbW8KKy50aGVybW80ZWwKKy50aGVybW9lMWxhCisudGhlcm1vZWxhc3QyaQorLnRoZXJtb2VsYXMxdGljCisudGk4bThlOXM4dDhhOG04cC4KKy50aTJtZXMKKy50aW1lczF0YQorLnRpbWVzdGE0bTFwCisudGk4bThlOXM4dDhhOG04cDhzLgorLnRpbWVzdGFtMnAxczIKKy50bzhvOGw5azhpOHQuCisudG9vMgorLnRvb2xrMWkKKy50bzhvOGw5azhpOHQ4cy4KKy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WxhbTJpbmUKKy50cjhlOGE4YzhoOWU4cjhpOGU4cy4KKy50cmVhMmNoCisudHJlYWNoZTIKKy50cmVhY2hlcjFpCisudHJlYWNoZXIyaWU0CisudHI4bzh1OWI4YTlkOG84dThyLgorLnRyb3UyCisudHJvdWJhMmQKKy50cm91YmExZG8KKy50cm91YmFkb3UyCisudHU4cjlrOGU4eS4KKy4xdHUKKy50dThyOWs4ZTh5OHMuCisudHVya2V5czQKKy50dThyOG45YThyOG84dThuOGQuCisudHVyNG4yYTJyCisudHVyMW5hCisudHVybmFyb3UyCisudHVybmFyb3VuMmQKKy50dThyOG45YThyOG84dThuOGQ4cy4KKy50dXJuYXJvdW4yZDFzMgorLnR5OHA5YThsLgorLjF0eQorLnR5MXBhCisudHlwNGFsCisudW45YTh0OXQ4YThjOGg4ZThkLgorLnVuMmF0NAorLnVuYTR0M3QyCisudW5hdDF0YQorLnVuYXR0YTJjaAorLnVuYXR0YWNoZTIKKy51bmF0dGE0Y2g0ZWQKKy51bjllOHI4cjlpOG44ZzlsOHkuCisudW40ZXIKKy51bmVyNHI0CisudW5lcnJpbjRnCisudW5lcnJpbmdsMgorLnVuZXJyaW5nMWx5CisudW45ZjhyOGk4ZThuOGQ5bDh5LgorLnVuM2YKKy51bmZyaTIKKy51bmZyMmllNAorLnVuZnJpZW4yZDFseQorLnVuOWY4cjhpOGU4bjhkOWw4aTllOHIuCisudW5mcmllbmRsMmllNAorLnZhOGc4dThlOHIuCisuMXZhCisudmFnNAorLnZhNWd1ZXIKKy52YTJndWUKKy52YTh1OGQ4ZTl2OGk4bDhsOGUuCisudmF1ZGUxdjQKKy52YXVkZTJ2M2k0bAorLnZhdWRlMXZpCisudmF1ZGV2aWwxbAorLnZhdWRldmlsMmxlCisudmk4YzlhOHI4cy4KKy52NGljMmEycgorLnZpMWNhCisudmljYTRyczIKKy52aThsOWw4YThpOG45ZThzOHMuCisuMnZpbAorLnZpbDFsCisudmlsbGFpMgorLnZpbGxhNGk0bgorLnZpbGxhMmluZQorLnZpbGxhaTVuMmUyc3MKKy52aWxsYWkxbmVzCisudmk4czl1OGE4bC4KKy52aTNzdQorLnZpc3UxYWwKKy52aThzOXU4YThsOWw4eS4KKy52aXN1YWwxbAorLnZpc3VhbDFseQorLnZpOXY4aThwOWE5cjhvOHU4cy4KKy4zdjJpdgorLnZpdjJpNHAKKy52aXZpMXBhCisudml2aXAyYTJyCisudml2aXBhcm91MgorLnZpdmlwYXJvMnVzCisudm84aThjOGU5cDhyOGk4bjh0LgorLnZvaTQKKy52b2kzY2VwCisudm9pY2VwcjIKKy52b2ljZXByaW40dDMKKy52czhwOGE4YzhlLgorLnYyczFwYQorLnZzcGE0Y2UKKy53YThkOWQ4aThuOGcuCisud2EyZAorLndhZDRkMWluCisud2FkMWQ0Cisud2E4bDhsOWY4bDhvOHc4ZThyLgorLndhbDFsCisud2FsMmxmCisud2FsbGY0bDIKKy53YWxsZmxvdzFlcgorLndhOGw4bDlmOGw4bzh3OWU4cjhzLgorLndhbGxmbG93ZTRyMXMyCisud2E4cjhtOWU4czh0LgorLncyYTJyCisud2FyMW0KKy53YXIybWUKKy53YXIybWVzCisud2E4czh0OGU5dzhhOHQ4ZThyLgorLndhczR0Cisud2FzdGUydworLndhc3RlMXc1YQorLndhc3Rld2ExdGUKKy53YTh2OGU5Zzh1OGk4ZDhlLgorLndhdmVnMworLndhdmVnMnVpMgorLndhdmVndTJpZAorLndhOHY4ZTlnOHU4aThkOGU4cy4KKy53YXZlZ3VpZGU0czIKKy53YTh2OGU5bDhlOHQuCisud2E4djhlOWw4ZTh0OHMuCisud2F2ZWxlNHQxczIKKy53ZThiOWw4aThrOGUuCisudzJlMWIKKy53ZWIybDIKKy53ZWIzbDRpaworLndlOGU4azluOGk4ZzhoOHQuCisud2Vla24yaWcKKy53ZThlOGs5bjhpOGc4aDh0OHMuCisud2Vla25pZ2g0dDFzMgorLndoOGU4ZThsOWM4aDhhOGk4ci4KKy53aGVlNGwxYzIKKy53aGVlbDJjaAorLndoZWVsY2hhaTIKKy53aGVlbGNoYTRpcgorLndoOGU4ZThsOWM4aDhhOGk4cjhzLgorLndoZWVsY2hhaTRyczIKKy53aDhpOGM4aDllOHY4ZThyLgorLndoaTQKKy53aDRpMmNoCisud2hpY2hlMgorLndoaWNoZXYxZXIKKy53aDhpOHQ4ZTlzOGk4ZDhlOGQuCisud2gyaXRlCisud2hpdDRlcworLndoaXRlMXNpCisud2hpdGUyczJpZAorLndoaXRlc2kyZDFlZAorLndoOGk4dDhlOXM4cDhhOGM4ZS4KKy53aGl0ZTFzcAorLndoaXRlMnMxcGEKKy53aGl0ZXNwYTRjZQorLndoOGk4dDhlOXM4cDhhOGM4ZThzLgorLndpOGQ4ZTlzOHA4cjhlOGE4ZC4KKy53MmlkCisud2lkZTRzMgorLndpZGUxc3AKKy53aWRlczRwcmUKKy53aWRlc3ByMgorLndpZGVzcHJlYTJkMQorLndpOG44ZzlzOHA4YThuLgorLndpbjRnCisud2luZ3MyCisud2luZzJzMXBhCisud2luZ3NwYTRuCisud2k4bjhnOXM4cDhhOG44cy4KKy53aW5nc3BhMm4xczIKKy53aThuOGc5czhwOHI4ZThhOGQuCisud2luZ3NwcjIKKy53aW5nc3ByZWEyZDEKKy53aTh0OGM4aDljOHI4YThmOHQuCisud2k0dGMKKy53aXQ0Y2gKKy53aXRjaGNyYTJmNHQKKy53aXRjaGNyYTJmCisud284cjhkOXM4cDhhOGM5aThuOGcuCisuMXdvMgorLndvcjJkMXMyCisud29yZHM0cAorLndvcmQyczFwYQorLndvcmRzcDRhMmNpCisud29yZHNwYTJjMWluCisud29yZHNwYWMxaW5nCisud284cjhrOWE4cjhvOHU4bjhkLgorLndvcmsyYTJyCisud29ya2Fyb3UyCisud29ya2Fyb3VuMmQKKy53bzhyOGs5YThyOG84dThuOGQ4cy4KKy53b3JrYXJvdW4yZDFzMgorLndvOHI4azloOG84cjhzOGUuCisud29ya2g0Cisud29ya2hvcjRzZQorLndvcmtobzRyczIKKy53bzhyOGs5a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mhlOHI5bThpOHQ5aThhOG4uCisuaGVyM21pdAorLmhlcm1pMXRpCisuaGVybTRpMXQyaTFhCisuaGVybWl0aTJhMm4KKy5oaThiOGI4cy4KKy5oaTJiMWIKKy5oaWIyYjVzMgorLmhvOGs5azhhOGk5ZDhvLgorLmgyb2sKKy5ob2trNAorLmhva2thaTIKKy5ob2trYTJpZAorLmhva2thaTFkbworLmphOGM5azhvOHc5czhrOGkuCisuNWphCisuamFjazEKKy5qYWNrb3dzazIKKy5qYWNrb3dzazFpCisuamE4bjl1OWE4cjh5LgorLmphMm4KKy5qYW4zdTFhCisuamFudTJhMnIKKy5qYTlwOGE5bjhlOHM4ZS4KKy5qYTRwCisuamExcGEKKy5qYXBhMm4KKy5qYXBhMW5lcworLmphcGFuZTFzMmUKKy5rYThkOW84bTl0OHM4ZTh2LgorLmthMmQKKy5rYTFkbworLmthZG80bXQKKy5rYWRvbTR0MXMyCisua2Fkb210NXNldgorLmthOG45czhhOHMuCisua2EybgorLmthbjJzYTIKKy5rYTJuMXMyCisua2E4cjhsOHM5cjh1OGg4ZS4KKy5rMmEycgorLmthcjFsCisua2FyMmwxczIKKy5rYXJsczFyCisua284cjl0OGU5dzhlOGcuCisua281cgorLmtyOGk4czhoOG44YS4KKy5rcjJpcworLmtyM2lzMmgKKy5rcmlzMmgxbgorLmtyaXNoMW5hCisua3I4aThzOGg5bjhhOWk4czhtLgorLmtyaXNobmFpMgorLmtyaXNobmFpMnMxbQorLmtyOGk4czhoOW44YThuLgorLmtyaXNobjJhMm4KKy5sYThuOWM4YThzOXQ4ZThyLgorLmxhbjFjYQorLmxhbmNhc3Q1ZXIKKy5sZTlnOGU4bjhkOHI4ZS4KKy5sZTFnZW4KKy5sZWdlbjFkcgorLmxlZ2VuZHJlNAorLmxlOGk4YzhlOHM5dDhlOHIuCisubGVpMgorLmxlNWljCisubGVpY2VzNXQKKy5saThwOXM4YzhoOGk4dDh6LgorLmwyaXAKKy5saTJwMXMyCisubGlwczJjaDIKKy5saXBzM2NoaXQKKy5saXBzY2hpNHR6CisubGk4cDlzOGM4aDhpOHQ4ejlpOGE4bi4KKy5saXBzY2hpdDJ6MWkKKy5saXBzY2hpdHoyaTFhCisubGlwc2NoaXR6aTJhMm4KKy5sbzhqOWI4YThuLgorLmxvNWoKKy5sb2piYTJuCisubG84dTlpOXM4aTlhOG44YS4KKy5sb3UyCisubG8ydWkyCisubG91aXMyaTFhCisubG91aXNpMmEybgorLmxvdWlzaWExbmEKKy5tYThjOW84cy4KKy5tYTFjbworLm1hOG45YzhoOGU4czl0OGU4ci4KKy5tYW4yY2gKKy5tYW5jaGUyCisubWFuY2gxZXMKKy5tYThyOWs4bzh2OWk4YThuLgorLm1hcmtvNXZpMmEybgorLm1hcmtvdjJpMWEKKy5tYThyOGs4dDlvOGI4ZThyOWQ4bzhyOGYuCisubWFyazV0CisubWFyazF0bworLm1hcmt0bzNiCisubWFya3RvYmVyMWRvCisubWFya3RvYmVyZDRvcgorLm1hcmt0b2JlcmRvcjFmCisubWE4czhzOWE5YzhoOHU5czhlOHQ4dDhzLgorLm1hMnNzCisubWFzMXNhMgorLm1hc3NhMmNoCisubWFzc2FjaDJ1cworLm1hc3NhY2h1c2U0dDN0MgorLm1hc3NhY2h1c2V0NHQxczIKKy5tYTh4OXc4ZThsOGwuCisubWF4d2VsNGwKKy5taTljOHI4bzlzOG84Zjh0LgorLm1pY3JvMnNvCisubWljcm9zbzJmdDMKKy5taThuOW44ZTlhOHA5bzlsOGk4cy4KKy5tMmk0bjFuMgorLm1pbm5lNAorLm1pbm5lYXBvbDJpCisubWk4bjluOGU5czhvOHQ4YS4KKy5taW4xbmVzCisubWlubmUxc28KKy5taW5uZXNvMXRhCisubW84czljOG84dy4KKy5tb3MyYworLm1vczFjbworLm5hOGM4aDlyOGk4YzhoOHQ4ZThuLgorLjFuYQorLm5hMmNoCisubmFjNGhyNAorLm5hMmNocjRpMmNoCisubmFjaHJpY2h0MWVuCisubmE4czhoOXY4aThsOGw4ZS4K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4ZS4KKy50eTNwbworLnR5NXBvNGcKKy50eXBvMWdyCisudHlwb2dyNGFwaGkKKy50eXBvZ3JhcGhpcXUyCisudWs4cjhhOGk4bjlpOGE4bi4KKy40dWsKKy51a3IyYWkyCisudWtyYTRpNG4KKy51a3JhMmluaQorLnVrcmFpNG40aTFhCisudWtyYWluaTNhMm4KKy52ZThyOWE4bDhsOWc4ZTltOGU4aThuOWU4cjh0OGUuCisudmVyYWwxbAorLnZlcmFsNGwxZzQKKy52ZXJhbGxnZTFtZQorLnZlcmFsbGdlbWVpMgorLnZlcmFsbGdlbWUyaW5lCisudmVyYWxsZ2VtZWluMWVyCisudmU4cjllOGk4bjlpOWc4dThuOGcuCisudmVyZTNpbgorLnZlcmVpMgorLnZlcmUyaW5pCisudmVyZWluMmlnCisudmVyZWluaTNndW4KKy52ZThyOXQ4ZThpOWw4dThuOWc4ZThuLgorLnZlcnRlaTIKKy52ZXJ0ZWlsdW4xZ2VuCisudmk4aThpOHQ4aC4KKy52NGk1aTQKKy52aTRpNWk0CisudmlpMml0aAorLnZpOGk4dDhoLgorLnZpMml0aAorLndhOGg4cjlzOGM4aDhlOGk4bjlsOGk4YzhoOWs4ZThpOHQ4czl0OGg4ZThvOXI4aThlLgorLndhNGhyNAorLndhaDRyczIKKy53YWhyczRjCisud2FocnMyY2gyCisud2FocnNjaGUyCisud2FocnNjaGVpMgorLndhaHJzY2hlNGk0bjFsCisud2FocnMyY2hlaW5sNGkyY2gKKy53YWhyc2NoZWlubGljNGhrCisud2FocnNjaGVpbmxpY2hrZWkyCisud2FocnNjaGVpbmxpY2hrZWk0dDFzMgorLndhaHJzY2hlaW5saWNoa2VpdHMzdGgyZQorLndhaHJzY2hlaW5saWNoa2VpdHN0aGUxbzVyCisud2FocnNjaGVpbmxpY2hrZWl0c3RoZW9yMmllNAorLndlOHI5bjhlOHIuCisudzFlcgorLndlcjRuMWVyCisud2U4cjl0OGg4ZThyOWk4YThuLgorLndlcnRoMmUKKy53ZXJ0aGV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IKKyAgICAgICAgYW5kcm9pZDpsYXlvdXRfYWJvdmU9IkAraWQvZW1lcmdlbmN5Q2FsbCI+CisgICAgICAgIDxSZWxhdGl2ZUxheW91dCAKKyAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X3dpZHRoPSJtYXRjaF9wYXJlbnQiCisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9oZWlnaHQ9Im1hdGNoX3BhcmVudCIKKyAgICAgICAgICAgICAgICA+CisgICAgICAgIAorICAgICAgICAgICAgPFRleHRWaWV3IAorICAgICAgICAgICAgICAgIGFuZHJvaWQ6aWQ9IkAraWQvdG9wSGVhZGVyIgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X3dpZHRoPSJtYXRjaF9wYXJlbnQiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfaGVpZ2h0PSI2NGRpcCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9hbGlnblBhcmVudFRvcD0idHJ1ZSIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9tYXJnaW5MZWZ0PSI0ZGlwIgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6dGV4dEFwcGVhcmFuY2U9Ij9hbmRyb2lkOmF0dHIvdGV4dEFwcGVhcmFuY2VNZWRpdW0iCisgICAgICAgICAgICAgICAgYW5kcm9pZDpncmF2aXR5PSJjZW50ZXJfdmVydGljYWwiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpkcmF3YWJsZUxlZnQ9IkBkcmF3YWJsZS9pY19sb2NrX2lkbGVfbG9jayIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmRyYXdhYmxlUGFkZGluZz0iNWRpcCIKKyAgICAgICAgICAgICAgICAvPgorICAgICAgICAKKyAgICAgICAgICAgIDwhLS0gc3BhY2VyIGJlbG93IGhlYWRlciAtLT4KKyAgICAgICAgICAgIDxWaWV3CisgICAgICAgICAgICAgICAgYW5kcm9pZDppZD0iQCtpZC9zcGFjZXJUb3AiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfd2lkdGg9Im1hdGNoX3BhcmVudCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9oZWlnaHQ9IjFkaXAiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfYmVsb3c9IkBpZC90b3BIZWFkZXIiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpiYWNrZ3JvdW5kPSJAZHJhd2FibGUvZGl2aWRlcl9ob3Jpem9udGFsX2RhcmsiLz4KKyAgICAgICAgCisgICAgICAgICAgICA8VGV4dFZpZXcKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmlkPSJAK2lkL2luc3RydWN0aW9ucyIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF93aWR0aD0ibWF0Y2hfcGFyZW50IgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X2hlaWdodD0id3JhcF9jb250ZW50IgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X2JlbG93PSJAK2lkL3NwYWNlclRvcCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9tYXJnaW5Ub3A9IjhkaXAiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfbWFyZ2luTGVmdD0iOWRpcCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOnRleHRBcHBlYXJhbmNlPSI/YW5kcm9pZDphdHRyL3RleHRBcHBlYXJhbmNlU21hbGwiCisgICAgICAgICAgICAgICAgYW5kcm9pZDp0ZXh0PSJAYW5kcm9pZDpzdHJpbmcvbG9ja3NjcmVlbl9nbG9naW5faW5zdHJ1Y3Rpb25zIgorICAgICAgICAgICAgICAgIC8+CisgICAgICAgIAorICAgICAgICAgICAgPEVkaXRUZXh0CisgICAgICAgICAgICAgICAgYW5kcm9pZDppZD0iQCtpZC9sb2dpbiIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOm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gYW5kcm9pZDppbnB1dFR5cGU9InRleHRQYXNzd29yZCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmhpbnQ9IkBhbmRyb2lkOnN0cmluZy9sb2Nrc2NyZWVuX2dsb2dpbl9wYXNzd29yZF9oaW50IgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6bmV4dEZvY3VzUmlnaHQ9IkAraWQvb2siCisgICAgICAgICAgICAgICAgYW5kcm9pZDpuZXh0Rm9jdXNEb3duPSJAK2lkL29rIgorICAgICAgICAgICAgICAgIC8+CisgICAgICAgIAorICAgICAgICAgICAgPCEtLSBvayBiZWxvdyBwYXNzd29yZCwgYWxpZ25lZCB0byByaWdodCBvZiBzY3JlZW4gLS0+CisgICAgICAgICAgICA8QnV0dG9uCisgICAgICAgICAgICAgICAgYW5kcm9pZDppZD0iQCtpZC9vayIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF93aWR0aD0iODVkaXAiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfaGVpZ2h0PSJ3cmFwX2NvbnRlbnQiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfYmVsb3c9IkBpZC9wYXNzd29yZCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9tYXJnaW5Ub3A9IjdkaXAiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfbWFyZ2luUmlnaHQ9IjdkaXAiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfYWxpZ25QYXJlbnRSaWdodD0idHJ1ZSIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOnRleHQ9IkBhbmRyb2lkOnN0cmluZy9sb2Nrc2NyZWVuX2dsb2dpbl9zdWJtaXRfYnV0dG9uIgorICAgICAgICAgICAgICAgIC8+CisgICAgICAgIAorICAgICAgICA8L1JlbGF0aXZlTGF5b3V0PgorICAgIDwvU2Nyb2xsVmlldz4KKyAgICAKKyAgICA8IS0tIHNwY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CIKKyAgICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X2hlaWdodD0id3JhcF9jb250ZW50IgorICAgICAgICAgICAgICAgICAgYW5kcm9pZDpncmF2aXR5PSJjZW50ZXIiCisgICAgICAgICAgICAgICAgICBhbmRyb2lkOnRleHQ9IkBhbmRyb2lkOnN0cmluZy9sb2Nrc2NyZWVuX21pc3Npbmdfc2ltX21lc3NhZ2UiCisgICAgICAgICAgICAgICAgICBhbmRyb2lkOnRleHRBcHBlYXJhbmNlPSI/YW5kcm9pZDphdHRyL3RleHRBcHBlYXJhbmNlTGFyZ2UiLz4KKyAgICAgICAgPFRleHRWaWV3IGFuZHJvaWQ6aWQ9IkAraWQvaGVhZGVyU2ltQmFkMiIKKyAgICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X3dpZHRoPSJtYXRjaF9wYXJlbnQiCisgICAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9oZWlnaHQ9IndyYXBfY29udGVudCIKKyAgICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X21hcmdpblRvcD0iN2RpcCIKKyAgICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X21hcmdpbkJvdHRvbT0iN2RpcCIKKyAgICAgICAgICAgICAgICAgIGFuZHJvaWQ6Z3Jhdml0eT0iY2VudGVyIgorICAgICAgICAgICAgICAgICAgYW5kcm9pZDp0ZXh0PSJAYW5kcm9pZDpzdHJpbmcvbG9ja3NjcmVlbl9taXNzaW5nX3NpbV9pbnN0cnVjdGlvbnMiCisgICAgICAgICAgICAgICAgICBhbmRyb2lkOnRleHRBcHBlYXJhbmNlPSI/YW5kcm9pZDphdHRyL3RleHRBcHBlYXJhbmNlU21hbGwiLz4KKworICAgICAgICA8IS0tIHNwYWNlciBhZnRlciBjYXJyaWVyIGluZm8gLyBzaW0gbWVzc2FnZXMgLS0+CisgICAgICAgIDxWaWV3CisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF93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hlaWdodD0iMWRpcCIKKyAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X21hcmdpbkJvdHRvbT0iOGRpcCIKKyAgICAgICAgICAgIGFuZHJvaWQ6YmFja2dyb3VuZD0iQGFuZHJvaWQ6ZHJhd2FibGUvZGl2aWRlcl9ob3Jpem9udGFsX2RhcmsiCisgICAgICAgICAgICAgICAgLz4KKworICAgICAgICA8IS0tIGJhdHRlcnkgaW5mbyAtLT4KKyAgICAgICAgPExpbmVhckxheW91dCBhbmRyb2lkOmlkPSJAK2lkL2JhdHRlcnlJbmZvIgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6b3JpZW50YXRpb249Imhvcml6b250YWwiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfd2lkdGg9Im1hdGNoX3BhcmVudCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9oZWlnaHQ9IndyYXBfY29udGVudCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmdyYXZpdHk9ImNlbnRlciIKKyAgICAgICAgICAgICAgPgorCisgICAgICAgICAgICA8SW1hZ2VWaWV3IGFuZHJvaWQ6aWQ9IkAraWQvYmF0dGVyeUluZm9JY29uIgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X3dpZHRoPSJ3cmFwX2NvbnRlbnQiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfaGVpZ2h0PSJ3cmFwX2NvbnRlbnQiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfbWFyZ2luUmlnaHQ9IjZkaXAiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpiYXNlbGluZUFsaWduZWQ9InRydWUiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpncmF2aXR5PSJjZW50ZXIiCisgICAgICAgICAgICAvPgorCisgICAgICAgICAgICA8VGV4dFZpZXcgYW5kcm9pZDppZD0iQCtpZC9iYXR0ZXJ5SW5mb1RleHQiCisgICAgICAgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfd2lkdGg9IndyYXBfY29udGVudCIKKyAgICAgICAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9oZWlnaHQ9IndyYXBfY29udGVudCIKKyAgICAgICAgICAgICAgICAgICAgICBhbmRyb2lkOnRleHRTaXplPSIxOHNwIgorICAgICAgICAgICAgICAgICAgICAgIGFuZHJvaWQ6Z3Jhdml0eT0iY2VudGVyIgorICAgICAgICAgICAgLz4KKworICAgICAgICA8L0xpbmVhckxheW91dD4KKworICAgICAgICA8IS0tIHNwYWNlciBhZnRlciBiYXR0ZXJ5IGluZm8gLS0+CisgICAgICAgIDxWaWV3IGFuZHJvaWQ6aWQ9IkAraWQvYmF0dGVyeUluZm9TcGFjZXIiCisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF93aWR0aD0ibWF0Y2hfcGFyZW50IgorICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfaGVpZ2h0PSIxZGlwIgorICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfbWFyZ2luVG9wPSI4ZGlwIgorICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfbWFyZ2luQm90dG9tPSI4ZGlwIgorICAgICAgICAgICAgYW5kcm9pZDpiYWNrZ3JvdW5kPSJAYW5kcm9pZDpkcmF3YWJsZS9kaXZpZGVyX2hvcml6b250YWxfZGFyayIKKyAgICAgICAgICAgICAgICAvPgorCisgICAgICAgIDwhLS0gbmV4dCBhbGFybSBpbmZvIC0tPgorCisgICAgICAgIDxMaW5lYXJMYXlvdXQgYW5kcm9pZDppZD0iQCtpZC9uZXh0QWxhcm1JbmZvIgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6b3JpZW50YXRpb249Imhvcml6b250YWwiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfd2lkdGg9Im1hdGNoX3BhcmVudCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9oZWlnaHQ9IndyYXBfY29udGVudCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmdyYXZpdHk9ImNlbnRlciIKKyAgICAgICAgICAgICAgPgorCisgICAgICAgICAgICA8SW1hZ2VWaWV3CisgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfd2lkdGg9IndyYXBfY29udGVudCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9oZWlnaHQ9IndyYXBfY29udGVudCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9tYXJnaW5SaWdodD0iNmRpcCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmJhc2VsaW5lQWxpZ25lZD0idHJ1ZSIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOnNyYz0iQGFuZHJvaWQ6ZHJhd2FibGUvaWNfbG9ja19pZGxlX2FsYXJtIgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6Z3Jhdml0eT0iY2VudGVyIgorICAgICAgICAgICAgLz4KKworICAgICAgICAgICAgPFRleHRWaWV3IGFuZHJvaWQ6aWQ9IkAraWQvbmV4dEFsYXJtVGV4dCIKKyAgICAgICAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF93aWR0aD0id3JhcF9jb250ZW50IgorICAgICAgICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X2hlaWdodD0id3JhcF9jb250ZW50IgorICAgICAgICAgICAgICAgICAgICAgIGFuZHJvaWQ6dGV4dFNpemU9IjE4c3AiCisgICAgICAgICAgICAgICAgICAgICAgYW5kcm9pZDpncmF2aXR5PSJjZW50ZXIiCisgICAgICAgICAgICAvPgorICAgICAgICA8L0xpbmVhckxheW91dD4KKworICAgICAgICA8IS0tIHNwYWNlciBhZnRlciBhbGFybSBpbmZvIC0tPgorICAgICAgICA8VmlldyBhbmRyb2lkOmlkPSJAK2lkL25leHRBbGFybVNwYWNlciIKKyAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X3dpZHRoPSJtYXRjaF9wYXJlbnQiCisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9oZWlnaHQ9IjFkaXAiCisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9tYXJnaW5Ub3A9IjhkaXAiCisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9tYXJnaW5Cb3R0b209IjhkaXAiCisgICAgICAgICAgICBhbmRyb2lkOmJhY2tncm91bmQ9IkBhbmRyb2lkOmRyYXdhYmxlL2RpdmlkZXJfaG9yaXpvbnRhbF9kYXJrIi8+CisKKyAgICAgICAgPCEtLSBsb2NrIGljb24gd2l0aCAnc2NyZWVuIGxvY2tlZCcgbWVzc2FnZQorICAgICAgICAgICAgIChzaG93biB3aGVuIFNJTSBjYXJkIGlzIHByZXNlbnQpIC0tPgorICAgICAgICA8TGluZWFyTGF5b3V0IGFuZHJvaWQ6aWQ9IkAraWQvc2NyZWVuTG9ja2VkSW5mbyIKKyAgICAgICAgICAgIGFuZHJvaWQ6b3JpZW50YXRpb249Imhvcml6b250YWwiCisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF93aWR0aD0ibWF0Y2hfcGFyZW50IgorICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfaGVpZ2h0PSJ3cmFwX2NvbnRlbnQiCisgICAgICAgICAgICBhbmRyb2lkOmdyYXZpdHk9ImNlbnRlciIKKyAgICAgICAgICAgID4KKworICAgICAgICAgICAgPEltYWdlVmlldworICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X3dpZHRoPSJ3cmFwX2NvbnRlbnQiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfaGVpZ2h0PSJ3cmFwX2NvbnRlbnQiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfbWFyZ2luUmlnaHQ9IjZkaXAiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpiYXNlbGluZUFsaWduZWQ9InRydWUiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpzcmM9IkBhbmRyb2lkOmRyYXdhYmxlL2ljX2xvY2tfaWRsZV9sb2NrIgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6Z3Jhdml0eT0iY2VudGVyIgorICAgICAgICAgICAgLz4KKworICAgICAgICAgICAgPFRleHRWaWV3CisgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfd2lkdGg9IndyYXBfY29udGVudCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9oZWlnaHQ9IndyYXBfY29udGVudCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOnRleHRTaXplPSIxOHNwIgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6dGV4dD0iQGFuZHJvaWQ6c3RyaW5nL2xvY2tzY3JlZW5fc2NyZWVuX2xvY2tlZCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmdyYXZpdHk9ImNlbnRlciIKKyAgICAgICAgICAgICAgICAgICAgLz4KKyAgICAgICAgPC9MaW5lYXJMYXlvdXQ+CisKKyAgICAgICAgPCEtLSBtZXNzYWdlIGFib3V0IGhvdyB0byB1bmxvY2sKKyAgICAgICAgICAgICAoc2hvd24gd2hlbiBTSU0gY2FyZCBpcyBwcmVzZW50KSAtLT4KKyAgICAgICAgPFRleHRWaWV3IGFuZHJvaWQ6aWQ9IkAraWQvbG9ja0luc3RydWN0aW9ucyIKKyAgICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X3dpZHRoPSJtYXRjaF9wYXJlbnQiCisgICAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9oZWlnaHQ9IndyYXBfY29udGVudCIKKyAgICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X21hcmdpbkJvdHRvbT0iNWRpcCIKKyAgICAgICAgICAgICAgICAgIGFuZHJvaWQ6Z3Jhdml0eT0iY2VudGVyIgorICAgICAgICAgICAgICAgICAgYW5kcm9pZDp0ZXh0U2l6ZT0iMTRzcCIvPgorCisKKyAgICAgICAgPCEtLSBlbWVy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2Fway9yZXMvYW5kcm9pZCIKKyAgICBhbmRyb2lkOmxheW91dF93aWR0aD0ibWF0Y2hfcGFyZW50IgorICAgIGFuZHJvaWQ6bGF5b3V0X2hlaWdodD0ibWF0Y2hfcGFyZW50IgorICAgIGFuZHJvaWQ6b3JpZW50YXRpb249Imhvcml6b250YWwiCisgICAgICAgID4KKyAgICAKKyAgICA8IS0tIGxlZnQgc2lkZTogc3RhdHVzIGFuZCBlbWVyZ2VuY3kgY2FsbCBidXR0b24gLS0+CisgICAgPExpbmVhckxheW91dAorICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfaGVpZ2h0PSJtYXRjaF9wYXJlbnQiCisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF93ZWlnaHQ9IjEiCisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF93aWR0aD0iMGRpcCIKKyAgICAgICAgICAgIGFuZHJvaWQ6b3JpZW50YXRpb249InZlcnRpY2FsIgorICAgICAgICAgICAgYW5kcm9pZDpncmF2aXR5PSJjZW50ZXJfdmVydGljYWwiCisgICAgICAgICAgICAgICAgPgorICAgICAgICA8aW5jbHVkZSBsYXlvdXQ9IkBsYXlvdXQva2V5Z3VhcmRfc2NyZWVuX3N0YXR1c19sYW5kIiAvPgorICAgIDwvTGluZWFyTGF5b3V0PgorICAgIAorICAgIDwhLS0gcmlnaHQgc2lkZTogcGFzc3dvcmQgLS0+CisgICAgPExpbmVhckxheW91dAorICAgICAgICBhbmRyb2lkOmxheW91dF93aWR0aD0iMGRpcCIKKyAgICAgICAgYW5kcm9pZDpsYXlvdXRfaGVpZ2h0PSJtYXRjaF9wYXJlbnQiCisgICAgICAgIGFuZHJvaWQ6b3JpZW50YXRpb249InZlcnRpY2FsIgorICAgICAgICBhbmRyb2lkOmxheW91dF93ZWlnaHQ9IjEiCisgICAgICAgIGFuZHJvaWQ6Z3Jhdml0eT0iY2VudGVyIj4KKworICAgICAgICA8IS0tIFBhc3N3b3JkIGVudHJ5IGZpZWxkIC0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4KKworICAgICAgICAgICAgPCEtLSBkaXNwbGF5cyBkb3RzIGFzIHVzZXIgZW50ZXJzIHBpbiAtLT4KKyAgICAgICAgICAgIDxUZXh0VmlldyBhbmRyb2lkOmlkPSJAK2lkL3BpbkRpc3BsYXkiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfd2lkdGg9IjBkaXAiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfaGVpZ2h0PSJ3cmFwX2NvbnRlbnQiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfd2VpZ2h0PSIxIgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6bWF4TGluZXM9IjEiCisgICAgICAgICAgICAgICAgYW5kcm9pZDp0ZXh0QXBwZWFyYW5jZT0iP2FuZHJvaWQ6YXR0ci90ZXh0QXBwZWFyYW5jZUxhcmdlSW52ZXJzZSIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOnRleHRTdHlsZT0iYm9sZCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmlucHV0VHlwZT0idGV4dFBhc3N3b3JkIgorICAgICAgICAgICAgLz4KKworICAgICAgICAgICAgPEltYWdlQnV0dG9uIGFuZHJvaWQ6aWQ9IkAraWQvYmFja3NwYWNlIgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6c3JjPSJAYW5kcm9pZDpkcmF3YWJsZS9pY19pbnB1dF9kZWxldGUiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfd2lkdGg9IndyYXBfY29udGVudCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9oZWlnaHQ9IndyYXBfY29udGVudCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9tYXJnaW5SaWdodD0iLTNkaXAiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfbWFyZ2luQm90dG9tPSItM2RpcCIKKyAgICAgICAgICAgIC8+CisgICAgICAgIDwvTGluZWFyTGF5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gICBhbmRyb2lkOmxheW91dF93aWR0aD0id3JhcF9jb250ZW50IgorICAgICAgICBhbmRyb2lkOmxheW91dF9oZWlnaHQ9IndyYXBfY29udGVudCIKKyAgICAgICAgYW5kcm9pZDpsYXlvdXRfYWxpZ25QYXJlbnRUb3A9InRydWUiCisgICAgICAgIGFuZHJvaWQ6bGF5b3V0X2FsaWduUGFyZW50TGVmdD0idHJ1ZSIKKyAgICAgICAgYW5kcm9pZDpsYXlvdXRfbWFyZ2luVG9wPSI4ZGlwIgorICAgICAgICBhbmRyb2lkOmxheW91dF9tYXJnaW5Cb3R0b209IjhkaXAiCisgICAgICAgID4KKworICAgICAgICA8VGV4dFZpZXcgYW5kcm9pZDppZD0iQCtpZC90aW1lRGlzcGxheSIKKyAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X3dpZHRoPSJ3cmFwX2NvbnRlbnQiCisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9oZWlnaHQ9IndyYXBfY29udGVudCIKKyAgICAgICAgICAgIGFuZHJvaWQ6c2luZ2xlTGluZT0idHJ1ZSIKKyAgICAgICAgICAgIGFuZHJvaWQ6ZWxsaXBzaXplPSJub25lIgorICAgICAgICAgICAgYW5kcm9pZDp0ZXh0U2l6ZT0iMTIwc3AiCisgICAgICAgICAgICBhbmRyb2lkOnRleHRBcHBlYXJhbmNlPSI/YW5kcm9pZDphdHRyL3RleHRBcHBlYXJhbmNlTWVkaXVtIgorICAgICAgICAgICAgYW5kcm9pZDpzaGFkb3dDb2xvcj0iI0MwMDAwMDAwIgorICAgICAgICAgICAgYW5kcm9pZDpzaGFkb3dEeD0iMCIKKyAgICAgICAgICAgIGFuZHJvaWQ6c2hhZG93RHk9IjAiCisgICAgICAgICAgICBhbmRyb2lkOnNoYWRvd1JhZGl1cz0iMy4wIgorICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfbWFyZ2luQm90dG9tPSI2ZGlwIgorICAgICAgICAgICAgLz4KKworCisgICAgICAgIDxUZXh0VmlldyBhbmRyb2lkOmlkPSJAK2lkL2FtX3BtIgorICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfd2lkdGg9IndyYXBfY29udGVudCIKKyAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X2hlaWdodD0id3JhcF9jb250ZW50IgorICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfdG9SaWdodE9mPSJAaWQvdGltZURpc3BsYXkiCisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9hbGlnbkJhc2VsaW5lPSJAaWQvdGltZURpc3BsYXkiCisgICAgICAgICAgICBhbmRyb2lkOnNpbmdsZUxpbmU9InRydWUiCisgICAgICAgICAgICBhbmRyb2lkOmVsbGlwc2l6ZT0ibm9uZSIKKyAgICAgICAgICAgIGFuZHJvaWQ6dGV4dFNpemU9IjMwc3AiCisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9tYXJnaW5MZWZ0PSI4ZGlwIgorICAgICAgICAgICAgYW5kcm9pZDp0ZXh0QXBwZWFyYW5jZT0iP2FuZHJvaWQ6YXR0ci90ZXh0QXBwZWFyYW5jZU1lZGl1bSIKKyAgICAgICAgICAgIGFuZHJvaWQ6c2hhZG93Q29sb3I9IiNDMDAwMDAwMCIKKyAgICAgICAgICAgIGFuZHJvaWQ6c2hhZG93RHg9IjAiCisgICAgICAgICAgICBhbmRyb2lkOnNoYWRvd0R5PSIwIgorICAgICAgICAgICAgYW5kcm9pZDpzaGFkb3dSYWRpdXM9IjMuMCIKKyAgICAgICAgICAgIC8+CisKKyAgICA8L2NvbS5hbmRyb2lkLmludGVybmFsLndpZGdldC5EaWdpdGFsQ2xvY2s+CisKKyAgICA8VGV4dFZpZXcKKyAgICAgICAgYW5kcm9pZDppZD0iQCtpZC9kYXRlIgorICAgICAgICBhbmRyb2lkOmxheW91dF93aWR0aD0id3JhcF9jb250ZW50IgorICAgICAgICBhbmRyb2lkOmxheW91dF9oZWlnaHQ9IndyYXBfY29udGVudCIKKyAgICAgICAgY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lvbj0idmVydGljYWwiCisgICAgICAgICAgICBhbmRyb2lkOmdyYXZpdHk9ImNlbnRlcl92ZXJ0aWNhbCIKKyAgICAgICAgICAgICAgICA+CisgICAgICAgIDxpbmNsdWRlIGxheW91dD0iQGxheW91dC9rZXlndWFyZF9zY3JlZW5fc3RhdHVzX2xhbmQiIC8+CisgICAgPC9MaW5lYXJMYXlvdXQ+CisKKyAgICA8IS0tIHJpZ2h0IHNpZGUgLS0+CisgICAgPExpbmVhckxheW91dAorICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfaGVpZ2h0PSJtYXRjaF9wYXJlbnQiCisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF93ZWlnaHQ9IjEiCisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF93aWR0aD0iMGRpcCIKKyAgICAgICAgICAgIGFuZHJvaWQ6b3JpZW50YXRpb249Imhvcml6b250YWwiCisgICAgICAgICAgICBhbmRyb2lkOmdyYXZpdHk9ImNlbnRlcl9ob3Jpem9udGFsIgorICAgICAgICAgICAgICAgID4KKyAgICAgICAgPFRleHRWaWV3CisgICAgICAgICAgICAgICAgYW5kcm9pZDppZD0iQCtpZC9zY3JlZW5Mb2NrZWQiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfd2lkdGg9IndyYXBfY29udGVudCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9oZWlnaHQ9IndyYXBfY29udGVudCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9iZWxvdz0iQGlkL3N0YXR1czIiCisgICAgICAgICAgICAgICAgYW5kcm9pZDp0ZXh0QXBwZWFyYW5jZT0iP2FuZHJvaWQ6YXR0ci90ZXh0QXBwZWFyYW5jZU1lZGl1bSIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmdyYXZpdHk9ImNlbnRlciIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9tYXJnaW5Ub3A9IjEyZGlwIgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6ZHJhd2FibGVQYWRkaW5nPSI0ZGlwIgorICAgICAgICAgICAgICAgIC8+CisKKyAgICAgICAgPGNvbS5hbmRyb2lkLmludGVybmFsLndpZGdldC5TbGlkaW5nVGFiCisgICAgICAgICAgICBhbmRyb2lkOmlkPSJAK2lkL3RhYl9zZWxlY3RvciIKKyAgICAgICAgICAgIGFuZHJvaWQ6b3JpZW50YXRpb249InZlcnRpY2FsIgorICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfd2lkdGg9IndyYXBfY29udGVudCIKKyAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X2hlaWdodD0ibWF0Y2hfcGFyZW50IgorICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfbWFyZ2luUmlnaHQ9IjBkaXAiCisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF93ZWlnaHQ9IjEuMCIKKyAgICAgICAgICAgIC8+CisgICAgICAgICAgICAKKyAgICAgICAgPCEtLSAiZW1lcmdlbmN5IGNhbGxzIG9ubHkiIHNob3duIHdoZW4gc2ltIGlzIG1pc3Npbmcgb3IgUFVLZCAtLT4KKyAgICAgICAgPFRleHRWaWV3CisgICAgICAgICAgICBhbmRyb2lkOmlkPSJAK2lkL2VtZXJnZW5jeUNhbGxUZXh0IgorICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfd2lkdGg9IndyYXBfY29udGVudCIKKyAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X2hlaWdodD0id3JhcF9jb250ZW50IgorICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfYWxpZ25QYXJlbnRUb3A9InRydWUiCisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9tYXJnaW5Ub3A9IjIwZGlwIgorICAgICAgICAgICAgYW5kcm9pZDp0ZXh0PSJAc3RyaW5nL2VtZXJnZW5jeV9jYWxsc19vbmx5IgorICAgICAgICAgICAgYW5kcm9pZDp0ZXh0QXBwZWFyYW5jZT0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nQiCisgICAgICAgICAgICAgICAgICAgIGFuZHJvaWQ6ZHJhd2FibGVMZWZ0PSJAZHJhd2FibGUvaWNfZW1lcmdlbmN5IgorICAgICAgICAgICAgICAgICAgICBhbmRyb2lkOmRyYXdhYmxlUGFkZGluZz0iOGRpcCIKKyAgICAgICAgICAgICAgICAgICAgYW5kcm9pZDp2aXNpYmlsaXR5PSJnb25lIgorICAgICAgICAgICAgICAgICAgICAvPgorICAgICAgICAgICAgPC9SZWxhdGl2ZUxheW91dD4KKworICAgICAgICAgICAgPCEtLSBvcHRpb24gMjogYW4gZW1lcmdlbmN5IGNhbGwgYnV0dG9uLCBhbmQgYSAnZm9yZ290IHBhdHRlcm4/JyBidXR0b24gLS0+CisgICAgICAgICAgICA8TGluZWFyTGF5b3V0IGFuZHJvaWQ6aWQ9IkAraWQvZm9vdGVyRm9yZ290UGF0dGVybiIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOm9yaWVudGF0aW9uPSJ2ZXJ0aWNhbCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF93aWR0aD0ibWF0Y2hfcGFyZW50IgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X2hlaWdodD0id3JhcF9jb250ZW50IgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6Z3Jhdml0eT0ibGVmdCIKKyAgICAgICAgICAgICAgICA+CisgICAgICAgICAgICAgICAgPEJ1dHRvbiBhbmRyb2lkOmlkPSJAK2lkL2ZvcmdvdFBhdHRlcm4iCisgICAgICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X3dpZHRoPSJtYXRjaF9wYXJlbnQiCisgICAgICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X2hlaWdodD0id3JhcF9jb250ZW50IgorICAgICAgICAgICAgICAgICAgICBzdHlsZT0iQHN0eWxlL1dpZGdldC5CdXR0b24uVHJhbnNwYXJlbnQiCisgICAgICAgICAgICAgICAgICAgIC8+CisgICAgICAg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aW5lYXJMYXlvdXQKKyAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X2hlaWdodD0iMGRpcCIKKyAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X3dlaWdodD0iMSIKKyAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X3dpZHRoPSJtYXRjaF9wYXJlbnQiCisgICAgICAgICAgICBhbmRyb2lkOm9yaWVudGF0aW9uPSJ2ZXJ0aWNhbCIKKyAgICAgICAgICAgIGFuZHJvaWQ6Z3Jhdml0eT0iY2VudGVyX3ZlcnRpY2FsIgorICAgICAgICAgICAgICAgID4KKyAgICAgICAgCisgICAgICAgIDxpbmNsdWRlIGxheW91dD0iQGxheW91dC9rZXlndWFyZF9zY3JlZW5fc3RhdHVzX3BvcnQiIC8+CisKKyAgICAgICAgPCEtLSBmb290ZXIgLS0+CisgICAgICAgIDxGcmFtZUxheW91dAorICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfd2lkdGg9Im1hdGNoX3BhcmVudCIKKyAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X2hlaWdodD0id3JhcF9jb250ZW50IgorICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfbWFyZ2luTGVmdD0iMTQwZGlwIgorICAgICAgICAgICAgPgorCisgICAgICAgICAgICA8IS0tIG9wdGlvbiAxOiBhIHNpbmdsZSBlbWVyZ2VuY3kgY2FsbCBidXR0b24gLS0+CisgICAgICAgICAgICA8UmVsYXRpdmVMYXlvdXQgYW5kcm9pZDppZD0iQCtpZC9mb290ZXJOb3JtYWwiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfd2lkdGg9Im1hdGNoX3BhcmVudCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9oZWlnaHQ9IndyYXBfY29udGVudCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmdyYXZpdHk9ImxlZnQiCisgICAgICAgICAgICAgICAgPgorICAgICAgICAgICAgICAgIDxC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b2lkOmdyYXZpdHk9ImxlZnQiCisgICAgICAgICAgICAgICAgPgorICAgICAgICAgICAgICAgIDxCdXR0b24gYW5kcm9pZDppZD0iQCtpZC9mb3Jnb3RQYXR0ZXJuIgorICAgICAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF93aWR0aD0ibWF0Y2hfcGFyZW50IgorICAgICAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9oZWlnaHQ9IndyYXBfY29udGVudCIKKyAgICAgICAgICAgICAgICAgICAgc3R5bGU9IkBzdHlsZS9XaWRnZXQuQnV0dG9uLlRyYW5zcGFyZW50IgorICAgICAgICAgICAgICAgICAgICAvPgorICAgICAgICAgICAgICAgIDxCdXR0b24gYW5kcm9pZDppZD0iQCtpZC9lbWVyZ2VuY3lDYWxsVG9nZXRoZXIiCisgICAgICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X3dpZHRoPSJtYXRjaF9wYXJlbnQiCisgICAgICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X2hlaWdodD0id3JhcF9jb250ZW50IgorICAgICAgICAgICAgICAgICAgICBhbmRyb2lkOnRleHQ9IkBzdHJpbmcvbG9ja3NjcmVlbl9lbWVyZ2VuY3lfY2FsbCIKKyAgICAgICAgICAgICAgICAgICAgc3R5bGU9IkBzdHlsZS9XaWRnZXQuQnV0dG9uLlRyYW5zcGFyZW50IgorICAgICAgICAgICAgICAgICAgICBhbmRyb2lkOmRyYXdhYmxlTGVmdD0iQGRyYXdhYmxlL2ljX2VtZXJnZW5jeSIKKyAgICAgICAgICAgICAgICAgICAgYW5kcm9pZDpkcmF3YWJsZVBhZGRpbmc9IjhkaXAiCisgICAgICAgICAgICAgICAgICAgIGFuZHJvaWQ6dmlzaWJpbGl0eT0iZ29uZSIKKyAgICAgICAgICAgICAgICAgICAgLz4KKyAgICAgICAgICAgIDwvTGluZWFyTGF5b3V0PgorICAgICAgICA8L0ZyYW1lTGF5b3V0PgorICAgIDwvTGlu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KLSAgICAgICAgICAgICAgICBhbmRyb2lkOnNpbmdsZUxpbmU9InRydWUiCi0gICAgICAgICAgICAgICAgYW5kcm9pZDplbGxpcHNpemU9ImVuZCIKLSAgICAgICAgICAgICAgICBhbmRyb2lkOnRleHRBcHBlYXJhbmNlPSI/YW5kcm9pZDphdHRyL3RleHRBcHBlYXJhbmNlTWVkaXVtIgotICAgICAgICAgICAgICAgIGFuZHJvaWQ6dGV4dFN0eWxlPSJib2xkIgotICAgICAgICAgICAgICAgIGFuZHJvaWQ6c2hhZG93Q29sb3I9IiNCQjAwMDAwMCIKLSAgICAgICAgICAgICAgICBhbmRyb2lkOnNoYWRvd1JhZGl1cz0iMi43NSIKLSAgICAgICAgICAgICAgICAvPgotICAgICAgICA8L0xpbmVhckxheW91dD4KLQotICAgICAgICA8VGV4dFZpZXcgYW5kcm9pZDppZD0iQCtpZC9waG9uZXRpY19uYW1lIgotICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfd2lkdGg9Im1hdGNoX3BhcmVudCIKLSAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X2hlaWdodD0id3JhcF9jb250ZW50IgotICAgICAgICAgICAgYW5kcm9pZDp0ZXh0QXBwZWFyYW5jZT0iP2FuZHJvaWQ6YXR0ci90ZXh0QXBwZWFyYW5jZVNtYWxsIgotICAgICAgICAgICAgYW5kcm9pZDpzaW5nbGVMaW5lPSJ0cnVlIgotICAgICAgICAgICAgYW5kcm9pZDplbGxpcHNpemU9ImVuZCIKLSAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X21hcmdpblRvcD0iLTJkaXAiCi0gICAgICAgICAgICBhbmRyb2lkOnZpc2liaWxpdHk9ImdvbmUiCi0gICAgICAgIC8+Ci0KLSAgICAgICAgPFRleHRWaWV3IGFuZHJvaWQ6aWQ9IkAraWQvc3RhdHVzIgotICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfd2lkdGg9Im1hdGNoX3BhcmVudCIKLSAgICAgICAgICAgI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XJlbnRUb3A9InRydWUiCiAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9hbGlnblBhcmVudExlZnQ9InRydWUiCiAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9tYXJnaW5Ub3A9IjhkaXAiCisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9tYXJnaW5Cb3R0b209IjhkaXAiCiAgICAgICAgICAgICA+CiAKICAgICAgICAgICAgIDxUZXh0VmlldyBhbmRyb2lkOmlkPSJAK2lkL3RpbWVEaXNwbGF5IgogICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X3dpZHRoPSJ3cmFwX2NvbnRlbnQiCiAgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfaGVpZ2h0PSJ3cmFwX2NvbnRlbnQiCi0gICAgICAgICAgICAgICAgYW5kcm9pZDpncmF2aXR5PSJib3R0b20iCiAgICAgICAgICAgICAgICAgYW5kcm9pZDpzaW5nbGVMaW5lPSJ0cnVlIgogICAgICAgICAgICAgICAgIGFuZHJvaWQ6ZWxsaXBzaXplPSJub25lIgogICAgICAgICAgICAgICAgIGFuZHJvaWQ6dGV4dFNpemU9Ijcyc3AiCkBAIC04NCw4ICs4NSw5IEBACiAKICAgICAgICAgICAgIDxUZXh0VmlldyBhbmRyb2lkOmlkPSJAK2lkL2FtX3BtIgogICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X3dpZHRoPSJ3cmFwX2NvbnRlbnQiCi0gICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfaGVpZ2h0PSJtYXRjaF9wYXJlbnQiCi0gICAgICAgICAgICAgICAgYW5kcm9pZDpncmF2aXR5PSJib3R0b20iCisgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfaGVpZ2h0PSJ3cmFwX2NvbnRlbnQiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfdG9SaWdodE9mPSJAaWQvdGltZURpc3BsYXkiCisgICAgICAgICAgICA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mVuY2UiIC8+CiAKICAgICAgICAgPCEtLSA9PT09PT09PT09PT09PT09PT09IC0tPgorICAgICAgICA8IS0tIEFjdGlvbiBiYXIgc3R5bGVzICAgLS0+CisgICAgICAgIDwhLS0gPT09PT09PT09PT09PT09PT09PSAtLT4KKyAgICAgICAgPGVhdC1jb21tZW50IC8+CisgICAgICAgIDwhLS0gRGVmYXVsdCBhbW91bnQgb2YgcGFkZGluZyB0byB1c2UgYmV0d2VlbiBhY3Rpb24gYnV0dG9ucy4gLS0+CisgICAgICAgIDxhdHRyIG5hbWU9ImFjdGlvbkJ1dHRvblBhZGRpbmciIGZvcm1hdD0iZGltZW5zaW9uIiAvPgorCisgICAgICAgIDwhLS0gPT09PT09PT09PT09PT09PT09PSAtLT4KKyAgICAgICAgPCEtLSBBY3Rpb24gbW9kZSBzdHlsZXMgIC0tPgorICAgICAgICA8IS0tID09PT09PT09PT09PT09PT09PT0gLS0+CisgICAgICAgIDxlYXQtY29tbWVudCAvPgorICAgICAgICA8IS0tIEJhY2tncm91bmQgZHJhd2FibGUgdG8gdXNlIGZvciBhY3Rpb24gbW9kZSBVSSAtLT4KKyAgICAgICAgPGF0dHIgbmFtZT0iYWN0aW9uTW9kZUJhY2tncm91bmQiIGZvcm1hdD0icmVmZXJlbmNlIiAvPgorICAgICAgICA8IS0tIERyYXdhYmxlIHRvIHVzZSBmb3IgdGhlIGNsb3NlIGFjdGlvbiBtb2RlIGJ1dHRvbiAtLT4KKyAgICAgICAgPGF0dHIgbmFtZT0iYWN0aW9uTW9kZUNsb3NlRHJhd2FibGUiIGZvcm1hdD0icmVmZXJlbmNlIiAvPgorCisgICAgICAgIDwhLS0gPT09PT09PT09PT09PT09PT09PSAtLT4KICAgICAgICAgPCEtLSBQcmVmZXJlbmNlIHN0eWxlcyAgIC0tPgogICAgICAgICA8IS0tID09PT09PT09PT09PT09PT09PT0gLS0+CiAgICAgICAgIDxlYXQtY29tbWVudCAvPgpAQCAtOTYzLDYgKzEwMTgsMTEg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JtIChFY2xhaXIgTVIxKS4KICAgICAgPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09IC0tPgpAQCAtMTIyMCw3ICsxMjIwLDcgQEAKICAgPHB1YmxpYyB0eXBlPSJhdHRyIiBuYW1lPSJhdXRob3IiIGlkPSIweDAxMDEwMmI0IiAvPgogICA8cHVibGljIHR5cGU9ImF0dHIiIG5hbWU9ImF1dG9TdGFydCIgaWQ9IjB4MDEwMTAyYjUiIC8+CiAKLSAgICAKKwogPCEtLSA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KICAgICAgUmVzb3VyY2VzIGFkZGVkIGluIHZlcnNpb24gOCBvZiB0aGUgcGxhdGZvcm0gKEVjbGFpciBNUjIpLgogICAgICA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gLS0+CkBAIC0xMjQxLDE5ICsxMjQxLDE5IEBACiAgIDxwdWJsaWMgdHlwZT0iYXR0ciIgbmFtZT0idGFiU3RyaXBFbmFibGVkIiBpZD0iMHgwMTAxMDJiZCIgLz4KIAogICA8cHVibGljIHR5cGU9ImlkIiBuYW1lPSJjdXN0b20iIGlkPSIweDAxMDIwMDJiIiAvPgotICAgIAorCiAgIDxwdWJsaWMgdHlwZT0iYW5pbSIgbmFtZT0iY3ljbGVfaW50ZXJwb2xhdG9yIiBpZD0iMHgwMTBhMDAwYyIgLz4KIAogPCEtLSA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLSAgICAgUmVzb3VyY2VzIGludHJvZHVjZWQgaW4ga3Jha2VuLgorICAgICBSZXNvdXJjZXMgaW50cm9kdWNlZCBpbiBHaW5nZXJicmVhZC4KICAgICAgPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09P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gICAgIHJldHVybiBBc3NldEZpbGVEZXNjcmlwdG9yLmZyb21NZW1vcnlGaWxlKG1lbW9yeUZpbGUpOworICAgICAgICAgICAgICAgICAgICByZXR1cm4gUGFyY2VsRmlsZURlc2NyaXB0b3IuZnJvbURhdGEoVEVTVF9CTE9CLCBudWxsKTsKICAgICAgICAgICAgICAgICB9IGNhdGNoIChJT0V4Y2VwdGlvbiBleCkgewogICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRmlsZU5vdEZvdW5kRXhjZXB0aW9uKCJFcnJvciByZWFkaW5nICIgKyB1cmwgKyAiOiIgKyBleC50b1N0cmluZygpKTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICBjYXNlIEZJTEU6CiAgICAgICAgICAgICAgICAgRmlsZSBmaWxlID0gZ2V0Q29udGV4dCgpLmdldEZpbGVTdHJlYW1QYXRoKERBVEFfRklMRSk7Ci0gICAgICAgICAgICAgICAgUGFyY2VsRmlsZURlc2NyaXB0b3IgZmQgPQotICAgICAgICAgICAgICAgICAgICAgICAgUGFyY2VsRmlsZURlc2NyaXB0b3Iub3BlbihmaWxlLCBQYXJjZWxGaWxlRGVzY3JpcHRvci5NT0RFX1JFQURfT05MWSk7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBBc3NldEZpbGVEZXNjcmlwdG9yKGZkLCAwLCBBc3NldEZpbGVEZXNjcmlwdG9yLlVOS05PV05fTEVOR1RIKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gUGFyY2VsRmlsZURlc2NyaXB0b3Iub3BlbihmaWxlLCBQYXJjZWxGaWxlRGVzY3JpcHRvci5NT0RFX1JFQURfT05MWSk7CiAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgIHRocm93IG5ldyBGaWxlTm90Rm91bmRFeGNlcHRpb24oIk5vIGZpbGVzIHN1cHBvcnRlZCBieSBwcm92aWRlciBhdCAiICsgdXJsKTsKICAgICAgICAgfQogICAgIH0KIAotICAgIH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BBbmRyb2lkVGVzdENhc2UgaW1wbGVtZW50cyBQZXJmb3JtYW5jZVRlc3RDYXNlIHsKIAogICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIFN0cmluZyBzU3RyaW5nMSA9ICJ0aGlzIGlzIGEgdGVzdCI7CkBAIC05Miw0MyArODksNiBAQAogICAgIH0KIAogICAgIEBNZWRpdW1UZXN0Ci0gICAgcHVibGljIHZvaWQgdGVzdEN1cnNvclVwZGF0ZSgpIHsKLSAgICAgICAgbURhdGFiYXNlLmV4ZWNTUUwoCi0gICAgICAgICAgICAiQ1JFQVRFIFRBQkxFIHRlc3QgKF9pZCBJTlRFR0VSIFBSSU1BUlkgS0VZLCBkIElOVEVHRVIsIHMgSU5URUdFUik7Iik7Ci0gICAgICAgIGZvcihpbnQgaSA9IDA7IGkgPCAyMDsgaSsrKSB7Ci0gICAgICAgICAgICBtRGF0YWJhc2UuZXhlY1NRTCgiSU5TRVJUIElOVE8gdGVzdCAoZCwgcykgVkFMVUVTICgiICsgaSArIAotICAgICAgICAgICAgICAgICIsIiArIGklMiArICIpOyIpOwotICAgICAgICB9Ci0gICAgICAgIAotICAgICAgICBDdXJzb3IgYyA9IG1EYXRhYmFzZS5xdWVyeSgidGVzdCIsIG51bGwsICJzID0gMCIsIG51bGwsIG51bGwsIG51bGwsIG51bGwpOwotICAgICAgICBpbnQgZENvbCA9IGMuZ2V0Q29sdW1uSW5kZXhPclRocm93KCJkIik7Ci0gICAgICAgIGludCBzQ29sID0gYy5nZXRDb2x1bW5JbmRleE9yVGhyb3coInMiKTsKLSAgICAgICAgCi0gICAgICAgIGludCBjb3VudCA9IDA7Ci0gICAgICAgIHdoaWxlIChjLm1vdmVUb05leHQoKSkgewotICAgICAgICAgICAgYXNzZXJ0VHJ1ZShjLnVwZGF0ZUludChkQ29sLCAzKSk7Ci0gICAgICAgICAgICBjb3VudCsrOwotICAgICAgICB9Ci0gICAgICAgIGFzc2VydEVxdWFscygxMCwgY291bnQpOwotICAgICAgIC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FMKCJpbnNlcnQgaW50byBDIHZhbHVlcyg5MDIpOyIpOworICAgICAgICBTdHJpbmcgcyA9ICJzZWxlY3QgaSBmcm9tIEEgd2hlcmUgaSA+IDIgIiArCisgICAgICAgICAgICAgICAgIlVOSU9OIHNlbGVjdCBrIGZyb20gQiB3aGVyZSBrID4gMjAxICIgKworICAgICAgICAgICAgICAgICJVTklPTiBzZWxlY3QgbiBmcm9tIEMgd2hlcmUgbiAhPTkwMDsiOworICAgICAgICBDdXJzb3IgYyA9IG1EYXRhYmFzZS5yYXdRdWVyeShzLCBudWxsKTsKKyAgICAgICAgaW50IG4gPSBjLmdldENvdW50KCk7CisgICAgICAgIGMuY2xvc2UoKTsKKyAgICAgICAgU3RyaW5nIHMxID0gInNlbGVjdCBpIGZyb20gQSB3aGVyZSBpID4gPyAiICsKKyAgICAgICAgICAgICAgICAiVU5JT04gc2VsZWN0IGsgZnJvbSBCIHdoZXJlIGsgPiA/ICIgKworICAgICAgICAgICAgICAgICJVTklPTiBzZWxlY3QgbiBmcm9tIEMgd2hlcmUgbiAhPSA/OyI7CisgICAgICAgIEN1cnNvciBjMSA9IG1EYXRhYmFzZS5yYXdRdWVyeShzMSwgbmV3IFN0cmluZ1tdeyIyIiwgIjIwMSIsICI5MDAifSk7CisgICAgICAgIGFzc2VydEVxdWFscyhuLCBjMS5nZXRDb3VudCgpKTsKKyAgICAgICAgYzEuY2xvc2UoKTsKKyAgICB9CisKICAgICAvKioKICAgICAgKiBUaGlzIHRlc3QgaXMgYXZhaWxhYmxlIG9ubHkgd2hlbiB0aGUgcGxhdGZvcm0gaGFzIGEgbG9jYWxlIHdpdGggdGhlIGxhbmd1YWdlICJqYSIuCiAgICAgICogSXQgZmluaXNoZXMgd2l0aG91dCBmYWlsdXJlIHdoZW4gaXQgaXMgbm90IGF2YWlsYWJsZS4gIApAQCAtMTEwOCw1ICsxMDU5LDExMyBAQAogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KICAgICAgICAgfQot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HRoZXkgYXJlIGFsbCByZW1vdmVkLgorICAgICAgICBpbnQgTiA9IDU7CisgICAgICAgIEFycmF5TGlzdDxTdHJpbmc+IGF0dGFjaGVkRGJGaWxlcyA9IG5ldyBBcnJheUxpc3Q8U3RyaW5nPihOKTsKKyAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBOOyBpKyspIHsKKyAgICAgICAgICAgIGF0dGFjaGVkRGJGaWxlcy5hZGQobURhdGFiYXNlLmdldFBhdGgoKSArIGkpOworICAgICAgICB9CisgICAgICAgIGRiT2JqID0gU1FMaXRlRGF0YWJhc2Uub3Blbk9yQ3JlYXRlRGF0YWJhc2UobURhdGFiYXNlLmdldFBhdGgoKSwgbnVsbCk7CisgICAgICAgIGRiT2JqLmV4ZWNTUUwoIkFUVEFDSCBEQVRBQkFTRSAnOm1lbW9yeTonIGFzIG1lbW9yeURiIik7CisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgTjsgaSsrKSB7CisgICAgICAgICAgICBkYk9iai5leGVjU1FMKCJBVFRBQ0ggREFUQUJBU0UgJyIgKyAgYXR0YWNoZWREYkZpbGVzLmdldChpKSArICInIGFzIGF0dGFjaGVkRGIiICsgaSk7CisgICAgICAgIH0KKyAgICAgICAgYXNzZXJ0VHJ1ZShkYmZpbGUuZXhpc3RzKCkpOworICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IE47IGkrKykgeworICAgICAgICAgICAgYXNzZXJ0VHJ1ZShuZXcgRmlsZShhdHRhY2hlZERiRmlsZXMuZ2V0KGkpKS5leGlzdHMoKSk7CisgICAgICAgIH0KKyAgICAgICAgYXNzZXJ0Tm90TnVsbChkYk9iaik7CisgICAgICAgIGFzc2VydFRydWUoZGJPYmouaXNPcGVuKCkpOworICAgICAgICBhdHRhY2hlZERicyA9IGRiT2JqLmdldEF0dGFjaGVkRGJzKCk7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBlcnJvckhhbmRsZXIub25Db3JydXB0aW9uKGRiT2Jq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TaXplKCkpOworICAgICAgICBhc3NlcnRFcXVhbHMoTUFYX0NPTk4sIG1UZXN0UG9vbC5nZXRNYXhQb29sU2l6ZSgpKTsKKworICAgICAgICBhc3NlcnRGYWxzZShtVGVzdFBvb2wuaXNEYXRhYmFzZU9iakZyZWUoZGIxKSk7CisgICAgICAgIGFzc2VydEZhbHNlKGRiMS5lcXVhbHMoZGIpKTsKKworICAgICAgICBtVGVzdFBvb2wucmVsZWFzZShkYik7CisgICAgICAgIGFzc2VydEVxdWFscygxLCBtVGVzdFBvb2wuZ2V0RnJlZVBvb2xTaXplKCkpOworICAgICAgICBhc3NlcnRFcXVhbHMoMiwgbVRlc3RQb29sLmdldFNpemUoKSk7CisgICAgICAgIGFzc2VydEVxdWFscyhNQVhfQ09OTiwgbVRlc3RQb29sLmdldE1heFBvb2xTaXplKCkpOworCisgICAgICAgIG1UZXN0UG9vbC5yZWxlYXNlKGRiMSk7CisgICAgICAgIGFzc2VydEVxdWFscygyLCBtVGVzdFBvb2wuZ2V0RnJlZVBvb2xTaXplKCkpOworICAgICAgICBhc3NlcnRFcXVhbHMoMiwgbVRlc3RQb29sLmdldFNpemUoKSk7CisgICAgICAgIGFzc2VydEVxdWFscyhNQVhfQ09OTiwgbVRlc3RQb29sLmdldE1heFBvb2xTaXplKCkpOworICAgIH0KKworICAgIC8qKgorICAgICAqIGdldCB0aGUgc2FtZSBjb25uZWN0aW9uIE4gdGltZXMgYW5kIHJlbGVhc2UgaXQgTiB0aW1lcy4KKyAgICAgKiB0aGlzIHRlc3RzIERhdGFiYXNlQ29ubmVjdGlvblBvb2wuUG9vbE9iai5tTnVtSG9sZGVycworICAgICAqLworICAgIEBTbWFsbFRlc3QKKyAgICBwdWJsaWMgdm9pZCB0ZXN0R2V0U2FtZUNvbm5OdGltZXNBbmRSZWxlYXNlSXROdGltZXMoKSB7CisgICAgICAgIG1UZXN0UG9vbC5zZXRNYXhQb29sU2l6ZShNQVhfQ09OTik7CisgICAgICAgIGFzc2VydEV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ICAgICAgICBhc3NlcnRFcXVhbHMoTUFYX0NPTk4sIG1UZXN0UG9vbC5nZXRTaXplKCkpOworICAgICAgICBhc3NlcnRFcXVhbHMoTUFYX0NPTk4sIG1UZXN0UG9vbC5nZXRNYXhQb29sU2l6ZSgpKTsKKyAgICAgICAgLy8gZ2V0IHRoZSBzYW1lIGNvbm5lY3Rpb24gTiB0aW1lcyBtb3JlCisgICAgICAgIGludCBOID0gMTAwOworICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IE47IGkrKykgeworICAgICAgICAgICAgU1FMaXRlRGF0YWJhc2UgZGIyID0gbVRlc3RQb29sLmdldCh0ZXN0U3FsKTsKKyAgICAgICAgICAgIGFzc2VydEVxdWFscyhkYjEsIGRiMik7CisgICAgICAgICAgICBhc3NlcnRGYWxzZShtVGVzdFBvb2wuaXNEYXRhYmFzZU9iakZyZWUoZGIyKSk7CisgICAgICAgICAgICAvLyBudW1Ib2xkZXJzIGZvciB0aGlzIG9iamVjdCBzaG91bGQgYmUgbm93IHVwIGJ5IDEKKyAgICAgICAgICAgIGludCBwcmV2ID0gbnVtSG9sZGVyczsKKyAgICAgICAgICAgIG51bUhvbGRlcnMgPSBwb29sT2JqLmdldE51bUhvbGRlcnMoKTsKKyAgICAgICAgICAgIGFzc2VydEVxdWFscyhwcmV2ICsgMSwgbnVtSG9sZGVycyk7CisgICAgICAgIH0KKyAgICAgICAgLy8gcmVsZWFzZSBpdCBOIHRpbWVzCisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgTjsgaSsrKSB7CisgICAgICAgICAgICBtVGVzdFBvb2wucmVsZWFzZShkYjEpOworICAgICAgICAgICAgaW50IHByZXYgPSBudW1Ib2xkZXJzOworICAgICAgICAgICAgbnVtSG9sZGVycyA9IHBvb2xPYmouZ2V0TnVtSG9sZGVycygpOworICAgICAgICAgICAgYXNzZXJ0RXF1YWxzKHByZXYgLSAxLCBudW1Ib2xkZXJzKTsKKyAgICAgICAgICAgIGFzc2VydEZhbH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IGRiID0gbVRlc3RQb29sLmdldChURVNUX1NRTCArIGkpOworICAgICAgICAgICAgYXNzZXJ0VHJ1ZShkYk1hcC5jb250YWluc0tleShkYikpOworICAgICAgICAgICAgaW50IGsgPSBkYk1hcC5nZXQoZGIpOworICAgICAgICAgICAgZGJNYXAucHV0KGRiLCArK2spOworICAgICAgICB9CisgICAgICAgIGFzc2VydEVxdWFscygwLCBtVGVzdFBvb2wuZ2V0RnJlZVBvb2xTaXplKCkpOworICAgICAgICBhc3NlcnRFcXVhbHMoTUFYX0NPTk4sIG1UZXN0UG9vbC5nZXRTaXplKCkpOworICAgICAgICBhc3NlcnRFcXVhbHMoTUFYX0NPTk4sIG1UZXN0UG9vbC5nZXRNYXhQb29sU2l6ZSgpKTsKKyAgICAgICAgLy8gcHJpbnQgdGhlIGRpc3RyaWJ1dGlvbiBvZiB0aGUgZGF0YWJhc2UgY29ubmVjdGlvbiBoYW5kbGVzIHJlY2VpdmVkLCBzaG91bGQgYmUgdW5pZm9ybS4KKyAgICAgICAgZm9yIChTUUxpdGVEYXRhYmFzZSBkIDogZGJNYXAua2V5U2V0KCkpIHsKKyAgICAgICAgICAgIExvZy5pKFRBRywgImNvbm5lY3Rpb24gIyAiICsgZC5tQ29ubmVjdGlvbk51bSArICIsIG51bUhvbGRlcnM6ICIgKyBkYk1hcC5nZXQoZCkpOworICAgICAgICB9CisgICAgICAgIC8vIHByaW50IHRoZSBwb29sIGluZm8KKyAgICAgICAgTG9nLmkoVEFHLCBtVGVzdFBvb2wudG9TdHJpbmcoKSk7CisgICAgICAgIC8vIHJlbGVhc2UgYWxsCisgICAgICAgIGZvciAoU1FMaXRlRGF0YWJhc2UgZCA6IGRiTWFwLmtleVNldCgpKSB7CisgICAgICAgICAgICBpbnQgbnVtID0gZGJNYXAuZ2V0KGQpOworICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBudW07IGkrKykgeworICAgICAgICAgICAgICAgIG1UZXN0UG9vbC5yZWxlYXNlKGQ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GlvbiB7CisgICAgICAgIGRiVGVhcmRvd24oKTsKKyAgICAgICAgc3VwZXIudGVhckRvd24oKTsKKyAgICB9CisKKyAgICBwcml2YXRlIHZvaWQgZGJUZWFyZG93bigpIHRocm93cyBFeGNlcHRpb24geworICAgICAgICBtRGF0YWJhc2UuY2xvc2UoKTsKKyAgICAgICAgbURhdGFiYXNlRmlsZS5kZWxldGUoKTsKKyAgICB9CisKKyAgICBwcml2YXRlIHZvaWQgZGJTZXRVcCgpIHRocm93cyBFeGNlcHRpb24geworICAgICAgICBGaWxlIGRiRGlyID0gZ2V0Q29udGV4dCgpLmdldERpcih0aGlzLmdldENsYXNzKCkuZ2V0TmFtZSgpLCBDb250ZXh0Lk1PREVfUFJJVkFURSk7CisgICAgICAgIG1EYXRhYmFzZUZpbGUgPSBuZXcgRmlsZShkYkRpciwgImRhdGFiYXNlX3Rlc3QuZGIiKTsKKyAgICAgICAgaWYgKG1EYXRhYmFzZUZpbGUuZXhpc3RzKCkpIHsKKyAgICAgICAgICAgIG1EYXRhYmFzZUZpbGUuZGVsZXRlKCk7CisgICAgICAgIH0KKyAgICAgICAgbURhdGFiYXNlID0gU1FMaXRlRGF0YWJhc2Uub3Blbk9yQ3JlYXRlRGF0YWJhc2UobURhdGFiYXNlRmlsZS5nZXRQYXRoKCksIG51bGwsIG51bGwpOworICAgICAgICBhc3NlcnROb3ROdWxsKG1EYXRhYmFzZSk7CisgICAgICAgIG1EYXRhYmFzZS5zZXRWZXJzaW9uKENVUlJFTlRfREFUQUJBU0VfVkVSU0lPTik7CisgICAgfQorCisgICAgQFNtYWxsVGVzdAorICAgIHB1YmxpYyB2b2lkIHRlc3RFbmFibGVXcml0ZUFoZWFkTG9nZ2luZygpIHsKKyAgICAgICAgbURhdGFiYXNlLmRpc2FibGVXcml0ZUFoZWFkTG9nZ2luZygpOworICAgICAgICBhc3NlcnROdWxsKG1EYXRhYmFzZS5tQ29ubmVjdGlvblBvb2wpOworICAgICAgICBtRGF0YWJhc2Uu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xdWVyeSgpOworICAgICAgICBhc3NlcnRFcXVhbHMoMSwgYy5nZXRDb3VudCgpKTsKKyAgICAgICAgYy5tb3ZlVG9OZXh0KCk7CisgICAgICAgIGFzc2VydEVxdWFscygxLCBjLmdldEludCgwKSk7CisgICAgICAgIGMuY2xvc2UoKTsKKyAgICB9CisKKyAgICBAU21hbGxUZXN0CisgICAgcHVibGljIHZvaWQgdGVzdFNldENvbm5lY3Rpb25Qb29sU2l6ZSgpIHsKKyAgICAgICAgbURhdGFiYXNlLmVuYWJsZVdyaXRlQWhlYWRMb2dnaW5nKCk7CisgICAgICAgIC8vIGNhbid0IHNldCBwb29sIHNpemUgdG8gemVybworICAgICAgICB0cnkgeworICAgICAgICAgICAgbURhdGFiYXNlLnNldENvbm5lY3Rpb25Qb29sU2l6ZSgwKTsKKyAgICAgICAgICAgIGZhaWwoIklsbGVnYWxTdGF0ZUV4Y2VwdGlvbiBleHBlY3RlZCIpOworICAgICAgICB9IGNhdGNoIChJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgYXNzZXJ0VHJ1ZShlLmdldE1lc3NhZ2UoKS5jb250YWlucygibGVzcyB0aGFuIHRoZSBjdXJyZW50IG1heCB2YWx1ZSIpKTsKKyAgICAgICAgfQorICAgICAgICAvLyBzZXQgcG9vbCBzaXplIHRvIGEgdmFsaWQgdmFsdWUKKyAgICAgICAgbURhdGFiYXNlLnNldENvbm5lY3Rpb25Qb29sU2l6ZSgxMCk7CisgICAgICAgIGFzc2VydEVxdWFscygxMCwgbURhdGFiYXNlLm1Db25uZWN0aW9uUG9vbC5nZXRNYXhQb29sU2l6ZSgpKTsKKyAgICAgICAgLy8gY2FuJ3Qgc2V0IHBvb2wgc2l6ZSB0byA8IHRoZSB2YWx1ZSBhYm92ZQorICAgICAgICB0cnkgeworICAgICAgICAgICAgbURhdGFiYXNlLnNldENvbm5lY3Rpb25Qb29sU2l6ZSgxKTsKKyAgICAgICAgICAgIGZhaWwoI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IgKyBURVNUX1RBQkxFOworICAgICAgICBTUUxpdGVTdGF0ZW1lbnQgc3RtdCA9IG1EYXRhYmFzZS5jb21waWxlU3RhdGVtZW50KHNxbCk7CisgICAgICAgIGZpbmFsIGludCBleHBlY3RlZFZhbHVlID0gKHN0bXRUeXBlID09IERFTEVURSkgPyA0IDogNTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKGV4cGVjdGVkVmFsdWUsIHN0bXQuc2ltcGxlUXVlcnlGb3JMb25nKCkpOworICAgICAgICBzdG10LmNsb3NlKCk7CisgICAgICAgIEN1cnNvciBjID0gbURhdGFiYXNlLnJhd1F1ZXJ5KHNxbCwgbnVsbCk7CisgICAgICAgIGFzc2VydEVxdWFscygxLCBjLmdldENvdW50KCkpOworICAgICAgICBjLm1vdmVUb0ZpcnN0KCk7CisgICAgICAgIGFzc2VydEVxdWFscyhleHBlY3RlZFZhbHVlLCBjLmdldExvbmcoMCkpOworICAgICAgICBjLmNsb3NlKCk7CisKKyAgICAgICAgLy8gZG8gNSBtb3JlIGNoYW5nZXMgaW4gYSB0cmFuc2FjdGlvbiBidXQgZG8gYSBxdWVyeSBiZWZvcmUgYW5kIGFmdGVyIHRoZSBjb21taXQKKyAgICAgICAgbURhdGFiYXNlLmJlZ2luVHJhbnNhY3Rpb24oKTsKKyAgICAgICAgZm9yIChpbnQgaSA9IDEwOyBpIDwgMTU7IGkrKykgeworICAgICAgICAgICAgdmFsdWVzLnB1dCgiaSIsIGkpOworICAgICAgICAgICAgdmFsdWVzLnB1dCgiaiIsICJpIiArIFN5c3RlbS5jdXJyZW50VGltZU1pbGxpcygpKTsKKyAgICAgICAgICAgIG1EYXRhYmFzZS5pbnNlcnQoVEVTVF9UQUJMRSwgbnVsbCwgdmFsdWVzKTsKKyAgICAgICAgICAgIHN3aXRjaCAoc3RtdFR5cGUpIHsKKyAgICAgICAgICAgICAgICBjYXNlIFVQREFURToKKyAgICAgICAgICAgICAgICAgICAgdmFsdWVzLnB1dCgiaiIsICJ1IiArIFN5c3RlbS5jdXJyZW50VGltZU1pbGxpcygpKTsKKyAgICAgICAgICAgICAgICAgICAgbURhdGFiYXNlLnVwZGF0ZShURVNUX1RBQkxFLCB2YWx1ZXMsICJpID0gIiArIGksIG51bGwpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIERFTEVURToKKyAgICAgICAgICAgICAgICAgICAgbURhdGFiYXNlLmRlbGV0ZShURVNUX1RBQkxFLCAiaSA9IDEiLCBudWxsKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgbURhdGFiYXNlLnNldFRyYW5zYWN0aW9uU3VjY2Vzc2Z1bCgpOworICAgICAgICAvLyBkbyBhIHF1ZXJ5IGJlZm9yZSBjb21taXQgLSBzaG91bGQgc3RpbGwgaGF2ZSA1IHJvd3MKKyAgICAgICAgLy8gdGhpcyBxdWVyeSBzaG91bGQgcnVuIGluIGEgZGlmZmVyZW50IHRocmVhZCB0byBmb3JjZSBpdCB0byB1c2UgYSBkaWZmZXJlbnQgZGF0YWJhc2UKKyAgICAgICAgLy8gY29ubmVjdGlvbgorICAgICAgICBUaHJlYWQgdCA9IG5ldyBUaHJlYWQoKSB7CisgICAgICAgICAgICBAT3ZlcnJpZGUgcHVibGljIHZvaWQgcnVuKCkgeworICAgICAgICAgICAgICAgIFN0cmluZyBzcWwgPSAic2VsZWN0IGNvdW50KCopIGZyb20gIiArIFRFU1RfVEFCTEU7CisgICAgICAgICAgICAgICAgU1FMaXRlU3RhdGVtZW50IHN0bXQgPSBnZXREYigpLmNvbXBpbGVTdGF0ZW1lbnQoc3FsKTsKKyAgICAgICAgICAgICAgICBhc3NlcnRFcXVhbHMoZXhwZWN0ZWRWYWx1ZSwgc3RtdC5zaW1wbGVRdWVyeUZvckxvbmcoKSk7CisgICAgICAgICAgICAgICAgc3RtdC5jbG9zZSgpOworICAgICAgICAgICAgICAgIEN1cnNvciBjID0gZ2V0RGIoKS5yYXdRdWVyeShzcWwsIG51bGwpOworICAgICAgICAgICAgICAgIGFzc2VydEVxdWFscygxLCBjLmdldENvdW50KCkpOworICAgICAgICAgICAgICAgIGMubW92ZVRvRmlyc3QoKTsKKyAgICAgICAgICAgICAgICBhc3NlcnRFcXVhbHMoZXhwZWN0ZWRWYWx1ZSwgYy5nZXRMb25nKDApKTsKKyAgICAgICAgICAgICAgICBjLmNsb3NlKCk7CisgICAgICAgICAgICB9CisgICAgICAgIH07CisgICAgICAgIHQuc3RhcnQoKTsKKyAgICAgICAgLy8gd2FpdCB1bnRpbCB0aGUgYWJvdmUgdGhyZWFkIGlzIGRvbmUKKyAgICAgICAgdC5qb2luKCk7CisgICAgICAgIC8vIGNvbW1pdCBhbmQgdGhlbiBxdWVyeS4gc2hvdWxkIHNlZSBjaGFuZ2VzIGZyb20gdGhlIHRyYW5zYWN0aW9uCisgICAgICAgIG1EYXRhYmFzZS5lbmRUcmFuc2FjdGlvbigpOworICAgICAgICBzdG10ID0gbURhdGFiYXNlLmNvbXBpbGVTdGF0ZW1lbnQoc3FsKTsKKyAgICAgICAgZmluYWwgaW50IGV4cGVjdGVkVmFsdWUyID0gKHN0bXRUeXBlID09IERFTEVURSkgPyA5IDogMTA7CisgICAgICAgIGFzc2VydEVxdWFscyhleHBlY3RlZFZhbHVlMiwgc3RtdC5zaW1wbGVRdWVyeUZvckxvbmcoKSk7CisgICAgICAgIHN0bXQuY2xvc2UoKTsKKyAgICAgICAgYyA9IG1EYXRhYmFzZS5yYXdRdWVyeShzcWwsIG51bGwpOworICAgICAgICBhc3NlcnRFcXVhbHMoMSwgYy5nZXRDb3VudCgpKTsKKyAgICAgICAgYy5tb3ZlVG9GaXJzdCgpOworICAgICAgICBhc3NlcnRFcXVhbHMoZXhwZWN0ZWRWYWx1ZTIsIGMuZ2V0TG9uZygwKSk7CisgICAgICAgIGMuY2xvc2UoKTsKKyAgICB9CisgICAgcHJpdmF0ZSBzeW5ja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aXZhdGUgdm9pZCBydW5Db25uZWN0aW9uUG9vbFRlc3QoYm9vbGVhbiB1c2VXYWwpIHRocm93cyBFeGNlcHRpb24geworICAgICAgICBpbnQgTSA9IDM7CisgICAgICAgIFN0cmluZ0J1aWxkZXJbXSBidWZmID0gbmV3IFN0cmluZ0J1aWxkZXJbTV07CisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgTTsgaSsrKSB7CisgICAgICAgICAgICBpZiAodXNlV2FsKSB7CisgICAgICAgICAgICAgICAgLy8gc2V0IHVwIGNvbm5lY3Rpb24gcG9vbAorICAgICAgICAgICAgICAgIG1EYXRhYmFzZS5lbmFibGVXcml0ZUFoZWFkTG9nZ2luZygpOworICAgICAgICAgICAgICAgIG1EYXRhYmFzZS5zZXRDb25uZWN0aW9uUG9vbFNpemUoaSArIDEpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBtRGF0YWJhc2UuZGlzYWJsZVdyaXRlQWhlYWRMb2dnaW5nKCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBtRGF0YWJhc2UuZXhlY1NRTCgiQ1JFQVRFIFRBQkxFIHQxIChpIGludCwgaiBpbnQpOyIpOworICAgICAgICAgICAgbURhdGFiYXNlLmV4ZWNTUUwoIkNSRUFURSBUQUJMRSB0MiAoaSBpbnQsIGogaW50KTsiKTsKKyAgICAgICAgICAgIG1EYXRhYmFzZS5iZWdpblRyYW5zYWN0aW9uKCk7CisgICAgICAgICAgICBmb3IgKGludCBrID0gMDsgayA8IDU7IGsrKykgeworICAgICAgICAgICAgICAgIG1EYXRhYmFzZS5leGVjU1FMKCJpbnNlcnQgaW50byB0MSB2YWx1ZXMoPyw/KTsiLCBuZXcgU3RyaW5nW10ge2srIiIsIGsrIiJ9KTsKKyAgICAgICAgICAgICAgICBtRGF0YWJhc2UuZXhlY1NRTCgiaW5zZXJ0IGludG8gdDIgdmFsdWVzKD8sPyk7IiwgbmV3IFN0cmluZ1tdIHtrKyIiLCBrKyIifSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBtRGF0YWJhc2Uuc2V0VHJhbnNhY3Rpb25TdWNjZXNzZnVsKCk7CisgICAgICAgICAgICBtRGF0YWJhc2UuZW5kVHJhbnNhY3Rpb24oKTsKKworICAgICAgICAgICAgLy8gc3RhcnQgYSB3cml0ZXIKKyAgICAgICAgICAgIFdyaXRlciB3ID0gbmV3IFdyaXRlcihtRGF0YWJhc2UpOworCisgICAgICAgICAgICAvLyBpbml0aWFsaXplIGFuIGFycmF5IG9mIGNvdW50ZXJzIHRvIGJlIHBhc3NlZCB0byB0aGUgcmVhZGVycworICAgICAgICAgICAgUmVhZGVyIHIxID0gbmV3IFJlYWRlcihtRGF0YWJhc2UsICJ0MSIsIHcsIDApOworICAgICAgICAgICAgUmVhZGVyIHIyID0gbmV3IFJlYWRlcihtRGF0YWJhc2UsICJ0MiIsIHcsIDEpOworICAgICAgICAgICAgdy5zdGFydCgpOworICAgICAgICAgICAgcjEuc3RhcnQoKTsKKyAgICAgICAgICAgIHIyLnN0YXJ0KCk7CisKKyAgICAgICAgICAgIC8vIHdhaXQgZm9yIGFsbCB0aHJlYWRzIHRvIGRpZQorICAgICAgICAgICAgdy5qb2luKCk7CisgICAgICAgICAgICByMS5qb2luKCk7CisgICAgICAgICAgICByMi5qb2luKCk7CisKKyAgICAgICAgICAgIC8vIHByaW50IHRoZSBzdGF0cworICAgICAgICAgICAgaW50W11bXSBjb3VudHMgPSBnZXRDb3VudHMoKTsKKyAgICAgICAgICAgIGJ1ZmZbaV0gPSBuZXcgU3RyaW5nQnVpbGRlcigpOworICAgICAgICAgICAgYnVmZltpXS5hcHBlbmQoImNvbm5wb29sLXNpemUgPSAiKTsKKyAgICAgICAgICAgIGJ1ZmZbaV0uYXBwZW5kKGkgKyAxKTsKKyAgICAgICAgICAgIGJ1ZmZbaV0uYXBwZW5kKCIsIG51bSB4YWN0cyBieSB3cml0ZXIgPSAiKTsKKyAgICAgICAgICAgIGJ1ZmZbaV0uYXBwZW5kKGdldE51bVhhY3RzKCkpOworICAgICAgICAgICAgYnVmZltpXS5hcHBlbmQoIiwgbnVtLXJlYWRzLWluLXhhY3QvTk9ULWluLXhhY3QgYnkgcmVhZGVyMSA9ICIpOworICAgICAgICAgICAgYnVmZltpXS5hcHBlbmQoY291bnRzWzBdWzFdICsgIi8iICsgY291bnRzWzBdWzBdKTsKKyAgICAgICAgICAgIGJ1ZmZbaV0uYXBwZW5kKCIsIGJ5IHJlYWRlcjIgPSAiKTsKKyAgICAgICAgICAgIGJ1ZmZbaV0uYXBwZW5kKGNvdW50c1sxXVsxXSArICIvIiArIGNvdW50c1sxXVswXSk7CisKKyAgICAgICAgICAgIExvZy5pKFRBRywgImRvbmUgdGVzdGluZyBmb3IgY29ubi1wb29sLXNpemUgb2YgIiArIChpKzEpKTsKKworICAgICAgICAgICAgZGJUZWFyZG93bigpOworICAgICAgICAgICAgZGJTZXRVcCgpOworICAgICAgICB9CisgICAgICAgIExvZy5pKFRBRywgImR1cmF0aW9uIG9mIHRlc3QgIiArIFRJTUVfVE9fUlVOX1dBTF9URVNUX0ZPUiArICIgc2VjIik7CisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgTTsgaSsrKSB7CisgICAgICAgICAgICBMb2cuaShUQUcsIGJ1ZmZbaV0udG9TdHJpbmcoKSk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcml2YXRlIGJvb2xlYW4gaW5YYWN0ID0gZmFsc2U7CisgICAgcHJpdmF0ZSBpbnQgbnVtWGFjdHM7CisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IFRJTUVfVE9fUlVOX1dBTF9URVNUX0ZPUiA9IDE1OyAvLyBudW0gc2VjIHRoaXMgdGVzdCBzaG91bGQgcnVuCisgICAgcHJpdmF0ZSBpbnRbXVtdIGNvdW50cyA9IG5ldyBpbnRbMl1bMl07CisKKyAgICBwcml2YXRlIHN5bmNocm9uaXplZCBib29sZWFuIGluWGFjdCgpIHsKKyAgICAgICAgcmV0dXJuIGluWGFjdDsKKyAgICB9CisKKyAgICBwcml2YXRlIHN5bmNocm9uaXplZCB2b2lkIHNldEluWGFjdEZsYWcoYm9vbGVhbiBmbGFnKSB7CisgICAgICAgIGluWGFjdCA9IGZsYWc7CisgICAgfQorCisgICAgcHJpdmF0ZSBzeW5jaHJvbml6ZWQgdm9pZCBzZXRDb3VudHMoaW50IHJlYWRlck51bSwgaW50W10gbnVtUmVhZHMpIHsKKyAgICAgICAgY291bnRzW3JlYWRlck51bV1bMF0gPSBudW1SZWFkc1swXTsKKyAgICAgICAgY291bnRzW3JlYWRlck51bV1bMV0gPSBudW1SZWFkc1sxXTsKKyAgICB9CisKKyAgICBwcml2YXRlIHN5bmNocm9uaXplZCBpbnRbXVtdIGdldENvdW50cygpIHsKKyAgICAgICAgcmV0dXJuIGNvdW50czsKKyAgICB9CisKKyAgICBwcml2YXRlIHN5bmNocm9uaXplZCB2b2lkIHNldE51bVhhY3RzKGludCBudW0pIHsKKyAgICAgICAgbnVtWGFjdHMgPSBudW07CisgICAgfQorCisgICAgcHJpdmF0ZSBzeW5jaHJvbml6ZWQgaW50IGdldE51bVhhY3RzKCkgeworICAgICAgICByZXR1cm4gbnVtWGFjdHM7CisgICAgfQorCisgICAgcHJpdmF0ZSBjbGFzcyBXcml0ZXIgZXh0ZW5kcyBUaHJlYWQgeworICAgICAgICBwcml2YXRlIFNRTGl0ZURhdGFiYXNlIGRiID0gbnVsbDsKKyAgICAgICAgcHVibGljIFdyaXRlcihTUUxpdGVEYXRhYmFzZSBkYikgeworICAgICAgICAgICAgdGhpcy5kYiA9IGRiOworICAgICAgICB9CisgICAgICAgIEBPdmVycmlkZSBwdWJsaWMgdm9pZCBydW4oKSB7CisgICAgICAgICAgICAvLyBpbiBhIGxvb3AsIGZvciBOIHNlYywgZG8gdGhlIGZvbGxvd2luZworICAgICAgICAgICAgLy8gICAgQkVHSU4gdHJhbnNhY3Rpb24KKyAgICAgICAgICAgIC8vICAgIGluc2VydCBpbnRvIHRhYmxlIHQxLCB0MgorICAgICAgICAgICAgLy8gICAgQ29tbWl0CisgICAgICAgICAgICBsb25nIG5vdyA9IFN5c3RlbS5jdXJyZW50VGltZU1pbGxpcygpOworICAgICAgICAgICAgaW50IGs7CisgICAgICAgICAgICBmb3IgKGsgPSAwOyhTeXN0ZW0uY3VycmVudFRpbWVNaWxsaXMoKSAtIG5vdykgLyAxMDAwIDwgVElNRV9UT19SVU5fV0FMX1RFU1RfRk9SOyBrKyspIHsKKyAgICAgICAgICAgICAgICBkYi5iZWdpblRyYW5zYWN0aW9uTm9uRXhjbHVzaXZlKCk7CisgICAgICAgICAgICAgICAgc2V0SW5YYWN0RmxhZyh0cnVlKTsKKyAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IDEwOyBpKyspIHsKKyAgICAgICAgICAgICAgICAgICAgZGIuZXhlY1NRTCgiaW5zZXJ0IGludG8gdDEgdmFsdWVzKD8sPyk7IiwgbmV3IFN0cmluZ1tdIHtpKyIiLCBpKyIifSk7CisgICAgICAgICAgICAgICAgICAgIGRiLmV4ZWNTUUwoImluc2VydCBpbnRvIHQyIHZhbHVlcyg/LD8pOyIsIG5ldyBTdHJpbmdbXSB7aSsiIiwgaSsiIn0pOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBkYi5zZXRUcmFuc2FjdGlvblN1Y2Nlc3NmdWwoKTsKKyAgICAgICAgICAgICAgICBzZXRJblhhY3RGbGFnKGZhbHNlKTsKKyAgICAgICAgICAgICAgICBkYi5lbmRUcmFuc2FjdGlvbigpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgc2V0TnVtWGFjdHMoayk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcml2YXRlIGNsYXNzIFJlYWRlciBleHRlbmRzIFRocmVhZCB7CisgICAgICAgIHByaXZhdGUgU1FMaXRlRGF0YWJhc2UgZGIgPSBudWxsOworICAgICAgICBwcml2YXRlIFN0cmluZyB0YWJsZSA9IG51bGw7CisgICAgICAgIHByaXZhdGUgV3JpdGVyIHcgPSBudWxsOworICAgICAgICBwcml2YXRlIGludCByZWFkZXJOdW07CisgICAgICAgIHByaXZhdGUgaW50W10gbnVtUmVhZHMgPSBuZXcgaW50WzJdOworICAgICAgICBwdWJsaWMgUmVhZGVyKFNRTGl0ZURhdGFiYXNlIGRiLCBTdHJpbmcgdGFibGUsIFdyaXRlciB3LCBpbnQgcmVhZGVyTnVtKSB7CisgICAgICAgICAgICB0aGlzLmRiID0gZGI7CisgICAgICAgICAgICB0aGlzLnRhYmxlID0gdGFibGU7CisgICAgICAgICAgICB0aGlzLncgPSB3OworICAgICAgICAgICAgdGhpcy5yZWFkZXJOdW0gPSByZWFkZXJOdW07CisgICAgICAgIH0KKyAgICAgICAgQE92ZXJyaWRlIHB1YmxpYyB2b2lkIHJ1bigpIHsKKyAgICAgICAgICAgIC8vIHdoaWxlIHRoZSB3cml0ZSBpcyBhbGl2ZSwgaW4gYSBsb29wIGRvIHRoZSBxdWVyeSBvbiBhIHRhYmxlCisgICAgICAgICAgICB3aGlsZSAody5pc0FsaXZlKCkpIHsKKyAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IDEwOyBpKyspIHsKKyAgICAgICAgICAgICAgICAgICAgRGF0YWJhc2VVdGlscy5sb25nRm9yUXVlcnkoZGIsICJzZWxlY3QgY291bnQoKikgZnJvbSAiICsgdGhpcy50YWJsZSwgbnVsbCk7CisgICAgICAgICAgICAgICAgICAgIC8vIHVwZGF0ZSBjb3VudCBvZiByZWFkcworICAgICAgICAgICAgICAgICAgICBudW1SZWFkc1tpblhhY3QoKSA/IDEgOiAwXSArPSAxOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHNldENvdW50cyhyZWFkZXJOdW0sIG51bVJlYWRzKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyBzdGF0aWMgY2xhc3MgQ2xhc3NU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ChOKzEpdGggZW50cnksIG1ha2Ugc3VyZSAwdGggZW50cnkgaXMgY2xvc2VkCisgICAgICAgIEFycmF5TGlzdDxJbnRlZ2VyPiBzdG10T2JqcyA9IG5ldyBBcnJheUxpc3Q8SW50ZWdlcj4oKTsKKyAgICAgICAgQXJyYXlMaXN0PFN0cmluZz4gc3FsU3RyaW5ncyA9IG5ldyBBcnJheUxpc3Q8U3RyaW5nPigpOworICAgICAgICBpbnQgc3RtdDAgPSAwOworICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IE4rMTsgaSsrKSB7CisgICAgICAgICAgICBTdHJpbmcgcyA9ICJpbnNlcnQgaW50byB0ZXN0IHZhbHVlcygiICsgaSArICIsPyk7IjsKKyAgICAgICAgICAgIHNxbFN0cmluZ3MuYWRkKHMpOworICAgICAgICAgICAgQ2xhc3NUb1Rlc3RTcWxDb21waWxhdGlvbkFuZENhY2hpbmcgYyA9CisgICAgICAgICAgICAgICAgICAgIENsYXNzVG9UZXN0U3FsQ29tcGlsYXRpb25BbmRDYWNoaW5nLmNyZWF0ZShtRGF0YWJhc2UsIHMpOworICAgICAgICAgICAgaW50IG4gPSBjLmdldFNxbFN0YXRlbWVudElkKCk7CisgICAgICAgICAgICBzdG10T2Jqcy5hZGQoaSwgbik7CisgICAgICAgICAgICBpZiAoaSA9PSAwKSB7CisgICAgICAgICAgICAgICAgLy8gc2F2ZSB0aGUgc3RhdGVtZW50SWQgb2YgdGhpcyBvYmouIHdlIHdhbnQgdG8gbWFrZSBzdXJlIGl0IGlzIHRocm93biBvdXQgb2YKKyAgICAgICAgICAgICAgICAvLyB0aGUgY2FjaGUgYXQgdGhlIGVuZCBvZiB0aGlzIHRlc3QuCisgICAgICAgICAgICAgICAgc3RtdDAgPSBuOworICAgICAgICAgICAgfQorICAgICAgICAgICAgYy5jbG9zZSgpOworICAgICAgICB9CisgICAgICAgIC8vIGlzIDAndGggZW50cnkgb3V0IG9mIHRoZSBjYWNoZT8gaXQgc2hvdWxkIGJl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AgIC8qKgorICAgICAqIHRlc3QgdG8gbWFrZSBzdXJlIHRoZSBzdGF0ZW1lbnQgZmluYWxpemF0aW9ucyBhcmUgbm90IGRvbmUgcmlnaHQgYXdheSBidXQKKyAgICAgKiBwaWdneS1iYWNrZWQgb250byB0aGUgbmV4dCBzcWwgc3RhdGVtZW50IGV4ZWN1dGlvbiBvbiB0aGUgc2FtZSBkYXRhYmFzZS4KKyAgICAgKi8KKyAgICBAU21hbGxUZXN0CisgICAgcHVibGljIHZvaWQgdGVzdFN0YXRlbWVudENsb3NlKCkgeworICAgICAgICBjcmVhdGVUYWJsZUFuZENsZWFyQ2FjaGUoKTsKKyAgICAgICAgLy8gZmlsbCB1cCBzdGF0ZW1lbnQgY2FjaGUgaW4gbURhdGFiYXNlCisgICAgICAgIGludCBOID0gU1FMaXRlRGF0YWJhc2UuTUFYX1NRTF9DQUNIRV9TSVpFOworICAgICAgICBtRGF0YWJhc2Uuc2V0TWF4U3FsQ2FjaGVTaXplKE4pOworICAgICAgICBTUUxpdGVTdGF0ZW1lbnQgc3RtdDsKKyAgICAgICAgaW50IHN0bXQwSWQgPSAwOworICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IE47IGkgKyspIHsKKyAgICAgICAgICAgIENsYXNzVG9UZXN0U3FsQ29tcGlsYXRpb25BbmRDYWNoaW5nIGMgPQorICAgICAgICAgICAgICAgICAgICBDbGFzc1RvVGVzdFNxbENvbXBpbGF0aW9uQW5kQ2FjaGluZy5jcmVhdGUobURhdGFiYXNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICJpbnNlcnQgaW50byB0ZXN0IHZhbHVlcygiICsgaSArICIsID8pOyIpOworICAgICAgICAgICAgLy8ga2VlcCB0cmFjayBvZiAwdGggZW50cnkKKyAgICAgICAgICAgIGlmIChpID09IDApIHsKKyAgICAgICAgICAgICAgICBzdG10MElkID0gYy5nZXRTcWxTdGF0ZW1lbnRJZCgpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgYy5j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iLCA/KTsiKTsKKyAgICAgICAgICAgICAgICAgICAgLy8ga2VlcCB0cmFjayBvZiAwdGggZW50cnkKKyAgICAgICAgICAgICAgICAgICAgaWYgKGkgPT0gMCkgeworICAgICAgICAgICAgICAgICAgICAgICAgc3RtdDBJZCA9IGMuZ2V0U3FsU3RhdGVtZW50SWQoKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBjLmNsb3NlKCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9OworICAgICAgICB0MS5zdGFydCgpOworICAgICAgICAvLyB3YWl0IGZvciB0aGUgdGhyZWFkIHRvIGZpbmlzaAorICAgICAgICB0MS5qb2luKCk7CisgICAgICAgIC8vIG1EYXRhYmFzZSBzaG91bGRuJ3QgaGF2ZSBhbnkgc3RhdGVtZW50cyB0byBiZSByZWxlYXNlZAorICAgICAgICBhc3NlcnRFcXVhbHMoMCwgbURhdGFiYXNlLmdldFF1ZXVlZFVwU3RtdExpc3QoKS5zaXplKCkpOworCisgICAgICAgIC8vIGFkZCBvbmUgbW9yZSB0byB0aGUgY2FjaGUgLSBhbmQgdGhlIGFib3ZlICdzdG10MElkJyBzaG91bGQgZmFsbCBvdXQgb2YgY2FjaGUKKyAgICAgICAgLy8ganVzdCBmb3IgdGhlIGhlY2sgb2YgaXQsIGRvIGl0IGluIGEgc2VwYXJhdGUgdGhyZWFkCisgICAgICAgIFRocmVhZCB0MiA9IG5ldyBUaHJlYWQoKSB7CisgICAgICAgICAgICBAT3ZlcnJpZGUgcHVibGljIHZvaWQgcnVuKCkgeworICAgICAgICAgICAgICAgIENsYXNzVG9UZXN0U3FsQ29tcGlsYXRpb25BbmRDYWNoaW5nIHN0bXQxID0KKyAgICAgICAgICAgICAgICAgICAgQ2xhc3NUb1Rlc3RTcWxDb21waWxhdGlvbkFuZENhY2hpbmcuY3JlYXRlKGdldERiKCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgImluc2VydCB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RJZHMgPSBnZXREYigpLmdldFF1ZXVlZFVwU3RtdExpc3QoKTsKKyAgICAgICAgYXNzZXJ0RmFsc2Uoc3RhdGVtZW50SWRzLmNvbnRhaW5zKGdldFN0bXQwSWQoKSkpOworICAgIH0KKworICAgIHByaXZhdGUgdm9sYXRpbGUgaW50IHN0bXQwSWQgPSAwOworICAgIHByaXZhdGUgc3luY2hyb25pemVkIGludCBnZXRTdG10MElkKCkgeworICAgICAgICByZXR1cm4gdGhpcy5zdG10MElkOworICAgIH0KKworICAgIC8qKgorICAgICAqIHNhbWUgYXMgYWJvdmUgLSBleGNlcHQgdGhhdCB0aGUgcXVldWUgb2Ygc3RhdGVtZW50cyB0byBiZSBmaW5hbGl6ZWQgYXJlIGZpbmFsaXplZAorICAgICAqIGJ5IGRhdGFiYXNlIGNsb3NlKCkgb3BlcmF0aW9uLgorICAgICAqLworICAgIEBMYXJnZVRlc3QKKyAgICBwdWJsaWMgdm9pZCB0ZXN0U3RhdGVtZW50Q2xvc2VCeURiQ2xvc2UoKSB0aHJvd3MgSW50ZXJydXB0ZWRFeGNlcHRpb24geworICAgICAgICBjcmVhdGVUYWJsZUFuZENsZWFyQ2FjaGUoKTsKKyAgICAgICAgLy8gZmlsbCB1cCBzdGF0ZW1lbnQgY2FjaGUgaW4gbURhdGFiYXNlIGluIGEgdGhyZWFkCisgICAgICAgIFRocmVhZCB0MSA9IG5ldyBUaHJlYWQoKSB7CisgICAgICAgICAgICBAT3ZlcnJpZGUgcHVibGljIHZvaWQgcnVuKCkgeworICAgICAgICAgICAgICAgIGludCBOID0gU1FMaXRlRGF0YWJhc2UuTUFYX1NRTF9DQUNIRV9TSVpFOworICAgICAgICAgICAgICAgIGdldERiKCkuc2V0TWF4U3FsQ2FjaGVTaXplKE4pOworICAgICAgICAgICAgICAgIFNRTGl0ZVN0YXRlbWVudCBzdG10OworICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgTjsgaSArKykgeworICAgICAgICAgICAgICAgICAgICBDbGFzc1RvVGVzdFNxbENvbXBpbGF0aW9uQW5kQ2FjaGluZyBjID0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBDbGFzc1RvVGVzdFNxbENvbXBpbGF0aW9uQW5kQ2FjaGluZy5jcmVhdGUoZ2V0RGIoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJpbnNlcnQgaW50byB0ZXN0IHZhbHVlcygiICsgaSArICIsID8pOyIpOworICAgICAgICAgICAgICAgICAgICAvLyBrZWVwIHRyYWNrIG9mIDB0aCBlbnRyeQorICAgICAgICAgICAgICAgICAgICBpZiAoaSA9PSAwKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBzdG10MElkID0gYy5nZXRTcWxTdGF0ZW1lbnRJZCgpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGMuY2xvc2UoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH07CisgICAgICAgIHQxLnN0YXJ0KCk7CisgICAgICAgIC8vIHdhaXQgZm9yIHRoZSB0aHJlYWQgdG8gZmluaXNoCisgICAgICAgIHQxLmpvaW4oKTsKKworICAgICAgICAvLyBhZGQgb25lIG1vcmUgdG8gdGhlIGNhY2hlIC0gYW5kIHRoZSBhYm92ZSAnc3RtdDBJZCcgc2hvdWxkIGZhbGwgb3V0IG9mIGNhY2hlCisgICAgICAgIC8vIGp1c3QgZm9yIHRoZSBoZWNrIG9mIGl0LCBkbyBpdCBpbiBhIHNlcGFyYXRlIHRocmVhZAorICAgICAgICBUaHJlYWQgdDIgPSBuZXcgVGhyZWFkKCkgeworICAgICAgICAgICAgQE92ZXJyaWRlIHB1YmxpYyB2b2lkIHJ1bigpIHsKKyAgICAgICAgICAgICAgICBDbGFzc1RvVGVzdFNxbENvbXBpbGF0aW9uQW5kQ2FjaGluZyBzdG10MSA9CisgICAgICAgICAgICAgICAgICAgICAgICBDbGFzc1RvVGVzdFNxbENvbXBpbGF0aW9uQW5kQ2FjaGluZy5jcmVhdGUoZ2V0RGIoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImluc2VydCBpbnRvIHRlc3QgdmFsdWVzKDEwMCwgPyk7Iik7CisgICAgICAgICAgICAgICAgc3RtdDEuYmluZExvbmcoMSwgMSk7CisgICAgICAgICAgICAgICAgc3RtdDEuY2xvc2UoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfTsKKyAgICAgICAgdDIuc3RhcnQoKTsKKyAgICAgICAgdDIuam9pbigpOworCisgICAgICAgIC8vIGNsb3NlKCkgaW4gdGhlIGFib3ZlIHRocmVhZCBzaG91bGQgaGF2ZSBxdWV1ZWRVcCB0aGUgc3RhdGVtZW50IGZvciBmaW5hbGl6YXRpb24KKyAgICAgICAgQXJyYXlMaXN0PEludGVnZXI+IHN0YXRlbWVudElkcyA9IGdldERiKCkuZ2V0UXVldWVkVXBTdG10TGlzdCgpOworICAgICAgICBhc3NlcnRUcnVlKGdldFN0bXQwSWQoKSA+IDApOworICAgICAgICBhc3NlcnRUcnVlKHN0YXRlbWVudElkcy5jb250YWlucyhzdG10MElkKSk7CisgICAgICAgIGFzc2VydEVxdWFscygxLCBzdGF0ZW1lbnRJZHMuc2l6ZSgpKTsKKworICAgICAgICAvLyBjbG9zZSB0aGUgZGF0YWJhc2UuIGV2ZXJ5dGhpbmcgZnJvbSBtQ2xvc2VkU3RhdGVtZW50SWRzIGluIG1EYXRhYmFzZQorICAgICAgICAvLyBzaG91bGQgYmUgZmluYWxpemVkIGFuZCBjbGVhcmVkIGZyb20gdGhlIGxpc3QKKyAgICAgICAgLy8gYWdhaW4gZG8gaXQgaW4gYSBzZXBhcmF0ZSB0aHJlYWQKKyAgICAgICAgVGhyZWFkIHQzID0gbmV3IFRocmVhZCgpIHsKKyAgICAgICAgICAgIEBPdmVycmlkZSBwdWJsaWMgdm9pZCBydW4oKSB7CisgICAgICAgICAgICAgICAgZ2V0RGIoKS5jbG9zZS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gICAgICAgVGhyZWFkIHQgPSBuZXcgVGhyZWFkKCkgeworICAgICAgICAgICAgQE92ZXJyaWRlIHB1YmxpYyB2b2lkIHJ1bigpIHsKKyAgICAgICAgICAgICAgICBhc3NlcnRUcnVlKG1EYXRhYmFzZS5hbUlJblRyYW5zYWN0aW9uKCkpOworICAgICAgICAgICAgICAgIGFzc2VydEVxdWFscyg5OTksIERhdGFiYXNlVXRpbHMubG9uZ0ZvclF1ZXJ5KGdldERiKCksCisgICAgICAgICAgICAgICAgICAgICAgICAic2VsZWN0IGogZnJvbSAiICsgVEVTVF9UQUJMRSArICIgV0hFUkUgaSA9IDEwIiwgbnVsbCkpOworICAgICAgICAgICAgICAgIGFzc2VydFRydWUoZ2V0RGIoKS5pblRyYW5zYWN0aW9uKCkpOworICAgICAgICAgICAgICAgIGFzc2VydEZhbHNlKGdldERiKCkuaXNEYkxvY2tlZEJ5Q3VycmVudFRocmVhZCgpKTsKKyAgICAgICAgICAgICAgICBhc3NlcnRGYWxzZShnZXREYigpLmlzRGJMb2NrZWRCeU90aGVyVGhyZWFkcygpKTsKKyAgICAgICAgICAgICAgICBhc3NlcnRUcnVlKG1EYXRhYmFzZS5hbUlJblRyYW5zYWN0aW9uKCkpOworICAgICAgICAgICAgfQorICAgICAgICB9OworICAgICAgICB0LnN0YXJ0KCk7CisgICAgICAgIHQuam9pbigpOworICAgICAgICBhc3NlcnRUcnVlKG1EYXRhYmFzZS5hbUlJblRyYW5zYWN0aW9uKCkpOworICAgICAgICBhc3NlcnRUcnVlKG1EYXRhYmFzZS5pblRyYW5zYWN0aW9uKCkpOworICAgICAgICBhc3NlcnRGYWxzZShtRGF0YWJhc2UuaXNEYkxvY2tlZEJ5Q3VycmVudFRocmVhZCgpKTsKKyAgICAgICAgYXNzZXJ0RmFsc2UobURhdGFiYXNlLmlzRGJMb2NrZWRCeU90aGVyVGhyZWFkcygpKTsKKyAgICAgICAgbURhdGFiYXNlLmV4ZWNTUUwoc3RyKTsKKyAgICAgIC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W1pdHRlZCB5ZXQuCisgICAgICogICAgICAgICAgICAvLyBmaXggaXMgdG8gbWFrZSB0aGUgYWJvdmUgY3Vyc29yIHVzZSB0aGUgbWFpbiBkYXRhYmFzZSBjb25uZWN0aW9uIC0gYW5kIE5PVAorICAgICAqICAgICAgICAgICAgLy8gdGhlIHBvb2xlZCBkYXRhYmFzZSBjb25uZWN0aW9uCisgICAgICogICAgICAgICAgICBkYi5zZXRUcmFuc2FjdGlvblN1Y2Nlc3NmdWwoKQorICAgICAqICAgICAgICAgIH0gZmluYWxseSB7CisgICAgICogICAgICAgICAgICBkYi5lbmRUcmFuc2FjdGlvbigpCisgICAgICogICAgICAgICAgfQorICAgICAqCisgICAgICogQHRocm93cyBJbnRlcnJ1cHRlZEV4Y2VwdGlvbgorICAgICAqLworICAgIEBTbWFsbFRlc3QKKyAgICBwdWJsaWMgdm9pZCB0ZXN0VHJhbnNhY3Rpb25BbmRXYWxJbnRlcnBsYXkxKCkgdGhyb3dzIEludGVycnVwdGVkRXhjZXB0aW9uIHsKKyAgICAgICAgY3JlYXRlVGFibGVBbmRDbGVhckNhY2hlKCk7CisgICAgICAgIG1EYXRhYmFzZS5leGVjU1FMKCJJTlNFUlQgaW50byAiICsgVEVTVF9UQUJMRSArICIgdmFsdWVzKDEwLCA5OTkpOyIpOworICAgICAgICBTdHJpbmcgc3FsID0gInNlbGVjdCAqIGZyb20gIiArIFRFU1RfVEFCTEU7CisgICAgICAgIEN1cnNvciBjID0gbURhdGFiYXNlLnJhd1F1ZXJ5KHNxbCwgbnVsbCk7CisgICAgICAgIC8vIHNob3VsZCBoYXZlIDEgcm93IGluIHRoZSB0YWJsZQorICAgICAgICBhc3NlcnRFcXVhbHMoMSwgYy5nZXRDb3VudCgpKTsKKyAgICAgICAgbURhdGFiYXNlLmJlZ2luVHJhbnNhY3Rpb25Ob25FeGNsdXNpdmUoKTsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIG1EYXRhYmFzZS5leGVjU1FMKC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F2ZSAxIHJvdyBpbiB0aGUgdGFibGUKKyAgICAgICAgYXNzZXJ0RXF1YWxzKDEsIGMxLmdldENvdW50KCkpOworICAgICAgICBtRGF0YWJhc2UuYmVnaW5UcmFuc2FjdGlvbk5vbkV4Y2x1c2l2ZSgpOworICAgICAgICB0cnkgeworICAgICAgICAgICAgbURhdGFiYXNlLmV4ZWNTUUwoIklOU0VSVCBpbnRvICIgKyBURVNUX1RBQkxFICsgIiB2YWx1ZXMoMTAwLCA5OTA5KTsiKTsKKyAgICAgICAgICAgIGFzc2VydEVxdWFscygyLCBEYXRhYmFzZVV0aWxzLmxvbmdGb3JRdWVyeShtRGF0YWJhc2UsCisgICAgICAgICAgICAgICAgICAgICJzZWxlY3QgY291bnQoKikgZnJvbSAiICsgVEVTVF9UQUJMRSwgbnVsbCkpOworICAgICAgICAgICAgLy8gcXVlcnkgaW4gYSBkaWZmZXJlbnQgdGhyZWFkLiB0aGF0IGNhdXNlcyB0aGUgY3Vyc29yIHRvIHVzZSBhIHBvb2xlZCBjb25uZWN0aW9uCisgICAgICAgICAgICAvLyBhbmQgc2luY2UgdGhpcyB0aHJlYWQgaGFzbid0IGNvbW1pdHRlZCBpdHMgY2hhbmdlcywgdGhlIGN1cnNvciBzaG91bGQgc3RpbGwgc2VlIG9ubHkKKyAgICAgICAgICAgIC8vIDEgcm93CisgICAgICAgICAgICBUaHJlYWQgdCA9IG5ldyBUaHJlYWQoKSB7CisgICAgICAgICAgICAgICAgQE92ZXJyaWRlIHB1YmxpYyB2b2lkIHJ1bigpIHsKKyAgICAgICAgICAgICAgICAgICAgYzEucmVxdWVyeSgpOworICAgICAgICAgICAgICAgICAgICBhc3NlcnRFcXVhbHMoMSwgYzEuZ2V0Q291bnQoKSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfTsKKyAgICAgICAgICAgIHQuc3RhcnQoKTsKKyAgICAgICAgICAgIHQuam9pbigpOworICAgICAgICAgICAgLy8gc2hvdWxkIGJlIDIgcm93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AgICAgICAgICAgICAgICAgYXNzZXJ0RXF1YWxzKDEsIGMxLmdldENvdW50KCkpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH07CisgICAgICAgICAgICB0LnN0YXJ0KCk7CisgICAgICAgICAgICB0LmpvaW4oKTsKKyAgICAgICAgICAgIC8vIHNob3VsZCBiZSAyIHJvd3Mgbm93IC0gaW5jbHVkaW5nIHRoZSB0aGUgcm93IGluc2VydGVkIGFib3ZlCisgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICBtRGF0YWJhc2UuZXhlY1NRTCgiY29tbWl0Iik7CisgICAgICAgIH0KKyAgICAgICAgYzEuY2xvc2UoKTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBUaGlzIHRlc3QgaXMgc2FtZSBhcyB7QGxpbmsgI3Rlc3RUcmFuc2FjdGlvbkFuZFdhbEludGVycGxheTIoKX0gZXhjZXB0IHRoZSBmb2xsb3dpbmc6CisgICAgICogaW5zdGVhZCBvZiBjb21taXRpbmcgdGhlIGRhdGEsIGRvIHJvbGxiYWNrIGFuZCBtYWtlIHN1cmUgdGhlIGRhdGEgc2VlbiBieSB0aGUgcXVlcnkKKyAgICAgKiB3aXRoaW4gdGhlIHRyYW5zYWN0aW9uIGlzIG5vdyBnb25lLgorICAgICAqLworICAgIEBTbWFsbFRlc3QKKyAgICBwdWJsaWMgdm9pZCB0ZXN0VHJhbnNhY3Rpb25BbmRXYWxJbnRlcnBsYXkzKCkgdGhyb3dzIEludGVycnVwdGVkRXhjZXB0aW9uIHsKKyAgICAgICAgY3JlYXRlVGFibGVBbmRDbGVhckNhY2hlKCk7CisgICAgICAgIG1EYXRhYmFzZS5leGVjU1FMKCJJTlNFUlQgaW50byAiICsgVEVTVF9UQUJMRSArICIgdmFsdWVzKDEwLCA5OTkpOyIpOworICAgICAgICBTdHJpbmcgc3FsID0gInNlbGVjdCAqIGZyb20gIiArIFRFU1RfVEFCTEU7CisgICAgICAgIEN1cnNvciBjID0gb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JlZCBzdGF0ZW1lbnQKLSAgICAgICAgZmluYWwgU3RyaW5nIHN0bXQgPSAiU0VMRUNUICogRlJPTSB0ZXN0X3BzdG10IFdIRVJFIGkgPSA/IjsKLQotICAgICAgICAvLyBzdGFydCAyIHRocmVhZHMgdG8gZG8gcmVwZWF0ZWRseSBleGVjdXRlICJzdG10IgotICAgICAgICAvLyBzaW5jZSB0aGVzZSAyIHRocmVhZHMgYXJlIGV4ZWN1dGluZyB0aGUgc2FtZSBzcWwsIHRoZXkgZWFjaCBzaG91bGQgZ2V0Ci0gICAgICAgIC8vIHRoZWlyIG93biBjb3B5IGFuZAotICAgICAgICAvLyB0aGVyZSBTSE9VTEQgTk9UIGJlIGFuIGVycm9yIGZyb20gc3FsaXRlOiAicHJlcGFyZWQgc3RhdGVtZW50IGlzIGJ1c3kiCi0gICAgICAgIGNsYXNzIFJ1blN0bXRUaHJlYWQgZXh0ZW5kcyBUaHJlYWQgewotICAgICAgICAgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IE4gPSAxMDAwOwotICAgICAgICAgICAgQE92ZXJyaWRlIHB1YmxpYyB2b2lkIHJ1bigpIHsKLSAgICAgICAgICAgICAgICBpbnQgaSA9IDA7Ci0gICAgICAgICAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgICAgICAgICAgLy8gZXhlY3V0ZSBtYW55IHRpbWVzCi0gICAgICAgICAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBOOyBpKyspIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIFNRTGl0ZVN0YXRlbWVudCBzMSA9IG1EYXRhYmFzZS5jb21waWxlU3RhdGVtZW50KHN0bXQpOwotICAgICAgICAgICAgICAgICAgICAgICAgczEuYmluZExvbmcoMSwgaSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBzMS5leGVjdXRlKCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBzMS5jbG9zZSgpOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICA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BmaW5hbCBTdHJpbmcgc3RtdCA9ICJTRUxFQ1QgKiBGUk9NIHRlc3RfcHN0bXQgV0hFUkUgaSA9ID8iOworICAgICAgICBjbGFzcyBSdW5TdG10VGhyZWFkIGV4dGVuZHMgVGhyZWFkIHsKKyAgICAgICAgICAgIEBPdmVycmlkZSBwdWJsaWMgdm9pZCBydW4oKSB7CisgICAgICAgICAgICAgICAgLy8gZG8gaXQgZW5vdWdoIHRpbWVzIHRvIG1ha2Ugc3VyZSB0aGVyZSBhcmUgbm8gY29ybmVyIGNhc2VzIGdvaW5nIHVudGVzdGVkCisgICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCAxMDAwOyBpKyspIHsKKyAgICAgICAgICAgICAgICAgICAgU1FMaXRlU3RhdGVtZW50IHMxID0gbURhdGFiYXNlLmNvbXBpbGVTdGF0ZW1lbnQoc3RtdCk7CisgICAgICAgICAgICAgICAgICAgIHMxLmJpbmRMb25nKDEsIGkpOworICAgICAgICAgICAgICAgICAgICBzMS5leGVjdXRlKCk7CisgICAgICAgICAgICAgICAgICAgIHMxLmNsb3NlKCk7CisgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICBSdW5TdG10VGhyZWFkIHQxID0gbmV3IFJ1blN0bXRUaHJlYWQoKTsKKyAgICAgICAgdDEuc3RhcnQoKTsKKyAgICAgICAgUnVuU3RtdFRocmVhZCB0MiA9IG5ldyBSdW5TdG10VGhyZWFkKCk7CisgICAgICAgIHQyLnN0YXJ0KCk7CisgICAgICAgICB3aGlsZSAodDEuaXNBbGl2ZSgpIHx8IHQyLmlzQWxpdmUoKSkgeworICAgICAgICAgICAgIFRocmVhZC5zbGVlcCgxMCk7CisgICAgICAgICB9CisgICAgIH0KKworICAgIC8qKgorICAgICAqIEEgc2ltcGxlIHRlc3Q6IHN0YXJ0IDIgdGhyZWFkcyB0byByZXBlYXRlZGx5IGV4ZWN1dGUgdGhlIHNhbWUge0Bs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AwOyBpIDwgMTAwMDsgaSsrKSB7CisgICAgICAgICAgICAgICAgICAgIGxvY2soKTsKKyAgICAgICAgICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHMxLmJpbmRMb25nKDEsIGkpOworICAgICAgICAgICAgICAgICAgICAgICAgczEuZXhlY3V0ZSgpOworICAgICAgICAgICAgICAgICAgICB9IGZpbmFsbHkgeworICAgICAgICAgICAgICAgICAgICAgICAgdW5sb2NrKCk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgVGhyZWFkLnlpZWxkKCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIFJ1blN0bXRUaHJlYWQgdDEgPSBuZXcgUnVuU3RtdFRocmVhZCgpOworICAgICAgICB0MS5zdGFydCgpOworICAgICAgICBSdW5TdG10VGhyZWFkIHQyID0gbmV3IFJ1blN0bXRUaHJlYWQoKTsKKyAgICAgICAgdDIuc3RhcnQoKTsKKyAgICAgICAgd2hpbGUgKHQxLmlzQWxpdmUoKSB8fCB0Mi5pc0FsaXZlKCkpIHsKKyAgICAgICAgICAgIFRocmVhZC5zbGVlcCgxMCk7CisgICAgICAgIH0KKyAgICB9CisgICAgLyoqIFN5bmNocm9uaXplIG9uIHRoaXMgd2hlbiBhY2Nlc3NpbmcgdGhlIFNxbGl0ZVN0YXRlbWV0IGluIHRoZSBhYm92ZSAqLworICAgIHByaXZhdGUgZmluYWwgUmVlbnRyYW50TG9jayBtTG9jayA9IG5ldyBSZWVudHJhbnRMb2NrKHRydWUpOworICAgIHByaXZhdGUgdm9pZCBsb2NrKCkgeworICAgICAgICBtTG9jay5sb2NrKCk7CisgICAgfQorICAgIHByaXZhdGUgdm9pZCB1bmxvY2soKSB7CisgICAgICAgIG1Mb2NrLnVubG9jaygpOworICAgIH0KKworICAgIC8qKgorICAgICAqIFRlc3RzIHRoZSBmb2xsb3dpbmc6IGEge0BsaW5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gfQotCi0gICAgICAgICAgICBAT3ZlcnJpZGUKLSAgICAgICAgICAgIHB1YmxpYyBib29sZWFuIG1vdmVUb05leHQoKSB7Ci0gICAgICAgICAgICAgICAgaWYgKG1DdXJyZW50UG9zaXRpb24gPCBtQ29udGFjdEVudHJ5TGlzdC5zaXplKCkpIHsKLSAgICAgICAgICAgICAgICAgICAgbUN1cnJlbnRQb3NpdGlvbisrOwotICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBAT3ZlcnJpZGUKLSAgICAgICAgICAgIHB1YmxpYyBib29sZWFuIGlzQmVmb3JlRmlyc3QoKSB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIG1DdXJyZW50UG9zaXRpb24gPCAwOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBAT3ZlcnJpZGUKLSAgICAgICAgICAgIHB1YmxpYyBib29sZWFuIGlzQWZ0ZXJMYXN0KCkgewotICAgICAgICAgICAgICAgIHJldHVybiBtQ3VycmVudFBvc2l0aW9uID49IG1Db250YWN0RW50cnlMaXN0LnNpemUoKTsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgQE92ZXJyaWRlCi0gICAgICAgICAgICBwdWJsaWMgaW50IGdldENvbHVtbkluZGV4KFN0cmluZyBjb2x1bW5OYW1lKSB7Ci0gICAgICAgICAgICAgICAgbVRlc3RDYXNlLmFzc2VydEVxdWFscyhDb250YWN0cy5fSUQsIGNvbHVtbk5hbWUpOwotICAgICAgICAgICAgICAgIHJldHVybiAwOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBAT3ZlcnJpZGUKLSAgICAgICAgICAgIHB1YmxpYyBpbnQgZ2V0SW50KGludCBjb2x1bW5JbmRleCkgewotICAgICAgICAgICAgICAgIG1UZX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cmluZywgT2JqZWN0PiBlbnRyeSA6IGFjdHVhbENvbnRlbnRWYWx1ZXMudmFsdWVTZXQoKSkgewotICAgICAgICAgICAgICAgICAgICBPYmplY3QgdmFsdWUgPSBlbnRyeS5nZXRWYWx1ZSgpOwotICAgICAgICAgICAgICAgICAgICBpZiAodmFsdWUgPT0gbnVsbCB8fCBUZXh0VXRpbHMuaXNFbXB0eSh2YWx1ZS50b1N0cmluZygpKSkgewotICAgICAgICAgICAgICAgICAgICAgICAga2V5VG9CZVJlbW92ZWQuYWRkKGVudHJ5LmdldEtleSgpKTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBmb3IgKFN0cmluZyBrZXk6IGtleVRvQmVSZW1vdmVkKSB7Ci0gICAgICAgICAgICAgICAgICAgIGFjdHVhbENvbnRlbnRWYWx1ZXMucmVtb3ZlKGtleSk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIC8qIGZvciB0ZXN0aW5nCi0gICAgICAgICAgICAgICAgTG9nLmQoIkBAQCIsCi0gICAgICAgICAgICAgICAgICAgICAgICBTdHJpbmcuZm9ybWF0KCJNaW1lVHlwZTogJXMsIGRhdGE6ICVzIiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWltZVR5cGUsIGFjdHVhbENvbnRlbnRWYWx1ZXMudG9TdHJpbmcoKSkpOyAqLwotICAgICAgICAgICAgICAgIC8vIFJlbW92ZSBSQVdfQ09OVEFDVF9JRCBlbnRyeSBqdXN0IGZvciBzYWZldHksIHNpbmNlIHdlIGRvIG5vdCBjYXJlCi0gICAgICAgICAgICAgICAgLy8gaG93IHJlc29sdmVyLXJlbGF0ZWQgY29kZSBoYW5kbGVzIHRoZSBlbnRyeSBpbiB0aGlzIHVuaXQgdGVzdCwKLSAgICAgICAgICAgICAgICBpZiAoYWN0dWFsQ29udGVudFZhbHVlcy5jb250YWluc0tleShEYXRhLlJBV19DT05UQUNUX0lEKSkgewotICAgICAgICAgICAgICAgICAgICBhY3R1YWxDb250ZW50VmFsdWVzLnJlbW92ZShEYXRhLlJBV19DT05UQUNUX0lEKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgZmluYWwgQ29sbGVjdGlvbjxDb250ZW50VmFsdWVzPiBjb250ZW50VmFsdWVzQ29sbGVjdGlvbiA9Ci0gICAgICAgICAgICAgICAgICAgIG1NaW1lVHlwZVRvRXhwZWN0ZWRDb250ZW50VmFsdWVzLmdldChtaW1lVHlwZSk7Ci0gICAgICAgICAgICAgICAgaWYgKGNvbnRlbnRWYWx1ZXNDb2xsZWN0aW9uLmlzRW1wdHkoKSkgewotICAgICAgICAgICAgICAgICAgICBtVGVzdENhc2UuZmFpbCgiQ29udGVudFZhbHVlcyBmb3IgTWltZVR5cGUgIiArIG1pbWVUeXBlCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgKyAiIGlzIG5vdCBleHBlY3RlZCBhdCBhbGwgKCIgKyBhY3R1YWxDb250ZW50VmFsdWVzICsgIikiKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgYm9vbGVhbiBjaGVja2VkID0gZmFsc2U7Ci0gICAgICAgICAgICAgICAgZm9yIChDb250ZW50VmFsdWVzIGV4cGVjdGVkQ29udGVudFZhbHVlcyA6IGNvbnRlbnRWYWx1ZXNDb2xsZWN0aW9uKSB7Ci0gICAgICAgICAgICAgICAgICAgIC8qZm9yIHRlc3RpbmcKLSAgICAgICAgICAgICAgICAgICAgTG9nLmQoIkBAQCIsICJleHBlY3RlZDogIgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgY29udmVydFRvRWFzaWx5UmVhZGFibGVTdHJpbmcoZXhwZWN0ZWRDb250ZW50VmFsdWVzKSk7Ci0gICAgICAgICAgICAgICAgICAgIExvZy5kKCJAQEAiLCAiYWN0dWFsICA6ICIKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICArIGNvbnZlcnRUb0Vhc2lseVJlYWRhYmxlU3RyaW5nKGFjdHVhbENvbnRlbnRWYWx1ZXMpKTsqLwotICAgICAgICAgICAgICAgICAgICBpZiAoZXF1YWxzRm9yQ29udGVudFZhbHVlcyhleHBlY3RlZENvbnRlbnRWYWx1ZXMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgYWN0dWFsQ29udGVudFZhbHVlcykpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIG1UZXN0Q2FzZS5hc3NlcnRUcnVlKGNvbnRlbnRWYWx1ZXNDb2xsZWN0aW9uLnJlbW92ZShleHBlY3RlZENvbnRlbnRWYWx1ZXMpKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGNoZWNrZWQgPSB0cnVlOwotICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgaWYgKCFjaGVja2VkKSB7Ci0gICAgICAgICAgICAgICAgICAgIGZpbmFsIFN0cmluZ0J1aWxkZXIgYnVpbGRlciA9IG5ldyBTdHJpbmdCdWlsZGVyKCk7Ci0gICAgICAgICAgICAgICAgICAgIGJ1aWxkZXIuYXBwZW5kKCJVbmV4cGVjdGVkOiAiKTsKLSAgICAgICAgICAgICAgICAgICAgYnVpbGRlci5hcHBlbmQoY29udmVydFRvRWFzaWx5UmVhZGFibGVTdHJpbmcoYWN0dWFsQ29udGVudFZhbHVlcykpOwotICAgICAgICAgICAgICAgICAgICBidWlsZGVyLmFwcGVuZCgiXG5FeHBlY3RlZDogIik7Ci0gICAgICAgICAgICAgICAgICAgIGZvciAoQ29udGVudFZhbHVlcyBleHBlY3RlZENvbnRlbnRWYWx1ZXMgOiBjb250ZW50VmFsdWVzQ29sbGVjdGlvbikgewotICAgICAgICAgICAgICAgICAgICAgICAgYnVpbGRlci5hcHBlbmQoY29udmVydFRvRWFzaWx5UmVhZGFibGVTdHJpbmcoZXhwZWN0ZWRDb250ZW50VmFsdWVzKSk7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgbVRlc3RDYXNlLmZhaWwoYnVpbGRlci50b1N0cmluZygpKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIG1UZXN0Q2FzZS5mYWlsKCJVbmV4cGVjdGVkIFVyaSBoYXMgY29tZTogIiArIHVyaSk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0gIC8vIGZvciAoaW50IGkgPSAwOyBpIDwgc2l6ZTsgaSsrKSB7Ci0gICAgICAgIHJldHVybiBmYWtlUmVzdWx0QXJyYXk7Ci0gICAgfQotCi0gICAgcHVibGljIHZvaWQgdmVyaWZ5KCkgewotICAgICAgICBTdHJpbmdCdWlsZGVyIGJ1aWxkZXIgPSBuZXcgU3RyaW5nQnVpbGRlcigpOwotICAgICAgICBmb3IgKENvbGxlY3Rpb248Q29udGVudFZhbHVlcz4gY29udGVudFZhbHVlc0NvbGxlY3Rpb24gOgotICAgICAgICAgICAgICAgIG1NaW1lVHlwZVRvRXhwZWN0ZWRDb250ZW50VmFsdWVzLnZhbHVlcygpKSB7Ci0gICAgICAgICAgICBmb3IgKENvbnRlbnRWYWx1ZXMgZXhwZWN0ZWRDb250ZW50VmFsdWVzOiBjb250ZW50VmFsdWVzQ29sbGVjdGlvbikgewotICAgICAgICAgICAgICAgIGJ1aWxkZXIuYXBwZW5kKGNvbnZlcnRUb0Vhc2lseVJlYWRhYmxlU3RyaW5nKGV4cGVjdGVkQ29udGVudFZhbHVlcykpOwotICAgICAgICAgICAgICAgIGJ1aWxkZXIuYXBwZW5kKCJcbiIpOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgICAgIGlmIChidWlsZGVyLmxlbmd0aCgpID4gMCkgewotICAgICAgICAgICAgZmluYWwgU3RyaW5nIGZhaWxNc2cgPQotICAgICAgICAgICAgICAgICJUaGVyZSBpcyhhcmU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bmdbXSBsaW5lQXJyYXkgPSB2Y2FyZC5zcGxpdCgiXFxyP1xcbiIpOwotICAgICAgICBmaW5hbCBpbnQgbGVuZ3RoID0gbGluZUFycmF5Lmxlbmd0aDsKLSAgICAgICAgYm9vbGVhbiBiZWdpbkV4aXN0cyA9IGZhbHNlOwotICAgICAgICBib29sZWFuIGVuZEV4aXN0cyA9IGZhbHNlOwotICAgICAgICBib29sZWFuIHZlcnNpb25FeGlzdHMgPSBmYWxzZTsKLQotICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGxlbmd0aDsgaSsrKSB7Ci0gICAgICAgICAgICBmaW5hbCBTdHJpbmcgbGluZSA9IGxpbmVBcnJheVtpXTsKLSAgICAgICAgICAgIGlmIChUZXh0VXRpbHMuaXNFbXB0eShsaW5lKSkgewotICAgICAgICAgICAgICAgIGNvbnRpbnVlOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBpZiAoIkJFR0lOOlZDQVJEIi5lcXVhbHNJZ25vcmVDYXNlKGxpbmUpKSB7Ci0gICAgICAgICAgICAgICAgaWYgKGJlZ2luRXhpc3RzKSB7Ci0gICAgICAgICAgICAgICAgICAgIG1UZXN0Q2FzZS5mYWlsKCJNdWx0aXBsZSBcIkJFR0lOOlZDQVJEXCIgbGluZSBmb3VuZCIpOwotICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIGJlZ2luRXhpc3RzID0gdHJ1ZTsKLSAgICAgICAgICAgICAgICAgICAgY29udGludWU7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfSBlbHNlIGlmICgiRU5EOlZDQVJEIi5lcXVhbHNJZ25vcmVDYXNlKGxpbmUpKSB7Ci0gICAgICAgICAgICAgICAgaWYgKGVuZEV4aXN0cykgewotICAgICAgICAgICAgICAgICAgICBtVGVzdENhc2UuZmFpbCgiTXVsdGlwbGUgXCJFTkQ6VkNBUkRcIiBsaW5lIGZvdW5kIik7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgZW5kRXhpc3RzID0gdHJ1ZTsKLSAgICAgICAgICAgICAgICAgICAgY29udGludWU7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfSBlbHNlIGlmICgobUlzVjMwID8gIlZFUlNJT046My4wIiA6ICJWRVJTSU9OOjIuMSIpLmVxdWFsc0lnbm9yZUNhc2UobGluZSkpIHsKLSAgICAgICAgICAgICAgICBpZiAodmVyc2lvbkV4aXN0cykgewotICAgICAgICAgICAgICAgICAgICBtVGVzdENhc2UuZmFpbCgiTXVsdGlwbGUgVkVSU0lPTiBsaW5lICsgZm91bmQiKTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICB2ZXJzaW9uRXhpc3RzID0gdHJ1ZTsKLSAgICAgICAgICAgICAgICAgICAgY29udGludWU7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBpZiAoIWJlZ2luRXhpc3RzKSB7Ci0gICAgICAgICAgICAgICAgbVRlc3RDYXNlLmZhaWwoIlByb3BlcnR5IG90aGVyIHRoYW4gQkVHSU4gY2FtZSBiZWZvcmUgQkVHSU4gcHJvcGVydHk6ICIKLSAgICAgICAgICAgICAgICAgICAgICAgICsgbGluZSk7Ci0gICAgICAgICAgICB9IGVsc2UgaWYgKGVuZEV4aXN0cykgewotICAgICAgICAgICAgICAgIG1UZXN0Q2FzZS5mYWlsKCJQcm9wZXJ0eSBvdGhlciB0aGFuIEVORCBjYW1lIGFmdGVyIEVORCBwcm9wZXJ0eTogIgotICAgICAgICAgICAgICAgICAgICAgICAgKyBsaW5lKTsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgZmluYWwgaW50IGluZGV4ID0gbUV4cGVjdGVkTGluZUxpc3QuaW5kZXhPZihsaW5lKTsKLSAgICAgICAgICAgIGlmIChpbmRleCA+PSAwKSB7Ci0gICAgICAgICAgICAgICAgb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WYgKGZpcnN0KSB7Ci0gICAgICAgICAgICAgICAgZmlyc3QgPSBmYWxzZTsKLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgYnVpbGRlci5hcHBlbmQoIiwgIik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBidWlsZGVyLmFwcGVuZCgnIicpOwotICAgICAgICAgICAgYnVpbGRlci5hcHBlbmQoZWxlbSk7Ci0gICAgICAgICAgICBidWlsZGVyLmFwcGVuZCgnIicpOwotICAgICAgICB9Ci0gICAgICAgIGJ1aWxkZXIuYXBwZW5kKCJdIik7Ci0gICAgICAgIGlmICghcHJvcEdyb3VwU2V0LmlzRW1wdHkoKSkgewotICAgICAgICAgICAgYnVpbGRlci5hcHBlbmQoIiwgcHJvcEdyb3VwU2V0OiBbIik7Ci0gICAgICAgICAgICBmaXJzdCA9IHRydWU7Ci0gICAgICAgICAgICBmb3IgKFN0cmluZyBlbGVtIDogcHJvcEdyb3VwU2V0KSB7Ci0gICAgICAgICAgICAgICAgaWYgKGZpcnN0KSB7Ci0gICAgICAgICAgICAgICAgICAgIGZpcnN0ID0gZmFsc2U7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgYnVpbGRlci5hcHBlbmQoIiwgIik7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGJ1aWxkZXIuYXBwZW5kKCciJyk7Ci0gICAgICAgICAgICAgICAgYnVpbGRlci5hcHBlbmQoZWxlbSk7Ci0gICAgICAgICAgICAgICAgYnVpbGRlci5hcHBlbmQoJyInKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGJ1aWxkZXIuYXBwZW5kKCJdIik7Ci0gICAgICAgIH0KLSAgICAgICAgaWYgKHByb3BWYWx1ZV92ZWN0b3IgIT0gbnVsbCAmJiBwcm9wVmFsdWVfdmVjdG9yLnNpemUoKSA+IDEpIHsKLSAgICAgICAgICAgIGJ1aWxkZXIu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RlZE5vZGUgPSBleHBlY3RlZE5vZGVMaXN0LmdldChpKTsKLSAgICAgICAgICAgICAgICBMaXN0PFByb3BlcnR5Tm9kZT4gZXhwZWN0ZWRCdXREaWZmZXJlbnRWYWx1ZUxpc3QgPSBuZXcgQXJyYXlMaXN0PFByb3BlcnR5Tm9kZT4oKTsKLSAgICAgICAgICAgICAgICBpZiAoZXhwZWN0ZWROb2RlLnByb3BOYW1lLmVxdWFscyhwcm9wTmFtZSkpIHsKLSAgICAgICAgICAgICAgICAgICAgaWYgKGV4cGVjdGVkTm9kZS5lcXVhbHMoYWN0dWFsTm9kZSkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGV4cGVjdGVkTm9kZUxpc3QucmVtb3ZlKGkpOwotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGV4cGVjdGVkTm9kZUxpc3Quc2l6ZSgpID09IDApIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBtT3JkZXJlZE5vZGVNYXAucmVtb3ZlKHByb3BOYW1lKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGV4cGVjdGVkQnV0RGlmZmVyZW50VmFsdWVMaXN0LmFkZChleHBlY3RlZE5vZGUpOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgLy8gImFjdHVhbE5vZGUiIGlzIG5vdCBpbiBvcmRlcmVkIGV4cGVjdGVkIGxpc3QuCi0gICAgICAgICAgICAgICAgLy8gVHJ5IGxvb2tpbmcgb3ZlciB1bm9yZGVyZWQgZXhwZWN0ZWQgbGlzdC4KLSAgICAgICAgICAgICAgICBpZiAodHJ5Rm91bmRFeHBlY3RlZE5vZGVGcm9tVW5vcmRlcmVkTGlzdChhY3R1YWxOb2RlLAotICAgICAgICAgICAgICAgICAgICAgICAgZXhwZWN0ZWRCdXREaWZmZXJlbnRWYWx1ZUxpc3QpKSB7Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICBpZiAoIWV4cGVjdGVkQnV0RGlmZmVyZW50VmFsdWVMaXN0LmlzRW1wdHkoKSkgewotICAgICAgICAgICAgICAgICAgICAvLyBTYW1lIHByb3BOYW1lIGV4aXN0cyBidXQgd2l0aCBkaWZmZXJlbnQgdmFsdWUocykuCi0gICAgICAgICAgICAgICAgICAgIGZhaWxXaXRoRXhwZWN0ZWROb2RlTGlzdChwcm9wTmFtZSwgYWN0dWFsTm9kZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBleHBlY3RlZEJ1dERpZmZlcmVudFZhbHVlTGlzdCk7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgLy8gVGhlcmUncyBubyBleHBlY3RlZCBub2RlIHdpdGggc2FtZSBwcm9wTmFtZS4KLSAgICAgICAgICAgICAgICAgICAgbVRlc3RDYXNlLmZhaWwoIlVuZXhwZWN0ZWQgcHJvcGVydHkgXCIiICsgcHJvcE5hbWUgKyAiXCIgZXhpc3RzLiIpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgIExpc3Q8UHJvcGVydHlOb2RlPiBleHBlY3RlZEJ1dERpZmZlcmVudFZhbHVlTGlzdCA9Ci0gICAgICAgICAgICAgICAgbmV3IEFycmF5TGlzdDxQcm9wZXJ0eU5vZGU+KCk7Ci0gICAgICAgICAgICBpZiAodHJ5Rm91bmRFeHBlY3RlZE5vZGVGcm9tVW5vcmRlcmVkTGlzdChhY3R1YWxOb2RlLCBleHBlY3RlZEJ1dERpZmZlcmVudFZhbHVlTGlzdCkpIHsKLSAgICAgICAgICAgICAgICByZXR1cm47Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIGlmICghZXhwZWN0ZWRCdXREaWZmZXJlbnRWYWx1ZUxpc3QuaXNFbXB0eSgpKSB7Ci0gICAgICAgICAgICAgICAgICAgIC8vIFNhbWUgcHJvcE5hbWUgZXhpc3RzIGJ1dCB3aXRoIGRpZmZlcmVudCB2YWx1ZShzKS4KLSAgICAgICAgICAgICAgICAgICAgZmFpbFdpdGhFeHBlY3RlZE5vZGVMaXN0KHByb3BOYW1lLCBhY3R1YWxOb2RlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4cGVjdGVkQnV0RGlmZmVyZW50VmFsdWVMaXN0KTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICAvLyBUaGVyZSdzIG5vIGV4cGVjdGVkIG5vZGUgd2l0aCBzYW1lIHByb3BOYW1lLgotICAgICAgICAgICAgICAgICAgICBtVGVzdENhc2UuZmFpbCgiVW5leHBlY3RlZCBwcm9wZXJ0eSBcIiIgKyBwcm9wTmFtZSArICJcIiBleGlzdHMuIik7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgfQotCi0gICAgcHJpdmF0ZSBTdHJpbmcgY29uY2F0aW5hdGVMaXN0V2l0aFNlbWlDb2xvbihMaXN0PFN0cmluZz4gYXJyYXkpIHsKLSAgICAgICAgU3RyaW5nQnVmZmVyIGJ1ZmZlciA9IG5ldyBTdHJpbmdCdWZmZXIoKTsKLSAgICAgICAgYm9vbGVhbiBmaXJzdCA9IHRydWU7Ci0gICAgICAgIGZvciAoU3RyaW5nIHByb3BWYWx1ZUVsZW0gOiBhcnJheSkgewotICAgICAgICAgICAgaWYgKGZpcnN0KSB7Ci0gICAgICAgICAgICAgICAgZmlyc3QgPSBmYWxzZTsKLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgYnVmZmVyLmFwcGVuZCgnOycpOwotICAgICAgICAgICAgfQot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G1WZXJpZmllci5pbml0Rm9yRXhwb3J0VGVzdCh2Y2FyZFR5cGUpOwotICAgICAgICBDb250YWN0RW50cnkgZW50cnkgPSBtVmVyaWZpZXIuYWRkSW5wdXRFbnRyeSgpOwotICAgICAgICBlbnRyeS5hZGRDb250ZW50VmFsdWVzKFBob25lLkNPTlRFTlRfSVRFTV9UWVBFKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuTlVNQkVSLCAiMTAiKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuVFlQRSwgUGhvbmUuVFlQRV9IT01FKTsKLSAgICAgICAgZW50cnkuYWRkQ29udGVudFZhbHVlcyhQaG9uZS5DT05URU5UX0lURU1fVFlQRSkKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLk5VTUJFUiwgIjIwIikKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLlRZUEUsIFBob25lLlRZUEVfV09SSyk7Ci0gICAgICAgIGVudHJ5LmFkZENvbnRlbnRWYWx1ZXMoUGhvbmUuQ09OVEVOVF9JVEVNX1RZUEUpCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5OVU1CRVIsICIzMCIpCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5UWVBFLCBQaG9uZS5UWVBFX0ZBWF9IT01FKTsKLSAgICAgICAgZW50cnkuYWRkQ29udGVudFZhbHVlcyhQaG9uZS5DT05URU5UX0lURU1fVFlQRSkKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLk5VTUJFUiwgIjQwIikKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLlRZUEUsIFBob25lLlRZUEVfRkFYX1dPUkspOwotICAgICAgICBlbnRyeS5hZGRDb250ZW50VmFsdWVzKFBob25lLkNPTlRFTlRfSVRFTV9UWVBFKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuTlVNQkVSLCAiNTAiKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuVFlQRSwgUGhvbmUuVFlQRV9NT0JJTEUpOwotICAgICAgICBlbnRyeS5hZGRDb250ZW50VmFsdWVzKFBob25lLkNPTlRFTlRfSVRFTV9UWVBFKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuTlVNQkVSLCAiNjAiKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuVFlQRSwgUGhvbmUuVFlQRV9QQUdFUik7Ci0gICAgICAgIGVudHJ5LmFkZENvbnRlbnRWYWx1ZXMoUGhvbmUuQ09OVEVOVF9JVEVNX1RZUEUpCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5OVU1CRVIsICI3MCIpCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5UWVBFLCBQaG9uZS5UWVBFX09USEVSKTsKLSAgICAgICAgZW50cnkuYWRkQ29udGVudFZhbHVlcyhQaG9uZS5DT05URU5UX0lURU1fVFlQRSkKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLk5VTUJFUiwgIjgwIikKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLlRZUEUsIFBob25lLlRZUEVfQ0FSKTsKLSAgICAgICAgZW50cnkuYWRkQ29udGVudFZhbHVlcyhQaG9uZS5DT05URU5UX0lURU1fVFlQRSkKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLk5VTUJFUiwgIjkwIikKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLlRZUEUsIFBob25lLlRZUEVfQ09NUEFOWV9NQUlOKTsKLSAgICAgICAgZW50cnkuYWRkQ29udGVudFZhbHVlcyhQaG9uZS5DT05URU5UX0lURU1fVFlQRSkKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLk5VTUJFUiwgIjEwMCIpCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5UWVBFLCBQaG9uZS5UWVBFX0lTRE4pOwotICAgICAgICBlbnRyeS5hZGRDb250ZW50VmFsdWVzKFBob25lLkNPTlRFTlRfSVRFTV9UWVBFKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuTlVNQkVSLCAiMTEwIikKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLlRZUEUsIFBob25lLlRZUEVfTUFJTik7Ci0gICAgICAgIGVudHJ5LmFkZENvbnRlbnRWYWx1ZXMoUGhvbmUuQ09OVEVOVF9JVEVNX1RZUEUpCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5OVU1CRVIsICIxMjAiKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuVFlQRSwgUGhvbmUuVFlQRV9PVEhFUl9GQVgpOwotICAgICAgICBlbnRyeS5hZGRDb250ZW50VmFsdWVzKFBob25lLkNPTlRFTlRfSVRFTV9UWVBFKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuTlVNQkVSLCAiMTMwIikKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLlRZUEUsIFBob25lLlRZUEVfVEVMRVgpOwotICAgICAgICBlbnRyeS5hZGRDb250ZW50VmFsdWVzKFBob25lLkNPTlRFTlRfSVRFTV9UWVBFKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuTlVNQkVSLCAiMTQwIikKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLlRZUEUsIFBob25lLlRZUEVfV09SS19NT0JJTEUpOwotICAgICAgICBlbnRyeS5hZGRDb250ZW50VmFsdWVzKFBob25lLkNPTlRFTlRfSVRFTV9UWVBFKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuTlVNQkVSLCAiMTUwIikKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLlRZUEUsIFBob25lLlRZUEVfV09SS19QQUdFUik7Ci0gICAgICAgIGVudHJ5LmFkZENvbnRlbnRWYWx1ZXMoUGhvbmUuQ09OVEVOVF9JVEVNX1RZUEUpCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5OVU1CRVIsICIxNjAiKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuVFlQRSwgUGhvbmUuVFlQRV9NTVMpOwotCi0gICAgICAgIG1WZXJpZmllci5hZGRQ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RyeS5hZGRDb250ZW50VmFsdWVzKFBob25lLkNPTlRFTlRfSVRFTV9UWVBFKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuTlVNQkVSLCAiMSIpCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5UWVBFLCBQaG9uZS5UWVBFX0hPTUUpOwotICAgICAgICBlbnRyeS5hZGRDb250ZW50VmFsdWVzKFBob25lLkNPTlRFTlRfSVRFTV9UWVBFKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuTlVNQkVSLCAiMiIpCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5UWVBFLCBQaG9uZS5UWVBFX1dPUkspCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5JU19QUklNQVJZLCAxKTsKLSAgICAgICAgZW50cnkuYWRkQ29udGVudFZhbHVlcyhQaG9uZS5DT05URU5UX0lURU1fVFlQRSkKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLk5VTUJFUiwgIjMiKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuVFlQRSwgUGhvbmUuVFlQRV9GQVhfSE9NRSkKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLklTX1BSSU1BUlksIDEpOwotICAgICAgICBlbnRyeS5hZGRDb250ZW50VmFsdWVzKFBob25lLkNPTlRFTlRfSVRFTV9UWVBFKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuTlVNQkVSLCAiNCIpCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5UWVBFLCBQaG9uZS5UWVBFX0ZBWF9XT1JLKTsKLQotICAgICAgICBtVmVyaWZpZXIuYWRkUHJvcGVydHlOb2Rlc1ZlcmlmaWVyRWxlbVdpdGhFbXB0eU5hbWUoKQotICAgICAgICAgICAgICAgIC5hZGRFeHBlY3RlZE5vZGUoIlRFTCIsICI0IiwgbmV3IFR5cGVTZXQoIldPUksiLCAiRkFYIikpCi0gICAgICAgICAgICAgICAgLmFkZEV4cGVjdGVkTm9k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AgIC5wdXQoUGhvbmUuTlVNQkVSLCAiMiIpCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5UWVBFLCBQaG9uZS5UWVBFX0NVU1RPTSkKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLkxBQkVMLCAiTVNHIik7Ci0gICAgICAgIGVudHJ5LmFkZENvbnRlbnRWYWx1ZXMoUGhvbmUuQ09OVEVOVF9JVEVNX1RZUEUpCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5OVU1CRVIsICIzIikKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLlRZUEUsIFBob25lLlRZUEVfQ1VTVE9NKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuTEFCRUwsICJCQlMiKTsKLSAgICAgICAgZW50cnkuYWRkQ29udGVudFZhbHVlcyhQaG9uZS5DT05URU5UX0lURU1fVFlQRSkKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLk5VTUJFUiwgIjQiKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuVFlQRSwgUGhvbmUuVFlQRV9DVVNUT00pCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5MQUJFTCwgIlZJREVPIik7Ci0gICAgICAgIGVudHJ5LmFkZENvbnRlbnRWYWx1ZXMoUGhvbmUuQ09OVEVOVF9JVEVNX1RZUEUpCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5OVU1CRVIsICI1IikKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLlRZUEUsIFBob25lLlRZUEVfQ1VTVE9NKTsKLSAgICAgICAgZW50cnkuYWRkQ29udGVudFZhbHVlcyhQaG9uZS5DT05URU5UX0lURU1fVFlQRSkKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLk5VTUJFUiwgIjYiKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuVFlQRSwgUGhvbmUuVFlQRV9DVVNUT00pCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5MQUJFTCwgIl9BVVRP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FZhbHVlcyhJbS5DT05URU5UX0lURU1fVFlQRSkKLSAgICAgICAgICAgICAgICAucHV0KEltLlBST1RPQ09MLCBJbS5QUk9UT0NPTF9NU04pCi0gICAgICAgICAgICAgICAgLnB1dChJbS5EQVRBLCAibXNuIik7Ci0gICAgICAgIGVudHJ5LmFkZENvbnRlbnRWYWx1ZXMoSW0uQ09OVEVOVF9JVEVNX1RZUEUpCi0gICAgICAgICAgICAgICAgLnB1dChJbS5QUk9UT0NPTCwgSW0uUFJPVE9DT0xfWUFIT08pCi0gICAgICAgICAgICAgICAgLnB1dChJbS5EQVRBLCAieWFob28iKTsKLSAgICAgICAgZW50cnkuYWRkQ29udGVudFZhbHVlcyhJbS5DT05URU5UX0lURU1fVFlQRSkKLSAgICAgICAgICAgICAgICAucHV0KEltLlBST1RPQ09MLCBJbS5QUk9UT0NPTF9TS1lQRSkKLSAgICAgICAgICAgICAgICAucHV0KEltLkRBVEEsICJza3lwZSIpOwotICAgICAgICBlbnRyeS5hZGRDb250ZW50VmFsdWVzKEltLkNPTlRFTlRfSVRFTV9UWVBFKQotICAgICAgICAgICAgICAgIC5wdXQoSW0uUFJPVE9DT0wsIEltLlBST1RPQ09MX1FRKQotICAgICAgICAgICAgICAgIC5wdXQoSW0uREFUQSwgInFxIik7Ci0gICAgICAgIGVudHJ5LmFkZENvbnRlbnRWYWx1ZXMoSW0uQ09OVEVOVF9JVEVNX1RZUEUpCi0gICAgICAgICAgICAgICAgLnB1dChJbS5QUk9UT0NPTCwgSW0uUFJPVE9DT0xfR09PR0xFX1RBTEspCi0gICAgICAgICAgICAgICAgLnB1dChJbS5EQVRBLCAiZ29vZ2xlIHRhbGsiKTsKLSAgICAgICAgZW50cnkuYWRkQ29udGVudFZhbHVlcyhJbS5DT05URU5UX0lURU1fVFlQRSkKLSAgICAgICAgICAgICAgICAucHV0KEltLlBST1RPQ09MLCBJbS5QUk9UT0NPTF9JQ1EpCi0gICAgICAgICAgICAgICAgLnB1dChJbS5EQVRBLCAiaWNxIik7Ci0gICAgICAgIGVudHJ5LmFkZENvbnRlbnRWYWx1ZXMoSW0uQ09OVEVOVF9JVEVNX1RZUEUpCi0gICAgICAgICAgICAgICAgLnB1dChJbS5QUk9UT0NPTCwgSW0uUFJPVE9DT0xfSkFCQkVSKQotICAgICAgICAgICAgICAgIC5wdXQoSW0uREFUQSwgImphYmJlciIpOwotICAgICAgICBlbnRyeS5hZGRDb250ZW50VmFsdWVzKEltLkNPTlRFTlRfSVRFTV9UWVBFKQotICAgICAgICAgICAgICAgIC5wdXQoSW0uUFJPVE9DT0wsIEltLlBST1RPQ09MX05FVE1FRVRJTkcpCi0gICAgICAgICAgICAgICAgLnB1dChJbS5EQVRBLCAibmV0bWVldGluZyIpOwotCi0gICAgICAgIC8vIE5vIGRldGVybWluZWQgd2F5IHRvIGV4cHJlc3MgdW5rbm93biB0eXBlLi4uCi0gICAgICAgIG1WZXJpZmllci5hZGRQcm9wZXJ0eU5vZGVzVmVyaWZpZXJFbGVtV2l0aEVtcHR5TmFtZSgpCi0gICAgICAgICAgICAgICAgLmFkZEV4cGVjdGVkTm9kZSgiWC1KQUJCRVIiLCAiamFiYmVyIikKLSAgICAgICAgICAgICAgICAuYWRkRXhwZWN0ZWROb2RlKCJYLUlDUSIsICJpY3EiKQotICAgICAgICAgICAgICAgIC5hZGRFeHBlY3RlZE5vZGUoIlgtR09PR0xFLVRBTEsiLCAiZ29vZ2xlIHRhbGsiKQotICAgICAgICAgICAgICAgIC5hZGRFeHBlY3RlZE5vZGUoIlgtUVEiLCAicXEiKQotICAgICAgICAgICAgICAgIC5hZGRFeHBlY3RlZE5vZGUoIlgtU0tZUEUtVVNFUk5BTUUiLCAic2t5cGUiKQotICAgICAgICAgICAgICAgIC5hZGRFeHBlY3RlZE5vZGUoIlgtWUFIT08iLCAieWFob28iKQotICAgICAgICAgICAgICAgIC5hZGRFeHBlY3RlZE5vZGUoIlgtTVNOIiwgIm1zbiIpCi0gICAgICAgICAgICAgICAgLmFkZE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NBUlkpKQotICAgICAgICAgICAgICAgIC5hZGRFeHBlY3RlZE5vZGUoIlgtQU5EUk9JRC1DVVNUT00iLAotICAgICAgICAgICAgICAgICAgICAgICAgZ2V0QW5kcm9pZFByb3BWYWx1ZSgKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRXZlbnQuQ09OVEVOVF9JVEVNX1RZUEUsICIyMDE4LTAzLTEyIiwgRXZlbnQuVFlQRV9PVEhFUikpCi0gICAgICAgICAgICAgICAgLmFkZEV4cGVjdGVkTm9kZSgiWC1BTkRST0lELUNVU1RPTSIsCi0gICAgICAgICAgICAgICAgICAgICAgICBnZXRBbmRyb2lkUHJvcFZhbHVlKAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBFdmVudC5DT05URU5UX0lURU1fVFlQRSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIldoZW4gdGhlIFRvd2VyIG9mIEhhbm9pIHdpdGggNjQgcmluZ3MgaXMgY29tcGxldGVkLiIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEV2ZW50LlRZUEVfQ1VTVE9NLCAiVGhlIGxhc3QgZGF5IikpOwotICAgIH0KLQotICAgIHB1YmxpYyB2b2lkIHRlc3RFdmVudFYyMSgpIHsKLSAgICAgICAgdGVzdEV2ZW50Q29tbW9uKFYyMSk7Ci0gICAgfQotCi0gICAgcHVibGljIHZvaWQgdGVzdEV2ZW50VjMwKCkgewotICAgICAgICB0ZXN0RXZlbnRDb21tb24oVjMwKTsKLSAgICB9Ci0KLSAgICBwcml2YXRlIHZvaWQgdGVzdE5vdGVDb21tb24oaW50IHZjYXJkVHlwZSkgewotICAgICAgICBtVmVyaWZpZXIuaW5pdEZvckV4cG9ydFRlc3QodmNhcmRUeXBlKTsKLSAgICAgICAgQ29udGFjdEVudHJ5IGVudHJ5ID0gbVZlcmlmaWVyLmFkZElucHV0RW50cnkoKTsKLSAgICAgICAgZW50cnkuYWRkQ29udGVudFZhbHVlcyhO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VBFKQotICAgICAgICAgICAgICAgIC5wdXQoRW1haWwuREFUQSwgInRlc3RAZXhhbXBsZS5jb20iKQotICAgICAgICAgICAgICAgIC5wdXQoRW1haWwuVFlQRSwgRW1haWwuVFlQRV9IT01FKQotICAgICAgICAgICAgICAgIC5wdXQoRW1haWwuSVNfUFJJTUFSWSwgMSk7Ci0gICAgICAgIGVsZW0uYWRkRXhwZWN0ZWQoRW1haWwuQ09OVEVOVF9JVEVNX1RZUEUpCi0gICAgICAgICAgICAgICAgLnB1dChFbWFpbC5EQVRBLCAidGVzdDJAZXhhbWluYXRpb24uY29tIikKLSAgICAgICAgICAgICAgICAucHV0KEVtYWlsLlRZUEUsIEVtYWlsLlRZUEVfTU9CSUxFKQotICAgICAgICAgICAgICAgIC5wdXQoRW1haWwuSVNfUFJJTUFSWSwgMSk7Ci0gICAgICAgIGVsZW0uYWRkRXhwZWN0ZWQoT3JnYW5pemF0aW9uLkNPTlRFTlRfSVRFTV9UWVBFKQotICAgICAgICAgICAgICAgIC5wdXQoT3JnYW5pemF0aW9uLkNPTVBBTlksICJDb21wYW55IikKLSAgICAgICAgICAgICAgICAucHV0KE9yZ2FuaXphdGlvbi5USVRMRSwgIkVuZ2luZWVyIikKLSAgICAgICAgICAgICAgICAucHV0KE9yZ2FuaXphdGlvbi5UWVBFLCBPcmdhbml6YXRpb24uVFlQRV9XT1JLKTsKLSAgICAgICAgZWxlbS5hZGRFeHBlY3RlZChPcmdhbml6YXRpb24uQ09OVEVOVF9JVEVNX1RZUEUpCi0gICAgICAgICAgICAgICAgLnB1dChPcmdhbml6YXRpb24uQ09NUEFOWSwgIk15c3RlcnkiKQotICAgICAgICAgICAgICAgIC5wdXQoT3JnYW5pemF0aW9uLlRJVExFLCAiQmxvZ2dlciIpCi0gICAgICAgICAgICAgICAgLnB1dChPcmdhbml6YXRpb24uVFlQRSwgT3JnYW5pemF0aW9uLlRZUEVfV09SSyk7Ci0gICAgICAgIGVsZW0uYWRkRXhwZWN0ZWQoT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RFIiLAotICAgICAgICAgICAgICAgICAgICAgICAgIjs7MTAwIFdhdGVycyBFZGdlO0JheXRvd247TEE7MzAzMTQ7VW5pdGVkIFN0YXRlcyBvZiBBbWVyaWNhIiwKLSAgICAgICAgICAgICAgICAgICAgICAgIEFycmF5cy5hc0xpc3QoIiIsICIiLCAiMTAwIFdhdGVycyBFZGdlIiwgIkJheXRvd24iLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiTEEiLCAiMzAzMTQiLCAiVW5pdGVkIFN0YXRlcyBvZiBBbWVyaWNhIiksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsIG51bGwsIG5ldyBUeXBlU2V0KCJXT1JLIiksIG51bGwpCi0gICAgICAgICAgICAgICAgLmFkZEV4cGVjdGVkTm9kZVdpdGhPcmRlcigiTEFCRUwiLAotICAgICAgICAgICAgICAgICAgICAgICAgIjEwMCBXYXRlcnMgRWRnZVxyXG5CYXl0b3duLCBMQSAzMDMxNFxyXG5Vbml0ZWQgIFN0YXRlcyBvZiBBbWVyaWNhIiwKLSAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsIG51bGwsIG1Db250ZW50VmFsdWVzRm9yUVAsIG5ldyBUeXBlU2V0KCJXT1JLIiksIG51bGwpCi0gICAgICAgICAgICAgICAgLmFkZEV4cGVjdGVkTm9kZVdpdGhPcmRlcigiQURSIiwKLSAgICAgICAgICAgICAgICAgICAgICAgICI7OzQyIFBsYW50YXRpb24gU3QuO0JheXRvd247TEE7MzAzMTQ7VW5pdGVkIFN0YXRlcyBvZiBBbWVyaWNhIiwKLSAgICAgICAgICAgICAgICAgICAgICAgIEFycmF5cy5hc0xpc3QoIiIsICIiLCAiNDIgUGxhbnRhdGlvbiBTdC4iLCAiQmF5dG93biIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJMQSIsICIzMDMxNCIsICJVbml0ZWQgU3RhdGVzIG9mIEFtZXJpY2EiKSwgbnVsbCwgbnVsbCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV3IFR5cGVTZXQoIkhPTUUiKSwgbnVsbCkKLSAgICAgICAgICAgICAgICAuYWRkRXhwZWN0ZWROb2RlV2l0aE9yZGVyKCJMQUJFTCIsCi0gICAgICAgICAgICAgICAgICAgICAgICAiNDIgUGxhbnRhdGlvbiBTdC5cclxuQmF5dG93biwgTEEgMzAzMTRcclxuVW5pdGVkICBTdGF0ZXMgb2YgQW1lcmljYSIsCi0gICAgICAgICAgICAgICAgICAgICAgICBudWxsLCBudWxsLCBtQ29udGVudFZhbHVlc0ZvclFQLAotICAgICAgICAgICAgICAgICAgICAgICAgbmV3IFR5cGVTZXQoIkhPTUUiKSwgbnVsbCkKLSAgICAgICAgICAgICAgICAuYWRkRXhwZWN0ZWROb2RlV2l0aE9yZGVyKCJFTUFJTCIsICJmb3JyZXN0Z3VtcEB3YWxsYWRhbGxhLmNvbSIsCi0gICAgICAgICAgICAgICAgICAgICAgICBuZXcgVHlwZVNldCgiUFJFRiIsICJJTlRFUk5FVCIpKQotICAgICAgICAgICAgICAgIC5hZGRFeHBlY3RlZE5vZGVXaXRoT3JkZXIoIkVNQUlMIiwgImNlbGxAZXhhbXBsZS5jb20iLCBuZXcgVHlwZVNldCgiQ0VMTCIpKQotICAgICAgICAgICAgICAgIC5hZGRFeHBlY3RlZE5vZGVXaXRoT3JkZXIoIk5PVEUiLCAiVGhlIGZvbGxvd2luZyBub3RlIGlzIHRoZSBleGFtcGxlIGZyb20gUkZDIDIwNDUuIikKLSAgICAgICAgICAgICAgICAuYWRkRXhwZWN0ZWROb2RlV2l0aE9yZGVyKCJOT1RFIiwKLSAgICAgICAgICAgICAgICAgICAgICAgICJOb3cncyB0aGUgdGltZSBmb3IgYWxsIGZvbGsgdG8gY29tZSB0byB0aGUgYWlkIG9mIHRoZWlyIGNvdW50cnkuIiwKLSAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsIG51bGwsIG1Db250ZW50VmFsdWVzRm9yUV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X1RZUEUpCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5UWVBFLCBQaG9uZS5UWVBFX1dPUkspCi0gICAgICAgICAgICAgICAgLy8gUGhvbmUgbnVtYmVyIGlzIGV4cGVjdGVkIHRvIGJlIGZvcm1hdGVkIHdpdGggTkFNUCBmb3JtYXQgaW4gZGVmYXVsdC4KLSAgICAgICAgICAgICAgICAucHV0KFBob25lLk5VTUJFUiwgIjExMS01NTUtMTIxMiIpOwotICAgICAgICBlbGVtLmFkZEV4cGVjdGVkKFBob25lLkNPTlRFTlRfSVRFTV9UWVBFKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuVFlQRSwgUGhvbmUuVFlQRV9IT01FKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuTlVNQkVSLCAiNDA0LTU1NS0xMjEyIik7Ci0gICAgICAgIGVsZW0uYWRkRXhwZWN0ZWQoUGhvbmUuQ09OVEVOVF9JVEVNX1RZUEUpCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5UWVBFLCBQaG9uZS5UWVBFX01PQklMRSkKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLk5VTUJFUiwgIjAzMS0xMTEtMTExMSIpOwotICAgICAgICBlbGVtLmFkZEV4cGVjdGVkKFBob25lLkNPTlRFTlRfSVRFTV9UWVBFKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuVFlQRSwgUGhvbmUuVFlQRV9DVVNUT00pCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5MQUJFTCwgIlZJREVPIikKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLk5VTUJFUiwgIjAzMi0yMjItMjIyMiIpOwotICAgICAgICBlbGVtLmFkZEV4cGVjdGVkKFBob25lLkNPTlRFTlRfSVRFTV9UWVBFKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuVFlQRSwgUGhvbmUuVFlQRV9DVVNUT00pCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5MQUJFT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TlRSWSwgIlVuaXRlZCBTdGF0ZXMgb2YgQW1lcmljYSIpCi0gICAgICAgICAgICAgICAgLnB1dChTdHJ1Y3R1cmVkUG9zdGFsLlBPU1RDT0RFLCAiMzAzMTQiKQotICAgICAgICAgICAgICAgIC5wdXQoU3RydWN0dXJlZFBvc3RhbC5SRUdJT04sICJMQSIpCi0gICAgICAgICAgICAgICAgLnB1dChTdHJ1Y3R1cmVkUG9zdGFsLkNJVFksICJCYXl0b3duIikKLSAgICAgICAgICAgICAgICAucHV0KFN0cnVjdHVyZWRQb3N0YWwuU1RSRUVULCAiNDIgUGxhbnRhdGlvbiBTdC4iKQotICAgICAgICAgICAgICAgIC5wdXQoU3RydWN0dXJlZFBvc3RhbC5GT1JNQVRURURfQUREUkVTUywKLSAgICAgICAgICAgICAgICAgICAgICAgICI0MiBQbGFudGF0aW9uIFN0LiBCYXl0b3duIExBIDMwMzE0IFVuaXRlZCBTdGF0ZXMgb2YgQW1lcmljYSIpOwotICAgICAgICBlbGVtLmFkZEV4cGVjdGVkKEVtYWlsLkNPTlRFTlRfSVRFTV9UWVBFKQotICAgICAgICAgICAgICAgIC8vICJUWVBFPUlOVEVSTkVUIiAtPiBUWVBFX0NVU1RPTSArIHRoZSBsYWJlbCAiSU5URVJORVQiCi0gICAgICAgICAgICAgICAgLnB1dChFbWFpbC5UWVBFLCBFbWFpbC5UWVBFX0NVU1RPTSkKLSAgICAgICAgICAgICAgICAucHV0KEVtYWlsLkxBQkVMLCAiSU5URVJORVQiKQotICAgICAgICAgICAgICAgIC5wdXQoRW1haWwuREFUQSwgImZvcnJlc3RndW1wQHdhbGxhZGFsbGEuY29tIikKLSAgICAgICAgICAgICAgICAucHV0KEVtYWlsLklTX1BSSU1BUlksIDEpOwotICAgICAgICBlbGVtLmFkZEV4cGVjdGVkKEVtYWlsLkNPTlRFTlRfSVRFTV9UWVBFKQotICAgICAgICAgICAgICAgIC5wdXQoRW1haWwuVFlQRSwgRW1haWwuVFlQRV9NT0JJTE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otICAgICAgICAgICAgICAgICAgICAgICAgQXJyYXlzLmFzTGlzdCgiXHU1Qjg5XHU4NUU0IiwgIlx1MzBFRFx1MzBBNFx1MzBDOVx1MDAzMSIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICIiLCAiIiwgIiIpLAotICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwgbUNvbnRlbnRWYWx1ZXNGb3JTSmlzLCBudWxsLCBudWxsKQotICAgICAgICAgICAgICAgIC5hZGRFeHBlY3RlZE5vZGVXaXRoT3JkZXIoIkZOIiwgIlx1NUI4OVx1ODVFNFx1MDAyMFx1MzBFRFx1MzBBNFx1MzBDOVx1MDAyMFx1MDAzMSIsCi0gICAgICAgICAgICAgICAgICAgICAgICBudWxsLCBudWxsLCBtQ29udGVudFZhbHVlc0ZvclNKaXMsIG51bGwsIG51bGwpCi0gICAgICAgICAgICAgICAgLmFkZEV4cGVjdGVkTm9kZVdpdGhPcmRlcigiU09VTkQiLAotICAgICAgICAgICAgICAgICAgICAgICAgIlx1RkY3MVx1RkY5RFx1RkY4NFx1RkY5RVx1RkY3MztcdUZGOUJcdUZGNzJcdUZGODRcdUZGOUVcdTAwMzE7OzsiLAotICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwgbnVsbCwgbUNvbnRlbnRWYWx1ZXNGb3JTSmlzLAotICAgICAgICAgICAgICAgICAgICAgICAgbmV3IFR5cGVTZXQoIlgtSVJNQy1OIiksIG51bGwpCi0gICAgICAgICAgICAgICAgLmFkZEV4cGVjdGVkTm9kZVdpdGhPcmRlcigiQURSIiwKLSAgICAgICAgICAgICAgICAgICAgICAgICI7XHU2NzcxXHU0RUFDXHU5MEZEXHU2RTBCXHU4QzM3XHU1MzNBXHU2ODVDIiArCi0gICAgICAgICAgICAgICAgICAgICAgICAiXHU0RTE4XHU3NTNBXHUwMDMyXHUwMDM2XHUwMDJEXHUwMDMxXHUzMEJCIiArCi0gICAgICAgICAgICAgICAgICAgICAgICAiXHUzMEVCXHUzMEVBXHUzMEEyXHUzMEYzXHUzMEJGXHUzMEVGXHUzMEZDXHUwMDM2IiArCi0gICAgICAgICAgICAgICAgICAgICAgICAiXHU5NjhFOzs7OzE1MC04NTEyOyIsCi0gICAgICAgICAgICAgICAgICAgICAgICBBcnJheXMuYXNMaXN0KCIiLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiXHU2NzcxXHU0RUFDXHU5MEZEXHU2RTBCXHU4QzM3XHU1MzNBXHU2ODVDIiArCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJcdTRFMThcdTc1M0FcdTAwMzJcdTAwMzZcdTAwMkRcdTAwMzFcdTMwQkIiICsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIlx1MzBFQlx1MzBFQVx1MzBBMlx1MzBGM1x1MzBCRlx1MzBFRlx1MzBGQyIgKwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiXHUwMDM2XHU5NjhFIiwgIiIsICIiLCAiIiwgIjE1MC04NTEyIiwgIiIpLAotICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwgbUNvbnRlbnRWYWx1ZXNGb3JRUEFuZFNKaXMsIG5ldyBUeXBlU2V0KCJIT01FIiksIG51bGwpCi0gICAgICAgICAgICAgICAgLmFkZEV4cGVjdGVkTm9kZVdpdGhPcmRlcigiTk9URSIsICJcdTMwRTFcdTMwRTIiLCBudWxsLCBudWxsLAotICAgICAgICAgICAgICAgICAgICAgICAgbUNvbnRlbnRWYWx1ZXNGb3JRUEFuZFNKaXMsIG51bGwsIG51bGwpOwotICAgIH0KLQotICAgIHB1YmxpYyB2b2lkIHRlc3RWMjFKYXBhbmVzZTJfVHlwZV9HZW5lcmljX1V0ZjgoKSB7Ci0gICAgICAgIG1WZXJpZmllci5pbml0Rm9ySW1wb3J0VGVzdChWMjEsIFIucmF3LnYyMV9qYXBhbmVzZV8yKTsKLSAgICAgICAgQ29udGVudFZhbHVlc1ZlcmlmaWVyRWxlbSBlb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ERSwgIjE1MC04NTEyIikKLSAgICAgICAgICAgICAgICAucHV0KFN0cnVjdHVyZWRQb3N0YWwuU1RSRUVULAotICAgICAgICAgICAgICAgICAgICAgICAgIlx1Njc3MVx1NEVBQ1x1OTBGRFx1NkUwQlx1OEMzN1x1NTMzQVx1Njg1QyIgKwotICAgICAgICAgICAgICAgICAgICAgICAgIlx1NEUxOFx1NzUzQVx1MDAzMlx1MDAzNlx1MDAyRFx1MDAzMVx1MzBCQiIgKwotICAgICAgICAgICAgICAgICAgICAgICAgIlx1MzBFQlx1MzBFQVx1MzBBMlx1MzBGM1x1MzBCRlx1MzBFRlx1MzBGQyIgKwotICAgICAgICAgICAgICAgICAgICAgICAgIlx1MDAzNlx1OTY4RSIpCi0gICAgICAgICAgICAgICAgLnB1dChTdHJ1Y3R1cmVkUG9zdGFsLkZPUk1BVFRFRF9BRERSRVNTLAotICAgICAgICAgICAgICAgICAgICAgICAgIlx1Njc3MVx1NEVBQ1x1OTBGRFx1NkUwQlx1OEMzN1x1NTMzQVx1Njg1QyIgKwotICAgICAgICAgICAgICAgICAgICAgICAgIlx1NEUxOFx1NzUzQVx1MDAzMlx1MDAzNlx1MDAyRFx1MDAzMVx1MzBCQiIgKwotICAgICAgICAgICAgICAgICAgICAgICAgIlx1MzBFQlx1MzBFQVx1MzBBMlx1MzBGM1x1MzBCRlx1MzBFRlx1MzBGQyIgKwotICAgICAgICAgICAgICAgICAgICAgICAgIlx1MDAzNlx1OTY4RSAxNTAtODUxMiIpCi0gICAgICAgICAgICAgICAgLnB1dChTdHJ1Y3R1cmVkUG9zdGFsLlRZUEUsIFN0cnVjdHVyZWRQb3N0YWwuVFlQRV9IT01FKTsKLSAgICAgICAgZWxlbS5hZGRFeHBlY3RlZChOb3RlLkNPTlRFTlRfSVRFTV9UWVBFKQotICAgICAgICAgICAgICAgIC5wdXQoTm90ZS5OT1RFLCAiXHUzMEUxXHUzMEUyIik7Ci0gICAgfQotCi0gICAgcHVibGljIHZvaWQgdGV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MLCAiTU9ERU0iKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuTlVNQkVSLCAiMTMiKTsKLSAgICAgICAgZWxlbS5hZGRFeHBlY3RlZChQaG9uZS5DT05URU5UX0lURU1fVFlQRSkKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLlRZUEUsIFBob25lLlRZUEVfUEFHRVIpCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5OVU1CRVIsICIxNCIpOwotICAgICAgICBlbGVtLmFkZEV4cGVjdGVkKFBob25lLkNPTlRFTlRfSVRFTV9UWVBFKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuVFlQRSwgUGhvbmUuVFlQRV9DVVNUT00pCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5MQUJFTCwgIk5FQy1GQU1JTFkiKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuTlVNQkVSLCAiMTUiKTsKLSAgICAgICAgZWxlbS5hZGRFeHBlY3RlZChQaG9uZS5DT05URU5UX0lURU1fVFlQRSkKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLlRZUEUsIFBob25lLlRZUEVfQ1VTVE9NKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuTEFCRUwsICJORUMtR0lSTCIpCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5OVU1CRVIsICIxNiIpOwotCi0gICAgICAgIGVsZW0gPSBtVmVyaWZpZXIuYWRkQ29udGVudFZhbHVlc1ZlcmlmaWVyRWxlbSgpOwotICAgICAgICBlbGVtLmFkZEV4cGVjdGVkKFN0cnVjdHVyZWROYW1lLkNPTlRFTlRfSVRFTV9UWVBFKQotICAgICAgICAgICAgICAgIC5wdXQoU3RydWN0dXJlZE5hbWUuRkFNSUxZX05BTUUsICJcdTVCODlcdTg1RTRcdTMwRURcdTMwQTRcdTMwQzlcdTAwMzUiKQotICAgICAgICAgICAgICAgIC5wdXQoU3RydWN0dXJlZE5hbWUuRElTUExBWV9OQU1FLCAiXHU1Qjg5XHU4NUU0XHUzMEVEXHUzMEE0XHUzMEM5XHUwMDM1IikKLSAgICAgICAgICAgICAgICAucHV0KFN0cnVjdHVyZWROYW1lLlBIT05FVElDX0dJVkVOX05BTUUsCi0gICAgICAgICAgICAgICAgICAgICAgICAiXHVGRjcxXHVGRjlEXHVGRjg0XHVGRjlFXHVGRjczXHVGRjlCXHVGRjcyXHVGRjg0XHVGRjlFXHUwMDM1Iik7Ci0gICAgICAgIGVsZW0uYWRkRXhwZWN0ZWQoUGhvbmUuQ09OVEVOVF9JVEVNX1RZUEUpCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5UWVBFLCBQaG9uZS5UWVBFX0NVU1RPTSkKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLkxBQkVMLCAiTkVDLUJPWSIpCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5OVU1CRVIsICIxNyIpOwotICAgICAgICBlbGVtLmFkZEV4cGVjdGVkKFBob25lLkNPTlRFTlRfSVRFTV9UWVBFKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuVFlQRSwgUGhvbmUuVFlQRV9DVVNUT00pCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5MQUJFTCwgIk5FQy1GUklFTkQiKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuTlVNQkVSLCAiMTgiKTsKLSAgICAgICAgZWxlbS5hZGRFeHBlY3RlZChQaG9uZS5DT05URU5UX0lURU1fVFlQRSkKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLlRZUEUsIFBob25lLlRZUEVfQ1VTVE9NKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuTEFCRUwsICJORUMtUEhTIikKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLk5VTUJFUiwgIjE5Iik7Ci0gICAgICAgIGVsZW0uYWRkRXhwZWN0ZWQoUGhvbmUuQ09OVEVOVF9JVEVNX1RZUEUpCi0gICAgICAgICAgICAgICAgLnB1dChQaG9u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0gICAgICAgICAgICAgICAgICAgICAgICBjb250ZW50VmFsdWVzKQotICAgICAgICAgICAgICAgIC5hZGRFeHBlY3RlZE5vZGUoIk4iLCAiXHUzMDc1XHUzMDhCXHUzMDY5O1x1MzA5MVx1MzA4QVx1MzA0QjtCO0RyLjtQaC5EIiwKLSAgICAgICAgICAgICAgICAgICAgICAgIEFycmF5cy5hc0xpc3QoCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJcdTMwNzVcdTMwOEJcdTMwNjkiLCAiXHUzMDkxXHUzMDhBXHUzMDRCIiwgIkIiLCAiRHIuIiwgIlBoLkQiKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwgY29udGVudFZhbHVlcywgbnVsbCwgbnVsbCk7Ci0gICAgfQotCi0gICAgcHVibGljIHZvaWQgdGVzdE5hbWVVdGY4VjIxKCkgewotICAgICAgICB0ZXN0TmFtZVV0ZjhDb21tb24oVkNhcmRDb25maWcuVkNBUkRfVFlQRV9WMjFfSkFQQU5FU0VfVVRGOCk7Ci0gICAgfQotCi0gICAgcHVibGljIHZvaWQgdGVzdE5hbWVVdGY4VjMwKCkgewotICAgICAgICB0ZXN0TmFtZVV0ZjhDb21tb24oVkNhcmRDb25maWcuVkNBUkRfVFlQRV9WMzBfSkFQQU5FU0VfVVRGOCk7Ci0gICAgfQotCi0gICAgcHVibGljIHZvaWQgdGVzdE5hbWVTaGlmdEppcygpIHsKLSAgICAgICAgbVZlcmlmaWVyLmluaXRGb3JFeHBvcnRUZXN0KFZDYXJkQ29uZmlnLlZDQVJEX1RZUEVfVjMwX0pBUEFORVNFX1NKSVMpOwotICAgICAgICBDb250YWN0RW50cnkgZW50cnkgPSBtVmVyaWZpZXIuYWRkSW5wdXRFbnRyeSgpOwotICAgICAgICBlbnRyeS5hZGRDb250ZW50VmFsdWVzKFN0cnVjdHVyZWROYW1lLkNPTlRFTlRfSVRFTV9UWVBFKQotICAgICAgICAgICAgICAgIC5wdXQoU3RydWN0dXJlZE5hbWUuRkFNSUxZX05BTUUsICJcdTMwNzVcdTMwOEJcdTMwNjkiKQotICAgICAgICAgICAgICAgIC5wdXQoU3RydWN0dXJlZE5hbWUuR0lWRU5fTkFNRSwgIlx1MzA5MVx1MzA4QVx1MzA0QiIpCi0gICAgICAgICAgICAgICAgLnB1dChTdHJ1Y3R1cmVkTmFtZS5NSURETEVfTkFNRSwgIkIiKQotICAgICAgICAgICAgICAgIC5wdXQoU3RydWN0dXJlZE5hbWUuUFJFRklYLCAiRHIuIikKLSAgICAgICAgICAgICAgICAucHV0KFN0cnVjdHVyZWROYW1lLlNVRkZJWCwgIlBoLkQiKTsKLQotICAgICAgICBtVmVyaWZpZXIuYWRkUHJvcGVydHlOb2Rlc1ZlcmlmaWVyRWxlbSgpCi0gICAgICAgICAgICAgICAgLmFkZEV4cGVjdGVkTm9kZSgiRk4iLCAiRHIuIFx1MzA3NVx1MzA4Qlx1MzA2OSBCIFx1MzA5MVx1MzA4QVx1MzA0QiBQaC5EIiwKLSAgICAgICAgICAgICAgICAgICAgICAgIG1Db250ZW50VmFsdWVzRm9yU0ppcykKLSAgICAgICAgICAgICAgICAuYWRkRXhwZWN0ZWROb2RlKCJOIiwgIlx1MzA3NVx1MzA4Qlx1MzA2OTtcdTMwOTFcdTMwOEFcdTMwNEI7QjtEci47UGguRCIsCi0gICAgICAgICAgICAgICAgICAgICAgICBBcnJheXMuYXNMaXN0KAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiXHUzMDc1XHUzMDhCXHUzMDY5IiwgIlx1MzA5MVx1MzA4QVx1MzA0QiIsICJCIiwgIkRyLiIsICJQaC5EIiksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsIG1Db250ZW50VmFsdWVzRm9yU0ppcywgbnVsbCwgbnVsbCk7Ci0gICAgfQotCi0gICAgLyoqCi0gICAgICogRG9Db01vIHBob25lcyByZXF1aXJlIGFsbCBuYW1lIGVsZW1lbnRzIHNob3Vs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WVzKQotICAgICAgICAgICAgICAgIC5hZGRFeHBlY3RlZE5vZGUoIlgtUEhPTkVUSUMtTUlERExFLU5BTUUiLAotICAgICAgICAgICAgICAgICAgICAgICAgIlx1MzBERlx1MzBDOVx1MzBFQlx1MzBDRFx1MzBGQ1x1MzBFMCIsCi0gICAgICAgICAgICAgICAgICAgICAgICBjb250ZW50VmFsdWVzKQotICAgICAgICAgICAgICAgIC5hZGRFeHBlY3RlZE5vZGUoIlgtUEhPTkVUSUMtRklSU1QtTkFNRSIsICJcdTMwNUZcdTMwOERcdTMwNDYiLAotICAgICAgICAgICAgICAgICAgICAgICAgY29udGVudFZhbHVlcyk7Ci0gICAgICAgIGlmIChWQ2FyZENvbmZpZy5pc1YzMCh2Y2FyZFR5cGUpKSB7Ci0gICAgICAgICAgICBlbGVtLmFkZEV4cGVjdGVkTm9kZSgiU09SVC1TVFJJTkciLAotICAgICAgICAgICAgICAgICAgICAiXHUzMDg0XHUzMDdFXHUzMDYwIFx1MzBERlx1MzBDOVx1MzBFQlx1MzBDRFx1MzBGQ1x1MzBFMCBcdTMwNUZcdTMwOERcdTMwNDYiLAotICAgICAgICAgICAgICAgICAgICBjb250ZW50VmFsdWVzKTsKLSAgICAgICAgfQotICAgICAgICBDb250ZW50VmFsdWVzQnVpbGRlciBidWlsZGVyID0gbVZlcmlmaWVyLmFkZENvbnRlbnRWYWx1ZXNWZXJpZmllckVsZW0oKQotICAgICAgICAgICAgICAgIC5hZGRFeHBlY3RlZChTdHJ1Y3R1cmVkTmFtZS5DT05URU5UX0lURU1fVFlQRSk7Ci0gICAgICAgIGJ1aWxkZXIucHV0KFN0cnVjdHVyZWROYW1lLlBIT05FVElDX0ZBTUlMWV9OQU1FLCAiXHUzMDg0XHUzMDdFXHUzMDYwIikKLSAgICAgICAgICAgICAgICAucHV0KFN0cnVjdHVyZWROYW1lLlBIT05FVElDX01JRERMRV9OQU1FLCAiXHUzMERGXHUzMEM5XHUzMEVCXHUzMENEXHUzMEZDXHUz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XJpZmllciAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgYnVpbGRlciA9IG5ldyBWQ2FyZEludGVycHJldGVyQ29sbGVjdGlvbihBcnJheXMuYXNMaXN0KAotICAgICAgICAgICAgICAgICAgICAgICAgbVByb3BlcnR5Tm9kZXNWZXJpZmllciwgdmNhcmREYXRhQnVpbGRlcikpOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBidWlsZGVyID0gdm5vZGVCdWlsZGVyOwotICAgICAgICAgICAgfQotICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgaWYgKG1Qcm9wZXJ0eU5vZGVzVmVyaWZpZXIgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgIGJ1aWxkZXIgPSBtUHJvcGVydHlOb2Rlc1ZlcmlmaWVyOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICByZXR1cm47Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQotICAgICAgICBmaW5hbCBWQ2FyZFBhcnNlciBwYXJzZXIgPQotICAgICAgICAgICAgICAgIChtSXNWMzAgPyBuZXcgVkNhcmRQYXJzZXJfVjMwKHRydWUpIDogbmV3IFZDYXJkUGFyc2VyX1YyMSgpKTsKLSAgICAgICAgSW5wdXRTdHJlYW0gaXMgPSBudWxsOwotICAgICAgICB0cnkgewotICAgICAgICAgICAgU3RyaW5nIGNoYXJzZXQgPQotICAgICAgICAgICAgICAgIChWQ2FyZENvbmZpZy51c2VzU2hpZnRKaXMobVZDYXJkVHlwZSkgPyAiU0hJRlRfSklTIiA6ICJVVEYtOCIpOwotICAgICAgICAgICAgaXMgPSBuZXcgQnl0ZUFycmF5SW5wdXRTdHJlYW0odmNhcmQuZ2V0Qnl0ZXMoY2hhcnNldCkpOwotICAgICAgICAgICAgbVRlc3RDYXNlLmFzc2VydEVxdWFscyh0cnVlLCBwYXJzZXIucGFyc2UoaXMsIG51bGwsIGJ1aWxkZXIpKTsKLSAgICAgICA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WZpZXIpOwotICAgICAgICBjb21wb3Nlci5hZGRIYW5kbGVyKG1WQ2FyZFZlcmlmaWVySW50ZXJuYWwpOwotICAgICAgICBpZiAoIWNvbXBvc2VyLmluaXQoVkNhcmRDb21wb3Nlci5DT05UQUNUU19URVNUX0NPTlRFTlRfVVJJLCBudWxsLCBudWxsLCBudWxsKSkgewotICAgICAgICAgICAgbVRlc3RDYXNlLmZhaWwoImluaXQoKSBmYWlsZWQuIFJlYXNvbjogIiArIGNvbXBvc2VyLmdldEVycm9yUmVhc29uKCkpOwotICAgICAgICB9Ci0gICAgICAgIG1UZXN0Q2FzZS5hc3NlcnRGYWxzZShjb21wb3Nlci5pc0FmdGVyTGFzdCgpKTsKLSAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgIHdoaWxlICghY29tcG9zZXIuaXNBZnRlckxhc3QoKSkgewotICAgICAgICAgICAgICAgIHRyeSB7Ci0gICAgICAgICAgICAgICAgICAgIGZpbmFsIE1ldGhvZCBtb2NrR2V0RW50aXR5SXRlcmF0b3JNZXRob2QgPSBnZXRNb2NrR2V0RW50aXR5SXRlcmF0b3JNZXRob2QoKTsKLSAgICAgICAgICAgICAgICAgICAgbVRlc3RDYXNlLmFzc2VydFRydWUoCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgY29tcG9zZXIuY3JlYXRlT25lRW50cnkoZ2V0TW9ja0dldEVudGl0eUl0ZXJhdG9yTWV0aG9kKCkpKTsKLSAgICAgICAgICAgICAgICB9IGNhdGNoIChFeGNlcHRpb24gZSkgewotICAgICAgICAgICAgICAgICAgICBlLnByaW50U3RhY2tUcmFjZSgpOwotICAgICAgICAgICAgICAgICAgICBtVGVzdENhc2UuZmFpbCgpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgfSBmaW5hbGx5IHsKLSAgICAgICAgICAgIGNvbXBvc2VyLnRlcm1pbmF0ZSgpOwotICAgICAgICB9Ci0gICAgfQotfQpkaWZmIC0tZ2l0I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S5wcm9wVmFsdWVfYnl0ZXMgPQotICAgICAgICAgICAgICAgICAgICBCYXNlNjQuZGVjb2RlQmFzZTY0KHZhbHVlLmdldEJ5dGVzKCkpOwotICAgICAgICAgICAgICAgIHJldHVybiB2YWx1ZTsKLSAgICAgICAgICAgIH0gZWxzZSBpZiAoZW5jb2RpbmcuZXF1YWxzKCJRVU9URUQtUFJJTlRBQkxFIikpIHsKLSAgICAgICAgICAgICAgICBTdHJpbmcgcXVvdGVkUHJpbnRhYmxlID0gdmFsdWUKLSAgICAgICAgICAgICAgICAucmVwbGFjZUFsbCgiPSAiLCAiICIpLnJlcGxhY2VBbGwoIj1cdCIsICJcdCIpOwotICAgICAgICAgICAgICAgIFN0cmluZ1tdIGxpbmVzOwotICAgICAgICAgICAgICAgIGlmIChtU3RyaWN0TGluZUJyZWFrUGFyc2luZykgewotICAgICAgICAgICAgICAgICAgICBsaW5lcyA9IHF1b3RlZFByaW50YWJsZS5zcGxpdCgiXHJcbiIpOwotICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIFN0cmluZ0J1aWxkZXIgYnVpbGRlciA9IG5ldyBTdHJpbmdCdWlsZGVyKCk7Ci0gICAgICAgICAgICAgICAgICAgIGludCBsZW5ndGggPSBxdW90ZWRQcmludGFibGUubGVuZ3RoKCk7Ci0gICAgICAgICAgICAgICAgICAgIEFycmF5TGlzdDxTdHJpbmc+IGxpc3QgPSBuZXcgQXJyYXlMaXN0PFN0cmluZz4oKTsKLSAgICAgICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBsZW5ndGg7IGkrKykgewotICAgICAgICAgICAgICAgICAgICAgICAgY2hhciBjaCA9IHF1b3RlZFByaW50YWJsZS5jaGFyQXQoaSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoY2ggPT0gJ1xuJykgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpc3QuYWRkKGJ1aWxkZXIudG9TdHJpbmcoKSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnVpbGRlciA9IG5ldyBTdHJpbmdCdWlsZGVyKCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGNoID09ICdccicpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaXN0LmFkZChidWlsZGVyLnRvU3RyaW5nKCkpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1aWxkZXIgPSBuZXcgU3RyaW5nQnVpbGRlcigpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpIDwgbGVuZ3RoIC0gMSkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGFyIG5leHRDaCA9IHF1b3RlZFByaW50YWJsZS5jaGFyQXQoaSArIDEpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobmV4dENoID09ICdcbicpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkrKzsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnVpbGRlci5hcHBlbmQoY2gpOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIFN0cmluZyBmaW5hbExpbmUgPSBidWlsZGVyLnRvU3RyaW5nKCk7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChmaW5hbExpbmUubGVuZ3RoKCkgPiAwKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBsaXN0LmFkZChmaW5hbExpbmUpOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIGxpbmVzID0gbGlzdC50b0FycmF5KG5ldyBTdHJpbmdbMF0pOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBTdHJpbmdCdWlsZGVyIGJ1aWxkZXIgPSBuZXcgU3RyaW5nQnVpbGRlcigpOwotICAgICAgICAgICAgICAgIGZvciAoU3RyaW5nIGxpbmUgOiBsaW5lcykgewotICAgICAgICAgICAgICAgICAgICBpZiAobGluZS5lbmRzV2l0aCgiPSIpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBsaW5lID0gbGluZS5zdWJzdHJpbmcoMCwgbGluZS5sZW5ndGgoKSAtIDEpOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIGJ1aWxkZXIuYXBwZW5kKGxpbmUpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBieXRlW10gYnl0ZXM7Ci0gICAgICAgICAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgICAgICAgICAgYnl0ZXMgPSBidWlsZGVyLnRvU3RyaW5nKCkuZ2V0Qnl0ZXMobVNvdXJjZUNoYXJzZXQpOwotICAgICAgICAgICAgICAgIH0gY2F0Y2ggKFVuc3VwcG9ydGVkRW5jb2RpbmdFeGNlcHRpb24gZTEpIHsKLSAgICAgICAgICAgICAgICAgICAgTG9nLmUoTE9HX1RBRywgIkZhaWxlZCB0byBlbmNvZGU6IGNoYXJzZXQ9IiArIG1Tb3VyY2VDaGFyc2V0KTsKLSAgICAgICAgICAgICAgICAgICAgYnl0ZXMgPSBidWlsZGVyLnRvU3RyaW5nKCkuZ2V0Qnl0ZXMoKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgCi0gICAgICAgICAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgICAgICAgICAgYnl0ZXMgPSBRdW90ZWRQcmludGFibGVDb2RlYy5kZWNvZGVRdW90ZWRQcmludGFibGUoYnl0ZXMpOwotICAgICAgICAgICAgICAgIH0gY2F0Y2ggKERlY29kZXJFeGNlcHRpb24gZSkgewotICAgICAgICAgICAgICAgICAgICBMb2cuZSh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AgICAgICAgaW50IHJlc3VsdERpciA9IFN0YXRpY0xheW91dC5iaWRpKGRpciwgY2hzLCBjaEluZm8sIG4sIGZhbHNlKTsKLSAgICAgICAgCi0gICAgICAgIHsKLSAgICAgICAgICAgIFN0cmluZ0J1aWxkZXIgc2IgPSBuZXcgU3RyaW5nQnVpbGRlcigiaW5mbzoiKTsKLSAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbjsgKytpKSB7Ci0gICAgICAgICAgICAgICAgc2IuYXBwZW5kKCIgIikuYXBwZW5kKFN0cmluZy52YWx1ZU9mKGNoSW5mb1tpXSkpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgTG9nLmkoIkJJREkiLCBzYi50b1N0cmluZygpKTsKLSAgICAgICAgfQotICAgICAgICAKLSAgICAgICAgY2hhcltdIHJlc3VsdExldmVsQ2hhcnMgPSBuZXcgY2hhcltuXTsKLSAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBuOyArK2kpIHsKLSAgICAgICAgICAgIHJlc3VsdExldmVsQ2hhcnNbaV0gPSAoY2hhcikoJzAnICsgY2hJbmZvW2ldKTsKLSAgICAgICAgfQotICAgICAgICBTdHJpbmcgcmVzdWx0TGV2ZWxzID0gbmV3IFN0cmluZyhyZXN1bHRMZXZlbENoYXJzKTsKLSAgICAgICAgYXNzZXJ0RXF1YWxzKCJkaXJlY3Rpb24iLCBleHBlY3RlZERpciwgcmVzdWx0RGlyKTsKLSAgICAgICAgYXNzZXJ0RXF1YWxzKCJsZXZlbHMiLCBleHBlY3RlZExldmVscywgcmVzdWx0TGV2ZWxzKTsKKyAgICAgICAgZXhwZWN0TmF0aXZlQmlkaShSRVFfREwsICBBTEVGICsgQkVUICsgR0lNRUwgKyAiIGFiYyIsICIxMTExMjIyIiwgUik7CiAgICAgfQogICAgIAogICAgIC8vQFNtYWxsVGVzdAogICAgIHB1YmxpYyB2b2lkIHRlc3ROYXRpdmVCaWRpKCkgewotICAgICAgICAvLyBuYXRpd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AgICAgICIgIiwKKyAgICAgICAgImEiLAorICAgICAgICAiYTEiLAorICAgICAgICAiYUEiLAorICAgICAgICAiYTFiIiwKKyAgICAgICAgImExQSIsCisgICAgICAgICJhQTEiLAorICAgICAgICAiYUFiIiwKKyAgICAgICAgImFBMUIiLAorICAgICAgICAiYUExQjIiLAorCisgICAgICAgIC8vIHJ0bAorICAgICAgICAiQSIsCisgICAgICAgICJBMSIsCisgICAgICAgICJBYSIsCisgICAgICAgICJBMUIiLAorICAgICAgICAiQTFhIiwKKyAgICAgICAgIkFhMSIsCisgICAgICAgICJBYUIiCisgICAgfTsKKworICAgIC8vIEV4cGVjdGVkIGRpcmVjdGlvbnMgYXJlIGFuIGFycmF5IG9mIHN0YXJ0L2xlbmd0aCtsZXZlbCBwYWlycywKKyAgICAvLyBpbiB2aXN1YWwgb3JkZXIgZnJvbSB0aGUgbGVhZGluZyBtYXJnaW4uCisgICAgcHJpdmF0ZSBzdGF0aWMgRGlyZWN0aW9uc1tdIGV4cGVjdGVkID0geworICAgICAgICBESVJTX0FMTF9MRUZUX1RPX1JJR0hULAorICAgICAgICBESVJTX0FMTF9MRUZUX1RPX1JJR0hULAorICAgICAgICBESVJTX0FMTF9MRUZUX1RPX1JJR0hULAorICAgICAgICBESVJTX0FMTF9MRUZUX1RPX1JJR0hULAorICAgICAgICBkaXJzKDAsIDEsIDEsIExWTDFfMSksCisgICAgICAgIERJUlNfQUxMX0xFRlRfVE9fUklHSFQsCisgICAgICAgIGRpcnMoMCwgMiwgMiwgTFZMMV8xKSwKKyAgICAgICAgZGlycygwLCAxLCAyLCBMVkwyXzEsIDEsIExWTDFfMSksCisgICAgICAgIGRpcnMoMCwgMSwgMSwgTFZMMV8xLCAyLCAxKSwKKyAgICAgICAgZGlycygwLCAxLCAzLCBMVkwxXzEsIDIsIExWTDJfMSwgMSwgTFZMMV8xKSwKKyAgICAgICAgZGlycygwLCAxLCA0LCBMVkwyXzEsIDMsIExWTDFfMSwgMiwgTFZMMl8xLCAxLCBMVkwxXzEpLAorCisgICAgICAgIC8vIHJ0bAorICAgICAgICBESVJTX0FMTF9SSUdIVF9UT19MRUZULAorICAgICAgICBkaXJzKDAsIExWTDFfMSwgMSwgTFZMMl8xKSwKKyAgICAgICAgZGlycygwLCBMVkwxXzEsIDEsIExWTDJfMSksCisgICAgICAgIGRpcnMoMCwgTFZMMV8xLCAxLCBMVkwyXzEsIDIsIExWTDFfMSksCisgICAgICAgIGRpcnMoMCwgTFZMMV8xLCAxLCBMVkwyXzIpLAorICAgICAgICBkaXJzKDAsIExWTDFfMSwgMSwgTFZMMl8yKSwKKyAgICAgICAgZGlycygwLCBMVkwxXzEsIDEsIExWTDJfMSwgMiwgTFZMMV8xKSwKKyAgICB9OworCisgICAgcHJpdmF0ZSBzdGF0aWMgU3RyaW5nIHBzZXVkb0JpZGlUb1JlYWwoU3RyaW5nIHNyYykgeworICAgICAgICBjaGFyW10gY2hhcnMgPSBzcmMudG9DaGFyQXJyYXkoKTsKKyAgICAgICAgZm9yIChpbnQgaiA9IDA7IGogPCBjaGFycy5sZW5ndGg7ICsraikgeworICAgICAgICAgICAgY2hhciBjID0gY2hhcnNbal07CisgICAgICAgICAgICBpZiAoYyA+PSAnQScgJiYgYyA8PSAnRCcpIHsKKyAgICAgICAgICAgICAgICBjaGFyc1tqXSA9IChjaGFyKShBTEVGICsgYyAtICdBJyk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gbmV3IFN0cmluZyhjaGFycywgMCwgY2hhcnMubGVuZ3RoKTsKKyAgICB9CisKKyAgICAvLyBAU21hbGxUZXN0CisgICAgcHVibGljIHZvaWQgdGVzdERpcmVjdGlvbnMoKSB7CisgICAgICAgIFN0cmluZ0J1aWxkZXIgYnVmID0gbmV3IFN0cmluZ0J1aWxkZXIoIlxuIik7CisgICAgICAgIEZvcm1hdHRlciBmID0gbmV3IEZvcm1hdHRlcihidWYpOworCisgICAgICAgIExheW91dEJ1aWxkZXIgYiA9IFN0YXRpY0xheW91dFRlc3QuYnVpbGRlcigpOworICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IHRleHRzLmxlbmd0aDsgKytpKSB7CisgICAgICAgICAgICBiLnNldFRleHQocHNldWRvQmlkaVRvUmVhbCh0ZXh0c1tpXSkpOworICAgICAgICAgICAgY2hlY2tEaXJlY3Rpb25zKGIuYnVpbGQoKSwgaSwgYi50ZXh0LCBleHBlY3RlZCwgZik7CisgICAgICAgIH0KKyAgICAgICAgaWYgKGJ1Zi5sZW5ndGgoKSA+IDEpIHsKKyAgICAgICAgICAgIGZhaWwoYnVmLnRvU3RyaW5nKCkpOworICAgICAgICB9CisgICAgfQorCisgICAgLy8gQFNtYWxsVGVzdAorICAgIHB1YmxpYyB2b2lkIHRlc3RUcmFpbGluZ1doaXRlc3BhY2UoKSB7CisgICAgICAgIExheW91dEJ1aWxkZXIgYiA9IFN0YXRpY0xheW91dFRlc3QuYnVpbGRlcigpOworICAgICAgICBiLnNldFRleHQocHNldWRvQmlkaVRvUmVhbCgiQWIgICBjIikpOworICAgICAgICBmbG9hdCB3aWR0aCA9IGIucGFpbnQubWVhc3VyZVRleHQoYi50ZXh0LCAwLCA1KTsgIC8vIGV4Y2x1ZGUgJ2MnCisgICAgICAgIGIuc2V0V2lkdGgoTWF0aC5yb3VuZCh3aWR0aCkpOworICAgICAgICBMYXlvdXQgbCA9IGIuYnVpbGQoKTsKKyAgICAgICAgaWYgKGwuZ2V0TGluZUNvdW50KCkgIT0gMikgeworICAgICAgICAgICAgdGhyb3cgbmV3IFJ1bnRpbWVFeGNlcHRpb24oImV4cGVjdGVkIDIgbGluZXMsIGdvdDogIiArIGwuZ2V0TGluZUNvdW50KCkpOworICAgICAgICB9CisgICAgICAgIERpcmVjdGlvbnMgcmVzdWx0ID0gbC5nZXRMaW5lRGlyZWN0aW9ucygwKTsKKyAgICAgICAgRGlyZWN0aW9ucyBleHBlY3RlZCA9IGRpcnMoMCwgTFZMMV8xLCAxLCBMVkwyXz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gICAgICAgICAgICAgZmFpbCgib2Zmc2V0WyIgKyBpICsgIl0gdG8gcmlnaHQgb2Y6ICIgKyBuICsgIiBleHBlY3RlZDogIiArCisgICAgICAgICAgICAgICAgICAgICAgICBleHBlY3RlZFtpXSArICIgZ290OiAiICsgdCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBuID0gdDsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHRlc3ROZXh0VG9MZWZ0T2YoKSB7CisgICAgICAgIExheW91dEJ1aWxkZXIgYiA9IFN0YXRpY0xheW91dFRlc3QuYnVpbGRlcigpOworICAgICAgICBiLnNldFRleHQocHNldWRvQmlkaVRvUmVhbCgiYUExQjIiKSk7CisgICAgICAgIGludFtdIGV4cGVjdGVkID0geyAwLCAxLCA0LCAzLCAyLCA1IH07CisgICAgICAgIExheW91dCBsID0gYi5idWlsZCgpOworICAgICAgICBpbnQgbiA9IDU7CisgICAgICAgIGZvciAoaW50IGkgPSBleHBlY3RlZC5sZW5ndGggLSAxOyAtLWkgPj0gMDspIHsKKyAgICAgICAgICAgIGludCB0ID0gbC5nZXRPZmZzZXRUb0xlZnRPZihuKTsKKyAgICAgICAgICAgIGlmICh0ICE9IGV4cGVjdGVkW2ldKSB7CisgICAgICAgICAgICAgICAgZmFpbCgib2Zmc2V0WyIgKyBpICsgIl0gdG8gbGVmdCBvZjogIiArIG4gKyAiIGV4cGVjdGVkOiAiICsKKyAgICAgICAgICAgICAgICAgICAgICAgIGV4cGVjdGVkW2ldICsgIiBnb3Q6ICIgKyB0KTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG4gPSB0OworICAgICAgICB9CisgICAgfQorCisgICAgLy8gdXRpbGl0eSwgbm90IHJlYWxseSBhIHRlc3QKKyAgICAvKgorICAgIHB1YmxpYyB2b2lkIHRlc3RNZWFzdXJlVGV4dDEoKSB7CisgICAgICAgIExheW91dEJ1aWxkZXIgYiA9IFN0YXRpY0xheW91dFRlc3QuYnVpbGRlcigpOworICAgICAgICBTdHJpbmcgdGV4dCA9ICJBQkMiOyAvLyAiYWJBQiIKKyAgICAgICAgYi5zZXRUZXh0KHBzZXVkb0JpZGlUb1JlYWwodGV4dCkpOworICAgICAgICBMYXlvdXQgbCA9IGIuYnVpbGQoKTsKKyAgICAgICAgRGlyZWN0aW9ucyBkaXJlY3Rpb25zID0gbC5nZXRMaW5lRGlyZWN0aW9ucygwKTsKKworICAgICAgICBUZXh0UGFpbnQgd29ya1BhaW50ID0gbmV3IFRleHRQYWludCgpOworCisgICAgICAgIGludCBkaXIgPSAtMTsgLy8gTEVGVF9UT19SSUdIVAorICAgICAgICBib29sZWFuIHRyYWlsaW5nID0gdHJ1ZTsKKyAgICAgICAgYm9vbGVhbiBhbHQgPSB0cnVlOworICAgICAgICBkbyB7CisgICAgICAgICAgICBkaXIgPSAtZGlyOworICAgICAgICAgICAgZG8geworICAgICAgICAgICAgICAgIHRyYWlsaW5nID0gIXRyYWlsaW5nOworICAgICAgICAgICAgICAgIGZvciAoaW50IG9mZnNldCA9IDAsIGVuZCA9IGIudGV4dC5sZW5ndGgoKTsgb2Zmc2V0IDw9IGVuZDsgKytvZmZzZXQpIHsKKyAgICAgICAgICAgICAgICAgICAgZmxvYXQgd2lkdGggPSBMYXlvdXQubWVhc3VyZVRleHQoYi5wYWludCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB3b3JrUGFpbnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgYi50ZXh0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAsIG9mZnNldCwgZW5kLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpciwgZGlyZWN0aW9ucywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFpbGluZywgZmFsc2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCk7CisgICAgICAgICAgICAgICAgICAgIExvZy5pKCJCSURJIiwgImRpcjogIiArIGRpciArICIgdHJhaWw6ICIgKyB0cmFpbGluZyArCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIiBvZmZzZXQ6ICIgKyBvZmZzZXQgKyAiIHdpZHRoOiAiICsgd2lkdGgpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0gd2hpbGUgKCF0cmFpbGluZyk7CisgICAgICAgIH0gd2hpbGUgKGRpciA+IDApOworICAgIH0KKyAgICAqLworCisgICAgLy8gdXRpbGl0eSBmb3IgZGlzcGxheWluZyBhcnJheXMgaW4gaGV4CisgICAgcHJpdmF0ZSBzdGF0aWMgU3RyaW5nIGhleEFycmF5KGludFtdIGFycmF5KSB7CisgICAgICAgIFN0cmluZ0J1aWxkZXIgc2IgPSBuZXcgU3RyaW5nQnVpbGRlcigpOworICAgICAgICBzYi5hcHBlbmQoJ3snKTsKKyAgICAgICAgZm9yIChpbnQgaSA6IGFycmF5KSB7CisgICAgICAgICAgICBpZiAoc2IubGVuZ3RoKCkgPiAxKSB7CisgICAgICAgICAgICAgICAgc2IuYXBwZW5kKCIsICIpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgc2IuYXBwZW5kKEludGVnZXIudG9IZXhTdHJpbmcoaSkpOworICAgICAgICB9CisgICAgICAgIHNiLmFwcGVuZCgnfScpOworICAgICAgICByZXR1cm4gc2IudG9TdHJpbmcoKTsKKyAgICB9CisKKyAgICBwcml2YXRlIHZvaWQgY2hlY2tEaXJlY3Rpb25zKExheW91dCBsLCBpbnQgaSwgU3RyaW5nIHRleHQsCisgICAgICAgICAgICBEaXJlY3Rpb25zW10gZXhwZWN0ZWREaXJzLCBGb3JtYXR0ZXIgZikgeworICAgICAgICBEaXJlY3Rpb25zIGV4cGVjdGVkID0gZXhwZWN0ZWREaXJzW2ldOworICAgICAgICBEaXJlY3Rpb25zIHJlc3VsdCA9IGwuZ2V0TGluZURpcmVjdGlvbnMoMCk7CisgICAgICAgIGlmICghQXJyYXlzLmVxdWFscyhleHBlY3RlZC5tRGlyZWN0aW9ucywgcmVzdW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gdGhlIEV4cGFuZGFibGVMaXN0VmlldyB3aWRnZXQuCi0gICAgICogQHJldHVybiBUaGUgbWFpbiB3aWRnZXQuCi0gICAgICovCi0gICAgcHVibGljIEV4cGFuZGFibGVMaXN0VmlldyBnZXRFeHBhbmRhYmxlTGlzdFZpZXcoKSB7Ci0gICAgICAgIHJldHVybiAoRXhwYW5kYWJsZUxpc3RWaWV3KSBzdXBlci5nZXRMaXN0VmlldygpOwotICAgIH0KLQotICAgIHB1YmxpYyBzdGF0aWMgY2xhc3MgRXhwYW5kYWJsZVBhcmFtcyBleHRlbmRzIFBhcmFtcyB7Ci0gICAgICAgIHByaXZhdGUgaW50W10gbU51bUNoaWxkcmVuOwotICAgICAgICAKLSAgICAgICAgLyoqCi0gICAgICAgICAqIFNldHMgdGhlIG51bWJlciBvZiBjaGlsZHJlbiBwZXIgZ3JvdXAuCi0gICAgICAgICAqICAKLSAgICAgICAgICogQHBhcmFtIG51bUNoaWxkcmVuUGVyR3JvdXAgVGhlIG51bWJlciBvZiBjaGlsZHJlbiBwZXIgZ3JvdXAuCi0gICAgICAgICAqLwotICAgICAgICBwdWJsaWMgRXhwYW5kYWJsZVBhcmFtcyBzZXROdW1DaGlsZHJlbihpbnRbXSBudW1DaGlsZHJlbikgewotICAgICAgICAgICAgbU51bUNoaWxkcmVuID0gbnVtQ2hpbGRyZW47Ci0gICAgICAgICAgICByZXR1cm4gdGhpczsKLSAgICAgICAgfQotCi0gICAgICAgIC8qKgotICAgICAgICAgKiBTZXRzIHRoZSBudW1iZXIgb2YgaXRlbXMgb24gdGhlIHN1cGVyY2xhc3MgYmFzZWQgb24gdGhlIG51bWJlciBvZgotICAgICAgICAgKiBncm91cHMgYW5kIGNoaWxkcmVuIHBlciBncm91cC4KLSAgICAgICAgICovCi0gICAgICAgIHByaXZhdGUgRXhwYW5kYWJsZVBhcmFtcyBzdXBlclNldE51bUl0ZW1zKCkgewotICAgICAgICAgICAgaW50IG51bUl0ZW1zID0gMDsKLSAgICAgICAgICAgIAotICAgICAgICAgICAgaWYgKG1OdW1DaGlsZHJlbiAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IG1OdW1DaGlsZHJlbi5sZW5ndGggLSAxOyBpID49IDA7IGktLSkgewotICAgICAgICAgICAgICAgICAgICBudW1JdGVtcyArPSBtTnVtQ2hpbGRyZW5baV07Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICAgICAgCi0gICAgICAgICAgICBzdXBlci5zZXROdW1JdGVtcyhudW1JdGVtcyk7Ci0gICAgICAgICAgICAKLSAgICAgICAgICAgIHJldHVybiB0aGlzOwotICAgICAgICB9Ci0gICAgICAgIAotICAgICAgICBAT3ZlcnJpZGUKLSAgICAgICAgcHVibGljIFBhcmFtcyBzZXROdW1JdGVtcyhpbnQgbnVtSXRlbXMpIHsKLSAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oIlVzZSBzZXROdW1Hcm91cHMgYW5kIHNldE51bUNoaWxkcmVuIGluc3RlYWQuIik7Ci0gICAgICAgIH0KLQotICAgICAgICBAT3ZlcnJpZGUKLSAgICAgICAgcHVibGljIEV4cGFuZGFibGVQYXJhbXMgc2V0RmFkaW5nRWRnZVNjcmVlblNpemVGYWN0b3IoZG91YmxlIGZhZGluZ0VkZ2VTY3JlZW5TaXplRmFjdG9yKSB7Ci0gICAgICAgICAgICByZXR1cm4gKEV4cGFuZGFibGVQYXJhbXMpIHN1cGVyLnNldEZhZGluZ0VkZ2VTY3JlZW5TaXplRmFjdG9yKGZhZGluZ0VkZ2VTY3JlZW5TaXplRmFjdG9yKTsKLSAgICAgICAgfQotCi0gICAgICAgIEBPdmVycmlkZQotICAgICAgICBwdWJsaWMgRXhwYW5kYWJsZVBhcmFtcyBzZXRJdGVtU2NyZWVuU2l6ZUZhY3Rvcihkb3VibGUgaXRlbVNjcmVlblNpemVGYWN0b3IpIHsKLSAgICAgICAgICAgIH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BwYXJlbnQpOwotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIE9iamVjdCBnZXRHcm91cChpbnQgZ3JvdXBQb3NpdGlvbikgewotICAgICAgICAgICAgcmV0dXJuIGdldFZhbHVlQXRQb3NpdGlvbihFeHBhbmRhYmxlTGlzdFZpZXcuZ2V0UGFja2VkUG9zaXRpb25Gb3JHcm91cChncm91cFBvc2l0aW9uKSk7Ci0gICAgICAgIH0KLQotICAgICAgICBwdWJsaWMgaW50IGdldEdyb3VwQ291bnQoKSB7Ci0gICAgICAgICAgICByZXR1cm4gbUdyb3Vwcy5zaXplKCk7Ci0gICAgICAgIH0KLQotICAgICAgICBwdWJsaWMgbG9uZyBnZXRHcm91cElkKGludCBncm91cFBvc2l0aW9uKSB7Ci0gICAgICAgICAgICByZXR1cm4gbUdyb3Vwcy5nZXQoZ3JvdXBQb3NpdGlvbikuaWQ7Ci0gICAgICAgIH0KLQotICAgICAgICBwdWJsaWMgVmlldyBnZXRHcm91cFZpZXcoaW50IGdyb3VwUG9zaXRpb24sIGJvb2xlYW4gaXNFeHBhbmRlZCwgVmlldyBjb252ZXJ0VmlldywKLSAgICAgICAgICAgICAgICBWaWV3R3JvdXAgcGFyZW50KSB7Ci0gICAgICAgICAgICByZXR1cm4gZ2V0VmlldyhFeHBhbmRhYmxlTGlzdFZpZXcuZ2V0UGFja2VkUG9zaXRpb25Gb3JHcm91cChncm91cFBvc2l0aW9uKSwKLSAgICAgICAgICAgICAgICAgICAgY29udmVydFZpZXcsIHBhcmVudCk7Ci0gICAgICAgIH0KLQotICAgICAgICBwdWJsaWMgYm9vbGVhbiBpc0NoaWxkU2VsZWN0YWJsZShpbnQgZ3JvdXBQb3NpdGlvbiwgaW50IGNoaWxkUG9zaXRpb24pIHsKLSAgICAgICAgICAgIHJldHVybiB0cnVlOwotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIGJvb2xlYW4gaGFzU3RhYmxlSWRzKCkgewotICAgICAgICAgICAgcmV0dXJuIHRydWU7Ci0gICAgICAgIH0KLSAgICAgICAgCi0gICAgfQotCi0gICAgcHVibGljIHN0YXRpYyBjbGFzcyBNeUdyb3VwIHsKLSAgICAgICAgcHJpdmF0ZSBzdGF0aWMgbG9uZyBtTmV4dElkID0gMTAwMDsKLSAgICAgICAgCi0gICAgICAgIFN0cmluZyBuYW1lOwotICAgICAgICBsb25nIGlkID0gbU5leHRJZCsrOwotICAgICAgICBMaXN0PE15Q2hpbGQ+IGNoaWxkcmVuOwotICAgICAgICAKLSAgICAgICAgcHVibGljIE15R3JvdXAoaW50IG51bUNoaWxkcmVuKSB7Ci0gICAgICAgICAgICBuYW1lID0gIkdyb3VwICIgKyBpZDsKLSAgICAgICAgICAgIGNoaWxkcmVuID0gbmV3IEFycmF5TGlzdDxNeUNoaWxkPihudW1DaGlsZHJlbik7Ci0gICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IG51bUNoaWxkcmVuOyBpKyspIHsKLSAgICAgICAgICAgICAgICBjaGlsZHJlbi5hZGQobmV3IE15Q2hpbGQoKSk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLSAgICB9Ci0gICAgCi0gICAgcHVibGljIHN0YXRpYyBjbGFzcyBNeUNoaWxkIHsKLSAgICAgICAgcHJpdmF0ZSBzdGF0aWMgbG9uZyBtTmV4dElkID0gMjAwMDsKLSAgICAgICAgCi0gICAgICAgIFN0cmluZyBuYW1lOwotICAgICAgICBsb25nIGlkID0gbU5leHRJZCsrOwotICAgICAgICAKLSAgICAgICAgcHVibGljIE15Q2hpbGQoKSB7Ci0gICAgICAgICAgICBuYW1lID0gIkNoaWxkICIgKyBpZDsKLSAgICAgICAgfQotICAgIH0KLSAgICAKLSAgICBAT3ZlcnJpZGUKLSAgICBwcm90ZWN0ZWQgZmluYWwgdm9pZCBpbml0KFBhcmFtcyBwYXJhbXMpIHsKLSAgICAgICAgaW5pdCgoRXhwYW5kYWJsZVBhcmFtcykgcGFyYW1zKTsKLSAgICB9Ci0KL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XIgcmVhZGVyID0gbmV3IEpzb25SZWFkZXIobmV3IFN0cmluZ1JlYWRlcigiW10iKSk7CisgICAgICAgIHJlYWRlci5iZWdpbkFycmF5KCk7CisgICAgICAgIGFzc2VydEZhbHNlKHJlYWRlci5oYXNOZXh0KCkpOworICAgICAgICByZWFkZXIuZW5kQXJyYXkoKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKEpzb25Ub2tlbi5FTkRfRE9DVU1FTlQsIHJlYWRlci5wZWVrKCkpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHRlc3RSZWFkT2JqZWN0KCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICAgSnNvblJlYWRlciByZWFkZXIgPSBuZXcgSnNvblJlYWRlcihuZXcgU3RyaW5nUmVhZGVyKAorICAgICAgICAgICAgICAgICJ7XCJhXCI6IFwiYW5kcm9pZFwiLCBcImJcIjogXCJiYW5hbmFcIn0iKSk7CisgICAgICAgIHJlYWRlci5iZWdpbk9iamVjdCgpOworICAgICAgICBhc3NlcnRFcXVhbHMoImEiLCByZWFkZXIubmV4dE5hbWUoKSk7CisgICAgICAgIGFzc2VydEVxdWFscygiYW5kcm9pZCIsIHJlYWRlci5uZXh0U3RyaW5nKCkpOworICAgICAgICBhc3NlcnRFcXVhbHMoImIiLCByZWFkZXIubmV4dE5hbWUoKSk7CisgICAgICAgIGFzc2VydEVxdWFscygiYmFuYW5hIiwgcmVhZGVyLm5leHRTdHJpbmcoKSk7CisgICAgICAgIHJlYWRlci5lbmRPYmplY3QoKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKEpzb25Ub2tlbi5FTkRfRE9DVU1FTlQsIHJlYWRlci5wZWVrKCkpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHRlc3RSZWFkRW1wdHlPYmplY3QoKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICBKc29uUmVhZGVyIHJlYWRlciA9IG5ldyBKc29uUmVhZGVyKG5ldyBTdHJpbmdSZWFkZXIoInt9IikpOworICAgICAgICByZWFkZXIuYmVnaW5PYmplY3QoKTsKKyAgICAgICAgYXNzZXJ0RmFsc2UocmVhZGVyLmhhc05leHQoKSk7CisgICAgICAgIHJlYWRlci5lbmRPYmplY3QoKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKEpzb25Ub2tlbi5FTkRfRE9DVU1FTlQsIHJlYWRlci5wZWVrKCkpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHRlc3RTa2lwT2JqZWN0KCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICAgSnNvblJlYWRlciByZWFkZXIgPSBuZXcgSnNvblJlYWRlcihuZXcgU3RyaW5nUmVhZGVyKAorICAgICAgICAgICAgICAgICJ7XCJhXCI6IHsgXCJjXCI6IFtdLCBcImRcIjogW3RydWUsIHRydWUsIHt9XSB9LCBcImJcIjogXCJiYW5hbmFcIn0iKSk7CisgICAgICAgIHJlYWRlci5iZWdpbk9iamVjdCgpOworICAgICAgICBhc3NlcnRFcXVhbHMoImEiLCByZWFkZXIubmV4dE5hbWUoKSk7CisgICAgICAgIHJlYWRlci5za2lwVmFsdWUoKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKCJiIiwgcmVhZGVyLm5leHROYW1lKCkpOworICAgICAgICByZWFkZXIuc2tpcFZhbHVlKCk7CisgICAgICAgIHJlYWRlci5lbmRPYmplY3QoKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKEpzb25Ub2tlbi5FTkRfRE9DVU1FTlQsIHJlYWRlci5wZWVrKCkpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHRlc3RIZWxsb1dvcmxkKCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICAgU3RyaW5nIGpzb24gPSAie1xuIiArCisgICAgICAgICAgICAgICAgIiAgIFwiaGVsbG9cIjogdHJ1ZSxcbiIgKworICAgICAgICAgICAgICAgICIgICBcImZvb1wiOiBbXCJ3b3JsZFwiXVxuIiArCisgICAgICAgICAgICAgICAgIn0iOworICAgICAgICBKc29uUmVhZGVyIHJlYWRlciA9IG5ldyBKc29uUmVhZGVyKG5ldyBTdHJpbmdSZWFkZXIoanNvbikpOworICAgICAgICByZWFkZXIuYmVnaW5PYmplY3QoKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKCJoZWxsbyIsIHJlYWRlci5uZXh0TmFtZSgpKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKHRydWUsIHJlYWRlci5uZXh0Qm9vbGVhbigpKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKCJmb28iLCByZWFkZXIubmV4dE5hbWUoKSk7CisgICAgICAgIHJlYWRlci5iZWdpbkFycmF5KCk7CisgICAgICAgIGFzc2VydEVxdWFscygid29ybGQiLCByZWFkZXIubmV4dFN0cmluZygpKTsKKyAgICAgICAgcmVhZGVyLmVuZEFycmF5KCk7CisgICAgICAgIHJlYWRlci5lbmRPYmplY3QoKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKEpzb25Ub2tlbi5FTkRfRE9DVU1FTlQsIHJlYWRlci5wZWVrKCkpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHRlc3ROdWxscygpIHsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIG5ldyBKc29uUmVhZGVyKG51bGwpOworICAgICAgICAgICAgZmFpbCgpOworICAgICAgICB9IGNhdGNoIChOdWxsUG9pbnRlckV4Y2VwdGlvbiBleHBlY3RlZCkgeworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHZvaWQgdGVzdEVtcHR5U3RyaW5nKCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIG5ldyBKc29uUmVhZGVyKG5ldyBTdHJpbmdSZWFkZXIoIiIpKS5iZWdpbkFycmF5KCk7CisgICAgICAgIH0gY2F0Y2ggKElPRXhjZXB0aW9uIGV4cGVjdGVkKSB7CisgICAgICAgIH0KKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIG5ldyBKc29uUmVhZGVyKG5ldyBTdHJpbmdSZWFkZXIoIiIpKS5iZWdpbk9iamVjdCgpOworICAgICAgICB9IGNhdGNoIChJT0V4Y2VwdGlvbiBleHBlY3RlZCkgeworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHZvaWQgdGVzdE5vVG9wTGV2ZWxPYmplY3QoKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICB0cnkgeworICAgICAgICAgICAgbmV3IEpzb25SZWFkZXIobmV3IFN0cmluZ1JlYWRlcigidHJ1ZSIpKS5uZXh0Qm9vbGVhbigpOworICAgICAgICB9IGNhdGNoIChJT0V4Y2VwdGlvbiBleHBlY3RlZCkgeworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHZvaWQgdGVzdENoYXJhY3RlclVuZXNjYXBpbmcoKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICBTdHJpbmcganNvbiA9ICJbXCJhXCIsIgorICAgICAgICAgICAgICAgICsgIlwiYVxcXCJcIiwiCisgICAgICAgICAgICAgICAgKyAiXCJcXFwiXCIsIgorICAgICAgICAgICAgICAgICsgIlwiOlwiLCIKKyAgICAgICAgICAgICAgICArICJcIixcIiwiCisgICAgICAgICAgICAgICAgKyAiXCJcXGJcIiwiCisgICAgICAgICAgICAgICAgKyAiXCJcXGZcIiwiCisgICAgICAgICAgICAgICAgKyAiXCJcXG5cIiwiCisgICAgICAgICAgICAgICAgKyAiXCJcXHJcIiwiCisgICAgICAgICAgICAgICAgKyAiXCJcXHRcIiwiCisgICAgICAgICAgICAgICAgKyAiXCIgXCIsIgorICAgICAgICAgICAgICAgICsgIlwiXFxcXFwiLCIKKyAgICAgICAgICAgICAgICArICJcIntcIiwiCisgICAgICAgICAgICAgICAgKyAiXCJ9XCIsIgorICAgICAgICAgICAgICAgICsgIlwiW1wiLCIKKyAgICAgICAgICAgICAgICArICJcIl1cIiwiCisgICAgICAgICAgICAgICAgKyAiXCJcXHUwMDAwXCIsIgorICAgICAgICAgICAgICAgICsgIlwiXFx1MDAxOVwiLCIKKyAgICAgICAgICAgICAgICArICJcIlxcdTIwQUNcIiIKKyAgICAgICAgICAgICAgICArICJdIjsKKyAgICAgICAgSnNvblJlYWRlciByZWFkZXIgPSBuZXcgSnNvblJlYWRlcihuZXcgU3RyaW5nUmVhZGVyKGpzb24pKTsKKyAgICAgICAgcmVhZGVyLmJlZ2luQXJyYXkoKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKCJhIiwgcmVhZGVyLm5leHRTdHJpbmcoKSk7CisgICAgICAgIGFzc2VydEVxdWFscygiYVwiIiwgcmVhZGVyLm5leHRTdHJpbmcoKSk7CisgICAgICAgIGFzc2VydEVxdWFscygiXCIiLCByZWFkZXIubmV4dFN0cmluZygpKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKCI6IiwgcmVhZGVyLm5leHRTdHJpbmcoKSk7CisgICAgICAgIGFzc2VydEVxdWFscygiLCIsIHJlYWRlci5uZXh0U3RyaW5nKCkpOworICAgICAgICBhc3NlcnRFcXVhbHMoIlxiIiwgcmVhZGVyLm5leHRTdHJpbmcoKSk7CisgICAgICAgIGFzc2VydEVxdWFscygiXGYiLCByZWFkZXIubmV4dFN0cmluZygpKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKCJcbiIsIHJlYWRlci5uZXh0U3RyaW5nKCkpOworICAgICAgICBhc3NlcnRFcXVhbHMoIlxyIiwgcmVhZGVyLm5leHRTdHJpbmcoKSk7CisgICAgICAgIGFzc2VydEVxdWFscygiXHQiLCByZWFkZXIubmV4dFN0cmluZygpKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKCIgIiwgcmVhZGVyLm5leHRTdHJpbmcoKSk7CisgICAgICAgIGFzc2VydEVxdWFscygiXFwiLCByZWFkZXIubmV4dFN0cmluZygpKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKCJ7IiwgcmVhZGVyLm5leHRTdHJpbmcoKSk7CisgICAgICAgIGFzc2VydEVxdWFscygifSIsIHJlYWRlci5uZXh0U3RyaW5nKCkpOworICAgICAgICBhc3NlcnRFcXVhbHMoIlsiLCByZWFkZXIubmV4dFN0cmluZygpKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKCJdIiwgcmVhZGVyLm5leHRTdHJpbmcoKSk7CisgICAgICAgIGFzc2VydEVxdWFscygiXDAiLCByZWFkZXIubmV4dFN0cmluZygpKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKCJcdTAwMTkiLCByZWFkZXIubmV4dFN0cmluZygpKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKCJcdTIwQUMiLCByZWFkZXIubmV4dFN0cmluZygpKTsKKyAgICAgICAgcmVhZGVyLmVuZEFycmF5KCk7CisgICAgICAgIGFzc2VydEVxdWFscyhKc29uVG9rZW4uRU5EX0RPQ1VNRU5ULCByZWFkZXIucGVlaygpKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCB0ZXN0SW50ZWdlcnNXaXRoRnJhY3Rpb25hbFBhcnRTcGVjaWZpZWQoKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICBKc29uUmVhZGVyIHJlYWRlciA9IG5ldyBKc29uUmVhZGVyKG5ldyBTdHJpbmdSZWFkZXIoIlsxLjAsMS4wLDEuMF0iKSk7CisgICAgICAgIHJlYWRlci5iZWdpbkFycmF5KCk7CisgICAgICAgIGFzc2VydEVxdWFscygxLjAsIHJlYWRlci5uZXh0RG91YmxlKCkpOworICAgICAgICBhc3NlcnRFcXVhbHMoMSwgcmVhZGVyLm5leHRJbnQoKSk7CisgICAgICAgIGFzc2VydEVxdWFscygxTCwgcmVhZGVyLm5leHRMb25nKCkpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHRlc3REb3VibGVzKCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICAgU3RyaW5nIGpzb24gPSAiWy0wLjAsIgorICAgICAgICAgICAgICAgICsgIjEuMCwiCisgICAgICAgICAgICAgICAgKyAiMS43OTc2OTMxMzQ4NjIzMTU3RTMwOCwiCisgICAgICAgICAgICAgICAgKyAiNC45RS0zMjQsIgorICAgICAgICAgICAgICAgICsgIjAuMCwiCisgICAgICAgICAgICAgICAgKyAiLTAuNSwiCisgICAgICAgICAgICAgICAgKyAiMi4yMjUwNzM4NTg1MDcyMDE0RS0zMDgsIgorICAgICAgICAgICAgICAgICsgIjMuMTQxNTkyNjUzNTg5NzkzLCIKKyAgICAgICAgICAgICAgICArICIyLjcxODI4MTgyODQ1OTA0NV0iOworICAgICAgICBKc29uUmVhZGVyIHJlYWRlciA9IG5ldyBKc29uUmVhZGVyKG5ldyBTdHJpbmdSZWFkZXIoanNvbikpOworICAgICAgICByZWFkZXIuYmVnaW5BcnJheSgpOworICAgICAgICBhc3NlcnRFcXVhbHMoLTAuMCwgcmVhZGVyLm5leHREb3VibGUoKSk7CisgICAgICAgIGFzc2VydEVxdWFscygxLjAsIHJlYWRlci5uZXh0RG91YmxlKCkpOworICAgICAgICBhc3NlcnRFcXVhbHMoMS43OTc2OTMxMzQ4NjIzMTU3RTMwOCwgcmVhZGVyLm5leHREb3VibGUoKSk7CisgICAgICAgIGFzc2VydEVxdWFscyg0LjlFLTMyNCwgcmVhZGVyLm5leHREb3VibGUoKSk7CisgICAgICAgIGFzc2VydEVxdWFscygwLjAsIHJlYWRlci5uZXh0RG91YmxlKCkpOworICAgICAgICBhc3NlcnRFcXVhbHMoLTAuNSwgcmVhZGVyLm5leHREb3VibGUoKSk7CisgICAgICAgIGFzc2VydEVxdWFscygyLjIyNTA3Mzg1ODUwNzIwMTRFLTMwOCwgcmVhZGVyLm5leHREb3VibGUoKSk7CisgICAgICAgIGFzc2VydEVxdWFscygzLjE0MTU5MjY1MzU4OTc5MywgcmVhZGVyLm5leHREb3VibGUoKSk7CisgICAgICAgIGFzc2VydEVxdWFscygyLjcxODI4MTgyODQ1OTA0NSwgcmVhZGVyLm5leHREb3VibGUoKSk7CisgICAgICAgIHJlYWRlci5lbmRBcnJheSgpOworICAgICAgICBhc3NlcnRFcXVhbHMoSnNvblRva2VuLkVORF9ET0NVTUVOVCwgcmVhZGVyLnBlZWsoKSk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgdGVzdE5vbkZpbml0ZURvdWJsZXMoKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICBTdHJpbmcganNvbiA9ICJbTmFOXSI7CisgICAgICAgIEpzb25SZWFkZXIgcmVhZGVyID0gbmV3IEpzb25SZWFkZXIobmV3IFN0cmluZ1JlYWRlcihqc29uKSk7CisgICAgICAgIHJlYWRlci5iZWdpbkFycmF5KCk7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICByZWFkZXIubmV4dERvdWJsZSgpOworICAgICAgICAgICAgZmFpbCgpOworICAgICAgICB9IGNhdGNoIChOdW1iZXJGb3JtYXRFeGNlcHRpb24gZXhwZWN0ZWQpIHsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHRlc3RMb25ncygpIHRocm93cyBJT0V4Y2VwdGlvbiB7CisgICAgICAgIFN0cmluZyBqc29uID0gIlswLDAsMCwiCisgICAgICAgICAgICAgICAgKyAiMSwxLDEsIgorICAgICAgICAgICAgICAgICsgIi0xLC0xLC0xLCIKKyAgICAgICAgICAgICAgICArICItOTIyMzM3MjAzNjg1NDc3NTgwOCwiCisgICAgICAgICAgICAgICAgKyAiOTIyMzM3MjAzNjg1NDc3NTgwN10iOworICAgICAgICBKc29uUmVhZGVyIHJlYWRlciA9IG5ldyBKc29uUmVhZGVyKG5ldyBTdHJpbmdSZWFkZXIoanNvbikpOworICAgICAgICByZWFkZXIuYmVnaW5BcnJheSgpOworICAgICAgICBhc3NlcnRFcXVhbHMoMEwsIHJlYWRlci5uZXh0TG9uZygpKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKDAsIHJlYWRlci5uZXh0SW50KCkpOworICAgICAgICBhc3NlcnRFcXVhbHMoMC4wLCByZWFkZXIubmV4dERvdWJsZSgpKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKDFMLCByZWFkZXIubmV4dExvbmcoKSk7CisgICAgICAgIGFzc2VydEVxdWFscygxLCByZWFkZXIubmV4dEludCgpKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKDEuMCwgcmVhZGVyLm5leHREb3VibGUoKSk7CisgICAgICAgIGFzc2VydEVxdWFscygtMUwsIHJlYWRlci5uZXh0TG9uZygpKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKC0xLCByZWFkZXIubmV4dEludCgpKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKC0xLjAsIHJlYWRlci5uZXh0RG91YmxlKCkpOworICAgICAgICB0cnkgeworICAgICAgICAgICAgcmVhZGVyLm5leHRJbnQoKTsKKyAgICAgICAgICAgIGZhaWwoKTsKKyAgICAgICAgfSBjYXRjaCAoTnVtYmVyRm9ybWF0RXhjZXB0aW9uIGV4cGVjdGVkKSB7CisgICAgICAgIH0KKyAgICAgICAgYXNzZXJ0RXF1YWxzKExvbmcuTUlOX1ZBTFVFLCByZWFkZXIubmV4dExvbmcoKSk7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICByZWFkZXIubmV4dEludCgpOworICAgICAgICAgICAgZmFpbCgpOworICAgICAgICB9IGNhdGNoIChOdW1iZXJGb3JtYXRFeGNlcHRpb24gZXhwZWN0ZWQpIHsKKyAgICAgICAgfQorICAgICAgICBhc3NlcnRFcXVhbHMoTG9uZy5NQVhfVkFMVUUsIHJlYWRlci5uZXh0TG9uZygpKTsKKyAgICAgICAgcmVhZGVyLmVuZEFycmF5KCk7CisgICAgICAgIGFzc2VydEVxdWFscyhKc29uVG9rZW4uRU5EX0RPQ1VNRU5ULCByZWFkZXIucGVlaygpKTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBUaGlzIHRlc3QgZmFpbHMgYmVjYXVzZSB0aGVyZSdzIG5vIGRvdWJsZSBmb3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EwsbnVsTF0iKSk7CisgICAgICAgIHJlYWRlci5iZWdpbkFycmF5KCk7CisgICAgICAgIGFzc2VydEVxdWFscyh0cnVlLCByZWFkZXIubmV4dEJvb2xlYW4oKSk7CisgICAgICAgIGFzc2VydEVxdWFscyh0cnVlLCByZWFkZXIubmV4dEJvb2xlYW4oKSk7CisgICAgICAgIGFzc2VydEVxdWFscyhmYWxzZSwgcmVhZGVyLm5leHRCb29sZWFuKCkpOworICAgICAgICBhc3NlcnRFcXVhbHMoZmFsc2UsIHJlYWRlci5uZXh0Qm9vbGVhbigpKTsKKyAgICAgICAgcmVhZGVyLm5leHROdWxsKCk7CisgICAgICAgIHJlYWRlci5uZXh0TnVsbCgpOworICAgICAgICByZWFkZXIuZW5kQXJyYXkoKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKEpzb25Ub2tlbi5FTkRfRE9DVU1FTlQsIHJlYWRlci5wZWVrKCkpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHRlc3RNaXNzaW5nVmFsdWUoKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICBKc29uUmVhZGVyIHJlYWRlciA9IG5ldyBKc29uUmVhZGVyKG5ldyBTdHJpbmdSZWFkZXIoIntcImFcIjp9IikpOworICAgICAgICByZWFkZXIuYmVnaW5PYmplY3QoKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKCJhIiwgcmVhZGVyLm5leHROYW1lKCkpOworICAgICAgICB0cnkgeworICAgICAgICAgICAgcmVhZGVyLm5leHRTdHJpbmcoKTsKKyAgICAgICAgICAgIGZhaWwoKTsKKyAgICAgICAgfSBjYXRjaCAoSU9FeGNlcHRpb24gZXhwZWN0ZWQpIHsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHRlc3RQcmVtYXR1cmVFbmRPZklucHV0KCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICAgSnNvblJlYWRlciByZWFkZXIgPSBuZXcgSnNvblJlYWRlcihuZXcgU3RyaW5nUmVhZGVyKCJ7XCJhXCI6dHJ1ZSwiKSk7CisgICAgICAgIHJlYWRlci5iZWdpbk9iamVjdCgpOworICAgICAgICBhc3NlcnRFcXVhbHMoImEiLCByZWFkZXIubmV4dE5hbWUoKSk7CisgICAgICAgIGFzc2VydEVxdWFscyh0cnVlLCByZWFkZXIubmV4dEJvb2xlYW4oKSk7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICByZWFkZXIubmV4dE5hbWUoKTsKKyAgICAgICAgICAgIGZhaWwoKTsKKyAgICAgICAgfSBjYXRjaCAoSU9FeGNlcHRpb24gZXhwZWN0ZWQpIHsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHRlc3RQcmVtYXR1cmVseUNsb3NlZCgpIHRocm93cyBJT0V4Y2VwdGlvbiB7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBKc29uUmVhZGVyIHJlYWRlciA9IG5ldyBKc29uUmVhZGVyKG5ldyBTdHJpbmdSZWFkZXIoIntcImFcIjpbXX0iKSk7CisgICAgICAgICAgICByZWFkZXIuYmVnaW5PYmplY3QoKTsKKyAgICAgICAgICAgIHJlYWRlci5jbG9zZSgpOworICAgICAgICAgICAgcmVhZGVyLm5leHROYW1lKCk7CisgICAgICAgICAgICBmYWlsKCk7CisgICAgICAgIH0gY2F0Y2ggKElsbGVnYWxTdGF0ZUV4Y2VwdGlvbiBleHBlY3RlZCkgeworICAgICAgICB9CisKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIEpzb25SZWFkZXIgcmVhZGVyID0gbmV3IEpzb25SZWFkZXIobmV3IFN0cmluZ1JlYWRlcigie1wiYVwiOltdfSIpKTsKKyAgICAgICAgICAgIHJlYWRlci5jbG9zZSgpOworICAgICAgICAgICAgcmVhZGVyLmJlZ2luT2JqZWN0KCk7CisgICAgICAgICAgICBmYWlsKCk7CisgICAgICAgIH0gY2F0Y2ggKElsbGVnYWxTdGF0ZUV4Y2VwdGlvbiBleHBlY3RlZCkgeworICAgICAgICB9CisKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIEpzb25SZWFkZXIgcmVhZGVyID0gbmV3IEpzb25SZWFkZXIobmV3IFN0cmluZ1JlYWRlcigie1wiYVwiOnRydWV9IikpOworICAgICAgICAgICAgcmVhZGVyLmJlZ2luT2JqZWN0KCk7CisgICAgICAgICAgICByZWFkZXIubmV4dE5hbWUoKTsKKyAgICAgICAgICAgIHJlYWRlci5wZWVrKCk7CisgICAgICAgICAgICByZWFkZXIuY2xvc2UoKTsKKyAgICAgICAgICAgIHJlYWRlci5uZXh0Qm9vbGVhbigpOworICAgICAgICAgICAgZmFpbCgpOworICAgICAgICB9IGNhdGNoIChJbGxlZ2FsU3RhdGVFeGNlcHRpb24gZXhwZWN0ZWQpIHsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHRlc3ROZXh0RmFpbHVyZXNEb05vdEFkdmFuY2UoKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICBKc29uUmVhZGVyIHJlYWRlciA9IG5ldyBKc29uUmVhZGVyKG5ldyBTdHJpbmdSZWFkZXIoIntcImFcIjp0cnVlfSIpKTsKKyAgICAgICAgcmVhZGVyLmJlZ2luT2JqZWN0KCk7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICByZWFkZXIubmV4dFN0cmluZygpOworICAgICAgICAgICAgZmFpbCgpOworICAgICAgICB9IGNhdGNoIChJbGxlZ2FsU3RhdGVFeGNlcHRpb24gZXhwZWN0ZWQpIHsKKyAgICAgICAgfQorICAgICAgICBhc3NlcnRFcXVhbHMoImEiLCByZWFkZXIubmV4dE5hbWUoKSk7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICByZWFkZXIubmV4dE5hbWUoKTsKKyAgICAgICAgICAgIGZhaWwoKTsKKyAgICAgICAgfSBjYXRjaCAoSWxsZWdhbFN0YXRlRXhjZXB0aW9uIGV4cGVjdGVkKSB7CisgICAgICAgIH0KKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIHJlYWRlci5iZWdpbkFycmF5KCk7CisgICAgICAgICAgICBmYWlsKCk7CisgICAgICAgIH0gY2F0Y2ggKElsbGVnYWxTdGF0ZUV4Y2VwdGlvbiBleHBlY3RlZCkgeworICAgICAgICB9CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICByZWFkZXIuZW5kQXJyYXkoKTsKKyAgICAgICAgICAgIGZhaWwoKTsKKyAgICAgICAgfSBjYXRjaCAoSWxsZWdhbFN0YXRlRXhjZXB0aW9uIGV4cGVjdGVkKSB7CisgICAgICAgIH0KKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIHJlYWRlci5iZWdpbk9iamVjdCgpOworICAgICAgICAgICAgZmFpbCgpOworICAgICAgICB9IGNhdGNoIChJbGxlZ2FsU3RhdGVFeGNlcHRpb24gZXhwZWN0ZWQpIHsKKyAgICAgICAgfQorICAgICAgICB0cnkgeworICAgICAgICAgICAgcmVhZGVyLmVuZE9iamVjdCgpOworICAgICAgICAgICAgZmFpbCgpOworICAgICAgICB9IGNhdGNoIChJbGxlZ2FsU3RhdGVFeGNlcHRpb24gZXhwZWN0ZWQpIHsKKyAgICAgICAgfQorICAgICAgICBhc3NlcnRFcXVhbHModHJ1ZSwgcmVhZGVyLm5leHRCb29sZWFuKCkpOworICAgICAgICB0cnkgeworICAgICAgICAgICAgcmVhZGVyLm5leHRTdHJpbmcoKTsKKyAgICAgICAgICAgIGZhaWwoKTsKKyAgICAgICAgfSBjYXRjaCAoSWxsZWdhbFN0YXRlRXhjZXB0aW9uIGV4cGVjdGVkKSB7CisgICAgICAgIH0KKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIHJlYWRlci5uZXh0TmFtZSgpOworICAgICAgICAgICAgZmFpbCgpOworICAgICAgICB9IGNhdGNoIChJbGxlZ2FsU3RhdGVFeGNlcHRpb24gZXhwZWN0ZWQpIHsKKyAgICAgICAgfQorICAgICAgICB0cnkgeworICAgICAgICAgICAgcmVhZGVyLmJlZ2luQXJyYXkoKTsKKyAgICAgICAgICAgIGZhaWwoKTsKKyAgICAgICAgfSBjYXRjaCAoSWxsZWdhbFN0YXRlRXhjZXB0aW9uIGV4cGVjdGVkKSB7CisgICAgICAgIH0KKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIHJlYWRlci5lbmRBcnJheSgpOworICAgICAgICAgICAgZmFpbCgpOworICAgICAgICB9IGNhdGNoIChJbGxlZ2FsU3RhdGVFeGNlcHRpb24gZXhwZWN0ZWQpIHsKKyAgICAgICAgfQorICAgICAgICByZWFkZXIuZW5kT2JqZWN0KCk7CisgICAgICAgIGFzc2VydEVxdWFscyhKc29uVG9rZW4uRU5EX0RPQ1VNRU5ULCByZWFkZXIucGVlaygpKTsKKyAgICAgICAgcmVhZGVyLmNsb3NlKCk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgdGVzdFN0cmluZ051bGxJc05vdE51bGwoKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICBKc29uUmVhZGVyIHJlYWRlciA9IG5ldyBKc29uUmVhZGVyKG5ldyBTdHJpbmdSZWFkZXIoIltcIm51bGxcIl0iKSk7CisgICAgICAgIHJlYWRlci5iZWdpbkFycmF5KCk7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICByZWFkZXIubmV4dE51bGwoKTsKKyAgICAgICAgICAgIGZhaWwoKTsKKyAgICAgICAgfSBjYXRjaCAoSWxsZWdhbFN0YXRlRXhjZXB0aW9uIGV4cGVjdGVkKSB7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCB0ZXN0TnVsbExpdGVyYWxJc05vdEFTdHJpbmcoKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgIEpzb25SZWFkZXIgcmVhZGVyID0gbmV3IEpzb25SZWFkZXIobmV3IFN0cmluZ1JlYWRlcigiW251bGxdIikpOworICAgICAgICByZWFkZXIuYmVnaW5BcnJheSgpOworICA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W1lbnQgXG4gdHJ1ZV0iKSk7CisgICAgICAgIHJlYWRlci5iZWdpbkFycmF5KCk7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICByZWFkZXIubmV4dEJvb2xlYW4oKTsKKyAgICAgICAgICAgIGZhaWwoKTsKKyAgICAgICAgfSBjYXRjaCAoSU9FeGNlcHRpb24gZXhwZWN0ZWQpIHsKKyAgICAgICAgfQorCisgICAgICAgIHJlYWRlciA9IG5ldyBKc29uUmVhZGVyKG5ldyBTdHJpbmdSZWFkZXIoIlsvKiBjb21tZW50ICovIHRydWVdIikpOworICAgICAgICByZWFkZXIuYmVnaW5BcnJheSgpOworICAgICAgICB0cnkgeworICAgICAgICAgICAgcmVhZGVyLm5leHRCb29sZWFuKCk7CisgICAgICAgICAgICBmYWlsKCk7CisgICAgICAgIH0gY2F0Y2ggKElPRXhjZXB0aW9uIGV4cGVjdGVkKSB7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCB0ZXN0TGVuaWVudENvbW1lbnRzKCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICAgSnNvblJlYWRlciByZWFkZXIgPSBuZXcgSnNvblJlYWRlcihuZXcgU3RyaW5nUmVhZGVyKCJbLy8gY29tbWVudCBcbiB0cnVlXSIpKTsKKyAgICAgICAgcmVhZGVyLnNldExlbmllbnQodHJ1ZSk7CisgICAgICAgIHJlYWRlci5iZWdpbkFycmF5KCk7CisgICAgICAgIGFzc2VydEVxdWFscyh0cnVlLCByZWFkZXIubmV4dEJvb2xlYW4oKSk7CisKKyAgICAgICAgcmVhZGVyID0gbmV3IEpzb25SZWFkZXIobmV3IFN0cmluZ1JlYWRlcigiWyMgY29tbWVudCBcbiB0cnVlXSIpKTsKKyAgICAgICAgcmVhZGVyLnNldExlbmllbnQodHJ1ZSk7CisgICAgICAgIHJlYWRlci5iZWdpbkFycmF5KCk7CisgICAgICAgIGFzc2VydEVxdWFscyh0cnVlLCByZWFkZXIubmV4dE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yaW5ncygpIHRocm93cyBJT0V4Y2VwdGlvbiB7CisgICAgICAgIEpzb25SZWFkZXIgcmVhZGVyID0gbmV3IEpzb25SZWFkZXIobmV3IFN0cmluZ1JlYWRlcigiW2FdIikpOworICAgICAgICByZWFkZXIuc2V0TGVuaWVudCh0cnVlKTsKKyAgICAgICAgcmVhZGVyLmJlZ2luQXJyYXkoKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKCJhIiwgcmVhZGVyLm5leHRTdHJpbmcoKSk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgdGVzdFN0cmljdFNpbmdsZVF1b3RlZFN0cmluZ3MoKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICBKc29uUmVhZGVyIHJlYWRlciA9IG5ldyBKc29uUmVhZGVyKG5ldyBTdHJpbmdSZWFkZXIoIlsnYSddIikpOworICAgICAgICByZWFkZXIuYmVnaW5BcnJheSgpOworICAgICAgICB0cnkgeworICAgICAgICAgICAgcmVhZGVyLm5leHRTdHJpbmcoKTsKKyAgICAgICAgICAgIGZhaWwoKTsKKyAgICAgICAgfSBjYXRjaCAoSU9FeGNlcHRpb24gZXhwZWN0ZWQpIHsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHRlc3RMZW5pZW50U2luZ2xlUXVvdGVkU3RyaW5ncygpIHRocm93cyBJT0V4Y2VwdGlvbiB7CisgICAgICAgIEpzb25SZWFkZXIgcmVhZGVyID0gbmV3IEpzb25SZWFkZXIobmV3IFN0cmluZ1JlYWRlcigiWydhJ10iKSk7CisgICAgICAgIHJlYWRlci5zZXRMZW5pZW50KHRydWUpOworICAgICAgICByZWFkZXIuYmVnaW5BcnJheSgpOworICAgICAgICBhc3NlcnRFcXVhbHMoImEiLCByZWFkZXIubmV4dFN0cmluZygpKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCB0ZXN0U3RyaWN0U2VtaWNvbG9uRGVsaW1pdGVkQXJyYXkoKSB0aHJvd3MgS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iLCByZWFkZXIubmV4dE5hbWUoKSk7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICByZWFkZXIubmV4dEJvb2xlYW4oKTsKKyAgICAgICAgICAgIHJlYWRlci5uZXh0TmFtZSgpOworICAgICAgICAgICAgZmFpbCgpOworICAgICAgICB9IGNhdGNoIChJT0V4Y2VwdGlvbiBleHBlY3RlZCkgeworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHZvaWQgdGVzdExlbmllbnRTZW1pY29sb25EZWxpbWl0ZWROYW1lVmFsdWVQYWlyKCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICAgSnNvblJlYWRlciByZWFkZXIgPSBuZXcgSnNvblJlYWRlcihuZXcgU3RyaW5nUmVhZGVyKCJ7XCJhXCI6dHJ1ZTtcImJcIjp0cnVlfSIpKTsKKyAgICAgICAgcmVhZGVyLnNldExlbmllbnQodHJ1ZSk7CisgICAgICAgIHJlYWRlci5iZWdpbk9iamVjdCgpOworICAgICAgICBhc3NlcnRFcXVhbHMoImEiLCByZWFkZXIubmV4dE5hbWUoKSk7CisgICAgICAgIGFzc2VydEVxdWFscyh0cnVlLCByZWFkZXIubmV4dEJvb2xlYW4oKSk7CisgICAgICAgIGFzc2VydEVxdWFscygiYiIsIHJlYWRlci5uZXh0TmFtZSgpKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCB0ZXN0U3RyaWN0VW5uZWNlc3NhcnlBcnJheVNlcGFyYXRvcnMoKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICBKc29uUmVhZGVyIHJlYWRlciA9IG5ldyBKc29uUmVhZGVyKG5ldyBTdHJpbmdSZWFkZXIoIlt0cnVlLCx0cnVlXSIpKTsKKyAgICAgICAgcmVhZGVyLmJlZ2luQXJyYXkoKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKHRydWUsIHJlYWRlci5uZXh0Qm9vbGVhbigpKTsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIHJlYWRlci5uZXh0TnVsbCgpOworICAgICAgICAgICAgZmFpbCgpOworICAgICAgICB9IGNhdGNoIChJT0V4Y2VwdGlvbiBleHBlY3RlZCkgeworICAgICAgICB9CisKKyAgICAgICAgcmVhZGVyID0gbmV3IEpzb25SZWFkZXIobmV3IFN0cmluZ1JlYWRlcigiWyx0cnVlXSIpKTsKKyAgICAgICAgcmVhZGVyLmJlZ2luQXJyYXkoKTsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIHJlYWRlci5uZXh0TnVsbCgpOworICAgICAgICAgICAgZmFpbCgpOworICAgICAgICB9IGNhdGNoIChJT0V4Y2VwdGlvbiBleHBlY3RlZCkgeworICAgICAgICB9CisKKyAgICAgICAgcmVhZGVyID0gbmV3IEpzb25SZWFkZXIobmV3IFN0cmluZ1JlYWRlcigiW3RydWUsXSIpKTsKKyAgICAgICAgcmVhZGVyLmJlZ2luQXJyYXkoKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKHRydWUsIHJlYWRlci5uZXh0Qm9vbGVhbigpKTsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIHJlYWRlci5uZXh0TnVsbCgpOworICAgICAgICAgICAgZmFpbCgpOworICAgICAgICB9IGNhdGNoIChJT0V4Y2VwdGlvbiBleHBlY3RlZCkgeworICAgICAgICB9CisKKyAgICAgICAgcmVhZGVyID0gbmV3IEpzb25SZWFkZXIobmV3IFN0cmluZ1JlYWRlcigiWyxdIikpOworICAgICAgICByZWFkZXIuYmVnaW5BcnJheSgpOworICAgICAgICB0cnkgeworICAgICAgICAgICAgcmVhZGVyLm5leHROdWxsKCk7CisgICAgICAgICAgICBmYWlsKCk7CisgICAgICAgIH0gY2F0Y2ggKElPRXhjZXB0aW9uIGV4cGVjdGVkKSB7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCB0ZXN0TGVuaWVudFVubmVjZXNzYXJ5QXJyYXlTZXBhcmF0b3JzKCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICAgSnNvblJlYWRlciByZWFkZXIgPSBuZXcgSnNvblJlYWRlcihuZXcgU3RyaW5nUmVhZGVyKCJbdHJ1ZSwsdHJ1ZV0iKSk7CisgICAgICAgIHJlYWRlci5zZXRMZW5pZW50KHRydWUpOworICAgICAgICByZWFkZXIuYmVnaW5BcnJheSgpOworICAgICAgICBhc3NlcnRFcXVhbHModHJ1ZSwgcmVhZGVyLm5leHRCb29sZWFuKCkpOworICAgICAgICByZWFkZXIubmV4dE51bGwoKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKHRydWUsIHJlYWRlci5uZXh0Qm9vbGVhbigpKTsKKyAgICAgICAgcmVhZGVyLmVuZEFycmF5KCk7CisKKyAgICAgICAgcmVhZGVyID0gbmV3IEpzb25SZWFkZXIobmV3IFN0cmluZ1JlYWRlcigiWyx0cnVlXSIpKTsKKyAgICAgICAgcmVhZGVyLnNldExlbmllbnQodHJ1ZSk7CisgICAgICAgIHJlYWRlci5iZWdpbkFycmF5KCk7CisgICAgICAgIHJlYWRlci5uZXh0TnVsbCgpOworICAgICAgICBhc3NlcnRFcXVhbHModHJ1ZSwgcmVhZGVyLm5leHRCb29sZWFuKCkpOworICAgICAgICByZWFkZXIuZW5kQXJyYXkoKTsKKworICAgICAgICByZWFkZXIgPSBuZXcgSnNvblJlYWRlcihuZXcgU3RyaW5nUmVhZGVyKCJbdHJ1ZSxdIikpOworICAgICAgICByZWFkZXIuc2V0TGVuaWVudCh0cnVlKTsKKyAgICAgICAgcmVhZGVyLmJlZ2luQXJyYXkoKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKHRydWUsIHJlYWRlci5uZXh0Qm9vbGVhbigpKTsKKyAgICAgICAgcmVhZGVyLm5leHROdWxsKCk7CisgICAgICAgIHJlYWRlci5lbmRBcnJheSgpOworCisgICAgICAgIHJlYWRlciA9IG5ldyBKc29uUmVhZGVyKG5ldyBTdHJpbmdSZWFkZXIoIlssXSIpKTsKKyA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XRlciA9IG5ldyBTdHJpbmdXcml0ZXIoKTsKKyAgICAgICAgSnNvbldyaXRlciBqc29uV3JpdGVyID0gbmV3IEpzb25Xcml0ZXIoc3RyaW5nV3JpdGVyKTsKKyAgICAgICAganNvbldyaXRlci5iZWdpbk9iamVjdCgpOworICAgICAgICBqc29uV3JpdGVyLm5hbWUoImEiKTsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIGpzb25Xcml0ZXIubmFtZSgiYSIpOworICAgICAgICAgICAgZmFpbCgpOworICAgICAgICB9IGNhdGNoIChJbGxlZ2FsU3RhdGVFeGNlcHRpb24gZXhwZWN0ZWQpIHsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHRlc3ROYW1lV2l0aG91dFZhbHVlKCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICAgU3RyaW5nV3JpdGVyIHN0cmluZ1dyaXRlciA9IG5ldyBTdHJpbmdXcml0ZXIoKTsKKyAgICAgICAgSnNvbldyaXRlciBqc29uV3JpdGVyID0gbmV3IEpzb25Xcml0ZXIoc3RyaW5nV3JpdGVyKTsKKyAgICAgICAganNvbldyaXRlci5iZWdpbk9iamVjdCgpOworICAgICAgICBqc29uV3JpdGVyLm5hbWUoImEiKTsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIGpzb25Xcml0ZXIuZW5kT2JqZWN0KCk7CisgICAgICAgICAgICBmYWlsKCk7CisgICAgICAgIH0gY2F0Y2ggKElsbGVnYWxTdGF0ZUV4Y2VwdGlvbiBleHBlY3RlZCkgeworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHZvaWQgdGVzdFZhbHVlV2l0aG91dE5hbWUoKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICBTdHJpbmdXcml0ZXIgc3RyaW5nV3JpdGVyID0gbmV3IFN0cmluZ1dyaXRlcigpOworICAgICAgICBKc29uV3JpdGVyIGpzb25Xcml0ZXIgPSBuZXcgSnNvb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sKKyAgICAgICAgICAgIGpzb25Xcml0ZXIuZW5kQXJyYXkoKTsKKyAgICAgICAgICAgIGZhaWwoKTsKKyAgICAgICAgfSBjYXRjaCAoSWxsZWdhbFN0YXRlRXhjZXB0aW9uIGV4cGVjdGVkKSB7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCB0ZXN0QmFkTmVzdGluZ0FycmF5KCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICAgU3RyaW5nV3JpdGVyIHN0cmluZ1dyaXRlciA9IG5ldyBTdHJpbmdXcml0ZXIoKTsKKyAgICAgICAgSnNvbldyaXRlciBqc29uV3JpdGVyID0gbmV3IEpzb25Xcml0ZXIoc3RyaW5nV3JpdGVyKTsKKyAgICAgICAganNvbldyaXRlci5iZWdpbkFycmF5KCk7CisgICAgICAgIGpzb25Xcml0ZXIuYmVnaW5BcnJheSgpOworICAgICAgICB0cnkgeworICAgICAgICAgICAganNvbldyaXRlci5lbmRPYmplY3QoKTsKKyAgICAgICAgICAgIGZhaWwoKTsKKyAgICAgICAgfSBjYXRjaCAoSWxsZWdhbFN0YXRlRXhjZXB0aW9uIGV4cGVjdGVkKSB7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCB0ZXN0TnVsbE5hbWUoKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICBTdHJpbmdXcml0ZXIgc3RyaW5nV3JpdGVyID0gbmV3IFN0cmluZ1dyaXRlcigpOworICAgICAgICBKc29uV3JpdGVyIGpzb25Xcml0ZXIgPSBuZXcgSnNvbldyaXRlcihzdHJpbmdXcml0ZXIpOworICAgICAgICBqc29uV3JpdGVyLmJlZ2luT2JqZWN0KCk7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBqc29uV3JpdGVyLm5hbWUobnVsbCk7CisgICAgICAgICAgICBmYWlsKCk7CisgICAgICAgIH0gY2F0Y2ggKE51bGxQb2ludGVyRXhjZXB0aW9uIGV4cGVjdGVkKSB7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCB0ZXN0TnVsbFN0cmluZ1ZhbHVlKCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICAgU3RyaW5nV3JpdGVyIHN0cmluZ1dyaXRlciA9IG5ldyBTdHJpbmdXcml0ZXIoKTsKKyAgICAgICAgSnNvbldyaXRlciBqc29uV3JpdGVyID0gbmV3IEpzb25Xcml0ZXIoc3RyaW5nV3JpdGVyKTsKKyAgICAgICAganNvbldyaXRlci5iZWdpbk9iamVjdCgpOworICAgICAgICBqc29uV3JpdGVyLm5hbWUoImEiKTsKKyAgICAgICAganNvbldyaXRlci52YWx1ZShudWxsKTsKKyAgICAgICAganNvbldyaXRlci5lbmRPYmplY3QoKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKCJ7XCJhXCI6bnVsbH0iLCBzdHJpbmdXcml0ZXIudG9TdHJpbmcoKSk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgdGVzdE5vbkZpbml0ZURvdWJsZXMoKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICBTdHJpbmdXcml0ZXIgc3RyaW5nV3JpdGVyID0gbmV3IFN0cmluZ1dyaXRlcigpOworICAgICAgICBKc29uV3JpdGVyIGpzb25Xcml0ZXIgPSBuZXcgSnNvbldyaXRlcihzdHJpbmdXcml0ZXIpOworICAgICAgICBqc29uV3JpdGVyLmJlZ2luQXJyYXkoKTsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIGpzb25Xcml0ZXIudmFsdWUoRG91YmxlLk5hTik7CisgICAgICAgICAgICBmYWlsKCk7CisgICAgICAgIH0gY2F0Y2ggKElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbiBleHBlY3RlZCkgeworICAgICAgICB9CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBqc29uV3JpdGVyLnZhbHVlKERvdWJsZS5ORUdBVElWRV9JTkZJTklUWSk7CisgICAgICAgICAgICBmYWlsKCk7CisgICAgICAgIH0gY2F0Y2ggKElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbiBleHBlY3RlZCkgeworICAgICAgICB9CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBqc29uV3JpdGVyLnZhbHVlKERvdWJsZS5QT1NJVElWRV9JTkZJTklUWSk7CisgICAgICAgICAgICBmYWlsKCk7CisgICAgICAgIH0gY2F0Y2ggKElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbiBleHBlY3RlZCkgeworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHZvaWQgdGVzdERvdWJsZXMoKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICBTdHJpbmdXcml0ZXIgc3RyaW5nV3JpdGVyID0gbmV3IFN0cmluZ1dyaXRlcigpOworICAgICAgICBKc29uV3JpdGVyIGpzb25Xcml0ZXIgPSBuZXcgSnNvbldyaXRlcihzdHJpbmdXcml0ZXIpOworICAgICAgICBqc29uV3JpdGVyLmJlZ2luQXJyYXkoKTsKKyAgICAgICAganNvbldyaXRlci52YWx1ZSgtMC4wKTsKKyAgICAgICAganNvbldyaXRlci52YWx1ZSgxLjApOworICAgICAgICBqc29uV3JpdGVyLnZhbHVlKERvdWJsZS5NQVhfVkFMVUUpOworICAgICAgICBqc29uV3JpdGVyLnZhbHVlKERvdWJsZS5NSU5fVkFMVUUpOworICAgICAgICBqc29uV3JpdGVyLnZhbHVlKDAuMCk7CisgICAgICAgIGpzb25Xcml0ZXIudmFsdWUoLTAuNSk7CisgICAgICAgIGpzb25Xcml0ZXIudmFsdWUoRG91YmxlLk1JTl9OT1JNQUwpOworICAgICAgICBqc29uV3JpdGVyLnZhbHVlKE1hdGguUEkpOworICAgICAgICBqc29uV3JpdGVyLnZhbHVlKE1hdGguRSk7CisgICAgICAgIGpzb25Xcml0ZXIuZW5kQXJyYXkoKTsKKyAgICAgICAganNvbldyaXRlci5jbG9zZSgpOworICAgICAgICBhc3NlcnRFcXVhbHMoIlstMC4wLCIKKyAgICAgICAgICAgICAgICArICIxLjAsIgorICAgICAgICAgICAgICAgICsgIjEuNzk3NjkzMTM0ODYyMzE1N0UzMDgsIgorICAgICAgICAgICAgICAgICsgIjQuOUUtMzI0LCIKKyAgICAgICAgICAgICAgICArICIwLjAsIgorICAgICAgICAgICAgICAgICsgIi0wLjUsIgorICAgICAgICAgICAgICAgICsgIjIuMjI1MDczODU4NTA3MjAxNEUtMzA4LCIKKyAgICAgICAgICAgICAgICArICIzLjE0MTU5MjY1MzU4OTc5MywiCisgICAgICAgICAgICAgICAgKyAiMi43MTgyODE4Mjg0NTkwNDVdIiwgc3RyaW5nV3JpdGVyLnRvU3RyaW5nKCkpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHRlc3RMb25ncygpIHRocm93cyBJT0V4Y2VwdGlvbiB7CisgICAgICAgIFN0cmluZ1dyaXRlciBzdHJpbmdXcml0ZXIgPSBuZXcgU3RyaW5nV3JpdGVyKCk7CisgICAgICAgIEpzb25Xcml0ZXIganNvbldyaXRlciA9IG5ldyBKc29uV3JpdGVyKHN0cmluZ1dyaXRlcik7CisgICAgICAgIGpzb25Xcml0ZXIuYmVnaW5BcnJheSgpOworICAgICAgICBqc29uV3JpdGVyLnZhbHVlKDApOworICAgICAgICBqc29uV3JpdGVyLnZhbHVlKDEpOworICAgICAgICBqc29uV3JpdGVyLnZhbHVlKC0xKTsKKyAgICAgICAganNvbldyaXRlci52YWx1ZShMb25nLk1JTl9WQUxVRSk7CisgICAgICAgIGpzb25Xcml0ZXIudmFsdWUoTG9uZy5NQVhfVkFMVUUpOworICAgICAgICBqc29uV3JpdGVyLmVuZEFycmF5KCk7CisgICAgICAgIGpzb25Xcml0ZXIuY2xvc2UoKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKCJbMCwiCisgICAgICAgICAgICAgICAgKyAiMSwiCisgICAgICAgICAgICAgICAgKyAiLTEsIgorICAgICAgICAgICAgICAgICsgIi05MjIzMzcyMD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KSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICBTdHJpbmdXcml0ZXIgc3RyaW5nV3JpdGVyID0gbmV3IFN0cmluZ1dyaXRlcigpOworICAgICAgICBKc29uV3JpdGVyIGpzb25Xcml0ZXIgPSBuZXcgSnNvbldyaXRlcihzdHJpbmdXcml0ZXIpOworICAgICAgICBqc29uV3JpdGVyLmJlZ2luQXJyYXkoKTsKKyAgICAgICAganNvbldyaXRlci52YWx1ZSgiYSIpOworICAgICAgICBqc29uV3JpdGVyLnZhbHVlKCJhXCIiKTsKKyAgICAgICAganNvbldyaXRlci52YWx1ZSgiXCIiKTsKKyAgICAgICAganNvbldyaXRlci52YWx1ZSgiOiIpOworICAgICAgICBqc29uV3JpdGVyLnZhbHVlKCIsIik7CisgICAgICAgIGpzb25Xcml0ZXIudmFsdWUoIlxiIik7CisgICAgICAgIGpzb25Xcml0ZXIudmFsdWUoIlxmIik7CisgICAgICAgIGpzb25Xcml0ZXIudmFsdWUoIlxuIik7CisgICAgICAgIGpzb25Xcml0ZXIudmFsdWUoIlxyIik7CisgICAgICAgIGpzb25Xcml0ZXIudmFsdWUoIlx0Iik7CisgICAgICAgIGpzb25Xcml0ZXIudmFsdWUoIiAiKTsKKyAgICAgICAganNvbldyaXRlci52YWx1ZSgiXFwiKTsKKyAgICAgICAganNvbldyaXRlci52YWx1ZSgieyIpOworICAgICAgICBqc29uV3JpdGVyLnZhbHVlKCJ9Iik7CisgICAgICAgIGpzb25Xcml0ZXIudmFsdWUoIlsiKTsKKyAgICAgICAganNvbldyaXRlci52YWx1ZSgiXSIpOworICAgICAgICBqc29uV3JpdGVyLnZhbHVlKCJcMCIpOworICAgICAgICBqc29uV3JpdGVyLnZhbHVlKCJcdTAwMTkiKTsKKyAgICAgICAganNvbldyaXRlci5lbmRBcnJheSgpOworICAgICAgICBhc3NlcnRFcXVhbHMoIltcImFcIiwiCisgICAgICAgICAgICAgICAgKyAiXCJhXFxcIlwiLCIKKyAgICAgICAgICAgICAgICArICJcIlxcXCJcIiwiCisgICAgICAgICAgICAgICAgKyAiXCI6XCIsIgorICAgICAgICAgICAgICAgICsgIlwiLFwiLCIKKyAgICAgICAgICAgICAgICArICJcIlxcYlwiLCIKKyAgICAgICAgICAgICAgICArICJcIlxcZlwiLCIKKyAgICAgICAgICAgICAgICArICJcIlxcblwiLCIKKyAgICAgICAgICAgICAgICArICJcIlxcclwiLCIKKyAgICAgICAgICAgICAgICArICJcIlxcdFwiLCIKKyAgICAgICAgICAgICAgICArICJcIiBcIiwiCisgICAgICAgICAgICAgICAgKyAiXCJcXFxcXCIsIgorICAgICAgICAgICAgICAgICsgIlwie1wiLCIKKyAgICAgICAgICAgICAgICArICJcIn1cIiwiCisgICAgICAgICAgICAgICAgKyAiXCJbXCIsIgorICAgICAgICAgICAgICAgICsgIlwiXVwiLCIKKyAgICAgICAgICAgICAgICArICJcIlxcdTAwMDBcIiwiCisgICAgICAgICAgICAgICAgKyAiXCJcXHUwMDE5XCJdIiwgc3RyaW5nV3JpdGVyLnRvU3RyaW5nKCkpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHRlc3RFbXB0eUFycmF5KCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICAgU3RyaW5nV3JpdGVyIHN0cmluZ1dyaXRlciA9IG5ldyBTdHJpbmdXcml0ZXIoKTsKKyAgICAgICAgSnNvbldyaXRlciBqc29uV3JpdGVyID0gbmV3IEpzb25Xcml0ZXIoc3RyaW5nV3JpdGVyKTsKKyAgICAgICAganNvbldyaXRlci5iZWdpbkFycmF5KCk7CisgICAgICAgIGpzb25Xcml0ZXIuZW5kQXJyYXkoKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKCJbXSIsIHN0cmluZ1dyaXRlci50b1N0cmluZygpKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCB0ZXN0RW1wdHlPYmplY3QoKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICBTdHJpbmdXcml0ZXIgc3RyaW5nV3JpdGVyID0gbmV3IFN0cmluZ1dyaXRlcigpOworICAgICAgICBKc29uV3JpdGVyIGpzb25Xcml0ZXIgPSBuZXcgSnNvbldyaXRlcihzdHJpbmdXcml0ZXIpOworICAgICAgICBqc29uV3JpdGVyLmJlZ2luT2JqZWN0KCk7CisgICAgICAgIGpzb25Xcml0ZXIuZW5kT2JqZWN0KCk7CisgICAgICAgIGFzc2VydEVxdWFscygie30iLCBzdHJpbmdXcml0ZXIudG9TdHJpbmcoKSk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgdGVzdE9iamVjdHNJbkFycmF5cygpIHRocm93cyBJT0V4Y2VwdGlvbiB7CisgICAgICAgIFN0cmluZ1dyaXRlciBzdHJpbmdXcml0ZXIgPSBuZXcgU3RyaW5nV3JpdGVyKCk7CisgICAgICAgIEpzb25Xcml0ZXIganNvbldyaXRlciA9IG5ldyBKc29uV3JpdGVyKHN0cmluZ1dyaXRlcik7CisgICAgICAgIGpzb25Xcml0ZXIuYmVnaW5BcnJheSgpOworICAgICAgICBqc29uV3JpdGVyLmJlZ2luT2JqZWN0KCk7CisgICAgICAgIGpzb25Xcml0ZXIubmFtZSgiYSIpLnZhbHVlKDUpOworICAgICAgICBqc29uV3JpdGVyLm5hbWUoImIiKS52YWx1ZShmYWxzZSk7CisgICAgICAgIGpzb25Xcml0ZXIuZW5kT2JqZWN0KCk7CisgICAgICAgIGpzb25Xcml0ZXIuYmVnaW5PYmplY3QoKTsKKyAgICAgICAganNvbldyaXRlci5uYW1lKCJjIikudmFsdWUoNik7CisgICAgICAgIGpzb25Xcml0ZXIubmFtZSgiZCIpLnZhbHVlKHRydWUpOworICAgICAgICBqc29uV3JpdGVyLmVuZE9iamVjdCgpOworICAgICAgICBqc29uV3JpdGVyLmVuZEFycmF5KCk7CisgICAgICAgIGFzc2VydEVxdWFscygiW3tcImFcIjo1LFwiYlwiOmZhbHNlfSwiCisgICAgICAgICAgICAgICAgKyAie1wiY1wiOjYsXCJkXCI6dHJ1ZX1dIiwgc3RyaW5nV3JpdGVyLnRvU3RyaW5nKCkpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHRlc3RBcnJheXNJbk9iamVjdHMoKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICBTdHJpbmdXcml0ZXIgc3RyaW5nV3JpdGVyID0gbmV3IFN0cmluZ1dyaXRlcigpOworICAgICAgICBKc29uV3JpdGVyIGpzb25Xcml0ZXIgPSBuZXcgSnNvbldyaXRlcihzdHJpbmdXcml0ZXIpOworICAgICAgICBqc29uV3JpdGVyLmJlZ2luT2JqZWN0KCk7CisgICAgICAgIGpzb25Xcml0ZXIubmFtZSgiYSIpOworICAgICAgICBqc29uV3JpdGVyLmJlZ2luQXJyYXkoKTsKKyAgICAgICAganNvbldyaXRlci52YWx1ZSg1KTsKKyAgICAgICAganNvbldyaXRlci52YWx1ZShmYWxzZSk7CisgICAgICAgIGpzb25Xcml0ZXIuZW5kQXJyYXkoKTsKKyAgICAgICAganNvbldyaXRlci5uYW1lKCJiIik7CisgICAgICAgIGpzb25Xcml0ZXIuYmVnaW5BcnJheSgpOworICAgICAgICBqc29uV3JpdGVyLnZhbHVlKDYpOworICAgICAgICBqc29uV3JpdGVyLnZhbHVlKHRydWUpOworICAgICAgICBqc29uV3JpdGVyLmVuZEFycmF5KCk7CisgICAgICAgIGpzb25Xcml0ZXIuZW5kT2JqZWN0KCk7CisgICAgICAgIGFzc2VydEVxdWFscygie1wiYVwiOls1LGZhbHNlXSwiCisgICAgICAgICAgICAgICAgKyAiXCJiXCI6WzYsdHJ1ZV19Iiwgc3RyaW5nV3JpdGVyLnRvU3RyaW5nKCkpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHRlc3REZWVwTmVzdGluZ0FycmF5cygpIHRocm93cyBJT0V4Y2VwdGlvbiB7CisgICAgICAgIFN0cmluZ1dyaXRlciBzdHJpbmdXcml0ZXIgPSBuZXcgU3RyaW5nV3JpdGVyKCk7CisgICAgICAgIEpzb25Xcml0ZXIganNvbldyaXRlciA9IG5ldyBKc29uV3JpdGVyKHN0cmluZ1dyaXRlcik7CisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgMjA7IGkrKykgeworICAgICAgICAgICAganNvbldyaXRlci5iZWdpbkFycmF5KCk7CisgICAgICAgIH0KKyAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCAyMDsgaSsrKSB7CisgICAgICAgICAgICBqc29uV3JpdGVyLmVuZEFycmF5KCk7CisgICAgICAgIH0KKyAgICAgICAgYXNzZXJ0RXF1YWxzKCJbW1tbW1tbW1tbW1tbW1tbW1tbW11dXV1dXV1dXV1dXV1dXV1dXV1dIiwgc3RyaW5nV3JpdGVyLnRvU3RyaW5nKCkpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHRlc3REZWVwTmVzdGluZ09iamVjdHMoKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICBTdHJpbmdXcml0ZXIgc3RyaW5nV3JpdGVyID0gbmV3IFN0cmluZ1dyaXRlcigpOworICAgICAgICBKc29uV3JpdGVyIGpzb25Xcml0ZXIgPSBuZXcgSnNvbldyaXRlcihzdHJpbmdXcml0ZXIpOworICAgICAgICBqc29uV3JpdGVyLmJlZ2luT2JqZWN0KCk7CisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgMjA7IGkrKykgeworICAgICAgICAgICAganNvbldyaXRlci5uYW1lKCJhIik7CisgICAgICAgICAgICBqc29uV3JpdGVyLmJlZ2luT2JqZWN0KCk7CisgICAgICAgIH0KKyAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCAyMDsgaSsrKSB7CisgICAgICAgICAgICBqc29uV3JpdGVyLmVuZE9iamVjdCgpOworICAgICAgICB9CisgICAgICAgIGpzb25Xcml0ZXIuZW5kT2JqZWN0KCk7CisgICAgICAgIGFzc2VydEVxdWFscygie1wiYVwiOntcImFcIjp7XCJhXCI6e1wiYVwiOntcImFcIjp7XCJhXCI6e1wiYVwiOntcImFcIjp7XCJhXCI6e1wiYVwiOiIKKyAgICAgICAgICAgICAgICArICJ7XCJhXCI6e1wiYVwiOntcImFcIjp7XCJhXCI6e1wiYVwiOntcImFcIjp7XCJhXCI6e1wiYVwiOntcImFcIjp7XCJhXCI6eyIKKyAgICAgICAgICAgICAgICArICJ9fX19fX19fX19fX19fX19fX19fX0iLCBzdHJpbmdXcml0ZXIudG9TdHJpbmcoKSk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgdGVzdFJlcGVhdGVkTmFtZSgpIHRocm93cyBJT0V4Y2VwdGlvbiB7CisgICAgICAgIFN0cmluZ1dyaXRlciBzdHJpbmdXcml0ZXIgPSBuZXcgU3RyaW5nV3JpdGVyKCk7CisgICAgICAgIEpzb25Xcml0ZXIganNvbldyaXRlciA9IG5ldyBKc29uV3JpdGVyKHN0cmluZ1dyaXRlcik7CisgICAgICAgIGpzb25Xcml0ZXIuYmVnaW5PYmplY3QoKTsKKyAgICAgICAganNvbldyaXRlci5uYW1lKCJhIikudmFsdWUodHJ1ZSk7CisgICAgICAgIGpzb25Xcml0ZXIubmFtZSgiYSIpLnZhbHVlKGZhbHNlKTsKKyAgICAgICAganNvbldyaXRlci5lbmRPYmplY3QoKTsKKyAgICAgICAgLy8gSnNvbldyaXRlciBkb2Vzbid0IGF0dGVtcHQgdG8gZGV0ZWN0IGR1cGxpY2F0ZSBuYW1lcworICAgICAgICBhc3NlcnRFcXVhbHMoIntcImFcIjp0cnVlLFwiYVwiOmZhbHNlfSIsIHN0cmluZ1dyaXRlci50b1N0cmluZygpKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCB0ZXN0UHJldHR5UHJpbnRPYmplY3QoKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICBTdHJpbmdXcml0ZXIgc3RyaW5nV3JpdGVyID0gbmV3IFN0cmluZ1dyaXRlcigpOworICAgICAgICBKc29uV3JpdGVyIGpzb25Xcml0ZXIgPSBuZXcgSnNvbldyaXRlcihzdHJpbmdXcml0ZXIpOworICAgICAgICBqc29uV3JpdGVyLnNldEluZGVudCgiICAgIik7CisKKyAgICAgICAganNvbldyaXRlci5iZWdpbk9iamVjdCgpOworICAgICAgICBqc29uV3JpdGVyLm5hbWUoImEiKS52YWx1ZSh0cnVlKTsKKyAgICAgICAganNvbldyaXRlci5uYW1lKCJiIikudmFsdWUoZmFsc2UpOworICAgICAgICBqc29uV3JpdGVyLm5hbWUoImMiKS52YWx1ZSg1LjApOworICAgICAgICBqc29uV3JpdGVyLm5hbWUoImUiKS5udWxsVmFsdWUoKTsKKyAgICAgICAganNvbldyaXRlci5uYW1lKCJmIikuYmVnaW5BcnJheSgpOworICAgICAgICBqc29uV3JpdGVyLnZhbHVlKDYuMCk7CisgICAgICAgIGpzb25Xcml0ZXIudmFsdWUoNy4wKTsKKyAgICAgICAganNvbldyaXRlci5lbmRBcnJheSgpOworICAgICAgICBqc29uV3JpdGVyLm5hbWUoImciKS5iZWdpbk9iamVjdCgpOworICAgICAgICBqc29uV3JpdGVyLm5hbWUoImgiKS52YWx1ZSg4LjApOworICAgICAgICBqc29uV3JpdGVyLm5hbWUoImkiKS52YWx1ZSg5LjApOworICAgICAgICBqc29uV3JpdGVyLmVuZE9iamVjdCgpOworICAgICAgICBqc29uV3JpdGVyLmVuZE9iamVjdCgpOworCisgICAgICAgIFN0cmluZyBleHBlY3RlZCA9ICJ7XG4iCisgICAgICAgICAgICAgICAgKyAiICAgXCJhXCI6IHRydWUsXG4iCisgICAgICAgICAgICAgICAgKyAiICAgXCJiXCI6IGZhbHNlLFxuIgorICAgICAgICAgICAgICAgICsgIiAgIFwiY1wiOiA1LjAsXG4iCisgICAgICAgICAgICAgICAgKyAiICAgXCJlXCI6IG51bGwsXG4iCisgICAgICAgICAgICAgICAgKyAiICAgXCJmXCI6IFtcbiIKKyAgICAgICAgICAgICAgICArICIgICAgICA2LjAsXG4iCisgICAgICAgICAgICAgICAgKyAiICAgICAgNy4wXG4iCisgICAgICAgICAgICAgICAgKyAiICAgXSxcbiIKKyAgICAgICAgICAgICAgICArICIgICBcImdcIjoge1xuIgorICAgICAgICAgICAgICAgICsgIiAgICAgIFwiaFwiOiA4LjAsXG4iCisgICAgICAgICAgICAgICAgKyAiICAgICAgXCJpXCI6IDkuMFxuIgorICAgICAgICAgICAgICAgICsgIiAgIH1cbiIKKyAgICAgICAgICAgICAgICArICJ9IjsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKGV4cGVjdGVkLCBzdHJpbmdXcml0ZXIudG9TdHJpbmcoKSk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgdGVzdFByZXR0eVByaW50QXJyYXkoKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICBTdHJpbmdXcml0ZXIgc3RyaW5nV3JpdGVyID0gbmV3IFN0cmluZ1dyaXRlcigpOworICAgICAgICBKc29uV3JpdGVyIGpzb25Xcml0ZXIgPSBuZXcgSnNvbldyaXRlcihzdHJpbmdXcml0ZXIpOworICAgICAgICBqc29uV3JpdGVyLnNldEluZGVudCgiICAgIik7CisKKyAgICAgICAganNvbldyaXRlci5iZWdpbkFycmF5KCk7CisgICAgICAgIGpzb25Xcml0ZXIudmFsdWUodHJ1ZSk7CisgICAgICAgIGpzb25Xcml0ZXIudmFsdWUoZmFsc2UpOworICAgICAgICBqc29uV3JpdGVyLnZhbHVlKDUuMCk7CisgICAgICAgIGpzb25Xcml0ZXIubnVsbFZhbHVlKCk7CisgICAgICAgIGpzb25Xcml0ZXIuYmVnaW5PYmplY3QoKTsKKyAgICAgICAganNvbldyaXRlci5uYW1lKCJhIikudmFsdWUoNi4wKTsKKyAgICAgICAganNvbldyaXRlci5uYW1lKCJiIikudmFsdWUoNy4wKTsKKyAgICAgICAganNvbldyaXRlci5lbmRPYmplY3QoKTsKKyAgICAgICAganNvbldyaXRlci5iZWdpbkFycmF5KCk7CisgICAgICAgIGpzb25Xcml0ZXIudmFsdWUoOC4wKTsKKyAgICAgICAganNvbldyaXRlci52YWx1ZSg5LjApOworICAgICAgICBqc29uV3JpdGVyLmVuZEFycmF5KCk7CisgICAgICAgIGpzb25Xcml0ZXIuZW5kQXJyYXkoKTsKKworICAgICAgICBTdHJpbmcgZXhwZWN0ZWQgPSAiW1xuIgorICAgICAgICAgICAgICAgICsgIiAgIHRydWUsXG4iCisgICAgICAgICAgICAgICAgKyAiICAgZmFsc2UsXG4iCisgICAgICAgICAgICAgICAgKyAiICAgNS4wLFxuIgorICAgICAgICAgICAgICAgICsgIiAgIG51bGwsXG4iCisgICAgICAgICAgICAgICAgKyAiICAge1xuIgorICAgICAgICAgICAgICAgICsgIiAgICAgIFwiYVwiOiA2LjAsXG4iCisgICAgICAgICAgICAgICAgKyAiICAgICAgXCJiXCI6IDcuMFxuIgorICAgICAgICAgICAgICAgICsgIiAgIH0sXG4iCisgICAgICAgICAgICAgICAgKyAiICAgW1xuIgorICAgICAgICAgICAgICAgICsgIiAgICAgIDguMCxcbiIKKyAgICAgICAgICAgICAgICArICIgICAgICA5LjBcbiIKKyAgICAgICAgICAgICAgICArICIgICBdXG4iCisgICAgICAgICAgICAgICAgKyAiXSI7CisgICAgICAgIGFzc2VydEVxdWFscyhleHBlY3RlZCwgc3RyaW5nV3JpdGVyLnRvU3RyaW5nKCkpOworICAgIH0KK30KZGlmZiAtLWdpdCBhL2NvcmUvdGVzdHMvY29yZXRlc3RzL3NyYy9hbmRyb2lkL3V0aWwvUGF0dGVybnNUZXN0LmphdmEgYi9jb3JlL3Rlc3RzL2NvcmV0ZXN0cy9zcmMvYW5kcm9pZC91dGlsL1BhdHRlcm5zVGVzdC5qYXZhCmluZGV4IGI5MGM5N2IuLmFhZDNmZTEgMTAwNjQ0Ci0tLSBhL2NvcmUvdGVzdHMvY29yZXRlc3RzL3NyYy9hbmRyb2lkL3V0aWwvUGF0dGVybnNUZXN0LmphdmEKKysrIGIvY29yZS90ZXN0cy9jb3JldGVzdHMvc3JjL2FuZHJvaWQvdXRpbC9QYXR0ZXJuc1Rlc3Q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RDaGlsZHJlbkNvdW50KGdyb3VwSW5kZXgpOwotICAgICAgICAgICAgZm9yIChpbnQgY2hpbGRJbmRleCA9IDA7IGNoaWxkSW5kZXggPCBjaGlsZHJlbkNvdW50OyBjaGlsZEluZGV4KyspIHsKLSAgICAgICAgICAgICAgICAvLyBDaGVjayBjaGlsZCBpbmRleCBpbiBjb250ZXh0IG1lbnUKLSAgICAgICAgICAgICAgICBtTGlzdFV0aWwuYXJyb3dTY3JvbGxUb1NlbGVjdGVkUG9zaXRpb24oaW5kZXgpOwotICAgICAgICAgICAgICAgIG1lbnVMaXN0ZW5lci5leHBlY3RDaGlsZENvbnRleHRNZW51KGdyb3VwSW5kZXgsIGNoaWxkSW5kZXgpOwotICAgICAgICAgICAgICAgIFZpZXcgY2hpbGQgPSBtRXhwYW5kYWJsZUxpc3RWaWV3LmdldENoaWxkQXQoaW5kZXgKLSAgICAgICAgICAgICAgICAgICAgICAgIC0gbUV4cGFuZGFibGVMaXN0Vmlldy5nZXRGaXJzdFZpc2libGVQb3NpdGlvbigpKTsKLSAgICAgICAgICAgICAgICBtRXhwYW5kYWJsZUxpc3RWaWV3LnNob3dDb250ZXh0TWVudUZvckNoaWxkKGNoaWxkKTsKLSAgICAgICAgICAgICAgICBtSW5zdHJ1bWVudGF0aW9uLndhaXRGb3JJZGxlU3luYygpOwotICAgICAgICAgICAgICAgIEFzc2VydC5hc3NlcnROdWxsKG1lbnVMaXN0ZW5lci5nZXRFcnJvck1lc3NhZ2UoKSwgbWVudUxpc3RlbmVyLmdldEVycm9yTWVzc2FnZSgpKTsKLSAgICAgICAgICAgICAgICBpbmRleCsrOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgLy8gU2Nyb2xsaW5nIG9uIGZvb3RlciBlbGVtZW50cyBzaG91bGQgdHJpZ2dlciBhbiBBZGFwdGVyQ29udGV4dE1lbnUKLSAgICAgICAgZm9yIChpbnQgaT0wOyBpPG1FeHBhbmRhYmxlTGlzdFZpZXc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MCk7Ci0gICAgICAgICAgICByZXR1cm4gdGV4dFZpZXc7Ci0gICAgICAgIH0KLSAgICAgICAgCi0gICAgICAgIHB1YmxpYyBWaWV3IGdldENoaWxkVmlldyhpbnQgZ3JvdXBQb3NpdGlvbiwgaW50IGNoaWxkUG9zaXRpb24sIGJvb2xlYW4gaXNMYXN0Q2hpbGQsCi0gICAgICAgICAgICAgICAgVmlldyBjb252ZXJ0VmlldywgVmlld0dyb3VwIHBhcmVudCkgewotICAgICAgICAgICAgVGV4dFZpZXcgdGV4dFZpZXcgPSBnZXRHZW5lcmljVmlldygpOwotICAgICAgICAgICAgdGV4dFZpZXcuc2V0VGV4dChnZXRDaGlsZChncm91cFBvc2l0aW9uLCBjaGlsZFBvc2l0aW9uKS50b1N0cmluZygpKTsKLSAgICAgICAgICAgIHJldHVybiB0ZXh0VmlldzsKLSAgICAgICAgfQotCi0gICAgICAgIHB1YmxpYyBPYmplY3QgZ2V0R3JvdXAoaW50IGdyb3VwUG9zaXRpb24pIHsKLSAgICAgICAgICAgIHJldHVybiBncm91cHNbZ3JvdXBQb3NpdGlvbl07Ci0gICAgICAgIH0KLQotICAgICAgICBwdWJsaWMgaW50IGdldEdyb3VwQ291bnQoKSB7Ci0gICAgICAgICAgICByZXR1cm4gZ3JvdXBzLmxlbmd0aDsKLSAgICAgICAgfQotCi0gICAgICAgIHB1YmxpYyBsb25nIGdldEdyb3VwSWQoaW50IGdyb3VwUG9zaXRpb24pIHsKLSAgICAgICAgICAgIHJldHVybiBncm91cFBvc2l0aW9uOwotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIFZpZXcgZ2V0R3JvdXBWaWV3KGludCBncm91cFBvc2l0aW9uLCBib29sZWFuIGlzRXhwYW5kZWQsIFZpZXcgY29udmVydFZpZXcsCi0gICAgICAgICAgICAgICAgVmlld0dyb3VwIHBhcmVudCkgewotICAgICAgICAgICAgVGV4dFZpZXcgdGV4dFZpZXcgPSBnZXRHZW5lcmljVmlldygpOwotICAgICA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gICAgICA8c3BhbiBjbGFzcz0iZW4iPldpa2lOb3RlczogTGlua2lmeSB5b3VyIFRleHQhPC9zcGFuPgotICAgICAgICAgICAgICAgIDwvYT48L2xpPgotICAgICAgICA8bGk+PGEgaHJlZj0iPD9jcyB2YXI6dG9yb290ID8+cmVzb3VyY2VzL2FydGljbGVzL3dpa2lub3Rlcy1pbnRlbnRzLmh0bWwiPgotICAgICAgICAgICAgICAgIDxzcGFuIGNsYXNzPSJlbiI+V2lraU5vdGVzOiBSb3V0aW5nIEludGVudHM8L3NwYW4+Ci0gICAgICAgICAgICAgICAgPC9hPjwvbGk+Ci0gICAgICAgIDxsaT48YSBocmVmPSI8P2NzIHZhcjp0b3Jvb3QgPz5yZXNvdXJjZXMvYXJ0aWNsZXMvd2luZG93LWJnLXNwZWVkLmh0bWwiPgotICAgICAgICAgICAgICAgIDxzcGFuIGNsYXNzPSJlbiI+V2luZG93IEJhY2tncm91bmRzICZhbXA7IFVJIFNwZWVkPC9zcGFuPgotICAgICAgICAgICAgICAgIDwvYT48L2xpPgotICAgICAgICA8bGk+PGEgaHJlZj0iPD9jcyB2YXI6dG9yb290ID8+cmVzb3VyY2VzL2FydGljbGVzL3ppcGFsaWduLmh0bWwiPgotICAgICAgICAgICAgICAgIDxzcGFuIGNsYXNzPSJlbiI+WmlwYWxpZ246IEFuIEVhc3kgT3B0aW1pemF0aW9uPC9zcGFuPgotICAgICAgICAgICAgICAgIDwvYT48L2xpPgotICAgICAgICA8L3VsPgotICAgICAgPC9saT4KLSAgICA8L3VsPgotICAgPC9saT4KLQotICA8bGk+Ci0gICAgPGgyPjxzcGFuIGNsYXNzPSJlbiI+VHV0b3JpYWxzPC9zcGFuPgotICAgICAgICAgICAgICAgPHNwYW4gY2xhc3M9ImRlIiBzdHlsZT0iZGlzcGxheTpub25lIj5MZXJucHJvZ3JhbW1lPC9zcGFuPgotICAgICAgICAgICAgICAgPHNwYW4gY2xhc3M9ImVzIiBzdHlsZT0iZGlzcGxheTpub25l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AgICAgICBuYXRpdmVQcmVwYXJlVG9EcmF3KG1OYXRpdmVCaXRtYXApOwogICAgIH0KIAotICAgIEBPdmVycmlkZQotICAgIHByb3RlY3RlZCB2b2lkIGZpbmFsaXplKCkgdGhyb3dzIFRocm93YWJsZSB7Ci0gICAgICAgIHRyeSB7CisgICAgcHJpdmF0ZSBzdGF0aWMgY2xhc3MgQml0bWFwRmluYWxpemVyIGV4dGVuZHMgRmluYWxpemVycy5SZWNsYWltYWJsZVJlZmVyZW5jZTxCaXRtYXA+IHsKKyAgICAgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgU2V0PEJpdG1hcEZpbmFsaXplcj4gc0ZpbmFsaXplcnMgPSBDb2xsZWN0aW9ucy5zeW5jaHJvbml6ZWRTZXQoCisgICAgICAgICAgICAgICAgbmV3IEhhc2hTZXQ8Qml0bWFwRmluYWxpemVyPigpKTsKKworICAgICAgICBwcml2YXRlIGludCBtTmF0aXZlQml0bWFwOworCisgICAgICAgIEJpdG1hcEZpbmFsaXplcihCaXRtYXAgYikgeworICAgICAgICAgICAgc3VwZXIoYiwgRmluYWxpemVycy5nZXRRdWV1ZSgpKTsKKyAgICAgICAgICAgIG1OYXRpdmVCaXRtYXAgPSBiLm1OYXRpdmVCaXRtYXA7CisgICAgICAgICAgICBzRmluYWxpemVycy5hZGQodGhpcyk7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIHZvaWQgcmVjbGFpbSgpIHsKICAgICAgICAgICAgIG5hdGl2ZURlc3RydWN0b3IobU5hdGl2ZUJpdG1hcCk7Ci0gICAgICAgIH0gZmluYWxseSB7Ci0gICAgICAgICAgICBzdXBlci5maW5hbGl6ZSgpOworICAgICAgICAgICAgc0ZpbmFsaXplcnMucmVtb3ZlKHRoaXMpOwogICAgICAgICB9CiAgICAgfQogCkBAIC0xMDQxLDYgKzEwNzgsNyBAQAogICAgIHByaXZhdGUgc3RhdGljIG5hdGl2ZSB2b2lkIG5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HN0YXJ0LCBlbmQsIHgsIHksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhaW50KTsKLSAgICAgICAgfQotICAgICAgICBlbHNlIHsKKyAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgIGNoYXJbXSBidWYgPSBUZW1wb3JhcnlCdWZmZXIub2J0YWluKGVuZCAtIHN0YXJ0KTsKICAgICAgICAgICAgIFRleHRVdGlscy5nZXRDaGFycyh0ZXh0LCBzdGFydCwgZW5kLCBidWYsIDApOwotICAgICAgICAgICAgZHJhd1RleHQoYnVmLCAwLCBlbmQgLSBzdGFydCwgeCwgeSwgcGFpbnQpOworICAgICAgICAgICAgbmF0aXZlX2RyYXdUZXh0KG1OYXRpdmVDYW52YXMsIGJ1ZiwgMCwgZW5kIC0gc3RhcnQsIHgsIHksIAorICAgICAgICAgICAgICAgICAgICBwYWludC5tQmlkaUZsYWdzLCBwYWludC5tTmF0aXZlUGFpbnQpOworICAgICAgICAgICAgVGVtcG9yYXJ5QnVmZmVyLnJlY3ljbGUoYnVmKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIFJlbmRlciBhIHJ1biBvZiBhbGwgTFRSIG9yIGFsbCBSVEwgdGV4dCwgd2l0aCBzaGFwaW5nLiBUaGlzIGRvZXMgbm90IHJ1bgorICAgICAqIGJpZGkgb24gdGhlIHByb3ZpZGVkIHRleHQsIGJ1dCByZW5kZXJzIGl0IGFzIGEgdW5pZm9ybSByaWdodC10by1sZWZ0IG9yCisgICAgICogbGVmdC10by1yaWdodCBydW4sIGFzIGluZGljYXRlZCBieSBkaXIuIEFsaWdubWVudCBvZiB0aGUgdGV4dCBpcyBhcworICAgICAqIGRldGVybWluZWQgYnkgdGhlIFBhaW50J3MgVGV4dEFsaWduIHZhbHVlLgorICAgICAqIAorICAgICAqIEBwYXJhbSB0ZXh0IHRoZSB0ZXh0IHRvIHJlbmRlcgorICAgICAqIEBwYXJhbSBpbmRleCB0aGUgc3RhcnQgb2YgdGhlIHRleHQgdG8gcmVuZGVyCisgICAgICogQHBhcmFtIGNvdW50IHRoZSBjb3VudCBvZiBjaGFycyB0byByZW5kZXIKKyAgICAgKiBAcGFyYW0gY29udGV4dEluZGV4IHRoZSBzdGFydCBvZiB0aGUgY29udGV4dCBmb3Igc2hhcGluZy4gIE11c3QgYmUKKyAgICAgKiAgICAgICAgIG5vIGdyZWF0ZXIgdGhhbiBpbmRleC4KKyAgICAgKiBAcGFyYW0gY29udGV4dENvdW50IHRoZSBudW1iZXIgb2YgY2hhcmFjdGVycyBpbiB0aGUgY29udGV4dCBmb3Igc2hhcGluZy4KKyAgICAgKiAgICAgICAgIENvbnRleEluZGV4ICsgY29udGV4dENvdW50IG11c3QgYmUgbm8gbGVzcyB0aGFuIGluZGV4CisgICAgICogICAgICAgICArIGNvdW50LgorICAgICAqIEBwYXJhbSB4IHRoZSB4IHBvc2l0aW9uIGF0IHdoaWNoIHRvIGRyYXcgdGhlIHRleHQKKyAgICAgKiBAcGFyYW0geSB0aGUgeSBwb3NpdGlvbiBhdCB3aGljaCB0byBkcmF3IHRoZSB0ZXh0CisgICAgICogQHBhcmFtIGRpciB0aGUgcnVuIGRpcmVjdGlvbiwgZWl0aGVyIHtAbGluayAjRElSRUNUSU9OX0xUUn0gb3IKKyAgICAgKiAgICAgICAgIHtAbGluayAjRElSRUNUSU9OX1JUTH0uCisgICAgICogQHBhcmFtIHBhaW50IHRoZSBwYWludAorICAgICAqIEBoaWRlCisgICAgICovCisgICAgcHVibGljIHZvaWQgZHJhd1RleHRSdW4oY2hhcltdIHRleHQsIGludCBpbmRleCwgaW50IGNvdW50LAorICAgICAgICAgICAgaW50IGNvbnRleHRJbmRleCwgaW50IGNvbnRleHRDb3VudCwgZmxvYXQgeCwgZmxvYXQgeSwgaW50IGRpciwKKyAgICAgICAgICAgIFBhaW50IHBhaW50KSB7CisKKyAgICAgICAgaWYgKHRleHQgPT0gbnVsbCkgeworIC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sUG9pbnRlckV4Y2VwdGlvbigidGV4dCBpcyBudWxsIik7CisgICAgICAgIH0KKyAgICAgICAgaWYgKHBhaW50ID09IG51bGwpIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBOdWxsUG9pbnRlckV4Y2VwdGlvbigicGFpbnQgaXMgbnVsbCIpOworICAgICAgICB9CisgICAgICAgIGlmICgoc3RhcnQgfCBlbmQgfCBlbmQgLSBzdGFydCB8IHRleHQubGVuZ3RoKCkgLSBlbmQpIDwgMCkgeworICAgICAgICAgICAgdGhyb3cgbmV3IEluZGV4T3V0T2ZCb3VuZHNFeGNlcHRpb24oKTsKKyAgICAgICAgfQorCisgICAgICAgIGludCBmbGFncyA9IGRpciA9PSAwID8gMCA6IDE7CisKKyAgICAgICAgaWYgKHRleHQgaW5zdGFuY2VvZiBTdHJpbmcgfHwgdGV4dCBpbnN0YW5jZW9mIFNwYW5uZWRTdHJpbmcgfHwKKyAgICAgICAgICAgICAgICB0ZXh0IGluc3RhbmNlb2YgU3Bhbm5hYmxlU3RyaW5nKSB7CisgICAgICAgICAgICBuYXRpdmVfZHJhd1RleHRSdW4obU5hdGl2ZUNhbnZhcywgdGV4dC50b1N0cmluZygpLCBzdGFydCwgZW5kLAorICAgICAgICAgICAgICAgICAgICBjb250ZXh0U3RhcnQsIGNvbnRleHRFbmQsIHgsIHksIGZsYWdzLCBwYWludC5tTmF0aXZlUGFpbnQpOworICAgICAgICB9IGVsc2UgaWYgKHRleHQgaW5zdGFuY2VvZiBHcmFwaGljc09wZXJhdGlvbnMpIHsKKyAgICAgICAgICAgICgoR3JhcGhpY3NPcGVyYXRpb25zKSB0ZXh0KS5kcmF3VGV4dFJ1bih0aGlzLCBzdGFydCwgZW5kLAorICAgICAgICAgICAgICAgICAgICBjb250ZXh0U3RhcnQsIGNvbnRleHRFbmQsIHgsIHksIGZsYWdzLCBwYWludCk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBpbnQgY29udGV4dExlbiA9IGNvbnRleHRFbmQgLSBjb250ZXh0U3RhcnQ7CisgICAgICAgICAgICBpbnQgbGVuID0gZW5kIC0gc3RhcnQ7CisgICAgICAgICAgICBjaGFyW10gYnVmID0gVGVtcG9yYXJ5QnVmZmVyLm9idGFpbihjb250ZXh0TGVuKTsKKyAgICAgICAgICAgIFRleHRVdGlscy5nZXRDaGFycyh0ZXh0LCBjb250ZXh0U3RhcnQsIGNvbnRleHRFbmQsIGJ1ZiwgMCk7CisgICAgICAgICAgICBuYXRpdmVfZHJhd1RleHRSdW4obU5hdGl2ZUNhbnZhcywgYnVmLCBzdGFydCAtIGNvbnRleHRTdGFydCwgbGVuLAorICAgICAgICAgICAgICAgICAgICAwLCBjb250ZXh0TGVuLCB4LCB5LCBmbGFncywgcGFpbnQubU5hdGl2ZVBhaW50KTsKICAgICAgICAgICAgIFRlbXBvcmFyeUJ1ZmZlci5yZWN5Y2xlKGJ1Zik7CiAgICAgICAgIH0KICAgICB9CkBAIC0xMzY4LDcgKzE0ODcsNyBAQAogICAgICAgICB9CiAgICAgICAgIG5hdGl2ZV9kcmF3VGV4dE9uUGF0aChtTmF0aXZlQ2FudmFzLCB0ZXh0LCBpbmRleCwgY291bnQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXRoLm5pKCksIGhPZmZzZXQsIHZPZmZzZXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYWludC5tTmF0aXZlUGFpbnQpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFpbnQubUJpZGlGbGFncywgcGFpbnQubU5hdGl2ZVBhaW50KTsKICAgICB9CiAKICAgICAvKioKQEAgLTEzODgsNyArMTUwNyw4IEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgdk9mZnNldCwgUGFpbnQgcGFpbnQpIHsKICAgICAgICAgaWYgKHRleHQubGVuZ3RoKCkgPiAwKSB7CiAgICAgICAgICAgICBuYXRpdmVfZHJhd1RleHRPblBhdGgobU5hdGl2ZUNhbnZhcywgdGV4dCwgcGF0aC5uaSgpLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhPZmZzZXQsIHZPZmZzZXQsIHBhaW50Lm1OYXRpdmVQYWludCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaE9mZnNldCwgdk9mZnNldCwgcGFpbnQubUJpZGlGbGFncywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYWludC5tTmF0aXZlUGFpbnQpOwogICAgICAgICB9CiAgICAgfQogCkBAIC0xNDMyLDI3ICsxNTUyLDI4IEBACiAgICAgICAgIHJlc3RvcmUoKTsKICAgICB9CiAgICAgCisgICAgQE92ZXJyaWRlCiAgICAgcHJvdGVjdGVkIHZvaWQgZmluYWxpemUoKSB0aHJvd3MgVGhyb3dhYmxlIHsKLSAgICAgICAgc3VwZXIuZmluYWxpemUoKTsKLSAgICAgICAgLy8gSWYgdGhlIGNvbnN0cnVjdG9yIHRocmV3IGFuIGV4Y2VwdGlvbiBiZWZvcmUgc2V0dGluZyBtTmF0aXZlQ2FudmFzLCB0aGUgbmF0aXZlIGZpbmFsaXplcgotICAgICAgICAvLyBtdXN0IG5vdCBiZSBpbnZva2VkLgotICAgICAgICBpZiAobU5hdGl2ZUNhbnZhcyAhPSAwKSB7Ci0gICAgICAgICAgICBmaW5hbGl6ZXIobU5hdGl2ZUNhbnZhcyk7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBzdXBlci5maW5hbGl6ZSgpOworICAgICAgICB9IGZpbmFsbHkgeworICAgICAgICAgICAgLy8gSWYgdGhlIGNvbnN0cnVjdG9yIHRocmV3IGFuIGV4Y2VwdGlvbiBiZWZvcmUgc2V0dGluZyBtTmF0aXZlQ2FudmFzLAorICAgICAgICAgICAgLy8gdGhlIG5hdGl2ZSBmaW5hbGl6ZXIgbXVzdCBub3QgYmUgaW52b2tlZC4KKyAgICAgICAgICAgIGlmIChtTmF0aXZlQ2FudmFzICE9IDApIHsK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WVyKGludCBuYXRpdmVDYW52YXMsIGZsb2F0IGwsCkBAIC0xNTU1LDEwICsxNjc2LDE5IEBACiAgICAgCiAgICAgcHJpdmF0ZSBzdGF0aWMgbmF0aXZlIHZvaWQgbmF0aXZlX2RyYXdUZXh0KGludCBuYXRpdmVDYW52YXMsIGNoYXJbXSB0ZXh0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgaW5kZXgsIGludCBjb3VudCwgZmxvYXQgeCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgeSwgaW50IHBhaW50KTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgeSwgaW50IGZsYWdzLCBpbnQgcGFpbnQpOwogICAgIHByaXZhdGUgc3RhdGljIG5hdGl2ZSB2b2lkIG5hdGl2ZV9kcmF3VGV4dChpbnQgbmF0aXZlQ2FudmFzLCBTdHJpbmcgdGV4dCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IHN0YXJ0LCBpbnQgZW5kLCBmbG9hdCB4LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCB5LCBpbnQgcGFpbnQpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCB5LCBpbnQgZmxhZ3MsIGludCBwYWludCk7CisKKyAgICBwcml2YXRlIHN0YXRpYyBuYXRpdmUgdm9pZCBuYXRpdmVfZHJhd1RleHRSdW4oaW50IG5hdGl2ZUNhbnZhcywgU3RyaW5nIHRleHQsCisgICAgICAgICAgICBpbnQgc3RhcnQsIGludCBlbmQsIGludCBjb250ZXh0U3RhcnQsIGludCBjb250ZXh0RW5kLAorICAgICAgICAgICAgZmxvYXQgeCwgZmxvYXQgeSwgaW50IGZsYWdzLCBpbnQgcGFpbnQpOworCisgICAgcHJpdmF0ZSBzdGF0aWMgbmF0aXZlIHZvaWQgbmF0aXZlX2RyYXdUZXh0UnVuKGludCBuYXRpdmVDYW52YXMsIGNoYXJbXSB0ZXh0LAorICAgICAgICAgICAgaW50IHN0YXJ0LCBpbnQgY291bnQsIGludCBjb250ZXh0U3RhcnQsIGludCBjb250ZXh0Q291bnQsCisgICAgICAgICAgICBmbG9hdCB4LCBmbG9hdCB5LCBpbnQgZmxhZ3MsIGludCBwYWludCk7CisKICAgICBwcml2YXRlIHN0YXRpYyBuYXRpdmUgdm9pZCBuYXRpdmVfZHJhd1Bvc1RleHQoaW50IG5hdGl2ZUNhbnZhcywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hhcltdIHRleHQsIGludCBpbmRleCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGNvdW50LCBmbG9hdFtdIHBvcywKQEAgLTE1NzAsMTEgKzE3MDAsMTMgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hhcltdIHRleHQsIGludCBpbmRleCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGNvdW50LCBpbnQgcGF0aCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgaE9mZnNldCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgdk9mZnNldCwgaW50IHBhaW50KTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgdk9mZnNldCwgaW50IGJpZGlGbGFncywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IHBhaW50KTsKICAgICBwcml2YXRlIHN0YXRpYyBuYXRpdmUgdm9pZCBuYXRpdmVfZHJhd1RleHRPblBhdGgoaW50IG5hdGl2ZUNhbnZhcywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgU3RyaW5nIHRleHQsIGludCBwYXRoLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCBoT2Zmc2V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCB2T2Zmc2V0LCBpbnQgcGFpbnQpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCBoT2Zmc2V0LCAKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgdk9mZnNldCwgCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBmbGFncywgaW50IHBhaW50KTsKICAgICBwcml2YXRlIHN0YXRpYyBuYXRpdmUgdm9pZCBuYXRpdmVfZHJhd1BpY3R1cmUoaW50IG5hdGl2ZUNhbnZhcywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IG5hdGl2ZVBpY3R1cmUpOwogICAgIHByaXZhdGUgc3RhdGljIG5hdGl2ZSB2b2lkIGZpbmFsaXplcihpbnQgbmF0aXZlQ2FudmFzKTsKZGlmZiAtLWdpdCBhL2dyYXBoaWNzL2phdmEvYW5kcm9pZC9ncmFwaGljcy9Db2xvckZpbHRlci5qYXZhIGIvZ3JhcGhpY3MvamF2YS9hbmRyb2lkL2dyYXBoaWNzL0NvbG9yRmlsdGVyLmphdmEKaW5kZXggNzZmMmM3Zi4uZTVjZjgzMCAxMDA2NDQKLS0tIGEvZ3JhcGhpY3MvamF2YS9hbmRyb2lkL2dyYXB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Yml0bWFwIHRvIG5pbmUgcGF0Y2hlcy4KICAgICAgKgpAQCAtNzQsMTAgKzgwLDE0IEBACiAgICAgICogQHBhcmFtIGxvY2F0aW9uICBXaGVyZSB0byBkcmF3IHRoZSBiaXRtYXAuCiAgICAgICovCiAgICAgcHVibGljIHZvaWQgZHJhdyhDYW52YXMgY2FudmFzLCBSZWN0RiBsb2NhdGlvbikgewotICAgICAgICBuYXRpdmVEcmF3KGNhbnZhcy5tTmF0aXZlQ2FudmFzLCBsb2NhdGlvbiwKLSAgICAgICAgICAgICAgICAgICBtQml0bWFwLm5pKCksIG1DaHVuaywKLSAgICAgICAgICAgICAgICAgICBtUGFpbnQgIT0gbnVsbCA/IG1QYWludC5tTmF0aXZlUGFpbnQgOiAwLAotICAgICAgICAgICAgICAgICAgIGNhbnZhcy5tRGVuc2l0eSwgbUJpdG1hcC5tRGVuc2l0eSk7CisgICAgICAgIGlmICghY2FudmFzLmlzSGFyZHdhcmVBY2NlbGVyYXRlZCgpKSB7CisgICAgICAgICAgICBuYXRpdmVEcmF3KGNhbnZhcy5tTmF0aXZlQ2FudmFzLCBsb2NhdGlvbiwKKyAgICAgICAgICAgICAgICAgICAgICAgbUJpdG1hcC5uaSgpLCBtQ2h1bmssCisgICAgICAgICAgICAgICAgICAgICAgIG1QYWludCAhPSBudWxsID8gbVBhaW50Lm1OYXRpdmVQYWludCA6IDAsCisgICAgICAgICAgICAgICAgICAgICAgIGNhbnZhcy5tRGVuc2l0eSwgbUJpdG1hcC5tRGVuc2l0eSk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBjYW52YXMuZHJhd1BhdGNoKG1CaXRtYXAsIG1DaHVuaywgbG9jYXRpb24sIG51bGwpOworICAgICAgICB9CiAgICAgfQogICAgIAogICAgIC8qKiAKQEAgLTg3LDEwICs5NywxNSBAQAogICAgICAqIEBwYXJhbSBsb2NhdGlvbiAgV2hlcmUgdG8gZHJhdyB0aGUgYml0bWFwLgogICAgICAqLwogICAgIHB1YmxpYyB2b2lkIGRyYXcoQ2FudmFzIGNhbnZhcywgUmVjdCBsb2NhdGlvbikgewotICAgICAgICBuYXRpdmVEcmF3KGNhbnZhcy5tTmF0aXZlQ2FudmFzLCBsb2NhdGlvbiwKLSAgICAgICAgICAgICAgICBtQml0bWFwLm5pKCksIG1DaHVuaywKLSAgICAgICAgICAgICAgICBtUGFpbnQgIT0gbnVsbCA/IG1QYWludC5tTmF0aXZlUGFpbnQgOiAwLAotICAgICAgICAgICAgICAgIGNhbnZhcy5tRGVuc2l0eSwgbUJpdG1hcC5tRGVuc2l0eSk7CisgICAgICAgIGlmICghY2FudmFzLmlzSGFyZHdhcmVBY2NlbGVyYXRlZCgpKSB7CisgICAgICAgICAgICBuYXRpdmVEcmF3KGNhbnZhcy5tTmF0aXZlQ2FudmFzLCBsb2NhdGlvbiwKKyAgICAgICAgICAgICAgICAgICAgICAgIG1CaXRtYXAubmkoKSwgbUNodW5rLAorICAgICAgICAgICAgICAgICAgICAgICAgbVBhaW50ICE9IG51bGwgPyBtUGFpbnQubU5hdGl2ZVBhaW50IDogMCwKKyAgICAgICAgICAgICAgICAgICAgICAgIGNhbnZhcy5tRGVuc2l0eSwgbUJpdG1hcC5tRGVuc2l0eSk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBtUmVjdC5zZXQobG9jYXRpb24pOworICAgICAgICAgICAgY2FudmFzLmRyYXdQYXRjaChtQml0bWFwLCBtQ2h1bmssIG1SZWN0LCBudWxsKTsKKyAgICAgICAgfQogICAgIH0KIAogICAgIC8qKiAKQEAgLTEwMSw5ICsxMTYsMTQgQEAKICAgICAgKiBAcGFyYW0gcGFpbnQgICAgIFRoZSBQYWludCB0byBkcmF3IHRocm91Z2guCiAgICAgICovCiAgICAgcHVibGljIHZvaWQgZHJhdyhDYW52YXMgY2FudmFzLCBSZWN0IGxvY2F0aW9uLCBQYWludCBwYWludCkgewotICAgICAgICBuYXRpdmVEcmF3KGNhbnZhcy5tTmF0aXZlQ2FudmFzLCBsb2NhdGlvbiwKLSAgICAgICAgICAgICAgICBtQml0bWFwLm5pKCksIG1DaHVuaywgcGFpbnQgIT0gbnVsbCA/IHBhaW50Lm1OYXRpdmVQYWludCA6IDAsCi0gICAgICAgICAgICAgICAgY2FudmFzLm1EZW5zaXR5LCBtQml0bWFwLm1EZW5zaXR5KTsKKyAgICAgICAgaWYgKCFjYW52YXMuaXNIYXJkd2FyZUFjY2VsZXJhdGVkKCkpIHsKKyAgICAgICAgICAgIG5hdGl2ZURyYXcoY2FudmFzLm1OYXRpdmVDYW52YXMsIGxvY2F0aW9uLAorICAgICAgICAgICAgICAgICAgICBtQml0bWFwLm5pKCksIG1DaHVuaywgcGFpbnQgIT0gbnVsbCA/IHBhaW50Lm1OYXRpdmVQYWludCA6IDAsCisgICAgICAgICAgICAgICAgICAgIGNhbnZhcy5tRGVuc2l0eSwgbUJpdG1hcC5tRGVuc2l0eSk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBtUmVjdC5zZXQobG9jYXRpb24pOworICAgICAgICAgICAgY2FudmFzLmRyYXdQYXRjaChtQml0bWFwLCBtQ2h1bmssIG1SZWN0LCBwYWludCk7CisgICAgICAgIH0KICAgICB9CiAKICAgICAvKioKQEAgLTEzMywxMSArMTUzLDYgQEAKICAgICAKICAgICBwdWJsaWMgbmF0aXZlIHN0YXRpYyBib29sZWFuIGlzTmluZVBhdGNoQ2h1bmsoYnl0ZVtdIGNodW5rKTsKIAotICAgIHByaXZhdGUgZmluYWwgQml0bWFwIG1CaXRtYXA7Ci0gICAgcHJpdmF0ZSBmaW5hbCBieXRlW10gbUNodW5rOwotICAgIHByaXZhdGUgUGFpbnQgICAgICAgIG1QYWludDsKLSAgICBwcml2YXRlIFN0cmluZyAgICAgICBtU3JjTmFtZTsgIC8vIFVzZWZ1bCBmb3IgZGVidWdnaW5nCi0KICAgICBwcml2YXRlIHN0YXRpYyBuYXRpdmUgdm9pZCB2YWxpZGF0ZU5pbmVQYXRja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gY2xhc3MgUGFpbnQgewogCi0gICAgLypwYWNrYWdlKi8gaW50ICAgICBtTmF0aXZlUGFpbnQ7CisgICAgLyoqCisgICAgICogQGhpZGUKKyAgICAgKi8KKyAgICBwdWJsaWMgaW50IG1OYXRpdmVQYWludDsKKwogICAgIHByaXZhdGUgQ29sb3JGaWx0ZXIgbUNvbG9yRmlsdGVyOwogICAgIHByaXZhdGUgTWFza0ZpbHRlciAgbU1hc2tGaWx0ZXI7CiAgICAgcHJpdmF0ZSBQYXRoRWZmZWN0ICBtUGF0aEVmZmVjdDsKQEAgLTM5LDYgKzQzLDMyIEBACiAgICAgcHJpdmF0ZSBib29sZWFuICAgICBtSGFzQ29tcGF0U2NhbGluZzsKICAgICBwcml2YXRlIGZsb2F0ICAgICAgIG1Db21wYXRTY2FsaW5nOwogICAgIHByaXZhdGUgZmxvYXQgICAgICAgbUludkNvbXBhdFNjYWxpbmc7CisKKyAgICAvKioKKyAgICAgKiBAaGlkZQorICAgICAqLworICAgIHB1YmxpYyBib29sZWFuIGhhc1NoYWRvdzsKKyAgICAvKioKKyAgICAgKiBAaGlkZQorICAgICAqLworICAgIHB1YmxpYyBmbG9hdCBzaGFkb3dEeDsKKyAgICAvKioKKyAgICAgKiBAaGlkZQorICAgICAqLworICAgIHB1YmxpYyBmbG9hdCBzaGFkb3dEeTsKKyAgICAvKioKKyAgICAgKiBAaGlkZQorICAgICAqLworICAgIHB1YmxpYyBmbG9hdCBzaGFkb3dSYWRpdXM7CisgICAgLyoqCisgICAgICogQGhpZGUKKyAgICAgKi8KKyAgICBwdWJsaWMgaW50IHNoYWRvd0NvbG9yOworCisgICAgLyoqCisgICAgICogQGhpZGUKKyAgICAgKi8KKyAgICBwdWJsaWMgIGludCAgICAgICAgIG1CaWRpRmxhZ3MgPSBCSURJX0RFRkFVTFRfTFRSOwogICAgIAogICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIFN0eWxlW10gc1N0eWxlQXJyYXkgPSB7CiAgICAgICAgIFN0e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ICAgICAqIAorICAgICAqIEBoaWRlCisgICAgICovCisgICAgcHVibGljIHN0YXRpYyBmaW5hbCBpbnQgQklESV9ERUZBVUxUX1JUTCA9IDB4MzsKKworICAgIC8qKgorICAgICAqIEJpZGkgZmxhZyB0byBvdmVycmlkZSBkaXJlY3Rpb24gdG8gYWxsIExUUiAoaWdub3JlIGJpZGkpLgorICAgICAqIAorICAgICAqIEBoaWRlCisgICAgICovCisgICAgcHVibGljIHN0YXRpYyBmaW5hbCBpbnQgQklESV9GT1JDRV9MVFIgPSAweDQ7CisKKyAgICAvKioKKyAgICAgKiBCaWRpIGZsYWcgdG8gb3ZlcnJpZGUgZGlyZWN0aW9uIHRvIGFsbCBSVEwgKGlnbm9yZSBiaWRpKS4KKyAgICAgKiAKKyAgICAgKiBAaGlkZQorICAgICAqLworICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgaW50IEJJRElfRk9SQ0VfUlRMID0gMHg1OworCisgICAgLyoqCisgICAgICogTWF4aW11bSBCaWRpIGZsYWcgdmFsdWUuCisgICAgICogQGhpZGUKKyAgICAgKi8KKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgQklESV9NQVhfRkxBR19WQUxVRSA9IEJJRElfRk9SQ0VfUlRMOworCisgICAgLyoqCisgICAgICogTWFzayBmb3IgYmlkaSBmbGFncy4KKyAgICAgKiBAaGlkZQorICAgICAqLworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBCSURJX0ZMQUdfTUFTSyA9IDB4NzsKKworICAgIC8qKgorICAgICAqIEZsYWcgZm9yIGdldFRleHRSdW5BZHZhbmNlcyBpbmRpY2F0aW5nIGxlZnQtdG8tcmlnaHQgcnVuIGRpcmVjdGlvbi4KKyAgICAgKiBAaGlkZQorICAgICAqLworICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgaW50IERJUkVDVElPTl9MVFIgPSAwOworCisgICAgLyoqCisgICAgICogRmxhZyBmb3IgZ2V0VGV4dFJ1bkFkdmFuY2Vz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b21wYXRTY2FsaW5nOwogICAgICAgICAgICAgbUNvbXBhdFNjYWxpbmcgICAgPSBzcmMubUNvbXBhdFNjYWxpbmc7CiAgICAgICAgICAgICBtSW52Q29tcGF0U2NhbGluZyA9IHNyYy5tSW52Q29tcGF0U2NhbGluZzsKKyAgICAgICAgICAgIG1CaWRpRmxhZ3MgICAgICA9IHNyYy5tQmlkaUZsYWdzOwogICAgICAgICB9CiAgICAgfQogCkBAIC0yNTIsMTAgKzM5NSwzMyBAQAogICAgICAgICAgICAgbUludkNvbXBhdFNjYWxpbmcgPSAxLjBmL2ZhY3RvcjsKICAgICAgICAgfQogICAgIH0KLSAgICAKKworICAgIC8qKgorICAgICAqIFJldHVybiB0aGUgYmlkaSBmbGFncyBvbiB0aGUgcGFpbnQuCisgICAgICogCisgICAgICogQHJldHVybiB0aGUgYmlkaSBmbGFncyBvbiB0aGUgcGFpbnQKKyAgICAgKiBAaGlkZQorICAgICAqLworICAgIHB1YmxpYyBpbnQgZ2V0QmlkaUZsYWdzKCkgeworICAgICAgICByZXR1cm4gbUJpZGlGbGFnczsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBTZXQgdGhlIGJpZGkgZmxhZ3Mgb24gdGhlIHBhaW50LgorICAgICAqIEBoaWRlCisgICAgICovCisgICAgcHVibGljIHZvaWQgc2V0QmlkaUZsYWdzKGludCBmbGFncykgeworICAgICAgICAvLyBvbmx5IGZsYWcgdmFsdWUgaXMgdGhlIDMtYml0IEJJREkgY29udHJvbCBzZXR0aW5nCisgICAgICAgIGZsYWdzICY9IEJJRElfRkxBR19NQVNLOworICAgICAgICBpZiAoZmxhZ3MgPiBCSURJX01BWF9GTEFHX1ZBTFVFKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCJ1bmtub3duIGJpZGkgZmxhZzogIiArIGZsYWdzKTsKKyAgICAgICAgfQorICAgICAgICBtQmlkaUZsYWdzID0gZmxhZ3M7CisgICAgfQorCiAgICAgLyoqCiAgICAgICogUmV0dXJuIHRoZSBwYWludCdzIGZsYWdzLiBVc2UgdGhlIEZsYWcgZW51bSB0byB0ZXN0IGZsYWcgdmFsdWVzLgotICAgICAqCisgICAgICogCiAgICAgICogQHJldHVybiB0aGUgcGFpbnQncyBmbGFncyAoc2VlIGVudW1zIGVuZGluZyBpbiBfRmxhZyBmb3IgYml0IG1hc2tzKQogICAgICAqLwogICAgIHB1YmxpYyBuYXRpdmUgaW50IGdldEZsYWdzKCk7CkBAIC03ODcsMTggKzk1MywyNyBAQAogICAgIH0KICAgICAKICAgICAvKioKLSAgICAgKiBUZW1wb3JhcnkgQVBJIHRvIGV4cG9zZSBsYXllciBkcmF3aW5nLiBUaGlzIGRyYXdzIGEgc2hhZG93IGxheWVyIGJlbG93Ci0gICAgICogdGhlIG1haW4gbGF5ZXIsIHdpdGggdGhlIHNwZWNpZmllZCBvZmZzZXQgYW5kIGNvbG9yLCBhbmQgYmx1ciByYWRpdXMuCi0gICAgICogSWYgcmFkaXVzIGlzIDAsIHRoZW4gdGhlIHNoYWRvdyBsYXllciBpcyByZW1vdmVkLgorICAgICAqIFRoaXMgZHJhd3MgYSBzaGFkb3cgbGF5ZXIgYmVsb3cgdGhlIG1haW4gbGF5ZXIsIHdpdGggdGhlIHNwZWNpZmllZAorICAgICAqIG9mZnNldCBhbmQgY29sb3IsIGFuZCBibHVyIHJhZGl1cy4gSWYgcmFkaXVzIGlzIDAsIHRoZW4gdGhlIHNoYWRvdworICAgICAqIGxheWVyIGlzIHJlbW92ZWQuCiAgICAgICovCi0gICAgcHVibGljIG5hdGl2ZSB2b2lkIHNldFNoYWRvd0xheWVyKGZsb2F0IHJhZGl1cywgZmxvYXQgZHgsIGZsb2F0IGR5LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgY29sb3IpOworICAgIHB1YmxpYyB2b2lkIHNldFNoYWRvd0xheWVyKGZsb2F0IHJhZGl1cywgZmxvYXQgZH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CBidWYsIDApOworICAgICAgICBpbnQgcmVzdWx0ID0gZ2V0VGV4dFdpZHRocyhidWYsIDAsIGVuZCAtIHN0YXJ0LCB3aWR0aHMpOwogICAgICAgICBUZW1wb3JhcnlCdWZmZXIucmVjeWNsZShidWYpOwotICAgIAlyZXR1cm4gcmVzdWx0OworICAgICAgICByZXR1cm4gcmVzdWx0OwogICAgIH0KIAogICAgIC8qKgpAQCAtMTI4Miw2ICsxNDU3LDI4NCBAQAogICAgIH0KIAogICAgIC8qKgorICAgICAqIENvbnZlbmllbmNlIG92ZXJsb2FkIHRoYXQgdGFrZXMgYSBjaGFyIGFycmF5IGluc3RlYWQgb2YgYQorICAgICAqIFN0cmluZy4KKyAgICAgKgorICAgICAqIEBzZWUgI2dldFRleHRSdW5BZHZhbmNlcyhTdHJpbmcsIGludCwgaW50LCBpbnQsIGludCwgaW50LCBmbG9hdFtdLCBpbnQpCisgICAgICogQGhpZGUKKyAgICAgKi8KKyAgICBwdWJsaWMgZmxvYXQgZ2V0VGV4dFJ1bkFkdmFuY2VzKGNoYXJbXSBjaGFycywgaW50IGluZGV4LCBpbnQgY291bnQsCisgICAgICAgICAgICBpbnQgY29udGV4dEluZGV4LCBpbnQgY29udGV4dENvdW50LCBpbnQgZmxhZ3MsIGZsb2F0W10gYWR2YW5jZXMsCisgICAgICAgICAgICBpbnQgYWR2YW5jZXNJbmRleCkgeworCisgICAgICAgIGlmICgoaW5kZXggfCBjb3VudCB8IGNvbnRleHRJbmRleCB8IGNvbnRleHRDb3VudCB8IGFkdmFuY2VzSW5kZXgKKyAgICAgICAgICAgICAgICB8IChpbmRleCAtIGNvbnRleHRJbmRleCkKKyAgICAgICAgICAgICAgICB8ICgoY29udGV4dEluZGV4ICsgY29udGV4dENvdW50KSAtIChpbmRleCArIGNvdW50KSkKKyAgICAgICAgICAgICAgICB8IChjaGFycy5sZW5ndGggLSAoY29udGV4dEluZGV4ICsgY29udGV4dENvdW50KSkKKyAgICAgICAgICAgICAgICB8IChhZHZhbmNlcyA9PSBudWxsID8gMCA6CisgICAgICAgICAgICAgICAgICAgIChhZHZhbmNlcy5sZW5ndGggLSAoYWR2YW5jZXNJbmRleCArIGNvdW50KSkpKSA8IDApIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBJbmRleE91dE9mQm91bmRzRXhjZXB0aW9uKCk7CisgICAgICAgIH0KKyAgICAgICAgaWYgKGZsYWdzICE9IERJUkVDVElPTl9MVFIgJiYgZmxhZ3MgIT0gRElSRUNUSU9OX1JUTCkgeworICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigidW5rbm93biBmbGFncyB2YWx1ZTogIiArIGZsYWdzKTsKKyAgICAgICAgfQorCisgICAgICAgIGlmICghbUhhc0NvbXBhdFNjYWxpbmcpIHsKKyAgICAgICAgICAgIHJldHVybiBuYXRpdmVfZ2V0VGV4dFJ1bkFkdmFuY2VzKG1OYXRpdmVQYWludCwgY2hhcnMsIGluZGV4LCBjb3VudCwKKyAgICAgICAgICAgICAgICAgICAgY29udGV4dEluZGV4LCBjb250ZXh0Q291bnQsIGZsYWdzLCBhZHZhbmNlcywgYWR2YW5jZXNJbmRleCk7CisgICAgICAgIH0KKworICAgICAgICBmaW5hbCBmbG9hdCBvbGRTaXplID0gZ2V0VGV4dFNpemUoKTsKKyAgICAgICAgc2V0VGV4dFNpemUob2xkU2l6ZSAqIG1Db21wYXRTY2FsaW5nKTsKKyAgICAgICAgZmxvYXQgcmVzID0gbmF0aXZlX2dldFRleHRSdW5BZHZhbmNlcyhtTmF0aXZlUGFpbnQsIGNoYXJzLCBpbmRleCwgY291bnQsCisgICAgICAgICAgICAgICAgY29udGV4dEluZGV4LCBjb250ZXh0Q291bnQsIGZsYWdzLCBhZHZhbmNlcywgYWR2YW5jZXNJbmRleCk7CisgICAgICAgIHNldFRleHRTaXplKG9sZFNpemUpOworCisgICAgICAgIGlmIChhZHZhbmNlcyAhPSBudWxsKSB7CisgICAgICAgICAgICBmb3IgKGludCBpID0gYWR2YW5jZXNJbmRleCwgZSA9IGkgKyBjb3VudDsgaSA8IGU7IGkrKykgeworICAgICAgICAgICAgICAgIGFkdmFuY2VzW2ldICo9IG1JbnZDb21wYXRTY2FsaW5nOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHJldHVybiByZXMgKiBtSW52Q29tcGF0U2NhbGluZzsgLy8gYXNzdW1lIGVycm9ycyBhcmUgbm90IHNpZ25pZmljYW50CisgICAgfQorCisgICAgLyoqCisgICAgICogQ29udmVuaWVuY2Ugb3ZlcmxvYWQgdGhhdCB0YWtlcyBhIENoYXJTZXF1ZW5jZSBpbnN0ZWFkIG9mIGEKKyAgICAgKiBTdHJpbmcuCisgICAgICoKKyAgICAgKiBAc2VlICNnZXRUZXh0UnVuQWR2YW5jZXMoU3RyaW5nLCBpbnQsIGludCwgaW50LCBpbnQsIGludCwgZmxvYXRbXSwgaW50KQorICAgICAqIEBoaWRlCisgICAgICovCisgICAgcHVibGljIGZsb2F0IGdldFRleHRSdW5BZHZhbmNlcyhDaGFyU2VxdWVuY2UgdGV4dCwgaW50IHN0YXJ0LCBpbnQgZW5kLAorICAgICAgICAgICAgaW50IGNvbnRleHRTdGFydCwgaW50IGNvbnRleHRFbmQsIGludCBmbGFncywgZmxvYXRbXSBhZHZhbmNlcywKKyAgICAgICAgICAgIGludCBhZHZhbmNlc0luZGV4KSB7CisKKyAgICAgICAgaWYgKHRleHQgaW5zdGFuY2VvZiBTdHJpbmcpIHsKKyAgICAgICAgICAgIHJldHVybiBnZXRUZXh0UnVuQWR2YW5jZXMoKFN0cmluZykgdGV4dCwgc3RhcnQsIGVuZCwKKyAgICAgICAgICAgICAgICAgICAgY29udGV4dFN0YXJ0LCBjb250ZXh0RW5kLCBmbGFncywgYWR2YW5jZXMsIGFkdmFuY2VzSW5kZXgpOworICAgICAgICB9CisgICAgICAgIGlmICh0ZXh0IGluc3RhbmNlb2YgU3Bhbm5lZFN0cmluZyB8fAorICAgICAgICAgICAgdGV4dCBpbnN0YW5jZW9mIFNwYW5uYWJsZVN0cmluZykgeworICAgICAgICAgICAgcmV0dXJuIGdldFRleHRSdW5BZHZhbmNlcyh0ZXh0LnRvU3RyaW5nKCksIHN0YXJ0LCBlbmQsCisgICAgICAgICAgICAgICAgICAgIGNvbnRleHRTdGFydCwgY29udGV4dEVuZCwgZmxhZ3MsIGFkdmFuY2VzLCBhZHZhbmNlc0luZGV4KTsKKyAgICAgICAgfQorICAgICAgICBpZiAodGV4dCBpbnN0YW5jZW9mIEdyYXBoaWNzT3BlcmF0aW9ucykgeworICAgICAgICAgICAgcmV0dXJuICgoR3JhcGhpY3NPcGVyYXRpb25zKSB0ZXh0KS5nZXRUZXh0UnVuQWR2YW5jZXMoc3RhcnQsIGVuZCwKKyAgICAgICAgICAgICAgICAgICAgY29udGV4dFN0YXJ0LCBjb250ZXh0RW5kLCBmbGFncywgYWR2YW5jZXMsIGFkdmFuY2VzSW5kZXgsIHRoaXMpOworICAgICAgICB9CisKKyAgICAgICAgaW50IGNvbnRleHRMZW4gPSBjb250ZXh0RW5kIC0gY29udGV4dFN0YXJ0OworICAgICAgICBpbnQgbGVuID0gZW5kIC0gc3RhcnQ7CisgICAgICAgIGNoYXJbXSBidWYgPSBUZW1wb3JhcnlCdWZmZXIub2J0YWluKGNvbnRleHRMZW4pOworICAgICAgICBUZXh0VXRpbHMuZ2V0Q2hhcnModGV4dCwgc3RhcnQsIGVuZCwgYnVmLCAwKTsKKyAgICAgICAgZmxvYXQgcmVzdWx0ID0gZ2V0VGV4dFJ1bkFkdmFuY2VzKGJ1Ziwgc3RhcnQgLSBjb250ZXh0U3RhcnQsIGxlbiwKKyAgICAgICAgICAgICAgICAwLCBjb250ZXh0TGVuLCBmbGFncywgYWR2YW5jZXMsIGFkdmFuY2VzSW5kZXgpOworICAgICAgICBUZW1wb3JhcnlCdWZmZXIucmVjeWNsZShidWYpOworICAgICAgICByZXR1cm4gcmVzdWx0OworICAgIH0KKworICAg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AorICAgICAqIHtAbGluayAjQ1VSU09SX0FUX09SX0FGVEVSfSwge0BsaW5rICNDVVJTT1JfQkVGT1JFfSwKKyAgICAgKiB7QGxpbmsgI0NVUlNPUl9BVF9PUl9CRUZPUkV9LCBvciB7QGxpbmsgI0NVUlNPUl9BVH0KKyAgICAgKiBAcmV0dXJuIHRoZSBvZmZzZXQgb2YgdGhlIG5leHQgcG9zaXRpb24sIG9yIC0xCisgICAgICogQGhpZGUKKyAgICAgKi8KKyAgICBwdWJsaWMgaW50IGdldFRleHRSdW5DdXJzb3IoQ2hhclNlcXVlbmNlIHRleHQsIGludCBjb250ZXh0U3RhcnQsCisgICAgICAgICAgIGludCBjb250ZXh0RW5kLCBpbnQgZmxhZ3MsIGludCBvZmZzZXQsIGludCBjdXJzb3JPcHQpIHsKKworICAgICAgICBpZiAodGV4dCBpbnN0YW5jZW9mIFN0cmluZyB8fCB0ZXh0IGluc3RhbmNlb2YgU3Bhbm5lZFN0cmluZyB8fAorICAgICAgICAgICAgICAgIHRleHQgaW5zdGFuY2VvZiBTcGFubmFibGVTdHJpbmcpIHsKKyAgICAgICAgICAgIHJldHVybiBnZXRUZXh0UnVuQ3Vyc29yKHRleHQudG9TdHJpbmcoKSwgY29udGV4dFN0YXJ0LCBjb250ZXh0RW5kLAorICAgICAgICAgICAgICAgICAgICBmbGFncywgb2Zmc2V0LCBjdXJzb3JPcHQpOworICAgICAgICB9CisgICAgICAgIGlmICh0ZXh0IGluc3RhbmNlb2YgR3JhcGhpY3NPcGVyYXRpb25zKSB7CisgICAgICAgICAgICByZXR1cm4gKChHcmFwaGljc09wZXJhdGlvbnMpIHRleHQpLmdldFRleHRSdW5DdXJzb3IoCisgICAgICAgICAgICAgICAgICAgIGNvbnRleHRTdGFydCwgY29udGV4dEVuZCwgZmxhZ3MsIG9mZnNldCwgY3Vyc29yT3B0LCB0aGlzKTsKKyAgICAgICAgfQorCisgICAgICAgIGludCBjb250ZXh0TGVuID0gY29udGV4dEVuZCAtIGN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U3RhcnQsIGludCBjb250ZXh0RW5kLAorICAgICAgICAgICAgaW50IGZsYWdzLCBpbnQgb2Zmc2V0LCBpbnQgY3Vyc29yT3B0KSB7CisgICAgICAgIGlmICgoKGNvbnRleHRTdGFydCB8IGNvbnRleHRFbmQgfCBvZmZzZXQgfCAoY29udGV4dEVuZCAtIGNvbnRleHRTdGFydCkKKyAgICAgICAgICAgICAgICB8IChvZmZzZXQgLSBjb250ZXh0U3RhcnQpIHwgKGNvbnRleHRFbmQgLSBvZmZzZXQpCisgICAgICAgICAgICAgICAgfCAodGV4dC5sZW5ndGgoKSAtIGNvbnRleHRFbmQpIHwgY3Vyc29yT3B0KSA8IDApCisgICAgICAgICAgICAgICAgfHwgY3Vyc29yT3B0ID4gQ1VSU09SX09QVF9NQVhfVkFMVUUpIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBJbmRleE91dE9mQm91bmRzRXhjZXB0aW9uKCk7CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gbmF0aXZlX2dldFRleHRSdW5DdXJzb3IobU5hdGl2ZVBhaW50LCB0ZXh0LAorICAgICAgICAgICAgICAgIGNvbnRleHRTdGFydCwgY29udGV4dEVuZCwgZmxhZ3MsIG9mZnNldCwgY3Vyc29yT3B0KTsKKyAgICB9CisKKyAgICAvKioKICAgICAgKiBSZXR1cm4gdGhlIHBhdGggKG91dGxpbmUpIGZvciB0aGUgc3BlY2lmaWVkIHRleHQuCiAgICAgICogTm90ZToganVzdCBsaWtlIENhbnZhcy5kcmF3VGV4dCwgdGhpcyB3aWxsIHJlc3BlY3QgdGhlIEFsaWduIHNldHRpbmcgaW4KICAgICAgKiB0aGUgcGFpbnQuCkBAIC0xMjk5LDcgKzE3NTIsOCBAQAogICAgICAgICBpZiAoKGluZGV4IHwgY291bnQpIDwgMCB8fCBpbmRleCArIGNvdW50ID4gdGV4dC5sZW5ndGgpIHsKICAgICAgICAgICAgIHRocm93IG5ldyBBcnJheUluZGV4T3V0T2ZCb3VuZHNFeGNlcHRpb24oKTsKICAgICAgICAgfQotICAgICAgICBuYXRpdmVfZ2V0VGV4dFBhdGgobU5hdGl2ZVBhaW50LCB0ZXh0LCBpbmRleCwgY291bnQsIHgsIHksIHBhdGgubmkoKSk7CisgICAgICAgIG5hdGl2ZV9nZXRUZXh0UGF0aChtTmF0aXZlUGFpbnQsIG1CaWRpRmxhZ3MsIHRleHQsIGluZGV4LCBjb3VudCwgeCwgeSwgCisgICAgICAgICAgICAgICAgcGF0aC5uaSgpKTsKICAgICB9CiAKICAgICAvKioKQEAgLTEzMjAsNyArMTc3NCw4IEBACiAgICAgICAgIGlmICgoc3RhcnQgfCBlbmQgfCAoZW5kIC0gc3RhcnQpIHwgKHRleHQubGVuZ3RoKCkgLSBlbmQpKSA8IDApIHsKICAgICAgICAgICAgIHRocm93IG5ldyBJbmRleE91dE9mQm91bmRzRXhjZXB0aW9uKCk7CiAgICAgICAgIH0KLSAgICAgICAgbmF0aXZlX2dldFRleHRQYXRoKG1OYXRpdmVQYWludCwgdGV4dCwgc3RhcnQsIGVuZCwgeCwgeSwgcGF0aC5uaSgpKTsKKyAgICAgICAgbmF0aXZlX2dldFRleHRQYXRoKG1OYXRpdmVQYWludCwgbUJpZGlGbGFncywgdGV4dCwgc3RhcnQsIGVuZCwgeCwgeSwgCisgICAgICAgICAgICAgICAgcGF0aC5uaSgpKTsKICAgICB9CiAgICAgCiAgICAgLyoqCkBAIC0xNDA0LDkgKzE4NTksMjIgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGFyW10gdGV4dCwgaW50IGluZGV4LCBpbnQgY291bnQsIGZsb2F0W10gd2lkdGhzKTsKICAgICBwcml2YXRlIHN0YXRpYyBuYXRpdmUgaW50IG5hdGl2ZV9nZXRUZXh0V2lkdGhzKGludCBuYXRpdmVfb2JqZWN0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIFN0cmluZyB0ZXh0LCBpbnQgc3RhcnQsIGludCBlbmQsIGZsb2F0W10gd2lkdGh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lci5pc0F2YWlsYWJsZSgpOwogICAgIH0KIAogICAgIC8qKgpAQCAtNDMsNiArNjAsNyBAQAogICAgICAgICAgICAgdmFsTmF0aXZlID0gc3JjLm1OYXRpdmVQYXRoOwogICAgICAgICB9CiAgICAgICAgIG1OYXRpdmVQYXRoID0gaW5pdDIodmFsTmF0aXZlKTsKKyAgICAgICAgbURldGVjdFNpbXBsZVBhdGhzID0gSGFyZHdhcmVSZW5kZXJlci5pc0F2YWlsYWJsZSgpOwogICAgIH0KICAgICAKICAgICAvKioKQEAgLTUwLDYgKzY4LDEwIEBACiAgICAgICogVGhpcyBkb2VzIE5PVCBjaGFuZ2UgdGhlIGZpbGwtdHlwZSBzZXR0aW5nLgogICAgICAqLwogICAgIHB1YmxpYyB2b2lkIHJlc2V0KCkgeworICAgICAgICBpc1NpbXBsZVBhdGggPSB0cnVlOworICAgICAgICBpZiAobURldGVjdFNpbXBsZVBhdGhzKSB7CisgICAgICAgICAgICBpZiAocmVjdHMgIT0gbnVsbCkgcmVjdHMuc2V0RW1wdHkoKTsKKyAgICAgICAgfQogICAgICAgICBuYXRpdmVfcmVzZXQobU5hdGl2ZVBhdGgpOwogICAgIH0KIApAQCAtNTgsNiArODAsMTAgQEAKICAgICAgKiBrZWVwcyB0aGUgaW50ZXJuYWwgZGF0YSBzdHJ1Y3R1cmUgZm9yIGZhc3RlciByZXVzZS4KICAgICAgKi8KICAgICBwdWJsaWMgdm9pZCByZXdpbmQoKSB7CisgICAgICAgIGlzU2ltcGxlUGF0aCA9IHRydWU7CisgICAgICAgIGlmIChtRGV0ZWN0U2ltcGxlUGF0aHMpIHsKKyAgICAgICAgICAgIGlmIChyZWN0cyAhPSBudWxsKSByZWN0cy5zZXRFbXB0eSgpOworICAgICAgICB9CiAgICAgICAgIG5hdGl2ZV9yZXdpbmQobU5hdGl2ZVBhdGgpOwogICAgIH0KIApAQCAtNjUsNiArOTEsNyBAQAogICAgICovCiAgICAgcHVibGljIHZvaWQgc2V0KFBhdGggc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gICAgICAgKiBAaGlkZQorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIGZpbmFsIGludCBuYXRpdmVJbnQ7CiAgICAgfQogCiAgICAgLyoqIENyZWF0ZSBhbiBlbXB0eSByZWdpb24KQEAgLTMyNSwxMCArMzMzLDE0IEBACiAgICAgfQogCiAgICAgcHJvdGVjdGVkIHZvaWQgZmluYWxpemUoKSB0aHJvd3MgVGhyb3dhYmxlIHsKLSAgICAgICAgbmF0aXZlRGVzdHJ1Y3RvcihtTmF0aXZlUmVnaW9uKTsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIG5hdGl2ZURlc3RydWN0b3IobU5hdGl2ZVJlZ2lvbik7CisgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICBzdXBlci5maW5hbGl6ZSgpOworICAgICAgICB9CiAgICAgfQogICAgIAotICAgIC8qcGFja2FnZSovIFJlZ2lvbihpbnQgbmkpIHsKKyAgICBSZWdpb24oaW50IG5pKSB7CiAgICAgICAgIGlmIChuaSA9PSAwKSB7CiAgICAgICAgICAgICB0aHJvdyBuZXcgUnVudGltZUV4Y2VwdGlvbigpOwogICAgICAgICB9CkBAIC0zNDEsNyArMzUzLDcgQEAKICAgICAgICAgdGhpcyhuaSk7CiAgICAgfQogCi0gICAgLypwYWNrYWdlKi8gZmluYWwgaW50IG5pKCkgeworICAgIGZpbmFsIGludCBuaSgpIHsKICAgICAgICAgcmV0dXJuIG1OYXRpdmVSZWdpb247CiAgICAgfQogCkBAIC0zNzAsNiArMzgyLDQgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBhcmNlbCBwKTsKIAogICAgIHByaXZhdGUgc3RhdGljIG5hdGl2ZSBib29sZWFuIG5hdGl2ZUVxdWFscyhpbnQgbmF0aXZlX3IxLCBpbnQgbmF0aXZlX3IyKTsKLQotICAgIHByaXZhdGUgZmluYWwgaW50IG1OYXRpdmVSZWdpb247CiB9CmRpZmYg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goTWF0cml4IGxvY2FsTSkgewotICAgICAgICBuYXRpdmVTZXRMb2NhbE1hdHJpeChuYXRpdmVfaW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxvY2FsTSAhPSBudWxsID8gbG9jYWxNLm5hdGl2ZV9pbnN0YW5jZSA6IDApOworICAgICAgICBuYXRpdmVTZXRMb2NhbE1hdHJpeChuYXRpdmVfaW5zdGFuY2UsIG5hdGl2ZV9zaGFkZXIsIGxvY2FsTS5uYXRpdmVfaW5zdGFuY2UpOwogICAgIH0KIAogICAgIHByb3RlY3RlZCB2b2lkIGZpbmFsaXplKCkgdGhyb3dzIFRocm93YWJsZSB7Ci0gICAgICAgIG5hdGl2ZURlc3RydWN0b3IobmF0aXZlX2luc3RhbmNlKTsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIHN1cGVyLmZpbmFsaXplKCk7CisgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICBuYXRpdmVEZXN0cnVjdG9yKG5hdGl2ZV9pbnN0YW5jZSwgbmF0aXZlX3NoYWRlcik7CisgICAgICAgIH0KICAgICB9CiAKLSAgICBwcml2YXRlIHN0YXRpYyBuYXRpdmUgdm9pZCBuYXRpdmVEZXN0cnVjdG9yKGludCBuYXRpdmVfc2hhZGVyKTsKKyAgICBwcml2YXRlIHN0YXRpYyBuYXRpdmUgdm9pZCBuYXRpdmVEZXN0cnVjdG9yKGludCBuYXRpdmVfc2hhZGVyLCBpbnQgbmF0aXZlX3NraWFTaGFkZXIpOwogICAgIHByaXZhdGUgc3RhdGljIG5hdGl2ZSBib29sZWFuIG5hdGl2ZUdldExvY2FsTWF0cml4KGludCBuYXRpdmVfc2hhZGVyLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBtYXRyaXhfaW5zdGFuY2UpOworICAgICAgICAgICAgaW50IG1hdHJpeF9pbnN0YW5jZSk7IAogICAgIHByaXZhdGUgc3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bXV0YWJsZSBEcmF3YWJsZSB3aWxsIGhhdmUgbm8gZWZmZWN0LgogICAgICAqCiAgICAgICogQHJldHVybiBUaGlzIGRyYXdhYmxlLgorICAgICAqIEBzZWUgQ29uc3RhbnRTdGF0ZQorICAgICAqIEBzZWUgI2dldENvbnN0YW50U3RhdGUoKQogICAgICAqLwogICAgIHB1YmxpYyBEcmF3YWJsZSBtdXRhdGUoKSB7CiAgICAgICAgIHJldHVybiB0aGlzOwpAQCAtNzQ5LDYgKzc2MCw4IEBACiAgICAgICAgICAgICBkcmF3YWJsZSA9IG5ldyBTdGF0ZUxpc3REcmF3YWJsZSgpOwogICAgICAgICB9IGVsc2UgaWYgKG5hbWUuZXF1YWxzKCJsZXZlbC1saXN0IikpIHsKICAgICAgICAgICAgIGRyYXdhYmxlID0gbmV3IExldmVsTGlzdERyYXdhYmxlKCk7CisgICAgICAgIH0gZWxzZSBpZiAobmFtZS5lcXVhbHMoIm1pcG1hcCIpKSB7CisgICAgICAgICAgICBkcmF3YWJsZSA9IG5ldyBNaXBtYXBEcmF3YWJsZSgpOwogICAgICAgICB9IGVsc2UgaWYgKG5hbWUuZXF1YWxzKCJsYXllci1saXN0IikpIHsKICAgICAgICAgICAgIGRyYXdhYmxlID0gbmV3IExheWVyRHJhd2FibGUoKTsKICAgICAgICAgfSBlbHNlIGlmIChuYW1lLmVxdWFscygidHJhbnNpdGlvbiIpKSB7CkBAIC03NzAsNyArNzgzLDcgQEAKICAgICAgICAgfSBlbHNlIGlmIChuYW1lLmVxdWFscygiaW5zZXQiKSkgewogICAgICAgICAgICAgZHJhd2FibGUgPSBuZXcgSW5zZXREcmF3YWJsZSgpOwogICAgICAgICB9IGVsc2UgaWYgKG5hbWUuZXF1YWxzKCJiaXRtYXAiKSkgewotICAgICAgICAgICAgZHJhd2FibGUgPSBuZXcgQml0bWFwRHJhd2FibGUoKTsKKyAgICAgICAgICAgIGRyYXdhYmxlID0gbmV3IEJpdG1hcERyYXdhYmxlKHIpOwogICAgICAgICAgICAgaWYgKHIgIT0gbnVsbCkgewogICAgICAgICAgICAgICAgKChCaXRtYXBEcmF3YWJsZSkgZHJhd2FibGUpLnNldFRhcmdldERlbnNpdHkoci5nZXREaXNwbGF5TWV0cmljcygpKTsKICAgICAgICAgICAgIH0KQEAgLTgwNSw2ICs4MTgsOSBAQAogICAgICAgICByZXR1cm4gbnVsbDsKICAgICB9CiAKKyAgICAvKioKKyAgICAgKiBJbmZsYXRlIHRoaXMgRHJhd2FibGUgZnJvbSBhbiBYTUwgcmVzb3VyY2UuCisgICAgICovCiAgICAgcHVibGljIHZvaWQgaW5mbGF0ZShSZXNvdXJjZXMgciwgWG1sUHVsbFBhcnNlciBwYXJzZXIsIEF0dHJpYnV0ZVNldCBhdHRycykKICAgICAgICAgICAgIHRocm93cyBYbWxQdWxsUGFyc2VyRXhjZXB0aW9uLCBJT0V4Y2VwdGlvbiB7CiAKQEAgLTgxMyw2ICs4MjksMTIgQEAKICAgICAgICAgYS5yZWN5Y2xlKCk7CiAgICAgfQogCisgICAgLyoqCisgICAgICogSW5mbGF0ZSBhIERyYXdhYmxlIGZyb20gYW4gWE1MIHJlc291cmNlLgorICAgICAqCisgICAgICogQHRocm93cyBYbWxQdWxsUGFyc2VyRXhjZXB0aW9uCisgICAgICogQHRocm93cyBJT0V4Y2VwdGlvbgorICAgICAqLwogICAgIHZvaWQgaW5mbGF0ZVdpdGhBdHRyaWJ1dGVzKFJlc291cmNlcyByLCBYbWxQdWxsUGFyc2VyIHBhcnNlciwKICAgICAgICAgICAgIFR5cGVkQXJyYXkgYXR0cnMsIGludCB2aXNpYmxlQXR0cikKICAgICAgICAgICAgIHRocm93cyBYbWxQdWxsUGFyc2VyRXhjZXB0aW9uLCBJT0V4Y2VwdGlvbiB7CkBAIC04MjAsMTIgKzg0MiwyNyBAQAogICAgICAgICBtVmlzaWJsZSA9IGF0dHJzLmdldEJvb2xlYW4odmlzaWJsZUF0dHIsIG1WaXNpYmxlKTsKICAgICB9CiAKK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OTYsOCArMjA0LDcgQEAKICAgICAgICAgICAgICAgICBtRHJhd2FibGVDb250YWluZXJTdGF0ZS5nZXRPcGFjaXR5KCk7CiAgICAgfQogCi0gICAgcHVibGljIGJvb2xlYW4gc2VsZWN0RHJhd2FibGUoaW50IGlkeCkKLSAgICB7CisgICAgcHVibGljIGJvb2xlYW4gc2VsZWN0RHJhd2FibGUoaW50IGlkeCkgewogICAgICAgICBpZiAoaWR4ID09IG1DdXJJbmRleCkgewogICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICB9CkBAIC0yNTUsNiArMjYyLDEyIEBACiAgICAgICAgIHJldHVybiB0aGlzOwogICAgIH0KIAorICAgIC8qKgorICAgICAqIEEgQ29uc3RhbnRTdGF0ZSB0aGF0IGNhbiBjb250YWluIHNldmVyYWwge0BsaW5rIERyYXdhYmxlfXMuCisgICAgICoKKyAgICAgKiBUaGlzIGNsYXNzIHdhcyBtYWRlIHB1YmxpYyB0byBlbmFibGUgdGVzdGluZywgYW5kIGl0cyB2aXNpYmlsaXR5IG1heSBjaGFuZ2UgaW4gYSBmdXR1cmUKKyAgICAgKiByZWxlYXNlLgorICAgICAqLwogICAgIHB1YmxpYyBhYnN0cmFjdCBzdGF0aWMgY2xhc3MgRHJhd2FibGVDb250YWluZXJTdGF0ZSBleHRlbmRzIENvbnN0YW50U3RhdGUgewogICAgICAgICBmaW5hbCBEcmF3YWJsZUNvbnRhaW5lciBtT3duZXI7CiAKQEAgLTQ0MywxMiArNDU2LDEyIEBACiAgICAgICAgICAgICByZXR1cm4gbUNvbnN0YW50TWluaW11bUhlaWdodDsKICAgICAgICAgfQogCi0gICAgICAgIHByaXZhdGUgdm9pZCBjb21wdXRlQ29uc3RhbnRTaXplKCkgeworICAgICAgICBwcm90ZWN0ZWQgdm9pZCBjb21wdXRlQ29uc3RhbnRTaXplKCkgewogICAgICAgICAgICAgbUNvbXB1dGVkQ29uc3RhbnRTaXplID0gdHJ1ZTsKIAogICAgICAgICAgICAg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mF5LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUGF0aC5EaXJlY3Rpb24uQ1cpOworICAgICAgICAgICAgICAgICAgICBtUGF0aC5hZGRSb3VuZFJlY3QobVJlY3QsIHN0Lm1SYWRpdXNBcnJheSwgUGF0aC5EaXJlY3Rpb24uQ1cpOwogICAgICAgICAgICAgICAgICAgICBjYW52YXMuZHJhd1BhdGgobVBhdGgsIG1GaWxsUGFpbnQpOwogICAgICAgICAgICAgICAgICAgICBpZiAoaGF2ZVN0cm9rZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgY2FudmFzLmRyYXdQYXRoKG1QYXRoLCBtU3Ryb2tlUGFpbnQpOwogICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGVsc2UgeworICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoc3QubVJhZGl1cyA+IDAuMGYpIHsKICAgICAgICAgICAgICAgICAgICAgLy8gc2luY2UgdGhlIGNhbGxlciBpcyBvbmx5IGdpdmluZyB1cyAxIHZhbHVlLCB3ZSB3aWxsIGZvcmNlCiAgICAgICAgICAgICAgICAgICAgIC8vIGl0IHRvIGJlIHNxdWFyZSBpZiB0aGUgcmVjdCBpcyB0b28gc21hbGwgaW4gb25lIGRpbWVuc2lvbgogICAgICAgICAgICAgICAgICAgICAvLyB0byBzaG93IGl0LiBJZiB3ZSBkaWQgbm90aGluZywgU2tpYSB3b3VsZCBjbGFtcCB0aGUgcmFkCi0gICAgICAgICAgICAgICAgICAgIC8vIGluZGVwZW5kZW50bHkgYWxvbmcgZWFjaCBheGlzLCBnaXZpbmcgdXMgYSB0aGluIGVsbGlwcworICAgICAgICAgICAgICAgICAgICAvLyBpbmRlcGVuZGVudGx5IGFsb25nIGVhY2ggYXhpcywgZ2l2aW5nIHVzIGEgdGhpbiBlbGxpcHNlCiAgICAgICAgICAgICAgICAgICAgIC8vIGlmIHRoZSByZWN0IHdlcmUgdmVyeSB3aWRlIGJ1dCBub3QgdmVyeSB0YWxsCiAgICAgICAgICAgICAgICAgICAgIGZsb2F0IHJhZCA9IHN0Lm1SYWRpdXM7CiAgICAgICAgICAgICAgICAgICAgIGZsb2F0IHIgPSBNYXRoLm1pbihtUmVjdC53aWR0aCgpLCBtUmVjdC5oZWlnaHQoKSkgKiAwLjVmOwpAQCAtMzM1LDYgKzMzMywxMSBAQAogICAgICAgICAgICAgICAgICAgICBpZiAoaGF2ZVN0cm9rZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgY2FudmFzLmRyYXdSb3VuZFJlY3QobVJlY3QsIHJhZCwgcmFkLCBtU3Ryb2tlUGFpbnQpOwogICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgY2FudmFzLmRyYXdSZWN0KG1SZWN0LCBtRmlsbFBhaW50KTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGhhdmVTdHJva2UpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNhbnZhcy5kcmF3UmVjdChtUmVjdCwgbVN0cm9rZVBhaW50KTsKKyAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgIGNhc2UgT1ZBTDoKZGlmZiAtLWdpdCBhL2dyYXBoaWNzL2phdmEvYW5kcm9pZC9ncmFwaGljcy9kcmF3YWJsZS9MYXllckRyYXdhYmxlLmphdmEgYi9ncmFwaGljcy9qYXZhL2FuZHJvaWQvZ3JhcGhpY3MvZHJhd2FibGUvTGF5ZXJEcmF3YWJsZS5qYXZhCmluZGV4IDgwNDdkZDQuLjUwMWNjYTkgMTAwNjQ0Ci0tLSBhL2dyYXBoaWNzL2phdmEvYW5kcm9pZC9ncmFwaGljcy9kcmF3YWJsZS9MYXllckRyYXdhYmxlLmphdmEKKysrIGIvZ3JhcGhpY3MvamF2YS9hbmRyb2lkL2dyY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0dWFsbHkgcmVwbGFjZSB0aGUgcHJldmlvdXMgb25lLgorICAgICAgICBzZWxlY3REcmF3YWJsZSgtMSk7CisgICAgICAgIG9uQm91bmRzQ2hhbmdlKGdldEJvdW5kcygpKTsKKyAgICB9CisKKyAgICAvLyBvdmVycmlkZXMgZnJvbSBEcmF3YWJsZQorCisgICAgQE92ZXJyaWRlCisgICAgcHJvdGVjdGVkIHZvaWQgb25Cb3VuZHNDaGFuZ2UoUmVjdCBib3VuZHMpIHsKKyAgICAgICAgZmluYWwgaW50IGluZGV4ID0gbU1pcG1hcENvbnRhaW5lclN0YXRlLmluZGV4Rm9yQm91bmRzKGJvdW5kcyk7CisKKyAgICAgICAgLy8gV2lsbCBjYWxsIGludmFsaWRhdGVTZWxmKCkgaWYgbmVlZGVkCisgICAgICAgIHNlbGVjdERyYXdhYmxlKGluZGV4KTsKKworICAgICAgICBzdXBlci5vbkJvdW5kc0NoYW5nZShib3VuZHMpOworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIGluZmxhdGUoUmVzb3VyY2VzIHIsIFhtbFB1bGxQYXJzZXIgcGFyc2VyLCBBdHRyaWJ1dGVTZXQgYXR0cnMpCisgICAgdGhyb3dzIFhtbFB1bGxQYXJzZXJFeGNlcHRpb24sIElPRXhjZXB0aW9uIHsKKworICAgICAgICBzdXBlci5pbmZsYXRlKHIsIHBhcnNlciwgYXR0cnMpOworCisgICAgICAgIGludCB0eXBlOworCisgICAgICAgIGZpbmFsIGludCBpbm5lckRlcHRoID0gcGFyc2VyLmdldERlcHRoKCkgKyAxOworICAgICAgICBpbnQgZGVwdGg7CisgICAgICAgIHdoaWxlICgodHlwZSA9IHBhcnNlci5uZXh0KCkpICE9IFhtbFB1bGxQYXJzZXIuRU5EX0RPQ1VNRU5UCisgICAgICAgICAgICAgICAgJiYgKChkZXB0aCA9IHBhcnNlci5nZXREZXB0aCgpKSA+PSBpbm5lckRlcHRoCisgICAgICAgICAgICAgICAgICAgICAgICB8fCB0eXBlICE9IFhtbFB1bGxQYXJzZXIuRU5EX1RBRykpIHsKKyAgICAgICAgICAgIGlmICh0eXBlICE9IFhtbFB1bGxQYXJzZXIuU1RBUlRfVEFHKSB7CisgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmIChkZXB0aCA+IGlubmVyRGVwdGggfHwgIXBhcnNlci5nZXROYW1lKCkuZXF1YWxzKCJpdGVtIikpIHsKKyAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgVHlwZWRBcnJheSBhID0gci5vYnRhaW5BdHRyaWJ1dGVzKGF0dHJzLAorICAgICAgICAgICAgICAgICAgICBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0eWxlYWJsZS5NaXBtYXBEcmF3YWJsZUl0ZW0pOworCisgICAgICAgICAgICBpbnQgZHJhd2FibGVSZXMgPSBhLmdldFJlc291cmNlSWQoCisgICAgICAgICAgICAgICAgICAgIGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3R5bGVhYmxlLk1pcG1hcERyYXdhYmxlSXRlbV9kcmF3YWJsZSwgMCk7CisKKyAgICAgICAgICAgIGEucmVjeWNsZSgpOworCisgICAgICAgICAgICBEcmF3YWJsZSBkcjsKKyAgICAgICAgICAgIGlmIChkcmF3YWJsZVJlcyAhPSAwKSB7CisgICAgICAgICAgICAgICAgZHIgPSByLmdldERyYXdhYmxlKGRyYXdhYmxlUmVzKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgd2hpbGUgKCh0eXBlID0gcGFyc2VyLm5leHQoKSkgPT0gWG1sUHVsbFBhcnNlci5URVhUKSB7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGlmICh0eXBlICE9IFhtbFB1bGxQYXJzZXIuU1RBUlRfVEFHKSB7CisgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBYbWxQdWxsUGFyc2VyRXhjZXB0aW9uKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcnNlci5nZXRQb3NpdGlvbkRlc2NyaXB0aW9uKCkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICArICI6IDxpdGVtPiB0YWcgcmVxdWlyZXMgYSAnZHJhd2FibGUnIGF0dHJpYnV0ZSBvciAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyAiY2hpbGQgdGFnIGRlZmluaW5nIGEgZHJhd2FibGUiKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZHIgPSBEcmF3YWJsZS5jcmVhdGVGcm9tWG1sSW5uZXIociwgcGFyc2VyLCBhdHRycyk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIG1NaXBtYXBDb250YWluZXJTdGF0ZS5hZGREcmF3YWJsZShkcik7CisgICAgICAgIH0KKworICAgICAgICBvbkRyYXdhYmxlQWRkZWQoKTsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgRHJhd2FibGUgbXV0YXRlKCkgeworICAgICAgICBpZiAoIW1NdXRhdGVkICYmIHN1cGVyLm11dGF0ZSgpID09IHRoaXMpIHsKKyAgICAgICAgICAgIG1NaXBtYXBDb250YWluZXJTdGF0ZS5tTWlwbWFwSGVpZ2h0cyA9IG1NaXBtYXBDb250YWluZXJTdGF0ZS5tTWlwbWFwSGVpZ2h0cy5jbG9uZSgpOworICAgICAgICAgICAgbU11dGF0ZWQgPSB0cnVlOworICAgICAgICB9CisgICAgICAgIHJldHVybiB0aGlzOworICAgIH0KKworICAgIHByaXZhdGUgZmluYWwgc3RhdGljIGNsYXNzIE1pcG1hcENvbnRhaW5lclN0YXRlIGV4dGVuZHMgRHJhd2FibGVDb250YWluZXJTdGF0ZSB7CisgICAgICAgIHByaXZhdGUgaW50W10gbU1pcG1hcEhlaWdodHM7CisKKyAgICAgICAgTWlwbWFwQ29udGFpbmVyU3RhdGUoTWlwbWFwQ29ud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gICAgICAgICAqIEBwYXJhbSBib3VuZHMgVGhlIGJvdW5kcyBvZiB0aGUgTWlwTWFwRHJhd2FibGUuCisgICAgICAgICAqIEByZXR1cm4gVGhlIGluZGV4IG9mIHRoZSBjaGlsZCBEcmF3YWJsZSB0aGF0IHdpbGwgYmVzdCBmaXQgdGhlc2UgYm91bmRzLCBvciAtMSBpZiB0aGVyZQorICAgICAgICAgKiBhcmUgbm8gY2hpbGRyZW4gbWlwbWFwcy4KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBpbnQgaW5kZXhGb3JCb3VuZHMoUmVjdCBib3VuZHMpIHsKKyAgICAgICAgICAgIGZpbmFsIGludCBib3VuZHNIZWlnaHQgPSBib3VuZHMuaGVpZ2h0KCk7CisgICAgICAgICAgICBmaW5hbCBpbnQgTiA9IGdldENoaWxkQ291bnQoKTsKKyAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgTjsgaSsrKSB7CisgICAgICAgICAgICAgICAgaWYgKGJvdW5kc0hlaWdodCA8PSBtTWlwbWFwSGVpZ2h0c1tpXSkgeworICAgICAgICAgICAgICAgICAgICByZXR1cm4gaTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIC8vIE5vIG1pcG1hcCBsYXJnZXIgdGhhbiBib3VuZHMgZm91bmQuIFVzZSBsYXJnZXN0IG9uZSB3aGljaCB3aWxsIGJlIHNjYWxlZCB1cC4KKyAgICAgICAgICAgIGlmIChOID4gMCkgeworICAgICAgICAgICAgICAgIHJldHVybiBOIC0gMTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIC8vIE5vIERyYXdhYmxlIG1pcG1hcCBhdCBhbGwKKyAgICAgICAgICAgIHJldHVybiAtMTsKKyAgICAgICAgfQorCisgICAgICAgIC8qKgorICAgICAgICAgKiBBZGRzIGEgRHJhd2FibGUgdG8gdGhlIGxpc3Qgb2YgYXZhaWxhYmxlIG1pcG1hcCBEcmF3YWJsZXMu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IGZpbmFsIGludCBwcmV2aW91c0ludHJpbnNpY0hlaWdodCA9IHByZXZpb3VzRHJhd2FibGUuZ2V0SW50cmluc2ljSGVpZ2h0KCk7CisKKyAgICAgICAgICAgICAgICBpZiAoZHJhd2FibGVIZWlnaHQgPCBwcmV2aW91c0ludHJpbnNpY0hlaWdodCkgeworICAgICAgICAgICAgICAgICAgICBtRHJhd2FibGVzW3Bvc10gPSBwcmV2aW91c0RyYXdhYmxlOworICAgICAgICAgICAgICAgICAgICBtTWlwbWFwSGVpZ2h0c1twb3NdID0gcHJldmlvdXNJbnRyaW5zaWNIZWlnaHQ7CisKKyAgICAgICAgICAgICAgICAgICAgbURyYXdhYmxlc1twb3MtMV0gPSBkcmF3YWJsZTsKKyAgICAgICAgICAgICAgICAgICAgbU1pcG1hcEhlaWdodHNbcG9zLTFdID0gZHJhd2FibGVIZWlnaHQ7CisgICAgICAgICAgICAgICAgICAgIHBvcy0tOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIC8qKgorICAgICAgICAgKiBJbnRyaW5zaWMgc2l6ZXMgYXJlIHRob3NlIG9mIHRoZSBsYXJnZXN0IGF2YWlsYWJsZSBtaXBtYXAuCisgICAgICAgICAqIE1pbmltdW0gc2l6ZXMgYXJlIHRob3NlIG9mIHRoZSBzbWFsbGVzdCBhdmFpbGFibGUgbWlwbWFwLgorICAgICAgICAgKi8KKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHByb3RlY3RlZCB2b2lkIGNvbXB1dGVDb25zdGFudFNpemUoKSB7CisgICAgICAgICAgICBmaW5hbCBpbnQgTiA9IGdldENoaWxkQ291bnQoKTsKKyAgICAgICAgICAgIGlmIChOID4gMCkgeworICAgICAgICAgICAgICAgIGZpbmFsIERyYXdhYmxlIHNtYWxsZXN0RHJhd2FibGUgPSBtRHJhd2FibGVzWzBdOworICAgICAgICAgICAgICAgIG1Db25zdGFudE1pbmltdW1XaWR0aCA9IHNtYWxsZXN0RHJhd2FibGUuZ2V0TWluaW11bVdpZHRoKCk7CisgICAgICAgICAgICAgICAgbUNvbnN0YW50TWluaW11bUhlaWdodCA9IHNtYWxsZXN0RHJhd2FibGUuZ2V0TWluaW11bUhlaWdodCgpOworCisgICAgICAgICAgICAgICAgZmluYWwgRHJhd2FibGUgbGFyZ2VzdERyYXdhYmxlID0gbURyYXdhYmxlc1tOLTFdOworICAgICAgICAgICAgICAgIG1Db25zdGFudFdpZHRoID0gbGFyZ2VzdERyYXdhYmxlLmdldEludHJpbnNpY1dpZHRoKCk7CisgICAgICAgICAgICAgICAgbUNvbnN0YW50SGVpZ2h0ID0gbGFyZ2VzdERyYXdhYmxlLmdldEludHJpbnNpY0hlaWdodCgpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBtQ29uc3RhbnRXaWR0aCA9IG1Db25zdGFudEhlaWdodCA9IC0xOworICAgICAgICAgICAgICAgIG1Db25zdGFudE1pbmltdW1XaWR0aCA9IG1Db25zdGFudE1pbmltdW1IZWlnaHQgPSAwOworICAgICAgICAgICAgfQorICAgICAgICAgICAgbUNvbXB1dGVkQ29uc3RhbnRTaXplID0gdHJ1ZTsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgRHJhd2FibGUgbmV3RHJhd2FibGUoKSB7CisgICAgICAgICAgICByZXR1cm4gbmV3IE1pcG1hcERyYXdhYmxlKHRoaXMsIG51bGwpOworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyBEcmF3YWJsZSBuZXdEcmF3YWJsZShSZXNvdXJjZXMgcmVzKSB7CisgICAgICAgICAgICByZXR1cm4gbmV3IE1pcG1hcERyYXdhYmxlKHRoaXMsIHJlcyk7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGU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vdW5kUmVjdFNoYXBlLmphdmEKQEAgLTU3LDEzICs1NywxMSBAQAogICAgICAqLwogICAgIHB1YmxpYyBSb3VuZFJlY3RTaGFwZShmbG9hdFtdIG91dGVyUmFkaWksIFJlY3RGIGluc2V0LAogICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdFtdIGlubmVyUmFkaWkpIHsKLSAgICAgICAgaWYgKG91dGVyUmFkaWkubGVuZ3RoIDwgOCkgewotICAgICAgICAgICAgdGhyb3cgbmV3IEFycmF5SW5kZXhPdXRPZkJvdW5kc0V4Y2VwdGlvbigKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAib3V0ZXIgcmFkaWkgbXVzdCBoYXZlID49IDggdmFsdWVzIik7CisgICAgICAgIGlmIChvdXRlclJhZGlpICE9IG51bGwgJiYgb3V0ZXJSYWRpaS5sZW5ndGggPCA4KSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgQXJyYXlJbmRleE91dE9mQm91bmRzRXhjZXB0aW9uKCJvdXRlciByYWRpaSBtdXN0IGhhdmUgPj0gOCB2YWx1ZXMiKTsKICAgICAgICAgfQogICAgICAgICBpZiAoaW5uZXJSYWRpaSAhPSBudWxsICYmIGlubmVyUmFkaWkubGVuZ3RoIDwgOCkgewotICAgICAgICAgICAgdGhyb3cgbmV3IEFycmF5SW5kZXhPdXRPZkJvdW5kc0V4Y2VwdGlvbigKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiaW5uZXIgcmFkaWkgbXVzdCBoYXZlID49IDggdmFsdWVzIik7CisgICAgICAgICAgICB0aHJvdyBuZXcgQXJyYXlJbmRleE91dE9mQm91bmRzRXhjZXB0aW9uKCJpbm5lciByYWRpaSBtdXN0IGhhdmUgPj0gOCB2YWx1ZXMiKTsKICAgICAgICAgfQogICAgICAgICBtT3V0ZXJSYWRpaSA9IG91dGVyUmFkaWk7CiAgICAgICAgIG1JbnNldCA9IGluc2V0OwpAQCAtOTcsOCAr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1SUy52YWxpZGF0ZSgpOworICAgICAgICBtTmFtZSA9IG1SUy5uR2V0TmFtZShtSUQpOworICAgICAgICBpbnQgdHlwZUlEID0gbVJTLm5BbGxvY2F0aW9uR2V0VHlwZShtSUQpOworICAgICAgICBpZih0eXBlSUQgIT0gMCkgeworICAgICAgICAgICAgbVR5cGUgPSBuZXcgVHlwZSh0eXBlSUQsIG1SUyk7CisgICAgICAgICAgICBtVHlwZS51cGRhdGVGcm9tTmF0aXZlKCk7CisgICAgICAgIH0KKyAgICB9CisKICAgICBwdWJsaWMgVHlwZSBnZXRUeXBlKCkgewogICAgICAgICByZXR1cm4gbVR5cGU7CiAgICAgfQpAQCAtNzYsMTAgKzkwLDMwIEBACiAgICAgICAgIHN1YkRhdGExRCgwLCBtVHlwZS5nZXRFbGVtZW50Q291bnQoKSwgZCk7CiAgICAgfQogCisgICAgcHVibGljIHZvaWQgc3ViRGF0YShpbnQgb2ZmLCBGaWVsZFBhY2tlciBmcCkgeworICAgICAgICBpbnQgZVNpemUgPSBtVHlwZS5tRWxlbWVudC5nZXRTaXplQnl0ZXMoKTsKKyAgICAgICAgZmluYWwgYnl0ZVtdIGRhdGEgPSBmcC5nZXREYXRhKCk7CisKKyAgICAgICAgaW50IGNvdW50ID0gZGF0YS5sZW5ndGggLyBlU2l6ZTsKKyAgICAgICAgaWYgKChlU2l6ZSAqIGNvdW50KSAhPSBkYXRhLmxlbmd0aCkgeworICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigiRmllbGQgcGFja2VyIGxlbmd0aCAiICsgZGF0YS5sZW5ndGggKworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiIG5vdCBkaXZpc2libGUgYnkgZWxlbWVudCBzaXplICIgKyBlU2l6ZSArICIuIik7CisgICAgICAgIH0KKyAgICAgICAgZGF0YTFEQ2hlY2tzKG9mZiwgY291bnQsIGRhdGEubGVuZ3RoLCBkYXRhLmxlbmd0aCk7CisgICAgICAgIG1SUy5uQWxsb2NhdGlvblN1YkRhdGExRChtSUQsIG9mZiwgY291bnQsIGRhdGEsIGRhdGEubGVuZ3RoKTsKKyAgICB9CisKICAgICBwcml2YXRlIHZvaWQgZGF0YTFEQ2hlY2tzKGludCBvZmYsIGludCBjb3VudCwgaW50IGxlbiwgaW50IGRhdGFTaXplKSB7CiAgICAgICAgIG1SUy52YWxpZGF0ZSgpOwotICAgICAgICBpZigob2ZmIDwgMCkgfHwgKGNvdW50IDwgMSkgfHwgKChvZmYgKyBjb3VudCkgPiBtVHlwZS5nZXRFbGVtZW50Q291bnQoKSkpIHsKLSAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oIk9mZnNldCBvciBDb3VudCBvdXQgb2YgYm91bmRzLiIpOworICAgICAgICBpZihvZmYgPCAwKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCJPZmZzZXQgbXVzdCBiZSA+PSAwLiIpOworICAgICAgICB9CisgICAgICAgIGlmKGNvdW50IDwgMSkgeworICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigiQ291bnQgbXVzdCBiZSA+PSAxLiIpOworICAgICAgICB9CisgICAgICAgIGlmKChvZmYgKyBjb3VudCkgPiBtVHlwZS5nZXRFbGVtZW50Q291bnQoKSkgeworICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigiT3ZlcmZsb3csIEF2YWlsYWJsZSBjb3VudCAiICsgbVR5cGUuZ2V0RWxlbWVudENvdW50KCkgKworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiLCBnb3QgIiArIGNvdW50ICsgIiBhdCBvZmZzZXQgIiArIG9mZiArICIuIik7CiAgICAgICAgIH0KICAgICAgICAgaWYoKGxlbikgPCBkYXRhU2l6ZSkgewogICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigiQXJyYXkgdG9vIHNtYWxsIGZvciBhbGxvY2F0aW9uIHR5cGUuIik7CkBAIC0xNDYsOCArMTgwLDcgQEAKIAogICAgIHB1YmxpYyBjbGFzcyBBZGFwdGVyMUQgZXh0ZW5kcyBCYXNlT2JqIHsKICAgICAgICAgQWRhcHRlcjFEKGludCBpZCwgUmVuZGVyU2NyaXB0IHJzKSB7Ci0gICAgICAgICAgICBzdXBlcihycyk7Ci0gICAgICAgICAgICBtSUQgPSBpZDsKKyAgICAgICAgICAgIHN1cGVyKGlkLCBycyk7CiAgICAgICAgIH0KIAogICAgICAgICBwdWJsaWMgdm9pZCBzZXRDb25zdHJhaW50KERpbWVuc2lvbiBkaW0sIGludCB2YWx1ZSkgewpAQCAtMTg5LDggKzIyMiw3IEBACiAKICAgICBwdWJsaWMgY2xhc3MgQWRhcHRlcjJEIGV4dGVuZHMgQmFzZU9iaiB7CiAgICAgICAgIEFkYXB0ZXIyRChpbnQgaWQsIFJlbmRlclNjcmlwdCBycykgewotICAgICAgICAgICAgc3VwZXIocnMpOwotICAgICAgICAgICAgbUlEID0gaWQ7CisgICAgICAgICAgICBzdXBlcihpZCwgcnMpOwogICAgICAgICB9CiAKICAgICAgICAgcHVibGljIHZvaWQgc2V0Q29uc3RyYWludChEaW1lbnNpb24gZGltLCBpbnQgdmFsdWUpIHsKQEAgLTM2Niw2ICszOTgsMjEgQEAKICAgICAgICAgQml0bWFwIGIgPSBCaXRtYXBGYWN0b3J5LmRlY29kZVJlc291cmNlKHJlcywgaWQsIG1CaXRtYXBPcHRpb25zKTsKICAgICAgICAgcmV0dXJuIGNyZWF0ZUZyb21CaXRtYXBCb3hlZChycywgYiwgZHN0Rm10LCBnZW5NaXBzKTsKICAgICB9CisKKyAgICBzdGF0aWMgcHVibGljIEFsbG9jYXRpb24gY3JlYXRlRnJvbVN0cmluZyhSZW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WNzL2phdmEvYW5kcm9pZC9yZW5kZXJzY3JpcHQvRWxlbWVudC5qYXZhCkBAIC0xNyw2ICsxNyw3IEBACiBwYWNrYWdlIGFuZHJvaWQucmVuZGVyc2NyaXB0OwogCiBpbXBvcnQgamF2YS5sYW5nLnJlZmxlY3QuRmllbGQ7CitpbXBvcnQgYW5kcm9pZC51dGlsLkxvZzsKIAogLyoqCiAgKiBAaGlkZQpAQCAtNDcsMjAgKzQ4LDIyIEBACiAgICAgICAgIFVOU0lHTkVEXzMyICgxMCwgNCksCiAgICAgICAgIC8vVU5TSUdORURfNjQgKDExLCA4KSwKIAotICAgICAgICBVTlNJR05FRF81XzZfNSAoMTIsIDIpLAotICAgICAgICBVTlNJR05FRF81XzVfNV8xICgxMywgMiksCi0gICAgICAgIFVOU0lHTkVEXzRfNF80XzQgKDE0LCAyKSwKKyAgICAgICAgQk9PTEVBTigxMiwgMSksCiAKLSAgICAgICAgUlNfRUxFTUVOVCAoMTUsIDQpLAotICAgICAgICBSU19UWVBFICgxNiwgNCksCi0gICAgICAgIFJTX0FMTE9DQVRJT04gKDE3LCA0KSwKLSAgICAgICAgUlNfU0FNUExFUiAoMTgsIDQpLAotICAgICAgICBSU19TQ1JJUFQgKDE5LCA0KSwKLSAgICAgICAgUlNfTUVTSCAoMjAsIDQpLAotICAgICAgICBSU19QUk9HUkFNX0ZSQUdNRU5UICgyMSwgNCksCi0gICAgICAgIFJTX1BST0dSQU1fVkVSVEVYICgyMiwgNCksCi0gICAgICAgIFJTX1BST0dSQU1fUkFTVEVSICgyMywgNCksCi0gICAgICAgIFJTX1BST0dSQU1fU1RPUkUgKDI0LCA0KTsKKyAgICAgICAgVU5TSUdORURfNV82XzUgKDEzLCAyKSwKKyAgICAgICAgVU5TSUdORURfNV81XzVfMSAoMTQsIDIpLAorICAgICAgICBVTlNJR05FRF80XzRfNF80ICgxNSwgMiksCisKKyAgICAgICAgUlNfRUxFTUVOVCAoMTYsIDQpLAorICAgICAgICBSU19UWVBFICgxNywgNCksCisgICAgICAgIFJTX0FMTE9DQVRJT04gKDE4LCA0KSwKKyAgICAgICAgUlNfU0FNUExFUiAoMTksIDQpLAorICAgICAgICBSU19TQ1JJUFQgKDIwLCA0KSwKKyAgICAgICAgUlNfTUVTSCAoMjEsIDQpLAorICAgICAgICBSU19QUk9HUkFNX0ZSQUdNRU5UICgyMiwgNCksCisgICAgICAgIFJTX1BST0dSQU1fVkVSVEVYICgyMywgNCksCisgICAgICAgIFJTX1BST0dSQU1fUkFTVEVSICgyNCwgNCksCisgICAgICAgIFJTX1BST0dSQU1fU1RPUkUgKDI1LCA0KTsKIAogICAgICAgICBpbnQgbUlEOwogICAgICAgICBpbnQgbVNpemU7CkBAIC03MiwxMiArNzUsNiBAQAogCiAgICAgcHVibGljIGVudW0gRGF0YUtpbmQgewogICAgICAgICBVU0VSICgwKSwKLSAgICAgICAgQ09MT1IgKDEpLAotICAgICAgICBQT1NJVElPTiAoMiksCi0gICAgICAgIFRFWFRVUkUgKDMpLAotICAgICAgICBOT1JNQUwgKDQpLAotICAgICAgICBJTkRFWCAoNSksCi0gICAgICAgIFBPSU5UX1NJWkUoNiksCiAKICAgICAgICAgUElYRUxfTCAoNyksCiAgICAgICAgIFBJWEVMX0EgKDgpLApAQCAtOTEsNDEgKzg4LDEzMyBAQAogICAgICAgICB9CiAgICAgfQogCi0gICAgcHVibGljIHN0YXRpYyBFbGVtZW50IFVTRVJfVTgoUmVuZGVyU2NyaXB0IHJzKSB7Ci0gICAgICAgIGlmKHJzLm1FbGVtZW50X1VTRVJfVTggPT0gbnVsbCkgewotICAgICAgICAgICAgcnMubUVsZW1lbnRfVVNFUl9VOCA9IGNyZWF0ZVVzZXIocnMsIERhdGFUeXBlLlVOU0lHTkVEXzgpOworICAgIHB1YmxpYyBzdGF0aWMgRWxlbWVudCBCT09MRUFOKFJlbmRlclNjcmlwdCBycykgeworICAgICAgICBpZihycy5tRWxlbWVudF9CT09MRUFOID09IG51bGwpIHsKKyAgICAgICA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W1lbnRfSTggPSBjcmVhdGVVc2VyKHJzLCBEYXRhVHlwZS5TSUdORURfOCk7CiAgICAgICAgIH0KLSAgICAgICAgcmV0dXJuIHJzLm1FbGVtZW50X1VTRVJfVTMyOworICAgICAgICByZXR1cm4gcnMubUVsZW1lbnRfSTg7CiAgICAgfQogCi0gICAgcHVibGljIHN0YXRpYyBFbGVtZW50IFVTRVJfSTMyKFJlbmRlclNjcmlwdCBycykgewotICAgICAgICBpZihycy5tRWxlbWVudF9VU0VSX0kzMiA9PSBudWxsKSB7Ci0gICAgICAgICAgICBycy5tRWxlbWVudF9VU0VSX0kzMiA9IGNyZWF0ZVVzZXIocnMsIERhdGFUeXBlLlNJR05FRF8zMik7CisgICAgcHVibGljIHN0YXRpYyBFbGVtZW50IFUxNihSZW5kZXJTY3JpcHQgcnMpIHsKKyAgICAgICAgaWYocnMubUVsZW1lbnRfVTE2ID09IG51bGwpIHsKKyAgICAgICAgICAgIHJzLm1FbGVtZW50X1UxNiA9IGNyZWF0ZVVzZXIocnMsIERhdGFUeXBlLlVOU0lHTkVEXzE2KTsKICAgICAgICAgfQotICAgICAgICByZXR1cm4gcnMubUVsZW1lbnRfVVNFUl9JMzI7CisgICAgICAgIHJldHVybiBycy5tRWxlbWVudF9VMTY7CiAgICAgfQogCi0gICAgcHVibGljIHN0YXRpYyBFbGVtZW50IFVTRVJfRjMyKFJlbmRlclNjcmlwdCBycykgewotICAgICAgICBpZihycy5tRWxlbWVudF9VU0VSX0YzMiA9PSBudWxsKSB7Ci0gICAgICAgICAgICBycy5tRWxlbWVudF9VU0VSX0YzMiA9IGNyZWF0ZVVzZXIocnMsIERhdGFUeXBlLkZMT0FUXzMyKTsKKyAgICBwdWJsaWMgc3RhdGljIEVsZW1lbnQgSTE2KFJlbmRlclNjcmlwdCBycykgeworICAgICAgICBpZihycy5tRWxlbWVudF9JMTYgPT0gbnVsbCkgeworICAgICAgICAgICAgcnMubUVsZW1lbnRfSTE2ID0gY3JlYXRlVXNlcihycywgRGF0YVR5cGUuU0lHTkVEXzE2KTsKICAgICAgICAgfQotICAgICAgICByZXR1cm4gcnMubUVsZW1lbnRfVVNFUl9GMzI7CisgICAgICAgIHJldHVybiBycy5tRWxlbWVudF9JMTY7CiAgICAgfQogCisgICAgcHVibGljIHN0YXRpYyBFbGVtZW50IFUzMihSZW5kZXJTY3JpcHQgcnMpIHsKKyAgICAgICAgaWYocnMubUVsZW1lbnRfVTMyID09IG51bGwpIHsKKyAgICAgICAgICAgIHJzLm1FbGVtZW50X1UzMiA9IGNyZWF0ZVVzZXIocnMsIERhdGFUeXBlLlVOU0lHTkVEXzMyKTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gcnMubUVsZW1lbnRfVTMyOworICAgIH0KKworICAgIHB1YmxpYyBzdGF0aWMgRWxlbWVudCBJMzIoUmVuZGVyU2NyaXB0IHJzKSB7CisgICAgICAgIGlmKHJzLm1FbGVtZW50X0kzMiA9PSBudWxsKSB7CisgICAgICAgICAgICBycy5tRWxlbWVudF9JMzIgPSBjcmVhdGVVc2VyKHJzLCBEYXRhVHlwZS5TSUdORURfMzIpOworICAgICAgICB9CisgICAgICAgIHJldHVybiBycy5tRWxlbWVudF9JMzI7CisgICAgfQorCisgICAgcHVibGljIHN0YXRpYyBFbGVtZW50IEYzMihSZW5kZXJTY3JpcHQgcnMpIHsKKyAgICAgICAgaWYocnMubUVsZW1lbnRfRjMyID09IG51bGwpIHsKKyAgICAgICAgICAgIHJzLm1FbGVtZW50X0YzMiA9IGNyZWF0ZVVzZXIocnMsIERhdGFUeXBlLkZMT0FUXzMyKTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gcnMubUVsZW1lbnRfRjMyOworICAgIH0KKworICAgIHB1YmxpYyBzdGF0aWMgRWxlbWVudCBFTEVNRU5UKFJlbmRlclNjcmlwdCBycykgeworICAgICAgICBpZihycy5tRWxlbWVudF9FTEVNRU5UID09IG51bGwpIHsKKyAgICAgICAgICAgIHJzLm1FbGVtZW50X0VMRU1FTlQgPSBjcmVhdGVVc2VyKHJzLCBEYXRhVHlwZS5SU19FTEVNRU5UKTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gcnMubUVsZW1lbnRfRUxFTUVOVDsKKyAgICB9CisKKyAgICBwdWJsaWMgc3RhdGljIEVsZW1lbnQgVFlQRShSZW5kZXJTY3JpcHQgcnMpIHsKKyAgICAgICAgaWYocnMubUVsZW1lbnRfVFlQRSA9PSBudWxsKSB7CisgICAgICAgICAgICBycy5tRWxlbWVudF9UWVBFID0gY3JlYXRlVXNlcihycywgRGF0YVR5cGUuUlNfVFlQRSk7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIHJzLm1FbGVtZW50X1RZUEU7CisgICAgfQorCisgICAgcHVibGljIHN0YXRpYyBFbGVtZW50IEFMTE9DQVRJT04oUmVuZGVyU2NyaXB0IHJzKSB7CisgICAgICAgIGlmKHJzLm1FbGVtZW50X0FMTE9DQVRJT04gPT0gbnVsbCkgeworICAgICAgICAgICAgcnMubUVsZW1lbnRfQUxMT0NBVElPTiA9IGNyZWF0ZVVzZXIocnMsIERhdGFUeXBlLlJTX0FMTE9DQVRJT04pOworICAgICAgICB9CisgICAgICAgIHJldHVybiBycy5tRWxlbWVudF9BTExPQ0FUSU9OOworICAgIH0KKworICAgIHB1YmxpYyBzdGF0aWMgRWxlbWVudCBTQU1QTEVSKFJlbmRlclNjcmlwdCBycykgeworICAgICAgICBpZihycy5tRWxlbWVudF9TQU1QTEVSID09IG51bGwpIHsKKyAgICAgICAgICAgIHJzLm1FbGVtZW50X1NBTVBMRVIgPSBjcmVhdGVVc2VyKHJzLCBEYXRhVHlwZS5SU19TQU1QTEVSKTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gcnMubUVsZW1lbnRfU0FNUExFUjsKKyAgICB9CisKKyAgICBwdWJsaWMgc3RhdGljIEVsZW1lbnQgU0NSSVBUKFJlbmRlclNjcmlwdCBycykgeworICAgICAgICBpZihycy5tRWxlbWVudF9TQ1JJUFQgPT0gbnVsbCkgeworICAgICAgICAgICAgcnMubUVsZW1lbnRfU0NSSVBUID0gY3JlYXRlVXNlcihycywgRGF0YVR5cGUuUlNfU0NSSVBUKTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gcnMubUVsZW1lbnRfU0NSSVBUOworICAgIH0KKworICAgIHB1YmxpYyBzdGF0aWMgRWxlbWVudCBNRVNIKFJlbmRlclNjcmlwdCBycykgeworICAgICAgICBpZihycy5tRWxlbWVudF9NRVNIID09IG51bGwpIHsKKyAgICAgICAgICAgIHJzLm1FbGVtZW50X01FU0ggPSBjcmVhdGVVc2VyKHJzLCBEYXRhVHlwZS5SU19NRVNIKTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gcnMubUVsZW1lbnRfTUVTSDsKKyAgICB9CisKKyAgICBwdWJsaWMgc3RhdGljIEVsZW1lbnQgUFJPR1JBTV9GUkFHTUVOVChSZW5kZXJTY3JpcHQgcnMpIHsKKyAgICAgICAgaWYocnMubUVsZW1lbnRfUFJPR1JBTV9GUkFHTUVOVCA9PSBudWxsKSB7CisgICAgICAgICAgICBycy5tRWxlbWVudF9QUk9HUkFNX0ZSQUdNRU5UID0gY3JlYXRlVXNlcihycywgRGF0YVR5cGUuUlNfUFJPR1JBTV9GUkFHTUVOVCk7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIHJzLm1FbGVtZW50X1BST0dSQU1fRlJBR01FTlQ7CisgICAgfQorCisgICAgcHVibGljIHN0YXRpYyBFbGVtZW50IFBST0dSQU1fVkVSVEVYKFJlbmRlclNjcmlwdCBycykgeworICAgICAgICBpZihycy5tRWxlbWVudF9QUk9HUkFNX1ZFUlRFWCA9PSBudWxsKSB7CisgICAgICAgICAgICBycy5tRWxlbWVudF9QUk9HUkFNX1ZFUlRFWCA9IGNyZWF0ZVVzZXIocnMsIERhdGFUeXBlLlJTX1BST0dSQU1fVkVSVEVYKTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gcnMubUVsZW1lbnRfUFJPR1JBTV9WRVJURVg7CisgICAgfQorCisgICAgcHVibGljIHN0YXRpYyBFbGVtZW50IFBST0dSQU1fUkFTVEVSKFJlbmRlclNjcmlwdCBycykgeworICAgICAgICBpZihycy5tRWxlbWVudF9QUk9HUkFNX1JBU1RFUiA9PSBudWxsKSB7CisgICAgICAgICAgICBycy5tRWxlbWVudF9QUk9HUkFNX1JBU1RFUiA9IGNyZWF0ZVVzZXIocnMsIERhdGFUeXBlLlJTX1BST0dSQU1fUkFTVEVSKTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gcnMubUVsZW1lbnRfUFJPR1JBTV9SQVNURVI7CisgICAgfQorCisgICAgcHVibGljIHN0YXRpYyBFbGVtZW50IFBST0dSQU1fU1RPUkUoUmVuZGVyU2NyaXB0IHJzKSB7CisgICAgICAgIGlmKHJzLm1FbGVtZW50X1BST0dSQU1fU1RPUkUgPT0gbnVsbCkgeworICAgICAgICAgICAgcnMubUVsZW1lbnRfUFJPR1JBTV9TVE9SRSA9IGNyZWF0ZVVzZXIocnMsIERhdGFUeXBlLlJTX1BST0dSQU1fU1RPUkUpOworICAgICAgICB9CisgICAgICAgIHJldHVybiBycy5tRWxlbWVudF9QUk9HUkFNX1NUT1JFOworICAgIH0KKworCiAgICAgcHVibGljIHN0YXRpYyBFbGVtZW50IEFfOChSZW5kZXJTY3JpcHQgcnMpIHsKICAgICAgICAgaWYocnMubUVsZW1lbnRfQV84ID09IG51bGwpIHsKICAgICAgICAgICAgIHJzLm1FbGVtZW50X0FfOCA9IGNyZWF0ZVBpeGVsKHJzLCBEYXRhVHlwZS5VTlNJR05FRF84LCBEYXRhS2luZC5QSVhFTF9BKTsKQEAgLTE2OCwxNjggKzI1NywxMTcgQEAKICAgICAgICAgcmV0dXJuIHJzLm1FbGVtZW50X1JHQkFfODg4ODsKICAgICB9CiAKLSAgICBwdWJsaWMgc3RhdGljIEVsZW1lbnQgSU5ERVhfMTYoUmVuZGVyU2NyaXB0IHJzKSB7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EXzgsIDQpOwogICAgICAgICB9Ci0gICAgICAgIHJldHVybiBycy5tRWxlbWVudF9URVhUVVJFXzI7CisgICAgICAgIHJldHVybiBycy5tRWxlbWVudF9VQ0hBUl80OwogICAgIH0KIAotICAgIHB1YmxpYyBzdGF0aWMgRWxlbWVudCBBVFRSSUJfTk9STUFMXzMoUmVuZGVyU2NyaXB0IHJzKSB7Ci0gICAgICAgIGlmKHJzLm1FbGVtZW50X05PUk1BTF8zID09IG51bGwpIHsKLSAgICAgICAgICAgIHJzLm1FbGVtZW50X05PUk1BTF8zID0gY3JlYXRlQXR0cmliKHJzLCBEYXRhVHlwZS5GTE9BVF8zMiwgRGF0YUtpbmQuTk9STUFMLCAzKTsKLSAgICAgICAgfQotICAgICAgICByZXR1cm4gcnMubUVsZW1lbnRfTk9STUFMXzM7Ci0gICAgfQogCi0gICAgcHVibGljIHN0YXRpYyBFbGVtZW50IEFUVFJJQl9DT0xPUl9VOF80KFJlbmRlclNjcmlwdCBycykgewotICAgICAgICBpZihycy5tRWxlbWVudF9DT0xPUl9VOF80ID09IG51bGwpIHsKLSAgICAgICAgICAgIHJzLm1FbGVtZW50X0NPTE9SX1U4XzQgPSBjcmVhdGVBdHRyaWIocnMsIERhdGFUeXBlLlVOU0lHTkVEXzgsIERhdGFLaW5kLkNPTE9SLCA0KTsKLSAgICAgICAgfQotICAgICAgICByZXR1cm4gcnMubUVsZW1lbnRfQ09MT1JfVThfNDsKLSAgICB9Ci0KLSAgICBwdWJsaWMgc3RhdGljIEVsZW1lbnQgQVRUUklCX0NPTE9SX0YzMl80KFJlbmRlclNjcmlwdCBycykgewotICAgICAgICBpZihycy5tRWxlbWVudF9DT0xPUl9GMzJfNCA9PSBudWxsKSB7Ci0gICAgICAgICAgICBycy5tRWxlbWVudF9DT0xPUl9GMzJfNCA9IGNyZWF0ZUF0dHJpYihycywgRGF0YVR5cGUuRkxPQVRfMzIsIERhdGFLaW5kLkNPTE9SLCA0KTsKLSAgICAgICAgfQotICAgICAgICByZXR1cm4gcnMubUVsZW1lbnRfQ09MT1JfRjMyXzQ7Ci0gICAgfQotCi0gICAgRWxlbWVudChSZW5kZXJTY3JpcHQgcnMsIEVsZW1lbnRbXSBlLCBTdHJpbmdbXSBuKSB7Ci0gICAgICAgIHN1cGVyKHJzKTsKKyAgICBFbGVtZW50KGludCBpZCwgUmVuZGVyU2NyaXB0IHJzLCBFbGVtZW50W10gZSwgU3RyaW5nW10gbikgeworICAgICAgICBzdXBlcihpZCwgcnMpOwogICAgICAgICBtU2l6ZSA9IDA7CiAgICAgICAgIG1FbGVtZW50cyA9IGU7CiAgICAgICAgIG1FbGVtZW50TmFtZXMgPSBuOwotICAgICAgICBpbnRbXSBpZHMgPSBuZXcgaW50W21FbGVtZW50cy5sZW5ndGhdOwogICAgICAgICBmb3IgKGludCBjdCA9IDA7IGN0IDwgbUVsZW1lbnRzLmxlbmd0aDsgY3QrKyApIHsKICAgICAgICAgICAgIG1TaXplICs9IG1FbGVtZW50c1tjdF0ubVNpemU7Ci0gICAgICAgICAgICBpZHNbY3RdID0gbUVsZW1lbnRzW2N0XS5tSUQ7CiAgICAgICAgIH0KLSAgICAgICAgbUlEID0gcnMubkVsZW1lbnRDcmVhdGUyKGlkcywgbUVsZW1lbnROYW1lcyk7CiAgICAgfQogCi0gICAgRWxlbWVudChSZW5kZXJTY3JpcHQgcnMsIERhdGFUeXBlIGR0LCBEYXRhS2luZCBkaywgYm9vbGVhbiBub3JtLCBpbnQgc2l6ZSkgewotICAgICAgICBzdXBlcihycyk7CisgICAgRWxlbWVudChpbnQgaWQsIFJlbmRlclNjcmlwdCBycywgRGF0YVR5cGUgZHQsIERhdGFLaW5kIGRrLCBib29sZWFuIG5vcm0sIGludCBzaXplKSB7CisgICAgICAgIHN1cGVyKGlkLCBycyk7CiAgICAgICAgIG1TaXplID0gZHQubVNpemUgKiBzaXplOwogICAgICAgICBtVHlwZSA9IGR0OwogICAgICAgICBtS2luZCA9IGRrOwogICAgICAgICBtTm9ybWFsaXplZCA9IG5vcm07CiAgICAgICAgIG1WZWN0b3JTaXplID0gc2l6ZTsKLSAgICAgICAgbUlEID0gcnMubkVsZW1lbnRDcmVhdGUoZHQubUlELCBkay5tSUQsIG5vcm0sIHNpemUpOworICAgIH0KKworICAgIEVsZW1lbnQoaW50IGlkLCBSZW5kZXJTY3JpcHQgcnMpIHsKKyAgICAgICAgc3VwZXIoaWQsIHJzKTsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICB2b2lkIHVwZGF0ZUZyb21OYXRpdmUoKSB7CisKKyAgICAgICAgLy8gd2Ugd2lsbCBwYWNrIG1UeXBlOyBtS2luZDsgbU5vcm1hbGl6ZWQ7IG1WZWN0b3JTaXplOyBOdW1TdWJFbGVtZW50cworICAgICAgICBpbnRbXSBkYXRhQnVmZmVyID0gbmV3IGludFs1XTsKKyAgICAgICAgbVJTLm5FbGVtZW50R2V0TmF0aXZlRGF0YShtSUQsIGRhdGFCdWZmZXIpOworCisgICAgICAgIG1Ob3JtYWxpemVkID0gZGF0YUJ1ZmZlclsyXSA9PSAxID8gdHJ1ZSA6IGZhbHNlOworICAgICAgICBtVmVjdG9yU2l6ZSA9IGRhdGFCdWZmZXJbM107CisgICAgICAgIG1TaXplID0gMDsKKyAgICAgICAgZm9yIChEYXRhVHlwZSBkdDogRGF0YVR5cGUudmFsdWVzKCkpIHsKKyAgICAgICAgICAgIGlmKGR0Lm1JRCA9PSBkYXRhQnVmZmVyWzBdKXsKKyAgICAgICAgICAgICAgICBtVHlwZSA9IGR0OworICAgICAgICAgICAgICAgIG1TaXplID0gbVR5cGUubVNpemUgKiBtVmVjdG9yU2l6ZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICBmb3IgKERhdGFLaW5kIGRrOiBEYXRhS2luZC52YWx1ZXMoKSkgeworICAgICAgICAgICAgaWYoZGsubUlEID09IGRhdGFCdWZmZXJbMV0peworICAgICAgICAgICAgICAgIG1LaW5kID0gZGs7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBpbnQgbnVtU3ViRWxlbWVudHMgPSBkYXRhQnVmZmVyWzRdOworICAgICAgICBpZihudW1TdWJFbGVtZW50cyA+IDApIHsKKyAgICAgICAgICAgIG1FbGVtZW50cyA9IG5ldyBFbGVtZW50W251bVN1YkVsZW1lbnRzXTsKKyAgICAgICAgICAgIG1FbGVtZW50TmFtZXMgPSBuZXcgU3RyaW5nW251bVN1YkVsZW1lbnRzXTsKKworICAgICAgICAgICAgaW50W10gc3ViRWxlbWVudElkcyA9IG5ldyBpbnRbbnVtU3ViRWxlbWVudHNdOworICAgICAgICAgICAgbVJTLm5FbGVtZW50R2V0U3ViRWxlbWVudHMobUlELCBzdWJFbGVtZW50SWRzLCBtRWxlbWVudE5hbWVzKTsKKyAgICAgICAgICAgIGZvcihpbnQgaSA9IDA7IGkgPCBudW1TdWJFbGVtZW50czsgaSArKykgeworICAgICAgICAgICAgICAgIG1FbGVtZW50c1tpXSA9IG5ldyBFbGVtZW50KHN1YkVsZW1lbnRJZHNbaV0sIG1SUyk7CisgICAgICAgICAgICAgICAgbUVsZW1lbnRzW2ldLnVwZGF0ZUZyb21OYXRpdmUoKTsKKyAgICAgICAgICAgICAgICBtU2l6ZSArPSBtRWxlbWVudHNbaV0ubVNpemU7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKwogICAgIH0KIAogICAgIHB1YmxpYyB2b2lkIGRlc3Ryb3koKSB0aHJvd3MgSWxsZWdhbFN0YXRlRXhjZXB0aW9uIHsKICAgICAgICAgc3VwZXIuZGVzdHJveSgpOwogICAgIH0KIAotICAgIHB1YmxpYyBzdGF0aWMgRWxlbWVudCBjcmVhdGVGcm9tQ2xhc3MoUmVuZGVyU2NyaXB0IHJzLCBDbGFzcyBjKSB7Ci0gICAgICAgIHJzLnZhbGlkYXRlKCk7Ci0gICAgICAgIEZpZWxkW10gZmllbGRzID0gYy5nZXRGaWVsZHMoKTsKLSAgICAgICAgQnVpbGRlciBiID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R0ID09IERhdGFUeXBlLlVOU0lHTkVEXzggfHwKLSAgICAgICAgICAgICAgZHQgPT0gRGF0YVR5cGUuVU5TSUdORURfMTYgfHwKLSAgICAgICAgICAgICAgZHQgPT0gRGF0YVR5cGUuVU5TSUdORURfMzIgfHwKLSAgICAgICAgICAgICAgZHQgPT0gRGF0YVR5cGUuU0lHTkVEXzggfHwKLSAgICAgICAgICAgICAgZHQgPT0gRGF0YVR5cGUuU0lHTkVEXzE2IHx8Ci0gICAgICAgICAgICAgIGR0ID09IERhdGFUeXBlLlNJR05FRF8zMikpIHsKLSAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oIlVuc3VwcG9ydGVkIERhdGFUeXBlIik7Ci0gICAgICAgIH0KLQotICAgICAgICBpZiAoIShkayA9PSBEYXRhS2luZC5DT0xPUiB8fAotICAgICAgICAgICAgICBkayA9PSBEYXRhS2luZC5QT1NJVElPTiB8fAotICAgICAgICAgICAgICBkayA9PSBEYXRhS2luZC5URVhUVVJFIHx8Ci0gICAgICAgICAgICAgIGRrID09IERhdGFLaW5kLk5PUk1BTCB8fAotICAgICAgICAgICAgICBkayA9PSBEYXRhS2luZC5QT0lOVF9TSVpFIHx8Ci0gICAgICAgICAgICAgIGRrID09IERhdGFLaW5kLlVTRVIpKSB7Ci0gICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCJVbnN1cHBvcnRlZCBEYXRhS2luZCIpOwotICAgICAgICB9Ci0KLSAgICAgICAgaWYgKGRrID09IERhdGFLaW5kLkNPTE9SICYmCi0gICAgICAgICAgICAoKGR0ICE9IERhdGFUeXBlLkZMT0FUXzMyICYmIGR0ICE9IERhdGFUeXBlLlVOU0lHTkVEXzgpIHx8Ci0gICAgICAgICAgICAgc2l6ZSA8IDMgfHwgc2l6ZSA+IDQpKSB7Ci0gICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW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PSB0cnVlOwotICAgICAgICB9Ci0KLSAgICAgICAgcmV0dXJuIG5ldyBFbGVtZW50KHJzLCBkdCwgZGssIG5vcm0sIHNpemUpOworICAgICAgICBpbnQgaWQgPSBycy5uRWxlbWVudENyZWF0ZShkdC5tSUQsIGRrLm1JRCwgbm9ybSwgc2l6ZSk7CisgICAgICAgIHJldHVybiBuZXcgRWxlbWVudChpZCwgcnMsIGR0LCBkaywgbm9ybSwgc2l6ZSk7CiAgICAgfQogCiAgICAgcHVibGljIHN0YXRpYyBFbGVtZW50IGNyZWF0ZVBpeGVsKFJlbmRlclNjcmlwdCBycywgRGF0YVR5cGUgZHQsIERhdGFLaW5kIGRrKSB7CkBAIC0zNjcsNyArNDA1LDkgQEAKICAgICAgICAgICAgIHNpemUgPSA0OwogICAgICAgICB9CiAKLSAgICAgICAgcmV0dXJuIG5ldyBFbGVtZW50KHJzLCBkdCwgZGssIHRydWUsIHNpemUpOworICAgICAgICBib29sZWFuIG5vcm0gPSB0cnVlOworICAgICAgICBpbnQgaWQgPSBycy5uRWxlbWVudENyZWF0ZShkdC5tSUQsIGRrLm1JRCwgbm9ybSwgc2l6ZSk7CisgICAgICAgIHJldHVybiBuZXcgRWxlbWVudChpZCwgcnMsIGR0LCBkaywgbm9ybSwgc2l6ZSk7CiAgICAgfQogCiAgICAgcHVibGljIHN0YXRpYyBjbGFzcyBCdWlsZGVyIHsKQEAgLTQwMyw3ICs0NDMsMTMgQEAKICAgICAgICAgICAgIFN0cmluZ1tdIHNpbiA9IG5ldyBTdHJpbmdbbUNvdW50XTsKICAgICAgICAgICAgIGphdmEubGFuZy5TeXN0ZW0uYXJyYXljb3B5KG1FbGVtZW50cywgMCwgZWluLCAwLCBtQ291bnQpOwogICAgICAgICAgICAgamF2YS5sYW5nLlN5c3RlbS5hcnJheWNvcHkobUVsZW1lbnROYW1lcywgMCwgc2luLCAwLCBtQ291bnQpOwotICAgICAgICAgICAgcmV0dXJuIG5ldyBFbGVtZW50KG1SUywgZWlu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IHYpIHsKICAgICAgICAgbURhdGFbbVBvcysrXSA9IHY7CiAgICAgfQogCi0gICAgdm9pZCBhZGRJMTYoc2hvcnQgdikgeworICAgIHB1YmxpYyB2b2lkIGFkZEkxNihzaG9ydCB2KSB7CiAgICAgICAgIGFsaWduKDIpOwogICAgICAgICBtRGF0YVttUG9zKytdID0gKGJ5dGUpKHYgJiAweGZmKTsKICAgICAgICAgbURhdGFbbVBvcysrXSA9IChieXRlKSh2ID4+IDgpOwogICAgIH0KIAotICAgIHZvaWQgYWRkSTMyKGludCB2KSB7CisgICAgcHVibGljIHZvaWQgYWRkSTMyKGludCB2KSB7CiAgICAgICAgIGFsaWduKDQpOwogICAgICAgICBtRGF0YVttUG9zKytdID0gKGJ5dGUpKHYgJiAweGZmKTsKICAgICAgICAgbURhdGFbbVBvcysrXSA9IChieXRlKSgodiA+PiA4KSAmIDB4ZmYpOwpAQCAtNTUsNyArNjIsNyBAQAogICAgICAgICBtRGF0YVttUG9zKytdID0gKGJ5dGUpKCh2ID4+IDI0KSAmIDB4ZmYpOwogICAgIH0KIAotICAgIHZvaWQgYWRkSTY0KGxvbmcgdikgeworICAgIHB1YmxpYyB2b2lkIGFkZEk2NChsb25nIHYpIHsKICAgICAgICAgYWxpZ24oOCk7CiAgICAgICAgIG1EYXRhW21Qb3MrK10gPSAoYnl0ZSkodiAmIDB4ZmYpOwogICAgICAgICBtRGF0YVttUG9zKytdID0gKGJ5dGUpKCh2ID4+IDgpICYgMHhmZik7CkBAIC02NywxNSArNzQsMTcgQEAKICAgICAgICAgbURhdGFbbVBvcysrXSA9IChieXRlKSgodiA+PiA1NikgJiAweGZmKTsKICAgICB9CiAKLSAgICB2b2lkIGFkZFU4KHNob3J0IHYpIHsKKyAgICBwdWJsaWMgdm9pZCBhZGRVOChzaG9ydCB2KSB7CiAgICAgICAgIGlmICgodiA8IDApIHx8ICh2ID4gMHhmZikpIHsKKyAgICAgICAgICAgIGFuZHJvaWQudXRpbC5Mb2cuZSgicnMiL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Iik7CiAgICAgICAgIH0KICAgICAgICAgYWxpZ24oNCk7CkBAIC05NCw4ICsxMDQsOSBAQAogICAgICAgICBtRGF0YVttUG9zKytdID0gKGJ5dGUpKCh2ID4+IDI0KSAmIDB4ZmYpOwogICAgIH0KIAotICAgIHZvaWQgYWRkVTY0KGxvbmcgdikgeworICAgIHB1YmxpYyB2b2lkIGFkZFU2NChsb25nIHYpIHsKICAgICAgICAgaWYgKHYgPCAwKSB7CisgICAgICAgICAgICBhbmRyb2lkLnV0aWwuTG9nLmUoInJzIiwgIkZpZWxkUGFja2VyLmFkZFU2NCggIiArIHYgKyAiICkiKTsKICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oIlNhdmluZyB2YWx1ZSBvdXQgb2YgcmFuZ2UgZm9yIHR5cGUiKTsKICAgICAgICAgfQogICAgICAgICBhbGlnbig4KTsKQEAgLTEwOSwxNSArMTIwLDEzOSBAQAogICAgICAgICBtRGF0YVttUG9zKytdID0gKGJ5dGUpKCh2ID4+IDU2KSAmIDB4ZmYpOwogICAgIH0KIAotICAgIHZvaWQgYWRkRjMyKGZsb2F0IHYpIHsKKyAgICBwdWJsaWMgdm9pZCBhZGRGMzIoZmxvYXQgdikgewogICAgICAgICBhZGRJMzIoRmxvYXQuZmxvYXRUb1Jhd0ludEJpdHModikpOwogICAgIH0KIAotICAgIHZvaWQgYWRkRjY0KGZsb2F0IHYpIHsKKyAgICBwdWJsaWMgdm9pZCBhZGRGNjQoZmxvYXQgdikgewogICAgICAgICBhZGRJNjQoRG91YmxlLmRvdWJsZVRvUmF3TG9uZ0JpdHModikpOwogICAgIH0KIAotICAgIGZpbmFsIGJ5dGVbXSBnZXREYXRhKCkgeworICAgIHB1YmxpYyB2b2lkIGFkZE9iaihCYXNlT2JqIG9iaikgeworICAgICAgICBpZiAob2JqICE9IG51bGwpIHsKKyAgICAgICAgICAgIGFkZEkzMihvYmouZ2V0SUQoKSk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBhZGRJMzIoMCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBhZGRGMzIoRmxvYXQyIHYpIHsKKyAgICAgICAgYWRkRjMyKHYueCk7CisgICAgICAgIGFkZEYzMih2LnkpOworICAgIH0KKyAgICBwdWJsaWMgdm9pZCBhZGRGMzIoRmxvYXQzIHYpIHsKKyAgICAgICAgYWRkRjMyKHYueCk7CisgICAgICAgIGFkZEYzMih2LnkpOworICAgICAgICBhZGRGMzIodi56KTsKKyAgICB9CisgICAgcHVibGljIHZvaWQgYWRkRjMyKEZsb2F0NCB2KSB7CisgICAgICAgIGFkZEYzMih2LngpOworICAgICAgICBhZGRGMzIodi55KTsKKyAgICAgICAgYWRkRjMyKHYueik7CisgICAgICAgIGFkZEYzMih2LncpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIGFkZEk4KEJ5dGUyIHYpIHsKKyAgICAgICAgYWRkSTgodi54KTsKKyAgICAgICAgYWRkSTgodi55KTsKKyAgICB9CisgICAgcHVibGljIHZvaWQgYWRkSTgoQnl0ZTMgdikgeworICAgICAgICBhZGRJOCh2LngpOworICAgICAgICBhZGRJOCh2LnkpOworICAgICAgICBhZGRJOCh2LnopOworICAgIH0KKyAgICBwdWJsaWMgdm9pZCBhZGRJOChCeXRlNCB2KSB7CisgICAgICAgIGFkZEk4KHYueCk7CisgICAgICAgIGFkZEk4KHYueSk7CisgICAgICAgIGFkZEk4KHYueik7CisgICAgICAgIGFkZEk4KHYudyk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgYWRkVTgoU2hvcnQyIHYpIHsKKyAgICAgICAgYWRkVTgodi54KTsKKyAgICAgICAgYWRkVTgodi55KTsKKyAgICB9CisgICAgcHVibGljIHZvaWQgYWRkVTgoU2hvcnQzIHYpIHsKKyAgICAgICAgYWRkVTgodi54KTsKKyAgICAgICAgYWRkVTgodi55KTsKKyAgICAgICAgYWRkVTgodi56KTsKKyAgICB9CisgICAgcHVibGljIHZvaWQgYWRkVTgoU2hvcnQ0IHYpIHsKKyAgICAgICAgYWRkVTgodi54KTsKKyAgICAgICAgYWRkVTgodi55KTsKKyAgICAgICAgYWRkVTgodi56KTsKKyAgICAgICAgYWRkVTgodi53KTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBhZGRJMTYoU2hvcnQyIHYpIHsKKyAgICAgICAgYWRkSTE2KHYueCk7CisgICAgICAgIGFkZEkxNih2LnkpOworICAgIH0KKyAgICBwdWJsaWMgdm9pZCBhZGRJMTYoU2hvcnQzIHYpIHsKKyAgICAgICAgYWRkSTE2KHYueCk7CisgICAgICAgIGFkZEkxNih2LnkpOworICAgICAgICBhZGRJMTYodi56KTsKKyAgICB9CisgICAgcHVibGljIHZvaWQgYWRkSTE2KFNob3J0NCB2KSB7CisgICAgICAgIGFkZEkxNih2LngpOworICAgICAgICBhZGRJMTYodi55KTsKKyAgICAgICAgYWRkSTE2KHYueik7CisgICAgICAgIGFkZEkxNih2LncpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIGFkZFUxNihJbnQyIHYpIHsKKyAgICAgICAgYWRkVTE2KHYueCk7CisgICAgICAgIGFkZFUxNih2LnkpOworICAgIH0KKyAgICBwdWJsaWMgdm9pZCBhZGRVMTYoSW50MyB2KSB7CisgICAgICAgIGFkZFUxNih2LngpOworICAgICAgICBhZGRVMTYodi55KTsKKyAgICAgICAgYWRkVTE2KHYueik7CisgICAgfQorICAgIHB1YmxpYyB2b2lkIGFkZFUxNihJbnQ0IHYpIHsKKyAgICAgICAgYWRkVTE2KHYueCk7CisgICAgICAgIGFkZFUxNih2LnkpOworICAgICAgICBhZGRVMTYodi56KTsKKyAgICAgICAgYWRkVTE2KHYudyk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgYWRkSTMyKEludDIgdikgeworICAgICAgICBhZGRJMzIodi54KTsKKyAgICAgICAgYWRkSTMyKHYueSk7CisgICAgfQorICAgIHB1YmxpYyB2b2lkIGFkZEkzMihJbnQzIHYpIHsKKyAgICAgICAgYWRkSTMyKHYueCk7CisgICAgICAgIGFkZEkzMih2LnkpOworICAgICAgICBhZGRJMzIodi56KTsKKyAgICB9CisgICAgcHVibGljIHZvaWQgYWRkSTMyKEludDQgdikgeworICAgICAgICBhZGRJMzIodi54KTsKKyAgICAgICAgYWRkSTMyKHYueSk7CisgICAgICAgIGFkZEkzMih2LnopOworICAgICAgICBhZGRJMzIodi53KTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBhZGRVMzIoSW50MiB2KSB7CisgICAgICAgIGFkZFUzMih2LngpOworICAgICAgICBhZGRVMzIodi55KTsKKyAgICB9CisgICAgcHVibGljIHZvaWQgYWRkVTMyKEludDMgdikgeworICAgICAgICBhZGRVMzIodi54KTsKKyAgICAgICAgYWRkVTMyKHYueSk7CisgICAgICAgIGFkZFUzMih2LnopOworICAgIH0KKyAgICBwdWJsaWMgdm9pZCBhZGRVMzIoSW50NCB2KSB7CisgICAgICAgIGFkZFUzMih2LngpOworICAgICAgICBhZGRVMzIodi55KTsKKyAgICAgICAgYWRkVTMyKHYueik7CisgICAgICAgIGFkZFUzMih2LncpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIGFkZEJvb2xlYW4oYm9vbGVhbiB2KSB7CisgICAgICAgIGFkZEk4KChieXRlKSh2ID8gMSA6IDApKTsKKyAgICB9CisKKyAgICBwdWJsaWMgZmluYWwgYnl0ZVtdIGdldERhdGEoKSB7CiAgICAgICAgIHJldHVybiBtRGF0YTsKICAgICB9CiAKZGlmZiAtLWdpdCBhL2dyYXBoaWNzL2phdmEvYW5kcm9pZC9yZW5kZXJzY3JpcHQvRmlsZUEzRC5qYXZhIGIvZ3JhcGhpY3MvamF2YS9hbmRyb2lkL3JlbmRlcnNjcmlwdC9GaWxlQTNELmphdmEKbmV3IGZpbGUgbW9kZSAxMDA2NDQKaW5kZXggMDAwMDAwMC4uMjQxNDA2MgotLS0gL2Rldi9udWxsCisrKyBiL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Y29udGVudC5yZXMuUmVzb3VyY2VzOworaW1wb3J0IGFuZHJvaWQuY29udGVudC5yZXMuQXNzZXRNYW5hZ2VyOworaW1wb3J0IGFuZHJvaWQuZ3JhcGhpY3MuQml0bWFwOworaW1wb3J0IGFuZHJvaWQuZ3JhcGhpY3MuQml0bWFwRmFjdG9yeTsKK2ltcG9ydCBhbmRyb2lkLnV0aWwuTG9nOworaW1wb3J0IGFuZHJvaWQudXRpbC5UeXBlZFZhbHVlOworCisvKioKKyAqIEBoaWRlCisgKgorICoqLworcHVibGljIGNsYXNzIEZpbGVBM0QgZXh0ZW5kcyBCYXNlT2JqIHsKKworICAgIHB1YmxpYyBlbnVtIENsYXNzSUQgeworCisgICAgICAgIFVOS05PV04sCisgICAgICAgIE1FU0gsCisgICAgICAgIFRZUEUsCisgICAgICAgIEVMRU1FTlQsCisgICAgICAgIEFMTE9DQVRJT04sCisgICAgICAgIFBST0dSQU1fVkVSVEVYLAorICAgICAgICBQUk9HUkFNX1JBU1RFUiwKKyAgICAgICAgUFJPR1JBTV9GUkFHTUVOVCwKKyAgICAgICAgUFJPR1JBTV9TVE9SRSwKKyAgICAgICAgU0FNUExFUiwKKyAgICAgICAgQU5JTUFUSU9OLAorICAgICAgICBMSUdIVCwKKyAgICAgICAgQURBUFRFUl8xRCwKKyAgICAgICAgQURBUFRFUl8yRCwKKyAgICAgICAgU0NSSVBUX0M7CisKKyAgICAgICAgcHVibGljIHN0YXRpYyBDbGFzc0lEIHRvQ2xhc3NJRChpbnQgaW50SUQpIHsKKyAgICAgICAgICAgIHJldHVybiBDbGFzc0lELnZhbHVlcygpW2ludElEXTsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8vIFJlYWQgb25seSBjbGFzcyB3aXRoIGluZGV4IGVudHJpZXMKKyAgICBwdWJsaWMgc3RhdGljIGNsYXNzIEluZGV4RW50cnkgeworICAgICAgICBSZW5kZXJTY3JpcHQgbVJTOworICAgICAgICBpbnQgbUluZGV4OworICAgICAgICBpbnQgbUlEOworICAgICAgICBTdHJpbmcgbU5hbWU7CisgICAgICAgIENsYXNzSUQgbUNsYXNzSUQ7CisgICAgICAgIEJhc2VPYmogbUxvYWRlZE9iajsKKworICAgICAgICBwdWJsaWMgU3RyaW5nIGdldE5hbWUoKSB7CisgICAgICAgICAgICByZXR1cm4gbU5hbWU7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgQ2xhc3NJRCBnZXRDbGFzc0lEKCkgeworICAgICAgICAgICAgcmV0dXJuIG1DbGFzc0lEOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIEJhc2VPYmogZ2V0T2JqZWN0KCkgeworICAgICAgICAgICAgbVJTLnZhbGlkYXRlKCk7CisgICAgICAgICAgICBCYXNlT2JqIG9iaiA9IGludGVybmFsQ3JlYXRlKG1SUywgdGhpcyk7CisgICAgICAgICAgICByZXR1cm4gb2JqOworICAgICAgICB9CisKKyAgICAgICAgc3RhdGljIHN5bmNocm9uaXplZCBCYXNlT2JqIGludGVybmFsQ3JlYXRlKFJlbmRlclNjcmlwdCBycywgSW5kZXhFbnRyeSBlbnRyeSkgeworICAgICAgICAgICAgaWYoZW50cnkubUxvYWRlZE9iaiAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIGVudHJ5Lm1Mb2FkZWRPYmo7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmKGVudHJ5Lm1DbGFzc0lEID09IENsYXNzSUQuVU5LTk9XTikgeworICAgICAgICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpbnQgb2JqZWN0SUQgPSBycy5uRmlsZUEzREdldEVudHJ5QnlJbmRleChlbnRyeS5tSUQsIGVudHJ5Lm1JbmRleCk7CisgICAgICAgICAgICBpZihvYmplY3RJRCA9PSAwKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHN3aXRjaCAoZW50cnkubUNsYXNzSUQpIHsKKyAgICAgICAgICAgIGNhc2UgTUVTSDoKKyAgICAgICAgICAgICAgICBlbnRyeS5tTG9hZGVkT2JqID0gbmV3IE1lc2gob2JqZWN0SUQsIHJzKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgVFlQRToKKyAgICAgICAgICAgICAgICBlbnRyeS5tTG9hZGVkT2JqID0gbmV3IFR5cGUob2JqZWN0SUQsIHJzKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgRUxFTUVOVDoKKyAgICAgICAgICAgICAgICBlbnRyeS5tTG9hZGVkT2JqID0gbnVsbDsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgQUxMT0NBVElPTjoKKyAgICAgICAgICAgICAgICBlbnRyeS5tTG9hZGVkT2JqID0gbnVsbDsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgUFJPR1JBTV9WRVJURVg6CisgICAgICAgICAgICAgICAgZW50cnkubUxvYWRlZE9iaiA9IG5ldyBQcm9ncmFtVmVydGV4KG9iamVjdElELCBycyk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIFBST0dSQU1fUkFTVEVSOgorICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBQUk9HUkFNX0ZSQUdNRU5UOgorICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBQUk9HUkFNX1NUT1JFOgorICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBTQU1QTEVSOgorICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBBTklNQVRJT046CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIExJR0hUOgorICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBBREFQVEVSXzFEOgorICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBBREFQVEVSXzJEOgorICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBTQ1JJUFRfQzoKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgZW50cnkubUxvYWRlZE9iai51cGRhdGVGcm9tTmF0aXZlKCk7CisKKyAgICAgICAgICAgIHJldHVybiBlbnRyeS5tTG9hZGVkT2JqOworICAgICAgICB9CisKKyAgICAgICAgSW5kZXhFbnRyeShSZW5kZXJTY3JpcHQgcnMsIGludCBpbmRleCwgaW50IGlkLCBTdHJpbmcgbmFtZSwgQ2xhc3NJRCBjbGFzc0lEKSB7CisgICAgICAgICAgICBtUlMgPSByczsKKyAgICAgICAgICAgIG1JbmRleCA9IGluZGV4OworICAgICAgICAgICAgbUlEID0gaWQ7CisgICAgICAgICAgICBtTmFtZSA9IG5hbWU7CisgICAgICAgICAgICBtQ2xhc3NJRCA9IGNsYXNzSUQ7CisgICAgICAgICAgICBtTG9hZGVkT2JqID0gbnVsbDsKKyAgICAgICAgfQorICAgIH0KKworICAgIEluZGV4RW50cnlbXSBtRmlsZUVudHJpZXM7CisKKyAgICBGaWxlQTNEKGludCBpZCwgUmVuZGVyU2NyaXB0IHJzKSB7CisgICAgICAgIHN1cGVyKGlkLCBycyk7CisgICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIGluaXRFbnRyaWVzKCkgeworICAgICAgICBpbnQgbnVtRmlsZUVudHJpZXMgPSBtUlMubkZpbGVBM0RHZXROdW1JbmRleEVudHJpZXMobUlEKTsKKyAgICAgICAgaWYobnVtRmlsZUVudHJpZXMgPD0gMCkgeworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisKKyAgICAgICAgbUZpbGVFbnRyaWVzID0gbmV3IEluZGV4RW50cnlbbnVtRmlsZUVudHJpZXNdOworICAgICAgICBpbnRbXSBpZHMgPSBuZXcgaW50W251bUZpbGVFbnRyaWVzXTsKKyAgICAgICAgU3RyaW5nW10gbmFtZXMgPSBuZXcgU3RyaW5nW251bUZpbGVFbnRyaWVzXTsKKworICAgICAgICBtUlMubkZpbGVBM0RHZXRJbmRleEVudHJpZXMobUlELCBudW1GaWxlRW50cmllcywgaWRzLCBuYW1lcyk7CisKKyAgICAgICAgZm9yKGludCBpID0gMDsgaSA8IG51bUZpbGVFbnRyaWVzOyBpICsrKSB7CisgICAgICAgICAgICBtRmlsZUVudHJpZXNbaV0gPSBuZXcgSW5kZXhFbnRyeShtUlMsIGksIG1JRCwgbmFtZXNbaV0sIENsYXNzSUQudG9DbGFzc0lEKGlkc1tpXSkpOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIGludCBnZXROdW1JbmRleEVudHJpZXMoKSB7CisgICAgICAgIGlmKG1GaWxlRW50cmllcyA9PSBudWxsKSB7CisgICAgICAgICAgICByZXR1cm4gMDsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gbUZpbGVFbnRyaWVzLmxlbmd0aDsKKyAgICB9CisKKyAgICBwdWJsaWMgSW5kZXhFbnRyeSBnZXRJbmRleEVudHJ5KGludCBpbmRleCkgeworICAgICAgICBpZihnZXROdW1JbmRleEVudHJpZXMoKSA9PSAwIHx8IGluZGV4IDwgMCB8fCBpbmRleCA+PSBtRmlsZUVudHJpZXMubGVuZ3RoKSB7CisgICAgICAgICAgICByZXR1cm4gbnVsbDsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gbUZpbGVFbnRyaWVzW2luZGV4XTsKKyAgICB9CisKKyAgICBzdGF0aWMgcHVibGljIEZpbGVBM0QgY3JlYXRlRnJvbVJlc291cmNlKFJlbmRlclNjcmlwdCBycywgUmVzb3VyY2VzIHJlcywgaW50IGlkKQorICAgICAgICB0aHJvd3MgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uIHsKKworICAgICAgICBycy52YWxpZGF0ZSgpOworICAgICAgICBJbnB1dFN0cmVhbSBpcyA9IG51bGw7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBmaW5hbCBUeXBlZFZhbHVlIHZhbHVlID0gbmV3IFR5cGVkVmFsdWUoKTsKKyAgICAgICAgICAgIGlzID0gcmVzLm9wZW5SYXdSZXNvdXJjZShpZCwgdmFsdWUpOworCisgICAgICAgICAgICBpbnQgYXNzZXQgPSAoKEFzc2V0TWFuYWdlci5Bc3NldElucHV0U3RyZWFtKSBpcykuZ2V0QXNzZXRJbnQoKTsKKworICAgICAgICAgICAgaW50IGZpbGVJZCA9IHJzLm5GaWxlQTNEQ3JlYXRlRnJvbUFzc2V0U3RyZWFtKGFzc2V0KTsKKworICAgICAgICAgICAgaWYoZmlsZUlkID09IDApIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJMb2FkIGZhaWxlZC4iKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIEZpbGVBM0QgZmEzZCA9IG5ldyBGaWxlQTNEKGZpbGVJZCwgcnMpOworICAgICAgICAgICAgZmEzZC5pbml0RW50cmllcygpOworICAgICAgICAgICAgcmV0dXJuIGZhM2Q7CisKKyAgICAgICAgfSBjYXRjaCAoRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgIC8vIElnbm9yZQorICAgICAgICB9IGZpbmFsbHkgeworICAgICAgICAgICAgaWYgKGlzICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgICAgICBpcy5jbG9zZSgpOworICAgICAgICAgICAgICAgIH0gY2F0Y2ggKElPRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gSWdub3JlCisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcmV0dXJuIG51bGw7CisgICAgfQorfQpkaWZmIC0tZ2l0IGEvZ3JhcGhpY3MvamF2YS9hbmRyb2lkL3JlbmRlcnNjcmlwd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SBoZWxwIHVzIGNyZWF0ZSBhIGZvbnQgYnkgZmFtaWx5IG5hbWUKKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBTdHJpbmdbXSBzU2Fuc05hbWVzID0geworICAgICAgICAic2Fucy1zZXJpZiIsICJhcmlhbCIsICJoZWx2ZXRpY2EiLCAidGFob21hIiwgInZlcmRhbmEiCisgICAgfTsKKworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIFN0cmluZ1tdIHNTZXJpZk5hbWVzID0geworICAgICAgICAic2VyaWYiLCAidGltZXMiLCAidGltZXMgbmV3IHJvbWFuIiwgInBhbGF0aW5vIiwgImdlb3JnaWEiLCAiYmFza2VydmlsbGUiLAorICAgICAgICAiZ291ZHkiLCAiZmFudGFzeSIsICJjdXJzaXZlIiwgIklUQyBTdG9uZSBTZXJpZiIKKyAgICB9OworCisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgU3RyaW5nW10gc01vbm9OYW1lcyA9IHsKKyAgICAgICAgIm1vbm9zcGFjZSIsICJjb3VyaWVyIiwgImNvdXJpZXIgbmV3IiwgIm1vbmFjbyIKKyAgICB9OworCisgICAgcHJpdmF0ZSBzdGF0aWMgY2xhc3MgRm9udEZhbWlseSB7CisgICAgICAgIFN0cmluZ1tdIG1OYW1lczsKKyAgICAgICAgU3RyaW5nIG1Ob3JtYWxGaWxlTmFtZTsKKyAgICAgICAgU3RyaW5nIG1Cb2xkRmlsZU5hbWU7CisgICAgICAgIFN0cmluZyBtSXRhbGljRmlsZU5hbWU7CisgICAgICAgIFN0cmluZyBtQm9sZEl0YWxpY0ZpbGVOYW1lOworICAgIH0KKworICAgIHByaXZhdGUgc3RhdGljIE1hcDxTdHJpbmcsIEZvbnRGYW1pbHk+IHNGb250RmFtaWx5TWFwOworCisgICAgcHVibGljIGVudW0gU3R5bGUgeworICAgICAgICBOT1JNQUwsCisgICAgICAgIEJPTEQsCisgICAgICAgIElUQUxJQywKKyAgICAgICAgQk9MRF9JVEFMSUM7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gICAgICAgIGlmKGZhbWlseSAhPSBudWxsKSB7CisgICAgICAgICAgICBzd2l0Y2goc3R5bGUpIHsKKyAgICAgICAgICAgICAgICBjYXNlIE5PUk1BTDoKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbWlseS5tTm9ybWFsRmlsZU5hbWU7CisgICAgICAgICAgICAgICAgY2FzZSBCT0xEOgorICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFtaWx5Lm1Cb2xkRmlsZU5hbWU7CisgICAgICAgICAgICAgICAgY2FzZSBJVEFMSUM6CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYW1pbHkubUl0YWxpY0ZpbGVOYW1lOworICAgICAgICAgICAgICAgIGNhc2UgQk9MRF9JVEFMSUM6CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYW1pbHkubUJvbGRJdGFsaWNGaWxlTmFtZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICAvLyBGYWxsYmFjayBpZiB3ZSBjb3VsZCBub3QgZmluZCB0aGUgZGVzaXJlZCBmYW1pbHkKKyAgICAgICAgcmV0dXJuICJEcm9pZFNhbnMudHRmIjsKKyAgICB9CisKKyAgICBGb250KGludCBpZCwgUmVuZGVyU2NyaXB0IHJzKSB7CisgICAgICAgIHN1cGVyKGlkLCBycyk7CisgICAgfQorCisgICAgLyoqCisgICAgICogVGFrZXMgYSBzcGVjaWZpYyBmaWxlIG5hbWUgYXMgYW4gYXJndW1lbnQKKyAgICAgKi8KKyAgICBzdGF0aWMgcHVibGljIEZvbnQgY3JlYXRlKFJlbmRlclNjcmlwdCBycywgUmVzb3VyY2VzIHJlcywgU3RyaW5nIGZpbGVOYW1lLCBpbnQgc2l6ZSkKKyAgICAgICAgdGhyb3dzIElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbiB7CisKKyAgICAgICAgcnMudmFsaWRhdGUoKTsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIGludCBkcGkgPSByZXMuZ2V0RGlzcGxheU1ldHJpY3MoKS5kZW5zaXR5RHBpOworICAgICAgICAgICAgaW50IGZvbnRJZCA9IHJzLm5Gb250Q3JlYXRlRnJvbUZpbGUoZmlsZU5hbWUsIHNpemUsIGRwaSk7CisKKyAgICAgICAgICAgIGlmKGZvbnRJZCA9PSAwKSB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigiRmFpbGVkIGxvYWRpbmcgYSBmb250Iik7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBGb250IHJzRm9udCA9IG5ldyBGb250KGZvbnRJZCwgcnMpOworCisgICAgICAgICAgICByZXR1cm4gcnNGb250OworCisgICAgICAgIH0gY2F0Y2ggKEV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAvLyBJZ25vcmUKKyAgICAgICAgfQorCisgICAgICAgIHJldHVybiBudWxsOworICAgIH0KKworICAgIC8qKgorICAgICAqIEFjY2VwdHMgb25lIG9mIHRoZSBmb2xsb3dpbmcgZmFtaWx5IG5hbWVzIGFzIGFuIGFyZ3VtZW50CisgICAgICogYW5kIHdpbGwgYXR0ZW1wIHRvIHByb2R1Y2UgdGhlIGJlc3QgbWF0Y2ggd2l0aCBhIHN5c3RlbSBmb250CisgICAgICogInNhbnMtc2VyaWYiICJhcmlhbCIgImhlbHZldGljYSIgInRhaG9tYSIgInZlcmRhbmEiCisgICAgICogInNlcmlmIiAidGltZXMiICJ0aW1lcyBuZXcgcm9tYW4iICJwYWxhdGlubyIgImdlb3JnaWEiICJiYXNrZXJ2aWxsZSIKKyAgICAgKiAiZ291ZHkiICJmYW50YXN5IiAiY3Vyc2l2ZSIgIklUQyBTdG9uZSBTZXJpZiIKKyAgICAgKiAibW9ub3NwYWNlIiAiY291cmllciIgImNvdXJpZXIgbmV3IiAibW9uYWNvIgorICAgICAqIFJldHVybnMgZGVmYXVsdCBmb250IGlmIG5vIG1hdGNoIGNvdWxkIGJlIGZvdW5kCisgICAgICov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bGlkYXRlKCk7Ci0gICAgICAgIG1SUy5uTGlnaHRTZXRQb3NpdGlvbihtSUQsIHgsIHksIHopOwotICAgIH0KLQotICAgIHB1YmxpYyBzdGF0aWMgY2xhc3MgQnVpbGRlciB7Ci0gICAgICAgIFJlbmRlclNjcmlwdCBtUlM7Ci0gICAgICAgIGJvb2xlYW4gbUlzTW9ubzsKLSAgICAgICAgYm9vbGVhbiBtSXNMb2NhbDsKLQotICAgICAgICBwdWJsaWMgQnVpbGRlcihSZW5kZXJTY3JpcHQgcnMpIHsKLSAgICAgICAgICAgIG1SUyA9IHJzOwotICAgICAgICAgICAgbUlzTW9ubyA9IGZhbHNlOwotICAgICAgICAgICAgbUlzTG9jYWwgPSBmYWxzZTsKLSAgICAgICAgfQotCi0gICAgICAgIHB1YmxpYyB2b2lkIGxpZ2h0U2V0SXNNb25vKGJvb2xlYW4gaXNNb25vKSB7Ci0gICAgICAgICAgICBtSXNNb25vID0gaXNNb25vOwotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIHZvaWQgbGlnaHRTZXRJc0xvY2FsKGJvb2xlYW4gaXNMb2NhbCkgewotICAgICAgICAgICAgbUlzTG9jYWwgPSBpc0xvY2FsOwotICAgICAgICB9Ci0KLSAgICAgICAgc3RhdGljIHN5bmNocm9uaXplZCBMaWdodCBpbnRlcm5hbENyZWF0ZShSZW5kZXJTY3JpcHQgcnMsIEJ1aWxkZXIgYikgewotICAgICAgICAgICAgcnMublNhbXBsZXJCZWdpbigpOwotICAgICAgICAgICAgcnMubkxpZ2h0U2V0SXNNb25vKGIubUlzTW9ubyk7Ci0gICAgICAgICAgICBycy5uTGlnaHRTZXRJc0xvY2FsKGIubUlzTG9jYWwpOwotICAgICAgICAgICAgaW50IGlkID0gcnMubkxpZ2h0Q3JlYXRlKCk7Ci0gICAgICAgICAgICByZXR1cm4gbmV3IExpZ2h0KGlkLCBycyk7Ci0gICAgICAgIH0KLQotICAgICAgICBwdWJsaWMgTGlnaHQgY3JlYXRl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FkU2NhbGUoZmxvYXQgeCwgZmxvYXQgeSkgeworICAgICAgICBsb2FkSWRlbnRpdHkoKTsKKyAgICAgICAgbU1hdFswXSA9IHg7CisgICAgICAgIG1NYXRbM10gPSB5OworICAgIH0KKyAgICBwdWJsaWMgdm9pZCBsb2FkTXVsdGlwbHkoTWF0cml4MmYgbGhzLCBNYXRyaXgyZiByaHMpIHsKKyAgICAgICAgZm9yIChpbnQgaT0wIDsgaTwyIDsgaSsrKSB7CisgICAgICAgICAgICBmbG9hdCByaTAgPSAwOworICAgICAgICAgICAgZmxvYXQgcmkxID0gMDsKKyAgICAgICAgICAgIGZvciAoaW50IGo9MCA7IGo8MiA7IGorKykgeworICAgICAgICAgICAgICAgIGZsb2F0IHJoc19paiA9IHJocy5nZXQoaSxqKTsKKyAgICAgICAgICAgICAgICByaTAgKz0gbGhzLmdldChqLDApICogcmhzX2lqOworICAgICAgICAgICAgICAgIHJpMSArPSBsaHMuZ2V0KGosMSkgKiByaHNfaWo7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBzZXQoaSwwLCByaTApOworICAgICAgICAgICAgc2V0KGksMSwgcmkxKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyB2b2lkIG11bHRpcGx5KE1hdHJpeDJmIHJocykgeworICAgICAgICBNYXRyaXgyZiB0bXAgPSBuZXcgTWF0cml4MmYoKTsKKyAgICAgICAgdG1wLmxvYWRNdWx0aXBseSh0aGlzLCByaHMpOworICAgICAgICBsb2FkKHRtcCk7CisgICAgfQorICAgIHB1YmxpYyB2b2lkIHJvdGF0ZShmbG9hdCByb3QpIHsKKyAgICAgICAgTWF0cml4MmYgdG1wID0gbmV3IE1hdHJpeDJmKCk7CisgICAgICAgIHRtcC5sb2FkUm90YXRlKHJvdCk7CisgICAgICAgIG11bHRpcGx5KHRtcCk7CisgICAgfQorICAgIHB1YmxpYyB2b2lkIHNjYWxlKGZsb2F0IHgsIGZsb2F0IHkpIHsKKyAgICAgICAgTWF0cml4M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ZmxvYXQpamF2YS5sYW5nLk1hdGguc3FydCh4KnggKyB5KnkgKyB6KnopOworICAgICAgICBpZiAoIShsZW4gIT0gMSkpIHsKKyAgICAgICAgICAgIGZsb2F0IHJlY2lwTGVuID0gMS5mIC8gbGVuOworICAgICAgICAgICAgeCAqPSByZWNpcExlbjsKKyAgICAgICAgICAgIHkgKj0gcmVjaXBMZW47CisgICAgICAgICAgICB6ICo9IHJlY2lwTGVuOworICAgICAgICB9CisgICAgICAgIGZsb2F0IG5jID0gMS4wZiAtIGM7CisgICAgICAgIGZsb2F0IHh5ID0geCAqIHk7CisgICAgICAgIGZsb2F0IHl6ID0geSAqIHo7CisgICAgICAgIGZsb2F0IHp4ID0geiAqIHg7CisgICAgICAgIGZsb2F0IHhzID0geCAqIHM7CisgICAgICAgIGZsb2F0IHlzID0geSAqIHM7CisgICAgICAgIGZsb2F0IHpzID0geiAqIHM7CisgICAgICAgIG1NYXRbMF0gPSB4KngqbmMgKyAgYzsKKyAgICAgICAgbU1hdFszXSA9ICB4eSpuYyAtIHpzOworICAgICAgICBtTWF0WzZdID0gIHp4Km5jICsgeXM7CisgICAgICAgIG1NYXRbMV0gPSAgeHkqbmMgKyB6czsKKyAgICAgICAgbU1hdFs0XSA9IHkqeSpuYyArICBjOworICAgICAgICBtTWF0WzldID0gIHl6Km5jIC0geHM7CisgICAgICAgIG1NYXRbMl0gPSAgengqbmMgLSB5czsKKyAgICAgICAgbU1hdFs2XSA9ICB5eipuYyArIHhzOworICAgICAgICBtTWF0WzhdID0geip6Km5jICsgIGM7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgbG9hZFJvdGF0ZShmbG9hdCByb3QpIHsKKyAgICAgICAgZmxvYXQgYywgczsKKyAgICAgICAgcm90ICo9IChmbG9hdCkoamF2YS5sYW5nLk1hdGguUEkgLyAxODAuMGYpOworICAgICAgICBjID0gKGZsb2F0KWphdmEubGFuZy5NYXRoLmNvcyhyb3QpOworICAgICAgICBzID0gKGZsb2F0KWphdmEubGFuZy5NYXRoLnNpbihyb3QpOworICAgICAgICBtTWF0WzBdID0gYzsKKyAgICAgICAgbU1hdFsxXSA9IC1zOworICAgICAgICBtTWF0WzNdID0gczsKKyAgICAgICAgbU1hdFs0XSA9IGM7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgbG9hZFNjYWxlKGZsb2F0IHgsIGZsb2F0IHkpIHsKKyAgICAgICAgbG9hZElkZW50aXR5KCk7CisgICAgICAgIG1NYXRbMF0gPSB4OworICAgICAgICBtTWF0WzRdID0geTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBsb2FkU2NhbGUoZmxvYXQgeCwgZmxvYXQgeSwgZmxvYXQgeikgeworICAgICAgICBsb2FkSWRlbnRpdHkoKTsKKyAgICAgICAgbU1hdFswXSA9IHg7CisgICAgICAgIG1NYXRbNF0gPSB5OworICAgICAgICBtTWF0WzhdID0gejsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBsb2FkVHJhbnNsYXRlKGZsb2F0IHgsIGZsb2F0IHkpIHsKKyAgICAgICAgbG9hZElkZW50aXR5KCk7CisgICAgICAgIG1NYXRbNl0gPSB4OworICAgICAgICBtTWF0WzddID0geTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBsb2FkTXVsdGlwbHkoTWF0cml4M2YgbGhzLCBNYXRyaXgzZiByaHMpIHsKKyAgICAgICAgZm9yIChpbnQgaT0wIDsgaTwzIDsgaSsrKSB7CisgICAgICAgICAgICBmbG9hdCByaTAgPSAwOworICAgICAgICAgICAgZmxvYXQgcmkxID0gMDsKKyAgICAgICAgICAgIGZsb2F0IHJpMiA9IDA7CisgICAgICAgICAgICBmb3IgKGludCBqPTAgOyBqPDMgOyBqKyspIHsKKyAgICAgICAgICAgICAgICBmbG9hdCByaHNfaWogPSByaHMuZ2V0KGksaik7CisgICAgICAgICAgICAgICAgcmkwICs9IGxocy5nZXQoaiwwKSAqIHJoc19pajsKKyAgICAgICAgICAgICAgICByaTEgKz0gbGhzLmdldChqLDEpICogcmhzX2lqOworICAgICAgICAgICAgICAgIHJpMiArPSBsaHMuZ2V0KGosMikgKiByaHNfaWo7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBzZXQoaSwwLCByaTApOworICAgICAgICAgICAgc2V0KGksMSwgcmkxKTsKKyAgICAgICAgICAgIHNldChpLDIsIHJpMik7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBtdWx0aXBseShNYXRyaXgzZiByaHMpIHsKKyAgICAgICAgTWF0cml4M2YgdG1wID0gbmV3IE1hdHJpeDNmKCk7CisgICAgICAgIHRtcC5sb2FkTXVsdGlwbHkodGhpcywgcmhzKTsKKyAgICAgICAgbG9hZCh0bXApOworICAgIH0KKyAgICBwdWJsaWMgdm9pZCByb3RhdGUoZmxvYXQgcm90LCBmbG9hdCB4LCBmbG9hdCB5LCBmbG9hdCB6KSB7CisgICAgICAgIE1hdHJpeDNmIHRtcCA9IG5ldyBNYXRyaXgzZigpOworICAgICAgICB0bXAubG9hZFJvdGF0ZShyb3QsIHgsIHksIHopOworICAgICAgICBtdWx0aXBseSh0bXApOworICAgIH0KKyAgICBwdWJsaWMgdm9pZCByb3RhdGUoZmxvYXQgcm90KSB7CisgICAgICAgIE1hdHJpeDNmIHRtcCA9IG5ldyBNYXRyaXgzZigpOworICAgICAgICB0bXAubG9hZFJvdGF0ZShyb3QpOworICAgICAgICBtdWx0aXBseSh0bXApOworICAgIH0KKyAgICBwdWJsaWMgdm9pZCBzY2FsZShmbG9hdCB4LCBmbG9hdCB5KSB7CisgICAgICAgIE1hdHJpeDNmIHRtcCA9IG5ldyBNYXRyaXgzZigpOworICAgICAgICB0bXAubG9hZFNjYWxlKHgsIHkpOworICAgICAgICBtdWx0aXBseSh0bXApOworICAgIH0KKyAgICBwdWJsaWMgdm9pZCBzY2FsZShmbG9hdCB4LCBmbG9hdCB5LCBmbG9hdCB6KSB7CisgICAgICAgIE1hdHJpeDNmIHRtcCA9IG5ldyBNYX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geSwgeik7CiAgICAgICAgIG11bHRpcGx5KHRtcCk7CiAgICAgfQorICAgIHByaXZhdGUgZmxvYXQgY29tcHV0ZUNvZmFjdG9yKGludCBpLCBpbnQgaikgeworICAgICAgICBpbnQgYzAgPSAoaSsxKSAlIDQ7CisgICAgICAgIGludCBjMSA9IChpKzIpICUgNDsKKyAgICAgICAgaW50IGMyID0gKGkrMykgJSA0OworICAgICAgICBpbnQgcjAgPSAoaisxKSAlIDQ7CisgICAgICAgIGludCByMSA9IChqKzIpICUgNDsKKyAgICAgICAgaW50IHIyID0gKGorMykgJSA0OworCisgICAgICAgIGZsb2F0IG1pbm9yID0gKG1NYXRbYzAgKyA0KnIwXSAqIChtTWF0W2MxICsgNCpyMV0gKiBtTWF0W2MyICsgNCpyMl0gLQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtTWF0W2MxICsgNCpyMl0gKiBtTWF0W2MyICsgNCpyMV0pKQorICAgICAgICAgICAgICAgICAgICAgLSAobU1hdFtjMCArIDQqcjFdICogKG1NYXRbYzEgKyA0KnIwXSAqIG1NYXRbYzIgKyA0KnIyXSAtCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1NYXRbYzEgKyA0KnIyXSAqIG1NYXRbYzIgKyA0KnIwXSkpCisgICAgICAgICAgICAgICAgICAgICArIChtTWF0W2MwICsgNCpyMl0gKiAobU1hdFtjMSArIDQqcjBdICogbU1hdFtjMiArIDQqcjFdIC0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbU1hdFtjMSArIDQqcjFdICogbU1hdFtjMiArIDQqcjBdKSk7CisKKyAgICAgICAgZmxvYXQgY29mYWN0b3IgPSAoKGkraikgJiAxKSAhPSAwID8gLW1pbm9yIDogbWlub3I7CisgICAgICAgIHJldHVybiBjb2ZhY3RvcjsKKyAgICB9CisKKyAgICBwdWJsaWMgYm9vbGVhbiBpbnZlcnNlKCkgeworCisgICAgICAgIE1hdHJpeDRmIHJlc3VsdCA9IG5ldyBNYXRyaXg0ZigpOworCisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgNDsgKytpKSB7CisgICAgICAgICAgICBmb3IgKGludCBqID0gMDsgaiA8IDQ7ICsraikgeworICAgICAgICAgICAgICAgIHJlc3VsdC5tTWF0WzQqaSArIGpdID0gY29tcHV0ZUNvZmFjdG9yKGksIGopOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgLy8gRG90IHByb2R1Y3Qgb2YgMHRoIGNvbHVtbiBvZiBzb3VyY2UgYW5kIDB0aCByb3cgb2YgcmVzdWx0CisgICAgICAgIGZsb2F0IGRldCA9IG1NYXRbMF0qcmVzdWx0Lm1NYXRbMF0gKyBtTWF0WzRdKnJlc3VsdC5tTWF0WzFdICsKKyAgICAgICAgICAgICAgICAgICAgIG1NYXRbOF0qcmVzdWx0Lm1NYXRbMl0gKyBtTWF0WzEyXSpyZXN1bHQubU1hdFszXTsKKworICAgICAgICBpZiAoTWF0aC5hYnMoZGV0KSA8IDFlLTYpIHsKKyAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgfQorCisgICAgICAgIGRldCA9IDEuMGYgLyBkZXQ7CisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgMTY7ICsraSkgeworICAgICAgICAgICAgbU1hdFtpXSA9IHJlc3VsdC5tTWF0W2ldICogZGV0OworICAgICAgICB9CisKKyAgICAgICAgcmV0dXJuIHRydWU7CisgICAgfQorCisgICAgcHVibGljIGJvb2xlYW4gaW52ZXJzZVRyYW5zcG9zZSgpIHsKKworICAgICAgICBNYXRyaXg0ZiByZXN1bHQgPSBuZXcgTWF0cml4NGYoKTsKKworICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IDQ7ICsraSkgeworICAgICAgICAgICAgZm9yIChpbnQgaiA9IDA7IGogPCA0OyArK2opIHsKKyAgICAgICAgICAgICAgICByZXN1bHQubU1hdFs0KmogKyBpXSA9IGNvbXB1dGVDb2ZhY3RvcihpLCBqKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIGZsb2F0IGRldCA9IG1NYXRbMF0qcmVzdWx0Lm1NYXRbMF0gKyBtTWF0WzRdKnJlc3VsdC5tTWF0WzRdICsKKyAgICAgICAgICAgICAgICAgICAgIG1NYXRbOF0qcmVzdWx0Lm1NYXRbOF0gKyBtTWF0WzEyXSpyZXN1bHQubU1hdFsxMl07CisKKyAgICAgICAgaWYgKE1hdGguYWJzKGRldCkgPCAxZS02KSB7CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKworICAgICAgICBkZXQgPSAxLjBmIC8gZGV0OworICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IDE2OyArK2kpIHsKKyAgICAgICAgICAgIG1NYXRbaV0gPSByZXN1bHQubU1hdFtpXSAqIGRldDsKKyAgICAgICAgfQorCisgICAgICAgIHJldHVybiB0cnVlOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHRyYW5zcG9zZSgpIHsKKyAgICAgICAgZm9yKGludCBpID0gMDsgaSA8IDM7ICsraSkgeworICAgICAgICAgICAgZm9yKGludCBqID0gaSArIDE7IGogPCA0OyArK2opIHsKKyAgICAgICAgICAgICAgICBmbG9hdCB0ZW1wID0gbU1hdFtpKjQgKyBqXTsKKyAgICAgICAgICAgICAgICBtTWF0W2kqNCArIGpdID0gbU1hdFtqKjQgKyBpXTsKKyAgICAgICAgICAgICAgICBtTWF0W2oqNCArIGldID0gdGVtcDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KIAogICAgIGZpbmFsIGZsb2F0W10gbU1hdDsKIH0KZGlmZiAtLWdpdCBhL2dyYXBoaWNzL2phdmEvYW5kcm9pZC9yZW5kZXJzY3JpcHQvTWVzaC5qYXZhIGIvZ3JhcGhpY3MvamF2YS9hbmRyb2lkL3JlbmRlcnNjcmlwdC9NZXNoLmphdmEKbmV3IG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WZWN0b3I7CisKK2ltcG9ydCBhbmRyb2lkLnV0aWwuQ29uZmlnOworaW1wb3J0IGFuZHJvaWQudXRpbC5Mb2c7CisKKy8qKgorICogQGhpZGUKKyAqCisgKiovCitwdWJsaWMgY2xhc3MgTWVzaCBleHRlbmRzIEJhc2VPYmogeworCisgICAgQWxsb2NhdGlvbltdIG1WZXJ0ZXhCdWZmZXJzOworICAgIEFsbG9jYXRpb25bXSBtSW5kZXhCdWZmZXJzOworICAgIFByaW1pdGl2ZVtdIG1QcmltaXRpdmVzOworCisgICAgTWVzaChpbnQgaWQsIFJlbmRlclNjcmlwdCBycykgeworICAgICAgICBzdXBlcihpZCwgcnMpOworICAgIH0KKworICAgIHB1YmxpYyBpbnQgZ2V0VmVydGV4QWxsb2NhdGlvbkNvdW50KCkgeworICAgICAgICBpZihtVmVydGV4QnVmZmVycyA9PSBudWxsKSB7CisgICAgICAgICAgICByZXR1cm4gMDsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gbVZlcnRleEJ1ZmZlcnMubGVuZ3RoOworICAgIH0KKyAgICBwdWJsaWMgQWxsb2NhdGlvbiBnZXRWZXJ0ZXhBbGxvY2F0aW9uKGludCBzbG90KSB7CisgICAgICAgIHJldHVybiBtVmVydGV4QnVmZmVyc1tzbG90XTsKKyAgICB9CisKKyAgICBwdWJsaWMgaW50IGdldFByaW1pdGl2ZUNvdW50KCkgeworICAgICAgICBpZihtSW5kZXhCdWZmZXJzID09IG51bGwpIHsKKyAgICAgICAgICAgIHJldHVybiAwOworICAgICAgICB9CisgICAgICAgIHJldHVybiBtSW5kZXhCdWZmZXJzLmxlbmd0aDsKKyAgICB9CisgICAgcHVibGljIEFsbG9jYXRpb24gZ2V0SW5kZXhBbGxvY2F0aW9uKGludCBzbG90KSB7CisgICAgICAgIHJldHVybiBtSW5kZXhCdWZmZXJzW3Nsb3RdOworICAgIH0KKyAgICBwdWJsaWMgUHJpbWl0aXZlIGdldFByaW1pdGl2ZShpbnQgc2xvdCkgeworICAgICAgICByZXR1cm4gbVByaW1pdGl2ZXNbc2xvdF07CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgdm9pZCB1cGRhdGVGcm9tTmF0aXZlKCkgeworICAgICAgICBtTmFtZSA9IG1SUy5uR2V0TmFtZShtSUQpOworICAgICAgICBpbnQgdnR4Q291bnQgPSBtUlMubk1lc2hHZXRWZXJ0ZXhCdWZmZXJDb3VudChtSUQpOworICAgICAgICBpbnQgaWR4Q291bnQgPSBtUlMubk1lc2hHZXRJbmRleENvdW50KG1JRCk7CisKKyAgICAgICAgaW50W10gdnR4SURzID0gbmV3IGludFt2dHhDb3VudF07CisgICAgICAgIGludFtdIGlkeElEcyA9IG5ldyBpbnRbaWR4Q291bnRdOworICAgICAgICBpbnRbXSBwcmltaXRpdmVzID0gbmV3IGludFtpZHhDb3VudF07CisKKyAgICAgICAgbVJTLm5NZXNoR2V0VmVydGljZXMobUlELCB2dHhJRHMsIHZ0eENvdW50KTsKKyAgICAgICAgbVJTLm5NZXNoR2V0SW5kaWNlcyhtSUQsIGlkeElEcywgcHJpbWl0aXZlcywgdnR4Q291bnQpOworCisgICAgICAgIG1WZXJ0ZXhCdWZmZXJzID0gbmV3IEFsbG9jYXRpb25bdnR4Q291bnRdOworICAgICAgICBtSW5kZXhCdWZmZXJzID0gbmV3IEFsbG9jYXRpb25baWR4Q291bnRdOworICAgICAgICBtUHJpbWl0aXZlcyA9IG5ldyBQcmltaXRpdmVbaWR4Q291bnRdOworCisgICAgICAgIGZvcihpbnQgaSA9IDA7IGkgPCB2dHhDb3VudDsgaSArKykgeworICAgICAgICAgICAgaWYodnR4SURzW2ldICE9IDApIHsKKyAgICAgICAgICAgICAgICBtVmVydGV4QnVmZmVyc1tpXSA9IG5ldyBBbGxvY2F0aW9uKHZ0eElEc1tpXSwgbVJTKTsKKyAgICAgICAgICAgICAgICBtVmVydGV4QnVmZmVyc1tpXS51cGRhdGVGcm9tTmF0aXZlKCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBmb3IoaW50IGkgPSAwOyBpIDwgaWR4Q291bnQ7IGkgKyspIHsKKyAgICAgICAgICAgIGlmKGlkeElEc1tpXSAhPSAwKSB7CisgICAgICAgICAgICAgICAgbUluZGV4QnVmZmVyc1tpXSA9IG5ldyBBbGxvY2F0aW9uKGlkeElEc1tpXSwgbVJTKTsKKyAgICAgICAgICAgICAgICBtSW5kZXhCdWZmZXJzW2ldLnVwZGF0ZUZyb21OYXRpdmUoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1QcmltaXRpdmVzW2ldID0gUHJpbWl0aXZlLnZhbHVlcygpW3ByaW1pdGl2ZXNbaV1dOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHN0YXRpYyBjbGFzcyBCdWlsZGVyIHsKKyAgICAgICAgUmVuZGVyU2NyaXB0IG1SUzsKKworICAgICAgICBjbGFzcyBFbnRyeSB7CisgICAgICAgICAgICBUeXBlIHQ7CisgICAgICAgICAgICBFbGVtZW50IGU7CisgICAgICAgICAgICBpbnQgc2l6ZTsKKyAgICAgICAgICAgIFByaW1pdGl2ZSBwcmltOworICAgICAgICB9CisKKyAgICAgICAgaW50IG1WZXJ0ZXhUeXBlQ291bnQ7CisgICAgICAgIEVudHJ5W10gbVZlcnRleFR5cGVzOworICAgICAgICBWZWN0b3IgbUluZGV4VHlwZXM7CisKKyAgICAgICAgcHVibGljIEJ1aWxkZXIoUmVuZGVyU2NyaXB0IHJzKSB7CisgICAgICAgICAgICBtUlMgPSByczsKKyAgICAgICAgICAgIG1WZXJ0ZXhUeXBlQ291bnQgPSAwOworICAgICAgICAgICAgbVZlcnRleFR5cGVzID0gbmV3IEVudHJ5WzE2XTsKKyAgICAgICAgICAgIG1JbmRleFR5cGVzID0gbmV3IFZlY3RvcigpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIGludCBhZGRWZXJ0ZXhUeXBlKFR5cGUgdCkgdGhyb3dzIElsbGVnYWxTdGF0ZUV4Y2VwdGlvbiB7CisgICAgICAgICAgICBpZiAobVZlcnRleFR5cGVDb3VudCA+PSBtVmVydGV4VHlwZXMubGVuZ3RoKSB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigiTWF4IHZlcnRleCB0eXBlcyBleGNlZWRlZC4iKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaW50IGFkZGVkSW5kZXggPSBtVmVydGV4VHlwZUNvdW50OworICAgICAgICAgICAgbVZlcnRleFR5cGVzW21WZXJ0ZXhUeXBlQ291bnRdID0gbmV3IEVudHJ5KCk7CisgICAgICAgICAgICBtVmVydGV4VHlwZXNbbVZlcnRleFR5cGVDb3VudF0udCA9IHQ7CisgICAgICAgICAgICBtVmVydGV4VHlwZXNbbVZlcnRleFR5cGVDb3VudF0uZSA9IG51bGw7CisgICAgICAgICAgICBtVmVydGV4VHlwZUNvdW50Kys7CisgICAgICAgICAgICByZXR1cm4gYWRkZWRJbmRleDsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBpbnQgYWRkVmVydGV4VHlwZShFbGVtZW50IGUsIGludCBzaXplKSB0aHJvd3MgSWxsZWdhbFN0YXRlRXhjZXB0aW9uIHsKKyAgICAgICAgICAgIGlmIChtVmVydGV4VHlwZUNvdW50ID49IG1WZXJ0ZXhUeXBlcy5sZW5ndGgpIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJNYXggdmVydGV4IHR5cGVzIGV4Y2VlZGVkLiIpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpbnQgYWRkZWRJbmRleCA9IG1WZXJ0ZXhUeXBlQ291bnQ7CisgICAgICAgICAgICBtVmVydGV4VHlwZXNbbVZlcnRleFR5cGVDb3VudF0gPSBuZXcgRW50cnkoKTsKKyAgICAgICAgICAgIG1WZXJ0ZXhUeXBlc1ttVmVydGV4VHlwZUNvdW50XS50ID0gbnVsbDsKKyAgICAgICAgICAgIG1WZXJ0ZXhUeXBlc1ttVmVydGV4VHlwZUNvdW50XS5lID0gZTsKKyAgICAgICAgICAgIG1WZXJ0ZXhUeXBlc1ttVmVydGV4VHlwZUNvdW50XS5zaXplID0gc2l6ZTsKKyAgICAgICAgICAgIG1WZXJ0ZXhUeXBlQ291bnQrKzsKKyAgICAgICAgICAgIHJldHVybiBhZGRlZEluZGV4OworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIGludCBhZGRJbmRleFR5cGUoVHlwZSB0LCBQcmltaXRpdmUgcCkgeworICAgICAgICAgICAgaW50IGFkZGVkSW5kZXggID0gbUluZGV4VHlwZXMuc2l6ZSgpOworICAgICAgICAgICAgRW50cnkgaW5kZXhUeXBlID0gbmV3IEVudHJ5KCk7CisgICAgICAgICAgICBpbmRleFR5cGUudCA9IHQ7CisgICAgICAgICAgICBpbmRleFR5cGUuZSA9IG51bGw7CisgICAgICAgICAgICBpbmRleFR5cGUuc2l6ZSA9IDA7CisgICAgICAgICAgICBpbmRleFR5cGUucHJpbSA9IHA7CisgICAgICAgICAgICBtSW5kZXhUeXBlcy5hZGRFbGVtZW50KGluZGV4VHlwZSk7CisgICAgICAgICAgICByZXR1cm4gYWRkZWRJbmRleDsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBpbnQgYWRkSW5kZXhUeXBlKFByaW1pdGl2ZSBwKSB7CisgICAgICAgICAgICBpbnQgYWRkZWRJbmRleCAgPSBtSW5kZXhUeXBlcy5zaXplKCk7CisgICAgICAgICAgICBFbnRyeSBpbmRleFR5cGUgPSBuZXcgRW50cnkoKTsKKyAgICAgICAgICAgIGluZGV4VHlwZS50ID0gbnVsbDsKKyAgICAgICAgICAgIGluZGV4VHlwZS5lID0gbnVsbDsKKyAgICAgICAgICAgIGluZGV4VHlwZS5zaXplID0gMDsKKyAgICAgICAgICAgIGluZGV4VHlwZS5wcmltID0gcDsKKyAgICAgICAgICAgIG1JbmRleFR5cGVzLmFkZEVsZW1lbnQoaW5kZXhUeXBlKTsKKyAgICAgICAgICAgIHJldHVybiBhZGRlZEluZGV4OworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIGludCBhZGRJbmRleFR5cGUoRWxlbWVudCBlLCBpbnQgc2l6ZSwgUHJpbWl0aXZlIHApIHsKKyAgICAgICAgICAgIGludCBhZGRlZEluZGV4ICA9IG1JbmRleFR5cGVzLnNpemUoKTsKKyAgICAgICAgICAgIEVudHJ5IGluZGV4VHlwZSA9IG5ldyBFbnRyeSgpOworICAgICAgICAgICAgaW5kZXhUeXBlLnQgPSBudWxsOworICAgICAgICAgICAgaW5kZXhUeXBlLmUgPSBlOworICAgICAgICAgICAgaW5kZXhUeXBlLnNpemUgPSBzaXplOworICAgICAgICAgICAgaW5kZXhUeXBlLnByaW0gPSBwOworICAgICAgICAgICAgbUluZGV4VHlwZXMuYWRkRWxlbWVudChpbmRleFR5cGUpOworICAgICAgICAgICAgcmV0dXJuIGFkZGVkSW5kZXg7CisgICAgICAgIH0KKworICAgICAgICBUeXBlIG5ld1R5cGUoRWxlbWVudCBlLCBpbnQgc2l6ZSkgeworICAgICAgICAgICAgVHlwZS5CdWlsZGVyIHRiID0gbmV3IFR5cGUuQnVpbGRlcihtUlMsIGUpOworICAgICAgICAgICAgdGIuYWRkKERpbWVuc2lvbi5YLCBzaXplKTsKKyAgICAgICAgICAgIHJldHVybiB0Yi5jcmVhdGUoKTsKKyAgICAgICAgfQorCisgICAgICAgIHN0YXRpYyBzeW5jaHJvbml6ZWQgTWVzaCBpbnRlcm5hbENyZWF0ZShSZW5kZXJTY3JpcHQgcnMsIEJ1aWxkZXIgYikgeworCisgICAgICAgICAgICBpbnQgaWQgPSBycy5uTWVzaENyZWF0ZShiLm1WZXJ0ZXhUeXBlQ291bnQsIGIubUluZGV4VHlwZXMuc2l6ZSgpKTsKKyAgICAgICAgICAgIE1lc2ggbmV3TWVzaCA9IG5ldyBNZXNoKGlkLCBycyk7CisgICAgICAgICAgICBuZXdNZXNoLm1JbmRleEJ1ZmZlcnMgPSBuZXcgQWxsb2NhdGlvbltiLm1JbmRleFR5cGVzLnNpemUoKV07CisgICAgICAgICAgICBuZXdNZXNoLm1QcmltaXRpdmVzID0gbmV3IFByaW1pdGl2ZVtiLm1JbmRleFR5cGVzLnNpemUoKV07CisgICAgICAgICAgICBuZXdNZXNoLm1WZXJ0ZXhCdWZmZXJzID0gbmV3IEFsbG9jYXRpb25bYi5tVmVydGV4VHlwZUNvdW50XTsKKworICAgICAgICAgICAgZm9yKGludCBjdCA9IDA7IGN0IDwgYi5tSW5kZXhUeXBlcy5zaXplKCk7IGN0ICsrKSB7CisgICAgICAgICAgICAgICAgQWxsb2NhdGlvbiBhbGxvYyA9IG51bGw7CisgICAgICAgICAgICAgICAgRW50cnkgZW50cnkgPSAoRW50cnkpYi5tSW5kZXhUeXBlcy5lbGVtZW50QXQoY3QpOworICAgICAgICAgICAgICAgIGlmIChlbnRyeS50ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgYWxsb2MgPSBBbGxvY2F0aW9uLmNyZWF0ZVR5cGVkKHJzLCBlbnRyeS50KTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZWxzZSBpZihlbnRyeS5lICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgYWxsb2MgPSBBbGxvY2F0aW9uLmNyZWF0ZVNpemVkKHJzLCBlbnRyeS5lLCBlbnRyeS5zaXplKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaW50IGFsbG9jSUQgPSAoYWxsb2MgPT0gbnVsbCkgPyAwIDogYWxsb2MuZ2V0SUQoKTsKKyAgICAgICAgICAgICAgICBycy5uTWVzaEJpbmRJbmRleChpZCwgYWxsb2NJRCwgZW50cnkucHJpbS5tSUQsIGN0KTsKKyAgICAgICAgICAgICAgICBuZXdNZXNoLm1JbmRleEJ1ZmZlcnNbY3RdID0gYWxsb2M7CisgICAgICAgICAgICAgICAgbmV3TWVzaC5tUHJpbWl0aXZlc1tjdF0gPSBlbnRyeS5wcmltOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBmb3IoaW50IGN0ID0gMDsgY3QgPCBiLm1WZXJ0ZXhUeXBlQ291bnQ7IGN0ICsrKSB7CisgICAgICAgICAgICAgICAgQWxsb2NhdGlvbiBhbGxvYyA9IG51bGw7CisgICAgICAgICAgICAgICAgRW50cnkgZW50cnkgPSBiLm1WZXJ0ZXhUeXBlc1tjdF07CisgICAgICAgICAgICAgICAgaWYgKGVudHJ5LnQgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICBhbGxvYyA9IEFsbG9jYXRpb24uY3JlYXRlVHlwZWQocnMsIGVudHJ5LnQpOworICAgICAgICAgICAgICAgIH0gZWxzZSBpZihlbnRyeS5lICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgYWxsb2MgPSBBbGxvY2F0aW9uLmNyZWF0ZVNpemVkKHJzLCBlbnRyeS5lLCBlbnRyeS5zaXplKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgcnMubk1lc2hCaW5kVmVydGV4KGlkLCBhbGxvYy5nZXRJRCgpLCBjdCk7CisgICAgICAgICAgICAgICAgbmV3TWVzaC5tVmVydGV4QnVmZmVyc1tjdF0gPSBhbGxvYzsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcmV0dXJuIG5ld01lc2g7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgTWVzaCBjcmVhdGUoKSB7CisgICAgICAgICAgICBtUlMudmFsaWRhdGUoKTsKKyAgICAgICAgICAgIE1lc2ggc20gPSBpbnRlcm5hbENyZWF0ZShtUlMsIHRoaXMpOworICAgICAgICAgICAgcmV0dXJuIHNtOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHN0YXRpYyBjbGFzcyBBbGxvY2F0aW9uQnVpbGRlciB7CisgICAgICAgIFJlbmRlclNjcmlwdCBtUlM7CisKKyAgICAgICAgY2xhc3MgRW50cnkgeworICAgICAgICAgICAgQWxsb2NhdGlvbiBhOworICAgICAgICAgICAgUHJpbWl0aXZlIHByaW07CisgICAgICAgIH0KKworICAgICAgICBpbnQgbVZlcnRleFR5cGVDb3VudDsKKyAgICAgICAgRW50cnlbXSBtVmVydGV4VHlwZXM7CisKKyAgICAgICAgVmVjdG9yIG1JbmRleFR5cGVzOworCisgICAgICAgIHB1YmxpYyBBbGxvY2F0aW9uQnVpbGRlcihSZW5kZXJTY3JpcHQgcnMpIHsKKyAgICAgICAgICAgIG1SUyA9IHJzOworICAgICAgICAgICAgbVZlcnRleFR5cGVDb3VudCA9IDA7CisgICAgICAgICAgICBtVmVydGV4VHlwZXMgPSBuZXcgRW50cnlbMTZdOworICAgICAgICAgICAgbUluZGV4VHlwZXMgPSBuZXcgVmVjdG9yKCk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgaW50IGFkZFZlcnRleEFsbG9jYXRpb24oQWxsb2NhdGlvbiBhKSB0aHJvd3MgSWxsZWdhbFN0YXRlRXhjZXB0aW9uIHsKKyAgICAgICAgICAgIGlmIChtVmVydGV4VHlwZUNvdW50ID49IG1WZXJ0ZXhUeXBlcy5sZW5ndGgpIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJNYXggdmVydGV4IHR5cGVzIGV4Y2VlZGVkLiIpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpbnQgYWRkZWRJbmRleCA9IG1WZXJ0ZXhUeXBlQ291bnQ7CisgICAgICAgICAgICBtVmVydGV4VHlwZXNbbVZlcnRleFR5cGVDb3VudF0gPSBuZXcgRW50cnkoKTsKKyAgICAgICAgICAgIG1WZXJ0ZXhUeXBlc1ttVmVydGV4VHlwZUNvdW50XS5hID0gYTsKKyAgICAgICAgICAgIG1WZXJ0ZXhUeXBlQ291bnQrKzsKKyAgICAgICAgICAgIHJldHVybiBhZGRlZEluZGV4OworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIGludCBhZGRJbmRleEFsbG9jYXRpb24oQWxsb2NhdGlvbiBhLCBQcmltaXRpdmUgcCkgeworICAgICAgICAgICAgaW50IGFkZGVkSW5kZXggID0gbUluZGV4VHlwZXMuc2l6ZSgpOworICAgICAgICAgICAgRW50cnkgaW5kZXhUeXBlID0gbmV3IEVudHJ5KCk7CisgICAgICAgICAgICBpbmRleFR5cGUuYSA9IGE7CisgICAgICAgICAgICBpbmRleFR5cGUucHJpbSA9IHA7CisgICAgICAgICAgICBtSW5kZXhUeXBlcy5hZGRFbGVtZW50KGluZGV4VHlwZSk7CisgICAgICAgICAgICByZXR1cm4gYWRkZWRJbmRleDsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBpbnQgYWRkSW5kZXhUeXBlKFByaW1pdGl2ZSBwKSB7CisgICAgICAgICAgICBpbnQgYWRkZWRJbmRleCAgPSBtSW5kZXhUeXBlcy5zaXplKCk7CisgICAgICAgICAgICBFbnRyeSBpbmRleFR5cGUgPSBuZXcgRW50cnkoKTsKKyAgICAgICAgICAgIGluZGV4VHlwZS5hID0gbnVsbDsKKyAgICAgICAgICAgIGluZGV4VHlwZS5wcmltID0gcDsKKyAgICAgICAgICAgIG1JbmRleFR5cGVzLmFkZEVsZW1lbnQoaW5kZXhUeXBlKTsKKyAgICAgICAgICAgIHJldHVybiBhZGRlZEluZGV4OworICAgICAgICB9CisKKyAgICAgICAgc3RhdGljIHN5bmNocm9uaXplZCBNZXNoIGludGVybmFsQ3JlYXRlKFJlbmRlclNjcmlwdCBycywgQWxsb2NhdGlvbkJ1aWxkZXIgYikgeworCisgICAgICAgICAgICBpbnQgaWQgPSBycy5uTWVzaENyZWF0ZShiLm1WZXJ0ZXhUeXBlQ291bnQsIGIubUluZGV4VHlwZXMuc2l6ZSgpKTsKKyAgICAgICAgICAgIE1lc2ggbmV3TWVzaCA9IG5ldyBNZXNoKGlkLCBycyk7CisgICAgICAgICAgICBuZXdNZXNoLm1JbmRleEJ1ZmZlcnMgPSBuZXcgQWxsb2NhdGlvbltiLm1JbmRleFR5cGVzLnNpemUoKV07CisgICAgICAgICAgICBuZXdNZXNoLm1QcmltaXRpdmVzID0gbmV3IFByaW1pdGl2ZVtiLm1JbmRleFR5cGVzLnNpemUoKV07CisgICAgICAgICAgICBuZXdNZXNoLm1WZXJ0ZXhCdWZmZXJzID0gbmV3IEFsbG9jYXRpb25bYi5tVmVydGV4VHlwZUNvdW50XTsKKworICAgICAgICAgICAgZm9yKGludCBjdCA9IDA7IGN0IDwgYi5tSW5kZXhUeXBlcy5zaXplKCk7IGN0ICsrKSB7CisgICAgICAgICAgICAgICAgRW50cnkgZW50cnkgPSAoRW50cnkpYi5tSW5kZXhUeXBlcy5lbGVtZW50QXQoY3QpOworICAgICAgICAgICAgICAgIGludCBhbGxvY0lEID0gKGVudHJ5LmEgPT0gbnVsbCkgPyAwIDogZW50cnkuYS5nZXRJRCgpOworICAgICAgICAgICAgICAgIHJzLm5NZXNoQmluZEluZGV4KGlkLCBhbGxvY0lELCBlbnRyeS5wcmltLm1JRCwgY3QpOworICAgICAgICAgICAgICAgIG5ld01lc2gubUluZGV4QnVmZmVyc1tjdF0gPSBlbnRyeS5hOworICAgICAgICAgICAgICAgIG5ld01lc2gubVByaW1pdGl2ZXNbY3RdID0gZW50cnkucHJpbTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgZm9yKGludCBjdCA9IDA7IGN0IDwgYi5tVmVydGV4VHlwZUNvdW50OyBjdCArKykgeworICAgICAgICAgICAgICAgIEVudHJ5IGVudHJ5ID0gYi5tVmVydGV4VHlwZXNbY3RdOworICAgICAgICAgICAgICAgIHJzLm5NZXNoQmluZFZlcnRleChpZCwgZW50cnkuYS5tSUQsIGN0KTsKKyAgICAgICAgICAgICAgICBuZXdNZXNoLm1WZXJ0ZXhCdWZmZXJzW2N0XSA9IGVudHJ5LmE7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHJldHVybiBuZXdNZXNoOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIE1lc2ggY3JlYXRlKCkgeworICAgICAgICAgICAgbVJTLnZhbGlkYXRlKCk7CisgICAgICAgICAgICBNZXNoIHNtID0gaW50ZXJuYWxDcmVhdGUobVJTLCB0aGlzKTsKKyAgICAgICAgICAgIHJldHVybiBzbTsKKyAgICAgICAgfQorICAgIH0KKworCisgICAgcHVibGljIHN0YXRpYyBjbGFzcyBUcmlhbmdsZU1lc2hCdWlsZGVyIHsKKyAgICAgICAgZmxvYXQgbVZ0eERhdGFbXTsKKyAgICAgICAgaW50IG1WdHhDb3VudDsKKyAgICAgICAgc2hvcnQgbUluZGV4RGF0YVtdOworICAgICAgICBpbnQgbUluZGV4Q291bnQ7CisgICAgICAgIFJlbmRlclNjcmlwdCBtUlM7CisgICAgICAgIEVsZW1lbnQgbUVsZW1lbnQ7CisKKyAgICAgICAgZmxvYXQgbU5YID0gMDsKKyAgICAgICAgZmxvYXQgbU5ZID0gMDsKKyAgICAgICAgZmxvYXQgbU5aID0gLTE7CisgICAgICAgIGZsb2F0IG1TMCA9IDA7CisgICAgICAgIGZsb2F0IG1UMCA9IDA7CisgICAgICAgIGZsb2F0IG1SID0gMTsKKyAgICAgICAgZmxvYXQgbUcgPSAxOworICAgICAgICBmbG9hdCBtQiA9IDE7CisgICAgICAgIGZsb2F0IG1BID0gMTsKKworICAgICAgICBpbnQgbVZ0eFNpemU7CisgICAgICAgIGludCBtRmxhZ3M7CisKKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBpbnQgQ09MT1IgPSAweDAwMDE7CisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgaW50IE5PUk1BTCA9IDB4MDAwMjsKKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBpbnQgVEVYVFVSRV8wID0gMHgwMTAwOworCisgICAgICAgIHB1YmxpYyBUcmlhbmdsZU1lc2hCdWlsZGVyKFJlbmRlclNjcmlwdCBycywgaW50IHZ0eFNpemUsIGludCBmbGFncykgeworICAgICAgICAgICAgbVJTID0gcnM7CisgICAgICAgICAgICBtVnR4Q291bnQgPSAwOworICAgICAgICAgICAgbUluZGV4Q291bnQgPSAwOworICAgICAgICAgICAgbVZ0eERhdGEgPSBuZXcgZmxvYXRbMTI4XTsKKyAgICAgICAgICAgIG1JbmRleERhdGEgPSBuZXcgc2hvcnRbMTI4XTsKKyAgICAgICAgICAgIG1WdHhTaXplID0gdnR4U2l6ZTsKKyAgICAgICAgICAgIG1GbGFncyA9IGZsYWdzOworCisgICAgICAgICAgICBpZiAodnR4U2l6ZSA8IDIgfHwgdnR4U2l6ZSA+IDMpIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCJWZXJ0ZXggc2l6ZSBvdXQgb2YgcmFuZ2UuIik7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBwcml2YXRlIHZvaWQgbWFrZVNwYWNlKGludCBjb3VudCkgeworICAgICAgICAgICAgaWYgKChtVnR4Q291bnQgKyBjb3VudCkgPj0gbVZ0eERhdGEubGVuZ3RoKSB7CisgICAgICAgICAgICAgICAgZmxvYXQgdFtdID0gbmV3IGZsb2F0W21WdHhEYXRhLmxlbmd0aCAqIDJdOworICAgICAgICAgICAgICAgIFN5c3RlbS5hcnJheWNvcHkobVZ0eERhdGEsIDAsIHQsIDAsIG1WdHhEYXRhLmxlbmd0aCk7CisgICAgICAgICAgICAgICAgbVZ0eERhdGEgPSB0OworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSB2b2lkIGxhdGNoKCkgeworICAgICAgICAgICAgaWYgKChtRmxhZ3MgJiBDT0xPUikgIT0gMCkgeworICAgICAgICAgICAgICAgIG1ha2VTcGFjZSg0KTsKKyAgICAgICAgICAgICAgICBtVnR4RGF0YVttVnR4Q291bnQrK10gPSBtUjsKKyAgICAgICAgICAgICAgICBtVnR4RGF0YVttVnR4Q291bnQrK10gPSBtRzsKKyAgICAgICAgICAgICAgICBtVnR4RGF0YVttVnR4Q291bnQrK10gPSBtQjsKKyAgICAgICAgICAgICAgICBtVnR4RGF0YVttVnR4Q291bnQrK10gPSBtQTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmICgobUZsYWdzICYgVEVYVFVSRV8wKSAhPSAwKSB7CisgICAgICAgICAgICAgICAgbWFrZVNwYWNlKDIpOworICAgICAgICAgICAgICAgIG1WdHhEYXRhW21WdHhDb3VudCsrXSA9IG1TMDsKKyAgICAgICAgICAgICAgICBtVnR4RGF0YVttVnR4Q291bnQrK10gPSBtVDA7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoKG1GbGFncyAmIE5PUk1BTCkgIT0gMCkgeworICAgICAgICAgICAgICAgIG1ha2VTcGFjZSgzKTsKKyAgICAgICAgICAgICAgICBtVnR4RGF0YVttVnR4Q291bnQrK10gPSBtTlg7CisgICAgICAgICAgICAgICAgbVZ0eERhdGFbbVZ0eENvdW50KytdID0gbU5ZOworICAgICAgICAgICAgICAgIG1WdHhEYXRhW21WdHhDb3VudCsrXSA9IG1OWjsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyB2b2lkIGFkZFZlcnRleChmbG9hdCB4LCBmbG9hdCB5KSB7CisgICAgICAgICAgICBpZiAobVZ0eFNpemUgIT0gMikgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oImFkZCBtaXN0bWF0Y2ggd2l0aCBkZWNsYXJlZCBjb21wb25lbnRzLiIpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgbWFrZVNwYWNlKDIpOworICAgICAgICAgICAgbVZ0eERhdGFbbVZ0eENvdW50KytdID0geDsKKyAgICAgICAgICAgIG1WdHhEYXRhW21WdHhDb3VudCsrXSA9IHk7CisgICAgICAgICAgICBsYXRjaCgpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgYWRkVmVydGV4KGZsb2F0IHgsIGZsb2F0IHksIGZsb2F0IHopIHsKKyAgICAgICAgICAgIGlmIChtVnR4U2l6ZSAhPSAzKSB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigiYWRkIG1pc3RtYXRjaCB3aXRoIGRlY2xhcmVkIGNvbXBvbmVudHMuIik7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBtYWtlU3BhY2UoMyk7CisgICAgICAgICAgICBtVnR4RGF0YVttVnR4Q291bnQrK10gPSB4OworICAgICAgICAgICAgbVZ0eERhdGFbbVZ0eENvdW50KytdID0geTsKKyAgICAgICAgICAgIG1WdHhEYXRhW21WdHhDb3VudCsrXSA9IHo7CisgICAgICAgICAgICBsYXRjaCgpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgc2V0VGV4dHVyZShmbG9hdCBzLCBmbG9hdCB0KSB7CisgICAgICAgICAgICBpZiAoKG1GbGFncyAmIFRFWFRVUkVfMCkgPT0gMCkgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oImFkZCBtaXN0bWF0Y2ggd2l0aCBkZWNsYXJlZCBjb21wb25lbnRzLiIpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgbVMwID0gczsKKyAgICAgICAgICAgIG1UMCA9IHQ7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCBzZXROb3JtYWwoZmxvYXQgeCwgZmxvYXQgeSwgZmxvYXQgeikgeworICAgICAgICAgICAgaWYgKChtRmxhZ3MgJiBOT1JNQUwpID09IDApIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJhZGQgbWlzdG1hdGNoIHdpdGggZGVjbGFyZWQgY29tcG9uZW50cy4iKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1OWCA9IHg7CisgICAgICAgICAgICBtTlkgPSB5OworICAgICAgICAgICAgbU5aID0gejsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyB2b2lkIHNldENvbG9yKGZsb2F0IHIsIGZsb2F0IGcsIGZsb2F0IGIsIGZsb2F0IGEpIHsKKyAgICAgICAgICAgIGlmICgobUZsYWdzICYgQ09MT1IpID09IDApIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJhZGQgbWlzdG1hdGNoIHdpdGggZGVjbGFyZWQgY29tcG9uZW50cy4iKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1SID0gcjsKKyAgICAgICAgICAgIG1HID0gZzsKKyAgICAgICAgICAgIG1CID0gYjsKKyAgICAgICAgICAgIG1BID0gYTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyB2b2lkIGFkZFRyaWFuZ2xlKGludCBpZHgxLCBpbnQgaWR4MiwgaW50IGlkeDMpIHsKKyAgICAgICAgICAgIGlmKChpZHgxID49IG1WdHhDb3VudCkgfHwgKGlkeDEgPCAwKSB8fAorICAgICAgICAgICAgICAgKGlkeDIgPj0gbVZ0eENvdW50KSB8fCAoaWR4MiA8IDApIHx8CisgICAgICAgICAgICAgICAoaWR4MyA+PSBtVnR4Q291bnQpIHx8IChpZHgzIDwgMCkpIHsKKyAgICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oIkluZGV4IHByb3ZpZGVkIGdyZWF0ZXIgdGhhbiB2ZXJ0ZXggY291bnQuIik7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoKG1JbmRleENvdW50ICsgMykgPj0gbUluZGV4RGF0YS5sZW5ndGgpIHsKKyAgICAgICAgICAgICAgICBzaG9ydCB0W10gPSBuZXcgc2hvcnRbbUluZGV4RGF0YS5sZW5ndGggKiAyXTsKKyAgICAgICAgICAgICAgICBTeXN0ZW0uYXJyYXljb3B5KG1JbmRleERhdGEsIDAsIHQsIDAsIG1JbmRleERhdGEubGVuZ3RoKTsKKyAgICAgICAgICAgICAgICBtSW5kZXhEYXRhID0gdDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1JbmRleERhdGFbbUluZGV4Q291bnQrK10gPSAoc2hvcnQpaWR4MTsKKyAgICAgICAgICAgIG1JbmRleERhdGFbbUluZGV4Q291bnQrK10gPSAoc2hvcnQpaWR4MjsKKyAgICAgICAgICAgIG1JbmRleERhdGFbbUluZGV4Q291bnQrK10gPSAoc2hvcnQpaWR4MzsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBNZXNoIGNyZWF0ZShib29sZWFuIHVwbG9hZFRvQnVmZmVyT2JqZWN0KSB7CisgICAgICAgICAgICBFbGVtZW50LkJ1aWxkZXIgYiA9IG5ldyBFbGVtZW50LkJ1aWxkZXIobVJTKTsKKyAgICAgICAgICAgIGludCBmbG9hdENvdW50ID0gbVZ0eFNpemU7CisgICAgICAgICAgICBiLmFkZChFbGVtZW50LmNyZWF0ZVZlY3RvcihtUlMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBFbGVtZW50LkRhdGFUeXBlLkZMT0FUXzMyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVZ0eFNpemUpLCAicG9zaXRpb24iKTsKKyAgICAgICAgICAgIGlmICgobUZsYWdzICYgQ09MT1IpICE9IDApIHsKKyAgICAgICAgICAgICAgICBmbG9hdENvdW50ICs9IDQ7CisgICAgICAgICAgICAgICAgYi5hZGQoRWxlbWVudC5GMzJfNChtUlMpLCAiY29sb3IiKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmICgobUZsYWdzICYgVEVYVFVSRV8wKSAhPSAwKSB7CisgICAgICAgICAgICAgICAgZmxvYXRDb3VudCArPSAyOworICAgICAgICAgICAgICAgIGIuYWRkKEVsZW1lbnQuRjMyXzIobVJTKSwgInRleHR1cmUwIik7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoKG1GbGFncyAmIE5PUk1BTCkgIT0gMCkgeworICAgICAgICAgICAgICAgIGZsb2F0Q291bnQgKz0gMzsKKyAgICAgICAgICAgICAgICBiLmFkZChFbGVtZW50LkYzMl8zKG1SUyksICJub3JtYWwiKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1FbGVtZW50ID0gYi5jcmVhdGUoKTsKKworICAgICAgICAgICAgQnVpbGRlciBzbWIgPSBuZXcgQnVpbGRlcihtUlMpOworICAgICAgICAgICAgc21iLmFkZFZlcnRleFR5cGUobUVsZW1lbnQsIG1WdHhDb3VudCAvIGZsb2F0Q291bnQpOworICAgICAgICAgICAgc21iLmFkZEluZGV4VHlwZShFbGVtZW50LlUxNihtUlMpLCBtSW5kZXhDb3VudCwgUHJpbWl0aXZlLlRSSUFOR0xFKTsKKworICAgICAgICAgICAgTWVzaCBzbSA9IHNtYi5jcmVhdGUoKTsKKworICAgICAgICAgICAgc20uZ2V0VmVydGV4QWxsb2NhdGlvbigwKS5kYXRhKG1WdHhEYXRhKTsKKyAgICAgICAgICAgIGlmKHVwbG9hZFRvQnVmZmVyT2JqZWN0KSB7CisgICAgICAgICAgICAgICAgc20uZ2V0VmVydGV4QWxsb2NhdGlvbigwKS51cGxvYWRUb0J1ZmZlck9iamVjdCgpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBzbS5nZXRJbmRleEFsbG9jYXRpb24oMCkuZGF0YShtSW5kZXhEYXRhKTsKKyAgICAgICAgICAgIHNtLmdldEluZGV4QWxsb2NhdGlvbigwKS51cGxvYWRUb0J1ZmZlck9iamVjdCgpOworCisgICAgICAgICAgICByZXR1cm4gc207CisgICAgICAgIH0KKyAgICB9Cit9CisKZGlmZiAtLWdpdCBhL2dyYXBoaWNzL2phdmEvYW5kcm9pZC9yZW5kZXJzY3JpcHQvUHJvZ3JhbS5qYXZhIGIvZ3JhcGhpY3MvamF2YS9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U3ByaXRlRW5hYmxlOworICAgICAgICBib29sZWFuIG1WYXJ5aW5nQ29sb3JFbmFibGU7CiAKICAgICAgICAgcHVibGljIGVudW0gRW52TW9kZSB7CiAgICAgICAgICAgICBSRVBMQUNFICgxKSwKQEAgLTEwNiwyMSArMTA3LDI4IEBACiAgICAgICAgICAgICBtUG9pbnRTcHJpdGVFbmFibGUgPSBmYWxzZTsKICAgICAgICAgfQogCi0gICAgICAgIHB1YmxpYyB2b2lkIHNldFRleHR1cmUoRW52TW9kZSBlbnYsIEZvcm1hdCBmbXQsIGludCBzbG90KQorICAgICAgICBwdWJsaWMgQnVpbGRlciBzZXRUZXh0dXJlKEVudk1vZGUgZW52LCBGb3JtYXQgZm10LCBpbnQgc2xvdCkKICAgICAgICAgICAgIHRocm93cyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24gewogICAgICAgICAgICAgaWYoKHNsb3QgPCAwKSB8fCAoc2xvdCA+PSBNQVhfVEVYVFVSRSkpIHsKICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCJNQVhfVEVYVFVSRSBleGNlZWRlZC4iKTsKICAgICAgICAgICAgIH0KICAgICAgICAgICAgIG1TbG90c1tzbG90XSA9IG5ldyBTbG90KGVudiwgZm10KTsKKyAgICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgICB9CiAKLSAgICAgICAgcHVibGljIHZvaWQgc2V0UG9pbnRTcHJpdGVUZXhDb29yZGluYXRlUmVwbGFjZW1lbnQoYm9vbGVhbiBlbmFibGUpIHsKKyAgICAgICAgcHVibGljIEJ1aWxkZXIgc2V0UG9pbnRTcHJpdGVUZXhDb29yZGluYXRlUmVwbGFjZW1lbnQoYm9vbGVhbiBlbmFibGUpIHsKICAgICAgICAgICAgIG1Qb2ludFNwcml0ZUVuYWJsZSA9IGVuYWJsZTsKKyAgICAgICAgICAgIHJldHVybiB0aGlzOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIEJ1aWxkZXIgc2V0VmFyeWluZ0NvbG9yKGJvb2xlYW4gZW5hYmxlKSB7CisgICAgICAgICAgICBtVmFyeWluZ0NvbG9yRW5hYmxlID0gZW5hYmxlOworICAgICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgIH0KIAogICAgICAgICBwdWJsaWMgUHJvZ3JhbUZyYWdtZW50IGNyZWF0ZSgpIHsKICAgICAgICAgICAgIG1SUy52YWxpZGF0ZSgpOwotICAgICAgICAgICAgaW50W10gdG1wID0gbmV3IGludFtNQVhfVEVYVFVSRSAqIDIgKyAxXTsKKyAgICAgICAgICAgIGludFtdIHRtcCA9IG5ldyBpbnRbTUFYX1RFWFRVUkUgKiAyICsgMl07CiAgICAgICAgICAgICBpZiAobVNsb3RzWzBdICE9IG51bGwpIHsKICAgICAgICAgICAgICAgICB0bXBbMF0gPSBtU2xvdHNbMF0uZW52Lm1JRDsKICAgICAgICAgICAgICAgICB0bXBbMV0gPSBtU2xvdHNbMF0uZm9ybWF0Lm1JRDsKQEAgLTEzMCw2ICsxMzgsNyBAQAogICAgICAgICAgICAgICAgIHRtcFszXSA9IG1TbG90c1sxXS5mb3JtYXQubUlEOwogICAgICAgICAgICAgfQogICAgICAgICAgICAgdG1wWzRdID0gbVBvaW50U3ByaXRlRW5hYmxlID8gMSA6IDA7CisgICAgICAgICAgICB0bXBbNV0gPSBtVmFyeWluZ0NvbG9yRW5hYmxlID8gMSA6IDA7CiAgICAgICAgICAgICBpbnQgaWQgPSBtUlMublByb2dyYW1GcmFnbWVudENyZWF0ZSh0bXApOwogICAgICAgICAgICAgUHJvZ3JhbUZyYWdtZW50IHBmID0gbmV3IFByb2dyYW1GcmFnbWVudChpZCwgbVJTKTsKICAgICAgICAgICAgIHBmLm1UZXh0dXJlQ291bnQgPSBNQVhfVEVYVFVSRTsKZGlmZiAtLWdpdCBhL2dyYXBoaWNzL2phdmEvYW5kcm9pZC9yZW5kZXJzY3JpcHQvUHJvZ3JhbVJhc3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50U21vb3RoID0gZmFsc2U7CiAgICAgICAgIG1MaW5lU21vb3RoID0gZmFsc2U7CiAgICAgICAgIG1Qb2ludFNwcml0ZSA9IGZhbHNlOworCisgICAgICAgIG1DdWxsTW9kZSA9IEN1bGxNb2RlLkJBQ0s7CiAgICAgfQogCiAgICAgcHVibGljIHZvaWQgc2V0TGluZVdpZHRoKGZsb2F0IHcpIHsKQEAgLTUxLDUxICs2MSw0MyBAQAogICAgICAgICBtUlMublByb2dyYW1SYXN0ZXJTZXRMaW5lV2lkdGgobUlELCB3KTsKICAgICB9CiAKLSAgICBwdWJsaWMgdm9pZCBzZXRQb2ludFNpemUoZmxvYXQgcykgeworICAgIHB1YmxpYyB2b2lkIHNldEN1bGxNb2RlKEN1bGxNb2RlIG0pIHsKICAgICAgICAgbVJTLnZhbGlkYXRlKCk7Ci0gICAgICAgIG1Qb2ludFNpemUgPSBzOwotICAgICAgICBtUlMublByb2dyYW1SYXN0ZXJTZXRQb2ludFNpemUobUlELCBzKTsKKyAgICAgICAgbUN1bGxNb2RlID0gbTsKKyAgICAgICAgbVJTLm5Qcm9ncmFtUmFzdGVyU2V0Q3VsbE1vZGUobUlELCBtLm1JRCk7CiAgICAgfQogCi0gICAgdm9pZCBpbnRlcm5hbEluaXQoKSB7Ci0gICAgICAgIGludCBpbklEID0gMDsKLSAgICAgICAgaW50IG91dElEID0gMDsKLSAgICAgICAgaWYgKG1JbiAhPSBudWxsKSB7Ci0gICAgICAgICAgICBpbklEID0gbUluLm1JRDsKLSAgICAgICAgfQotICAgICAgICBpZiAobU91dCAhPSBudWxsKSB7Ci0gICAgICAgICAgICBvdXRJRCA9IG1PdXQubUlEOwotICAgICAgICB9Ci0gICAgICAgIG1JRCA9IG1SUy5uUHJvZ3JhbVJhc3RlckNyZWF0ZShpbklELCBvdXRJRCwgbVBvaW50U21vb3RoLCBtTGluZVNtb290aCwgbVBvaW50U3ByaXRlKTsKLSAgICB9Ci0KLQogICAgIHB1YmxpYyBzdGF0aWMgY2xhc3MgQnVpbGRlciB7CiAgICAgICAgIFJlbmRlclNjcmlwdCBtUlM7Ci0gICAgICAgIFByb2dyYW1SYXN0ZXIgbVBSOworICAgICAgICBib29sZWFuIG1Qb2ludFNwcml0ZTsKKyAgICAgICAgYm9vbGVhbiBtUG9pbnRTbW9vdGg7CisgICAgICAgIGJvb2xlYW4gbUxpbmVTbW9vdGg7CiAKLSAgICAgICAgcHVibGljIEJ1aWxkZXIoUmVuZGVyU2NyaXB0IHJzLCBFbGVtZW50IGluLCBFbGVtZW50IG91dCkgeworICAgICAgICBwdWJsaWMgQnVpbGRlcihSZW5kZXJTY3JpcHQgcnMpIHsKICAgICAgICAgICAgIG1SUyA9IHJzOwotICAgICAgICAgICAgbVBSID0gbmV3IFByb2dyYW1SYXN0ZXIoMCwgcnMpOworICAgICAgICAgICAgbVBvaW50U21vb3RoID0gZmFsc2U7CisgICAgICAgICAgICBtTGluZVNtb290aCA9IGZhbHNlOworICAgICAgICAgICAgbVBvaW50U3ByaXRlID0gZmFsc2U7CiAgICAgICAgIH0KIAotICAgICAgICBwdWJsaWMgdm9pZCBzZXRQb2ludFNwcml0ZUVuYWJsZShib29sZWFuIGVuYWJsZSkgewotICAgICAgICAgICAgbVBSLm1Qb2ludFNwcml0ZSA9IGVuYWJsZTsKKyAgICAgICAgcHVibGljIEJ1aWxkZXIgc2V0UG9pbnRTcHJpdGVFbmFibGUoYm9vbGVhbiBlbmFibGUpIHsKKyAgICAgICAgICAgIG1Qb2ludFNwcml0ZSA9IGVuYWJsZTsKKyAgICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgICB9CiAKLSAgICAgICAgcHVibGljIHZvaWQgc2V0UG9pbnRTbW9vdGhFbmFibGUoYm9vbGVhbiBlbmFibGUpIHsKLSAgICAgICAgICAgIG1QUi5tUG9pbnRTbW9vdGggPSBlbmFibGU7CisgICAgICAgIHB1YmxpYyBCdWlsZGVyIHNldFBvaW50U21vb3RoRW5hYmxlKGJvb2xlYW4gZW5hYmxlKSB7CisgICAgICAgICAgICBtUG9pbnRTbW9vdGggPSBlbmFibGU7CisgICAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICAgfQogCi0gICAgICAgIHB1YmxpYyB2b2lkIHNldExpbmVTbW9vdGhFbmFibGUoYm9vbGVhbiBlbmFibGUpIHsKLSAgICAgICAgICAgIG1QUi5tTGluZVNtb290aCA9IGVuYWJsZTsKKyAgICAgICAgcHVibGljIEJ1aWxkZXIgc2V0TGluZVNtb290aEVuYWJsZShib29sZWFuIGVuYWJsZSkgeworICAgICAgICAgICAgbUxpbmVTbW9vdGggPSBlbmFibGU7CisgICAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICAgfQogCi0KICAgICAgICAgc3RhdGljIHN5bmNocm9uaXplZCBQcm9ncmFtUmFzdGVyIGludGVybmFsQ3JlYXRlKFJlbmRlclNjcmlwdCBycywgQnVpbGRlciBiKSB7Ci0gICAgICAgICAgICBiLm1QUi5pbnRlcm5hbEluaXQoKTsKLSAgICAgICAgICAgIFByb2dyYW1SYXN0ZXIgcHIgPSBiLm1QUjsKLSAgICAgICAgICAgIGIubVBSID0gbmV3IFByb2dyYW1SYXN0ZXIoMCwgYi5tUlMpOworICAgICAgICAgICAgaW50IGlkID0gcnMublByb2dyYW1SYXN0ZXJDcmVhdGUoYi5tUG9pbnRTbW9vdGgsIGIubUxpbmVTbW9vdGgsIGIubVBvaW50U3ByaXRlKTsKKyAgICAgICAgICAgIFByb2dyYW1SYXN0ZXIgcHIgPSBuZXcgUHJvZ3JhbVJhc3RlcihpZCwgcnMpOwogICAgICAgICAgICAgcmV0dXJuIHByOwogICAgICAgICB9CiAKQEAgLTExMSwzICsxMTMsNCBAQAogCiAKIAorCmRpZmYgLS1naXQgYS9ncmFwaGljcy9qYXZhL2FuZHJvaWQvcmVuZGVyc2NyaXB0L1Byb2dyYW1TdG9yZS5qYXZhIGIvZ3JhcGhpY3MvamF2YS9hbmRyb2lkL3JlbmRlcnNjcmlwdC9Q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xlYW4gZywgYm9vbGVhbiBiLCBib29sZWFuIGEpIHsKICAgICAgICAgICAgIG1Db2xvck1hc2tSID0gcjsKICAgICAgICAgICAgIG1Db2xvck1hc2tHID0gZzsKICAgICAgICAgICAgIG1Db2xvck1hc2tCID0gYjsKICAgICAgICAgICAgIG1Db2xvck1hc2tBID0gYTsKKyAgICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgICB9CiAKLSAgICAgICAgcHVibGljIHZvaWQgc2V0QmxlbmRGdW5jKEJsZW5kU3JjRnVuYyBzcmMsIEJsZW5kRHN0RnVuYyBkc3QpIHsKKyAgICAgICAgcHVibGljIEJ1aWxkZXIgc2V0QmxlbmRGdW5jKEJsZW5kU3JjRnVuYyBzcmMsIEJsZW5kRHN0RnVuYyBkc3QpIHsKICAgICAgICAgICAgIG1CbGVuZFNyYyA9IHNyYzsKICAgICAgICAgICAgIG1CbGVuZERzdCA9IGRzdDsKKyAgICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgICB9CiAKLSAgICAgICAgcHVibGljIHZvaWQgc2V0RGl0aGVyRW5hYmxlKGJvb2xlYW4gZW5hYmxlKSB7CisgICAgICAgIHB1YmxpYyBCdWlsZGVyIHNldERpdGhlckVuYWJsZShib29sZWFuIGVuYWJsZSkgewogICAgICAgICAgICAgbURpdGhlciA9IGVuYWJsZTsKKyAgICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgICB9CiAKICAgICAgICAgc3RhdGljIHN5bmNocm9uaXplZCBQcm9ncmFtU3RvcmUgaW50ZXJuYWxDcmVhdGUoUmVuZGVyU2NyaXB0IHJzLCBCdWlsZGVyIGIpIHsKQEAgLTE0NywxNyArMTUxLDE3IEBACiAgICAgICAgICAgICBpZiAoYi5tT3V0ICE9IG51bGwpIHsKICAgICAgICAgICAgICAgICBvdXRJRCA9IGIubU91dC5tSUQ7CiAgICAgICAgICAgICB9Ci0gICAgICAgICAgICBycy5uUHJvZ3JhbUZyYWdtZW50U3RvcmVCZWdpbihpbklELCBvdXRJRCk7Ci0gICAgICAgICAgICBycy5uUHJvZ3JhbUZyYWdtZW50U3RvcmVEZXB0aEZ1bmMoYi5tRGVwdGhGdW5jLm1JRCk7Ci0gICAgICAgICAgICBycy5uUHJvZ3JhbUZyYWdtZW50U3RvcmVEZXB0aE1hc2soYi5tRGVwdGhNYXNrKTsKLSAgICAgICAgICAgIHJzLm5Qcm9ncmFtRnJhZ21lbnRTdG9yZUNvbG9yTWFzayhiLm1Db2xvck1hc2tSLAorICAgICAgICAgICAgcnMublByb2dyYW1TdG9yZUJlZ2luKGluSUQsIG91dElEKTsKKyAgICAgICAgICAgIHJzLm5Qcm9ncmFtU3RvcmVEZXB0aEZ1bmMoYi5tRGVwdGhGdW5jLm1JRCk7CisgICAgICAgICAgICBycy5uUHJvZ3JhbVN0b3JlRGVwdGhNYXNrKGIubURlcHRoTWFzayk7CisgICAgICAgICAgICBycy5uUHJvZ3JhbVN0b3JlQ29sb3JNYXNrKGIubUNvbG9yTWFza1IsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYi5tQ29sb3JNYXNrRywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiLm1Db2xvck1hc2tCLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIubUNvbG9yTWFza0EpOwotICAgICAgICAgICAgcnMublByb2dyYW1GcmFnbWVudFN0b3JlQmxlbmRGdW5jKGIubUJsZW5kU3JjLm1JRCwgYi5tQmxlbmREc3QubUlEKTsKLSAgICAgICAgICAgIHJzLm5Qcm9ncmFtRnJhZ21lbnRTdG9yZURpdGhlcihiLm1EaXRoZXIpOworICAgICAgICAgICAgcnMublByb2dyYW1TdG9yZUJsZW5kRnVuYyhiLm1CbGVuZFNyYy5tSUQsIGIubUJsZW5kRHN0Lm1JRCk7CisgICAgICAgICAgICBycy5uUHJvZ3JhbVN0b3JlRGl0aGVyKGIubURpdGh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aWQgcnNuQ29udGV4dFNldFN1cmZhY2UoaW50IGNvbiwgaW50IHcsIGludCBoLCBTdXJmYWNlIHN1cik7CisgICAgc3luY2hyb25pemVkIHZvaWQgbkNvbnRleHRTZXRTdXJmYWNlKGludCB3LCBpbnQgaCwgU3VyZmFjZSBzdXIpIHsKKyAgICAgICAgcnNuQ29udGV4dFNldFN1cmZhY2UobUNvbnRleHQsIHcsIGgsIHN1cik7CisgICAgfQorICAgIG5hdGl2ZSB2b2lkIHJzbkNvbnRleHRTZXRQcmlvcml0eShpbnQgY29uLCBpbnQgcCk7CisgICAgc3luY2hyb25pemVkIHZvaWQgbkNvbnRleHRTZXRQcmlvcml0eShpbnQgcCkgeworICAgICAgICByc25Db250ZXh0U2V0UHJpb3JpdHkobUNvbnRleHQsIHApOworICAgIH0KKyAgICBuYXRpdmUgdm9pZCByc25Db250ZXh0RHVtcChpbnQgY29uLCBpbnQgYml0cyk7CisgICAgc3luY2hyb25pemVkIHZvaWQgbkNvbnRleHREdW1wKGludCBiaXRzKSB7CisgICAgICAgIHJzbkNvbnRleHREdW1wKG1Db250ZXh0LCBiaXRzKTsKKyAgICB9CisgICAgbmF0aXZlIHZvaWQgcnNuQ29udGV4dEZpbmlzaChpbnQgY29uKTsKKyAgICBzeW5jaHJvbml6ZWQgdm9pZCBuQ29udGV4dEZpbmlzaCgpIHsKKyAgICAgICAgcnNuQ29udGV4dEZpbmlzaChtQ29udGV4dCk7CisgICAgfQogCi0gICAgbmF0aXZlIHZvaWQgblR5cGVCZWdpbihpbnQgZWxlbWVudElEKTsKLSAgICBuYXRpdmUgdm9pZCBuVHlwZUFkZChpbnQgZGltLCBpbnQgdmFsKTsKLSAgICBuYXRpdmUgaW50ICBuVHlwZUNyZWF0ZSgpOwotICAgIG5hdGl2ZSB2b2lkIG5UeXBlRmluYWxEZXN0cm95KFR5cGUgdCk7Ci0gICAgbmF0aXZlIHZvaWQgblR5cGVTZXR1cEZpZWxkcyhUeXBlIHQsIGludFtdIHR5cGVzLCBpbnRbXSBiaXRzLCBGaWVsZFtdIElEcyk7CisgICAgbmF0aXZlIHZvaWQgcnNuQ29udGV4dEJpbmRSb290U2NyaXB0KGludCBjb24sIGludCBzY3JpcHQpOworICAgIHN5bmNocm9uaXplZCB2b2lkIG5Db250ZXh0QmluZFJvb3RTY3JpcHQoaW50IHNjcmlwdCkgeworICAgICAgICByc25Db250ZXh0QmluZFJvb3RTY3JpcHQobUNvbnRleHQsIHNjcmlwdCk7CisgICAgfQorICAgIG5hdGl2ZSB2b2lkIHJzbkNvbnRleHRCaW5kU2FtcGxlcihpbnQgY29uLCBpbnQgc2FtcGxlciwgaW50IHNsb3QpOworICAgIHN5bmNocm9uaXplZCB2b2lkIG5Db250ZXh0QmluZFNhbXBsZXIoaW50IHNhbXBsZXIsIGludCBzbG90KSB7CisgICAgICAgIHJzbkNvbnRleHRCaW5kU2FtcGxlcihtQ29udGV4dCwgc2FtcGxlciwgc2xvdCk7CisgICAgfQorICAgIG5hdGl2ZSB2b2lkIHJzbkNvbnRleHRCaW5kUHJvZ3JhbVN0b3JlKGludCBjb24sIGludCBwZnMpOworICAgIHN5bmNocm9uaXplZCB2b2lkIG5Db250ZXh0QmluZFByb2dyYW1TdG9yZShpbnQgcGZzKSB7CisgICAgICAgIHJzbkNvbnRleHRCaW5kUHJvZ3JhbVN0b3JlKG1Db250ZXh0LCBwZnMpOworICAgIH0KKyAgICBuYXRpdmUgdm9pZCByc25Db250ZXh0QmluZFByb2dyYW1GcmFnbWVudChpbnQgY29uLCBpbnQgcGYpOworICAgIHN5bmNocm9uaXplZCB2b2lkIG5Db250ZXh0QmluZFByb2dyYW1GcmFnbWVudChpbnQgcGYpIHsKKyAgICAgICAgcnNuQ29udGV4dEJpbmRQcm9ncmFtRnJhZ21lbnQobUNvbnRleHQsIHBmKTsKKyAgICB9CisgICAgbmF0aXZlIHZvaWQgcnNuQ29udGV4dEJpbmRQcm9ncmFtVmVydGV4KGludCBjb24sIGludCBwdik7CisgICAgc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UgaW50ICByc25UeXBlQ3JlYXRlKGludCBjb24pOworICAgIHN5bmNocm9uaXplZCBpbnQgblR5cGVDcmVhdGUoKSB7CisgICAgICAgIHJldHVybiByc25UeXBlQ3JlYXRlKG1Db250ZXh0KTsKKyAgICB9CisgICAgbmF0aXZlIHZvaWQgcnNuVHlwZUZpbmFsRGVzdHJveShpbnQgY29uLCBUeXBlIHQpOworICAgIHN5bmNocm9uaXplZCB2b2lkIG5UeXBlRmluYWxEZXN0cm95KFR5cGUgdCkgeworICAgICAgICByc25UeXBlRmluYWxEZXN0cm95KG1Db250ZXh0LCB0KTsKKyAgICB9CisgICAgbmF0aXZlIHZvaWQgcnNuVHlwZVNldHVwRmllbGRzKGludCBjb24sIFR5cGUgdCwgaW50W10gdHlwZXMsIGludFtdIGJpdHMsIEZpZWxkW10gSURzKTsKKyAgICBzeW5jaHJvbml6ZWQgdm9pZCBuVHlwZVNldHVwRmllbGRzKFR5cGUgdCwgaW50W10gdHlwZXMsIGludFtdIGJpdHMsIEZpZWxkW10gSURzKSB7CisgICAgICAgIHJzblR5cGVTZXR1cEZpZWxkcyhtQ29udGV4dCwgdCwgdHlwZXMsIGJpdHMsIElEcyk7CisgICAgfQorICAgIG5hdGl2ZSB2b2lkIHJzblR5cGVHZXROYXRpdmVEYXRhKGludCBjb24sIGludCBpZCwgaW50W10gdHlwZURhdGEpOworICAgIHN5bmNocm9uaXplZCB2b2lkIG5UeXBlR2V0TmF0aXZlRGF0YShpbnQgaWQsIGludFtdIHR5cGVEYXRhKSB7CisgICAgICAgIHJzblR5cGVHZXROYXRpdmVEYXRhKG1Db250ZXh0LCBpZCwgdHlwZURhdGEpOworICAgIH0KIAotICAgIG5hdGl2ZSB2b2lkIG5BbGxvY2F0aW9uU3ViRGF0YTJEKGludCBpZCwgaW50IHhvZmYsIGludCB5b2ZmLCBpbnQgdywgaW50IGgsIGludFtdIGQsIGludCBzaXplQnl0ZXMpOwotICAgIG5hdGl2ZSB2b2lkIG5BbGxvY2F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luY2hyb25pemVkIGludCBuUHJvZ3JhbVZlcnRleENyZWF0ZShib29sZWFuIHRleE1hdCkgeworICAgICAgICByZXR1cm4gcnNuUHJvZ3JhbVZlcnRleENyZWF0ZShtQ29udGV4dCwgdGV4TWF0KTsKKyAgICB9CisgICAgbmF0aXZlIGludCAgcnNuUHJvZ3JhbVZlcnRleENyZWF0ZTIoaW50IGNvbiwgU3RyaW5nIHNoYWRlciwgaW50W10gcGFyYW1zKTsKKyAgICBzeW5jaHJvbml6ZWQgaW50IG5Qcm9ncmFtVmVydGV4Q3JlYXRlMihTdHJpbmcgc2hhZGVyLCBpbnRbXSBwYXJhbXMpIHsKKyAgICAgICAgcmV0dXJuIHJzblByb2dyYW1WZXJ0ZXhDcmVhdGUyKG1Db250ZXh0LCBzaGFkZXIsIHBhcmFtcyk7CisgICAgfQorCisKKyAgICBuYXRpdmUgaW50ICByc25NZXNoQ3JlYXRlKGludCBjb24sIGludCB2dHhDb3VudCwgaW50IGluZGV4Q291bnQpOworICAgIHN5bmNocm9uaXplZCBpbnQgbk1lc2hDcmVhdGUoaW50IHZ0eENvdW50LCBpbnQgaW5kZXhDb3VudCkgeworICAgICAgICByZXR1cm4gcnNuTWVzaENyZWF0ZShtQ29udGV4dCwgdnR4Q291bnQsIGluZGV4Q291bnQpOworICAgIH0KKyAgICBuYXRpdmUgdm9pZCByc25NZXNoQmluZFZlcnRleChpbnQgY29uLCBpbnQgaWQsIGludCBhbGxvYywgaW50IHNsb3QpOworICAgIHN5bmNocm9uaXplZCB2b2lkIG5NZXNoQmluZFZlcnRleChpbnQgaWQsIGludCBhbGxvYywgaW50IHNsb3QpIHsKKyAgICAgICAgcnNuTWVzaEJpbmRWZXJ0ZXgobUNvbnRleHQsIGlkLCBhbGxvYywgc2xvdCk7CisgICAgfQorICAgIG5hdGl2ZSB2b2lkIHJzbk1lc2hCaW5kSW5kZXgoaW50IGNvbiwgaW50IGlkLCBpbnQgYWxsb2MsIGludCBwcmltLCBpbnQgc2xvdCk7CisgICAgc3luY2hyb25pemVkIHZvaWQgbk1lc2hCaW5kSW5kZXgoaW50IGlkLCBpbnQgYWxsb2MsIGludCBwcmltLCBpbnQgc2xvdCkgeworICAgICAgICByc25NZXNoQmluZEluZGV4KG1Db250ZXh0LCBpZCwgYWxsb2MsIHByaW0sIHNsb3QpOworICAgIH0KKyAgICBuYXRpdmUgaW50ICByc25NZXNoR2V0VmVydGV4QnVmZmVyQ291bnQoaW50IGNvbiwgaW50IGlkKTsKKyAgICBzeW5jaHJvbml6ZWQgaW50IG5NZXNoR2V0VmVydGV4QnVmZmVyQ291bnQoaW50IGlkKSB7CisgICAgICAgIHJldHVybiByc25NZXNoR2V0VmVydGV4QnVmZmVyQ291bnQobUNvbnRleHQsIGlkKTsKKyAgICB9CisgICAgbmF0aXZlIGludCAgcnNuTWVzaEdldEluZGV4Q291bnQoaW50IGNvbiwgaW50IGlkKTsKKyAgICBzeW5jaHJvbml6ZWQgaW50IG5NZXNoR2V0SW5kZXhDb3VudChpbnQgaWQpIHsKKyAgICAgICAgcmV0dXJuIHJzbk1lc2hHZXRJbmRleENvdW50KG1Db250ZXh0LCBpZCk7CisgICAgfQorICAgIG5hdGl2ZSB2b2lkIHJzbk1lc2hHZXRWZXJ0aWNlcyhpbnQgY29uLCBpbnQgaWQsIGludFtdIHZ0eElkcywgaW50IHZ0eElkQ291bnQpOworICAgIHN5bmNocm9uaXplZCB2b2lkIG5NZXNoR2V0VmVydGljZXMoaW50IGlkLCBpbnRbXSB2dHhJZHMsIGludCB2dHhJZENvdW50KSB7CisgICAgICAgIHJzbk1lc2hHZXRWZXJ0aWNlcyhtQ29udGV4dCwgaWQsIHZ0eElkcywgdnR4SWRDb3VudCk7CisgICAgfQorICAgIG5hdGl2ZSB2b2lkIHJzbk1lc2hHZXRJbmRpY2VzKGludCBjb24sIGludCBpZCwgaW50W10gaWR4SWRzLCBpbnRbXSBwcmltaXRpdmVzLCBpbnQgdnR4SWRDb3VudCk7CisgICAgc3luY2hy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vdWxkIG9ubHkgaGFwcGVuIGR1cmluZyB0ZWFyZG93bi4KICAgICAgICAgICAgICAgICAgICAgLy8gQnV0IHdlIHdhbnQgdG8gYXZvaWQgc3RhcnZpbmcgb3RoZXIgdGhyZWFkcyBkdXJpbmcKQEAgLTI4Miw3ICs2MTMsNiBAQAogICAgICAgICAgICAgICAgICAgICBtUlMubU1lc3NhZ2VDYWxsYmFjay5tSUQgPSBtc2c7CiAgICAgICAgICAgICAgICAgICAgIG1SUy5tTWVzc2FnZUNhbGxiYWNrLnJ1bigpOwogICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAvL0xvZy5kKExPR19UQUcsICJNZXNzYWdlVGhyZWFkIG1zZyAiICsgbXNnICsgIiB2MSAiICsgcmJ1ZlswXSArICIgdjIgIiArIHJidWZbMV0gKyAiIHYzICIgK3JidWZbMl0pOwogICAgICAgICAgICAgfQogICAgICAgICAgICAgTG9nLmQoTE9HX1RBRywgIk1lc3NhZ2VUaHJlYWQgZXhpdGluZy4iKTsKICAgICAgICAgfQpAQCAtMzA3LDEyICs2MzcsMTYgQEAKICAgICAgICAgbkNvbnRleHREdW1wKGJpdHMpOwogICAgIH0KIAorICAgIHB1YmxpYyB2b2lkIGZpbmlzaCgpIHsKKyAgICAgICAgbkNvbnRleHRGaW5pc2goKTsKKyAgICB9CisKICAgICBwdWJsaWMgdm9pZCBkZXN0cm95KCkgewogICAgICAgICB2YWxpZGF0ZSgpOwotICAgICAgICBuQ29udGV4dERlaW5pdFRvQ2xpZW50KCk7CisgICAgICAgIG5Db250ZXh0RGVpbml0VG9DbGllbnQobUNvbnRleHQpOwogICAgICAgICBtTWVzc2FnZVRocmVhZC5tUnVuID0gZmFsc2U7CiAKLSAgICAgICAgbkNvbnRleHREZXN0cm95KG1Db250ZXh0KTsKKyAgICAgICAgbkNvbnRleHREZXN0cm95KCk7CiAgICAgICAgIG1Db250ZXh0ID0gMDsKIAogICAgICAgICBuRGV2aWNlRGVzdHJveShtRGV2K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GwpIHsKKyAgICAgICAgICAgIEJ1aWxkZXIgYiA9IG5ldyBCdWlsZGVyKHJzKTsKKyAgICAgICAgICAgIGIuc2V0TWluKFZhbHVlLkxJTkVBUl9NSVBfTElORUFSKTsKKyAgICAgICAgICAgIGIuc2V0TWFnKFZhbHVlLkxJTkVBUl9NSVBfTElORUFSKTsKKyAgICAgICAgICAgIGIuc2V0V3JhcFMoVmFsdWUuQ0xBTVApOworICAgICAgICAgICAgYi5zZXRXcmFwVChWYWx1ZS5DTEFNUCk7CisgICAgICAgICAgICBycy5tU2FtcGxlcl9DTEFNUF9MSU5FQVJfTUlQX0xJTkVBUiA9IGIuY3JlYXRlKCk7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIHJzLm1TYW1wbGVyX0NMQU1QX0xJTkVBUl9NSVBfTElORUFSOworICAgIH0KKworICAgIHB1YmxpYyBzdGF0aWMgU2FtcGxlciBXUkFQX05FQVJFU1QoUmVuZGVyU2NyaXB0IHJzKSB7CisgICAgICAgIGlmKHJzLm1TYW1wbGVyX1dSQVBfTkVBUkVTVCA9PSBudWxsKSB7CisgICAgICAgICAgICBCdWlsZGVyIGIgPSBuZXcgQnVpbGRlcihycyk7CisgICAgICAgICAgICBiLnNldE1pbihWYWx1ZS5ORUFSRVNUKTsKKyAgICAgICAgICAgIGIuc2V0TWFnKFZhbHVlLk5FQVJFU1QpOworICAgICAgICAgICAgYi5zZXRXcmFwUyhWYWx1ZS5XUkFQKTsKKyAgICAgICAgICAgIGIuc2V0V3JhcFQoVmFsdWUuV1JBUCk7CisgICAgICAgICAgICBycy5tU2FtcGxlcl9XUkFQX05FQVJFU1QgPSBiLmNyZWF0ZSgpOworICAgICAgICB9CisgICAgICAgIHJldHVybiBycy5tU2FtcGxlcl9XUkFQX05FQVJFU1Q7CisgICAgfQorCisgICAgcHVibGljIHN0YXRpYyBTYW1wbGVyIFdSQVBfTElORUFSKFJlbmRlclNjcmlwdCBycykgeworICAgICAgICBpZihycy5tU2FtcGxlcl9XUkFQX0xJTkVBUiA9PSBudWxsKSB7CisgICAgICAgICAgICBCdWlsZGVyIGIgPSBuZXcgQnVpbGRlcihycyk7CisgICAgICAgICAgICBiLnNldE1pbihWYWx1ZS5MSU5FQVIpOworICAgICAgICAgICAgYi5zZXRNYWcoVmFsdWUuTElORUFSKTsKKyAgICAgICAgICAgIGIuc2V0V3JhcFMoVmFsdWUuV1JBUCk7CisgICAgICAgICAgICBiLnNldFdyYXBUKFZhbHVlLldSQVApOworICAgICAgICAgICAgcnMubVNhbXBsZXJfV1JBUF9MSU5FQVIgPSBiLmNyZWF0ZSgpOworICAgICAgICB9CisgICAgICAgIHJldHVybiBycy5tU2FtcGxlcl9XUkFQX0xJTkVBUjsKKyAgICB9CisKKyAgICBwdWJsaWMgc3RhdGljIFNhbXBsZXIgV1JBUF9MSU5FQVJfTUlQX0xJTkVBUihSZW5kZXJTY3JpcHQgcnMpIHsKKyAgICAgICAgaWYocnMubVNhbXBsZXJfV1JBUF9MSU5FQVJfTUlQX0xJTkVBUiA9PSBudWxsKSB7CisgICAgICAgICAgICBCdWlsZGVyIGIgPSBuZXcgQnVpbGRlcihycyk7CisgICAgICAgICAgICBiLnNldE1pbihWYWx1ZS5MSU5FQVJfTUlQX0xJTkVBUik7CisgICAgICAgICAgICBiLnNldE1hZyhWYWx1ZS5MSU5FQVJfTUlQX0xJTkVBUik7CisgICAgICAgICAgICBiLnNldFdyYXBTKFZhbHVlLldSQVApOworICAgICAgICAgICAgYi5zZXRXcmFwVChWYWx1ZS5XUkFQKTsKKyAgICAgICAgICAgIHJzLm1TYW1wbGVyX1dSQVBfTElORUFSX01JUF9MSU5FQVIgPSBiLmNyZWF0ZSgpOworICAgICAgICB9CisgICAgICAgIHJldHVybiBycy5tU2FtcGxlcl9XUkFQX0xJTkVBUl9NSVBfTElORUFSOworICAgIH0KKworCiAgICAgcHVibGljIHN0YXRpYyBjbGFzcyBCdWlsZGVyIHsKICAgICAgICAgUmVuZGVyU2NyaXB0IG1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uIHYpIHsKKyAgICAgICAgbVJTLm5TY3JpcHRTZXRWYXJJKG1JRCwgaW5kZXgsIHYgPyAxIDogMCk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgc2V0VmFyKGludCBpbmRleCwgRmllbGRQYWNrZXIgdikgeworICAgICAgICBtUlMublNjcmlwdFNldFZhclYobUlELCBpbmRleCwgdi5nZXREYXRhKCkpOwogICAgIH0KIAogICAgIHB1YmxpYyB2b2lkIHNldFRpbWVab25lKFN0cmluZyB0aW1lWm9uZSkgewpAQCAtNzgsNzIgKzk1LDU0IEBACiAKICAgICBwdWJsaWMgc3RhdGljIGNsYXNzIEJ1aWxkZXIgewogICAgICAgICBSZW5kZXJTY3JpcHQgbVJTOwotICAgICAgICBib29sZWFuIG1Jc1Jvb3QgPSBmYWxzZTsKLSAgICAgICAgVHlwZVtdIG1UeXBlczsKLSAgICAgICAgU3RyaW5nW10gbU5hbWVzOwotICAgICAgICBib29sZWFuW10gbVdyaXRhYmxlOwotICAgICAgICBpbnQgbUludm9rYWJsZUNvdW50ID0gMDsKLSAgICAgICAgSW52b2thYmxlW10gbUludm9rYWJsZXM7CiAKICAgICAgICAgQnVpbGRlcihSZW5kZXJTY3JpcHQgcnMpIHsKICAgICAgICAgICAgIG1SUyA9IHJzOwotICAgICAgICAgICAgbVR5cGVzID0gbmV3IFR5cGVbTUFYX1NMT1RdOwotICAgICAgICAgICAgbU5hbWVzID0gbmV3IFN0cmluZ1tNQVhfU0xPVF07Ci0gICAgICAgICAgICBtV3JpdGFibGUgPSBuZXcgYm9vbGVhbltNQVhfU0xPVF07Ci0gICAgICAgICAgICBtSW52b2thYmxlcyA9IG5ldyBJbnZva2FibGVbTUFYX1NMT1RdOwogICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIHZvaWQgc2V0VHlwZShUeXBlIHQsIGludCBzbG90KSB7Ci0gICAgICAgICAgICBtVHlwZXNbc2xvdF0gPSB0OwotICAgICAgICAgICAgbU5hbWVzW3Nsb3RdID0gbnVsbDsKLSAgICAgICAgfQotCi0gICAgICAgIHB1YmxpYyB2b2lkIHNldFR5cGUoVHlwZSB0LCBTdHJpbmcgbmFtZSwgaW50IHNsb3QpIHsKLSAgICAgICAgICAgIG1UeXBlc1tzbG90XSA9IHQ7Ci0gICAgICAgICAgICBtTmFtZXNbc2xvdF0gPSBuYW1lOwotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIEludm9rYWJsZSBhZGRJbnZva2FibGUoU3RyaW5nIGZ1bmMpIHsKLSAgICAgICAgICAgIEludm9rYWJsZSBpID0gbmV3IEludm9rYWJsZSgpOwotICAgICAgICAgICAgaS5tTmFtZSA9IGZ1bmM7Ci0gICAgICAgICAgICBpLm1SUyA9IG1SUzsKLSAgICAgICAgICAgIGkubVNsb3QgPSBtSW52b2thYmxlQ291bnQ7Ci0gICAgICAgICAgICBtSW52b2thYmxlc1ttSW52b2thYmxlQ291bnQrK10gPSBpOwotICAgICAgICAgICAgcmV0dXJuIGk7Ci0gICAgICAgIH0KLQotICAgICAgICBwdWJsaWMgdm9pZCBzZXRUeXBlKGJvb2xlYW4gd3JpdGFibGUsIGludCBzbG90KSB7Ci0gICAgICAgICAgICBtV3JpdGFibGVbc2xvdF0gPSB3cml0YWJsZTsKLSAgICAgICAgfQotCi0gICAgICAgIHZvaWQgdHJhbnNmZXJDcmVhdGUoKSB7Ci0gICAgICAgICAgICBtUlMublNjcmlwdFNldFJvb3QobUlzUm9vdCk7Ci0gICAgICAgICAgICBmb3IoaW50IGN0PTA7IGN0IDwgbVR5cGVzLmxlbmd0aDsgY3QrKykgewotICAgICAgICAgICAgICAgIGlmKG1UeXBlc1tjdF0gIT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICBtUlMublNjcmlwdFNldFR5cGUobVR5cGVzW2N0XS5tSUQsIG1Xcml0YWJsZVtjdF0sIG1OYW1lc1tjdF0sIGN0KTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBmb3IoaW50IGN0PTA7IGN0IDwgbUludm9rYWJsZUNvdW50OyBjdCsrKSB7Ci0gICAgICAgICAgICAgICAgbVJTLm5TY3JpcHRTZXRJbnZva2FibGUobUludm9rYWJsZXNbY3RdLm1OYW1lLCBjdCk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQotICAgICAgICB2b2lkIHRyYW5zZmVyT2JqZWN0KFNjcmlwdCBzKSB7Ci0gICAgICAgICAgICBzLm1Jc1Jvb3QgPSBtSXNSb290OwotICAgICAgICAgICAgcy5tVHlwZXMgPSBtVHlwZXM7Ci0gICAgICAgICAgICBzLm1JbnZva2FibGVzID0gbmV3IEludm9rYWJsZVttSW52b2thYmxlQ291bnRdOwotICAgICAgICAgICAgZm9yKGludCBjdD0wOyBjdCA8IG1JbnZva2FibGVDb3VudDsgY3QrKykgewotICAgICAgICAgICAgICAgIHMubUludm9rYWJsZXNbY3RdID0gbUludm9rYWJsZXNbY3RdOwotICAgICAgICAgICAgICAgIHMubUludm9rYWJsZXNbY3RdLm1TY3JpcHQgPSBzOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgcy5tSW52b2thYmxlcyA9IG51bGw7Ci0gICAgICAgIH0KLQotICAgICAgICBwdWJsaWMgdm9pZCBzZXRSb290KGJvb2xlYW4gcikgewotICAgICAgICAgICAgbUlzUm9vdCA9IHI7Ci0gICAgICAgIH0KLQogICAgIH0KIAorCisgICAgcHVibGljIHN0YXRpYyBjbGFzcyBGaWVsZEJhc2UgeworICAgICAgICBwcm90ZWN0ZWQgRWxlbWVudCBtRWxlbWVudDsKKyAgICAgICAgcHJvdGVjdGVkIFR5cGUgbVR5cGU7CisgICAgICAgIHByb3RlY3RlZCBBbGxvY2F0aW9uIG1BbGxvY2F0aW9uOworCisgICAgICAgIHByb3RlY3RlZCB2b2lkIGluaXQoUmVuZGVyU2NyaXB0IHJzLCBpbnQgZGlteCkgeworICAgICAgICAgICAgbUFsbG9jYXRpb24gPSBBbGxvY2F0aW9uLmNyZWF0ZVNpemVkKHJzLCBtRWxlbWVudCwgZGlteCk7CisgICAgICAgICAgICBtVHlwZSA9IG1BbGxvY2F0aW9uLmdldFR5cGUoKTsKKyAgICAgICAgfQorCisgICAgICAgIHByb3RlY3RlZCBGaWVsZEJhc2UoKSB7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgRWxlbWVudCBnZXRFbGVtZW50KCkgeworICAgICAgICAgICAgcmV0dXJuIG1FbGVtZW50OworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIFR5cGUgZ2V0VHlwZSgpIHsKKyAgICAgICAgICAgIHJldHVybiBtVHlwZTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBBbGxvY2F0aW9uIGdldEFsbG9jYXRpb24oKSB7CisgICAgICAgICAgICByZXR1cm4gbUFsbG9jYXRpb247CisgICAgICAgIH0KKworICAgICAgICAvL0BPdmVycmlkZQorICAgICAgICBwdWJsaWMgdm9pZCB1cGRhdGVBbGxvY2F0aW9uKCkgeworICAgICAgICB9CisKKworICAgICAgICAvLworICAgICAgICAvKgorICAgICAgICBwdWJsaWMgY2xhc3MgU2NyaXB0RmllbGRfVXNlckZpZWxkCisgICAgICAgICAgICBleHRlbmRzIGFuZHJvaWQucmVuZGVyc2NyaXB0LlNjcmlwdC5GaWVsZEJhc2UgeworCisgICAgICAgICAgICBwcm90ZWN0ZWQKKworICAgICAgICB9CisKKyAgICAgICAgKi8KKworICAgIH0KIH0KIApkaWZmIC0tZ2l0IGEvZ3JhcGhpY3MvamF2YS9hbmRyb2lkL3JlbmRlcnNjcmlwdC9TY3JpcHRDLmphdmEgYi9ncmFwaGljcy9qYXZhL2FuZHJvaWQvcmVuZGVyc2NyaXB0L1NjcmlwdEMuamF2YQppbmRleCBiYjk5ZTIzLi41OTU5YmU0IDEwMDY0NAotLS0gYS9ncmFwaGljcy9qYXZhL2FuZHJvaWQvcmVuZGVyc2NyaXB0L1NjcmlwdEMuamF2YQorKysgYi9ncmFwaGljcy9qYXZhL2FuZHJvaWQvcmVuZGVyc2NyaXB0L1NjcmlwdEMuamF2YQpAQCAtMzcsMTEgKzM3LDQ5IEBACiAgICAgICAgIHN1cGVyKGlkLCBycyk7CiAgICAgfQogCisgICAgcHJvdGVjdGVkIFNjcmlwdEMoUmVuZGVyU2NyaXB0IHJzLCBSZXNvdXJjZXMgcmVzb3VyY2VzLCBpbnQgcmVzb3VyY2VJRCwgYm9vbGVhbiBpc1Jvb3QpIHsKKyAgICAgICAgc3VwZXIoMCwgcnMpOworICAgICAgICBtSUQgPSBpbnRlcm5hbENyZWF0ZShycywgcmVzb3VyY2VzLCByZXNvdXJjZUlEKTsKKyAgICB9CisKKworICAgIHByaXZhdGUgc3RhdGljIHN5bmNocm9uaXplZCBpbnQgaW50ZXJuYWxDcmVhdGUoUmVuZGVyU2NyaXB0IHJzLCBSZXNvdXJjZXMgcmVzb3VyY2VzLCBpbnQgcmVzb3VyY2VJRCkgeworICAgICAgICBieXRlW10gcGdtOworICAgICAgICBpbnQgcGdtTGVuZ3RoOworICAgICAgICBJbnB1dFN0cmVhbSBpcyA9IHJlc291cmNlcy5vcGVuUmF3UmVzb3VyY2UocmVzb3VyY2VJRCk7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIHBnbSA9IG5ldyBieXRlWzEwMjRdOworICAgICAgICAgICAgICAgIHBnbUxlbmd0aCA9IDA7CisgICAgICAgICAgICAgICAgd2hpbGUodHJ1ZSkgeworICAgICAgICAgICAgICAgICAgICBpbnQgYnl0ZXNMZWZ0ID0gcGdtLmxlbmd0aCAtIHBnbUxlbmd0aDsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGJ5dGVzTGVmdCA9PSAwKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBieXRlW10gYnVmMiA9IG5ldyBieXRlW3BnbS5sZW5ndGggKiAyXTsKKyAgICAgICAgICAgICAgICAgICAgICAgIFN5c3RlbS5hcnJheWNvcHkocGdtLCAwLCBidWYyLCAwLCBwZ20ubGVuZ3RoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHBnbSA9IGJ1ZjI7CisgICAgICAgICAgICAgICAgICAgICAgICBieXRlc0xlZnQgPSBwZ20ubGVuZ3RoIC0gcGdtTGVuZ3RoOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGludCBieXRlc1JlYWQgPSBpcy5yZWFkKHBnbSwgcGdtTGVuZ3RoLCBieXRlc0xlZnQpOworICAgICAgICAgICAgICAgICAgICBpZiAoYnl0ZXNSZWFkIDw9IDApIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIHBnbUxlbmd0aCArPSBieXRlc1JlYWQ7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSBmaW5hbGx5IHsKKyAgICAgICAgICAgICAgICBpcy5jbG9zZSgpOworICAgICAgICAgICAgfQorICAgICAgICB9IGNhdGNoKElPRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBSZXNvdXJjZXMuTm90Rm91bmRFeGNlcHRpb24oKTsKKyAgICAgICAgfQorCisgICAgICAgIHJzLm5TY3JpcHRDQmVnaW4oKTsKKyAgICAgICAgcnMublNjcmlwdENTZXRTY3JpcHQocGdtLCAwLCBwZ21MZW5ndGgpOworICAgICAgICByZXR1cm4gcnMublNjcmlwdENDcmVhdGUoKTsKKyAgICB9CisKICAgICBwdWJsaWMgc3RhdGljIGNsYXNzIEJ1aWxkZXIgZXh0ZW5kcyBTY3JpcHQuQnVpbGRlciB7CiAgICAgICAgIGJ5dGVbXSBtUHJvZ3JhbTsKICAgICAgICAgaW50IG1Qcm9ncmFtTGVuZ3RoOwotICAgICAgICBIYXNoTWFwPFN0cmluZyxJbnRlZ2VyPiBtSW50RGVmaW5lcyA9IG5ldyBIYXNoTWFwKCk7Ci0gICAgICAgIEhhc2hNYXA8U3Ry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ICAgcHVibGljIHZvaWQgYWRkRGVmaW5lcyhPYmplY3QgbykgewotICAgICAgICAgICAgYWRkRGVmaW5lcyhvLmdldENsYXNzKCkuZ2V0RmllbGRzKCksIE1vZGlmaWVyLlBVQkxJQywgbyk7Ci0gICAgICAgIH0KLQotICAgICAgICB2b2lkIGFkZERlZmluZXMoRmllbGRbXSBmaWVsZHMsIGludCBtYXNrLCBPYmplY3QgbykgewotICAgICAgICAgICAgZm9yIChGaWVsZCBmOiBmaWVsZHMpIHsKLSAgICAgICAgICAgICAgICB0cnkgewotICAgICAgICAgICAgICAgICAgICBpZiAoKGYuZ2V0TW9kaWZpZXJzKCkgJiBtYXNrKSA9PSBtYXNrKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBDbGFzcyB0ID0gZi5nZXRUeXBlKCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAodCA9PSBpbnQuY2xhc3MpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBtSW50RGVmaW5lcy5wdXQoZi5nZXROYW1lKCksIGYuZ2V0SW50KG8pKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKHQgPT0gZmxvYXQuY2xhc3MpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBtRmxvYXREZWZpbmVzLnB1dChmLmdldE5hbWUoKSwgZi5nZXRGbG9hdChvKSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9IGNhdGNoIChJbGxlZ2FsQWNjZXNzRXhjZXB0aW9uIGV4KSB7Ci0gICAgICAgICAgICAgICAgICAgIC8vIFRPRE86IERvIHdlIHdhbnQgdGhpcyBsb2c/Ci0gICAgICAgICAgICAgICAgICAgIExvZy5kKFRBRywgImFkZERlZmluZXMgc2tpcHBpbmcgZmllbGQgIiArIGYuZ2V0TmFtZSgpKTsKLSAgICAgIC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ICAgIHB1YmxpYyBzdGF0aWMgY2xhc3MgQnVpbGRlciB7Ci0gICAgICAgIFJlbmRlclNjcmlwdCBtUlM7Ci0KLSAgICAgICAgY2xhc3MgRW50cnkgewotICAgICAgICAgICAgVHlwZSB0OwotICAgICAgICAgICAgRWxlbWVudCBlOwotICAgICAgICAgICAgaW50IHNpemU7Ci0gICAgICAgIH0KLQotICAgICAgICBpbnQgbVZlcnRleFR5cGVDb3VudDsKLSAgICAgICAgRW50cnlbXSBtVmVydGV4VHlwZXM7Ci0gICAgICAgIEVudHJ5IG1JbmRleFR5cGU7Ci0gICAgICAgIC8vRW50cnkgbUJhdGNoVHlwZTsKLSAgICAgICAgUHJpbWl0aXZlIG1QcmltaXRpdmU7Ci0KLQotICAgICAgICBwdWJsaWMgQnVpbGRlcihSZW5kZXJTY3JpcHQgcnMpIHsKLSAgICAgICAgICAgIG1SUyA9IHJzOwotICAgICAgICAgICAgbVZlcnRleFR5cGVDb3VudCA9IDA7Ci0gICAgICAgICAgICBtVmVydGV4VHlwZXMgPSBuZXcgRW50cnlbMTZdOwotICAgICAgICAgICAgbUluZGV4VHlwZSA9IG5ldyBFbnRyeSgpOwotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIGludCBhZGRWZXJ0ZXhUeXBlKFR5cGUgdCkgdGhyb3dzIElsbGVnYWxTdGF0ZUV4Y2VwdGlvbiB7Ci0gICAgICAgICAgICBpZiAobVZlcnRleFR5cGVDb3VudCA+PSBtVmVydGV4VHlwZXMubGVuZ3RoKSB7Ci0gICAgICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigiTWF4IHZlcnRleCB0eXBlcyBleGNlZWRlZC4iKTsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgaW50IGFkZGVkSW5kZXggPSBtVmVydGV4VHlwZUNvdW50OwotICAgICAgICAgICAgbVZlcnRleFR5cGVzW21WZXJ0ZXhUeXBlQ291bnRdID0gbmV3IEVudHJ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vaWQgc2V0SW5kZXhUeXBlKEVsZW1lbnQgZSwgaW50IHNpemUpIHsKLSAgICAgICAgICAgIG1JbmRleFR5cGUudCA9IG51bGw7Ci0gICAgICAgICAgICBtSW5kZXhUeXBlLmUgPSBlOwotICAgICAgICAgICAgbUluZGV4VHlwZS5zaXplID0gc2l6ZTsKLSAgICAgICAgfQotCi0gICAgICAgIHB1YmxpYyB2b2lkIHNldFByaW1pdGl2ZShQcmltaXRpdmUgcCkgewotICAgICAgICAgICAgbVByaW1pdGl2ZSA9IHA7Ci0gICAgICAgIH0KLQotCi0gICAgICAgIFR5cGUgbmV3VHlwZShFbGVtZW50IGUsIGludCBzaXplKSB7Ci0gICAgICAgICAgICBUeXBlLkJ1aWxkZXIgdGIgPSBuZXcgVHlwZS5CdWlsZGVyKG1SUywgZSk7Ci0gICAgICAgICAgICB0Yi5hZGQoRGltZW5zaW9uLlgsIHNpemUpOwotICAgICAgICAgICAgcmV0dXJuIHRiLmNyZWF0ZSgpOwotICAgICAgICB9Ci0KLSAgICAgICAgc3RhdGljIHN5bmNocm9uaXplZCBTaW1wbGVNZXNoIGludGVybmFsQ3JlYXRlKFJlbmRlclNjcmlwdCBycywgQnVpbGRlciBiKSB7Ci0gICAgICAgICAgICBUeXBlW10gdG9EZXN0cm95ID0gbmV3IFR5cGVbMThdOwotICAgICAgICAgICAgaW50IHRvRGVzdHJveUNvdW50ID0gMDsKLQotICAgICAgICAgICAgaW50IGluZGV4SUQgPSAwOwotICAgICAgICAgICAgaWYgKGIubUluZGV4VHlwZS50ICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICBpbmRleElEID0gYi5tSW5kZXhUeXBlLnQubUlEOwotICAgICAgICAgICAgfSBlbHNlIGlmIChiLm1JbmRleFR5cGUuc2l6ZSAhPSAwKSB7Ci0gICAgICAgICAgICAgICAgYi5tSW5kZXhUeXBlLnQgPSBiLm5ld1R5cGUoYi5tSW5kZXhUeXBlLmUsIGIubUluZGV4VHlwZS5zaXplKTsKLSAgICAgICAgICAgICAgICBpbmRleElEID0gYi5tSW5kZXhUeXBlLnQubUlEOwotICAgICAgICAgICAgICAgIHRvRGVzdHJveVt0b0Rlc3Ryb3lDb3VudCsrXSA9IGIubUluZGV4VHlwZS50OwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBpbnRbXSBJRHMgPSBuZXcgaW50W2IubVZlcnRleFR5cGVDb3VudF07Ci0gICAgICAgICAgICBmb3IoaW50IGN0PTA7IGN0IDwgYi5tVmVydGV4VHlwZUNvdW50OyBjdCsrKSB7Ci0gICAgICAgICAgICAgICAgaWYgKGIubVZlcnRleFR5cGVzW2N0XS50ICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgSURzW2N0XSA9IGIubVZlcnRleFR5cGVzW2N0XS50Lm1JRDsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICBiLm1WZXJ0ZXhUeXBlc1tjdF0udCA9IGIubmV3VHlwZShiLm1WZXJ0ZXhUeXBlc1tjdF0uZSwgYi5tVmVydGV4VHlwZXNbY3RdLnNpemUpOwotICAgICAgICAgICAgICAgICAgICBJRHNbY3RdID0gYi5tVmVydGV4VHlwZXNbY3RdLnQubUlEOwotICAgICAgICAgICAgICAgICAgICB0b0Rlc3Ryb3lbdG9EZXN0cm95Q291bnQrK10gPSBiLm1WZXJ0ZXhUeXBlc1tjdF0udDsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIGludCBpZCA9IHJzLm5TaW1wbGVNZXNoQ3JlYXRlKDAsIGluZGV4SUQsIElEcywgYi5tUHJpbWl0aXZlLm1JRCk7Ci0gICAgICAgICAgICBmb3IoaW50IGN0PTA7IGN0IDwgdG9EZXN0cm95Q291bnQ7IGN0KyspIHsKLSAgICAgICAgICAgICAgICB0b0Rlc3Ryb3lbY3RdLmRlc3Ryb3koKTsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgcmV0dXJuIG5ldyBTaW1wbGVNZXNoKGlkLCBycyk7Ci0gICAgICAgIH0KLQotICAgICAgICBwdWJsaWMgU2ltcGxlTWVzaCBjcmVhdGUoKSB7Ci0gICAgICAgICAgICBtUlMudmFsaWRhdGUoKTsKLSAgICAgICAgICAgIFNpbXBsZU1lc2ggc20gPSBpbnRlcm5hbENyZWF0ZShtUlMsIHRoaXMpOwotICAgICAgICAgICAgc20ubVZlcnRleFR5cGVzID0gbmV3IFR5cGVbbVZlcnRleFR5cGVDb3VudF07Ci0gICAgICAgICAgICBmb3IoaW50IGN0PTA7IGN0IDwgbVZlcnRleFR5cGVDb3VudDsgY3QrKykgewotICAgICAgICAgICAgICAgIHNtLm1WZXJ0ZXhUeXBlc1tjdF0gPSBtVmVydGV4VHlwZXNbY3RdLnQ7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBzbS5tSW5kZXhUeXBlID0gbUluZGV4VHlwZS50OwotICAgICAgICAgICAgc20ubVByaW1pdGl2ZSA9IG1QcmltaXRpdmU7Ci0gICAgICAgICAgICByZXR1cm4gc207Ci0gICAgICAgIH0KLSAgICB9Ci0KLSAgICBwdWJsaWMgc3RhdGljIGNsYXNzIFRyaWFuZ2xlTWVzaEJ1aWxkZXIgewotICAgICAgICBmbG9hdCBtVnR4RGF0YVtdOwotICAgICAgICBpbnQgbVZ0eENvdW50OwotICAgICAgICBzaG9ydCBtSW5kZXhEYXRhW107Ci0gICAgICAgIGludCBtSW5kZXhDb3VudDsKLSAgICAgICAgUmVuZGVyU2NyaXB0IG1SUzsKLSAgICAgICAgRWxlbWVudCBtRWxlbWVudDsKLQotICAgICAgICBmbG9hdCBtTlggPSAwOwotICAgICAgICBmbG9hdCBtTlkgPSAwOwotICAgICAgICBmbG9hdCBtTlogPSAtMTsKLSAgICAgICAgZmxvYXQgbVMwID0gMDsKLSAgICAgICAgZmxvYXQgbVQwID0gMDsKLSAgICAgICAgZmxvYXQgbVIgPSAxOwotICAgICAgICBmbG9hdCBtRyA9IDE7Ci0gICAgICAgIGZsb2F0IG1CID0gMTsKLSAgICAgICAgZmxvYXQgbUEgPSAxOwotCi0gICAgICAgIGludCBtVnR4U2l6ZTsKLSAgICAgICAgaW50IG1GbGFnczsKLQotICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGludCBDT0xPUiA9IDB4MDAwMTsKLSAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBpbnQgTk9STUFMID0gMHgwMDAyOwotICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGludCBURVhUVVJFXzAgPSAweDAxMDA7Ci0KLSAgICAgICAgcHVibGljIFRyaWFuZ2xlTWVzaEJ1aWxkZXIoUmVuZGVyU2NyaXB0IHJzLCBpbnQgdnR4U2l6ZSwgaW50IGZsYWdzKSB7Ci0gICAgICAgICAgICBtUlMgPSByczsKLSAgICAgICAgICAgIG1WdHhDb3VudCA9IDA7Ci0gICAgICAgICAgICBtSW5kZXhDb3VudCA9IDA7Ci0gICAgICAgICAgICBtVnR4RGF0YSA9IG5ldyBmbG9hdFsxMjhdOwotICAgICAgICAgICAgbUluZGV4RGF0YSA9IG5ldyBzaG9ydFsxMjhdOwotICAgICAgICAgICAgbVZ0eFNpemUgPSB2dHhTaXplOwotICAgICAgICAgICAgbUZsYWdzID0gZmxhZ3M7Ci0KLSAgICAgICAgICAgIGlmICh2dHhTaXplIDwgMiB8fCB2dHhTaXplID4gMykgewotICAgICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oIlZlcnRleCBzaXplIG91dCBvZiByYW5nZS4iKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCi0gICAgICAgIHByaXZhdGUgdm9pZCBtYWtlU3BhY2UoaW50IGNvdW50KSB7Ci0gICAgICAgICAgICBpZiAoKG1WdHhDb3VudCArIGNvdW50KSA+PSBtVnR4RGF0YS5sZW5ndGgpIHsKLSAgICAgICAgICAgICAgICBmbG9hdCB0W10gPSBuZXcgZmxvYXRbbVZ0eERhdGEubGVuZ3RoICogMl07Ci0gICAgICAgICAgICAgICAgU3lzdGVtLmFycmF5Y29weShtVnR4RGF0YSwgMCwgdCwgMCwgbVZ0eERhdGEubGVuZ3RoKTsKLSAgICAgICAgICAgICAgICBtVnR4RGF0YSA9IHQ7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQotICAgICAgICBwcml2YXRlIHZvaWQgbGF0Y2goKSB7Ci0gICAgICAgICAgICBpZiAoKG1GbGFncyAmIENPTE9SKSAhPSAwKSB7Ci0gICAgICAgICAgICAgICAgbWFrZVNwYWNlKDQpOwotICAgICAgICAgICAgICAgIG1WdHhEYXRhW21WdHhDb3VudCsrXSA9IG1SOwotICAgICAgICAgICAgICAgIG1WdHhEYXRhW21WdHhDb3VudCsrXSA9IG1HOwotICAgICAgICAgICAgICAgIG1WdHhEYXRhW21WdHhDb3VudCsrXSA9IG1COwotICAgICAgICAgICAgICAgIG1WdHhEYXRhW21WdHhDb3VudCsrXSA9IG1BOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKChtRmxhZ3MgJiBURVhUVVJFXzApICE9IDApIHsKLSAgICAgICAgICAgICAgICBtYWtlU3BhY2UoMik7Ci0gICAgICAgICAgICAgICAgbVZ0eERhdGFbbVZ0eENvdW50KytdID0gbVMwOwotICAgICAgICAgICAgICAgIG1WdHhEYXRhW21WdHhDb3VudCsrXSA9IG1UMDsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmICgobUZsYWdzICYgTk9STUFMKSAhPSAwKSB7Ci0gICAgICAgICAgICAgICAgbWFrZVNwYWNlKDMpOwotICAgICAgICAgICAgICAgIG1WdHhEYXRhW21WdHhDb3VudCsrXSA9IG1OWDsKLSAgICAgICAgICAgICAgICBtVnR4RGF0YVttVnR4Q291bnQrK10gPSBtTlk7Ci0gICAgICAgICAgICAgICAgbVZ0eERhdGFbbVZ0eENvdW50KytdID0gbU5aOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIHZvaWQgYWRkVmVydGV4KGZsb2F0IHgsIGZsb2F0IHkpIHsKLSAgICAgICAgICAgIGlmIChtVnR4U2l6ZSAhPSAyKSB7Ci0gICAgICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigiYWRkIG1pc3RtYXRjaCB3aXRoIGRlY2xhcmVkIGNvbXBvbmVudHMuIik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBtYWtlU3BhY2UoMik7Ci0gICAgICAgICAgICBtVnR4RGF0YVttVnR4Q291bnQrK10gPSB4OwotICAgICAgICAgICAgbVZ0eERhdGFbbVZ0eENvdW50KytdID0geTsKLSAgICAgICAgICAgIGxhdGNoKCk7Ci0gICAgICAgIH0KLQotICAgICAgICBwdWJsaWMgdm9pZCBhZGRWZXJ0ZXgoZmxvYXQgeCwgZmxvYXQgeSwgZmxvYXQgeikgewotICAgICAgICAgICAgaWYgKG1WdHhTaXplICE9IDMpIHsKLSAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJhZGQgbWlzdG1hdGNoIHdpdGggZGVjbGFyZWQgY29tcG9uZW50cy4iKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIG1ha2VTcGFjZSgzKTsKLSAgICAgICAgICAgIG1WdHhEYXRhW21WdHhDb3VudCsrXSA9IHg7Ci0gICAgICAgICAgICBtVnR4RGF0YVttVnR4Q291bnQrK10gPSB5OwotICAgICAgICAgICAgbVZ0eERhdGFbbVZ0eENvdW50KytdID0gejsKLSAgICAgICAgICAgIGxhdGNoKCk7Ci0gICAgICAgIH0KLQotICAgICAgICBwdWJsaWMgdm9pZCBzZXRUZXh0dXJlKGZsb2F0IHMsIGZsb2F0IHQpIHsKLSAgICAgICAgICAgIGlmICgobUZsYWdzICYgVEVYVFVSRV8wKSA9PSAwKSB7Ci0gICAgICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigiYWRkIG1pc3RtYXRjaCB3aXRoIGRlY2xhcmVkIGNvbXBvbmVudHMuIik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBtUzAgPSBzOwotICAgICAgICAgICAgbVQwID0gdDsKLSAgICAgICAgfQotCi0gICAgICAgIHB1YmxpYyB2b2lkIHNldE5vcm1hbChmbG9hdCB4LCBmbG9hdCB5LCBmbG9hdCB6KSB7Ci0gICAgICAgICAgICBpZiAoKG1GbGFncyAmIE5PUk1BTCkgPT0gMCkgewotICAgICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oImFkZCBtaXN0bWF0Y2ggd2l0aCBkZWNsYXJlZCBjb21wb25lbnRzLiIpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgbU5YID0geDsKLSAgICAgICAgICAgIG1OWSA9IHk7Ci0gICAgICAgICAgICBtTlogPSB6OwotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIHZvaWQgc2V0Q29sb3IoZmxvYXQgciwgZmxvYXQgZywgZmxvYXQgYiwgZmxvYXQgYSkgewotICAgICAgICAgICAgaWYgKChtRmxhZ3MgJiBDT0xPUikgPT0gMCkgewotICAgICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oImFkZCBtaXN0bWF0Y2ggd2l0aCBkZWNsYXJlZCBjb21wb25lbnRzLiIpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgbVIgPSByOwotICAgICAgICAgICAgbUcgPSBnOwotICAgICAgICAgICAgbUIgPSBiOwotICAgICAgICAgICAgbUEgPSBhOwotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIHZvaWQgYWRkVHJpYW5nbGUoaW50IGlkeDEsIGludCBpZHgyLCBpbnQgaWR4MykgewotICAgICAgICAgICAgaWYoKGlkeDEgPj0gbVZ0eENvdW50KSB8fCAoaWR4MSA8IDApIHx8Ci0gICAgICAgICAgICAgICAoaWR4MiA+PSBtVnR4Q291bnQpIHx8IChpZHgyIDwgMCkgfHwKLSAgICAgICAgICAgICAgIChpZHgzID49IG1WdHhDb3VudCkgfHwgKGlkeDMgPCAwKSkgewotICAgICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigiSW5kZXggcHJvdmlkZWQgZ3JlYXRlciB0aGFuIHZlcnRleCBjb3VudC4iKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmICgobUluZGV4Q291bnQgKyAzKSA+PSBtSW5kZXhEYXRhLmxlbmd0aCkgewotICAgICAgICAgICAgICAgIHNob3J0IHRbXSA9IG5ldyBzaG9ydFttSW5kZXhEYXRhLmxlbmd0aCAqIDJdOwotICAgICAgICAgICAgICAgIFN5c3RlbS5hcnJheWNvcHkobUluZGV4RGF0YSwgMCwgdCwgMCwgbUluZGV4RGF0YS5sZW5ndGgpOwotICAgICAgICAgICAgICAgIG1JbmRleERhdGEgPSB0OwotICAgICAgICAgICAgfQotICAgICAgICAgICAgbUluZGV4RGF0YVttSW5kZXhDb3VudCsrXSA9IChzaG9ydClpZHgxOwotICAgICAgICAgICAgbUluZGV4RGF0YVttSW5kZXhDb3VudCsrXSA9IChzaG9ydClpZHgyOwotICAgICAgICAgICAgbUluZGV4RGF0YVttSW5kZXhDb3VudCsrXSA9IChzaG9ydClpZHgzOwotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIFNpbXBsZU1lc2ggY3JlYXRlKCkgewotICAgICAgICAgICAgRWxlbWVudC5CdWlsZGVyIGIgPSBuZXcgRWxlbWVudC5CdWlsZGVyKG1SUyk7Ci0gICAgICAgICAgICBpbnQgZmxvYXRDb3VudCA9IG1WdHhTaXplOwotICAgICAgICAgICAgYi5hZGQoRWxlbWVudC5jcmVhdGVBdHRyaWIobVJTLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRWxlbWVudC5EYXRhVHlwZS5GTE9BVF8zMiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEVsZW1lbnQuRGF0YUtpbmQuUE9TSVRJT04sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtVnR4U2l6ZSksICJwb3NpdGlvbiIpOwotICAgICAgICAgICAgaWYgKChtRmxhZ3MgJiBDT0xPUikgIT0gMCkgewotICAgICAgICAgICAgICAgIGZsb2F0Q291bnQgKz0gNDsKLSAgICAgICAgICAgICAgICBiLmFkZChFbGVtZW50LmNyZWF0ZUF0dHJpYihtUlMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRWxlbWVudC5EYXRhVHlwZS5GTE9BVF8zMiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBFbGVtZW50LkRhdGFLaW5kLkNPTE9SLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQpLCAiY29sb3IiKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmICgobUZsYWdzICYgVEVYVFVSRV8wKSAhPSAwKSB7Ci0gICAgICAgICAgICAgICAgZmxvYXRDb3VudCArPSAyOwotICAgICAgICAgICAgICAgIGIuYWRkKEVsZW1lbnQuY3JlYXRlQXR0cmliKG1SUywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBFbGVtZW50LkRhdGFUeXBlLkZMT0FUXzMyLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEVsZW1lbnQuRGF0YUtpbmQuVEVYVFVSRSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyKSwgInRleHR1cmUiKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmICgobUZsYWdzICYgTk9STUFMKSAhPSAwKSB7Ci0gICAgICAgICAgICAgICAgZmxvYXRDb3VudCArPSAzOwotICAgICAgICAgICAgICAgIGIuYWRkKEVsZW1lbnQuY3JlYXRlQXR0cmliKG1SUywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBFbGVtZW50LkRhdGFUeXBlLkZMT0FUXzMyLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEVsZW1lbnQuRGF0YUtpbmQuTk9STUFMLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMpLCAibm9ybWFsIik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBtRWxlbWVudCA9IGIuY3JlYXRlKCk7Ci0KLSAgICAgICAgICAgIEJ1aWxkZXIgc21iID0gbmV3IEJ1aWxkZXIobVJTKTsKLSAgICAgICAgICAgIHNtYi5hZGRWZXJ0ZXhUeXBlKG1FbGVtZW50LCBtVnR4Q291bnQgLyBmbG9hdENvdW50KTsKLSAgICAgICAgICAgIHNtYi5zZXRJbmRleFR5cGUoRWxlbWVudC5jcmVhdGVJbmRleChtUlMpLCBtSW5kZXhDb3VudCk7Ci0gICAgICAgICAgICBzbWIuc2V0UHJpbWl0aXZlKFByaW1pdGl2ZS5UUklBTkdMRSk7Ci0gICAgICAgICAgICBTaW1wbGVNZXNoIHNtID0gc21iLmNyZWF0ZSgpOwotCi0gICAgICAgICAgICBBbGxvY2F0aW9uIHZlcnRleEFsbG9jID0gc20uY3JlYXRlVmVydGV4QWxsb2NhdGlvbigwKTsKLSAgICAgICAgICAgIEFsbG9jYXRpb24gaW5kZXhBbGxvYyA9IHNtLmNyZWF0ZUluZGV4QWxsb2NhdGlvbigpOwotICAgICAgICAgICAgc20uYmluZFZlcnRleEFsbG9jYXRpb24odmVydGV4QWxsb2MsIDApOwotICAgICAgICAgICAgc20uYmluZEluZGV4QWxsb2NhdGlvbihpbmRleEFsbG9jKTsKLQotICAgICAgICAgICAgdmVydGV4QWxsb2MuZGF0YShtVnR4RGF0YSk7Ci0gICAgICAgICAg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AotICAgICAgICAgICAgZm9yKGludCBjdD0wOyBjdCA8IGZpZWxkcy5sZW5ndGg7IGN0KyspIHsKLSAgICAgICAgICAgICAgICBGaWVsZCBmID0gZmllbGRzW2N0XTsKLSAgICAgICAgICAgICAgICBDbGFzcyBmYyA9IGYuZ2V0VHlwZSgpOwotICAgICAgICAgICAgICAgIGlmKGZjID09IGludC5jbGFzcykgewotICAgICAgICAgICAgICAgICAgICBhclR5cGVzW2N0XSA9IEVsZW1lbnQuRGF0YVR5cGUuU0lHTkVEXzMyLm1JRDsKLSAgICAgICAgICAgICAgICAgICAgYXJCaXRzW2N0XSA9IDMyOwotICAgICAgICAgICAgICAgIH0gZWxzZSBpZihmYyA9PSBzaG9ydC5jbGFzcykgewotICAgICAgICAgICAgICAgICAgICBhclR5cGVzW2N0XSA9IEVsZW1lbnQuRGF0YVR5cGUuU0lHTkVEXzE2Lm1JRDsKLSAgICAgICAgICAgICAgICAgICAgYXJCaXRzW2N0XSA9IDE2OwotICAgICAgICAgICAgICAgIH0gZWxzZSBpZihmYyA9PSBieXRlLmNsYXNzKSB7Ci0gICAgICAgICAgICAgICAgICAgIGFyVHlwZXNbY3RdID0gRWxlbWVudC5EYXRhVHlwZS5TSUdORURfOC5tSUQ7Ci0gICAgICAgICAgICAgICAgICAgIGFyQml0c1tjdF0gPSA4OwotICAgICAgICAgICAgICAgIH0gZWxzZSBpZihmYyA9PSBmbG9hdC5jbGFzcykgewotICAgICAgICAgICAgICAgICAgICBhclR5cGVzW2N0XSA9IEVsZW1lbnQuRGF0YVR5cGUuRkxPQVRfMzIubUlEOwotICAgICAgICAgICAgICAgICAgICBhckJpdHNbY3RdID0gMzI7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigiVW5rb3duIGZpZWxkIHR5cGUiKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9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aWdodCwgam9iamVjdCB3bmQpCiB7Ci0gICAgUnNDb250ZXh0IGNvbiA9IChSc0NvbnRleHQpKF9lbnYtPkdldEludEZpZWxkKF90aGlzLCBnQ29udGV4dElkKSk7CiAgICAgTE9HX0FQSSgibkNvbnRleHRTZXRTdXJmYWNlLCBjb24oJXApLCB3aWR0aCglaSksIGhlaWdodCglaSksIHN1cmZhY2UoJXApIiwgY29uLCB3aWR0aCwgaGVpZ2h0LCAoU3VyZmFjZSAqKXduZCk7CiAKICAgICBTdXJmYWNlICogd2luZG93ID0gTlVMTDsKICAgICBpZiAod25kID09IE5VTEwpIHsKIAogICAgIH0gZWxzZSB7Ci0gICAgICAgIGpjbGFzcyBzdXJmYWNlX2NsYXNzID0gX2Vudi0+RmluZENsYXNzKCJhbmRyb2lkL3ZpZXcvU3VyZmFjZSIpOwotICAgICAgICBqZmllbGRJRCBzdXJmYWNlRmllbGRJRCA9IF9lbnYtPkdldEZpZWxkSUQoc3VyZmFjZV9jbGFzcywgQU5EUk9JRF9WSUVXX1NVUkZBQ0VfSk5JX0lELCAiSSIpOwotICAgICAgICB3aW5kb3cgPSAoU3VyZmFjZSopX2Vudi0+R2V0SW50RmllbGQod25kLCBzdXJmYWNlRmllbGRJRCk7CisgICAgICAgIHdpbmRvdyA9IChTdXJmYWNlKikgYW5kcm9pZF9TdXJmYWNlX2dldE5hdGl2ZVdpbmRvdyhfZW52LCB3bmQpLmdldCgpOwogICAgIH0KIAogICAgIHJzQ29udGV4dFNldFN1cmZhY2UoY29uLCB3aWR0aCwgaGVpZ2h0LCB3aW5kb3cpOwogfQogCiBzdGF0aWMgdm9pZAotbkNvbnRleHREZXN0cm95KEpOSUVudiAqX2Vudiwgam9iamVjdCBfdGhpcywgamludCBjb24pCituQ29udGV4dERlc3Ryb3koSk5JRW52ICpfZW52LCBqb2JqZWN0IF90aGlzLCBSc0NvbnRleHQgY29uKQogewotICAgIExPR19BUEkoIm5Db250ZXh0RGVzdHJveSwgY29uKCVwKSIsIChSc0NvbnRleHQpY29uKTsKLSAgICByc0NvbnRleHREZXN0cm95KChSc0NvbnRleHQpY29uKTsKKyAgICBMT0dfQVBJKCJuQ29udGV4dERlc3Ryb3ksIGNvbiglcCkiLCBjb24pOworICAgIHJzQ29udGV4dERlc3Ryb3koY29uKTsKIH0KIAogc3RhdGljIHZvaWQKLW5Db250ZXh0RHVtcChKTklFbnYgKl9lbnYsIGpvYmplY3QgX3RoaXMsIGppbnQgYml0cykKK25Db250ZXh0RHVtcChKTklFbnYgKl9lbnYsIGpvYmplY3QgX3RoaXMsIFJzQ29udGV4dCBjb24sIGppbnQgYml0cykKIHsKLSAgICBSc0NvbnRleHQgY29uID0gKFJzQ29udGV4dCkoX2Vudi0+R2V0SW50RmllbGQoX3RoaXMsIGdDb250ZXh0SWQpKTsKICAgICBMT0dfQVBJKCJuQ29udGV4dER1bXAsIGNvbiglcCkgIGJpdHMoJWkpIiwgKFJzQ29udGV4dCljb24sIGJpdHMpOwogICAgIHJzQ29udGV4dER1bXAoKFJzQ29udGV4dCljb24sIGJpdHMpOwogfQogCiBzdGF0aWMgdm9pZAotbkNvbnRleHRQYXVzZShKTklFbnYgKl9lbnYsIGpvYmplY3QgX3RoaXMpCituQ29udGV4dFBhdXNlKEpOSUVudiAqX2Vudiwgam9iamVjdCBfdGhpcywgUnNDb250ZXh0IGNvbikKIHsKLSAgICBSc0NvbnRleHQgY29uID0gKFJzQ29udGV4dCkoX2Vudi0+R2V0SW50RmllbGQoX3RoaXMsIGdDb250ZXh0SWQpKTsKICAgICBMT0dfQVBJKCJuQ29udGV4dFBhdXNlLCBjb24oJXApIiwgY29uKTsKICAgICByc0NvbnRleHRQYXVzZShjb24pOwogfQogCiBzdGF0aWMgdm9pZAotbkNvbnRleHRSZXN1bWUoSk5JRW52ICpfZW52LCBqb2JqZWN0IF90aGlzKQorbkNvbnRleHRSZXN1bWUoSk5JRW52ICpfZW52LCBqb2JqZWN0IF90aGlzLCBSc0NvbnRleHQgY29uKQogewotICAgIFJzQ29udGV4dCBjb24gPSAoUnNDb250ZXh0KShfZW52LT5HZXRJbnRGaWVsZChfdGhpcywgZ0NvbnRleHRJZCkpOwogICAgIExPR19BUEkoIm5Db250ZXh0UmVzdW1lLCBjb24oJXApIiwgY29uKTsKICAgICByc0NvbnRleHRSZXN1bWUoY29uKTsKIH0KIAogc3RhdGljIGppbnQKLW5Db250ZXh0R2V0TWVzc2FnZShKTklFbnYgKl9lbnYsIGpvYmplY3QgX3RoaXMsIGppbnRBcnJheSBkYXRhLCBqYm9vbGVhbiB3YWl0KQorbkNvbnRleHRHZXRNZXNzYWdlKEpOSUVudiAqX2Vudiwgam9iamVjdCBfdGhpcywgUnNDb250ZXh0IGNvbiwgamludEFycmF5IGRhdGEsIGpib29sZWFuIHdhaXQpCiB7Ci0gICAgUnNDb250ZXh0IGNvbiA9IChSc0NvbnRleHQpKF9lbnYtPkdldEludEZpZWxkKF90aGlzLCBnQ29udGV4dElkKSk7CiAgICAgamludCBsZW4gPSBfZW52LT5HZXRBcnJheUxlbmd0aChkYXRhKTsKICAgICBMT0dfQVBJKCJuQ29udGV4dEdldE1lc3NhZ2UsIGNvbiglcCksIGxlbiglaSkiLCBjb24sIGxlbik7CiAgICAgamludCAqcHRyID0gX2Vudi0+R2V0SW50QXJyYXlFbGVtZW50cyhkYXRhLCBOVUxMKTsKQEAgLTIzOSwzNCArMjM0LDMwIEBACiAgICAgcmV0dXJuIGlkOwogfQogCi1zdGF0aWMgdm9pZCBuQ29udGV4dEluaXRUb0NsaWVudChKTklFbnYgKl9lbnYsIGpvYmplY3QgX3RoaXMpCitzdGF0aWMgdm9pZCBuQ29udGV4dEluaXRUb0NsaWVudChKTklFbnYgKl9lbnYsIGpvYmplY3QgX3RoaXMsIFJzQ29udGV4dCBjb24pCiB7Ci0gICAgUnNDb250ZXh0IGNvbiA9IChSc0NvbnRleHQpKF9lbnYtPkdldEludEZpZWxkKF90aGlzLCBnQ29udGV4dElkKSk7CiAgICAgTE9HX0FQSSgibkNvbnRleHRJbml0VG9DbGllbnQsIGNvbiglcCkiLCBjb24pOwogICAgIHJzQ29udGV4dEluaXRUb0NsaWVudChjb24pOwogfQogCi1zdGF0aWMgdm9pZCBuQ29udGV4dERlaW5pdFRvQ2xpZW50KEpOSUVudiAqX2Vudiwgam9iamVjdCBfdGhpcykKK3N0YXRpYyB2b2lkIG5Db250ZXh0RGVpbml0VG9DbGllbnQoSk5JRW52ICpfZW52LCBqb2JqZWN0IF90aGlzLCBSc0NvbnRleHQgY29uKQogewotICAgIFJzQ29udGV4dCBjb24gPSAoUnNDb250ZXh0KShfZW52LT5HZXRJbnRGaWVsZChfdGhpcywgZ0NvbnRleHRJZCkpOwogICAgIExPR19BUEkoIm5Db250ZXh0RGVpbml0VG9DbGllbnQsIGNvbiglcCkiLCBjb24pOwogICAgIHJzQ29udGV4dERlaW5pdFRvQ2xpZW50KGNvbik7CiB9CiAKIAogc3RhdGljIGppbnQKLW5FbGVtZW50Q3JlYXRlKEpOSUVudiAqX2Vudiwgam9iamVjdCBfdGhpcywgamludCB0eXBlLCBqaW50IGtpbmQsIGpib29sZWFuIG5vcm0sIGppbnQgc2l6ZSkKK25FbGVtZW50Q3JlYXRlKEpOSUVudiAqX2Vudiwgam9iamVjdCBfdGhpcywgUnNDb250ZXh0IGNvbiwgamludCB0eXBlLCBqaW50IGtpbmQsIGpib29sZWFuIG5vcm0sIGppbnQgc2l6ZSkKIHsKLSAgICBSc0NvbnRleHQgY29uID0gKFJzQ29udGV4dCkoX2Vudi0+R2V0SW50RmllbGQoX3RoaXMsIGdDb250ZXh0SWQpKTsKICAgICBMT0dfQVBJKCJuRWxlbWVudENyZWF0ZSwgY29uKCVwKSwgdHlwZSglaSksIGtpbmQoJWkpLCBub3JtKCVpKSwgc2l6ZSglaSkiLCBjb24sIHR5cGUsIGtpbmQsIG5vcm0sIHNpemUpOwogICAgIHJldHVybiAoamludClyc0VsZW1lbnRDcmVhdGUoY29uLCAoUnNEYXRhVHlwZSl0e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worCisgICAgdWludDMyX3QgZWxlbWVudERhdGFbNV07CisgICAgcnNFbGVtZW50R2V0TmF0aXZlRGF0YShjb24sIChSc0VsZW1lbnQpaWQsIGVsZW1lbnREYXRhLCBkYXRhU2l6ZSk7CisKKyAgICBmb3IoamludCBpID0gMDsgaSA8IGRhdGFTaXplOyBpICsrKSB7CisgICAgICAgIF9lbnYtPlNldEludEFycmF5UmVnaW9uKF9lbGVtZW50RGF0YSwgaSwgMSwgKGNvbnN0IGppbnQqKSZlbGVtZW50RGF0YVtpXSk7CisgICAgfQorfQorCisKK3N0YXRpYyB2b2lkCituRWxlbWVudEdldFN1YkVsZW1lbnRzKEpOSUVudiAqX2Vudiwgam9iamVjdCBfdGhpcywgUnNDb250ZXh0IGNvbiwgamludCBpZCwgamludEFycmF5IF9JRHMsIGpvYmplY3RBcnJheSBfbmFtZXMpCit7CisgICAgaW50IGRhdGFTaXplID0gX2Vudi0+R2V0QXJyYXlMZW5ndGgoX0lEcyk7CisgICAgTE9HX0FQSSgibkVsZW1lbnRHZXRTdWJFbGVtZW50cywgY29uKCVwKSIsIGNvbik7CisKKyAgICB1aW50MzJfdCAqaWRzID0gKHVpbnQzMl90ICopbWFsbG9jKCh1aW50MzJfdClkYXRhU2l6ZSAqIHNpemVvZih1aW50MzJfdCkpOworICAgIGNvbnN0IGNoYXIgKipuYW1lcyA9IChjb25zdCBjaGFyICoqKW1hbGxvYygodWludDMyX3QpZGF0YVNpemUgKiBzaXplb2YoY29uc3QgY2hhciAqKSk7CisKKyAgICByc0VsZW1lbnRHZXRTdWJFbGVtZW50cyhjb24sIChSc0VsZW1lbnQpaWQsIGlkcywgbmFtZXMsICh1aW50MzJfdClkYXRhU2l6ZSk7CisKKyAgICBmb3IoamludCBpID0gMDsgaSA8IGRhdGFTaXplOyBpICsrKSB7CisgICAgICAgIF9lbnYtPlNldE9iamVjdEFycmF5RWxlbWVudChfbmFtZXMsIGksIF9lbnYtPk5ld1N0cmluZ1VURihuYW1lc1tpXSkpOworICAgICAgICBfZW52LT5TZXRJbnRBcnJheVJlZ2lvbihfSURzLCBpLCAxLCAoY29uc3QgamludCopJmlkc1tpXSk7CisgICAgfQorCisgICAgZnJlZShpZHMpOworICAgIGZyZWUobmFtZXMpOworfQorCiAvLyAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQogCiBzdGF0aWMgdm9pZAotblR5cGVCZWdpbihKTklFbnYgKl9lbnYsIGpvYmplY3QgX3RoaXMsIGppbnQgZUlEKQorblR5cGVCZWdpbihKTklFbnYgKl9lbnYsIGpvYmplY3QgX3RoaXMsIFJzQ29udGV4dCBjb24sIGppbnQgZUlEKQogewotICAgIFJzQ29udGV4dCBjb24gPSAoUnNDb250ZXh0KShfZW52LT5HZXRJbnRGaWVsZChfdGhpcywgZ0NvbnRleHRJZCkpOwogICAgIExPR19BUEkoIm5UeXBlQmVnaW4sIGNvbiglcCkgZSglcCkiLCBjb24sIChSc0VsZW1lbnQpZUlEKTsKICAgICByc1R5cGVCZWdpbihjb24sIChSc0VsZW1lbnQpZUlEKTsKIH0KIAogc3RhdGljIHZvaWQKLW5UeXBlQWRkKEpOSUVudiAqX2Vudiwgam9iamVjdCBfdGhpcywgamludCBkaW0sIGppbnQgdmFsKQorblR5cGVBZGQoSk5JRW52ICpfZW52LCBqb2JqZWN0IF90aGlzLCBSc0NvbnRleHQgY29uLCBqaW50IGRpbSwgamludCB2YWwpCiB7Ci0gICAgUnNDb250ZXh0IGNvbiA9IChSc0NvbnRleHQpKF9lbnYtPkdldEludEZpZWxkKF90aGlzLCBnQ29udGV4dElkKSk7CiAgICAgTE9HX0FQSSgiblR5cGVBZGQsIGNvbiglcCkgZGltKCVpKSwgdmFsKCVpKSIsIGNvbiwgZGltLCB2YWwpOwogICAgIHJzVHlwZUFkZChjb24sIChSc0RpbWVuc2lvbilkaW0sIHZhbCk7CiB9CiAKIHN0YXRpYyBqaW50Ci1uVHlwZUNyZWF0ZShKTklFbnYgKl9lbnYsIGpvYmplY3QgX3RoaXMpCituVHlwZUNyZWF0ZShKTklFbnYgKl9lbnYsIGpvYmplY3QgX3RoaXMsIFJzQ29udGV4dCBjb24pCiB7Ci0gICAgUnNDb250ZXh0IGNvbiA9IChSc0NvbnRleHQpKF9lbnYtPkdldEludEZpZWxkKF90aGlzLCBnQ29udGV4dElkKSk7CiAgICAgTE9HX0FQSSgiblR5cGVDcmVhdGUsIGNvbiglcCkiLCBjb24pOwogICAgIHJldHVybiAoamludClyc1R5cGVDcmVhdGUoY29uKTsKIH0KIAorc3RhdGljIHZvaWQKK25UeXBlR2V0TmF0aXZlRGF0YShKTklFbnYgKl9lbnYsIGpvYmplY3QgX3RoaXMsIFJzQ29udGV4dCBjb24sIGppbnQgaWQsIGppbnRBcnJheSBfdHlwZURhdGEpCit7CisgICAgLy8gV2UgYXJlIHBhY2tpbmcgNiBpdGVtczogbURpbVg7IG1EaW1ZOyBtRGltWjsKKyAgICAvLyBtRGltTE9EOyBtRGltRmFjZXM7IG1FbGVtZW50OyBpbnRvIHR5cGVEYXRhCisgICAgaW50IGVsZW1lbnRDb3VudCA9IF9lbnYtPkdldEFycmF5TGVuZ3RoKF90eXBlRGF0YSk7CisKKyAgICBhc3NlcnQoZWxlbWVudENvdW50ID09IDYpOworICAgIExPR19BUEkoIm5UeXBlQ3JlYXRlLCBjb24oJXApIiwgY29uKTsKKworICAgIHVpbnQzMl90IHR5cGVEYXRhWzZdOworICAgIHJzVHlwZUdldE5hdGl2ZURhdGEoY29uLCAoUnNUeXBlKWlkLCB0eXBlRGF0YSwgNik7CisKKyAgICBmb3IoamludCBpID0gMDsgaSA8IGVsZW1lbnRDb3VudDsgaSArKykgeworICAgICAgICBfZW52LT5TZXRJbnRBcnJheVJlZ2lvbihfdHlwZURhdGEsIGksIDEsIChjb25zdCBqaW50KikmdHlwZURhdGFbaV0pOworICAgIH0KK30KKwogc3RhdGljIHZvaWQgKiBTRl9Mb2FkSW50KEpOSUVudiAqX2Vudiwgam9iamV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dldEJ1ZmZlcihmYWxzZSksIGFzc2V0LT5nZXRMZW5ndGgoKSk7CisgICAgcmV0dXJuIGlkOworfQorCitzdGF0aWMgaW50CituRmlsZUEzREdldE51bUluZGV4RW50cmllcyhKTklFbnYgKl9lbnYsIGpvYmplY3QgX3RoaXMsIFJzQ29udGV4dCBjb24sIGppbnQgZmlsZUEzRCkKK3sKKyAgICBpbnQzMl90IG51bUVudHJpZXMgPSAwOworICAgIHJzRmlsZUEzREdldE51bUluZGV4RW50cmllcyhjb24sICZudW1FbnRyaWVzLCAoUnNGaWxlKWZpbGVBM0QpOworICAgIHJldHVybiBudW1FbnRyaWVzOworfQorCitzdGF0aWMgdm9pZAorbkZpbGVBM0RHZXRJbmRleEVudHJpZXMoSk5JRW52ICpfZW52LCBqb2JqZWN0IF90aGlzLCBSc0NvbnRleHQgY29uLCBqaW50IGZpbGVBM0QsIGppbnQgbnVtRW50cmllcywgamludEFycmF5IF9pZHMsIGpvYmplY3RBcnJheSBfZW50cmllcykKK3sKKyAgICBMT0dWKCJfX19fX19uRmlsZUEzRCAldSIsICh1aW50MzJfdCkgZmlsZUEzRCk7CisgICAgUnNGaWxlSW5kZXhFbnRyeSAqZmlsZUVudHJpZXMgPSAoUnNGaWxlSW5kZXhFbnRyeSopbWFsbG9jKCh1aW50MzJfdCludW1FbnRyaWVzICogc2l6ZW9mKFJzRmlsZUluZGV4RW50cnkpKTsKKworICAgIHJzRmlsZUEzREdldEluZGV4RW50cmllcyhjb24sIGZpbGVFbnRyaWVzLCAodWludDMyX3QpbnVtRW50cmllcywgKFJzRmlsZSlmaWxlQTNEKTsKKworICAgIGZvcihqaW50IGkgPSAwOyBpIDwgbnVtRW50cmllczsgaSArKykgeworICAgICAgICBfZW52LT5TZXRPYmplY3RBcnJheUVsZW1lbnQoX2VudHJpZXMsIGksIF9lbnYtPk5ld1N0cmluZ1VURihmaWxlRW50cmllc1tpXS5vYmplY3ROYW1lKSk7CisgICAgICAgIF9lbnYtPlNldEludEFycmF5UmVnaW9uKF9pZHMsIGksIDEsIChjb25zdCBqaW50KikmZmlsZUVudHJpZXNbaV0uY2xhc3NJRCk7CisgICAgfQorCisgICAgZnJlZShmaWxlRW50cmllcyk7Cit9CisKK3N0YXRpYyBpbnQKK25GaWxlQTNER2V0RW50cnlCeUluZGV4KEpOSUVudiAqX2Vudiwgam9iamVjdCBfdGhpcywgUnNDb250ZXh0IGNvbiwgamludCBmaWxlQTNELCBqaW50IGluZGV4KQoreworICAgIExPR1YoIl9fX19fX25GaWxlQTNEICV1IiwgKHVpbnQzMl90KSBmaWxlQTNEKTsKKyAgICBqaW50IGlkID0gKGppbnQpcnNGaWxlQTNER2V0RW50cnlCeUluZGV4KGNvbiwgKHVpbnQzMl90KWluZGV4LCAoUnNGaWxlKWZpbGVBM0QpOworICAgIHJldHVybiBpZDsKK30KKworLy8gLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0KKworc3RhdGljIGludAorbkZvbnRDcmVhdGVGcm9tRmlsZShKTklFbnYgKl9lbnYsIGpvYmplY3QgX3RoaXMsIFJzQ29udGV4dCBjb24sIGpzdHJpbmcgZmlsZU5hbWUsIGppbnQgZm9udFNpemUsIGppbnQgZHBpKQoreworICAgIGNvbnN0IGNoYXIqIGZpbGVOYW1lVVRGID0gX2Vudi0+R2V0U3RyaW5nVVRGQ2hhcnMoZmlsZU5hbWUsIE5VTEwpOworCisgICAgamludCBpZCA9IChqaW50KXJzRm9udENyZWF0ZUZyb21GaWxlKGNvbiwgZmlsZU5hbWVVVEYsIGZvbnRTaXplLCBkcGkpOworICAgIHJldHVybiBpZDsKK30KKwogCiAvLyAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQogCiBzdGF0aWMgdm9pZAotbkFkYXB0ZXIxREJpbmRBbGxvY2F0aW9uKEpOSUVudiAqX2Vudiwgam9iamVjdCBfdGhpcywgamludCBhZGFwdGVyLCBqaW50IGFsbG9jKQorbkFkYXB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lciwgKFJzRGltZW5zaW9uKWRpbSwgdmFsdWUpOwogfQogCiBzdGF0aWMgdm9pZAotbkFkYXB0ZXIxRERhdGFfaShKTklFbnYgKl9lbnYsIGpvYmplY3QgX3RoaXMsIGppbnQgYWRhcHRlciwgamludEFycmF5IGRhdGEpCituQWRhcHRlcjFERGF0YV9pKEpOSUVudiAqX2Vudiwgam9iamVjdCBfdGhpcywgUnNDb250ZXh0IGNvbiwgamludCBhZGFwdGVyLCBqaW50QXJyYXkgZGF0YSkKIHsKLSAgICBSc0NvbnRleHQgY29uID0gKFJzQ29udGV4dCkoX2Vudi0+R2V0SW50RmllbGQoX3RoaXMsIGdDb250ZXh0SWQpKTsKICAgICBqaW50IGxlbiA9IF9lbnYtPkdldEFycmF5TGVuZ3RoKGRhdGEpOwogICAgIExPR19BUEkoIm5BZGFwdGVyMUREYXRhX2ksIGNvbiglcCksIGFkYXB0ZXIoJXApLCBsZW4oJWkpIiwgY29uLCAoUnNBZGFwdGVyMUQpYWRhcHRlciwgbGVuKTsKICAgICBqaW50ICpwdHIgPSBfZW52LT5HZXRJbnRBcnJheUVsZW1lbnRzKGRhdGEsIE5VTEwpOwpAQCAtNzMxLDkgKzgxNyw4IEBACiB9CiAKIHN0YXRpYyB2b2lkCi1uQWRhcHRlcjFEU3ViRGF0YV9pKEpOSUVudiAqX2Vudiwgam9iamVjdCBfdGhpcywgamludCBhZGFwdGVyLCBqaW50IG9mZnNldCwgamludCBjb3VudCwgamludEFycmF5IGRhdGEpCituQWRhcHRlcjFEU3ViRGF0YV9pKEpOSUVudiAqX2Vudiwgam9iamVjdCBfdGhpcywgUnNDb250ZXh0IGNvbiwgamludCBhZGFwdGVyLCBqaW50IG9mZnNldCwgamludCBjb3VudCwgamludEFycmF5IGRhdGEpCiB7Ci0gICAgUnNDb250ZXh0IGNvbiA9IChSc0NvbnRleHQpKF9lbnYtPkdldEludEZpZWxkKF90aGlzLCBnQ29udGV4dElkKSk7CiAgICAgamludCBsZW4gPSBfZW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Wxsb2MoJXApIiwgY29uLCAoUnNNZXNoKW1lc2gsIChSc0FsbG9jYXRpb24pYWxsb2MpOworICAgIHJzTWVzaEJpbmRJbmRleChjb24sIChSc01lc2gpbWVzaCwgKFJzQWxsb2NhdGlvbilhbGxvYywgcHJpbUlELCBzbG90KTsKK30KKworc3RhdGljIGppbnQKK25NZXNoR2V0VmVydGV4QnVmZmVyQ291bnQoSk5JRW52ICpfZW52LCBqb2JqZWN0IF90aGlzLCBSc0NvbnRleHQgY29uLCBqaW50IG1lc2gpCit7CisgICAgTE9HX0FQSSgibk1lc2hHZXRWZXJ0ZXhCdWZmZXJDb3VudCwgY29uKCVwKSwgTWVzaCglcCkiLCBjb24sIChSc01lc2gpbWVzaCk7CisgICAgamludCB2dHhDb3VudCA9IDA7CisgICAgcnNNZXNoR2V0VmVydGV4QnVmZmVyQ291bnQoY29uLCAoUnNNZXNoKW1lc2gsICZ2dHhDb3VudCk7CisgICAgcmV0dXJuIHZ0eENvdW50OworfQorCitzdGF0aWMgamludAorbk1lc2hHZXRJbmRleENvdW50KEpOSUVudiAqX2Vudiwgam9iamVjdCBfdGhpcywgUnNDb250ZXh0IGNvbiwgamludCBtZXNoKQoreworICAgIExPR19BUEkoIm5NZXNoR2V0SW5kZXhDb3VudCwgY29uKCVwKSwgTWVzaCglcCkiLCBjb24sIChSc01lc2gpbWVzaCk7CisgICAgamludCBpZHhDb3VudCA9IDA7CisgICAgcnNNZXNoR2V0SW5kZXhDb3VudChjb24sIChSc01lc2gpbWVzaCwgJmlkeENvdW50KTsKKyAgICByZXR1cm4gaWR4Q291bnQ7Cit9CisKK3N0YXRpYyB2b2lkCituTWVzaEdldFZlcnRpY2VzKEpOSUVudiAqX2Vudiwgam9iamVjdCBfdGhpcywgUnNDb250ZXh0IGNvbiwgamludCBtZXNoLCBqaW50QXJyYXkgX2lkcywgaW50IG51bVZ0eElEcykKK3sKKyAgICBMT0dfQVBJKCJuTWVzaEdldFZlcnRpY2VzLCBjb24oJXApLCBNZXNoKCVwKSIsIGNvbiwgKFJzTWVzaCltZXNoKTsKKworICAgIFJzQWxsb2NhdGlvbiAqYWxsb2NzID0gKFJzQWxsb2NhdGlvbiopbWFsbG9jKCh1aW50MzJfdCludW1WdHhJRHMgKiBzaXplb2YoUnNBbGxvY2F0aW9uKSk7CisgICAgcnNNZXNoR2V0VmVydGljZXMoY29uLCAoUnNNZXNoKW1lc2gsIGFsbG9jcywgKHVpbnQzMl90KW51bVZ0eElEcyk7CisKKyAgICBmb3IoamludCBpID0gMDsgaSA8IG51bVZ0eElEczsgaSArKykgeworICAgICAgICBfZW52LT5TZXRJbnRBcnJheVJlZ2lvbihfaWRzLCBpLCAxLCAoY29uc3QgamludCopJmFsbG9jc1tpXSk7CisgICAgfQorCisgICAgZnJlZShhbGxvY3MpOworfQorCitzdGF0aWMgdm9pZAorbk1lc2hHZXRJbmRpY2VzKEpOSUVudiAqX2Vudiwgam9iamVjdCBfdGhpcywgUnNDb250ZXh0IGNvbiwgamludCBtZXNoLCBqaW50QXJyYXkgX2lkeElkcywgamludEFycmF5IF9wcmltaXRpdmVzLCBpbnQgbnVtSW5kaWNlcykKK3sKKyAgICBMT0dfQVBJKCJuTWVzaEdldFZlcnRpY2VzLCBjb24oJXApLCBNZXNoKCVwKSIsIGNvbiwgKFJzTWVzaCltZXNoKTsKKworICAgIFJzQWxsb2NhdGlvbiAqYWxsb2NzID0gKFJzQWxsb2NhdGlvbiopbWFsbG9jKCh1aW50MzJfdCludW1JbmRpY2VzICogc2l6ZW9mKFJzQWxsb2NhdGlvbikpOworICAgIHVpbnQzMl90ICpwcmltcz0gKHVpbnQzMl90KiltYWxsb2MoKHVpbnQzMl90KW51bUluZGljZXMgKiBzaXplb2YodWludDMyX3QpKTsKKworICAgIHJzTWVzaEdldEluZGljZXMoY29uLCAoUnNNZXNoKW1lc2gsIGFsbG9jcywgcHJpbXMsICh1aW50MzJfdCludW1JbmRpY2VzKTsKKworICAgIGZvcihqaW50IGkgPSAwOyBpIDwgbnVtSW5kaWNlczsgaSArKykgeworICAgICAgICBfZW52LT5TZXRJbnRBcnJheVJlZ2lvbihfaWR4SWRzLCBpLCAxLCAoY29uc3QgamludCopJmFsbG9jc1tpXSk7CisgICAgICAgIF9lbnYtPlNldEludEFycmF5UmVnaW9uKF9wcmltaXRpdmVzLCBpLCAxLCAoY29uc3QgamludCopJnByaW1zW2ldKTsKKyAgICB9CisKKyAgICBmcmVlKGFsbG9jcyk7CisgICAgZnJlZShwcmltcyk7CiB9CiAKIC8vIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQpAQCAtMTM1OSwxMjQgKzEzNTAsMTMyIEBACiB7Im5EZXZpY2VDcmVhdGUiLCAgICAgICAgICAgICAgICAgICIoKUkiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkRldmljZUNyZWF0ZSB9LAogeyJuRGV2aWNlRGVzdHJveSIsICAgICAgICAgICAgICAgICAiKEkpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5EZXZpY2VEZXN0cm95IH0sCiB7Im5EZXZpY2VTZXRDb25maWciLCAgICAgICAgICAgICAgICIoSUlJKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkRldmljZVNldENvbmZpZyB9LAoteyJuQ29udGV4dENyZWF0ZSIsICAgICAgICAgICAgICAgICAiKElJKUkiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5Db250ZXh0Q3JlYXRlIH0sCi17Im5Db250ZXh0Q3JlYXRlR0wiLCAgICAgICAgICAgICAgICIoSUlaKUkiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkNvbnRleHRDcmVhdGVHTCB9LAoteyJuQ29udGV4dFNldFByaW9yaXR5IiwgICAgICAgICAgICAiKEkpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5Db250ZXh0U2V0UHJpb3JpdHkgfSwKLXsibkNvbnRleHRTZXRTdXJmYWNlIiwgICAgICAgICAgICAgIihJSUxhbmRyb2lkL3ZpZXcvU3VyZmFjZTspViIsICAgICAgICAgICh2b2lkKiluQ29udGV4dFNldFN1cmZhY2UgfSwKLXsibkNvbnRleHREZXN0cm95IiwgICAgICAgICAgICAgICAgIihJKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluQ29udGV4dERlc3Ryb3kgfSwKLXsibkNvbnRleHREdW1wIiwgICAgICAgICAgICAgICAgICAgIihJKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluQ29udGV4dER1bXAgfSwKLXsibkNvbnRleHRQYXVzZSIsICAgICAgICAgICAgICAgICAgIigpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluQ29udGV4dFBhdXNlIH0sCi17Im5Db250ZXh0UmVzdW1lIiwgICAgICAgICAgICAgICAgICIoKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkNvbnRleHRSZXN1bWUgfSwKLXsibkFzc2lnbk5hbWUiLCAgICAgICAgICAgICAgICAgICAgIihJW0IpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluQXNzaWduTmFtZSB9LAoteyJuT2JqRGVzdHJveSIsICAgICAgICAgICAgICAgICAgICAiKEkpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5PYmpEZXN0cm95IH0sCi17Im5PYmpEZXN0cm95T09CIiwgICAgICAgICAgICAgICAgICIoSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbk9iakRlc3Ryb3lPT0IgfSwKLXsibkNvbnRleHRHZXRNZXNzYWdlIiwgICAgICAgICAgICAgIihbSVopSSIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluQ29udGV4dEdldE1lc3NhZ2UgfSwKLXsibkNvbnRleHRJbml0VG9DbGllbnQiLCAgICAgICAgICAgIigpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluQ29udGV4dEluaXRUb0NsaWVudCB9LAoteyJuQ29udGV4dERlaW5pdFRvQ2xpZW50IiwgICAgICAgICAiKClWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5Db250ZXh0RGVpbml0VG9DbGllbnQgfSwKK3sibkNvbnRleHRHZXRNZXNzYWdlIiwgICAgICAgICAgICAgIihJW0laKUkiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkNvbnRleHRHZXRNZXNzYWdlIH0sCit7Im5Db250ZXh0SW5pdFRvQ2xpZW50IiwgICAgICAgICAgICIoSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5Db250ZXh0SW5pdFRvQ2xpZW50IH0sCit7Im5Db250ZXh0RGVpbml0VG9DbGllbnQiLCAgICAgICAgICIoSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5Db250ZXh0RGVpbml0VG9DbGllbnQgfSwKIAoteyJuRmlsZU9wZW4iLCAgICAgICAgICAgICAgICAgICAgICAiKFtCKUkiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5GaWxlT3BlbiB9LAogCi17Im5FbGVtZW50Q3JlYXRlIiwgICAgICAgICAgICAgICAgICIoSUlaSSlJIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkVsZW1lbnRDcmVhdGUgfSwKLXsibkVsZW1lbnRDcmVhdGUyIiwgICAgICAgICAgICAgICAgIihbSVtMamF2YS9sYW5nL1N0cmluZzspSSIsICAgICAgICAgICAgICh2b2lkKiluRWxlbWVudENyZWF0ZTIgfSwKKy8vIEFsbCBtZXRob2RzIGJlbG93IGFyZSB0aHJlYWQgcHJvdGVjdGVkIGluIGphdmEuCit7InJzbkNvbnRleHRDcmVhdGUiLCAgICAgICAgICAgICAgICAgIihJSSlJIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluQ29udGV4dENyZWF0ZSB9LAoreyJyc25Db250ZXh0Q3JlYXRlR0wiLCAgICAgICAgICAgICAgICIoSUlaKUkiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkNvbnRleHRDcmVhdGVHTCB9LAoreyJyc25Db250ZXh0RmluaXNoIiwgICAgICAgICAgICAgICAgICIoSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5Db250ZXh0RmluaXNoIH0sCit7InJzbkNvbnRleHRTZXRQcmlvcml0eSIsICAgICAgICAgICAgIihJSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkNvbnRleHRTZXRQcmlvcml0eSB9LAoreyJyc25Db250ZXh0U2V0U3VyZmFjZSIsICAgICAgICAgICAgICIoSUlJTGFuZHJvaWQvdmlldy9TdXJmYWNlOylWIiwgICAgICAgICAgKHZvaWQqKW5Db250ZXh0U2V0U3VyZmFjZSB9LAoreyJyc25Db250ZXh0RGVzdHJveSIsICAgICAgICAgICAgICAgICIoSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkNvbnRleHREZXN0cm95IH0sCit7InJzbkNvbnRleHREdW1wIiwgICAgICAgICAgICAgICAgICAgIihJSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkNvbnRleHREdW1wIH0sCit7InJzbkNvbnRleHRQYXVzZSIsICAgICAgICAgICAgICAgICAgIihJKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkNvbnRleHRQYXVzZSB9LAoreyJyc25Db250ZXh0UmVzdW1lIiwgICAgICAgICAgICAgICAgICIoSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5Db250ZXh0UmVzdW1lIH0sCit7InJzbkFzc2lnbk5hbWUiLCAgICAgICAgICAgICAgICAgICAgIihJSVtCKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkFzc2lnbk5hbWUgfSwKK3sicnNuR2V0TmFtZSIsICAgICAgICAgICAgICAgICAgICAgICAiKElJKUxqYXZhL2xhbmcvU3RyaW5nOyIsICAgICAgICAgICAgICAgKHZvaWQqKW5HZXROYW1lIH0sCit7InJzbk9iakRlc3Ryb3kiLCAgICAgICAgICAgICAgICAgICAgIihJSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbk9iakRlc3Ryb3kgfSwKIAoteyJuVHlwZUJlZ2luIiwgICAgICAgICAgICAgICAgICAgICAiKEkpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5UeXBlQmVnaW4gfSwKLXsiblR5cGVBZGQiLCAgICAgICAgICAgICAgICAgICAgICAgIihJSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluVHlwZUFkZCB9LAoteyJuVHlwZUNyZWF0ZSIsICAgICAgICAgICAgICAgICAgICAiKClJIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5UeXBlQ3JlYXRlIH0sCi17Im5UeXBlRmluYWxEZXN0cm95IiwgICAgICAgICAgICAgICIoTGFuZHJvaWQvcmVuZGVyc2NyaXB0L1R5cGU7KVYiLCAgICAgICAodm9pZCopblR5cGVGaW5hbERlc3Ryb3kgfSwKLXsiblR5cGVTZXR1cEZpZWxkcyIsICAgICAgICAgICAgICAgIihMYW5kcm9pZC9yZW5kZXJzY3JpcHQvVHlwZTtbSVtJW0xqYXZhL2xhbmcvcmVmbGVjdC9GaWVsZDspViIsICh2b2lkKiluVHlwZVNldHVwRmllbGRzIH0sCit7InJzbkZpbGVPcGVuIiwgICAgICAgICAgICAgICAgICAgICAgIihJW0IpSSIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkZpbGVPcGVuIH0sCit7InJzbkZpbGVBM0RDcmVhdGVGcm9tQXNzZXRTdHJlYW0iLCAgIihJSSlJIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkZpbGVBM0RDcmVhdGVGcm9tQXNzZXRTdHJlYW0gfSwKK3sicnNuRmlsZUEzREdldE51bUluZGV4RW50cmllcyIsICAgICAiKElJKUkiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluRmlsZUEzREdldE51bUluZGV4RW50cmllcyB9LAoreyJyc25GaWxlQTNER2V0SW5kZXhFbnRyaWVzIiwgICAgICAgICIoSUlJW0lbTGphdmEvbGFuZy9TdHJpbmc7KVYiLCAgICAgICAgICAodm9pZCopbkZpbGVBM0RHZXRJbmRleEVudHJpZXMgfSwKK3sicnNuRmlsZUEzREdldEVudHJ5QnlJbmRleCIsICAgICAgICAiKElJSSlJIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluRmlsZUEzREdldEVudHJ5QnlJbmRleCB9LAogCi17Im5BbGxvY2F0aW9uQ3JlYXRlVHlwZWQiLCAgICAgICAgICIoSSlJIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkFsbG9jYXRpb25DcmVhdGVUeXBlZCB9LAoteyJuQWxsb2NhdGlvbkNyZWF0ZUZyb21CaXRtYXAiLCAgICAiKElaTGFuZHJvaWQvZ3JhcGhpY3MvQml0bWFwOylJIiwgICAgICAgKHZvaWQqKW5BbGxvY2F0aW9uQ3JlYXRlRnJvbUJpdG1hcCB9LAoteyJuQWxsb2NhdGlvbkNyZWF0ZUJpdG1hcFJlZiIsICAgICAiKElMYW5kcm9pZC9ncmFwaGljcy9CaXRtYXA7KUkiLCAgICAgICAgKHZvaWQqKW5BbGxvY2F0aW9uQ3JlYXRlQml0bWFwUmVmIH0sCi17Im5BbGxvY2F0aW9uQ3JlYXRlRnJvbUJpdG1hcEJveGVkIiwiKElaTGFuZHJvaWQvZ3JhcGhpY3MvQml0bWFwOylJIiwgICAgICAodm9pZCopbkFsbG9jYXRpb25DcmVhdGVGcm9tQml0bWFwQm94ZWQgfSwKLXsibkFsbG9jYXRpb25DcmVhdGVGcm9tQXNzZXRTdHJlYW0iLCIoSVpJKUkiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluQWxsb2NhdGlvbkNyZWF0ZUZyb21Bc3NldFN0cmVhbSB9LAoteyJuQWxsb2NhdGlvblVwbG9hZFRvVGV4dHVyZSIsICAgICAiKElaSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5BbGxvY2F0aW9uVXBsb2FkVG9UZXh0dXJlIH0sCi17Im5BbGxvY2F0aW9uVXBsb2FkVG9CdWZmZXJPYmplY3QiLCIoSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkFsbG9jYXRpb25VcGxvYWRUb0J1ZmZlck9iamVjdCB9LAoteyJuQWxsb2NhdGlvblN1YkRhdGExRCIsICAgICAgICAgICAiKElJSVtJSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5BbGxvY2F0aW9uU3ViRGF0YTFEX2kgfSwKLXsibkFsbG9jYXRpb25TdWJEYXRhMUQiLCAgICAgICAgICAgIihJSUlbU0kpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluQWxsb2NhdGlvblN1YkRhdGExRF9zIH0sCi17Im5BbGxvY2F0aW9uU3ViRGF0YTFEIiwgICAgICAgICAgICIoSUlJW0JJKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkFsbG9jYXRpb25TdWJEYXRhMURfYiB9LAoteyJuQWxsb2NhdGlvblN1YkRhdGExRCIsICAgICAgICAgICAiKElJSVtGSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5BbGxvY2F0aW9uU3ViRGF0YTFEX2YgfSwKLXsibkFsbG9jYXRpb25TdWJEYXRhMkQiLCAgICAgICAgICAgIihJSUlJSVtJSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluQWxsb2NhdGlvblN1YkRhdGEyRF9pIH0sCi17Im5BbGxvY2F0aW9uU3ViRGF0YTJEIiwgICAgICAgICAgICIoSUlJSUlbRkkpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkFsbG9jYXRpb25TdWJEYXRhMkRfZiB9LAoteyJuQWxsb2NhdGlvblJlYWQiLCAgICAgICAgICAgICAgICAiKElbSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5BbGxvY2F0aW9uUmVhZF9pIH0sCi17Im5BbGxvY2F0aW9uUmVhZCIsICAgICAgICAgICAgICAgICIoSVtGKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkFsbG9jYXRpb25SZWFkX2YgfSwKLXsibkFsbG9jYXRpb25TdWJEYXRhRnJvbU9iamVjdCIsICAgIihJTGFuZHJvaWQvcmVuZGVyc2NyaXB0L1R5cGU7SUxqYXZhL2xhbmcvT2JqZWN0OylWIiwgICAodm9pZCopbkFsbG9jYXRpb25TdWJEYXRhRnJvbU9iamVjdCB9LAoteyJuQWxsb2NhdGlvblN1YlJlYWRGcm9tT2JqZWN0IiwgICAiKElMYW5kcm9pZC9yZW5kZXJzY3JpcHQvVHlwZTtJTGphdmEvbGFuZy9PYmplY3Q7KVYiLCAgICh2b2lkKiluQWxsb2NhdGlvblN1YlJlYWRGcm9tT2JqZWN0IH0sCit7InJzbkZvbnRDcmVhdGVGcm9tRmlsZSIsICAgICAgICAgICAgIihJTGphdmEvbGFuZy9TdHJpbmc7SUkpSSIsICAgICAgICAgICAgICh2b2lkKiluRm9udENyZWF0ZUZyb21GaWxlIH0sCiAKLXsibkFkYXB0ZXIxREJpbmRBbGxvY2F0aW9uIiwgICAgICAgIihJSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluQWRhcHRlcjFEQmluZEFsbG9jYXRpb24gfSwKLXsibkFkYXB0ZXIxRFNldENvbnN0cmFpbnQiLCAgICAgICAgIihJSUkpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluQWRhcHRlcjFEU2V0Q29uc3RyYWludCB9LAoteyJuQWRhcHRlcjFERGF0YSIsICAgICAgICAgICAgICAgICAiKElbSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5BZGFwdGVyMUREYXRhX2kgfSwKLXsibkFkYXB0ZXIxRERhdGEiLCAgICAgICAgICAgICAgICAgIihJW0YpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluQWRhcHRlcjFERGF0YV9mIH0sCi17Im5BZGFwdGVyMURTdWJEYXRhIiwgICAgICAgICAgICAgICIoSUlJW0kpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkFkYXB0ZXIxRFN1YkRhdGFfaSB9LAoteyJuQWRhcHRlcjFEU3ViRGF0YSIsICAgICAgICAgICAgICAiKElJSVtGKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5BZGFwdGVyMURTdWJEYXRhX2YgfSwKLXsibkFkYXB0ZXIxRENyZWF0ZSIsICAgICAgICAgICAgICAgIigpSSIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluQWRhcHRlcjFEQ3JlYXRlIH0sCit7InJzbkVsZW1lbnRDcmVhdGUiLCAgICAgICAgICAgICAgICAgIihJSUlaSSlJIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkVsZW1lbnRDcmVhdGUgfSwKK3sicnNuRWxlbWVudENyZWF0ZTIiLCAgICAgICAgICAgICAgICAiKElbSVtMamF2YS9sYW5nL1N0cmluZzspSSIsICAgICAgICAgICAgICh2b2lkKiluRWxlbWVudENyZWF0ZTIgfSwKK3sicnNuRWxlbWVudEdldE5hdGl2ZURhdGEiLCAgICAgICAgICAiKElJW0kpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluRWxlbWVudEdldE5hdGl2ZURhdGEgfSwKK3sicnNuRWxlbWVudEdldFN1YkVsZW1lbnRzIiwgICAgICAgICAiKElJW0lbTGphdmEvbGFuZy9TdHJpbmc7KVYiLCAgICAgICAgICAgKHZvaWQqKW5FbGVtZW50R2V0U3ViRWxlbWVudHMgfSwKIAoteyJuQWRhcHRlcjJEQmluZEFsbG9jYXRpb24iLCAgICAgICAiKElJKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5BZGFwdGVyMkRCaW5kQWxsb2NhdGlvbiB9LAoteyJuQWRhcHRlcjJEU2V0Q29uc3RyYWludCIsICAgICAgICAiKElJSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5BZGFwdGVyMkRTZXRDb25zdHJhaW50IH0sCi17Im5BZGFwdGVyMkREYXRhIiwgICAgICAgICAgICAgICAgICIoSVtJKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkFkYXB0ZXIyRERhdGFfaSB9LAoteyJuQWRhcHRlcjJERGF0YSIsICAgICAgICAgICAgICAgICAiKElbRilWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5BZGFwdGVyMkREYXRhX2YgfSwKLXsibkFkYXB0ZXIyRFN1YkRhdGEiLCAgICAgICAgICAgICAgIihJSUlJSVtJKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluQWRhcHRlcjJEU3ViRGF0YV9pIH0sCi17Im5BZGFwdGVyMkRTdWJEYXRhIiwgICAgICAgICAgICAgICIoSUlJSUlbRilWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkFkYXB0ZXIyRFN1YkRhdGFfZiB9LAoteyJuQWRhcHRlcjJEQ3JlYXRlIiwgICAgICAgICAgICAgICAiKClJIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5BZGFwdGVyMkRDcmVhdGUgfSwKK3sicnNuVHlwZUJlZ2luIiwgICAgICAgICAgICAgICAgICAgICAiKElJKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluVHlwZUJlZ2luIH0sCit7InJzblR5cGVBZGQiLCAgICAgICAgICAgICAgICAgICAgICAgIihJSUkpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopblR5cGVBZGQgfSwKK3sicnNuVHlwZUNyZWF0ZSIsICAgICAgICAgICAgICAgICAgICAiKEkpSSIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluVHlwZUNyZWF0ZSB9LAoreyJyc25UeXBlRmluYWxEZXN0cm95IiwgICAgICAgICAgICAgICIoSUxhbmRyb2lkL3JlbmRlcnNjcmlwdC9UeXBlOylWIiwgICAgICAgKHZvaWQqKW5UeXBlRmluYWxEZXN0cm95IH0sCit7InJzblR5cGVTZXR1cEZpZWxkcyIsICAgICAgICAgICAgICAgIihJTGFuZHJvaWQvcmVuZGVyc2NyaXB0L1R5cGU7W0lbSVtMamF2YS9sYW5nL3JlZmxlY3QvRmllbGQ7KVYiLCAodm9pZCopblR5cGVTZXR1cEZpZWxkcyB9LAoreyJyc25UeXBlR2V0TmF0aXZlRGF0YSIsICAgICAgICAgICAgICIoSUlbSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluVHlwZUdldE5hdGl2ZURhdGEgfSwKIAoteyJuU2NyaXB0QmluZEFsbG9jYXRpb24iLCAgICAgICAgICAiKElJSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5TY3JpcHRCaW5kQWxsb2NhdGlvbiB9LAoteyJuU2NyaXB0U2V0Q2xlYXJDb2xvciIsICAgICAgICAgICAiKElGRkZGKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5TY3JpcHRTZXRDbGVhckNvbG9yIH0sCi17Im5TY3JpcHRTZXRDbGVhckRlcHRoIiwgICAgICAgICAgICIoSUYpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopblNjcmlwdFNldENsZWFyRGVwdGggfSwKLXsiblNjcmlwdFNldENsZWFyU3RlbmNpbCIsICAgICAgICAgIihJSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluU2NyaXB0U2V0Q2xlYXJTdGVuY2lsIH0sCi17Im5TY3JpcHRTZXRUaW1lWm9uZSIsICAgICAgICAgICAgICIoSVtCKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopblNjcmlwdFNldFRpbWVab25lIH0sCi17Im5TY3JpcHRTZXRUeXBlIiwgICAgICAgICAgICAgICAgICIoSVpMamF2YS9sYW5nL1N0cmluZztJKVYiLCAgICAgICAgICAgICAodm9pZCopblNjcmlwdFNldFR5cGUgfSwKLXsiblNjcmlwdFNldFJvb3QiLCAgICAgICAgICAgICAgICAgIihaKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluU2NyaXB0U2V0Um9vdCB9LAoteyJuU2NyaXB0U2V0SW52b2thYmxlIiwgICAgICAgICAgICAiKExqYXZhL2xhbmcvU3RyaW5nO0kpViIsICAgICAgICAgICAgICAgKHZvaWQqKW5TY3JpcHRTZXRJbnZva2UgfSwKLXsiblNjcmlwdEludm9rZSIsICAgICAgICAgICAgICAgICAgIihJSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluU2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B9LAoreyJyc25BbGxvY2F0aW9uU3ViRGF0YTFEIiwgICAgICAgICAgICIoSUlJSVtJSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5BbGxvY2F0aW9uU3ViRGF0YTFEX2kgfSwKK3sicnNuQWxsb2NhdGlvblN1YkRhdGExRCIsICAgICAgICAgICAiKElJSUlbU0kpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluQWxsb2NhdGlvblN1YkRhdGExRF9zIH0sCit7InJzbkFsbG9jYXRpb25TdWJEYXRhMUQiLCAgICAgICAgICAgIihJSUlJW0JJKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkFsbG9jYXRpb25TdWJEYXRhMURfYiB9LAoreyJyc25BbGxvY2F0aW9uU3ViRGF0YTFEIiwgICAgICAgICAgICIoSUlJSVtGSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5BbGxvY2F0aW9uU3ViRGF0YTFEX2YgfSwKK3sicnNuQWxsb2NhdGlvblN1YkRhdGEyRCIsICAgICAgICAgICAiKElJSUlJSVtJSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluQWxsb2NhdGlvblN1YkRhdGEyRF9pIH0sCit7InJzbkFsbG9jYXRpb25TdWJEYXRhMkQiLCAgICAgICAgICAgIihJSUlJSUlbRkkpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkFsbG9jYXRpb25TdWJEYXRhMkRfZiB9LAoreyJyc25BbGxvY2F0aW9uUmVhZCIsICAgICAgICAgICAgICAgICIoSUlbSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5BbGxvY2F0aW9uUmVhZF9pIH0sCit7InJzbkFsbG9jYXRpb25SZWFkIiwgICAgICAgICAgICAgICAgIihJSVtGKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkFsbG9jYXRpb25SZWFkX2YgfSwKK3sicnNuQWxsb2NhdGlvblN1YkRhdGFGcm9tT2JqZWN0IiwgICAiKElJTGFuZHJvaWQvcmVuZGVyc2NyaXB0L1R5cGU7SUxqYXZhL2xhbmcvT2JqZWN0OylWIiwgICAodm9pZCopbkFsbG9jYXRpb25TdWJEYXRhRnJvbU9iamVjdCB9LAoreyJyc25BbGxvY2F0aW9uU3ViUmVhZEZyb21PYmplY3QiLCAgICIoSUlMYW5kcm9pZC9yZW5kZXJzY3JpcHQvVHlwZTtJTGphdmEvbGFuZy9PYmplY3Q7KVYiLCAgICh2b2lkKiluQWxsb2NhdGlvblN1YlJlYWRGcm9tT2JqZWN0IH0sCit7InJzbkFsbG9jYXRpb25HZXRUeXBlIiwgICAgICAgICAgICAgIihJSSlJIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkFsbG9jYXRpb25HZXRUeXBlfSwKIAoteyJuU2NyaXB0Q0JlZ2luIiwgICAgICAgICAgICAgICAgICAiKClWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5TY3JpcHRDQmVnaW4gfSwKLXsiblNjcmlwdENTZXRTY3JpcHQiLCAgICAgICAgICAgICAgIihbQklJKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluU2NyaXB0Q1NldFNjcmlwdCB9LAoteyJuU2NyaXB0Q0NyZWF0ZSIsICAgICAgICAgICAgICAgICAiKClJIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5TY3JpcHRDQ3JlYXRlIH0sCi17Im5TY3JpcHRDQWRkRGVmaW5lSTMyIiwgICAgICAgICAgICIoTGphdmEvbGFuZy9TdHJpbmc7SSlWIiwgICAgICAgICAgICAgICAodm9pZCopblNjcmlwdENBZGREZWZpbmVJMzIgfSwKLXsiblNjcmlwdENBZGREZWZpbmVGIiwgICAgICAgICAgICAgIihMamF2YS9sYW5nL1N0cmluZztGKVYiLCAgICAgICAgICAgICAgICh2b2lkKiluU2NyaXB0Q0FkZERlZmluZUYgfSwKK3sicnNuQWRhcHRlcjFEQmluZEFsbG9jYXRpb24iLCAgICAgICAiKElJSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluQWRhcHRlcjFEQmluZEFsbG9jYXRpb24gfSwKK3sicnNuQWRhcHRlcjFEU2V0Q29uc3RyYWludCIsICAgICAgICAiKElJSUkpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluQWRhcHRlcjFEU2V0Q29uc3RyYWludCB9LAoreyJyc25BZGFwdGVyMUREYXRhIiwgICAgICAgICAgICAgICAgICIoSUlbSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5BZGFwdGVyMUREYXRhX2kgfSwKK3sicnNuQWRhcHRlcjFERGF0YSIsICAgICAgICAgICAgICAgICAiKElJW0YpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluQWRhcHRlcjFERGF0YV9mIH0sCit7InJzbkFkYXB0ZXIxRFN1YkRhdGEiLCAgICAgICAgICAgICAgIihJSUlJW0kpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkFkYXB0ZXIxRFN1YkRhdGFfaSB9LAoreyJyc25BZGFwdGVyMURTdWJEYXRhIiwgICAgICAgICAgICAgICIoSUlJSVtGKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5BZGFwdGVyMURTdWJEYXRhX2YgfSwKK3sicnNuQWRhcHRlcjFEQ3JlYXRlIiwgICAgICAgICAgICAgICAiKEkpSSIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluQWRhcHRlcjFEQ3JlYXRlIH0sCiAKLXsiblByb2dyYW1GcmFnbWVudFN0b3JlQmVnaW4iLCAgICAgIihJSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2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9LAoreyJyc25BZGFwdGVyMkRTZXRDb25zdHJhaW50IiwgICAgICAgICIoSUlJSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5BZGFwdGVyMkRTZXRDb25zdHJhaW50IH0sCit7InJzbkFkYXB0ZXIyRERhdGEiLCAgICAgICAgICAgICAgICAgIihJSVtJKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkFkYXB0ZXIyRERhdGFfaSB9LAoreyJyc25BZGFwdGVyMkREYXRhIiwgICAgICAgICAgICAgICAgICIoSUlbRilWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5BZGFwdGVyMkREYXRhX2YgfSwKK3sicnNuQWRhcHRlcjJEU3ViRGF0YSIsICAgICAgICAgICAgICAiKElJSUlJSVtJKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluQWRhcHRlcjJEU3ViRGF0YV9pIH0sCit7InJzbkFkYXB0ZXIyRFN1YkRhdGEiLCAgICAgICAgICAgICAgIihJSUlJSUlbRilWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkFkYXB0ZXIyRFN1YkRhdGFfZiB9LAoreyJyc25BZGFwdGVyMkRDcmVhdGUiLCAgICAgICAgICAgICAgICIoSSlJIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5BZGFwdGVyMkRDcmVhdGUgfSwKIAoteyJuUHJvZ3JhbUJpbmRDb25zdGFudHMiLCAgICAgICAgICAiKElJSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5Qcm9ncmFtQmluZENvbnN0YW50cyB9LAoteyJuUHJvZ3JhbUJpbmRUZXh0dXJlIiwgICAgICAgICAgICAiKElJSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5Qcm9ncmFtQmluZFRleHR1cmUgfSwKLXsiblByb2dyYW1CaW5kU2FtcGxlciIsICAgICAgICAgICAgIihJSUkpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluUHJvZ3JhbUJpbmRTYW1wbGVyIH0sCit7InJzblNjcmlwdEJpbmRBbGxvY2F0aW9uIiwgICAgICAgICAgIihJSUlJKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopblNjcmlwdEJpbmRBbGxvY2F0aW9uIH0sCit7InJzblNjcmlwdFNldFRpbWVab25lIiwgICAgICAgICAgICAgIihJSVtCKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopblNjcmlwdFNldFRpbWVab25lIH0sCit7InJzblNjcmlwdEludm9rZSIsICAgICAgICAgICAgICAgICAgIihJSUkpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopblNjcmlwdEludm9rZSB9LAoreyJyc25TY3JpcHRJbnZva2VWIiwgICAgICAgICAgICAgICAgICIoSUlJW0IpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5TY3JpcHRJbnZva2VWIH0sCit7InJzblNjcmlwdFNldFZhckkiLCAgICAgICAgICAgICAgICAgIihJSUlJKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopblNjcmlwdFNldFZhckkgfSwKK3sicnNuU2NyaXB0U2V0VmFyRiIsICAgICAgICAgICAgICAgICAiKElJSUYpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluU2NyaXB0U2V0VmFyRiB9LAoreyJyc25TY3JpcHRTZXRWYXJWIiwgICAgICAgICAgICAgICAgICIoSUlJW0IpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5TY3JpcHRTZXRWYXJWIH0sCiAKLXsiblByb2dyYW1GcmFnbWVudENyZWF0ZSIsICAgICAgICAgIihbSSlJIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluUHJvZ3JhbUZyYWdtZW50Q3JlYXRlIH0sCi17Im5Qcm9ncmFtRnJhZ21lbnRDcmVhdGUyIiwgICAgICAgICIoTGphdmEvbGFuZy9TdHJpbmc7W0kpSSIsICAgICAgICAgICAgICAodm9pZCopblByb2dyYW1GcmFnbWVudENyZWF0ZTIgfSwKK3sicnNuU2NyaXB0Q0JlZ2luIiwgICAgICAgICAgICAgICAgICAiKEkpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluU2NyaXB0Q0JlZ2luIH0sCit7InJzblNjcmlwdENTZXRTY3JpcHQiLCAgICAgICAgICAgICAgIihJW0JJSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopblNjcmlwdENTZXRTY3JpcHQgfSwKK3sicnNuU2NyaXB0Q0NyZWF0ZSIsICAgICAgICAgICAgICAgICAiKEkpSSIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluU2NyaXB0Q0NyZWF0ZSB9LAogCi17Im5Qcm9ncmFtUmFzdGVyQ3JlYXRlIiwgICAgICAgICAgICIoSUlaWlopSSIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopblByb2dyYW1SYXN0ZXJDcmVhdGUgfSwKLXsiblByb2dyYW1SYXN0ZXJTZXRQb2ludFNpemUiLCAgICAgIihJRilWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluUHJvZ3JhbVJhc3RlclNldFBvaW50U2l6ZSB9LAoteyJuUHJvZ3JhbVJhc3RlclNldExpbmVXaWR0aCIsICAgICAiKElGKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5Qcm9ncmFtUmFzdGVyU2V0TGluZVdpZHRoIH0sCit7InJzblByb2dyYW1TdG9yZUJlZ2luIiwgICAgICAgICAgICAgIihJSUkpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopblByb2dyYW1TdG9yZUJlZ2luIH0sCit7InJzblByb2dyYW1TdG9yZURlcHRoRnVuYyIsICAgICAgICAgIihJSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopblByb2dyYW1TdG9yZURlcHRoRnVuYyB9LAoreyJyc25Qcm9ncmFtU3RvcmVEZXB0aE1hc2siLCAgICAgICAgICIoSVopViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5Qcm9ncmFtU3RvcmVEZXB0aE1hc2sgfSwKK3sicnNuUHJvZ3JhbVN0b3JlQ29sb3JNYXNrIiwgICAgICAgICAiKElaWlpaKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluUHJvZ3JhbVN0b3JlQ29sb3JNYXNrIH0sCit7InJzblByb2dyYW1TdG9yZUJsZW5kRnVuYyIsICAgICAgICAgIihJSUkpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopblByb2dyYW1TdG9yZUJsZW5kRnVuYyB9LAoreyJyc25Qcm9ncmFtU3RvcmVEaXRoZXIiLCAgICAgICAgICAgICIoSVopViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5Qcm9ncmFtU3RvcmVEaXRoZXIgfSwKK3sicnNuUHJvZ3JhbVN0b3JlQ3JlYXRlIiwgICAgICAgICAgICAiKEkpSSIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluUHJvZ3JhbVN0b3JlQ3JlYXRlIH0sCiAKLXsiblByb2dyYW1WZXJ0ZXhDcmVhdGUiLCAgICAgICAgICAgIihaKUkiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluUHJvZ3JhbVZlcnRleENyZWF0ZSB9LAoteyJuUHJvZ3JhbVZlcnRleENyZWF0ZTIiLCAgICAgICAgICAiKExqYXZhL2xhbmcvU3RyaW5nO1tJKUkiLCAgICAgICAgICAgICAgKHZvaWQqKW5Qcm9ncmFtVmVydGV4Q3JlYXRlMiB9LAoreyJyc25Qcm9ncmFtQmluZENvbnN0YW50cyIsICAgICAgICAgICIoSUlJSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5Qcm9ncmFtQmluZENvbnN0YW50cyB9LAoreyJyc25Qcm9ncmFtQmluZFRleHR1cmUiLCAgICAgICAgICAgICIoSUlJSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5Qcm9ncmFtQmluZFRleHR1cmUgfSwKK3sicnNuUHJvZ3JhbUJpbmRTYW1wbGVyIiwgICAgICAgICAgICAiKElJSUkpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluUHJvZ3JhbUJpbmRTYW1wbGVyIH0sCiAKLXsibkxpZ2h0QmVnaW4iLCAgICAgICAgICAgICAgICAgICAgIigpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluTGlnaHRCZWdpbiB9LAoteyJuTGlnaHRTZXRJc01vbm8iLCAgICAgICAgICAgICAgICAiKFopViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5MaWdodFNldElzTW9ubyB9LAoteyJuTGlnaHRTZXRJc0xvY2FsIiwgICAgICAgICAgICAgICAiKFopViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5MaWdodFNldElzTG9jYWwgfSwKLXsibkxpZ2h0Q3JlYXRlIiwgICAgICAgICAgICAgICAgICAgIigpSSIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluTGlnaHRDcmVhdGUgfSwKLXsibkxpZ2h0U2V0Q29sb3IiLCAgICAgICAgICAgICAgICAgIihJRkZGKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluTGlnaHRTZXRDb2xvciB9LAoteyJuTGlnaHRTZXRQb3NpdGlvbiIsICAgICAgICAgICAgICAiKElGRkYpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5MaWdodFNldFBvc2l0aW9uIH0sCit7InJzblByb2dyYW1GcmFnbWVudENyZWF0ZSIsICAgICAgICAgIihJW0kpSSIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopblByb2dyYW1GcmFnbWVudENyZWF0ZSB9LAoreyJyc25Qcm9ncmFtRnJhZ21lbnRDcmVhdGUyIiwgICAgICAgICIoSUxqYXZhL2xhbmcvU3RyaW5nO1tJKUkiLCAgICAgICAgICAgICAgKHZvaWQqKW5Qcm9ncmFtRnJhZ21lbnRDcmVhdGUyIH0sCiAKLXsibkNvbnRleHRCaW5kUm9vdFNjcmlwdCIsICAgICAgICAgIihJKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluQ29udGV4dEJpbmRSb290U2NyaXB0IH0sCi17Im5Db250ZXh0QmluZFByb2dyYW1GcmFnbWVudFN0b3JlIiwiKEkpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkNvbnRleHRCaW5kUHJvZ3JhbUZyYWdtZW50U3RvcmUgfSwKLXsibkNvbnRleHRCaW5kUHJvZ3JhbUZyYWdtZW50IiwgICAgIihJKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluQ29udGV4dEJpbmRQcm9ncmFtRnJhZ21lbnQgfSwKLXsibkNvbnRleHRCaW5kUHJvZ3JhbVZlcnRleCIsICAgICAgIihJKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluQ29udGV4dEJpbmRQcm9ncmFtVmVydGV4IH0sCi17Im5Db250ZXh0QmluZFByb2dyYW1SYXN0ZXIiLCAgICAgICIoSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkNvbnRleHRCaW5kUHJvZ3JhbVJhc3RlciB9LAoreyJyc25Qcm9ncmFtUmFzdGVyQ3JlYXRlIiwgICAgICAgICAgICIoSVpaWilJIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluUHJvZ3JhbVJhc3RlckNyZWF0ZSB9LAoreyJyc25Qcm9ncmFtUmFzdGVyU2V0TGluZVdpZHRoIiwgICAgICIoSUlGKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5Qcm9ncmFtUmFzdGVyU2V0TGluZVdpZHRoIH0sCit7InJzblByb2dyYW1SYXN0ZXJTZXRDdWxsTW9kZSIsICAgICAgIihJSUkpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopblByb2dyYW1SYXN0ZXJTZXRDdWxsTW9kZSB9LAogCi17Im5TYW1wbGVyQmVnaW4iLCAgICAgICAgICAgICAgICAgICIoKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopblNhbXBsZXJCZWdpbiB9LAoteyJuU2FtcGxlclNldCIsICAgICAgICAgICAgICAgICAgICAiKElJKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5TYW1wbGVyU2V0IH0sCi17Im5TYW1wbGVyQ3JlYXRlIiwgICAgICAgICAgICAgICAgICIoKUkiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopblNhbXBsZXJDcmVhdGUgfSwKK3sicnNuUHJvZ3JhbVZlcnRleENyZWF0ZSIsICAgICAgICAgICAiKElaKUkiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluUHJvZ3JhbVZlcnRleENyZWF0ZSB9LAoreyJyc25Qcm9ncmFtVmVydGV4Q3JlYXRlMiIsICAgICAgICAgICIoSUxqYXZhL2xhbmcvU3RyaW5nO1tJKUkiLCAgICAgICAgICAgICAgKHZvaWQqKW5Qcm9ncmFtVmVydGV4Q3JlYXRlMiB9LAogCi17Im5TaW1wbGVNZXNoQ3JlYXRlIiwgICAgICAgICAgICAgICIoSUlbSUkpSSIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopblNpbXBsZU1lc2hDcmVhdGUgfSwKLXsiblNpbXBsZU1lc2hCaW5kVmVydGV4IiwgICAgICAgICAgIihJSUkpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluU2ltcGxlTWVzaEJpbmRWZXJ0ZXggfSwKLXsiblNpbXBsZU1lc2hCaW5kSW5kZXgiLCAgICAgICAgICAgIihJSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluU2ltcGxlTWVzaEJpbmRJbmRleCB9LAoreyJyc25Db250ZXh0QmluZFJvb3RTY3JpcHQiLCAgICAgICAgICIoSUkpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5Db250ZXh0QmluZFJvb3RTY3JpcHQgfSwKK3sicnNuQ29udGV4dEJpbmRQcm9ncmFtU3RvcmUiLCAgICAgICAiKElJKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5Db250ZXh0QmluZFByb2dyYW1TdG9yZSB9LAoreyJyc25Db250ZXh0QmluZFByb2dyYW1GcmFnbWVudCIsICAgICIoSUkpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5Db250ZXh0QmluZFByb2dyYW1GcmFnbWVudCB9LAoreyJyc25Db250ZXh0QmluZFByb2dyYW1WZXJ0ZXgiLCAgICAgICIoSUkpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5Db250ZXh0QmluZFByb2dyYW1WZXJ0ZXggfSwKK3sicnNuQ29udGV4dEJpbmRQcm9ncmFtUmFzdGVyIiwgICAgICAiKElJKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluQ29udGV4dEJpbmRQcm9ncmFtUmFzdGVyIH0sCisKK3sicnNuU2FtcGxlckJlZ2luIiwgICAgICAgICAgICAgICAgICAiKEkpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluU2FtcGxlckJlZ2luIH0sCit7InJzblNhbXBsZXJTZXQiLCAgICAgICAgICAgICAgICAgICAgIihJSUkpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopblNhbXBsZXJTZXQgfSwKK3sicnNuU2FtcGxlckNyZWF0ZSIsICAgICAgICAgICAgICAgICAiKEkpSSIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluU2FtcGxlckNyZWF0ZSB9LAorCit7InJzbk1lc2hDcmVhdGUiLCAgICAgICAgICAgICAgICAgICAgIihJSUkpSSIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbk1lc2hDcmVhdGUgfSwKK3sicnNuTWVzaEJpbmRWZXJ0ZXgiLCAgICAgICAgICAgICAgICAiKElJSUkpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluTWVzaEJpbmRWZXJ0ZXggfSwKK3sicnNuTWVzaEJpbmRJbmRleCIsICAgICAgICAgICAgICAgICAiKElJSUlJKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluTWVzaEJpbmRJbmRleCB9LAorCit7InJzbk1lc2hHZXRWZXJ0ZXhCdWZmZXJDb3VudCIsICAgICAgIihJSSlJIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbk1lc2hHZXRWZXJ0ZXhCdWZmZXJDb3VudCB9LAoreyJyc25NZXNoR2V0SW5kZXhDb3VudCIsICAgICAgICAgICAgICIoSUkpSSIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5NZXNoR2V0SW5kZXhDb3VudCB9LAoreyJyc25NZXNoR2V0VmVydGljZXMiLCAgICAgICAgICAgICAgICIoSUlbSUkpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbk1lc2hHZXRWZXJ0aWNlcyB9LAoreyJyc25NZXNoR2V0SW5kaWNlcyIsICAgICAgICAgICAgICAgICIoSUlbSVtJSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5NZXNoR2V0SW5kaWNlcyB9LAogCiB9OwogCkBAIC0xNTEwLDMgKzE1MDksNCBAQAogYmFpbDoKICAgICByZXR1cm4gcmVzdWx0OwogfQorCmRpZmYgLS1naXQgYS9pY3U0ai9qYXZhL2FuZHJvaWQvaWN1L3RleHQvQXJhYmljU2hhcGluZy5qYXZhIGIvaWN1NGovamF2YS9hbmRyb2lkL2ljdS90ZXh0L0FyYWJpY1NoYXBpbmcuamF2YQpuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi4xM2UyMTc1Ci0tLSAvZGV2L251bGwKKysrIGIvaWN1NGovamF2YS9hbmRyb2lkL2ljdS90ZXh0L0FyYWJpY1NoYXBpbmcuamF2YQpAQCAtMCwwICsxLDE5NDcgQEAKKy8qCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqICAgQ29weXJpZ2h0IChDKSAyMDAxLTIwMDksIEludGVybmF0aW9uYWwgQnVzaW5lc3MgTWFjaGluZXMKKyogICBDb3Jwb3JhdGlvbiBhbmQgb3RoZXJzLiAgQWxsIFJpZ2h0cyBSZXNlcnZlZC4KKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyovCisKKy8qCisgKiBQb3J0ZWQgd2l0aCBtaW5vciBtb2RpZmljYXRpb25zIGZyb20gSUNVNEogNC4yJ3MKKyAqIGNvbS5pYm0uaWN1LnRleHQuQXJhYmljU2hhcGluZyBjbGFzcy4KKyAqLworCitwYWNrYWdlIGFuZHJvaWQuaWN1LnRleH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yZ3VtZW50RXhjZXB0aW9uKCJiYWQgc291cmNlIHN0YXJ0ICgiICsgc291cmNlU3RhcnQgKworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiKSBvciBsZW5ndGggKCIgKyBzb3VyY2VMZW5ndGggKworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiKSBmb3IgYnVmZmVyIG9mIGxlbmd0aCAiICsgc291cmNlLmxlbmd0aCk7CisgICAgICAgIH0KKyAgICAgICAgaWYgKGRlc3QgPT0gbnVsbCAmJiBkZXN0U2l6ZSAhPSAwKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCJudWxsIGRlc3QgcmVxdWlyZXMgZGVzdFNpemUgPT0gMCIpOworICAgICAgICB9CisgICAgICAgIGlmICgoZGVzdFNpemUgIT0gMCkgJiYKKyAgICAgICAgICAgIChkZXN0U3RhcnQgPCAwIHx8IGRlc3RTaXplIDwgMCB8fCBkZXN0U3RhcnQgKyBkZXN0U2l6ZSA+IGRlc3QubGVuZ3RoKSkgeworICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigiYmFkIGRlc3Qgc3RhcnQgKCIgKyBkZXN0U3RhcnQgKworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiKSBvciBzaXplICgiICsgZGVzdFNpemUgKworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiKSBmb3IgYnVmZmVyIG9mIGxlbmd0aCAiICsgZGVzdC5sZW5ndGgpOworICAgICAgICB9CisgICAgICAgIC8qIFZhbGlkYXRlIGlucHV0IG9wdGlvbnMgKi8KKyAgICAgICAgaWYgKCAoKG9wdGlvbnMmVEFTSEtFRUxfTUFTSykgPiAwKSAmJgorICAgICAgICAgICAgICEoKChvcHRpb25zICYgVEFTSEtFRUxfTUFTSyk9PVRBU0hLRUVMX0JFR0lOKSAgfHwKKyAgICAgICAgICAgICAgICgob3B0aW9ucyAmIFRBU0hLRUVMX01BU0spPT1UQVNIS0VFTF9FTkQgKSAgIHx8CisgICAgICAgICAgICAgICAoKG9wdGlvbnMgJiBUQVNIS0VFTF9NQVNLKT09VEFTSEtFRUxfUkVTSVpFICl8fAorICAgICAgICAgICAgICAgKChvcHRpb25zICYgVEFTSEtFRUxfTUFTSyk9PVRBU0hLRUVMX1JFUExBQ0VfQllfVEFUV0VFTCkpICl7CisgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCJXcm9uZyBUYXNoa2VlbCBhcmd1bWVudCIpOworICAgICAgICB9CisKKyAgICAgICAvLy9DTE9WRVI6T0ZGCisgICAgICAgLy9BY2NvcmRpbmcgdG8gU3RldmVuIExvb21pcywgdGhlIGNvZGUgaXMgdW5yZWFjaGFibGUgd2hlbiB5b3UgT1IgYWxsIHRoZSBjb25zdGFudHMgd2l0aGluIHRoZSBpZiBzdGF0ZW1lbnRzCisgICAgICAgaWYoKChvcHRpb25zJkxBTUFMRUZfTUFTSykgPiAwKSYmCisgICAgICAgICAgICAgICEoKChvcHRpb25zICYgTEFNQUxFRl9NQVNLKT09TEFNQUxFRl9CRUdJTikgIHx8CisgICAgICAgICAgICAgICAgKChvcHRpb25zICYgTEFNQUxFRl9NQVNLKT09TEFNQUxFRl9FTkQgKSAgIHx8CisgICAgICAgICAgICAgICAgKChvcHRpb25zICYgTEFNQUxFRl9NQVNLKT09TEFNQUxFRl9SRVNJWkUgKXx8CisgICAgICAgICAgICAgICAgICgob3B0aW9ucyAmIExBTUFMRUZfTUFTSyk9PUxBTUFMRUZfQVVUTykgIHx8CisgICAgICAgICAgICAgICAgICgob3B0aW9ucyAmIExBTUFMRUZfTUFTSyk9PUxBTUFMRUZfTkVBUikpKXsKKyAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd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ICAgICAqIHByZXNlbnRhdGlvbiBmb3Jtcy48YnI+CisgICAgICogJ0RJR0lUUycgZmxhZ3MgY29udHJvbCB3aGV0aGVyIGRpZ2l0cyBhcmUgc2hhcGVkLCBhbmQgd2hldGhlciBmcm9tCisgICAgICogRXVyb3BlYW4gdG8gQXJhYmljLUluZGljIG9yIHZpY2UtdmVyc2EuPGJyPgorICAgICAqICdESUdJVF9UWVBFJyBmbGFncyBjb250cm9sIHdoZXRoZXIgc3RhbmRhcmQgb3IgZXh0ZW5kZWQgQXJhYmljLUluZGljCisgICAgICogZGlnaXRzIGFyZSB1c2VkIHdoZW4gcGVyZm9ybWluZyBkaWdpdCBjb252ZXJzaW9uLgorICAgICAqIEBzdGFibGUgSUNVIDIuMAorICAgICAqLworICAgIHB1YmxpYyBBcmFiaWNTaGFwaW5nKGludCBvcHRpb25zKSB7CisgICAgICAgIHRoaXMub3B0aW9ucyA9IG9wdGlvbnM7CisgICAgICAgIGlmICgob3B0aW9ucyAmIERJR0lUU19NQVNLKSA+IDB4ODApIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oImJhZCBESUdJVFMgb3B0aW9ucyIpOworICAgICAgICB9CisKKyAgICAgICAgaXNMb2dpY2FsID0gKCAob3B0aW9ucyAmIFRFWFRfRElSRUNUSU9OX01BU0spID09IFRFWFRfRElSRUNUSU9OX0xPR0lDQUwgKTsKKyAgICAgICAgLyogVmFsaWRhdGUgb3B0aW9ucyAqLworICAgICAgICBzcGFjZXNSZWxhdGl2ZVRvVGV4dEJlZ2luRW5kID0gKCAob3B0aW9ucyAmIFNQQUNFU19SRUxBVElWRV9UT19URVhUX01BU0spID09IFNQQUNFU19SRUxBVElWRV9UT19URVhUX0JFR0lOX0VORCApOworICAgICAgICBpZiAoIChvcHRpb25zJlNIQVBFX1RBSUxfVFlQRV9NQVNLKSA9PSBTSEFQRV9UQUlMX05FV19VTklDT0RFKXsKKyAgICAgICAgICAgI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iogTm90IGEgdmFsaWQgb3B0aW9uIHZhbHVlLiAqLworICAgIC8vcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IERJR0lUU19SRVNFUlZFRCA9IDB4YTA7CisKKyAgICAvKioKKyAgICAgKiBCaXQgbWFzayBmb3IgZGlnaXQgc2hhcGluZyBvcHRpb25zLgorICAgICAqIEBzdGFibGUgSUNVIDIuMAorICAgICAqLworICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgaW50IERJR0lUU19NQVNLID0gMHhlMDsKKworICAgIC8qKgorICAgICAqIERpZ2l0IHR5cGUgb3B0aW9uOiBVc2UgQXJhYmljLUluZGljIGRpZ2l0cyAoVSswNjYwLi4uVSswNjY5KS4KKyAgICAgKiBAc3RhYmxlIElDVSAyLjAKKyAgICAgKi8KKyAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGludCBESUdJVF9UWVBFX0FOID0gMDsKKworICAgIC8qKgorICAgICAqIERpZ2l0IHR5cGUgb3B0aW9uOiBVc2UgRWFzdGVybiAoRXh0ZW5kZWQpIEFyYWJpYy1JbmRpYyBkaWdpdHMgKFUrMDZmMC4uLlUrMDZmOSkuCisgICAgICogQHN0YWJsZSBJQ1UgMi4wCisgICAgICovCisgICAgcHVibGljIHN0YXRpYyBmaW5hbCBpbnQgRElHSVRfVFlQRV9BTl9FWFRFTkRFRCA9IDB4MTAwOworCisgICAgLyoqCisgICAgICogQml0IG1hc2sgZm9yIGRpZ2l0IHR5cGUgb3B0aW9ucy4KKyAgICAgKiBAc3RhYmxlIElDVSAyLjAKKyAgICAgKi8KKyAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGludCBESUdJVF9UWVBFX01BU0sgPSAweDAxMDA7IC8vIDB4M2YwMD8KKworICAgIC8qKgorICAgICAqIHNvbWUgY29uc3RhbnRzCisgICAgICovCisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgY2hhciBIQU1aQUZFX0NIQVIgICAgICAgPSAnXHVmZTgwJzsKKyAgICBwcml2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hdGUgc3RhdGljIGZpbmFsIGludCBTSEFQRV9NT0RFICAgICAgPSAwOworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBERVNIQVBFX01PREUgICAgPSAxOworCisgICAgLyoqCisgICAgICogQHN0YWJsZSBJQ1UgMi4wCisgICAgICovCisgICAgcHVibGljIGJvb2xlYW4gZXF1YWxzKE9iamVjdCByaHMpIHsKKyAgICAgICAgcmV0dXJuIHJocyAhPSBudWxsICYmCisgICAgICAgICAgICByaHMuZ2V0Q2xhc3MoKSA9PSBBcmFiaWNTaGFwaW5nLmNsYXNzICYmCisgICAgICAgICAgICBvcHRpb25zID09ICgoQXJhYmljU2hhcGluZylyaHMpLm9wdGlvbnM7CisgICAgfQorCisgICAgLyoqCisgICAgICogQHN0YWJsZSBJQ1UgMi4wCisgICAgICovCisgICAgIC8vL0NMT1ZFUjpPRkYKKyAgICBwdWJsaWMgaW50IGhhc2hDb2RlKCkgeworICAgICAgICByZXR1cm4gb3B0aW9uczsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBAc3RhYmxlIElDVSAyLjAKKyAgICAgKi8KKyAgICBwdWJsaWMgU3RyaW5nIHRvU3RyaW5nKCkgeworICAgICAgICBTdHJpbmdCdWZmZXIgYnVmID0gbmV3IFN0cmluZ0J1ZmZlcihzdXBlci50b1N0cmluZygpKTsKKyAgICAgICAgYnVmLmFwcGVuZCgnWycpOworCisgICAgICAgIHN3aXRjaCAob3B0aW9ucyAmIExBTUFMRUZfTUFTSykgeworICAgICAgICBjYXNlIExBTUFMRUZfUkVTSVpFOiBidWYuYXBwZW5kKCJMYW1BbGVmIHJlc2l6ZSIpOyBicmVhazsKKyAgICAgICAgY2FzZSBMQU1BTEVGX05FQVI6IGJ1Zi5hcHBlbmQoIkxhbUFsZWYgc3BhY2VzIGF0IG5lYXIiKTsgYnJlYWs7CisgICAgICAgIGNhc2UgTEFNQUxFRl9CRUdJTjogYnVmLmFwcGVuZCgiTGFtQWxlZiBzcGFjZXMgY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KKyAgICAgICAgMHgwLCAweDIsIDB4NCwgMHg2LCAweDgsIDB4QSwgMHhDLCAweEUKKyAgICB9OworCisvKgorICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGNoYXIgY29udmVydExhbUFsZWZbXSA9ICB7CisgICAgICAgICdcdTA2MjInLCAvLyBGRUY1CisgICAgICAgICdcdTA2MjInLCAvLyBGRUY2CisgICAgICAgICdcdTA2MjMnLCAvLyBGRUY3CisgICAgICAgICdcdTA2MjMnLCAvLyBGRUY4CisgICAgICAgICdcdTA2MjUnLCAvLyBGRUY5CisgICAgICAgICdcdTA2MjUnLCAvLyBGRUZBCisgICAgICAgICdcdTA2MjcnLCAvLyBGRUZCCisgICAgICAgICdcdTA2MjcnICAvLyBGRUZDCisgICAgfTsKKyovCisKKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgdGFpbEZhbWlseUlzb2xhdGVkRmluYWxbXSA9IHsKKyAgICAgICAgLyogRkVCMSAqLyAxLAorICAgICAgICAvKiBGRUIyICovIDEsCisgICAgICAgIC8qIEZFQjMgKi8gMCwKKyAgICAgICAgLyogRkVCNCAqLyAwLAorICAgICAgICAvKiBGRUI1ICovIDEsCisgICAgICAgIC8qIEZFQjYgKi8gMSwKKyAgICAgICAgLyogRkVCNyAqLyAwLAorICAgICAgICAvKiBGRUI4ICovIDAsCisgICAgICAgIC8qIEZFQjkgKi8gMSwKKyAgICAgICAgLyogRkVCQSAqLyAxLAorICAgICAgICAvKiBGRUJCICovIDAsCisgICAgICAgIC8qIEZFQkMgKi8gMCwKKyAgICAgICAgLyogRkVCRCAqLyAxLAorICAgICAgICAvKiBGRUJFICovIDEKKyAgICB9OworCisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IHRhc2hrZWVsTWVkaWFsW10gPSB7CisgICAgICAgIC8qIEZFNzAgKi8gMCwKKyAgICAgICAgLyogRkU3MSAqLyAxLAorICAgICAgICAvKiBGRTcyICovIDAsCisgICAgICAgIC8qIEZFNzMgKi8gMCwKKyAgICAgICAgLyogRkU3NCAqLyAwLAorICAgICAgICAvKiBGRTc1ICovIDAsCisgICAgICAgIC8qIEZFNzYgKi8gMCwKKyAgICAgICAgLyogRkU3NyAqLyAxLAorICAgICAgICAvKiBGRTc4ICovIDAsCisgICAgICAgIC8qIEZFNzkgKi8gMSwKKyAgICAgICAgLyogRkU3QSAqLyAwLAorICAgICAgICAvKiBGRTdCICovIDEsCisgICAgICAgIC8qIEZFN0MgKi8gMCwKKyAgICAgICAgLyogRkU3RCAqLyAxLAorICAgICAgICAvKiBGRTdFICovIDAsCisgICAgICAgIC8qIEZFN0YgKi8gMQorICAgIH07CisKKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBjaGFyIHllaEhhbXphVG9ZZWhbXSA9CisgICAgeworICAgIC8qIGlzb2xhdGVkKi8gMHhGRUVGLAorICAgIC8qIGZpbmFsICAgKi8gMHhGRUYwCisgICAgfTsKKworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGNoYXIgY29udmVydE5vcm1hbGl6ZWRMYW1BbGVmW10gPSB7CisgICAgICAgICdcdTA2MjInLCAvLyAwNjVDCisgICAgICAgICdcdTA2MjMnLCAvLyAwNjVECisgICAgICAgICdcdTA2MjUnLCAvLyAwNjVFCisgICAgICAgICdcdTA2MjcnLCAvLyAwNjVGCisgICAgfTsKKworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludFtdIGFyYUxpbmsgPSB7CisgICAgICAgIDEgICAgICAgICAgICsgMzIgKyAyNTYgKiAweDExLCAgLyoweDA2MjIqLworICAgICAgICAxICAgICAgICAgICArIDMyICsgMjU2ICogMHgxMywgIC8qMHgwNjIzKi8KKyAgICAgICAgMSAgICAgICAgICAgICAgICArIDI1NiAqIDB4MTUsICAvKjB4MDYyNCovCisgICAgICAgIDEgICAgICAgICAgICsgMzIgKyAyNTYgKiAweDE3LCAgLyoweDA2MjUqLworICAgICAgICAxICsgMiAgICAgICAgICAgICsgMjU2ICogMHgxOSwgIC8qMHgwNjI2Ki8KKyAgICAgICAgMSAgICAgICAgICAgKyAzMiArIDI1NiAqIDB4MUQsICAvKjB4MDYyNyovCisgICAgICAgIDEgKyAyICAgICAgICAgICAgKyAyNTYgKiAweDFGLCAgLyoweDA2MjgqLworICAgICAgICAxICAgICAgICAgICAgICAgICsgMjU2ICogMHgyMywgIC8qMHgwNjI5Ki8KKyAgICAgICAgMSArIDIgICAgICAgICAgICArIDI1NiAqIDB4MjUsICAvKjB4MDYyQSovCisgICAgICAgIDEgKyAyICAgICAgICAgICAgKyAyNTYgKiAweDI5LCAgLyoweDA2MkIqLworICAgICAgICAxICsgMiAgICAgICAgICAgICsgMjU2ICogMHgyRCwgIC8qMHgwNjJDKi8KKyAgICAgICAgMSArIDIgICAgICAgICAgICArIDI1NiAqIDB4MzEsICAvKjB4MDYyRCovCisgICAgICAgIDEgKyAyICAgICAgICAgICAgKyAyNTYgKiAweDM1LCAgLyoweDA2MkUqLworICAgICAgICAxICAgICAgICAgICAgICAgICsgMjU2ICogMHgzOSwgIC8qMHgwNjJGKi8KKyAgICAgICAgMSAgICAgICAgICAgICAgICArIDI1NiAqIDB4M0IsICAvKjB4MDYzMCovCisgICAgICAgIDEgICAgICAgICAgICAgICAgKyAyNTYgKiAweDNELCAgLyoweDA2MzEqLworICAgICAgICAxICAgICAgICAgICAgICAgICsgMjU2ICogMHgzRiwgIC8qMHgwNjMyKi8KKyAgICAgICAgMSArIDIgICAgICAgICAgICArIDI1NiAqIDB4NDEsICAvKjB4MDYzMyovCisgICAgICAgIDEgKyAyICAgICAgICAgICAgKyAyNTYgKiAweDQ1LCAgLyoweDA2MzQqLworICAgICAgICAxICsgMiAgICAgICAgICAgICsgMjU2ICogMHg0OSwgIC8qMHgwNjM1Ki8KKyAgICAgICAgMSArIDIgICAgICAgICAgICArIDI1NiAqIDB4NEQsICAvKjB4MDYzNiovCisgICAgICAgIDEgKyAyICAgICAgICAgICAgKyAyNTYgKiAweDUxLCAgLyoweDA2MzcqLworICAgICAgICAxICsgMiAgICAgICAgICAgICsgMjU2ICogMHg1NSwgIC8qMHgwNjM4Ki8KKyAgICAgICAgMSArIDIgICAgICAgICAgICArIDI1NiAqIDB4NTksICAvKjB4MDYzOSovCisgICAgICAgIDEgKyAyICAgICAgICAgICAgKyAyNTYgKiAweDVELCAgLyoweDA2M0EqLworICAgICAgICAwLCAwLCAwLCAwLCAwLCAgICAgICAgICAgICAgICAgIC8qMHgwNjNCLTB4MDYzRiovCisgICAgICAgIDEgKyAyLCAgICAgICAgICAgICAgICAgICAgICAgICAgLyoweDA2NDAqLworICAgICAgICAxICsgMiAgICAgICAgICAgICsgMjU2ICogMHg2MSwgIC8qMHgwNjQxKi8KKyAgICAgICAgMSArIDIgICAgICAgICAgICArIDI1NiAqIDB4NjUsICAvKjB4MDY0MiovCisgICAgICAgIDEgKyAyICAgICAgICAgICAgKyAyNTYgKiAweDY5LCAgLyoweDA2NDMqLworICAgICAgICAxICsgMiAgICAgICArIDE2ICsgMjU2ICogMHg2RCwgIC8qMHgwNjQ0Ki8KKyAgICAgICAgMSArIDIgICAgICAgICAgICArIDI1NiAqIDB4NzEsICAvKjB4MDY0NSovCisgICAgICAgIDEgKyAyICAgICAgICAgICAgKyAyNTYgKiAweDc1LCAgLyoweDA2NDYqLworICAgICAgICAxICsgMiAgICAgICAgICAgICsgMjU2ICogMHg3OSwgIC8qMHgwNjQ3Ki8KKyAgICAgICAgMSAgICAgICAgICAgICAgICArIDI1NiAqIDB4N0QsICAvKjB4MDY0OCovCisgICAgICAgIDEgICAgICAgICAgICAgICAgKyAyNTYgKiAweDdGLCAgLyoweDA2NDkqLworICAgICAgICAxICsgMiAgICAgICAgICAgICsgMjU2ICogMHg4MSwgIC8qMHgwNjRBKi8KKyAgICAgICAgNCwgNCwgNCwgNCwgICAgICAgICAgICAgICAgICAgICAvKjB4MDY0Qi0weDA2NEUqLworICAgICAgICA0LCA0LCA0LCA0LCAgICAgICAgICAgICAgICAgICAgIC8qMHgwNjRGLTB4MDY1MiovCisgICAgICAgIDQsIDQsIDQsIDAsIDAsICAgICAgICAgICAgICAgICAgLyoweDA2NTMtMHgwNjU3Ki8KKyAgICAgICAgMCwgMCwgMCwgMCwgICAgICAgICAgICAgICAgICAgICAvKjB4MDY1OC0weDA2NUIqLworICAgICAgICAxICAgICAgICAgICAgICAgICsgMjU2ICogMHg4NSwgIC8qMHgwNjVDKi8KKyAgICAgICAgMSAgICAgICAgICAgICAgICArIDI1NiAqIDB4ODcsICAvKjB4MDY1RCovCisgICAgICAgIDEgICAgICAgICAgICAgICAgKyAyNTYgKiAweDg5LCAgLyoweDA2NUUqLworICAgICAgICAxICAgICAgICAgICAgICAgICsgMjU2ICogMHg4QiwgIC8qMHgwNjVGKi8KKyAgICAgICAgMCwgMCwgMCwgMCwgMCwgICAgICAgICAgICAgICAgICAvKjB4MDY2MC0weDA2NjQqLworICAgICAgICAwLCAwLCAwLCAwLCAwLCAgICAgICAgICAgICAgICAgIC8qMHgwNjY1LTB4MDY2OSovCisgICAgICAgIDAsIDAsIDAsIDAsIDAsIDAsICAgICAgICAgICAgICAgLyoweDA2NkEtMHgwNjZGKi8KKyAgICAgICAgNCwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKjB4MDY3MCovCisgICAgICAgIDAsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyoweDA2NzEqLworICAgICAgICAxICAgICAgICAgICArIDMyLCAgICAgICAgICAgICAgIC8qMHgwNjcyKi8KKyAgICAgICAgMSAgICAgICAgICAgKyAzMiwgICAgICAgICAgICAgICAvKjB4MDY3MyovCisgICAgICAgIDAsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyoweDA2NzQqLworICAgICAgICAxICAgICAgICAgICArIDMyLCAgICAgICAgICAgICAgIC8qMHgwNjc1Ki8KKyAgICAgICAgMSwgMSwgICAgICAgICAgICAgICAgICAgICAgICAgICAvKjB4MDY3Ni0weDA2NzcqLworICAgICAgICAxKzIsIDErMiwgMSsyLCAxKzIsIDErMiwgMSsyLCAgIC8qMHgwNjc4LTB4MDY3RCovCisgICAgICAgIDErMiwgMSsyLCAxKzIsIDErMiwgMSsyLCAxKzIsICAgLyoweDA2N0UtMHgwNjgzKi8KKyAgICAgICAgMSsyLCAxKzIsIDErMiwgMSsyLCAgICAgICAgICAgICAvKjB4MDY4NC0weDA2ODcqLworICAgICAgICAxLCAxLCAxLCAxLCAxLCAxLCAxLCAxLCAxLCAxLCAgIC8qMHgwNjg4LTB4MDY5MSovCisgICAgICAgIDEsIDEsIDEsIDEsIDEsIDEsIDEsIDEsICAgICAgICAgLyoweDA2OTItMHgwNjk5Ki8KKyAgICAgICAgMSsyLCAxKzIsIDErMiwgMSsyLCAxKzIsIDErMiwgICAvKjB4MDY5QS0weDA2QTMqLworICAgICAgICAxKzIsIDErMiwgMSsyLCAxKzIsICAgICAgICAgICAgIC8qMHgwNjlBLTB4MDZBMyovCisgICAgICAgIDErMiwgMSsyLCAxKzIsIDErMiwgMSsyLCAxKzIsICAgLyoweDA2QTQtMHgwNkFEKi8KKyAgICAgICAgMSsyLCAxKzIsIDErMiwgMSsyLCAgICAgICAgICAgICAvKjB4MDZBNC0weDA2QUQqLworICAgICAgICAxKzIsIDErMiwgMSsyLCAxKzIsIDErMiwgMSsyLCAgIC8qMHgwNkFFLTB4MDZCNyovCisgICAgICAgIDErMiwgMSsyLCAxKzIsIDErMiwgICAgICAgICAgICAgLyoweDA2QUUtMHgwNkI3Ki8KKyAgICAgICAgMSsyLCAxKzIsIDErMiwgMSsyLCAxKzIsIDErMiwgICAvKjB4MDZCOC0weDA2QkYqLworICAgICAgICAxKzIsIDErMiwgICAgICAgICAgICAgICAgICAgICAgIC8qMHgwNkI4LTB4MDZCRiovCisgICAgICAgIDEsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyoweDA2QzAqLworICAgICAgICAxKzIsICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qMHgwNkMxKi8KKyAgICAgICAgMSwgMSwgMSwgMSwgMSwgMSwgMSwgMSwgMSwgMSwgICAvKjB4MDZDMi0weDA2Q0IqLworICAgICAgICAxKzIsICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qMHgwNkNDKi8KKyAgICAgICAgMSwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKjB4MDZDRCovCisgICAgICAgIDErMiwgMSsyLCAxKzIsIDErMiwgICAgICAgICAgICAgLyoweDA2Q0UtMHgwNkQxKi8KKyAgICAgICAgMSwgMSAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKjB4MDZEMi0weDA2RDMqLworICAgIH07CisKKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnRbXSBwcmVzTGluayA9IHsKKyAgICAgICAgMSArIDIsICAgICAgICAgICAgICAgICAgICAgICAgLyoweEZFNzAqLworICAgICAgICAxICsgMiwgICAgICAgICAgICAgICAgICAgICAgICAvKjB4RkU3MSovCisgICAgICAgIDEgKyAyLCAwLCAxKyAyLCAwLCAxKyAyLCAgICAgIC8qMHhGRTcyLTB4RkU3NiovCisgICAgICAgIDEgKyAyLCAgICAgICAgICAgICAgICAgICAgICAgIC8qMHhGRTc3Ki8KKyAgICAgICAgMSsgMiwgMSArIDIsIDErMiwgMSArIDIsICAgICAgLyoweEZFNzgtMHhGRTgxKi8KKyAgICAgICAgMSsgMiwgMSArIDIsIDErMiwgMSArIDIsICAgICAgLyoweEZFODItMHhGRTg1Ki8KKyAgICAgICAgMCwgMCArIDMyLCAxICsgMzIsIDAgKyAzMiwgICAgLyoweEZFODYtMHhGRTg5Ki8KKyAgICAgICAgMSArIDMyLCAwLCAxLCAgMCArIDMyLCAgICAgICAgLyoweEZFOEEtMHhGRThEKi8KKyAgICAgICAgMSArIDMyLCAwLCAyLCAgMSArIDIsICAgICAgICAgLyoweEZFOEUtMHhGRTkxKi8KKyAgICAgICAgMSwgMCArIDMyLCAxICsgMzIsIDAsICAgICAgICAgLyoweEZFOTItMHhGRTk1Ki8KKyAgICAgICAgMiwgMSArIDIsIDEsIDAsICAgICAgICAgICAgICAgLyoweEZFOTYtMHhGRTk5Ki8KKyAgICAgICAgMSwgMCwgMiwgMSArIDIsICAgICAgICAgICAgICAgLyoweEZFOUEtMHhGRTlEKi8KKyAgICAgICAgMSwgMCwgMiwgMSArIDIsICAgICAgICAgICAgICAgLyoweEZFOUUtMHhGRUExKi8KKyAgICAgICAgMSwgMCwgMiwgMSArIDIsICAgICAgICAgICAgICAgLyoweEZFQTItMHhGRUE1Ki8KKyAgICAgICAgMSwgMCwgMiwgMSArIDIsICAgICAgICAgICAgICAgLyoweEZFQTYtMHhGRUE5Ki8KKyAgICAgICAgMSwgMCwgMiwgMSArIDIsICAgICAgICAgICAgICAgLyoweEZFQUEtMHhGRUFEKi8KKyAgICAgICAgMSwgMCwgMSwgMCwgICAgICAgICAgICAgICAgICAgLyoweEZFQUUtMHhGRUIxKi8KKyAgICAgICAgMSwgMCwgMSwgMCwgICAgICAgICAgICAgICAgICAgLyoweEZFQjItMHhGRUI1Ki8KKyAgICAgICAgMSwgMCwgMiwgMSsyLCAgICAgICAgICAgICAgICAgLyoweEZFQjYtMHhGRUI5Ki8KKyAgICAgICAgMSwgMCwgMiwgMSsyLCAgICAgICAgICAgICAgICAgLyoweEZFQkEtMHhGRUJEKi8KKyAgICAgICAgMSwgMCwgMiwgMSsyLCAgICAgICAgICAgICAgICAgLyoweEZFQkUtMHhGRUMxKi8KKyAgICAgICAgMSwgMCwgMiwgMSsyLCAgICAgICAgICAgICAgICAgLyoweEZFQzItMHhGRUM1Ki8KKyAgICAgICAgMSwgMCwgMiwgMSsyLCAgICAgICAgICAgICAgICAgLyoweEZFQzYtMHhGRUM5Ki8KKyAgICAgICAgMSwgMCwgMiwgMSsyLCAgICAgICAgICAgICAgICAgLyoweEZFQ0EtMHhGRUNEKi8KKyAgICAgICAgMSwgMCwgMiwgMSsyLCAgICAgICAgICAgICAgICAgLyoweEZFQ0UtMHhGRUQxKi8KKyAgICAgICAgMSwgMCwgMiwgMSsyLCAgICAgICAgICAgICAgICAgLyoweEZFRDItMHhGRUQ1Ki8KKyAgICAgICAgMSwgMCwgMiwgMSsyLCAgICAgICAgICAgICAgICAgLyoweEZFRDYtMHhGRUQ5Ki8KKyAgICAgICAgMSwgMCwgMiwgMSsyLCAgICAgICAgICAgICAgICAgLyoweEZFREEtMHhGRUREKi8KKyAgICAgICAgMSwgMCwgMiwgMSsyLCAgICAgICAgICAgICAgICAgLyoweEZFREUtMHhGRUUxKi8KKyAgICAgICAgMSwgMCArIDE2LCAyICsgMTYsIDEgKyAyICsxNiwgLyoweEZFRTItMHhGRUU1Ki8KKyAgICAgICAgMSArIDE2LCAwLCAyLCAxKzIsICAgICAgICAgICAgLyoweEZFRTYtMHhGRUU5Ki8KKyAgICAgICAgMSwgMCwgMiwgMSsyLCAgICAgICAgICAgICAgICAgLyoweEZFRUEtMHhGRUVEKi8KKyAgICAgICAgMSwgMCwgMiwgMSsyLCAgICAgICAgICAgICAgICAgLyoweEZFRUUtMHhGRUYxKi8KKyAgICAgICAgMSwgMCwgMSwgMCwgICAgICAgICAgICAgICAgICAgLyoweEZFRjItMHhGRUY1Ki8KKyAgICAgICAgMSwgMCwgMiwgMSsyLCAgICAgICAgICAgICAgICAgLyoweEZFRjYtMHhGRUY5Ki8KKyAgICAgICAgMSwgMCwgMSwgMCwgICAgICAgICAgICAgICAgICAgLyoweEZFRkEtMHhGRUZEKi8KKyAgICAgICAgMSwgMCwgMSwgMCwKKyAgICAgICAgMQorICAgIH07CisKKyAgICBwcml2YXRlIHN0YXRpYyBpbnRbXSBjb252ZXJ0RkV0bzA2ID0geworICAgICAgICAvKioqKioqKioqKiowKioqKioqMSoqKioqKjIqKioqKiozKioqKioqNCoqKioqKjUqKioqKio2KioqKioqNyoqKioqKjgqKioqKio5KioqKioqQSoqKioqKkIqKioqKipDKioqKioqRCoqKioqKkUqKioqKipGKioqLworICAgICAgICAvKkZFNyovICAgMHg2NEIsIDB4NjRCLCAweDY0QywgMHg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BkZXN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IHN0YXJ0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGxlbmd0aCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoYXIgZGlnaXRCYXNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbGVhbiBsYXN0U3Ryb25nV2FzQUwpIHsKKyAgICAgICAgZGlnaXRCYXNlIC09ICcwJzsgLy8gbW92ZSBjb21tb24gYWRqdXN0bWVudCBvdXQgb2YgbG9vcAorCisgICAgICAgIGZvcihpbnQgaSA9IHN0YXJ0ICsgbGVuZ3RoOyAtLWkgPj0gc3RhcnQ7KSB7CisgICAgICAgICAgICBjaGFyIGNoID0gZGVzdFtpXTsKKyAgICAgICAgICAgIHN3aXRjaCAoQ2hhcmFjdGVyLmdldERpcmVjdGlvbmFsaXR5KGNoKSkgeworICAgICAgICAgICAgY2FzZSBDaGFyYWN0ZXIuRElSRUNUSU9OQUxJVFlfTEVGVF9UT19SSUdIVDoKKyAgICAgICAgICAgIGNhc2UgQ2hhcmFjdGVyLkRJUkVDVElPTkFMSVRZX1JJR0hUX1RPX0xFRlQ6CisgICAgICAgICAgICAgICAgbGFzdFN0cm9uZ1dhc0FMID0gZmFsc2U7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIENoYXJhY3Rlci5ESVJFQ1RJT05BTElUWV9SSUdIVF9UT19MRUZUX0FSQUJJQzoKKyAgICAgICAgICAgICAgICBsYXN0U3Ryb25nV2FzQUwgPSB0cnVlOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBDaGFyYWN0ZXIuRElSRUNUSU9OQUxJVFlfRVVST1BFQU5fTlVNQkVSOgorICAgICAgICAgICAgICAgIGlmIChsYXN0U3Ryb25nV2FzQUwgJiYgY2ggPD0gJ1x1MDAzOScpIHsKKyAgICAgICAgICAgICAgICAgICAgZGVzdFtpXSA9IChjaGFyKShjaCArIGRpZ2l0QmFzZSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIC8qCisgICAgICogTmFtZSAgICA6IGludmVydEJ1ZmZlcgorICAgICAqIEZ1bmN0aW9uOiBUaGlzIGZ1bmN0aW9uIGludmVydHMgdGhlIGJ1ZmZlciwgaXQncyB1c2VkCisgICAgICogICAgICAgICAgIGluIGNhc2UgdGhlIHVzZXIgc3BlY2lmaWVzIHRoZSBidWZmZXIgdG8gYmUKKyAgICAgKiAgICAgICAgICAgVEVYVF9ESVJFQ1RJT05fTE9HSUNBTAorICAgICAqLworICAgIHByaXZhdGUgc3RhdGljIHZvaWQgaW52ZXJ0QnVmZmVyKGNoYXJbXSBidWZmZXIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IHN0YXJ0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBsZW5ndGgpIHsKKworICAgICAgICBmb3IoaW50IGkgPSBzdGFydCwgaiA9IHN0YXJ0ICsgbGVuZ3RoIC0gMTsgaSA8IGo7IGkrKywgLS1qKSB7CisgICAgICAgICAgICBjaGFyIHRlbXAgPSBidWZmZXJbaV07CisgICAgICAgICAgICBidWZmZXJbaV0gPSBidWZmZXJbal07CisgICAgICAgICAgICBidWZmZXJbal0gPSB0ZW1wOworICAgICAgICB9CisgICAgfQorCisgICAgLyoKKyAgICAgKiBOYW1lICAgIDogY2hhbmdlTGFtQWxlZgorICAgICAqIEZ1bmN0aW9uOiBDb252ZXJ0cyB0aGUgQWxlZiBjaGFyYWN0ZXJzIGludG8gYW4gZXF1aXZh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AgICBpZiAoKGNoID4gJ1x1MDYyMScgJiYgY2ggPCAnXHUwNjI2JykgfHwKKyAgICAgICAgICAgIChjaCA9PSAnXHUwNjI3JykgfHwKKyAgICAgICAgICAgIChjaCA+ICdcdTA2MkUnICYmIGNoIDwgJ1x1MDYzMycpIHx8CisgICAgICAgICAgICAoY2ggPiAnXHUwNjQ3JyAmJiBjaCA8ICdcdTA2NEEnKSB8fAorICAgICAgICAgICAgKGNoID09ICdcdTA2MjknKSkgeworICAgICAgICAgICAgcmV0dXJuIDE7CisgICAgICAgIH0gZWxzZSBpZiAoY2ggPj0gJ1x1MDY0QicgJiYgY2g8PSAnXHUwNjUyJykgeworICAgICAgICAgICAgcmV0dXJuIDI7CisgICAgICAgIH0gZWxzZSBpZiAoY2ggPj0gMHgwNjUzICYmIGNoIDw9IDB4MDY1NSB8fAorICAgICAgICAgICAgICAgICAgIGNoID09IDB4MDY3MCB8fAorICAgICAgICAgICAgICAgICAgIGNoID49IDB4RkU3MCAmJiBjaCA8PSAweEZFN0YpIHsKKyAgICAgICAgICAgIHJldHVybiAzOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgcmV0dXJuIDA7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKgorICAgICAqIE5hbWUgICAgOiBnZXRMaW5rCisgICAgICogRnVuY3Rpb246IFJlc29sdmVzIHRoZSBsaW5rIGJldHdlZW4gdGhlIGNoYXJhY3RlcnMgYXMKKyAgICAgKiAgICAgICAgICAgQXJhYmljIGNoYXJhY3RlcnMgaGF2ZSBmb3VyIGZvcm1zIDoKKyAgICAgKiAgICAgICAgICAgSXNvbGF0ZWQsIEluaXRpYWwsIE1pZGRsZSBhbmQgRmluYWwgRm9ybQorICAgICAqLworICAgIHByaXZhdGUgc3RhdGljIGludCBnZXRMaW5rKGNoYXIgY2gpIHsKKyAgICAgICAgaWYgKGNoID49ICdcdTA2MjInICYmIGNoIDw9ICdcdTA2RDMnKSB7CisgICAgICAgICAgICByZXR1cm4gYXJhTGlua1tjaCAtICdcdTA2MjInXTsKKyAgICAgICAgfSBlbHNlIGlmIChjaCA9PSAnXHUyMDBEJykgeworICAgICAgICAgICAgcmV0dXJuIDM7CisgICAgICAgIH0gZWxzZSBpZiAoY2ggPj0gJ1x1MjA2RCcgJiYgY2ggPD0gJ1x1MjA2RicpIHsKKyAgICAgICAgICAgIHJldHVybiA0OworICAgICAgICB9IGVsc2UgaWYgKGNoID49ICdcdUZFNzAnICYmIGNoIDw9ICdcdUZFRkMnKSB7CisgICAgICAgICAgICByZXR1cm4gcHJlc0xpbmtbY2ggLSAnXHVGRTcwJ107CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICByZXR1cm4gMDsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qCisgICAgICogTmFtZSAgICA6IGNvdW50U3BhY2VzCisgICAgICogRnVuY3Rpb246IENvdW50cyB0aGUgbnVtYmVyIG9mIHNwYWNlcworICAgICAqICAgICAgICAgICBhdCBlYWNoIGVuZCBvZiB0aGUgbG9naWNhbCBidWZmZXIKKyAgICAgKi8KKyAgICBwcml2YXRlIHN0YXRpYyBpbnQgY291bnRTcGFjZXNMZWZ0KGNoYXJbXSBkZXN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IHN0YXJ0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGNvdW50KSB7CisgICAgICAgIGZvciAoaW50IGkgPSBzdGFydCwgZSA9IHN0YXJ0ICsgY291bnQ7IGkgPCBlOyArK2kpIHsKKyAgICAgICAgICAgIGlmIChkZXN0W2ldICE9IFNQQUNFX0NIQVIpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gaSAtIHN0YXJ0OworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHJldHVybiBjb3VudDsKKyAgICB9CisKKyAgICBwcml2YXRlIHN0YXRpYyBpbnQgY291bnRTcGFjZXNSaWdodChjaGFyW10gZGVzdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgc3RhcnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGNvdW50KSB7CisKKyAgICAgICAgZm9yIChpbnQgaSA9IHN0YXJ0ICsgY291bnQ7IC0taSA+PSBzdGFydDspIHsKKyAgICAgICAgICAgIGlmIChkZXN0W2ldICE9IFNQQUNFX0NIQVIpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gc3RhcnQgKyBjb3VudCAtIDEgLSBpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHJldHVybiBjb3VudDsKKyAgICB9CisKKyAgICAvKgorICAgICAqIE5hbWUgICAgOiBpc1Rhc2hrZWVsQ2hhcgorICAgICAqIEZ1bmN0aW9uOiBSZXR1cm5zIHRydWUgZm9yIFRhc2hrZWVsIGNoYXJhY3RlcnMgZWxzZSByZXR1cm4gZmFsc2UKKyAgICAgKi8KKyAgICBwcml2YXRlIHN0YXRpYyBib29sZWFuIGlzVGFzaGtlZWxDaGFyKGNoYXIgY2gpIHsKKyAgICAgICAgcmV0dXJuICggY2ggPj0nXHUwNjRCJyAmJiBjaCA8PSAnXHUwNjUyJyApOworICAgIH0KKworICAgIC8qCisgICAgICpOYW1lICAgICA6IGlzU2VlblRhaWxGYW1pbHlDaGFyCisgICAgICpGdW5jdGlvbiA6IHJldHVybnMgMSBpZiB0aGUgY2hhcmFjdGVyIGlzIGEgc2VlbiBmYW1pbHkgaXNvbGF0ZWQgY2hhcmFjdGVyCisgICAgICogICAgICAgICAgIGluIHRoZSBGRSByYW5nZSBvdGhlcndpc2UgcmV0dXJucyAwCisgICAgICovCisKKyAgICBwcml2YXRlIHN0YXRpYyBpbnQgaXNTZWVuVGFpbEZhbWlseUNoYXIoY2hhciBjaCkgeworICAgICAgICBpZiAoY2ggPj0gMHhmZWIxICYmIGNoIDwgMHhmZWJmKXsKKyAgICAgICAgICAgICByZXR1cm4gdGFpbEZhbWlseUlzb2xhdGVkRmluYWwgW2NoIC0gMHhGRUIxXTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICByZXR1cm4gMDsKKyAgICAgICAgfQorICAgIH0KKworICAgICAvKiBOYW1lICAgICA6IGlzU2VlbkZhbWlseUNoYXIKKyAgICAgICogRnVuY3Rpb24gOiByZXR1cm5zIDEgaWYgdGhlIGNoYXJhY3RlciBpcyBhIHNlZW4gZmFtaWx5IGNoYXJhY3RlciBpbiB0aGUgVW5pY29kZQorICAgICAgKiAgICAgICAgICAgIDA2IHJhbmdlIG90aGVyd2lzZSByZXR1cm5zIDAKKyAgICAgKi8KKworICAgIHByaXZhdGUgc3RhdGljIGludCBpc1NlZW5GYW1pbHlDaGFyKGNoYXIgIGNoKXsKKyAgICAgICAgaWYgKGNoID49IDB4NjMzICYmIGNoIDw9IDB4NjM2KXsKKyAgICAgICAgICAgIHJldHVybiAxOworICAgICAgICB9ZWxzZSB7CisgICAgICAgICAgICByZXR1cm4gMDsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qCisgICAgICpOYW1lICAgICA6IGlzVGFpbENoYXIKKyAgICAgKkZ1bmN0aW9uIDogcmV0dXJucyB0cnVlIGlmIHRoZSBjaGFyYWN0ZXIgbWF0Y2hlcyBvbmUgb2YgdGhlIHRhaWwgY2hhcmFjdGVycworICAgICAqICAgICAgICAgICAoMHhmZTczIG9yIDB4MjAwYikgb3RoZXJ3aXNlIHJldHVybnMgZmFsc2UKKyAgICAgKi8KKworICAgIHByaXZhdGUgc3RhdGljIGJvb2xlYW4gaXNUYWlsQ2hhcihjaGFyIGNoKSB7CisgICAgICAgIGlmKGNoID09IE9MRF9UQUlMX0NIQVIgfHwgY2ggPT0gTkVXX1RBSUxfQ0hBUil7CisgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgIH1lbHNleworICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qCisgICAgICpOYW1lICAgICA6IGlzQWxlZk1ha3NvdXJhQ2hhcgorICAgICAqRnVuY3Rpb24gOiByZXR1cm5zIHRydWUgaWYgdGhlIGNoYXJhY3RlciBpcyBhIEFsZWYgTWFrc291cmEgRmluYWwgb3IgaXNvbGF0ZWQKKyAgICAgKiAgICAgICAgICAgb3RoZXJ3aXNlIHJldHVybnMgZmFsc2UKKyAgICAgKi8KKyAgICBwcml2YXRlIHN0YXRpYyBib29sZWFuIGlzQWxlZk1ha3NvdXJhQ2hhcihjaGFyIGNoKSB7CisgICAgICAgIHJldHVybiAoIChjaCA9PSAweEZFRUYpIHx8ICggY2ggPT0gMHhGRUYwKSB8fCAoY2ggPT0gMHgwNjQ5KSk7CisgICAgfQorCisgICAgLyoKKyAgICAgKiBOYW1lICAgICA6IGlzWWVoSGFtemFDaGFyCisgICAgICogRnVuY3Rpb24gOiByZXR1cm5zIHRydWUgaWYgdGhlIGNoYXJhY3RlciBpcyBhIHllaEhhbXphIGlzb2xhdGVkIG9yIHllaGhhbXphCisgICAgICogICAgICAgICAgICBmaW5hbCBpcyBmb3VuZCBvdGhlcndpc2UgcmV0dXJucyBmYWxzZQorICAgICAqLworICAgIHByaXZhdGUgc3RhdGljIGJvb2xlYW4gaXNZZWhIYW16YUNoYXIoY2hhciBjaCkgeworICAgICAgICBpZigoY2g9PTB4RkU4OSl8fChjaD09MHhGRThBKSl7CisgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgfWVsc2V7CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKgorICAgICAqTmFtZSAgICAgOiBpc1Rhc2hrZWVsQ2hhckZFCisgICAgICpGdW5jdGlvbiA6IFJldHVybnMgdHJ1ZSBmb3IgVGFzaGtlZWwgY2hhcmFjdGVycyBpbiBGRSByYW5nZSBlbHNlIHJldHVybiBmYWxzZQorICAgICAqLworCisgICAgcHJpdmF0ZSBzdGF0aWMgYm9vbGVhbiBpc1Rhc2hrZWVsQ2hhckZFKGNoYXIgY2gpIHsKKyAgICAgICAgcmV0dXJuICggY2ghPTB4RkU3NSAmJihjaD49MHhGRTcwICYmIGNoPD0gMHhGRTdGKSApOworICAgIH0KKworICAgIC8qCisgICAgICogTmFtZTogaXNUYXNoa2VlbE9uVGF0d2VlbENoYXIKKyAgICAgKiBGdW5jdGlvbjogQ2hlY2tzIGlmIHRoZSBUYXNoa2VlbCBDaGFyYWN0ZXIgaXMgb24gVGF0d2VlbCBvciBub3QsaWYgdGhlCisgICAgICogICAgICAgICAgIFRhc2hrZWVsIG9uIHRhdHdlZWwgKEZFIHJhbmdlKSwgaXQgcmV0dXJucyAxIGVsc2UgaWYgdGhlCisgICAgICogICAgICAgICAgIFRhc2hrZWVsIHdpdGggc2hhZGRhIG9uIHRhdHdlZWwgKEZDIHJhbmdlKXJldHVybiAyIG90aGVyd2lzZQorICAgICAqICAgICAgICAgICByZXR1cm5zIDAKKyAgICAgKi8KKyAgICBwcml2YXRlIHN0YXRpYyBpbnQgaXNUYXNoa2VlbE9uVGF0d2VlbENoYXIoY2hhciBjaCl7CisgICAgICAgIGlmIChjaCA+PSAweGZlNzAgJiYgY2ggPD0gMHhmZTdmICYmIGNoICE9IE5FV19UQUlMX0NIQVIgJiYgY2ggIT0gMHhGRTc1ICYmIGNoICE9IFNIQUREQV9UQVRXRUVMX0NIQVIpCisgICAgICAgIHsKKyAgICAgICAgICAgIHJldHVybiB0YXNoa2VlbE1lZGlhbCBbY2ggLSAweEZFNzBdOworICAgICAgICB9IGVsc2UgaWYoIChjaCA+PSAweGZjZjIgJiYgY2ggPD0gMHhmY2Y0KSB8fCAoY2ggPT0gU0hBRERBX1RBVFdFRUxfQ0hBUikpIHsKKyAgICAgICAgICAgIHJldHVybiAyOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgcmV0dXJuIDA7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKgorICAgICAqIE5hbWU6IGlzSXNvbGF0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T0gJ1x1MDYyNScgfHwgY2ggPT0gJ1x1MDYyNyc7CisgICAgfQorCisgICAgLyoKKyAgICAgKiBOYW1lICAgIDogaXNMYW1BbGVmQ2hhcgorICAgICAqIEZ1bmN0aW9uOiBSZXR1cm5zIHRydWUgZm9yIExhbUFsZWYgY2hhcmFjdGVycyBlbHNlIHJldHVybiBmYWxzZQorICAgICAqLworICAgIHByaXZhdGUgc3RhdGljIGJvb2xlYW4gaXNMYW1BbGVmQ2hhcihjaGFyIGNoKSB7CisgICAgICAgIHJldHVybiBjaCA+PSAnXHVGRUY1JyAmJiBjaCA8PSAnXHVGRUZDJzsKKyAgICB9CisKKyAgICBwcml2YXRlIHN0YXRpYyBib29sZWFuIGlzTm9ybWFsaXplZExhbUFsZWZDaGFyKGNoYXIgY2gpIHsKKyAgICAgICAgcmV0dXJuIGNoID49ICdcdTA2NUMnICYmIGNoIDw9ICdcdTA2NUYnOworICAgIH0KKworICAgIC8qCisgICAgICogTmFtZSAgICA6IGNhbGN1bGF0ZVNpemUKKyAgICAgKiBGdW5jdGlvbjogVGhpcyBmdW5jdGlvbiBjYWxjdWxhdGVzIHRoZSBkZXN0U2l6ZSB0byBiZSB1c2VkIGluIHByZWZsaWdodGluZworICAgICAqICAgICAgICAgICB3aGVuIHRoZSBkZXN0U2l6ZSBpcyBlcXVhbCB0byAwCisgICAgICovCisgICAgcHJpdmF0ZSBpbnQgY2FsY3VsYXRlU2l6ZShjaGFyW10gc291cmNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IHNvdXJjZVN0YXJ0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IHNvdXJjZUxlbmd0aCkgeworCisgICAgICAgIGludCBkZXN0U2l6ZSA9IHNvdXJjZUxlbmd0aDsKKworICAgICAgICBzd2l0Y2ggKG9wdGlvbnMgJiBMRVRURVJTX01BU0spIHsKKyAgICAgICAgY2FzZSBMRVRURVJTX1NIQVBFOgorICAgICAgICBjYXNlIExFVFRFUlNfU0hBUEVfVEFTSEtFRUxfSVNPTEFURUQ6CisgICAgICAgICAgICBpZiAoaXNMb2dpY2FsKSB7CisgICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IHNvdXJjZVN0YXJ0LCBlID0gc291cmNlU3RhcnQgKyBzb3VyY2VMZW5ndGggLSAxOyBpIDwgZTsgKytpKSB7CisgICAgICAgICAgICAgICAgICAgIGlmICgoc291cmNlW2ldID09IExBTV9DSEFSICYmIGlzQWxlZkNoYXIoc291cmNlW2krMV0pKSB8fCBpc1Rhc2hrZWVsQ2hhckZFKHNvdXJjZVtpXSkpeworICAgICAgICAgICAgICAgICAgICAgICAgLS1kZXN0U2l6ZTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0gZWxzZSB7IC8vIHZpc3VhbAorICAgICAgICAgICAgICAgIGZvcihpbnQgaSA9IHNvdXJjZVN0YXJ0ICsgMSwgZSA9IHNvdXJjZVN0YXJ0ICsgc291cmNlTGVuZ3RoOyBpIDwgZTsgKytpKSB7CisgICAgICAgICAgICAgICAgICAgIGlmICgoc291cmNlW2ldID09IExBTV9DSEFSICYmIGlzQWxlZkNoYXIoc291cmNlW2ktMV0pKSB8fCBpc1Rhc2hrZWVsQ2hhckZFKHNvdXJjZVtpXSkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIC0tZGVzdFNpemU7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBicmVhazsKKworICAgICAgICBjYXNlIExFVFRFUlNfVU5TSEFQRToKKyAgICAgICAgICAgIGZvcihpbnQgaSA9IHNvdXJjZVN0YXJ0LCBlID0gc291cmNlU3RhcnQgKyBzb3VyY2VMZW5ndGg7IGkgPCBlOyArK2kpIHsKKyAgICAgICAgICAgICAgICBpZiAoaXNMYW1BbGVmQ2hhcihzb3VyY2VbaV0pKSB7CisgICAgICAgICAgICAgICAgICAgIGRlc3RTaXplKys7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisKKyAgICAgICAgcmV0dXJuIGRlc3RTaXplOworICAgIH0KKworCisgICAgLyoKKyAgICAgKiBOYW1lICAgIDogY291bnRTcGFjZVN1YgorICAgICAqIEZ1bmN0aW9uOiBDb3VudHMgbnVtYmVyIG9mIHRpbWVzIHRoZSBzdWJDaGFyIGFwcGVhcnMgaW4gdGhlIGFycmF5CisgICAgICovCisgICAgcHVibGljIHN0YXRpYyBpbnQgY291bnRTcGFjZVN1YihjaGFyIFtdIGRlc3QsaW50IGxlbmd0aCwgY2hhciBzdWJDaGFyKXsKKyAgICAgICAgaW50IGkgPSAwOworICAgICAgICBpbnQgY291bnQgPSAwOworICAgICAgICB3aGlsZSAoaSA8IGxlbmd0aCkgeworICAgICAgICAgIGlmIChkZXN0W2ldID09IHN1YkNoYXIpIHsKKyAgICAgICAgICAgICAgY291bnQrKzsKKyAgICAgICAgICAgICAgfQorICAgICAgICAgIGkrKzsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gY291bnQ7CisgICAgfQorCisgICAgLyoKKyAgICAgKiBOYW1lICAgIDogc2hpZnRBcnJheQorICAgICAqIEZ1bmN0aW9uOiBTaGlmdHMgY2hhcmFjdGVycyB0byByZXBsYWNlIHNwYWNlIHN1YiBjaGFyYWN0ZXJzCisgICAgICovCisgICAgcHVibGljIHN0YXRpYyB2b2lkIHNoaWZ0QXJyYXkoY2hhciBbXSBkZXN0LGludCBzdGFydCwgaW50IGUsIGNoYXIgc3ViQ2hhcil7CisgICAgICAgIGludCB3ID0gZTsKKyAgICAgICAgaW50IHIgPSBlOworICAgICAgICB3aGlsZSAoLS1yID49IHN0YXJ0KSB7CisgICAgICAgICAgY2hhciBjaCA9IGRlc3Rbcl07CisgICAgICAgICAgaWYgKGNoICE9IHN1YkNoYXIpIHsKKyAgICAgICAgICAgIC0tdzsKKyAgICAgICAgICAgIGlmICh3ICE9IHIpIHsKKyAgICAgICAgICAgICAgZGVzdFt3XSA9IGNoOworICAgICAgICAgICAgfQorICAgICAgICAgIH0KKyAgICAgICAgfQorICAgfQorCisgICAgLyoKKyAgICAgKiBOYW1lICAgIDogZmxpcEFycmF5CisgICAgICogRnVuY3Rpb246IGludmVydHMgYXJyYXksIHNvIHRoYXQgc3RhcnQgYmVjb21lcyBlbmQgYW5kIHZpY2UgdmVyc2EKKyAgICAgKi8KKyAgICAgIHB1YmxpYyBzdGF0aWMgaW50IGZsaXBBcnJheShjaGFyIFtdIGRlc3QsIGludCBzdGFydCwgaW50IGUsIGludCB3KXsKKyAgICAgICAgaW50IHI7CisgICAgICAgIGlmICh3ID4gc3RhcnQpIHsKKyAgICAgICAgLy8gc2hpZnQsIGFzc3VtZSBzbWFsbCBidWZmZXIgc2l6ZSBzbyBkb24ndCB1c2UgYXJyYXljb3B5CisgICAgICAgICAgciA9IHc7CisgICAgICAgICAgdyA9IHN0YXJ0OworICAgICAgICAgIHdoaWxlIChyIDwgZSkgeworICAgICAgICAgICAgZGVzdFt3KytdID0gZGVzdFtyKytdOworICAgICAgICAgICB9CisgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgIHcgPSBlOworICAgICAgICAgfQorICAgICAgICByZXR1cm4gdzsKKyAgICAgIH0KKworICAgIC8qCisgICAgICogTmFtZSAgICAgOiBoYW5kbGVUYXNoa2VlbFdpdGhUYXR3ZWVsCisgICAgICogRnVuY3Rpb24gOiBSZXBsYWNlcyBUYXNoa2VlbCBhcyBmb2xsb3dpbmc6CisgICAgICogICAgICAgICAgICBDYXNlIDEgOmlmIHRoZSBUYXNoa2VlbCBvbiB0YXR3ZWVsLCByZXBsYWNlIGl0IHdpdGggVGF0d2VlbC4KKyAgICAgKiAgICAgICAgICAgIENhc2UgMiA6aWYgdGhlIFRhc2hrZWVsIGFnZ3JlZ2F0ZWQgd2l0aCBTaGFkZGEgb24gVGF0d2VlbCwgcmVwbGFjZQorICAgICAqICAgICAgICAgICAgICAgICAgIGl0IHdpdGggU2hhZGRhIG9uIFRhdHdlZWwuCisgICAgICogICAgICAgICAgICBDYXNlIDM6IGlmIHRoZSBUYXNoa2VlbCBpcyBpc29sYXRlZCByZXBsYWNlIGl0IHdpdGggU3BhY2UuCisgICAgICoKKyAgICAgKi8KKyAgICBwcml2YXRlIHN0YXRpYyBpbnQgaGFuZGxlVGFzaGtlZWxXaXRoVGF0d2VlbChjaGFyW10gZGVzdCwgaW50IHNvdXJjZUxlbmd0aCkgeworICAgICAgICAgICAgICAgICAgICAgaW50IGk7CisgICAgICAgICAgICAgICAgICAgICBmb3IoaSA9IDA7IGkgPCBzb3VyY2VMZW5ndGg7IGkrKyl7CisgICAgICAgICAgICAgICAgICAgICAgICAgaWYoKGlzVGFzaGtlZWxPblRhdHdlZWxDaGFyKGRlc3RbaV0pID09IDEpKXsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVzdFtpXSA9IFRBVFdFRUxfQ0hBUjsKKyAgICAgICAgICAgICAgICAgICAgICAgIH1lbHNlIGlmKChpc1Rhc2hrZWVsT25UYXR3ZWVsQ2hhcihkZXN0W2ldKSA9PSAyKSl7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlc3RbaV0gPSBTSEFEREFfVEFUV0VFTF9DSEFSOworICAgICAgICAgICAgICAgICAgICAgICAgfWVsc2UgaWYoKGlzSXNvbGF0ZWRUYXNoa2VlbENoYXIoZGVzdFtpXSk9PTEpICYmIGRlc3RbaV0gIT0gU0hBRERBX0NIQVIpeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXN0W2ldID0gU1BBQ0VfQ0hBUjsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgIHJldHVybiBzb3VyY2VMZW5ndGg7CisgICAgfQ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SEtFRUxfRU5EOyBicmVhazsKKyAgICAgICAgICBjYXNlIFRBU0hLRUVMX0VORDogbGVuT3B0aW9uc1Rhc2hrZWVsID0gVEFTSEtFRUxfQkVHSU47IGJyZWFrOworICAgICAgICAgIGRlZmF1bHQ6IGJyZWFrOworICAgICAgICAgIH0KKyAgICAgICAgfQorCisKKyAgICAgIGlmIChsZW5PcHRpb25zTGFtQWxlZiA9PSBMQU1BTEVGX05FQVIpIHsKKyAgICAgICAgICBmb3IgKGludCBpID0gc3RhcnQsIGUgPSBpICsgbGVuZ3RoOyBpIDwgZTsgKytpKSB7CisgICAgICAgICAgICAgIGlmIChkZXN0W2ldID09IExBTUFMRUZfU1BBQ0VfU1VCKSB7CisgICAgICAgICAgICAgICAgICBkZXN0W2ldID0gU1BBQ0VfQ0hBUl9GT1JfTEFNQUxFRjsKKyAgICAgICAgICAgICAgfQorICAgICAgICAgIH0KKworICAgICAgfSBlbHNlIHsKKworICAgICAgICAgIGZpbmFsIGludCBlID0gc3RhcnQgKyBsZW5ndGg7CisgICAgICAgICAgaW50IHdMID0gY291bnRTcGFjZVN1YihkZXN0LCBsZW5ndGgsIExBTUFMRUZfU1BBQ0VfU1VCKTsKKyAgICAgICAgICBpbnQgd1QgPSBjb3VudFNwYWNlU3ViKGRlc3QsIGxlbmd0aCwgVEFTSEtFRUxfU1BBQ0VfU1VCKTsKKworICAgICAgICAgIGlmIChsZW5PcHRpb25zTGFtQWxlZiA9PSBMQU1BTEVGX0VORCl7CisgICAgICAgICAgICBsYW1BbGVmT24gPSB0cnVlOworICAgICAgICAgIH0KKyAgICAgICAgICBpZiAobGVuT3B0aW9uc1Rhc2hrZWVsID09IFRBU0hLRUVMX0VORCl7CisgICAgICAgICAgICB0YXNoa2VlbE9uID0gdHJ1ZTsKKyAgICAgICAgICB9CisKKworICAgICAgICAgIGlmIChsYW1BbGVmT24gJiYgKGxlbk9wdGlvbnNMYW1BbGVmID09IExBTUFMRUZfRU5EKSkgeworICAgICAgICAgICAgc2hpZnRBcnJheShkZXN0LCBzdGFydCwgZSwgTEFNQUxFRl9TUEFDRV9TVUIpOworICAgICAgICAgICAgd2hpbGUgKHdMID4gc3RhcnQpIHsKKyAgICAgICAgICAgICAgICBkZXN0Wy0td0xdID0gU1BBQ0VfQ0hBUjsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICB9CisKKyAgICAgICAgICBpZiAodGFzaGtlZWxPbiAmJiAobGVuT3B0aW9uc1Rhc2hrZWVsID09IFRBU0hLRUVMX0VORCkpeworICAgICAgICAgICAgc2hpZnRBcnJheShkZXN0LCBzdGFydCwgZSwgVEFTSEtFRUxfU1BBQ0VfU1VCKTsKKyAgICAgICAgICAgIHdoaWxlICh3VCA+IHN0YXJ0KSB7CisgICAgICAgICAgICAgICAgIGRlc3RbLS13VF0gPSBTUEFDRV9DSEFSOworICAgICAgICAgICAgfQorICAgICAgICAgIH0KKworICAgICAgICAgIGxhbUFsZWZPbiA9IGZhbHNlOworICAgICAgICAgIHRhc2hrZWVsT24gPSBmYWxzZTsKKworICAgICAgICAgIGlmIChsZW5PcHRpb25zTGFtQWxlZiA9PSBMQU1BTEVGX1JFU0laRSl7CisgICAgICAgICAgICBsYW1BbGVmT24gPSB0cnVlOworICAgICAgICAgIH0KKyAgICAgICAgICBpZiAobGVuT3B0aW9uc1Rhc2hrZWVsID09IFRBU0hLRUVMX1JFU0laRSl7CisgICAgICAgICAgICB0YXNoa2VlbE9uID0gdHJ1ZTsKKyAgICAgICAgICB9CisKKyAgICAgICAgICBpZiAobGFtQWxlZk9uICYmIChsZW5PcHRpb25zTGFtQWxlZiA9PSBMQU1BTEVGX1JFU0laRSkpeworICAgICAgICAgICAgICBzaGlmdEFycmF5KGRlc3QsIHN0YXJ0LCBlLCBMQU1BTEVGX1NQQUNFX1NVQik7CisgICAgICAgICAgICAgIHdMID0gZmxpcEFycmF5KGRlc3Qsc3RhcnQsZSwgd0wpOworICAgICAgICAgICAgICBsZW5ndGggPSB3TCAtIHN0YXJ0OworICAgICAgICAgIH0KKyAgICAgICAgICBpZiAodGFzaGtlZWxPbiAmJiAobGVuT3B0aW9uc1Rhc2hrZWVsID09IFRBU0hLRUVMX1JFU0laRSkpIHsKKyAgICAgICAgICAgICAgc2hpZnRBcnJheShkZXN0LCBzdGFydCwgZSwgVEFTSEtFRUxfU1BBQ0VfU1VCKTsKKyAgICAgICAgICAgICAgd1QgPSBmbGlwQXJyYXkoZGVzdCxzdGFydCxlLCB3VCk7CisgICAgICAgICAgICAgIGxlbmd0aCA9IHdUIC0gc3RhcnQ7CisgICAgICAgICAgfQorCisgICAgICAgICAgbGFtQWxlZk9uID0gZmFsc2U7CisgICAgICAgICAgdGFzaGtlZWxPbiA9IGZhbHNlOworCisgICAgICAgICAgaWYgKChsZW5PcHRpb25zTGFtQWxlZiA9PSBMQU1BTEVGX0JFR0lOKSB8fAorICAgICAgICAgICAgICAobGVuT3B0aW9uc0xhbUFsZWYgPT0gTEFNQUxFRl9BVVRPKSl7CisgICAgICAgICAgICAgICAgbGFtQWxlZk9uID0gdHJ1ZTsKKyAgICAgICAgICB9CisgICAgICAgICAgaWYgKGxlbk9wdGlvbnNUYXNoa2VlbCA9PSBUQVNIS0VFTF9CRUdJTil7CisgICAgICAgICAgICAgICAgdGFzaGtlZWxPbiA9IHRydWU7CisgICAgICAgICAgfQorCisgICAgICAgICAgaWYgKGxhbUFsZWZPbiAmJiAoKGxlbk9wdGlvbnNMYW1BbGVmID09IExBTUFMRUZfQkVHSU4pfHwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAobGVuT3B0aW9uc0xhbUFsZWYgPT0gTEFNQUxFRl9BVVRPKSkpIHsgLy8gc3BhY2VzIGF0IGJlZ2lubmluZworICAgICAgICAgICAgICBzaGlmdEFycmF5KGRlc3QsIHN0YXJ0LCBlLCBMQU1BTEVGX1NQQUNFX1NVQik7CisgICAgICAgICAgICAgICB3TCA9IGZsaXBBcnJheShkZXN0LHN0YXJ0LGUsIHdMKTsKKyAgICAgICAg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5vIHNwYWNlcyB0byBleHBhbmQgdGhlIExhbUFsZWYsIGFuIGV4Y2VwdGlvbiBpcyB0aHJvd24uCisqLworIHByaXZhdGUgYm9vbGVhbiBleHBhbmRDb21wb3NpdENoYXJBdEJlZ2luKGNoYXJbXSBkZXN0LGludCBzdGFydCwgaW50IGxlbmd0aCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgbGFjb3VudCkgeworICAgICBib29sZWFuIHNwYWNlTm90Rm91bmQgPSBmYWxzZTsKKworICAgICBpZiAobGFjb3VudCA+IGNvdW50U3BhY2VzUmlnaHQoZGVzdCwgc3RhcnQsIGxlbmd0aCkpIHsKKyAgICAgICAgIHNwYWNlTm90Rm91bmQgPSB0cnVlOworICAgICAgICAgcmV0dXJuIHNwYWNlTm90Rm91bmQ7CisgICAgIH0KKyAgICAgZm9yIChpbnQgciA9IHN0YXJ0ICsgbGVuZ3RoIC0gbGFjb3VudCwgdyA9IHN0YXJ0ICsgbGVuZ3RoOyAtLXIgPj0gc3RhcnQ7KSB7CisgICAgICAgICBjaGFyIGNoID0gZGVzdFtyXTsKKyAgICAgICAgIGlmIChpc05vcm1hbGl6ZWRMYW1BbGVmQ2hhcihjaCkpIHsKKyAgICAgICAgICAgICBkZXN0Wy0td10gPSBMQU1fQ0hBUjsKKyAgICAgICAgICAgICBkZXN0Wy0td10gPSBjb252ZXJ0Tm9ybWFsaXplZExhbUFsZWZbY2ggLSAnXHUwNjVDJ107CisgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgIGRlc3RbLS13XSA9IGNoOworICAgICAgICAgfQorICAgICB9CisgICAgIHJldHVybiBzcGFjZU5vdEZvdW5kOworCisgIH0KKworICAvKgorICAgKk5hbWUgICAgIDogZXhwYW5kQ29tcG9zaXRDaGFyQXRFbmQKKyAgICpGdW5jdGlvbiA6IEV4cGFuZHMgdGhlIExhbUFsZWYgY2hhcmFjdGVyIHRvIExhbSBhbmQgQWxlZiBjb25zdW1pbmcgdGhlCisgICAqICAgICAgICAgICByZXF1aXJlZCBzcGFjZSBmcm9tIGVuZCBvZiB0aGUgYnVmZmVyLiBJZiB0aGUgdGV4dCB0eXBlIHdhcworICAgKiAgICAgICAgICAgVmlzdWFsIExUUiBhbmQgdGhlIG9wdGlvbiBTUEFDRVNfUkVMQVRJVkVfVE9fVEVYVF9CRUdJTl9FTkQKKyAgICogICAgICAgICAgIHdhcyB1c2VkLCB0aGUgc3BhY2VzIHdpbGwgYmUgY29uc3VtZWQgZnJvbSBiZWdpbiBvZiBidWZmZXIuIElmCisgICAqICAgICAgICAgICB0aGVyZSBhcmUgbm8gc3BhY2VzIHRvIGV4cGFuZCB0aGUgTGFtQWxlZiwgYW4gZXhjZXB0aW9uIGlzIHRocm93bi4KKyAgICovCisKKyAgcHJpdmF0ZSBib29sZWFuICBleHBhbmRDb21wb3NpdENoYXJBdEVuZChjaGFyW10gZGVzdCxpbnQgc3RhcnQsIGludCBsZW5ndGgsCisgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBsYWNvdW50KXsKKyAgICAgIGJvb2xlYW4gc3BhY2VOb3RGb3VuZCA9IGZhbHNlOworCisgICAgICBpZiAobGFjb3VudCA+IGNvdW50U3BhY2VzTGVmdChkZXN0LCBzdGFydCwgbGVuZ3RoKSkgeworICAgICAgICAgIHNwYWNlTm90Rm91bmQgPSB0cnVlOworICAgICAgICAgIHJldHVybiBzcGFjZU5vdEZvdW5kOworICAgICAgfQorICAgICAgZm9yIChpbnQgciA9IHN0YXJ0ICsgbGFjb3VudCwgdyA9IHN0YXJ0LCBlID0gc3RhcnQgKyBsZW5ndGg7IHIgPCBlOyArK3IpIHsKKyAgICAgICAgICBjaGFyIGNoID0gZGVzdFtyXTsKKyAgICAgICAgICBpZiAoaXNOb3JtYWxpemVkTGFtQWxlZkNoYXIoY2gpKSB7CisgICAgICAgICAgICAgIGRlc3RbdysrXSA9IGNvbnZlcnROb3JtYWxpemVkTGFtQWxlZltjaCAtICdcdTA2NUMnXTsKKyAgICAgICAgICAgICAgZGVzdFt3KytdID0gTEFNX0NIQVI7CisgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgZGVzdFt3KytdID0gY2g7CisgICAgICAgICAgfQorICAgICAgfQorICAgICAgcmV0dXJuIHNwYWNlTm90Rm91bmQ7CisgIH0KKworICAvKgorICAgKk5hbWUgICAgIDogZXhwYW5kQ29tcG9zaXRDaGFyQXROZWFyCisgICAqRnVuY3Rpb24gOiBFeHBhbmRzIHRoZSBMYW1BbGVmIGNoYXJhY3RlciBpbnRvIExhbSArIEFsZWYsIFllaEhhbXphIGNoYXJhY3RlcgorICAgKiAgICAgICAgICAgaW50byBZZWggKyBIYW16YSwgU2VlbkZhbWlseSBjaGFyYWN0ZXIgaW50byBTZWVuRmFtaWx5IGNoYXJhY3RlcgorICAgKiAgICAgICAgICAgKyBUYWlsLCB3aGlsZSBjb25zdW1pbmcgdGhlIHNwYWNlIG5leHQgdG8gdGhlIGNoYXJhY3Rlci4KKyAgICovCisKKyAgcHJpdmF0ZSBib29sZWFuIGV4cGFuZENvbXBvc2l0Q2hhckF0TmVhcihjaGFyW10gZGVzdCxpbnQgc3RhcnQsIGludCBsZW5ndGgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgeWVoSGFtemFPcHRpb24sIGludCBzZWVuVGFpbE9wdGlvbiwgaW50IGxhbUFsZWZPcHRpb24peworCisgICAgICBib29sZWFuIHNwYWNlTm90Rm91bmQgPSBmYWxzZTsKKworCisKKyAgICAgIGlmIChpc05vcm1hbGl6ZWRMYW1BbGVmQ2hhcihkZXN0W3N0YXJ0XSkpIHsKKyAgICAgICAgICBzcGFjZU5vdEZvdW5kID0gdHJ1ZTsKKyAgICAgICAgICByZXR1cm4gc3BhY2VOb3RGb3VuZDsKKyAgICAgIH0KKyAgICAgIGZvciAoaW50IGkgPSBzdGFydCArIGxlbmd0aDsgLS1pID49c3RhcnQ7KSB7CisgICAgICAgICAgY2hhciBjaCA9IGRlc3RbaV07CisgICAgICAgICAgaWYgKGxhbUFsZWZPcHRpb24gPT0gMSAmJiBpc05vcm1hbGl6ZWRMYW1BbGVmQ2hhcihjaCkpIHsKKyAgICAgICAgICAgICAgaWYgKGk+c3RhcnQgJiZkZXN0W2ktMV0gPT0gU1BBQ0VfQ0hBUikgeworICAgICAgICAgICAgICAgICAgZGVzdFtpXSA9IExBTV9DSEFSOworICAgICAgICAgICAgICAgICAgZGVzdFstLWldID0gY29udmVydE5vcm1hbGl6ZWRMYW1BbGVmW2NoIC0gJ1x1MDY1QyddOworICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgc3BhY2VOb3RGb3VuZCA9IHRydWU7CisgICAgICAgICAgICAgICAgICByZXR1cm4gc3BhY2VOb3RGb3VuZDsKKyAgICAgICAgICAgICAgfQorICAgICAgICAgIH1lbHNlIGlmKHNlZW5UYWlsT3B0aW9uID09IDEgJiYgaXNTZWVuVGFpbEZhbWlseUNoYXIoY2gpID09IDEpeworICAgICAgICAgICAgICBpZihpPnN0YXJ0ICYmZGVzdFtpLTFdID09IFNQQUNFX0NIQVIpeworICAgICAgICAgICAgICAgICAgZGVzdFtpLTFdID0gdGFpbENoYXI7CisgICAgICAgICAgICAgIH0gZWxzZXsKKyAgICAgICAgICAgICAgICAgIHNwYWNlTm90Rm91bmQgPSB0cnVlOworICAgICAgICAgICAgICAgICAgcmV0dXJuIHNwYWNlTm90Rm91bmQ7CisgICAgICAgICAgICAgIH0KKyAgICAgICAgICB9ZWxzZSBpZih5ZWhIYW16YU9wdGlvbiA9PSAxICYmIGlzWWVoSGFtemFDaGFyKGNoKSl7CisKKyAgICAgICAgICAgICAgIGlmKGk+c3RhcnQgJiZkZXN0W2ktMV0gPT0gU1BBQ0VfQ0hBUil7CisgICAgICAgICAgICAgICAgICBkZXN0W2ldID0geWVoSGFtemFUb1llaFtjaCAtIFlFSF9IQU1aQUZFX0NIQVJdOworICAgICAgICAgICAgICAgICAgZGVzdFtpLTFdID0gSEFNWkFGRV9DSEFSOworICAgICAgICAgICAgICB9ZWxzZXsKKyAgICAgICAgICAgICAgICAgIHNwYWNlTm90Rm91bmQgPSB0cnVlOworICAgICAgICAgICAgICAgICAgcmV0dXJuIHNwYWNlTm90Rm91bmQ7CisgICAgICAgICAgICAgICAgfQorCisKKyAgICAgICAgICB9CisgICAgICB9CisgICAgICByZXR1cm4gZmFsc2U7CisKKyAgfQorCisgICAgLyoKKyAgICAgKiBOYW1lICAgIDogZXhwYW5kQ29tcG9zaXRDaGFyCisgICAgICogRnVuY3Rpb246IExhbUFsZWYgbmVlZHMgc3BlY2lhbCBoYW5kbGluZyBhcyB0aGUgTGFtQWxlZiBpcworICAgICAqICAgICAgICAgICBvbmUgY2hhcmFjdGVyIHdoaWxlIGV4cGFuZGluZyBpdCB3aWxsIGdpdmUgdHdvCisgICAgICogICAgICAgICAgIGNoYXJhY3RlcnMgTGFtICsgQWxlZiwgc28gd2UgbmVlZCB0byBleHBhbmQgdGhlIExhbUFsZWYKKyAgICAgKiAgICAgICAgICAgaW4gbmVhciBvciBmYXIgc3BhY2VzIGFjY29yZGluZyB0byB0aGUgb3B0aW9ucyB0aGUgdXNlcgorICAgICAqICAgICAgICAgICBzcGVjaWZpZXMgb3IgaW5jcmVhc2UgdGhlIGJ1ZmZlciBzaXplLgorICAgICAqICAgICAgICAgICBEZXN0IGhhcyBlbm91Z2ggcm9vbSBmb3IgdGhlIGV4cGFuc2lvbiBpZiB3ZSBhcmUgZ3Jvd2luZy4KKyAgICAgKiAgICAgICAgICAgbGFtYWxlZiBhcmUgbm9ybWFsaXplZCB0byB0aGUgJ3NwZWNpYWwgY2hhcmFjdGVycycKKyAgICAgKi8KKyAgICBwcml2YXRlIGludCBleHBhbmRDb21wb3NpdENoYXIoY2hhcltdIGRlc3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgc3RhcnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgbGVuZ3RoLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGxhY291bnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgc2hhcGluZ01vZGUpIHRocm93cyBBcmFiaWNTaGFwaW5nRXhjZXB0aW9uIHsKKworICAgICAgICBpbnQgbGVuT3B0aW9uc0xhbUFsZWYgPSBvcHRpb25zICYgTEFNQUxFRl9NQVNLOworICAgICAgICBpbnQgbGVuT3B0aW9uc1NlZW4gPSBvcHRpb25zICYgU0VFTl9NQVNLOworICAgICAgICBpbnQgbGVuT3B0aW9uc1llaEhhbXphID0gb3B0aW9ucyAmIFlFSEhBTVpBX01BU0s7CisgICAgICAgIGJvb2xlYW4gc3BhY2VOb3RGb3VuZCA9IGZhbHNlOworCisgICAgICAgIGlmICghaXNMb2dpY2FsICYmICFzcGFjZXNSZWxhdGl2ZVRvVGV4dEJlZ2luRW5kKSB7CisgICAgICAgICAgICBzd2l0Y2ggKGxlbk9wdGlvbnNMYW1BbGVmKSB7CisgICAgICAgICAgICBjYXNlIExBTUFMRUZfQkVHSU46IGxlbk9wdGlvbnNMYW1BbGVmID0gTEFNQUxFRl9FTkQ7IGJyZWFrOworICAgICAgICAgICAgY2FzZSBMQU1BTEVGX0VORDogbGVuT3B0aW9uc0xhbUFsZWYgPSBMQU1BTEVGX0JFR0lOOyBicmVhazsKKyAgICAgICAgICAgIGRlZmF1bHQ6IGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgaWYoc2hhcGluZ01vZGUgPT0gMSl7CisgICAgICAgICAgICBpZihsZW5PcHRpb25zTGFtQWxlZiA9PSBMQU1BTEVGX0FVVE8peworICAgICAgICAgICAgICAgIGlmKGlzTG9naWNhbCl7CisgICAgICAgICAgICAgICAgICAgIHNwYWNlTm90Rm91bmQgPSBleHBhbmRDb21wb3NpdENoYXJBdEVuZChkZXN0LCBzdGFydCwgbGVuZ3RoLCBsYWNvdW50KTsKKyAgICAgICAgICAgICAgICAgICAgaWYoc3BhY2VOb3RGb3VuZCl7CisgICAgICAgICAgICAgICAgICAgICAgICBzcGFjZU5vdEZvdW5kID0gZXhwYW5kQ29tcG9zaXRDaGFyQXRCZWdpbihkZXN0LCBzdGFydCwgbGVuZ3RoLCBsYWNvdW50KTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBpZihzcGFjZU5vdEZvdW5kKXsKKyAgICAgICAgICAgICAgICAgICAgICAgIHNwYWNlTm90Rm91bmQgPSBleHBhbmRDb21wb3NpdENoYXJBdE5lYXIoZGVzdCwgc3RhcnQsIGxlbmd0aCwwLDAsMSk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgaWYoc3BhY2VOb3RGb3VuZCl7CisgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgQXJhYmljU2hhcGluZ0V4Y2VwdGlvbigiTm8gc3BhY2Vmb3IgbGFtYWxlZiIpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfWVsc2V7CisgICAgICAgICAgICAgICAgICAgIHNwYWNlTm90Rm91bmQgPSBleHBhbmRDb21wb3NpdENoYXJBdEJlZ2luKGRlc3QsIHN0YXJ0LCBsZW5ndGgsIGxhY291bnQpOworICAgICAgICAgICAgICAgICAgICBpZihzcGFjZU5vdEZvdW5kKXsKKyAgICAgICAgICAgICAgICAgICAgICAgIHNwYWNlTm90Rm91bmQgPSBleHBhbmRDb21wb3NpdENoYXJBdEVuZChkZXN0LCBzdGFydCwgbGVuZ3RoLCBsYWNvdW50KTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBpZihzcGFjZU5vdEZvdW5kKXsKKyAgICAgICAgICAgICAgICAgICAgICAgIHNwYWNlTm90Rm91bmQgPSBleHBhbmRDb21wb3NpdENoYXJBdE5lYXIoZGVzdCwgc3RhcnQsIGxlbmd0aCwwLDAsMSk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgaWYoc3BhY2VOb3RGb3VuZCl7CisgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgQXJhYmljU2hhcGluZ0V4Y2VwdGlvbigiTm8gc3BhY2Vmb3IgbGFtYWxlZiIpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfWVsc2UgaWYobGVuT3B0aW9uc0xhbUFsZWYgPT0gTEFNQUxFRl9FTkQpeworICAgICAgICAgICAgICAgIHNwYWNlTm90Rm91bmQgPSBleHBhbmRDb21wb3NpdENoYXJBdEVuZChkZXN0LCBzdGFydCwgbGVuZ3RoLCBsYWNvdW50KTsKKyAgICAgICAgICAgICAgICBpZihzcGFjZU5vdEZvdW5kKXsKKyAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEFyYWJpY1NoYXBpbmdFeGNlcHRpb24oIk5vIHNwYWNlZm9yIGxhbWFsZWYiKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9ZWxzZSBpZihsZW5PcHRpb25zTGFtQWxlZiA9PSBMQU1BTEVGX0JFR0lOKXsKKyAgICAgICAgICAgICAgICBzcGFjZU5vdEZvdW5kID0gZXhwYW5kQ29tcG9zaXRDaGFyQXRCZWdpbihkZXN0LCBzdGFydCwgbGVuZ3RoLCBsYWNvdW50KTsKKyAgICAgICAgICAgICAgICBpZihzcGFjZU5vdEZvdW5kKXsKKyAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEFyYWJpY1NoYXBpbmdFeGNlcHRpb24oIk5vIHNwYWNlZm9yIGxhbWFsZWYiKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9ZWxzZSBpZihsZW5PcHRpb25zTGFtQWxlZiA9PSBMQU1BTEVGX05FQVIpeworICAgICAgICAgICAgICAgIHNwYWNlTm90Rm91bmQgPSBleHBhbmRDb21wb3NpdENoYXJBdE5lYXIoZGVzdCwgc3RhcnQsIGxlbmd0aCwwLDAsMSk7CisgICAgICAgICAgICAgICAgaWYoc3BhY2VOb3RGb3VuZCl7CisgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBBcmFiaWNTaGFwaW5nRXhjZXB0aW9uKCJObyBzcGFjZWZvciBsYW1hbGVmIik7CisgICAgICAgICAgICB9CisgICAgICAgICAgICB9ZWxzZSBpZihsZW5PcHRpb25zTGFtQWxlZiA9PSBMQU1BTEVGX1JFU0laRSl7CisgICAgICAgICAgICAgICAgZm9yIChpbnQgciA9IHN0YXJ0ICsgbGVuZ3RoLCB3ID0gciArIGxhY291bnQ7IC0tciA+PSBzdGFydDspIHsKKyAgICAgICAgICAgICAgICAgICAgY2hhciBjaCA9IGRlc3Rbcl07CisgICAgICAgICAgICAgICAgICAgIGlmIChpc05vcm1hbGl6ZWRMYW1BbGVmQ2hhcihjaCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGRlc3RbLS13XSA9ICdcdTA2NDQnOworICAgICAgICAgICAgICAgICAgICAgICAgZGVzdFstLXddID0gY29udmVydE5vcm1hbGl6ZWRMYW1BbGVmW2NoIC0gJ1x1MDY1QyddOworICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAgICAgZGVzdFstLXddID0gY2g7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgbGVuZ3RoICs9IGxhY291bnQ7CisgICAgICAgICAgICB9CisgICAgICAgICAgICB9ZWxzZXsKKyAgICAgICAgICAgICAgICBpZihsZW5PcHRpb25zU2VlbiA9PSBTRUVOX1RXT0NFTExfTkVBUil7CisgICAgICAgICAgICAgICAgc3BhY2VOb3RGb3VuZCA9IGV4cGFuZENvbXBvc2l0Q2hhckF0TmVhcihkZXN0LCBzdGFydCwgbGVuZ3RoLDAsMSwwKTsKKyAgICAgICAgICAgICAgICBpZihzcGFjZU5vdEZvdW5kKXsKKyAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEFyYWJpY1NoYXBpbmdFeGNlcHRpb24oIk5vIHNwYWNlIGZvciBTZWVuIHRhaWwgZXhwYW5zaW9uIik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYobGVuT3B0aW9uc1llaEhhbXphID09IFlFSEhBTVpBX1RXT0NFTExfTkVBUil7CisgICAgICAgICAgICAgICAgc3BhY2VOb3RGb3VuZCA9IGV4cGFuZENvbXBvc2l0Q2hhckF0TmVhcihkZXN0LCBzdGFydCwgbGVuZ3RoLDEsMCwwKTsKKyAgICAgICAgICAgICAgICBpZihzcGFjZU5vdEZvdW5kKXsKKyAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEFyYWJpY1NoYXBpbmdFeGNlcHRpb24oIk5vIHNwYWNlIGZvciBZZWhIYW16YSBleHBhbnNpb24iKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIHJldHVybiBsZW5ndGg7CisgICAgfQorCisKKyAgICAvKiBDb252ZXJ0IHRoZSBpbnB1dCBidWZmZXIgZnJvbSBGRXh4IFJhbmdlIGludG8gMDZ4eCBSYW5nZQorICAgICAqIHRvIHB1dCBhbGwgY2hhcmFjdGVycyBpbnRvIHRoZSAwNnh4IHJhbmdlCisgICAgICogZXZlbiB0aGUgbGFtYWxlZiBpcyBjb252ZXJ0ZWQgdG8gdGhlIHNwZWNpYWwgcmVnaW9uIGluCisgICAgICogdGhlIDA2eHggcmFuZ2UuICBSZXR1cm4gdGhlIG51bWJlciBvZiBsYW1hbGVmIGNoYXJzIGZvdW5kLgorICAgICAqLworICAgIHByaXZhdGUgaW50IG5vcm1hbGl6ZShjaGFyW10gZGVzdCwgaW50IHN0YXJ0LCBpbnQgbGVuZ3RoKSB7CisgICAgICAgIGludCBsYWNvdW50ID0gMDsKKyAgICAgICAgZm9yIChpbnQgaSA9IHN0YXJ0LCBlID0gaSArIGxlbmd0aDsgaSA8IGU7ICsraSkgeworICAgICAgICAgICAgY2hhciBjaCA9IGRlc3RbaV07CisgICAgICAgICAgICBpZiAoY2ggPj0gJ1x1RkU3MCcgJiYgY2ggPD0gJ1x1RkVGQycpIHsKKyAgICAgICAgICAgICAgICBpZiAoaXNMYW1BbGVmQ2hhcihjaCkpIHsKKyAgICAgICAgICAgICAgICAgICAgKytsYWNvdW50OworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBkZXN0W2ldID0gKGNoYXIpY29udmVydEZFdG8wNltjaCAtICdcdUZFNzAnXTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICByZXR1cm4gbGFjb3VudDsKKyAgICB9CisKKyAgICAvKgorICAgICAqIE5hbWUgICAgOiBkZXNoYXBlTm9ybWFsaXplCisgICAgICogRnVuY3Rpb246IENvbnZlcnQgdGhlIGlucHV0IGJ1ZmZlciBmcm9tIEZFeHggUmFuZ2UgaW50byAwNnh4IFJhbmdlCisgICAgICogICAgICAgICAgIGV2ZW4gdGhlIGxhbWFsZWYgaXMgY29udmVydGVkIHRvIHRoZSBzcGVjaWFsIHJlZ2lvbiBpbiB0aGUgMDZ4eCByYW5nZS4KKyAgICAgKiAgICAgICAgICAgQWNjb3JkaW5nIHRvIHRoZSBvcHRpb25zIHRoZSB1c2VyIGVudGVycywgYWxsIHNlZW4gZmFtaWx5IGNoYXJhY3RlcnMKKyAgICAgKiAgICAgICAgICAgZm9sbG93ZWQgYnkgYSB0YWlsIGNoYXJhY3RlciBhcmUgbWVyZ2VkIHRvIHNlZW4gdGFpbCBmYW1pbHkgY2hhcmFjdGVyIGFuZAorICAgICAqICAgICAgICAgICBhbnkgeWVoIGZvbGxvd2VkIGJ5IGEgaGFtemEgY2hhcmFjdGVyIGFyZSBtZXJnZWQgdG8geWVoaGFtemEgY2hhcmFjdGVyLgorICAgICAqICAgICAgICAgICBNZXRob2QgcmV0dXJucyB0aGUgbnVtYmVyIG9mIGxhbWFsZWYgY2hhcnMgZm91bmQuCisgICAgICovCisgICAgcHJpdmF0ZSBpbnQgZGVzaGFwZU5vcm1hbGl6ZShjaGFyW10gZGVzdCwgaW50IHN0YXJ0LCBpbnQgbGVuZ3RoKSB7CisgICAgICAgIGludCBsYWNvdW50ID0gMDsKKyAgICAgICAgaW50IHllaEhhbXphQ29tcG9zZUVuYWJsZWQgPSAwOworICAgICAgICBpbnQgc2VlbkNvbXBvc2VFbmFibGVkID0gMDsKKworICAgICAgICB5ZWhIYW16YUNvbXBvc2VFbmFibGVkID0gKChvcHRpb25zJllFSEhBTVpBX01BU0spID09IFlFSEhBTVpBX1RXT0NFTExfTkVBUikgPyAxIDogMDsKKyAgICAgICAgc2VlbkNvbXBvc2VFbmFibGVkID0gKChvcHRpb25zJlNFRU5fTUFTSykgPT0gU0VFTl9UV09DRUxMX05FQVIpPyAxIDogMDsKKworICAgICAgICBmb3IgKGludCBpID0gc3RhcnQsIGUgPSBpICsgbGVuZ3RoOyBpIDwgZTsgKytpKSB7CisgICAgICAgICAgICBjaGFyIGNoID0gZGVzdFtpXTsKKworICAgICAgICBpZiggKHllaEhhbXphQ29tcG9zZUVuYWJsZWQgPT0gMSkgJiYgKChjaCA9PSBIQU1aQTA2X0NIQVIpIHx8IChjaCA9PSBIQU1aQUZFX0NIQVIpKQorICAgICAgICAgICAgICAgJiYgKGkgPCAobGVuZ3RoIC0gMSkpICYmIGlzQWxlZk1ha3NvdXJhQ2hhcihkZXN0W2krMV0gKSkgeworICAgICAgICAgICAgICAgIGRlc3RbaV0gPSBTUEFDRV9DSEFSOworICAgICAgICAgICAgICAgIGRlc3RbaSsxXSA9IFlFSF9IQU1aQV9DSEFSOworICAgICAgIH0gZWxzZSBpZiAoIChzZWVuQ29tcG9zZUVuYWJsZWQgPT0gMSkgJiYgKGlzVGFpbENoYXIoY2gpKSAmJiAoaTwgKGxlbmd0aCAtIDEpKQorICAgICAgICAgICAgICAgICAgICAgICAmJiAoaXNTZWVuVGFpbEZhbWlseUNoYXIoZGVzdFtpKzFdKT09MSkgKSB7CisgICAgICAgICAgICAgICBkZXN0W2ldID0gU1BBQ0VfQ0hBUjsKKyAgICAgICB9CisgICAgICAgZWxzZSBpZiAoY2ggPj0gJ1x1RkU3MCcgJiYgY2ggPD0gJ1x1RkVGQycpIHsKKyAgICAgICAgICAgICAgICBpZiAoaXNMYW1BbGVmQ2hhcihjaCkpIHsKKyAgICAgICAgICAgICAgICAgICAgKytsYWNvdW50OworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBkZXN0W2ldID0gKGNoYXIpY29udmVydEZFdG8wNltjaCAtICdcdUZFNzAnXTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICByZXR1cm4gbGFjb3VudDsKKyAgICB9CisKKyAgICAvKgorICAgICAqIE5hbWUgICAgOiBzaGFwZVVuaWNvZGUKKyAgICAgKiBGdW5jdGlvbjogQ29udmVydHMgYW4gQXJhYmljIFVuaWNvZGUgYnVmZmVyIGluIDA2eHggUmFuZ2UgaW50byBhIHNoYXBlZAorICAgICAqICAgICAgICAgICBhcmFiaWMgVW5pY29kZSBidWZmZXIgaW4gRkV4eCBSYW5nZQorICAgICAqLworICAgIHByaXZhdGUgaW50IHNoYXBlVW5pY29kZShjaGFyW10gZGVzdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IHN0YXJ0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgbGVuZ3RoLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgZGVzdFNpemUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCB0YXNoa2VlbEZsYWcpdGhyb3dzIEFyYWJpY1NoYXBpbmdFeGNlcHRpb24geworCisgICAgICAgIGludCBsYW1hbGVmX2NvdW50ID0gbm9ybWFsaXplKGRlc3QsIHN0YXJ0LCBsZW5ndGgpOworCisgICAgICAgIC8vIHJlc29sdmUgdGhlIGxpbmsgYmV0d2VlbiB0aGUgY2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FyKGRlc3RbaV0pKSB7CisgICAgICAgICAgICAgICAgbncgPSBpIC0gMTsKKyAgICAgICAgICAgICAgICBueCA9IC0yOworICAgICAgICAgICAgICAgIHdoaWxlIChueCA8IDApIHsgLy8gd2UgbmVlZCB0byBrbm93IGFib3V0IG5leHQgY2hhcgorICAgICAgICAgICAgICAgICAgICBpZiAobncgPT0gLTEpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIG5leHRMaW5rID0gMDsKKyAgICAgICAgICAgICAgICAgICAgICAgIG54ID0gSW50ZWdlci5NQVhfVkFMVUU7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICBuZXh0TGluayA9IGdldExpbmsoZGVzdFtud10pOworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKChuZXh0TGluayAmIElSUkVMRVZBTlQpID09IDApIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBueCA9IG53OworICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAtLW53OworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgaWYgKCgoY3VyckxpbmsgJiBBTEVGVFlQRSkgPiAwKSAmJiAoKGxhc3RMaW5rICYgTEFNVFlQRSkgPiAwKSkgeworICAgICAgICAgICAgICAgICAgICBsYW1hbGVmX2ZvdW5kID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICAgICAgY2hhciB3TGFtYWxlZiA9IGNoYW5nZUxhbUFsZWYoZGVzdFtpXSk7IC8vIGdldCBmcm9tIDB4MDY1Qy0weDA2NWYKKyAgICAgICAgICAgICAgICAgICAgaWYgKHdMYW1hbGVmICE9ICdcdTAwMDAnKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAvLyByZXBsYWNlIGFsZWYgYnkgbWFya2VyLCBpdCB3aWxsIGJlIHJlbW92ZWQgbGF0ZXIKKyAgICAgICAgICAgICAgICAgICAgICAgIGRlc3RbaV0gPSAnXHVmZmZmJzsKKyAgICAgICAgICAgICAgICAgICAgICAgIGRlc3RbbGFzdFBvc10gPSB3TGFtYWxlZjsKKyAgICAgICAgICAgICAgICAgICAgICAgIGkgPSBsYXN0UG9zOworICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgICAgbGFzdExpbmsgPSBwcmV2TGluazsKKyAgICAgICAgICAgICAgICAgICAgY3VyckxpbmsgPSBnZXRMaW5rKHdMYW1hbGVmKTsgLy8gcmVxdWlyZXMgJ1x1MDAwMCcsIHVuZm9ydHVuYXRlbHkKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaWYgKChpID4gMCkgJiYgKGRlc3RbaS0xXSA9PSBTUEFDRV9DSEFSKSkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIGlmICggaXNTZWVuRmFtaWx5Q2hhcihkZXN0W2ldKSA9PSAxKXsKKyAgICAgICAgICAgICAgICAgICAgICAgIHNlZW5mYW1fZm91bmQgPSB0cnVlOworICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGRlc3RbaV0gPT0gWUVIX0hBTVpBX0NIQVIpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHllaGhhbXphX2ZvdW5kID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBlbHNlIGlmKGk9PTApeworICAgICAgICAgICAgICAgICAgICBpZiAoIGlzU2VlbkZhbWlseUNoYXIoZGVzdFtpXSkgPT0gMSl7CisgICAgICAgICAgICAgICAgICAgICAgICBzZWVuZmFtX2ZvdW5kID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChkZXN0W2ldID09IFlFSF9IQU1aQV9DSEFSKSB7CisgICAgICAgICAgICAgICAgICAgICAgICB5ZWhoYW16YV9mb3VuZCA9IHRydWU7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisKKworICAgICAgICAgICAgICAgIC8vIGdldCB0aGUgcHJvcGVyIHNoYXBlIGFjY29yZGluZyB0byBsaW5rIGFiaWxpdHkgb2YgbmVpZ2hib3JzCisgICAgICAgICAgICAgICAgLy8gYW5kIG9mIGNoYXJhY3RlcjsgZGVwZW5kcyBvbiB0aGUgb3JkZXIgb2YgdGhlIHNoYXBlcworICAgICAgICAgICAgICAgIC8vIChpc29sYXRlZCwgaW5pdGlhbCwgbWlkZGxlLCBmaW5hbCkgaW4gdGhlIGNvbXBhdGliaWxpdHkgYXJlYQorCisgICAgICAgICAgICAgICAgaW50IGZsYWcgPSBzcGVjaWFsQ2hhcihkZXN0W2ldKTsKKworICAgICAgICAgICAgICAgIGludCBzaGFwZSA9IHNoYXBlVGFibGVbbmV4dExpbmsgJiBMSU5LX01BU0tdCisgICAgICAgICAgICAgICAgICAgIFtsYXN0TGluayAmIExJTktfTUFTS10KKyAgICAgICAgICAgICAgICAgICAgW2N1cnJMaW5rICYgTElOS19NQVNLXTsKKworICAgICAgICAgICAgICAgIGlmIChmbGFnID09IDEpIHsKKyAgICAgICAgICAgICAgICAgICAgc2hhcGUgJj0gMHgxOworICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoZmxhZyA9PSAyKSB7CisgICAgICAgICAgICAgICAgICAgIGlmICh0YXNoa2VlbEZsYWcgPT0gMCAmJgorICAgICAgICAgICAgICAgICAgICAgICAgKChsYXN0TGluayAmIExJTktMKSAhPSAwKSAmJgorICAgICAgICAgICAgICAgICAgICAgICAgKChuZXh0TGluayAmIExJTktSKSAhPSAwKSAmJgorICAgICAgICAgICAgICAgICAgICAgICAgZGVzdFtpXSAhPSAnXHUwNjRDJyAmJgorICAgICAgICAgICAgICAgICAgICAgICAgZGVzdFtpXSAhPSAnXHUwNjREJyAmJgorICAgICAgICAgICAgICAgICAgICAgICAgISgobmV4dExpbmsgJiBBTEVGVFlQRSkgPT0gQUxFRlRZUEUgJiYKKyAgICAgICAgICAgICAgICAgICAgICAgICAgKGxhc3RMaW5rICYgTEFNVFlQRSkgPT0gTEFNVFlQRSkpIHsKKworICAgICAgICAgICAgICAgICAgICAgICAgc2hhcGUgPSAxOworICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAgICAgc2hhcGUgPSAwOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGlmIChmbGFnID09IDIpIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKHRhc2hrZWVsRmxhZyA9PSAyKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBkZXN0W2ldID0gVEFTSEtFRUxfU1BBQ0VfU1VCOworICAgICAgICAgICAgICAgICAgICAgICAgdGFzaGtlZWxfZm91bmQgPSB0cnVlOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGVsc2V7CisgICAgICAgICAgICAgICAgICAgICAgICBkZXN0W2ldID0gKGNoYXIpKCdcdUZFNzAnICsgaXJyZWxldmFudFBvc1tkZXN0W2ldIC0gJ1x1MDY0QiddICsgc2hhcGUpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIC8vIGVsc2UgbGVhdmUgdGFzaGtlZWwgYWxvbmUKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICBkZXN0W2ldID0gKGNoYXIpKCdcdUZFNzAnICsgKGN1cnJMaW5rID4+IDgpICsgc2hhcGUpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgLy8gbW92ZSBvbmUgbm90Y2ggZm9yd2FyZAorICAgICAgICAgICAgaWYgKChjdXJyTGluayAmIElSUkVMRVZBTlQpID09IDApIHsKKyAgICAgICAgICAgICAgICBwcmV2TGluayA9IGxhc3RMaW5rOworICAgICAgICAgICAgICAgIGxhc3RMaW5rID0gY3Vyckxpbms7CisgICAgICAgICAgICAgICAgLy9wcmV2UG9zID0gbGFzdFBvczsKKyAgICAgICAgICAgICAgICBsYXN0UG9zID0gaTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgLS1pOworICAgICAgICAgICAgaWYgKGkgPT0gbngpIHsKKyAgICAgICAgICAgICAgICBjdXJyTGluayA9IG5leHRMaW5rOworICAgICAgICAgICAgICAgIG54ID0gLTI7CisgICAgICAgICAgICB9IGVsc2UgaWYgKGkgIT0gLTEpIHsKKyAgICAgICAgICAgICAgICBjdXJyTGluayA9IGdldExpbmsoZGVzdFtpXSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICAvLyBJZiB3ZSBmb3VuZCBhIGxhbS9hbGVmIHBhaXIgaW4gdGhlIGJ1ZmZlcgorICAgICAgICAvLyBjYWxsIGhhbmRsZUdlbmVyYXRlZFNwYWNlcyB0byByZW1vdmUgdGhlIHNwYWNlcyB0aGF0IHdlcmUgYWRkZWQKKworICAgICAgICBkZXN0U2l6ZSA9IGxlbmd0aDsKKyAgICAgICAgaWYgKGxhbWFsZWZfZm91bmQgfHwgdGFzaGtlZWxfZm91bmQpIHsKKyAgICAgICAgICAgIGRlc3RTaXplID0gaGFuZGxlR2VuZXJhdGVkU3BhY2VzKGRlc3QsIHN0YXJ0LCBsZW5ndGgpOworICAgICAgICB9CisgICAgICAgIGlmIChzZWVuZmFtX2ZvdW5kIHx8IHllaGhhbXphX2ZvdW5kKXsKKyAgICAgICAgICAgIGRlc3RTaXplID0gZXhwYW5kQ29tcG9zaXRDaGFyKGRlc3QsIHN0YXJ0LCBkZXN0U2l6ZSwgbGFtYWxlZl9jb3VudCwgU0hBUEVfTU9ERSk7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIGRlc3RTaXplOworICAgIH0KKworICAgIC8qCisgICAgICogTmFtZSAgICA6IGRlU2hhcGVVbmljb2RlCisgICAgICogRnVuY3Rpb246IENvbnZlcnRzIGFuIEFyYWJpYyBVbmljb2RlIGJ1ZmZlciBpbiBGRXh4IFJhbmdlIGludG8gdW5zaGFwZWQKKyAgICAgKiAgICAgICAgICAgYXJhYmljIFVuaWNvZGUgYnVmZmVyIGluIDA2eHggUmFuZ2UKKyAgICAgKi8KKyAgICBwcml2YXRlIGludCBkZVNoYXBlVW5pY29kZShjaGFyW10gZGVzdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgc3RhcnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGxlbmd0aCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgZGVzdFNpemUpIHRocm93cyBBcmFiaWNTaGFwaW5nRXhjZXB0aW9uIHsKKworICAgICAgICBpbnQgbGFtYWxlZl9jb3VudCA9IGRlc2hhcGVOb3JtYWxpemUoZGVzdCwgc3RhcnQsIGxlbmd0aCk7CisKKyAgICAgICAgLy8gSWYgdGhlcmUgd2FzIGEgbGFtYWxlZiBpbiB0aGUgYnVmZmVyIGNhbGwgZXhwYW5kTGFtQWxlZgorICAgICAgICBpZiAobGFtYWxlZl9jb3VudCAhPSAwKSB7CisgICAgICAgICAgICAvLyBuZWVkIHRvIGFkanVzdCBkZXN0IHRvIGZpdCBleHBhbmRlZCBidWZmZXIuLi4gISEhCisgICAgICAgICAgICBkZXN0U2l6ZSA9IGV4cGFuZENvbXBvc2l0Q2hhcihkZXN0LCBzdGFydCwgbGVuZ3RoLCBsYW1hbGVmX2NvdW50LERFU0hBUEVfTU9ERSk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBkZXN0U2l6ZSA9IGxlbmd0aDsKKyAgICAgICAgfQorCisgICAgICAgIHJldHVybiBkZXN0U2l6ZTsKKyAgICB9CisKKyAgICBwcml2YXRlIGludCBpbnRlcm5hbFNoYXBlKGNoYXJbXSBzb3VyY2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgc291cmNlU3RhcnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgc291cmNlTGVuZ3RoLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hhcltdIGRlc3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgZGVzdFN0YXJ0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGRlc3RTaXplKSB0aHJvd3MgQXJhYmljU2hhcGluZ0V4Y2VwdGlvbiB7CisKKyAgICAgICAgaWYgKHNvdXJjZUxlbmd0aCA9PSAwKSB7CisgICAgICAgICAgICByZXR1cm4gMDsKKyAgICAgICAgfQorCisgICAgICAgIGlmIChkZXN0U2l6ZSA9PSAwKSB7CisgICAgICAgICAgICBpZiAoKChvcHRpb25zICYgTEVUVEVSU19NQVNLKSAhPSBMRVRURVJTX05PT1ApICYmCisgICAgICAgICAgICAgICAgKChvcHRpb25zICYgTEFNQUxFRl9NQVNLKSA9PSBMQU1BTEVGX1JFU0laRSkpIHsKKworICAgICAgICAgICAgICAgIHJldHVybiBjYWxjdWxhdGVTaXplKHNvdXJjZSwgc291cmNlU3RhcnQsIHNvdXJjZUxlbmd0aCk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIHJldHVybiBzb3VyY2VMZW5ndGg7IC8vIGJ5IGRlZmluaXRpb24KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIC8vIGFsd2F5cyB1c2UgdGVtcCBidWZmZXIKKyAgICAgICAgY2hhcltdIHRlbXAgPSBuZXcgY2hhcltzb3VyY2VMZW5ndGggKiAyXTsgLy8gYWxsIGxhbWFsZWZzIHJlcXVpcmluZyBleHBhbnNpb24KKyAgICAgICAgU3lzdGVtLmFycmF5Y29weShzb3VyY2UsIHNvdXJjZVN0YXJ0LCB0ZW1wLCAwLCBzb3VyY2VMZW5ndGgpOworCisgICAgICAgIGlmIChpc0xvZ2ljYWwpIHsKKyAgICAgICAgICAgIGludmVydEJ1ZmZlcih0ZW1wLCAwLCBzb3VyY2VMZW5ndGgpOworICAgICAgICB9CisKKyAgICAgICAgaW50IG91dHB1dFNpemUgPSBzb3VyY2VMZW5ndGg7CisKKyAgICAgICAgc3dpdGNoIChvcHRpb25zICYgTEVUVEVSU19NQVNLKSB7CisgICAgICAgIGNhc2UgTEVUVEVSU19TSEFQRV9UQVNIS0VFTF9JU09MQVRFRDoKKyAgICAgICAgICAgIG91dHB1dFNpemUgPSBzaGFwZVVuaWNvZGUodGVtcCwgMCwgc291cmNlTGVuZ3RoLCBkZXN0U2l6ZSwgMSk7CisgICAgICAgICAgICBicmVhazsKKworICAgICAgICBjYXNlIExFVFRFUlNfU0hBUEU6CisgICAgICAgICAgICBpZiggKChvcHRpb25zJlRBU0hLRUVMX01BU0spPiAwKSAmJgorICAgICAgICAgICAgICAgICgob3B0aW9ucyZUQVNIS0VFTF9NQVNLKSAhPVRBU0hLRUVMX1JFUExBQ0VfQllfVEFUV0VFTCkpIHsKKyAgICAgICAgICAgICAgICAgICAvKiBDYWxsIHRoZSBzaGFwaW5nIGZ1bmN0aW9uIHdpdGggdGFzaGtlZWwgZmxhZyA9PSAyIGZvciByZW1vdmFsIG9mIHRhc2hrZWVsICovCisgICAgICAgICAgICAgICAgb3V0cHV0U2l6ZSA9IHNoYXBlVW5pY29kZSh0ZW1wLCAwLCBzb3VyY2VMZW5ndGgsIGRlc3RTaXplLCAyKTsKKyAgICAgICAgICAgICAgICB9ZWxzZSB7CisgICAgICAgICAgICAgICAgICAgLy9kZWZhdWx0IENhbGwgdGhlIHNoYXBpbmcgZnVuY3Rpb24gd2l0aCB0YXNoa2VlbCBmbGFnID09IDEgKi8KKyAgICAgICAgICAgICAgICAgICAgb3V0cHV0U2l6ZSA9IHNoYXBlVW5pY29kZSh0ZW1wLCAwLCBzb3VyY2VMZW5ndGgsIGRlc3RTaXplLCAwKTsKKworICAgICAgICAgICAgICAgICAgIC8qQWZ0ZXIgc2hhcGluZyB0ZXh0IGNoZWNrIGlmIHVzZXIgd2FudHMgdG8gcmVtb3ZlIHRhc2hrZWVsIGFuZCByZXBsYWNlIGl0IHdpdGggdGF0d2VlbCovCisgICAgICAgICAgICAgICAgICAgaWYoIChvcHRpb25zJlRBU0hLRUVMX01BU0spID09IFRBU0hLRUVMX1JFUExBQ0VfQllfVEFUV0VFTCl7CisgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dFNpemUgPSBoYW5kbGVUYXNoa2VlbFdpdGhUYXR3ZWVsKHRlbXAsc291cmNlTGVuZ3RoKTsKKyAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICB9CisgICAgICAgICAgICBicmVhazsKKworICAgICAgICBjYXNlIExFVFRFUlNfVU5TSEFQRToKKyAgICAgICAgICAgIG91dHB1dFNpemUgPSBkZVNoYXBlVW5pY29kZSh0ZW1wLCAwLCBzb3VyY2VMZW5ndGgsIGRlc3RTaXplKTsKKyAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorCisgICAgICAgIGlmIChvdXRwdXRTaXplID4gZGVzdFNpemUpIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBBcmFiaWNTaGFwaW5nRXhjZXB0aW9uKCJub3QgZW5vdWdoIHJvb20gZm9yIHJlc3VsdCBkYXRhIik7CisgICAgICAgIH0KKworICAgICAgICBpZiAoKG9wdGlvbnMgJiBESUdJVFNfTUFTSykgIT0gRElHSVRTX05PT1ApIHsKKyAgICAgICAgICAgIGNoYXIgZGlnaXRCYXNlID0gJ1x1MDAzMCc7IC8vIEV1cm9wZWFuIGRpZ2l0cworICAgICAgICAgICAgc3dpdGNoIChvcHRpb25zICYgRElHSVRfVFlQRV9NQVNLKSB7CisgICAgICAgICAgICBjYXNlIERJR0lUX1RZUEVfQU46CisgICAgICAgICAgICAgICAgZGlnaXRCYXNlID0gJ1x1MDY2MCc7ICAvLyBBcmFiaWMtSW5kaWMgZGlnaXRzCisgICAgICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICAgIGNhc2UgRElHSVRfVFlQRV9BTl9FWFRFTkRFRDoKKyAgICAgICAgICAgICAgICBkaWdpdEJhc2UgPSAnXHUwNmYwJzsgIC8vIEVhc3Rlcm4gQXJhYmljLUluZGljIGRpZ2l0cyAoUGVyc2lhbiBhbmQgVXJkdSkKKyAgICAgICAgICAgICAgICBicmVhazsKKworICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgc3dpdGNoIChvcHRpb25zICYgRElHSVRTX01BU0spIHsKKyAgICAgICAgICAgIGNhc2UgRElHSVRTX0VOMkFOOgorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgaW50IGRpZ2l0RGVsdGEgPSBkaWdpdEJhc2UgLSAnXHUwMDMwJzsKKyAgICAgICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBvdXRwdXRTaXplOyArK2kpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNoYXIgY2ggPSB0ZW1wW2ldOworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNoIDw9ICdcdTAwMzknICYmIGNoID49ICdcdTAwMzAnKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGVtcFtpXSArPSBkaWdpdERlbHRhOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICBjYXNlIERJR0lUU19BTjJFTjoKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIGNoYXIgZGlnaXRUb3AgPSAoY2hhcikoZGlnaXRCYXNlICsgOSk7CisgICAgICAgICAgICAgICAgICAgIGludCBkaWdpdERlbHRhID0gJ1x1MDAzMCcgLSBkaWdpdEJhc2U7CisgICAgICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgb3V0cHV0U2l6ZTsgKytpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBjaGFyIGNoID0gdGVtcFtpXTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjaCA8PSBkaWdpdFRvcCAmJiBjaCA+PSBkaWdpdEJhc2UpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ZW1wW2ldICs9IGRpZ2l0RGVsdGE7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICAgIGNhc2UgRElHSVRTX0VOMkFOX0lOSVRfTFI6CisgICAgICAgICAgICAgICAgc2hhcGVUb0FyYWJpY0RpZ2l0c1dpdGhDb250ZXh0KHRlbXAsIDAsIG91dHB1dFNpemUsIGRpZ2l0QmFzZSwgZmFsc2UpOworICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICBjYXNlIERJR0lUU19FTjJBTl9JTklUX0FMOgorICAgICAgICAgICAgICAgIHNoYXBlVG9BcmFiaWNEaWdpdHNXaXRoQ29udGV4dCh0ZW1wLCAwLCBvdXRwdXRTaXplLCBkaWdpdEJhc2UsIHRydWUpOworICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgaWYgKGlzTG9naWNhbCkgeworICAgICAgICAgICAgaW52ZXJ0QnVmZmVyKHRlbXAsIDAsIG91dHB1dFNpemUpOworICAgICAgICB9CisKKyAgICAgICAgU3lzdGVtLmFycmF5Y29weSh0ZW1wLCAwLCBkZXN0LCBkZXN0U3RhcnQsIG91dHB1dFNpemUpOworCisgICAgICAgIHJldHVybiBvdXRwdXRTaXplOworICAgIH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IHByZS1hbGxvY2F0ZWQgY2h1bmsgaXNuJ3QgYmlnIGVub3VnaCB0byByZWZlciB0byBhbGwgcm93cy4gRWFjaCByb3cgZGlyZWN0b3J5IGhhcyBhCisgKiBmaWVsZF9zbG90X3QgcGVyIGNvbHVtbiwgd2hpY2ggaGFzIHRoZSBzaXplLCBvZmZzZXQsIGFuZCB0eXBlIG9mIHRoZSBkYXRhIGZvciB0aGF0IGZpZWxkLgorICogTm90ZSB0aGF0IHRoZSBkYXRhIHR5cGVzIGNvbWUgZnJvbSBzcWxpdGUzLmguCisgKi8KK2NsYXNzIEN1cnNvcldpbmRvdworeworcHVibGljOgorICAgICAgICAgICAgICAgICAgICAgICAgQ3Vyc29yV2luZG93KHNpemVfdCBtYXhTaXplKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIEN1cnNvcldpbmRvdygpe30KKyAgICBib29sICAgICAgICAgICAgICAgIHNldE1lbW9yeShjb25zdCBzcDxJTWVtb3J5PiYpOworICAgICAgICAgICAgICAgICAgICAgICAgfkN1cnNvcldpbmRvdygpOworCisgICAgYm9vbCAgICAgICAgICAgICAgICBpbml0QnVmZmVyKGJvb2wgbG9jYWxPbmx5KTsKKyAgICBzcDxJTWVtb3J5PiAgICAgICAgIGdldE1lbW9yeSgpIHtyZXR1cm4gbU1lbW9yeTt9CisKKyAgICBzaXplX3QgICAgICAgICAgICAgIHNpemUoKSB7cmV0dXJuIG1TaXplO30KKyAgICB1aW50OF90ICogICAgICAgICAgIGRhdGEoKSB7cmV0dXJuIG1EYXRhO30KKyAgICB1aW50MzJfdCAgICAgICAgICAgIGdldE51bVJvd3MoKSB7cmV0dXJuIG1IZWFkZXItPm51bVJvd3M7fQorICAgIHVpbnQzMl90ICAgICAgICAgICAgZ2V0TnVtQ29sdW1ucygpIHtyZXR1cm4gbUhlYWRlci0+bnVtQ29sdW1uczt9CisgICAgdm9pZCAgICAgICAgICAgICAgICBmcmVlTGFzdFJvdygpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobUhlYWRlci0+bnVtUm93cyA+IDApIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUhlYWRlci0+bnVtUm93cy0tOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICBib29sICAgICAgICAgICAgICAgIHNldE51bUNvbHVtbnModWludDMyX3QgbnVtQ29sdW1ucykKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMl90IGN1ciA9IG1IZWFkZXItPm51bUNvbHVtbnM7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjdXIgPiAwICYmIGN1ciAhPSBudW1Db2x1bW5zKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMT0dFKCJUcnlpbmcgdG8gZ28gZnJvbSAlZCBjb2x1bW5zIHRvICVkIiwgY3VyLCBudW1Db2x1bW5zKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtSGVhZGVyLT5udW1Db2x1bW5zID0gbnVtQ29sdW1uczsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorCisgICAgaW50MzJfdCAgICAgICAgICAgICBmcmVlU3BhY2UoKTsKKworICAgIHZvaWQgICAgICAgICAgICAgICAgY2xlYXIoKTsKKworICAgICAgICAgICAgICAgICAgICAgICAgLyoqCisgICAgICAgICAgICAgICAgICAgICAgICAgKiBBbGxvY2F0ZSBhIHJvdyBzbG90IGFuZCBpdHMgZGlyZWN0b3J5LiBUaGUgcmV0dXJuZWQKKyAgICAgICAgICAgICAgICAgICAgICAgICAqIHBvaW50ZXIgcG9pbnRzIHRvIHRoZSBiZWdpbmluZyBvZiB0aGUgcm93J3MgZGlyZWN0b3J5CisgICAgICAgICAgICAgICAgICAgICAgICAgKiBvciBOVUxMIGlmIHRoZXJlIHdhc24ndCByb29tLiBUaGUgZGlyZWN0b3J5IGlzCisgICAgICAgICAgICAgICAgICAgICAgICAgKiBpbml0aWFsaWVkIHdpdGggTlVMTCBlbnRyaWVzIGZvciBlYWNoIGZpZWxkLgorICAgICAgICAgICAgICAgICAgICAgICAgICovCisgICAgZmllbGRfc2xvdF90ICogICAgICBhbGxvY1JvdygpOworCisgICAgICAgICAgICAgICAgICAgICAgICAvKioKKyAgICAgICAgICAgICAgICAgICAgICAgICAqIEFsbG9jYXRlIGEgcG9ydGlvbiBvZiB0aGUgd2luZG93LiBSZXR1cm5zIHRoZSBvZmZzZXQKKyAgICAgICAgICAgICAgICAgICAgICAgICAqIG9mIHRoZSBhbGxvY2F0aW9uLCBvciAwIGlmIHRoZXJlIGlzbid0IGVub3VnaCBzcGFjZS4KKyAgICAgICAgICAgICAgICAgICAgICAgICAqIElmIGFsaWduZWQgaXMgdHJ1ZSwgdGhlIGFsbG9jYXRpb24gZ2V0cyA0IGJ5dGUgYWxpZ25tZW50LgorICAgICAgICAgICAgICAgICAgICAgICAgICovCisgICAgdWludDMyX3QgICAgICAgICAgICBhbGxvYyhzaXplX3Qgc2l6ZSwgYm9vbCBhbGlnbmVkID0gZmFsc2UpOworCisgICAgdWludDMyX3QgICAgICAgICAgICByZWFkX2ZpZWxkX3Nsb3QoaW50IHJvdywgaW50IGNvbHVtbiwgZmllbGRfc2xvdF90ICogc2xvdCk7CisKKyAgICAgICAgICAgICAgICAgICAgICAgIC8qKgorICAgICAgICAgICAgICAgICAgICAgICAgICogQ29weSBkYXRhIGludG8gdGhlIHdpbmRvdyBhdCB0aGUgZ2l2ZW4gb2Zmc2V0LgorICAgICAgICAgICAgICAgICAgICAgICAgICovCisgICAgdm9pZCAgICAgICAgICAgICAgICBjb3B5SW4odWludDMyX3Qgb2Zmc2V0LCB1aW50OF90IGNvbnN0ICogZGF0YSwgc2l6ZV90IHNpemUpOworICAgIHZvaWQgICAgICAgICAgICAgICAgY29weUluKHVpbnQzMl90IG9mZnNldCwgaW50NjRfdCBkYXRhKTsKKyAgICB2b2lkICAgICAgICAgICAgICAgIGNvcHlJbih1aW50MzJfdCBvZmZzZXQsIGRvdWJsZSBkYXRhKTsKKworICAgIHZvaWQgICAgICAgICAgICAgICAgY29weU91dCh1aW50MzJfdCBvZmZzZXQsIHVpbnQ4X3QgKiBkYXRhLCBzaXplX3Qgc2l6ZSk7CisgICAgaW50NjRfdCAgICAgICAgICAgICBjb3B5T3V0TG9uZyh1aW50MzJfdCBvZmZzZXQpOworICAgIGRvdWJsZSAgICAgICAgICAgICAgY29weU91dERvdWJsZSh1aW50MzJfdCBvZmZzZXQpOworCisgICAgYm9vbCAgICAgICAgICAgICAgICBwdXRMb25nKHVuc2lnbmVkIGludCByb3csIHVuc2lnbmVkIGludCBjb2wsIGludDY0X3QgdmFsdWUpOworICAgIGJvb2wgICAgICAgICAgICAgICAgcHV0RG91YmxlKHVuc2lnbmVkIGludCByb3csIHVuc2lnbmVkIGludCBjb2wsIGRvdWJsZSB2YWx1ZSk7CisgICAgYm9vbCAgICAgICAgICAgICAgICBwdXROdWxsKHVuc2lnbmVkIGludCByb3csIHVuc2lnbmVkIGludCBjb2wpOworCisgICAgYm9vbCAgICAgICAgICAgICAgICBnZXRMb25nKHVuc2lnbmVkIGludCByb3csIHVuc2lnbmVkIGludCBjb2wsIGludDY0X3QgKiB2YWx1ZU91dCk7CisgICAgYm9vbCAgICAgICAgICAgICAgICBnZXREb3VibGUodW5zaWduZWQgaW50IHJvdywgdW5zaWduZWQgaW50IGNvbCwgZG91YmxlICogdmFsdWVPdXQpOworICAgIGJvb2wgICAgICAgICAgICAgICAgZ2V0TnVsbCh1bnNpZ25lZCBpbnQgcm93LCB1bnNpZ25lZCBpbnQgY29sLCBib29sICogdmFsdWVPdXQpOworCisgICAgdWludDhfdCAqICAgICAgICAgICBvZmZzZXRUb1B0cih1aW50MzJfdCBvZmZzZXQpIHtyZXR1cm4gbURhdGEgKyBvZmZzZXQ7fQorCisgICAgcm93X3Nsb3RfdCAqICAgICAgICBhbGxvY1Jvd1Nsb3QoKTsKKworICAgIHJvd19zbG90X3QgKiAgICAgICAgZ2V0Um93U2xvdChpbnQgcm93KTsKKworICAgICAgICAgICAgICAgICAgICAgICAgLyoqCisgICAgICAgICAgICAgICAgICAgICAgICAgKiByZXR1cm4gTlVMTCBpZiBGYWlsZWQgdG8gZmluZCByb3dTbG90IG9yCisgICAgICAgICAgICAgICAgICAgICAgICAgKiBJbnZhbGlkIHJvd1Nsb3QKKyAgICAgICAgICAgICAgICAgICAgICAgICAqLworICAgIGZpZWxkX3Nsb3RfdCAqICAgICAgZ2V0RmllbGRTbG90V2l0aENoZWNrKGludCByb3csIGludCBjb2x1bW4pOworICAgIGZpZWxkX3Nsb3RfdCAqICAgICAgZ2V0RmllbGRTbG90KGludCByb3csIGludCBjb2x1bW4pCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgZmllbGREaXJPZmZzZXQgPSBnZXRSb3dTbG90KHJvdyktPm9mZnNldDsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICgoZmllbGRfc2xvdF90ICopb2Zmc2V0VG9QdHIoZmllbGREaXJPZmZzZXQpKSArIGNvbHVtbjsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisKK3ByaXZhdGU6CisgICAgdWludDhfdCAqIG1EYXRhOworICAgIHNpemVfdCBtU2l6ZTsKKyAgICBzaXplX3QgbU1heFNpemU7CisgICAgd2luZG93X2hlYWRlcl90ICogbUhlYWRlcjsKKyAgICBzcDxJTWVtb3J5PiBtTWVtb3J5OworCisgICAgLyoqCisgICAgICogT2Zmc2V0IG9mIHRoZSBsb3dl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GVhcCAhPSBOVUxMKSB7CisgICAgICAgIG1NZW1vcnkgPSBuZXcgTWVtb3J5QmFzZShoZWFwLCAwLCBtTWF4U2l6ZSk7CisgICAgICAgIGlmIChtTWVtb3J5ICE9IE5VTEwpIHsKKyAgICAgICAgICAgIG1EYXRhID0gKHVpbnQ4X3QgKikgbU1lbW9yeS0+cG9pbnRlcigpOworICAgICAgICAgICAgaWYgKG1EYXRhKSB7CisgICAgICAgICAgICAgICAgbUhlYWRlciA9ICh3aW5kb3dfaGVhZGVyX3QgKikgbURhdGE7CisgICAgICAgICAgICAgICAgbVNpemUgPSBtTWF4U2l6ZTsKKworICAgICAgICAgICAgICAgIC8vIFB1dCB0aGUgd2luZG93IGludG8gYSBjbGVhbiBzdGF0ZQorICAgICAgICAgICAgICAgIGNsZWFyKCk7CisgICAgICAgICAgICBMT0dfV0lORE9XKCJDcmVhdGVkIEN1cnNvcldpbmRvdyB3aXRoIG5ldyBNZW1vcnlEZWFsZXI6IG1GcmVlT2Zmc2V0ID0gJWQsIG1TaXplID0gJWQsIG1NYXhTaXplID0gJWQsIG1EYXRhID0gJXAiLCBtRnJlZU9mZnNldCwgbVNpemUsIG1NYXhTaXplLCBtRGF0YSk7CisgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7ICAgICAgICAgICAgICAgIAorICAgICAgICAgICAgfQorICAgICAgICB9IAorICAgICAgICBMT0dFKCJDdXJzb3JXaW5kb3cgaGVhcCBhbGxvY2F0aW9uIGZhaWxlZCIpOworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfSBlbHNlIHsKKyAgICAgICAgTE9HRSgiZmFpbGVkIHRvIGNyZWF0ZSB0aGUgQ3Vyc29yV2luZG93IGhlYXAiKTsKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KK30KKworQ3Vyc29yV2luZG93Ojp+Q3Vyc29yV2luZG93KCkKK3sKKyAgICAvLyBFdmVyeXRoaW5nIHRoYXQgbWF0dGVycyBpcyBhIHNtYXJ0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ZmZzZXQpIHsKKyAgICAgICAgbUhlYWRlci0+bnVtUm93cy0tOworICAgICAgICBMT0dFKCJUaGUgcm93IGZhaWxlZCwgc28gYmFjayBvdXQgdGhlIG5ldyByb3cgYWNjb3VudGluZyBmcm9tIGFsbG9jUm93U2xvdCAlZCIsIG1IZWFkZXItPm51bVJvd3MpOworICAgICAgICByZXR1cm4gTlVMTDsKKyAgICB9CisgICAgZmllbGRfc2xvdF90ICogZmllbGREaXIgPSAoZmllbGRfc2xvdF90ICopb2Zmc2V0VG9QdHIoZmllbGREaXJPZmZzZXQpOworICAgIG1lbXNldChmaWVsZERpciwgMHgwLCBmaWVsZERpclNpemUpOworCitMT0dfV0lORE9XKCJBbGxvY2F0ZWQgcm93ICV1LCByb3dTbG90IGlzIGF0IG9mZnNldCAldSwgZmllbGREaXIgaXMgJWQgYnl0ZXMgYXQgb2Zmc2V0ICV1XG4iLCAobUhlYWRlci0+bnVtUm93cyAtIDEpLCAoKHVpbnQ4X3QgKilyb3dTbG90KSAtIG1EYXRhLCBmaWVsZERpclNpemUsIGZpZWxkRGlyT2Zmc2V0KTsKKyAgICByb3dTbG90LT5vZmZzZXQgPSBmaWVsZERpck9mZnNldDsKKworICAgIHJldHVybiBmaWVsZERpcjsKK30KKwordWludDMyX3QgQ3Vyc29yV2luZG93OjphbGxvYyhzaXplX3QgcmVxdWVzdGVkU2l6ZSwgYm9vbCBhbGlnbmVkKQoreworICAgIGludDMyX3Qgc2l6ZTsKKyAgICB1aW50MzJfdCBwYWRkaW5nOworICAgIGlmIChhbGlnbmVkKSB7CisgICAgICAgIC8vIDQgYnl0ZSBhbGlnbm1lbnQKKyAgICAgICAgcGFkZGluZyA9IDQgLSAobUZyZWVPZmZzZXQgJiAweDMpOworICAgIH0gZWxzZSB7CisgICAgICAgIHBhZGRpbmcgPSAwOworICAgIH0KKworICAgIHNpemUgPSByZXF1ZXN0ZWRTaXplICsgcGFkZGluZzsKKworICAgIGlmIChzaXplID4gZnJlZVNwYWNlKCkpIHsKKyAgICAgICAgTE9HRSgibmVlZCB0byBncm93OiBtU2l6ZSA9ICVkLCBzaXplID0gJWQsIGZyZWVTcGFjZSgpID0gJWQsIG51bVJvd3MgPSAlZCIsIG1TaXplLCBzaXplLCBmcmVlU3BhY2UoKSwgbUhlYWRlci0+bnVtUm93cyk7CisgICAgICAgIC8vIE9ubHkgZ3JvdyB0aGUgd2luZG93IGlmIHRoZSBmaXJzdCByb3cgZG9lc24ndCBmaXQKKyAgICAgICAgaWYgKG1IZWFkZXItPm51bVJvd3MgPiAxKSB7CitMT0dFKCJub3QgZ3Jvd2luZyBzaW5jZSB0aGVyZSBhcmUgYWxyZWFkeSAlZCByb3cocyksIG1heCBzaXplICVkIiwgbUhlYWRlci0+bnVtUm93cywgbU1heFNpemUpOworICAgICAgICAgICAgcmV0dXJuIDA7CisgICAgICAgIH0KKworICAgICAgICAvLyBGaW5kIGEgbmV3IHNpemUgdGhhdCB3aWxsIGZpdCB0aGUgYWxsb2NhdGlvbgorICAgICAgICBpbnQgYWxsb2NhdGVkID0gbVNpemUgLSBmcmVlU3BhY2UoKTsKKyAgICAgICAgaW50IG5ld1NpemUgPSBtU2l6ZSArIFdJTkRPV19BTExPQ0FUSU9OX1NJWkU7CisgICAgICAgIHdoaWxlIChzaXplID4gKG5ld1NpemUgLSBhbGxvY2F0ZWQpKSB7CisgICAgICAgICAgICBuZXdTaXplICs9IFdJTkRPV19BTExPQ0FUSU9OX1NJWkU7CisgICAgICAgICAgICBpZiAobmV3U2l6ZSA+IG1NYXhTaXplKSB7CisgICAgICAgICAgICAgICAgTE9HRSgiQXR0ZW1wdGluZyB0byBncm93IHdpbmRvdyBiZXlvbmQgbWF4IHNpemUgKCVkKSIsIG1NYXhTaXplKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gMDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorTE9HX1dJTkRPVygiZm91bmQgc2l6ZSAlZCIsIG5ld1NpemUpOworICAgICAgICBtU2l6ZSA9IG5ld1NpemU7CisgICAgfQorCisgICAgdWludDMyX3Qgb2Zmc2V0ID0gbUZyZWVPZmZzZXQgKyBwYWRkaW5nOworICAgIG1GcmVlT2Zmc2V0ICs9IHNpemU7CisgICAgcmV0dXJuIG9mZnNldDsKK30KKworcm93X3Nsb3RfdCAqIEN1cnNvcldpbmRvdzo6Z2V0Um93U2xvdChpbnQgcm93KQoreworICAgIExPR19XSU5ET1coImVudGVyIGdldFJvd1Nsb3QgY3VycmVudCByb3cgbnVtICVkLCB0aGlzIHJvdyAlZCIsIG1IZWFkZXItPm51bVJvd3MsIHJvdyk7CisgICAgaW50IGNodW5rTnVtID0gcm93IC8gUk9XX1NMT1RfQ0hVTktfTlVNX1JPV1M7CisgICAgaW50IGNodW5rUG9zID0gcm93ICUgUk9XX1NMT1RfQ0hVTktfTlVNX1JPV1M7CisgICAgaW50IGNodW5rUHRyT2Zmc2V0ID0gc2l6ZW9mKHdpbmRvd19oZWFkZXJfdCkgKyBST1dfU0xPVF9DSFVOS19TSVpFIC0gc2l6ZW9mKHVpbnQzMl90KTsKKyAgICB1aW50OF90ICogcm93Q2h1bmsgPSBtRGF0YSArIHNpemVvZih3aW5kb3dfaGVhZGVyX3QpOworICAgIGZvciAoaW50IGkgPSAwOyBpIDwgY2h1bmtOdW07IGkrKykgeworICAgICAgICByb3dDaHVuayA9IG9mZnNldFRvUHRyKCooKHVpbnQzMl90ICopKG1EYXRhICsgY2h1bmtQdHJPZmZzZXQpKSk7CisgICAgICAgIGNodW5rUHRyT2Zmc2V0ID0gcm93Q2h1bmsgLSBtRGF0YSArIChST1dfU0xPVF9DSFVOS19OVU1fUk9XUyAqIHNpemVvZihyb3dfc2xvdF90KSk7CisgICAgfQorICAgIHJldHVybiAocm93X3Nsb3RfdCAqKShyb3dDaHVuayArIChjaHVua1BvcyAqIHNpemVvZihyb3dfc2xvdF90KSkpOworICAgIExPR19XSU5ET1coImV4aXQgZ2V0Um93U2xvdCBjdXJyZW50IHJvdyBudW0gJ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obmV4dENodW5rT2Zmc2V0ID09IDApIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gTlVMTDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHJvd0NodW5rID0gb2Zmc2V0VG9QdHIobmV4dENodW5rT2Zmc2V0KTsKK0xPR19XSU5ET1coImFsbG9jYXRlZCBuZXcgY2h1bmsgYXQgJWQsIHJvd0NodW5rID0gJXAiLCBuZXh0Q2h1bmtPZmZzZXQsIHJvd0NodW5rKTsKKyAgICAgICAgICAgICooKHVpbnQzMl90ICopKG1EYXRhICsgY2h1bmtQdHJPZmZzZXQpKSA9IHJvd0NodW5rIC0gbURhdGE7CisgICAgICAgICAgICAvLyBNYXJrIHRoZSBuZXcgY2h1bmsncyBuZXh0ICdwb2ludGVyJyBhcyBudWxsCisgICAgICAgICAgICAqKCh1aW50MzJfdCAqKShyb3dDaHVuayArIFJPV19TTE9UX0NIVU5LX1NJWkUgLSBzaXplb2YodWludDMyX3QpKSkgPSAwOworICAgICAgICB9IGVsc2UgeworTE9HX1dJTkRPVygiZm9sbHdpbmcgJ3BvaW50ZXInIHRvIG5leHQgY2h1bmssIG9mZnNldCBvZiBuZXh0IHBvaW50ZXIgaXMgJWQiLCBjaHVua1B0ck9mZnNldCk7CisgICAgICAgICAgICByb3dDaHVuayA9IG9mZnNldFRvUHRyKG5leHRDaHVua09mZnNldCk7CisgICAgICAgICAgICBjaHVua1B0ck9mZnNldCA9IHJvd0NodW5rIC0gbURhdGEgKyAoUk9XX1NMT1RfQ0hVTktfTlVNX1JPV1MgKiBzaXplb2Yocm93X3Nsb3RfdCkpOworICAgICAgICB9CisgICAgfQorICAgIG1IZWFkZXItPm51bVJvd3MrKzsKKworICAgIHJldHVybiAocm93X3Nsb3RfdCAqKShyb3dDaHVuayArIChjaHVua1BvcyAqIHNpemVvZihyb3dfc2xvdF90KSkpOworfQorCitmaWVsZF9zbG90X3QgKiBDdXJzb3JXaW5kb3c6OmdldEZpZWxkU2xvdFdpdGhDa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JRUxEX1RZUEVfRkxPQVQ7CisgICAgcmV0dXJuIHRydWU7Cit9CisKK2Jvb2wgQ3Vyc29yV2luZG93OjpwdXROdWxsKHVuc2lnbmVkIGludCByb3csIHVuc2lnbmVkIGludCBjb2wpCit7CisgICAgZmllbGRfc2xvdF90ICogZmllbGRTbG90ID0gZ2V0RmllbGRTbG90V2l0aENoZWNrKHJvdywgY29sKTsKKyAgICBpZiAoIWZpZWxkU2xvdCkgeworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgZmllbGRTbG90LT50eXBlID0gRklFTERfVFlQRV9OVUxMOworICAgIGZpZWxkU2xvdC0+ZGF0YS5idWZmZXIub2Zmc2V0ID0gMDsKKyAgICBmaWVsZFNsb3QtPmRhdGEuYnVmZmVyLnNpemUgPSAwOworICAgIHJldHVybiB0cnVlOworfQorCitib29sIEN1cnNvcldpbmRvdzo6Z2V0TG9uZyh1bnNpZ25lZCBpbnQgcm93LCB1bnNpZ25lZCBpbnQgY29sLCBpbnQ2NF90ICogdmFsdWVPdXQpCit7CisgICAgZmllbGRfc2xvdF90ICogZmllbGRTbG90ID0gZ2V0RmllbGRTbG90V2l0aENoZWNrKHJvdywgY29sKTsKKyAgICBpZiAoIWZpZWxkU2xvdCB8fCBmaWVsZFNsb3QtPnR5cGUgIT0gRklFTERfVFlQRV9JTlRFR0VSKSB7CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisgICAgCisjaWYgV0lORE9XX1NUT1JBR0VfSU5MSU5FX05VTUVSSUNTCisgICAgKnZhbHVlT3V0ID0gZmllbGRTbG90LT5kYXRhLmw7CisjZWxzZQorICAgICp2YWx1ZU91dCA9IGNvcHlPdXRMb25nKGZpZWxkU2xvdC0+ZGF0YS5idWZmZXIub2Zmc2V0KTsKKyNlbmRpZgorICAgIHJldHVybiB0cnVlOworfQorCitib29sIEN1cnNvcldpbmRvdzo6Z2V0RG91YmxlKHVuc2lnbmVkIGludCByb3csIHVuc2lnbmVkIGludC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ICAgaW50IHdpZHRoLCBoZWlnaHQ7CisgICAgICAgIGludCBzdWNjZXNzID0gcGFyc2Vfc2l6ZShzaXplU3RhcnRQdHIsIHdpZHRoLCBoZWlnaHQsICZzaXplU3RhcnRQdHIpOworICAgICAgICBpZiAoc3VjY2VzcyA9PSAtMSB8fCAoKnNpemVTdGFydFB0ciAhPSAnLCcgJiYgKnNpemVTdGFydFB0ciAhPSAnXDAnKSkgeworICAgICAgICAgICAgTE9HRSgiUGljdHVyZSBzaXplcyBzdHJpbmcgXCIlc1wiIGNvbnRhaW5zIGludmFsaWQgY2hhcmFjdGVyLiIsIHNpemVzU3RyKTsKKyAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfQorICAgICAgICBzaXplcy5wdXNoKFNpemUod2lkdGgsIGhlaWdodCkpOworCisgICAgICAgIGlmICgqc2l6ZVN0YXJ0UHRyID09ICdcMCcpIHsKKyAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfQorICAgICAgICBzaXplU3RhcnRQdHIrKzsKKyAgICB9Cit9CisKIHZvaWQgQ2FtZXJhUGFyYW1ldGVyczo6c2V0UHJldmlld1NpemUoaW50IHdpZHRoLCBpbnQgaGVpZ2h0KQogewogICAgIGNoYXIgc3RyWzMyXTsKQEAgLTMxMSw2ICszMzksMTIgQEAKICAgICB9CiB9CiAKK3ZvaWQgQ2FtZXJhUGFyYW1ldGVyczo6Z2V0U3VwcG9ydGVkUHJldmlld1NpemVzKFZlY3RvcjxTaXplPiAmc2l6ZXMpIGNvbnN0Cit7CisgICAgY29uc3QgY2hhciAqcHJldmlld1NpemVzU3RyID0gZ2V0KEtFWV9TVVBQT1JURURfUFJFVklFV19TSVpFUyk7CisgICAgcGFyc2VTaXplc0xpc3QocHJldmlld1NpemVzU3RyLCBzaXplcyk7Cit9CisKIHZvaWQgQ2FtZXJhUGFyYW1ldGVyczo6c2V0UHJldmlld0ZyYW1lUmF0ZShpbnQgZnBzKQogewogICAgIHNldChLRVlfUFJFVklFV19GU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Zm5kZWYgQU5EUk9JRF9VSV9FWFRFTlNJT05TX0gKKyNkZWZpbmUgQU5EUk9JRF9VSV9FWFRFTlNJT05TX0gKKworI2luY2x1ZGUgPHV0aWxzL1NvcnRlZFZlY3Rvci5oPgorI2luY2x1ZGUgPHV0aWxzL1N0cmluZzguaD4KKworI2luY2x1ZGUgPEdMRVMyL2dsMi5oPgorI2luY2x1ZGUgPEdMRVMyL2dsMmV4dC5oPgorCituYW1lc3BhY2UgYW5kcm9pZCB7CituYW1lc3BhY2UgdWlyZW5kZXJlciB7CisKK2NsYXNzIEV4dGVuc2lvbnMgeworcHVibGljOgorICAgIEV4dGVuc2lvbnMoKSB7CisgICAgICAgIGNvbnN0IGNoYXIqIGJ1ZmZlciA9IChjb25zdCBjaGFyKikgZ2xHZXRTdHJpbmcoR0xfRVhURU5TSU9OUyk7CisgICAgICAgIGNvbnN0IGNoYXIqIGN1cnJlbnQgPSBidWZmZXI7CisgICAgICAgIGNvbnN0IGNoYXIqIGhlYWQgPSBjdXJyZW50OworICAgICAgICBkbyB7CisgICAgICAgICAgICBoZWFkID0gc3RyY2hyKGN1cnJlbnQsICcgJyk7CisgICAgICAgICAgICBTdHJpbmc4IHMoY3VycmVudCwgaGVhZCA/IGhlYWQgLSBjdXJyZW50IDogc3RybGVuKGN1cnJlbnQpKTsKKyAgICAgICAgICAgIGlmIChzLmxlbmd0aCgpKSB7CisgICAgICAgICAgICAgICAgbUV4dGVuc2lvbkxpc3QuYWRkKHMpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY3VycmVudCA9IGhlYWQgKyAxOworICAgICAgICB9IHdoaWxlIChoZWFkKTsKKworICAgICAgICBtSGFzTlBvdCA9IGhhc0V4dGVuc2lvbigiR0xfT0VTX3RleHR1cmVfbnBvdCIpOworICAgICAgICBtSGFzRHJhd1BhdGggPSBoYXNFeHRlbnNpb24oIkdMX05WX2RyYXdfcGF0aCIpOworICAgICAgICBtSGFzQ292ZXJhZ2VTYW1wbGUgPSBoYX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UtPm1BY3RpdmVGb250c1tjdF0gPT0gdGhpcykgeworICAgICAgICAgICAgbVN0YXRlLT5tQWN0aXZlRm9udHMucmVtb3ZlQXQoY3QpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBmb3IgKHVpbnQzMl90IGkgPSAwOyBpIDwgbUNhY2hlZEdseXBocy5zaXplKCk7IGkrKykgeworICAgICAgICBDYWNoZWRHbHlwaEluZm8qIGdseXBoID0gbUNhY2hlZEdseXBocy52YWx1ZUF0KGkpOworICAgICAgICBkZWxldGUgZ2x5cGg7CisgICAgfQorfQorCit2b2lkIEZvbnQ6OmludmFsaWRhdGVUZXh0dXJlQ2FjaGUoKSB7CisgICAgZm9yICh1aW50MzJfdCBpID0gMDsgaSA8IG1DYWNoZWRHbHlwaHMuc2l6ZSgpOyBpKyspIHsKKyAgICAgICAgbUNhY2hlZEdseXBocy52YWx1ZUF0KGkpLT5tSXNWYWxpZCA9IGZhbHNlOworICAgIH0KK30KKwordm9pZCBGb250OjptZWFzdXJlQ2FjaGVkR2x5cGgoQ2FjaGVkR2x5cGhJbmZvICpnbHlwaCwgaW50IHgsIGludCB5LCBSZWN0ICpib3VuZHMpIHsKKyAgICBpbnQgblBlblggPSB4ICsgZ2x5cGgtPm1CaXRtYXBMZWZ0OworICAgIGludCBuUGVuWSA9IHkgKyBnbHlwaC0+bUJpdG1hcFRvcDsKKworICAgIGludCB3aWR0aCA9IChpbnQpIGdseXBoLT5tQml0bWFwV2lkdGg7CisgICAgaW50IGhlaWdodCA9IChpbnQpIGdseXBoLT5tQml0bWFwSGVpZ2h0OworCisgICAgaWYgKGJvdW5kcy0+Ym90dG9tID4gblBlblkpIHsKKyAgICAgICAgYm91bmRzLT5ib3R0b20gPSBuUGVuWTsKKyAgICB9CisgICAgaWYgKGJvdW5kcy0+bGVmdCA+IG5QZW5YKSB7CisgICAgICAgIGJvdW5kcy0+bGVmdCA9IG5QZW5YOworICAgIH0KKyAgICBpZiAo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ZvICpnbHlwaCwgaW50IHgsIGludCB5LAorICAgICAgICB1aW50OF90ICpiaXRtYXAsIHVpbnQzMl90IGJpdG1hcFcsIHVpbnQzMl90IGJpdG1hcEgpIHsKKyAgICBpbnQgblBlblggPSB4ICsgZ2x5cGgtPm1CaXRtYXBMZWZ0OworICAgIGludCBuUGVuWSA9IHkgKyBnbHlwaC0+bUJpdG1hcFRvcDsKKworICAgIHVpbnQzMl90IGVuZFggPSBnbHlwaC0+bVN0YXJ0WCArIGdseXBoLT5tQml0bWFwV2lkdGg7CisgICAgdWludDMyX3QgZW5kWSA9IGdseXBoLT5tU3RhcnRZICsgZ2x5cGgtPm1CaXRtYXBIZWlnaHQ7CisKKyAgICB1aW50MzJfdCBjYWNoZVdpZHRoID0gbVN0YXRlLT5nZXRDYWNoZVdpZHRoKCk7CisgICAgY29uc3QgdWludDhfdCogY2FjaGVCdWZmZXIgPSBtU3RhdGUtPmdldFRleHRUZXh0dXJlRGF0YSgpOworCisgICAgdWludDMyX3QgY2FjaGVYID0gMCwgY2FjaGVZID0gMDsKKyAgICBpbnQzMl90IGJYID0gMCwgYlkgPSAwOworICAgIGZvciAoY2FjaGVYID0gZ2x5cGgtPm1TdGFydFgsIGJYID0gblBlblg7IGNhY2hlWCA8IGVuZFg7IGNhY2hlWCsrLCBiWCsrKSB7CisgICAgICAgIGZvciAoY2FjaGVZID0gZ2x5cGgtPm1TdGFydFksIGJZID0gblBlblk7IGNhY2hlWSA8IGVuZFk7IGNhY2hlWSsrLCBiWSsrKSB7CisgICAgICAgICAgICBpZiAoYlggPCAwIHx8IGJZIDwgMCB8fCBiWCA+PSAoaW50MzJfdCliaXRtYXBXIHx8IGJZID49IChpbnQzMl90KWJpdG1hcEgpIHsKKyAgICAgICAgICAgICAgICBMT0dFKCJTa2lwcGluZyBpbnZhbGlkIGluZGV4Iik7CisgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICB9CisgICAgICAgICAgICB1aW50OF90IHRlbXBDb2wgP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W9kZSBtb2RlLCB1aW50OF90ICpiaXRtYXAsCisgICAgICAgIHVpbnQzMl90IGJpdG1hcFcsIHVpbnQzMl90IGJpdG1hcEgsUmVjdCAqYm91bmRzKSB7CisgICAgaWYgKG51bUdseXBocyA9PSAwIHx8IHRleHQgPT0gTlVMTCB8fCBsZW4gPT0gMCkgeworICAgICAgICByZXR1cm47CisgICAgfQorCisgICAgaW50IHBlblggPSB4LCBwZW5ZID0geTsKKyAgICBpbnQgZ2x5cGhzTGVmdCA9IDE7CisgICAgaWYgKG51bUdseXBocyA+IDApIHsKKyAgICAgICAgZ2x5cGhzTGVmdCA9IG51bUdseXBoczsKKyAgICB9CisKKyAgICB0ZXh0ICs9IHN0YXJ0OworCisgICAgd2hpbGUgKGdseXBoc0xlZnQgPiAwKSB7CisgICAgICAgIGludDMyX3QgdXRmQ2hhciA9IFNrVVRGMTZfTmV4dFVuaWNoYXIoKGNvbnN0IHVpbnQxNl90KiopICZ0ZXh0KTsKKworICAgICAgICAvLyBSZWFjaGVkIHRoZSBlbmQgb2YgdGhlIHN0cmluZworICAgICAgICBpZiAodXRmQ2hhciA8IDApIHsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisKKyAgICAgICAgQ2FjaGVkR2x5cGhJbmZvKiBjYWNoZWRHbHlwaCA9IGdldENhY2hlZFVURkNoYXIocGFpbnQsIHV0ZkNoYXIpOworCisgICAgICAgIC8vIElmIGl0J3Mgc3RpbGwgbm90IHZhbGlkLCB3ZSBjb3VsZG4ndCBjYWNoZSBpdCwgc28gd2Ugc2hvdWxkbid0IGRyYXcgZ2FyYmFnZQorICAgICAgICBpZiAoY2FjaGVkR2x5cGgtPm1Jc1ZhbGlkKSB7CisgICAgICAgICAgICBzd2l0Y2gobW9kZSkgeworICAgICAgICAgICAgY2FzZSBGUkFNRUJVRkZFUjoKKyAgICAgICAgICAgICAgICBkcmF3Q2FjaGVkR2x5cGgoY2FjaGVkR2x5cGgsIHBlblgsIHBlblkpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBCSVRNQVA6CisgICAgICAgICAgICAgICAgZHJhd0NhY2hlZEdseXBoKGNhY2hlZEdseXBoLCBwZW5YLCBwZW5ZLCBiaXRtYXAsIGJpdG1hcFcsIGJpdG1hcEgpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBNRUFTVVJFOgorICAgICAgICAgICAgICAgIG1lYXN1cmVDYWNoZWRHbHlwaChjYWNoZWRHbHlwaCwgcGVuWCwgcGVuWSwgYm91bmRzKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHBlblggKz0gU2tGaXhlZEZsb29yKGNhY2hlZEdseXBoLT5tQWR2YW5jZVgpOworCisgICAgICAgIC8vIElmIHdlIHdlcmUgZ2l2ZW4gYSBzcGVjaWZpYyBudW1iZXIgb2YgZ2x5cGhzLCBkZWNyZW1lbnQKKyAgICAgICAgaWYgKG51bUdseXBocyA+IDApIHsKKyAgICAgICAgICAgIGdseXBoc0xlZnQtLTsKKyAgICAgICAgfQorICAgIH0KK30KKwordm9pZCBGb250Ojp1cGRhdGVHbHlwaENhY2hlKFNrUGFpbnQqIHBhaW50LCBjb25zdCBTa0dseXBoJiBza2lhR2x5cGgsIENhY2hlZEdseXBoSW5mbyogZ2x5cGgpIHsKKyAgICBnbHlwaC0+bUFkdmFuY2VYID0gc2tpYUdseXBoLmZBZHZhbmNlWDsKKyAgICBnbHlwaC0+bUFkdmFuY2VZID0gc2tpYUdseXBoLmZBZHZhbmNlWTsKKyAgICBnbHlwaC0+bUJpdG1hcExlZnQgPSBza2lhR2x5cGguZkxlZnQ7CisgICAgZ2x5cGgtPm1CaXRtYXBUb3AgPSBza2lhR2x5cGguZlRvcDsKKworICAgIHVpbnQzMl90IHN0YXJ0WCA9IDA7CisgICAgdWludDMyX3Qgc3RhcnRZID0gMDsKKworICAgIC8vIEdldCB0aGUg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vYXQgejQsIGZsb2F0IHU0LCBmbG9hdCB2NCkgeworICAgIGlmICh4MSA+IG1DbGlwLT5yaWdodCB8fCB5MSA8IG1DbGlwLT50b3AgfHwgeDIgPCBtQ2xpcC0+bGVmdCB8fCB5NCA+IG1DbGlwLT5ib3R0b20pIHsKKyAgICAgICAgcmV0dXJuOworICAgIH0KKworICAgIGNvbnN0IHVpbnQzMl90IHZlcnRzUGVyUXVhZCA9IDQ7CisgICAgY29uc3QgdWludDMyX3QgZmxvYXRzUGVyVmVydCA9IDU7CisgICAgZmxvYXQqIGN1cnJlbnRQb3MgPSBtVGV4dE1lc2hQdHIgKyBtQ3VycmVudFF1YWRJbmRleCAqIHZlcnRzUGVyUXVhZCAqIGZsb2F0c1BlclZlcnQ7CisKKyAgICAoKmN1cnJlbnRQb3MrKykgPSB4MTsKKyAgICAoKmN1cnJlbnRQb3MrKykgPSB5MTsKKyAgICAoKmN1cnJlbnRQb3MrKykgPSB6MTsKKyAgICAoKmN1cnJlbnRQb3MrKykgPSB1MTsKKyAgICAoKmN1cnJlbnRQb3MrKykgPSB2MTsKKworICAgICgqY3VycmVudFBvcysrKSA9IHgyOworICAgICgqY3VycmVudFBvcysrKSA9IHkyOworICAgICgqY3VycmVudFBvcysrKSA9IHoyOworICAgICgqY3VycmVudFBvcysrKSA9IHUyOworICAgICgqY3VycmVudFBvcysrKSA9IHYyOworCisgICAgKCpjdXJyZW50UG9zKyspID0geDM7CisgICAgKCpjdXJyZW50UG9zKyspID0geTM7CisgICAgKCpjdXJyZW50UG9zKyspID0gejM7CisgICAgKCpjdXJyZW50UG9zKyspID0gdTM7CisgICAgKCpjdXJyZW50UG9zKyspID0gdjM7CisKKyAgICAoKmN1cnJlbnRQb3MrKykgPSB4NDsKKyAgICAoKmN1cnJlbnRQb3MrKykgPSB5NDsKKyAgICAoKmN1cnJlbnRQb3MrKykgPSB6NDsKKyAgICAoKmN1cnJlbnRQb3MrKykgPSB1NDsKKyAgICAoKmN1cnJlbnRQb3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yB5IDwgaGVpZ2h0OyB5ICsrKSB7CisKKyAgICAgICAgY29uc3QgdWludDhfdCogaW5wdXQgPSBzb3VyY2UgKyB5ICogd2lkdGg7CisgICAgICAgIHVpbnQ4X3QqIG91dHB1dCA9IGRlc3QgKyB5ICogd2lkdGg7CisKKyAgICAgICAgZm9yKGludDMyX3QgeCA9IDA7IHggPCB3aWR0aDsgeCArKykgeworICAgICAgICAgICAgYmx1cnJlZFBpeGVsID0gMC4wZjsKKyAgICAgICAgICAgIGNvbnN0IGZsb2F0KiBnUHRyID0gd2VpZ2h0czsKKyAgICAgICAgICAgIC8vIE9wdGltaXphdGlvbiBmb3Igbm9uLWJvcmRlciBwaXhlbHMKKyAgICAgICAgICAgIGlmICgoeCA+IHJhZGl1cykgJiYgKHggPCAod2lkdGggLSByYWRpdXMpKSkgeworICAgICAgICAgICAgICAgIGNvbnN0IHVpbnQ4X3QgKmkgPSBpbnB1dCArICh4IC0gcmFkaXVzKTsKKyAgICAgICAgICAgICAgICBmb3IoaW50IHIgPSAtcmFkaXVzOyByIDw9IHJhZGl1czsgciArKykgeworICAgICAgICAgICAgICAgICAgICBjdXJyZW50UGl4ZWwgPSAoZmxvYXQpKCppKTsKKyAgICAgICAgICAgICAgICAgICAgYmx1cnJlZFBpeGVsICs9IGN1cnJlbnRQaXhlbCAqIGdQdHJbMF07CisgICAgICAgICAgICAgICAgICAgIGdQdHIrKzsKKyAgICAgICAgICAgICAgICAgICAgaSsrOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgZm9yKGludDMyX3QgciA9IC1yYWRpdXM7IHIgPD0gcmFkaXVzOyByICsrKSB7CisgICAgICAgICAgICAgICAgICAgIC8vIFN0ZXBwaW5nIGxlZnQgYW5kIHJpZ2h0IGF3YXkgZnJvbSB0aGUgcGl4ZWwKKyAgICAgICAgICAgICAgICAgICAgaW50IHZhbGlkVyA9IHggKyByOworICAgICAgICAgICAgICAgICAgICBpZih2YWxpZFcgPCAwKSB7CisgICAgICAgICAgICAgICAgICAgICAgICB2YWxpZFcgPSAwOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGlmKHZhbGlkVyA+IHdpZHRoIC0gMSkgeworICAgICAgICAgICAgICAgICAgICAgICAgdmFsaWRXID0gd2lkdGggLSAxOworICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgICAgY3VycmVudFBpeGVsID0gKGZsb2F0KShpbnB1dFt2YWxpZFddKTsKKyAgICAgICAgICAgICAgICAgICAgYmx1cnJlZFBpeGVsICs9IGN1cnJlbnRQaXhlbCAqIGdQdHJbMF07CisgICAgICAgICAgICAgICAgICAgIGdQdHIrKzsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICAqb3V0cHV0ID0gKHVpbnQ4X3QpYmx1cnJlZFBpeGVsOworICAgICAgICAgICAgb3V0cHV0ICsrOworICAgICAgICB9CisgICAgfQorfQorCit2b2lkIEZvbnRSZW5kZXJlcjo6dmVydGljYWxCbHVyKGZsb2F0KiB3ZWlnaHRzLCBpbnQzMl90IHJhZGl1cywKKyAgICAgICAgY29uc3QgdWludDhfdCogc291cmNlLCB1aW50OF90KiBkZXN0LCBpbnQzMl90IHdpZHRoLCBpbnQzMl90IGhlaWdodCkgeworICAgIGZsb2F0IGJsdXJyZWRQaXhlbCA9IDAuMGY7CisgICAgZmxvYXQgY3VycmVudFBpeGVsID0gMC4wZjsKKworICAgIGZvcihpbnQzMl90IHkgPSAwOyB5IDwgaGVpZ2h0OyB5ICsrKSB7CisKKyAgICAgICAgdWludDhfdCogb3V0cHV0ID0gZGVzdCArIHkgKiB3aWR0aDsKKworICAgICAgICBmb3IoaW50MzJfdCB4ID0gMDsgeCA8IHdpZHRoOyB4ICsrKSB7CisgICAgICAgICAgICBibHVycmVkUGl4ZWwgPSAwLjBmOworICAgICAgICAgICAgY29uc3QgZmxvYXQqIGdQdHIgPSB3ZWlnaHRzOworICAgICAgICAgICAgY29uc3QgdWludDhfdCogaW5wdXQgPSBzb3VyY2UgKyB4OworICAgICAgICAgICAgLy8gT3B0aW1pemF0aW9uIGZvciBub24tYm9yZGVyIHBpeGVscworICAgICAgICAgICAgaWYgKCh5ID4gcmFkaXVzKSAmJiAoeSA8IChoZWlnaHQgLSByYWRpdXMpKSkgeworICAgICAgICAgICAgICAgIGNvbnN0IHVpbnQ4X3QgKmkgPSBpbnB1dCArICgoeSAtIHJhZGl1cykgKiB3aWR0aCk7CisgICAgICAgICAgICAgICAgZm9yKGludDMyX3QgciA9IC1yYWRpdXM7IHIgPD0gcmFkaXVzOyByICsrKSB7CisgICAgICAgICAgICAgICAgICAgIGN1cnJlbnRQaXhlbCA9IChmbG9hdCkoKmkpOworICAgICAgICAgICAgICAgICAgICBibHVycmVkUGl4ZWwgKz0gY3VycmVudFBpeGVsICogZ1B0clswXTsKKyAgICAgICAgICAgICAgICAgICAgZ1B0cisrOworICAgICAgICAgICAgICAgICAgICBpICs9IHdpZHRoOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgZm9yKGludDMyX3QgciA9IC1yYWRpdXM7IHIgPD0gcmFkaXVzOyByICsrKSB7CisgICAgICAgICAgICAgICAgICAgIGludCB2YWxpZEggPSB5ICsgcjsKKyAgICAgICAgICAgICAgICAgICAgLy8gQ2xhbXAgdG8gemVybyBhbmQgd2lkdGgKKyAgICAgICAgICAgICAgICAgICAgaWYodmFsaWRIIDwgMCkgeworICAgICAgICAgICAgICAgICAgICAgICAgdmFsaWRIID0gMDsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBpZih2YWxpZEggPiBoZWlnaHQgLSAxKSB7CisgICAgICAgICAgICAgICAgICAgICAgICB2YWxpZEggPSBoZWlnaHQgLSAxOworICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgICAgY29uc3QgdWludDhfdCAqaSA9IGlucHV0ICsgdmFsaWRIICogd2lkdGg7CisgICAgICAgICAgICAgICAgICAgIGN1cnJlbnRQaXhlbCA9IChmbG9hdCkoKmkpOworICAgICAgICAgICAgICAgICAgICBibHVycmVkUGl4ZWwgKz0gY3VycmVudFBpeGVsICogZ1B0clswXTsKKyAgICAgICAgICAgICAgICAgICAgZ1B0cisrOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgICpvdXRwdXQgPSAodWludDhfdClibHVycmVkUGl4ZWw7CisgICAgICAgICAgICBvdXRwdXQgKys7CisgICAgICAgIH0KKyAgICB9Cit9CisKKwordm9pZCBGb250UmVuZGVyZXI6OmJsdXJJbWFnZSh1aW50OF90ICppbWFnZSwgaW50MzJfdCB3aWR0aCwgaW50MzJfdCBoZWlnaHQsIGludDMyX3QgcmFkaXVzKSB7CisgICAgZmxvYXQgKmdhdXNzaWFuID0gbmV3IGZsb2F0WzIgKiByYWRpdXMgKyAxXTsKKyAgICBjb21wdXRlR2F1c3NpYW5XZWlnaHRzKGdhdXNzaWFuLCByYWRpdXMpOworICAgIHVpbnQ4X3QqIHNjcmF0Y2ggPSBuZXcgdWludDhfdFt3aWR0aCAqIGhlaWdodF07CisgICAgaG9yaXpvbnRhbEJsdXIoZ2F1c3NpYW4sIHJhZGl1cywgaW1hZ2UsIHNjcmF0Y2gsIHdpZHRoLCBoZWlnaHQpOworICAgIHZlcnRpY2FsQmx1cihnYXVzc2lhbiwgcmFkaXVzLCBzY3JhdGNoLCBpbWFnZSwgd2lkdGgsIGhlaWdodCk7CisgICAgZGVsZXRlW10gZ2F1c3NpYW47CisgICAgZGVsZXRlW10gc2NyYXRjaDsKK30KKworfTsgLy8gbmFtZXNwYWNlIHVpcmVuZGVyZXIKK307IC8vIG5hbWVzcGFjZSBhbmRyb2lkCmRpZmYgLS1naXQgYS9saWJzL2h3dWkvRm9udFJlbmRlcmVyLmggYi9saWJzL2h3dWkvRm9udFJl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gdWludDMyX3QgYml0bWFwVyA9IDAsIHVpbnQzMl90IGJpdG1hcEggPSAwKTsKKyAgICAvKioKKyAgICAgKiBDcmVhdGVzIGEgbmV3IGZvbnQgYXNzb2NpYXRlZCB3aXRoIHRoZSBzcGVjaWZpZWQgZm9udCBzdGF0ZS4KKyAgICAgKi8KKyAgICBzdGF0aWMgRm9udCogY3JlYXRlKEZvbnRSZW5kZXJlciogc3RhdGUsIHVpbnQzMl90IGZvbnRJZCwgZmxvYXQgZm9udFNpemUpOworCitwcm90ZWN0ZWQ6CisgICAgZnJpZW5kIGNsYXNzIEZvbnRSZW5kZXJlcjsKKworICAgIGVudW0gUmVuZGVyTW9kZSB7CisgICAgICAgIEZSQU1FQlVGRkVSLAorICAgICAgICBCSVRNQVAsCisgICAgICAgIE1FQVNVUkUsCisgICAgfTsKKworICAgIHZvaWQgcmVuZGVyVVRGKFNrUGFpbnQqIHBhaW50LCBjb25zdCBjaGFyICp0ZXh0LCB1aW50MzJfdCBzdGFydCwgdWludDMyX3QgbGVuLAorICAgICAgICAgICAgICAgICAgICAgaW50IG51bUdseXBocywgaW50IHgsIGludCB5LCBSZW5kZXJNb2RlIG1vZGUsCisgICAgICAgICAgICAgICAgICAgICB1aW50OF90ICpiaXRtYXAsIHVpbnQzMl90IGJpdG1hcFcsIHVpbnQzMl90IGJpdG1hcEgsCisgICAgICAgICAgICAgICAgICAgICBSZWN0ICpib3VuZHMpOworCisgICAgdm9pZCBtZWFzdXJlVVRGKFNrUGFpbnQqIHBhaW50LCBjb25zdCBjaGFyKiB0ZXh0LCB1aW50MzJfdCBzdGFydCwgdWludDMyX3QgbGVuLAorICAgICAgICAgICAgICAgICAgICAgIGludCBudW1HbHlwaHMsIFJlY3QgKmJvdW5kcyk7CisKKyAgICBzdHJ1Y3QgQ2FjaGVkR2x5cGhJbmZvIHsKKyAgICAgICAgLy8gSGFzIHRoZSBjYWNoZSBiZWVuIGludmFsaWRhdGVkPworICAgICAgICBib29sIG1Jc1ZhbGlkOworICAgICAgICAvLyBMb2NhdGlvbiBvZiB0aGUgY2FjaGVkIGdseXBoIGluIHRoZSBiaXRtYXAKKyAgICAgICAgLy8gaW4gY2FzZSB3ZSBuZWVkIHRvIHJlc2l6ZSB0aGUgdGV4dHVyZSBvcgorICAgICAgICAvLyByZW5kZXIgdG8gYml0bWFwCisgICAgICAgIHVpbnQzMl90IG1TdGFydFg7CisgICAgICAgIHVpbnQzMl90IG1TdGFydFk7CisgICAgICAgIHVpbnQzMl90IG1CaXRtYXBXaWR0aDsKKyAgICAgICAgdWludDMyX3QgbUJpdG1hcEhlaWdodDsKKyAgICAgICAgLy8gQWxzbyBjYWNoZSB0ZXh0dXJlIGNvb3JkcyBmb3IgdGhlIHF1YWQKKyAgICAgICAgZmxvYXQgbUJpdG1hcE1pblU7CisgICAgICAgIGZsb2F0IG1CaXRtYXBNaW5WOworICAgICAgICBmbG9hdCBtQml0bWFwTWF4VTsKKyAgICAgICAgZmxvYXQgbUJpdG1hcE1heFY7CisgICAgICAgIC8vIE1pbmltaXplIGhvdyBtdWNoIHdlIGNhbGwgZnJlZXR5cGUKKyAgICAgICAgdWludDMyX3QgbUdseXBoSW5kZXg7CisgICAgICAgIHVpbnQzMl90IG1BZHZhbmNlWDsKKyAgICAgICAgdWludDMyX3QgbUFkdmFuY2VZOworICAgICAgICAvLyBWYWx1ZXMgYmVsb3cgY29udGFpbiBhIGdseXBoJ3Mgb3JpZ2luIGluIHRoZSBiaXRtYXAKKyAgICAgICAgaW50MzJfdCBtQml0bWFwTGVmdDsKKyAgICAgICAgaW50MzJfdCBtQml0bWFwVG9wOworICAgIH07CisKKyAgICBGb250KEZvbnRSZW5kZXJlciogc3RhdGUsIHVpbnQzMl90IGZvbnRJZCwgZmxvYXQgZm9udFNpemUpOworCisgICAgRGVmYXVsdEtleWVkVmVjdG9yPGludDMyX3QsIENhY2hlZEdseXBoSW5mbyo+IG1DYWNoZWRHbHlwaHM7CisKKyAgICB2b2lkIGludmFsaWRhdGV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IGNvbnN0IFJlY3QqIGNsaXAsIGNvbnN0IGNoYXIgKnRleHQsIHVpbnQzMl90IHN0YXJ0SW5kZXgsCisgICAgICAgICAgICB1aW50MzJfdCBsZW4sIGludCBudW1HbHlwaHMsIGludCB4LCBpbnQgeSk7CisKKyAgICBzdHJ1Y3QgRHJvcFNoYWRvdyB7CisgICAgICAgIERyb3BTaGFkb3coKSB7IH07CisKKyAgICAgICAgRHJvcFNoYWRvdyhjb25zdCBEcm9wU2hhZG93JiBkcm9wU2hhZG93KToKKyAgICAgICAgICAgIHdpZHRoKGRyb3BTaGFkb3cud2lkdGgpLCBoZWlnaHQoZHJvcFNoYWRvdy5oZWlnaHQpLAorICAgICAgICAgICAgaW1hZ2UoZHJvcFNoYWRvdy5pbWFnZSksIHBlblgoZHJvcFNoYWRvdy5wZW5YKSwKKyAgICAgICAgICAgIHBlblkoZHJvcFNoYWRvdy5wZW5ZKSB7CisgICAgICAgIH0KKworICAgICAgICB1aW50MzJfdCB3aWR0aDsKKyAgICAgICAgdWludDMyX3QgaGVpZ2h0OworICAgICAgICB1aW50OF90KiBpbWFnZTsKKyAgICAgICAgaW50MzJfdCBwZW5YOworICAgICAgICBpbnQzMl90IHBlblk7CisgICAgfTsKKworICAgIC8vIEFmdGVyIHJlbmRlckRyb3BTaGFkb3cgcmV0dXJucywgdGhlIGNhbGxlZCBvd25zIHRoZSBtZW1vcnkgaW4gRHJvcFNoYWRvdy5pbWFnZQorICAgIC8vIGFuZCBpcyByZXNwb25zaWJsZSBmb3IgcmVsZWFzaW5nIGl0IHdoZW4gaXQncyBkb25lIHdpdGggaXQKKyAgICBEcm9wU2hhZG93IHJlbmRlckRyb3BTaGFkb3coU2tQYWludCogcGFpbnQsIGNvbnN0IGNoYXIgKnRleHQsIHVpbnQzMl90IHN0YXJ0SW5kZXgsCisgICAgICAgICAgICB1aW50MzJfdCBsZW4sIGludCBudW1HbHlwaHMsIHVpbnQzMl90IHJhZGl1cyk7CisKKyAgICBHTHVpbnQgZ2V0VGV4dHVyZSgpIHsKKyAgICAgICAgY2hlY2tJbml0KCk7CisgICAgICAgIHJldHVybiBtVGV4dHVyZUlkOworICAgIH0KKworcHJvdGVjdGVkOgorICAgIGZyaWVuZCBjbGFzcyBGb250OworCisgICAgc3RydWN0IENhY2hlVGV4dHVyZUxpbmUgeworICAgICAgICB1aW50MTZfdCBtTWF4SGVpZ2h0OworICAgICAgICB1aW50MTZfdCBtTWF4V2lkdGg7CisgICAgICAgIHVpbnQzMl90IG1DdXJyZW50Um93OworICAgICAgICB1aW50MzJfdCBtQ3VycmVudENvbDsKKyAgICAgICAgYm9vbCBtRGlydHk7CisKKyAgICAgICAgQ2FjaGVUZXh0dXJlTGluZSh1aW50MTZfdCBtYXhXaWR0aCwgdWludDE2X3QgbWF4SGVpZ2h0LCB1aW50MzJfdCBjdXJyZW50Um93LAorICAgICAgICAgICAgICAgIHVpbnQzMl90IGN1cnJlbnRDb2wpOgorICAgICAgICAgICAgICAgICAgICBtTWF4SGVpZ2h0KG1heEhlaWdodCksCisgICAgICAgICAgICAgICAgICAgIG1NYXhXaWR0aChtYXhXaWR0aCksCisgICAgICAgICAgICAgICAgICAgIG1DdXJyZW50Um93KGN1cnJlbnRSb3cpLAorICAgICAgICAgICAgICAgICAgICBtQ3VycmVudENvbChjdXJyZW50Q29sKSwKKyAgICAgICAgICAgICAgICAgICAgbURpcnR5KGZhbHNlKSB7CisgICAgICAgIH0KKworICAgICAgICBib29sIGZpdEJpdG1hcChjb25zdCBTa0dseXBoJiBnbHlwaCwgdWludDMyX3QgKnJldE9yaWdpblgsIHVpbnQzMl90ICpyZXRPcmlnaW5ZKSB7CisgICAgICAgICAgICBpZiAoZ2x5cGguZkhlaWdodCA+IG1NYXhIZWlnaHQpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmIChtQ3VycmVudENvbCArIGdseXBoLmZXaWR0aCA8IG1NYXhXaWR0aCkgeworICAgICAgICAgICAgICAgICpyZXRPcmlnaW5YID0gbUN1cnJlbnRDb2w7CisgICAgICAgICAgICAgICAgKnJldE9yaWdpblkgPSBtQ3VycmVudFJvdzsKKyAgICAgICAgICAgICAgICBtQ3VycmVudENvbCArPSBnbHlwaC5mV2lkdGg7CisgICAgICAgICAgICAgICAgbURpcnR5ID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisgICAgfTsKKworICAgIHVpbnQzMl90IGdldENhY2hlV2lkdGgoKSBjb25zdCB7CisgICAgICAgIHJldHVybiBtQ2FjaGVXaWR0aDsKKyAgICB9CisKKyAgICB1aW50MzJfdCBnZXRDYWNoZUhlaWdodCgpIGNvbnN0IHsKKyAgICAgICAgcmV0dXJuIG1DYWNoZUhlaWdodDsKKyAgICB9CisKKyAgICB2b2lkIGluaXRUZXh0VGV4dHVyZSgpOworICAgIGJvb2wgY2FjaGVCaXRtYXAoY29uc3QgU2tHbHlwaCYgZ2x5cGgsIHVpbnQzMl90ICpyZXRPcmlnaW5YLCB1aW50MzJfdCAqcmV0T3JpZ2luWSk7CisKKyAgICB2b2lkIGZsdXNoQWxsQW5kSW52YWxpZGF0ZSgpOworICAgIHZvaWQgaW5pdFZlcnRleEFycmF5QnVmZmVycygpOworCisgICAgdm9pZCBjaGVja0luaXQoKTsKKworICAgIFN0cmluZzE2IG1MYXRpblByZWNhY2hlOworICAgIHZvaWQgcHJlY2FjaGVMYXRpbihTa1BhaW50KiBwYWludCk7CisKKyAgICB2b2lkIGlzc3VlRHJhd0NvbW1hbmQoKTsKKyAgICB2b2lkIGFwcGVuZE1lc2hRdWFkKGZsb2F0IHgxLCBmbG9hdCB5MSwgZmxvYXQgejEsIGZsb2F0IHUxLCBmbG9hdCB2MSwgZmxvYXQgeDIsIGZsb2F0IHkyLAorICAgICAgICAgICAgZmxvYXQgejI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5oZWlnaHQ7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIHdpZHRoIDwgcmhzLndpZHRoOworICAgIH0KKworICAgIGJvb2wgb3BlcmF0b3I9PShjb25zdCBMYXllclNpemUmIHJocykgY29uc3QgeworICAgICAgICByZXR1cm4gd2lkdGggPT0gcmhzLndpZHRoICYmIGhlaWdodCA9PSByaHMuaGVpZ2h0OworICAgIH0KK307IC8vIHN0cnVjdCBMYXllclNpemUKKworLyoqCisgKiBBIGxheWVyIGhhcyBkaW1lbnNpb25zIGFuZCBpcyBiYWNrZWQgYnkgYW4gT3BlbkdMIHRleHR1cmUuCisgKi8KK3N0cnVjdCBMYXllciB7CisgICAgLyoqCisgICAgICogQ29vcmRpbmF0ZXMgb2YgdGhlIGxheWVyIGNvcnJlc3BvbmRpbmcgdG8gdGhpcyBzbmFwc2hvdC4KKyAgICAgKiBPbmx5IHNldCB3aGVuIHRoZSBmbGFnIGtGbGFnSXNMYXllciBpcyBzZXQuCisgICAgICovCisgICAgUmVjdCBsYXllcjsKKyAgICAvKioKKyAgICAgKiBOYW1lIG9mIHRoZSB0ZXh0dXJlIHVzZWQgdG8gcmVuZGVyIHRoZSBsYXllci4KKyAgICAgKiBPbmx5IHNldCB3aGVuIHRoZSBmbGFnIGtGbGFnSXNMYXllciBpcyBzZXQuCisgICAgICovCisgICAgR0x1aW50IHRleHR1cmU7CisgICAgLyoqCisgICAgICogTmFtZSBvZiB0aGUgRkJPIHVzZWQgdG8gcmVuZGVyIHRoZSBsYXllci4KKyAgICAgKiBPbmx5IHNldCB3aGVuIHRoZSBmbGFnIGtGbGFnSXNMYXllciBpcyBzZXQuCisgICAgICovCisgICAgR0x1aW50IGZibzsKKyAgICAvKioKKyAgICAgKiBPcGFjaXR5IG9mIHRoZSBsYXllci4KKyAgICAgKiBPbmx5IHNldCB3aGVuIHRoZSBmbGFnIGtGbGFnSXNMYXllciBpcyBzZXQuCisgICAgICovCisgICAgZmxvYXQgYWxwaGE7CisgICAgLy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X1RFWFRVUkVfMkQsIEdMX1RFWFRVUkVfV1JBUF9ULCBHTF9DTEFNUF9UT19FREdFKTsKKworICAgICAgICBnbFRleEltYWdlMkQoR0xfVEVYVFVSRV8yRCwgMCwgR0xfUkdCQSwgc2l6ZS53aWR0aCwgc2l6ZS5oZWlnaHQsIDAsCisgICAgICAgICAgICAgICAgR0xfUkdCQSwgR0xfVU5TSUdORURfQllURSwgTlVMTCk7CisKKyAgICAgICAgLy8gQmluZCB0ZXh0dXJlIHRvIEZCTworICAgICAgICBnbEZyYW1lYnVmZmVyVGV4dHVyZTJEKEdMX0ZSQU1FQlVGRkVSLCBHTF9DT0xPUl9BVFRBQ0hNRU5UMCwgR0xfVEVYVFVSRV8yRCwKKyAgICAgICAgICAgICAgICBsYXllci0+dGV4dHVyZSwgMCk7CisKKyAgICAgICAgR0xlbnVtIHN0YXR1cyA9IGdsQ2hlY2tGcmFtZWJ1ZmZlclN0YXR1cyhHTF9GUkFNRUJVRkZFUik7CisgICAgICAgIGlmIChzdGF0dXMgIT0gR0xfRlJBTUVCVUZGRVJfQ09NUExFVEUpIHsKKyAgICAgICAgICAgIExPR0UoIkZyYW1lYnVmZmVyIGluY29tcGxldGUgKEdMIGVycm9yIGNvZGUgMHgleCkiLCBzdGF0dXMpOworCisgICAgICAgICAgICBnbEJpbmRGcmFtZWJ1ZmZlcihHTF9GUkFNRUJVRkZFUiwgcHJldmlvdXNGYm8pOworCisgICAgICAgICAgICBnbERlbGV0ZUZyYW1lYnVmZmVycygxLCAmbGF5ZXItPmZibyk7CisgICAgICAgICAgICBnbERlbGV0ZVRleHR1cmVzKDEsICZsYXllci0+dGV4dHVyZSk7CisgICAgICAgICAgICBkZWxldGUgbGF5ZXI7CisKKyAgICAgICAgICAgIHJldHVybiBOVUxMOworICAgICAgICB9CisgICAgfQorCisgICAgcmV0dXJuIGxheWVyOworfQorCitib29sIExheWVyQ2FjaGU6OnB1dChMYXllclNpemUmIGxheWVyU2l6ZSwgTGF5ZXIqI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ZXcKKyAgICAgKiBsYXllciBmYWlscywgTlVMTCBpcyByZXR1cm5lZC4KKyAgICAgKgorICAgICAqIFdoZW4gYSBsYXllciBpcyBvYnRhaW5lZCBmcm9tIHRoZSBjYWNoZSwgaXQgaXMgcmVtb3ZlZCBhbmQgdGhlIHRvdGFsCisgICAgICogc2l6ZSBvZiB0aGUgY2FjaGUgZ29lcyBkb3duLgorICAgICAqCisgICAgICogQHBhcmFtIHNpemUgVGhlIGRpbWVuc2lvbnMgb2YgdGhlIGRlc2lyZWQgbGF5ZXIKKyAgICAgKiBAcGFyYW0gcHJldmlvdXNGYm8gVGhlIG5hbWUgb2YgdGhlIEZCTyB0byBiaW5kIHRvIGlmIGNyZWF0aW5nIGEgbmV3CisgICAgICogICAgICAgIGxheWVyIGZhaWxzCisgICAgICovCisgICAgTGF5ZXIqIGdldChMYXllclNpemUmIHNpemUsIEdMdWludCBwcmV2aW91c0Zibyk7CisgICAgLyoqCisgICAgICogQWRkcyB0aGUgbGF5ZXIgdG8gdGhlIGNhY2hlLiBUaGUgbGF5ZXIgd2lsbCBub3QgYmUgYWRkZWQgaWYgdGhlcmUgaXMKKyAgICAgKiBub3QgZW5vdWdoIHNwYWNlIGF2YWlsYWJsZS4KKyAgICAgKgorICAgICAqIEBwYXJhbSBzaXplIFRoZSBkaW1lbnNpb25zIG9mIHRoZSBsYXllcgorICAgICAqIEBwYXJhbSBsYXllciBUaGUgbGF5ZXIgdG8gYWRkIHRvIHRoZSBjYWNoZQorICAgICAqCisgICAgICogQHJldHVybiBUcnVlIGlmIHRoZSBsYXllciB3YXMgYWRkZWQsIGZhbHNlIG90aGVyd2lzZS4KKyAgICAgKi8KKyAgICBib29sIHB1dChMYXllclNpemUmIHNpemUsIExheWVyKiBsYXllcik7CisgICAgLyoqCisgICAgICogQ2xlYXJzIHRoZSBjYWNoZS4gVGhpcyBjYXVzZXMgYWxsIGxheWVycyB0byBiZSBkZWxldGVkLgorICAgICAqLworICAgIHZvaWQgY2xlYXIo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DxzdGRsaWIuaD4KKyNpbmNsdWRlIDxzdHJpbmcuaD4KKworI2luY2x1ZGUgPHV0aWxzL0xvZy5oPgorCisjaW5jbHVkZSA8U2tNYXRyaXguaD4KKworI2luY2x1ZGUgIk1hdHJpeC5oIgorCituYW1lc3BhY2UgYW5kcm9pZCB7CituYW1lc3BhY2UgdWlyZW5kZXJlciB7CisKK3ZvaWQgTWF0cml4NDo6bG9hZElkZW50aXR5KCkgeworICAgIGRhdGFba1NjYWxlWF0gICAgICAgPSAxLjBmOworICAgIGRhdGFba1NrZXdZXSAgICAgICAgPSAwLjBmOworICAgIGRhdGFbMl0gICAgICAgICAgICAgPSAwLjBmOworICAgIGRhdGFba1BlcnNwZWN0aXZlMF0gPSAwLjBmOworCisgICAgZGF0YVtrU2tld1hdICAgICAgICA9IDAuMGY7CisgICAgZGF0YVtrU2NhbGVZXSAgICAgICA9IDEuMGY7CisgICAgZGF0YVs2XSAgICAgICAgICAgICA9IDAuMGY7CisgICAgZGF0YVtrUGVyc3BlY3RpdmUxXSA9IDAuMGY7CisKKyAgICBkYXRhWzhdICAgICAgICAgICAgID0gMC4wZjsKKyAgICBkYXRhWzldICAgICAgICAgICAgID0gMC4wZjsKKyAgICBkYXRhW2tTY2FsZVpdICAgICAgID0gMS4wZjsKKyAgICBkYXRhWzExXSAgICAgICAgICAgID0gMC4wZjsKKworICAgIGRhdGFba1RyYW5zbGF0ZVhdICAgPSAwLjBmOworICAgIGRhdGFba1RyYW5zbGF0ZVldICAgPSAwLjBmOworICAgIGRhdGFba1RyYW5zbGF0ZVpdICAgPSAwLjBmOworICAgIGRhdGFba1BlcnNwZWN0aXZlMl0gPSAxLjBmOworCisgICAgbVNpbXBsZU1hdHJpeCA9IHRydWU7Cit9CisKK3ZvaWQgTWF0cml4NDo6bG9hZChjb25zdCBmbG9hdCogdikgeworICAgIG1lbWNweShkYXRhLCB2LCBzaXplb2YoZGF0YSkpOworICAgIG1TaW1wbGVNYXRyaXggPSBmYWxzZTsKK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CisKKyAgICBjb25zdCBmbG9hdCBuYyA9IDEuMGYgLSBjOworICAgIGNvbnN0IGZsb2F0IHh5ID0geCAqIHk7CisgICAgY29uc3QgZmxvYXQgeXogPSB5ICogejsKKyAgICBjb25zdCBmbG9hdCB6eCA9IHogKiB4OworICAgIGNvbnN0IGZsb2F0IHhzID0geCAqIHM7CisgICAgY29uc3QgZmxvYXQgeXMgPSB5ICogczsKKyAgICBjb25zdCBmbG9hdCB6cyA9IHogKiBzOworCisgICAgZGF0YVtrU2NhbGVYXSA9IHggKiB4ICogbmMgKyAgYzsKKyAgICBkYXRhW2tTa2V3WF0gID0gICAgeHkgKiBuYyAtIHpzOworICAgIGRhdGFbOF0gICAgICAgPSAgICB6eCAqIG5jICsgeXM7CisgICAgZGF0YVtrU2tld1ldICA9ICAgIHh5ICogbmMgKyB6czsKKyAgICBkYXRhW2tTY2FsZVldID0geSAqIHkgKiBuYyArICBjOworICAgIGRhdGFbOV0gICAgICAgPSAgICB5eiAqIG5jIC0geHM7CisgICAgZGF0YVsyXSAgICAgICA9ICAgIHp4ICogbmMgLSB5czsKKyAgICBkYXRhWzZdICAgICAgID0gICAgeXogKiBuYyArIHhzOworICAgIGRhdGFba1NjYWxlWl0gPSB6ICogeiAqIG5jICsgIGM7CisKKyAgICBtU2ltcGxlTWF0cml4ID0gZmFsc2U7Cit9CisKK3ZvaWQgTWF0cml4NDo6bG9hZE11bHRpcGx5KGNvbnN0IE1hdHJpeDQmIHUsIGNvbnN0IE1hdHJpeDQmIHYpIHsKKyAgICBmb3IgKGludCBpID0gMCA7IGkgPCA0IDsgaSsrKSB7CisgICAgICAgIGZsb2F0IHggPSAwOworICAgICAgICBmbG9hdCB5ID0gMDsKKyAgICAgICAgZmxvYXQgeiA9IDA7CisgICAgICAgIGZsb2F0IHcgPSAwOworCisgICAgICAgIGZvciAoaW50IGogPSAwIDsgaiA8IDQgOyBqKyspIHsKKyAgICAgICAgICAgIGNvbnN0IGZsb2F0IGUgPSB2LmdldChp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WV0pOworICAgICAgICByZXR1cm47CisgICAgfQorCisgICAgZmxvYXQgdmVydGljZXNbXSA9IHsKKyAgICAgICAgci5sZWZ0LCByLnRvcCwKKyAgICAgICAgci5yaWdodCwgci50b3AsCisgICAgICAgIHIucmlnaHQsIHIuYm90dG9tLAorICAgICAgICByLmxlZnQsIHIuYm90dG9tCisgICAgfTsKKworICAgIGZsb2F0IHgsIHksIHo7CisKKyAgICBmb3IgKGludCBpID0gMDsgaSA8IDg7IGkrPSAyKSB7CisgICAgICAgIGZsb2F0IHB4ID0gdmVydGljZXNbaV07CisgICAgICAgIGZsb2F0IHB5ID0gdmVydGljZXNbaSArIDFdOworCisgICAgICAgIHggPSBweCAqIGRhdGFba1NjYWxlWF0gKyBweSAqIGRhdGFba1NrZXdYXSArIGRhdGFba1RyYW5zbGF0ZVhdOworICAgICAgICB5ID0gcHggKiBkYXRhW2tTa2V3WV0gKyBweSAqIGRhdGFba1NjYWxlWV0gKyBkYXRhW2tUcmFuc2xhdGVZXTsKKyAgICAgICAgeiA9IHB4ICogZGF0YVtrUGVyc3BlY3RpdmUwXSArIHB5ICogZGF0YVtrUGVyc3BlY3RpdmUxXSArIGRhdGFba1BlcnNwZWN0aXZlMl07CisgICAgICAgIGlmICh6KSB6ID0gMS4wZiAvIHo7CisKKyAgICAgICAgdmVydGljZXNbaV0gPSB4ICogejsKKyAgICAgICAgdmVydGljZXNbaSArIDFdID0geSAqIHo7CisgICAgfQorCisgICAgci5sZWZ0ID0gci5yaWdodCA9IHZlcnRpY2VzWzBdOworICAgIHIudG9wID0gci5ib3R0b20gPSB2ZXJ0aWNlc1sxXTsKKworICAgIGZvciAoaW50IGkgPSAyOyBpIDwgODsgaSArPSAyKSB7CisgICAgICAgIHggPSB2ZXJ0aWNlc1tpXTsKKyAgICAgICAgeSA9IHZlcnRpY2VzW2kgKyAxXTsKKworICAgICAgICBpZiAoeCA8IHIubGVmdCkgci5sZWZ0ID0geDsKKyAgICAgICAgZWxzZSBpZiAoeC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y8vLy8vLy8vLy8vLy8vLworLy8gQ2xhc3NlcworLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLworCitjbGFzcyBNYXRyaXg0IHsKK3B1YmxpYzoKKyAgICBmbG9hdCBkYXRhWzE2XTsKKworICAgIGVudW0gRW50cnkgeworICAgICAgICBrU2NhbGVYID0gMCwKKyAgICAgICAga1NrZXdZID0gMSwKKyAgICAgICAga1BlcnNwZWN0aXZlMCA9IDMsCisgICAgICAgIGtTa2V3WCA9IDQsCisgICAgICAgIGtTY2FsZVkgPSA1LAorICAgICAgICBrUGVyc3BlY3RpdmUxID0gNywKKyAgICAgICAga1NjYWxlWiA9IDEwLAorICAgICAgICBrVHJhbnNsYXRlWCA9IDEyLAorICAgICAgICBrVHJhbnNsYXRlWSA9IDEzLAorICAgICAgICBrVHJhbnNsYXRlWiA9IDE0LAorICAgICAgICBrUGVyc3BlY3RpdmUyID0gMTUKKyAgICB9OworCisgICAgTWF0cml4NCgpIHsKKyAgICAgICAgbG9hZElkZW50aXR5KCk7CisgICAgfQorCisgICAgTWF0cml4NChjb25zdCBmbG9hdCogdikgeworICAgICAgICBsb2FkKHYpOworICAgIH0KKworICAgIE1hdHJpeDQoY29uc3QgTWF0cml4NCYgdikgeworICAgICAgICBsb2FkKHYpOworICAgIH0KKworICAgIE1hdHJpeDQoY29uc3QgU2tNYXRyaXgmIHYpIHsKKyAgICAgICAgbG9hZCh2KTsKKyAgICB9CisKKyAgICB2b2lkIGxvYWRJZGVudGl0eSgpOworCisgICAgdm9pZCBsb2FkKGNvbnN0IGZsb2F0KiB2KTsKKyAgICB2b2lkIGxvYWQoY29uc3QgTWF0cml4NCYgdik7CisgICAgdm9pZCBsb2FkKGNvbnN0IFNrTWF0cml4JiB2KTsKKworICAgIHZvaWQgbG9hZEludmVyc2UoY29uc3QgTWF0cml4NCYgdik7C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SA9IHAtPmdldEFscGhhKCk7CisgICAgICAgIGNvbnN0IGJvb2wgaXNNb2RlID0gU2tYZmVybW9kZTo6SXNNb2RlKHAtPmdldFhmZXJtb2RlKCksICZtb2RlKTsKKyAgICAgICAgaWYgKCFpc01vZGUpIHsKKyAgICAgICAgICAgIC8vIEFzc3VtZSBTUkNfT1ZFUgorICAgICAgICAgICAgbW9kZSA9IFNrWGZlcm1vZGU6OmtTcmNPdmVyX01vZGU7CisgICAgICAgIH0KKyAgICB9IGVsc2UgeworICAgICAgICBtb2RlID0gU2tYZmVybW9kZTo6a1NyY092ZXJfTW9kZTsKKyAgICB9CisKKyAgICBpZiAoYWxwaGEgPiAwICYmICFtU25hcHNob3QtPmludmlzaWJsZSkgeworICAgICAgICBjcmVhdGVMYXllcihtU25hcHNob3QsIGxlZnQsIHRvcCwgcmlnaHQsIGJvdHRvbSwgYWxwaGEsIG1vZGUsIGZsYWdzKTsKKyAgICB9IGVsc2UgeworICAgICAgICBtU25hcHNob3QtPmludmlzaWJsZSA9IHRydWU7CisgICAgfQorCisgICAgcmV0dXJuIGNvdW50OworfQorCitpbnQgT3BlbkdMUmVuZGVyZXI6OnNhdmVMYXllckFscGhhKGZsb2F0IGxlZnQsIGZsb2F0IHRvcCwgZmxvYXQgcmlnaHQsIGZsb2F0IGJvdHRvbSwKKyAgICAgICAgaW50IGFscGhhLCBpbnQgZmxhZ3MpIHsKKyAgICBpbnQgY291bnQgPSBzYXZlU25hcHNob3QoKTsKKyAgICBpZiAoYWxwaGEgPiAwICYmICFtU25hcHNob3QtPmludmlzaWJsZSkgeworICAgICAgICBjcmVhdGVMYXllcihtU25hcHNob3QsIGxlZnQsIHRvcCwgcmlnaHQsIGJvdHRvbSwgYWxwaGEsIFNrWGZlcm1vZGU6OmtTcmNPdmVyX01vZGUsIGZsYWdzKTsKKyAgICB9IGVsc2UgeworICAgICAgICBtU25hcHNob3QtPmludmlzaWJsZSA9IHRydWU7CisgICAgfQorICAgIHJldHVybiBjb3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T0gMCB8fAorICAgICAgICAgICAgKHBhaW50LT5nZXRBbHBoYSgpID09IDAgJiYgcGFpbnQtPmdldFhmZXJtb2RlKCkgPT0gTlVMTCkpIHsKKyAgICAgICAgcmV0dXJuOworICAgIH0KKworICAgIGZsb2F0IHNjYWxlWCA9IHBhaW50LT5nZXRUZXh0U2NhbGVYKCk7CisgICAgYm9vbCBhcHBseVNjYWxlWCA9IHNjYWxlWCA8IDAuOTk5OWYgfHwgc2NhbGVYID4gMS4wMDAxZjsKKyAgICBpZiAoYXBwbHlTY2FsZVgpIHsKKyAgICAgICAgc2F2ZSgwKTsKKyAgICAgICAgdHJhbnNsYXRlKHggLSAoeCAqIHNjYWxlWCksIDAuMGYpOworICAgICAgICBzY2FsZShzY2FsZVgsIDEuMGYpOworICAgIH0KKworICAgIGZsb2F0IGxlbmd0aCA9IC0xLjBmOworICAgIHN3aXRjaCAocGFpbnQtPmdldFRleHRBbGlnbigpKSB7CisgICAgICAgIGNhc2UgU2tQYWludDo6a0NlbnRlcl9BbGlnbjoKKyAgICAgICAgICAgIGxlbmd0aCA9IHBhaW50LT5tZWFzdXJlVGV4dCh0ZXh0LCBieXRlc0NvdW50KTsKKyAgICAgICAgICAgIHggLT0gbGVuZ3RoIC8gMi4wZjsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIFNrUGFpbnQ6OmtSaWdodF9BbGlnbjoKKyAgICAgICAgICAgIGxlbmd0aCA9IHBhaW50LT5tZWFzdXJlVGV4dCh0ZXh0LCBieXRlc0NvdW50KTsKKyAgICAgICAgICAgIHggLT0gbGVuZ3RoOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICBicmVhazsKKyAgICB9CisKKyAgICBpbnQgYWxwaGE7CisgICAgU2tYZmVybW9kZTo6TW9kZSBtb2RlOworICAgIGdldEFscGhhQW5kTW9kZShwYWludCwgJmFscGhhLCAmbW9kZSk7CisKKyAgICB1aW50MzJfdCBjb2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bnQ6OmtVbmRlcmxpbmVUZXh0X0ZsYWcgfCBTa1BhaW50OjprU3RyaWtlVGhydVRleHRfRmxhZykpIHsKKyAgICAgICAgZmxvYXQgdW5kZXJsaW5lV2lkdGggPSBsZW5ndGg7CisgICAgICAgIC8vIElmIGxlbmd0aCBpcyA+IDAuMGYsIHdlIGFscmVhZHkgbWVhc3VyZWQgdGhlIHRleHQgZm9yIHRoZSB0ZXh0IGFsaWdubWVudAorICAgICAgICBpZiAobGVuZ3RoIDw9IDAuMGYpIHsKKyAgICAgICAgICAgIHVuZGVybGluZVdpZHRoID0gcGFpbnQtPm1lYXN1cmVUZXh0KHRleHQsIGJ5dGVzQ291bnQpOworICAgICAgICB9CisKKyAgICAgICAgZmxvYXQgb2Zmc2V0WCA9IDA7CisgICAgICAgIHN3aXRjaCAocGFpbnQtPmdldFRleHRBbGlnbigpKSB7CisgICAgICAgICAgICBjYXNlIFNrUGFpbnQ6OmtDZW50ZXJfQWxpZ246CisgICAgICAgICAgICAgICAgb2Zmc2V0WCA9IHVuZGVybGluZVdpZHRoICogMC41ZjsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgU2tQYWludDo6a1JpZ2h0X0FsaWduOgorICAgICAgICAgICAgICAgIG9mZnNldFggPSB1bmRlcmxpbmVXaWR0aDsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKworICAgICAgICBpZiAodW5kZXJsaW5lV2lkdGggPiAwLjBmKSB7CisgICAgICAgICAgICBmbG9hdCB0ZXh0U2l6ZSA9IHBhaW50LT5nZXRUZXh0U2l6ZSgpOworICAgICAgICAgICAgZmxvYXQgaGVpZ2h0ID0gdGV4dFNpemUgKiBrU3RkVW5kZXJsaW5lX1RoaWNrbmVzczsKKworICAgICAgICAgICAgZmxvYXQgbGVmdCA9IHggLSBvZmZzZXRYOworICAgICAgICAgICAgZmxvYXQgdG9wID0gMC4wZjsKKyAgICAgICAgICAgIGZsb2F0IHJpZ2h0ID0gbGVmdCArIHVuZGVybGluZVdpZHRoOworICAgICAgICAgICAgZmxvYXQgYm90dG9tID0gMC4wZjsKKworICAgICAgICAgICAgaWYgKGZsYWdzICYgU2tQYWludDo6a1VuZGVybGluZVRleHRfRmxhZykgeworICAgICAgICAgICAgICAgIHRvcCA9IHkgKyB0ZXh0U2l6ZSAqIGtTdGRVbmRlcmxpbmVfT2Zmc2V0OworICAgICAgICAgICAgICAgIGJvdHRvbSA9IHRvcCArIGhlaWdodDsKKyAgICAgICAgICAgICAgICBkcmF3UmVjdChsZWZ0LCB0b3AsIHJpZ2h0LCBib3R0b20sIHBhaW50KTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKGZsYWdzICYgU2tQYWludDo6a1N0cmlrZVRocnVUZXh0X0ZsYWcpIHsKKyAgICAgICAgICAgICAgICB0b3AgPSB5ICsgdGV4dFNpemUgKiBrU3RkU3RyaWtlVGhydV9PZmZzZXQ7CisgICAgICAgICAgICAgICAgYm90dG9tID0gdG9wICsgaGVpZ2h0OworICAgICAgICAgICAgICAgIGRyYXdSZWN0KGxlZnQsIHRvcCwgcmlnaHQsIGJvdHRvbSwgcGFpbnQpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorfQorCit2b2lkIE9wZW5HTFJlbmRlcmVyOjpkcmF3Q29sb3JSZWN0KGZsb2F0IGxlZnQsIGZsb2F0IHRvcCwgZmxvYXQgcmlnaHQsIGZsb2F0IGJvdHRvbSwKKyAgICAgICAgaW50IGNvbG9yLCBTa1hmZXJtb2RlOjpNb2RlIG1vZGUsIGJvb2wgaWdub3JlVHJhbnNmb3JtKSB7CisgICAgLy8gSWYgYSBzaGFkZXIgaXMgc2V0LCBwcmVzZXJ2ZSBvbmx5IHRoZSBhbHBoYQorICAgIGlmIChtU2hhZGVyKSB7CisgICAgICAgIGNvbG9yIHw9IDB4MDBmZmZmZ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Ly8vLy8vLy8vLy8vLy8vLy8vLy8vLy8KKy8vIENvbnN0cnVjdG9ycy9kZXN0cnVjdG9yCisvLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vCisKK1BhdGNoOjpQYXRjaChjb25zdCB1aW50MzJfdCB4Q291bnQsIGNvbnN0IHVpbnQzMl90IHlDb3VudCk6CisgICAgICAgIHhDb3VudCh4Q291bnQgKyAyKSwgeUNvdW50KHlDb3VudCArIDIpIHsKKyAgICB2ZXJ0aWNlc0NvdW50ID0gKHhDb3VudCArIDIpICogKHlDb3VudCArIDIpOworICAgIHZlcnRpY2VzID0gbmV3IFRleHR1cmVWZXJ0ZXhbdmVydGljZXNDb3VudF07CisKKyAgICAvLyAyIHRyaWFuZ2xlcyBwZXIgcGF0Y2gsIDMgdmVydGljZXMgcGVyIHRyaWFuZ2xlCisgICAgaW5kaWNlc0NvdW50ID0gKHhDb3VudCArIDEpICogKHlDb3VudCArIDEpICogMiAqIDM7CisgICAgaW5kaWNlcyA9IG5ldyB1aW50MTZfdFtpbmRpY2VzQ291bnRdOworCisgICAgY29uc3QgdWludDMyX3QgeE51bSA9IHhDb3VudCArIDE7CisgICAgY29uc3QgdWludDMyX3QgeU51bSA9IHlDb3VudCArIDE7CisKKyAgICB1aW50MTZfdCogc3RhcnRJbmRpY2VzID0gaW5kaWNlczsKKyAgICB1aW50MzJfdCBuID0gMDsKKyAgICBmb3IgKHVpbnQzMl90IHkgPSAwOyB5IDwgeU51bTsgeSsrKSB7CisgICAgICAgIGZvciAodWludDMyX3QgeCA9IDA7IHggPCB4TnVtOyB4KyspIHsKKyAgICAgICAgICAgICpzdGFydEluZGljZXMrKyA9IG47CisgICAgICAgICAgICAqc3RhcnRJbmRpY2VzKysgPSBuICsgMTsKKyAgICAgICAgICAgICpzdGFydEluZGljZXMrKyA9IG4gKyB4TnVtICsg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nN0IGZsb2F0IGZpeGVkID0gYml0bWFwSGVpZ2h0IC0gc3RyZXRjaFNpemU7CisgICAgICAgIHlTdHJldGNoID0gKGJvdHRvbSAtIHRvcCAtIGZpeGVkKSAvIHlTdHJldGNoQ291bnQ7CisgICAgfQorCisgICAgZmxvYXQgdnkgPSAwLjBmOworICAgIGZsb2F0IHR5ID0gMC4wZjsKKyAgICBUZXh0dXJlVmVydGV4KiB2ZXJ0ZXggPSB2ZXJ0aWNlczsKKworICAgIGdlbmVyYXRlVmVydGljZXModmVydGV4LCAwLjBmLCAwLjBmLCB4RGl2cywgd2lkdGgsIHhTdHJldGNoLCB4U3RyZXRjaFRleCwKKyAgICAgICAgICAgIG1lc2hXaWR0aCwgYml0bWFwV2lkdGgpOworICAgIHZlcnRleCArPSB3aWR0aCArIDI7CisKKyAgICBmb3IgKHVpbnQzMl90IHkgPSAwOyB5IDwgaGVpZ2h0OyB5KyspIHsKKyAgICAgICAgaWYgKHkgJiAxKSB7CisgICAgICAgICAgICB2eSArPSB5U3RyZXRjaDsKKyAgICAgICAgICAgIHR5ICs9IHlTdHJldGNoVGV4OworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgY29uc3QgZmxvYXQgc3RlcCA9IGZsb2F0KHlEaXZzW3ldKTsKKyAgICAgICAgICAgIHZ5ICs9IHN0ZXA7CisgICAgICAgICAgICB0eSArPSBzdGVwIC8gYml0bWFwSGVpZ2h0OworICAgICAgICB9CisgICAgICAgIGdlbmVyYXRlVmVydGljZXModmVydGV4LCB2eSwgdHksIHhEaXZzLCB3aWR0aCwgeFN0cmV0Y2gsIHhTdHJldGNoVGV4LAorICAgICAgICAgICAgICAgIG1lc2hXaWR0aCwgYml0bWFwV2lkdGgpOworICAgICAgICB2ZXJ0ZXggKz0gd2lkdGggKyAyOworICAgIH0KKworICAgIGdlbmVyYXRlVmVydGljZXModmVydGV4LCBib3R0b20gLSB0b3AsIDEuMGYsIHhEaXZzLCB3aWR0aCwgeFN0cmV0Y2gs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yBsYW5ndWFnZSBnb3Zlcm5pbmcgcGVybWlzc2lvbnMgYW5kCisgKiBsaW1pdGF0aW9ucyB1bmRlciB0aGUgTGljZW5zZS4KKyAqLworCisjaWZuZGVmIEFORFJPSURfVUlfUEFUQ0hfSAorI2RlZmluZSBBTkRST0lEX1VJX1BBVENIX0gKKworI2luY2x1ZGUgPHN5cy90eXBlcy5oPgorCisjaW5jbHVkZSA8U2tCaXRtYXAuaD4KKworI2luY2x1ZGUgIlZlcnRleC5oIgorCituYW1lc3BhY2UgYW5kcm9pZCB7CituYW1lc3BhY2UgdWlyZW5kZXJlciB7CisKKy8qKgorICogRGVzY3JpcHRpb24gb2YgYSBwYXRjaC4KKyAqLworc3RydWN0IFBhdGNoRGVzY3JpcHRpb24geworICAgIFBhdGNoRGVzY3JpcHRpb24oKTogeENvdW50KDApLCB5Q291bnQoMCkgeyB9CisgICAgUGF0Y2hEZXNjcmlwdGlvbihjb25zdCB1aW50MzJfdCB4Q291bnQsIGNvbnN0IHVpbnQzMl90IHlDb3VudCk6CisgICAgICAgICAgICB4Q291bnQoeENvdW50KSwgeUNvdW50KHlDb3VudCkgeyB9CisgICAgUGF0Y2hEZXNjcmlwdGlvbihjb25zdCBQYXRjaERlc2NyaXB0aW9uJiBkZXNjcmlwdGlvbik6CisgICAgICAgICAgICB4Q291bnQoZGVzY3JpcHRpb24ueENvdW50KSwgeUNvdW50KGRlc2NyaXB0aW9uLnlDb3VudCkgeyB9CisKKyAgICB1aW50MzJfdCB4Q291bnQ7CisgICAgdWludDMyX3QgeUNvdW50OworCisgICAgYm9vbCBvcGVyYXRvcjwoY29uc3QgUGF0Y2hEZXNjcmlwdGlvbiYgcmhzKSBjb25zdCB7CisgICAgICAgIGlmICh4Q291bnQgPT0gcmhzLnhDb3VudCkgeworICAgICAgICAgICAgcmV0dXJuIHlDb3VudCA8IHJocy55Q291bnQ7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIHhDb3VudCA8IHJocy54Q291bnQ7CisgICAgfQorCisgICAgYm9vbCBvcGVyYXRvcj09KGNvbnN0IFBhdGNoRGVzY3JpcHRpb24mIHJocykgY29uc3QgeworICAgICAgICByZXR1cm4geENvdW50ID09IHJocy54Q291bnQgJiYgeUNvdW50ID09IHJocy55Q291bnQ7CisgICAgfQorfTsgLy8gc3RydWN0IFBhdGNoRGVzY3JpcHRpb24KKworLyoqCisgKiBBbiBPcGVuR0wgcGF0Y2guIFRoaXMgY29udGFpbnMgYW4gYXJyYXkgb2YgdmVydGljZXMgYW5kIGFuIGFycmF5IG9mCisgKiBpbmRpY2VzIHRvIHJlbmRlciB0aGUgdmVydGljZXMuCisgKi8KK3N0cnVjdCBQYXRjaCB7CisgICAgUGF0Y2goY29uc3QgdWludDMyX3QgeENvdW50LCBjb25zdCB1aW50MzJfdCB5Q291bnQpOworICAgIH5QYXRjaCgpOworCisgICAgdm9pZCB1cGRhdGVWZXJ0aWNlcyhjb25zdCBTa0JpdG1hcCogYml0bWFwLCBmbG9hdCBsZWZ0LCBmbG9hdCB0b3AsIGZsb2F0IHJpZ2h0LCBmbG9hdCBib3R0b20sCisgICAgICAgICAgICBjb25zdCBpbnQzMl90KiB4RGl2cywgIGNvbnN0IGludDMyX3QqIHlEaXZzLAorICAgICAgICAgICAgY29uc3QgdWludDMyX3Qgd2lkdGgsIGNvbnN0IHVpbnQzMl90IGhlaWdodCk7CisgICAgdm9pZCBkdW1wKCk7CisKKyAgICB1aW50MzJfdCB4Q291bnQ7CisgICAgdWludDMyX3QgeUNvdW50OworCisgICAgdWludDE2X3QqIGluZGljZXM7CisgICAgdWludDMyX3QgaW5kaWNlc0NvdW50OworCisgICAgVGV4dHVyZVZlcnRleCogdmVydGljZXM7CisgICAgdWludDMyX3QgdmVydGljZXNDb3VudDsKKworcHJpdmF0ZToKKyAgICBzdGF0aWMgaW5saW5lIHZvaWQgZ2VuZXJhdGVWZXJ0aWNlcyhUZXh0dXJlVmVydGV4KiB2ZXJ0ZXgsIGZsb2F0IHksIGZs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TsKKyAgICBhdHRyaWJ1dGVzLmFkZChuYW1lLCBzbG90KTsKKyAgICByZXR1cm4gc2xvdDsKK30KKworaW50IFByb2dyYW06OmdldEF0dHJpYihjb25zdCBjaGFyKiBuYW1lKSB7CisgICAgc3NpemVfdCBpbmRleCA9IGF0dHJpYnV0ZXMuaW5kZXhPZktleShuYW1lKTsKKyAgICBpZiAoaW5kZXggPj0gMCkgeworICAgICAgICByZXR1cm4gYXR0cmlidXRlcy52YWx1ZUF0KGluZGV4KTsKKyAgICB9CisgICAgcmV0dXJuIGFkZEF0dHJpYihuYW1lKTsKK30KKworaW50IFByb2dyYW06OmFkZFVuaWZvcm0oY29uc3QgY2hhciogbmFtZSkgeworICAgIGludCBzbG90ID0gZ2xHZXRVbmlmb3JtTG9jYXRpb24oaWQsIG5hbWUpOworICAgIHVuaWZvcm1zLmFkZChuYW1lLCBzbG90KTsKKyAgICByZXR1cm4gc2xvdDsKK30KKworaW50IFByb2dyYW06OmdldFVuaWZvcm0oY29uc3QgY2hhciogbmFtZSkgeworICAgIHNzaXplX3QgaW5kZXggPSB1bmlmb3Jtcy5pbmRleE9mS2V5KG5hbWUpOworICAgIGlmIChpbmRleCA+PSAwKSB7CisgICAgICAgIHJldHVybiB1bmlmb3Jtcy52YWx1ZUF0KGluZGV4KTsKKyAgICB9CisgICAgcmV0dXJuIGFkZFVuaWZvcm0obmFtZSk7Cit9CisKK0dMdWludCBQcm9ncmFtOjpidWlsZFNoYWRlcihjb25zdCBjaGFyKiBzb3VyY2UsIEdMZW51bSB0eXBlKSB7CisgICAgR0x1aW50IHNoYWRlciA9IGdsQ3JlYXRlU2hhZGVyKHR5cGUpOworICAgIGdsU2hhZGVyU291cmNlKHNoYWRlciwgMSwgJnNvdXJjZSwgMCk7CisgICAgZ2xDb21waWxlU2hhZGVyKHNoYWRlcik7CisKKyAgICBHTGludCBzdGF0dXM7CisgICAgZ2xHZXRTaGFkZXJpdihzaGFkZXIsIEdMX0NPTVBJTEVfU1RBVFV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Y29udGV4dC4KKyAgICAgKi8KKyAgICB2aXJ0dWFsIHZvaWQgcmVtb3ZlKCk7CisKKyAgICAvKioKKyAgICAgKiBSZXR1cm5zIHRoZSBPcGVuR0wgbmFtZSBvZiB0aGUgc3BlY2lmaWVkIGF0dHJpYnV0ZS4KKyAgICAgKi8KKyAgICBpbnQgZ2V0QXR0cmliKGNvbnN0IGNoYXIqIG5hbWUpOworCisgICAgLyoqCisgICAgICogUmV0dXJucyB0aGUgT3BlbkdMIG5hbWUgb2YgdGhlIHNwZWNpZmllZCB1bmlmb3JtLgorICAgICAqLworICAgIGludCBnZXRVbmlmb3JtKGNvbnN0IGNoYXIqIG5hbWUpOworCisgICAgLyoqCisgICAgICogSW5kaWNhdGVzIHdoZXRoZXIgdGhpcyBwcm9ncmFtIGlzIGN1cnJlbnRseSBpbiB1c2Ugd2l0aAorICAgICAqIHRoZSBHTCBjb250ZXh0LgorICAgICAqLworICAgIGlubGluZSBib29sIGlzSW5Vc2UoKSBjb25zdCB7CisgICAgICAgIHJldHVybiBtVXNlOworICAgIH0KKworICAgIC8qKgorICAgICAqIEJpbmRzIHRoZSBwcm9ncmFtIHdpdGggdGhlIHNwZWNpZmllZCBwcm9qZWN0aW9uLCBtb2RlbFZpZXcgYW5kCisgICAgICogdHJhbnNmb3JtIG1hdHJpY2VzLgorICAgICAqLworICAgIHZvaWQgc2V0KGNvbnN0IG1hdDQmIHByb2plY3Rpb25NYXRyaXgsIGNvbnN0IG1hdDQmIG1vZGVsVmlld01hdHJpeCwKKyAgICAgICAgICAgICBjb25zdCBtYXQ0JiB0cmFuc2Zvcm1NYXRyaXgpOworCisgICAgLyoqCisgICAgICogTmFtZSBvZiB0aGUgcG9zaXRpb24gYXR0cmlidXRlLgorICAgICAqLworICAgIGludCBwb3NpdGlvbjsKKworICAgIC8qKgorICAgICAqIE5hbWUgb2YgdGhlIGNvbG9yIHVuaWZvcm0uCisgICAgICovCisgICAgaW50IGNvbG9yOworCisgICAgLyoqCisgICAgIC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xhdGUgPQorICAgICAgICAiICAgIGZyYWdDb2xvciA9IGJpdG1hcENvbG9yICogZnJhZ0NvbG9yLmE7XG4iOworY29uc3QgY2hhciogZ0ZTX01haW5fRnJhZ0NvbG9yID0KKyAgICAgICAgIiAgICBnbF9GcmFnQ29sb3IgPSBmcmFnQ29sb3I7XG4iOworY29uc3QgY2hhciogZ0ZTX01haW5fQXBwbHlDb2xvck9wWzRdID0geworICAgICAgICAvLyBOb25lCisgICAgICAgICIiLAorICAgICAgICAvLyBNYXRyaXgKKyAgICAgICAgLy8gVE9ETzogRml4IHByZW11bHRpcGxpZWQgYWxwaGEgY29tcHV0YXRpb25zIGZvciBjb2xvciBtYXRyaXgKKyAgICAgICAgIiAgICBmcmFnQ29sb3IgKj0gY29sb3JNYXRyaXg7XG4iCisgICAgICAgICIgICAgZnJhZ0NvbG9yICs9IGNvbG9yTWF0cml4VmVjdG9yO1xuIgorICAgICAgICAiICAgIGZyYWdDb2xvci5yZ2IgKj0gZnJhZ0NvbG9yLmE7XG4iLAorICAgICAgICAvLyBMaWdodGluZworICAgICAgICAiICAgIGZsb2F0IGxpZ2h0aW5nQWxwaGEgPSBmcmFnQ29sb3IuYTtcbiIKKyAgICAgICAgIiAgICBmcmFnQ29sb3IgPSBtaW4oZnJhZ0NvbG9yICogbGlnaHRpbmdNdWwgKyAobGlnaHRpbmdBZGQgKiBsaWdodGluZ0FscGhhKSwgbGlnaHRpbmdBbHBoYSk7XG4iCisgICAgICAgICIgICAgZnJhZ0NvbG9yLmEgPSBsaWdodGluZ0FscGhhO1xuIiwKKyAgICAgICAgLy8gUG9ydGVyRHVmZgorICAgICAgICAiICAgIGZyYWdDb2xvciA9IGJsZW5kQ29sb3JzKGNvbG9yQmxlbmQsIGZyYWdDb2xvcik7XG4iCit9OworY29uc3QgY2hhciogZ0ZTX0Zvb3RlciA9CisgICAgICAgICJ9XG5cbiI7CisKKy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vL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JjLmEgKyAoMS4wIC0gZHN0LmEpICogc3JjLnJnYiwgc3JjLmEpO1xuIiwKKyAgICAgICAgLy8gWG9yCisgICAgICAgICJyZXR1cm4gdmVjNChzcmMucmdiICogKDEuMCAtIGRzdC5hKSArICgxLjAgLSBzcmMuYSkgKiBkc3QucmdiLCAiCisgICAgICAgICAgICAgICAgInNyYy5hICsgZHN0LmEgLSAyLjAgKiBzcmMuYSAqIGRzdC5hKTtcbiIsCisgICAgICAgIC8vIEFkZAorICAgICAgICAicmV0dXJuIG1pbihzcmMgKyBkc3QsIDEuMCk7XG4iLAorICAgICAgICAvLyBNdWx0aXBseQorICAgICAgICAicmV0dXJuIHNyYyAqIGRzdDtcbiIsCisgICAgICAgIC8vIFNjcmVlbgorICAgICAgICAicmV0dXJuIHNyYyArIGRzdCAtIHNyYyAqIGRzdDtcbiIsCisgICAgICAgIC8vIE92ZXJsYXkKKyAgICAgICAgInJldHVybiBjbGFtcCh2ZWM0KG1peCgiCisgICAgICAgICAgICAgICAgIjIuMCAqIHNyYy5yZ2IgKiBkc3QucmdiICsgc3JjLnJnYiAqICgxLjAgLSBkc3QuYSkgKyBkc3QucmdiICogKDEuMCAtIHNyYy5hKSwgIgorICAgICAgICAgICAgICAgICJzcmMuYSAqIGRzdC5hIC0gMi4wICogKGRzdC5hIC0gZHN0LnJnYikgKiAoc3JjLmEgLSBzcmMucmdiKSArIHNyYy5yZ2IgKiAoMS4wIC0gZHN0LmEpICsgZHN0LnJnYiAqICgxLjAgLSBzcmMuYSksICIKKyAgICAgICAgICAgICAgICAic3RlcChkc3QuYSwgMi4wICogZHN0LnJnYikpLCAiCisgICAgICAgICAgICAgICAgInNyYy5hICsgZHN0LmEgLSBzcmMuYSAqIGRzdC5hKSwgMC4wLCAxLjApO1xuIiwKKyAgICAgICAgLy8gRGFya2VuCisgICAgICAgICJyZXR1cm4gdmVjNChzcmMucmdiICogKDEuMCAtIGRzdC5hKSArICgxLjAgLSBzcmMuYSkgKiBkc3Qucmdi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ICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIHNoYWRlci5hcHBlbmQoZ0ZTX01haW5fRmV0Y2hUZXh0dXJlKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIHNoYWRlci5hcHBlbmQoZ0ZTX01haW5fRmV0Y2hDb2xvcik7CisgICAgICAgIH0KKyAgICAgICAgaWYgKGRlc2NyaXB0aW9uLmhhc0dyYWRpZW50KSB7CisgICAgICAgICAgICBzaGFkZXIuYXBwZW5kKGdGU19NYWluX0ZldGNoR3JhZGllbnQpOworICAgICAgICB9CisgICAgICAgIGlmIChkZXNjcmlwdGlvbi5oYXNCaXRtYXApIHsKKyAgICAgICAgICAgIGlmICghZGVzY3JpcHRpb24uaXNCaXRtYXBOcG90KSB7CisgICAgICAgICAgICAgICAgc2hhZGVyLmFwcGVuZChnRlNfTWFpbl9GZXRjaEJpdG1hcCk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIHNoYWRlci5hcHBlbmQoZ0ZTX01haW5fRmV0Y2hCaXRtYXBOcG90KTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICAvLyBDYXNlIHdoZW4gd2UgaGF2ZSB0d28gc2hhZGVycyBzZXQKKyAgICAgICAgaWYgKGRlc2NyaXB0aW9uLmhhc0dyYWRpZW50ICYmIGRlc2NyaXB0aW9uLmhhc0JpdG1hcCkgeworICAgICAgICAgICAgaWYgKGRlc2NyaXB0aW9uLmlzQml0bWFwRmlyc3QpIHsKKyAgICAgICAgICAgICAgICBzaGFkZXIuYXBwZW5kKGdGU19NYWluX0JsZW5kU2hhZGVyc0JHKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgc2hhZGVyLmFwcGVuZChnRlNfTWFpbl9CbGVuZFNoYWRlcnNHQik7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBzaGFkZXIuYXBwZW5kKGdGU19NYWluX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ICAgICAgICBjYXNlIEdMX1JFUEVBVDoKKyAgICAgICAgICAgIHNoYWRlci5hcHBlbmQoIm1vZCh0ZXhDb29yZHMueCwgMS4wKSIpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgR0xfTUlSUk9SRURfUkVQRUFUOgorICAgICAgICAgICAgc2hhZGVyLmFwcGVuZCgieE1vZDIiKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgIH0KKyAgICBzaGFkZXIuYXBwZW5kKCIsICIpOworICAgIHN3aXRjaCAod3JhcFQpIHsKKyAgICAgICAgY2FzZSBHTF9DTEFNUF9UT19FREdFOgorICAgICAgICAgICAgc2hhZGVyLmFwcGVuZCgidGV4Q29vcmRzLnkiKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIEdMX1JFUEVBVDoKKyAgICAgICAgICAgIHNoYWRlci5hcHBlbmQoIm1vZCh0ZXhDb29yZHMueSwgMS4wKSIpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgR0xfTUlSUk9SRURfUkVQRUFUOgorICAgICAgICAgICAgc2hhZGVyLmFwcGVuZCgieU1vZDIiKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgIH0KKyAgICBzaGFkZXIuYXBwZW5kKCIpO1xuIik7CisgICAgc2hhZGVyLmFwcGVuZCgifVxuIik7Cit9CisKK3ZvaWQgUHJvZ3JhbUNhY2hlOjpwcmludExvbmdTdHJpbmcoY29uc3QgU3RyaW5nOCYgc2hhZGVyKSBjb25zdCB7CisgICAgc3NpemVfdCBpbmRleCA9IDA7CisgICAgc3NpemVfdCBsYXN0SW5kZXggPSAwOworICAgIGNvbnN0IGNoYXIqIHN0ciA9IHNoYWRlci5zdHJpbmcoKTsKKyAgICB3aGlsZSAoKGluZGV4ID0gc2hhZGVyLmZpbmQoIlxuIiwgaW5kZXgpKSA+IC0xKSB7CisgICAgICAgIFN0cmluZzggbGluZShzdHIsIGluZGV4IC0gbGFzdEluZGV4KT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c2UpLCBoYXNHcmFkaWVudChmYWxzZSksCisgICAgICAgIHNoYWRlcnNNb2RlKFNrWGZlcm1vZGU6OmtDbGVhcl9Nb2RlKSwgaXNCaXRtYXBGaXJzdChmYWxzZSksCisgICAgICAgIGJpdG1hcFdyYXBTKEdMX0NMQU1QX1RPX0VER0UpLCBiaXRtYXBXcmFwVChHTF9DTEFNUF9UT19FREdFKSwKKyAgICAgICAgY29sb3JPcChrQ29sb3JOb25lKSwgY29sb3JNb2RlKFNrWGZlcm1vZGU6OmtDbGVhcl9Nb2RlKSB7CisgICAgfQorCisgICAgLy8gVGV4dHVyaW5nCisgICAgYm9vbCBoYXNUZXh0dXJlOworICAgIGJvb2wgaGFzQWxwaGE4VGV4dHVyZTsKKworICAgIC8vIFNoYWRlcnMKKyAgICBib29sIGhhc0JpdG1hcDsKKyAgICBib29sIGlzQml0bWFwTnBvdDsKKyAgICBib29sIGhhc0dyYWRpZW50OworICAgIFNrWGZlcm1vZGU6Ok1vZGUgc2hhZGVyc01vZGU7CisgICAgYm9vbCBpc0JpdG1hcEZpcnN0OworICAgIEdMZW51bSBiaXRtYXBXcmFwUzsKKyAgICBHTGVudW0gYml0bWFwV3JhcFQ7CisKKyAgICAvLyBDb2xvciBvcGVyYXRpb25zCisgICAgaW50IGNvbG9yT3A7CisgICAgU2tYZmVybW9kZTo6TW9kZSBjb2xvck1vZGU7CisKKyAgICBpbmxpbmUgdWludDMyX3QgZ2V0RW51bUZvcldyYXAoR0xlbnVtIHdyYXApIGNvbnN0IHsKKyAgICAgICAgc3dpdGNoICh3cmFwKSB7CisgICAgICAgICAgICBjYXNlIEdMX0NMQU1QX1RPX0VER0U6CisgICAgICAgICAgICAgICAgcmV0dXJuIDA7CisgICAgICAgICAgICBjYXNlIEdMX1JFUEVBVDoKKyAgICAgICAgICAgICAgICByZXR1cm4gMTsKKyAgICAgICAgICAgIGNhc2UgR0xfTUlSUk9SRURfUkVQRUFUOgorICAgICAgICAgICAgICAgIHJldHVybiAyOworICAgICAgICB9CisgICAgICAgIHJldHVybiAwOworICAgIH0KKworICAgIHByb2dyYW1pZCBrZXkoKSBjb25zdCB7CisgICAgICAgIHByb2dyYW1pZCBrZXkgPSAwOworICAgICAgICBpZiAoaGFzVGV4dHVyZSkga2V5IHw9IFBST0dSQU1fS0VZX1RFWFRVUkU7CisgICAgICAgIGlmIChoYXNBbHBoYThUZXh0dXJlKSBrZXkgfD0gUFJPR1JBTV9LRVlfQThfVEVYVFVSRTsKKyAgICAgICAgaWYgKGhhc0JpdG1hcCkgeworICAgICAgICAgICAga2V5IHw9IFBST0dSQU1fS0VZX0JJVE1BUDsKKyAgICAgICAgICAgIGlmIChpc0JpdG1hcE5wb3QpIHsKKyAgICAgICAgICAgICAgICBrZXkgfD0gUFJPR1JBTV9LRVlfQklUTUFQX05QT1Q7CisgICAgICAgICAgICAgICAga2V5IHw9IGdldEVudW1Gb3JXcmFwKGJpdG1hcFdyYXBTKSA8PCBQUk9HUkFNX0JJVE1BUF9XUkFQU19TSElGVDsKKyAgICAgICAgICAgICAgICBrZXkgfD0gZ2V0RW51bUZvcldyYXAoYml0bWFwV3JhcFQpIDw8IFBST0dSQU1fQklUTUFQX1dSQVBUX1NISUZUOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIGlmIChoYXNHcmFkaWVudCkga2V5IHw9IFBST0dSQU1fS0VZX0dSQURJRU5UOworICAgICAgICBpZiAoaXNCaXRtYXBGaXJzdCkga2V5ICB8PSBQUk9HUkFNX0tFWV9CSVRNQVBfRklSU1Q7CisgICAgICAgIGlmIChoYXNCaXRtYXAgJiYgaGFzR3JhZGllbnQpIHsKKyAgICAgICAgICAgIGtleSB8PSAoc2hhZGVyc01vZGUgJiBQUk9HUkFNX01BWF9YRkVSTU9ERSkgPDwgUFJPR1JBTV9YRkVSTU9ERV9TSEFERVJfU0hJRlQ7CisgICAgICAgIH0KKyAgICAgICAgc3dpdGNoIChjb2xvck9wKSB7CisgICAgICAgICAgICBjYXNlIGtDb2xvck1hdHJpeDoKKyAgICAgICAgICAgICAgICBrZXkgfD0gUFJPR1JBTV9LRVlfQ09MT1JfTUFUUklYOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBrQ29sb3JMaWdodGluZzoKKyAgICAgICAgICAgICAgICBrZXkgfD0gUFJPR1JBTV9LRVlfQ09MT1JfTElHSFRJTkc7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIGtDb2xvckJsZW5kOgorICAgICAgICAgICAgICAgIGtleSB8PSBQUk9HUkFNX0tFWV9DT0xPUl9CTEVORDsKKyAgICAgICAgICAgICAgICBrZXkgfD0gKGNvbG9yTW9kZSAmIFBST0dSQU1fTUFYX1hGRVJNT0RFKSA8PCBQUk9HUkFNX1hGRVJNT0RFX0NPTE9SX09QX1NISUZUOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBrQ29sb3JOb25lOgorICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgICAgIHJldHVybiBrZXk7CisgICAgfQorfTsgLy8gc3RydWN0IFByb2dyYW1EZXNjcmlwdGlvbgorCisvKioKKyAqIEdlbmVyYXRlcyBhbmQgY2FjaGVzIHByb2dyYW0uIFByb2dyYW1zIGFyZSBnZW5lcmF0ZWQgYmFzZWQgb24KKyAqIFByb2dyYW1EZXNjcmlwdGlvbnMuCisgKi8KK2NsYXNzIFByb2dyYW1DYWNoZSB7CitwdWJsaWM6CisgICAgUHJvZ3JhbUNhY2hlKCk7CisgICAgflByb2dyYW1DYWNoZSgpOworCisgICAgUHJvZ3JhbSogZ2V0KGNvbnN0IFByb2dyYW1EZXNjcmlwdGlvbiYgZGVzY3JpcHRpb24pOworCisgICAgdm9pZCBjbGVhcigpOworCitwcml2YXRlOgorICAgIFByb2dyYW0qIGdlbmVyYXRlUHJvZ3JhbShjb25zdCBQcm9ncmFtRGVzY3JpcHRpb24mIGRlc2NyaXB0aW9uLCB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isgICAgZmxvYXQgdG9wOworICAgIGZsb2F0IHJpZ2h0OworICAgIGZsb2F0IGJvdHRvbTsKKworICAgIFJlY3QoKToKKyAgICAgICAgICAgIGxlZnQoMCksCisgICAgICAgICAgICB0b3AoMCksCisgICAgICAgICAgICByaWdodCgwKSwKKyAgICAgICAgICAgIGJvdHRvbSgwKSB7CisgICAgfQorCisgICAgUmVjdChmbG9hdCBsZWZ0LCBmbG9hdCB0b3AsIGZsb2F0IHJpZ2h0LCBmbG9hdCBib3R0b20pOgorICAgICAgICAgICAgbGVmdChsZWZ0KSwKKyAgICAgICAgICAgIHRvcCh0b3ApLAorICAgICAgICAgICAgcmlnaHQocmlnaHQpLAorICAgICAgICAgICAgYm90dG9tKGJvdHRvbSkgeworICAgIH0KKworICAgIFJlY3QoY29uc3QgUmVjdCYgcikgeworICAgICAgICBzZXQocik7CisgICAgfQorCisgICAgUmVjdChSZWN0JiByKSB7CisgICAgICAgIHNldChyKTsKKyAgICB9CisKKyAgICBSZWN0JiBvcGVyYXRvcj0oY29uc3QgUmVjdCYgcikgeworICAgICAgICBzZXQocik7CisgICAgICAgIHJldHVybiAqdGhpczsKKyAgICB9CisKKyAgICBSZWN0JiBvcGVyYXRvcj0oUmVjdCYgcikgeworICAgICAgICBzZXQocik7CisgICAgICAgIHJldHVybiAqdGhpczsKKyAgICB9CisKKyAgICBmcmllbmQgaW50IG9wZXJhdG9yPT0oY29uc3QgUmVjdCYgYSwgY29uc3QgUmVjdCYgYikgeworICAgICAgICByZXR1cm4gIW1lbWNtcCgmYSwgJmIsIHNpemVvZihhKSk7CisgICAgfQorCisgICAgZnJpZW5kIGludCBvcGVyYXRvciE9KGNvbnN0IFJlY3QmIGEsIGNvbnN0IFJlY3QmIGIpIHsKKyAgICAgICAgcmV0dXJuIG1lbWNtcCgmYSwgJmIsIHNpemVvZihhKSk7CisgICAgfQorCisgICAgYm9vbCBpc0VtcHR5KCkgY29uc3QgeworICAgICAgICByZXR1cm4gbGVmdCA+PSBya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tPmJvdHRvbTsKKyAgICB9CisKKyAgICBib29sIGludGVyc2VjdHMoY29uc3QgUmVjdCYgcikgY29uc3QgeworICAgICAgICByZXR1cm4gaW50ZXJzZWN0cyhyLmxlZnQsIHIudG9wLCByLnJpZ2h0LCByLmJvdHRvbSk7CisgICAgfQorCisgICAgYm9vbCBpbnRlcnNlY3QoZmxvYXQgbGVmdCwgZmxvYXQgdG9wLCBmbG9hdCByaWdodCwgZmxvYXQgYm90dG9tKSB7CisgICAgICAgIGlmIChsZWZ0IDwgcmlnaHQgJiYgdG9wIDwgYm90dG9tICYmICF0aGlzLT5pc0VtcHR5KCkgJiYKKyAgICAgICAgICAgICAgICB0aGlzLT5sZWZ0IDwgcmlnaHQgJiYgbGVmdCA8IHRoaXMtPnJpZ2h0ICYmCisgICAgICAgICAgICAgICAgdGhpcy0+dG9wIDwgYm90dG9tICYmIHRvcCA8IHRoaXMtPmJvdHRvbSkgeworCisgICAgICAgICAgICBpZiAodGhpcy0+bGVmdCA8IGxlZnQpIHRoaXMtPmxlZnQgPSBsZWZ0OworICAgICAgICAgICAgaWYgKHRoaXMtPnRvcCA8IHRvcCkgdGhpcy0+dG9wID0gdG9wOworICAgICAgICAgICAgaWYgKHRoaXMtPnJpZ2h0ID4gcmlnaHQpIHRoaXMtPnJpZ2h0ID0gcmlnaHQ7CisgICAgICAgICAgICBpZiAodGhpcy0+Ym90dG9tID4gYm90dG9tKSB0aGlzLT5ib3R0b20gPSBib3R0b207CisKKyAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICB9CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisKKyAgICBib29sIGludGVyc2VjdChjb25zdCBSZWN0JiByKSB7CisgICAgICAgIHJldHVybiBpbnRlcnNlY3Qoci5sZWZ0LCByLnRvcCwgci5yaWdodCwgci5ib3R0b20pOworICAgIH0KKworICAgIGJvb2wgdW5pb25XaXRoKGNvbnN0IFJlY3QmIHIpIHsKKyAgICAgICAgaWYgKHIubGVmdCA8IHIucmlnaHQgJiYgci50b3AgPCByLmJvdHRvbSkgeworICAgICAgICAgICAgaWYgKGxlZnQgPCByaWdodCAmJiB0b3AgPCBib3R0b20pIHsKKyAgICAgICAgICAgICAgICBpZiAobGVmdCA+IHIubGVmdCkgbGVmdCA9IHIubGVmdDsKKyAgICAgICAgICAgICAgICBpZiAodG9wID4gci50b3ApIHRvcCA9IHIudG9wOworICAgICAgICAgICAgICAgIGlmIChyaWdodCA8IHIucmlnaHQpIHJpZ2h0ID0gci5yaWdodDsKKyAgICAgICAgICAgICAgICBpZiAoYm90dG9tIDwgci5ib3R0b20pIGJvdHRvbSA9IHIuYm90dG9tOworICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBsZWZ0ID0gci5sZWZ0OworICAgICAgICAgICAgICAgIHRvcCA9IHIudG9wOworICAgICAgICAgICAgICAgIHJpZ2h0ID0gci5yaWdodDsKKyAgICAgICAgICAgICAgICBib3R0b20gPSByLmJvdHRvbTsKKyAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgdm9pZCBkdW1wKCkgY29uc3QgeworICAgICAgICBMT0dEKCJSZWN0W2w9JWYgdD0lZiByPSVmIGI9JWZdIiwgbGVmdCwgdG9wLCByaWdodCwgYm90dG9tKTsKKyAgICB9CisKK307IC8vIHN0cnVjdCBSZWN0CisKK307IC8vIG5hbWVzcGFjZSB1aXJlbmRlcmVyCit9OyAvLyBuYW1lc3BhY2UgYW5kcm9pZAorCisjZW5kaWYgLy8gQU5EUk9JRF9SRUNUX0gKZGlmZiAtLWdpdCBhL2xpYnMvaHd1aS9Ta2lhQ29sb3JGaWx0ZXIuY3BwIGIvbGlicy9od3VpL1NraWFDb2xvckZpbHRlci5jcHAKbmV3IGZpbGUgbW9kZSAxMDA2NDQKa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cGllcyB0aGUgc3BlY2lmaWVkIHNuYXBzaG90LiBPbmx5IHRoZSB0cmFuc2Zvcm0gYW5kIGNsaXAgcmVjdGFuZ2xlCisgICAgICogYXJlIGNvcGllZC4gVGhlIGxheWVyIGluZm9ybWF0aW9uIGlzIHNldCB0byAwIGFuZCB0aGUgdHJhbnNmb3JtIGlzCisgICAgICogYXNzdW1lZCB0byBiZSBkaXJ0eS4gVGhlIHNwZWNpZmllZCBzbmFwc2hvdCBpcyBzdG9yZWQgYXMgdGhlIHByZXZpb3VzCisgICAgICogc25hcHNob3QuCisgICAgICovCisgICAgU25hcHNob3QoY29uc3Qgc3A8U25hcHNob3Q+JiBzKToKKyAgICAgICAgICAgIGhlaWdodChzLT5oZWlnaHQpLAorICAgICAgICAgICAgdHJhbnNmb3JtKHMtPnRyYW5zZm9ybSksCisgICAgICAgICAgICBjbGlwUmVjdChzLT5jbGlwUmVjdCksCisgICAgICAgICAgICBpbnZpc2libGUocy0+aW52aXNpYmxlKSwKKyAgICAgICAgICAgIGZsYWdzKDApLAorICAgICAgICAgICAgcHJldmlvdXMocyksCisgICAgICAgICAgICBsYXllcihOVUxMKSwKKyAgICAgICAgICAgIGZibyhzLT5mYm8pLAorICAgICAgICAgICAgdmlld3BvcnQocy0+dmlld3BvcnQpIHsKKyAgICAgICAgaWYgKChzLT5mbGFncyAmIFNuYXBzaG90OjprRmxhZ0NsaXBTZXQpICYmCisgICAgICAgICAgICAgICAgIShzLT5mbGFncyAmIFNuYXBzaG90OjprRmxhZ0RpcnR5TG9jYWxDbGlwKSkgeworICAgICAgICAgICAgbG9jYWxDbGlwLnNldChzLT5sb2NhbENsaXApOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgZmxhZ3MgfD0gU25hcHNob3Q6OmtGbGFnRGlydHlMb2NhbENsaXA7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBWYXJpb3VzIGZsYWdzIHNldCBvbiAjZmxhZ3MuCisgICAgICovCisgICAgZW51bSBGbGFncyB7CisgICAgICAgIC8qKgorICAgICAgICAgKiBJbmRpY2F0ZXMgdGhhdCB0aGUgY2xpcCByZWdpb24gd2FzIG1vZGlmaWVkLiBXaGVuIHRoaXMKKyAgICAgICAgICogc25hcHNob3QgaXMgcmVzdG9yZWQgc28gbXVzdCB0aGUgY2xpcC4KKyAgICAgICAgICovCisgICAgICAgIGtGbGFnQ2xpcFNldCA9IDB4MSwKKyAgICAgICAgLyoqCisgICAgICAgICAqIEluZGljYXRlcyB0aGF0IHRoaXMgc25hcHNob3Qgd2FzIGNyZWF0ZWQgd2hlbiBzYXZpbmcKKyAgICAgICAgICogYSBuZXcgbGF5ZXIuCisgICAgICAgICAqLworICAgICAgICBrRmxhZ0lzTGF5ZXIgPSAweDIsCisgICAgICAgIC8qKgorICAgICAgICAgKiBJbmRpY2F0ZXMgdGhhdCB0aGlzIHNuYXBzaG90IGhhcyBjaGFuZ2VkIHRoZSBvcnRobyBtYXRyaXguCisgICAgICAgICAqLworICAgICAgICBrRmxhZ0RpcnR5T3J0aG8gPSAweDQsCisgICAgICAgIC8qKgorICAgICAgICAgKiBJbmRpY2F0ZXMgdGhhdCB0aGUgbG9jYWwgY2xpcCBzaG91bGQgYmUgcmVjb21wdXRlZC4KKyAgICAgICAgICovCisgICAgICAgIGtGbGFnRGlydHlMb2NhbENsaXAgPSAweDgsCisgICAgfTsKKworICAgIC8qKgorICAgICAqIEludGVyc2VjdHMgdGhlIGN1cnJlbnQgY2xpcCB3aXRoIHRoZSBuZXcgY2xpcCByZWN0YW5nbGUuCisgICAgICovCisgICAgYm9vbCBjbGlwKGZsb2F0IGxlZnQsIGZsb2F0IHRvcCwgZmxvYXQgcmlnaHQsIGZsb2F0IGJvdHRvbSwgU2tSZWdpb246Ok9wIG9wKSB7CisgICAgICAgIGJvb2wgY2xpcHBlZCA9IGZhbHNlOworCisgICAgICAgIFJlY3QgcihsZWZ0LCB0b3AsIHJpZ2h0LCBib3R0b20pOworICAgICAgICB0cmFuc2Zvcm0ubWFwUmVjdChyKTsKKworICAgICAgICBzd2l0Y2ggKG9wKSB7CisgICAgICAgICAgICBjYXNlIFNrUmVnaW9uOjprRGlmZmVyZW5jZV9PcDoKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgU2tSZWdpb246OmtJbnRlcnNlY3RfT3A6CisgICAgICAgICAgICAgICAgY2xpcHBlZCA9IGNsaXBSZWN0LmludGVyc2VjdChyKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgU2tSZWdpb246OmtVbmlvbl9PcDoKKyAgICAgICAgICAgICAgICBjbGlwcGVkID0gY2xpcFJlY3QudW5pb25XaXRoKHIpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBTa1JlZ2lvbjo6a1hPUl9PcDoKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgU2tSZWdpb246OmtSZXZlcnNlRGlmZmVyZW5jZV9PcDoKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgU2tSZWdpb246OmtSZXBsYWNlX09wOgorICAgICAgICAgICAgICAgIGNsaXBSZWN0LnNldChyKTsKKyAgICAgICAgICAgICAgICBjbGlwcGVkID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorCisgICAgICAgIGlmIChjbGlwcGVkKSB7CisgICAgICAgICAgICBmbGFncyB8PSBTbmFwc2hvdDo6a0ZsYWdDbGlwU2V0IHwgU25hcHNob3Q6OmtGbGFnRGlydHlMb2NhbENsaXA7CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gY2xpcHBlZDsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBTZXRzIHRoZSBjdXJyZW50IGNsaXAuCisgICAgICovCisgICAgdm9pZCBzZXRDbGlwKGZsb2F0IGxlZnQsIGZsb2F0IHRvcCwgZmxvYXQgcmlnaHQsIGZsb2F0IGJvdHRvbSkgeworICAgICAgICBjbGlwUmVjdC5zZXQobGVmdCwgdG9wLCByaWdodCwgYm90dG9tKTsKKyAgICAgICAgZmxhZ3MgfD0gU25hcHNob3Q6OmtGbGFnQ2xpcFNldCB8IFNuYXBzaG90OjprRmxhZ0RpcnR5TG9jYWxDbGlwOworICAgIH0KKworICAgIGNvbnN0IFJlY3QmIGdldExvY2FsQ2xpcCgpIHsKKyAgICAgICAgaWYgKGZsYWdzICYgU25hcHNob3Q6OmtGbGFnRGlydHlMb2NhbENsaXApIHsKKyAgICAgICAgICAgIG1hdDQgaW52ZXJzZTsKKyAgICAgICAgICAgIGludmVyc2UubG9hZEludmVyc2UodHJhbnNmb3JtKTsKKworICAgICAgICAgICAgbG9jYWxDbGlwLnNldChjbGlwUmVjdCk7CisgICAgICAgICAgICBpbnZlcnNlLm1hcFJlY3QobG9jYWxDbGlwKTsKKworICAgICAgICAgICAgZmxhZ3MgJj0gflNuYXBzaG90OjprRmxhZ0RpcnR5TG9jYWxDbGlwOworICAgICAgICB9CisgICAgICAgIHJldHVybiBsb2NhbENsaXA7CisgICAgfQorCisgICAgLyoqCisgICAgICogSGVpZ2h0IG9mIHRoZSBmcmFtZWJ1ZmZlciB0aGUgc25hcHNob3QgaXMgcmVuZGVyaW5nIGludG8uCisgICAgICovCisgICAgaW50IGhlaWdodDsKKworICAgIC8qKgorICAgICAqIExvY2FsIHRyYW5zZm9ybWF0aW9uLiBIb2xkcyB0aGUgY3VycmVudCB0cmFuc2xhdGlvbiwgc2NhbGUgYW5kCisgICAgICogcm90YXRpb24gdmFsdWVzLgorICAgICAqLworICAgIG1hdDQgdHJhbnNmb3JtOworCisgICAgLyoqCisgICAgICogQ3VycmVudCBjbGlwIHJlZ2lvbi4gVGhlIGNsaXAgaXMgc3RvcmVkIGluIGNhbnZhcy1zcGFjZSBjb29yZGluYXRlcywKKyAgICAgKiAoc2NyZWVuLXNwYWNlIGNvb3JkaW5hdGVzIGluIHRoZS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T5nZXRUZXh0U2l6ZSgpOworICAgICAgICB0eXBlZmFjZSA9IHBhaW50LT5nZXRUeXBlZmFjZSgpOworCisgICAgICAgIGhhc2ggPSAwOworICAgICAgICB1aW50MzJfdCBtdWx0aXBsaWVyID0gMTsKKyAgICAgICAgZm9yICh1aW50MzJfdCBpID0gMDsgaSA8IGxlbjsgaSsrKSB7CisgICAgICAgICAgICBoYXNoICs9IHRleHRbaV0gKiBtdWx0aXBsaWVyOworICAgICAgICAgICAgdWludDMyX3Qgc2hpZnRlZCA9IG11bHRpcGxpZXIgPDwgNTsKKyAgICAgICAgICAgIG11bHRpcGxpZXIgPSBzaGlmdGVkIC0gbXVsdGlwbGllcjsKKyAgICAgICAgfQorICAgIH0KKworICAgIFNoYWRvd1RleHQoY29uc3QgU2hhZG93VGV4dCYgc2hhZG93KToKKyAgICAgICAgICAgIHJhZGl1cyhzaGFkb3cucmFkaXVzKSwgbGVuKHNoYWRvdy5sZW4pLCBoYXNoKHNoYWRvdy5oYXNoKSwKKyAgICAgICAgICAgIHRleHRTaXplKHNoYWRvdy50ZXh0U2l6ZSksIHR5cGVmYWNlKHNoYWRvdy50eXBlZmFjZSkgeworICAgICAgICB0ZXh0ID0gbmV3IGNoYXJbc2hhZG93Lmxlbl07CisgICAgICAgIG1lbWNweSh0ZXh0LCBzaGFkb3cudGV4dCwgc2hhZG93Lmxlbik7CisgICAgfQorCisgICAgflNoYWRvd1RleHQoKSB7CisgICAgICAgIGRlbGV0ZVtdIHRleHQ7CisgICAgfQorCisgICAgdWludDMyX3QgcmFkaXVzOworICAgIHVpbnQzMl90IGxlbjsKKyAgICB1aW50MzJfdCBoYXNoOworICAgIGZsb2F0IHRleHRTaXplOworICAgIFNrVHlwZWZhY2UqIHR5cGVmYWNlOworICAgIGNoYXIgKnRleHQ7CisKKyAgICBib29sIG9wZXJhdG9yPChjb25zdCBTaGFkb3dUZXh0JiByaHMpIGNvbnN0IHsKKyAgICAgICAgaWYgKGxlbiA8IHJocy5sZW4pIHJldHVybiB0cnVlOworICAgICAgICBlbHNlIGlmIChsZW4gPT0gcmhzLmxlbikgeworICAgICAgICAgICAgaWYgKHJhZGl1cyA8IHJocy5yYWRpdXMpIHJldHVybiB0cnVlOworICAgICAgICAgICAgZWxzZSBpZiAocmFkaXVzID09IHJocy5yYWRpdXMpIHsKKyAgICAgICAgICAgICAgICBpZiAodGV4dFNpemUgPCByaHMudGV4dFNpemUpIHJldHVybiB0cnVlOworICAgICAgICAgICAgICAgIGVsc2UgaWYgKHRleHRTaXplID09IHJocy50ZXh0U2l6ZSkgeworICAgICAgICAgICAgICAgICAgICBpZiAodHlwZWZhY2UgPCByaHMudHlwZWZhY2UpIHJldHVybiB0cnVlOworICAgICAgICAgICAgICAgICAgICBlbHNlIGlmICh0eXBlZmFjZSA9PSByaHMudHlwZWZhY2UpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChoYXNoIDwgcmhzLmhhc2gpIHJldHVybiB0cnVlOworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGhhc2ggPT0gcmhzLmhhc2gpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gc3RybmNtcCh0ZXh0LCByaHMudGV4dCwgbGVuKSA8IDA7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KK307IC8vIHN0cnVjdCBTaGFkb3dUZXh0CisKKy8qKgorICogQWxwaGEgdGV4dHVyZSB1c2VkIHRvIHJlcHJlc2VudCBhIHNoYWRvdy4KKyAqLworc3RydWN0IFNoYWRvd1RleHR1cmU6IHB1YmxpYyBUZXh0dXJlIHsKKyAgICBTaGFkb3dUZXh0dXJlKCk6IFRleHR1cmUoKSB7CisgICAgfQorCisgICAgZmxvYXQgbGVmdDsKKyAgICBmbG9hdCB0b3A7Cit9OyAv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UxfTCwKKyAgICBSU19LSU5EX1BJWEVMX0wgPSA3LAogICAgIFJTX0tJTkRfUElYRUxfQSwKICAgICBSU19LSU5EX1BJWEVMX0xBLAogICAgIFJTX0tJTkRfUElYRUxfUkdCLAogICAgIFJTX0tJTkRfUElYRUxfUkdCQSwKLQogfTsKIAogZW51bSBSc1NhbXBsZXJQYXJhbSB7CkBAIC0yMDUsOSArMjAyLDcxIEBACiBlbnVtIFJzRXJyb3IgewogICAgIFJTX0VSUk9SX05PTkUsCiAgICAgUlNfRVJST1JfQkFEX1NIQURFUiwKLSAgICBSU19FUlJPUl9CQURfU0NSSVBUCisgICAgUlNfRVJST1JfQkFEX1NDUklQVCwKKyAgICBSU19FUlJPUl9CQURfVkFMVUUsCisgICAgUlNfRVJST1JfT1VUX09GX01FTU9SWQogfTsKIAorZW51bSBSc0FuaW1hdGlvbkludGVycG9sYXRpb24geworICAgIFJTX0FOSU1BVElPTl9JTlRFUlBPTEFUSU9OX1NURVAsCisgICAgUlNfQU5JTUFUSU9OX0lOVEVSUE9MQVRJT05fTElORUFSLAorICAgIFJTX0FOSU1BVElPTl9JTlRFUlBPTEFUSU9OX0JFWklFUiwKKyAgICBSU19BTklNQVRJT05fSU5URVJQT0xBVElPTl9DQVJESU5BTCwKKyAgICBSU19BTklNQVRJT05fSU5URVJQT0xBVElPTl9IRVJNSVRFLAorICAgIFJTX0FOSU1BVElPTl9JTlRFUlBPTEFUSU9OX0JTUExJTkUKK307CisKK2VudW0gUnNBbmltYXRpb25FZGdlIHsKKyAgICBSU19BTklNQVRJT05fRURHRV9VTkRFRklORUQsCisgICAgUlNfQU5JTUFUSU9OX0VER0VfQ09OU1RBTlQsCisgICAgUlNfQU5JTUFUSU9OX0VER0VfR1JBRElFTlQsCisgICAgUlNfQU5JTUFUSU9OX0VER0VfQ1lDTEUsCisgICAgUlNfQU5JTUFUSU9OX0VER0VfT1NDSUxMQVRFLAorICAgIFJTX0FOSU1BVElPTl9FREdFX0NZTEVfUkVMQV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ID0gMDsKLSAgICAgICAgfQotCi0gICAgICAgIHZvaWQgeHl6KGZsb2F0IF94LCBmbG9hdCBfeSwgZmxvYXQgX3opIHsKLSAgICAgICAgICAgIHggPSBfeDsKLSAgICAgICAgICAgIHkgPSBfeTsKLSAgICAgICAgICAgIHogPSBfejsKLSAgICAgICAgfQotCi0gICAgICAgIHZvaWQgbnh5eihmbG9hdCBfeCwgZmxvYXQgX3ksIGZsb2F0IF96KSB7Ci0gICAgICAgICAgICBueCA9IF94OwotICAgICAgICAgICAgbnkgPSBfeTsKLSAgICAgICAgICAgIG56ID0gX3o7Ci0gICAgICAgIH0KLQotICAgICAgICB2b2lkIHN0KGZsb2F0IF9zLCBmbG9hdCBfdCkgewotICAgICAgICAgICAgcyA9IF9zOwotICAgICAgICAgICAgdCA9IF90OwotICAgICAgICB9Ci0KLSAgICAgICAgdm9pZCBjb21wdXRlTm9ybShWZXJ0ZXggdjEsIFZlcnRleCB2MikgewotICAgICAgICAgICAgZmxvYXQgZHggPSB2MS54IC0gdjIueDsKLSAgICAgICAgICAgIGZsb2F0IGR5ID0gdjEueSAtIHYyLnk7Ci0gICAgICAgICAgICBmbG9hdCBkeiA9IHYxLnogLSB2Mi56OwotICAgICAgICAgICAgZmxvYXQgbGVuID0gKGZsb2F0KWphdmEubGFuZy5NYXRoLnNxcnQoZHgqZHggKyBkeSpkeSArIGR6KmR6KTsKLSAgICAgICAgICAgIGR4IC89IGxlbjsKLSAgICAgICAgICAgIGR5IC89IGxlbjsKLSAgICAgICAgICAgIGR6IC89IGxlbjsKLQotICAgICAgICAgICAgbnggPSBkeCAqIGR6OwotICAgICAgICAgICAgbnkgPSBkeSAqIGR6OwotICAgICAgICAgICAgbnogPSAoZmxvYXQpamF2YS5sYW5nLk1hdGguc3FydChkeCpkeCArIGR5KmR5KTsKLQotICAgICAgICAgICAgbGVuID0gKGZsb2F0KWphdmEubGFuZy5NYXRoLnNxcnQobngqbnggKyBueSpueSArIG56Km56KTsKLSAgICAgICAg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MjkyN2YsCi0gICAgICAgICAgICAgLTg3Ljk0NTI4M2YsIDE3Mi42MDQ3MzFmLAotICAgICAgICAgICAgIC05OC45NTg5OTRmLCAxNzIuNDQyMzY0ZiwKLSAgICAgICAgICAgICAtMTA5LjQ4OTUyM2YsIDE2OS4yMTE4NjZmLAotICAgICAgICAgICAgIC0xMTguNjk5NTgyZiwgMTYzLjE3MDA5NmYsCi0gICAgICAgICAgICAgLTEyNS44NTY4NzJmLCAxNTQuNzk3NDM5ZiwKLSAgICAgICAgICAgICAtMTMwLjM5MjMxMWYsIDE0NC43NTk2MTNmLAotICAgICAgICAgICAgIC0xMzEuOTQ1MjgzZiwgMTMzLjg1NDczMWYsCi0gICAgICAgICAgICAgLTEzMC4zOTIzMTFmLCAxMjIuOTQ5ODQ5ZiwKLSAgICAgICAgICAgICAtMTI1Ljg1Njg3MmYsIDExMi45MTIwMjJmLAotICAgICAgICAgICAgIC0xMTguNjk5NTgyZiwgMTA0LjUzOTM2NmYsCi0gICAgICAgICAgICAgLTEwOS40ODk1MjNmLCA5OC40OTc1OTZmLAotICAgICAgICAgICAgIC05OC45NTg5OTRmLCA5NS4yNjcwOThmLAotICAgICAgICAgICAgIC04Ny45NDUyODNmLCA5NS4xMDQ3MzFmLAotICAgICAgICAgICAgIC04NC4zNzE3NzNmLCA5NS43NzEwMjNmLAotICAgICAgICAgICAgIC04MC44OTg1NzRmLCA5Ni44NDM3ODFmLAotICAgICAgICAgICAgIC03Ny41NzE3NTdmLCA5OC4zMDg3NzdmLAotICAgICAgICAgICAgIC03NC40MzU0NTJmLCAxMDAuMTQ2NTc3ZiwKLSAgICAgICAgICAgICAtNzEuNTMxMjU5ZiwgMTAyLjMzMjgwM2YsCi0gICAgICAgICAgICAgLTY4Ljg5NzcwM2YsIDEwNC44Mzg0NTdmLAotICAgICAgICAgICAgIC02Ni41Njk3MTZmLCAxMDcuNjMwMzAyZiwKLSAgICAgICAgICAgICAtNjQuNTc4MTc3ZiwgMTEwLjY3MTM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gICh2dHhbY3QqMiszXSAtIHZ0eFtjdCoyICsxXSk7Ci0gICAgICAgICAgICB0Lm55ID0gICh2dHhbY3QqMisyXSAtIHZ0eFtjdCoyICAgXSk7Ci0gICAgICAgICAgICBmbG9hdCBsZW4gPSAoZmxvYXQpamF2YS5sYW5nLk1hdGguc3FydCh0Lm54ICogdC5ueCArIHQubnkgKiB0Lm55KTsKLSAgICAgICAgICAgIHJ1bm5pbmdTICs9IGxlbiAvIDEwMDsKLSAgICAgICAgICAgIHQubnggLz0gbGVuOwotICAgICAgICAgICAgdC5ueSAvPSBsZW47Ci0gICAgICAgICAgICB0LnkgPSAtMC41ZjsKLSAgICAgICAgICAgIHQudCA9IDA7Ci0gICAgICAgICAgICB0bS5zZXROb3JtYWwodC5ueCwgdC5ueSwgdC5ueik7Ci0gICAgICAgICAgICB0bS5zZXRUZXh0dXJlKHQucywgdC50KTsKLSAgICAgICAgICAgIHRtLmFkZFZlcnRleCh0LngsIHQueSwgdC56KTsKLSAgICAgICAgICAgIC8vYW5kcm9pZC51dGlsLkxvZy5lKCJycyIsICJ2dHggeD0iK3QueCsiIHk9Iit0LnkrIiB6PSIrdC56KyIgcz0iK3QucysiIHQ9Iit0LnQpOwotICAgICAgICAgICAgdC55ID0gLjVmOwotICAgICAgICAgICAgdC50ID0gMTsKLSAgICAgICAgICAgIHRtLnNldFRleHR1cmUodC5zLCB0LnQpOwotICAgICAgICAgICAgdG0uYWRkVmVydGV4KHQueCwgdC55LCB0LnopOwotICAgICAgICAgICAgLy9hbmRyb2lkLnV0aWwuTG9nLmUoInJzIiwgInZ0eCB4PSIrdC54KyIgeT0iK3QueSsiIHo9Iit0LnorIiBzPSIrdC5zKyIgdD0iK3QudCk7Ci0KLSAgICAgICAgICAgIGlmKChydW5uaW5nUyoyKSA+IG1UcmlhbmdsZU9mZnNldHNDb3VudCkgewotICAgICAgICAgICAgICAgIG1UcmlhbmdsZU9mZnNldHNbbVRyaWFuZ2xlT2Zmc2V0c0NvdW50XS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Y3JpcHQodHJ1ZSk7Ci0gICAgICAgICAgICBtUlMuY29udGV4dFNldFN1cmZhY2UodywgaCwgaG9sZGVyLmdldFN1cmZhY2UoKSk7Ci0gICAgICAgICAgICBtUmVuZGVyID0gbmV3IEZpbG1SUygpOwotICAgICAgICAgICAgbVJlbmRlci5pbml0KG1SUywgZ2V0UmVzb3VyY2VzKCksIHcsIGgpOwotICAgICAgICB9Ci0gICAgfQotCi0gICAgQE92ZXJyaWRlCi0gICAgcHJvdGVjdGVkIHZvaWQgb25EZXRhY2hlZEZyb21XaW5kb3coKSB7Ci0gICAgICAgIGlmKG1SUyAhPSBudWxsKSB7Ci0gICAgICAgICAgICBtUlMgPSBudWxsOwotICAgICAgICAgICAgZGVzdHJveVJlbmRlclNjcmlwdCgpOwotICAgICAgICB9Ci0gICAgfQotCi0gICAgQE92ZXJyaWRlCi0gICAgcHVibGljIGJvb2xlYW4gb25LZXlEb3duKGludCBrZXlDb2RlLCBLZXlFdmVudCBldmVudCkKLSAgICB7Ci0gICAgICAgIC8vIGJyZWFrIHBvaW50IGF0IGhlcmUKLSAgICAgICAgLy8gdGhpcyBtZXRob2QgZG9lc24ndCB3b3JrIHdoZW4gJ2V4dGVuZHMgVmlldycgaW5jbHVkZSAnZXh0ZW5kcyBTY3JvbGxWaWV3Jy4KLSAgICAgICAgcmV0dXJuIHN1cGVyLm9uS2V5RG93bihrZXlDb2RlLCBldmVudCk7Ci0gICAgfQotCi0KLSAgICBAT3ZlcnJpZGUKLSAgICBwdWJsaWMgYm9vbGVhbiBvblRvdWNoRXZlbnQoTW90aW9uRXZlbnQgZXYpCi0gICAgewotICAgICAgICBib29sZWFuIHJldCA9IHRydWU7Ci0gICAgICAgIGludCBhY3QgPSBldi5nZXRBY3Rpb24oKTsKLSAgICAgICAgaWYgKGFjdCA9PSBldi5BQ1RJT05fVVApIHsKLSAgICAgICAgICAgIHJldCA9IGZhbHNlOwotICAgICAgICB9Ci0gICAgICAgIG1SZW5kZXIuc2V0Rml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GNvbG9yID0gKChpbnQpKENvbnRyb2wtPnIgKiAyNTUuZikpIHwKLSAgICAgICAgICAgICAgICAgICAgKChpbnQpKENvbnRyb2wtPmcgKiAyNTUuZikpIDw8IDggfAotICAgICAgICAgICAgICAgICAgICAoKGludCkoQ29udHJvbC0+YiAqIDI1NS5mKSkgPDwgMTYgfAotICAgICAgICAgICAgICAgICAgICAoMHhmMCA8PCAyNCk7Ci0gICAgICAgIHN0cnVjdCBwb2ludF9zICogbnAgPSAmcFtuZXdQYXJ0XTsKLQotICAgICAgICB3aGlsZSAocmF0ZS0tKSB7Ci0gICAgICAgICAgICB2ZWMyUmFuZCgoZmxvYXQgKikmbnAtPmRlbHRhLngsIHJNYXgpOwotICAgICAgICAgICAgbnAtPnBvc2l0aW9uLnggPSB4OwotICAgICAgICAgICAgbnAtPnBvc2l0aW9uLnkgPSB5OwotICAgICAgICAgICAgbnAtPmNvbG9yID0gY29sb3I7Ci0gICAgICAgICAgICBuZXdQYXJ0Kys7Ci0gICAgICAgICAgICBucCsrOwotICAgICAgICAgICAgaWYgKG5ld1BhcnQgPj0gY291bnQpIHsKLSAgICAgICAgICAgICAgICBuZXdQYXJ0ID0gMDsKLSAgICAgICAgICAgICAgICBucCA9ICZwW25ld1BhcnRdOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgfQotCi0gICAgZm9yIChjdD0wOyBjdCA8IGNvdW50OyBjdCsrKSB7Ci0gICAgICAgIGZsb2F0IGR5ID0gcC0+ZGVsdGEueSArIDAuMTVmOwotICAgICAgICBmbG9hdCBwb3N5ID0gcC0+cG9zaXRpb24ueSArIGR5OwotICAgICAgICBpZiAoKHBvc3kgPiBoZWlnaHQpICYmIChkeSA+IDApKSB7Ci0gICAgICAgICAgICBkeSAqPSAtMC4zZjsKLSAgICAgICAgfQotICAgICAgICBwLT5kZWx0YS55ID0gZHk7Ci0gICAgICAgIHAtPnBvc2l0aW9uLnggKz0gcC0+ZGVsdGEueDsKLSAgICAgICAgcC0+c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RfdCAqcG9pbnQ7Ci0KLWludCBtYWluKGludCBsYXVuY2hJRCkgewotICAgIGludCBjdDsKLSAgICBpbnQgY291bnQgPSBDb250cm9sLT5jb3VudDsKLSAgICBpbnQgcmF0ZSA9IENvbnRyb2wtPnJhdGU7Ci0gICAgZmxvYXQgaGVpZ2h0ID0gZ2V0SGVpZ2h0KCk7Ci0gICAgUG9pbnRfdCAqIHAgPSBwb2ludDsKLQotICAgIGlmIChyYXRlKSB7Ci0gICAgICAgIGZsb2F0IHJNYXggPSAoKGZsb2F0KXJhdGUpICogMC4wMDVmOwotICAgICAgICBpbnQgeCA9IENvbnRyb2wtPng7Ci0gICAgICAgIGludCB5ID0gQ29udHJvbC0+eTsKLSAgICAgICAgaW50IGNvbG9yID0gKChpbnQpKENvbnRyb2wtPnIgKiAyNTUuZikpIHwKLSAgICAgICAgICAgICAgICAgICAgKChpbnQpKENvbnRyb2wtPmcgKiAyNTUuZikpIDw8IDggfAotICAgICAgICAgICAgICAgICAgICAoKGludCkoQ29udHJvbC0+YiAqIDI1NS5mKSkgPDwgMTYgfAotICAgICAgICAgICAgICAgICAgICAoMHhmMCA8PCAyNCk7Ci0gICAgICAgIFBvaW50X3QgKiBucCA9ICZwW25ld1BhcnRdOwotCi0gICAgICAgIHdoaWxlIChyYXRlLS0pIHsKLSAgICAgICAgICAgIG5wLT5kZWx0YSA9IHZlYzJSYW5kKHJNYXgpOwotICAgICAgICAgICAgbnAtPnBvc2l0aW9uLnggPSB4OwotICAgICAgICAgICAgbnAtPnBvc2l0aW9uLnkgPSB5OwotICAgICAgICAgICAgbnAtPmNvbG9yID0gY29sb3I7Ci0gICAgICAgICAgICBuZXdQYXJ0Kys7Ci0gICAgICAgICAgICBucCsrOwotICAgICAgICAgICAgaWYgKG5ld1BhcnQgPj0gY291bnQpIHsKLSAgICAgICAgICAgICAgICBuZXdQYXJ0ID0gMDsKLSAgICAgICAgICAgICAgICBucCA9ICZwW25ld1BhcnRdOwotICAgICAgICAgICAgfQ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W9uQnVpbGRlciBzbWIgPSBuZXcgTWVzaC5BbGxvY2F0aW9uQnVpbGRlcihtUlMpOworICAgICAgICBzbWIuYWRkVmVydGV4QWxsb2NhdGlvbihwb2ludHMuZ2V0QWxsb2NhdGlvbigpKTsKKyAgICAgICAgc21iLmFkZEluZGV4VHlwZShQcmltaXRpdmUuUE9JTlQpOworICAgICAgICBNZXNoIHNtID0gc21iLmNyZWF0ZSgpOworCisgICAgICAgIG1TY3JpcHQgPSBuZXcgU2NyaXB0Q19Gb3VudGFpbihtUlMsIG1SZXMsIFIucmF3LmZvdW50YWluLCB0cnVlKTsKKyAgICAgICAgbVNjcmlwdC5zZXRfcGFydE1lc2goc20pOworICAgICAgICBtU2NyaXB0LmJpbmRfcG9pbnQocG9pbnRzKTsKKyAgICAgICAgbVJTLmNvbnRleHRCaW5kUm9vdFNjcmlwdChtU2NyaXB0KTsKICAgICB9CiAKLSAgICBwdWJsaWMgdm9pZCBuZXdUb3VjaFBvc2l0aW9uKGludCB4LCBpbnQgeSwgaW50IHJhdGUpIHsKLSAgICAgICAgaWYgKG1TRC5yYXRlID09IDApIHsKLSAgICAgICAgICAgIG1TRC5yID0gKCh4ICYgMHgxKSAhPSAwKSA/IDAuZiA6IDEuZjsKLSAgICAgICAgICAgIG1TRC5nID0gKCh4ICYgMHgyKSAhPSAwKSA/IDAuZiA6IDEuZjsKLSAgICAgICAgICAgIG1TRC5iID0gKCh4ICYgMHg0KSAhPSAwKSA/IDAuZiA6IDEuZjsKLSAgICAgICAgICAgIGlmICgobVNELnIgKyBtU0QuZyArIG1TRC5iKSA8IDAuOWYpIHsKLSAgICAgICAgICAgICAgICBtU0QuciA9IDAuOGY7Ci0gICAgICAgICAgICAgICAgbVNELmcgPSAwLjVmOwotICAgICAgICAgICAgICAgIG1TRC5iID0gMS5mOwotICAgICAgICAgICAgfQorICAgIGJvb2xlYW4gaG9sZGluZ0NvbG9yW10gPSBuZXcgYm9vbGVhblsxMF07CisgICAgcHVibGljIHZva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leCgpOworICAgICAgICAgICAgaW50IHBvaW50ZXJJZCA9IGV2LmdldFBvaW50ZXJJZChwb2ludGVySW5kZXgpOworICAgICAgICAgICAgbVJlbmRlci5uZXdUb3VjaFBvc2l0aW9uKDAsIDAsIDAsIHBvaW50ZXJJZCk7CiAgICAgICAgIH0KLSAgICAgICAgZmxvYXQgcmF0ZSA9IChldi5nZXRQcmVzc3VyZSgpICogNTAuZik7Ci0gICAgICAgIHJhdGUgKj0gcmF0ZTsKLSAgICAgICAgaWYocmF0ZSA+IDIwMDAuZikgewotICAgICAgICAgICAgcmF0ZSA9IDIwMDAuZjsKKyAgICAgICAgaW50IGNvdW50ID0gZXYuZ2V0SGlzdG9yeVNpemUoKTsKKyAgICAgICAgaW50IHBjb3VudCA9IGV2LmdldFBvaW50ZXJDb3VudCgpOworCisgICAgICAgIGZvciAoaW50IHA9MDsgcCA8IHBjb3VudDsgcCsrKSB7CisgICAgICAgICAgICBpbnQgaWQgPSBldi5nZXRQb2ludGVySWQocCk7CisgICAgICAgICAgICBtUmVuZGVyLm5ld1RvdWNoUG9zaXRpb24oZXYuZ2V0WChwKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBldi5nZXRZKHApLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2LmdldFByZXNzdXJlKHApLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkKTsKKworICAgICAgICAgICAgZm9yIChpbnQgaT0wOyBpIDwgY291bnQ7IGkrKykgeworICAgICAgICAgICAgICAgIG1SZW5kZXIubmV3VG91Y2hQb3NpdGlvbihldi5nZXRIaXN0b3JpY2FsWChwLCBpKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXYuZ2V0SGlzdG9yaWNhbFkocCwgaSksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2LmdldEhpc3RvcmljYWxQcmVzc3VyZShwLCBpK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YXIocG9pbnQsIHBhcnRNZXNoKQorI3ByYWdtYSBycyBleHBvcnRfZnVuYyhhZGRQYXJ0aWNsZXMpCisKK2ludCByb290KCkgeworICAgIGZsb2F0IGR0ID0gbWluKHJzR2V0RHQoKSwgMC4xZik7CisgICAgcnNnQ2xlYXJDb2xvcigwLmYsIDAuZiwgMC5mLCAxLmYpOworICAgIGNvbnN0IGZsb2F0IGhlaWdodCA9IHJzZ0dldEhlaWdodCgpOworICAgIGNvbnN0IGludCBzaXplID0gcnNBbGxvY2F0aW9uR2V0RGltWChyc0dldEFsbG9jYXRpb24ocG9pbnQpKTsKKyAgICBmbG9hdCBkeTIgPSBkdCAqICgxMC5mKTsKKyAgICBQb2ludF90ICogcCA9IHBvaW50OworICAgIGZvciAoaW50IGN0PTA7IGN0IDwgc2l6ZTsgY3QrKykgeworICAgICAgICBwLT5kZWx0YS55ICs9IGR5MjsKKyAgICAgICAgcC0+cG9zaXRpb24gKz0gcC0+ZGVsdGE7CisgICAgICAgIGlmICgocC0+cG9zaXRpb24ueSA+IGhlaWdodCkgJiYgKHAtPmRlbHRhLnkgPiAwKSkgeworICAgICAgICAgICAgcC0+ZGVsdGEueSAqPSAtMC4zZjsKKyAgICAgICAgfQorICAgICAgICBwKys7CisgICAgfQorCisgICAgcnNnRHJhd01lc2gocGFydE1lc2gpOworICAgIHJldHVybiAxOworfQorCitzdGF0aWMgZmxvYXQ0IHBhcnRDb2xvclsxMF07Cit2b2lkIGFkZFBhcnRpY2xlcyhpbnQgcmF0ZSwgZmxvYXQgeCwgZmxvYXQgeSwgaW50IGluZGV4LCBib29sIG5ld0NvbG9yKQoreworICAgIGlmIChuZXdDb2xvcikgeworICAgICAgICBwYXJ0Q29sb3JbaW5kZXhdLnggPSByc1JhbmQoMC41ZiwgMS4wZik7CisgICAgICAgIHBhcnRDb2xvcltpbmRleF0ueSA9IHJzUmFuZCgxLjBmKTsKKyAgICAgICAgcGFydENvbG9yW2luZGV4XS56ID0gcnNSYW5kKDEuMGYpOworICAgIH0KKyAgICBmbG9hdCByTWF4ID0gKChmbG9hdClyYXRlKSAqIDAuMDJmOworICAgIGludCBzaXplID0gcnNBbGxvY2F0aW9uR2V0RGltWChyc0dldEFsbG9jYXRpb24ocG9pbnQpKTsKKyAgICB1Y2hhcjQgYyA9IHJzUGFja0NvbG9yVG84ODg4KHBhcnRDb2xvcltpbmRleF0pOworCisgICAgUG9pbnRfdCAqIG5wID0gJnBvaW50W25ld1BhcnRdOworICAgIGZsb2F0MiBwID0ge3gsIHl9OworICAgIHdoaWxlIChyYXRlLS0pIHsKKyAgICAgICAgZmxvYXQgYW5nbGUgPSByc1JhbmQoMy4xNGYgKiAyLmYpOworICAgICAgICBmbG9hdCBsZW4gPSByc1JhbmQock1heCk7CisgICAgICAgIG5wLT5kZWx0YS54ID0gbGVuICogc2luKGFuZ2xlKTsKKyAgICAgICAgbnAtPmRlbHRhLnkgPSBsZW4gKiBjb3MoYW5nbGUpOworICAgICAgICBucC0+cG9zaXRpb24gPSBwOworICAgICAgICBucC0+Y29sb3IgPSBjOworICAgICAgICBuZXdQYXJ0Kys7CisgICAgICAgIG5wKys7CisgICAgICAgIGlmIChuZXdQYXJ0ID49IHNpemUpIHsKKyAgICAgICAgICAgIG5ld1BhcnQgPSAwOworICAgICAgICAgICAgbnAgPSAmcG9pbnRbbmV3UGFydF07CisgICAgICAgIH0KKyAgICB9Cit9CisKZGlmZiAtLWdpdCBhL2xpYnMvcnMvamF2YS9JbWFnZVByb2Nlc3NpbmcvQW5kcm9pZC5tayBiL2xpYnMvcnMvamF2YS9JbWFnZVByb2Nlc3NpbmcvQW5kcm9pZC5tawppbmRleCA4MzM0MjdiLi43ZmEzMGQwIDEwMDY0NAotLS0gYS9saWJzL3JzL2phdmEvSW1hZ2VQcm9jZXNzaW5nL0FuZHJvaWQubWsKKysrIGIvbGlicy9ycy9qYXZhL0ltYWdlUHJvY2Vzc2luZy9BbmRyb2lkLm1rCkBAIC0xNCwxNCArMTQsMTkgQEA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ZmaWNpZW50cyBoZXJlCisgICAgZmxvYXQgZ2F1c3NpYW5bXTsKKworICAgIHByaXZhdGUgbG9uZyBqYXZhRmlsdGVyKCkgeworICAgICAgICBmaW5hbCBpbnQgd2lkdGggPSBtQml0bWFwSW4uZ2V0V2lkdGgoKTsKKyAgICAgICAgZmluYWwgaW50IGhlaWdodCA9IG1CaXRtYXBJbi5nZXRIZWlnaHQoKTsKKyAgICAgICAgZmluYWwgaW50IGNvdW50ID0gd2lkdGggKiBoZWlnaHQ7CisKKyAgICAgICAgaWYgKGluID09IG51bGwpIHsKKyAgICAgICAgICAgIGluID0gbmV3IGludFtjb3VudF07CisgICAgICAgICAgICBpbnRlcm0gPSBuZXcgaW50W2NvdW50XTsKKyAgICAgICAgICAgIG91dCA9IG5ldyBpbnRbY291bnRdOworICAgICAgICAgICAgZ2F1c3NpYW4gPSBuZXcgZmxvYXRbTUFYX1JBRElVUyAqIDIgKyAxXTsKKyAgICAgICAgICAgIG1CaXRtYXBJbi5nZXRQaXhlbHMoaW4sIDAsIHdpZHRoLCAwLCAwLCB3aWR0aCwgaGVpZ2h0KTsKKyAgICAgICAgfQorCiAgICAgICAgIGxvbmcgdCA9IGphdmEubGFuZy5TeXN0ZW0uY3VycmVudFRpbWVNaWxsaXMoKTsKLSAgICAgICAgaW50IGNvdW50ID0gbVBhcmFtcy5pbldpZHRoICogbVBhcmFtcy5pbkhlaWdodDsKLSAgICAgICAgZmxvYXQgdGhyZXNob2xkID0gbVBhcmFtcy50aHJlc2hvbGQgKiAyNTUuZjsKIAotICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGNvdW50OyBpKyspIHsKLSAgICAgICAgICAgIGZpbmFsIGZsb2F0IHIgPSAoZmxvYXQpKChtSW5EYXRhW2ldID4+IDApICYgMHhmZik7Ci0gICAgICAgICAgICBmaW5hbCBmbG9hdCBnID0gKGZsb2F0KSgobUluRGF0YVtpXSA+PiA4KSAmIDB4ZmYpOwotICAgICAgICAgICAgZmluYWwgZmxvYXQgYiA9IChmbG9hdCkoKG1JbkRhdGFbaV0gPj4gMTYpICYgMHhmZik7CisgICAgICAgIGludCB3LCBoLCByOwogCi0gICAgICAgICAgICBmaW5hbCBmbG9hdCBsdW1pbmFuY2UgPSAwLjIxMjVmICogciArCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjcxNTRmICogZyArCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjA3MjFmICogYjsKLSAgICAgICAgICAgIGlmIChsdW1pbmFuY2UgPiB0aHJlc2hvbGQpIHsKLSAgICAgICAgICAgICAgICBtT3V0RGF0YVtpXSA9IG1JbkRhdGFbaV07Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIG1PdXREYXRhW2ldID0gbUluRGF0YVtpXSAmIDB4ZmYwMDAwMDA7CisgICAgICAgIGZsb2F0IGZSYWRpdXMgPSAoZmxvYXQpbVJhZGl1czsKKyAgICAgICAgaW50IHJhZGl1cyA9IChpbnQpbVJhZGl1czsKKworICAgICAgICAvLyBDb21wdXRlIGdhdXNzaWFuIHdlaWdodHMgZm9yIHRoZSBibHVyCisgICAgICAgIC8vIGUgaXMgdGhlIGV1bGVyJ3MgbnVtYmVyCisgICAgICAgIGZsb2F0IGUgPSAyLjcxODI4MTgyODQ1OTA0NWY7CisgICAgICAgIGZsb2F0IHBpID0gMy4xNDE1OTI2NTM1ODk3OTMyZjsKKyAgICAgICAgLy8gZyh4KSA9ICggMSAvIHNxcnQoIDIgKiBwaSApICogc2lnbWEpICogZSBeICggLXheMiAvIDIgKiBzaWdtYV4yICkKKyAgICAgICAgLy8geCBpcyBvZiB0aGUgZm9ybSBbLXJhZGl1cyAuLiAwIC4uIHJhZGl1c10KKyAgICAgICAgLy8gYW5kIHNpZ21hIHZhcmllcyB3aXRoIHJhZGl1cy4KKyAgICAgICAgLy8gQmFzZWQgb24gc29tZSBleHBlcmltZW50YWwgcmFkaXVzIHZhbHVlcyBhbmQgc2lnbWEncworICAg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NYXRoLnBvdyhlLCBmbG9hdFIgKiBmbG9hdFIgKiBjb2VmZjIpOworICAgICAgICAgICAgbm9ybWFsaXplRmFjdG9yICs9IGdhdXNzaWFuW3IgKyByYWRpdXNdOworICAgICAgICB9CisKKyAgICAgICAgLy9Ob3cgd2UgbmVlZCB0byBub3JtYWxpemUgdGhlIHdlaWdodHMgYmVjYXVzZSBhbGwgb3VyIGNvZWZmaWNpZW50cyBuZWVkIHRvIGFkZCB1cCB0byBvbmUKKyAgICAgICAgbm9ybWFsaXplRmFjdG9yID0gMS4wZiAvIG5vcm1hbGl6ZUZhY3RvcjsKKyAgICAgICAgZm9yKHIgPSAtcmFkaXVzOyByIDw9IHJhZGl1czsgciArKykgeworICAgICAgICAgICAgZmxvYXRSID0gKGZsb2F0KXI7CisgICAgICAgICAgICBnYXVzc2lhbltyICsgcmFkaXVzXSAqPSBub3JtYWxpemVGYWN0b3I7CisgICAgICAgIH0KKworICAgICAgICBmbG9hdCBibHVycmVkUGl4ZWxSID0gMC4wZjsKKyAgICAgICAgZmxvYXQgYmx1cnJlZFBpeGVsRyA9IDAuMGY7CisgICAgICAgIGZsb2F0IGJsdXJyZWRQaXhlbEIgPSAwLjBmOworICAgICAgICBmbG9hdCBibHVycmVkUGl4ZWxBID0gMC4wZjsKKworICAgICAgICBmb3IoaCA9IDA7IGggPCBoZWlnaHQ7IGggKyspIHsKKyAgICAgICAgICAgIGZvcih3ID0gMDsgdyA8IHdpZHRoOyB3ICsrKSB7CisKKyAgICAgICAgICAgICAgICBibHVycmVkUGl4ZWxSID0gMC4wZjsKKyAgICAgICAgICAgICAgICBibHVycmVkUGl4ZWxHID0gMC4wZjsKKyAgICAgICAgICAgICAgICBibHVycmVkUGl4ZWxCID0gMC4wZjsKKyAgICAgICAgICAgICAgICBibHVycmVkUGl4ZWxBID0gMC4wZjsKKworICAgICAgICAgICAgICAgIGZvcihyID0gLXJhZGl1czsgciA8PSByYWRpdXM7IHIgKyspIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gU3RlcHBpbmcgbGVmdCBhbmQgcmlnaHQgYXdheSBmcm9tIHRoZSBwaXhlbAorICAgICAgICAgICAgICAgICAgICBpbnQgdmFsaWRXID0gdyArIHI7CisgICAgICAgICAgICAgICAgICAgIC8vIENsYW1wIHRvIHplcm8gYW5kIHdpZHRoIG1heCgpIGlzbid0IGV4cG9zZWQgZm9yIGludHMgeWV0CisgICAgICAgICAgICAgICAgICAgIGlmKHZhbGlkVyA8IDApIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHZhbGlkVyA9IDA7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgaWYodmFsaWRXID4gd2lkdGggLSAxKSB7CisgICAgICAgICAgICAgICAgICAgICAgICB2YWxpZFcgPSB3aWR0aCAtIDE7CisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICBpbnQgaW5wdXQgPSBpbltoKndpZHRoICsgdmFsaWRXXTsKKworICAgICAgICAgICAgICAgICAgICBpbnQgUiA9ICgoaW5wdXQgPj4gMjQpICYgMHhmZik7CisgICAgICAgICAgICAgICAgICAgIGludCBHID0gKChpbnB1dCA+PiAxNikgJiAweGZmKTsKKyAgICAgICAgICAgICAgICAgICAgaW50IEIgPSAoKGlucHV0ID4+IDgpICYgMHhmZik7CisgICAgICAgICAgICAgICAgICAgIGludCBBID0gKGlucHV0ICYgMHhmZik7CisKKyAgICAgICAgICAgICAgICAgICAgZmxvYXQgd2VpZ2h0ID0gZ2F1c3NpYW5bciArIHJhZGl1c107CisKKyAgICAgICAgICAgICAgICAgICAgYmx1cnJlZFBpeGVsUiArPSAoZmxvYXQpKFIpKndlaWdodDsKKyAgICAgICAgICAgICAgICAgICAgYmx1cnJlZFBpeGVsRyArPSAoZmxvYXQpKEcpKndlaWdodDsKKyAgICAgICAgICAgICAgICAgICAgYmx1cnJlZFBpeGVsQiArPSAoZmxvYXQpKEIpKndlaWdodDsKKyAgICAgICAgICAgICAgICAgICAgYmx1cnJlZFBpeGVsQSArPSAoZmxvYXQpKEEpKndlaWdodDsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICBpbnQgUiA9IChpbnQpYmx1cnJlZFBpeGVsUjsKKyAgICAgICAgICAgICAgICBpbnQgRyA9IChpbnQpYmx1cnJlZFBpeGVsRzsKKyAgICAgICAgICAgICAgICBpbnQgQiA9IChpbnQpYmx1cnJlZFBpeGVsQjsKKyAgICAgICAgICAgICAgICBpbnQgQSA9IChpbnQpYmx1cnJlZFBpeGVsQTsKKworICAgICAgICAgICAgICAgIGludGVybVtoKndpZHRoICsgd10gPSAoUiA8PCAyNCkgfCAoRyA8PCAxNikgfCAoQiA8PCA4KSB8IChBKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIGZvcihoID0gMDsgaCA8IGhlaWdodDsgaCArKykgeworICAgICAgICAgICAgZm9yKHcgPSAwOyB3IDwgd2lkdGg7IHcgKyspIHsKKworICAgICAgICAgICAgICAgIGJsdXJyZWRQaXhlbFIgPSAwLjBmOworICAgICAgICAgICAgICAgIGJsdXJyZWRQaXhlbEcgPSAwLjBmOworICAgICAgICAgICAgICAgIGJsdXJyZWRQaXhlbEIgPSAwLjBmOworICAgICAgICAgICAgICAgIGJsdXJyZWRQaXhlbEEgPSAwLjBmOworICAgICAgICAgICAgICAgIGZvcihyID0gLXJhZGl1czsgciA8PSByYWRpdXM7IHIgKyspIHsKKyAgICAgICAgICAgICAgICAgICAgaW50IHZhbGlkSCA9IGggKyByOworICAgICAgICAgICAgICAgICAgICAvLyBDbGFtcCB0byB6ZXJvIGFuZCB3aWR0aAorICAgICAgICAgICAgICAgICAgICBpZih2YWxpZEggPCAwKSB7CisgICAgICAgICAgICAgICAgICAgICAgICB2YWxpZEggPSAwOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGlmKHZhbGlkSCA+IGhlaWdodCAtIDEpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHZhbGlkSCA9IGhlaWdodCAtIDE7CisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICBpbnQgaW5wdXQgPSBpbnRlcm1bdmFsaWRIKndpZHRoICsgd107CisKKyAgICAgICAgICAgICAgICAgICAgaW50IFIgPSAoKGlucHV0ID4+IDI0KSAmIDB4ZmYpOworICAgICAgICAgICAgICAgICAgICBpbnQgRyA9ICgoaW5wdXQgPj4gMTYpICYgMHhmZik7CisgICAgICAgICAgICAgICAgICAgIGludCBCID0gKChpbnB1dCA+PiA4KSAmIDB4ZmYpOworICAgICAgICAgICAgICAgICAgICBpbnQgQSA9IChpbnB1dCAmIDB4ZmYpOworCisgICAgICAgICAgICAgICAgICAgIGZsb2F0IHdlaWdodCA9IGdhdXNzaWFuW3IgKyByYWRpdXNdOworCisgICAgICAgICAgICAgICAgICAgIGJsdXJyZWRQaXhlbFIgKz0gKGZsb2F0KShSKSp3ZWlnaHQ7CisgICAgICAgICAgICAgICAgICAgIGJsdXJyZWRQaXhlbEcgKz0gKGZsb2F0KShHKSp3ZWlnaHQ7CisgICAgICAgICAgICAgICAgICAgIGJsdXJyZWRQaXhlbEIgKz0gKGZsb2F0KShCKSp3ZWlnaHQ7CisgICAgICAgICAgICAgICAgICAgIGJsdXJyZWRQaXhlbEEgKz0gKGZsb2F0KShBKSp3ZWlnaHQ7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgaW50IFIgPSAoaW50KWJsdXJyZWRQaXhlbFI7CisgICAgICAgICAgICAgICAgaW50IEcgPSAoaW50KWJsdXJyZWRQaXhlbEc7CisgICAgICAgICAgICAgICAgaW50IEIgPSAoaW50KWJsdXJyZWRQaXhlbEI7CisgICAgICAgICAgICAgICAgaW50IEEgPSAoaW50KWJsdXJyZWRQaXhlbEE7CisKKyAgICAgICAgICAgICAgICBvdXRbaCp3aWR0aCArIHddID0gKFIgPDwgMjQpIHwgKEcgPDwgMTYpIHwgKEIgPDwgOCkgfCAoQSk7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KIAogICAgICAgICB0ID0gamF2YS5sYW5nLlN5c3RlbS5jdXJyZW50VGltZU1pbGxpcygpIC0gdDsKKyAgICAgICAgYW5kcm9pZC51dGlsLkxvZy52KCJJbWciLCAiSmF2YSBmcmFtZSB0aW1lIG1zICIgKyB0KTsKKyAgICAgICAgbUJpdG1hcE91dC5zZXRQaXhlbHMob3V0LCAwLCB3aWR0aCwgMCwgMCwgd2lkdGgsIGhlaWdodCk7CisgICAgICAgIHJldHVybiB0OworICAgIH0KIAotICAgICAgICBhbmRyb2lkLnV0aWwuTG9nLnYoIkltZyIsICJmcmFtZSB0aW1lIG1zICIgKyB0KTsKKyAgICBwdWJsaWMgdm9pZCBvblByb2dyZXNzQ2hhbmdlZChTZWVrQmFyIHNlZWtCYXIsIGludCBwcm9ncmVzcywgYm9vbGVhbiBmcm9tVXNlcikgeworICAgICAgICBpZiAoZnJvbVVzZXIpIHsKKworICAgICAgICAgICAgaWYoc2Vla0JhciA9PSBtUmFkaXVzU2Vla0JhcikgeworICAgICAgICAgICAgICAgIGZsb2F0IGZSYWRpdXMgPSBwcm9ncmVzcyAvIDEwMC4wZjsKKyAgICAgICAgICAgICAgICBmUmFkaXVzICo9IChmbG9hdCkoTUFYX1JBRElVUyk7CisgICAgICAgICAgICAgICAgbVJhZGl1cyA9IChpbnQpZlJhZGl1czsKKworICAgICAgICAgICAgICAgIG1TY3JpcHQuc2V0X3JhZGl1cyhtUmFkaXVzKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGVsc2UgaWYoc2Vla0JhciA9PSBtSW5CbGFja1NlZWtCYXIpIHsKKyAgICAgICAgICAgICAgICBtSW5CbGFjayA9IChmbG9hdClwcm9ncmVzczsKKyAgICAgICAgICAgICAgICBtU2NyaXB0VkJsdXIuaW52b2tlX3NldExldmVscyhtSW5CbGFjaywgbU91dEJsYWNrLCBtSW5XaGl0ZSwgbU91dFdoaXRlKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGVsc2UgaWYoc2Vla0JhciA9PSBtT3V0QmxhY2tTZWVrQmFyKSB7CisgICAgICAgICAgICAgICAgbU91dEJsYWNrID0gKGZsb2F0KXByb2dyZXNzOworICAgICAgICAgICAgICAgIG1TY3JpcHRWQmx1ci5pbnZva2Vfc2V0TGV2ZWxzKG1JbkJsYWNrLCBtT3V0QmxhY2ssIG1JbldoaXRlLCBtT3V0V2hpdGUpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgZWxzZSBpZihzZWVrQmFyID09IG1JbldoaXRlU2Vla0JhcikgeworICAgICAgICAgICAgICAgIG1JbldoaXRlID0gKGZsb2F0KXByb2dyZXNzICsgMTI3LjBmOworICAgICAgICAgICAgICAgIG1TY3JpcHRWQmx1ci5pbnZva2Vfc2V0TGV2ZWxzKG1JbkJsYWNrLCBtT3V0QmxhY2ssIG1JbldoaXRlLCBtT3V0V2hpdGUpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgZWxzZSBpZihzZWVrQmFyID09IG1PdXRXaGl0ZVNlZWtCYXIpIHsKKyAgICAgICAgICAgICAgICBtT3V0V2hpdGUgPSAoZmxvYXQpcHJvZ3Jlc3MgKyAxMjcuMGY7CisgICAgICAgICAgICAgICAgbVNjcmlwdFZCbHVyLmludm9rZV9zZXRMZXZlbHMobUluQmxhY2ssIG1PdXRCbGFjaywgbUluV2hpdGUsIG1PdXRXaGl0ZSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBlbHNlIGlmKHNlZWtCYXIgPT0gbUdhbW1hU2Vla0JhcikgeworICAgICAgICAgICAgICAgIG1HYW1tYSA9IChmbG9hdClwcm9ncmVzcy8xMDAuMGY7CisgICAgICAgICAgICAgICAgbUdhbW1hID0gTWF0aC5tYXgobUdhbW1hLCAwLjFmKTsKKyAgICAgICAgICAgICAgICBtR2FtbWEgPSAxLjBmIC8gbUdhbW1hOworICAgICAgICAgICAgICAgIG1TY3JpcHRWQmx1ci5pbnZva2Vfc2V0R2FtbWEobUdhbW1hKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGVsc2UgaWYoc2Vla0JhciA9PSBtU2F0dXJhdGlvblNlZWtCYXIpIHsKKyAgICAgICAgICAgICAgICBtU2F0dXJhdGlvbiA9IChmbG9hdClwcm9ncmVzcyAvIDUwLjBmOworICAgICAgICAgICAgICAgIG1TY3JpcHRWQmx1ci5pbnZva2Vfc2V0U2F0dXJhdGlvbihtU2F0dXJhdGlvbik7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGxvbmcgdCA9IGphdmEubGFuZy5TeXN0ZW0uY3VycmVudFRpbWVNaWxsaXMoKTsKKyAgICAgICAgICAgIGlmICh0cnVlKSB7CisgICAgICAgICAgICAgICAgbVNjcmlwdC5pbnZva2VfZmlsdGVyKCk7CisgICAgICAgICAgICAgICAgbVJTLmZpbmlzaCgpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBqYXZhRmlsdGVyKCk7CisgICAgICAgICAgICAgICAgbURpc3BsYXlWaWV3LmludmFsaWRhdGUoKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgdCA9IGphdmEubGFuZy5TeXN0ZW0uY3VycmVudFRpbWVNaWxsaXMoKSAtIHQ7CisgICAgICAgICAgICBhbmRyb2lkLnV0aWwuTG9nLnYoIkltZyIsICJSZW5kZXJzY3JpcHQgZnJhbWUgdGltZSBjb3JlIG1zICIgKyB0KTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyB2b2lkIG9uU3RhcnRUcmFja2luZ1RvdWNoKFNlZWtCYXIgc2Vla0JhcikgeworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIG9uU3RvcFRyYWNraW5nVG91Y2goU2Vla0JhciBzZWVrQmFyKSB7CiAgICAgfQogCiAgICAgQE92ZXJyaWRlCkBAIC0xMTksNDUgKzMxMSw1NCBAQAogICAgICAgICBzdXBlci5vbkNyZWF0ZShz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QYXJhbXMudGhyZXNob2xkID0gcHJvZ3Jlc3MgLyAxMDAuMGY7Ci0gICAgICAgICAgICAgICAgICAgIG1QYXJhbXNBbGxvY2F0aW9uLmRhdGEobVBhcmFtcyk7CisgICAgICAgIG1SYWRpdXNTZWVrQmFyID0gKFNlZWtCYXIpIGZpbmRWaWV3QnlJZChSLmlkLnJhZGl1cyk7CisgICAgICAgIG1SYWRpdXNTZWVrQmFyLnNldE9uU2Vla0JhckNoYW5nZUxpc3RlbmVyKHRoaXMpOwogCi0gICAgICAgICAgICAgICAgICAgIGlmICh0cnVlKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBtSW52b2thYmxlLmV4ZWN1dGUoKTsKLSAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGphdmFGaWx0ZXIoKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIG1CaXRtYXAuc2V0UGl4ZWxzKG1PdXREYXRhLCAwLCBtUGFyYW1zLm91dFdpZHRoLCAwLCAwLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtUGFyYW1zLm91dFdpZHRoLCBtUGFyYW1zLm91dEhlaWdodCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBtRGlzcGxheVZpZXcuaW52YWxpZGF0ZSgpOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQorICAgICAgICBtSW5CbGFja1NlZWtCYXIgPSAoU2Vla0JhcilmaW5kVmlld0J5SWQoUi5pZC5pbkJsYWNrKTsKKyAgICAgICAgbUluQmxhY2tTZWVrQmFyLnNldE9uU2Vla0JhckNoYW5nZUxpc3RlbmVyKHRoaXMpOworICAgICAgICBtSW5CbGFja1NlZWtCYXIuc2V0TWF4KDEyOCk7CisgICAgICAgIG1JbkJsYWNrU2Vla0Jhci5zZXRQcm9ncmVzcygwKTsKKyAgICAgICAgbU91dEJsYWNrU2Vla0JhciA9IChTZWVr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BwYXJhbXMub3V0V2lkdGggPSBtQml0bWFwLmdldFdpZHRoKCk7Ci0gICAgICAgIHBhcmFtcy5pbkhlaWdodCA9IHBhcmFtcy5vdXRIZWlnaHQgPSBtQml0bWFwLmdldEhlaWdodCgpOwotICAgICAgICBwYXJhbXMudGhyZXNob2xkID0gMC41ZjsKLSAgICAgICAgcmV0dXJuIHBhcmFtczsKKyAgICAgICAgbVNjcmlwdC5zZXRfdkJsdXJTY3JpcHQobVNjcmlwdFZCbHVyKTsKKyAgICAgICAgbVNjcmlwdC5zZXRfaEJsdXJTY3JpcHQobVNjcmlwdEhCbHVyKTsKICAgICB9CiAKICAgICBwcml2YXRlIEJpdG1hcCBsb2FkQml0bWFwKGludCByZXNvdXJjZSkgewpAQCAtMjI5LDQgKzQxNCwzMCBAQAogICAgICAgICBzb3VyY2UucmVjeWNsZSgpOwogICAgICAgICByZXR1cm4gYjsKICAgICB9CisKKyAgICAvLyBidXR0b24gaG9vaworICAgIHB1YmxpYyB2b2lkIGJlbmNobWFyayhWaWV3IHYpIHsKKyAgICAgICAgYW5kcm9pZC51dGlsLkxvZy52KCJJbWciLCAiQmVuY2htYXJraW5nIik7CisgICAgICAgIGludCBvbGRSYWRpdXMgPSBtUmFkaXVzOworICAgICAgICBtUmFkaXVzID0gTUFYX1JBRElVUzsKKyAgICAgICAgbVNjcmlwdC5zZXRfcmFkaXVzKG1SYWRpdXMpOworCisgICAgICAgIGxvbmcgdCA9IGphdmEubGFuZy5TeXN0ZW0uY3VycmVudFRpbWVNaWxsaXMoKTsKKworICAgICAgICBtU2NyaXB0Lmludm9rZV9maWx0ZXIoKTsKKyAgICAgICAgbVJTLmZpbmlzaCgpOworCisgICAgICAgIHQgPSBqYXZhLmxhbmcuU3lzdGVtLmN1cnJlbnRUaW1lTWlsbGlzKCkgLSB0OworICAgICAgICBhbmRyb2lkLnV0aWwuTG9nLnYoIkltZyIsICJSZW5kZXJzY3JpcHQgZnJhbWUgdGltZSBjb3JlIG1zICIgKy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25zdCBGaWx0ZXJTdHJ1Y3QgKmZzID0gKGNvbnN0IEZpbHRlclN0cnVjdCAqKXVzckRhdGE7CisgICAgY29uc3QgZmxvYXQ0ICppbnB1dCA9IChjb25zdCBmbG9hdDQgKilyc0dldEVsZW1lbnRBdChmcy0+YWluLCAwLCB5KTsKKworICAgIGZsb2F0MyBibHVycmVkUGl4ZWwgPSAwOworICAgIGNvbnN0IGZsb2F0ICpnUHRyID0gZnMtPmdhdXNzaWFuOworICAgIGlmICgoeCA+IGZzLT5yYWRpdXMpICYmICh4IDwgKGZzLT53aWR0aCAtIGZzLT5yYWRpdXMpKSkgeworICAgICAgICBjb25zdCBmbG9hdDQgKmkgPSBpbnB1dCArICh4IC0gZnMtPnJhZGl1cyk7CisgICAgICAgIGZvcihpbnQgciA9IC1mcy0+cmFkaXVzOyByIDw9IGZzLT5yYWRpdXM7IHIgKyspIHsKKyAgICAgICAgICAgIGJsdXJyZWRQaXhlbCArPSBpLT54eXogKiBnUHRyWzBdOworICAgICAgICAgICAgZ1B0cisrOworICAgICAgICAgICAgaSsrOworICAgICAgICB9CisgICAgfSBlbHNlIHsKKyAgICAgICAgZm9yKGludCByID0gLWZzLT5yYWRpdXM7IHIgPD0gZnMtPnJhZGl1czsgciArKykgeworICAgICAgICAgICAgLy8gU3RlcHBpbmcgbGVmdCBhbmQgcmlnaHQgYXdheSBmcm9tIHRoZSBwaXhlbAorICAgICAgICAgICAgaW50IHZhbGlkVyA9IHJzQ2xhbXAoeCArIHIsICh1aW50KTAsICh1aW50KShmcy0+d2lkdGggLSAxKSk7CisgICAgICAgICAgICBibHVycmVkUGl4ZWwgKz0gaW5wdXRbdmFsaWRXXS54eXogKiBnUHRyWzBdOworICAgICAgICAgICAgZ1B0cisrOworICAgICAgICB9CisgICAgfQorCisgICAgb3V0cHV0LT54eXogPSBibHVycmVkUGl4ZWw7Cit9CisKZGlmZiAtLWdpdCBhL2xpYnMvcnMvamF2YS9JbWFnZVByb2Nlc3Npbmcvc3Jj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gICBnYXVzc2lhbltyICsgcmFkaXVzXSA9IGNvZWZmMSAqIHBvdyhlLCBmbG9hdFIgKiBmbG9hdFIgKiBjb2VmZjIpOworICAgICAgICBub3JtYWxpemVGYWN0b3IgKz0gZ2F1c3NpYW5bciArIHJhZGl1c107CisgICAgfQorCisgICAgLy9Ob3cgd2UgbmVlZCB0byBub3JtYWxpemUgdGhlIHdlaWdodHMgYmVjYXVzZSBhbGwgb3VyIGNvZWZmaWNpZW50cyBuZWVkIHRvIGFkZCB1cCB0byBvbmUKKyAgICBub3JtYWxpemVGYWN0b3IgPSAxLjBmIC8gbm9ybWFsaXplRmFjdG9yOworICAgIGZvcihyID0gLXJhZGl1czsgciA8PSByYWRpdXM7IHIgKyspIHsKKyAgICAgICAgZmxvYXRSID0gKGZsb2F0KXI7CisgICAgICAgIGdhdXNzaWFuW3IgKyByYWRpdXNdICo9IG5vcm1hbGl6ZUZhY3RvcjsKKyAgICB9Cit9CisKKworc3RhdGljIHZvaWQgY29weUlucHV0KCkgeworICAgIFJTX0RFQlVHX01BUktFUjsKKyAgICByc19hbGxvY2F0aW9uIGFpbiA9IHJzR2V0QWxsb2NhdGlvbihJblBpeGVsKTsKKyAgICB1aW50MzJfdCBkaW14ID0gcnNBbGxvY2F0aW9uR2V0RGltWChhaW4pOworICAgIHVpbnQzMl90IGRpbXkgPSByc0FsbG9jYXRpb25HZXREaW1ZKGFpbik7CisgICAgZm9yKHVpbnQzMl90IHkgPSAwOyB5IDwgZGlteTsgeSsrKSB7CisgICAgICAgIGZvcih1aW50MzJfdCB4ID0gMDsgeCA8IGRpbXg7IHgrKykgeworICAgICAgICAgICAgU2NyYXRjaFBpeGVsMVt4ICsgeSAqIGRpbXhdID0gY29udmVydF9mbG9hdDQoSW5QaXhlbFt4ICsgeSAqIGRpbXhdKTsKKyAgICAgICAgfQorICAgIH0KKyAgICBSU19ERUJVR19NQVJLRVI7Cit9CisKK3ZvaWQgZmlsdGVyKCkgeworICAgIGNvcHlJbnB1dC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ZXI7CisgICAgcHJpdmF0ZSBQcm9ncmFtU3RvcmUgbVBTQmFja2dyb3VuZDsKKyAgICBwcml2YXRlIFByb2dyYW1GcmFnbWVudCBtUEZCYWNrZ3JvdW5kOworICAgIHByaXZhdGUgUHJvZ3JhbVZlcnRleCBtUFZCYWNrZ3JvdW5kOworICAgIHByaXZhdGUgUHJvZ3JhbVZlcnRleC5NYXRyaXhBbGxvY2F0aW9uIG1QVkE7CisKKyAgICBwcml2YXRlIEFsbG9jYXRpb24gbUdyaWRJbWFnZTsKKyAgICBwcml2YXRlIEFsbG9jYXRpb24gbUFsbG9jUFY7CisKKyAgICBwcml2YXRlIE1lc2ggbU1lc2g7CisKKyAgICBwcml2YXRlIEZvbnQgbUl0YWxpYzsKKyAgICBwcml2YXRlIEFsbG9jYXRpb24gbVRleHRBbGxvYzsKKworICAgIHByaXZhdGUgU2NyaXB0Q19Nb2RlbHZpZXdlciBtU2NyaXB0OworCisgICAgaW50IG1MYXN0WDsKKyAgICBpbnQgbUxhc3RZOworCisgICAgcHVibGljIHZvaWQgdG91Y2hFdmVudChpbnQgeCwgaW50IHkpIHsKKyAgICAgICAgaW50IGR4ID0gbUxhc3RYIC0geDsKKyAgICAgICAgaWYoTWF0aC5hYnMoZHgpID4gNTAgfHwgTWF0aC5hYnMoZHgpIDwgMykgeworICAgICAgICAgICAgZHggPSAwOworICAgICAgICB9CisKKyAgICAgICAgbVJvdGF0aW9uIC09IGR4OworICAgICAgICBpZihtUm90YXRpb24gPiAzNjApIHsKKyAgICAgICAgICAgIG1Sb3RhdGlvbiAtPSAzNjA7CisgICAgICAgIH0KKyAgICAgICAgaWYobVJvdGF0aW9uIDwgMCkgeworICAgICAgICAgICAgbVJvdGF0aW9uICs9IDM2MDsKKyAgICAgICAgfQorCisgICAgICAgIG1TY3JpcHQuc2V0X2dSb3RhdGUoLShmbG9hdCltUm90YXRpb24pOworCisgICAgICAgIG1MYXN0WCA9IHg7CisgICAgICAgIG1MYXN0WSA9IHk7Cis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Xcucm9ib3QiOworICAgICAgICBtVGV4dEFsbG9jID0gQWxsb2NhdGlvbi5jcmVhdGVGcm9tU3RyaW5nKG1SUywgYWxsb2NTdHJpbmcpOworICAgICAgICBtU2NyaXB0LnNldF9nVGV4dEFsbG9jKG1UZXh0QWxsb2MpOworICAgIH0KKworICAgIHByaXZhdGUgdm9pZCBpbml0UlMoKSB7CisKKyAgICAgICAgbVNjcmlwdCA9IG5ldyBTY3JpcHRDX01vZGVsdmlld2VyKG1SUywgbVJlcywgUi5yYXcubW9kZWx2aWV3ZXIsIHRydWUpOworCisgICAgICAgIGluaXRQRlMoKTsKKyAgICAgICAgaW5pdFBGKCk7CisgICAgICAgIGluaXRQVigpOworCisgICAgICAgIGxvYWRJbWFnZSgpOworCisgICAgICAgIEZpbGVBM0QgbW9kZWwgPSBGaWxlQTNELmNyZWF0ZUZyb21SZXNvdXJjZShtUlMsIG1SZXMsIFIucmF3LnJvYm90KTsKKyAgICAgICAgRmlsZUEzRC5JbmRleEVudHJ5IGVudHJ5ID0gbW9kZWwuZ2V0SW5kZXhFbnRyeSgwKTsKKyAgICAgICAgaWYoZW50cnkgPT0gbnVsbCB8fCBlbnRyeS5nZXRDbGFzc0lEKCkgIT0gRmlsZUEzRC5DbGFzc0lELk1FU0gpIHsKKyAgICAgICAgICAgIExvZy5lKCJycyIsICJjb3VsZCBub3QgbG9hZCBtb2RlbCIpOworICAgICAgICB9CisgICAgICAgIGVsc2UgeworICAgICAgICAgICAgbU1lc2ggPSAoTWVzaCllbnRyeS5nZXRPYmplY3QoKTsKKyAgICAgICAgICAgIG1TY3JpcHQuc2V0X2dUZXN0TWVzaChtTWVzaCk7CisgICAgICAgIH0KKworICAgICAgICBtSXRhbGljID0gRm9udC5jcmVhdGUobVJTLCBtUmVzLCAiRHJvaWRTZXJpZi1JdGFsaWMudHRmIiwgOCk7CisgICAgICAgIG1TY3JpcHQuc2V0X2dJdGFsaWMobUl0YWxpYyk7CisKKyAgICAgICAgaW5pdFRleHRB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ygpIHsKKyAgICAgICAgaWYobVJTICE9IG51bGwpIHsKKyAgICAgICAgICAgIG1SUyA9IG51bGw7CisgICAgICAgICAgICBkZXN0cm95UmVuZGVyU2NyaXB0KCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgYm9vbGVhbiBvbktleURvd24oaW50IGtleUNvZGUsIEtleUV2ZW50IGV2ZW50KQorICAgIHsKKyAgICAgICAgLy8gYnJlYWsgcG9pbnQgYXQgaGVyZQorICAgICAgICAvLyB0aGlzIG1ldGhvZCBkb2Vzbid0IHdvcmsgd2hlbiAnZXh0ZW5kcyBWaWV3JyBpbmNsdWRlICdleHRlbmRzIFNjcm9sbFZpZXcnLgorICAgICAgICByZXR1cm4gc3VwZXIub25LZXlEb3duKGtleUNvZGUsIGV2ZW50KTsKKyAgICB9CisKKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyBib29sZWFuIG9uVG91Y2hFdmVudChNb3Rpb25FdmVudCBldikKKyAgICB7CisgICAgICAgIGJvb2xlYW4gcmV0ID0gdHJ1ZTsKKyAgICAgICAgaW50IGFjdCA9IGV2LmdldEFjdGlvbigpOworICAgICAgICBpZiAoYWN0ID09IGV2LkFDVElPTl9VUCkgeworICAgICAgICAgICAgcmV0ID0gZmFsc2U7CisgICAgICAgIH0KKworICAgICAgICBtUmVuZGVyLnRvdWNoRXZlbnQoKGludClldi5nZXRYKCksIChpbnQpZXYuZ2V0WSgpKTsKKyAgICAgICAgcmV0dXJuIHJldDsKKyAgICB9Cit9CisKKwpkaWZmIC0tZ2l0IGEvbGlicy9ycy9qYXZhL01vZGVsVmlld2VyL3NyYy9jb20vYW5kcm9pZC9tb2RlbHZpZXdlci9TY2VuZUdyYXBoLmphdmEgYi9saWJzL3JzL2phdmEvTW9kZWxWaWV3ZXIvc3JjL2NvbS9hbmRyb2lkL21vZGVsdmlld2VyL1NjZW5lR3JhcGguamF2YQpuZXcgZmlsZSBtb2RlIDEwMDY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DsKKyAgICBwcml2YXRlIFByb2dyYW1WZXJ0ZXguTWF0cml4QWxsb2NhdGlvbiBtUFZBOworCisgICAgcHJpdmF0ZSBBbGxvY2F0aW9uIG1HcmlkSW1hZ2U7CisgICAgcHJpdmF0ZSBBbGxvY2F0aW9uIG1BbGxvY1BWOworCisgICAgcHJpdmF0ZSBNZXNoIG1NZXNoOworCisgICAgcHJpdmF0ZSBGb250IG1JdGFsaWM7CisgICAgcHJpdmF0ZSBBbGxvY2F0aW9uIG1UZXh0QWxsb2M7CisKKyAgICBwcml2YXRlIFNjcmlwdENfU2NlbmVncmFwaCBtU2NyaXB0OworICAgIHByaXZhdGUgU2NyaXB0Q19UcmFuc2Zvcm0gbVRyYW5zZm9ybVNjcmlwdDsKKworICAgIGludCBtTGFzdFg7CisgICAgaW50IG1MYXN0WTsKKworICAgIHB1YmxpYyB2b2lkIHRvdWNoRXZlbnQoaW50IHgsIGludCB5KSB7CisgICAgICAgIGludCBkeCA9IG1MYXN0WCAtIHg7CisgICAgICAgIGlmKE1hdGguYWJzKGR4KSA+IDUwIHx8IE1hdGguYWJzKGR4KSA8IDMpIHsKKyAgICAgICAgICAgIGR4ID0gMDsKKyAgICAgICAgfQorCisgICAgICAgIG1Sb3RhdGlvbiAtPSBkeDsKKyAgICAgICAgaWYobVJvdGF0aW9uID4gMzYwKSB7CisgICAgICAgICAgICBtUm90YXRpb24gLT0gMzYwOworICAgICAgICB9CisgICAgICAgIGlmKG1Sb3RhdGlvbiA8IDApIHsKKyAgICAgICAgICAgIG1Sb3RhdGlvbiArPSAzNjA7CisgICAgICAgIH0KKworICAgICAgICBtU2NyaXB0LnNldF9nUm90YXRlKC0oZmxvYXQpbVJvdGF0aW9uKTsKKworICAgICAgICBtTGFzdFggPSB4OworICAgICAgICBtTGFzdFkgPSB5OworICAgIH0KKworICAgIHByaXZhdGUgdm9pZCBpbml0UEZTKCkgeworICAgICAgICBQcm9ncmFtU3RvcmUuQnVpbGRlciBiID0gbmV3IFByb2d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AgICAgICAgICBtUlMuY29udGV4dFNldFN1cmZhY2UodywgaCwgaG9sZGVyLmdldFN1cmZhY2UoKSk7CisgICAgICAgICAgICBtUmVuZGVyID0gbmV3IFNjZW5lR3JhcGhSUygpOworICAgICAgICAgICAgbVJlbmRlci5pbml0KG1SUywgZ2V0UmVzb3VyY2VzKCksIHcsIGgpOworICAgICAgICB9CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHJvdGVjdGVkIHZvaWQgb25EZXRhY2hlZEZyb21XaW5kb3coKSB7CisgICAgICAgIGlmKG1SUyAhPSBudWxsKSB7CisgICAgICAgICAgICBtUlMgPSBudWxsOworICAgICAgICAgICAgZGVzdHJveVJlbmRlclNjcmlwdCgpOworICAgICAgICB9CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIGJvb2xlYW4gb25LZXlEb3duKGludCBrZXlDb2RlLCBLZXlFdmVudCBldmVudCkKKyAgICB7CisgICAgICAgIC8vIGJyZWFrIHBvaW50IGF0IGhlcmUKKyAgICAgICAgLy8gdGhpcyBtZXRob2QgZG9lc24ndCB3b3JrIHdoZW4gJ2V4dGVuZHMgVmlldycgaW5jbHVkZSAnZXh0ZW5kcyBTY3JvbGxWaWV3Jy4KKyAgICAgICAgcmV0dXJuIHN1cGVyLm9uS2V5RG93bihrZXlDb2RlLCBldmVudCk7CisgICAgfQorCisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgYm9vbGVhbiBvblRvdWNoRXZlbnQoTW90aW9uRXZlbnQgZXYpCisgICAgeworICAgICAgICBib29sZWFuIHJldCA9IHRydWU7CisgICAgICAgIGludCBhY3QgPSBldi5nZXRBY3Rpb24oKTsKKyAgICAgICAgaWYgKGFjdCA9PSBldi5BQ1RJT05fVVApIHsKKyAgICAgICAgICAgIHJldCA9IGZhbHNlOworICAgICAgICB9CisKKyAgICAgICAgbVJlbmRlci50b3VjaEV2ZW50KChpbnQpZXYuZ2V0WCgpLCAoaW50KWV2LmdldFk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FN0YXRlcyBNaW5vciBPdXRseWluZyBJc2xhbmRzIiwgIlVydWd1YXkiLCAiVXpiZWtpc3RhbiIsCisgICAgIlZhbnVhdHUiLCAiVmF0aWNhbiBDaXR5IiwgIlZlbmV6dWVsYSIsICJWaWV0bmFtIiwgIldhbGxpcyBhbmQgRnV0dW5hIiwgIldlc3Rlcm4gU2FoYXJhIiwKKyAgICAiWWVtZW4iLCAiWXVnb3NsYXZpYSIsICJaYW1iaWEiLCAiWmltYmFid2UiCisgICAgfTsKKworICAgIGludCBtV2lkdGg7CisgICAgaW50IG1IZWlnaHQ7CisKKyAgICBwdWJsaWMgUnNMaXN0UlMoKSB7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgaW5pdChSZW5kZXJTY3JpcHRHTCBycywgUmVzb3VyY2VzIHJlcywgaW50IHdpZHRoLCBpbnQgaGVpZ2h0KSB7CisgICAgICAgIG1SUyA9IHJzOworICAgICAgICBtUmVzID0gcmVzOworICAgICAgICBtV2lkdGggPSB3aWR0aDsKKyAgICAgICAgbUhlaWdodCA9IGhlaWdodDsKKyAgICAgICAgaW5pdFJTKCk7CisgICAgfQorCisgICAgcHJpdmF0ZSBSZXNvdXJjZXMgbVJlczsKKyAgICBwcml2YXRlIFJlbmRlclNjcmlwdEdMIG1SUzsKKyAgICBwcml2YXRlIEZvbnQgbUl0YWxpYzsKKworICAgIFNjcmlwdEZpZWxkX0xpc3RBbGxvY3NfcyBtTGlzdEFsbG9jczsKKworICAgIHByaXZhdGUgU2NyaXB0Q19Sc2xpc3QgbVNjcmlwdDsKKworICAgIGludCBtTGFzdFg7CisgICAgaW50IG1MYXN0WTsKKworICAgIHB1YmxpYyB2b2lkIG9uQWN0aW9uRG93bihpbnQgeCwgaW50IHkpIHsKKyAgICAgICAgbVNjcmlwdC5zZXRfZ0RZKDAuMGYpOworCisgICAgICAgIG1MYXN0WCA9IHg7CisgICAgICAgIG1MYXN0WSA9IHk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgb25BY3Rpb25Nb3ZlKGludCB4LCBpbnQgeSkgeworICAgICAgICBpbnQgZHggPSBtTGFzdFggLSB4OworICAgICAgICBpbnQgZHkgPSBtTGFzdFkgLSB5OworCisgICAgICAgIGlmKE1hdGguYWJzKGR5KSA8PSAyKSB7CisgICAgICAgICAgICBkeSA9IDA7CisgICAgICAgIH0KKworICAgICAgICBtU2NyaXB0LnNldF9nRFkoZHkpOworCisgICAgICAgIG1MYXN0WCA9IHg7CisgICAgICAgIG1MYXN0WSA9IHk7CisgICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIGluaXRSUygpIHsKKworICAgICAgICBtU2NyaXB0ID0gbmV3IFNjcmlwdENfUnNsaXN0KG1SUywgbVJlcywgUi5yYXcucnNsaXN0LCB0cnVlKTsKKworICAgICAgICBtTGlzdEFsbG9jcyA9IG5ldyBTY3JpcHRGaWVsZF9MaXN0QWxsb2NzX3MobVJTLCBEQVRBX0xJU1QubGVuZ3RoKTsKKyAgICAgICAgZm9yKGludCBpID0gMDsgaSA8IERBVEFfTElTVC5sZW5ndGg7IGkgKyspIHsKKyAgICAgICAgICAgIFNjcmlwdEZpZWxkX0xpc3RBbGxvY3Nfcy5JdGVtIGxpc3RFbGVtID0gbmV3IFNjcmlwdEZpZWxkX0xpc3RBbGxvY3Nfcy5JdGVtKCk7CisgICAgICAgICAgICBsaXN0RWxlbS50ZXh0ID0gQWxsb2NhdGlvbi5jcmVhdGVGcm9tU3RyaW5nKG1SUywgREFUQV9MSVNUW2ldKTsKKyAgICAgICAgICAgIG1MaXN0QWxsb2NzLnNldChsaXN0RWxlbSwgaSwgZmFsc2UpOworICAgICAgICB9CisKKyAgICAgICAgbUxpc3RBbGxvY3MuY29weUFsbCgpOworCisgICAgICAgIG1TY3JpcHQuYmluZF9nTGlzdChtTGlzdEFsbG9jcyk7CisKKyAgICAgICAgbUl0YWxpYyA9IEZvbnQuY3JlYXRlRnJvbUZhbWlseShtUlMsIG1SZXMsICJzZXJpZiIsIEZvbnQuU3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5Mb2c7CitpbXBvcnQgYW5kcm9pZC52aWV3LlN1cmZhY2U7CitpbXBvcnQgYW5kcm9pZC52aWV3LlN1cmZhY2VIb2xkZXI7CitpbXBvcnQgYW5kcm9pZC52aWV3LlN1cmZhY2VWaWV3OworaW1wb3J0IGFuZHJvaWQudmlldy5LZXlFdmVudDsKK2ltcG9ydCBhbmRyb2lkLnZpZXcuTW90aW9uRXZlbnQ7CisKK3B1YmxpYyBjbGFzcyBSc0xpc3RWaWV3IGV4dGVuZHMgUlNTdXJmYWNlVmlldyB7CisKKyAgICBwdWJsaWMgUnNMaXN0VmlldyhDb250ZXh0IGNvbnRleHQpIHsKKyAgICAgICAgc3VwZXIoY29udGV4dCk7CisgICAgICAgIC8vc2V0Rm9jdXNhYmxlKHRydWUpOworICAgIH0KKworICAgIHByaXZhdGUgUmVuZGVyU2NyaXB0R0wgbVJTOworICAgIHByaXZhdGUgUnNMaXN0UlMgbVJlbmRlcjsKKworCisgICAgcHVibGljIHZvaWQgc3VyZmFjZUNoYW5nZWQoU3VyZmFjZUhvbGRlciBob2xkZXIsIGludCBmb3JtYXQsIGludCB3LCBpbnQgaCkgeworICAgICAgICBzdXBlci5zdXJmYWNlQ2hhbmdlZChob2xkZXIsIGZvcm1hdCwgdywgaCk7CisgICAgICAgIGlmIChtUlMgPT0gbnVsbCkgeworICAgICAgICAgICAgbVJTID0gY3JlYXRlUmVuZGVyU2NyaXB0KHRydWUpOworICAgICAgICAgICAgbVJTLmNvbnRleHRTZXRTdXJmYWNlKHcsIGgsIGhvbGRlci5nZXRTdXJmYWNlKCkpOworICAgICAgICAgICAgbVJlbmRlciA9IG5ldyBSc0xpc3RSUygpOworICAgICAgICAgICAgbVJlbmRlci5pbml0KG1SUywgZ2V0UmVzb3VyY2VzKCksIHcsIGgpOworICAgICAgICB9CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHJvdGVjdGVkIHZvaWQgb25EZXRhY2hlZEZyb21XaW5kb3coKSB7CisgICAgICAgIGlmKG1SUyAhPSBudWxsKSB7CisgICAgICAgICAgICBtUlMgPSBudWxsOworICAgICAgICAgICAgZGVzdHJveVJlbmRlclNjcmlwdCgpOworICAgICAgICB9CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIGJvb2xlYW4gb25LZXlEb3duKGludCBrZXlDb2RlLCBLZXlFdmVudCBldmVudCkKKyAgICB7CisgICAgICAgIC8vIGJyZWFrIHBvaW50IGF0IGhlcmUKKyAgICAgICAgLy8gdGhpcyBtZXRob2QgZG9lc24ndCB3b3JrIHdoZW4gJ2V4dGVuZHMgVmlldycgaW5jbHVkZSAnZXh0ZW5kcyBTY3JvbGxWaWV3Jy4KKyAgICAgICAgcmV0dXJuIHN1cGVyLm9uS2V5RG93bihrZXlDb2RlLCBldmVudCk7CisgICAgfQorCisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgYm9vbGVhbiBvblRvdWNoRXZlbnQoTW90aW9uRXZlbnQgZXYpCisgICAgeworICAgICAgICBib29sZWFuIHJldCA9IGZhbHNlOworICAgICAgICBpbnQgYWN0ID0gZXYuZ2V0QWN0aW9uKCk7CisgICAgICAgIGlmIChhY3QgPT0gZXYuQUNUSU9OX0RPV04pIHsKKyAgICAgICAgICAgIG1SZW5kZXIub25BY3Rpb25Eb3duKChpbnQpZXYuZ2V0WCgpLCAoaW50KWV2LmdldFkoKSk7CisgICAgICAgICAgICByZXQgPSB0cnVlOworICAgICAgICB9CisgICAgICAgIGVsc2UgaWYgKGFjdCA9PSBldi5BQ1RJT05fTU9WRSkgeworICAgICAgICAgICAgbVJlbmRlci5vbkFjdGlvbk1vdmUoKGludClldi5nZXRYKCksIChpbnQpZXYuZ2V0WSgpKTsKKyAgICAgICAgICAgIHJldCA9IHRydWU7CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gcmV0OworICAgIH0KK30KKworCmRpZmYgLS1naXQgYS9saWJzL3JzL2phdmEvU2FtcGxlcy9zcmMvY29tL2FuZHJvaW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aW1pdGF0aW9ucyB1bmRlciB0aGUgTGljZW5zZS4KKworI3ByYWdtYSB2ZXJzaW9uKDEpCisKKyNwcmFnbWEgcnMgamF2YV9wYWNrYWdlX25hbWUoY29tLmFuZHJvaWQuc2FtcGxlcykKKworI2luY2x1ZGUgInJzX2dyYXBoaWNzLnJzaCIKKworZmxvYXQgZ0RZOworCityc19mb250IGdJdGFsaWM7CisKK3R5cGVkZWYgc3RydWN0IExpc3RBbGxvY3NfcyB7CisgICAgcnNfYWxsb2NhdGlvbiB0ZXh0OworfSBMaXN0QWxsb2NzOworCitMaXN0QWxsb2NzICpnTGlzdDsKKworI3ByYWdtYSBycyBleHBvcnRfdmFyKGdEWSwgZ0l0YWxpYywgZ0xpc3QpCisKK3ZvaWQgaW5pdCgpIHsKKyAgICBnRFkgPSAwLjBmOworfQorCitpbnQgdGV4dFBvcyA9IDA7CisKK2ludCByb290KGludCBsYXVuY2hJRCkgeworCisgICAgcnNnQ2xlYXJDb2xvcigwLjBmLCAwLjBmLCAwLjBmLCAwLjBmKTsKKyAgICByc2dDbGVhckRlcHRoKDEuMGYpOworCisgICAgdGV4dFBvcyAtPSAoaW50KWdEWSoyOworICAgIGdEWSAqPSAwLjk1OworCisgICAgcnNnRm9udENvbG9yKDAuOWYsIDAuOWYsIDAuOWYsIDEuMGYpOworICAgIHJzZ0JpbmRGb250KGdJdGFsaWMpOworICAgIGNvbG9yKDAuMiwgMC4yLCAwLjIsIDApOworCisgICAgcnNfYWxsb2NhdGlvbiBsaXN0QWxsb2MgPSByc0dldEFsbG9jYXRpb24oZ0xpc3QpOworICAgIGludCBhbGxvY1NpemUgPSByc0FsbG9jYXRpb25HZXREaW1YKGxpc3RBbGxvYyk7CisKKyAgICBpbnQgd2lkdGggPSByc2dHZXRXaWR0aCgpOworICAgIGludCBoZWlnaHQgPSByc2dHZXRIZWlnaHQoKTsKKworICAgIGludCBpdGVtSGVpZ2h0ID0gODA7CisgICAgaW50IGN1cnJlbnRZUG9zID0gaXR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ICAgIG1SUyA9IGNyZWF0ZVJlbmRlclNjcmlwdChmYWxzZSk7CisgICAgICAgICAgICBtUlMuY29udGV4dFNldFN1cmZhY2UodywgaCwgaG9sZGVyLmdldFN1cmZhY2UoKSk7CisgICAgICAgICAgICBtUmVuZGVyID0gbmV3IFJTVGVzdENvcmUoKTsKKyAgICAgICAgICAgIG1SZW5kZXIuaW5pdChtUlMsIGdldFJlc291cmNlcygpLCB3LCBoKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHByb3RlY3RlZCB2b2lkIG9uRGV0YWNoZWRGcm9tV2luZG93KCkgeworICAgICAgICBpZihtUlMgIT0gbnVsbCkgeworICAgICAgICAgICAgbVJTID0gbnVsbDsKKyAgICAgICAgICAgIGRlc3Ryb3lSZW5kZXJTY3JpcHQoKTsKKyAgICAgICAgfQorICAgIH0KKworLyoKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgYm9vbGVhbiBvblRvdWNoRXZlbnQoTW90aW9uRXZlbnQgZXYpCisgICAgeworICAgICAgICBpbnQgYWN0ID0gZXYuZ2V0QWN0aW9uTWFza2VkKCk7CisgICAgICAgIGlmIChhY3QgPT0gZXYuQUNUSU9OX1VQKSB7CisgICAgICAgICAgICBtUmVuZGVyLm5ld1RvdWNoUG9zaXRpb24oMCwgMCwgMCwgZXYuZ2V0UG9pbnRlcklkKDApKTsKKyAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgfSBlbHNlIGlmIChhY3QgPT0gTW90aW9uRXZlbnQuQUNUSU9OX1BPSU5URVJfVVApIHsKKyAgICAgICAgICAgIC8vIG9ubHkgb25lIHBvaW50ZXIgZ29pbmcgdXAsIHdlIGNhbiBnZXQgdGhlIGluZGV4IGxpa2UgdGhpcworICAgICAgICAgICAgaW50IHBvaW50ZXJJbmRleCA9IGV2LmdldEFjdGlvbkluZGV4KCk7CisgICAgICAgICAgICBpbnQgcG9pbnRlcklkID0gZXYuZ2V0UG9pbnRlcklkKHBvaW50ZXJJbmRleCk7CisgICAgICAgICAgICBtUmVuZGVyLm5ld1RvdWNoUG9zaXRpb24oMCwgMCwgMCwgcG9pbnRlcklkKTsKKyAgICAgICAgfQorICAgICAgICBpbnQgY291bnQgPSBldi5nZXRIaXN0b3J5U2l6ZSgpOworICAgICAgICBpbnQgcGNvdW50ID0gZXYuZ2V0UG9pbnRlckNvdW50KCk7CisKKyAgICAgICAgZm9yIChpbnQgcD0wOyBwIDwgcGNvdW50OyBwKyspIHsKKyAgICAgICAgICAgIGludCBpZCA9IGV2LmdldFBvaW50ZXJJZChwKTsKKyAgICAgICAgICAgIG1SZW5kZXIubmV3VG91Y2hQb3NpdGlvbihldi5nZXRYKHApLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2LmdldFkocCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXYuZ2V0UHJlc3N1cmUocCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQpOworCisgICAgICAgICAgICBmb3IgKGludCBpPTA7IGkgPCBjb3VudDsgaSsrKSB7CisgICAgICAgICAgICAgICAgbVJlbmRlci5uZXdUb3VjaFBvc2l0aW9uKGV2LmdldEhpc3RvcmljYWxYKHAsIGkpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBldi5nZXRIaXN0b3JpY2FsWShwLCBpKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXYuZ2V0SGlzdG9yaWNhbFByZXNzdXJlKHAsIGkpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIHRydWU7CisgICAgfQorICAgICovCit9CisKKwpkaWZmIC0tZ2l0IGEvbGlicy9ycy9qYXZhL3Rlc3RzL3NyYy9jb20vYW5kcm9pZC9ycy90ZXN0L2Zw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gICAgICAgICAgICAgIGRhdGFfZjRbaSs1XSAqIDAuMmYgKworICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhX2Y0W2krNl0gKiAwLjFmICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YV9mNFtpKzddICogMC4wNWYgKworICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhX2Y0W2krOF0gKiAwLjA0ZiArCisgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFfZjRbaSs5XSAqIDAuMDJmICsgMS5mKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIGZsb2F0IHRpbWUgPSBlbmQoaW5kZXgpOworICAgIHJzRGVidWcoImZwX21hZDQgTSBvcHMiLCAxMDAwLmYgLyB0aW1lKTsKK30KKworc3RhdGljIHZvaWQgdGVzdF9tYWQodWludDMyX3QgaW5kZXgpIHsKKyAgICBzdGFydCgpOworCisgICAgZmxvYXQgdG90YWwgPSAwOworICAgIC8vIERvIH4xIGJpbGxpb24gb3BzCisgICAgZm9yIChpbnQgY3Q9MDsgY3QgPCAxMDAwICogKDEwMDAgLyAyMCk7IGN0KyspIHsKKyAgICAgICAgZm9yIChpbnQgaT0wOyBpIDwgKDEwMDApOyBpKyspIHsKKyAgICAgICAgICAgIGRhdGFfZjFbaV0gPSAoZGF0YV9mMVtpXSAqIDAuMDJmICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YV9mMVtpKzFdICogMC4wNGYgKworICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhX2YxW2krMl0gKiAwLjA1ZiArCisgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFfZjFbaSszXSAqIDAuMWYgKworICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhX2YxW2krNF0gKiAwLjJmICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YV9mMVtpKzVdICogMC4yZiArCisgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFfZjFbaSs2XSAqIDAuMWYgKworICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhX2YxW2krN10gKiAwLjA1ZiArCisgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFfZjFbaSs4XSAqIDAuMDRmICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YV9mMVtpKzldICogMC4wMmYgKyAxLmYpOworICAgICAgICB9CisgICAgfQorCisgICAgZmxvYXQgdGltZSA9IGVuZChpbmRleCk7CisgICAgcnNEZWJ1ZygiZnBfbWFkIE0gb3BzIiwgMTAwMC5mIC8gdGltZSk7Cit9CisKK3N0YXRpYyB2b2lkIHRlc3Rfbm9ybSh1aW50MzJfdCBpbmRleCkgeworICAgIHN0YXJ0KCk7CisKKyAgICBmbG9hdCB0b3RhbCA9IDA7CisgICAgLy8gRG8gfjEwIE0gb3BzCisgICAgZm9yIChpbnQgY3Q9MDsgY3QgPCAxMDAwICogMTA7IGN0KyspIHsKKyAgICAgICAgZm9yIChpbnQgaT0wOyBpIDwgKDEwMDApOyBpKyspIHsKKyAgICAgICAgICAgIGRhdGFfZjRbaV0gPSBub3JtYWxpemUoZGF0YV9mNFtpXSk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBmbG9hdCB0aW1lID0gZW5kKGluZGV4KTsKKyAgICByc0RlYnVnKCJmcF9ub3JtIE0gb3BzIiwgMTAuZiAvIHRpbWUpOworfQorCitzdGF0aWMgdm9pZCB0ZXN0X3NpbmNvczQodWludDMyX3QgaW5kZXgpIHsKKyAgICBzdGFydCgpOworCisgICAgZmxvYXQgdG90YWwgPSAwOworICAgIC8vIERvIH4xMCBNIG9wcworICAgIGZvciAoaW50IGN0PTA7IGN0IDwgMTAwMCAqIDEwIC8gNDsgY3QrKykgeworICAgICAgICBmb3IgKGludCBpPTA7IGkgPCAoMTAwMCk7IGkrKykgeworICAgICAgICAgICAgZGF0YV9mNFtpXSA9IHNpbihkYXRhX2Y0W2ldKSAqIGNvcyhkYXRhX2Y0W2ldKTsKKyAgICAgICAgfQorICAgIH0KK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oaW50IGk9MDsgaSA8ICgxMDAwKTsgaSsrKSB7CisgICAgICAgICAgICBpZiAoZGF0YV9mMVtpXSA8IC0xLmYpIGRhdGFfZjFbaV0gPSAtMS5mOworICAgICAgICAgICAgaWYgKGRhdGFfZjFbaV0gPiAtMS5mKSBkYXRhX2YxW2ldID0gMS5mOworICAgICAgICB9CisgICAgfQorCisgICAgdGltZSA9IGVuZChpbmRleCk7CisgICAgcnNEZWJ1ZygiZnBfY2xhbXAgcmVmIE0gb3BzIiwgMTAwLmYgLyB0aW1lKTsKK30KKworc3RhdGljIHZvaWQgdGVzdF9jbGFtcDQodWludDMyX3QgaW5kZXgpIHsKKyAgICBzdGFydCgpOworCisgICAgZmxvYXQgdG90YWwgPSAwOworICAgIC8vIERvIH4xMDAgTSBvcHMKKyAgICBmb3IgKGludCBjdD0wOyBjdCA8IDEwMDAgKiAxMDAgLzQ7IGN0KyspIHsKKyAgICAgICAgZm9yIChpbnQgaT0wOyBpIDwgKDEwMDApOyBpKyspIHsKKyAgICAgICAgICAgIGRhdGFfZjRbaV0gPSBjbGFtcChkYXRhX2Y0W2ldLCAtMS5mLCAxLmYpOworICAgICAgICB9CisgICAgfQorCisgICAgZmxvYXQgdGltZSA9IGVuZChpbmRleCk7CisgICAgcnNEZWJ1ZygiZnBfY2xhbXA0IE0gb3BzIiwgMTAwLmYgLyB0aW1lKTsKK30KKwordm9pZCBkb1Rlc3QodWludDMyX3QgaW5kZXgsIGludCB0ZXN0X251bSkgeworICAgIGZvciAoaW50IHg9MDsgeCA8IDEwMjU7IHgrKykgeworICAgICAgICBkYXRhX2YxW3hdID0gKHggJiAweGYpICogMC4xZjsKKyAgICAgICAgZGF0YV9mNFt4XS54ID0gKHggJiAweGYpICogMC4xZjsKKyAgICAgICAgZGF0YV9mNFt4XS55ID0gKHggJiAweGYwKSAqIDAuMWY7CisgICAgICAgIGRhdGFfZjRbeF0ueiA9ICh4ICYgMHgzMykgKiAwLjFmOworICAgICAgICBkYXRhX2Y0W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0cmlkZTsKKyAgICB9Cit9CisKK3ZvaWQgQWxsb2NhdGlvbjo6ZGVjUmVmcyhjb25zdCB2b2lkICpwdHIsIHNpemVfdCBjdCkgY29uc3QKK3sKKyAgICBjb25zdCB1aW50OF90ICpwID0gc3RhdGljX2Nhc3Q8Y29uc3QgdWludDhfdCAqPihwdHIpOworICAgIGNvbnN0IEVsZW1lbnQgKmUgPSBtVHlwZS0+Z2V0RWxlbWVudCgpOworICAgIHVpbnQzMl90IHN0cmlkZSA9IGUtPmdldFNpemVCeXRlcygpOworCisgICAgd2hpbGUgKGN0ID4gMCkgeworICAgICAgICBlLT5kZWNSZWZzKHApOworICAgICAgICBjdCAtLTsKKyAgICAgICAgcCArPSBzdHJpZGU7CisgICAgfQorfQorCiAvLy8vLy8vLy8vLy8vLy8vLwogLy8KIApAQCAtNDk1LDcgKzYwNSw3IEBACiAgICAgaWYgKHNyY0dMVHlwZSA9PSBHTF9VTlNJR05FRF9CWVRFICYmCiAgICAgICAgIHNyY0dMRm10ID09IEdMX1JHQiAmJgogICAgICAgICBkc3RHTFR5cGUgPT0gR0xfVU5TSUdORURfU0hPUlRfNV82XzUgJiYKLSAgICAgICAgZHN0R0xUeXBlID09IEdMX1JHQikgeworICAgICAgICBkc3RHTEZtdCA9PSBHTF9SR0IpIHsKIAogICAgICAgICByZXR1cm4gZWxlbWVudENvbnZlcnRlcl84ODhfdG9fNTY1OwogICAgIH0KQEAgLTUwMywxNSArNjEzLDIxIEBACiAgICAgaWYgKHNyY0dMVHlwZSA9PSBHTF9VTlNJR05FRF9CWVRFICYmCiAgICAgICAgIHNyY0dMRm10ID09IEdMX1JHQkEgJiYKICAgICAgICAgZHN0R0xUeXBlID09IEdMX1VOU0lHTkVEX1NIT1JUXzVfNl81ICYmCi0gICAgICAgIGRzdEdMVHlwZSA9PSBHTF9SR0IpIHsKKyAgICAgICAgZHN0R0xGbXQgPT0gR0xfUkdCKSB7CiAKICAgICAgICAgcmV0dXJuIGVsZW1lbnRDb252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gICAgICAgICAgICAgIGNvbnN0IGZsb2F0ICppblZhbHVlcywgY29uc3QgZmxvYXQgKm91dFZhbHVlcywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMl90IHZhbHVlQ291bnQsIFJzQW5pbWF0aW9uSW50ZXJwb2xhdGlvbiBpbnRlcnAsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBSc0FuaW1hdGlvbkVkZ2UgcHJlLCBSc0FuaW1hdGlvbkVkZ2UgcG9zdCkKK3sKKyAgICBpZiAodmFsdWVDb3VudCA8IDIpIHsKKyAgICAgICAgcnNjLT5zZXRFcnJvcihSU19FUlJPUl9CQURfVkFMVUUsICJBbmltYXRpb25zIHJlcXVpcmUgbW9yZSB0aGFuIDIgdmFsdWVzLiIpOworICAgICAgICByZXR1cm4gTlVMTDsKKyAgICB9CisgICAgQW5pbWF0aW9uICphID0gbmV3IEFuaW1hdGlvbihyc2MpOworICAgIGlmICghYSkgeworICAgICAgICByc2MtPnNldEVycm9yKFJTX0VSUk9SX09VVF9PRl9NRU1PUlkpOworICAgICAgICByZXR1cm4gTlVMTDsKKyAgICB9CisKKyAgICBmbG9hdCAqdmluID0gKGZsb2F0ICopbWFsbG9jKHZhbHVlQ291bnQgKiBzaXplb2YoZmxvYXQpKTsKKyAgICBmbG9hdCAqdm91dCA9IChmbG9hdCAqKW1hbGxvYyh2YWx1ZUNvdW50ICogc2l6ZW9mKGZsb2F0KSk7CisgICAgYS0+bVZhbHVlc0lucHV0ID0gdmluOworICAgIGEtPm1WYWx1ZXNPdXRwdXQgPSB2b3V0OworICAgIGlmIChhLT5tVmFsdWVzSW5wdXQgPT0gTlVMTCB8fCBhLT5tVmFsdWVzT3V0cHV0ID09IE5VTEwpIHsKKyAgICAgICAgZGVsZXRlIGE7CisgICAgICAgIHJzYy0+c2V0RXJyb3IoUlNfRVJST1JfT1VUX09GX01FTU9SWSk7CisgICAgICAgIHJldHVybiBOVUxMOworICAgIH0KKworICAgIGEtPm1FZGdlUHJlID0gcHJlOworICAgIGEtPm1FZGdlUG9zdCA9IHBvc3Q7CisgICAgYS0+bUludGVycG9sYXRpb24gPSBpbnRlcnA7CisgICAgYS0+bVZhbHVlQ291bnQgPSB2YWx1ZUNvdW50OworCisgICAgbWVtY3B5KHZpbiwgaW5WYWx1ZXMsIHZhbHVlQ291bnQgKiBzaXplb2YoZmxvYXQpKTsKKyAgICBtZW1jcHkodm91dCwgb3V0VmFsdWVzLCB2YWx1ZUNvdW50ICogc2l6ZW9mKGZsb2F0KSk7CisgICAgYS0+bUlucHV0TWluID0gaW5WYWx1ZXNbMF07CisgICAgYS0+bUlucHV0TWF4ID0gaW5WYWx1ZXNbMF07CisKKyAgICBib29sIG5lZWRTb3J0ID0gZmFsc2U7CisgICAgZm9yICh1aW50MzJfdCBjdD0xOyBjdCA8IHZhbHVlQ291bnQ7IGN0KyspIHsKKyAgICAgICAgaWYgKGEtPm1JbnB1dE1pbiA+IHZpbltjdF0pIHsKKyAgICAgICAgICAgIG5lZWRTb3J0ID0gdHJ1ZTsKKyAgICAgICAgICAgIGEtPm1JbnB1dE1pbiA9IHZpbltjdF07CisgICAgICAgIH0KKyAgICAgICAgaWYgKGEtPm1JbnB1dE1heCA8IHZpbltjdF0pIHsKKyAgICAgICAgICAgIGEtPm1JbnB1dE1heCA9IHZpbltjdF07CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBuZWVkU29ydCA9IHRydWU7CisgICAgICAgIH0KKyAgICB9CisKKyAgICB3aGlsZSAoMSkgeworICAgICAgICBib29sIGNoYW5nZWQgPSBmYWxzZTsKKyAgICAgICAgZm9yICh1aW50MzJfdCBjdD0xOyBjdCA8IHZhbHVlQ291bnQ7IGN0KyspIHsKKyAgICAgICAgICAgIGlmICh2aW5bY3QtMV0gPiB2aW5bY3RdKSB7CisgICAgICAgICAgICAgICAgZmxvYXQgdCA9IHZpbltjdC0xXTsKKyAgICAgICAgICAgICAgICB2aW5bY3QtMV0gPSB2aW5bY3RdOworICAgICAgICAgICAgICAgIHZpbltjdF0gPSB0OworICAgICAgICAgICAgICAgIHQgPSB2b3V0W2N0LTFdOworICAgICAgICAgICAgICAgIHZvdXRbY3QtMV0gPSB2b3V0W2N0XTsKKyAgICAgICAgICAgICAgICB2b3V0W2N0XSA9IHQ7CisgICAgICAgICAgICAgICAgY2hhbmdlZCA9IHRydWU7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgaWYgKCFjaGFuZ2VkKSBicmVhazsKKyAgICB9CisKKyAgICByZXR1cm4gYTsKK30KKyovCisKKworLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8KKy8vCisKK25hbWVzcGFjZSBhbmRyb2lkIHsKK25hbWVzcGFjZSByZW5kZXJzY3JpcHQgeworCitSc0FuaW1hdGlvbiByc2lfQW5pbWF0aW9uQ3JlYXRlKENvbnRleHQgKnJzYywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZmxvYXQgKmluVmFsdWVzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBmbG9hdCAqb3V0VmFsdWVzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50MzJfdCB2YWx1ZUNvdW50LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBSc0FuaW1hdGlvbkludGVycG9sYXRpb24gaW50ZXJwLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBSc0FuaW1hdGlvbkVkZ2UgcHJlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBSc0FuaW1hdGlvbkVkZ2UgcG9zdCkKK3sKKyAgICAvL0xPR0UoInJzaV9FbGVtZW50Q3JlYXRlICVpICVpICVpICVpIiwgZHQsIGRrLCBub3JtLCB2ZWNTaXplKTsKKyAgICBBbmltYXRpb24gKmEgPSBOVUxMOy8vQW5pbWF0aW9uOjpjcmVhdGUocnNjLCBpblZhbHVlcywgb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luaXQocnNjKTsKICAgICAgfQogCkBAIC0zMjEsNiArMzI3LDExIEBACiAgICAgICAgICB1aW50MzJfdCB0YXJnZXRUaW1lID0gMDsKICAgICAgICAgIGlmIChtRHJhdyAmJiByc2MtPm1Jc0dyYXBoaWNzQ29udGV4dCkgewogICAgICAgICAgICAgIHRhcmdldFRpbWUgPSByc2MtPnJ1blJvb3RTY3JpcHQoKTsKKworICAgICAgICAgICAgIGlmKHJzYy0+cHJvcHMubUxvZ1Zpc3VhbCkgeworICAgICAgICAgICAgICAgICByc2MtPmRpc3BsYXlEZWJ1Z1N0YXRzKCk7CisgICAgICAgICAgICAgfQorCiAgICAgICAgICAgICAgbURyYXcgPSB0YXJnZXRUaW1lICYmICFyc2MtPm1QYXVzZWQ7CiAgICAgICAgICAgICAgcnNjLT50aW1lclNldChSU19USU1FUl9DTEVBUl9TV0FQKTsKICAgICAgICAgICAgICBlZ2xTd2FwQnVmZmVycyhyc2MtPm1FR0wubURpc3BsYXksIHJzYy0+bUVHTC5tU3VyZmFjZSk7CkBAIC0zMjksOSArMzQwLDYgQEAKICAgICAgICAgICAgICByc2MtPnRpbWVyUHJpbnQoKTsKICAgICAgICAgICAgICByc2MtPnRpbWVyUmVzZXQoKTsKICAgICAgICAgIH0KLSAgICAgICAgIGlmIChyc2MtPm1PYmpEZXN0cm95Lm1OZWVkVG9FbXB0eSkgewotICAgICAgICAgICAgIHJzYy0+b2JqRGVzdHJveU9PQlJ1bigpOwotICAgICAgICAgfQogICAgICAgICAgaWYgKHJzYy0+bVRocmVhZFByaW9yaXR5ID4gMCAmJiB0YXJnZXRUaW1lKSB7CiAgICAgICAgICAgICAgaW50MzJfdCB0ID0gKHRhcmdldFRpbWUgLSAoaW50MzJfdCkocnNjLT5tVGltZU1TTGFzdFNjcmlwdCArIHJzYy0+bVRpbWVNU0xhc3RTd2FwKSkgKiAxMDAwOwogICAgICAgICAgICAgIGlmICh0ID4gMCkgewpAQCAtMzQ2LDE3ICszNTQsMTYgQEAK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CiAKICAgICBib29sIGV4dF9PRVNfdGV4dHVyZV9ucG90KCkgY29uc3Qge3JldHVybiBtR0wuT0VTX3RleHR1cmVfbnBvdDt9CiAKKyAgICB2b2lkIGxhdW5jaFRocmVhZHMoV29ya2VyQ2FsbGJhY2tfdCBjYmssIHZvaWQgKmRhdGEpOworICAgIHVpbnQzMl90IGdldFdvcmtlclBvb2xTaXplKCkgY29uc3Qge3JldHVybiAodWludDMyX3QpbVdvcmtlcnMubVJ1bm5pbmdDb3VudDt9CisKIHByb3RlY3RlZDoKICAgICBEZXZpY2UgKm1EZXY7CiAKQEAgLTE3Nyw4ICsxODYsNiBAQAogICAgICAgICBFR0xDb25maWcgbUNvbmZpZzsKICAgICAgICAgRUdMQ29udGV4dCBtQ29udGV4dDsKICAgICAgICAgRUdMU3VyZmFjZSBtU3VyZmFjZTsKLSAgICAgICAgRUdMaW50IG1XaWR0aDsKLSAgICAgICAgRUdMaW50IG1IZWlnaHQ7CiAgICAgICAgIEVHTERpc3BsYXkgbURpc3BsYXk7CiAgICAgfSBtRUdMOwogCkBAIC0yMTksMjIgKzIyNiwyOCBAQAogICAgIHB0aHJlYWRfdCBtVGhyZWFkSWQ7CiAgICAgcGlkX3QgbU5hdGl2ZVRocmVhZElkOwogCisgICAgc3RydWN0IFdvcmtlcnMgeworICAgICAgICB2b2xhdGlsZSBpbnQgbVJ1bm5pbmdDb3VudDsKKyAgICAgICAgdm9sYXRpbGUgaW50IG1MYXVuY2hDb3VudDsKKyAgICAgICAgdWludDMyX3QgbUNvdW50OworICAgICAgICBwdGhyZWFkX3QgKm1UaHJlYWRJZDsKKyAgICAgICAgcGlkX3QgKm1OYXRpdmVUaHJlYWRJZDsKKyAgICAgICAgU2lnbmFsIG1Db21wbGV0ZVNpZ25hbDsKKworICAgICAgICBTaWduYWwgKm1MYXVuY2hTaWduYWxzOworICAgICAgICBXb3JrZXJDYWxsYmFja190IG1MYXVuY2hDYWxsYmFjazsKKyAgICAgICAgdm9pZCAqbUxh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JhbVZlcnRleCAqIGdldERlZmF1bHRQcm9ncmFtVmVydGV4KCkgY29uc3QgeworICAgICAgICByZXR1cm4gTlVMTDsKKyAgICB9CisgICAgUHJvZ3JhbVN0b3JlICogZ2V0RGVmYXVsdFByb2dyYW1TdG9yZSgpIGNvbnN0IHsKKyAgICAgICAgcmV0dXJuIE5VTEw7CisgICAgfQorICAgIFByb2dyYW1SYXN0ZXIgKiBnZXREZWZhdWx0UHJvZ3JhbVJhc3RlcigpIGNvbnN0IHsKKyAgICAgICAgcmV0dXJuIE5VTEw7CisgICAgfQorCisgICAgdWludDMyX3QgZ2V0V2lkdGgoKSBjb25zdCB7cmV0dXJuIDA7fQorICAgIHVpbnQzMl90IGdldEhlaWdodCgpIGNvbnN0IHtyZXR1cm4gMDt9CisKKyAgICAvLyBUaW1lcnMKKyAgICBlbnVtIFRpbWVycyB7CisgICAgICAgIFJTX1RJTUVSX0lETEUsCisgICAgICAgIFJTX1RJTUVSX0lOVEVSTkFMLAorICAgICAgICBSU19USU1FUl9TQ1JJUFQsCisgICAgICAgIFJTX1RJTUVSX0NMRUFSX1NXQVAsCisgICAgICAgIF9SU19USU1FUl9UT1RBTAorICAgIH07CisKKyAgICBib29sIGNoZWNrVmVyc2lvbjFfMSgpIGNvbnN0IHtyZXR1cm4gZmFsc2U7IH0KKyAgICBib29sIGNoZWNrVmVyc2lvbjJfMCgpIGNvbnN0IHtyZXR1cm4gZmFsc2U7IH0KKworICAgIHN0cnVjdCB7CisgICAgICAgIGJvb2wgbUxvZ1RpbWVzOworICAgICAgICBib29sIG1Mb2dTY3JpcHRzOworICAgICAgICBib29sIG1Mb2dPYmplY3RzOworICAgICAgICBib29sIG1Mb2dTaGFkZXJzOworICAgIH0gcHJvcHM7CisKKyAgICB2b2lkIGR1bXBEZWJ1ZygpIGNvbnN0IHsgICAgfQorICAgIHZvaWQgY2hlY2tFcnJvcihjb25zdCBjaGFyICopIGNvbnN0IHsgIH07CisgICAgdm9pZCBzZXRFcnJvcih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FscmVhZHkgZXhpc3RzCisgICAgZm9yICh1aW50MzJfdCBjdD0wOyBjdCA8IHJzYy0+bVN0YXRlRWxlbWVudC5tRWxlbWVudHMuc2l6ZSgpOyBjdCsrKSB7CisgICAgICAgIEVsZW1lbnQgKmVlID0gcnNjLT5tU3RhdGVFbGVtZW50Lm1FbGVtZW50c1tjdF07CisKKyAgICAgICAgaWYgKCFlZS0+Z2V0RmllbGRDb3VudCgpICkgeworCisgICAgICAgICAgICBpZigoZWUtPmdldENvbXBvbmVudCgpLmdldFR5cGUoKSA9PSBlbGVtLT5nZXRDb21wb25lbnQoKS5nZXRUeXBlKCkpICYmCisgICAgICAgICAgICAgICAoZWUtPmdldENvbXBvbmVudCgpLmdldEtpbmQoKSA9PSBlbGVtLT5nZXRDb21wb25lbnQoKS5nZXRLaW5kKCkpICYmCisgICAgICAgICAgICAgICAoZWUtPmdldENvbXBvbmVudCgpLmdldElzTm9ybWFsaXplZCgpID09IGVsZW0tPmdldENvbXBvbmVudCgpLmdldElzTm9ybWFsaXplZCgpKSAmJgorICAgICAgICAgICAgICAgKGVlLT5nZXRDb21wb25lbnQoKS5nZXRWZWN0b3JTaXplKCkgPT0gZWxlbS0+Z2V0Q29tcG9uZW50KCkuZ2V0VmVjdG9yU2l6ZSgpKSkgeworICAgICAgICAgICAgICAgIC8vIE1hdGNoCisgICAgICAgICAgICAgICAgZGVsZXRlIGVsZW07CisgICAgICAgICAgICAgICAgZWUtPmluY1VzZXJSZWYoKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gZWU7CisgICAgICAgICAgICB9CisKKyAgICAgICAgfSBlbHNlIGlmIChlZS0+Z2V0RmllbGRDb3VudCgpID09IGVsZW0tPm1GaWVsZENvdW50KSB7CisKKyAgICAgICAgICAgIGJvb2wgbWF0Y2ggPSB0cnVlOworICAgICAgICAgICAgZm9yICh1aW50MzJfdCBpPTA7IGkgPCBlbGVtLT5tRmllbGRDb3VudDsgaSsrKSB7CisgICAgICAgICAgICAgICAgaWYgKChlZS0+bUZpZWxkc1tpXS5lLmdldCgpICE9IGVsZW0tPm1GaWVsZHNbaV0uZS5nZXQoKSkgfHwKKyAgICAgICAgICAgICAgICAgICAgKGVlLT5tRmllbGRzW2ldLm5hbWUubGVuZ3RoKCkgIT0gZWxlbS0+bUZpZWxkc1tpXS5uYW1lLmxlbmd0aCgpKSB8fAorICAgICAgICAgICAgICAgICAgICAoZWUtPm1GaWVsZHNbaV0ubmFtZSAhPSBlbGVtLT5tRmllbGRzW2ldLm5hbWUpKSB7CisgICAgICAgICAgICAgICAgICAgIG1hdGNoID0gZmFsc2U7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmIChtYXRjaCkgeworICAgICAgICAgICAgICAgIGRlbGV0ZSBlbGVtOworICAgICAgICAgICAgICAgIGVlLT5pbmNVc2VyUmVmKCk7CisgICAgICAgICAgICAgICAgcmV0dXJuIGVlOworICAgICAgICAgICAgfQorCisgICAgICAgIH0KKyAgICB9CisKKyAgICByc2MtPm1TdGF0ZUVsZW1lbnQubUVsZW1lbnRzLnB1c2goZWxlbSk7CisgICAgcmV0dXJuIGVsZW07Cit9CisKIAogY29uc3QgRWxlbWVudCAqIEVsZW1lbnQ6OmNyZWF0ZShDb250ZXh0ICpyc2MsIFJzRGF0YVR5cGUgZHQsIFJzRGF0YUtpbmQgZGssCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpc05vcm0sIHVpbnQzMl90IHZlY1NpemUpCkBAIC0xMDQsNiArMTk0LDcgQEAKICAgICBFbGVtZW50ICplID0gbmV3IEVsZW1lbnQocnNjKTsKICAgICBlLT5tQ29tcG9uZW50LnNldChkdCwgZGssIGlzTm9ybSwgdmVjU2l6ZSk7CiAgICAgZS0+bUJpdHMgPSBlLT5tQ29tcG9uZW50LmdldEJpdHMoKTsKKyAgICBlLT5tSGFzUmVmZXJlbmNlID0gZS0+bUNvb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cG9uZW50LmlzUmVmZXJlbmNlKCkpIHsKKyAgICAgICAgICAgIE9iamVjdEJhc2UgKmNvbnN0Km9icCA9IHN0YXRpY19jYXN0PE9iamVjdEJhc2UgKmNvbnN0Kj4ocHRyKTsKKyAgICAgICAgICAgIE9iamVjdEJhc2UgKm9iID0gb2JwWzBdOworICAgICAgICAgICAgaWYgKG9iKSBvYi0+aW5jU3lzUmVmKCk7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuOworICAgIH0KKworICAgIGNvbnN0IHVpbnQ4X3QgKnAgPSBzdGF0aWNfY2FzdDxjb25zdCB1aW50OF90ICo+KHB0cik7CisgICAgZm9yICh1aW50MzJfdCBpPTA7IGkgPCBtRmllbGRDb3VudDsgaSsrKSB7CisgICAgICAgIGlmIChtRmllbGRzW2ldLmUtPm1IYXNSZWZlcmVuY2UpIHsKKyAgICAgICAgICAgIG1GaWVsZHNbaV0uZS0+aW5jUmVmcygmcFttRmllbGRzW2ldLm9mZnNldEJpdHMgPj4gM10pOworICAgICAgICB9CisgICAgfQorfQorCit2b2lkIEVsZW1lbnQ6OmRlY1JlZnMoY29uc3Qgdm9pZCAqcHRyKSBjb25zdAoreworICAgIGlmICghbUZpZWxkQ291bnQpIHsKKyAgICAgICAgaWYgKG1Db21wb25lbnQuaXNSZWZlcmVuY2UoKSkgeworICAgICAgICAgICAgT2JqZWN0QmFzZSAqY29uc3Qqb2JwID0gc3RhdGljX2Nhc3Q8T2JqZWN0QmFzZSAqY29uc3QqPihwdHIpOworICAgICAgICAgICAgT2JqZWN0QmFzZSAqb2IgPSBvYnBbMF07CisgICAgICAgICAgICBpZiAob2IpIG9iLT5kZWNTeXNSZWYoKTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm47CisgICAgfQorCisgICAgY29uc3QgdWludDhfdCAqcCA9IHN0YXRpY19jYXN0PGNvbnN0IHVpbnQ4X3QgKj4ocHRyKTsKKyAgICBmb3IgKHVpbnQzMl90IGk9MDsgaSA8IG1GaWVsZENv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WFpbmluZyAtPSBoZWFkZXJTaXplOworCisgICAgaWYobGVuZ3RoUmVtYWluaW5nIDwgc2l6ZW9mKG1EYXRhU2l6ZSkpIHsKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIC8vIFJlYWQgdGhlIHNpemUgb2YgdGhlIGRhdGEKKyAgICBtZW1jcHkoJm1EYXRhU2l6ZSwgbG9jYWxEYXRhLCBzaXplb2YobURhdGFTaXplKSk7CisgICAgbG9jYWxEYXRhICs9IHNpemVvZihtRGF0YVNpemUpOworICAgIGxlbmd0aFJlbWFpbmluZyAtPSBzaXplb2YobURhdGFTaXplKTsKKworICAgIExPR0UoIkxvYWRpbmcgZGF0YSwgbURhdGFTaXplID0gJWxsaSIsIG1EYXRhU2l6ZSk7CisKKyAgICBpZihsZW5ndGhSZW1haW5pbmcgPCBtRGF0YVNpemUpIHsKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIC8vIFdlIHNob3VsZCBrbm93IGVub3VnaCB0byByZWFkIHRoZSBmaWxlIGluIGF0IHRoaXMgcG9pbnQuCisgICAgbUFsbG9jID0gbWFsbG9jKG1EYXRhU2l6ZSk7CisgICAgaWYgKCFtQWxsb2MpIHsKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKyAgICBtRGF0YSA9ICh1aW50OF90ICopbUFsbG9jOworICAgIG1lbWNweShtQWxsb2MsIGxvY2FsRGF0YSwgbURhdGFTaXplKTsKKworICAgIG1SZWFkU3RyZWFtID0gbmV3IElTdHJlYW0obURhdGEsIG1Vc2U2NEJpdE9mZnNldHMpOworCisgICAgcmV0dXJuIHRydWU7Cit9CisKK2Jvb2wgRmlsZUEzRDo6bG9hZChGSUxFICpmKQogewogICAgIGNoYXIgbWFnaWNTdHJpbmdbMTJdOwogICAgIHNpemVfdCBsZW47CkBAIC00OSw0NyArMTc2LDM5IEBACiAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICB9CiAKLSAgICBMT0dFKC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mNyZWF0ZUZyb21TdHJlYW0obVJTQywgbVJlYWRTdHJlYW0pOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgUlNfQTNEX0NMQVNTX0lEX1NBTVBMRVI6CisgICAgICAgICAgICBlbnRyeS0+bVJzT2JqID0gU2FtcGxlcjo6Y3JlYXRlRnJvbVN0cmVhbShtUlNDLCBtUmVhZFN0cmVhbSk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBSU19BM0RfQ0xBU1NfSURfQU5JTUFUSU9OOgorICAgICAgICAgICAgZW50cnktPm1Sc09iaiA9IEFuaW1hdGlvbjo6Y3JlYXRlRnJvbVN0cmVhbShtUlNDLCBtUmVhZFN0cmVhbSk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBSU19BM0RfQ0xBU1NfSURfTElHSFQ6CisgICAgICAgICAgICBlbnRyeS0+bVJzT2JqID0gTGlnaHQ6OmNyZWF0ZUZyb21TdHJlYW0obVJTQywgbVJlYWRTdHJlYW0pOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgUlNfQTNEX0NMQVNTX0lEX0FEQVBURVJfMUQ6CisgICAgICAgICAgICBlbnRyeS0+bVJzT2JqID0gQWRhcHRlcjFEOjpjcmVhdGVGcm9tU3RyZWFtKG1SU0MsIG1SZWFkU3RyZWFtKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIFJTX0EzRF9DTEFTU19JRF9BREFQVEVSXzJEOgorICAgICAgICAgICAgZW50cnktPm1Sc09iaiA9IEFkYXB0ZXIyRDo6Y3JlYXRlRnJvbVN0cmVhbShtUlNDLCBtUmVhZFN0cmVhbSk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBSU19BM0RfQ0xBU1NfSURfU0NSSVBUX0M6CisgICAgICAgICAgICByZXR1cm4gTlVMTDsKKyAgICB9CisgICAgaWYoZW50cnktPm1Sc09iaikgeworICAgICAgICBlbnRyeS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gc3RydWN0IEEzREluZGV4RW50cnkgewotICAgICAgICBTdHJpbmc4IG1JRDsKLSAgICAgICAgQTNEQ2h1bmtUeXBlIG1UeXBlOworICAgIGNsYXNzIEEzREluZGV4RW50cnkgeworICAgICAgICBTdHJpbmc4IG1PYmplY3ROYW1lOworICAgICAgICBSc0EzRENsYXNzSUQgbVR5cGU7CiAgICAgICAgIHVpbnQ2NF90IG1PZmZzZXQ7Ci0gICAgICAgIHZvaWQgKiBtUnNPYmo7CisgICAgICAgIHVpbnQ2NF90IG1MZW5ndGg7CisgICAgICAgIE9iamVjdEJhc2UgKm1Sc09iajsKKyAgICBwdWJsaWM6CisgICAgICAgIGZyaWVuZCBjbGFzcyBGaWxlQTNEOworICAgICAgICBjb25zdCBTdHJpbmc4ICZnZXRPYmplY3ROYW1lKCkgY29uc3QgeworICAgICAgICAgICAgcmV0dXJuIG1PYmplY3ROYW1lOworICAgICAgICB9CisgICAgICAgIFJzQTNEQ2xhc3NJRCBnZXRUeXBlKCkgY29uc3QgeworICAgICAgICAgICAgcmV0dXJuIG1UeXBlOworICAgICAgICB9CiAgICAgfTsKIAotICAgIGJvb2wgbG9hZChDb250ZXh0ICpyc2MsIEZJTEUgKmYpOworICAgIGJvb2wgbG9hZChGSUxFICpmKTsKKyAgICBib29sIGxvYWQoY29uc3Qgdm9pZCAqZGF0YSwgc2l6ZV90IGxlbmd0aCk7CisKKyAgICBzaXplX3QgZ2V0TnVtSW5kZXhFbnRyaWVzKCkgY29uc3Q7CisgICAgY29uc3QgQTNESW5kZXhFbnRyeSogZ2V0SW5kZXhFbnRyeShzaXplX3QgaW5kZXgpIGNvbnN0OworICAgIE9iamVjdEJhc2UgKmluaXRpYWxpemVGcm9tRW50cnkoc2l6ZV90IGluZGV4KTsKKworICAgIHZvaWQgYXBwZW5kVG9GaWxlKE9iamVjdEJhc2UgKm9iaik7CisgICAgYm9vbCB3cml0ZUZpbGUoY29uc3QgY2hhciAqZmlsZW5hbWUpOworCisgICAgLy8gQ3VycmVudGx5IGZpbGVzIGRvIG5vdCBnZXQgc2VyaWFsaXplZCwKKyAgICAvLyBidXQgd2UgbmVlZCB0byBpbmhlcml0IGZyb20gT2JqZWN0QmFzZSBmb3IgcmVmIHRyYWNraW5nCisgICAgdmlydHVhbCB2b2lkIHNlcmlhbGl6ZShPU3RyZWFtICpzdHJlYW0pIGNvbnN0IHsKKyAgICB9CisgICAgdmlydHVhbCBSc0EzRENsYXNzSUQgZ2V0Q2xhc3NJZCgpIGNvbnN0IHsKKyAgICAgICAgcmV0dXJuIFJTX0EzRF9DTEFTU19JRF9VTktOT1dOOworICAgIH0KIAogcHJvdGVjdGVkOgotICAgIGNsYXNzIElPCi0gICAgewotICAgIHB1YmxpYzoKLSAgICAgICAgSU8oY29uc3QgdWludDhfdCAqLCBib29sIHVzZTY0KTsKLSAgICAKLSAgICAgICAgZmxvYXQgbG9hZEYoKSB7Ci0gICAgICAgICAgICBtUG9zID0gKG1Qb3MgKyAzKSAmICh+Myk7Ci0gICAgICAgICAgICBmbG9hdCB0bXAgPSByZWludGVycHJldF9jYXN0PGNvbnN0IGZsb2F0ICo+KCZtRGF0YVttUG9zXSlbMF07Ci0gICAgICAgICAgICBtUG9zICs9IHNpemVvZihmbG9hdCk7Ci0gICAgICAgICAgICByZXR1cm4gdG1wOwotICAgICAgICB9Ci0gICAgICAgIGludDMyX3QgbG9hZEkzMigpIHsKLSAgICAgICAgICAgIG1Qb3MgPSAobVBvcyArIDMpICYgKH4zKTsKLSAgICAgICAgICAgIGludDMyX3QgdG1wID0gcmVpbnRlcnByZXRfY2FzdDxjb25zdCBpbnQzMl90ICo+KCZtRGF0YVttUG9zXSlbMF07Ci0gICAgICAgICAgICBtUG9zICs9IHNpemVvZihpbnQzMl90KTsKLSAgICAgICAgICAgIHJldHVybiB0bXA7Ci0gICAgICAgIH0KLSAgICAgICAgdWludDMyX3QgbG9hZFUzMigpIHsKLSAgICAgICAgICAgIG1Qb3MgPSAobVBvcyArIDMpICYgKH4z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NjKSA6IE9iamVjdEJhc2UocnNjKSwgbUNhY2hlZEdseXBocyhOVUxMKQoreworICAgIG1BbGxvY0ZpbGUgPSBfX0ZJTEVfXzsKKyAgICBtQWxsb2NMaW5lID0gX19MSU5FX187CisgICAgbUluaXRpYWxpemVkID0gZmFsc2U7CisgICAgbUhhc0tlcm5pbmcgPSBmYWxzZTsKKyAgICBtRmFjZSA9IE5VTEw7Cit9CisKK2Jvb2wgRm9udDo6aW5pdChjb25zdCBjaGFyICpuYW1lLCB1aW50MzJfdCBmb250U2l6ZSwgdWludDMyX3QgZHBpKQoreworICAgIGlmKG1Jbml0aWFsaXplZCkgeworICAgICAgICBMT0dFKCJSZWluaXRpYWxpemF0aW9uIG9mIGZvbnRzIG5vdCBzdXBwb3J0ZWQiKTsKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIFN0cmluZzggZm9udHNEaXIoIi9mb250cy8iKTsKKyAgICBTdHJpbmc4IGZ1bGxQYXRoKGdldGVudigiQU5EUk9JRF9ST09UIikpOworICAgIGZ1bGxQYXRoICs9IGZvbnRzRGlyOworICAgIGZ1bGxQYXRoICs9IG5hbWU7CisKKyAgICBGVF9FcnJvciBlcnJvciA9IEZUX05ld19GYWNlKG1SU0MtPm1TdGF0ZUZvbnQuZ2V0TGliKCksIGZ1bGxQYXRoLnN0cmluZygpLCAwLCAmbUZhY2UpOworICAgIGlmKGVycm9yKSB7CisgICAgICAgIExPR0UoIlVuYWJsZSB0byBpbml0aWFsaXplIGZvbnQgJXMiLCBmdWxsUGF0aC5zdHJpbmcoKSk7CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisKKyAgICBtRm9udE5hbWUgPSBuYW1lOworICAgIG1Gb250U2l6ZSA9IGZvbnRTaXplOworICAgIG1EcGkgPSBkcGk7CisKKyAgICBlcnJvciA9IEZUX1NldF9DaGFyX1NpemUobUZhY2UsIGZvbnRTaXplICogNjQsIDAsIGRwaSwgMCk7CisgICAgaWYoZXJyb3IpIHsKKyAgICAgICAgTE9HRSgiVW5hYmxlIHRvIHNldCBmb250IHNpemUgb24gJXMiLCBmdWxsUGF0aC5zdHJpbmcoKSk7CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisKKyAgICBtSGFzS2VybmluZyA9IEZUX0hBU19LRVJOSU5HKG1GYWNlKTsKKworICAgIG1Jbml0aWFsaXplZCA9IHRydWU7CisgICAgcmV0dXJuIHRydWU7Cit9CisKK3ZvaWQgRm9udDo6aW52YWxpZGF0ZVRleHR1cmVDYWNoZSgpCit7CisgICAgZm9yKHVpbnQzMl90IGkgPSAwOyBpIDwgbUNhY2hlZEdseXBocy5zaXplKCk7IGkgKyspIHsKKyAgICAgICAgbUNhY2hlZEdseXBocy52YWx1ZUF0KGkpLT5tSXNWYWxpZCA9IGZhbHNlOworICAgIH0KK30KKwordm9pZCBGb250OjpkcmF3Q2FjaGVkR2x5cGgoQ2FjaGVkR2x5cGhJbmZvICpnbHlwaCwgaW50IHgsIGludCB5KQoreworICAgIEZvbnRTdGF0ZSAqc3RhdGUgPSAmbVJTQy0+bVN0YXRlRm9udDsKKworICAgIGludCBuUGVuWCA9IHggKyBnbHlwaC0+bUJpdG1hcExlZnQ7CisgICAgaW50IG5QZW5ZID0geSAtIGdseXBoLT5tQml0bWFwVG9wICsgZ2x5cGgtPm1CaXRtYXBIZWlnaHQ7CisKKyAgICBzdGF0ZS0+YXBwZW5kTWVzaFF1YWQoblBlblgsIG5QZW5ZLCAwLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdseXBoLT5tQml0bWFwTWluVSwgZ2x5cGgtPm1CaXRtYXBNYXhWLAorCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgblBlblggKyAoaW50KWdseXBoLT5tQml0bWFwV2lkdGgsIG5QZW5ZLCAwLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdseXBoLT5tQml0bWFwTWF4VSwgZ2x5cGgtPm1CaXRtYXBNYXhWLAorCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgblBlblggKyAoaW50KWdseXBoLT5tQml0bWFwV2lkdGgsIG5QZW5ZIC0gKGludClnbHlwaC0+bUJpdG1hcEhlaWdodCwgMCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBnbHlwaC0+bUJpdG1hcE1heFUsIGdseXBoLT5tQml0bWFwTWluViwKKworICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5QZW5YLCBuUGVuWSAtIChpbnQpZ2x5cGgtPm1CaXRtYXBIZWlnaHQsIDAsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2x5cGgtPm1CaXRtYXBNaW5VLCBnbHlwaC0+bUJpdG1hcE1pblYpOworfQorCit2b2lkIEZvbnQ6OnJlbmRlclVURihjb25zdCBjaGFyICp0ZXh0LCB1aW50MzJfdCBsZW4sIHVpbnQzMl90IHN0YXJ0LCBpbnQgbnVtR2x5cGhzLCBpbnQgeCwgaW50IHkpCit7CisgICAgaWYoIW1Jbml0aWFsaXplZCB8fCBudW1HbHlwaHMgPT0gMCB8fCB0ZXh0ID09IE5VTEwgfHwgbGVuID09IDApIHsKKyAgICAgICAgcmV0dXJuOworICAgIH0KKworICAgIGludCBwZW5YID0geCwgcGVuWSA9IHk7CisgICAgaW50IGdseXBoc0xlZnQgPSAxOworICAgIGlmKG51bUdseXBocyA+IDApIHsKKyAgICAgICAgZ2x5cGhzTGVmdCA9IG51bUdseXBoczsKKyAgICB9CisKKyAgICBzaXplX3QgaW5kZXggPSBzdGFydDsKKyAgICBzaXplX3QgbmV4dEluZGV4ID0gMDsKKworICAgIHdoaWxlIChnbHlwaHNMZWZ0ID4gMCkgeworCisgICAgICAgIGludDMyX3QgdXRmQ2hhciA9IHV0ZjMyX2F0KHRleHQsIGxlbiwgaW5kZXgsICZuZXh0SW5kZXgpOworCisgICAgICAgIC8vIFJlYWNoZWQgdGhlIGVuZCBvZiB0aGUgc3RyaW5nIG9yIGVuY291bnRlcmVkCisgICAgICAgIGlmKHV0ZkNoYXIgPCAwKSB7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorCisgICAgICAgIC8vIE1vdmUgdG8gdGhlIG5leHQgY2hhcmFjdGVyIGluIHRoZSBhcnJheQorICAgICAgICBpbmRleCA9IG5leHRJbmRleDsKKworICAgICAgICBDYWNoZWRHbHlwaEluZm8gKmNhY2hlZEdseXBoID0gZ2V0Q2FjaGVkVVRGQ2hhcih1dGZDaGFyKTsKKworICAgICAgICAvLyBJZiBpdCdzIHN0aWxsIG5vdCB2YWxpZCwgd2UgY291bGRuJ3QgY2FjaGUgaXQsIHNvIHdlIHNob3VsZG4ndCBkcmF3IGdhcmJhZ2UKKyAgICAgICAgaWYoY2FjaGVkR2x5cGgtPm1Jc1ZhbGlkKSB7CisgICAgICAgICAgICBkcmF3Q2FjaGVkR2x5cGgoY2FjaGVkR2x5cGgsIHBlblgsIHBlblkpOworICAgICAgICB9CisKKyAgICAgICAgcGVuWCArPSAoY2FjaGVkR2x5cGgtPm1BZHZhbmNlLnggPj4gNik7CisKKyAgICAgICAgLy8gSWYgd2Ugd2VyZSBnaXZlbiBhIHNwZWNpZmljIG51bWJlciBvZiBnbHlwaHMsIGRlY3JlbWVudAorICAgICAgICBpZihudW1HbHlwaHMgPiAwKSB7CisgICAgICAgICAgICBnbHlwaHNMZWZ0IC0tOworICAgICAgICB9CisgICAgfQorfQorCitGb250OjpDYWNoZWRHbHlwaEluZm8qIEZvbnQ6OmdldENhY2hlZFVURkNoYXIoaW50MzJfdCB1dGZDaGFyKSB7CisKKyAgICBDYWNoZWRHbHlwaEluZm8gKmNhY2hlZEdseXBoID0gbUNhY2hlZEdseXBocy52YWx1ZUZvcigodWludDMyX3QpdXRmQ2hhcik7CisgICAgaWYoY2FjaGVkR2x5cGggPT0gTlVMTCkgeworICAgICAgICBjYWNoZWRHbHlwaCA9IGNhY2hlR2x5cGgoKHVpbnQzMl90KXV0ZkNoYXIpOworICAgIH0KKyAgICAvLyBJcyB0aGUgZ2x5cGggc3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m8oKTsKKyAgICBtQ2FjaGVkR2x5cGhzLmFkZChnbHlwaCwgbmV3R2x5cGgpOworCisgICAgbmV3R2x5cGgtPm1HbHlwaEluZGV4ID0gRlRfR2V0X0NoYXJfSW5kZXgobUZhY2UsIGdseXBoKTsKKyAgICBuZXdHbHlwaC0+bUlzVmFsaWQgPSBmYWxzZTsKKworICAgIHVwZGF0ZUdseXBoQ2FjaGUobmV3R2x5cGgpOworCisgICAgcmV0dXJuIG5ld0dseXBoOworfQorCitGb250ICogRm9udDo6Y3JlYXRlKENvbnRleHQgKnJzYywgY29uc3QgY2hhciAqbmFtZSwgdWludDMyX3QgZm9udFNpemUsIHVpbnQzMl90IGRwaSkKK3sKKyAgICByc2MtPm1TdGF0ZUZvbnQuY2hlY2tJbml0KCk7CisgICAgVmVjdG9yPEZvbnQqPiAmYWN0aXZlRm9udHMgPSByc2MtPm1TdGF0ZUZvbnQubUFjdGl2ZUZvbnRzOworCisgICAgZm9yKHVpbnQzMl90IGkgPSAwOyBpIDwgYWN0aXZlRm9udHMuc2l6ZSgpOyBpICsrKSB7CisgICAgICAgIEZvbnQgKml0aEZvbnQgPSBhY3RpdmVGb250c1tpXTsKKyAgICAgICAgaWYoaXRoRm9udC0+bUZvbnROYW1lID09IG5hbWUgJiYgaXRoRm9udC0+bUZvbnRTaXplID09IGZvbnRTaXplICYmIGl0aEZvbnQtPm1EcGkgPT0gZHBpKSB7CisgICAgICAgICAgICByZXR1cm4gaXRoRm9udDsKKyAgICAgICAgfQorICAgIH0KKworICAgIEZvbnQgKm5ld0ZvbnQgPSBuZXcgRm9udChyc2MpOworICAgIGJvb2wgaXNJbml0aWFsaXplZCA9IG5ld0ZvbnQtPmluaXQobmFtZSwgZm9udFNpemUsIGRwaSk7CisgICAgaWYoaXNJbml0aWFsaXplZCkgeworICAgICAgICBhY3RpdmVGb250cy5wdXNoKG5ld0ZvbnQpOworICAgICAgICByc2MtPm1TdGF0ZUZvbnQucHJlY2FjaGVMYXRpbihuZXdGb250KTsKKyAgICAgICAgcmV0dXJuIG5ld0ZvbnQ7CisgICAgfQorCisgICAgZGVsZXRlIG5ld0ZvbnQ7CisgICAgcmV0dXJuIE5VTEw7CisKK30KKworRm9udDo6fkZvbnQoKQoreworICAgIGlmKG1GYWNlKSB7CisgICAgICAgIEZUX0RvbmVfRmFjZShtRmFjZSk7CisgICAgfQorCisgICAgZm9yICh1aW50MzJfdCBjdCA9IDA7IGN0IDwgbVJTQy0+bVN0YXRlRm9udC5tQWN0aXZlRm9udHMuc2l6ZSgpOyBjdCsrKSB7CisgICAgICAgIGlmIChtUlNDLT5tU3RhdGVGb250Lm1BY3RpdmVGb250c1tjdF0gPT0gdGhpcykgeworICAgICAgICAgICAgbVJTQy0+bVN0YXRlRm9udC5tQWN0aXZlRm9udHMucmVtb3ZlQXQoY3QpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBmb3IodWludDMyX3QgaSA9IDA7IGkgPCBtQ2FjaGVkR2x5cGhzLnNpemUoKTsgaSArKykgeworICAgICAgICBDYWNoZWRHbHlwaEluZm8gKmdseXBoID0gbUNhY2hlZEdseXBocy52YWx1ZUF0KGkpOworICAgICAgICBkZWxldGUgZ2x5cGg7CisgICAgfQorfQorCitGb250U3RhdGU6OkZvbnRTdGF0ZSgpCit7CisgICAgbUluaXRpYWxpemVkID0gZmFsc2U7CisgICAgbU1heE51bWJlck9mUXVhZHMgPSAxMDI0OworICAgIG1DdXJyZW50UXVhZEluZGV4ID0gMDsKKyAgICBtUlNDID0gTlVMTDsKKyAgICBtTGlicmFyeSA9IE5VTEw7CisgICAgc2V0Rm9udENvbG9yKDAuMWYsIDAuMWYsIDAuMWYsIDEuMGYpOworfQorCitGb250U3RhdGU6On5Gb250U3RhdGUoKQoreworICAgIGZvcih1aW50MzJfdCBpID0gMDsgaSA8IG1DYWNoZUxpbmVzLnNpemUoKTsgaSArKykgeworICAgICAgICBkZWxldGUgbUNhY2hlTGluZXNbaV07Cisg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ArKykgeworICAgICAgICAgICAgYml0bWFwRml0ID0gbUNhY2hlTGluZXNbaV0tPmZpdEJpdG1hcChiaXRtYXAsICZzdGFydFgsICZzdGFydFkpOworICAgICAgICAgICAgaWYoYml0bWFwRml0KSB7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICAvLyBpZiB3ZSBzdGlsbCBkb24ndCBmaXQsIHNvbWV0aGluZyBpcyB3cm9uZyBhbmQgd2Ugc2hvdWxkbid0IGRyYXcKKyAgICAgICAgaWYoIWJpdG1hcEZpdCkgeworICAgICAgICAgICAgTE9HRSgiQml0bWFwIGRvZXNuJ3QgZml0IGluIGNhY2hlLiB3aWR0aCwgaGVpZ2h0ID0gJWksICVpIiwgKGludCliaXRtYXAtPndpZHRoLCAoaW50KWJpdG1hcC0+cm93cyk7CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAqcmV0T3JpZ2luWCA9IHN0YXJ0WDsKKyAgICAqcmV0T3JpZ2luWSA9IHN0YXJ0WTsKKworICAgIHVpbnQzMl90IGVuZFggPSBzdGFydFggKyBiaXRtYXAtPndpZHRoOworICAgIHVpbnQzMl90IGVuZFkgPSBzdGFydFkgKyBiaXRtYXAtPnJvd3M7CisKKyAgICB1aW50MzJfdCBjYWNoZVdpZHRoID0gZ2V0Q2FjaGVUZXh0dXJlVHlwZSgpLT5nZXREaW1YKCk7CisKKyAgICB1bnNpZ25lZCBjaGFyICpjYWNoZUJ1ZmZlciA9ICh1bnNpZ25lZCBjaGFyKiltVGV4dFRleHR1cmUtPmdldFB0cigpOworICAgIHVuc2lnbmVkIGNoYXIgKmJpdG1hcEJ1ZmZlciA9IGJpdG1hcC0+YnVmZmVyOworCisgICAgdWludDMyX3QgY2FjaGVYID0gMCwgYlggPSAwLCBjYWNoZVkgPSAwLCBiWSA9IDA7CisgICAgZm9yKGNhY2hlWCA9IHN0YXJ0WCwgYlgg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WVudCAqKXRtcEYuZ2V0KCkpOworICAgIG1SU0MtPnNldEZyYWdtZW50U3RvcmUoKFByb2dyYW1TdG9yZSAqKXRtcFBTLmdldCgpKTsKK30KKwordm9pZCBGb250U3RhdGU6OmFwcGVuZE1lc2hRdWFkKGZsb2F0IHgxLCBmbG9hdCB5MSwgZmxvYXQgejEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgdTEsIGZsb2F0IHYxLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsb2F0IHgyLCBmbG9hdCB5MiwgZmxvYXQgejIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgdTIsIGZsb2F0IHYyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsb2F0IHgzLCBmbG9hdCB5MywgZmxvYXQgejMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgdTMsIGZsb2F0IHYzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsb2F0IHg0LCBmbG9hdCB5NCwgZmxvYXQgejQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgdTQsIGZsb2F0IHY0KQoreworICAgIGNvbnN0IHVpbnQzMl90IHZlcnRzUGVyUXVhZCA9IDQ7CisgICAgY29uc3QgdWludDMyX3QgZmxvYXRzUGVyVmVydCA9IDU7CisgICAgZmxvYXQgKmN1cnJlbnRQb3MgPSBtVGV4dE1lc2hQdHIgKyBtQ3VycmVudFF1YWRJbmRleCAqIHZlcnRzUGVyUXVhZCAqIGZsb2F0c1BlclZlcnQ7CisKKyAgICAvLyBDdWxsIHRoaW5ncyB0aGF0IGFyZSBvZmYgdGhlIHNjcmVlbgorICAgIGZsb2F0IHdpZHRoID0gKGZsb2F0KW1SU0MtPmdldFdpZHRoKCk7CisgICAgZmxvYXQgaGVpZ2h0ID0gKGZsb2F0KW1SU0MtPmdldEhlaWdodCgpOworCisgICAgaWYoeDEgPiB3aWR0aCB8fCB5MSA8IDAuMGYgfHwgeDIgPCAwIHx8IHk0ID4gaGVpZ2h0KSB7CisgICAgICAgIHJldHVybjsKKyAgICB9CisKKyAgICAvKkxPR0UoIlYwIHg6ICVmIHk6ICVmIHo6ICVmIiwgeDEsIHkxLCB6MSk7CisgICAgTE9HRSgiVjEgeDogJWYgeTogJWYgejogJWYiLCB4MiwgeTIsIHoyKTsKKyAgICBMT0dFKCJWMiB4OiAlZiB5OiAlZiB6OiAlZiIsIHgzLCB5MywgejMpOworICAgIExPR0UoIlYzIHg6ICVmIHk6ICVmIHo6ICVmIiwgeDQsIHk0LCB6NCk7Ki8KKworICAgICgqY3VycmVudFBvcysrKSA9IHgxOworICAgICgqY3VycmVudFBvcysrKSA9IHkxOworICAgICgqY3VycmVudFBvcysrKSA9IHoxOworICAgICgqY3VycmVudFBvcysrKSA9IHUxOworICAgICgqY3VycmVudFBvcysrKSA9IHYxOworCisgICAgKCpjdXJyZW50UG9zKyspID0geDI7CisgICAgKCpjdXJyZW50UG9zKyspID0geTI7CisgICAgKCpjdXJyZW50UG9zKyspID0gejI7CisgICAgKCpjdXJyZW50UG9zKyspID0gdTI7CisgICAgKCpjdXJyZW50UG9zKyspID0gdjI7CisKKyAgICAoKmN1cnJlbnRQb3MrKykgPSB4MzsKKyAgICAoKmN1cnJlbnRQb3MrKykgPSB5MzsKKyAgICAoKmN1cnJlbnRQb3MrKykgPSB6MzsKKyAgICAoKmN1cnJlbnRQb3MrKykgPSB1MzsKKyAgICAoKmN1cnJlbnRQb3MrKykgPSB2MzsKKworICAgICgqY3VycmVudFBvcysrKSA9IHg0OworICAgICgqY3VycmVudFBvcysrKSA9IHk0OworICAgICgqY3VycmVudFBvcysrKSA9IHo0OworICAgICgqY3VycmVudFBvcysrKSA9IHU0OworICAgICgqY3VycmVudFBvcysrKSA9IHY0OworCisgICAgbUN1cnJlbnRRdWFkSW5kZXggKys7CisKKyAgICBpZihtQ3V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nQzMl90KW1MYXRpblByZWNhY2hlW3ByZWNhY2hlSWR4XSk7CisgICAgICAgIHJlbWFpbmluZ0NhcGFjaXR5ID0gZ2V0UmVtYWluaW5nQ2FjaGVDYXBhY2l0eSgpOworICAgICAgICBwcmVjYWNoZUlkeCArKzsKKyAgICB9Cit9CisKKwordm9pZCBGb250U3RhdGU6OnJlbmRlclRleHQoY29uc3QgY2hhciAqdGV4dCwgdWludDMyX3QgbGVuLCB1aW50MzJfdCBzdGFydEluZGV4LCBpbnQgbnVtR2x5cGhzLCBpbnQgeCwgaW50IHkpCit7CisgICAgY2hlY2tJbml0KCk7CisKKyAgICAvLyBSZW5kZXIgY29kZSBoZXJlCisgICAgRm9udCAqY3VycmVudEZvbnQgPSBtUlNDLT5nZXRGb250KCk7CisgICAgaWYoIWN1cnJlbnRGb250KSB7CisgICAgICAgIGlmKCFtRGVmYXVsdC5nZXQoKSkgeworICAgICAgICAgICAgbURlZmF1bHQuc2V0KEZvbnQ6OmNyZWF0ZShtUlNDLCAiRHJvaWRTYW5zLnR0ZiIsIDE2LCA5NikpOworICAgICAgICB9CisgICAgICAgIGN1cnJlbnRGb250ID0gbURlZmF1bHQuZ2V0KCk7CisgICAgfQorICAgIGlmKCFjdXJyZW50Rm9udCkgeworICAgICAgICBMT0dFKCJVbmFibGUgdG8gaW5pdGlhbGl6ZSBhbnkgZm9udHMiKTsKKyAgICAgICAgcmV0dXJuOworICAgIH0KKworICAgIGN1cnJlbnRGb250LT5yZW5kZXJVVEYodGV4dCwgbGVuLCBzdGFydEluZGV4LCBudW1HbHlwaHMsIHgsIHkpOworCisgICAgaWYobUN1cnJlbnRRdWFkSW5kZXggIT0gMCkgeworICAgICAgICBpc3N1ZURyYXdDb21tYW5kKCk7CisgICAgICAgIG1DdXJyZW50UXVhZEluZGV4ID0gMDsKKyAgICB9Cit9CisKK3ZvaWQgRm9udFN0YXRlOjpyZW5kZXJUZXh0KGNvbnN0IGNoYXIgKnRleHQsIGludCB4LCBpbnQg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gbUZvbnRDb2xvckRpcnR5ID0gdHJ1ZTsKK30KKwordm9pZCBGb250U3RhdGU6OmdldEZvbnRDb2xvcihmbG9hdCAqciwgZmxvYXQgKmcsIGZsb2F0ICpiLCBmbG9hdCAqYSkgY29uc3QgeworICAgICpyID0gbUZvbnRDb2xvclswXTsKKyAgICAqZyA9IG1Gb250Q29sb3JbMV07CisgICAgKmIgPSBtRm9udENvbG9yWzJdOworICAgICphID0gbUZvbnRDb2xvclszXTsKK30KKwordm9pZCBGb250U3RhdGU6OmRlaW5pdChDb250ZXh0ICpyc2MpCit7CisgICAgbUluaXRpYWxpemVkID0gZmFsc2U7CisKKyAgICBtSW5kZXhCdWZmZXIuY2xlYXIoKTsKKyAgICBtVmVydGV4QXJyYXkuY2xlYXIoKTsKKworICAgIG1Gb250U2hhZGVyRi5jbGVhcigpOworICAgIG1Gb250U2FtcGxlci5jbGVhcigpOworICAgIG1Gb250UHJvZ3JhbVN0b3JlLmNsZWFyKCk7CisKKyAgICBtVGV4dFRleHR1cmUuY2xlYXIoKTsKKyAgICBmb3IodWludDMyX3QgaSA9IDA7IGkgPCBtQ2FjaGVMaW5lcy5zaXplKCk7IGkgKyspIHsKKyAgICAgICAgZGVsZXRlIG1DYWNoZUxpbmVzW2ldOworICAgIH0KKyAgICBtQ2FjaGVMaW5lcy5jbGVhcigpOworCisgICAgbURlZmF1bHQuY2xlYXIoKTsKKworICAgIFZlY3RvcjxGb250Kj4gZm9udHNUb0RlcmVmZXJlbmNlID0gbUFjdGl2ZUZvbnRzOworICAgIGZvcih1aW50MzJfdCBpID0gMDsgaSA8IGZvbnRzVG9EZXJlZmVyZW5jZS5zaXplKCk7IGkgKyspIHsKKyAgICAgICAgZm9udHNUb0RlcmVmZXJlbmNlW2ldLT56ZXJvVXNlclJlZigpOworICAgIH0KKworICAgIGlmKG1MaWJyYXJ5KSB7CisgICAgICAgIEZUX0RvbmVfRnJlZVR5cGUoIG1MaWJyYXJ5ICk7CisgICAgICAgIG1MaWJ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Ym9vbCBtSXNWYWxpZDsKKyAgICAgICAgLy8gTG9jYXRpb24gb2YgdGhlIGNhY2hlZCBnbHlwaCBpbiB0aGUgYml0bWFwCisgICAgICAgIC8vIGluIGNhc2Ugd2UgbmVlZCB0byByZXNpemUgdGhlIHRleHR1cmUKKyAgICAgICAgdWludDMyX3QgbUJpdG1hcE1pblg7CisgICAgICAgIHVpbnQzMl90IG1CaXRtYXBNaW5ZOworICAgICAgICB1aW50MzJfdCBtQml0bWFwV2lkdGg7CisgICAgICAgIHVpbnQzMl90IG1CaXRtYXBIZWlnaHQ7CisgICAgICAgIC8vIEFsc28gY2FjaGUgdGV4dHVyZSBjb29yZHMgZm9yIHRoZSBxdWFkCisgICAgICAgIGZsb2F0IG1CaXRtYXBNaW5VOworICAgICAgICBmbG9hdCBtQml0bWFwTWluVjsKKyAgICAgICAgZmxvYXQgbUJpdG1hcE1heFU7CisgICAgICAgIGZsb2F0IG1CaXRtYXBNYXhWOworICAgICAgICAvLyBNaW5pbWl6ZSBob3cgbXVjaCB3ZSBjYWxsIGZyZWV0eXBlCisgICAgICAgIEZUX1VJbnQgbUdseXBoSW5kZXg7CisgICAgICAgIEZUX1ZlY3RvciBtQWR2YW5jZTsKKyAgICAgICAgLy8gVmFsdWVzIGJlbG93IGNvbnRhaW4gYSBnbHlwaCdzIG9yaWdpbiBpbiB0aGUgYml0bWFwCisgICAgICAgIEZUX0ludCBtQml0bWFwTGVmdDsKKyAgICAgICAgRlRfSW50IG1CaXRtYXBUb3A7CisgICAgfTsKKworICAgIFN0cmluZzggbUZvbnROYW1lOworICAgIHVpbnQzMl90IG1Gb250U2l6ZTsKKyAgICB1aW50MzJfdCBtRHBpOworCisgICAgRm9udChDb250ZXh0ICpyc2MpOworICAgIGJvb2wgaW5pdChjb25zdCBjaGFyICpuYW1lLCB1aW50MzJfdCBmb250U2l6ZSwgdWludDMyX3QgZHBpKTsKKworICAgIEZUX0ZhY2UgbUZhY2U7CisgICAgYm9vbCBtSW5pdGlh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kIHNldEZvbnRDb2xvcihmbG9hdCByLCBmbG9hdCBnLCBmbG9hdCBiLCBmbG9hdCBhKTsKKyAgICB2b2lkIGdldEZvbnRDb2xvcihmbG9hdCAqciwgZmxvYXQgKmcsIGZsb2F0ICpiLCBmbG9hdCAqYSkgY29uc3Q7CisKK3Byb3RlY3RlZDoKKworICAgIGZyaWVuZCBjbGFzcyBGb250OworCisgICAgc3RydWN0IENhY2hlVGV4dHVyZUxpbmUKKyAgICB7CisgICAgICAgIHVpbnQzMl90IG1NYXhIZWlnaHQ7CisgICAgICAgIHVpbnQzMl90IG1NYXhXaWR0aDsKKyAgICAgICAgdWludDMyX3QgbUN1cnJlbnRSb3c7CisgICAgICAgIHVpbnQzMl90IG1DdXJyZW50Q29sOworICAgICAgICBib29sIG1EaXJ0eTsKKworICAgICAgICBDYWNoZVRleHR1cmVMaW5lKHVpbnQzMl90IG1heEhlaWdodCwgdWludDMyX3QgbWF4V2lkdGgsIHVpbnQzMl90IGN1cnJlbnRSb3csIHVpbnQzMl90IGN1cnJlbnRDb2wpIDoKKyAgICAgICAgICAgIG1NYXhIZWlnaHQobWF4SGVpZ2h0KSwgbU1heFdpZHRoKG1heFdpZHRoKSwgbUN1cnJlbnRSb3coY3VycmVudFJvdyksIG1DdXJyZW50Q29sKGN1cnJlbnRDb2wpLAorICAgICAgICAgICAgbURpcnR5KGZhbHNlKSAgeworICAgICAgICB9CisKKyAgICAgICAgYm9vbCBmaXRCaXRtYXAoRlRfQml0bWFwICpiaXRtYXAsIHVpbnQzMl90ICpyZXRPcmlnaW5YLCB1aW50MzJfdCAqcmV0T3JpZ2luWSkgeworICAgICAgICAgICAgaWYoKHVpbnQzMl90KWJpdG1hcC0+cm93cyA+IG1NYXhIZWlnaHQpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmKG1DdXJyZW50Q29sICsgKHVpbnQzMl90KWJpdG1hcC0+d2lkdGggPC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oKTsKKworICAgIC8vIFRleHR1cmUgdG8gY2FjaGUgZ2x5cGggYml0bWFwcworICAgIE9iamVjdEJhc2VSZWY8QWxsb2NhdGlvbj4gbVRleHRUZXh0dXJlOworICAgIHZvaWQgaW5pdFRleHRUZXh0dXJlKCk7CisKKyAgICBib29sIGNhY2hlQml0bWFwKEZUX0JpdG1hcCAqYml0bWFwLCB1aW50MzJfdCAqcmV0T3JpZ2luWCwgdWludDMyX3QgKnJldE9yaWdpblkpOworICAgIGNvbnN0IFR5cGUqIGdldENhY2hlVGV4dHVyZVR5cGUoKSB7CisgICAgICAgIHJldHVybiBtVGV4dFRleHR1cmUtPmdldFR5cGUoKTsKKyAgICB9CisKKyAgICB2b2lkIGZsdXNoQWxsQW5kSW52YWxpZGF0ZSgpOworCisgICAgLy8gUG9pbnRlciB0byB2ZXJ0ZXggZGF0YSB0byBzcGVlZCB1cCBmcmFtZSB0byBmcmFtZSB3b3JrCisgICAgZmxvYXQgKm1UZXh0TWVzaFB0cjsKKyAgICB1aW50MzJfdCBtQ3VycmVudFF1YWRJbmRleDsKKyAgICB1aW50MzJfdCBtTWF4TnVtYmVyT2ZRdWFkczsKKworICAgIHZvaWQgaW5pdFZlcnRleEFycmF5QnVmZmVycygpOworICAgIE9iamVjdEJhc2VSZWY8QWxsb2NhdGlvbj4gbUluZGV4QnVmZmVyOworICAgIE9iamVjdEJhc2VSZWY8QWxsb2NhdGlvbj4gbVZlcnRleEFycmF5OworCisKKyAgICBib29sIG1Jbml0aWFsaXplZDsKKworICAgIHZvaWQgY2hlY2tJbml0KCk7CisKKyAgICB2b2lkIGlzc3VlRHJhd0NvbW1hbmQoKTsKKworICAgIHZvaWQgYXBwZW5kTWVzaFF1YWQoZmxvYXQgeDEsIGZsb2F0IHkxLCBmbG9hdCB6MSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgdTEsIGZsb2F0IHYxLAorICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCB4MiwgZmxvYXQgeTIsIGZsb2F0IHoyLAorICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCB1MiwgZmxvYXQgdjIsCisgICAgICAgICAgICAgICAgICAgICAgICAgIGZsb2F0IHgzLCBmbG9hdCB5MywgZmxvYXQgejMsCisgICAgICAgICAgICAgICAgICAgICAgICAgIGZsb2F0IHUzLCBmbG9hdCB2MywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgeDQsIGZsb2F0IHk0LCBmbG9hdCB6NCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgdTQsIGZsb2F0IHY0KTsKKworfTsKKworCit9Cit9CisKKyNlbmRpZgpkaWZmIC0tZ2l0IGEvbGlicy9ycy9yc0hhbmRjb2RlLmggYi9saWJzL3JzL3JzSGFuZGNvZGUuaAppbmRleCA4MDBlZGRkLi4zNTNiNzNhIDEwMDY0NAotLS0gYS9saWJzL3JzL3JzSGFuZGNvZGUuaAorKysgYi9saWJzL3JzL3JzSGFuZGNvZGUuaApAQCAtMSw2ICsxLDU3IEBACiAKICNkZWZpbmUgREFUQV9TWU5DX1NJWkUgMTAyNAogCitzdGF0aWMgaW5saW5lIHZvaWQgcnNIQ0FQSV9Db250ZXh0RmluaXNoIChSc0NvbnRleHQgcnNjKQoreworICAgIFRocmVhZElPICppbyA9ICYoKENvbnRleHQgKilyc2MpLT5tSU87CisgICAgdWludDMyX3Qgc2l6ZSA9IHNpemVvZihSU19DTURfQ29udGV4dEZpbmlzaCk7CisgICAgUlNfQ01EX0NvbnRleHRGaW5pc2ggKmNtZCA9IHN0YXRpY19jYXN0PFJTX0NNRF9Db250ZXh0RmluaXNoICo+KGlvLT5tVG9Db3JlLnJlc2VydmUoc2l6ZSkpOworICAgIGlvLT5tVG9Db3JlLmNvbW1pdFN5bmMoUlNfQ01EX0lEX0NvbnRleHRGaW5pc2gsIHNpemUpOworfQorCitzdGF0aWMgaW5saW5lIHZvaWQgcnNIQ0FQSV9TY3JpcHRJbnZva2VWI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3VudCkgeworICAgICAgICBMT0dFKCJJbnZhbGlkIHByaW1pdGl2ZSBpbmRleCIpOworICAgICAgICByZXR1cm47CisgICAgfQorCisgICAgUHJpbWl0aXZlX3QgKnByaW0gPSBtUHJpbWl0aXZlc1twcmltSW5kZXhdOworCisgICAgaWYgKHByaW0tPm1JbmRleEJ1ZmZlci5nZXQoKSkgeworICAgICAgICByZW5kZXJQcmltaXRpdmVSYW5nZShyc2MsIHByaW1JbmRleCwgMCwgcHJpbS0+bUluZGV4QnVmZmVyLT5nZXRUeXBlKCktPmdldERpbVgoKSk7CisgICAgICAgIHJldHVybjsKKyAgICB9CisKKyAgICByZW5kZXJQcmltaXRpdmVSYW5nZShyc2MsIHByaW1JbmRleCwgMCwgbVZlcnRleEJ1ZmZlcnNbMF0tPmdldFR5cGUoKS0+Z2V0RGltWCgpKTsKK30KKwordm9pZCBNZXNoOjpyZW5kZXJQcmltaXRpdmVSYW5nZShDb250ZXh0ICpyc2MsIHVpbnQzMl90IHByaW1JbmRleCwgdWludDMyX3Qgc3RhcnQsIHVpbnQzMl90IGxlbikgY29uc3QKK3sKKyAgICBpZiAobGVuIDwgMSB8fCBwcmltSW5kZXggPj0gbVByaW1pdGl2ZXNDb3VudCkgeworICAgICAgICByZXR1cm47CisgICAgfQorCisgICAgcnNjLT5jaGVja0Vycm9yKCJNZXNoOjpyZW5kZXJQcmltaXRpdmVSYW5nZSAxIik7CisgICAgVmVydGV4QXJyYXkgdmE7CisgICAgZm9yICh1aW50MzJfdCBjdD0wOyBjdCA8IG1WZXJ0ZXhCdWZmZXJDb3VudDsgY3QrKykgeworICAgICAgICBtVmVydGV4QnVmZmVyc1tjdF0tPnVwbG9hZENoZWNrKHJzYyk7CisgICAgICAgIGlmIChtVmVydGV4QnVmZmVyc1tjdF0tPmdldElzQnVmZmVyT2JqZWN0KCkpIHsKKyAgICAgICAgICAgIHZhLnNldEFjdGl2ZUJ1ZmZlcihtVmVydGV4QnVmZmVyc1tjdF0tPmdldEJ1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gPSAwOyBwQ291bnQgPCBtUHJpbWl0aXZlc0NvdW50OyBwQ291bnQgKyspIHsKKyAgICAgICAgUHJpbWl0aXZlX3QgKiBwcmltID0gbVByaW1pdGl2ZXNbcENvdW50XTsKKworICAgICAgICBzdHJlYW0tPmFkZFU4KCh1aW50OF90KXByaW0tPm1QcmltaXRpdmUpOworCisgICAgICAgIGlmKHByaW0tPm1JbmRleEJ1ZmZlci5nZXQoKSkgeworICAgICAgICAgICAgc3RyZWFtLT5hZGRVMzIoMSk7CisgICAgICAgICAgICBwcmltLT5tSW5kZXhCdWZmZXItPnNlcmlhbGl6ZShzdHJlYW0pOworICAgICAgICB9CisgICAgICAgIGVsc2UgeworICAgICAgICAgICAgc3RyZWFtLT5hZGRVMzIoMCk7CisgICAgICAgIH0KKyAgICB9Cit9CisKK01lc2ggKk1lc2g6OmNyZWF0ZUZyb21TdHJlYW0oQ29udGV4dCAqcnNjLCBJU3RyZWFtICpzdHJlYW0pCit7CisgICAgLy8gRmlyc3QgbWFrZSBzdXJlIHdlIGFyZSByZWFkaW5nIHRoZSBjb3JyZWN0IG9iamVjdAorICAgIFJzQTNEQ2xhc3NJRCBjbGFzc0lEID0gKFJzQTNEQ2xhc3NJRClzdHJlYW0tPmxvYWRVMzIoKTsKKyAgICBpZihjbGFzc0lEICE9IFJTX0EzRF9DTEFTU19JRF9NRVNIKSB7CisgICAgICAgIExPR0UoIm1lc2ggbG9hZGluZyBza2lwcGVkIGR1ZSB0byBpbnZhbGlkIGNsYXNzIGlkIik7CisgICAgICAgIHJldHVybiBOVUxMOworICAgIH0KKworICAgIE1lc2ggKiBtZXNoID0gbmV3IE1lc2gocnNjKTsKKworICAgIFN0cmluZzggbmFtZTsKKyAgICBzdHJlYW0tPmxvYWRTdHJpbmcoJm5hbWUpOworICAgIG1lc2gtPnNldE5hbWUobmFtZS5zdHJpbmcoKSwgbmFtZS5zaXplKCkpOworCisgICAgbWVzaC0+bVZlcnRleEJ1ZmZlckNvdW50ID0gc3R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291bnQoKTsgY3QrKykgeworICAgICAgICAgICAgaWYoc3RyY21wKGJ1ZmZlckVsZW0tPmdldEZpZWxkTmFtZShjdCksICJwb3NpdGlvbiIpID09IDApIHsKKyAgICAgICAgICAgICAgICB2ZWN0b3JTaXplID0gYnVmZmVyRWxlbS0+Z2V0RmllbGQoY3QpLT5nZXRDb21wb25lbnQoKS5nZXRWZWN0b3JTaXplKCk7CisgICAgICAgICAgICAgICAgc3RyaWRlID0gYnVmZmVyRWxlbS0+Z2V0U2l6ZUJ5dGVzKCkgLyBzaXplb2YoZmxvYXQpOworICAgICAgICAgICAgICAgIHVpbnQzMl90IG9mZnNldCA9IGJ1ZmZlckVsZW0tPmdldEZpZWxkT2Zmc2V0Qnl0ZXMoY3QpOworICAgICAgICAgICAgICAgIHBvc1B0ciA9IChmbG9hdCopKCh1aW50OF90KiltVmVydGV4QnVmZmVyc1tjdF0tPmdldFB0cigpICsgb2Zmc2V0KTsKKyAgICAgICAgICAgICAgICBudW1WZXJ0cyA9IGJ1ZmZlclR5cGUtPmdldERpbVgoKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICBpZihwb3NQdHIpIHsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgfQorCisgICAgbUJCb3hNaW5bMF0gPSBtQkJveE1pblsxXSA9IG1CQm94TWluWzJdID0gMWU2OworICAgIG1CQm94TWF4WzBdID0gbUJCb3hNYXhbMV0gPSBtQkJveE1heFsyXSA9IC0xZTY7CisgICAgaWYoIXBvc1B0cikgeworICAgICAgICBMT0dFKCJVbmFibGUgdG8gY29tcHV0ZSBib3VuZGluZyBib3giKTsKKyAgICAgICAgbUJCb3hNaW5bMF0gPSBtQkJveE1pblsxXSA9IG1CQm94TWluWzJdID0gMC4wZjsKKyAgICAgICAgbUJCb3hNYXhbMF0gPSBtQkJveE1heFsxXSA9IG1CQm94TWF4WzJdID0gMC4wZjsKKyAgICAgICAg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BOVUxMKTsKKyAgICBpZiAoc3RhdHVzKSB7CisgICAgICAgIExPR0UoIk11dGV4OjpNdXRleCBpbml0IGZhaWx1cmUiKTsKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKyAgICByZXR1cm4gdHJ1ZTsKK30KKworYm9vbCBNdXRleDo6bG9jaygpCit7CisgICAgaW50IHN0YXR1czsKKyAgICBzdGF0dXMgPSBwdGhyZWFkX211dGV4X2xvY2soJm1NdXRleCk7CisgICAgaWYgKHN0YXR1cykgeworICAgICAgICBMT0dFKCJNdXRleDogZXJyb3IgJWkgbG9ja2luZy4iLCBzdGF0dXMpOworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorICAgIHJldHVybiB0cnVlOworfQorCitib29sIE11dGV4Ojp1bmxvY2soKQoreworICAgIGludCBzdGF0dXM7CisgICAgc3RhdHVzID0gcHRocmVhZF9tdXRleF91bmxvY2soJm1NdXRleCk7CisgICAgaWYgKHN0YXR1cykgeworICAgICAgICBMT0dFKCJNdXRleCBlcnJvciAlaSB1bmxvY2tpbmcuIiwgc3RhdHVzKTsKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKyAgICByZXR1cm4gdHJ1ZTsKK30KKworCmRpZmYgLS1naXQgYS9saWJzL3JzL3JzTXV0ZXguaCBiL2xpYnMvcnMvcnNNdXRleC5oCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLjQ3NzI1ZDcKLS0tIC9kZXYvbnVsbAorKysgYi9saWJzL3JzL3JzTXV0ZXguaApAQCAtMCwwICsxLDQzIEBACisvKgorICogQ29weXJpZ2h0IChDKSAyMDA5IFRoZSBBbmRyb2lkIE9wZW4gU291cmNlIFByb2plY3QKKyAqCisgKiBMaWNlbnNlZCB1bmRlciB0aGUgQXBhY2hlIExpY2Vuc2UsIFZlcnNpb24gMi4wICh0aGUgIkxpY2Vuc2UiKTsKKyAqIHlvdSBtYXkgbm90IHVzZSB0aGlzIGZp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FdIC8gczsKLX0KLQotaW5saW5lIHZvaWQgU0Nfbm9ybWFsaXplZjMoZmxvYXQgdltdKQotewotICAgIGZsb2F0IHMgPSAoZmxvYXQpc3FydGYodlswXSAqIHZbMF0gKyB2WzFdICogdlsxXSArIHZbMl0gKiB2WzJdKTsKLSAgICB2WzBdID0gdlswXSAvIHM7Ci0gICAgdlsxXSA9IHZbMV0gLyBzOwotICAgIHZbMl0gPSB2WzJdIC8gczsKLX0KLQotc3RhdGljIHZvaWQgbm9pc2VfaW5pdCgpCi17Ci0gICAgaW50IGksIGosIGs7Ci0gICAgCi0gICAgZm9yIChpID0gMDsgaSA8IEI7IGkrKykgewotICAgICAgICBwW2ldID0gaTsKLSAgICAgICAgCi0gICAgICAgIGcxW2ldID0gKGZsb2F0KSgocmFuZCgpICUgKEIgKyBCKSkgLSBCKSAvIEI7Ci0gICAgICAgIAotICAgICAgICBmb3IgKGogPSAwOyBqIDwgMjsgaisrKQotICAgICAgICAgICAgZzJbaV1bal0gPSAoZmxvYXQpKChyYW5kKCkgJSAoQiArIEIpKSAtIEIpIC8gQjsKLSAgICAgICAgU0Nfbm9ybWFsaXplZjIoZzJbaV0pOwotICAgICAgICAKLSAgICAgICAgZm9yIChqID0gMDsgaiA8IDM7IGorKykKLSAgICAgICAgICAgIGczW2ldW2pdID0gKGZsb2F0KSgocmFuZCgpICUgKEIgKyBCKSkgLSBCKSAvIEI7Ci0gICAgICAgIFNDX25vcm1hbGl6ZWYzKGczW2ldKTsKLSAgICB9Ci0gICAgCi0gICAgZm9yIChpID0gQi0xOyBpID49IDA7IGktLSkgewotICAgICAgICBrID0gcFtpXTsKLSAgICAgICAgcFtpXSA9IHBbaiA9IHJhbmQoKSAlIEJdOwotICAgICAgICBwW2pdID0gazsKLSAgICB9Ci0gICAgCi0gICAgZm9yIChpID0gMDsgaSA8IEIgKyAyOyBpKyspIHsKLSAgICAgICAgcFtCICsgaV0gPSBwW2ldOwotICAgICAgICBnMVtCICsgaV0gPSBnMVtpXTsKLSAgICAgICAgZm9yIChqID0gMDsgaiA8IDI7IGorKykKLSAgICAgICAgICAgIGcyW0IgKyBpXVtqXSA9IGcyW2ldW2pdOwotICAgICAgICBmb3IgKGogPSAwOyBqIDwgMzsgaisrKQotICAgICAgICAgICAgZzNbQiArIGldW2pdID0gZzNbaV1bal07Ci0gICAgfQotfQotCi1mbG9hdCBTQ19ub2lzZWYoZmxvYXQgeCkKLXsKLSAgICBzcmFuZCh0aW1lKE5VTEwpKTsKLSAgICBpbnQgYngwLCBieDE7Ci0gICAgZmxvYXQgcngwLCByeDEsIHN4LCB0LCB1LCB2OwotICAgIAotICAgIGlmIChub2lzZV9zdGFydCkgewotICAgICAgICBub2lzZV9zdGFydCA9IGZhbHNlOwotICAgICAgICBub2lzZV9pbml0KCk7Ci0gICAgfQotICAgIAotICAgIHQgPSB4ICsgTjsKLSAgICBieDAgPSAoKGludCl0KSAmIEJNOwotICAgIGJ4MSA9IChieDArMSkgJiBCTTsKLSAgICByeDAgPSB0IC0gKGludCl0OwotICAgIHJ4MSA9IHJ4MCAtIDEuMGY7Ci0gICAgCi0gICAgc3ggPSBub2lzZV9zQ3VydmUocngwKTsKLSAgICAKLSAgICB1ID0gcngwICogZzFbcFtieDBdXTsKLSAgICB2ID0gcngxICogZzFbcFtieDFdXTsKLSAgICByZXR1cm4gMi4zZiAqIGxlcnBmKHUsIHYsIHN4KTsKLX0KLQotZmxvYXQgU0Nfbm9pc2VmMihmbG9hdCB4LCBmbG9hdCB5KQotewotICAgIHNyYW5kKHRpbWUoTlVMTCkpOwotICAgIGludCBieDAsIGJ4MSwgYnkwLCBieTEsIGIwMCwgYjEwLCBiMDEsIGIxMTsKLSAgICBmbG9hdCByeDAsIHJ4MSwgcnkwLCByeTEsIHN4LCBzeSwgYSwgYiwgdCwgdSwgdjsKLSAgICBmbG9hdCAqcTsKLSAgICBpbnQgaSwgajsKLSAgICAKLSAgICBpZiAobm9pc2Vfc3RhcnQpIHsKLSAgICAgICAgbm9pc2Vfc3RhcnQgPSBmYWxzZTsKLSAgICAgICAgbm9pc2VfaW5pdCgpOwotICAgIH0KLSAgICAKLSAgICB0ID0geCArIE47Ci0gICAgYngwID0gKChpbnQpdCkgJiBCTTsKLSAgICBieDEgPSAoYngwKzEpICYgQk07Ci0gICAgcngwID0gdCAtIChpbnQpdDsKLSAgICByeDEgPSByeDAgLSAxLjBmOwotCQotICAgIHQgPSB5ICsgTjsKLSAgICBieTAgPSAoKGludCl0KSAmIEJNOwotICAgIGJ5MSA9IChieTArMSkgJiBCTTsKLSAgICByeTAgPSB0IC0gKGludCl0OwotICAgIHJ5MSA9IHJ5MCAtIDEuMGY7Ci0JCi0gICAgaSA9IHBbYngwXTsKLSAgICBqID0gcFtieDFdOwotICAgIAotICAgIGIwMCA9IHBbaSArIGJ5MF07Ci0gICAgYjEwID0gcFtqICsgYnkwXTsKLSAgICBiMDEgPSBwW2kgKyBieTFdOwotICAgIGIxMSA9IHBbaiArIGJ5MV07Ci0gICAgCi0gICAgc3ggPSBub2lzZV9zQ3VydmUocngwKTsKLSAgICBzeSA9IG5vaXNlX3NDdXJ2ZShyeTApOwotICAgIAotICAgIHEgPSBnMltiMDBdOyB1ID0gcngwICogcVswXSArIHJ5MCAqIHFbMV07Ci0gICAgcSA9IGcyW2IxMF07IHYgPSByeDEgKiBxWzBdICsgcnkwICogcVsxXTsKLSAgICBhID0gbGVycGYodSwgdiwgc3gpOwotICAgIAotICAgIHEgPSBnMltiMDFdOyB1ID0gcngwICogcVswXSArIHJ5MSAqIHFbMV07Ci0gICAgcSA9IGcyW2IxMV07IHYgPSByeDEgKiBxWzBdICsgcnkxICogcVsxXTsKLSAgICBiID0gbGVycGYodSwgdiwgc3gpOwotICAgIAotICAgIHJldHVybiAxLjVmKmxlcnBmKGEsIGIsIHN5KTsKLX0KLQotZmxvYXQgU0Nfbm9pc2VmMyhmbG9hdCB4LCBmbG9hdCB5LCBmbG9hdCB6KQotewotICAgIHNyYW5kKHRpbWUoTlVMTC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RGVwdGhUZXN0RW5hYmxlID0gZmFsc2U7CisgICAgICAgIG1EZXB0aEZ1bmMgPSBHTF9BTFdBWVM7CisgICAgICAgIGJyZWFrOworICAgIGNhc2UgUlNfREVQVEhfRlVOQ19MRVNTOgorICAgICAgICBtRGVwdGhGdW5jID0gR0xfTEVTUzsKKyAgICAgICAgYnJlYWs7CisgICAgY2FzZSBSU19ERVBUSF9GVU5DX0xFUVVBTDoKKyAgICAgICAgbURlcHRoRnVuYyA9IEdMX0xFUVVBTDsKKyAgICAgICAgYnJlYWs7CisgICAgY2FzZSBSU19ERVBUSF9GVU5DX0dSRUFURVI6CisgICAgICAgIG1EZXB0aEZ1bmMgPSBHTF9HUkVBVEVSOworICAgICAgICBicmVhazsKKyAgICBjYXNlIFJTX0RFUFRIX0ZVTkNfR0VRVUFMOgorICAgICAgICBtRGVwdGhGdW5jID0gR0xfR0VRVUFMOworICAgICAgICBicmVhazsKKyAgICBjYXNlIFJTX0RFUFRIX0ZVTkNfRVFVQUw6CisgICAgICAgIG1EZXB0aEZ1bmMgPSBHTF9FUVVBTDsKKyAgICAgICAgYnJlYWs7CisgICAgY2FzZSBSU19ERVBUSF9GVU5DX05PVEVRVUFMOgorICAgICAgICBtRGVwdGhGdW5jID0gR0xfTk9URVFVQUw7CisgICAgICAgIGJyZWFrOworICAgIH0KK30KKwordm9pZCBQcm9ncmFtU3RvcmU6OnNldERlcHRoTWFzayhib29sIG1hc2spCit7CisgICAgbURlcHRoV3JpdGVFbmFibGUgPSBtYXNrOworfQorCit2b2lkIFByb2dyYW1TdG9yZTo6c2V0QmxlbmRGdW5jKFJzQmxlbmRTcmNGdW5jIHNyYywgUnNCbGVuZERzdEZ1bmMgZHN0KQoreworICAgIG1CbGVuZEVuYWJsZSA9IHRydWU7CisgICAgaWYgKChzcmMgPT0gUlNfQkxFTkRfU1JDX09ORSkgJiYKKyAgICAgICAgKGRzdCA9PSBSU19CTEVORF9EU1RfWkVSTykpIHsKKyAgICAgICAgbUJsZW5kRW5hYmxlID0gZmFsc2U7CisgICAgfQorCisgICAgc3dpdGNoKHNyYykgeworICAgIGNhc2UgUlNfQkxFTkRfU1JDX1pFUk86CisgICAgICAgIG1CbGVuZFNyYyA9IEdMX1pFUk87CisgICAgICAgIGJyZWFrOworICAgIGNhc2UgUlNfQkxFTkRfU1JDX09ORToKKyAgICAgICAgbUJsZW5kU3JjID0gR0xfT05FOworICAgICAgICBicmVhazsKKyAgICBjYXNlIFJTX0JMRU5EX1NSQ19EU1RfQ09MT1I6CisgICAgICAgIG1CbGVuZFNyYyA9IEdMX0RTVF9DT0xPUjsKKyAgICAgICAgYnJlYWs7CisgICAgY2FzZSBSU19CTEVORF9TUkNfT05FX01JTlVTX0RTVF9DT0xPUjoKKyAgICAgICAgbUJsZW5kU3JjID0gR0xfT05FX01JTlVTX0RTVF9DT0xPUjsKKyAgICAgICAgYnJlYWs7CisgICAgY2FzZSBSU19CTEVORF9TUkNfU1JDX0FMUEhBOgorICAgICAgICBtQmxlbmRTcmMgPSBHTF9TUkNfQUxQSEE7CisgICAgICAgIGJyZWFrOworICAgIGNhc2UgUlNfQkxFTkRfU1JDX09ORV9NSU5VU19TUkNfQUxQSEE6CisgICAgICAgIG1CbGVuZFNyYyA9IEdMX09ORV9NSU5VU19TUkNfQUxQSEE7CisgICAgICAgIGJyZWFrOworICAgIGNhc2UgUlNfQkxFTkRfU1JDX0RTVF9BTFBIQToKKyAgICAgICAgbUJsZW5kU3JjID0gR0xfRFNUX0FMUEhBOworICAgICAgICBicmVhazsKKyAgICBjYXNlIFJTX0JMRU5EX1NSQ19PTkVfTUlOVVNfRFNUX0FMUEhBOgorICAgICAgICBtQmxlbmRTcmMgPSBHTF9PTkVfTUlOVVNfRFNUX0FMUEhBOworICAgICAgICBicmVhazsKKyAgICBjYXNlIFJTX0JMRU5EX1NSQ19TUkNfQUxQSEFfU0FUVVJBVEU6CisgICAgICAgIG1CbGVuZFNyYyA9IEdMX1NSQ19BTFBIQV9TQVRVUkFURTsKKyAgICAgICAgYnJlYWs7CisgICAgfQorCisgICAgc3dpdGNoKGRzdCkgeworICAgIGNhc2UgUlNfQkxFTkRfRFNUX1pFUk86CisgICAgICAgIG1CbGVuZERzdCA9IEdMX1pFUk87CisgICAgICAgIGJyZWFrOworICAgIGNhc2UgUlNfQkxFTkRfRFNUX09ORToKKyAgICAgICAgbUJsZW5kRHN0ID0gR0xfT05FOworICAgICAgICBicmVhazsKKyAgICBjYXNlIFJTX0JMRU5EX0RTVF9TUkNfQ09MT1I6CisgICAgICAgIG1CbGVuZERzdCA9IEdMX1NSQ19DT0xPUjsKKyAgICAgICAgYnJlYWs7CisgICAgY2FzZSBSU19CTEVORF9EU1RfT05FX01JTlVTX1NSQ19DT0xPUjoKKyAgICAgICAgbUJsZW5kRHN0ID0gR0xfT05FX01JTlVTX1NSQ19DT0xPUjsKKyAgICAgICAgYnJlYWs7CisgICAgY2FzZSBSU19CTEVORF9EU1RfU1JDX0FMUEhBOgorICAgICAgICBtQmxlbmREc3QgPSBHTF9TUkNfQUxQSEE7CisgICAgICAgIGJyZWFrOworICAgIGNhc2UgUlNfQkxFTkRfRFNUX09ORV9NSU5VU19TUkNfQUxQSEE6CisgICAgICAgIG1CbGVuZERzdCA9IEdMX09ORV9NSU5VU19TUkNfQUxQSEE7CisgICAgICAgIGJyZWFrOworICAgIGNhc2UgUlNfQkxFTkRfRFNUX0RTVF9BTFBIQToKKyAgICAgICAgbUJsZW5kRHN0ID0gR0xfRFNUX0FMUEhBOworICAgICAgICBicmVhazsKKyAgICBjYXNlIFJTX0JMRU5EX0RTVF9PTkVfTUlOVVNfRFNUX0FMUEhBOgorICAgICAgICBtQmxlbmREc3QgPSBHTF9PTkVfTUlOVVNfRFNUX0FMUEhBOworICAgICAgICBicmVhazsKKyAgICB9Cit9CisKK3ZvaWQgUHJvZ3JhbVN0b3JlOjpzZXRDb2xvck1hc2soYm9vbCByLCBib29sIGcsIGJvb2wgYiwgYm9vbCBhKQoreworICAgIG1Db2xv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iAgICAgICAgIGZvciAodWludDMyX3QgY3QgPSAwOyBjdCA8IG1MaWdodENvdW50OyBjdCsrKSB7CiAgICAgICAgICAgICBjb25zdCBMaWdodCAqbCA9IG1MaWdodHNbY3RdLmdldCgpOwogICAgICAgICAgICAgZ2xFbmFibGUoR0xfTElHSFQwICsgY3QpOwpAQCAtOTIsNiArMTAxLDcgQEAKICAgICAgICAgZm9yICh1aW50MzJfdCBjdCA9IG1MaWdodENvdW50OyBjdCA8IE1BWF9MSUdIVFM7IGN0KyspIHsKICAgICAgICAgICAgIGdsRGlzYWJsZShHTF9MSUdIVDAgKyBjdCk7CiAgICAgICAgIH0KKyNlbmRpZiAvL0FORFJPSURfUlNfQlVJTERfRk9SX0hPU1QKICAgICB9IGVsc2UgewogICAgICAgICBnbERpc2FibGUoR0xfTElHSFRJTkcpOwogICAgIH0KQEAgLTEyOCw2ICsxMzgsMTEgQEAKICAgICAgICAgICAgIGNvbnN0IEVsZW1lbnQgKmUgPSBtQ29uc3RhbnRUeXBlc1tjdF0tPmdldEVsZW1lbnQoKTsKICAgICAgICAgICAgIGZvciAodWludDMyX3QgZmllbGQ9MDsgZmllbGQgPCBlLT5nZXRGaWVsZENvdW50KCk7IGZpZWxkKyspIHsKICAgICAgICAgICAgICAgICBjb25zdCBFbGVtZW50ICpmID0gZS0+Z2V0RmllbGQoZmllbGQpOworICAgICAgICAgICAgICAgIGNvbnN0IGNoYXIgKmZuID0gZS0+Z2V0RmllbGROYW1lKGZpZWxkKTsKKworICAgICAgICAgICAgICAgIGlmIChmblswXSA9PSAnIycpIHsKKyAgICAgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICAgICAgfQogCiAgICAgICAgICAgICAgICAgLy8gQ2Fubm90IGJlIGNvbXBsZXgKICAgICAgICAgICAgICAgICByc0Fzc2VydCghZi0+Z2V0RmllbGRDb3VudCgpKTsKQEAgLTE0MCw3ICsxNTUsNyBAQAogICAgICAgICAgICAgICAgICAgICByc0Fzc2VydCgwKTsKICAgICAgICAgICAgICAgICB9CiAKLSAgICAgICAgICAgICAgICBtU2hhZGVyLmFwcGVuZChlLT5nZXRGaWVsZE5hbWUoZmllbGQpKTsKKyAgICAgICAgICAgICAgICBtU2hhZGVyLmFwcGVuZChmbik7CiAgICAgICAgICAgICAgICAgbVNoYWRlci5hcHBlbmQoIjtcbiIpOwogICAgICAgICAgICAgfQogICAgICAgICB9CkBAIC0xNTAsNiArMTY1LDExIEBACiAgICAgICAgICAgICBjb25zdCBFbGVtZW50ICplID0gbUlucHV0RWxlbWVudHNbY3RdLmdldCgpOwogICAgICAgICAgICAgZm9yICh1aW50MzJfdCBmaWVsZD0wOyBmaWVsZCA8IGUtPmdldEZpZWxkQ291bnQoKTsgZmllbGQrKykgewogICAgICAgICAgICAgICAgIGNvbnN0IEVsZW1lbnQgKmYgPSBlLT5nZXRGaWVsZChmaWVsZCk7CisgICAgICAgICAgICAgICAgY29uc3QgY2hhciAqZm4gPSBlLT5nZXRGaWVsZE5hbWUoZmllbGQpOworCisgICAgICAgICAgICAgICAgaWYgKGZuWzBdID09ICcjJykgeworICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgICAgICB9CiAKICAgICAgICAgICAgICAgICAvLyBDYW5ub3QgYmUgY29tcGxleAogICAgICAgICAgICAgICAgIHJzQXNzZXJ0KCFmLT5nZXRGaWVsZENvdW50KCkpOwpAQCAtMTYyLDE3ICsxODIsMTYgQEAKICAgICAgICAgICAgICAgICAgICAgcnNBc3NlcnQoMCk7CiAgICAgICAgICAgICAgICAgfQogCi0gICAgICAgICAgICAgICAgbVNoYWRlci5hcHBlbmQoZS0+Z2V0RmllbGROYW1lKGZpZWxkKSk7CisgICAgICAgICAgICAgICAgbVNoYWRlci5hcHBlbmQoZm4pOwogICAgICAgICAgICAgICAgIG1TaGFkZXIuYXBwZW5kKCI7XG4iKTsKICAgICAgICAgICAgIH0KICAgICAgICAgfQogICAgICAgICBtU2hhZGVyLmFwcGVuZChtV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U3RhcnRUaW1lTWlsbGlzOworICAgICAgICBpbnQ2NF90IG1MYXN0RHRUaW1lOwogICAgICAgICBjb25zdCBjaGFyKiBtVGltZVpvbmU7CiAKICAgICAgICAgT2JqZWN0QmFzZVJlZjxQcm9ncmFtVmVydGV4PiBtVmVydGV4OwogICAgICAgICBPYmplY3RCYXNlUmVmPFByb2dyYW1GcmFnbWVudD4gbUZyYWdtZW50OwogICAgICAgICBPYmplY3RCYXNlUmVmPFByb2dyYW1SYXN0ZXI+IG1SYXN0ZXI7Ci0gICAgICAgIE9iamVjdEJhc2VSZWY8UHJvZ3JhbUZyYWdtZW50U3RvcmU+IG1GcmFnbWVudFN0b3JlOwotICAgICAgICBJbnZva2VGdW5jX3QgbUludm9rYWJsZXNbTUFYX1NDUklQVF9CQU5LU107CisgICAgICAgIE9iamVjdEJhc2VSZWY8UHJvZ3JhbVN0b3JlPiBtRnJhZ21lbnRTdG9yZTsKKworICAgICAgICB1aW50MzJfdCBtSW52b2tlRnVuY3Rpb25Db3VudDsKKyAgICAgICAgSW52b2tlRnVuY190ICptSW52b2tlRnVuY3Rpb25zOworICAgICAgICB1aW50MzJfdCBtRmllbGRDb3VudDsKKyAgICAgICAgdm9pZCAqKiBtRmllbGRBZGRyZXNzOworCiAgICAgICAgIGNoYXIgKiBtU2NyaXB0VGV4dDsKICAgICAgICAgdWludDMyX3QgbVNjcmlwdFRleHRMZW5ndGg7CisKKyAgICAgICAgYm9vbCBtSXNUaHJlYWRhYmxlOwogICAgIH07CiAgICAgRW52aXJvbWVudF90IG1FbnZpcm9tZW50OwogCi0gICAgdWludDMyX3QgbUNvdW5zdGFudEJ1ZmZlckNvdW50OwotCi0KICAgICBPYmplY3RCYXNlUmVmPEFsbG9jYXRpb24+IG1TbG90c1tNQVhfU0NSSVBUX0JBTktTXTsKICAgICBPYmplY3RCYXNlUmVmPGNvbnN0IFR5cGU+IG1UeXBlc1tNQVhfU0NSSVBUX0JBTktTXTsKLSAgICBTdHJpbmc4IG1TbG90TmFtZXNbTUFYX1NDUklQVF9CQU5LU107CiAgICAgYm9vbCBtU2xvdFdyaXRhYmxlW01BWF9TQ1JJUFRfQkFOS1NdOwogCisgICAgdm9pZCBzZXRWYXIodWludDMyX3Qgc2xvdCwgY29uc3Qgdm9pZCAqdmFsLCB1aW50MzJfdCBsZW4pOwogCisgICAgdmlydHVhbCB2b2lkIHJ1bkZvckVhY2goQ29udGV4dCAqcnNjLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IEFsbG9jYXRpb24gKiBhaW4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgQWxsb2NhdGlvbiAqIGFvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgdm9pZCAqIHVzciwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBSc1NjcmlwdENhbGwgKnNjID0gTlVMTCkgPSAwOwogCi0gICAgdmlydHVhbCB2b2lkIHNldHVwU2NyaXB0KCkgPSAwOwotICAgIHZpcnR1YWwgdWludDMyX3QgcnVuKENvbnRleHQgKiwgdWludDMyX3QgbGF1bmNoSUQpID0gMDsKKyAgICB2aXJ0dWFsIHZvaWQgSW52b2tlKENvbnRleHQgKnJzYywgdWludDMyX3Qgc2xvdCwgY29uc3Qgdm9pZCAqZGF0YSwgdWludDMyX3QgbGVuKSA9IDA7CisgICAgdmlydHVhbCB2b2lkIHNldHVwU2NyaXB0KENvbnRleHQgKnJzYykgPSAwOworICAgIHZpcnR1YWwgdWludDMyX3QgcnVuKENvbnRleHQgKikgPSAwOwogfTsKIAogCmRpZmYgLS1naXQgYS9saWJzL3JzL3JzU2NyaXB0Qy5jcHAgYi9saWJzL3JzL3JzU2NyaXB0Qy5jcHAKaW5kZXggZjRkMjQ1MS4uYTE0MGUyMiAxMDA2NDQKLS0tIGEvbGlicy9ycy9yc1NjcmlwdEMuY3BwCisrKyBiL2xpYnMvcnMvcnNTY3JpcHRDLmNwcApAQCAtMTcsOCArMTcsNyB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1TbG90c1tjdF0tPmdldFB0cigpOworICAgIHNldHVwR0xTdGF0ZShyc2MpOworICAgIG1FbnZpcm9tZW50Lm1TdGFydFRpbWVNaWxsaXMKKyAgICAgICAgICAgICAgICA9IG5hbm9zZWNvbmRzX3RvX21pbGxpc2Vjb25kcyhzeXN0ZW1UaW1lKFNZU1RFTV9USU1FX01PTk9UT05JQykpOworCisgICAgZm9yICh1aW50MzJfdCBjdD0wOyBjdCA8IG1FbnZpcm9tZW50Lm1GaWVsZENvdW50OyBjdCsrKSB7CisgICAgICAgIGlmICghbVNsb3RzW2N0XS5nZXQoKSkKKyAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICB2b2lkICpwdHIgPSBtU2xvdHNbY3RdLT5nZXRQdHIoKTsKKyAgICAgICAgdm9pZCAqKmRlc3QgPSAoKHZvaWQgKioqKW1FbnZpcm9tZW50Lm1GaWVsZEFkZHJlc3MpW2N0XTsKKyAgICAgICAgLy9MT0dFKCJzZXR1cFNjcmlwdCAlaSAlcCA9ICVwICAgICVwICVpIiwgY3QsIGRlc3QsIHB0ciwgbVNsb3RzW2N0XS0+Z2V0VHlwZSgpLCBtU2xvdHNbY3RdLT5nZXRUeXBlKCktPmdldERpbVgoKSk7CisKKyAgICAgICAgLy9jb25zdCB1aW50MzJfdCAqcDMyID0gKGNvbnN0IHVpbnQzMl90ICopcHRyOworICAgICAgICAvL2ZvciAodWludDMyX3QgY3QyPTA7IGN0MiA8IG1TbG90c1tjdF0tPmdldFR5cGUoKS0+Z2V0RGltWCgpOyBjdDIrKykgeworICAgICAgICAgICAgLy9MT0dFKCIgICVpID0gMHglMDh4ICIsIGN0MiwgcDMyW2N0Ml0pOworICAgICAgICAvL30KKworICAgICAgICBpZiAoZGVzdCkgeworICAgICAgICAgICAgKmRlc3QgPSBwdHI7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBMT0dFKCJTY3JpcHRDOjpzZXR1cFNjcmlwdCwgTlVMTCB2YXIgYmluZGluZyBh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1Y3QgKiB0bHMgPSAoQ29udGV4dDo6U2NyaXB0VExTU3RydWN0ICopCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHRocmVhZF9nZXRzcGVjaWZpYyhDb250ZXh0OjpnVGhyZWFkVExTS2V5KTsKICAgICByc0Fzc2VydCh0bHMpOworICAgIFNjcmlwdCAqb2xkID0gdGxzLT5tU2NyaXB0OworICAgIHRscy0+bVNjcmlwdCA9IHNjOworICAgIHJldHVybiBvbGQ7Cit9CiAKKwordm9pZCBTY3JpcHRDOjpzZXR1cEdMU3RhdGUoQ29udGV4dCAqcnNjKQorewogICAgIGlmIChtRW52aXJvbWVudC5tRnJhZ21lbnRTdG9yZS5nZXQoKSkgewogICAgICAgICByc2MtPnNldEZyYWdtZW50U3RvcmUobUVudmlyb21lbnQubUZyYWdtZW50U3RvcmUuZ2V0KCkpOwogICAgIH0KQEAgLTgzLDIwICsxMTYsMjE0IEBACiAgICAgaWYgKG1FbnZpcm9tZW50Lm1SYXN0ZXIuZ2V0KCkpIHsKICAgICAgICAgcnNjLT5zZXRSYXN0ZXIobUVudmlyb21lbnQubVJhc3Rlci5nZXQoKSk7CiAgICAgfQorfQogCi0gICAgaWYgKGxhdW5jaEluZGV4ID09IDApIHsKLSAgICAgICAgbUVudmlyb21lbnQubVN0YXJ0VGltZU1pbGxpcwotICAgICAgICAgICAgICAgID0gbmFub3NlY29uZHNfdG9fbWlsbGlzZWNvbmRzKHN5c3RlbVRpbWUoU1lTVEVNX1RJTUVfTU9OT1RPTklDKSk7Cit1aW50MzJfdCBTY3JpcHRDOjpydW4oQ29udGV4dCAqcnNjKQoreworICAgIGlmIChtUHJvZ3JhbS5tUm9vdCA9PSBOVUxMKSB7CisgICAgICAgIHJzYy0+c2V0RXJyb3IoUlNfRVJST1JfQkFEX1NDUklQVCwgIkF0dGVtcHRlZCB0byBydW4gYmFkIHNjcmlwdCIpOworICAgICAgICByZXR1cm4gMDsKICAgICB9Ci0gICAgc2V0dXBTY3JpcHQoKTsKKworICAgIHNldHVwU2NyaXB0KHJzYyk7CiAKICAgICB1aW50MzJfdCByZXQgPSAwOwotICAgIHRscy0+bVNjcmlwdCA9IHRoaXM7Ci0gICAgcmV0ID0gbVByb2dyYW0ubVNjcmlwdChsYXVuY2hJbmRleCk7Ci0gICAgdGxzLT5tU2NyaXB0ID0gTlVMTDsKKyAgICBTY3JpcHQgKiBvbGRUTFMgPSBzZXRUTFModGhpcyk7CisgICAgLy9MT0dFKCJTY3JpcHRDOjpydW4gJXAiLCBtUHJvZ3JhbS5tUm9vdCk7CisgICAgcmV0ID0gbVByb2dyYW0ubVJvb3QoKTsKKyAgICBzZXRUTFMob2xkVExTKTsKKyAgICAvL0xPR0UoIlNjcmlwdEM6OnJ1biByZXQgJWkiLCByZXQpOwogICAgIHJldHVybiByZXQ7CiB9CiAKKwordHlwZWRlZiBzdHJ1Y3QgeworICAgIENvbnRleHQgKnJzYzsKKyAgICBTY3JpcHRDICpzY3JpcHQ7CisgICAgY29uc3QgQWxsb2NhdGlvbiAqIGFpbjsKKyAgICBBbGxvY2F0aW9uICogYW91dDsKKyAgICBjb25zdCB2b2lkICogdXNyOworCisgICAgdWludDMyX3QgbVNsaWNlU2l6ZTsKKyAgICB2b2xhdGlsZSBpbnQgbVNsaWNlTnVtOworCisgICAgY29uc3QgdWludDhfdCAqcHRySW47CisgICAgdWludDMyX3QgZVN0cmlkZUluOworICAgIHVpbnQ4X3QgKnB0ck91dDsKKyAgICB1aW50MzJfdCBlU3RyaWRlT3V0OworCisgICAgdWludDMyX3QgeFN0YXJ0OworICAgIHVpbnQzMl90IHhFbmQ7CisgICAgdWludDMyX3QgeVN0YXJ0OworICAgIHVpbnQzMl90IHlFbmQ7CisgICAgdWludDMyX3QgelN0YXJ0OworICAgIHVpbnQzMl90IHpFbmQ7CisgICAgdWludDMyX3QgYXJyYXlTdGFydDsKKyAgICB1aW50MzJfdCBhcnJheUVuZDsKKworICAgIHVpbnQzMl90IGRpbVg7CisgICAgdWludDMyX3QgZGltWTsKKyAgICB1aW50MzJfdCBkaW1aOworICAgIHVpbnQzMl90IGRpbUFycmF5OworfSBNVExhdW5jaFN0cnVjdDsKK3R5cGVkZWYgaW50ICgqcnNfdCkoY29uc3Qgdm9pZCAqLCB2b2lkICosIGNvbnN0IHZvaWQgKiwgdWludDMyX3QsIHVpbnQzMl90LCB1aW50MzJfdCwgdWludDMyX3QpOworCitzdGF0aWMgdm9pZCB3Y194eSh2b2lkICp1c3IsIHVpbnQzMl90IGlkeCkKK3sKKyAgICBNVExhdW5jaFN0cnVjdCAqbXRscyA9IChNVExhdW5jaFN0cnVjdCAqKXVzcjsKKworICAgIHdoaWxlICgxKSB7CisgICAgICAgIHVpbnQzMl90IHNsaWNlID0gKHVpbnQzMl90KWFuZHJvaWRfYXRvbWljX2luYygmbXRscy0+bVNsaWNlTnVtKTsKKyAgICAgICAgdWludDMyX3QgeVN0YXJ0ID0gbXRscy0+eVN0YXJ0ICsgc2xpY2UgKiBtdGxzLT5tU2xpY2VTaXplOworICAgICAgICB1aW50MzJfdCB5RW5kID0geVN0YXJ0ICsgbXRscy0+bVNsaWNlU2l6ZTsKKyAgICAgICAgeUVuZCA9IHJzTWluKHlFbmQsIG10bHMtPnlFbmQpOworICAgICAgICBpZiAoeUVuZCA8PSB5U3RhcnQpIHsKKyAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfQorCisgICAgICAgIC8vTE9HRSgidXNyIGlkeCAlaSwgeCAlaSwlaSAgeSAlaSwlaSIsIGlkeCwgbXRscy0+eFN0YXJ0LCBtdGxzLT54RW5kLCB5U3RhcnQsIHlFbmQpOworCisgICAgICAgIGZvciAodWludDMyX3QgeSA9IHlTdGFydDsgeSA8IHlFbmQ7IHkrKykgeworICAgICAgICAgICAgdWludDMyX3Qgb2Zmc2V0ID0gbXRscy0+ZGltWCAqIHk7CisgICAgICAgICAgICB1aW50OF90ICp4UHRyT3V0ID0gbXRscy0+cHRyT3V0ICsgKG10bHMtPmVTdHJpZGVPdXQgKiBvZmZzZXQpOworICAgICAgICAgICAgY29uc3QgdWludDhfdCAqeFB0ckluID0gbXRscy0+cHRySW4gKyAobXRscy0+ZVN0cmlkZUluICogb2Zmc2V0KTsKKworICAgICAgICAgICAgZm9yICh1aW50MzJfdCB4ID0gbXRscy0+eFN0YXJ0OyB4IDwgbXRscy0+eEVuZDsgeCsrKSB7CisgICAgICAgICAgICAgICAgKChyc190KW10bHMtPnNjcmlwdC0+bVByb2dyYW0ubVJvb3QpICh4UHRySW4sIHhQdHJPdXQsIG10bHMtPnVzciwgeCwgeSwgMCwgMCk7CisgICAgICAgICAgICAgICAgeFB0ckluICs9IG10bHMtPmVTdHJpZGVJbjsKKyAgICAgICAgICAgICAgICB4UHRyT3V0ICs9IG10bHMtPmVTdHJpZGVPdXQ7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKK30KKwordm9pZCBTY3JpcHRDOjpydW5Gb3JFYWNoKENvbnRleHQgKnJzYywKKyAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBBbGxvY2F0aW9uICogYWluLAorICAgICAgICAgICAgICAgICAgICAgICAgIEFsbG9jYXRpb24gKiBhb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHZvaWQgKiB1c3IsCisgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgUnNTY3JpcHRDYWxsICpzYykKK3sKKyAgICBNVExhdW5jaFN0cnVjdCBtdGxzOworICAgIG1lbXNldCgmbXRscywgMCwgc2l6ZW9mKG10bHMpKTsKKworICAgIGlmIChhaW4pIHsKKyAgICAgICAgbXRscy5kaW1YID0gYWluLT5nZXRUeXBlKCktPmdldERpbVgoKTsKKyAgICAgICAgbXRscy5kaW1ZID0gYWluLT5nZXRUeXBlKCktPmdldERpbVkoKTsKKyAgICAgICAgbXRscy5kaW1aID0gYWluLT5nZXRUeXBlKCktPmdldERpbVooKTsKKyAgICAgICAgLy9tdGxzLmRpbUFycmF5ID0gYWluLT5nZXRUeXBlKCktPmdldERpbUFycmF5KCk7CisgICAgfSBlbHNlIGlmIChhb3V0KSB7CisgICAgICAgIG10bHMuZGltWCA9IGFvdXQtPmdldFR5cGUoKS0+Z2V0RGltWCgpOworICAgICAgICBtdGxzLmRpbVkgPSBhb3V0LT5nZXRUeXBlKCktPmdldERpbVkoKTsKKyAgICAgICAgbXRscy5kaW1aID0gYW91dC0+Z2V0VHlwZSgpLT5nZXREaW1aKCk7CisgICAgICAgIC8vbXRscy5kaW1BcnJheSA9IGFvdXQtPmdldFR5cGUoKS0+Z2V0RGltQXJyYXkoKTsKKyAgICB9IGVsc2UgeworICAgICAgICByc2MtPnNldEVycm9yKFJTX0VSUk9SX0JBRF9TQ1JJUFQsICJyc0ZvckVhY2ggY2FsbGVkIHdpdGggbnVsbCBhbGxvY2F0aW9ucyIpOworICAgICAgICByZXR1cm47CisgICAgfQorCisgICAgaWYgKCFzYyB8fCAoc2MtPnhFbmQgPT0gMCkpIHsKKyAgICAgICAgbXRscy54RW5kID0gbXRscy5kaW1YOworICAgIH0gZWxzZSB7CisgICAgICAgIHJzQXNzZXJ0KHNjLT54U3RhcnQgPCBtdGxzLmRpbVgpOworICAgICAgICByc0Fzc2VydChzYy0+eEVuZCA8PSBtdGxzLmRpbVgpOworICAgICAgICByc0Fzc2VydChzYy0+eFN0YXJ0IDwgc2MtPnhFbmQpOworICAgICAgICBtdGxzLnhTdGFydCA9IHJzTWluKG10bHMuZGltWCwgc2MtPnhTdGFydCk7CisgICAgICAgIG10bHMueEVuZCA9IHJzTWluKG10bHMuZGltWCwgc2MtPnhFbmQpOworICAgICAgICBpZiAobXRscy54U3RhcnQgPj0gbXRscy54RW5kKSByZXR1cm47CisgICAgfQorCisgICAgaWYgKCFzYyB8fCAoc2MtPnlFbmQgPT0gMCkpIHsKKyAgICAgICAgbXRscy55RW5kID0gbXRscy5kaW1ZOworICAgIH0gZWxzZSB7CisgICAgICAgIHJzQXNzZXJ0KHNjLT55U3RhcnQgPCBtdGxzLmRpbVkpOworICAgICAgICByc0Fzc2VydChzYy0+eUVuZCA8PSBtdGxzLmRpbVkpOworICAgICAgICByc0Fzc2VydChzYy0+eVN0YXJ0IDwgc2MtPnlFbmQpOworICAgICAgICBtdGxzLnlTdGFydCA9IHJzTWluKG10bHMuZGltWSwgc2MtPnlTdGFydCk7CisgICAgICAgIG10bHMueUVuZCA9IHJzTWluKG10bHMuZGltWSwgc2MtPnlFbmQpOworICAgICAgICBpZiAobXRscy55U3RhcnQgPj0gbXRscy55RW5kKSByZXR1cm47CisgICAgfQorCisgICAgbXRscy54RW5kID0gcnNNYXgoKHVpbnQzMl90KTEsIG10bHMueEVuZCk7CisgICAgbXRscy55RW5kID0gcnNNYXgoKHVpbnQzMl90KTEsIG10bHMueUVuZCk7CisgICAgbXRscy56RW5kID0gcnNNYXgoKHVpbnQzMl90KTEsIG10bHMuekVuZCk7CisgICAgbXRscy5hcnJheUVuZCA9IHJzTWF4KCh1aW50MzJfdCkxLCBtdGxzLmFycmF5RW5kKTsKKworICAgIHJzQXNzZXJ0KGFpbi0+Z2V0VHlwZSgpLT5nZXREaW1aKCkgPT0gMCk7CisKKyAgICBzZXR1cFNjcmlwdChyc2MpOworICAgIFNjcmlwdCAqIG9sZFRMUyA9IHNldFRMUyh0aGlzKTsKKworCisgICAgbXRscy5yc2MgPSByc2M7CisgICAgbXRscy5haW4gPSBhaW47CisgICAgbXRscy5hb3V0ID0gYW91dDsKKyAgICBtdGxzLnNjcmlwdCA9IHRoaXM7CisgICAgbXRscy51c3IgPSB1c3I7CisgICAgbXRscy5tU2xpY2VTaXplID0gMTA7CisgICAgbXRscy5tU2xpY2VOdW0gPSAwOworCisgICAgbXRscy5wdHJJbiA9IE5VTEw7CisgICAgbXRscy5lU3RyaWRlSW4gPSAwOworICAgIGlmIChhaW4pIHsKKyAgICAgICAgbXRscy5wdHJJbiA9IChjb25zdCB1aW50OF90ICopYWluLT5nZXRQdHIoKTsKKyAgICAgICAgbXRscy5lU3RyaWRlSW4gPSBhaW4tPmdldFR5cGUoKS0+Z2V0RWxlbWVudFNpemVCeXRlcygpOworICAgIH0KKworICAgIG10bHMucHRyT3V0ID0gTlVMTDsKKyAgICBtdGxzLmVTdHJpZGVPdXQgPSAwOworICAgIGlmIChhb3V0KSB7CisgICAgICAgIG10bHMucHRyT3V0ID0gKHVpbnQ4X3QgKilhb3V0LT5nZXRQdHIoKTsKKyAgICAgICAgbXRscy5lU3RyaWRlT3V0ID0gYW91dC0+Z2V0VHlwZSgpLT5nZXRFbGVtZW50U2l6ZUJ5dGVzKCk7CisgICAgfQorCisKKyAgICBpZiAoKHJzYy0+Z2V0V29ya2VyUG9vbFNpemUoKSA+IDEpICYmIG1FbnZpcm9tZW50Lm1Jc1RocmVhZGFibGUgJiYKKyAgICAgICAgKChtdGxzLmRpbVkgKiBtdGxzLmRpbVogKiBtdGxzLmRpbUFycmF5KSA+IDEpKSB7CisKKyAgICAgICAgLy9MT0dFKCJsYXVuY2ggMSIpOworICAgICAgICByc2MtPmxhdW5jaFRocmVhZHMod2NfeHksICZtdGxzKTsKKyAgICAgICAgLy9MT0dFKCJsYXVuY2ggMiIpOworICAgIH0gZWxzZSB7CisgICAgICAgIGZvciAodWludDMyX3QgYXIgPSBtdGxzLmFycmF5U3RhcnQ7IGFyIDwgbXRscy5hcnJheUVuZDsgYXIrKykgeworICAgICAgICAgICAgZm9yICh1aW50MzJfdCB6ID0gbXRscy56U3RhcnQ7IHogPCBtdGxzLnpFbmQ7IHorKykgeworICAgICAgICAgICAgICAgIGZvciAodWludDMyX3QgeSA9IG10bHMueVN0YXJ0OyB5IDwgbXRscy55RW5kOyB5KyspIHsKKyAgICAgICAgICAgICAgICAgICAgdWludDMyX3Qgb2Zmc2V0ID0gbXRscy5kaW1YICogbXRscy5kaW1ZICogbXRscy5kaW1aICogYXIgKworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtdGxzLmRpbVggKiBtdGxzLmRpbVkgKiB6ICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbXRscy5kaW1YICogeTsKKyAgICAgICAgICAgICAgICAgICAgdWludDhfdCAqeFB0ck91dCA9IG10bHMucHRyT3V0ICsgKG10bHMuZVN0cmlkZU91dCAqIG9mZnNldCk7CisgICAgICAgICAgICAgICAgICAgIGNvbnN0IHVpbnQ4X3QgKnhQdHJJbiA9IG10bHMucHRySW4gKyAobXRscy5lU3RyaWRlSW4gKiBvZmZzZXQpOworCisgICAgICAgICAgICAgICAgICAgIGZvciAodWludDMyX3QgeCA9IG10bHMueFN0YXJ0OyB4IDwgbXRscy54RW5kOyB4KyspIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICgocnNfdCltUHJvZ3JhbS5tUm9vdCkgKHhQdHJJbiwgeFB0ck91dCwgdXNyLCB4LCB5LCB6LCBhcik7CisgICAgICAgICAgICAgICAgICAgICAgICB4UHRySW4gKz0gbXRscy5lU3RyaWRlSW47CisgICAgICAgICAgICAgICAgICAgICAgICB4UHRyT3V0ICs9IG10bHMuZVN0cmlkZU91dDsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIHNldFRMUyhvbGRUTFMpOworfQorCit2b2lkIFNjcmlwdEM6Okludm9rZShDb250ZXh0ICpyc2MsIHVpbnQzMl90IHNsb3QsIGNvbnN0IHZvaWQgKmRhdGEsIHVpbnQzMl90IGxlbikKK3sKKyAgICAvL0xPR0UoInJzaV9TY3JpcHRJbnZva2UgJWkiLCBzbG90KTsKKyAgICBpZiAoKHNsb3QgPj0gbUVudmlyb21lbnQubUludm9rZUZ1bmN0aW9uQ291bnQpIHx8CisgICAgICAgIChtRW52aXJvbWVudC5tSW52b2tlRnVuY3Rpb25zW3Nsb3RdID09IE5VTEwpKSB7CisgICAgICAgIHJzYy0+c2V0RXJyb3IoUlNfRVJST1JfQkFEX1NDUklQVCwgIkNhbGxpbmcg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REZWZhdWx0UHJvZ3JhbVN0b3JlKCkpOwogICAgIHMtPm1FbnZpcm9tZW50Lm1SYXN0ZXIuc2V0KHJzYy0+Z2V0RGVmYXVsdFByb2dyYW1SYXN0ZXIoKSk7CiAKLSAgICBpZiAocy0+bVByb2dyYW0ubVNjcmlwdCkgeworICAgIGlmIChzLT5tUHJvZ3JhbS5tUm9vdCkgewogICAgICAgICBjb25zdCBzdGF0aWMgaW50IHByYWdtYU1heCA9IDE2OwotICAgICAgICBBQ0NzaXplaSBwcmFnbWFDb3VudDsKLSAgICAgICAgQUNDY2hhciAqIHN0cltwcmFnbWFNYXhdOwotICAgICAgICBhY2NHZXRQcmFnbWFzKHMtPm1BY2NTY3JpcHQsICZwcmFnbWFDb3VudCwgcHJhZ21hTWF4LCAmc3RyWzBdKTsKKyAgICAgICAgQkNDc2l6ZWkgcHJhZ21hQ291bnQ7CisgICAgICAgIEJDQ2NoYXIgKiBzdHJbcHJhZ21hTWF4XTsKKyAgICAgICAgYmNjR2V0UHJhZ21hcyhzLT5tQmNjU2NyaXB0LCAmcHJhZ21hQ291bnQsIHByYWdtYU1heCwgJnN0clswXSk7CiAKICAgICAgICAgZm9yIChpbnQgY3Q9MDsgY3QgPCBwcmFnbWFDb3VudDsgY3QrPTIpIHsKKyAgICAgICAgICAgIC8vTE9HRSgicHJhZ21lICVzICVzIiwgc3RyW2N0XSwgc3RyW2N0KzFdKTsKICAgICAgICAgICAgIGlmICghc3RyY21wKHN0cltjdF0sICJ2ZXJzaW9uIikpIHsKICAgICAgICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgICAgIH0KQEAgLTIwOCwxMSArNDI5LDYgQEAKICAgICAgICAgICAgICAgICAgICAgcy0+bUVudmlyb21lbnQubVZlcnRleC5jbGVhcigpOwogICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgUHJvZ3JhbVZlcnRleCAqIHB2ID0gKFByb2dyYW1WZXJ0ZXggKilyc2MtPmxvb2t1cE5hbWUoc3RyW2N0KzFdKTsKLSAgICAgICAgICAgICAgICBpZiAocHYgIT0gTlVMTCkgewotICAgICAgICAgICAgICAgICAgICBzLT5tRW52aXJvbWVudC5tVmVydGV4LnNldChwdik7Ci0gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOwotICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBMT0dFKCJVbnJlY29uaXplZCB2YWx1ZSAlcyBwYXNzZWQgdG8gc3RhdGVWZXJ0ZXgiLCBzdHJbY3QrMV0pOwogICAgICAgICAgICAgfQogCkBAIC0yMjQsMTEgKzQ0MCw2IEBACiAgICAgICAgICAgICAgICAgICAgIHMtPm1FbnZpcm9tZW50Lm1SYXN0ZXIuY2xlYXIoKTsKICAgICAgICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIFByb2dyYW1SYXN0ZXIgKiBwciA9IChQcm9ncmFtUmFzdGVyICopcnNjLT5sb29rdXBOYW1lKHN0cltjdCsxXSk7Ci0gICAgICAgICAgICAgICAgaWYgKHByICE9IE5VTEwpIHsKLSAgICAgICAgICAgICAgICAgICAgcy0+bUVudmlyb21lbnQubVJhc3Rlci5zZXQocHIpOwotICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKLSAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgTE9HRSgiVW5yZWNvbml6ZWQgdmFsdWUgJXMgcGFzc2VkIHRvIHN0YXRlUmFzdGVyIiwgc3RyW2N0KzFdKTsKICAgICAgICAgICAgIH0KIApAQCAtMjQwLDExICs0NTEsNiBAQAogICAgICAgICAgICAgICAgICAgICBzLT5tRW52aXJvbWVudC5tRnJhZ21lbnQuY2xlYXIoKTsKICAgICAgICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIFByb2dyYW1GcmFnbWVudCAqIHBmID0gKFByb2dyYW1GcmFnbWVudCAqKXJzYy0+bG9va3VwTmFtZShzdHJbY3QrMV0pOwotICAgICAgICAgICAgICAgIGlmIChwZiAhPSBOVUxMKSB7Ci0gICAgICAgICAgICAgICAgICAgIHMtPm1FbnZpcm9tZW50Lm1GcmFnbWVudC5zZXQocGYpOwotICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKLSAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgTE9HRSgiVW5yZWNvbml6ZWQgdmFsdWUgJXMgcGFzc2VkIHRvIHN0YXRlRnJhZ21lbnQiLCBzdHJbY3QrMV0pOwogICAgICAgICAgICAgfQogCkBAIC0yNTYsMTIgKzQ2Miw2IEBACiAgICAgICAgICAgICAgICAgICAgIHMtPm1FbnZpcm9tZW50Lm1GcmFnbWVudFN0b3JlLmNsZWFyKCk7CiAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBQcm9ncmFtRnJhZ21lbnRTdG9yZSAqIHBmcyA9Ci0gICAgICAgICAgICAgICAgICAgIChQcm9ncmFtRnJhZ21lbnRTdG9yZSAqKXJzYy0+bG9va3VwTmFtZShzdHJbY3QrMV0pOwotICAgICAgICAgICAgICAgIGlmIChwZnMgIT0gTlVMTCkgewotICAgICAgICAgICAgICAgICAgICBzLT5tRW52aXJvbWVudC5tRnJhZ21lbnRTdG9yZS5zZXQocGZzKTsKLSAgICAgICAgICAgICAgICAgICAgY29udGludWU7Ci0gICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIExPR0UoIlVucmVjb25pemVkIHZhbHVlICVzIHBhc3NlZCB0byBzdGF0ZVN0b3JlIiwgc3RyW2N0KzFdKTsKICAgICAgICAgICAgIH0KIApAQCAtMjczLDExMSArNDczLDYgQEAKICAgICB9CiB9CiAKLXN0YXRpYyB2b2lkIGFwcGVuZEVsZW1lbnRCb2R5KFN0cmluZzggKnMsIGNvbnN0IEVsZW1lbnQgKmUpC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cHRzKSB7Ci0gICAgICAgICAgICAgICAgTE9HVigiJXMiLCBzdGF0aWNfY2FzdDxjb25zdCBjaGFyKj4ocykpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgc3RyLT5hcHBlbmQocyk7Ci0gICAgICAgIH0KLQotICAgICAgICBpZiAobVNsb3ROYW1lc1tjdF0ubGVuZ3RoKCkgPiAwKSB7Ci0gICAgICAgICAgICBTdHJpbmc4IHM7Ci0gICAgICAgICAgICBpZiAoZS0+Z2V0TmFtZSgpKSB7Ci0gICAgICAgICAgICAgICAgLy8gVXNlIHRoZSBuYW1lZCBzdHJ1Y3QKLSAgICAgICAgICAgICAgICBzLnNldFRvKGUtPmdldE5hbWUoKSk7Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIC8vIGNyZWF0ZSBhbiBzdHJ1Y3QgbmFtZWQgZnJvbSB0aGUgc2xvdC4KLSAgICAgICAgICAgICAgICBzLnNldFRvKCJzdHJ1Y3QgIik7Ci0gICAgICAgICAgICAgICAgcy5hcHBlbmQobVNsb3ROYW1lc1tjdF0pOwotICAgICAgICAgICAgICAgIHMuYXBwZW5kKCJfcyIpOwotICAgICAgICAgICAgICAgIHMuYXBwZW5kKGUtPmdldENTdHJ1Y3RCb2R5KCkpOwotICAgICAgICAgICAgICAgIC8vYXBwZW5kRWxlbWVudEJvZHkoJnMsIGUpOwotICAgICAgICAgICAgICAgIHMuYXBwZW5kKCI7XG4iKTsKLSAgICAgICAgICAgICAgICBzLmFwcGVuZCgic3RydWN0ICIpOwotICAgICAgICAgICAgICAgIHMuYXBwZW5kKG1TbG90TmFtZXNbY3RdKTsKLSAgICAgICAgICAgICAgICBzLmFwcGVuZCgiX3MiKTsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgcy5hcHBlbmQoIiAqICIpOwotICAgICAgICAgICAgcy5hcHBlbmQobVNsb3ROYW1lc1tjdF0pOwotICAgICAgICAgICAgcy5hcHBlbmQoIjtcbiIpOwotICAg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JBTktTXTsKICAgICB9OwogCiAgICAgUHJvZ3JhbV90IG1Qcm9ncmFtOwogCi0gICAgQUNDc2NyaXB0KiAgICBtQWNjU2NyaXB0OworICAgIEJDQ3NjcmlwdCogICAgbUJjY1NjcmlwdDsKIAotICAgIHZpcnR1YWwgdm9pZCBzZXR1cFNjcmlwdCgpOwotICAgIHZpcnR1YWwgdWludDMyX3QgcnVuKENvbnRleHQgKiwgdWludDMyX3QgbGF1bmNoSUQpOworICAgIGNvbnN0IEFsbG9jYXRpb24gKnB0clRvQWxsb2NhdGlvbihjb25zdCB2b2lkICopIGNvbnN0OworCisKKyAgICB2aXJ0dWFsIHZvaWQgSW52b2tlKENvbnRleHQgKnJzYywgdWludDMyX3Qgc2xvdCwgY29uc3Qgdm9pZCAqZGF0YSwgdWludDMyX3QgbGVuKTsKKworICAgIHZpcnR1YWwgdWludDMyX3QgcnVuKENvbnRleHQgKik7CisKKyAgICB2aXJ0dWFsIHZvaWQgcnVuRm9yRWFjaChDb250ZXh0ICpyc2MsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgQWxsb2NhdGlvbiAqIGFpbiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBBbGxvY2F0aW9uICogYW91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCB2b2lkICogdXNyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IFJzU2NyaXB0Q2FsbCAqc2MgPSBOVUxMKTsKKworICAgIHZpcnR1YWwgdm9pZCBzZXJpYWxpemUoT1N0cmVhbSAqc3RyZWFtKSBjb25zdCB7ICAgIH0KKyAgICB2aXJ0dWFsIFJzQTNEQ2xhc3NJRCBnZXRDbGFzc0lkKCkgY29uc3QgeyByZXR1cm4gUlNfQTNEX0NMQVNTX0lEX1NDUklQVF9DOyB9CisgICAgc3RhdGljIFR5cGUgKmNyZWF0ZUZyb21TdHJlYW0oQ29udGV4dCAqcnNjLCBJU3RyZWFtICpzdHJlY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GlmICghcnNjLT5zZXR1cENoZWNrKCkpIHsKLSAgICAgICAgcmV0dXJuOwotICAgIH0KLQotICAgIGZsb2F0IHZ0eFtdID0geyB4LCB5LCB6IH07Ci0KLSAgICBWZXJ0ZXhBcnJheSB2YTsKLSAgICB2YS5hZGRMZWdhY3koR0xfRkxPQVQsIDMsIDEyLCBSU19LSU5EX1BPU0lUSU9OLCBmYWxzZSwgKHVpbnQzMl90KXZ0eCk7Ci0gICAgaWYgKHJzYy0+Y2hlY2tWZXJzaW9uMl8wKCkpIHsKLSAgICAgICAgdmEuc2V0dXBHTDIocnNjLCAmcnNjLT5tU3RhdGVWZXJ0ZXhBcnJheSwgJnJzYy0+bVNoYWRlckNhY2hlKTsKLSAgICB9IGVsc2UgewotICAgICAgICB2YS5zZXR1cEdMKHJzYywgJnJzYy0+bVN0YXRlVmVydGV4QXJyYXkpOwotICAgIH0KLQotICAgIGdsRHJhd0FycmF5cyhHTF9QT0lOVFMsIDAsIDEpOwotfQotCi1zdGF0aWMgdm9pZCBTQ19kcmF3UXVhZFRleENvb3JkcyhmbG9hdCB4MSwgZmxvYXQgeTEsIGZsb2F0IHoxLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgdTEsIGZsb2F0IHYxLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgeDIsIGZsb2F0IHkyLCBmbG9hdCB6MiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsb2F0IHUyLCBmbG9hdCB2MiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsb2F0IHgzLCBmbG9hdCB5MywgZmxvYXQgejMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCB1MywgZmxvYXQgdjMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCB4NCwgZmxvYXQgeTQsIGZsb2F0IHo0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAg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qICgxLjBmIC0geSAqICgxLjBmIC0gZikpOwotCi0gICAgc3dpdGNoIChpaGYpIHsKLSAgICAgICAgY2FzZSAwOiAgICAgICAgIC8vIFJlZCBpcyB0aGUgZG9taW5hbnQgY29sb3IKLSAgICAgICAgICAgIHJlZCA9IHo7Ci0gICAgICAgICAgICBncmVlbiA9IHR2OwotICAgICAgICAgICAgYmx1ZSA9IHB2OwotICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgIGNhc2UgMTogICAgICAgICAvLyBHcmVlbiBpcyB0aGUgZG9taW5hbnQgY29sb3IKLSAgICAgICAgICAgIHJlZCA9IHF2OwotICAgICAgICAgICAgZ3JlZW4gPSB6OwotICAgICAgICAgICAgYmx1ZSA9IHB2OwotICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgIGNhc2UgMjoKLSAgICAgICAgICAgIHJlZCA9IHB2OwotICAgICAgICAgICAgZ3JlZW4gPSB6OwotICAgICAgICAgICAgYmx1ZSA9IHR2OwotICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgIGNhc2UgMzogICAgICAgICAvLyBCbHVlIGlzIHRoZSBkb21pbmFudCBjb2xvcgotICAgICAgICAgICAgcmVkID0gcHY7Ci0gICAgICAgICAgICBncmVlbiA9IHF2OwotICAgICAgICAgICAgYmx1ZSA9IHo7Ci0gICAgICAgICAgICBicmVhazsKLSAgICAgICAgY2FzZSA0OgotICAgICAgICAgICAgcmVkID0gdHY7Ci0gICAgICAgICAgICBncmVlbiA9IHB2OwotICAgICAgICAgICAgYmx1ZSA9IHo7Ci0gICAgICAgICAgICBicmVhazsKLSAgICAgICAgY2FzZSA1OiAgICAgICAgIC8vIFJlZCBpcyB0aGUgZG9taW5hbnQgY29sb3IKLSAgICAgICAgICAgIHJlZCA9IHo7Ci0gICAgICAgICAgICBncmVlbiA9IHB2OwotICAgICAgICAgICAgYmx1ZSA9IHF2OwotICAgICAgICAgICAgYnJlYWs7Ci0gICAgfQotCi0gICAgcmdiWzBdID0gcmVk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ICAgICAgICA6Oj0gYyAgIyBjaGFyCisvLyAgICAgICAgICAgICAgICAgOjo9IGEgICMgc2lnbmVkIGNoYXIKKy8vICAgICAgICAgICAgICAgICA6Oj0gaCAgIyB1bnNpZ25lZCBjaGFyCisvLyAgICAgICAgICAgICAgICAgOjo9IHMgICMgc2hvcnQKKy8vICAgICAgICAgICAgICAgICA6Oj0gdCAgIyB1bnNpZ25lZCBzaG9ydAorLy8gICAgICAgICAgICAgICAgIDo6PSBpICAjIGludAorLy8gICAgICAgICAgICAgICAgIDo6PSBqICAjIHVuc2lnbmVkIGludAorLy8gICAgICAgICAgICAgICAgIDo6PSBsICAjIGxvbmcKKy8vICAgICAgICAgICAgICAgICA6Oj0gbSAgIyB1bnNpZ25lZCBsb25nCisvLyAgICAgICAgICAgICAgICAgOjo9IHggICMgbG9uZyBsb25nLCBfX2ludDY0CisvLyAgICAgICAgICAgICAgICAgOjo9IHkgICMgdW5zaWduZWQgbG9uZyBsb25nLCBfX2ludDY0CisvLyAgICAgICAgICAgICAgICAgOjo9IGYgICMgZmxvYXQKKy8vICAgICAgICAgICAgICAgICA6Oj0gZCAgIyBkb3VibGUKIAotICAgIC8vIG1hdGgKLSAgICB7ICJtb2RmIiwgKHZvaWQgKikmZm1vZCwKLSAgICAgICAgImZsb2F0IiwgIihmbG9hdCwgZmxvYXQpIiB9LAotICAgIHsgImFicyIsICh2b2lkICopJmFicywKLSAgICAgICAgImludCIsICIoaW50KSIgfSwKLSAgICB7ICJhYnNmIiwgKHZvaWQgKikmZmFic2YsCi0gICAgICAgICJmbG9hdCIsICIoZmxvYXQpIiB9LAotICAgIHsgInNpbmZfZmFzdCIsICh2b2lkICopJlNDX3NpbmZfZmFzdCwKLSAgICAgICAgImZsb2F0IiwgIihmbG9hdCkiIH0sCi0gICAgeyAiY29zZl9mYXN0IiwgKHZvaWQgKikmU0NfY29zZl9mYXN0LAotICAgICAgICAiZmxvYXQiLCAiKGZsb2F0KSIgfSwKLSAgICB7ICJzaW5mIiwgKHZvaWQgKikmc2luZiwKLSAgICAgICAgImZsb2F0IiwgIihmbG9hdCkiIH0sCi0gICAgeyAiY29zZiIsICh2b2lkICopJmNvc2YsCi0gICAgICAgICJmbG9hdCIsICIoZmxvYXQpIiB9LAotICAgIHsgImFzaW5mIiwgKHZvaWQgKikmYXNpbmYsCi0gICAgICAgICJmbG9hdCIsICIoZmxvYXQpIiB9LAotICAgIHsgImFjb3NmIiwgKHZvaWQgKikmYWNvc2YsCi0gICAgICAgICJmbG9hdCIsICIoZmxvYXQpIiB9LAotICAgIHsgImF0YW5mIiwgKHZvaWQgKikmYXRhbmYsCi0gICAgICAgICJmbG9hdCIsICIoZmxvYXQpIiB9LAotICAgIHsgImF0YW4yZiIsICh2b2lkICopJmF0YW4yZiwKLSAgICAgICAgImZsb2F0IiwgIihmbG9hdCwgZmxvYXQpIiB9LAotICAgIHsgImZhYnNmIiwgKHZvaWQgKikmZmFic2YsCi0gICAgICAgICJmbG9hdCIsICIoZmxvYXQpIiB9LAotICAgIHsgInJhbmRmIiwgKHZvaWQgKikmU0NfcmFuZGYsCi0gICAgICAgICJmbG9hdCIsICIoZmxvYXQpIiB9LAotICAgIHsgInJhbmRmMiIsICh2b2lkICopJlNDX3JhbmRmMiwKLSAgICAgICAgImZsb2F0IiwgIihmbG9hdCwgZmxvYXQpIiB9LAotICAgIHsgImZsb29yZiIsICh2b2lkICopJmZsb29yZiwKLSAgICAgICAgImZsb2F0IiwgIihmbG9hdCkiIH0sCi0gICAgeyAiZnJhY2YiLCAodm9pZCAqKSZTQ19mcmFjZiwKLSAgICAgICAgImZsb2F0IiwgIihmbG9hdCkiIH0sCi0gICAgeyAiY2VpbGYiLCAodm9pZCAqKSZjZWlsZiwKLSAgICAgICAgImZsb2F0IiwgIihmbG9hdCkiIH0sCi0gICAgeyAicm91bmRmIiwgKHZvaWQgKikmU0Nfcm91bmRmLAotICAgICAgICAiZmxvYXQiLCAiKGZsb2F0KSIgfSwKLSAgICB7ICJleHBmIiwgKHZvaWQgKikmZXhwZiwKLSAgICAgICAgImZsb2F0IiwgIihmbG9hdCkiIH0sCi0gICAgeyAibG9nZiIsICh2b2lkICopJmxvZ2YsCi0gICAgICAgICJmbG9hdCIsICIoZmxvYXQpIiB9LAotICAgIHsgInBvd2YiLCAodm9pZCAqKSZwb3dmLAotICAgICAgICAiZmxvYXQiLCAiKGZsb2F0LCBmbG9hdCkiIH0sCi0gICAgeyAibWF4ZiIsICh2b2lkICopJlNDX21heGYsCi0gICAgICAgICJmbG9hdCIsICIoZmxvYXQsIGZsb2F0KSIgfSwKLSAgICB7ICJtaW5mIiwgKHZvaWQgKikmU0NfbWluZiwKLSAgICAgICAgImZsb2F0IiwgIihmbG9hdCwgZmxvYXQpIiB9LAotICAgIHsgInNxcnQiLCAodm9pZCAqKSZzcXJ0LAotICAgICAgICAiaW50IiwgIihpbnQpIiB9LAotICAgIHsgInNxcnRmIiwgKHZvaWQgKikmc3FydGYsCi0gICAgICAgICJmbG9hdCIsICIoZmxvYXQpIiB9LAotICAgIHsgInNxciIsICh2b2lkICopJlNDX3NxciwKLSAgICAgICAgImludCIsICIoaW50KSIgfSwKLSAgICB7ICJzcXJmIiwgKHZvaWQgKikmU0Nfc3FyZiwKLSAgICAgICAgImZsb2F0IiwgIihmbG9hdCkiIH0sCi0gICAgeyAic2lnbiIsICh2b2lkICopJlNDX3NpZ24sCi0gICAgICAgICJpbnQiLCAiKGludCkiIH0sCi0gICAgeyAic2lnbmYiLCAodm9pZCAqKSZTQ19zaWduZiwKLSAgICAgICAgImZsb2F0IiwgIihmbG9hdCkiIH0sCi0gICAgeyAiY2xhbXAiLCAodm9pZCAqKSZTQ19jbGFtcCwKLSAgICAgICAgImludCIsICIoaW50LCBpbnQsIGludCkiIH0sCi0gICAgeyAiY2xhbXBmIiwgKHZvaWQgKikmU0NfY2xhbXBmLAotICAgICAgICAiZmxvYXQiLCAiKGZsb2F0LCBmbG9hdCwgZmxvYXQpIiB9LAotICAgIHsgImRpc3Rm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RDLmgiCisKKy8vIEltcGxlbWVudHMgcnNfY2wucnNoCisKKwordXNpbmcgbmFtZXNwYWNlIGFuZHJvaWQ7Cit1c2luZyBuYW1lc3BhY2UgYW5kcm9pZDo6cmVuZGVyc2NyaXB0OworCisKK3N0YXRpYyBmbG9hdCBTQ19hY29zcGkoZmxvYXQgdikgeworICAgIHJldHVybiBhY29zZih2KS8gTV9QSTsKK30KKworc3RhdGljIGZsb2F0IFNDX2FzaW5waShmbG9hdCB2KSB7CisgICAgcmV0dXJuIGFzaW5mKHYpIC8gTV9QSTsKK30KKworc3RhdGljIGZsb2F0IFNDX2F0YW5waShmbG9hdCB2KSB7CisgICAgcmV0dXJuIGF0YW5mKHYpIC8gTV9QSTsKK30KKworc3RhdGljIGZsb2F0IFNDX2F0YW4ycGkoZmxvYXQgeSwgZmxvYXQgeCkgeworICAgIHJldHVybiBhdGFuMmYoeSwgeCkgLyBNX1BJOworfQorCitzdGF0aWMgZmxvYXQgU0NfY29zcGkoZmxvYXQgdikgeworICAgIHJldHVybiBjb3NmKHYgKiBNX1BJKTsKK30KKworc3RhdGljIGZsb2F0IFNDX2V4cDEwKGZsb2F0IHYpIHsKKyAgICByZXR1cm4gcG93KDEwLmYsIHYpOworCit9CisKK3N0YXRpYyBmbG9hdCBTQ19mcmFjdChmbG9hdCB2LCBpbnQgKmlwdHIpIHsKKyAgICBpbnQgaSA9IChpbnQpZmxvb3Iodik7CisgICAgaXB0clswXSA9IGk7CisgICAgcmV0dXJuIGZtaW4odiAtIGksIDB4MS5mZmZmZmVwLTFmKTsKK30KKworc3RhdGljIGZsb2F0IFNDX2xvZzIoZmxvYXQgdikgeworICAgIHJldHVybiBsb2cxMCh2KSAvIGxvZzEwKDIuZik7Cit9CisKK3N0YXRpYyBmbG9hdCBTQ19wb3duKGZsb2F0IHYsIGludCBwKSB7CisgICAgcmV0dXJuIHBvd2YodiwgKGZsb2F0KXApOworfQorCitzdGF0aWMgZmxvYXQgU0NfcG93cihmbG9hdCB2L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y8vLy8vCisvLyBDbGFzcyBpbXBsZW1lbnRhdGlvbgorLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vCisKKy8vIGxsdm0gbmFtZSBtYW5nbGluZyByZWYKKy8vICA8YnVpbHRpbi10eXBlPiA6Oj0gdiAgIyB2b2lkCisvLyAgICAgICAgICAgICAgICAgOjo9IGIgICMgYm9vbAorLy8gICAgICAgICAgICAgICAgIDo6PSBjICAjIGNoYXIKKy8vICAgICAgICAgICAgICAgICA6Oj0gYSAgIyBzaWduZWQgY2hhcgorLy8gICAgICAgICAgICAgICAgIDo6PSBoICAjIHVuc2lnbmVkIGNoYXIKKy8vICAgICAgICAgICAgICAgICA6Oj0gcyAgIyBzaG9ydAorLy8gICAgICAgICAgICAgICAgIDo6PSB0ICAjIHVuc2lnbmVkIHNob3J0CisvLyAgICAgICAgICAgICAgICAgOjo9IGkgICMgaW50CisvLyAgICAgICAgICAgICAgICAgOjo9IGogICMgdW5zaWduZWQgaW50CisvLyAgICAgICAgICAgICAgICAgOjo9IGwgICMgbG9uZworLy8gICAgICAgICAgICAgICAgIDo6PSBtICAjIHVuc2lnbmVkIGxvbmcKKy8vICAgICAgICAgICAgICAgICA6Oj0geCAgIyBsb25nIGxvbmcsIF9faW50NjQKKy8vICAgICAgICAgICAgICAgICA6Oj0geSAgIyB1bnNpZ25lZCBsb25nIGxvbmcsIF9faW50NjQKKy8vICAgICAgICAgICAgICAgICA6Oj0gZiAgIyBmbG9hdAorLy8gICAgICAgICAgICAgICAgIDo6PSBkICAjIGRvdWJsZQorCitzdGF0aWMgU2NyaXB0Q1N0YXRlOjpTeW1ib2xUYWJsZV90IGdTeW1zW10gPSB7CisgICAgLy8gT3BlbkNMIG1hdGgKKyAgICB7ICJfWjRhY29zZiIsICh2b2lkICopJmFjb3NmIH0sCisgICAgeyAiX1o1YWNvc2hmI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M2Fic3MiLCAodm9pZCAqKSZTQ19hYnNfaTE2IH0sCisgICAgeyAiX1ozYWJzYyIsICh2b2lkICopJlNDX2Fic19pOCB9LAorICAgIHsgIl9aM2NsemoiLCAodm9pZCAqKSZTQ19jbHpfdTMyIH0sCisgICAgeyAiX1ozY2x6dCIsICh2b2lkICopJlNDX2Nsel91MTYgfSwKKyAgICB7ICJfWjNjbHpoIiwgKHZvaWQgKikmU0NfY2x6X3U4IH0sCisgICAgeyAiX1ozY2x6aSIsICh2b2lkICopJlNDX2Nsel9pMzIgfSwKKyAgICB7ICJfWjNjbHpzIiwgKHZvaWQgKikmU0NfY2x6X2kxNiB9LAorICAgIHsgIl9aM2NsemMiLCAodm9pZCAqKSZTQ19jbHpfaTggfSwKKyAgICB7ICJfWjNtYXhqaiIsICh2b2lkICopJlNDX21heF91MzIgfSwKKyAgICB7ICJfWjNtYXh0dCIsICh2b2lkICopJlNDX21heF91MTYgfSwKKyAgICB7ICJfWjNtYXhoaCIsICh2b2lkICopJlNDX21heF91OCB9LAorICAgIHsgIl9aM21heGlpIiwgKHZvaWQgKikmU0NfbWF4X2kzMiB9LAorICAgIHsgIl9aM21heHNzIiwgKHZvaWQgKikmU0NfbWF4X2kxNiB9LAorICAgIHsgIl9aM21heGNjIiwgKHZvaWQgKikmU0NfbWF4X2k4IH0sCisgICAgeyAiX1ozbWluamoiLCAodm9pZCAqKSZTQ19taW5fdTMyIH0sCisgICAgeyAiX1ozbWludHQiLCAodm9pZCAqKSZTQ19taW5fdTE2IH0sCisgICAgeyAiX1ozbWluaGgiLCAodm9pZCAqKSZTQ19taW5fdTggfSwKKyAgICB7ICJfWjNtaW5paSIsICh2b2lkICopJlNDX21pbl9pMzIgfSwKKyAgICB7ICJfWjNtaW5zcyIsICh2b2lkICopJlNDX21pbl9pMTYgfSwKKyAgICB7ICJfWjNtaW5jYyIsICh2b2lkICopJlNDX21pbl9pOCB9LAorCisgICAgLy8gT3BlbkNMIDYuMTEuNAorICAgIHsgIl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tZW50ICo+KHZwZiksCisgICAgICAgICAgICAgICAgICAgICAgICAgICBzbG90LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhdGljX2Nhc3Q8QWxsb2NhdGlvbiAqPih2YSkpOworCit9CisKK3N0YXRpYyB2b2lkIFNDX2JpbmRTYW1wbGVyKFJzUHJvZ3JhbUZyYWdtZW50IHZwZiwgdWludDMyX3Qgc2xvdCwgUnNTYW1wbGVyIHZzKQoreworICAgIEdFVF9UTFMoKTsKKyAgICByc2lfUHJvZ3JhbUJpbmRTYW1wbGVyKHJzYywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRpY19jYXN0PFByb2dyYW1GcmFnbWVudCAqPih2cGYpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgc2xvdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRpY19jYXN0PFNhbXBsZXIgKj4odnMpKTsKKworfQorCitzdGF0aWMgdm9pZCBTQ19iaW5kUHJvZ3JhbVN0b3JlKFJzUHJvZ3JhbVN0b3JlIHBmcykKK3sKKyAgICBHRVRfVExTKCk7CisgICAgcnNpX0NvbnRleHRCaW5kUHJvZ3JhbVN0b3JlKHJzYywgcGZzKTsKK30KKworc3RhdGljIHZvaWQgU0NfYmluZFByb2dyYW1GcmFnbWVudChSc1Byb2dyYW1GcmFnbWVudCBwZikKK3sKKyAgICBHRVRfVExTKCk7CisgICAgcnNpX0NvbnRleHRCaW5kUHJvZ3JhbUZyYWdtZW50KHJzYywgcGYpOworfQorCitzdGF0aWMgdm9pZCBTQ19iaW5kUHJvZ3JhbVZlcnRleChSc1Byb2dyYW1WZXJ0ZXggcHYpCit7CisgICAgR0VUX1RMUygpOworICAgIHJzaV9Db250ZXh0QmluZFByb2dyYW1WZXJ0ZXgocnNjLCBwdik7Cit9CisKK3N0YXRpYyB2b2lkIFNDX2JpbmRQcm9ncmFtUmFzdGVyKFJzUHJvZ3JhbVJhc3RlciBwdikKK3sKKyAgICBHRVRfVEx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gYSk7Cit9CisKK3N0YXRpYyB2b2lkIFNDX3ZwR2V0UHJvamVjdGlvbk1hdHJpeChyc2NfTWF0cml4ICptKQoreworICAgIEdFVF9UTFMoKTsKKyAgICByc2MtPmdldFZlcnRleCgpLT5nZXRQcm9qZWN0aW9uTWF0cml4KG0pOworfQorCisKKy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLworLy8gRHJhd2luZworLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vCisKK3N0YXRpYyB2b2lkIFNDX2RyYXdRdWFkVGV4Q29vcmRzKGZsb2F0IHgxLCBmbG9hdCB5MSwgZmxvYXQgejEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCB1MSwgZmxvYXQgdjEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCB4MiwgZmxvYXQgeTIsIGZsb2F0IHoyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgdTIsIGZsb2F0IHYyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgeDMsIGZsb2F0IHkzLCBmbG9hdCB6MywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsb2F0IHUzLCBmbG9hdCB2MywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsb2F0IHg0LCBmbG9hdCB5NCwgZmxvYXQgejQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCB1NCwgZmxvYXQgdjQpCit7CisgICAgR0VUX1RMUygpOworICAgIGlmICghcnNjLT5zZXR1cENoZWNrKCkpIHsKKyAgICAgICAgcmV0dXJuOworICAgIH0KKworICAg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29yZHMoeDEsIHkxLCB6MSwgMCwgMSwKKyAgICAgICAgICAgICAgICAgICAgICAgICB4MiwgeTIsIHoyLCAxLCAxLAorICAgICAgICAgICAgICAgICAgICAgICAgIHgzLCB5MywgejMsIDEsIDAsCisgICAgICAgICAgICAgICAgICAgICAgICAgeDQsIHk0LCB6NCwgMCwgMCk7Cit9CisKK3N0YXRpYyB2b2lkIFNDX2RyYXdTcHJpdGVTY3JlZW5zcGFjZShmbG9hdCB4LCBmbG9hdCB5LCBmbG9hdCB6LCBmbG9hdCB3LCBmbG9hdCBoKQoreworICAgIEdFVF9UTFMoKTsKKyAgICBPYmplY3RCYXNlUmVmPGNvbnN0IFByb2dyYW1WZXJ0ZXg+IHRtcChyc2MtPmdldFZlcnRleCgpKTsKKyAgICByc2MtPnNldFZlcnRleChyc2MtPmdldERlZmF1bHRQcm9ncmFtVmVydGV4KCkpOworICAgIC8vcnNjLT5zZXR1cENoZWNrKCk7CisKKyAgICAvL0dMaW50IGNyb3BbNF0gPSB7MCwgaCwgdywgLWh9OworCisgICAgZmxvYXQgc2ggPSByc2MtPmdldEhlaWdodCgpOworCisgICAgU0NfZHJhd1F1YWQoeCwgICBzaCAtIHksICAgICB6LAorICAgICAgICAgICAgICAgIHgrdywgc2ggLSB5LCAgICAgeiwKKyAgICAgICAgICAgICAgICB4K3csIHNoIC0gKHkraCksIHosCisgICAgICAgICAgICAgICAgeCwgICBzaCAtICh5K2gpLCB6KTsKKyAgICByc2MtPnNldFZlcnRleCgoUHJvZ3JhbVZlcnRleCAqKXRtcC5nZXQoKSk7Cit9CisvKgorc3RhdGljIHZvaWQgU0NfZHJhd1Nwcml0ZShmbG9hdCB4LCBmbG9hdCB5LCBmbG9hdCB6LCBmbG9hdCB3LCBmbG9hdCBoKQoreworICAgIEdFVF9UTFMoKTsKKyAgICBmbG9hdCB2aW5bM10gPSB7eCwgeSwgen07CisgICAgZmxvYXQgdm91dFs0XTsKKworICAgIC8vTE9HRSgiZHMgIGluICVmICVm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B4MiwgeTEsIHosCisgICAgICAgICAgICAgICAgeDEsIHkxLCB6KTsKK30KKworc3RhdGljIHZvaWQgU0NfZHJhd01lc2goUnNNZXNoIHZzbSkKK3sKKyAgICBHRVRfVExTKCk7CisgICAgTWVzaCAqc20gPSBzdGF0aWNfY2FzdDxNZXNoICo+KHZzbSk7CisgICAgaWYgKCFyc2MtPnNldHVwQ2hlY2soKSkgeworICAgICAgICByZXR1cm47CisgICAgfQorICAgIHNtLT5yZW5kZXIocnNjKTsKK30KKworc3RhdGljIHZvaWQgU0NfZHJhd01lc2hQcmltaXRpdmUoUnNNZXNoIHZzbSwgdWludDMyX3QgcHJpbUluZGV4KQoreworICAgIEdFVF9UTFMoKTsKKyAgICBNZXNoICpzbSA9IHN0YXRpY19jYXN0PE1lc2ggKj4odnNtKTsKKyAgICBpZiAoIXJzYy0+c2V0dXBDaGVjaygpKSB7CisgICAgICAgIHJldHVybjsKKyAgICB9CisgICAgc20tPnJlbmRlclByaW1pdGl2ZShyc2MsIHByaW1JbmRleCk7Cit9CisKK3N0YXRpYyB2b2lkIFNDX2RyYXdNZXNoUHJpbWl0aXZlUmFuZ2UoUnNNZXNoIHZzbSwgdWludDMyX3QgcHJpbUluZGV4LCB1aW50MzJfdCBzdGFydCwgdWludDMyX3QgbGVuKQoreworICAgIEdFVF9UTFMoKTsKKyAgICBNZXNoICpzbSA9IHN0YXRpY19jYXN0PE1lc2ggKj4odnNtKTsKKyAgICBpZiAoIXJzYy0+c2V0dXBDaGVjaygpKSB7CisgICAgICAgIHJldHVybjsKKyAgICB9CisgICAgc20tPnJlbmRlclByaW1pdGl2ZVJhbmdlKHJzYywgcHJpbUluZGV4LCBzdGFydCwgbGVuKTsKK30KKworc3RhdGljIHZvaWQgU0NfbWVzaENvbXB1dGVCb3VuZGluZ0JveChSc01lc2ggdnNtLCBmbG9hdCAqbWluWCwgZmxvYXQgKm1pblksIGZsb2F0ICptaW5aLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC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Bib29sCisvLyAgICAgICAgICAgICAgICAgOjo9IGMgICMgY2hhcgorLy8gICAgICAgICAgICAgICAgIDo6PSBhICAjIHNpZ25lZCBjaGFyCisvLyAgICAgICAgICAgICAgICAgOjo9IGggICMgdW5zaWduZWQgY2hhcgorLy8gICAgICAgICAgICAgICAgIDo6PSBzICAjIHNob3J0CisvLyAgICAgICAgICAgICAgICAgOjo9IHQgICMgdW5zaWduZWQgc2hvcnQKKy8vICAgICAgICAgICAgICAgICA6Oj0gaSAgIyBpbnQKKy8vICAgICAgICAgICAgICAgICA6Oj0gaiAgIyB1bnNpZ25lZCBpbnQKKy8vICAgICAgICAgICAgICAgICA6Oj0gbCAgIyBsb25nCisvLyAgICAgICAgICAgICAgICAgOjo9IG0gICMgdW5zaWduZWQgbG9uZworLy8gICAgICAgICAgICAgICAgIDo6PSB4ICAjIGxvbmcgbG9uZywgX19pbnQ2NAorLy8gICAgICAgICAgICAgICAgIDo6PSB5ICAjIHVuc2lnbmVkIGxvbmcgbG9uZywgX19pbnQ2NAorLy8gICAgICAgICAgICAgICAgIDo6PSBmICAjIGZsb2F0CisvLyAgICAgICAgICAgICAgICAgOjo9IGQgICMgZG91YmxlCisKK3N0YXRpYyBTY3JpcHRDU3RhdGU6OlN5bWJvbFRhYmxlX3QgZ1N5bXNbXSA9IHsKKyAgICB7ICJfWjIycnNnQmluZFByb2dyYW1GcmFnbWVudDE5cnNfcHJvZ3JhbV9mcmFnbWVudCIsICh2b2lkICopJlNDX2JpbmRQcm9ncmFtRnJhZ21lbnQgfSwKKyAgICB7ICJfWjE5cnNnQmluZFByb2dyYW1TdG9yZTE2cnNfcHJvZ3JhbV9zdG9yZSIsICh2b2lkICopJlNDX2JpbmRQcm9ncmFtU3RvcmUgfSwKKyAgICB7ICJfWjIwcnNnQmluZFByb2dyYW1WZXJ0ZXgxN3JzX3Byb2dyYW1fdmVydGV4IiwgKHZvaWQgKikmU0NfYmluZFByb2dyYW1WZXJ0ZXggfSwKKyAgICB7ICJ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CkKK3sKKyAgICBwdGhyZWFkX211dGV4X2Rlc3Ryb3koJm1NdXRleCk7CisgICAgcHRocmVhZF9jb25kX2Rlc3Ryb3koJm1Db25kaXRpb24pOworfQorCitib29sIFNpZ25hbDo6aW5pdCgpCit7CisgICAgaW50IHN0YXR1cyA9IHB0aHJlYWRfbXV0ZXhfaW5pdCgmbU11dGV4LCBOVUxMKTsKKyAgICBpZiAoc3RhdHVzKSB7CisgICAgICAgIExPR0UoIkxvY2tsZXNzRmlmbyBtdXRleCBpbml0IGZhaWx1cmUiKTsKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIHN0YXR1cyA9IHB0aHJlYWRfY29uZF9pbml0KCZtQ29uZGl0aW9uLCBOVUxMKTsKKyAgICBpZiAoc3RhdHVzKSB7CisgICAgICAgIExPR0UoIkxvY2tsZXNzRmlmbyBjb25kaXRpb24gaW5pdCBmYWlsdXJlIik7CisgICAgICAgIHB0aHJlYWRfbXV0ZXhfZGVzdHJveSgmbU11dGV4KTsKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIHJldHVybiB0cnVlOworfQorCit2b2lkIFNpZ25hbDo6c2V0KCkKK3sKKyAgICBpbnQgc3RhdHVzOworCisgICAgc3RhdHVzID0gcHRocmVhZF9tdXRleF9sb2NrKCZtTXV0ZXgpOworICAgIGlmIChzdGF0dXMpIHsKKyAgICAgICAgTE9HRSgiTG9ja2xlc3NDb21tYW5kRmlmbzogZXJyb3IgJWkgbG9ja2luZyBmb3Igc2V0IGNvbmRpdGlvbi4iLCBzdGF0dXMpOworICAgICAgICByZXR1cm47CisgICAgfQorCisgICAgbVNldCA9IHRydWU7CisKKyAgICBzdGF0dXMgPSBwdGhyZWFkX2NvbmRfc2lnbmFsKCZtQ29uZGl0aW9uKTsKKyAgICBpZiAoc3RhdHVzKSB7CisgICAgICAgIExPR0UoIkxvY2tsZXNzQ29tbWFuZEZpZm86IGVycm9yICVpIG9uIHNldCBjb25kaXRpb24uIiwgc3RhdHVzKTsKKyAgICB9CisKKyAgICBzdGF0dXMgPSBwdGhyZWFkX211dGV4X3VubG9jaygmbU11dGV4KTsKKyAgICBpZiAoc3RhdHVzKSB7CisgICAgICAgIExPR0UoIkxvY2tsZXNzQ29tbWFuZEZpZm86IGVycm9yICVpIHVubG9ja2luZyBmb3Igc2V0IGNvbmRpdGlvbi4iLCBzdGF0dXMpOworICAgIH0KK30KKwordm9pZCBTaWduYWw6OndhaXQoKQoreworICAgIGludCBzdGF0dXM7CisKKyAgICBzdGF0dXMgPSBwdGhyZWFkX211dGV4X2xvY2soJm1NdXRleCk7CisgICAgaWYgKHN0YXR1cykgeworICAgICAgICBMT0dFKCJMb2NrbGVzc0NvbW1hbmRGaWZvOiBlcnJvciAlaSBsb2NraW5nIGZvciBjb25kaXRpb24uIiwgc3RhdHVzKTsKKyAgICAgICAgcmV0dXJuOworICAgIH0KKworICAgIGlmICghbVNldCkgeworICAgICAgICBzdGF0dXMgPSBwdGhyZWFkX2NvbmRfd2FpdCgmbUNvbmRpdGlvbiwgJm1NdXRleCk7CisgICAgICAgIGlmIChzdGF0dXMpIHsKKyAgICAgICAgICAgIExPR0UoIkxvY2tsZXNzQ29tbWFuZEZpZm86IGVycm9yICVpIHdhaXRpbmcgb24gY29uZGl0aW9uLiIsIHN0YXR1cyk7CisgICAgICAgIH0KKyAgICB9CisgICAgbVNldCA9IGZhbHNlOworCisgICAgc3RhdHVzID0gcHRocmVhZF9tdXRleF91bmxvY2soJm1NdXRleCk7CisgICAgaWYgKHN0YXR1cykgeworICAgICAgICBMT0dFKCJMb2NrbGVzc0NvbW1hbmRGaWZvOiBlcnJvciAlaSB1bmxvY2tpbmcgZm9yIGNvbmRpdGlvbi4iLCBzdGF0dXMpOworICAgIH0KK30KKwpkaWZmIC0tZ2l0IGEvbGlicy9ycy9yc1NpZ25hbC5oIGIvbGlicy9ycy9yc1NpZ25hbC5oCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4I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EYXRhW21Qb3MrK10gPSAodWludDhfdCkoKHYgPj4gOCkgJiAweGZmKTsKKyAgICAgICAgbURhdGFbbVBvcysrXSA9ICh1aW50OF90KSgodiA+PiAxNikgJiAweGZmKTsKKyAgICAgICAgbURhdGFbbVBvcysrXSA9ICh1aW50OF90KSgodiA+PiAyNCkgJiAweGZmKTsKKyAgICAgICAgbURhdGFbbVBvcysrXSA9ICh1aW50OF90KSgodiA+PiAzMikgJiAweGZmKTsKKyAgICAgICAgbURhdGFbbVBvcysrXSA9ICh1aW50OF90KSgodiA+PiA0MCkgJiAweGZmKTsKKyAgICAgICAgbURhdGFbbVBvcysrXSA9ICh1aW50OF90KSgodiA+PiA0OCkgJiAweGZmKTsKKyAgICAgICAgbURhdGFbbVBvcysrXSA9ICh1aW50OF90KSgodiA+PiA1NikgJiAweGZmKTsKKyAgICB9CisgICAgZWxzZSB7CisgICAgICAgIGFkZFUzMih2KTsKKyAgICB9Cit9CisKK3ZvaWQgT1N0cmVhbTo6YWRkU3RyaW5nKFN0cmluZzggKnMpCit7CisgICAgdWludDMyX3QgbGVuID0gcy0+c2l6ZSgpOworICAgIGFkZFUzMihsZW4pOworICAgIGlmKG1Qb3MgKyBsZW4qc2l6ZW9mKGNoYXIpID49IG1MZW5ndGgpIHsKKyAgICAgICAgZ3Jvd1NpemUoKTsKKyAgICB9CisgICAgY2hhciAqc3RyaW5nRGF0YSA9IHJlaW50ZXJwcmV0X2Nhc3Q8Y2hhciAqPigmbURhdGFbbVBvc10pOworICAgIGZvcih1aW50MzJfdCBpID0gMDsgaSA8IGxlbjsgaSArKykgeworICAgICAgICBzdHJpbmdEYXRhW2ldID0gcy0+c3RyaW5nKClbaV07CisgICAgfQorICAgIG1Qb3MgKz0gbGVuKnNpemVvZihjaGFyKTsKK30KKwordm9pZCBPU3RyZWFtOjpncm93U2l6ZSgpCit7CisgICAgdWludDhfdCAqbmV3RGF0YSA9ICh1aW50OF90KiltYWxsb2MobUxlbmd0aCoyKTsKKyAgIC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AgIG1Qb3MgPSAobVBvcyArIDMpICYgKH4zKTsKKyAgICAgICAgdWludDMyX3QgdG1wID0gcmVpbnRlcnByZXRfY2FzdDxjb25zdCB1aW50MzJfdCAqPigmbURhdGFbbVBvc10pWzBdOworICAgICAgICBtUG9zICs9IHNpemVvZih1aW50MzJfdCk7CisgICAgICAgIHJldHVybiB0bXA7CisgICAgfQorICAgIHVpbnQxNl90IGxvYWRVMTYoKSB7CisgICAgICAgIG1Qb3MgPSAobVBvcyArIDEpICYgKH4xKTsKKyAgICAgICAgdWludDE2X3QgdG1wID0gcmVpbnRlcnByZXRfY2FzdDxjb25zdCB1aW50MTZfdCAqPigmbURhdGFbbVBvc10pWzBdOworICAgICAgICBtUG9zICs9IHNpemVvZih1aW50MTZfdCk7CisgICAgICAgIHJldHVybiB0bXA7CisgICAgfQorICAgIGlubGluZSB1aW50OF90IGxvYWRVOCgpIHsKKyAgICAgICAgdWludDhfdCB0bXAgPSByZWludGVycHJldF9jYXN0PGNvbnN0IHVpbnQ4X3QgKj4oJm1EYXRhW21Qb3NdKVswXTsKKyAgICAgICAgbVBvcyArPSBzaXplb2YodWludDhfdCk7CisgICAgICAgIHJldHVybiB0bXA7CisgICAgfQorICAgIHZvaWQgbG9hZEJ5dGVBcnJheSh2b2lkICpkZXN0LCBzaXplX3QgbnVtQnl0ZXMpOworICAgIHVpbnQ2NF90IGxvYWRPZmZzZXQoKTsKKyAgICB2b2lkIGxvYWRTdHJpbmcoU3RyaW5nOCAqcyk7CisgICAgdWludDY0X3QgZ2V0UG9zKCkgY29uc3QgeworICAgICAgICByZXR1cm4gbVBvczsKKyAgICB9CisgICAgdm9pZCByZXNldCh1aW50NjRfdCBwb3MpIHsKKyAgICAgICAgbVBvcyA9IHBvczsKKyAgICB9CisgICAgdm9pZCByZXNldCgpIHsKKyAgICAgICAgbVBvcyA9IDA7CisgICAgfQorICAgIAorICAgIGNvbnN0IHVpbnQ4X3QgKiBnZXRQdHIoKSBjb25zdCB7CisgICAgICAgIHJldHVybiBtRGF0YTsKKyAgICB9Citwcm90ZWN0ZWQ6CisgICAgY29uc3QgdWludDhfdCAqIG1EYXRhOworICAgIHVpbnQ2NF90IG1Qb3M7CisgICAgYm9vbCBtVXNlNjQ7Cit9OworCitjbGFzcyBPU3RyZWFtCit7CitwdWJsaWM6CisgICAgT1N0cmVhbSh1aW50NjRfdCBsZW5ndGgsIGJvb2wgdXNlNjQpOworICAgIH5PU3RyZWFtKCk7CisgICAgCisgICAgdm9pZCBhbGlnbih1aW50MzJfdCBieXRlcykgeworICAgICAgICBtUG9zID0gKG1Qb3MgKyAoYnl0ZXMgLSAxKSkgJiAofihieXRlcyAtIDEpKTsKKyAgICAgICAgaWYobVBvcyA+PSBtTGVuZ3RoKSB7CisgICAgICAgICAgICBncm93U2l6ZSgpOworICAgICAgICB9CisgICAgfQorICAgIAorICAgIHZvaWQgYWRkRihmbG9hdCB2KSB7CisgICAgICAgIHVpbnQzMl90IHVpbnRWID0gKnJlaW50ZXJwcmV0X2Nhc3Q8dWludDMyX3QqPiAoJnYpOworICAgICAgICBhZGRVMzIodWludFYpOworICAgIH0KKyAgICB2b2lkIGFkZEkzMihpbnQzMl90IHYpIHsKKyAgICAgICAgbVBvcyA9IChtUG9zICsgMykgJiAofjMpOworICAgICAgICBpZihtUG9zICsgc2l6ZW9mKHYpID49IG1MZW5ndGgpIHsKKyAgICAgICAgICAgIGdyb3dTaXplKCk7CisgICAgICAgIH0KKyAgICAgICAgbURhdGFbbVBvcysrXSA9ICh1aW50OF90KSh2ICYgMHhmZik7CisgICAgICAgIG1EYXRhW21Qb3MrK10gPSAodWludDhfdCkoKHYgPj4gOCkgJiAweGZmKTsKKyAgICAgICAgbURhdGFbbVBvcysrXSA9ICh1aW50OF90KSgodiA+PiAxNikgJiAweGZmKTsKKyAgICAgICAgbURhdGFbbVBvcysrXSA9ICh1aW50OF90KSgodiA+PiAyNCkgJiAweGZmKTsKKyAgICB9CisgICAgdm9pZCBhZGRVMzIodWludDMyX3QgdikgeworICAgICAgICBtUG9zID0gKG1Qb3MgKyAzKSAmICh+Myk7CisgICAgICAgIGlmKG1Qb3MgKyBzaXplb2YodikgPj0gbUxlbmd0aCkgeworICAgICAgICAgICAgZ3Jvd1NpemUoKTsKKyAgICAgICAgfQorICAgICAgICBtRGF0YVttUG9zKytdID0gKHVpbnQ4X3QpKHYgJiAweGZmKTsKKyAgICAgICAgbURhdGFbbVBvcysrXSA9ICh1aW50OF90KSgodiA+PiA4KSAmIDB4ZmYpOworICAgICAgICBtRGF0YVttUG9zKytdID0gKHVpbnQ4X3QpKCh2ID4+IDE2KSAmIDB4ZmYpOworICAgICAgICBtRGF0YVttUG9zKytdID0gKHVpbnQ4X3QpKCh2ID4+IDI0KSAmIDB4ZmYpOworICAgIH0KKyAgICB2b2lkIGFkZFUxNih1aW50MTZfdCB2KSB7CisgICAgICAgIG1Qb3MgPSAobVBvcyArIDEpICYgKH4xKTsKKyAgICAgICAgaWYobVBvcyArIHNpemVvZih2KSA+PSBtTGVuZ3RoKSB7CisgICAgICAgICAgICBncm93U2l6ZSgpOworICAgICAgICB9CisgICAgICAgIG1EYXRhW21Qb3MrK10gPSAodWludDhfdCkodiAmIDB4ZmYpOworICAgICAgICBtRGF0YVttUG9zKytdID0gKHVpbnQ4X3QpKHYgPj4gOCk7CisgICAgfQorICAgIGlubGluZSB2b2lkIGFkZFU4KHVpbnQ4X3QgdikgeworICAgICAgICBpZihtUG9zICsgMSA+PSBtTGVuZ3RoKSB7CisgICAgICAgICAgICBncm93U2l6ZSgpOworICAgICAgICB9CisgICAgICAgIHJlaW50ZXJwcmV0X2Nhc3Q8dWludDhfdCAqPigmbURhdGFbbVBvc10pWzBdID0gdjsKKyAgICAgICAgbVBvcyArKzsKKyAgICB9CisgICAgdm9pZCBhZGRCeXRlQXJyYXkoY29uc3Qgdm9pZCAqc3JjLCBzaXplX3QgbnVtQnl0ZXMpOworICAgIHZvaWQgYWRkT2Zmc2V0KHVpbnQ2NF90IHYpOworIC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kOwogdXNpbmcgbmFtZXNwYWNlIGFuZHJvaWQ6OnJlbmRlcnNjcmlwdDsKQEAgLTg0LDcgKzg5LDkgQEAKICAgICAgICAgbUxPRENvdW50ID0gMTsKICAgICB9CiAgICAgaWYgKG1MT0RDb3VudCAhPSBvbGRMT0RDb3VudCkgewotICAgICAgICBkZWxldGUgW10gbUxPRHM7CisgICAgICAgIGlmKG1MT0RzKXsKKyAgICAgICAgICAgIGRlbGV0ZSBbXSBtTE9EczsKKyAgICAgICAgfQogICAgICAgICBtTE9EcyA9IG5ldyBMT0RbbUxPRENvdW50XTsKICAgICB9CiAKQEAgLTEzOCwxMzYgKzE0NSwzMSBAQAogCiB2b2lkIFR5cGU6Om1ha2VHTENvbXBvbmVudHMoKQogeworICAgIGlmKGdldEVsZW1lbnQoKS0+Z2V0RmllbGRDb3VudCgpID49IFJTX01BWF9BVFRSSUJTKSB7CisgICAgICAgIHJldHVybjsKKyAgICB9CisKICAgICB1aW50MzJfdCB1c2VyTnVtID0gMDsKIAogICAgIGZvciAodWludDMyX3QgY3Q9MDsgY3QgPCBnZXRFbGVtZW50KCktPmdldEZpZWxkQ291bnQoKTsgY3QrKykgewogICAgICAgICBjb25zdCBDb21wb25lbnQgJmMgPSBnZXRFbGVtZW50KCktPmdldEZpZWxkKGN0KS0+Z2V0Q29tcG9uZW50KCk7CiAKLSAgICAgICAgc3dpdGNoKGMuZ2V0S2luZCgpKSB7Ci0gICAgICAgIGNhc2UgUlNfS0lORF9VU0VSOgotICAgICAgICAgICAgbUdMLm1Vc2VyW3VzZXJOdW1dLnNpemUgPSBjLmdldFZlY3RvclNpemUoKTsKLSAgICAgICAgICAgIG1HTC5tVXNlclt1c2VyTnVtXS5vZmZzZXQgPSBtRWxlbWVudC0+Z2V0RmllbGRPZmZzZXRCeXRlcyhjdCk7Ci0gICAgICAgICAgICBtR0wubVVzZXJbdXNlck51bV0udHlwZSA9IGMuZ2V0R0xUeXBlKCk7Ci0gICAgICAgICAgICBtR0wubVV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U19UWVBFX0ZMT0FUXzMyOwotICAgICAgICAgICAgbUdMLm1Db2xvci5uYW1lLnNldFRvKCJDb2xvciIpOwotICAgICAgICAgICAgYnJlYWs7Ci0KLSAgICAgICAgY2FzZSBSU19LSU5EX05PUk1BTDoKLSAgICAgICAgICAgIHJzQXNzZXJ0KG1HTC5tTm9ybS5zaXplID09IDApOwotICAgICAgICAgICAgbUdMLm1Ob3JtLnNpemUgPSBjLmdldFZlY3RvclNpemUoKTsKLSAgICAgICAgICAgIG1HTC5tTm9ybS5vZmZzZXQgPSBtRWxlbWVudC0+Z2V0RmllbGRPZmZzZXRCeXRlcyhjdCk7Ci0gICAgICAgICAgICBtR0wubU5vcm0udHlwZSA9IGMuZ2V0R0xUeXBlKCk7Ci0gICAgICAgICAgICBtR0wubU5vcm0ubm9ybWFsaXplZCA9IGZhbHNlOwotICAgICAgICAgICAgbUdMLm1Ob3JtLm5hbWUuc2V0VG8oIk5vcm1hbCIpOwotICAgICAgICAgICAgYnJlYWs7Ci0KLSAgICAgICAgY2FzZSBSU19LSU5EX1RFWFRVUkU6Ci0gICAgICAgICAgICByc0Fzc2VydChtR0wubVRleC5zaXplID09IDApOwotICAgICAgICAgICAgbUdMLm1UZXguc2l6ZSA9IGMuZ2V0VmVjdG9yU2l6ZSgpOwotICAgICAgICAgICAgbUdMLm1UZXgub2Zmc2V0ID0gbUVsZW1lbnQtPmdldEZpZWxkT2Zmc2V0Qnl0ZXMoY3QpOwotICAgICAgICAgICAgbUdMLm1UZXgudHlwZSA9IGMuZ2V0R0xUeXBlKCk7Ci0gICAgICAgICAgICBtR0wubVRleC5ub3JtYWxpemVkID0gZmFsc2U7Ci0gICAgICAgICAgICBtR0wubVRleC5uYW1lLnNldFRvKCJUZXh0dXJlIik7Ci0gICAgICAgICAgICBicmVhazsKLQotICAgICAgICBjYXNlIFJTX0tJTkRfUE9JTlRfU0laRToKLSAgICAgICAgICAgIHJzQXNzZXJ0KCFtR0wubVBvaW50U2l6ZS5zaXplK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gZGlzYWJsZSB0aGVtCi0gICAgLy8gaGVyZS4gIFRoZSByZWFzb24gaXMgbW9yZSB0aGFuIG9uZSBBbGxvY2F0aW9uIG1heSBiZSB1c2VkIGFzIGEgdmVydGV4Ci0gICAgLy8gc291cmNlLiAgU28gd2UgY2Fubm90IGRpc2FibGUgYXJyYXlzIHRoYXQgbWF5IGhhdmUgYmVlbiBpbiB1c2UgYnkKLSAgICAvLyBhbm90aGVyIGFsbG9jYXRpb24uCi0KLSAgICB1aW50MzJfdCBzdHJpZGUgPSBtRWxlbWVudC0+Z2V0U2l6ZUJ5dGVzKCk7Ci0gICAgaWYgKG1HTC5tVnR4LnNpemUpIHsKLSAgICAgICAgdmEtPmFkZExlZ2FjeShtR0wubVZ0eC50eXBlLAotICAgICAgICAgICAgICAgICAgICAgIG1HTC5tVnR4LnNpemUsCi0gICAgICAgICAgICAgICAgICAgICAgc3RyaWRlLAotICAgICAgICAgICAgICAgICAgICAgIFJTX0tJTkRfUE9TSVRJT04sCi0gICAgICAgICAgICAgICAgICAgICAgZmFsc2UsCi0gICAgICAgICAgICAgICAgICAgICAgbUdMLm1WdHgub2Zmc2V0KTsKLSAgICB9Ci0KLSAgICBpZiAobUdMLm1Ob3JtLnNpemUpIHsKLSAgICAgICAgdmEtPmFkZExlZ2FjeShtR0wubU5vcm0udHlwZSwKLSAgICAgICAgICAgICAgICAgICAgIDMsCi0gICAgICAgICAgICAgICAgICAgICBzdHJpZGUsCi0gICAgICAgICAgICAgICAgICAgICBSU19LSU5EX05PUk1BTCwKLSAgICAgICAgICAgICAgICAgICAgIGZhbHNlLAotICAgICAgICAgICAgICAgICAgICAgbUdMLm1Ob3JtLm9mZnNldCk7Ci0gICAgfQotCi0gICAgaWYgKG1HTC5tQ29sb3Iuc2l6ZSkgewotICAgICAgICB2YS0+YWRkTGVnYWN5KG1HTC5tQ29sb3IudHlwZSwKLSAgICAgICAgICAgICAgICAgICAgIG1HTC5tQ29sb3Iuc2l6ZSwKLSAgICAgICAgICAgICAgICAgICAgIHN0cmlkZSwKLSAgICAgICAgICAgICAgICAgICAgIFJTX0tJTkRfQ09MT1IsCi0gICAgICAgICAgICAgICAgICAgICB0cnVlLAotICAgICAgICAgICAgICAgICAgICAgbUdMLm1Db2xvci5vZmZzZXQpOwotICAgIH0KLQotICAgIGlmIChtR0wubVRleC5zaXplKSB7Ci0gICAgICAgIHZhLT5hZGRMZWdhY3kobUdMLm1UZXgudHlwZSwKLSAgICAgICAgICAgICAgICAgICAgIG1HTC5tVGV4LnNpemUsCi0gICAgICAgICAgICAgICAgICAgICBzdHJpZGUsCi0gICAgICAgICAgICAgICAgICAgICBSU19LSU5EX1RFWFRVUkUsCi0gICAgICAgICAgICAgICAgICAgICBmYWxzZSwKLSAgICAgICAgICAgICAgICAgICAgIG1HTC5tVGV4Lm9mZnNldCk7Ci0gICAgfQotCi0gICAgaWYgKG1HTC5tUG9pbnRTaXplLnNpemUpIHsKLSAgICAgICAgdmEtPmFkZExlZ2FjeShtR0wubVBvaW50U2l6ZS50eXBlLAotICAgICAgICAgICAgICAgICAgICAgMSwKLSAgICAgICAgICAgICAgICAgICAgIHN0cmlkZSwKLSAgICAgICAgICAgICAgICAgICAgIFJTX0tJTkRfUE9JTlRfU0laRSwKLSAgICAgICAgICAgICAgICAgICAgIGZhbHNlLAotICAgICAgICAgICAgICAgICAgICAgbUdMLm1Qb2ludFNpemUub2Zmc2V0KTsKLSAgICB9Ci0KLX0KLQotdm9pZCBUeXBlOjplbmFibGVHTFZlcnRleEJ1ZmZlcjIoVmVydGV4QXJyYXkgKnZhKSBjb25zdAotewotICAgIC8vIERvIGxlZ2FjeSBidWZmZXJzCi0gICAgZW5hYmxlR0xWZXJ0ZXhCdWZmZXIodmEpOwotCiAgICAgdWludDMyX3Qgc3RyaWRlID0gbUVsZW1lbnQtPmdldFNpemVCeXRlcygpOwogICAgIGZvciAodWludDMyX3QgY3Q9MDsgY3QgPCBSU19NQVhfQVRUUklCUzsgY3QrKykgewotICAgICAgICBpZiAobUdMLm1Vc2VyW2N0XS5zaXplKSB7Ci0gICAgICAgICAgICB2YS0+YWRkVXNlcihtR0wubVVzZXJbY3RdLCBzdHJpZGUpOworICAgICAgICBpZiAobUF0dHJpYnNbY3RdLnNpemUpIHsKKyAgICAgICAgICAgIHZhLT5hZGQobUF0dHJpYnNbY3RdLCBzdHJpZGUpOwogICAgICAgICB9CiAgICAgfQogfQpAQCAtMjgzLDYgKzE4NSw1NyBAQAogICAgIG1FbGVtZW50LT5kdW1wTE9HVihidWYpOwogfQogCit2b2lkIFR5cGU6OnNlcmlhbGl6ZShPU3RyZWFtICpzdHJlYW0pIGNvbnN0Cit7CisgICAgLy8gTmVlZCB0byBpZGVudGlmeSBvdXJzZWx2ZXMKKyAgICBzdHJlYW0tPmFkZFUzMigodWludDMyX3QpZ2V0Q2xhc3NJZCgpKTsKKwor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ICAgICBtQXR0cmlic1tjdF0uc3RyaWRlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkICopbUF0dHJpYnNbY3RdLm9mZnNldCk7Ci0gICAgICAgICAgICBicmVhazsKLQotICAgICAgICBjYXNlIFJTX0tJTkRfTk9STUFMOgotICAgICAgICAgICAgLy9sb2dBdHRyaWIoTk9STUFMKTsKLSAgICAgICAgICAgIGdsRW5hYmxlQ2xpZW50U3RhdGUoR0xfTk9STUFMX0FSUkFZKTsKLSAgICAgICAgICAgIHJzQXNzZXJ0KG1BdHRyaWJzW2N0XS5zaXplID09IDMpOwotICAgICAgICAgICAgZ2xCaW5kQnVmZmVyKEdMX0FSUkFZX0JVRkZFUiwgbUF0dHJpYnNbY3RdLmJ1ZmZlcik7Ci0gICAgICAgICAgICBnbE5vcm1hbFBvaW50ZXIobUF0dHJpYnNbY3RdLnR5cGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgbUF0dHJpYnNbY3RdLnN0cmlkZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCAqKW1BdHRyaWJzW2N0XS5vZmZzZXQpOwotICAgICAgICAgICAgYnJlYWs7Ci0KLSAgICAgICAgY2FzZSBSU19LSU5EX0NPTE9SOgotICAgICAgICAgICAgLy9sb2dBdHRyaWIoQ09MT1IpOwotICAgICAgICAgICAgZ2xFbmFibGVDbGllbnRTdGF0ZShHTF9DT0xPUl9BUlJBWSk7Ci0gICAgICAgICAgICBnbEJpbmRCdWZmZXIoR0xfQVJSQVlfQlVGRkVSLCBtQXR0cmlic1tjdF0uYnVmZmVyKTsKLSAgICAgICAgICAgIGdsQ29sb3JQb2ludGVyKG1BdHRyaWJzW2N0XS5zaXplLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgbUF0dHJpYnNbY3RdLnR5cGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICBtQXR0cmlic1tjdF0uc3RyaWRlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQgKiltQXR0cmlic1tjdF0ub2Zmc2V0KTsKLSAgICAgICAgICAgIGJyZWFrOwotCi0gICAgICAgIGNhc2UgUlNfS0lORF9URVhUVVJFOgotICAgICAgICAgICAgLy9sb2dBdHRyaWIoVEVYVFVSRSk7Ci0gICAgICAgICAgICBnbEVuYWJsZUNsaWVudFN0YXRlKEdMX1RFWFRVUkVfQ09PUkRfQVJSQVkpOwotICAgICAgICAgICAgZ2xCaW5kQnVmZmVyKEdMX0FSUkFZX0JVRkZFUiwgbUF0dHJpYnNbY3RdLmJ1ZmZlcik7Ci0gICAgICAgICAgICBnbFRleENvb3JkUG9pbnRlcihtQXR0cmlic1tjdF0uc2l6ZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1BdHRyaWJzW2N0XS50eXBlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUF0dHJpYnNbY3RdLnN0cmlkZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkICopbUF0dHJpYnNbY3RdLm9mZnNldCk7Ci0gICAgICAgICAgICBicmVhazsKLQotICAgICAgICBjYXNlIFJTX0tJTkRfUE9JTlRfU0laRToKLSAgICAgICAgICAgIC8vbG9nQXR0cmliKFBPSU5UX1NJWkUpOwotICAgICAgICAgICAgZ2xFbmFibGVDbGllbnRTdGF0ZShHTF9QT0lOVF9TSVpFX0FSUkFZX09FUyk7Ci0gICAgICAgICAgICBnbEJpbmRCdWZmZXIoR0xfQVJSQVlfQlVGRkVSLCBtQXR0cmlic1tjdF0uYnVmZmVyKTsKLSAgICAgICAgICAgIGdsUG9pbnRTaXplUG9pbnRlck9FUyhtQXR0cmlic1tjdF0udHlwZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtQXR0cmlic1tjdF0uc3RyaWRlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkICopbUF0dHJpYnNbY3RdLm9mZnNldCk7Ci0gICAgICAgICAgICBicmV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ICAgICAgICAgICBpZiAobUF0dHJpYnNbY3RdLm5hbWUgPT0gInBvc2l0aW9uIikgeworICAgICAgICAgICAgICAgIHNsb3QgPSAwOworICAgICAgICAgICAgfSBlbHNlIGlmIChtQXR0cmlic1tjdF0ubmFtZSA9PSAiY29sb3IiKSB7CisgICAgICAgICAgICAgICAgc2xvdCA9IDE7CisgICAgICAgICAgICB9IGVsc2UgaWYgKG1BdHRyaWJzW2N0XS5uYW1lID09ICJub3JtYWwiKSB7CisgICAgICAgICAgICAgICAgc2xvdCA9IDI7CisgICAgICAgICAgICB9IGVsc2UgaWYgKG1BdHRyaWJzW2N0XS5uYW1lID09ICJ0ZXh0dXJlMCIpIHsKKyAgICAgICAgICAgICAgICBzbG90ID0gMzsKKyAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgICB9Ci0gICAgICAgICAgICBzbG90ID0gc2MtPnZ0eEF0dHJpYlNsb3QobUF0dHJpYnNbY3RdLmtpbmQpOwogICAgICAgICB9CiAKICAgICAgICAgLy9sb2dBdHRyaWIoY3QsIHNsb3QpOwogICAgICAgICBnbEVuYWJsZVZlcnRleEF0dHJpYkFycmF5KHNsb3QpOwogICAgICAgICBnbEJpbmRCdWZmZXIoR0xfQVJSQVlfQlVGRkVSLCBtQXR0cmlic1tjdF0uYnVmZmVyKTsKLQogICAgICAgICBnbFZlcnRleEF0dHJpYlBvaW50ZXIoc2xvdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1BdHRyaWJzW2N0XS5zaXplLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUF0dHJpYnNbY3RdLnR5cGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtQXR0cmlic1tjdF0ubm9ybWFsaXplZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1BdHRyaWJzW2N0XS5zdHJpZGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9p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XQjIzIgX19hdHRyaWJ1dGVfXygob3ZlcmxvYWRhYmxlKSkgY29udmVydF8jI3R5cGVvdXQjIzIodHlwZWluIyMyIHYpIHsgXAorICAgIHR5cGVvdXQjIzIgciA9IHsodHlwZW91dCl2LngsICh0eXBlb3V0KXYueX07IFwKKyAgICByZXR1cm4gcjsgXAorfSBcCitzdGF0aWMgdHlwZW91dCMjMyBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKSBjb252ZXJ0XyMjdHlwZW91dCMjMyh0eXBlaW4jIzMgdikgeyBcCisgICAgdHlwZW91dCMjMyByID0geyh0eXBlb3V0KXYueCwgKHR5cGVvdXQpdi55LCAodHlwZW91dCl2Lnp9OyBcCisgICAgcmV0dXJuIHI7IFwKK30gXAorc3RhdGljIHR5cGVvdXQjIzQgX19hdHRyaWJ1dGVfXygob3ZlcmxvYWRhYmxlKSkgY29udmVydF8jI3R5cGVvdXQjIzQodHlwZWluIyM0IHYpIHsgXAorICAgIHR5cGVvdXQjIzQgciA9IHsodHlwZW91dCl2LngsICh0eXBlb3V0KXYueSwgKHR5cGVvdXQpdi56LCAodHlwZW91dCl2Lnd9OyBcCisgICAgcmV0dXJuIHI7IFwKK30KKworI2RlZmluZSBDVlRfRlVOQyh0eXBlKSAgICAgIENWVF9GVU5DXzIodHlwZSwgdWNoYXIpIFwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBDVlRfRlVOQ18yKHR5cGUsIGNoYXIpIFwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBDVlRfRlVOQ18yKHR5cGUsIHVzaG9ydCkgXAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIENWVF9GVU5DXzIodHlwZSwgc2hvcnQpIFwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBDVlRfRlVOQ18yKHR5cGUsIGludCkgXAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIENWVF9GVU5DXzIodHlwZSwgdWludCkgXAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIENWVF9GVU5DXzIodHlwZSwgZmxvYXQpCisKK0NWVF9GVU5DKGNoYXIpCitDVlRfRlVOQyh1Y2hhcikKK0NWVF9GVU5DKHNob3J0KQorQ1ZUX0ZVTkModXNob3J0KQorQ1ZUX0ZVTkMoaW50KQorQ1ZUX0ZVTkModWludCkKK0NWVF9GVU5DKGZsb2F0KQorCisKKworLy8gRmxvYXQgb3BzLCA2LjExLjIKKworI2RlZmluZSBERUZfRlVOQ18xKGZuYykgXAorc3RhdGljIGZsb2F0MiBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKSBmbmMoZmxvYXQyIHYpIHsgXAorICAgIGZsb2F0MiByOyBcCisgICAgci54ID0gZm5jKHYueCk7IFwKKyAgICByLnkgPSBmbmModi55KTsgXAorICAgIHJldHVybiByOyBcCit9IFwKK3N0YXRpYyBmbG9hdDMgX19hdHRyaWJ1dGVfXygob3ZlcmxvYWRhYmxlKSkgZm5jKGZsb2F0MyB2KSB7IFwKKyAgICBmbG9hdDMgcjsgXAorICAgIHIueCA9IGZuYyh2LngpOyBcCisgICAgci55ID0gZm5jKHYueSk7IFwKKyAgICByLnogPSBmbmModi56KTsgXAorICAgIHJldHVybiByOyBcCit9IFwKK3N0YXRpYyBmbG9hdDQgX19hdHRyaWJ1dGVfXygob3ZlcmxvYWRhYmxlKSkgZm5jKGZsb2F0NCB2KSB7IFwKKyAgICBmbG9hdDQgcjsgXAorICAgIHIueCA9IGZuYyh2LngpOyBcCisgICAgci55ID0gZm5jKHYueSk7IFwKKyAgICByLnogPSBmbmModi56KTsgXAorICAgIHIudyA9IGZuYyh2LncpOyBcCisgICAgcmV0dXJuIHI7IFwKK30KKworI2RlZmluZSBERUZfRlVOQ18yKGZuYykgXAorc3RhdGljIGZsb2F0MiBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKSBmbmMoZmxvYXQyIHYxLCBmbG9hdDIgdjIpIHsgXAorICAgIGZsb2F0MiByOyBcCisgICAgci54ID0gZm5jKHYxLngsIHYyLngpOyBcCisgICAgci55ID0gZm5jKHYxLnksIHYyLnkpOyBcCisgICAgcmV0dXJuIHI7IFwKK30gXAorc3RhdGljIGZsb2F0MyBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKSBmbmMoZmxvYXQzIHYxLCBmbG9hdDMgdjIpIHsgXAorICAgIGZsb2F0MyByOyBcCisgICAgci54ID0gZm5jKHYxLngsIHYyLngpOyBcCisgICAgci55ID0gZm5jKHYxLnksIHYyLnkpOyBcCisgICAgci56ID0gZm5jKHYxLnosIHYyLnopOyBcCisgICAgcmV0dXJuIHI7IFwKK30gXAorc3RhdGljIGZsb2F0NCBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKSBmbmMoZmxvYXQ0IHYxLCBmbG9hdDQgdjIpIHsgXAorICAgIGZsb2F0NCByOyBcCisgICAgci54ID0gZm5jKHYxLngsIHYyLngpOyBcCisgICAgci55ID0gZm5jKHYxLnksIHYyLnkpOyBcCisgICAgci56ID0gZm5jKHYxLnosIHYyLnopOyBcCisgICAgci53ID0gZm5jKHYxLncsIHYyLnopOyBcCisgICAgcmV0dXJuIHI7IFwKK30KKworI2RlZmluZSBERUZfRlVOQ18yRihmbmMpIFwKK3N0YXRpYyBmbG9hdDIgX19hdHRyaWJ1dGVfXygob3ZlcmxvYWRhYmxlKSkgZm5jKGZsb2F0MiB2MSwgZmxvYXQgdjIpIHsgXAorICAgIGZsb2F0MiByOyBcCisgICAgci54ID0gZm5jKHYxLngsIHYyKTsgXAorICAgIHIueSA9IGZuYyh2MS55LCB2Mik7IFwKKyAgICByZXR1cm4gcjsgXAorfSBcCitzdGF0aWMgZmxvYXQzIF9fYXR0cmlidXRlX18oKG92ZXJsb2FkYWJsZSkpIGZuYyhmbG9hdDMgdjEsIGZsb2F0IHYyKSB7IFwKKyAgICBmbG9hdDMgcjsgXAorICAgIHIueCA9IGZuYyh2MS54LCB2Mik7IFwKKyAgICByLnkgPSBmbmModjEueSw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SA9IChpbnQpZmxvb3Iodik7CisgICAgaXB0clswXSA9IGk7CisgICAgcmV0dXJuIGZtaW4odiAtIGksIDB4MS5mZmZmZmVwLTFmKTsKK30KK3N0YXRpYyBmbG9hdDIgX19hdHRyaWJ1dGVfXygob3ZlcmxvYWRhYmxlKSkgZnJhY3QoZmxvYXQyIHYsIGZsb2F0MiAqaXB0cikgeworICAgIGZsb2F0IHRbMl07CisgICAgZmxvYXQyIHI7CisgICAgci54ID0gZnJhY3Qodi54LCAmdFswXSk7CisgICAgci55ID0gZnJhY3Qodi55LCAmdFsxXSk7CisgICAgaXB0clswXSA9IHRbMF07CisgICAgaXB0clsxXSA9IHRbMV07CisgICAgcmV0dXJuIHI7Cit9CitzdGF0aWMgZmxvYXQzIF9fYXR0cmlidXRlX18oKG92ZXJsb2FkYWJsZSkpIGZyYWN0KGZsb2F0MyB2LCBmbG9hdDMgKmlwdHIpIHsKKyAgICBmbG9hdCB0WzNdOworICAgIGZsb2F0MyByOworICAgIHIueCA9IGZyYWN0KHYueCwgJnRbMF0pOworICAgIHIueSA9IGZyYWN0KHYueSwgJnRbMV0pOworICAgIHIueiA9IGZyYWN0KHYueiwgJnRbMl0pOworICAgIGlwdHJbMF0gPSB0WzBdOworICAgIGlwdHJbMV0gPSB0WzFdOworICAgIGlwdHJbMl0gPSB0WzJdOworICAgIHJldHVybiByOworfQorc3RhdGljIGZsb2F0NCBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKSBmcmFjdChmbG9hdDQgdiwgZmxvYXQ0ICppcHRyKSB7CisgICAgZmxvYXQgdFs0XTsKKyAgICBmbG9hdDQgcjsKKyAgICByLnggPSBmcmFjdCh2LngsICZ0WzBdKTsKKyAgICByLnkgPSBmcmFjdCh2LnksICZ0WzFdKTsKKyAgICByLnogPSBmcmFjdCh2LnosICZ0WzJdKTsKKyAgICByLncgPSBmcmFjdCh2LncsICZ0WzNdKTsKKyAgICBpcHRyWzBdID0gdFswXTsKKyAgICBpcHRyW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SBhbW91bnQueSA8IGxvdy55ID8gbG93LnkgOiAoYW1vdW50LnkgPiBoaWdoLnkgPyBoaWdoLnkgOiBhbW91bnQueSk7CisgICAgci56ID0gYW1vdW50LnogPCBsb3cueiA/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/IHYxLnggOiB2MjsKKyAgICByLnkgPSB2MS55IDwgdjIgPyB2MS55IDogdjI7CisgICAgci56ID0gdjEueiA8IHYyID8gdjEueiA6IHYyOworICAgIHJ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ZmxvYXQsIGZsb2F0Myk7CitleHRlcm4gZmxvYXQ0IF9fYXR0cmlidXRlX18oKG92ZXJsb2FkYWJsZSkpIHNtb290aHN0ZXAoZmxvYXQsIGZsb2F0LCBmbG9hdDQpOworCitzdGF0aWMgZmxvYXQgX19hdHRyaWJ1dGVfXygob3ZlcmxvYWRhYmxlKSkgc2lnbihmbG9hdCB2KSB7CisgICAgaWYgKHYgPiAwKSByZXR1cm4gMS5mOworICAgIGlmICh2IDwgMCkgcmV0dXJuIC0xLmY7CisgICAgcmV0dXJuIHY7Cit9CitERUZfRlVOQ18xKHNpZ24pCisKKy8vIDYuMTEuNQorc3RhdGljIGZsb2F0MyBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKSBjcm9zcyhmbG9hdDMgbGhzLCBmbG9hdDMgcmhzKSB7CisgICAgZmxvYXQzIHI7CisgICAgci54ID0gbGhzLnkgKiByaHMueiAgLSBsaHMueiAqIHJocy55OworICAgIHIueSA9IGxocy56ICogcmhzLnggIC0gbGhzLnggKiByaHMuejsKKyAgICByLnogPSBsaHMueCAqIHJocy55ICAtIGxocy55ICogcmhzLng7CisgICAgcmV0dXJuIHI7Cit9CisKK3N0YXRpYyBmbG9hdDQgX19hdHRyaWJ1dGVfXygob3ZlcmxvYWRhYmxlKSkgY3Jvc3MoZmxvYXQ0IGxocywgZmxvYXQ0IHJocykgeworICAgIGZsb2F0NCByOworICAgIHIueCA9IGxocy55ICogcmhzLnogIC0gbGhzLnogKiByaHMueTsKKyAgICByLnkgPSBsaHMueiAqIHJocy54ICAtIGxocy54ICogcmhzLno7CisgICAgci56ID0gbGhzLnggKiByaHMueSAgLSBsaHMueSAqIHJocy54OworICAgIHIudyA9IDAuZjsKKyAgICByZXR1cm4gcjsKK30KKworc3RhdGljIGZsb2F0IF9fYXR0cmlidXRlX18oKG92ZXJsb2FkYWJsZSkpIGRvdChmbG9hdCBsaHMsIGZsb2F0IHJocykgeworICAgIHJldHVybiBsaHMgKiByaHM7Cit9CitzdGF0aWMgZmxvYXQgX19hdHRyaWJ1dGVfXygob3ZlcmxvYWRhYmxlKSkgZG90KGZsb2F0MiBsaHMsIGZsb2F0MiByaHMpIHsKKyAgICByZXR1cm4gbGhzLngqcmhzLnggKyBsaHMueSpyaHMueTsKK30KK3N0YXRpYyBmbG9hdCBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKSBkb3QoZmxvYXQzIGxocywgZmxvYXQzIHJocykgeworICAgIHJldHVybiBsaHMueCpyaHMueCArIGxocy55KnJocy55ICsgbGhzLnoqcmhzLno7Cit9CitzdGF0aWMgZmxvYXQgX19hdHRyaWJ1dGVfXygob3ZlcmxvYWRhYmxlKSkgZG90KGZsb2F0NCBsaHMsIGZsb2F0NCByaHMpIHsKKyAgICByZXR1cm4gbGhzLngqcmhzLnggKyBsaHMueSpyaHMueSArIGxocy56KnJocy56ICsgbGhzLncqcmhzLnc7Cit9CisKK3N0YXRpYyBmbG9hdCBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKSBsZW5ndGgoZmxvYXQgdikgeworICAgIHJldHVybiB2OworfQorc3RhdGljIGZsb2F0IF9fYXR0cmlidXRlX18oKG92ZXJsb2FkYWJsZSkpIGxlbmd0aChmbG9hdDIgdikgeworICAgIHJldHVybiBzcXJ0KHYueCp2LnggKyB2Lnkqdi55KTsKK30KK3N0YXRpYyBmbG9hdCBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKSBsZW5ndGgoZmxvYXQzIHYpIHsKKyAgICByZXR1cm4gc3FydCh2Lngqdi54ICsgdi55KnYueSArIHYueip2LnopOworfQorc3RhdGljIGZsb2F0IF9fYXR0cmlidXRlX18oKG92ZXJsb2FkYWJsZSkpIGxlbmd0aChmbG9hdDQgdikgeworICAgIHJldHVybiBzcXJ0KHYueCp2LnggKyB2Lnkqdi55ICsgdi56KnYueiArIHYudyp2LncpOworfQorCitzdGF0aWMgZmxvYXQgX19hdHRyaWJ1dGVfXygob3Z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KSByc1BhY2tDb2xvclRvODg4OChmbG9hdCByLCBmbG9hdCBnLCBmbG9hdCBiLCBmbG9hdCBhKQoreworICAgIHVjaGFyNCBjOworICAgIGMueCA9ICh1Y2hhcikociAqIDI1NS5mKTsKKyAgICBjLnkgPSAodWNoYXIpKGcgKiAyNTUuZik7CisgICAgYy56ID0gKHVjaGFyKShiICogMjU1LmYpOworICAgIGMudyA9ICh1Y2hhcikoYSAqIDI1NS5mKTsKKyAgICByZXR1cm4gYzsKK30KKworc3RhdGljIHVjaGFyNCBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKSByc1BhY2tDb2xvclRvODg4OChmbG9hdDMgY29sb3IpCit7CisgICAgY29sb3IgKj0gMjU1LmY7CisgICAgdWNoYXI0IGMgPSB7Y29sb3IueCwgY29sb3IueSwgY29sb3IueiwgMjU1fTsKKyAgICByZXR1cm4gYzsKK30KKworc3RhdGljIHVjaGFyNCBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKSByc1BhY2tDb2xvclRvODg4OChmbG9hdDQgY29sb3IpCit7CisgICAgY29sb3IgKj0gMjU1LmY7CisgICAgdWNoYXI0IGMgPSB7Y29sb3IueCwgY29sb3IueSwgY29sb3IueiwgY29sb3Iud307CisgICAgcmV0dXJuIGM7Cit9CisKK3N0YXRpYyBmbG9hdDQgcnNVbnBhY2tDb2xvcjg4ODgodWNoYXI0IGMpCit7CisgICAgZmxvYXQ0IHJldCA9IChmbG9hdDQpMC4wMDM5MTU2ODYyNzQ1ZjsKKyAgICByZXQgKj0gY29udmVydF9mbG9hdDQoYyk7CisgICAgcmV0dXJuIHJldDsKK30KKworLy9leHRlcm4gdWNoYXI0IF9fYXR0cmlidXRlX18oKG92ZXJsb2FkYWJsZSkpIHJzUGFja0NvbG9yVG81NjUoZmxvYXQgciwgZmxvYXQgZywgZmxvYXQgYik7CisvL2V4dGVybiB1Y2hhcjQgX19hdHRyaWJ1dGVfXygob3ZlcmxvYWRhYmxlKSkgcn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AxLmY7CisgICAgbS0+bVs1XSA9IDAuZjsKKyAgICBtLT5tWzZdID0gMC5mOworICAgIG0tPm1bN10gPSAwLmY7CisgICAgbS0+bVs4XSA9IDEuZjsKK30KKworc3RhdGljIHZvaWQgX19hdHRyaWJ1dGVfXygob3ZlcmxvYWRhYmxlKSkKK3JzTWF0cml4TG9hZElkZW50aXR5KHJzX21hdHJpeDJ4MiAqbSkgeworICAgIG0tPm1bMF0gPSAxLmY7CisgICAgbS0+bVsxXSA9IDAuZjsKKyAgICBtLT5tWzJdID0gMC5mOworICAgIG0tPm1bM10gPSAxLmY7Cit9CisKK3N0YXRpYyB2b2lkIF9fYXR0cmlidXRlX18oKG92ZXJsb2FkYWJsZSkpCityc01hdHJpeExvYWQocnNfbWF0cml4NHg0ICptLCBjb25zdCBmbG9hdCAqdikgeworICAgIG0tPm1bMF0gPSB2WzBdOworICAgIG0tPm1bMV0gPSB2WzFdOworICAgIG0tPm1bMl0gPSB2WzJdOworICAgIG0tPm1bM10gPSB2WzNdOworICAgIG0tPm1bNF0gPSB2WzRdOworICAgIG0tPm1bNV0gPSB2WzVdOworICAgIG0tPm1bNl0gPSB2WzZdOworICAgIG0tPm1bN10gPSB2WzddOworICAgIG0tPm1bOF0gPSB2WzhdOworICAgIG0tPm1bOV0gPSB2WzldOworICAgIG0tPm1bMTBdID0gdlsxMF07CisgICAgbS0+bVsxMV0gPSB2WzExXTsKKyAgICBtLT5tWzEyXSA9IHZbMTJdOworICAgIG0tPm1bMTNdID0gdlsxM107CisgICAgbS0+bVsxNF0gPSB2WzE0XTsKKyAgICBtLT5tWzE1XSA9IHZbMTVdOworfQorCitzdGF0aWMgdm9pZCBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKQorcnNNYXRyaXhMb2FkKHJzX21hdHJpeDN4MyAqbSwgY29uc3QgZmxvYXQgKnYpIHsKKyAgICBtLT5tWzBdID0gdlswXTsKKyAgICBtLT5tWzFdID0gdlsxXTsKKyAgICBtLT5tWz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1dGVfXygob3ZlcmxvYWRhYmxlKSkKK3JzTWF0cml4TG9hZChyc19tYXRyaXg0eDQgKm0sIGNvbnN0IHJzX21hdHJpeDN4MyAqdikgeworICAgIG0tPm1bMF0gPSB2LT5tWzBdOworICAgIG0tPm1bMV0gPSB2LT5tWzFdOworICAgIG0tPm1bMl0gPSB2LT5tWzJdOworICAgIG0tPm1bM10gPSAwLmY7CisgICAgbS0+bVs0XSA9IHYtPm1bM107CisgICAgbS0+bVs1XSA9IHYtPm1bNF07CisgICAgbS0+bVs2XSA9IHYtPm1bNV07CisgICAgbS0+bVs3XSA9IDAuZjsKKyAgICBtLT5tWzhdID0gdi0+bVs2XTsKKyAgICBtLT5tWzldID0gdi0+bVs3XTsKKyAgICBtLT5tWzEwXSA9IHYtPm1bOF07CisgICAgbS0+bVsxMV0gPSAwLmY7CisgICAgbS0+bVsxMl0gPSAwLmY7CisgICAgbS0+bVsxM10gPSAwLmY7CisgICAgbS0+bVsxNF0gPSAwLmY7CisgICAgbS0+bVsxNV0gPSAxLmY7Cit9CisKK3N0YXRpYyB2b2lkIF9fYXR0cmlidXRlX18oKG92ZXJsb2FkYWJsZSkpCityc01hdHJpeExvYWQocnNfbWF0cml4NHg0ICptLCBjb25zdCByc19tYXRyaXgyeDIgKnYpIHsKKyAgICBtLT5tWzBdID0gdi0+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+bVsxMl0gPSB4OworICAgIG0tPm1bMTNdID0geTsKKyAgICBtLT5tWzE0XSA9IHo7Cit9CisKK3N0YXRpYyB2b2lkIF9fYXR0cmlidXRlX18oKG92ZXJsb2FkYWJsZSkpCityc01hdHJpeExvYWRNdWx0aXBseShyc19tYXRyaXg0eDQgKm0sIGNvbnN0IHJzX21hdHJpeDR4NCAqbGhzLCBjb25zdCByc19tYXRyaXg0eDQgKnJocykgeworICAgIGZvciAoaW50IGk9MCA7IGk8NCA7IGkrKykgeworICAgICAgICBmbG9hdCByaTAgPSAwOworICAgICAgICBmbG9hdCByaTEgPSAwOworICAgICAgICBmbG9hdCByaTIgPSAwOworICAgICAgICBmbG9hdCByaTMgPSAwOworICAgICAgICBmb3IgKGludCBqPTAgOyBqPDQgOyBqKyspIHsKKyAgICAgICAgICAgIGNvbnN0IGZsb2F0IHJoc19paiA9IHJzTWF0cml4R2V0KHJocywgaSxqKTsKKyAgICAgICAgICAgIHJpMCArPSByc01hdHJpeEdldChsaHMsIGosIDApICogcmhzX2lqOworICAgICAgICAgICAgcmkxICs9IHJzTWF0cml4R2V0KGxocywgaiwgMSkgKiByaHNfaWo7CisgICAgICAgICAgICByaTIgKz0gcnNNYXRyaXhHZXQobGhzLCBqLCAyKSAqIHJoc19pajsKKyAgICAgICAgICAgIHJpMyArPSByc01hdHJpeEdldChsaHMsIGosIDMpICogcmhzX2lqOworICAgICAgICB9CisgICAgICAgIHJzTWF0cml4U2V0KG0sIGksIDAsIHJpMCk7CisgICAgICAgIHJzTWF0cml4U2V0KG0sIGksIDEsIHJpMSk7CisgICAgICAgIHJzTWF0cml4U2V0KG0sIGksIDIsIHJpMik7CisgICAgICAgIHJzTWF0cml4U2V0KG0sIGksIDMsIHJpMyk7CisgICAgfQorfQorCitzdGF0aWMgdm9pZCBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKQorcnNNYXRyaXhNdWx0aXBseShyc19tYXRyaXg0eDQgKm0sIGNvbnN0IHJzX21hdHJpeDR4NCAqcmhzKSB7CisgICAgcnNfbWF0cml4NHg0IG10OworICAgIHJzTWF0cml4TG9hZE11bHRpcGx5KCZtdCwgbSwgcmhzKTsKKyAgICByc01hdHJpeExvYWQobSwgJm10KTsKK30KKworc3RhdGljIHZvaWQgX19hdHRyaWJ1dGVfXygob3ZlcmxvYWRhYmxlKSkKK3JzTWF0cml4TG9hZE11bHRpcGx5KHJzX21hdHJpeDN4MyAqbSwgY29uc3QgcnNfbWF0cml4M3gzICpsaHMsIGNvbnN0IHJzX21hdHJpeDN4MyAqcmhzKSB7CisgICAgZm9yIChpbnQgaT0wIDsgaTwzIDsgaSsrKSB7CisgICAgICAgIGZsb2F0IHJpMCA9IDA7CisgICAgICAgIGZsb2F0IHJpMSA9IDA7CisgICAgICAgIGZsb2F0IHJpMiA9IDA7CisgICAgICAgIGZvciAoaW50IGo9MCA7IGo8MyA7IGorKykgeworICAgICAgICAgICAgY29uc3QgZmxvYXQgcmhzX2lqID0gcnNNYXRyaXhHZXQocmhzLCBpLGopOworICAgICAgICAgICAgcmkwICs9IHJzTWF0cml4R2V0KGxocywgaiwgMCkgKiByaHNfaWo7CisgICAgICAgICAgICByaTEgKz0gcnNNYXRyaXhHZXQobGhzLCBqLCAxKSAqIHJoc19pajsKKyAgICAgICAgICAgIHJpMiArPSByc01hdHJpeEdldChsaHMsIGosIDIpICogcmhzX2lqOworICAgICAgICB9CisgICAgICAgIHJzTWF0cml4U2V0KG0sIGksIDAsIHJpMCk7CisgICAgICAgIHJzTWF0cml4U2V0KG0sIGksIDEsIHJpMSk7CisgICAgICAgIHJzTWF0cml4U2V0KG0sIGksIDIsIHJpMik7CisgICAgfQorfQorCitzdGF0aWMgdm9pZCBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKQorcnNNYXRyaXhNdWx0aXBseShyc19tYXRyaXgzeDMgKm0sIGNvbnN0IHJzX21hdHJpeDN4MyAqcmhzKSB7CisgICAgcnNfbWF0cml4M3gzIG10OworICAgIHJzTWF0cml4TG9hZE11bHRpcGx5KCZtdCwgbSwgcmhzKTsKKyAgICByc01hdHJpeExvYWQobSwgJm10KTsKK30KKworc3RhdGljIHZvaWQgX19hdHRyaWJ1dGVfXygob3ZlcmxvYWRhYmxlKSkKK3JzTWF0cml4TG9hZE11bHRpcGx5KHJzX21hdHJpeDJ4MiAqbSwgY29uc3QgcnNfbWF0cml4MngyICpsaHMsIGNvbnN0IHJzX21hdHJpeDJ4MiAqcmhzKSB7CisgICAgZm9yIChpbnQgaT0wIDsgaTwyIDsgaSsrKSB7CisgICAgICAgIGZsb2F0IHJpMCA9IDA7CisgICAgICAgIGZsb2F0IHJpMSA9IDA7CisgICAgICAgIGZvciAoaW50IGo9MCA7IGo8MiA7IGorKykgeworICAgICAgICAgICAgY29uc3QgZmxvYXQgcmhzX2lqID0gcnNNYXRyaXhHZXQocmhzLCBpLGopOworICAgICAgICAgICAgcmkwICs9IHJzTWF0cml4R2V0KGxocywgaiwgMCkgKiByaHNfaWo7CisgICAgICAgICAgICByaTEgKz0gcnNNYXRyaXhHZXQobGhzLCBqLCAxKSAqIHJoc19pajsKKyAgICAgICAgfQorICAgICAgICByc01hdHJpeFNldChtLCBpLCAwLCByaTApOworICAgICAgICByc01hdHJpeFNldChtLCBpLCAxLCByaTEpOworICAgIH0KK30KKworc3RhdGljIHZvaWQgX19hdHRyaWJ1dGVfXygob3ZlcmxvYWRhYmxlKSkKK3JzTWF0cml4TXVsdGlwbHkocnNfb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YXIgKiBuZWFyIC8gKGZhciAtIG5lYXIpOworICAgIG0tPm1bMTVdPSAwLmY7Cit9CisKK3N0YXRpYyBmbG9hdDQgX19hdHRyaWJ1dGVfXygob3ZlcmxvYWRhYmxlKSkKK3JzTWF0cml4TXVsdGlwbHkocnNfbWF0cml4NHg0ICptLCBmbG9hdDQgaW4pIHsKKyAgICBmbG9hdDQgcmV0OworICAgIHJldC54ID0gKG0tPm1bMF0gKiBpbi54KSArIChtLT5tWzRdICogaW4ueSkgKyAobS0+bVs4XSAqIGluLnopICsgKG0tPm1bMTJdICogaW4udyk7CisgICAgcmV0LnkgPSAobS0+bVsxXSAqIGluLngpICsgKG0tPm1bNV0gKiBpbi55KSArIChtLT5tWzldICogaW4ueikgKyAobS0+bVsxM10gKiBpbi53KTsKKyAgICByZXQueiA9IChtLT5tWzJdICogaW4ueCkgKyAobS0+bVs2XSAqIGluLnkpICsgKG0tPm1bMTBdICogaW4ueikgKyAobS0+bVsxNF0gKiBpbi53KTsKKyAgICByZXQudyA9IChtLT5tWzNdICogaW4ueCkgKyAobS0+bVs3XSAqIGluLnkpICsgKG0tPm1bMTFdICogaW4ueikgKyAobS0+bVsxNV0gKiBpbi53KTsKKyAgICByZXR1cm4gcmV0OworfQorCitzdGF0aWMgZmxvYXQ0IF9fYXR0cmlidXRlX18oKG92ZXJsb2FkYWJsZSkpCityc01hdHJpeE11bHRpcGx5KHJzX21hdHJpeDR4NCAqbSwgZmxvYXQzIGluKSB7CisgICAgZmxvYXQ0IHJldDsKKyAgICByZXQueCA9IChtLT5tWzBdICogaW4ueCkgKyAobS0+bVs0XSAqIGluLnkpICsgKG0tPm1bOF0gKiBpbi56KSArIG0tPm1bMTJdOworICAgIHJldC55ID0gKG0tPm1bMV0gKiBpbi54KSArIChtLT5tWzVdICogaW4ueSkgKyAobS0+bVs5XSAqIGluLnopICsgbS0+bVsxM107CisgICAgcmV0LnogPSAobS0+bVsyXSAqIGluLngpICsgKG0tPm1bNl0gKiBpbi55KSArIChtLT5tWzEwXSAqIGluLnopICsgbS0+bVsxNF07CisgICAgcmV0LncgPSAobS0+bVszXSAqIGluLngpICsgKG0tPm1bN10gKiBpbi55KSArIChtLT5tWzExXSAqIGluLnopICsgbS0+bVsxNV07CisgICAgcmV0dXJuIHJldDsKK30KKworc3RhdGljIGZsb2F0NCBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKQorcnNNYXRyaXhNdWx0aXBseShyc19tYXRyaXg0eDQgKm0sIGZsb2F0MiBpbikgeworICAgIGZsb2F0NCByZXQ7CisgICAgcmV0LnggPSAobS0+bVswXSAqIGluLngpICsgKG0tPm1bNF0gKiBpbi55KSArIG0tPm1bMTJdOworICAgIHJldC55ID0gKG0tPm1bMV0gKiBpbi54KSArIChtLT5tWzVdICogaW4ueSkgKyBtLT5tWzEzXTsKKyAgICByZXQueiA9IChtLT5tWzJdICogaW4ueCkgKyAobS0+bVs2XSAqIGluLnkpICsgbS0+bVsxNF07CisgICAgcmV0LncgPSAobS0+bVszXSAqIGluLngpICsgKG0tPm1bN10gKiBpbi55KSArIG0tPm1bMTVdOworICAgIHJldHVybiByZXQ7Cit9CisKK3N0YXRpYyBmbG9hdDMgX19hdHRyaWJ1dGVfXygob3ZlcmxvYWRhYmxlKSkKK3JzTWF0cml4TXVsdGlwbHkocnNfbWF0cml4M3gzICptLCBmbG9hdDMgaW4pIHsKKyAgICBmbG9hdDMgcmV0OworICAgIHJldC54ID0gKG0tPm1bMF0gKiBpbi54KSArIChtLT5tWzNdICogaW4ueSkgKyAobS0+bVs2XSAqIGluLnopOworICAgIHJldC55ID0gKG0tPm1bMV0gKiBpbi54KSArIChtLT5tWzRdICogaW4ueSkgKyAobS0+bVs3XSAqIGluLnopOworICAgIHJldC56ID0gKG0tPm1bMl0gKiBpbi54KSArIChtLT5tWzVdICogaW4ueSkgKyAobS0+bVs4XSAqIGluLnopOworICAgIHJldHVybiByZXQ7Cit9CisKK3N0YXRpYyBmbG9hdDMgX19hdHRyaWJ1dGVfXygob3ZlcmxvYWRhYmxlKSkKK3JzTWF0cml4TXVsdGlwbHkocnNfbWF0cml4M3gzICptLCBmbG9hdDIgaW4pIHsKKyAgICBmbG9hdDMgcmV0OworICAgIHJldC54ID0gKG0tPm1bMF0gKiBpbi54KSArIChtLT5tWzNdICogaW4ueSk7CisgICAgcmV0LnkgPSAobS0+bVsxXSAqIGluLngpICsgKG0tPm1bNF0gKiBpbi55KTsKKyAgICByZXQueiA9IChtLT5tWzJdICogaW4ueCkgKyAobS0+bVs1XSAqIGluLnkpOworICAgIHJldHVybiByZXQ7Cit9CisKK3N0YXRpYyBmbG9hdDIgX19hdHRyaWJ1dGVfXygob3ZlcmxvYWRhYmxlKSkKK3JzTWF0cml4TXVsdGlwbHkocnNfbWF0cml4MngyICptLCBmbG9hdDIgaW4pIHsKKyAgICBmbG9hdDIgcmV0OworICAgIHJldC54ID0gKG0tPm1bMF0gKiBpbi54KSArIChtLT5tWzJdICogaW4ueSk7CisgICAgcmV0LnkgPSAobS0+bVsxXSAqIGluLngpICsgKG0tPm1bM10gKiBpbi55KTsKKyAgICByZXR1cm4gcmV0OworfQorCisvLyBSZXR1cm5zIHRydWUgaWYgdGhlIG1hdHJpeCB3YXMgc3VjY2Vzc2Z1bGx5IGludmVyc2VkCitzdGF0aWMgYm9vbCBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKQorcnNNYXRyaXhJbnZlcnNlKHJzX21hdHJpeDR4NCAqbSkgeworICAgIHJzX21hdHJpeDR4NCByZXN1bHQ7CisKKyAgICBpbnQgaSwgajsKKyAgICBmb3IgKGkgPSAwOyBpIDwgNDsgKytpKSB7CisgICAgICAgIGZvciAoaiA9IDA7IGogPCA0OyArK2opIHsKKyAgICAgICAgICAgIC8vIGNvbXB1dGVDb2ZhY3RvciBmb3IgaW50IGksIGludCBqCisgICAgICAgICAgICBpbnQgYzAgPSAoaSsxKSAlIDQ7CisgICAgICAgICAgICBpbnQgYzEgPSAoaSsyKSAlI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KyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIGRldCA9IDEuMGYgLyBkZXQ7CisgICAgZm9yIChpID0gMDsgaSA8IDE2OyArK2kpIHsKKyAgICAgICAgbS0+bVtpXSA9IHJlc3VsdC5tW2ldICogZGV0OworICAgIH0KKworICAgIHJldHVybiB0cnVlOworfQorCisvLyBSZXR1cm5zIHRydWUgaWYgdGhlIG1hdHJpeCB3YXMgc3VjY2Vzc2Z1bGx5IGludmVyc2VkCitzdGF0aWMgYm9vbCBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKQorcnNNYXRyaXhJbnZlcnNlVHJhbnNwb3NlKHJzX21hdHJpeDR4NCAqbSkgeworICAgIHJzX21hdHJpeDR4NCByZXN1bHQ7CisKKyAgICBpbnQgaSwgajsKKyAgICBmb3IgKGkgPSAwOyBpIDwgNDsgKytpKSB7CisgICAgICAgIGZvciAoaiA9IDA7IGogPCA0OyArK2opIHsKKyAgICAgICAgICAgIC8vIGNvbXB1dGVDb2ZhY3RvciBmb3IgaW50IGksIGludCBqCisgICAgICAgICAgICBpbnQgYzAgPSAoaSsxKSAlIDQ7CisgICAgICAgICAgICBpbnQgYzEgPSAoaSsyKSAlIDQ7CisgICAgICAgICAgICBpbnQgYzIgPSAoaSszKSAlIDQ7CisgICAgICAgICAgICBpbnQgcjAgPSAoaisxKSAlIDQ7CisgICAgICAgICAgICBpbnQgcjEgPSAoaisyKSAlIDQ7CisgICAgICAgICAgICBpbnQgcjIgPSAoaiszKSAlIDQ7CisKKyAgICAgICAgICAgIGZsb2F0IG1pbm9yID0gKG0tPm1bYzAgKyA0KnIwXSAqIChtLT5tW2MxICsgNCpyMV0gKiBtLT5tW2MyICsgNCpyMl0gLSBtLT5tW2MxICsgNCpyMl0gKiBtLT5tW2MyICsgNCpyMV0pKQorICAgICAgICAgICAgICAgICAgICAgICAgIC0gKG0tPm1bYzAgKyA0KnIxXSAqIChtLT5tW2MxICsgNCpyMF0gKiBtLT5tW2MyICsgNCpyMl0gLSBtLT5tW2MxICsgNCpyMl0gKiBtLT5tW2MyICsgNCpyMF0pKQorICAgICAgICAgICAgICAgICAgICAgICAgICsgKG0tPm1bYzAgKyA0KnIyXSAqIChtLT5tW2MxICsgNCpyMF0gKiBtLT5tW2MyICsgNCpyMV0gLSBtLT5tW2MxICsgNCpyMV0gKiBtLT5tW2MyICsgNCpyMF0pKTsKKworICAgICAgICAgICAgZmxvYXQgY29mYWN0b3IgPSAoaStqKSAmIDEgPyAtbWlub3IgOiBtaW5vcjsKKworICAgICAgICAgICAgcmVzdWx0Lm1bNCpqICsgaV0gPSBjb2ZhY3RvcjsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8vIERvdCBwcm9kdWN0IG9mIDB0aCBjb2x1bW4gb2Ygc291cmNlIGFuZCAwdGggY29sdW1uIG9mIHJlc3VsdAorICAgIGZsb2F0IGRldCA9IG0tPm1bMF0qcmVzdWx0Lm1bMF0gKyBtLT5tWzRdKnJlc3VsdC5tWzRdICsKKyAgICAgICAgICAgICAgICAgbS0+bVs4XSpyZXN1bHQubVs4XSArIG0tPm1bMTJdKnJlc3VsdC5tWzEyXTsKKworICAgIGlmIChmYWJzKGRldCkgPCAxZS02KSB7CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisKKyAgICBkZXQgPSAxLjBmIC8gZGV0OworICAgIGZvciAoaSA9IDA7IGkgPCAxNjsgKytpKSB7CisgICAgICAgIG0tPm1baV0gPSByZXN1bHQubVtpXSAqIGRldDsKKyAgICB9CisKKyAgICByZXR1cm4gdHJ1ZTsKK30KKworc3RhdGljIHZvaWQgX19hdHRyaWJ1dGVfXygob3ZlcmxvYWRhYmxlKSkKK3JzTWF0cml4VHJhbnNwb3NlKHJzX21hdHJpeDR4NCAqbSkgeworICAgIGludCBpLCBqOworICAgIGZsb2F0IHRlbXA7CisgICAgZm9yIChpID0gMDsgaSA8IDM7ICsraSkgeworICAgICAgICBmb3IgKGogPSBpICsgMTsgaiA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HcsIGZsb2F0IHgsIGZsb2F0IHksIGZsb2F0IHopIHsKKyAgICBxLT53ID0gdzsKKyAgICBxLT54ID0geDsKKyAgICBxLT55ID0geTsKKyAgICBxLT56ID0gejsKK30KKworc3RhdGljIHZvaWQgX19hdHRyaWJ1dGVfXygob3ZlcmxvYWRhYmxlKSkKK3JzUXVhdGVybmlvblNldChyc19xdWF0ZXJuaW9uICpxLCBjb25zdCByc19xdWF0ZXJuaW9uICpyaHMpIHsKKyAgICBxLT53ID0gcmhzLT53OworICAgIHEtPnggPSByaHMtPng7CisgICAgcS0+eSA9IHJocy0+eTsKKyAgICBxLT56ID0gcmhzLT56OworfQorCitzdGF0aWMgdm9pZCBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKQorcnNRdWF0ZXJuaW9uTXVsdGlwbHkocnNfcXVhdGVybmlvbiAqcSwgZmxvYXQgcykgeworICAgIHEtPncgKj0gczsKKyAgICBxLT54ICo9IHM7CisgICAgcS0+eSAqPSBzOworICAgIHEtPnogKj0gczsKK30KKworc3RhdGljIHZvaWQgX19hdHRyaWJ1dGVfXygob3ZlcmxvYWRhYmxlKSkKK3JzUXVhdGVybmlvbk11bHRpcGx5KHJzX3F1YXRlcm5pb24gKnEsIGNvbnN0IHJzX3F1YXRlcm5pb24gKnJocykgeworICAgIHEtPncgPSAtcS0+eCpyaHMtPnggLSBxLT55KnJocy0+eSAtIHEtPnoqcmhzLT56ICsgcS0+dypyaHMtPnc7CisgICAgcS0+eCA9ICBxLT54KnJocy0+dyArIHEtPnkqcmhzLT56IC0gcS0+eipyaHMtPnkgKyBxLT53KnJocy0+eDsKKyAgICBxLT55ID0gLXEtPngqcmhzLT56ICsgcS0+eSpyaHMtPncgKyBxLT56KnJocy0+eiArIHEtPncqcmhzLT55OworICAgIHEtPnogPSAgcS0+eCpyaHMtPnkgLSBxLT55KnJocy0+eCArIHEtPnoqcmhzLT53ICsgcS0+dypyaHMtPno7Cit9CisKK3N0YXRpYyB2b2lkCityc1F1YXRlcm5pb25BZGQocnNfcXVhdGVybmlvbiAqcSwgY29uc3QgcnNfcXVhdGVybmlvbiAqcmhzKSB7CisgICAgcS0+dyAqPSByaHMtPnc7CisgICAgcS0+eCAqPSByaHMtPng7CisgICAgcS0+eSAqPSByaHMtPnk7CisgICAgcS0+eiAqPSByaHMtPno7Cit9CisKK3N0YXRpYyB2b2lkCityc1F1YXRlcm5pb25Mb2FkUm90YXRlVW5pdChyc19xdWF0ZXJuaW9uICpxLCBmbG9hdCByb3QsIGZsb2F0IHgsIGZsb2F0IHksIGZsb2F0IHopIHsKKyAgICByb3QgKj0gKGZsb2F0KShNX1BJIC8gMTgwLjBmKSAqIDAuNWY7CisgICAgZmxvYXQgYyA9IGNvcyhyb3QpOworICAgIGZsb2F0IHMgPSBzaW4ocm90KTsKKworICAgIHEtPncgPSBjOworICAgIHEtPnggPSB4ICogczsKKyAgICBxLT55ID0geSAqIHM7CisgICAgcS0+eiA9IHogKiBzOworfQorCitzdGF0aWMgdm9pZAorcnNRdWF0ZXJuaW9uTG9hZFJvdGF0ZShyc19xdWF0ZXJuaW9uICpxLCBmbG9hdCByb3QsIGZsb2F0IHgsIGZsb2F0IHksIGZsb2F0IHopIHsKKyAgICBjb25zdCBmbG9hdCBsZW4gPSB4KnggKyB5KnkgKyB6Kno7CisgICAgaWYgKGxlbiAhPSAxKSB7CisgICAgICAgIGNvbnN0IGZsb2F0IHJlY2lwTGVuID0gMS5mIC8gc3FydChsZW4pOworICAgICAgICB4ICo9IHJlY2lwTGVuOworICAgICAgICB5ICo9IHJlY2lwTGVuOworICAgICAgICB6ICo9IHJlY2lwTGVuOworICAgIH0KKyAgICByc1F1YXRlcm5pb25Mb2FkUm90YXRlVW5pdChxLCByb3QsIHgsIHksIHopOworfQorCitzdGF0aWMgdm9pZAorcnNRdWF0ZXJuaW9uQ29uanVnYXRlKHJzX3F1YXRlcm5pb24gKnEpIHsKKyAgICBxLT54ID0gLXEtPng7CisgICAgcS0+eSA9IC1xLT55OworICAgIHEtPnogPSAtcS0+ejsKK30KKworc3RhdGljIGZsb2F0Cityc1F1YXRlcm5pb25Eb3QoY29uc3QgcnNfcXVhdGVybmlvbiAqcTAsIGNvbnN0IHJzX3F1YXRlcm5pb24gKnExKSB7CisgICAgcmV0dXJuIHEwLT53KnExLT53ICsgcTAtPngqcTEtPnggKyBxMC0+eSpxMS0+eSArIHEwLT56KnExLT56OworfQorCitzdGF0aWMgdm9pZAorcnNRdWF0ZXJuaW9uTm9ybWFsaXplKHJzX3F1YXRlcm5pb24gKnEpIHsKKyAgICBjb25zdCBmbG9hdCBsZW4gPSByc1F1YXRlcm5pb25Eb3QocSwgcSk7CisgICAgaWYgKGxlbiAhPSAxKSB7CisgICAgICAgIGNvbnN0IGZsb2F0IHJlY2lwTGVuID0gMS5mIC8gc3FydChsZW4pOworICAgICAgICByc1F1YXRlcm5pb25NdWx0aXBseShxLCByZWNpcExlbik7CisgICAgfQorfQorCitzdGF0aWMgdm9pZAorcnNRdWF0ZXJuaW9uU2xlcnAocnNfcXVhdGVybmlvbiAqcSwgY29uc3QgcnNfcXVhdGVybmlvbiAqcTAsIGNvbnN0IHJzX3F1YXRlcm5pb24gKnExLCBmbG9hdCB0KSB7CisgICAgaWYodCA8PSAwLjBmKSB7CisgICAgICAgIHJzUXVhdGVybmlvblNldChxLCBxMCk7CisgICAgICAgIHJldHVybjsKKyAgICB9CisgICAgaWYodCA+PSAxLjBmKSB7CisgICAgICAgIHJzUXVhdGVybmlvblNldChxLCBxMSk7CisgICAgICAgIHJldHVybjsKKyAgICB9CisKKyAgICByc19xdWF0ZXJuaW9uIHRlbXBxMCwgdGVtcHExOworICAgIHJzUXVhdGVybmlvblNldCgmdGVtcHEwLCBxMCk7CisgICAgcnNRdWF0ZXJuaW9uU2V0KCZ0ZW1wcTEsIHExKTsKKworICAgIGZsb2F0IGFuZ2xlID0gcnNRdWF0ZXJuaW9uRG90KHEwLCBxMSk7CisgICAgaWYoYW5nbGUgPCAwKSB7CisgICAgICAgIHJzUXVhdGVybmlvbk11bHRpcGx5KCZ0ZW1wcTAsIC0xLjBmKTsKKyAgICAgICAgYW5nbGUgKj0gLTEuMGY7CisgICAgfQorCisgICAgZmxvYXQgc2NhbGUsIGludlNjYWxlOworICAgIGlmIChhbmdsZSArIDEuMGYgPiAwLjA1ZikgeworICAgICAgICBpZiAoMS4wZiAtIGFuZ2xlID49IDAuMDVmKSB7CisgICAgICAgICAgICBmbG9hdCB0aGV0YSA9IGFjb3MoYW5nbGUpOworICAgICAgICAgICAgZmxvYXQgaW52U2luVGhldGEgPSAxLjBmIC8gc2luKHRoZXRhKTsKKyAgICAgICAgICAgIHNjYWxlID0gc2luKHRoZXRhICogKDEuMGYgLSB0KSkgKiBpbnZTaW5UaGV0YTsKKyAgICAgICAgICAgIGludlNjYWxlID0gc2luKHRoZXRhICogdCkgKiBpbnZTaW5UaGV0YTsKKyAgICAgICAgfQorICAgICAgICBlbHNlIHsKKyAgICAgICAgICAgIHNjYWxlID0gMS4wZiAtIHQ7CisgICAgICAgICAgICBpbnZTY2FsZSA9IHQ7CisgICAgICAgIH0KKyAgICB9CisgICAgZWxzZSB7CisgICAgICAgIHJzUXVhdGVybmlvblNldCgmdGVtcHExLCB0ZW1wcTAueiwgLXRlbXBxMC55LCB0ZW1wcTAueCwgLXRlbXBxMC53KTsKKyAgICAgICAgc2NhbGUgPSBzaW4oTV9QSSAqICgwLjVmIC0gdCkpOworICAgICAgICBpbnZTY2FsZSA9IHNpbihNX1BJICogdCk7CisgICAgfQorCisgICAgcnNRdWF0ZXJuaW9uU2V0KHEsIHRlbXBxMC53KnNjYWxlICsgdGVtcHExLncqaW52U2NhbGUsIHRlbXBxMC54KnNjYWxlICsgdGVtcHExLngqaW52U2NhbGUsCisgICAgICAgICAgICAgICAgICAgICAgICB0ZW1wcTAueSpzY2FsZSArIHRlbXBxMS55KmludlNjYWxlLCB0ZW1wcTAueipzY2FsZSArIHRlbXBxMS56KmludlNjYWxlKTsKK30KKworc3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bHNlOworICAgIH0KKyAgICBkaXN0VG9DZW50ZXIgPSBkb3QocmlnaHQtPnh5eiwgc3BoZXJlLT54eXopICsgcmlnaHQtPnc7CisgICAgaWYoZGlzdFRvQ2VudGVyIDwgLXNwaGVyZS0+dykgeworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorICAgIGRpc3RUb0NlbnRlciA9IGRvdCh0b3AtPnh5eiwgc3BoZXJlLT54eXopICsgdG9wLT53OworICAgIGlmKGRpc3RUb0NlbnRlciA8IC1zcGhlcmUtPncpIHsKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKyAgICBkaXN0VG9DZW50ZXIgPSBkb3QoYm90dG9tLT54eXosIHNwaGVyZS0+eHl6KSArIGJvdHRvbS0+dzsKKyAgICBpZihkaXN0VG9DZW50ZXIgPCAtc3BoZXJlLT53KSB7CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisgICAgZGlzdFRvQ2VudGVyID0gZG90KG5lYXItPnh5eiwgc3BoZXJlLT54eXopICsgbmVhci0+dzsKKyAgICBpZihkaXN0VG9DZW50ZXIgPCAtc3BoZXJlLT53KSB7CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisgICAgZGlzdFRvQ2VudGVyID0gZG90KGZhci0+eHl6LCBzcGhlcmUtPnh5eikgKyBmYXItPnc7CisgICAgaWYoZGlzdFRvQ2VudGVyIDwgLXNwaGVyZS0+dykgeworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorICAgIHJldHVybiB0cnVlOworfQorCisKKy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vCisvLyBpbnQgb3BzCisvLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLworCitfX2lubGluZV9fIHN0YXRpYyB1aW50IF9fYXR0cmlidXRlX18oKG92ZXJsb2FkYWJsZSwg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RhcnQ7CisgICAgdWludDMyX3QgeEVuZDsKKyAgICB1aW50MzJfdCB5U3RhcnQ7CisgICAgdWludDMyX3QgeUVuZDsKKyAgICB1aW50MzJfdCB6U3RhcnQ7CisgICAgdWludDMyX3QgekVuZDsKKyAgICB1aW50MzJfdCBhcnJheVN0YXJ0OworICAgIHVpbnQzMl90IGFycmF5RW5kOworfSByc19zY3JpcHRfY2FsbF90OwogCi1leHRlcm4gaW50IF9fYXR0cmlidXRlX18oKG92ZXJsb2FkYWJsZSkpIGFicyhpbnQpOwotZXh0ZXJuIGludDIgX19hdHRyaWJ1dGVfXygob3ZlcmxvYWRhYmxlKSkgYWJzKGludDIpOwotZXh0ZXJuIGludDMgX19hdHRyaWJ1dGVfXygob3ZlcmxvYWRhYmxlKSkgYWJzKGludDMpOwotZXh0ZXJuIGludDQgX19hdHRyaWJ1dGVfXygob3ZlcmxvYWRhYmxlKSkgYWJzKGludDQpOwotZXh0ZXJuIGludDggX19hdHRyaWJ1dGVfXygob3ZlcmxvYWRhYmxlKSkgYWJzKGludDgpOwotZXh0ZXJuIGludDE2IF9fYXR0cmlidXRlX18oKG92ZXJsb2FkYWJsZSkpIGFicyhpbnQxNik7CitleHRlcm4gdm9pZCBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKQorICAgIHJzRm9yRWFjaChyc19zY3JpcHQgc2NyaXB0LCByc19hbGxvY2F0aW9uIGlucHV0LAorICAgICAgICAgICAgICByc19hbGxvY2F0aW9uIG91dHB1dCwgY29uc3Qgdm9pZCAqIHVzckRhdGEpOwogCitleHRlcm4gdm9pZCBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKQorICAgIHJzRm9yRWFjaChyc19zY3JpcHQgc2NyaXB0LCByc19hbGxvY2F0aW9uIGlucHV0LAorICAgICAgICAgICAgICByc19hbGxvY2F0aW9uIG91dHB1dCwgY29uc3Qgdm9pZCAqIHVzckRhdGEsCisgICAgICAgICAgICAgIGNvbnN0IHJzX3Njc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zaG91bGQgYWJvcnQuCisgICAgICAgIGlmIChvdXROYW1lLT50eXBlID09IE5VTEwgfHwgb3V0TmFtZS0+bmFtZSA9PSBOVUxMKSB7CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKwogICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICB9CiAKQEAgLTI2MDksNiArMjYyMSwyNCBAQAogICAgICAgICAqb3V0VHlwZSA9ICpkZWZUeXBlOwogICAgIH0KICAgICAqb3V0TmFtZSA9IFN0cmluZzE2KHAsIGVuZC1wKTsKKyAgICBpZigqKm91dFBhY2thZ2UgPT0gMCkgeworICAgICAgICBpZihvdXRFcnJvck1zZykgeworICAgICAgICAgICAgKm91dEVycm9yTXNnID0gIlJlc291cmNlIHBhY2thZ2UgY2Fubm90IGJlIGFuIGVtcHR5IHN0cmluZyI7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKyAgICBpZigqKm91dFR5cGUgPT0gMCkgeworICAgICAgICBpZihvdXRFcnJvck1zZykgeworICAgICAgICAgICAgKm91dEVycm9yTXNnID0gIlJlc291cmNlIHR5cGUgY2Fubm90IGJlIGFuIGVtcHR5IHN0cmluZyI7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKyAgICBpZigqKm91dE5hbWUgPT0gMCkgeworICAgICAgICBpZihvdXRFcnJvck1zZykgeworICAgICAgICAgICAgKm91dEVycm9yTXNnID0gIlJlc291cmNlIGlkIGNhbm5vdCBiZSBhbiBlbXB0eSBzdHJpbmciOworICAgICAgICB9CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CiAgICAgcmV0dXJuIHRydWU7CiB9CiAKQEAgLTQxMjcsMTMgKzQxNTcsMTYgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgKDB4MDBmZjAwMDAgJiAoKHR5cGVJbmRleCsxKTw8MTYpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAoMHgwMDAwZmZmZiAmIChlbnRyeUluZGV4KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICByZXNvdXJjZV9uYW1lIHJlc05hbWU7Ci0gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLT5nZXRSZXNvdXJjZU5hbWUocmVzSUQsICZyZXNOYW1lKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIHByaW50ZigiICAgICAgc3BlYyByZXNvdXJjZSAweCUwOHggJXM6JXMvJXM6IGZsYWdzPTB4JTA4eFxuIiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXNJRCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBDSEFSMTZfVE9fQ1NUUihyZXNOYW1lLnBhY2thZ2UsIHJlc05hbWUucGFja2FnZUxlbiksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgQ0hBUjE2X1RPX0NTVFIocmVzTmFtZS50eXBlLCByZXNOYW1lLnR5cGVMZW4pLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIENIQVIxNl9UT19DU1RSKHJlc05hbWUubmFtZSwgcmVzTmFtZS5uYW1lTGVuKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBkdG9obCh0eXBlQ29uZmlncy0+dHlwZVNwZWNGbGFnc1tlbnRyeUluZGV4XSkpOworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMtPmdldFJlc291cmNlTmFtZShyZXNJRCwgJnJlc05hbWUpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJpbnRmKCIgICAgICBzcGVjIHJlc291cmNlIDB4JTA4eCAlczolcy8lczogZmxhZ3M9MHglMDh4XG4iLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXNJRCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ0hBUjE2X1RPX0NTVFIocmVzTmFtZS5wYWNrYWdlLCByZXNOYW1lLnBhY2thZ2VMZW4pLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDSEFSMTZfVE9fQ1NUUihyZXNOYW1lLnR5cGUsIHJlc05hbWUudHlwZUxlbiksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENIQVIxNl9UT19DU1RSKHJlc05hbWUubmFtZSwgcmVzTmFtZS5uYW1lTGVuKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZHRvaGwodHlwZUNvbmZpZ3MtPnR5cGVTcGVjRmxhZ3NbZW50cnlJbmRleF0pKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJpbnRmKCIgICAgICBJTlZBTElEIFRZUEUgQ09ORklHIEZPUiBSRVNPVVJDRSAweCUwOHhcbiIsIHJlc0lEKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBmb3IgKHNpemVfdCBjb25maWdJbmRleD0wOyBjb25maWdJbmRleDxOVEM7IGNvbmZpZ0luZGV4KyspIHsKQEAgLTQzNDAsMTEgKzQzNzMsMTQgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgKDB4MDBmZjAwMDAgJiAoKHR5cGVJbmRleCsxKTw8MTYpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAoMHgwMDAwZmZmZiAmIChlbnRyeUluZGV4KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICByZXNvdXJjZV9uYW1lIHJlc05hbWU7Ci0gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLT5nZXRSZXNvdXJjZU5hbWUocmVzSUQsICZyZXNOYW1lKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIHByaW50ZigiICAgICAgICByZXNvdXJjZSAweCUwOHggJXM6JXMvJXM6ICIsIHJlc0lELAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDSEFSMTZfVE9fQ1NUUihyZXNOYW1lLnBhY2thZ2UsIHJlc05hbWUucGFja2FnZUxlbiksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENIQVIxNl9UT19DU1RSKHJlc05hbWUudHlwZSwgcmVzTmFtZS50eXBlTGVuKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ0hBUjE2X1RPX0NTVFIocmVzTmFtZS5uYW1lLCByZXNOYW1lLm5hbWVMZW4pKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLT5nZXRSZXNvdXJjZU5hbWUocmVzSUQsICZyZXNOYW1lKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByaW50ZigiICAgICAgICByZXNvdXJjZSAweCUwOHggJXM6JXMvJXM6ICIsIHJlc0lELAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ0hBUjE2X1RPX0NTVFIocmVzTmFtZS5wYWNrYWdlLCByZXNOYW1lLnBhY2thZ2VMZW4pLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ0hBUjE2X1RPX0NTVFIocmVzTmFtZS50eXBlLCByZXNOYW1lLnR5cGVMZW4pLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ0hBUjE2X1RPX0NTVFIocmVzTmFtZS5uYW1lLCByZXNOYW1lLm5hbWVMZW4pKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJpbnRmKCIgICAgICAgIElOVkFMSUQgUkVTT1VSQ0UgMHglMDh4OiAiLCByZXNJRCk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoKHRoaXNPZmZzZXQmMHgzKSAhPSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJpbnRmKCJOT04tSU5URUdFUiBPRkZTRVQ6ICVwXG4iLCAodm9pZCopdGhpc09mZnNldCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7CkBAIC00NDAyLDE4ICs0NDM4LDE5IEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByaW50X3ZhbHVlKHBrZywgdmFsdWUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoYmFnUHRyICE9IE5VTEwpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgaW50IE4gPSBkdG9obChiYWdQdHItPmNvdW50KTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgUmVzVGFibGVfbWFwKiBtYXBQdHIgPSAoY29uc3QgUmVzVGFibGVfbWFwKikKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoKChjb25zdCB1aW50OF90KillbnQpICsgZXNpemUpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCB1aW50OF90KiBiYXNlTWFwUHRyID0gKGNvbnN0IHVpbnQ4X3QqKWVudDsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZV90IG1hcE9mZnNldCA9IGVzaXplOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBSZXNUYWJsZV9tYXAqIG1hcFB0ciA9IChSZXNUYWJsZV9tYXAqKShiYXNlTWFwUHRyK21hcE9mZnNldCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByaW50ZigiICAgICAgICAgIFBhcmVudD0weCUwOHgsIENvdW50PSVkXG4iLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZHRvaGwoYmFnUHRyLT5wYXJlbnQuaWRlbnQpLCBOKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChpbnQgaT0wOyBpPE47IGkrKykgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGludCBpPTA7IGk8TiAmJiBtYXBPZmZzZXQgPCAodHlwZVNpemUtc2l6ZW9mKFJlc1RhYmxlX21hcCkpOyBpKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByaW50ZigiICAgICAgICAgICMlaSAoS2V5PTB4JTA4eCk6ICIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaSwgZHRvaGwobWFwUHRyLT5uYW1lLmlkZW50KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZS5jb3B5RnJvbV9kdG9oKG1hcFB0ci0+dmFsdWUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJpbnRfdmFsdWUocGtnLCB2YWx1ZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzaXplX3Qgc2l6ZSA9IGR0b2hzKG1hcFB0ci0+dmFsdWUuc2l6ZSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXBQdHIgPSAoUmVzVGFibGVfbWFwKikoKChjb25zdCB1aW50OF90KiltYXBQdHIpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgc2l6ZSArIHNpemVvZigqbWFwUHRyKS1zaXplb2YobWFwUHRyLT52YWx1ZSkpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWFwT2Zmc2V0ICs9IHNpemUgKyBzaXplb2YoKm1hcFB0ciktc2l6ZW9mKG1hcFB0ci0+dmFsdWUpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWFwUHRyID0gKFJlc1RhYmxlX21hcCopKGJhc2VNYXBQdHIrbWFwT2Zmc2V0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgIH0K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JvbSB0aGUgc3lzdGVtIGxvY2FsZSBzZXR0aW5nCisgICAgICovCisgICAgcHVibGljIHN0YXRpYyBmaW5hbCBpbnQgQ09VTlRSWV9TT1VSQ0VfTE9DQUxFID0gMzsKKworICAgIC8qKgorICAgICAqIFRoZSBJU08gMzE2Ni0xIHR3byBsZXR0ZXJzIGNvdW50cnkgY29kZS4KKyAgICAgKi8KKyAgICBwcml2YXRlIGZpbmFsIFN0cmluZyBtQ291bnRyeUlzbzsKKworICAgIC8qKgorICAgICAqIFdoZXJlIHRoZSBjb3VudHJ5IGNvZGUgY2FtZSBmcm9tLgorICAgICAqLworICAgIHByaXZhdGUgZmluYWwgaW50IG1Tb3VyY2U7CisKKyAgICBwcml2YXRlIGludCBtSGFzaENvZGU7CisgICAgLyoqCisgICAgICoKKyAgICAgKiBAcGFyYW0gY291bnRyeUlzbyB0aGUgSVNPIDMxNjYtMSB0d28gbGV0dGVycyBjb3VudHJ5IGNvZGUuCisgICAgICogQHBhcmFtIHNvdXJjZSB3aGVyZSB0aGUgY291bnRyeUlzbyBjYW1lIGZyb20sIGNvdWxkIGJlIG9uZSBvZiBiZWxvdworICAgICAqICAgICAgICB2YWx1ZXMKKyAgICAgKiAgICAgICAgPHA+CisgICAgICogICAgICAgIDx1bD4KKyAgICAgKiAgICAgICAgPGxpPntAbGluayAjQ09VTlRSWV9TT1VSQ0VfTkVUV09SS308L2xpPgorICAgICAqICAgICAgICA8bGk+e0BsaW5rICNDT1VOVFJZX1NPVVJDRV9MT0NBVElPTn08L2xpPgorICAgICAqICAgICAgICA8bGk+e0BsaW5rICNDT1VOVFJZX1NPVVJDRV9TSU19PC9saT4KKyAgICAgKiAgICAgICAgPGxpPntAbGluayAjQ09VTlRSWV9TT1VSQ0VfTE9DQUxFfTwvbGk+CisgICAgICogICAgICAgIDwvdWw+CisgICAgICovCisgICAgcHVibGljIENvdW50cnkoZmluYWwgU3RyaW5nIGNvdW50cnlJc28sIGZpbmFsIGludCBzb3VyY2UpIHsKKyAgICAgICAgaWYgKGNvdW50cnlJc28gPT0gbnVsbCB8fCBzb3VyY2UgPCBDT1VOVFJZX1NPVVJDRV9ORVRXT1JLCisgICAgICAgICAgICAgICAgfHwgc291cmNlID4gQ09VTlRSWV9TT1VSQ0VfTE9DQUxFKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCk7CisgICAgICAgIH0KKyAgICAgICAgbUNvdW50cnlJc28gPSBjb3VudHJ5SXNvLnRvTG93ZXJDYXNlKCk7CisgICAgICAgIG1Tb3VyY2UgPSBzb3VyY2U7CisgICAgfQorCisgICAgcHVibGljIENvdW50cnkoQ291bnRyeSBjb3VudHJ5KSB7CisgICAgICAgIG1Db3VudHJ5SXNvID0gY291bnRyeS5tQ291bnRyeUlzbzsKKyAgICAgICAgbVNvdXJjZSA9IGNvdW50cnkubVNvdXJjZTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBAcmV0dXJuIHRoZSBJU08gMzE2Ni0xIHR3byBsZXR0ZXJzIGNvdW50cnkgY29kZQorICAgICAqLworICAgIHB1YmxpYyBmaW5hbCBTdHJpbmcgZ2V0Q291bnRyeUlzbygpIHsKKyAgICAgICAgcmV0dXJuIG1Db3VudHJ5SXNvOworICAgIH0KKworICAgIC8qKgorICAgICAqIEByZXR1cm4gd2hlcmUgdGhlIGNvdW50cnkgY29kZSBjYW1lIGZyb20sIGNvdWxkIGJlIG9uZSBvZiBiZWxvdyB2YWx1ZXMKKyAgICAgKiAgICAgICAgIDxwPgorICAgICAqICAgICAgICAgPHVsPgorICAgICAqICAgICAgICAgPGxpPntAbGluayAjQ09VTlRSWV9TT1VSQ0VfTkVUV09SS308L2xpPgorICAgICAqICAgICAgICAgPGxpPntAbGluayAjQ09VTlRSWV9TT1VSQ0VfTE9DQVRJT059PC9saT4KKyAgICAgKiAgICAgICAgIDxsaT57QGxpbmsgI0NPVU5UUllfU09VUkNFX1NJTX08L2xpPgorICAgICAqICAgICAgICAgPGxpPntAbGluayAjQ09VTlRSWV9TT1VSQ0VfTE9DQUxFfTwvbGk+CisgICAgICogICAgICAgICA8L3VsPgorICAgICAqLworICAgIHB1YmxpYyBmaW5hbCBpbnQgZ2V0U291cmNlKCkgeworICAgICAgICByZXR1cm4gbVNvdXJjZTsKKyAgICB9CisKKyAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFBhcmNlbGFibGUuQ3JlYXRvcjxDb3VudHJ5PiBDUkVBVE9SID0gbmV3IFBhcmNlbGFibGUuQ3JlYXRvcjxDb3VudHJ5PigpIHsKKyAgICAgICAgcHVibGljIENvdW50cnkgY3JlYXRlRnJvbVBhcmNlbChQYXJjZWwgaW4pIHsKKyAgICAgICAgICAgIHJldHVybiBuZXcgQ291bnRyeShpbi5yZWFkU3RyaW5nKCksIGluLnJlYWRJbnQoKSk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgQ291bnRyeVtdIG5ld0FycmF5KGludCBzaXplKSB7CisgICAgICAgICAgICByZXR1cm4gbmV3IENvdW50cnlbc2l6ZV07CisgICAgICAgIH0KKyAgICB9OworCisgICAgcHVibGljIGludCBkZXNjcmliZUNvbnRlbnRzKCkgeworICAgICAgICByZXR1cm4gMDsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCB3cml0ZVRvUGFyY2VsKFBhcmNlbCBwYXJjZWwsIGludCBmbGFncykgeworICAgICAgICBwYXJjZWwud3JpdGVTdHJpbmcobUNvdW50cnlJc28pOworICAgICAgICBwYXJjZWwud3JpdGVJbnQobVNvdXJjZSk7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIGJvb2xlYW4gZXF1YWxzKE9iamVjdCBvYmplY3QpIHsKKyAgICAgICAgaWYgKG9iamVjdCA9PSB0aGlzKSB7CisgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgfQorICAgICAgICBpZiAob2JqZWN0IGluc3RhbmNlb2YgQ291bnRyeSkgeworICAgICAgICAgICAgQ291bnRyeSBjID0gKENvdW50cnkpIG9iamVjdDsKKyAgICAgICAgICAgIHJldHVybiBtQ291bnRyeUlzby5lcXVhbHMoYy5nZXRDb3VudHJ5SXNvKCkpICYmIG1Tb3VyY2UgPT0gYy5nZXRTb3VyY2UoKTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIGludCBoYXNoQ29kZSgpIHsKKyAgICAgICAgaW50IGhhc2ggPSBtSGFzaENvZGU7CisgICAgICAgIGlmIChoYXNoID09IDApIHsKKyAgICAgICAgICAgIGhhc2ggPSAxNzsKKyAgICAgICAgICAgIGhhc2ggPSBoYXNoICogMTMgKyBtQ291bnRyeUlzby5oYXNoQ29kZSgpOworICAgICAgICAgICAgaGFzaCA9IGhhc2ggKiAxMyArIG1Tb3VyY2U7CisgICAgICAgICAgICBtSGFzaENvZGUgPSBoYXNoOworICAgICAgICB9CisgICAgICAgIHJldHVybiBtSGFzaENvZGU7CisgICAgfQorCisgICAgLyoqCisgICAgICogQ29tcGFyZSB0aGUgc3BlY2lmaWVkIGNvdW50cnkgdG8gdGhpcyBjb3VudHJ5IG9iamVjdCBpZ25vcmluZyB0aGUgbVNvdXJjZQorICAgICAqIGZpZWxkLCByZXR1cm4gdHJ1ZSBpZiB0aGUgY291bnRyeUlzbyBmaWVsZHMgYXJlIGVxdWFsCisgICAgICoKKyAgICAgKiBAcGFyYW0gY291bnRyeSB0aGUgY291bnRyeSB0byBjb21wYXJlCisgICAgICogQHJldHVybiB0cnVlIGlmIHRoZSBzcGVjaWZpZWQgY291bnRyeSdzIGNvdW50cnlJc28gZmllbGQgaXMgZXF1YWwgdG8gdGhpcworICAgICAqICAgICAgICAgY291bnRyeSdzLCBmYWxzZSBvdGhlcndpc2UuCisgICAgICovCisgICAgcHVibGljIGJvb2xlYW4gZXF1YWxzSWdub3JlU291cmNlKENvdW50cnkgY291bnRyeSkgeworICAgICAgICBy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lzdGVuZXJUcmFuc3BvcnQoQ291bnRyeUxpc3RlbmVyIGxpc3RlbmVyLCBMb29wZXIgbG9vcGVyKSB7CisgICAgICAgICAgICBtTGlzdGVuZXIgPSBsaXN0ZW5lcjsKKyAgICAgICAgICAgIGlmIChsb29wZXIgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIG1IYW5kbGVyID0gbmV3IEhhbmRsZXIobG9vcGVyKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgbUhhbmRsZXIgPSBuZXcgSGFuZGxlcigpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgb25Db3VudHJ5RGV0ZWN0ZWQoZmluYWwgQ291bnRyeSBjb3VudHJ5KSB7CisgICAgICAgICAgICBtSGFuZGxlci5wb3N0KG5ldyBSdW5uYWJsZSgpIHsKKyAgICAgICAgICAgICAgICBwdWJsaWMgdm9pZCBydW4oKSB7CisgICAgICAgICAgICAgICAgICAgIG1MaXN0ZW5lci5vbkNvdW50cnlEZXRlY3RlZChjb3VudHJ5KTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9KTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgZmluYWwgc3RhdGljIFN0cmluZyBUQUcgPSAiQ291bnRyeURldGVjdG9yIjsKKyAgICBwcml2YXRlIGZpbmFsIElDb3VudHJ5RGV0ZWN0b3IgbVNlcnZpY2U7CisgICAgcHJpdmF0ZSBmaW5hbCBIYXNoTWFwPENvdW50cnlMaXN0ZW5lciwgTGlzdGVuZXJUcmFuc3BvcnQ+IG1MaXN0ZW5lcnM7CisKKyAgICAvKioKKyAgICAgKiBAaGlkZSAtIGhpZGUgdGhpcyBjb25zdHJ1Y3RvciBiZWNhdXNlIGl0IGhhcyBhIHBhcmFtZXRlciBvZiB0eXBlCisgICAgICogICAgICAgSUNvdW50cnlEZXRlY3Rvciwgd2hpY2ggaXMgYSBzeXN0ZW0gcHJ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wogICAgIH0KIAorICAgIHB1YmxpYyBzdGF0aWMgaW50IGdldEZvcm1hdENvZGUoU3RyaW5nIGZpbGVOYW1lLCBTdHJpbmcgbWltZVR5cGUpIHsKKyAgICAgICAgaWYgKG1pbWVUeXBlICE9IG51bGwpIHsKKyAgICAgICAgICAgIEludGVnZXIgdmFsdWUgPSBzTWltZVR5cGVUb0Zvcm1hdE1hcC5nZXQobWltZVR5cGUpOworICAgICAgICAgICAgaWYgKHZhbHVlICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gdmFsdWUuaW50VmFsdWUoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICBpbnQgbGFzdERvdCA9IGZpbGVOYW1lLmxhc3RJbmRleE9mKCcuJyk7CisgICAgICAgIGlmIChsYXN0RG90ID4gMCkgeworICAgICAgICAgICAgU3RyaW5nIGV4dGVuc2lvbiA9IGZpbGVOYW1lLnN1YnN0cmluZyhsYXN0RG90ICsgMSk7CisgICAgICAgICAgICBJbnRlZ2VyIHZhbHVlID0gc0ZpbGVUeXBlVG9Gb3JtYXRNYXAuZ2V0KGV4dGVuc2lvbik7CisgICAgICAgICAgICBpZiAodmFsdWUgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIHJldHVybiB2YWx1ZS5pbnRWYWx1ZSgpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHJldHVybiBNdHAuT2JqZWN0LkZPUk1BVF9VTkRFRklORUQ7CisgICAgfQorCisgICAgcHVibGljIHN0YXRpYyBTdHJpbmcgZ2V0TWltZVR5cGVGb3JGb3JtYXRDb2RlKGludCBmb3JtYXRDb2RlKSB7CisgICAgICAgIHJldHVybiBzRm9ybWF0VG9NaW1lVHlwZU1hcC5nZXQoZm9ybWF0Q29kZSk7CisgICAgfQogfQpkaWZmIC0tZ2l0IGEvbWVkaWEvamF2YS9hbmRyb2lkL21lZGlhL01lZGlhUmVjb3JkZXIuamF2YSBiL21lZGlhL2phdmEvY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bGllbnQ6IGxpc3RlbmVyIGlzIG51bGwiKTsKKyAgICAgICAgfQorICAgICAgICBtTGlzdGVuZXIgPSBsaXN0ZW5lcjsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwcm90ZWN0ZWQgdm9pZCBmaW5hbGl6ZSgpIHsKKyAgICAgICAgbmF0aXZlX2ZpbmFsaXplKCk7CisgICAgfQorCisgICAgcHVibGljIGJvb2xlYW4gc3RhcnQoKSB7CisgICAgICAgIHJldHVybiBuYXRpdmVfc3RhcnQoKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBzdG9wKCkgeworICAgICAgICBuYXRpdmVfc3RvcCgpOworICAgIH0KKworICAgIHB1YmxpYyBib29sZWFuIGRlbGV0ZU9iamVjdChpbnQgZGV2aWNlSUQsIGludCBvYmplY3RJRCkgeworICAgICAgICByZXR1cm4gbmF0aXZlX2RlbGV0ZV9vYmplY3QoZGV2aWNlSUQsIG9iamVjdElEKTsKKyAgICB9CisKKyAgICBwdWJsaWMgaW50IGdldFBhcmVudChpbnQgZGV2aWNlSUQsIGludCBvYmplY3RJRCkgeworICAgICAgICByZXR1cm4gbmF0aXZlX2dldF9wYXJlbnQoZGV2aWNlSUQsIG9iamVjdElEKTsKKyAgICB9CisKKyAgICBwdWJsaWMgaW50IGdldFN0b3JhZ2VJRChpbnQgZGV2aWNlSUQsIGludCBvYmplY3RJRCkgeworICAgICAgICByZXR1cm4gbmF0aXZlX2dldF9zdG9yYWdlX2lkKGRldmljZUlELCBvYmplY3RJRCk7CisgICAgfQorCisgICAgLy8gY3JlYXRlIGEgZmlsZSBkZXNjcmlwdG9yIGZvciByZWFkaW5nIHRoZSBjb250ZW50cyBvZiBhbiBvYmplY3Qgb3ZlciBNVFAKKyAgICBwdWJsaWMgUGFyY2VsRmlsZURlc2NyaXB0b3Igb3BlbkZpbGUoaW50IGRldmljZUlELCBpbnQgb2JqZWN0SUQpIHsKKyAgICAgICAgcmV0dXJuIG5hdGl2ZV9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HB1YmxpYyBzdGF0aWMgZmluYWwgaW50IERFVklDRSAgICAgICAgICAgICAgPSAxOworICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgaW50IERFVklDRV9JRCAgICAgICAgICAgPSAyOworICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgaW50IFNUT1JBR0UgICAgICAgICAgICAgPSAzOworICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgaW50IFNUT1JBR0VfSUQgICAgICAgICAgPSA0OworICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgaW50IE9CSkVDVCAgICAgICAgICAgICAgPSA1OworICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgaW50IE9CSkVDVF9JRCAgICAgICAgICAgPSA2OworICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgaW50IFNUT1JBR0VfQ0hJTERSRU4gICAgPSA3OworICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgaW50IE9CSkVDVF9DSElMRFJFTiAgICAgPSA4OworCisgICAgcHJpdmF0ZSBpbnQgbVF1ZXJ5VHlwZTsKKyAgICBwcml2YXRlIGludCBtRGV2aWNlSUQ7CisgICAgcHJpdmF0ZSBpbnQgbVN0b3JhZ2VJRDsKKyAgICBwcml2YXRlIGludCBtUWJqZWN0SUQ7CisKKyAgICAvKiogVGhlIG5hbWVzIG9mIHRoZSBjb2x1bW5zIGluIHRoZSBwcm9qZWN0aW9uICovCisgICAgcHJpdmF0ZSBTdHJpbmdbXSBtQ29sdW1uczsKKworICAgIC8qKiBUaGUgbnVtYmVyIG9mIHJvd3MgaW4gdGhlIGN1cnNvciAqLworICAgIHByaXZhdGUgaW50IG1Db3VudCA9IE5PX0NPVU5UOworCisgICAgcHJpdmF0ZSBmaW5hbCBNdHBDbGllbnQgbUNsaWVudDsKKworICAgIHB1YmxpYyBNdHBDdXJzb3IoTXRwQ2xpZW50IGNsaWVudCwgaW50IHF1ZXJ5VHlwZSwgaW50IGRldmljZUlELCBpbnQgc3RvcmFnZUlELCBpbnQgb2JqZWN0SUQsCisgICAgICAgICAgICBTdHJpbmdbXSBwcm9qZWN0aW9uKSB7CisKKyAgICAgICAgbUNsaWVudCA9IGNsaWVudDsKKyAgICAgICAgbVF1ZXJ5VHlwZSA9IHF1ZXJ5VHlwZTsKKyAgICAgICAgbURldmljZUlEID0gZGV2aWNlSUQ7CisgICAgICAgIG1TdG9yYWdlSUQgPSBzdG9yYWdlSUQ7CisgICAgICAgIG1RYmplY3RJRCA9IG9iamVjdElEOworICAgICAgICBtQ29sdW1ucyA9IHByb2plY3Rpb247CisKKyAgICAgICAgSGFzaE1hcDxTdHJpbmcsIEludGVnZXI+IG1hcDsKKyAgICAgICAgc3dpdGNoIChxdWVyeVR5cGUpIHsKKyAgICAgICAgICAgIGNhc2UgREVWSUNFOgorICAgICAgICAgICAgY2FzZSBERVZJQ0VfSUQ6CisgICAgICAgICAgICAgICAgbWFwID0gc0RldmljZVByb2plY3Rpb25NYXA7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIFNUT1JBR0U6CisgICAgICAgICAgICBjYXNlIFNUT1JBR0VfSUQ6CisgICAgICAgICAgICAgICAgbWFwID0gc1N0b3JhZ2VQcm9qZWN0aW9uTWFwOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBPQkpFQ1Q6CisgICAgICAgICAgICBjYXNlIE9CSkVDVF9JRDoKKyAgICAgICAgICAgIGNhc2UgU1RPUkFHRV9DSElMRFJFTjoKKyAgICAgICAgICAgIGNhc2UgT0JKRUNUX0NISUxEUkVOOgorICAgICAgICAgICAgICAgIG1hcCA9IHNPYmplY3RQcm9qZWN0aW9uTWFwOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCJ1bmtub3duIHF1ZXJ5IHR5cGUgIiAgKyBxdWVyeVR5cGUpOworICAgICAgICB9CisKKyAgICAgICAgaW50W10gY29sdW1ucyA9IG5ldyBpbnRbcHJvamVjdGlvbi5sZW5ndGhdOworICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IHByb2plY3Rpb24ubGVuZ3RoOyBpKyspIHsKKyAgICAgICAgICAgIEludGVnZXIgaWQgPSBtYXAuZ2V0KHByb2plY3Rpb25baV0pOworICAgICAgICAgICAgaWYgKGlkID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCJ1bmtub3duIGNvbHVtbiAiICArIHByb2plY3Rpb25baV0pOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY29sdW1uc1tpXSA9IGlkLmludFZhbHVlKCk7CisgICAgICAgIH0KKyAgICAgICAgbmF0aXZlX3NldHVwKGNsaWVudCwgcXVlcnlUeXBlLCBkZXZpY2VJRCwgc3RvcmFnZUlELCBvYmplY3RJRCwgY29sdW1ucyk7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHJvdGVjdGVkIHZvaWQgZmluYWxpemUoKSB7CisgICAgICAgIG5hdGl2ZV9maW5hbGl6ZSgpOworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyBpbnQgZ2V0Q291bnQoKSB7CisgICAgICAgIGlmIChtQ291bnQgPT0gTk9fQ09VTlQpIHsKKyAgICAgICAgICAgIGZpbGxXaW5kb3coMCk7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIG1Db3VudDsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgYm9vbGVhbiByZXF1ZXJ5KCkgeworICAgICAgICBMb2cuZChUQUcsICJyZXF1ZXJ5Iik7CisgICAgICAgIG1Db3VudCA9IE5PX0NPVU5UOworICAgICAgICBpZiAobVdpbmRvdyAhPSBudWxsKSB7CisgICAgICAgICAgICBtV2luZG93LmNsZWFyKCk7CisgICAgICAgIH0KKyAgIC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XNzZWQgaW4gdmlhIHRoZSBjb25zdHJ1Y3RvcgorICAgIHByaXZhdGUgZmluYWwgaW50IG1TdG9yYWdlSUQgPSAweDAwMDEwMDAxOworCisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgU3RyaW5nW10gSURfUFJPSkVDVElPTiA9IG5ldyBTdHJpbmdbXSB7CisgICAgICAgICAgICBNdHBPYmplY3RzLk9iamVjdENvbHVtbnMuX0lELCAvLyAwCisgICAgfTsKKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBTdHJpbmdbXSBQQVRIX1NJWkVfUFJPSkVDVElPTiA9IG5ldyBTdHJpbmdbXSB7CisgICAgICAgICAgICBNdHBPYmplY3RzLk9iamVjdENvbHVtbnMuX0lELCAvLyAwCisgICAgICAgICAgICBNdHBPYmplY3RzLk9iamVjdENvbHVtbnMuREFUQSwgLy8gMQorICAgICAgICAgICAgTXRwT2JqZWN0cy5PYmplY3RDb2x1bW5zLlNJWkUsIC8vIDIKKyAgICB9OworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIFN0cmluZ1tdIE9CSkVDVF9JTkZPX1BST0pFQ1RJT04gPSBuZXcgU3RyaW5nW10geworICAgICAgICAgICAgTXRwT2JqZWN0cy5PYmplY3RDb2x1bW5zLl9JRCwgLy8gMAorICAgICAgICAgICAgTXRwT2JqZWN0cy5PYmplY3RDb2x1bW5zLkRBVEEsIC8vIDEKKyAgICAgICAgICAgIE10cE9iamVjdHMuT2JqZWN0Q29sdW1ucy5GT1JNQVQsIC8vIDIKKyAgICAgICAgICAgIE10cE9iamVjdHMuT2JqZWN0Q29sdW1ucy5QQVJFTlQsIC8vIDMKKyAgICAgICAgICAgIE10cE9iamVjdHMuT2JqZWN0Q29sdW1ucy5TSVpFLCAvLyA0CisgICAgICAgICAgICBNdHBPYmplY3RzLk9iamVjdENvbHVtbnMuREFURV9NT0RJRklFRCwgLy8gNQorICAgIH07CisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgU3Ry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fUFJPUEVSVFlfUEFSRU5UX09CSkVDVCA9IDB4REMwQjsKKworICAgIC8vIE1UUCByZXNwb25zZSBjb2RlcworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBNVFBfUkVTUE9OU0VfT0sgPSAweDIwMDE7CisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IE1UUF9SRVNQT05TRV9HRU5FUkFMX0VSUk9SID0gMHgyMDAyOworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBNVFBfUkVTUE9OU0VfSU5WQUxJRF9PQkpFQ1RfSEFORExFID0gMHgyMDA5OworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBNVFBfUkVTUE9OU0VfT0JKRUNUX1BST1BfTk9UX1NVUFBPUlRFRCA9IDB4QTgwQTsKKworICAgIHN0YXRpYyB7CisgICAgICAgIFN5c3RlbS5sb2FkTGlicmFyeSgibWVkaWFfam5pIik7CisgICAgfQorCisgICAgcHVibGljIE10cERhdGFiYXNlKENvbnRleHQgY29udGV4dCwgU3RyaW5nIHZvbHVtZU5hbWUpIHsKKyAgICAgICAgbmF0aXZlX3NldHVwKCk7CisKKyAgICAgICAgbU1lZGlhUHJvdmlkZXIgPSBjb250ZXh0LmdldENvbnRlbnRSZXNvbHZlcigpLmFjcXVpcmVQcm92aWRlcigibWVkaWEiKTsKKyAgICAgICAgbVZvbHVtZU5hbWUgPSB2b2x1bWVOYW1lOworICAgICAgICBtT2JqZWN0c1VyaSA9IE10cE9iamVjdHMuZ2V0Q29udGVudFVyaSh2b2x1bWVOYW1lKTsKKyAgICAgICAgbU1lZGlhU2Nhbm5lciA9IG5ldyBNZWRpYVNjYW5uZXIoY29udGV4dCk7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHJvdGVjdGVkIHZvaWQgZmluYWxpemUoKSB7CisgICAgICAgIG5hdGl2ZV9maW5hbGl6ZSgpOworICAgIH0KKworICAgIHByaXZhdGUgaW50IGJlZ2luU2VuZE9iamVjdChTdHJpbmcgcGF0aCwgaW50IGZvcm1hdCwgaW50IHBhcmVudCwKKyAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgc3RvcmFnZSwgbG9uZyBzaXplLCBsb25nIG1vZGlmaWVkKSB7CisgICAgICAgIENvbnRlbnRWYWx1ZXMgdmFsdWVzID0gbmV3IENvbnRlbnRWYWx1ZXMoKTsKKyAgICAgICAgdmFsdWVzLnB1dChNdHBPYmplY3RzLk9iamVjdENvbHVtbnMuREFUQSwgcGF0aCk7CisgICAgICAgIHZhbHVlcy5wdXQoTXRwT2JqZWN0cy5PYmplY3RDb2x1bW5zLkZPUk1BVCwgZm9ybWF0KTsKKyAgICAgICAgdmFsdWVzLnB1dChNdHBPYmplY3RzLk9iamVjdENvbHVtbnMuUEFSRU5ULCBwYXJlbnQpOworICAgICAgICAvLyBzdG9yYWdlIGlzIGlnbm9yZWQgZm9yIG5vdworICAgICAgICB2YWx1ZXMucHV0KE10cE9iamVjdHMuT2JqZWN0Q29sdW1ucy5TSVpFLCBzaXplKTsKKyAgICAgICAgdmFsdWVzLnB1dChNdHBPYmplY3RzLk9iamVjdENvbHVtbnMuREFURV9NT0RJRklFRCwgbW9kaWZpZWQpOworCisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBVcmkgdXJpID0gbU1lZGlhUHJvdmlkZXIuaW5zZXJ0KG1PYmplY3RzVXJpLCB2YWx1ZXMpOworICAgICAgICAgICAgaWYgKHVyaSAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIEludGVnZXIucGFyc2VJbnQodXJpLmdldFBhdGhTZWdtZW50cygpLmdldCgyKSk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIHJldHVybiAtMTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgIExvZy5lKFRBRywgIlJlbW90ZUV4Y2VwdGlvbiBpbiBiZWdpblNlbmRPYmplY3QiLCBlKTsKKyAgICAgICAgICAgIHJldHVybiAtMTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgdm9pZCBlbmRTZW5kT2JqZWN0KFN0cmluZyBwYXRoLCBpbnQgaGFuZGxlLCBpbnQgZm9ybWF0LCBib29sZWFuIHN1Y2NlZWRlZCkgeworICAgICAgICBpZiAoc3VjY2VlZGVkKSB7CisgICAgICAgICAgICAvLyBoYW5kbGUgYWJzdHJhY3QgcGxheWxpc3RzIHNlcGFyYXRlbHkKKyAgICAgICAgICAgIC8vIHRoZXkgZG8gbm90IGV4aXN0IGluIHRoZSBmaWxlIHN5c3RlbSBzbyBkb24ndCB1c2UgdGhlIG1lZGlhIHNjYW5uZXIgaGVyZQorICAgICAgICAgICAgaWYgKGZvcm1hdCA9PSBNdHAuT2JqZWN0LkZPUk1BVF9BQlNUUkFDVF9BVl9QTEFZTElTVCkgeworICAgICAgICAgICAgICAgIC8vIFN0cmlwIFdpbmRvd3MgTWVkaWEgUGxheWVyIGZpbGUgZXh0ZW5zaW9uCisgICAgICAgICAgICAgICAgaWYgKHBhdGguZW5kc1dpdGgoIi5wbGEiKSkgeworICAgICAgICAgICAgICAgICAgICBwYXRoID0gcGF0aC5zdWJzdHJpbmcoMCwgcGF0aC5sZW5ndGgoKSAtIDQpOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIC8vIGV4dHJhY3QgbmFtZSBmcm9tIHBhdGgKKyAgICAgICAgICAgICAgICBTdHJpbmcgbmFtZSA9IHBhdGg7CisgICAgICAgICAgICAgICAgaW50IGxhc3RTbGFzaCA9IG5hbWUubGFzdEluZGV4T2YoJy8nKTsKKyAgICAgICAgICAgICAgICBpZiAobGFzdFNsYXNoID49IDApIHsKKyAgICAgICAgICAgICAgICAgICAgbmFtZSA9IG5hbWUuc3Vic3RyaW5nKGxhc3RTbGFzaCArIDEpOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIENvbnRlbnRWYWx1ZXMgdmFsdWVzID0gbmV3IENvbnRlbnRWYWx1ZXMoMSk7CisgICAgICAgICAgICAgICAgdmFsdWVzLnB1dChBdWRpby5QbGF5bGlzdHMuREFUQSwgcGF0aCk7CisgICAgICAgICAgICAgICAgdmFsdWVzLnB1dChBdWRpby5QbGF5bGlzdHMuTkFNRSwgbmFtZSk7CisgICAgICAgICAgICAgICAgdmFsdWVzLnB1dChNZWRpYUNvbHVtbnMuTUVESUFfU0NBTk5FUl9ORVdfT0JKRUNUX0lELCBoYW5kbGUpOworICAgICAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgICAgIFVyaSB1cmkgPSBtTWVkaWFQcm92aWRlci5pbnNlcnQoQXVkaW8uUGxheWxpc3RzLkVYVEVSTkFMX0NPTlRFTlRfVVJJLCB2YWx1ZXMpOworICAgICAgICAgICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgICAgIExvZy5lKFRBRywgIlJlbW90ZUV4Y2VwdGlvbiBpbiBlbmRTZW5kT2JqZWN0IiwgZSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBVcmkgdXJpID0gbU1lZGlhU2Nhbm5lci5zY2FuTXRwRmlsZShwYXRoLCBtVm9sdW1lTmFtZSwgaGFuZGxlLCBmb3JtYXQpOworICAgICAgICAgICAgfQorICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgZGVsZXRlRmlsZShoYW5kbGUpOworICAgICAgICB9CisgICAgfQorCisgICAgcHJpdmF0ZSBpbnRbXSBnZXRPYmplY3RMaXN0KGludCBzdG9yYWdlSUQsIGludCBmb3JtYXQsIGludCBwYXJlbnQpIHsKKyAgICAgICAgLy8gd2UgY2FuIGlnbm9yZSBzdG9yYWdlSUQgdW50aWwgd2Ugc3VwcG9ydCBtdWx0aXBsZSBzdG9yYWdlcworICAgICAgICBMb2cuZChUQUcsICJnZXRPYmplY3RMaXN0IHBhcmVudDogIiArIHBhcmVudCk7CisgICAgICAgIEN1cnNvciBjID0gbnVsbDsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIGlmIChmb3JtYXQgIT0gMCkgeworICAgICAgICAgICAgICAgIGMgPSBtTWVkaWFQcm92aWRlci5xdWVyeShtT2JqZWN0c1VyaSwgSURfUFJPSkVDVElPTiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBQQVJFTlRfRk9STUFUX1dIRVJFLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5ldyBTdHJpbmdbXSB7IEludGVnZXIudG9TdHJpbmcocGFyZW50KSwgSW50ZWdlci50b1N0cmluZyhmb3JtYXQpIH0sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBjID0gbU1lZGlhUHJvdmlkZXIucXVlcnkobU9iamVjdHNVcmksIElEX1BST0pFQ1RJT04sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgUEFSRU5UX1dIRVJFLCBuZXcgU3RyaW5nW10geyBJbnRlZ2VyLnRvU3RyaW5nKHBhcmVudCkgfSwgbnVsbCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoYyA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgTG9nLmQoVEFHLCAibnVsbCBjdXJzb3IiKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGludCBjb3VudCA9IGMuZ2V0Q291bnQoKTsKKyAgICAgICAgICAgIGlmIChjb3VudCA+IDApIHsKKyAgICAgICAgICAgICAgICBpbnRbXSByZXN1bHQgPSBuZXcgaW50W2NvdW50XTsKKyAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGNvdW50OyBpKyspIHsKKyAgICAgICAgICAgICAgICAgICAgYy5tb3ZlVG9OZXh0KCk7CisgICAgICAgICAgICAgICAgICAgIHJlc3VsdFtpXSA9IGMuZ2V0SW50KDApOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBMb2cuZChUQUcsICJyZXR1cm5pbmcgIiArIHJlc3VsdCk7CisgICAgICAgICAgICAgICAgcmV0dXJuIHJlc3VsdDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgIExvZy5lKFRBRywgIlJlbW90ZUV4Y2VwdGlvbiBpbiBnZXRPYmplY3RMaXN0IiwgZSk7CisgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICBpZiAoYyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgYy5jbG9zZSgpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHJldHVybiBudWxsOworICAgIH0KKworICAgIHByaXZhdGUgaW50IGdldE51bU9iamVjdHMoaW50IHN0b3JhZ2VJRCwgaW50IGZvcm1hdCwgaW50IHBhcmVudCkgeworICAgICAgICAvLyB3ZSBjYW4gaWdub3JlIHN0b3JhZ2VJRCB1bnRpbCB3ZSBzdXBwb3J0IG11bHRpcGxlIHN0b3JhZ2VzCisgICAgICAgIExvZy5kKFRBRywgImdldE9iamVjdExpc3QgcGFyZW50OiAiICsgcGFyZW50KTsKKyAgICAgICAgQ3Vyc29yIGMgPSBudWxsOworICAgICAgICB0cnkgeworICAgICAgICAgICAgaWYgKGZvcm1hdCAhPSAwKSB7CisgICAgICAgICAgICAgICAgYyA9IG1NZWRpYVByb3ZpZGVyLnF1ZXJ5KG1PYmplY3RzVXJpLCBJRF9QUk9KRUNUSU9OLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBBUkVOVF9GT1JNQVRfV0hFUkUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV3IFN0cmluZ1tdIHsgSW50ZWdlci50b1N0cmluZyhwYXJlbnQpLCBJbnRlZ2VyLnRvU3RyaW5nKGZvcm1hdCkgfSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIGMgPSBtTWVkaWFQcm92aWRlci5xdWVyeShtT2JqZWN0c1VyaSwgSURfUFJPSkVDVElPTiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBQQVJFTlRfV0hFUkUsIG5ldyBTdHJpbmdbXSB7IEludGVnZXIudG9TdHJpbmcocGFyZW50KSB9LCBudWxsKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmIChjICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gYy5nZXRDb3VudCgpOworICAgICAgICAgICAgfQorICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgTG9nLmUoVEFHLCAiUmVtb3RlRXhjZXB0aW9uIGluIGdldE51bU9iamVjdHMiLCBlKTsKKyAgICAgICAgfSBmaW5hbGx5IHsKKyAgICAgICAgICAgIGlmIChjICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBjLmNsb3NlKCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIC0xOworICAgIH0KKworICAgIHByaXZhdGUgaW50W10gZ2V0U3VwcG9ydGVkUGxheWJhY2tGb3JtYXRzKCkgeworICAgICAgICByZXR1cm4gbmV3IGludFtdIHsKKyAgICAgICAgICAgIE10cC5PYmplY3QuRk9STUFUX0FTU09DSUFUSU9OLAorICAgICAgICAgICAgTXRwLk9iamVjdC5GT1JNQVRfTVAzLAorICAgICAgICAgICAgTXRwLk9iamVjdC5GT1JNQVRfTVBFRywKKyAgICAgICAgICAgIE10cC5PYmplY3QuRk9STUFUX0VYSUZfSlBFRywKKyAgICAgICAgICAgIE10cC5PYmplY3QuRk9STUFUX1RJRkZfRVAsCisgICAgICAgICAgICBNdHAuT2JqZWN0LkZPUk1BVF9HSUYsCisgICAgICAgICAgICBNdHAuT2JqZWN0LkZPUk1BVF9KRklGLAorICAgICAgICAgICAgTXRwLk9iamVjdC5GT1JNQVRfUE5HLAorICAgICAgICAgICAgTXRwLk9iamVjdC5GT1JNQVRfVElGRiwKKyAgICAgICAgICAgIE10cC5PYmplY3QuRk9STUFUX1dNQSwKKyAgICAgICAgICAgIE10cC5PYmplY3QuRk9STUFUX09HRywKKyAgICAgICAgICAgIE10cC5PYmplY3QuRk9STUFUX0FBQywKKyAgICAgICAgICAgIE10cC5PYmplY3QuRk9STUFUX01QNF9DT05UQUlORVIsCisgICAgICAgICAgICBNdHAuT2JqZWN0LkZPUk1BVF9NUDIsCisgICAgICAgICAgICBNdHAuT2JqZWN0LkZPUk1BVF8zR1BfQ09OVEFJTkVSLAorICAgICAgICAgICAgTXRwLk9iamVjdC5GT1JNQVRfQUJTVFJBQ1RfQVZfUExBWUxJU1QsCisgICAgICAgICAgICBNdHAuT2JqZWN0LkZPUk1BVF9XUExfUExBWUxJU1QsCisgICAgICAgICAgICBNdHAuT2JqZWN0LkZPUk1BVF9NM1VfUExBWUxJU1QsCisgICAgICAgICAgICBNdHAuT2JqZWN0LkZPUk1BVF9QTFNfUExBWUxJU1QsCisgICAgICAgIH07CisgICAgfQorCisgICAgcHJpdmF0ZSBpbnRbXSBnZXRTdXBwb3J0ZWRDYXB0dXJlRm9ybWF0cygpIHsKKyAgICAgICAgLy8gbm8gY2FwdHVyZSBmb3JtYXRzIHlldAorICAgICAgICByZXR1cm4gbnVsbDsKKyAgICB9CisKKyAgICBwcml2YXRlIGludFtdIGdldFN1cHBvcnRlZE9iamVjdFByb3BlcnRpZXMoaW50IGhhbmRsZSkgeworICAgICAgICByZXR1cm4gbmV3IGludFtdIHsKKyAgICAgICAgICAgIE10cC5PYmplY3QuUFJPUEVSVFlfU1RPUkFHRV9JRCwKKyAgICAgICAgICAgIE10cC5PYmplY3QuUFJPUEVSVFlfT0JKRUNUX0ZPUk1BVCwKKyAgICAgICAgICAgIE10cC5PYmplY3QuUFJPUEVSVFlfT0JKRUNUX1NJWkUsCisgICAgICAgICAgICBNdHAuT2JqZWN0LlBST1BFUlRZX09CSkVDVF9GSUxFX05BTUUsCisgICAgICAgICAgICBNdHAuT2JqZWN0LlBST1BFUlRZX1BBUkVOVF9PQkpFQ1QsCisgICAgICAgIH07CisgICAgfQorCisgICAgcHJpdmF0ZSBpbnRbXSBnZXRTdXBwb3J0ZWREZXZpY2VQcm9wZXJ0aWVzKCkgeworICAgICAgICAvLyBubyBkZXZpY2UgcHJvcGVydGllcyB5ZXQKKyAgICAgICAgcmV0dXJuIG51bGw7CisgICAgfQorCisgICAgcHJpdmF0ZSBpbnQgZ2V0T2JqZWN0UHJvcGVydHkoaW50IGhhbmRsZSwgaW50IHByb3BlcnR5LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxvbmdbXSBvdXRJbnRWYWx1ZSwgY2hhcltdIG91dFN0cmluZ1ZhbHVlKSB7CisgICAgICAgIExvZy5kKFRBRywgImdldE9iamVjdFByb3BlcnR5OiAiICsgcHJvcGVydHkpOworICAgICAgICBTdHJpbmcgY29sdW1uID0gbnVsbDsKKyAgICAgICAgYm9vbGVhbiBpc1N0cmluZyA9IGZhbHNlOworCisgICAgICAgIHN3aXRjaCAocHJvcGVydHkpIHsKKyAgICAgICAgICAgIGNhc2UgTVRQX1BST1BFUlRZX1NUT1JBR0VfSUQ6CisgICAgICAgICAgICAgICAgb3V0SW50VmFsdWVbMF0gPSBtU3RvcmFnZUlEOworICAgICAgICAgICAgICAgIHJldHVybiBNVFBfUkVTUE9OU0VfT0s7CisgICAgICAgICAgICBjYXNlIE1UUF9QUk9QRVJUWV9PQkpFQ1RfRk9STUFUOgorICAgICAgICAgICAgICAgIGNvbHVtbiA9IE10cE9iamVjdHMuT2JqZWN0Q29sdW1ucy5GT1JNQVQ7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIE1UUF9QUk9QRVJUWV9PQkpFQ1RfU0laRToKKyAgICAgICAgICAgICAgICBjb2x1bW4gPSBNdHBPYmplY3RzLk9iamVjdENvbHVtbnMuU0laRTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgTVRQX1BST1BFUlRZX09CSkVDVF9GSUxFX05BTUU6CisgICAgICAgICAgICAgICAgY29sdW1uID0gTXRwT2JqZWN0cy5PYmplY3RDb2x1bW5zLkRBVEE7CisgICAgICAgICAgICAgICAgaXNTdHJpbmcgPSB0cnVlOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBNVFBfUFJPUEVSVFlfREFURV9NT0RJRklFRDoKKyAgICAgICAgICAgICAgICBjb2x1bW4gPSBNdHBPYmplY3RzLk9iamVjdENvbHVtbnMuREFURV9NT0RJRklFRDsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgTVRQX1BST1BFUlRZX1BBUkVOVF9PQkpFQ1Q6CisgICAgICAgICAgICAgICAgY29sdW1uID0gTXRwT2JqZWN0cy5PYmplY3RDb2x1bW5zLlBBUkVOVDsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgcmV0dXJuIE1UUF9SRVNQT05TRV9PQkpFQ1RfUFJPUF9OT1RfU1VQUE9SVEVEOworICAgICAgICB9CisKKyAgICAgICAgQ3Vyc29yIGMgPSBudWxsOworICAgICAgICB0cnkgeworICAgICAgICAgICAgLy8gZm9yIG5vdyB3ZSBhcmUgb25seSByZWFkaW5nIHByb3BlcnRpZXMgZnJvbSB0aGUgIm9iamVjdHMiIHRhYmxlCisgICAgICAgICAgICBjID0gbU1lZGlhUHJvdmlkZXIucXVlcnkobU9iamVjdHNVcmksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV3IFN0cmluZyBbXSB7IE10cE9iamVjdHMuT2JqZWN0Q29sdW1ucy5fSUQsIGNvbHVtbiB9LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIElEX1dIRVJFLCBuZXcgU3RyaW5nW10geyBJbnRlZ2VyLnRvU3RyaW5nKGhhbmRsZSkgfSwgbnVsbCk7CisgICAgICAgICAgICBpZiAoYyAhPSBudWxsICYmIGMubW92ZVRvTmV4dCgpKSB7CisgICAgICAgICAgICAgICAgaWYgKGlzU3RyaW5nKSB7CisgICAgICAgICAgICAgICAgICAgIFN0cmluZyB2YWx1ZSA9IGMuZ2V0U3RyaW5nKDEpOworICAgICAgICAgICAgICAgICAgICBpbnQgc3RhcnQgPSAwOworCisgICAgICAgICAgICAgICAgICAgIGlmIChwcm9wZXJ0eSA9PSBNVFBfUFJPUEVSVFlfT0JKRUNUX0ZJTEVfTkFNRSkgeworICAgICAgICAgICAgICAgICAgICAgICAgLy8gZXh0cmFjdCBuYW1lIGZyb20gZnVsbCBwYXRoCisgICAgICAgICAgICAgICAgICAgICAgICBpbnQgbGFzdFNsYXNoID0gdmFsdWUubGFzdEluZGV4T2YoJy8nKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChsYXN0U2xhc2ggPj0gMCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXJ0ID0gbGFzdFNsYXNoICsgMTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBpbnQgZW5kID0gdmFsdWUubGVuZ3RoKCk7CisgICAgICAgICAgICAgICAgICAgIGlmIChlbmQgLSBzdGFydCA+IDI1NSkgeworICAgICAgICAgICAgICAgICAgICAgICAgZW5kID0gc3RhcnQgKyAyNTU7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgdmFsdWUuZ2V0Q2hhcnMoc3RhcnQsIGVuZCwgb3V0U3RyaW5nVmFsdWUsIDApOworICAgICAgICAgICAgICAgICAgICBvdXRTdHJpbmdWYWx1ZVtlbmQgLSBzdGFydF0gPSAwOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIG91dEludFZhbHVlWzBdID0gYy5nZXRMb25nKDEpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICByZXR1cm4gTVRQX1JFU1BPTlNFX09LOworICAgICAgICAgICAgfQorICAgICAgICB9IGNhdGNoIChFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgcmV0dXJuIE1UUF9SRVNQT05TRV9HRU5FUkFMX0VSUk9SOworICAgICAgICB9IGZpbmFsbHkgeworICAgICAgICAgICAgaWYgKGMgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIGMuY2xvc2UoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICAvLyBxdWVyeSBmYWlsZWQgaWYgd2UgZ2V0IGhlcmUKKyAgICAgICAgcmV0dXJuIE1UUF9SRVNQT05TRV9JTlZBTElEX09CSkVDVF9IQU5ETEU7CisgICAgfQorCisgICAgcHJpdmF0ZSBib29sZWFuIGdldE9iamVjdEluZm8oaW50IGhhbmRsZSwgaW50W10gb3V0U3RvcmFnZUZvcm1hdFBhcmVudCwKKyAgICAgICAgICAgICAgICAgICAgICAgIGNoYXJbXSBvdXROYW1lLCBsb25nW10gb3V0U2l6ZU1vZGlmaWVkKSB7CisgICAgICAgIExvZy5kKFRBRywgImdldE9iamVjdEluZm86ICIgKyBoYW5kbGUpOworICAgICAgICBDdXJzb3IgYyA9IG51bGw7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBjID0gbU1lZGlhUHJvdmlkZXIucXVlcnkobU9iamVjdHNVcmksIE9CSkVDVF9JTkZPX1BST0pFQ1RJT04sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgSURfV0hFUkUsIG5ldyBTdHJpbmdbXSB7ICBJbnRlZ2VyLnRvU3RyaW5nKGhhbmRsZSkgfSwgbnVsbCk7CisgICAgICAgICAgICBpZiAoYyAhPSBudWxsICYmIGMubW92ZVRvTmV4dCgpKSB7CisgICAgICAgICAgICAgICAgb3V0U3RvcmFnZUZvcm1hdFBhcmVudFswXSA9IG1TdG9yYWdlSUQ7CisgICAgICAgICAgICAgICAgb3V0U3RvcmFnZUZvcm1hdFBhcmVudFsxXSA9IGMuZ2V0SW50KDIpOworICAgICAgICAgICAgICAgIG91dFN0b3JhZ2VGb3JtYXRQYXJlbnRbMl0gPSBjLmdldEludCgzKTsKKworICAgICAgICAgICAgICAgIC8vIGV4dHJhY3QgbmFtZSBmcm9tIHBhdGgKKyAgICAgICAgICAgICAgICBTdHJpbmcgcGF0aCA9IGMuZ2V0U3RyaW5nKDEpOworICAgICAgICAgICAgICAgIGludCBsYXN0U2xhc2ggPSBwYXRoLmxhc3RJbmRleE9mKCcvJyk7CisgICAgICAgICAgICAgICAgaW50IHN0YXJ0ID0gKGxhc3RTbGFzaCA+PSAwID8gbGFzdFNsYXNoICsgMSA6IDApOworICAgICAgICAgICAgICAgIGludCBlbmQgPSBwYXRoLmxlbmd0aCgpOworICAgICAgICAgICAgICAgIGlmIChlbmQgLSBzdGFydCA+IDI1NSkgeworICAgICAgICAgICAgICAgICAgICBlbmQgPSBzdGFydCArIDI1NTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgcGF0aC5nZXRDaGFycyhzdGFydCwgZW5kLCBvdXROYW1lLCAwKTsKKyAgICAgICAgICAgICAgICBvdXROYW1lW2VuZCAtIHN0YXJ0XSA9IDA7CisKKyAgICAgICAgICAgICAgICBvdXRTaXplTW9kaWZpZWRbMF0gPSBjLmdldExvbmcoNCk7CisgICAgICAgICAgICAgICAgb3V0U2l6ZU1vZGlmaWVkWzFdID0gYy5nZXRMb25nKDUpOworICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICAgICAgfQorICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgTG9nLmUoVEFHLCAiUmVtb3RlRXhjZXB0aW9uIGluIGdldE9iamVjdFByb3BlcnR5IiwgZSk7CisgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICBpZiAoYyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgYy5jbG9zZSgpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisKKyAgICBwcml2YXRlIGludCBnZXRPYmplY3RGaWxlUGF0aChpbnQgaGFuZGxlLCBjaGFyW10gb3V0RmlsZVBhdGgsIGxvbmdbXSBvdXRGaWxlTGVuZ3RoKSB7CisgICAgICAgIExvZy5kKFRBRywgImdldE9iamVjdEZpbGVQYXRoOiAiICsgaGFuZGxlKTsKKyAgICAgICAgQ3Vyc29yIGMgPSBudWxsOworICAgICAgICB0cnkgeworICAgICAgICAgICAgYyA9IG1NZWRpYVByb3ZpZGVyLnF1ZXJ5KG1PYmplY3RzVXJpLCBQQVRIX1NJWkVfUFJPSkVDVElPTiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBJRF9XSEVSRSwgbmV3IFN0cmluZ1tdIHsgIEludGVnZXIudG9TdHJpbmcoaGFuZGxlKSB9LCBudWxsKTsKKyAgICAgICAgICAgIGlmIChjICE9IG51bGwgJiYgYy5tb3ZlVG9OZXh0KCkpIHsKKyAgICAgICAgICAgICAgICBTdHJpbmcgcGF0aCA9IGMuZ2V0U3RyaW5nKDEpOworICAgICAgICAgICAgICAgIHBhdGguZ2V0Q2hhcnMoMCwgcGF0aC5sZW5ndGgoKSwgb3V0RmlsZVBhdGgsIDApOworICAgICAgICAgICAgICAgIG91dEZpbGVQYXRoW3BhdGgubGVuZ3RoKCldID0gMDsKKyAgICAgICAgICAgICAgICBvdXRGaWxlTGVuZ3RoWzBdID0gYy5nZXRMb25nKDIpOworICAgICAgICAgICAgICAgIHJldHVybiBNVFBfUkVTUE9OU0VfT0s7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIHJldHVybiBNVFBfUkVTUE9OU0VfSU5WQUxJRF9PQkpFQ1RfSEFORExFOworICAgICAgICAgICAgfQorICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgTG9nLmUoVEFHLCAiUmVtb3RlRXhjZXB0aW9uIGluIGdldE9iamVjdEZpbGVQYXRoIiwgZSk7CisgICAgICAgICAgICByZXR1cm4gTVRQX1JFU1BPTlNFX0dFTkVSQUxfRVJST1I7CisgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICBpZiAoYyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgYy5jbG9zZSgpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgcHJpdmF0ZSBpbnQgZGVsZXRlRmlsZShpbnQgaGFuZGxlKSB7CisgICAgICAgIExvZy5kKFRBRywgImRlbGV0ZUZpbGU6ICIgKyBoYW5kbGUpOworICAgICAgICBVcmkgdXJpID0gTXRwT2JqZWN0cy5nZXRDb250ZW50VXJpKG1Wb2x1bWVOYW1lLCBoYW5kbGUpOworICAgICAgICB0cnkgeworICAgICAgICAgICAgaWYgKG1NZWRpYVByb3ZpZGVyLmRlbGV0ZSh1cmksIG51bGwsIG51bGwpID09IDEpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gTVRQX1JFU1BPTlNFX09LOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gTVRQX1JFU1BPTlNFX0lOVkFMSURfT0JKRUNUX0hBTkRMRTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgIExvZy5lKFRBRywgIlJlbW90ZUV4Y2VwdGlvbiBpbiBkZWxldGVGaWxlIiwgZSk7CisgICAgICAgICAgICByZXR1cm4gTVRQX1JFU1BPTlNFX0dFTkVSQUxfRVJST1I7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcml2YXRlIGludFtdIGdldE9iamVjdFJlZmVyZW5jZXMoaW50IGhhbmRsZSkgeworICAgICAgICBMb2cuZChUQUcsICJnZXRPYmplY3RSZWZlcmVuY2VzIGZvcjogIiArIGhhbmRsZSk7CisgICAgICAgIFVyaSB1cmkgPSBNdHBPYmplY3RzLmdldFJlZmVyZW5jZXNVcmkobVZvbHVtZU5hbWUsIGhhbmRsZSk7CisgICAgICAgIEN1cnNvciBjID0gbnVsbDsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIGMgPSBtTWVkaWFQcm92aWRlci5xdWVyeSh1cmksIElEX1BST0pFQ1RJT04sIG51bGwsIG51bGwsIG51bGwpOworICAgICAgICAgICAgaWYgKGMgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaW50IGNvdW50ID0gYy5nZXRDb3VudCgpOworICAgICAgICAgICAgaWYgKGNvdW50ID4gMCkgeworICAgICAgICAgICAgICAgIGludFtdIHJlc3VsdCA9IG5ldyBpbnRbY291bnRdOworICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgY291bnQ7IGkrKykgeworICAgICAgICAgICAgICAgICAgICBjLm1vdmVUb05leHQoKTsKKyAgICAgICAgICAgICAgICAgICAgcmVzdWx0W2ldID0gYy5nZXRJbnQoMCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHJldHVybiByZXN1bHQ7CisgICAgICAgICAgICB9CisgICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICBMb2cuZShUQUcsICJSZW1vdGVFeGNlcHRpb24gaW4gZ2V0T2JqZWN0TGlzdCIsIGUpOworICAgICAgICB9IGZpbmFsbHkgeworICAgICAgICAgICAgaWYgKGMgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIGMuY2xvc2UoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICByZXR1cm4gbnVsbDsK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2RldmljZVJlbW92ZWQsIGRldmljZS0+Z2V0SUQoKSk7CisKKyAgICBjaGVja0FuZENsZWFyRXhjZXB0aW9uRnJvbUNhbGxiYWNrKGVudiwgX19GVU5DVElPTl9fKTsKK30KKworI2VuZGlmIC8vIEhBVkVfQU5EUk9JRF9PUworCisvLyAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tCisKK3N0YXRpYyB2b2lkCithbmRyb2lkX21lZGlhX010cENsaWVudF9zZXR1cChKTklFbnYgKmVudiwgam9iamVjdCB0aGl6KQoreworI2lmZGVmIEhBVkVfQU5EUk9JRF9PUworICAgIExPR0QoInNldHVwXG4iKTsKKyAgICBNeUNsaWVudCogY2xpZW50ID0gbmV3IE15Q2xpZW50KGVudiwgdGhpeik7CisgICAgY2xpZW50LT5zdGFydCgpOworICAgIGVudi0+U2V0SW50RmllbGQodGhpeiwgZmllbGRfY29udGV4dCwgKGludCljbGllbnQpOworI2VuZGlmCit9CisKK3N0YXRpYyB2b2lkCithbmRyb2lkX21lZGlhX010cENsaWVudF9maW5hbGl6ZShKTklFbnYgKmVudiwgam9iamVjdCB0aGl6KQoreworI2lmZGVmIEhBVkVfQU5EUk9JRF9PUworICAgIExPR0QoImZpbmFsaXplXG4iKTsKKyAgICBNeUNsaWVudCAqY2xpZW50ID0gKE15Q2xpZW50ICopZW52LT5HZXRJbnRGaWVsZCh0aGl6LCBmaWVsZF9jb250ZXh0KTsKKyAgICBjbGllbnQtPmNsZWFudXAoZW52KTsKKyAgICBkZWxldGUgY2xpZW50OworICAgIGVudi0+U2V0SW50RmllbGQodGhpeiwgZmllbGRfY29udGV4dCwgMCk7CisjZW5kaWYKK30KKworc3RhdGljIGpib29sZWFuCithbmRyb2lkX21lZGlhX010cENsaWVudF9zdGFydChKTklFbnYgKmVudiwgam9iamVjdCB0aGl6KQoreworI2lmZGVmIEhB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VudChKTklFbnYgKmVudiwgam9iamVjdCB0aGl6LAorICAgICAgICBqaW50IGRldmljZV9pZCwgamludCBvYmplY3RfaWQpCit7CisjaWZkZWYgSEFWRV9BTkRST0lEX09TCisgICAgTXlDbGllbnQgKmNsaWVudCA9IChNeUNsaWVudCAqKWVudi0+R2V0SW50RmllbGQodGhpeiwgZmllbGRfY29udGV4dCk7CisgICAgTXRwRGV2aWNlKiBkZXZpY2UgPSBjbGllbnQtPmdldERldmljZShkZXZpY2VfaWQpOworICAgIGlmIChkZXZpY2UpCisgICAgICAgIHJldHVybiBkZXZpY2UtPmdldFBhcmVudChvYmplY3RfaWQpOworICAgIGVsc2UKKyNlbmRpZgorICAgICAgICByZXR1cm4gLTE7Cit9CisKK3N0YXRpYyBqaW50CithbmRyb2lkX21lZGlhX010cENsaWVudF9nZXRfc3RvcmFnZV9pZChKTklFbnYgKmVudiwgam9iamVjdCB0aGl6LAorICAgICAgICBqaW50IGRldmljZV9pZCwgamludCBvYmplY3RfaWQpCit7CisgI2lmZGVmIEhBVkVfQU5EUk9JRF9PUworICAgIE15Q2xpZW50ICpjbGllbnQgPSAoTXlDbGllbnQgKillbnYtPkdldEludEZpZWxkKHRoaXosIGZpZWxkX2NvbnRleHQpOworICAgIE10cERldmljZSogZGV2aWNlID0gY2xpZW50LT5nZXREZXZpY2UoZGV2aWNlX2lkKTsKKyAgICBpZiAoZGV2aWNlKQorICAgICAgICByZXR1cm4gZGV2aWNlLT5nZXRTdG9yYWdlSUQob2JqZWN0X2lkKTsKKyAgICBlbHNlCisjZW5kaWYKKyAgICAgICAgcmV0dXJuIC0xOworfQorCitzdGF0aWMgam9iamVjdAorYW5kcm9pZF9tZWRpYV9NdHBDbGllbnRfb3Blbl9maWxlKEpOSUVudiAqZW52LCBqb2JqZWN0IHRoaXosCisgICAgICAgIGppbnQgZGV2aWNlX2lkLCBqaW50IG9iamVjdF9pZCkKK3sKKyNpZmRlZiBIQVZFX0FORFJPSURfT1MKKyAgICBNeUNsaWVudCAqY2xpZW50ID0gKE15Q2xpZW50ICopZW52LT5HZXRJbnRGaWVsZCh0aGl6LCBmaWVsZF9jb250ZXh0KTsKKyAgICBNdHBEZXZpY2UqIGRldmljZSA9IGNsaWVudC0+Z2V0RGV2aWNlKGRldmljZV9pZCk7CisgICAgaWYgKCFkZXZpY2UpCisgICAgICAgIHJldHVybiBOVUxMOworCisgICAgTXRwT2JqZWN0SW5mbyogaW5mbyA9IGRldmljZS0+Z2V0T2JqZWN0SW5mbyhvYmplY3RfaWQpOworICAgIGlmICghaW5mbykKKyAgICAgICAgcmV0dXJuIE5VTEw7CisgICAgaW50IG9iamVjdF9zaXplID0gaW5mby0+bUNvbXByZXNzZWRTaXplOworICAgIGRlbGV0ZSBpbmZvOworICAgIGludCBmZCA9IGRldmljZS0+cmVhZE9iamVjdChvYmplY3RfaWQsIG9iamVjdF9zaXplKTsKKyAgICBpZiAoZmQgPCAwKQorICAgICAgICByZXR1cm4gTlVMTDsKKworICAgIGpvYmplY3QgZmlsZURlc2NyaXB0b3IgPSBlbnYtPk5ld09iamVjdChnRmlsZURlc2NyaXB0b3JPZmZzZXRzLm1DbGFzcywKKyAgICAgICAgZ0ZpbGVEZXNjcmlwdG9yT2Zmc2V0cy5tQ29uc3RydWN0b3IpOworICAgIGlmIChmaWxlRGVzY3JpcHRvciAhPSBOVUxMKSB7CisgICAgICAgIGVudi0+U2V0SW50RmllbGQoZmlsZURlc2NyaXB0b3IsIGdGaWxlRGVzY3JpcHRvck9mZnNldHMubURlc2NyaXB0b3IsIGZkKTsKKyAgICB9IGVsc2UgeworICAgICAgICByZXR1cm4gTlVMTDsKKyAgICB9CisgICAgcmV0dXJuIGVudi0+TmV3T2JqZWN0KGdQYXJjZWxGaWxlRGVzY3JpcHRvck9mZnNldHMubUNsYXNzLAorICAgICAgICBnUGFyY2VsRmlsZURlc2NyaXB0b3JPZmZzZXRzLm1Db25zdHJ1Y3RvciwgZmlsZURlc2NyaXB0b3IpOworI2VuZGlmCis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ICAgICAodm9pZCAqKWFuZHJvaWRfbWVkaWFfTXRwQ2xpZW50X29wZW5fZmlsZX0sCit9OworCitzdGF0aWMgY29uc3QgY2hhciogY29uc3Qga0NsYXNzUGF0aE5hbWUgPSAiYW5kcm9pZC9tZWRpYS9NdHBDbGllbnQiOworCitpbnQgcmVnaXN0ZXJfYW5kcm9pZF9tZWRpYV9NdHBDbGllbnQoSk5JRW52ICplbnYpCit7CisgICAgamNsYXNzIGNsYXp6OworCisgICAgTE9HRCgicmVnaXN0ZXJfYW5kcm9pZF9tZWRpYV9NdHBDbGllbnRcbiIpOworCisgICAgY2xhenogPSBlbnYtPkZpbmRDbGFzcygiYW5kcm9pZC9tZWRpYS9NdHBDbGllbnQiKTsKKyAgICBpZiAoY2xhenogPT0gTlVMTCkgeworICAgICAgICBMT0dFKCJDYW4ndCBmaW5kIGFuZHJvaWQvbWVkaWEvTXRwQ2xpZW50Iik7CisgICAgICAgIHJldHVybiAtMTsKKyAgICB9CisgICAgbWV0aG9kX2RldmljZUFkZGVkID0gZW52LT5HZXRNZXRob2RJRChjbGF6eiwgImRldmljZUFkZGVkIiwgIihJKVYiKTsKKyAgICBpZiAobWV0aG9kX2RldmljZUFkZGVkID09IE5VTEwpIHsKKyAgICAgICAgTE9HRSgiQ2FuJ3QgZmluZCBkZXZpY2VBZGRlZCIpOworICAgICAgICByZXR1cm4gLTE7CisgICAgfQorICAgIG1ldGhvZF9kZXZpY2VSZW1vdmVkID0gZW52LT5HZXRNZXRob2RJRChjbGF6eiwgImRldmljZVJlbW92ZWQiLCAiKEkpViIpOworICAgIGlmIChtZXRob2RfZGV2aWNlUmVtb3ZlZCA9PSBOVUxMKSB7CisgICAgICAgIExPR0UoIkNhbid0IGZpbmQgZGV2aWNlUmVtb3ZlZCIpOworICAgICAgICByZXR1cm4gLTE7CisgICAgfQorICAgIGZpZWxkX2NvbnRleHQgPSBlbnYtPkdldEZpZWxkSUQoY2xhenosICJtTmF0aXZlQ29udGV4dCIsICJJIik7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SBOVUxMOworICAgIGludCBjb2x1bW5Db3VudCA9IDA7CisgICAgaWYgKGphdmFDb2x1bW5zKSB7CisgICAgICAgIGNvbHVtbnMgPSBlbnYtPkdldEludEFycmF5RWxlbWVudHMoamF2YUNvbHVtbnMsIDApOworICAgICAgICBjb2x1bW5Db3VudCA9IGVudi0+R2V0QXJyYXlMZW5ndGgoamF2YUNvbHVtbnMpOworICAgIH0KKworICAgIE10cENsaWVudCogY2xpZW50ID0gZ2V0X2NsaWVudF9mcm9tX29iamVjdChlbnYsIGphdmFDbGllbnQpOworICAgIE10cEN1cnNvciogY3Vyc29yID0gbmV3IE10cEN1cnNvcihjbGllbnQsIHF1ZXJ5VHlwZSwKKyAgICAgICAgICAgIGRldmljZUlELCBzdG9yYWdlSUQsIG9iamVjdElELCBjb2x1bW5Db3VudCwgY29sdW1ucyk7CisKKyAgICBpZiAoY29sdW1ucykKKyAgICAgICAgZW52LT5SZWxlYXNlSW50QXJyYXlFbGVtZW50cyhqYXZhQ29sdW1ucywgY29sdW1ucywgMCk7CisgICAgZW52LT5TZXRJbnRGaWVsZCh0aGl6LCBmaWVsZF9jb250ZXh0LCAoaW50KWN1cnNvcik7CisjZW5kaWYKK30KKworc3RhdGljIHZvaWQKK2FuZHJvaWRfbWVkaWFfTXRwQ3Vyc29yX2ZpbmFsaXplKEpOSUVudiAqZW52LCBqb2JqZWN0IHRoaXopCit7CisjaWZkZWYgSEFWRV9BTkRST0lEX09TCisgICAgTE9HRCgiZmluYWxpemVcbiIpOworICAgIE10cEN1cnNvciAqY3Vyc29yID0gKE10cEN1cnNvciAqKWVudi0+R2V0SW50RmllbGQodGhpeiwgZmllbGRfY29udGV4dCk7CisgICAgZGVsZXRlIGN1cnNvcjsKKyNlbmRpZgorfQorCitzdGF0aWMgamludAorYW5kcm9pZF9tZWRpYV9NdHBDdXJzb3JfZmlsbF93aW5kb3coSk5JRW52ICplbnYsIGpvYmplY3QgdGhpeiwgam9iamVjdCBqYXZhV2luZG93LCBqaW50IHN0YXJ0UG9zKQoreworI2lmZGVmIEhBVkVfQU5EUk9JRF9PUworICAgIEN1cnNvcldpbmRvdyogd2luZG93ID0gZ2V0X3dpbmRvd19mcm9tX29iamVjdChlbnYsIGphdmFXaW5kb3cpOworICAgIGlmICghd2luZG93KSB7CisgICAgICAgIExPR0UoIkludmFsaWQgQ3Vyc29yV2luZG93Iik7CisgICAgICAgIGpuaVRocm93RXhjZXB0aW9uKGVudiwgImphdmEvbGFuZy9JbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24iLAorICAgICAgICAgICAgICAgICAgICAgICAgICAiQmFkIEN1cnNvcldpbmRvdyIpOworICAgICAgICByZXR1cm4gMDsKKyAgICB9CisgICAgTXRwQ3Vyc29yICpjdXJzb3IgPSAoTXRwQ3Vyc29yICopZW52LT5HZXRJbnRGaWVsZCh0aGl6LCBmaWVsZF9jb250ZXh0KTsKKworICAgIHJldHVybiBjdXJzb3ItPmZpbGxXaW5kb3cod2luZG93LCBzdGFydFBvcyk7CisjZWxzZQorICAgIHJldHVybiAwOworI2VuZGlmCit9CisKKy8vIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0KKworc3RhdGljIEpOSU5hdGl2ZU1ldGhvZCBnTWV0aG9kc1tdID0geworICAgIHsibmF0aXZlX3NldHVwIiwgICAgICAgICAgICAiKExhbmRyb2lkL21lZGlhL010cENsaWVudDtJSUlJW0kpViIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQgKilhbmRyb2lkX21lZGlhX010cEN1cnNvcl9zZXR1cH0sCisgICAgeyJuYXRpdmVfZmluYWxpemUiLCAgICAgICAgICIoKVYiLCAgKHZvaWQgKilhbmRyb2lkX21lZGlhX010cEN1cnNvcl9maW5hbGl6ZX0sCisgICAgeyJuYXRpdmVfZmlsbF93aW5kb3ciLCAgICAgICIoTGFuZHJvaWQvZGF0YWJhc2UvQ3Vyc29yV2luZG93O0kpSSIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQgKilhbmRyb2lkX21lZGlhX010cEN1cnNvcl9maWxsX3dpbmRvd30sCisKK307CisKK3N0YXRpYyBjb25zdCBjaGFyKiBjb25zdCBrQ2xhc3NQYXRoTmFtZSA9ICJhbmRyb2lkL21lZGlhL010cEN1cnNvciI7CisKK2ludCByZWdpc3Rlcl9hbmRyb2lkX21lZGlhX010cEN1cnNvcihKTklFbnYgKmVudikKK3sKKyAgICBqY2xhc3MgY2xheno7CisKKyAgICBMT0dEKCJyZWdpc3Rlcl9hbmRyb2lkX21lZGlhX010cEN1cnNvclxuIik7CisKKyAgICBjbGF6eiA9IGVudi0+RmluZENsYXNzKCJhbmRyb2lkL21lZGlhL010cEN1cnNvciIpOworICAgIGlmIChjbGF6eiA9PSBOVUxMKSB7CisgICAgICAgIExPR0UoIkNhbid0IGZpbmQgYW5kcm9pZC9tZWRpYS9NdHBDdXJzb3IiKTsKKyAgICAgICAgcmV0dXJuIC0xOworICAgIH0KKyAgICBmaWVsZF9jb250ZXh0ID0gZW52LT5HZXRGaWVsZElEKGNsYXp6LCAibU5hdGl2ZUNvbnRleHQiLCAiSSIpOworICAgIGlmIChmaWVsZF9jb250ZXh0ID09IE5VTEwpIHsKKyAgICAgICAgTE9HRSgiQ2FuJ3QgZmluZCBNdHBDdXJzb3IubU5hdGl2ZUNvbnRleHQiKTsKKyAgICAgICAgcmV0dXJuIC0xOworICAgIH0KKworICAgIHJldHVybiBBbmRyb2lkUnVudGltZTo6cmVnaXN0ZXJOYXRpdmVNZXRob2RzKGVudiwKKyAgICAgICAgICAgICAgICAiYW5kcm9pZC9tZWRpYS9NdHBDdXJzb3IiLCBnTWV0aG9kcywgTkVMRU0oZ01ldGhvZHMpKTsKK30KZGlmZiAtLWdpdCBhL21lZGlhL2puaS9hbmRyb2lkX21lZGlhX010cER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WN0IGNsaWVudCk7CisgICAgdmlydHVhbCAgICAgICAgICAgICAgICAgICAgICAgICB+TXlNdHBEYXRhYmFzZSgpOworICAgIHZvaWQgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xlYW51cChKTklFbnYgKmVudik7CisKKyAgICB2aXJ0dWFsIE10cE9iamVjdEhhbmRsZSAgICAgICAgIGJlZ2luU2VuZE9iamVjdChjb25zdCBjaGFyKiBwYXRoLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNdHBPYmplY3RGb3JtYXQgZm9ybWF0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNdHBPYmplY3RIYW5kbGUgcGFyZW50LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNdHBTdG9yYWdlSUQgc3RvcmFnZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWludDY0X3Qgc2l6ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGltZV90IG1vZGlmaWVkKTsKKworICAgIHZpcnR1YWwgdm9pZCAgICAgICAgICAgICAgICAgICAgZW5kU2VuZE9iamVjdChjb25zdCBjaGFyKiBwYXRoLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNdHBPYmplY3RIYW5kbGUgaGFuZGxlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNdHBPYmplY3RGb3JtYXQgZm9ybWF0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIHN1Y2NlZWRlZCk7CisKKyAgICB2aXJ0dWFsIE10cE9iamVjdEhhbmRsZUxpc3QqICAgIGdldE9iamVjdExpc3QoTXRwU3RvcmFnZUlEIHN0b3JhZ2VJRCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE10cE9iamVjdEZvcm1hdCBmb3JtYXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNdHBPYmplY3RIYW5kbGUgcGFyZW50KTsKKworICAgIHZpcnR1YWwgaW50ICAgICAgICAgICAgICAgICAgICAgZ2V0TnVtT2JqZWN0cyhNdHBTdG9yYWdlSUQgc3RvcmFnZUlELAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNdHBPYmplY3RGb3JtYXQgZm9ybWF0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNdHBPYmplY3RIYW5kbGUgcGFyZW50KTsKKworICAgIC8vIGNhbGxlZSBzaG91bGQgZGVsZXRlW10gdGhlIHJlc3VsdHMgZnJvbSB0aGVzZQorICAgIC8vIHJlc3VsdHMgY2FuIGJlIE5VTEwKKyAgICB2aXJ0dWFsIE10cE9iamVjdEZvcm1hdExpc3QqICAgIGdldFN1cHBvcnRlZFBsYXliYWNrRm9ybWF0cygpOworICAgIHZpcnR1YWwgTXRwT2JqZWN0Rm9ybWF0TGlzdCogICAgZ2V0U3VwcG9ydGVkQ2FwdHVyZUZvcm1hdHMoKTsKKyAgICB2aXJ0dWFsIE10cE9iamVjdFByb3BlcnR5TGlzdCogIGdldFN1cHBvcnRlZE9iamVjdFByb3BlcnRpZXMoTXRwT2JqZWN0Rm9ybWF0IGZvcm1hdCk7CisgICAgdmlydHVhbCBNdHBEZXZpY2VQcm9wZXJ0eUxpc3QqICBnZXRTdXBwb3J0ZWREZXZpY2VQcm9wZXJ0aWVzKCk7CisKKyAgICB2aXJ0dWFsIE10cFJlc3BvbnNlQ29kZSAgICAgICAgIGdldE9iamVjdFByb3BlcnR5KE10cE9iamVjdEhhbmRsZSBoYW5kbGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE10cE9iamVjdFByb3BlcnR5IHByb3BlcnR5LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNdHBEYXRhUGFja2V0JiBwYWNrZXQpOworCisgICAgdmlydHVhbCBNdHBSZXNwb25zZUNvZGUgICAgICAgICBnZXRPYmplY3RJbmZvKE10cE9iamVjdEhhbmRsZSBoYW5kbGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE10cERhdGFQYWNrZXQmIHBhY2tldCk7CisKKyAgICB2aXJ0dWFsIE10cFJlc3BvbnNlQ29kZSAgICAgICAgIGdldE9iamVjdEZpbGVQYXRoKE10cE9iamVjdEhhbmRsZSBoYW5kbGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE10cFN0cmluZyYgZmlsZVBhdGgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludDY0X3QmIGZpbGVMZW5ndGgpOworICAgIHZpcnR1YWwgTXRwUmVzcG9uc2VDb2RlICAgICAgICAgZGVsZXRlRmlsZShNdHBPYmplY3RIYW5kbGUgaGFuZGxlKTsKKworICAgIGJvb2wgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0UHJvcGVydHlJbmZvKE10cE9iamVjdFByb3BlcnR5IHByb3BlcnR5LCBpbnQmIHR5cGUpOworCisgICAgdmlydHVhbCBNdHBPYmplY3RIYW5kbGVMaXN0KiAgICBnZXRPYmplY3RSZWZlcmVuY2VzKE10cE9iamVjdEhhbmRsZSBoYW5kbGUpOworCisgICAgdmlydHVhbCBNdHBSZXNwb25zZUNvZGUgICAgICAgICBzZXRPYmplY3RSZWZlcmVuY2VzKE10cE9iamVjdEhhbmRsZSBoYW5kbGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE10cE9iamVjdEhhbmRsZUxpc3QqIHJlZmVyZW5jZXMpOworfTsKKworTXlNdHBEYXRhYmFzZTo6TXlNdHBEYXRhYmFzZShKTklFbnYgKmVudiwgam9iamVjdCBjbGllbnQpCisgICAgOiAgIG1EYXRhYmFzZShlbnYtPk5ld0dsb2JhbFJlZihjbGllbnQpKSwKKyAgICAgICAgbUludEJ1ZmZlcihOVUxMKSwKKyAgICAgICAgbUxvbmdCdWZmZXIoTlVMTCksCisgICAgICAgIG1TdHJpbmdCdWZmZXIoTlVMTCkKK3sKKyAgICBqaW50QXJyYXkgaW50QXJyYXk7CisgICAgamxvbmdBcnJheSBsb25nQXJyYXk7CisgICAgamNoYXJBcnJheSBjaGFyQXJyYXk7CisKKyAgICAvLyBjcmVhdGUgYnVmZmVycyBmb3Igb3V0IGFyZ3VtZW50cworICAgIC8vIHdlIGRvbid0IG5lZWQgdG8gYmUgdGhyZWFkLXNhZmUgc28gdGhpcyBpcyBPSworICAgIGludEFycmF5ID0gZW52LT5OZXdJbnRBcnJheSgzKTsKKyAgICBpZiAoIWludEFycmF5KQorICAgICAgICBnb3RvIG91dF9vZl9tZW1vcnk7CisgICAgbUludEJ1ZmZlciA9IChqaW50QXJyYXkpZW52LT5OZXdHbG9iYWxSZWYoaW50QXJyYXkpOworICAgIGxvbmdBcnJheSA9IGVudi0+TmV3TG9uZ0FycmF5KDIpOworICAgIGlmICghbG9uZ0FycmF5KQorICAgICAgICBnb3RvIG91dF9vZl9tZW1vcnk7CisgICAgbUxvbmdCdWZmZXIgPSAoamxvbmdBcnJheSllbnYtPk5ld0dsb2JhbFJlZihsb25nQXJyYXkpOworICAgIGNoYXJBcnJheSA9IGVudi0+TmV3Q2hhckFycmF5KDI1Nik7CisgICAgaWYgKCFjaGFyQXJyYXkpCisgICAgICAgIGdvdG8gb3V0X29mX21lbW9yeTsKKyAgICBtU3RyaW5nQnVmZmVyID0gKGpjaGFyQXJyYXkpZW52LT5OZXdHbG9iYWxSZWYoY2hhckFycmF5KTsKKyAgICByZXR1cm47CisKK291dF9vZl9tZW1vcnk6CisgICAgZW52LT5UaHJvd05ldyhlbnYtPkZpbmRDbGFzcygiamF2YS9sYW5nL091dE9mTWVtb3J5RXJyb3IiKSwgTlVMTCk7Cit9CisKK3ZvaWQgTXlNdHBEYXRhYmFzZTo6Y2xlYW51cChKTklFbnYgKmVudikgeworICAgIGVudi0+RGVsZXRlR2xvYmFsUmVmKG1EYXRhYmFzZSk7CisgICAgZW52LT5EZWxldGVHbG9iYWxSZWYobUludEJ1ZmZlcik7CisgICAgZW52LT5EZWxldGVHbG9iYWxSZWYobUxvbmdCdWZmZXIpOworICAgIGVudi0+RGVsZXRlR2xvYmFsUmVmKG1TdHJpbmdCdWZmZXIpOworfQorCitNeU10cERhdGFiYXNlOjp+TXlNdHBEYXRhYmFzZSgpIHsKK30KKworTXRwT2JqZWN0SGFuZGxlIE15TXRwRGF0YWJhc2U6OmJlZ2luU2VuZE9iamVjdChjb25zdCBjaGFyKiBwYXRoLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNdHBPYmplY3RGb3JtYXQgZm9ybWF0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNdHBPYmplY3RIYW5kbGUgcGFyZW50LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNdHBTdG9yYWdlSUQgc3RvcmFnZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWludDY0X3Qgc2l6ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGltZV90IG1vZGlmaWVkKSB7CisgICAgSk5JRW52KiBlbnYgPSBBbmRyb2lkUnVudGltZTo6Z2V0Sk5JRW52KCk7CisgICAgcmV0dXJuIGVudi0+Q2FsbEludE1ldGhvZChtRGF0YWJhc2UsIG1ldGhvZF9iZWdpblNlbmRPYmplY3QsIGVudi0+TmV3U3RyaW5nVVRGKHBhdGgpLAorICAgICAgICAgICAgICAgIChqaW50KWZvcm1hdCwgKGppbnQpcGFyZW50LCAoamludClzdG9yYWdlLCAoamxvbmcpc2l6ZSwgKGpsb25nKW1vZGlmaWVkKTsKK30KKwordm9pZCBNeU10cERhdGFiYXNlOjplbmRTZW5kT2JqZWN0KGNvbnN0IGNoYXIqIHBhdGgsIE10cE9iamVjdEhhbmRsZSBoYW5kbGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE10cE9iamVjdEZvcm1hdCBmb3JtYXQsIGJvb2wgc3VjY2VlZGVkKSB7CisgICAgSk5JRW52KiBlbnYgPSBBbmRyb2lkUnVudGltZTo6Z2V0Sk5JRW52KCk7CisgICAgZW52LT5DYWxsVm9pZE1ldGhvZChtRGF0YWJhc2UsIG1ldGhvZF9lbmRTZW5kT2JqZWN0LCBlbnYtPk5ld1N0cmluZ1VURihwYXRoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgIChqaW50KWhhbmRsZSwgKGppbnQpZm9ybWF0LCAoamJvb2xlYW4pc3VjY2VlZGVkKTsKK30KKworTXRwT2JqZWN0SGFuZGxlTGlzdCogTXlNdHBEYXRhYmFzZTo6Z2V0T2JqZWN0TGlzdChNdHBTdG9yYWdlSUQgc3RvcmFnZUlELAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTXRwT2JqZWN0Rm9ybWF0IGZvcm1hdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE10cE9iamVjdEhhbmRsZSBwYXJlbnQpIHsKKyAgICBKTklFbnYqIGVudiA9IEFuZHJvaWRSdW50aW1lOjpnZXRKTklFbnYoKTsKKyAgICBqaW50QXJyYXkgYXJyYXkgPSAoamludEFycmF5KWVudi0+Q2FsbE9iamVjdE1ldGhvZChtRGF0YWJhc2UsIG1ldGhvZF9nZXRPYmplY3RMaXN0LAorICAgICAgICAgICAgICAgIChqaW50KXN0b3JhZ2VJRCwgKGppbnQpZm9ybWF0LCAoamludClwYXJlbnQpOworICAgIGlmICghYXJyYXkpCisgICAgICAgIHJldHVybiBOVUxMOworICAgIE10cE9iamVjdEhhbmRsZUxpc3QqIGxpc3QgPSBuZXcgTXRwT2JqZWN0SGFuZGxlTGlzdCgpOworICAgIGppbnQqIGhhbmRsZXMgPSBlbnYtPkdldEludEFycmF5RWxlbWVudHMoYXJyYXksIDApOworICAgIGpzaXplIGxlbmd0aCA9IGVudi0+R2V0QXJyYXlMZW5ndGgoYXJyYXkpOworICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbGVuZ3RoOyBpKyspCisgICAgICAgIGxpc3QtPnB1c2goaGFuZGxlc1tpXSk7CisgICBlbnYtPlJlbGVhc2VJbnRBcnJheUVsZW1lbnRzKGFycmF5LCBoYW5kbGVzLCAwKTsKKyAgIHJldHVybiBsaXN0OworfQorCitpbnQgTXlNdHBEYXRhYmFzZTo6Z2V0TnVtT2JqZWN0cyhNdHBTdG9yYWdlSUQgc3RvcmFnZUlELAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNdHBPYmplY3RGb3JtYXQgZm9ybWF0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNdHBPYmplY3RIYW5kbGUgcGFyZW50KSB7CisgICAgSk5JRW52KiBlbnYgPSBBbmRyb2lkUnVudGltZTo6Z2V0Sk5JRW52KCk7CisgICAgcmV0dXJuIGVudi0+Q2FsbEludE1ldGhvZChtRGF0YWJhc2UsIG1ldGhvZF9nZXROdW1PYmplY3RzLAorICAgICAgICAgICAgICAgIChqaW50KXN0b3JhZ2VJRCwgKGppbnQpZm9ybWF0LCAoamludClwYXJlbnQpOworfQorCitNdHBPYmplY3RGb3JtYXRMaXN0KiBNeU10cERhdGFiYXNlOjpnZXRTdXBwb3J0ZWRQbGF5YmFja0Zvcm1hdHMoKSB7CisgICAgSk5JRW52KiBlbnYgPSBBbmRyb2lkUnVudGltZTo6Z2V0Sk5JRW52KCk7CisgICAgamludEFycmF5IGFycmF5ID0gKGppbnRBcnJheSllbnYtPkNhbGxPYmplY3RNZXRob2QobURhdGFiYXNlLAorICAgICAgICAgICAgbWV0aG9kX2dldFN1cHBvcnRlZFBsYXliYWNrRm9ybWF0cyk7CisgICAgaWYgKCFhcnJheSkKKyAgICAgICAgcmV0dXJuIE5VTEw7CisgICAgTXRwT2JqZWN0Rm9ybWF0TGlzdCogbGlzdCA9IG5ldyBNdHBPYmplY3RGb3JtYXRMaXN0KCk7CisgICAgamludCogZm9ybWF0cyA9IGVudi0+R2V0SW50QXJyYXlFbGVtZW50cyhhcnJheSwgMCk7CisgICAganNpemUgbGVuZ3RoID0gZW52LT5HZXRBcnJheUxlbmd0aChhcnJheSk7CisgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBsZW5ndGg7IGkrKykKKyAgICAgICAgbGlzdC0+cHVzaChmb3JtYXRzW2ldKTsKKyAgIGVudi0+UmVsZWFzZUludEFycmF5RWxlbWVudHMoYXJyYXksIGZvcm1hdHMsIDApOworICAgcmV0dXJuIGxpc3Q7Cit9CisKK010cE9iamVjdEZvcm1hdExpc3QqIE15TXRwRGF0YWJhc2U6OmdldFN1cHBvcnRlZENhcHR1cmVGb3JtYXRzKCkgeworICAgIEpOSUVudiogZW52ID0gQW5kcm9pZFJ1bnRpbWU6OmdldEpOSUVudigpOworICAgIGppbnRBcnJheSBhcnJheSA9IChqaW50QXJyYXkpZW52LT5DYWxsT2JqZWN0TWV0aG9kKG1EYXRhYmFzZSwKKyAgICAgICAgICAgIG1ldGhvZF9nZXRTdXBwb3J0ZWRDYXB0dXJlRm9ybWF0cyk7CisgICAgaWYgKCFhcnJheSkKKyAgICAgICAgcmV0dXJuIE5VTEw7CisgICAgTXRwT2JqZWN0Rm9ybWF0TGlzdCogbGlzdCA9IG5ldyBNdHBPYmplY3RGb3JtYXRMaXN0KCk7CisgICAgamludCogZm9ybWF0cyA9IGVudi0+R2V0SW50QXJyYXlFbGVtZW50cyhhcnJheSwgMCk7CisgICAganNpemUgbGVuZ3RoID0gZW52LT5HZXRBcnJheUxlbmd0aChhcnJheSk7CisgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBsZW5ndGg7IGkrKykKKyAgICAgICAgbGlzdC0+cHVzaChmb3JtYXRzW2ldKTsKKyAgIGVudi0+UmVsZWFzZUludEFycmF5RWxlbWVudHMoYXJyYXksIGZvcm1hdHMsIDApOworICAgcmV0dXJuIGxpc3Q7Cit9CisKK010cE9iamVjdFByb3BlcnR5TGlzdCogTXlNdHBEYXRhYmFzZTo6Z2V0U3VwcG9ydGVkT2JqZWN0UHJvcGVydGllcyhNdHBPYmplY3RGb3JtYXQgZm9ybWF0KSB7CisgICAgSk5JRW52KiBlbnYgPSBBbmRyb2lkUnVudGltZTo6Z2V0Sk5JRW52KCk7CisgICAgamludEFycmF5IGFycmF5ID0gKGppbnRBcnJheSllbnYtPkNhbGxPYmplY3RNZXRob2QobURhdGFiYXNlLAorICAgICAgICAgICAgbWV0aG9kX2dldFN1cHBvcnRlZE9iamVjdFByb3BlcnRpZXMsIChqaW50KWZvcm1hdCk7CisgICAgaWYgKCFhcnJheSkKKyAgICAgICAgcmV0dXJuIE5VTEw7CisgICAgTXRwT2JqZWN0UHJvcGVydHlMaXN0KiBsaXN0ID0gbmV3IE10cE9iamVjdFByb3BlcnR5TGlzdCgpOworICAgIGppbnQqIHByb3BlcnRpZXMgPSBlbnYtPkdldEludEFycmF5RWxlbWVudHMoYXJyYXksIDApOworICAgIGpzaXplIGxlbmd0aCA9IGVudi0+R2V0QXJyYXlMZW5ndGgoYXJyYXkpOworICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbGVuZ3RoOyBpKyspCisgICAgICAgIGxpc3QtPnB1c2gocHJvcGVydGllc1tpXSk7CisgICBlbnYtPlJlbGVhc2VJbnRBcnJheUVsZW1lbnRzKGFycmF5LCBwcm9wZXJ0aWVzLCAwKTsKKyAgIHJldHVybiBsaXN0OworfQorCitNdHBEZXZpY2VQcm9wZXJ0eUxpc3QqIE15TXRwRGF0YWJhc2U6OmdldFN1cHBvcnRlZERldmljZVByb3BlcnRpZXMoKSB7CisgICAgSk5JRW52KiBlbnYgPSBBbmRyb2lkUnVudGltZTo6Z2V0Sk5JRW52KCk7CisgICAgamludEFycmF5IGFycmF5ID0gKGppbnRBcnJheSllbnYtPkNhbGxPYmplY3RNZXRob2QobURhdGFiYXNlLAorICAgICAgICAgICAgbWV0aG9kX2dldFN1cHBvcnRlZERldmljZVByb3BlcnRpZXMpOworICAgIGlmICghYXJyYXkpCisgICAgICAgIHJldHVybiBOVUxMOworICAgIE10cERldmljZVByb3BlcnR5TGlzdCogbGlzdCA9IG5ldyBNdHBEZXZpY2VQcm9wZXJ0eUxpc3QoKTsKKyAgICBqaW50KiBwcm9wZXJ0aWVzID0gZW52LT5HZXRJbnRBcnJheUVsZW1lbnRzKGFycmF5LCAwKTsKKyAgICBqc2l6ZSBsZW5ndGggPSBlbnYtPkdldEFycmF5TGVuZ3RoKGFycmF5KTsKKyAgICBmb3IgKGludCBpID0gMDsgaSA8IGxlbmd0aDsgaSsrKQorICAgICAgICBsaXN0LT5wdXNoKHByb3BlcnRpZXNbaV0pOworICAgZW52LT5SZWxlYXNlSW50QXJyYXlFbGVtZW50cyhhcnJheSwgcHJvcGVydGllcywgMCk7CisgICByZXR1cm4gbGlzdDsKK30KKworTXRwUmVzcG9uc2VDb2RlIE15TXRwRGF0YWJhc2U6OmdldE9iamVjdFByb3BlcnR5KE10cE9iamVjdEhhbmRsZSBoYW5kbGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE10cE9iamVjdFByb3BlcnR5IHByb3BlcnR5LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNdHBEYXRhUGFja2V0JiBwYWNrZXQpIHsKKyAgICBpbnQgICAgICAgICB0eXBlOworCisgICAgaWYgKCFnZXRQcm9wZXJ0eUluZm8ocHJvcGVydHksIHR5cGUpKQorICAgICAgICByZXR1cm4gTVRQX1JFU1BPTlNFX0lOVkFMSURfT0JKRUNUX1BST1BfQ09ERTsKKworICAgIEpOSUVudiogZW52ID0gQW5kcm9pZFJ1bnRpbWU6OmdldEpOSUVudigpOworICA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ICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIE1UUF9UWVBFX1VJTlQzMjoKKyAgICAgICAgICAgIHBhY2tldC5wdXRVSW50MzIobG9uZ1ZhbHVlKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIE1UUF9UWVBFX0lOVDY0OgorICAgICAgICAgICAgcGFja2V0LnB1dEludDY0KGxvbmdWYWx1ZSk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBNVFBfVFlQRV9VSU5UNjQ6CisgICAgICAgICAgICBwYWNrZXQucHV0VUludDY0KGxvbmdWYWx1ZSk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBNVFBfVFlQRV9TVFI6CisgICAgICAgIHsKKyAgICAgICAgICAgIGpjaGFyKiBzdHIgPSBlbnYtPkdldENoYXJBcnJheUVsZW1lbnRzKG1TdHJpbmdCdWZmZXIsIDApOworICAgICAgICAgICAgcGFja2V0LnB1dFN0cmluZyhzdHIpOworICAgICAgICAgICAgZW52LT5SZWxlYXNlQ2hhckFycmF5RWxlbWVudHMobVN0cmluZ0J1ZmZlciwgc3RyLCAwKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgfQorICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgTE9HRSgidW5zdXBwb3J0ZWQgb2JqZWN0IHR5cGVcbiIpOworICAgICAgICAgICAgcmV0dXJuIE1UUF9SRVNQT05TRV9JTlZBTElEX09CSkVDVF9IQU5ETEU7CisgICAgfQorICAgIHJldHVybiBNVFBfUkVTUE9OU0VfT0s7Cit9CisKK010cFJlc3BvbnNlQ29kZSBNeU10cERhdGFiYXNlOjpnZXRPYmplY3RJbmZvKE10cE9iamVjdEhhbmRsZSBoYW5kbGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE10cERhdGFQYWNrZXQmIHBhY2tldCkgeworICAgIGNoYXIgICAgZGF0ZVsyMF07CisKKyAgICBKTklFbnY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0dFTkVSSUNfRk9MREVSIDoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBNVFBfQVNTT0NJQVRJT05fVFlQRV9VTkRFRklORUQpOworCisgICAgcGFja2V0LnB1dFVJbnQzMihzdG9yYWdlSUQpOworICAgIHBhY2tldC5wdXRVSW50MTYoZm9ybWF0KTsKKyAgICBwYWNrZXQucHV0VUludDE2KDApOyAgIC8vIHByb3RlY3Rpb24gc3RhdHVzCisgICAgcGFja2V0LnB1dFVJbnQzMigoc2l6ZSA+IDB4RkZGRkZGRkZMTCA/IDB4RkZGRkZGRkYgOiBzaXplKSk7CisgICAgcGFja2V0LnB1dFVJbnQxNigwKTsgICAvLyB0aHVtYiBmb3JtYXQKKyAgICBwYWNrZXQucHV0VUludDMyKDApOyAgIC8vIHRodW1iIGNvbXByZXNzZWQgc2l6ZQorICAgIHBhY2tldC5wdXRVSW50MzIoMCk7ICAgLy8gdGh1bWIgcGl4IHdpZHRoCisgICAgcGFja2V0LnB1dFVJbnQzMigwKTsgICAvLyB0aHVtYiBwaXggaGVpZ2h0CisgICAgcGFja2V0LnB1dFVJbnQzMigwKTsgICAvLyBpbWFnZSBwaXggd2lkdGgKKyAgICBwYWNrZXQucHV0VUludDMyKDApOyAgIC8vIGltYWdlIHBpeCBoZWlnaHQKKyAgICBwYWNrZXQucHV0VUludDMyKDApOyAgIC8vIGltYWdlIGJpdCBkZXB0aAorICAgIHBhY2tldC5wdXRVSW50MzIocGFyZW50KTsKKyAgICBwYWNrZXQucHV0VUludDE2KGFzc29jaWF0aW9uVHlwZSk7CisgICAgcGFja2V0LnB1dFVJbnQzMigwKTsgICAvLyBhc3NvY2lhdGlvbiBkZXNjCisgICAgcGFja2V0LnB1dFVJbnQzMigwKTsgICAvLyBzZXF1ZW5jZSBudW1iZXIKKworICAgIGpjaGFyKiBzdHIgPSBlbnYtPkdldENoYXJBcnJheUVsZW1lbnRzKG1TdHJpbmdCdWZmZXIsIDApOworICAgIHBhY2tldC5wdXRTdHJpb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VfTkFNRSwgIE1UUF9UWVBFX1NUUiAgICB9LAorICAgIHsgICBNVFBfUFJPUEVSVFlfT0JKRUNUX1NJWkUsICAgICAgIE1UUF9UWVBFX1VJTlQ2NCB9LAorICAgIHsgICBNVFBfUFJPUEVSVFlfREFURV9NT0RJRklFRCwgICAgIE1UUF9UWVBFX1NUUiAgICB9LAorfTsKKworYm9vbCBNeU10cERhdGFiYXNlOjpnZXRQcm9wZXJ0eUluZm8oTXRwT2JqZWN0UHJvcGVydHkgcHJvcGVydHksIGludCYgdHlwZSkgeworICAgIGludCBjb3VudCA9IHNpemVvZihrUHJvcGVydHlUYWJsZSkgLyBzaXplb2Yoa1Byb3BlcnR5VGFibGVbMF0pOworICAgIGNvbnN0IFByb3BlcnR5VGFibGVFbnRyeSogZW50cnkgPSBrUHJvcGVydHlUYWJsZTsKKyAgICBmb3IgKGludCBpID0gMDsgaSA8IGNvdW50OyBpKyssIGVudHJ5KyspIHsKKyAgICAgICAgaWYgKGVudHJ5LT5wcm9wZXJ0eSA9PSBwcm9wZXJ0eSkgeworICAgICAgICAgICAgdHlwZSA9IGVudHJ5LT50eXBlOworICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgIH0KKyAgICB9CisgICAgcmV0dXJuIGZhbHNlOworfQorCitNdHBPYmplY3RIYW5kbGVMaXN0KiBNeU10cERhdGFiYXNlOjpnZXRPYmplY3RSZWZlcmVuY2VzKE10cE9iamVjdEhhbmRsZSBoYW5kbGUpIHsKKyAgICBKTklFbnYqIGVudiA9IEFuZHJvaWRSdW50aW1lOjpnZXRKTklFbnYoKTsKKyAgICBqaW50QXJyYXkgYXJyYXkgPSAoamludEFycmF5KWVudi0+Q2FsbE9iamVjdE1ldGhvZChtRGF0YWJhc2UsIG1ldGhvZF9nZXRPYmplY3RSZWZlcmVuY2VzLAorICAgICAgICAgICAgICAgIChqaW50KWhhbmRsZSk7CisgICAgaWYgKCFhcnJheSkKKyAgICAgICAgcmV0dXJuIE5VTEw7Cisg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fUkRXUik7CisgICAgICAgIHByaW50Zigib3BlbiByZXR1cm5lZCAlZFxuIiwgZmQpOworICAgICAgICBpZiAoZmQgPCAwKSB7CisgICAgICAgICAgICBMT0dFKCJjb3VsZCBub3Qgb3BlbiBNVFAgZHJpdmVyXG4iKTsKKyAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgfQorCisgICAgICAgIHNNdXRleC5sb2NrKCk7CisgICAgICAgIG1TZXJ2ZXIgPSBuZXcgTXRwU2VydmVyKGZkLCBtRGF0YWJhc2UsIEFJRF9TRENBUkRfUlcsIDA2NjQsIDA3NzUpOworICAgICAgICBtU2VydmVyLT5hZGRTdG9yYWdlKG1TdG9yYWdlUGF0aCk7CisgICAgICAgIHNNdXRleC51bmxvY2soKTsKKworICAgICAgICBMT0dEKCJNdHBUaHJlYWQgbVNlcnZlci0+cnVuIik7CisgICAgICAgIG1TZXJ2ZXItPnJ1bigpOworICAgICAgICBjbG9zZShmZCk7CisKKyAgICAgICAgc011dGV4LmxvY2soKTsKKyAgICAgICAgZGVsZXRlIG1TZXJ2ZXI7CisgICAgICAgIG1TZXJ2ZXIgPSBOVUxMOworCisgICAgICAgIEpOSUVudiogZW52ID0gQW5kcm9pZFJ1bnRpbWU6OmdldEpOSUVudigpOworICAgICAgICBlbnYtPlNldEludEZpZWxkKG1KYXZhU2VydmVyLCBmaWVsZF9jb250ZXh0LCAwKTsKKyAgICAgICAgZW52LT5EZWxldGVHbG9iYWxSZWYobUphdmFTZXJ2ZXIpOworICAgICAgICBzTXV0ZXgudW5sb2NrKCk7CisKKyAgICAgICAgTE9HRCgidGhyZWFkTG9vcCByZXR1cm5pbmciKTsKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIHZvaWQgc2VuZE9iamVjdEFkZGVkKE10cE9iamVjdEhhbmRsZSBoYW5kbGUpIHsKKyAgICAgICAgc011dGV4LmxvY2soKTsKKyAgICAgICAgaWYgKG1TZXJ2ZXIpCisgICAgICAg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XRoUmVtYWluaW5nKSB7CisgICAgICAgICAgICAvLyBwYXRoIHRvbyBsb25nIQorICAgICAgICAgICAgY29udGludWU7CisgICAgICAgIH0KKyAgICAgICAgc3RyY3B5KGZpbGVTcG90LCBuYW1lKTsKKwogICAgICAgICBpbnQgdHlwZSA9IGVudHJ5LT5kX3R5cGU7CiAgICAgICAgIGlmICh0eXBlID09IERUX1VOS05PV04pIHsKICAgICAgICAgICAgIC8vIElmIHRoZSB0eXBlIGlzIHVua25vd24sIHN0YXQoKSB0aGUgZmlsZSBpbnN0ZWFkLgpAQCAtMTUwLDE2ICsxNTcsNyBAQAogICAgICAgICAgICAgfQogICAgICAgICB9CiAgICAgICAgIGlmICh0eXBlID09IERUX1JFRyB8fCB0eXBlID09IERUX0RJUikgewotICAgICAgICAgICAgaW50IG5hbWVMZW5ndGggPSBzdHJsZW4obmFtZSk7Ci0gICAgICAgICAgICBib29sIGlzRGlyZWN0b3J5ID0gKHR5cGUgPT0gRFRfRElSKTsKLQotICAgICAgICAgICAgaWYgKG5hbWVMZW5ndGggPiBwYXRoUmVtYWluaW5nIHx8IChpc0RpcmVjdG9yeSAmJiBuYW1lTGVuZ3RoICsgMSA+IHBhdGhSZW1haW5pbmcpKSB7Ci0gICAgICAgICAgICAgICAgLy8gcGF0aCB0b28gbG9uZyEKLSAgICAgICAgICAgICAgICBjb250aW51ZTsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgc3RyY3B5KGZpbGVTcG90LCBuYW1lKTsKLSAgICAgICAgICAgIGlmIChpc0RpcmVjdG9yeSkgeworICAgICAgICAgICAgaWYgKHR5cGUgPT0gRFRfRElSKSB7CiAgICAgICAgICAgICAgICAgLy8gaWdub3JlIGRpcmVjdG9yaWVzIHdpdGggYSBuYW1lIHRoYXQgc3RhcnRzIHdpdGggJy4nCiAgICAgICAgICAgICAgICAgLy8gZm9yIGV4YW1wbGUsIHRoZSBNYWMgIi5UcmFzaGVzIiBkaXJlY3RvcnkKICAgICAgICAgIC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QvQW5kcm9pZC5taworKysgYi9tZWRpYS9saWJzdGFnZWZyaWdodC9BbmRyb2lkLm1rCkBAIC0xMCw2ICsxMCw3IEBACiAgICAgICAgIEF1ZGlvU291cmNlLmNwcCAgICAgICAgICAgICAgICAgICBcCiAgICAgICAgIEF3ZXNvbWVQbGF5ZXIuY3BwICAgICAgICAgICAgICAgICBcCiAgICAgICAgIENhbWVyYVNvdXJjZS5jcHAgICAgICAgICAgICAgICAgICBcCisgICAgICAgIENhbWVyYVNvdXJjZVRpbWVMYXBzZS5jcHAgICAgICAgICAgICAgICAgICBcCiAgICAgICAgIERhdGFTb3VyY2UuY3BwICAgICAgICAgICAgICAgICAgICBcCiAgICAgICAgIEVTRFMuY3BwICAgICAgICAgICAgICAgICAgICAgICAgICBcCiAgICAgICAgIEZpbGVTb3VyY2UuY3BwICAgICAgICAgICAgICAgICAgICBcCkBAIC01Nyw2ICs1OCw3IEBACiAgICAgICAgIGxpYnNvbml2b3ggICAgICAgIFwKICAgICAgICAgbGlidm9yYmlzaWRlYyAgICAgXAogICAgICAgICBsaWJzdXJmYWNlZmxpbmdlcl9jbGllbnQgXAorICAgICAgICBsaWJzdGFnZWZyaWdodF95dXYgXAogICAgICAgICBsaWJjYW1lcmFfY2xpZW50CiAKIExPQ0FMX1NUQVRJQ19MSUJSQVJJRVMgOj0gXApkaWZmIC0tZ2l0IGEvbWVkaWEvbGlic3RhZ2VmcmlnaHQvQ2FtZXJhU291cmNlLmNwcCBiL21lZGlhL2xpYnN0YWdlZnJpZ2h0L0NhbWVyYVNvdXJjZS5jcHAKaW5kZXggM2UzMWQ2MS4uOWNjZDE0MCAxMDA2NDQKLS0tIGEvbWVkaWEvbGlic3RhZ2VmcmlnaHQvQ2FtZXJhU291cmNlLmNwcAorKysgYi9tZWRpYS9saWJzdGFnZWZyaWdodC9DYW1lcmFTb3VyY2UuY3BwCkBAIC02NSw2ICs2NSwxMSBAQAogdm9pZCBDYW1lcmFTb3VyY2VMaXN0ZW5lcjo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IHJlY3QucmlnaHQ7ICsreCkgeworICAgICAgICAgICAgbVlVVkltYWdlLnNldFBpeGVsVmFsdWUoeCwgeSwgeVZhbHVlLCB1VmFsdWUsIHZWYWx1ZSk7CisgICAgICAgIH0KKyAgICB9Cit9CisKK3ZvaWQgWVVWQ2FudmFzOjpDb3B5SW1hZ2VSZWN0KAorICAgICAgICBjb25zdCBSZWN0JiBzcmNSZWN0LAorICAgICAgICBpbnQzMl90IGRlc3RTdGFydFgsIGludDMyX3QgZGVzdFN0YXJ0WSwKKyAgICAgICAgY29uc3QgWVVWSW1hZ2UgJnNyY0ltYWdlKSB7CisKKyAgICAvLyBUcnkgZmFzdCBjb3B5IGZpcnN0CisgICAgaWYgKFlVVkltYWdlOjpmYXN0Q29weVJlY3RhbmdsZSgKKyAgICAgICAgICAgICAgICBzcmNSZWN0LAorICAgICAgICAgICAgICAgIGRlc3RTdGFydFgsIGRlc3RTdGFydFksCisgICAgICAgICAgICAgICAgc3JjSW1hZ2UsIG1ZVVZJbWFnZSkpIHsKKyAgICAgICAgcmV0dXJuOworICAgIH0KKworICAgIGludDMyX3Qgc3JjU3RhcnRYID0gc3JjUmVjdC5sZWZ0OworICAgIGludDMyX3Qgc3JjU3RhcnRZID0gc3JjUmVjdC50b3A7CisgICAgZm9yIChpbnQzMl90IG9mZnNldFkgPSAwOyBvZmZzZXRZIDwgc3JjUmVjdC5oZWlnaHQoKTsgKytvZmZzZXRZKSB7CisgICAgICAgIGZvciAoaW50MzJfdCBvZmZzZXRYID0gMDsgb2Zmc2V0WCA8IHNyY1JlY3Qud2lkdGgoKTsgKytvZmZzZXRYKSB7CisgICAgICAgICAgICBpbnQzMl90IHNyY1ggPSBzcmNTdGFydFggKyBvZmZzZXRYOworICAgICAgICAgICAgaW50MzJfdCBzcmNZID0gc3JjU3RhcnRZICsgb2Zmc2V0WTsKKworICAgICAgICAgICAgaW50MzJfdCBkZXN0WCA9IGRlc3RTdGFydFggKyBvZmZzZXRYOworICAgICAgICAgICA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2Zmc2V0SW5jcmVtZW50KTsKKworICAgIGludDMyX3QgeURlc3RPZmZzZXRJbmNyZW1lbnQ7CisgICAgaW50MzJfdCB1RGVzdE9mZnNldEluY3JlbWVudDsKKyAgICBpbnQzMl90IHZEZXN0T2Zmc2V0SW5jcmVtZW50OworICAgIGRlc3RJbWFnZS5nZXRPZmZzZXRJbmNyZW1lbnRzUGVyRGF0YVJvdygKKyAgICAgICAgICAgICZ5RGVzdE9mZnNldEluY3JlbWVudCwgJnVEZXN0T2Zmc2V0SW5jcmVtZW50LCAmdkRlc3RPZmZzZXRJbmNyZW1lbnQpOworCisgICAgLy8gQ29weSBZCisgICAgeworICAgICAgICBzaXplX3QgbnVtYmVyT2ZZQnl0ZXNQZXJSb3cgPSAoc2l6ZV90KSB3aWR0aDsKKyAgICAgICAgdWludDhfdCAqeVNyY0FkZHIgPSB5U3JjQWRkckJhc2U7CisgICAgICAgIHVpbnQ4X3QgKnlEZXN0QWRkciA9IHlEZXN0QWRkckJhc2U7CisgICAgICAgIGZvciAoaW50MzJfdCBvZmZzZXRZID0gMDsgb2Zmc2V0WSA8IGhlaWdodDsgKytvZmZzZXRZKSB7CisgICAgICAgICAgICBtZW1jcHkoeURlc3RBZGRyLCB5U3JjQWRkciwgbnVtYmVyT2ZZQnl0ZXNQZXJSb3cpOworCisgICAgICAgICAgICB5U3JjQWRkciArPSB5U3JjT2Zmc2V0SW5jcmVtZW50OworICAgICAgICAgICAgeURlc3RBZGRyICs9IHlEZXN0T2Zmc2V0SW5jcmVtZW50OworICAgICAgICB9CisgICAgfQorCisgICAgLy8gQ29weSBVCisgICAgeworICAgICAgICBzaXplX3QgbnVtYmVyT2ZVQnl0ZXNQZXJSb3cgPSAoc2l6ZV90KSAod2lkdGggPj4gMSk7CisgICAgICAgIHVpbnQ4X3QgKnVTcmNBZGRyID0gdVNyY0FkZHJCYXNlOworICAgICAgICB1aW50OF90ICp1RGVzdEFkZHIgPSB1RGVzdEFkZHJCYXNlOworICAgICAgICA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RBZGRyID0geURlc3RBZGRyQmFzZTsKKyAgICAgICAgZm9yIChpbnQzMl90IG9mZnNldFkgPSAwOyBvZmZzZXRZIDwgaGVpZ2h0OyArK29mZnNldFkpIHsKKyAgICAgICAgICAgIG1lbWNweSh5RGVzdEFkZHIsIHlTcmNBZGRyLCBudW1iZXJPZllCeXRlc1BlclJvdyk7CisKKyAgICAgICAgICAgIHlTcmNBZGRyID0geVNyY0FkZHIgKyB5U3JjT2Zmc2V0SW5jcmVtZW50OworICAgICAgICAgICAgeURlc3RBZGRyID0geURlc3RBZGRyICsgeURlc3RPZmZzZXRJbmNyZW1lbnQ7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvLyBDb3B5IFVWCisgICAgeworICAgICAgICAvLyBVViBhcmUgaW50ZXJsZWF2ZWQuIFNvIG51bWJlciBvZiBVViBieXRlcyBwZXIgcm93IGlzIDIqKHdpZHRoLzIpLgorICAgICAgICBzaXplX3QgbnVtYmVyT2ZVVkJ5dGVzUGVyUm93ID0gKHNpemVfdCkgd2lkdGg7CisgICAgICAgIHVpbnQ4X3QgKnZTcmNBZGRyID0gdlNyY0FkZHJCYXNlOworICAgICAgICB1aW50OF90ICp2RGVzdEFkZHIgPSB2RGVzdEFkZHJCYXNlOworICAgICAgICAvLyBFdmVyeSBvdGhlciBwaXhlbCByb3cgaGFzIGEgVS9WIGRhdGEgcm93LiBIZW5jZSBvbmx5IGdvIGhhbGYgdGhlIGhlaWdodC4KKyAgICAgICAgZm9yIChpbnQzMl90IG9mZnNldFkgPSAwOyBvZmZzZXRZIDwgKGhlaWdodCA+PiAxKTsgKytvZmZzZXRZKSB7CisgICAgICAgICAgICBtZW1jcHkodkRlc3RBZGRyLCB2U3JjQWRkciwgbnVtYmVyT2ZVVkJ5dGVzUGVyUm93KTsKKworICAgICAgICAgICAgdlNyY0FkZHIgKz0gdlNyY09mZnNldEluY3JlbWVudDsKKyAgICAgICAgICAgIHZEZXN0QWRkciArPSB2RGVzdE9mZnNldEluY3JlbWVudDsKKyAgICAgICAgfQorICAgIH0KK30KKworLy8gc3RhdGljCitib29sIFlVVkltYWdlOjpmYXN0Q29weVJlY3RhbmdsZSgKKyAgICAgICAgY29uc3QgUmVjdCYgc3JjUmVjdCwKKyAgICAgICAgaW50MzJfdCBkZXN0U3RhcnRYLCBpbnQzMl90IGRlc3RTdGFydFksCisgICAgICAgIGNvbnN0IFlVVkltYWdlICZzcmNJbWFnZSwgWVVWSW1hZ2UgJmRlc3RJbWFnZSkgeworICAgIGlmIChzcmNJbWFnZS5tWVVWRm9ybWF0ID09IGRlc3RJbWFnZS5tWVVWRm9ybWF0KSB7CisgICAgICAgIGlmIChzcmNJbWFnZS5tWVVWRm9ybWF0ID09IFlVVjQyMFBsYW5hcikgeworICAgICAgICAgICAgZmFzdENvcHlSZWN0YW5nbGU0MjBQbGFuYXIoCisgICAgICAgICAgICAgICAgICAgIHNyY1JlY3QsCisgICAgICAgICAgICAgICAgICAgIGRlc3RTdGFydFgsIGRlc3RTdGFydFksCisgICAgICAgICAgICAgICAgICAgIHNyY0ltYWdlLCBkZXN0SW1hZ2UpOworICAgICAgICB9IGVsc2UgaWYgKHNyY0ltYWdlLm1ZVVZGb3JtYXQgPT0gWVVWNDIwU2VtaVBsYW5hcikgeworICAgICAgICAgICAgZmFzdENvcHlSZWN0YW5nbGU0MjBTZW1pUGxhbmFyKAorICAgICAgICAgICAgICAgICAgICBzcmNSZWN0LAorICAgICAgICAgICAgICAgICAgICBkZXN0U3RhcnRYLCBkZXN0U3RhcnRZLAorICAgICAgICAgICAgICAgICAgICBzcmNJbWFnZSwgZGVzdEltYWdlKTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICB9CisgICAgcmV0dXJuIGZhbHNlOworfQorCit1aW50OF90IGNsYW1wKHVpbnQ4X3QgdiwgdWludDhfdCBtaW5WYWx1ZSwgdWludDhfdCBtYXhWYWx1ZSkgeworICAgIENIRUNLKG1heFZhbHVlID49IG1pblZhbHVl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NlIHdpdGggdGhlIExpY2Vuc2UuCisjIFlvdSBtYXkgb2J0YWluIGEgY29weSBvZiB0aGUgTGljZW5zZSBhdAorIworIyAgICAgIGh0dHA6Ly93d3cuYXBhY2hlLm9yZy9saWNlbnNlcy9MSUNFTlNFLTIuMAorIworIyBVbmxlc3MgcmVxdWlyZWQgYnkgYXBwbGljYWJsZSBsYXcgb3IgYWdyZWVkIHRvIGluIHdyaXRpbmcsIHNvZnR3YXJlCisjIGRpc3RyaWJ1dGVkIHVuZGVyIHRoZSBMaWNlbnNlIGlzIGRpc3RyaWJ1dGVkIG9uIGFuICJBUyBJUyIgQkFTSVMsCisjIFdJVEhPVVQgV0FSUkFOVElFUyBPUiBDT05ESVRJT05TIE9GIEFOWSBLSU5ELCBlaXRoZXIgZXhwcmVzcyBvciBpbXBsaWVkLgorIyBTZWUgdGhlIExpY2Vuc2UgZm9yIHRoZSBzcGVjaWZpYyBsYW5ndWFnZSBnb3Zlcm5pbmcgcGVybWlzc2lvbnMgYW5kCisjIGxpbWl0YXRpb25zIHVuZGVyIHRoZSBMaWNlbnNlLgorIworCitMT0NBTF9QQVRIOj0gJChjYWxsIG15LWRpcikKKworaWZuZXEgKCQoVEFSR0VUX1NJTVVMQVRPUiksdHJ1ZSkKKworaW5jbHVkZSAkKENMRUFSX1ZBUlMpCisKK0xPQ0FMX1NSQ19GSUxFUzo9ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgTXRwQ2xpZW50LmNwcCAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAgICAgICBNdHBDdXJzb3IuY3BwICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgICAgICAgIE10cERhdGFQYWNrZXQuY3BwICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgTXRwRGVidWcuY3BwICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAgICAgICBNdHBEZXZpY2UuY3BwICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgICAgICAgIE10cEV2ZW50UGFja2V0LmNwcCAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgTXRwRGV2aWNlSW5mby5jcHAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAgICAgICBNdHBPYmplY3RJbmZvLmNwcCAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgICAgICAgIE10cFBhY2tldC5jcHAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgTXRwUHJvcGVydHkuY3BwICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAgICAgICBNdHBSZXF1ZXN0UGFja2V0LmNwcCAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgICAgICAgIE10cFJlc3BvbnNlUGFja2V0LmNwcCAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgTXRwU2VydmVyLmNwcCAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAgICAgICBNdHBTdG9yYWdlSW5mby5jcHAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgICAgICAgIE10cFN0cmluZ0J1ZmZlci5jcHAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgTXRwU3RvcmFnZS5jcHAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAgICAgICBNdHBVdGlscy5jcHAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKworTE9DQUxfTU9EVUxFOj0gbGlibXRwCisKK0xPQ0FMX0NGTEFHUyA6PSAtRE1UUF9ERVZJQ0UgLURNVFBfSE9TVAorCitpbmNsdWRlICQoQlVJTERfU1RBVElDX0xJQlJBUlkpCisKK2VuZGlmCisKK2lmZXEgKCQoSE9TVF9PUyksbGludXgpCisKK2luY2x1ZGUgJChDTEVBUl9WQVJTKQorCitMT0NBTF9TUkNfRklMRVM6PSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgICAgICAgIE10cENsaWVudC5jcHAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgTXRwQ3Vyc29yLmNwcCAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAgICAgICBNdHBEYXRhUGFja2V0LmNwcCAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgICAgICAgIE10cERlYnVnLmNwcCAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgTXRwRGV2aWNlLmNwcCAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAgICAgICBNdHBFdmVudFBhY2tldC5jcHAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgICAgICAgIE10cERldmljZUluZm8uY3BwICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgTXRwT2JqZWN0SW5mby5jcHAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAgICAgICBNdHBQYWNrZXQuY3BwICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgICAgICAgIE10cFByb3BlcnR5LmNwcCAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgTXRwUmVxdWVzdFBhY2tldC5jcHAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAgICAgICBNdHBSZXNwb25zZVBhY2tldC5jcHAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgICAgICAgIE10cFN0b3JhZ2VJbmZvLmNwcCAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgTXRwU3RyaW5nQnVmZmVyLmNwcCAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAgICAgICBNdHBTdG9yYWdlLmNwcCAgICAgICAgICAgICAgICAgICAgICAg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ZW5kb3IgPT0gMHgwNGU4ICYmIHByb2R1Y3QgPT0gMHg1MDNjKQorICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICByZXR1cm4gZmFsc2U7Cit9CisKK2NsYXNzIE10cENsaWVudFRocmVhZCA6IHB1YmxpYyBUaHJlYWQgeworcHJpdmF0ZToKKyAgICBNdHBDbGllbnQqICAgbUNsaWVudDsKKworcHVibGljOgorICAgIE10cENsaWVudFRocmVhZChNdHBDbGllbnQqIGNsaWVudCkKKyAgICAgICAgOiBtQ2xpZW50KGNsaWVudCkKKyAgICB7CisgICAgfQorCisgICAgdmlydHVhbCBib29sIHRocmVhZExvb3AoKSB7CisgICAgICAgIHJldHVybiBtQ2xpZW50LT50aHJlYWRMb29wKCk7CisgICAgfQorfTsKKworCitNdHBDbGllbnQ6Ok10cENsaWVudCgpCisgICAgOiAgIG1UaHJlYWQoTlVMTCksCisgICAgICAgIG1Vc2JIb3N0Q29udGV4dChOVUxMKSwKKyAgICAgICAgbURvbmUoZmFsc2UpCit7Cit9CisKK010cENsaWVudDo6fk10cENsaWVudCgpIHsKKyAgICB1c2JfaG9zdF9jbGVhbnVwKG1Vc2JIb3N0Q29udGV4dCk7Cit9CisKK2Jvb2wgTXRwQ2xpZW50OjpzdGFydCgpIHsKKyAgICBNdXRleDo6QXV0b2xvY2sgYXV0b0xvY2sobU11dGV4KTsKKworICAgIGlmIChtVGhyZWFkKQorICAgICAgICByZXR1cm4gdHJ1ZTsKKworICAgIG1Vc2JIb3N0Q29udGV4dCA9IHVzYl9ob3N0X2luaXQoKTsKKyAgICBpZiAoIW1Vc2JIb3N0Q29udGV4dCkKKyAgICAgICAgcmV0dXJuIGZhbHNlOworCisgICAgbVRocmVhZCA9IG5ldyBNdHBDbGllbnRUaHJlYWQodGhpcyk7CisgICAgbVRocmVhZC0+cnVuKCJNdHBDbGllbnRUaHJlYWQiKTsKKyAgICAvLyB3YWl0IGZvciB0aGUgdGhyZWFkIHRvIGRvIGluaXRpYWwgZG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IHx8IHN0cmNtcChpbnRlcmZhY2VOYW1lLCAiTVRQIikpCisgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgICAgIC8vIExvb2tzIGxpa2UgYW4gYW5kcm9pZCBzdHlsZSBNVFAgZGV2aWNlCisgICAgICAgICAgICAgICAgTE9HRCgiRm91bmQgTVRQIGRldmljZTogXCIlc1wiIFwiJXNcIlxuIiwgdXNiX2RldmljZV9nZXRfbWFudWZhY3R1cmVyX25hbWUoZGV2aWNlKSwKKyAgICAgICAgICAgICAgICAgICAgICAgIHVzYl9kZXZpY2VfZ2V0X3Byb2R1Y3RfbmFtZShkZXZpY2UpKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgLy8gbG9vayBmb3Igc3BlY2lhbCBjYXNlZCBkZXZpY2VzIGJhc2VkIG9uIHZlbmRvci9wcm9kdWN0IElECisgICAgICAgICAgICAgICAgLy8gd2UgYXJlIGRvaW5nIHRoaXMgbWFpbmx5IGZvciB0ZXN0aW5nIHB1cnBvc2VzCisgICAgICAgICAgICAgICAgdWludDE2X3QgdmVuZG9yID0gdXNiX2RldmljZV9nZXRfdmVuZG9yX2lkKGRldmljZSk7CisgICAgICAgICAgICAgICAgdWludDE2X3QgcHJvZHVjdCA9IHVzYl9kZXZpY2VfZ2V0X3Byb2R1Y3RfaWQoZGV2aWNlKTsKKyAgICAgICAgICAgICAgICBpZiAoIWlzTXRwRGV2aWNlKHZlbmRvciwgcHJvZHVjdCkpIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gbm90IGFuIE1UUCBvciBQVFAgZGV2aWNlCisgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAvLyByZXF1ZXN0IE1UUCBPUyBzdHJpbmcgYW5kIGRlc2NyaXB0b3IKKyAgICAgICAgICAgICAgICAvLyBzb21lIG11c2ljIHBsYXllcnMgbmVlZCB0byBzZWUgdGhpcyBiZWZvcmUgZW50ZXJpbmcgTVRQIG1vZGUuCisgICAgICAgICAgICAgICAgY2hhciBidWZmZXJbMjU2XTsKKyAgICAgICAgICAgICAgICBtZW1zZXQoYnVmZmVyLCAwLCBzaXplb2YoYnVmZmVyKSk7CisgICAgICAgICAgICAgICAgaW50IHJldCA9IHVzYl9kZXZpY2Vfc2VuZF9jb250cm9sKGRldmljZSwKKyAgICAgICAgICAgICAgICAgICAgICAgIFVTQl9ESVJfSU58VVNCX1JFQ0lQX0RFVklDRXxVU0JfVFlQRV9TVEFOREFSRCwKKyAgICAgICAgICAgICAgICAgICAgICAgIFVTQl9SRVFfR0VUX0RFU0NSSVBUT1IsIChVU0JfRFRfU1RSSU5HIDw8IDgpIHwgMHhFRSwKKyAgICAgICAgICAgICAgICAgICAgICAgIDAsIHNpemVvZihidWZmZXIpLCBidWZmZXIpOworICAgICAgICAgICAgICAgIHByaW50ZigidXNiX2RldmljZV9zZW5kX2NvbnRyb2wgcmV0dXJuZWQgJWQgZXJybm86ICVkXG4iLCByZXQsIGVycm5vKTsKKyAgICAgICAgICAgICAgICBpZiAocmV0ID4gMCkgeworICAgICAgICAgICAgICAgICAgICBwcmludGYoImdvdCBNVFAgc3RyaW5nICVzXG4iLCBidWZmZXIpOworICAgICAgICAgICAgICAgICAgICByZXQgPSB1c2JfZGV2aWNlX3NlbmRfY29udHJvbChkZXZpY2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgVVNCX0RJUl9JTnxVU0JfUkVDSVBfREVWSUNFfFVTQl9UWVBFX1ZFTkRPUiwgMSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLCA0LCBzaXplb2YoYnVmZmVyKSwgYnVmZmVyKTsKKyAgICAgICAgICAgICAgICAgICAgcHJpbnRmKCJPUyBkZXNjcmlwdG9yIGdvdCAlZFxuIiwgcmV0KTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICBwcmludGYoIm5vIE1UUCBzdHJpbmdcbiIpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgLy8gaWYgd2UgZ290IGhlcmUsIHRoZW4gd2UgaGF2ZSBhIGxpa2VseSBNVFAgb3IgUFRQIGRldmljZQorCisgICAgICAgICAgICAvLyBpbnRlcmZhY2Ugc2hvdWxkIGJlIGZvbGxvd2VkIGJ5IHRocmVlIGVuZHBvaW50cworICAgICAgICAgICAgc3RydWN0IHVzYl9lbmRwb2ludF9kZXNjcmlwdG9yICplcDsKKyAgICAgICAgICAgIHN0cnVjdCB1c2JfZW5kcG9pbnRfZGVzY3JpcHRvciAqZXBfaW5fZGVzYyA9IE5VTEw7CisgICAgICAgICAgICBzdHJ1Y3QgdXNiX2VuZHBvaW50X2Rlc2NyaXB0b3IgKmVwX291dF9kZXNjID0gTlVMTDsKKyAgICAgICAgICAgIHN0cnVjdCB1c2JfZW5kcG9pbnRfZGVzY3JpcHRvciAqZXBfaW50cl9kZXNjID0gTlVMTDsKKyAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgMzsgaSsrKSB7CisgICAgICAgICAgICAgICAgZXAgPSAoc3RydWN0IHVzYl9lbmRwb2ludF9kZXNjcmlwdG9yICopdXNiX2Rlc2NyaXB0b3JfaXRlcl9uZXh0KCZpdGVyKTsKKyAgICAgICAgICAgICAgICBpZiAoIWVwIHx8IGVwLT5iRGVzY3JpcHRvclR5cGUgIT0gVVNCX0RUX0VORFBPSU5UKSB7CisgICAgICAgICAgICAgICAgICAgIExPR0UoImVuZHBvaW50cyBub3QgZm91bmRcbiIpOworICAgICAgICAgICAgICAgICAgICByZXR1cm4gbURvbmU7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGlmIChlcC0+Ym1BdHRyaWJ1dGVzID09IFVTQl9FTkRQT0lOVF9YRkVSX0JVTEspIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGVwLT5iRW5kcG9pbnRBZGRyZXNzICYgVVNCX0VORFBPSU5UX0RJUl9NQVNLKQorICAgICAgICAgICAgICAgICAgICAgICAgZXBfaW5fZGVzYyA9IGVwOworICAgICAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgICAgICAgICBlcF9vdXRfZGVzYyA9IGVwOworICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoZXAtPmJtQXR0cmlidXRlcyA9PSBVU0JfRU5EUE9JTlRfWEZFUl9JTlQgJiYKKyAgICAgICAgICAgICAgICAgICAgZXAtPmJFbmRwb2ludEFkZHJlc3MgJiBVU0JfRU5EUE9JTlRfRElSX01BU0spIHsKKyAgICAgICAgICAgICAgICAgICAgZXBfaW50cl9kZXNjID0gZXA7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKCFlcF9pbl9kZXNjIHx8ICFlcF9vdXRfZGVzYyB8fCAhZXBfaW50cl9kZXNjKSB7CisgICAgICAgICAgICAgICAgTE9HRSgiZW5kcG9pbnRzIG5vdCBmb3VuZFxuIik7CisgICAgICAgICAgICAgICAgcmV0dXJuIG1Eb25lOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBzdHJ1Y3QgdXNiX2VuZHBvaW50ICplcF9pbiA9IHVzYl9lbmRwb2ludF9vcGVuKGRldmljZSwgZXBfaW5fZGVzYyk7CisgICAgICAgICAgICBzdHJ1Y3QgdXNiX2VuZHBvaW50ICplcF9vdXQgPSB1c2JfZW5kcG9pbnRfb3BlbihkZXZpY2UsIGVwX291dF9kZXNjKTsKKyAgICAgICAgICAgIHN0cnVjdCB1c2JfZW5kcG9pbnQgKmVwX2ludHIgPSB1c2JfZW5kcG9pbnRfb3BlbihkZXZpY2UsIGVwX2ludHJfZGVzYyk7CisKKyAgICAgICAgICAgIGlmICh1c2JfZGV2aWNlX2NsYWltX2ludGVyZmFjZShkZXZpY2UsIGludGVyZmFjZS0+YkludGVyZmFjZU51bWJlcikpIHsKKyAgICAgICAgICAgICAgICBMT0dFKCJ1c2JfZGV2aWNlX2NsYWltX2ludGVyZmFjZSBmYWlsZWQgZXJybm86ICVkXG4iLCBlcnJubyk7CisgICAgICAgICAgICAgICAgdXNiX2VuZHBvaW50X2Nsb3NlKGVwX2luKTsKKyAgICAgICAgICAgICAgICB1c2JfZW5kcG9pbnRfY2xvc2UoZXBfb3V0KTsKKyAgICAgICAgICAgICAgICB1c2JfZW5kcG9pbnRfY2xvc2UoZXBfaW50cik7CisgICAgICAgICAgICAgICAgcmV0dXJuIG1Eb25lOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBNdHBEZXZpY2UqIG10cERldmljZSA9IG5ldyBNdHBEZXZpY2UoZGV2aWNlLCBpbnRlcmZhY2UtPmJJbnRlcmZhY2VOdW1iZXIsCisgICAgICAgICAgICAgICAgICAgICAgICBlcF9pbiwgZXBfb3V0LCBlcF9pbnRyKTsKKyAgICAgICAgICAgIG1EZXZpY2VMaXN0LmFkZChtdHBEZXZpY2UpOworICAgICAgICAgICAgbXRwRGV2aWNlLT5pbml0aWFsaXplKCk7CisgICAgICAgICAgICBkZXZpY2VBZGRlZChtdHBEZXZpY2UpOworICAgICAgICAgICAgcmV0dXJuIG1Eb25lOworICAgICAgICB9CisgICAgfQorCisgICAgdXNiX2RldmljZV9jbG9zZShkZXZpY2UpOworICAgIHJldHVybiBtRG9uZTsKK30KKworYm9vbCBNdHBDbGllbnQ6OnVzYkRldmljZVJlbW92ZWQoY29uc3QgY2hhciAqZGV2bmFtZSkgeworICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbURldmljZUxpc3Quc2l6ZSgpOyBpKyspIHsKKyAgICAgICAgTXRwRGV2aWNlKiBkZXZpY2UgPSBtRGV2aWNlTGlzdFtpXTsKKyAgICAgICAgaWYgKCFzdHJjbXAoZGV2bmFtZSwgZGV2aWNlLT5nZXREZXZpY2VOYW1lKCkpKSB7CisgICAgICAgICAgICBkZXZpY2VSZW1vdmVkKGRldmljZSk7CisgICAgICAgICAgICBtRGV2aWNlT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E9GIEFOWSBLSU5ELCBlaXRoZXIgZXhwcmVzcyBvciBpbXBsaWVkLgorICogU2VlIHRoZSBMaWNlbnNlIGZvciB0aGUgc3BlY2lmaWMgbGFuZ3VhZ2UgZ292ZXJuaW5nIHBlcm1pc3Npb25zIGFuZAorICogbGltaXRhdGlvbnMgdW5kZXIgdGhlIExpY2Vuc2UuCisgKi8KKworI2lmbmRlZiBfTVRQX0NMSUVOVF9ICisjZGVmaW5lIF9NVFBfQ0xJRU5UX0gKKworI2luY2x1ZGUgIk10cFR5cGVzLmgiCisKKyNpbmNsdWRlIDx1dGlscy90aHJlYWRzLmg+CisKK3N0cnVjdCB1c2JfaG9zdF9jb250ZXh0OworCituYW1lc3BhY2UgYW5kcm9pZCB7CisKK2NsYXNzIE10cENsaWVudFRocmVhZDsKKworY2xhc3MgTXRwQ2xpZW50IHsKK3ByaXZhdGU6CisgICAgTXRwRGV2aWNlTGlzdCAgICAgICAgICAgICAgIG1EZXZpY2VMaXN0OworICAgIE10cENsaWVudFRocmVhZCogICAgICAgICAgICBtVGhyZWFkOworICAgIENvbmRpdGlvbiAgICAgICAgICAgICAgICAgICBtVGhyZWFkU3RhcnRDb25kaXRpb247CisgICAgTXV0ZXggICAgICAgICAgICAgICAgICAgICAgIG1NdXRleDsKKyAgICBzdHJ1Y3QgdXNiX2hvc3RfY29udGV4dCogICAgbVVzYkhvc3RDb250ZXh0OworICAgIGJvb2wgICAgICAgICAgICAgICAgICAgICAgICBtRG9uZTsKKworcHVibGljOgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIE10cENsaWVudCgpOworICAgIHZpcnR1YWwgICAgICAgICAgICAgICAgIH5NdHBDbGllbnQoKTsKKworICAgIGJvb2wgICAgICAgICAgICAgICAgICAgIHN0YXJ0KCk7CisgICAgdm9pZCAgICAgICAgICAgICAgICAgICAgc3RvcCgpOworCisgICAgaW5saW5lIE10cERldmljZUxpc3QmICAgZ2V0RGV2aWNlTGlzdCgpIHsgcmV0dXJuIG1EZXZpY2VMaXN0OyB9CisgICAgTXRwRGV2aWNlKiAgICAgICAgICAgICAgZ2V0RGV2aWNlKGludCBpZCk7CisKKworICAgIHZpcnR1YWwgdm9pZCAgICAgICAgICAgIGRldmljZUFkZGVkKE10cERldmljZSAqZGV2aWNlKSA9IDA7CisgICAgdmlydHVhbCB2b2lkICAgICAgICAgICAgZGV2aWNlUmVtb3ZlZChNdHBEZXZpY2UgKmRldmljZSkgPSAwOworCitwcml2YXRlOgorICAgIC8vIHRoZXNlIHJldHVybiB0cnVlIGlmIHdlIHNob3VsZCBzdG9wIG1vbml0b3JpbmcgVVNCIGFuZCBjbGVhbiB1cAorICAgIGJvb2wgICAgICAgICAgICAgICAgICAgIHVzYkRldmljZUFkZGVkKGNvbnN0IGNoYXIgKmRldm5hbWUpOworICAgIGJvb2wgICAgICAgICAgICAgICAgICAgIHVzYkRldmljZVJlbW92ZWQoY29uc3QgY2hhciAqZGV2bmFtZSk7CisgICAgYm9vbCAgICAgICAgICAgICAgICAgICAgdXNiRGlzY292ZXJ5RG9uZSgpOworCisgICAgZnJpZW5kIGNsYXNzIE10cENsaWVudFRocmVhZDsKKyAgICBib29sICAgICAgICAgICAgICAgICAgICB0aHJlYWRMb29wKCk7CisgICAgc3RhdGljIGludCAgICAgICAgICAgICAgdXNiX2RldmljZV9hZGRlZChjb25zdCBjaGFyICpkZXZuYW1lLCB2b2lkKiBjbGllbnRfZGF0YSk7CisgICAgc3RhdGljIGludCAgICAgICAgICAgICAgdXNiX2RldmljZV9yZW1vdmVkKGNvbnN0IGNoYXIgKmRldm5hbWUsIHZvaWQqIGNsaWVudF9kYXRhKTsKKyAgICBzdGF0aWMgaW50ICAgICAgICAgICAgICB1c2JfZGlzY292ZXJ5X2RvbmUodm9pZCogY2xpZW50X2RhdGEpOworfTsKKworfTsgLy8gbmFtZXNwYWNlIGFuZHJvaWQKKworI2VuZGlmIC8vIF9NVFBfQ0xJRU5UX0gKZGlmZiAtLWdpdCBhL21lZGlhL210cC9Nd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3RJRCwgaW50IGNvbHVtbkNvdW50LCBpbnQqIGNvbHVtbnMpCisgICAgICAgIDogICBtQ2xpZW50KGNsaWVudCksCisgICAgICAgICAgICBtUXVlcnlUeXBlKHF1ZXJ5VHlwZSksCisgICAgICAgICAgICBtRGV2aWNlSUQoZGV2aWNlSUQpLAorICAgICAgICAgICAgbVN0b3JhZ2VJRChzdG9yYWdlSUQpLAorICAgICAgICAgICAgbVFiamVjdElEKG9iamVjdElEKSwKKyAgICAgICAgICAgIG1Db2x1bW5Db3VudChjb2x1bW5Db3VudCksCisgICAgICAgICAgICBtQ29sdW1ucyhOVUxMKQoreworICAgIGlmIChjb2x1bW5zKSB7CisgICAgICAgIG1Db2x1bW5zID0gbmV3IGludFtjb2x1bW5Db3VudF07CisgICAgICAgIG1lbWNweShtQ29sdW1ucywgY29sdW1ucywgY29sdW1uQ291bnQgKiBzaXplb2YoaW50KSk7CisgICAgfQorfQorCitNdHBDdXJzb3I6On5NdHBDdXJzb3IoKSB7CisgICAgZGVsZXRlW10gbUNvbHVtbnM7Cit9CisKK2ludCBNdHBDdXJzb3I6OmZpbGxXaW5kb3coQ3Vyc29yV2luZG93KiB3aW5kb3csIGludCBzdGFydFBvcykgeworICAgIExPR0QoIk10cEN1cnNvcjo6ZmlsbFdpbmRvdyBtUXVlcnlUeXBlOiAlZFxuIiwgbVF1ZXJ5VHlwZSk7CisKKyAgICBzd2l0Y2ggKG1RdWVyeVR5cGUpIHsKKyAgICAgICAgY2FzZSBERVZJQ0U6CisgICAgICAgICAgICByZXR1cm4gZmlsbERldmljZXMod2luZG93LCBzdGFydFBvcyk7CisgICAgICAgIGNhc2UgREVWSUNFX0lEOgorICAgICAgICAgICAgcmV0dXJuIGZpbGxEZXZpY2Uod2luZG93LCBzdGFydFBvcyk7CisgICAgICAgIGNhc2UgU1RPUkFHRToKKyAgICAgICAgICAgIHJldHVybiBmaWxsU3RvcmFnZXMod2luZG93LCBzdGFydFBvcyk7CisgICAgICAgIGNhc2UgU1RPUkFHRV9JRDoKKyAgICAgICAgICAgIHJldHVybiBmaWxsU3RvcmFnZSh3aW5kb3csIHN0YXJ0UG9zKTsKKyAgICAgICAgY2FzZSBPQkpFQ1Q6CisgICAgICAgICAgICByZXR1cm4gZmlsbE9iamVjdHMod2luZG93LCAwLCBzdGFydFBvcyk7CisgICAgICAgIGNhc2UgT0JKRUNUX0lEOgorICAgICAgICAgICAgcmV0dXJuIGZpbGxPYmplY3Qod2luZG93LCBzdGFydFBvcyk7CisgICAgICAgIGNhc2UgU1RPUkFHRV9DSElMRFJFTjoKKyAgICAgICAgICAgIHJldHVybiBmaWxsT2JqZWN0cyh3aW5kb3csIC0xLCBzdGFydFBvcyk7CisgICAgICAgIGNhc2UgT0JKRUNUX0NISUxEUkVOOgorICAgICAgICAgICAgcmV0dXJuIGZpbGxPYmplY3RzKHdpbmRvdywgbVFiamVjdElELCBzdGFydFBvcyk7CisgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICBMT0dFKCJNdHBDdXJzb3I6OmZpbGxXaW5kb3c6IHVua25vd24gcXVlcnkgdHlwZSAlZFxuIiwgbVF1ZXJ5VHlwZSk7CisgICAgICAgICAgICByZXR1cm4gMDsKKyAgICB9Cit9CisKK2ludCBNdHBDdXJzb3I6OmZpbGxEZXZpY2VzKEN1cnNvcldpbmRvdyogd2luZG93LCBpbnQgc3RhcnRQb3MpIHsKKyAgICBpbnQgY291bnQgPSAwOworICAgIE10cERldmljZUxpc3QmIGRldmljZUxpc3QgPSBtQ2xpZW50LT5nZXREZXZpY2VMaXN0KCk7CisgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBkZXZpY2VMaXN0LnNpemUoKTsgaSsrKSB7CisgICAgICAgIE10cERldmljZSogZGV2aWNlID0gZGV2aWNlTGlzdFtpXTsKKyAgICAgICAgaWYgKGZpbGxEZXZpY2Uod2luZG93LCBkZXZpY2UsIHN0YXJ0UG9zKSkgeworICAgICAgICAgICAgY291bnQrKzsKKyAgICAgICAgICAgIHN0YXJ0UG9zKys7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgIH0KKyAgICByZXR1cm4gY291bnQ7Cit9CisKK2ludCBNdHBDdXJzb3I6OmZpbGxEZXZpY2UoQ3Vyc29yV2luZG93KiB3aW5kb3csIGludCBzdGFydFBvcykgeworICAgIE10cERldmljZSogZGV2aWNlID0gbUNsaWVudC0+Z2V0RGV2aWNlKG1EZXZpY2VJRCk7CisgICAgaWYgKGRldmljZSAmJiBmaWxsRGV2aWNlKHdpbmRvdywgZGV2aWNlLCBzdGFydFBvcykpCisgICAgICAgIHJldHVybiAxOworICAgIGVsc2UKKyAgICAgICAgcmV0dXJuIDA7Cit9CisKK2ludCBNdHBDdXJzb3I6OmZpbGxTdG9yYWdlcyhDdXJzb3JXaW5kb3cqIHdpbmRvdywgaW50IHN0YXJ0UG9zKSB7CisgICAgaW50IGNvdW50ID0gMDsKKyAgICBNdHBEZXZpY2UqIGRldmljZSA9IG1DbGllbnQtPmdldERldmljZShtRGV2aWNlSUQpOworICAgIGlmICghZGV2aWNlKQorICAgICAgICByZXR1cm4gMDsKKyAgICBNdHBTdG9yYWdlSURMaXN0KiBzdG9yYWdlSURzID0gZGV2aWNlLT5nZXRTdG9yYWdlSURzKCk7CisgICAgaWYgKCFzdG9yYWdlSURzKQorICAgICAgICByZXR1cm4gMDsKKworICAgIGZvciAoaW50IGkgPSAwOyBpIDwgc3RvcmFnZUlEcy0+c2l6ZSgpOyBpKyspIHsKKyAgICAgICAgTXRwU3RvcmFnZUlEIHN0b3JhZ2VJRCA9ICgqc3RvcmFnZUlEcylbaV07CisgICAgICAgIGlmIChmaWxsU3RvcmFnZSh3aW5kb3csIGRldmljZSwgc3RvcmFnZUlELCBzdGFydFBvcykpIHsKKyAgICAgICAgICAgIGNvdW50Kys7CisgICAgICAgICAgICBzdGFydFBvcysrOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICB9CisgICAgZGVsZXRlIHN0b3JhZ2VJRHM7CisgICAgcmV0dXJuIGNvdW50OworfQorCitpbnQgTXRwQ3Vyc29yOjpmaWxsU3RvcmFnZShDdXJzb3JXaW5kb3cqIHdpbmRvdywgaW50IHN0YXJ0UG9zKSB7CisgICAgTXRwRGV2aWNlKiBkZXZpY2UgPSBtQ2xpZW50LT5nZXREZXZpY2UobURldmljZUlEKTsKKyAgICBpZiAoZGV2aWNlICYmIGZpbGxTdG9yYWdlKHdpbmRvdywgZGV2aWNlLCBtU3RvcmFnZUlELCBzdGFydFBvcykpCisgICAgICAgIHJldHVybiAxOworICAgIGVsc2UKKyAgICAgICAgcmV0dXJuIDA7Cit9CisKK2ludCBNdHBDdXJzb3I6OmZpbGxPYmplY3RzKEN1cnNvcldpbmRvdyogd2luZG93LCBpbnQgcGFyZW50LCBpbnQgc3RhcnRQb3MpIHsKKyAgICBpbnQgY291bnQgPSAwOworICAgIE10cERldmljZSogZGV2aWNlID0gbUNsaWVudC0+Z2V0RGV2aWNlKG1EZXZpY2VJRCk7CisgICAgaWYgKCFkZXZpY2UpCisgICAgICAgIHJldHVybiAwOworICAgIE10cE9iamVjdEhhbmRsZUxpc3QqIGhhbmRsZXMgPSBkZXZpY2UtPmdldE9iamVjdEhhbmRsZXMobVN0b3JhZ2VJRCwgMCwgcGFyZW50KTsKKyAgICBpZiAoIWhhbmRsZXMpCisgICAgICAgIHJldHVybiAwOworCisgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBoYW5kbGVzLT5zaXplKCk7IGkrKykgeworICAgICAgICBNdHBPYmplY3RIYW5kbGUgaGFuZGxlID0gKCpoYW5kbGVzKVtpXTsKKyAgICAgICAgaWYgKGZpbGxPYmplY3Qod2luZG93LCBkZXZpY2UsIGhhbmRsZSwgc3RhcnRQb3MpKSB7CisgICAgICAgICAgICBjb3VudCsrOworICAgICAgICAgICAgc3RhcnRQb3MrKzsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgfQorICAgIGRlbGV0ZSBoYW5kbGVzOworICAgIHJldHVybiBjb3VudDsKK30KKworaW50IE10cEN1cnNvcjo6ZmlsbE9iamVjdChDdXJzb3JXaW5kb3cqIHdpbmRvdywgaW50IHN0YXJ0UG9zKSB7CisgICAgTXRwRGV2aWNlKiBkZXZpY2UgPSBtQ2xpZW50LT5nZXREZXZpY2UobURldmljZUlEKTsKKyAgICBpZiAoZGV2aWNlICYmIGZpbGxPYmplY3Qod2luZG93LCBkZXZpY2UsIG1RYmplY3RJRCwgc3RhcnRQb3MpKQorICAgICAgICByZXR1cm4gMTsKKyAgICBlbHNlCisgICAgICAgIHJldHVybiAwOworfQorCitib29sIE10cEN1cnNvcjo6ZmlsbERldmljZShDdXJzb3JXaW5kb3cqIHdpbmRvdywgTXRwRGV2aWNlKiBkZXZpY2UsIGludCByb3cpIHsKKyAgICBNdHBEZXZpY2VJbmZvKiBkZXZpY2VJbmZvID0gZGV2aWNlLT5nZXREZXZpY2VJbmZvKCk7CisgICAgaWYgKCFkZXZpY2VJbmZvKQorICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgaWYgKCFwcmVwYXJlUm93KHdpbmRvdykpCisgICAgICAgIHJldHVybiBmYWxzZTsKKworICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbUNvbHVtbkNvdW50OyBpKyspIHsKKyAgICAgICAgc3dpdGNoIChtQ29sdW1uc1tpXSkgeworICAgICAgICAgICAgY2FzZSBERVZJQ0VfUk9XX0lEOgorICAgICAgICAgICAgICAgIGlmICghcHV0TG9uZyh3aW5kb3csIGRldmljZS0+Z2V0SUQoKSwgcm93LCBpKSkKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgREVWSUNFX01BTlVGQUNUVVJFUjoKKyAgICAgICAgICAgICAgICBpZiAoIXB1dFN0cmluZyh3aW5kb3csIGRldmljZUluZm8tPm1NYW51ZmFjdHVyZXIsIHJvdywgaSkpCisgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIERFVklDRV9NT0RFTDoKKyAgICAgICAgICAgICAgICBpZiAoIXB1dFN0cmluZyh3aW5kb3csIGRldmljZUluZm8tPm1Nb2RlbCwgcm93LCBpKSkKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgTE9HRSgiZmlsbERldmljZTogdW5rbm93biBjb2x1bW4gJWRcbiIsIG1Db2x1bW5zW2ldKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKyAgICB9CisKKyAgICByZXR1cm4gdHJ1ZTsKK30KKworYm9vbCBNdHBDdXJzb3I6OmZpbGxTdG9yYWdlKEN1cnNvcldpbmRvdyogd2luZG93LCBNdHBEZXZpY2UqIGRldmljZSwKKyAgICAgICAgTXRwU3RvcmFnZUlEIHN0b3JhZ2VJRCwgaW50IHJvdykgeworCitMT0dEKCJmaWxsU3RvcmFnZSAlZFxuIiwgc3RvcmFnZUlEKTsKKworICAgIE10cFN0b3JhZ2VJbmZvKiBzdG9yYWdlSW5mbyA9IGRldmljZS0+Z2V0U3RvcmFnZUluZm8oc3RvcmFnZUlEKTsKKyAgICBpZiAoIXN0b3JhZ2VJbmZvKQorICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgaWYgKCFwcmVwYXJlUm93KHdpbmRvdykpIHsKKyAgICAgICAgZGVsZXRlIHN0b3JhZ2VJbmZvOworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgY29uc3QgY2hhciogdGV4dDsKKyAgICBmb3IgKGludCBpID0gMDsgaSA8IG1Db2x1bW5Db3VudDsgaSsrKSB7CisgICAgICAgIHN3aXRjaCAobUNvbHVtbnNbaV0pIHsKKyAgICAgICAgICAgIGNhc2UgU1RPUkFHRV9ST1dfSUQ6CisgICAgICAgICAgICAgICAgaWYgKCFwdXRMb25nKHdpbmRvdywgc3RvcmFnZUlELCByb3csIGkpKQorICAgICAgICAgICAgICAgICAgICBnb3RvIGZhaWw7CisgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBTVE9SQUdFX0lERU5USUZJRVI6CisgICAgICAgICAgICAgICAgdGV4dCA9IHN0b3JhZ2VJbmZvLT5tVm9sdW1lSWRlbnRpZmllcjsKKyAgICAgICAgICAgICAgICBpZiAoIXRleHQgfHwgIXRleHRbMF0pCisgICAgICAgICAgICAgICAgICAgIHRleHQgPSAiQ2FtZXJhIFN0b3JhZ2UiOworICAgICAgICAgICAgICAgIGlmICghcHV0U3RyaW5nKHdpbmRvdywgdGV4dCwgcm93LCBpKSkKKyAgICAgICAgICAgICAgICAgICAgZ290byBmYWlsOworICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgU1RPUkFHRV9ERVNDUklQVElPTjoKKyAgICAgICAgICAgICAgICB0ZXh0ID0gc3RvcmFnZUluZm8tPm1TdG9yYWdlRGVzY3JpcHRpb247CisgICAgICAgICAgICAgICAgaWYgKCF0ZXh0IHx8ICF0ZXh0WzBdKQorICAgICAgICAgICAgICAgICAgICB0ZXh0ID0gIlN0b3JhZ2UgRGVzY3JpcHRpb24iOworICAgICAgICAgICAgICAgIGlmICghcHV0U3RyaW5nKHdpbmRvdywgdGV4dCwgcm93LCBpKSkKKyAgICAgICAgICAgICAgICAgICAgZ290byBmYWlsOworICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgTE9HRSgiZmlsbFN0b3JhZ2U6IHVua25vd24gY29sdW1uICVkXG4iLCBtQ29sdW1uc1tpXSk7CisgICAgICAgICAgICAgICAgZ290byBmYWlsOworICAgICAgICB9CisgICAgfQorCisgICAgZGVsZXRlIHN0b3JhZ2VJbmZvOworICAgIHJldHVybiB0cnVlOworCitmYWlsOgorICAgIGRlbGV0ZSBzdG9yYWdlSW5mbzsKKyAgICByZXR1cm4gZmFsc2U7Cit9CisKK2Jvb2wgTXRwQ3Vyc29yOjpmaWxsT2JqZWN0KEN1cnNvcldpbmRvdyogd2luZG93LCBNdHBEZXZpY2UqIGRldmljZSwKKyAgICAgICAgTXRwT2JqZWN0SGFuZGxlIG9iamVjdElELCBpbnQgcm93KSB7CisKKyAgICBNdHBPYmplY3RJbmZvKiBvYmplY3RJbmZvID0gZGV2aWNlLT5nZXRPYmplY3RJbmZvKG9iamVjdElEKTsKKyAgICBpZiAoIW9iamVjdEluZm8pCisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAvLyBvYmplY3RJbmZvLT5wcmludCgpOworICAgIGlmICghcHJlcGFyZVJvdyh3aW5kb3cpKSB7CisgICAgICAgIGRlbGV0ZSBvYmplY3RJbmZvOworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBtQ29sdW1uQ291bnQ7IGkrKykgeworICAgICAgICBzd2l0Y2ggKG1Db2x1bW5zW2ldKSB7CisgICAgICAgICAgICBjYXNlIE9CSkVDVF9ST1dfSUQ6CisgICAgICAgICAgICAgICAgaWYgKCFwdXRMb25nKHdpbmRvdywgb2JqZWN0SUQsIHJvdywgaSkpCisgICAgICAgICAgICAgICAgICAgIGdvdG8gZmFpbDsKKyAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIE9CSkVDVF9TVE9SQUdFX0lEOgorICAgICAgICAgICAgICAgIGlmICghcHV0TG9uZyh3aW5kb3csIG9iamVjdEluZm8tPm1TdG9yYWdlSUQsIHJvdywgaSkpCisgICAgICAgICAgICAgICAgICAgIGdvdG8gZmFpbDsKKyAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIE9CSkVDVF9GT1JNQVQ6CisgICAgICAgICAgICAgICAgaWYgKCFwdXRMb25nKHdpbmRvdywgb2JqZWN0SW5mby0+bUZvcm1hdCwgcm93LCBpKSkKKyAgICAgICAgICAgICAgICAgICAgZ290byBmYWlsOworICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgT0JKRUNUX1BST1RFQ1RJT05fU1RBVFVTOgorICAgICAgICAgICAgICAgIGlmICghcHV0TG9uZyh3aW5kb3csIG9iamVjdEluZm8tPm1Qcm90ZWN0aW9uU3RhdHVzLCByb3csIGkpKQorICAgICAgICAgICAgICAgICAgICBnb3RvIGZhaWw7CisgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBPQkpFQ1RfU0laRToKKyAgICAgICAgICAgICAgICBpZiAoIXB1dExvbmcod2luZG93LCBvYmplY3RJbmZvLT5tQ29tcHJlc3NlZFNpemUsIHJvdywgaSkpCisgICAgICAgICAgICAgICAgICAgIGdvdG8gZmFpbDsKKyAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIE9CSkVDVF9USFVNQl9GT1JNQVQ6CisgICAgICAgICAgICAgICAgaWYgKCFwdXRMb25nKHdpbmRvdywgb2JqZWN0SW5mby0+bVRodW1iRm9ybWF0LCByb3csIGkpKQorICAgICAgICAgICAgICAgICAgICBnb3RvIGZhaWw7CisgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBPQkpFQ1RfVEhVTUJfU0laRToKKyAgICAgICAgICAgICAgICBpZiAoIXB1dExvbmcod2luZG93LCBvYmplY3RJbmZvLT5tVGh1bWJDb21wcmVzc2VkU2l6ZSwgcm93LCBpKSkKKyAgICAgICAgICAgICAgICAgICAgZ290byBmYWlsOworICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgT0JKRUNUX1RIVU1CX1dJRFRIOgorICAgICAgICAgICAgICAgIGlmICghcHV0TG9uZyh3aW5kb3csIG9iamVjdEluZm8tPm1UaHVtYlBpeFdpZHRoLCByb3csIGkpKQorICAgICAgICAgICAgICAgICAgICBnb3RvIGZhaWw7CisgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBPQkpFQ1RfVEhVTUJfSEVJR0hUOgorICAgICAgICAgICAgICAgIGlmICghcHV0TG9uZyh3aW5kb3csIG9iamVjdEluZm8tPm1UaHVtYlBpeEhlaWdodCwgcm93LCBpKSkKKyAgICAgICAgICAgICAgICAgICAgZ290byBmYWlsOworICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgT0JKRUNUX0lNQUdFX1dJRFRIOgorICAgICAgICAgICAgICAgIGlmICghcHV0TG9uZyh3aW5kb3csIG9iamVjdEluZm8tPm1JbWFnZVBpeFdpZHRoLCByb3csIGkpKQorICAgICAgICAgICAgICAgICAgICBnb3RvIGZhaWw7CisgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBPQkpFQ1RfSU1BR0VfSEVJR0hUOgorICAgICAgICAgICAgICAgIGlmICghcHV0TG9uZyh3aW5kb3csIG9iamVjdEluZm8tPm1JbWFnZVBpeEhlaWdodCwgcm93LCBpKSkKKyAgICAgICAgICAgICAgICAgICAgZ290byBmYWlsOworICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgT0JKRUNUX0lNQUdFX0RFUFRIOgorICAgICAgICAgICAgICAgIGlmICghcHV0TG9uZyh3aW5kb3csIG9iamVjdEluZm8tPm1JbWFnZVBpeERlcHRoLCByb3csIGkpKQorICAgICAgICAgICAgICAgICAgICBnb3RvIGZhaWw7CisgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBPQkpFQ1RfUEFSRU5UOgorICAgICAgICAgICAgICAgIGlmICghcHV0TG9uZyh3aW5kb3csIG9iamVjdEluZm8tPm1QYXJlbnQsIHJvdywgaSkpCisgICAgICAgICAgICAgICAgICAgIGdvdG8gZmFpbDsKKyAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIE9CSkVDVF9BU1NPQ0lBVElPTl9UWVBFOgorICAgICAgICAgICAgICAgIGlmICghcHV0TG9uZyh3aW5kb3csIG9iamVjdEluZm8tPm1Bc3NvY2lhdGlvblR5cGUsIHJvdywgaSkpCisgICAgICAgICAgICAgICAgICAgIGdvdG8gZmFpbDsKKyAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIE9CSkVDVF9BU1NPQ0lBVElPTl9ERVNDOgorICAgICAgICAgICAgICAgIGlmICghcHV0TG9uZyh3aW5kb3csIG9iamVjdEluZm8tPm1Bc3NvY2lhdGlvbkRlc2MsIHJvdywgaSkpCisgICAgICAgICAgICAgICAgICAgIGdvdG8gZmFpbDsKKyAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIE9CSkVDVF9TRVFVRU5DRV9OVU1CRVI6CisgICAgICAgICAgICAgICAgaWYgKCFwdXRMb25nKHdpbmRvdywgb2JqZWN0SW5mby0+bVNlcXVlbmNlTnVtYmVyLCByb3csIGkpKQorICAgICAgICAgICAgICAgICAgICBnb3RvIGZhaWw7CisgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBPQkpFQ1RfTkFNRToKKyAgICAgICAgICAgICAgICBpZiAoIXB1dFN0cmluZyh3aW5kb3csIG9iamVjdEluZm8tPm1OYW1lLCByb3csIGkpKQorICAgICAgICAgICAgICAgICAgICBnb3RvIGZhaWw7CisgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBPQkpFQ1RfREFURV9DUkVBVEVEOgorICAgICAgICAgICAgICAgIGlmICghcHV0TG9uZyh3aW5kb3csIG9iamVjdEluZm8tPm1EYXRlQ3JlYXRlZCwgcm93LCBpKSkKKyAgICAgICAgICAgICAgICAgICAgZ290byBmYWlsOworICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgT0JKRUNUX0RBVEVfTU9ESUZJRUQ6CisgICAgICAgICAgICAgICAgaWYgKCFwdXRMb25nKHdpbmRvdywgb2JqZWN0SW5mby0+bURhdGVNb2RpZmllZCwgcm93LCBpKSkKKyAgICAgICAgICAgICAgICAgICAgZ290byBmYWlsOworICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgT0JKRUNUX0tFWVdPUkRTOgorICAgICAgICAgICAgICAgIGlmICghcHV0U3RyaW5nKHdpbmRvdywgb2JqZWN0SW5mby0+bUtleXdvcmRzLCByb3csIGkpKQorICAgICAgICAgICAgICAgICAgICBnb3RvIGZhaWw7CisgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBPQkpFQ1RfVEhVTUI6CisgICAgICAgICAgICAgICAgaWYgKCFwdXRUaHVtYm5haWwod2luZG93LCBvYmplY3RJRCwgb2JqZWN0SW5mby0+bUZvcm1hdCwgcm93LCBpKSkKKyAgICAgICAgICAgICAgICAgICAgZ290byBmYWlsOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICBMT0dFKCJmaWxsU3RvcmFnZTogdW5rbm93biBjb2x1bW4gJWRcbiIsIG1Db2x1bW5zW2ldKTsKKyAgICAgICAgICAgICAgICBnb3RvIGZhaWw7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBkZWxldGUgb2JqZWN0SW5mbzsKKyAgICByZXR1cm4gdHJ1ZTsKKworZmFpbDoKKyAgICBkZWxldGUgb2JqZWN0SW5mbzsKKyAgICByZXR1cm4gZmFsc2U7Cit9CisKK2Jvb2wgTXRwQ3Vyc29yOjpwcmVwYXJlUm93KEN1cnNvcldpbmRvdyogd2luZG93KSB7CisgICAgaWYgKCF3aW5kb3ctPnNldE51bUNvbHVtbnMobUNvbHVtbkNvdW50KSkgeworICAgICAgICBMT0dFKCJGYWlsZWQgdG8gY2hhbmdlIGNvbHVtbiBjb3VudCBmcm9tICVkIHRvICVkIiwgd2luZG93LT5nZXROdW1Db2x1bW5zKCksIG1Db2x1bW5Db3VudCk7CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisgICAgZmllbGRfc2xvdF90ICogZmllbGREaXIgPSB3aW5kb3ctPmFsbG9jUm93KCk7CisgICAgaWYgKCFmaWVsZERpcikgeworICAgICAgICBMT0dFKCJGYWlsZWQgYWxsb2NhdGluZyBmaWVsZERpciIpOworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorICAgIHJldHVybiB0cnVlOworfQorCisKK2Jvb2wgTXRwQ3Vyc29yOjpwdXRMb25nKEN1cnNvcldpbmRvdyogd2luZG93LCBpbnQgdmFsdWUsIGludCByb3csIGludCBjb2x1bW4pIHsKKworICAgIGlmICghd2luZG93LT5wdXRMb25nKHJvdywgY29sdW1uLCB2YWx1ZSkpIHsKKyAgICAgICAgd2luZG93LT5mcmVlTGFzdFJvdygpOworICAgICAgICBMT0dFKCJGYWlsZWQgYWxsb2NhdGluZyBzcGFjZSBmb3IgYSBsb25nIGluIGNvbHVtbiAlZCIsIGNvbHVtbik7CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisgICAgcmV0dXJuIHRydWU7Cit9CisKK2Jvb2wgTXRwQ3Vyc29yOjpwdXRTdHJpbmcoQ3Vyc29yV2luZG93KiB3aW5kb3csIGNvbnN0IGNoYXIqIHRleHQsIGludCByb3csIGludCBjb2x1bW4pIHsKKyAgICBpbnQgc2l6ZSA9IHN0cmxlbih0ZXh0KSArIDE7CisgICAgaW50IG9mZnNldCA9IHdpbmRvdy0+YWxsb2Moc2l6ZSk7CisgICAgaWYgKCFvZmZzZXQpIHsKKyAgICAgICAgd2luZG93LT5mcmVlTGFzdFJvdygpOworICAgICAgICBMT0dFKCJGYWlsZWQgYWxsb2NhdGluZyAldSBieXRlcyBmb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worY2xhc3MgTXRwQ3Vyc29yIHsKK3ByaXZhdGU6CisgICAgZW51bSB7CisgICAgICAgIERFVklDRSAgICAgICAgICAgICAgPSAxLAorICAgICAgICBERVZJQ0VfSUQgICAgICAgICAgID0gMiwKKyAgICAgICAgU1RPUkFHRSAgICAgICAgICAgICA9IDMsCisgICAgICAgIFNUT1JBR0VfSUQgICAgICAgICAgPSA0LAorICAgICAgICBPQkpFQ1QgICAgICAgICAgICAgID0gNSwKKyAgICAgICAgT0JKRUNUX0lEICAgICAgICAgICA9IDYsCisgICAgICAgIFNUT1JBR0VfQ0hJTERSRU4gICAgPSA3LAorICAgICAgICBPQkpFQ1RfQ0hJTERSRU4gICAgID0gOCwKKyAgICB9OworCisgICAgTXRwQ2xpZW50KiAgbUNsaWVudDsKKyAgICBpbnQgICAgICAgICBtUXVlcnlUeXBlOworICAgIGludCAgICAgICAgIG1EZXZpY2VJRDsKKyAgICBpbnQgICAgICAgICBtU3RvcmFnZUlEOworICAgIGludCAgICAgICAgIG1RYmplY3RJRDsKKyAgICBpbnQgICAgICAgICBtQ29sdW1uQ291bnQ7CisgICAgaW50KiAgICAgICAgbUNvbHVtbnM7CisKK3B1YmxpYzoKKyAgICAgICAgICAgICAgICBNdHBDdXJzb3IoTXRwQ2xpZW50KiBjbGllbnQsIGludCBxdWVyeVR5cGUsIGludCBkZXZpY2VJRCwKKyAgICAgICAgICAgICAgICAgICAgICAgIGludCBzdG9yYWdlSUQsIGludCBvYmplY3RJRCwgaW50IGNvbHVtbkNvdW50LCBpbnQqIGNvbHVtbnMpOworICAgIHZpcnR1YWwgICAgIH5NdHBDdXJzb3IoKTsKKworICAgIGludCAgICAgICAgIGZpbGxXaW5kb3coQ3Vyc29yV2luZG93KiB3aW5kb3csIGludCBzdGFydFBvcyk7CisKK3ByaXZhdGU6CisgICAgaW50ICAgICAgICAgZmlsbERldmljZXMoQ3Vyc29yV2luZG93KiB3aW5kb3csIGludCBzdGFydFBvcyk7CisgICAgaW50ICAgICAgICAgZmlsbERldmljZShDdXJzb3JXaW5kb3cqIHdpbmRvdywgaW50IHN0YXJ0UG9zKTsKKyAgICBpbnQgICAgICAgICBmaWxsU3RvcmFnZXMoQ3Vyc29yV2luZG93KiB3aW5kb3csIGludCBzdGFydFBvcyk7CisgICAgaW50ICAgICAgICAgZmlsbFN0b3JhZ2UoQ3Vyc29yV2luZG93KiB3aW5kb3csIGludCBzdGFydFBvcyk7CisgICAgaW50ICAgICAgICAgZmlsbE9iamVjdHMoQ3Vyc29yV2luZG93KiB3aW5kb3csIGludCBwYXJlbnQsIGludCBzdGFydFBvcyk7CisgICAgaW50ICAgICAgICAgZmlsbE9iamVjdChDdXJzb3JXaW5kb3cqIHdpbmRvdywgaW50IHN0YXJ0UG9zKTsKKworICAgIGJvb2wgICAgICAgIGZpbGxEZXZpY2UoQ3Vyc29yV2luZG93KiB3aW5kb3csIE10cERldmljZSogZGV2aWNlLCBpbnQgc3RhcnRQb3MpOworICAgIGJvb2wgICAgICAgIGZpbGxTdG9yYWdlKEN1cnNvcldpbmRvdyogd2luZG93LCBNdHBEZXZpY2UqIGRldmljZSwKKyAgICAgICAgICAgICAgICAgICAgICAgIE10cFN0b3JhZ2VJRCBzdG9yYWdlSUQsIGludCByb3cpOworICAgIGJvb2wgICAgICAgIGZpbGxPYmplY3QoQ3Vyc29yV2luZG93KiB3aW5kb3csIE10cERldmljZSogZGV2aWNlLAorICAgICAgICAgICAgICAgICAgICAgICAgTXRwT2JqZWN0SGFuZGxlIG9iamVjdElELCBpbnQgcm93KTsKKworICAgIGJvb2wgICAgICAgIHByZXBhcmVSb3coQ3Vyc29yV2luZG93KiB3aW5kb3cpOworICAgIGJvb2wgICAgICAgIHB1dExvbmcoQ3Vyc29yV2luZG93KiB3aW5kb3csIGludCB2YWx1ZSwgaW50IHJvdywgaW50IGNvbHVtbik7CisgICAgYm9vbCAgICAgICAgcHV0U3RyaW5nKEN1cnNvcldpbmRvdyogd2luZG93LCBjb25zdCBjaGFyKiB0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50OyBpKyspCisgICAgICAgIHJlc3VsdC0+cHVzaChnZXRVSW50OCgpKTsKKyAgICByZXR1cm4gcmVzdWx0OworfQorCitJbnQxNkxpc3QqIE10cERhdGFQYWNrZXQ6OmdldEFJbnQxNigpIHsKKyAgICBJbnQxNkxpc3QqIHJlc3VsdCA9IG5ldyBJbnQxNkxpc3Q7CisgICAgaW50IGNvdW50ID0gZ2V0VUludDMyKCk7CisgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBjb3VudDsgaSsrKQorICAgICAgICByZXN1bHQtPnB1c2goZ2V0SW50MTYoKSk7CisgICAgcmV0dXJuIHJlc3VsdDsKK30KKworVUludDE2TGlzdCogTXRwRGF0YVBhY2tldDo6Z2V0QVVJbnQxNigpIHsKKyAgICBVSW50MTZMaXN0KiByZXN1bHQgPSBuZXcgVUludDE2TGlzdDsKKyAgICBpbnQgY291bnQgPSBnZXRVSW50MzIoKTsKKyAgICBmb3IgKGludCBpID0gMDsgaSA8IGNvdW50OyBpKyspCisgICAgICAgIHJlc3VsdC0+cHVzaChnZXRVSW50MTYoKSk7CisgICAgcmV0dXJuIHJlc3VsdDsKK30KKworSW50MzJMaXN0KiBNdHBEYXRhUGFja2V0OjpnZXRBSW50MzIoKSB7CisgICAgSW50MzJMaXN0KiByZXN1bHQgPSBuZXcgSW50MzJMaXN0OworICAgIGludCBjb3VudCA9IGdldFVJbnQzMigpOworICAgIGZvciAoaW50IGkgPSAwOyBpIDwgY291bnQ7IGkrKykKKyAgICAgICAgcmVzdWx0LT5wdXNoKGdldEludDMyKCkpOworICAgIHJldHVybiByZXN1bHQ7Cit9CisKK1VJbnQzMkxpc3QqIE10cERhdGFQYWNrZXQ6OmdldEFVSW50MzIoKSB7CisgICAgVUludDMyTGlzdCogcmVzdWx0ID0gbmV3IFVJbnQzMkxpc3Q7CisgICAgaW50IGNvdW50ID0gZ2V0VUludDMyKCk7CisgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBjb3VudDsgaSsrKQorICAgICAgICByZXN1bHQtPnB1c2goZ2V0VUludDMyKCkpOworICAgIHJldHVybiByZXN1bHQ7Cit9CisKK0ludDY0TGlzdCogTXRwRGF0YVBhY2tldDo6Z2V0QUludDY0KCkgeworICAgIEludDY0TGlzdCogcmVzdWx0ID0gbmV3IEludDY0TGlzdDsKKyAgICBpbnQgY291bnQgPSBnZXRVSW50MzIoKTsKKyAgICBmb3IgKGludCBpID0gMDsgaSA8IGNvdW50OyBpKyspCisgICAgICAgIHJlc3VsdC0+cHVzaChnZXRJbnQ2NCgpKTsKKyAgICByZXR1cm4gcmVzdWx0OworfQorCitVSW50NjRMaXN0KiBNdHBEYXRhUGFja2V0OjpnZXRBVUludDY0KCkgeworICAgIFVJbnQ2NExpc3QqIHJlc3VsdCA9IG5ldyBVSW50NjRMaXN0OworICAgIGludCBjb3VudCA9IGdldFVJbnQzMigpOworICAgIGZvciAoaW50IGkgPSAwOyBpIDwgY291bnQ7IGkrKykKKyAgICAgICAgcmVzdWx0LT5wdXNoKGdldFVJbnQ2NCgpKTsKKyAgICByZXR1cm4gcmVzdWx0OworfQorCit2b2lkIE10cERhdGFQYWNrZXQ6OnB1dEludDgoaW50OF90IHZhbHVlKSB7CisgICAgYWxsb2NhdGUobU9mZnNldCArIDEpOworICAgIG1CdWZmZXJbbU9mZnNldCsrXSA9ICh1aW50OF90KXZhbHVlOworICAgIGlmIChtUGFja2V0U2l6ZSA8IG1PZmZzZXQpCisgICAgICAgIG1QYWNrZXRTaXplID0gbU9mZnNldDsKK30KKwordm9pZCBNdHBEYXRhUGFja2V0OjpwdXRVSW50OCh1aW50OF90IHZhbHVlKSB7CisgICAgYWxsb2NhdGUobU9mZnNldCArIDEpOworICAgIG1CdWZmZXJbbU9mZnNldCsrXSA9ICh1aW50OF90KXZhbHVlOworICAgIGlmIChtUGFja2V0U2l6ZSA8IG1PZmZzZXQpCisgICAgICAgIG1QYWNrZXRTaXplID0gbU9mZnNldDsKK30KKwordm9pZCBNdHBEYXRhUGFja2V0Oj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yAgICBwdXRJbnQzMih2YWx1ZVswXSk7CisgICAgcHV0SW50MzIodmFsdWVbMV0pOworICAgIHB1dEludDMyKHZhbHVlWzJdKTsKKyAgICBwdXRJbnQzMih2YWx1ZVszXSk7Cit9CisKK3ZvaWQgTXRwRGF0YVBhY2tldDo6cHV0VUludDEyOChjb25zdCB1aW50MTI4X3QmIHZhbHVlKSB7CisgICAgcHV0VUludDMyKHZhbHVlWzBdKTsKKyAgICBwdXRVSW50MzIodmFsdWVbMV0pOworICAgIHB1dFVJbnQzMih2YWx1ZVsyXSk7CisgICAgcHV0VUludDMyKHZhbHVlWzNdKTsKK30KKwordm9pZCBNdHBEYXRhUGFja2V0OjpwdXRBSW50OChjb25zdCBpbnQ4X3QqIHZhbHVlcywgaW50IGNvdW50KSB7CisgICAgcHV0VUludDMyKGNvdW50KTsKKyAgICBmb3IgKGludCBpID0gMDsgaSA8IGNvdW50OyBpKyspCisgICAgICAgIHB1dEludDgoKnZhbHVlcysrKTsKK30KKwordm9pZCBNdHBEYXRhUGFja2V0OjpwdXRBVUludDgoY29uc3QgdWludDhfdCogdmFsdWVzLCBpbnQgY291bnQpIHsKKyAgICBwdXRVSW50MzIoY291bnQpOworICAgIGZvciAoaW50IGkgPSAwOyBpIDwgY291bnQ7IGkrKykKKyAgICAgICAgcHV0VUludDgoKnZhbHVlcysrKTsKK30KKwordm9pZCBNdHBEYXRhUGFja2V0OjpwdXRBSW50MTYoY29uc3QgaW50MTZfdCogdmFsdWVzLCBpbnQgY291bnQpIHsKKyAgICBwdXRVSW50MzIoY291bnQpOworICAgIGZvciAoaW50IGkgPSAwOyBpIDwgY291bnQ7IGkrKykKKyAgICAgICAgcHV0SW50MTYoKnZhbHVlcysrKTsKK30KKwordm9pZCBNdHBEYXRhUGFja2V0OjpwdXRBVUludDE2KGNvbnN0IHVpbnQxNl90KiB2YWx1ZXMsIGludCBjb3VudCkgeworICAgIHB1dFVJbnQzMihjb3VudCk7CisgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBjb3VudDsgaSsrKQorICAgICAgICBwdXRVSW50MTYoKnZhbHVlcysrKTsKK30KKwordm9pZCBNdHBEYXRhUGFja2V0OjpwdXRBVUludDE2KGNvbnN0IFVJbnQxNkxpc3QqIHZhbHVlcykgeworICAgIHNpemVfdCBjb3VudCA9ICh2YWx1ZXMgPyB2YWx1ZXMtPnNpemUoKSA6IDApOworICAgIHB1dFVJbnQzMihjb3VudCk7CisgICAgZm9yIChzaXplX3QgaSA9IDA7IGkgPCBjb3VudDsgaSsrKQorICAgICAgICBwdXRVSW50MTYoKCp2YWx1ZXMpW2ldKTsKK30KKwordm9pZCBNdHBEYXRhUGFja2V0OjpwdXRBSW50MzIoY29uc3QgaW50MzJfdCogdmFsdWVzLCBpbnQgY291bnQpIHsKKyAgICBwdXRVSW50MzIoY291bnQpOworICAgIGZvciAoaW50IGkgPSAwOyBpIDwgY291bnQ7IGkrKykKKyAgICAgICAgcHV0SW50MzIoKnZhbHVlcysrKTsKK30KKwordm9pZCBNdHBEYXRhUGFja2V0OjpwdXRBVUludDMyKGNvbnN0IHVpbnQzMl90KiB2YWx1ZXMsIGludCBjb3VudCkgeworICAgIHB1dFVJbnQzMihjb3VudCk7CisgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBjb3VudDsgaSsrKQorICAgICAgICBwdXRVSW50MzIoKnZhbHVlcysrKTsKK30KKwordm9pZCBNdHBEYXRhUGFja2V0OjpwdXRBVUludDMyKGNvbnN0IFVJbnQzMkxpc3QqIGxpc3QpIHsKKyAgICBpZiAoIWxpc3QpIHsKKyAgICAgICAgcHV0RW1wdHlBcnJheSgpOworICAgIH0gZWxzZSB7CisgICAgICAgIHNpemVfdCBzaXplID0gbGlzdC0+c2l6ZSgpOworICAgICAgICBwdXRVSW50MzIoc2l6ZSk7CisgICAgICAgIGZvciAoc2l6ZV90IGkgPSAwOyBpIDwgc2l6ZTsgaSsrKQorICAgICAgICAgICAgcHV0VUludDMyKCgqbGlzdClbaV0pOworICAgIH0KK30KKwordm9pZCBNdHBEYXRhUGFja2V0OjpwdXRBSW50NjQoY29uc3QgaW50NjRfdCogdmFsdWVzLCBpbnQgY291bnQpIHsKKyAgICBwdXRVSW50MzIoY291bnQpOworICAgIGZvciAoaW50IGkgPSAwOyBpIDwgY291bnQ7IGkrKykKKyAgICAgICAgcHV0SW50NjQoKnZhbHVlcysrKTsKK30KKwordm9pZCBNdHBEYXRhUGFja2V0OjpwdXRBVUludDY0KGNvbnN0IHVpbnQ2NF90KiB2YWx1ZXMsIGludCBjb3VudCkgeworICAgIHB1dFVJbnQzMihjb3VudCk7CisgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBjb3VudDsgaSsrKQorICAgICAgICBwdXRVSW50NjQoKnZhbHVlcysrKTsKK30KKwordm9pZCBNdHBEYXRhUGFja2V0OjpwdXRTdHJpbmcoY29uc3QgTXRwU3RyaW5nQnVmZmVyJiBzdHJpbmcpIHsKKyAgICBzdHJpbmcud3JpdGVUb1BhY2tldCh0aGlzKTsKK30KKwordm9pZCBNdHBEYXRhUGFja2V0OjpwdXRTdHJpbmcoY29uc3QgY2hhciogcykgeworICAgIE10cFN0cmluZ0J1ZmZlciBzdHJpbmcocyk7CisgICAgc3RyaW5nLndyaXRlVG9QYWNrZXQodGhpcyk7Cit9CisKK3ZvaWQgTXRwRGF0YVBhY2tldDo6cHV0U3RyaW5nKGNvbnN0IHVpbnQxNl90KiBzdHJpbmcpIHsKKyAgICBpbnQgY291bnQgPSAwOworICAgIGZvciAoaW50IGkgPSAwOyBpIDwgMjU2OyBpKyspIHsKKyAgICAgICAgaWYgKHN0cmluZ1tpXSkKKyAgICAgICAgICAgIGNvdW50Kys7CisgICAgICAgIGVsc2UKKyAgICAgICAgICAgIGJyZWFrOworICAgIH0KKyAgICBwdXRVSW50OChjb3VudCA+IDAgPyBjb3VudCArIDEgOiAwKTsKKyAgICBmb3IgKGludCBpID0gMDsgaSA8IGNvdW50OyBpKyspCisgICAgICAgIHB1dFVJbnQxNihzdHJpbmdbaV0pOworICAgIC8vIG9ubHkgdGVybWluYXRlIHdpdGggemVybyBpZiBzdHJpbmcgaXMgbm90IGVtcHR5CisgICAgaWYgKGNvdW50ID4gMCkKKyAgICAgICAgcHV0VUludDE2KDApOworfQorCisjaWZkZWYgTVRQX0RFVklDRSAKK2ludCBNdHBEYXRhUGFja2V0OjpyZWFkKGludCBmZCkgeworICAgIC8vIGZpcnN0IHJlYWQgdGhlIGhlYWRlcgorICAgIGludCByZXQgPSA6OnJlYWQoZmQsIG1CdWZmZXIsIE1UUF9DT05UQUlORVJfSEVBREVSX1NJWkUpOworICAgIGlmIChyZXQgIT0gTVRQX0NPTlRBSU5FUl9IRUFERVJfU0laRSkKKyAgICAgICAgcmV0dXJuIC0xOworICAgIC8vIHRoZW4gdGhlIGZvbGxvd2luZyBkYXRhCisgICAgaW50IHRvdGFsID0gTXRwUGFja2V0OjpnZXRVSW50MzIoTVRQX0NPTlRBSU5FUl9MRU5HVEhfT0ZGU0VUKTsKKyAgICBpbnQgcmVtYWluaW5nID0gdG90YWwgLSBNVFBfQ09OVEFJTkVSX0hFQURFUl9TSVpFOworICAgIHJldCA9IDo6cmVhZChmZCwgJm1CdWZmZXJbMF0gKyBNVFBfQ09OVEFJTkVSX0hFQURFUl9TSVpFLCByZW1haW5pbmcpOworICAgIGlmIChyZXQgIT0gcmVtYWluaW5nKQorICAgICAgICByZXR1cm4gLTE7CisKKyAgICBtUGFja2V0U2l6ZSA9IHRvdGFsOworICAgIG1PZmZzZXQgPSBNVFBfQ09OVEFJTkVSX0hFQURFUl9TSVpFOworICAgIHJldHVybiB0b3RhbDsKK30KKworaW50IE10cERhdGFQYWNrZXQ6OnJlYWREYXRhSGVhZGVyKGludCBmZCkgeworICAgIGludCByZXQgPSA6OnJlYWQoZmQsIG1CdWZmZXIsIE1UUF9DT05UQUlORVJfSEVBREVSX1NJWkUpOworICAgIGlmIChyZXQgPiAwKQorICAgICAgICBtUGFja2V0U2l6ZSA9IHJldDsKKy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X3BhY2tldChlcCk7CisgICAgd2hpbGUgKGxlbmd0aCA+IDApIHsKKyAgICAgICAgaW50IHdyaXRlID0gKGxlbmd0aCA+IHBhY2tldFNpemUgPyBwYWNrZXRTaXplIDogbGVuZ3RoKTsKKyAgICAgICAgaW50IHJldCA9IHRyYW5zZmVyKGVwLCBidWZmZXIsIHdyaXRlKTsKKyAgICAgICAgaWYgKHJldCA8IDApCisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgbGVuZ3RoIC09IHJldDsKKyAgICB9CisgICAgcmV0dXJuIChyZXQgPCAwID8gcmV0IDogMCk7Cit9CisKKyNlbmRpZiAvLyBNVFBfSE9TVAorCit2b2lkKiBNdHBEYXRhUGFja2V0OjpnZXREYXRhKGludCYgb3V0TGVuZ3RoKSBjb25zdCB7CisgICAgaW50IGxlbmd0aCA9IG1QYWNrZXRTaXplIC0gTVRQX0NPTlRBSU5FUl9IRUFERVJfU0laRTsKKyAgICBpZiAobGVuZ3RoID4gMCkgeworICAgICAgICB2b2lkKiByZXN1bHQgPSBtYWxsb2MobGVuZ3RoKTsKKyAgICAgICAgaWYgKHJlc3VsdCkgeworICAgICAgICAgICAgbWVtY3B5KHJlc3VsdCwgbUJ1ZmZlciArIE1UUF9DT05UQUlORVJfSEVBREVSX1NJWkUsIGxlbmd0aCk7CisgICAgICAgICAgICBvdXRMZW5ndGggPSBsZW5ndGg7CisgICAgICAgICAgICByZXR1cm4gcmVzdWx0OworICAgICAgICB9CisgICAgfQorICAgIG91dExlbmd0aCA9IDA7CisgICAgcmV0dXJuIE5VTEw7Cit9CisKK30gIC8vIG5hbWVzcGFjZSBhbmRyb2lkCmRpZmYgLS1naXQgYS9tZWRpYS9tdHAvTXRwRGF0YVBhY2tldC5oIGIvbWVkaWEvbXRwL010cERhdGFQYWNrZXQuaApuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi4xNDY3YWFiCi0tLSAvZGV2L251bGwKKysrIGIvbWVkaWEvbXRwL010c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5nQnVmZmVyOworCitjbGFzcyBNdHBEYXRhUGFja2V0IDogcHVibGljIE10cFBhY2tldCB7Citwcml2YXRlOgorICAgIC8vIGN1cnJlbnQgb2Zmc2V0IGZvciBnZXQvcHV0IG1ldGhvZHMKKyAgICBpbnQgICAgICAgICAgICAgICAgIG1PZmZzZXQ7CisKK3B1YmxpYzoKKyAgICAgICAgICAgICAgICAgICAgICAgIE10cERhdGFQYWNrZXQoKTsKKyAgICB2aXJ0dWFsICAgICAgICAgICAgIH5NdHBEYXRhUGFja2V0KCk7CisKKyAgICB2aXJ0dWFsIHZvaWQgICAgICAgIHJlc2V0KCk7CisKKyAgICB2b2lkICAgICAgICAgICAgICAgIHNldE9wZXJhdGlvbkNvZGUoTXRwT3BlcmF0aW9uQ29kZSBjb2RlKTsKKyAgICB2b2lkICAgICAgICAgICAgICAgIHNldFRyYW5zYWN0aW9uSUQoTXRwVHJhbnNhY3Rpb25JRCBpZCk7CisKKyAgICBpbmxpbmUgdWludDhfdCAgICAgIGdldFVJbnQ4KCkgeyByZXR1cm4gKHVpbnQ4X3QpbUJ1ZmZlclttT2Zmc2V0KytdOyB9CisgICAgaW5saW5lIGludDhfdCAgICAgICBnZXRJbnQ4KCkgeyByZXR1cm4gKGludDhfdCltQnVmZmVyW21PZmZzZXQrK107IH0KKyAgICB1aW50MTZfdCAgICAgICAgICAgIGdldFVJbnQxNigpOworICAgIGlubGluZSBpbnQxNl90ICAgICAgZ2V0SW50MTYoKSB7IHJldHVybiAoaW50MTZfdClnZXRVSW50MTYoKTsgfQorICAgIHVpbnQzMl90ICAgICAgICAgICAgZ2V0VUludDMyKCk7CisgICAgaW5saW5lIGludDMyX3QgICAgICBnZXRJbnQzMigpIHsgcmV0dXJuIChpbnQzMl90KWdldFVJbnQzMigpOyB9CisgICAgdWludDY0X3QgICAgICAgICAgICBnZXRVSW50NjQoKTsKKyAgICBpbmxpbmUgaW50NjRfdCAgICAgIGdldEludDY0KCkgeyByZXR1cm4gKGludDY0X3QpZ2V0VUludDY0KCk7IH0KKyAgICB2b2lkICAgICAgICAgICAgICAgIGdldFVJbnQxMjgodWludDEyOF90JiB2YWx1ZSk7CisgICAgaW5saW5lIHZvaWQgICAgICAgICBnZXRJbnQxMjgoaW50MTI4X3QmIHZhbHVlKSB7IGdldFVJbnQxMjgoKHVpbnQxMjhfdCYpdmFsdWUpOyB9CisgICAgdm9pZCAgICAgICAgICAgICAgICBnZXRTdHJpbmcoTXRwU3RyaW5nQnVmZmVyJiBzdHJpbmcpOworCisgICAgSW50OExpc3QqICAgICAgICAgICBnZXRBSW50OCgpOworICAgIFVJbnQ4TGlzdCogICAgICAgICAgZ2V0QVVJbnQ4KCk7CisgICAgSW50MTZMaXN0KiAgICAgICAgICBnZXRBSW50MTYoKTsKKyAgICBVSW50MTZMaXN0KiAgICAgICAgIGdldEFVSW50MTYoKTsKKyAgICBJbnQzMkxpc3QqICAgICAgICAgIGdldEFJbnQzMigpOworICAgIFVJbnQzMkxpc3QqICAgICAgICAgZ2V0QVVJbnQzMigpOworICAgIEludDY0TGlzdCogICAgICAgICAgZ2V0QUludDY0KCk7CisgICAgVUludDY0TGlzdCogICAgICAgICBnZXRBVUludDY0KCk7CisKKyAgICB2b2lkICAgICAgICAgICAgICAgIHB1dEludDgoaW50OF90IHZhbHVlKTsKKyAgICB2b2lkICAgICAgICAgICAgICAgIHB1dFVJbnQ4KHVpbnQ4X3QgdmFsdWUpOworICAgIHZvaWQgICAgICAgICAgICAgICAgcHV0SW50MTYoaW50MTZfdCB2YWx1ZSk7CisgICAgdm9pZCAgICAgICAgICAgICAgICBwdXRVSW50MTYodWludDE2X3QgdmFsdWUpOworICAgIHZvaWQgICAgICAgICAgICAgICAgcHV0SW50MzIoaW50MzJfdCB2YWx1ZSk7CisgICAgdm9pZCAgICAgICAgICAgICAgICBwdXRVSW50MzIodWludDMyX3QgdmFsdWUpOworICAgIHZvaWQgICAgICAgICAgICAgICAgcHV0SW50NjQoaW50NjRfdCB2YWx1ZSk7CisgICAgdm9pZCAgICAgICAgICAgICAgICBwdXRVSW50NjQodWludDY0X3QgdmFsdWUpOworICAgIHZvaWQgICAgICAgICAgICAgICAgcHV0SW50MTI4KGNvbnN0IGludDEyOF90JiB2YWx1ZSk7CisgICAgdm9pZCAgICAgICAgICAgICAgICBwdXRVSW50MTI4KGNvbnN0IHVpbnQxMjhfdCYgdmFsdWUpOworCisgICAgdm9pZCAgICAgICAgICAgICAgICBwdXRBSW50OChjb25zdCBpbnQ4X3QqIHZhbHVlcywgaW50IGNvdW50KTsKKyAgICB2b2lkICAgICAgICAgICAgICAgIHB1dEFVSW50OChjb25zdCB1aW50OF90KiB2YWx1ZXMsIGludCBjb3VudCk7CisgICAgdm9pZCAgICAgICAgICAgICAgICBwdXRBSW50MTYoY29uc3QgaW50MTZfdCogdmFsdWVzLCBpbnQgY291bnQpOworICAgIHZvaWQgICAgICAgICAgICAgICAgcHV0QVVJbnQxNihjb25zdCB1aW50MTZfdCogdmFsdWVzLCBpbnQgY291bnQpOworICAgIHZvaWQgICAgICAgICAgICAgICAgcHV0QVVJbnQxNihjb25zdCBVSW50MTZMaXN0KiB2YWx1ZXMpOworICAgIHZvaWQgICAgICAgICAgICAgICAgcHV0QUludDMyKGNvbnN0IGludDMyX3QqIHZhbHVlcywgaW50IGNvdW50KTsKKyAgICB2b2lkICAgICAgICAgICAgICAgIHB1dEFVSW50MzIoY29uc3QgdWludDMyX3QqIHZhbHVlcywgaW50IGNvdW50KTsKKyAgICB2b2lkICAgICAgICAgICAgICAgIHB1dEFVSW50MzIoY29uc3QgVUludDMyTGlzdCogbGlzdCk7CisgICAgdm9pZCAgICAgICAgICAgICAgICBwdXRBSW50NjQoY29uc3QgaW50NjRfdCogdmFsdWVzLCBpbnQgY291bnQpOworICAgIHZvaWQgICAgICAgICAgICAgICAgcHV0QVVJbnQ2NChjb25zdCB1aW50NjRfdCogdmFsdWVzLCBpbnQgY291bnQpOworICAgIHZvaWQgICAgICAgICAgICAgICAgcHV0U3RyaW5nKGNvbnN0IE10cFN0cmluZ0J1ZmZlciYgc3RyaW5nKTsKKyAgICB2b2lkICAgICAgICAgICAgICAgIHB1dFN0cmluZyhjb25zdCBjaGFyKiBzdHJpbmcpOworICAgIHZvaWQgICAgICAgICAgICAgICAgcHV0U3RyaW5nKGNvbnN0IHVpbnQxNl90KiBzdHJpbmcpOworICAgIGlubGluZSB2b2lkICAgICAgICAgcHV0RW1wdHlTdHJpbmcoKSB7IHB1dFVJbnQ4KDApOyB9CisgICAgaW5saW5lIHZvaWQgICAgICAgICBwdXRFbXB0eUFycmF5KCkgeyBwdXRVSW50MzIoMCk7IH0KKworCisjaWZkZWYgTVRQX0RFVklDRQorICAgIC8vIGZpbGwgb3VyIGJ1ZmZlciB3aXRoIGRhdGEgZnJvbSB0aGUgZ2l2ZW4gZmlsZSBkZXNjcmlwdG9yCisgICAgaW50ICAgICAgICAgICAgICAgICByZWFkKGludCBmZCk7CisgICAgaW50ICAgICAgICAgICAgICAgICByZWFkRGF0YUhlYWRlcihpbnQgZmQpOworCisgICAgLy8gd3JpdGUgb3VyIGRhdGEgdG8gdGhlIGdpdmVuIGZpbGUgZGVzY3JpcHRvcgorICAgIGludCAgICAgICAgICAgICAgICAgd3JpdGUoaW50IGZkKTsKKyAgICBpbnQgICAgICAgICAgICAgICAgIHdyaXRlRGF0YUhlYWRlcihpbnQgZmQsIHVpbnQzMl90IGxlbmd0aCk7CisjZW5kaWYKKworI2lmZGVmIE1UUF9IT1NUCisgICAgaW50ICAgICAgICAgICAgICAgICByZWFkKHN0cnVjdCB1c2JfZW5kcG9pbnQgKmVwKTsKKyAgICBpbnQgICAgICAgICAgICAgICAgIHJlYWREYXRhKHN0cnVjdCB1c2JfZW5kcG9pbnQgKmVwLCB2b2lkKiBidWZmZXIsIGludCBsZW5ndGgpOworICAgIGludCAgICAgICAgICAgICAgICAgcmVhZERhdGFIZWFkZXIoc3RydWN0IHVzYl9lbmRwb2ludCAqZXApOworCisgICAgaW50ICAgICAgICA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sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE10cE9iamVjdEhhbmRsZSBwYXJlbnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE10cFN0b3JhZ2VJRCBzdG9yYWdlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50NjRfdCBzaXplLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aW1lX3QgbW9kaWZpZWQpID0gMDsKKworICAgIC8vIGNhbGxlZCB0byByZXBvcnQgc3VjY2VzcyBvciBmYWlsdXJlIG9mIHRoZSBTZW5kT2JqZWN0IGZpbGUgdHJhbnNmZXIKKyAgICAvLyBzdWNjZXNzIHNob3VsZCBzaWduYWwgYSBub3RpZmljYXRpb24gb2YgdGhlIG5ldyBvYmplY3QncyBjcmVhdGlvbiwKKyAgICAvLyBmYWlsdXJlIHNob3VsZCByZW1vdmUgdGhlIGRhdGFiYXNlIGVudHJ5IGNyZWF0ZWQgaW4gYmVnaW5TZW5kT2JqZWN0CisgICAgdmlydHVhbCB2b2lkICAgICAgICAgICAgICAgICAgICBlbmRTZW5kT2JqZWN0KGNvbnN0IGNoYXIqIHBhdGgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE10cE9iamVjdEhhbmRsZSBoYW5kbGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE10cE9iamVjdEZvcm1hdCBmb3JtYXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgc3VjY2VlZGVkKSA9IDA7CisKKyAgICB2aXJ0dWFsIE10cE9iamVjdEhhbmRsZUxpc3QqICAgIGdldE9iamVjdExpc3QoTXRwU3RvcmFnZUlEIHN0b3JhZ2VJRCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTXRwT2JqZWN0Rm9ybWF0IGZvcm1hdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTXRwT2JqZWN0SGFuZGxlIHBhcmVudCkgPSAwOworCisgICAgdmlydHVhbCBpbnQgICAgICAgICAgICAgICAgICAgICBnZXROdW1PYmplY3RzKE10cFN0b3JhZ2VJRCBzdG9yYWdlSUQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE10cE9iamVjdEZvcm1hdCBmb3JtYXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE10cE9iamVjdEhhbmRsZSBwYXJlbnQpID0gMDsKKworICAgIC8vIGNhbGxlZSBzaG91bGQgZGVsZXRlW10gdGhlIHJlc3VsdHMgZnJvbSB0aGVzZQorICAgIC8vIHJlc3VsdHMgY2FuIGJlIE5VTEwKKyAgICB2aXJ0dWFsIE10cE9iamVjdEZvcm1hdExpc3QqICAgIGdldFN1cHBvcnRlZFBsYXliYWNrRm9ybWF0cygpID0gMDsKKyAgICB2aXJ0dWFsIE10cE9iamVjdEZvcm1hdExpc3QqICAgIGdldFN1cHBvcnRlZENhcHR1cmVGb3JtYXRzKCkgPSAwOworICAgIHZpcnR1YWwgTXRwT2JqZWN0UHJvcGVydHlMaXN0KiAgZ2V0U3VwcG9ydGVkT2JqZWN0UHJvcGVydGllcyhNdHBPYmplY3RGb3JtYXQgZm9ybWF0KSA9IDA7CisgICAgdmlydHVhbCBNdHBEZXZpY2VQcm9wZXJ0eUxpc3QqICBnZXRTdXBwb3J0ZWREZXZpY2VQcm9wZXJ0aWVzKCkgPSAwOworCisgICAgdmlydHVhbCBNdHBSZXNwb25zZUNvZGUgICAgICAgICBnZXRPYmplY3RQcm9wZXJ0eShNdHBPYmplY3RIYW5kbGUgaGFuZGxlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNdHBPYmplY3RQcm9wZXJ0eSBwcm9wZXJ0eSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTXRwRGF0YVBhY2tldCYgcGFja2V0KSA9IDA7CisKKyAgICB2aXJ0dWFsIE10cFJlc3BvbnNlQ29kZSAgICAgICAgIGdldE9iamVjdEluZm8oTXRwT2JqZWN0SGFuZGxlIGhhbmRsZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTXRwRGF0YVBhY2tldCYgcGFja2V0KSA9IDA7CisKKyAgICB2aXJ0dWFsIE10cFJlc3BvbnNlQ29kZSAgICAgICAgIGdldE9iamVjdEZpbGVQYXRoKE10cE9iamVjdEhhbmRsZSBoYW5kbGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE10cFN0cmluZyYgZmlsZVBhdGgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludDY0X3QmIGZpbGVMZW5ndGgpID0gMDsKKworICAgIHZpcnR1YWwgTXRwUmVzcG9uc2VDb2RlICAgICAgICAgZGVsZXRlRmlsZShNdHBPYmplY3RIYW5kbGUgaGFuZGxlKSA9IDA7CisKKyAgICB2aXJ0dWFsIE10cE9iamVjdEhhbmRsZUxpc3QqICAgIGdldE9iamVjdFJlZmVyZW5jZXMoTXRwT2JqZWN0SGFuZGxlIGhhbmRsZSkgPSAwOworCisgICAgdmlydHVhbCBNdHBSZXNwb25zZUNvZGUgICAgICAgICBzZXRPYmplY3RSZWZlcmVuY2VzKE10cE9iamVjdEhhbmRsZSBoYW5kbGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE10cE9iamVjdEhhbmRsZUxpc3QqIHJlZmVyZW5jZXMpID0gMDsKKworfTsKKworfTsgLy8gbmFtZXNwYWNlIGFuZHJvaWQKKworI2VuZGlmIC8vIF9NVFBfREFUQUJBU0VfSApkaWZmIC0tZ2l0IGEvbWVkaWEvbXRw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FuZHJvaWQgeworCitzdHJ1Y3QgQ29kZUVudHJ5IHsKKyAgICBjb25zdCBjaGFyKiBuYW1lOworICAgIHVpbnQxNl90IGNvZGU7Cit9OworCitzdGF0aWMgY29uc3QgQ29kZUVudHJ5IHNPcGVyYXRpb25Db2Rlc1tdID0geworICAgIHsgIk1UUF9PUEVSQVRJT05fR0VUX0RFVklDRV9JTkZPIiwgICAgICAgICAgICAgIDB4MTAwMSB9LAorICAgIHsgIk1UUF9PUEVSQVRJT05fT1BFTl9TRVNTSU9OIiwgICAgICAgICAgICAgICAgIDB4MTAwMiB9LAorICAgIHsgIk1UUF9PUEVSQVRJT05fQ0xPU0VfU0VTU0lPTiIsICAgICAgICAgICAgICAgIDB4MTAwMyB9LAorICAgIHsgIk1UUF9PUEVSQVRJT05fR0VUX1NUT1JBR0VfSURTIiwgICAgICAgICAgICAgIDB4MTAwNCB9LAorICAgIHsgIk1UUF9PUEVSQVRJT05fR0VUX1NUT1JBR0VfSU5GTyIsICAgICAgICAgICAgIDB4MTAwNSB9LAorICAgIHsgIk1UUF9PUEVSQVRJT05fR0VUX05VTV9PQkpFQ1RTIiwgICAgICAgICAgICAgIDB4MTAwNiB9LAorICAgIHsgIk1UUF9PUEVSQVRJT05fR0VUX09CSkVDVF9IQU5ETEVTIiwgICAgICAgICAgIDB4MTAwNyB9LAorICAgIHsgIk1UUF9PUEVSQVRJT05fR0VUX09CSkVDVF9JTkZPIiwgICAgICAgICAgICAgIDB4MTAwOCB9LAorICAgIHsgIk1UUF9PUEVSQVRJT05fR0VUX09CSkVDVCIsICAgICAgICAgICAgICAgICAgIDB4MTAwOSB9LAorICAgIHsgIk1UUF9PUEVSQVRJT05fR0VUX1RIVU1CIiwgICAgICAgICAgICAgICAgICAgIDB4MTAwQSB9LAorICAgIHsgIk1UUF9PUEVSQVRJT05fREVMRVRFX09CSkVDVCIsICAgICAgICAgICAgICAgIDB4MTAwQiB9LAorICAgIHsgIk1UUF9PUEVSQVRJT05fU0VORF9PQ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VOREVGSU5FRCIsICAgICAgICAgICAgICAgICAgICAgICAweDMwMDAgfSwKKyAgICB7ICJNVFBfRk9STUFUX0FTU09DSUFUSU9OIiwgICAgICAgICAgICAgICAgICAgICAweDMwMDEgfSwKKyAgICB7ICJNVFBfRk9STUFUX1NDUklQVCIsICAgICAgICAgICAgICAgICAgICAgICAgICAweDMwMDIgfSwKKyAgICB7ICJNVFBfRk9STUFUX0VYRUNVVEFCTEUiLCAgICAgICAgICAgICAgICAgICAgICAweDMwMDMgfSwKKyAgICB7ICJNVFBfRk9STUFUX1RFWFQiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDMwMDQgfSwKKyAgICB7ICJNVFBfRk9STUFUX0hUTUwiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDMwMDUgfSwKKyAgICB7ICJNVFBfRk9STUFUX0RQT0YiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDMwMDYgfSwKKyAgICB7ICJNVFBfRk9STUFUX0FJRkYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDMwMDcgfSwKKyAgICB7ICJNVFBfRk9STUFUX1dBViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDMwMDggfSwKKyAgICB7ICJNVFBfRk9STUFUX01QMyIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDMwMDkgfSwKKyAgICB7ICJNVFBfRk9STUFUX0FWSSIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDMwMEEgfSwKKyAgICB7ICJNVFBfRk9STUFUX01QRUciLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDMwMEIgfSwKKyAgICB7ICJNVFBfRk9STUFUX0FTRiIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDMwMEMgfSwKKyAgICB7ICJNVFBfRk9STUFUX0RFRklORUQiLCAgICAgICAgICAgICAgICAgICAgICAgICAweDM4MDAgfSwKKyAgICB7ICJNVFBfRk9STUFUX0VYSUZfSlBFRyIsICAgICAgICAgICAgICAgICAgICAgICAweDM4MDEgfSwKKyAgICB7ICJNVFBfRk9STUFUX1RJRkZfRVAiLCAgICAgICAgICAgICAgICAgICAgICAgICAweDM4MDIgfSwKKyAgICB7ICJNVFBfRk9STUFUX0ZMQVNIUElYIiwgICAgICAgICAgICAgICAgICAgICAgICAweDM4MDMgfSwKKyAgICB7ICJNVFBfRk9STUFUX0JNUCIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDM4MDQgfSwKKyAgICB7ICJNVFBfRk9STUFUX0NJRkYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDM4MDUgfSwKKyAgICB7ICJNVFBfRk9STUFUX0dJRiIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDM4MDcgfSwKKyAgICB7ICJNVFBfRk9STUFUX0pGSUYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDM4MDggfSwKKyAgICB7ICJNVFBfRk9STUFUX0NEIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDM4MDkgfSwKKyAgICB7ICJNVFBfRk9STUFUX1BJQ1QiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDM4MEEgfSwKKyAgICB7ICJNVFBfRk9STUFUX1BORyIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDM4MEIgfSwKKyAgICB7ICJNVFBfRk9STUFUX1RJRkYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDM4MEQgfSwKKyAgICB7ICJNVFBfRk9STUFUX1RJRkZfSVQiLCAgICAgICAgICAgICAgICAgICAgICAgICAweDM4MEUgfSwKKyAgICB7ICJNVFBfRk9STUFUX0pQMiIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDM4MEYgfSwKKyAgICB7ICJNVFBfRk9STUFUX0pQWCIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDM4MTAgfSwKKyAgICB7ICJNVFBfRk9STUFUX1VOREVGSU5FRF9GSVJNV0FSRSIsICAgICAgICAgICAgICAweEI4MDIgfSwKKyAgICB7ICJNVFBfRk9STUFUX1dJTkRPV1NfSU1BR0VfRk9STUFUIiwgICAgICAgICAgICAweEI4ODEgfSwKKyAgICB7ICJNVFBfRk9STUFUX1VOREVGSU5FRF9BVURJTyIsICAgICAgICAgICAgICAgICAweEI5MDAgfSwKKyAgICB7ICJNVFBfRk9STUFUX1dNQSIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweEI5MDEgfSwKKyAgICB7ICJNVFBfRk9STUFUX09HRyIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweEI5MDIgfSwKKyAgICB7ICJNVFBfRk9STUFUX0FBQyIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweEI5MDMgfSwKKyAgICB7ICJNVFBfRk9STUFUX0FVRElCTEUiLCAgICAgICAgICAgICAgICAgICAgICAgICAweEI5MDQgfSwKKyAgICB7ICJNVFBfRk9STUFUX0ZMQUMiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAweEI5MDYgfSwKKyAgICB7ICJNVFBfRk9STUFUX1VOREVGSU5FRF9WSURFTyIsICAgICAgICAgICAgICAgICAweEI5ODAgfSwKKyAgICB7ICJNVFBfRk9STUFUX1dNViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweEI5ODEgfSwKKyAgICB7ICJNVFBfRk9STUFUX01QNF9DT05UQUlORVIiLCAgICAgICAgICAgICAgICAgICAweEI5ODIgfSwKKyAgICB7ICJNVFBfRk9STUFUX01QMiIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweEI5ODMgfSwKKyAgICB7ICJNVFBfRk9STUFUXzNHUF9DT05UQUlORVIiLCAgICAgICAgICAgICAgICAgICAweEI5ODQgfSwKKyAgICB7ICJNVFBfRk9STUFUX1VOREVGSU5FRF9DT0xMRUNUSU9OIiwgICAgICAgICAgICAweEJBMDAgfSwKKyAgICB7ICJNVFBfRk9STUFUX0FCU1RSQUNUX01VTFRJTUVESUFfQUxCVU0iLCAgICAgICAweEJBMDEgfSwKKyAgICB7ICJNVFBfRk9STUFUX0FCU1RSQUNUX0lNQUdFX0FMQlVNIiwgICAgICAgICAgICAweEJBMDIgfSwKKyAgICB7ICJNVFBfRk9STUFUX0FCU1RSQUNUX0FVRElPX0FMQlVNIiwgICAgICAgICAgICAweEJBMDMgfSwKKyAgICB7ICJNVFBfRk9STUFUX0FCU1RSQUNUX1ZJREVPX0FMQlVNIiwgICAgICAgICAgICAweEJBMDQgfSwKKyAgICB7ICJNVFBfRk9STUFUX0FCU1RSQUNUX0FWX1BMQVlMSVNUIiwgICAgICAgICAgICAweEJBMDUgfSwKKyAgICB7ICJNVFBfRk9STUFUX0FCU1RSQUNUX0NPTlRBQ1RfR1JPVVAiLCAgICAgICAgICAweEJBMDYgfSwKKyAgICB7ICJNVFBfRk9STUFUX0FCU1RSQUNUX01FU1NBR0VfRk9MREVSIiwgICAgICAgICAweEJBMDcgfSwKKyAgICB7ICJNVFBfRk9STUFUX0FCU1RSQUNUX0NIQVBURVJFRF9QUk9EVUNUSU9OIiwgICAweEJBMDggfSwKKyAgICB7ICJNVFBfRk9STUFUX0FCU1RSQUNUX0FVRElPX1BMQVlMSVNUIiwgICAgICAgICAweEJBMDkgfSwKKyAgICB7ICJNVFBfRk9STUFUX0FCU1RSQUNUX1ZJREVPX1BMQVlMSVNUIiwgICAgICAgICAweEJBMEEgfSwKKyAgICB7ICJNVFBfRk9STUFUX0FCU1RSQUNUX01FRElBQ0FTVCIsICAgICAgICAgICAgICAweEJBMEIgfSwKKyAgICB7ICJNVFBfRk9STUFUX1dQTF9QTEFZTElTVCIsICAgICAgICAgICAgICAgICAgICAweEJBMTAgfSwKKyAgICB7ICJNVFBfRk9STUFUX00zVV9QTEFZTElTVCIsICAgICAgICAgICAgICAgICAgICAweEJBMTEgfSwKKyAgICB7ICJNVFBfRk9STUFUX01QTF9QTEFZTElTVCIsICAgICAgICAgICAgICAgICAgICAweEJBMTIgfSwKKyAgICB7ICJNVFBfRk9STUFUX0FTWF9QTEFZTElTVCIsICAgICAgICAgICAgICAgICAgICAweEJBMTMgfSwKKyAgICB7ICJNVFBfRk9STUFUX1BMU19QTEFZTElTVCIsICAgICAgICAgICAgICAgICAgICAweEJBMTQgfSwKKyAgICB7ICJNVFBfRk9STUFUX1VOREVGSU5FRF9ET0NVTUVOVCIsICAgICAgICAgICAgICAweEJBODAgfSwKKyAgICB7ICJNVFBfRk9STUFUX0FCU1RSQUNUX0RPQ1VNRU5UIiwgICAgICAgICAgICAgICAweEJBODEgfSwKKyAgICB7ICJNVFBfRk9STUFUX1hNTF9ET0NVTUVOVCIsICAgICAgICAgICAgICAgICAgICAweEJBODIgfSwKKyAgICB7ICJNVFBfRk9STUFUX01TX1dPUkRfRE9DVU1FTlQiLCAgICAgICAgICAgICAgICAweEJBODMgfSwKKyAgICB7ICJNVFBfRk9STUFUX01IVF9DT01QSUxFRF9IVE1MX0RPQ1VNRU5UIiwgICAgICAweEJBODQgfSwKKyAgICB7ICJNVFBfRk9STUFUX01TX0VYQ0VMX1NQUkVBRFNIRUVUIiwgICAgICAgICAgICAweEJBODUgfSwKKyAgICB7ICJNVFBfRk9STUFUX01TX1BPV0VSUE9JTlRfUFJFU0VOVEFUSU9OIiwgICAgICAweEJBODYgfSwKKyAgICB7ICJNVFBfRk9STUFUX1VOREVGSU5FRF9NRVNTQUdFIiwgICAgICAgICAgICAgICAweEJCMDAgfSwKKyAgICB7ICJNVFBfRk9STUFUX0FCU1RSQUNUX01FU1NTQUdFIiwgICAgICAgICAgICAgICAweEJCMDEgfSwKKyAgICB7ICJNVFBfRk9STUFUX1VOREVGSU5FRF9DT05UQUNUIiwgICAgICAgICAgICAgICAweEJCODAgfSwKKyAgICB7ICJNVFBfRk9STUFUX0FCU1RSQUNUX0NPTlRBQ1QiLCAgICAgICAgICAgICAgICAweEJCODEgfSwKKyAgICB7ICJNVFBfRk9STUFUX1ZDQVJEXzIiLCAgICAgICAgICAgICAgICAgICAgICAgICAweEJCODIgfSwKKyAgICB7IDAsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwICAgICAgfSwKK307CisKK3N0YXRpYyBjb25zdCBDb2RlRW50cnkgc09iamVjdFByb3BDb2Rlc1tdID0geworICAgIHsgIk1UUF9QUk9QRVJUWV9TVE9SQUdFX0lEIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REMwMSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9PQkpFQ1RfRk9STUFUIiwgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REMwMiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QUk9URUNUSU9OX1NUQVRVUyIsICAgICAgICAgICAgICAgICAgICAgIDB4REMwMyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9PQkpFQ1RfU0laRSIsICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REMwNCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9BU1NPQ0lBVElPTl9UWVBFIiwgICAgICAgICAgICAgICAgICAgICAgIDB4REMwNSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9BU1NPQ0lBVElPTl9ERVNDIiwgICAgICAgICAgICAgICAgICAgICAgIDB4REMwNiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9PQkpFQ1RfRklMRV9OQU1FIiwgICAgICAgICAgICAgICAgICAgICAgIDB4REMwNyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9EQVRFX0NSRUFURUQiLCAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REMwOCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9EQVRFX01PRElGSUVEIiwgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REMwOSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9LRVlXT1JEUyIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REMwQSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QQVJFTlRfT0JKRUNUIiwgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REMwQiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9BTExPV0VEX0ZPTERFUl9DT05URU5UUyIsICAgICAgICAgICAgICAgIDB4REMwQyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9ISURERU4iLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REMwRCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9TWVNURU1fT0JKRUNUIiwgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REMwRSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QRVJTSVNURU5UX1VJRCIsICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM0MSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9TWU5DX0lEIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM0MiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QUk9QRVJUWV9CQUciLCAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM0MyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9OQU1FIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM0NCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9DUkVBVEVEX0JZIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM0NSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9BUlRJU1QiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM0NiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9EQVRFX0FVVEhPUkVEIiwgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM0NyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9ERVNDUklQVElPTiIsICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM0OCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9VUkxfUkVGRVJFTkNFIiwgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM0OSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9MQU5HVUFHRV9MT0NBTEUiLCAgICAgICAgICAgICAgICAgICAgICAgIDB4REM0QSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9DT1BZUklHSFRfSU5GT1JNQVRJT04iLCAgICAgICAgICAgICAgICAgIDB4REM0QiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9TT1VSQ0UiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM0QyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9PUklHSU5fTE9DQVRJT04iLCAgICAgICAgICAgICAgICAgICAgICAgIDB4REM0RCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9EQVRFX0FEREVEIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM0RSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9OT05fQ09OU1VNQUJMRSIsICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM0RiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9DT1JSVVBUX1VOUExBWUFCTEUiLCAgICAgICAgICAgICAgICAgICAgIDB4REM1MCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QUk9EVUNFUl9TRVJJQUxfTlVNQkVSIiwgICAgICAgICAgICAgICAgIDB4REM1MSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9SRVBSRVNFTlRBVElWRV9TQU1QTEVfRk9STUFUIiwgICAgICAgICAgIDB4REM4MSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9SRVBSRVNFTlRBVElWRV9TQU1QTEVfU0laRSIsICAgICAgICAgICAgIDB4REM4MiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9SRVBSRVNFTlRBVElWRV9TQU1QTEVfSEVJR0hUIiwgICAgICAgICAgIDB4REM4MyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9SRVBSRVNFTlRBVElWRV9TQU1QTEVfV0lEVEgiLCAgICAgICAgICAgIDB4REM4NCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9SRVBSRVNFTlRBVElWRV9TQU1QTEVfRFVSQVRJT04iLCAgICAgICAgIDB4REM4NSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9SRVBSRVNFTlRBVElWRV9TQU1QTEVfREFUQSIsICAgICAgICAgICAgIDB4REM4NiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9XSURUSCIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM4NyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9IRUlHSFQiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM4OCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9EVVJBVElPTiIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM4OSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9SQVRJTkciLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM4QSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9UUkFDSyIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM4QiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9HRU5SRSIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM4QyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9DUkVESVRTIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM4RCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9MWVJJQ1MiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM4RSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9TVUJTQ1JJUFRJT05fQ09OVEVOVF9JRCIsICAgICAgICAgICAgICAgIDB4REM4RiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QUk9EVUNFRF9CWSIsICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM5MCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9VU0VfQ09VTlQiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM5MSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9TS0lQX0NPVU5UIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM5MiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9MQVNUX0FDQ0VTU0VEIiwgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM5MyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QQVJFTlRBTF9SQVRJTkciLCAgICAgICAgICAgICAgICAgICAgICAgIDB4REM5NCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9NRVRBX0dFTlJFIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM5NSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9DT01QT1NFUiIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM5NiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9FRkZFQ1RJVkVfUkFUSU5HIiwgICAgICAgICAgICAgICAgICAgICAgIDB4REM5NyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9TVUJUSVRMRSIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM5OCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9PUklHSU5BTF9SRUxFQVNFX0RBVEUiLCAgICAgICAgICAgICAgICAgIDB4REM5OSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9BTEJVTV9OQU1FIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM5QSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9BTEJVTV9BUlRJU1QiLCAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM5QiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9NT09EIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM5QyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9EUk1fU1RBVFVTIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM5RCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9TVUJfREVTQ1JJUFRJT04iLCAgICAgICAgICAgICAgICAgICAgICAgIDB4REM5RSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9JU19DUk9QUEVEIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4RENEMSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9JU19DT0xPVVJfQ09SUkVDVEVEIiwgICAgICAgICAgICAgICAgICAgIDB4RENEMiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9JTUFHRV9CSVRfREVQVEgiLCAgICAgICAgICAgICAgICAgICAgICAgIDB4RENEMyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9GX05VTUJFUiIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4RENENCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9FWFBPU1VSRV9USU1FIiwgICAgICAgICAgICAgICAgICAgICAgICAgIDB4RENENSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9FWFBPU1VSRV9JTkRFWCIsICAgICAgICAgICAgICAgICAgICAgICAgIDB4RENENiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9UT1RBTF9CSVRSQVRFIiwgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REU5MSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9CSVRSQVRFX1RZUEUiLCAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REU5MiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9TQU1QTEVfUkFURSIsICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REU5MyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9OVU1CRVJfT0ZfQ0hBTk5FTFMiLCAgICAgICAgICAgICAgICAgICAgIDB4REU5NCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9BVURJT19CSVRfREVQVEgiLCAgICAgICAgICAgICAgICAgICAgICAgIDB4REU5NSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9TQ0FOX1RZUEUiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REU5NyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9BVURJT19XQVZFX0NPREVDIiwgICAgICAgICAgICAgICAgICAgICAgIDB4REU5OSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9BVURJT19CSVRSQVRFIiwgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REU5QSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9WSURFT19GT1VSQ0NfQ09ERUMiLCAgICAgICAgICAgICAgICAgICAgIDB4REU5QiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9WSURFT19CSVRSQVRFIiwgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REU5QyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9GUkFNRVNfUEVSX1RIT1VTQU5EX1NFQ09ORFMiLCAgICAgICAgICAgIDB4REU5RCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9LRVlGUkFNRV9ESVNUQU5DRSIsICAgICAgICAgICAgICAgICAgICAgIDB4REU5RSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9CVUZGRVJfU0laRSIsICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REU5RiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9FTkNPRElOR19RVUFMSVRZIiwgICAgICAgICAgICAgICAgICAgICAgIDB4REVBMCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9FTkNPRElOR19QUk9GSUxFIiwgICAgICAgICAgICAgICAgICAgICAgIDB4REVBMSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9ESVNQTEFZX05BTUUiLCAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4RENFMCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9CT0RZX1RFWFQiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4RENFMSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9TVUJKRUNUIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4RENFMiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QUklPUklUWSIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4RENFMyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9HSVZFTl9OQU1FIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQwMCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9NSURETEVfTkFNRVMiLCAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQwMSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9GQU1JTFlfTkFNRSIsICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQwMiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QUkVGSVgiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQwMyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9TVUZGSVgiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQwNCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QSE9ORVRJQ19HSVZFTl9OQU1FIiwgICAgICAgICAgICAgICAgICAgIDB4REQwNSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QSE9ORVRJQ19GQU1JTFlfTkFNRSIsICAgICAgICAgICAgICAgICAgIDB4REQwNiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9FTUFJTF9QUklNQVJZIiwgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQwNyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9FTUFJTF9QRVJTT05BTF8xIiwgICAgICAgICAgICAgICAgICAgICAgIDB4REQwOCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9FTUFJTF9QRVJTT05BTF8yIiwgICAgICAgICAgICAgICAgICAgICAgIDB4REQwOSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9FTUFJTF9CVVNJTkVTU18xIiwgICAgICAgICAgICAgICAgICAgICAgIDB4REQwQSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9FTUFJTF9CVVNJTkVTU18yIiwgICAgICAgICAgICAgICAgICAgICAgIDB4REQwQiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9FTUFJTF9PVEhFUlMiLCAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQwQyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QSE9ORV9OVU1CRVJfUFJJTUFSWSIsICAgICAgICAgICAgICAgICAgIDB4REQwRCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QSE9ORV9OVU1CRVJfUEVSU09OQUwiLCAgICAgICAgICAgICAgICAgIDB4REQwRSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QSE9ORV9OVU1CRVJfUEVSU09OQUxfMiIsICAgICAgICAgICAgICAgIDB4REQwRiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QSE9ORV9OVU1CRVJfQlVTSU5FU1MiLCAgICAgICAgICAgICAgICAgIDB4REQxMCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QSE9ORV9OVU1CRVJfQlVTSU5FU1NfMiIsICAgICAgICAgICAgICAgIDB4REQxMSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QSE9ORV9OVU1CRVJfTU9CSUxFIiwgICAgICAgICAgICAgICAgICAgIDB4REQxMiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QSE9ORV9OVU1CRVJfTU9CSUxFXzIiLCAgICAgICAgICAgICAgICAgIDB4REQxMyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9GQVhfTlVNQkVSX1BSSU1BUlkiLCAgICAgICAgICAgICAgICAgICAgIDB4REQxNCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9GQVhfTlVNQkVSX1BFUlNPTkFMIiwgICAgICAgICAgICAgICAgICAgIDB4REQxNSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9GQVhfTlVNQkVSX0JVU0lORVNTIiwgICAgICAgICAgICAgICAgICAgIDB4REQxNiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QQUdFUl9OVU1CRVIiLCAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQxNyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QSE9ORV9OVU1CRVJfT1RIRVJTIiwgICAgICAgICAgICAgICAgICAgIDB4REQxOCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QUklNQVJZX1dFQl9BRERSRVNTIiwgICAgICAgICAgICAgICAgICAgIDB4REQxOSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QRVJTT05BTF9XRUJfQUREUkVTUyIsICAgICAgICAgICAgICAgICAgIDB4REQxQSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9CVVNJTkVTU19XRUJfQUREUkVTUyIsICAgICAgICAgICAgICAgICAgIDB4REQxQiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9JTlNUQU5UX01FU1NBTkdFUl9BRERSRVNTIiwgICAgICAgICAgICAgIDB4REQxQyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9JTlNUQU5UX01FU1NBTkdFUl9BRERSRVNTXzIiLCAgICAgICAgICAgIDB4REQxRCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9JTlNUQU5UX01FU1NBTkdFUl9BRERSRVNTXzMiLCAgICAgICAgICAgIDB4REQxRSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QT1NUQUxfQUREUkVTU19QRVJTT05BTF9GVUxMIiwgICAgICAgICAgIDB4REQxRiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QT1NUQUxfQUREUkVTU19QRVJTT05BTF9MSU5FXzEiLCAgICAgICAgIDB4REQyMCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QT1NUQ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IHsgIk1UUF9QUk9QRVJUWV9QT1NUQUxfQUREUkVTU19PVEhFUl9GVUxMIiwgICAgICAgICAgICAgIDB4REQyRCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QT1NUQUxfQUREUkVTU19PVEhFUl9MSU5FXzEiLCAgICAgICAgICAgIDB4REQyRSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QT1NUQUxfQUREUkVTU19PVEhFUl9MSU5FXzIiLCAgICAgICAgICAgIDB4REQyRiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QT1NUQUxfQUREUkVTU19PVEhFUl9DSVRZIiwgICAgICAgICAgICAgIDB4REQzMCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QT1NUQUxfQUREUkVTU19PVEhFUl9SRUdJT04iLCAgICAgICAgICAgIDB4REQzMSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QT1NUQUxfQUREUkVTU19PVEhFUl9QT1NUQUxfQ09ERSIsICAgICAgIDB4REQzMiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QT1NUQUxfQUREUkVTU19PVEhFUl9DT1VOVFJZIiwgICAgICAgICAgIDB4REQzMyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9PUkdBTklaQVRJT05fTkFNRSIsICAgICAgICAgICAgICAgICAgICAgIDB4REQzNCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QSE9ORVRJQ19PUkdBTklaQVRJT05fTkFNRSIsICAgICAgICAgICAgIDB4REQzNSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9ST0xFIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQzNiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9CSVJUSERBVEUiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQzNyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9NRVNTQUdFX1RPIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQ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AgICAgICAgICAgICAgICAgIDB4REQ1NyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9BQ1RJVklUWV9URU5UQVRJVkUiLCAgICAgICAgICAgICAgICAgICAgIDB4REQ1OCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9BQ1RJVklUWV9ERUNMSU5FRCIsICAgICAgICAgICAgICAgICAgICAgIDB4REQ1OSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9BQ1RJVklUWV9SRU1BSU5ERVJfVElNRSIsICAgICAgICAgICAgICAgIDB4REQ1QSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9BQ1RJVklUWV9PV05FUiIsICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQ1QiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9BQ1RJVklUWV9TVEFUVVMiLCAgICAgICAgICAgICAgICAgICAgICAgIDB4REQ1QyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9PV05FUiIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQ1RCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9FRElUT1IiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQ1RSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9XRUJNQVNURVIiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQ1RiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9VUkxfU09VUkNFIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQ2MCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9VUkxfREVTVElOQVRJT04iLCAgICAgICAgICAgICAgICAgICAgICAgIDB4REQ2MSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9USU1FX0JPT0tNQVJLIiwgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQ2MiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9PQkpFQ1RfQk9PS01BUksiLCAgICAgICAgICAgICAgICAgICAgICAgIDB4REQ2MyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9CWVRFX0JPT0tNQVJLIiwgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQ2NCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9MQVNUX0JVSUxEX0RBVEUiLCAgICAgICAgICAgICAgICAgICAgICAgIDB4REQ3MCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9USU1FX1RPX0xJVkUiLCAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQ3MSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9NRURJQV9HVUlEIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQ3MiB9LAorICAgIHsgMCwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAgICAgICB9LAorfTsKKworc3RhdGljIGNvbnN0IENvZGVFbnRyeSBzRGV2aWNlUHJvcENvZGVzW10gPSB7CisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9VTkRFRklORUQiLCAgICAgICAgICAgICAgICAgICAgICAgMHg1MDAwIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9CQVRURVJZX0xFVkVMIiwgICAgICAgICAgICAgICAgICAgMHg1MDAxIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9GVU5DVElPTkFMX01PREUiLCAgICAgICAgICAgICAgICAgMHg1MDAyIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9JTUFHRV9TSVpFIiwgICAgICAgICAgICAgICAgICAgICAgMHg1MDAzIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9DT01QUkVTU0lPTl9TRVRUSU5HIiwgICAgICAgICAgICAgMHg1MDA0IH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9XSElURV9CQUxBTkNFIiwgICAgICAgICAgICAgICAgICAgMHg1MDA1IH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9SR0JfR0FJTiIsICAgICAgICAgICAgICAgICAgICAgICAgMHg1MDA2IH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9GX05VTUJFUiIsICAgICAgICAgICAgICAgICAgICAgICAgMHg1MDA3IH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9GT0NBTF9MRU5HVEgiLCAgICAgICAgICAgICAgICAgICAgMHg1MDA4IH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9GT0NVU19ESVNUQU5DRSIsICAgICAgICAgICAgICAgICAgMHg1MDA5IH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9GT0NVU19NT0RFIiwgICAgICAgICAgICAgICAgICAgICAgMHg1MDBBIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9FWFBPU1VSRV9NRVRFUklOR19NT0RFIiwgICAgICAgICAgMHg1MDBCIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9GTEFTSF9NT0RFIiwgICAgICAgICAgICAgICAgICAgICAgMHg1MDBDIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9FWFBPU1VSRV9USU1FIiwgICAgICAgICAgICAgICAgICAgMHg1MDBEIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9FWFBPU1VSRV9QUk9HUkFNX01PREUiLCAgICAgICAgICAgMHg1MDBFIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9FWFBPU1VSRV9JTkRFWCIsICAgICAgICAgICAgICAgICAgMHg1MDBGIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9FWFBPU1VSRV9CSUFTX0NPTVBFTlNBVElPTiIsICAgICAgMHg1MDEwIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9EQVRFVElNRSIsICAgICAgICAgICAgICAgICAgICAgICAgMHg1MDExIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9DQVBUVVJFX0RFTEFZIiwgICAgICAgICAgICAgICAgICAgMHg1MDEyIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9TVElMTF9DQVBUVVJFX01PREUiLCAgICAgICAgICAgICAgMHg1MDEzIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9DT05UUkFTVCIsICAgICAgICAgICAgICAgICAgICAgICAgMHg1MDE0IH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9TSEFSUE5FU1MiLCAgICAgICAgICAgICAgICAgICAgICAgMHg1MDE1IH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9ESUdJVEFMX1pPT00iLCAgICAgICAgICAgICAgICAgICAgMHg1MDE2IH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9FRkZFQ1RfTU9ERSIsICAgICAgICAgICAgICAgICAgICAgMHg1MDE3IH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9CVVJTVF9OVU1CRVIiLCAgICAgICAgICAgICAgICAgICAgMHg1MDE4IH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9CVVJTVF9JTlRFUlZBTCIsICAgICAgICAgICAgICAgICAgMHg1MDE5IH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9USU1FTEFQU0VfTlVNQkVSIiwgICAgICAgICAgICAgICAgMHg1MDFBIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9USU1FTEFQU0VfSU5URVJWQUwiLCAgICAgICAgICAgICAgMHg1MDFCIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9GT0NVU19NRVRFUklOR19NT0RFIiwgICAgICAgICAgICAgMHg1MDFDIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9VUExPQURfVVJMIiwgICAgICAgICAgICAgICAgICAgICAgMHg1MDFEIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9BUlRJU1QiLCAgICAgICAgICAgICAgICAgICAgICAgICAgMHg1MDFFIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9DT1BZUklHSFRfSU5GTyIsICAgICAgICAgICAgICAgICAgMHg1MDFGIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9TWU5DSFJPTklaQVRJT05fUEFSVE5FUiIsICAgICAgICAgMHhENDAxIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9ERVZJQ0VfRlJJRU5ETFlfTkFNRSIsICAgICAgICAgICAgMHhENDAyIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9WT0xVTUUiLCAgICAgICAgICAgICAgICAgICAgICAgICAgMHhENDAzIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9TVVBQT1JURURfRk9STUFUU19PUkRFUkVEIiwgICAgICAgMHhENDA0IH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9ERVZJQ0VfSUNPTiIsICAgICAgICAgICAgICAgICAgICAgMHhENDA1IH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9QTEFZQkFDS19SQVRFIiwgICAgICAgICAgICAgICAgICAgMHhENDEwIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9QTEFZQkFDS19PQkpFQ1QiLCAgICAgICAgICAgICAgICAgMHhENDExIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9QTEFZQkFDS19DT05UQUlORVJfSU5ERVgiLCAgICAgICAgMHhENDEyIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9TRVNTSU9OX0lOSVRJQVRPUl9WRVJTSU9OX0lORk8iLCAgMHhENDA2IH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9QRVJDRUlWRURfREVWSUNFX1RZUEUiLCAgICAgICAgICAgMHhENDA3IH0sCisgICAgeyAwLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMCAgICAgIH0sCit9OworCitzdGF0aWMgY29uc3QgY2hhciogZ2V0Q29kZU5hbWUodWludDE2X3QgY29kZSwgY29uc3QgQ29kZUVudHJ5KiB0YWJsZSkgeworICAgIGNvbnN0IENvZGVFbnRyeSogZW50cnkgPSB0YWJsZTsKKyAgICB3aGlsZSAoZW50cnktPm5hbWUpIHsKKyAgICAgICAgaWYgKGVudHJ5LT5jb2RlID09IGNvZGUpCisgICAgICAgICAgICByZXR1cm4gZW50cnktPm5hbWU7CisgICAgICAgIGVudHJ5Kys7CisgICAgfQorICAgIHJldHVybiAiVU5LTk9XTiI7Cit9CisKK2NvbnN0IGNoYXIqIE10cERlYnVnOjpnZXRPcGVyYXRpb25Db2RlTmFtZShNdHBPcGVyYXRpb25Db2RlIGNvZGUpIHsKKyAgICByZXR1cm4gZ2V0Q29kZU5hbWUoY29kZSwgc09wZXJhdGlvbkNvZGVzKTsKK30KKworY29uc3QgY2hhciogTXRwRGVidWc6OmdldEZvcm1hdENvZGVOYW1lKE10cE9wZXJhdGlvbkNvZGUgY29kZSkgeworICAgIHJldHVybiBnZXRDb2RlTmFtZShjb2RlLCBzRm9ybWF0Q29kZXMpOworfQorCitjb25zdCBjaGFyKiBNdHBEZWJ1Zzo6Z2V0T2JqZWN0UHJvcENvZGVOYW1lKE10cFByb3BlcnR5Q29kZSBjb2RlKSB7CisgICAgcmV0dXJuIGdldENvZGVOYW1lKGNvZGUsIHNPYmplY3RQcm9wQ29kZXMpOworfQorCitjb25zdCBjaGFyKiBNdHBEZWJ1Zzo6Z2V0RGV2aWNlUHJvcENvZGVOYW1lKE10cFByb3BlcnR5Q29kZSBjb2RlKSB7CisgICAgcmV0dXJuIGdldENvZGVOYW1lKGNvZGUsIHNEZXZpY2VQcm9wQ29kZXMpOworfQorCit9ICA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y9pb2N0bC5oPgorI2luY2x1ZGUgPHN5cy9zdGF0Lmg+CisjaW5jbHVkZSA8ZmNudGwuaD4KKyNpbmNsdWRlIDxlcnJuby5oPgorI2luY2x1ZGUgPGVuZGlhbi5oPgorCisjaW5jbHVkZSA8dXNiaG9zdC91c2Job3N0Lmg+CisKK25hbWVzcGFjZSBhbmRyb2lkIHsKKworTXRwRGV2aWNlOjpNdHBEZXZpY2Uoc3RydWN0IHVzYl9kZXZpY2UqIGRldmljZSwgaW50IGludGVyZmFjZSwKKyAgICAgICAgICAgIHN0cnVjdCB1c2JfZW5kcG9pbnQgKmVwX2luLCBzdHJ1Y3QgdXNiX2VuZHBvaW50ICplcF9vdXQsCisgICAgICAgICAgICBzdHJ1Y3QgdXNiX2VuZHBvaW50ICplcF9pbnRyKQorICAgIDogICBtRGV2aWNlKGRldmljZSksCisgICAgICAgIG1JbnRlcmZhY2UoaW50ZXJmYWNlKSwKKyAgICAgICAgbUVuZHBvaW50SW4oZXBfaW4pLAorICAgICAgICBtRW5kcG9pbnRPdXQoZXBfb3V0KSwKKyAgICAgICAgbUVuZHBvaW50SW50cihlcF9pbnRyKSwKKyAgICAgICAgbURldmljZUluZm8oTlVMTCksCisgICAgICAgIG1JRCh1c2JfZGV2aWNlX2dldF91bmlxdWVfaWQoZGV2aWNlKSksCisgICAgICAgIG1TZXNzaW9uSUQoMCksCisgICAgICAgIG1UcmFuc2FjdGlvbklEKDApCit7Cit9CisKK010cERldmljZTo6fk10cERldmljZSgpIHsKKyAgICBjbG9zZSgpOworICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbURldmljZVByb3BlcnRpZXMuc2l6ZSgpOyBpKyspCisgICAgICAgIGRlbGV0ZSBtRGV2aWNlUHJvcGVydGllc1tpXTsKK30KKwordm9pZCBNdHBEZXZpY2U6OmluaXRpYWxpemUoKSB7CisgICAgb3BlblNlc3Npb24oKTsKKyAgICBtRGV2aWNlSW5mbyA9IGdldERldmljZUluZm8oKTsKKyAgICBpZiAobURldmljZUluZm8pIHsKKyAgICAgICAgbURldmljZUluZm8tPnByaW50KCk7CisKKyAgICAgICAgaWYgKG1EZXZpY2VJbmZvLT5tRGV2aWNlUHJvcGVydGllcykgeworICAgICAgICAgICAgaW50IGNvdW50ID0gbURldmljZUluZm8tPm1EZXZpY2VQcm9wZXJ0aWVzLT5zaXplKCk7CisgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGNvdW50OyBpKyspIHsKKyAgICAgICAgICAgICAgICBNdHBEZXZpY2VQcm9wZXJ0eSBwcm9wQ29kZSA9ICgqbURldmljZUluZm8tPm1EZXZpY2VQcm9wZXJ0aWVzKVtpXTsKKyAgICAgICAgICAgICAgICBNdHBQcm9wZXJ0eSogcHJvcGVydHkgPSBnZXREZXZpY2VQcm9wRGVzYyhwcm9wQ29kZSk7CisgICAgICAgICAgICAgICAgaWYgKHByb3BlcnR5KSB7CisgICAgICAgICAgICAgICAgICAgIHByb3BlcnR5LT5wcmludCgpOworICAgICAgICAgICAgICAgICAgICBtRGV2aWNlUHJvcGVydGllcy5wdXNoKHByb3BlcnR5KTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9Cit9CisKK3ZvaWQgTXRwRGV2aWNlOjpjbG9zZSgpIHsKKyAgICBpZiAobURldmljZSkgeworICAgICAgICB1c2JfZGV2aWNlX3JlbGVhc2VfaW50ZXJmYWNlKG1EZXZpY2UsIG1JbnRlcmZhY2UpOworICAgICAgICB1c2JfZGV2aWNlX2Nsb3NlKG1EZXZpY2UpOworICAgICAgICBtRGV2aWNlID0gTlVMTDsKKyAgICB9Cit9CisKK2NvbnN0IGNoYXIqIE10cERldmljZTo6Z2V0RGV2aWNlTmFtZSgpIHsKKyAgICBpZiAobURldmljZSkKKyAgICAgICAgcmV0dXJuIHVzYl9kZXZpY2VfZ2V0X25hbWUobURldmljZSk7CisgICAgZWxzZQorICAgICAgICByZXR1cm4gIj8/PyI7Cit9CisKK2J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AgICBpZiAoIXJlYWREYXRhKCkpCisgICAgICAgIHJldHVybiBOVUxMOworICAgIE10cFJlc3BvbnNlQ29kZSByZXQgPSByZWFkUmVzcG9uc2UoKTsKKyAgICBpZiAocmV0ID09IE1UUF9SRVNQT05TRV9PSykgeworICAgICAgICBNdHBEZXZpY2VJbmZvKiBpbmZvID0gbmV3IE10cERldmljZUluZm87CisgICAgICAgIGluZm8tPnJlYWQobURhdGEpOworICAgICAgICByZXR1cm4gaW5mbzsKKyAgICB9CisgICAgcmV0dXJuIE5VTEw7Cit9CisKK010cFN0b3JhZ2VJRExpc3QqIE10cERldmljZTo6Z2V0U3RvcmFnZUlEcygpIHsKKyAgICBNdXRleDo6QXV0b2xvY2sgYXV0b0xvY2sobU11dGV4KTsKKworICAgIG1SZXF1ZXN0LnJlc2V0KCk7CisgICAgaWYgKCFzZW5kUmVxdWVzdChNVFBfT1BFUkFUSU9OX0dFVF9TVE9SQUdFX0lEUykpCisgICAgICAgIHJldHVybiBOVUxMOworICAgIGlmICghcmVhZERhdGEoKSkKKyAgICAgICAgcmV0dXJuIE5VTEw7CisgICAgTXRwUmVzcG9uc2VDb2RlIHJldCA9IHJlYWRSZXNwb25zZSgpOworICAgIGlmIChyZXQgPT0gTVRQX1JFU1BPTlNFX09LKSB7CisgICAgICAgIHJldHVybiBtRGF0YS5nZXRBVUludDMyKCk7CisgICAgfQorICAgIHJldHVybiBOVUxMOworfQorCitNdHBTdG9yYWdlSW5mbyogTXRwRGV2aWNlOjpnZXRTdG9yYWdlSW5mbyhNdHBTdG9yYWdlSUQgc3RvcmFnZUlEKSB7CisgICAgTXV0ZXg6OkF1dG9sb2NrIGF1dG9Mb2NrKG1NdXRleCk7CisKKyAgICBtUmVxdWVzdC5yZXNldCgpOworICAgIG1SZXF1ZXN0LnNldFBhcmFtZXRlcigxLCBzdG9yYWdlSUQpOworICAgIGlmICghc2VuZFJlcXVlc3QoTVRQX09QRVJBVElPTl9HRVRfU1RPUkFHRV9JTkZPKSk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TsKKyAgICAgICAgaWYgKHJldCA9PSBNVFBfUkVTUE9OU0VfT0spIHsKKyAgICAgICAgICAgIGluZm8tPm1TdG9yYWdlSUQgPSBtUmVzcG9uc2UuZ2V0UGFyYW1ldGVyKDEpOworICAgICAgICAgICAgaW5mby0+bVBhcmVudCA9IG1SZXNwb25zZS5nZXRQYXJhbWV0ZXIoMik7CisgICAgICAgICAgICBpbmZvLT5tSGFuZGxlID0gbVJlc3BvbnNlLmdldFBhcmFtZXRlcigzKTsKKyAgICAgICAgICAgIHJldHVybiBpbmZvLT5tSGFuZGxlOworICAgICAgICB9CisgICAgfQorICAgIHJldHVybiAoTXRwT2JqZWN0SGFuZGxlKS0xOworfQorCitib29sIE10cERldmljZTo6c2VuZE9iamVjdChNdHBPYmplY3RJbmZvKiBpbmZvLCBpbnQgc3JjRkQpIHsKKyAgICBNdXRleDo6QXV0b2xvY2sgYXV0b0xvY2sobU11dGV4KTsKKworICAgIGludCByZW1haW5pbmcgPSBpbmZvLT5tQ29tcHJlc3NlZFNpemU7CisgICAgbVJlcXVlc3QucmVzZXQoKTsKKyAgICBtUmVxdWVzdC5zZXRQYXJhbWV0ZXIoMSwgaW5mby0+bUhhbmRsZSk7CisgICAgaWYgKHNlbmRSZXF1ZXN0KE1UUF9PUEVSQVRJT05fU0VORF9PQkpFQ1QpKSB7CisgICAgICAgIC8vIHNlbmQgZGF0YSBoZWFkZXIKKyAgICAgICAgd3JpdGVEYXRhSGVhZGVyKE1UUF9PUEVSQVRJT05fU0VORF9PQkpFQ1QsIHJlbWFpbmluZyk7CisKKyAgICAgICAgY2hhciBidWZmZXJbNjU1MzZdOworICAgICAgICB3aGlsZSAocmVtYWluaW5nID4gMCkgeworICAgICAgICAgICAgaW50IGNvdW50ID0gcmVhZChzcmNGRCwgYnVmZmVyLCBzaXplb2YoYnVmZmVyKSk7CisgICAgICAgICAgICBpZiAoY291bnQgPiAwKSB7CisgICAgICAgICAgICAgICAgaW50IHdyaXR0ZW4gPSBtRGF0YS53cml0ZShtRW5kcG9pbnRPdXQsIGJ1ZmZlciwgY291bnQpOworICAgICAgICAgICAgICAgIC8vIEZJWE1FIGNoZWNrIGVycm9yCisgICAgICAgICAgICAgICAgcmVtYWluaW5nIC09IGNvdW50OworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKyAgICBNdHBSZXNwb25zZUNvZGUgcmV0ID0gcmVhZFJlc3BvbnNlKCk7CisgICAgcmV0dXJuIChyZW1haW5pbmcgPT0gMCAmJiByZXQgPT0gTVRQX1JFU1BPTlNFX09LKTsKK30KKworYm9vbCBNdHBEZXZpY2U6OmRlbGV0ZU9iamVjdChNdHBPYmplY3RIYW5kbGUgaGFuZGxlKSB7CisgICAgTXV0ZXg6OkF1dG9sb2NrIGF1dG9Mb2NrKG1NdXRleCk7CisKKyAgICBtUmVxdWVzdC5yZXNldCgpOworICAgIG1SZXF1ZXN0LnNldFBhcmFtZXRlcigxLCBoYW5kbGUpOworICAgIGlmIChzZW5kUmVxdWVzdChNVFBfT1BFUkFUSU9OX0RFTEVURV9PQkpFQ1QpKSB7CisgICAgICAgIE10cFJlc3BvbnNlQ29kZSByZXQgPSByZWFkUmVzcG9uc2UoKTsKKyAgICAgICAgaWYgKHJldCA9PSBNVFBfUkVTUE9OU0VfT0spCisgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICB9CisgICAgcmV0dXJuIGZhbHNlOworfQorCitNdHBPYmplY3RIYW5kbGUgTXRwRGV2aWNlOjpnZXRQYXJlbnQoTXRwT2JqZWN0SGFuZGxlIGhhbmRsZSkgeworICAgIE10cE9iamVjdEluZm8qIGluZm8gPSBnZXRPYmplY3RJbmZvKGhhbmRsZSk7CisgICAgaWYgKGluZm8pCisgICAgICAgIHJldHVybiBpbmZvLT5tUGFyZW50OworICAgIGVsc2UKKyAgICAgICAgcmV0dXJuIC0xOworfQorCitNdHBPYmplY3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ICAgICAgICAgICAgbU9iamVjdFNpemU7CisgICAgdm9pZCogICAgICAgICAgICAgICBtSW5pdGlhbERhdGE7CisgICAgaW50ICAgICAgICAgICAgICAgICBtSW5pdGlhbERhdGFMZW5ndGg7CisgICAgaW50ICAgICAgICAgICAgICAgICBtRkQ7CisKK3B1YmxpYzoKKyAgICBSZWFkT2JqZWN0VGhyZWFkKE10cERldmljZSogZGV2aWNlLCBNdHBPYmplY3RIYW5kbGUgaGFuZGxlLCBpbnQgb2JqZWN0U2l6ZSkKKyAgICAgICAgOiBtRGV2aWNlKGRldmljZSksCisgICAgICAgICAgbUhhbmRsZShoYW5kbGUpLAorICAgICAgICAgIG1PYmplY3RTaXplKG9iamVjdFNpemUpLAorICAgICAgICAgIG1Jbml0aWFsRGF0YShOVUxMKSwKKyAgICAgICAgICBtSW5pdGlhbERhdGFMZW5ndGgoMCkKKyAgICB7CisgICAgfQorCisgICAgdmlydHVhbCB+UmVhZE9iamVjdFRocmVhZCgpIHsKKyAgICAgICAgaWYgKG1GRCA+PSAwKQorICAgICAgICAgICAgY2xvc2UobUZEKTsKKyAgICAgICAgZnJlZShtSW5pdGlhbERhdGEpOworICAgIH0KKworICAgIC8vIHJldHVybnMgZmlsZSBkZXNjcmlwdG9yCisgICAgaW50IGluaXQoKSB7CisgICAgICAgIG1EZXZpY2UtPm1SZXF1ZXN0LnJlc2V0KCk7CisgICAgICAgIG1EZXZpY2UtPm1SZXF1ZXN0LnNldFBhcmFtZXRlcigxLCBtSGFuZGxlKTsKKyAgICAgICAgaWYgKG1EZXZpY2UtPnNlbmRSZXF1ZXN0KE1UUF9PUEVSQVRJT05fR0VUX09CSkVDVCkKKyAgICAgICAgICAgICAgICAmJiBtRGV2aWNlLT5tRGF0YS5yZWFkRGF0YUhlYWRlcihtRGV2aWNlLT5tRW5kcG9pbnRJbikpIHsKKworICAgICAgICAgICAgLy8gbURhdGEgd2lsbCBjb250YWluIGhlYWRlciBhbmQgcG9zc2libHkgdGhlIGJlZ2lubmluZyBvZiB0aGUgb2JqZWN0IGRhdGEKKyAgICAgICAgICAgIG1Jbml0aWFsRGF0YSA9IG1EZXZpY2UtPm1EYXRhLmdldERhdGEobUluaXRpYWxEYXRhTGVuZ3RoKTsKKworICAgICAgICAgICAgLy8gY3JlYXRlIGEgcGlwZSBmb3IgdGhlIGNsaWVudCB0byByZWFkIGZyb20KKyAgICAgICAgICAgIGludCBwaXBlZmRbMl07CisgICAgICAgICAgICBpZiAocGlwZShwaXBlZmQpIDwgMCkgeworICAgICAgICAgICAgICAgIExPR0UoInBpcGUgZmFpbGVkICglcykiLCBzdHJlcnJvcihlcnJubykpOworICAgICAgICAgICAgICAgIHJldHVybiAtMTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgbUZEID0gcGlwZWZkWzFdOworICAgICAgICAgICAgcmV0dXJuIHBpcGVmZFswXTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgcmV0dXJuIC0xOworICAgICAgICB9CisgICAgfQorCisgICAgdmlydHVhbCBib29sIHRocmVhZExvb3AoKSB7CisgICAgICAgIGludCByZW1haW5pbmcgPSBtT2JqZWN0U2l6ZTsKKyAgICAgICAgaWYgKG1Jbml0aWFsRGF0YSkgeworICAgICAgICAgICAgd3JpdGUobUZELCBtSW5pdGlhbERhdGEsIG1Jbml0aWFsRGF0YUxlbmd0aCk7CisgICAgICAgICAgICByZW1haW5pbmcgLT0gbUluaXRpYWxEYXRhTGVuZ3RoOworICAgICAgICAgICAgZnJlZShtSW5pdGlhbERhdGEpOworICAgICAgICAgICAgbUluaXRpYWxEYXRhID0gTlVMTDsKKyAgICAgICAgfQorCisgICAgICAgIGNoYXIgYnVmZmVyWzE2Mzg0XTsKKyAgICAgICAgd2hpbGUgKHJlbWFpbmluZyA+IDApIHsKKyAgICAgICAgICAgIGludCByZWFkU2l6ZSA9IChyZW1haW5pbmcgPiBzaXplb2YoYnVmZmVyKSA/IHNpemVvZihidWZmZXIpIDogcmVtYWluaW5nKTsKKyAgICAgICAgICAgIGludCBjb3VudCA9IG1EZXZpY2UtPm1EYXRhLnJlYWREYXRhKG1EZXZpY2UtPm1FbmRwb2ludEluLCBidWZmZXIsIHJlYWRTaXplKTsKKyAgICAgICAgICAgIGludCB3cml0dGVuOworICAgICAgICAgICAgaWYgKGNvdW50ID49IDApIHsKKyAgICAgICAgICAgICAgICBpbnQgd3JpdHRlbiA9IHdyaXRlKG1GRCwgYnVmZmVyLCBjb3VudCk7CisgICAgICAgICAgICAgICAgLy8gRklYTUUgY2hlY2sgZXJyb3IKKyAgICAgICAgICAgICAgICByZW1haW5pbmcgLT0gY291bnQ7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgTXRwUmVzcG9uc2VDb2RlIHJldCA9IG1EZXZpY2UtPnJlYWRSZXNwb25zZSgpOworICAgICAgICBtRGV2aWNlLT5tTXV0ZXgudW5sb2NrKCk7CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9Cit9OworCisgICAgLy8gcmV0dXJucyB0aGUgZmlsZSBkZXNjcmlwdG9yIGZvciBhIHBpcGUgdG8gcmVhZCB0aGUgb2JqZWN0J3MgZGF0YQoraW50IE10cERldmljZTo6cmVhZE9iamVjdChNdHBPYmplY3RIYW5kbGUgaGFuZGxlLCBpbnQgb2JqZWN0U2l6ZSkgeworICAgIG1NdXRleC5sb2NrKCk7CisKKyAgICBSZWFkT2JqZWN0VGhyZWFkKiB0aHJlYWQgPSBuZXcgUmVhZE9iamVjdFRocmVhZCh0aGlzLCBoYW5kbGUsIG9iamVjdFNpemUpOworICAgIGludCBmZCA9IHRocmVhZC0+aW5pdCgpOworICAgIGlmIChmZCA8IDApIHsKKyAgICAgICAgZGVsZXRlIHRocmVhZDsKKyAgICAgICAgbU11dGV4LnVubG9jaygpOworICAgIH0gZWxzZSB7CisgICAgICAgIHRocmVhZC0+cnVuKCJSZWFkT2JqZWN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UmVzcG9uc2VQYWNrZXQuaCIKKyNpbmNsdWRlICJNdHBUeXBlcy5oIgorCisjaW5jbHVkZSA8dXRpbHMvdGhyZWFkcy5oPgorCitzdHJ1Y3QgdXNiX2RldmljZTsKKworbmFtZXNwYWNlIGFuZHJvaWQgeworCitjbGFzcyBNdHBEZXZpY2VJbmZvOworY2xhc3MgTXRwT2JqZWN0SW5mbzsKK2NsYXNzIE10cFN0b3JhZ2VJbmZvOworCitjbGFzcyBNdHBEZXZpY2UgeworcHJpdmF0ZToKKyAgICBzdHJ1Y3QgdXNiX2RldmljZSogICAgICBtRGV2aWNlOworICAgIGludCAgICAgICAgICAgICAgICAgICAgIG1JbnRlcmZhY2U7CisgICAgc3RydWN0IHVzYl9lbmRwb2ludCogICAgbUVuZHBvaW50SW47CisgICAgc3RydWN0IHVzYl9lbmRwb2ludCogICAgbUVuZHBvaW50T3V0OworICAgIHN0cnVjdCB1c2JfZW5kcG9pbnQqICAgIG1FbmRwb2ludEludHI7CisgICAgTXRwRGV2aWNlSW5mbyogICAgICAgICAgbURldmljZUluZm87CisgICAgTXRwUHJvcGVydHlMaXN0ICAgICAgICAgbURldmljZVByb3BlcnRpZXM7CisKKyAgICAvLyBhIHVuaXF1ZSBJRCBmb3IgdGhlIGRldmljZQorICAgIGludCAgICAgICAgICAgICAgICAgICAgIG1JRDsKKworICAgIC8vIGN1cnJlbnQgc2Vzc2lvbiBJRAorICAgIE10cFNlc3Npb25JRCAgICAgICAgICAgIG1TZXNzaW9uSUQ7CisgICAgLy8gY3VycmVudCB0cmFuc2FjdGlvbiBJRAorICAgIE10cFRyYW5zYWN0aW9uSUQgICAgICAgIG1UcmFuc2FjdGlvbklEOworCisgICAgTXRwUmVxdWVzdFBhY2tldCAgICAgICAgbVJlcXVlc3Q7CisgICAgTXRwRGF0YVBhY2tldCAgICAgICAgICAgbURhdGE7CisgICAgTXRwUmVzcG9uc2VQYWNrZXQgICAgICAgbVJlc3BvbnNlOworCisgICAgLy8gdG8gZW5zdXJlIG9ubHkgb25lIE1UUCB0cmFuc2FjdGlvbiBhdCBhIHRpbWUKKyAgICBNdXRleCAgICAgICAgICAgICAgICAgICBtTXV0ZXg7CisKK3B1YmxpYzoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBNdHBEZXZpY2Uoc3RydWN0IHVzYl9kZXZpY2UqIGRldmljZSwgaW50IGludGVyZmFjZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cnVjdCB1c2JfZW5kcG9pbnQgKmVwX2luLCBzdHJ1Y3QgdXNiX2VuZHBvaW50ICplcF9vdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJ1Y3QgdXNiX2VuZHBvaW50ICplcF9pbnRyKTsKKyAgICB2aXJ0dWFsICAgICAgICAgICAgICAgICB+TXRwRGV2aWNlKCk7CisKKyAgICBpbmxpbmUgaW50ICAgICAgICAgICAgICBnZXRJRCgpIGNvbnN0IHsgcmV0dXJuIG1JRDsgfQorCisgICAgdm9pZCAgICAgICAgICAgICAgICAgICAgaW5pdGlhbGl6ZSgpOworICAgIHZvaWQgICAgICAgICAgICAgICAgICAgIGNsb3NlKCk7CisgICAgY29uc3QgY2hhciogICAgICAgICAgICAgZ2V0RGV2aWNlTmFtZSgpOworCisgICAgYm9vbCAgICAgICAgICAgICAgICAgICAgb3BlblNlc3Npb24oKTsKKyAgICBib29sICAgICAgICAgICAgICAgICAgICBjbG9zZVNlc3Npb24oKTsKKworICAgIE10cERldmljZUluZm8qICAgICAgICAgIGdldERldmljZUluZm8oKTsKKyAgICBNdHBTdG9yYWdlSURMaXN0KiAgICAgICBnZXRTdG9yYWdlSURzKCk7CisgICAgTXRwU3RvcmFnZUluZm8qICAgICAgICAgZ2V0U3RvcmFnZUluZm8oTXRwU3RvcmFnZUlEIHN0b3JhZ2VJRCk7CisgICAgTXRwT2JqZWN0SGFuZGxlTGlzdCogICAgZ2V0T2JqZWN0SGFuZGxlcyhNdHBTdG9yYWdlSUQgc3RvcmFnZUlELCBNdHBPYmplY3RGb3JtYXQgZm9ybWF0LCBNdHBPYmplY3RIYW5kbGUgcGFyZW50KTsKKyAgICBNdHBPYmplY3RJbmZvKiAgICAgICAgICBnZXRPYmplY3RJbmZvKE10cE9iamVjdEhhbmRsZSBoYW5kbGUpOworICAgIHZvaWQqICAgICAgICAgICAgICAgICAgIGdldFRodW1ibmFpbChNdHBPYmplY3RIYW5kbGUgaGFuZGxlLCBpbnQmIG91dExlbmd0aCk7CisgICAgTXRwT2JqZWN0SGFuZGxlICAgICAgICAgc2VuZE9iamVjdEluZm8oTXRwT2JqZWN0SW5mbyogaW5mbyk7CisgICAgYm9vbCAgICAgICAgICAgICAgICAgICAgc2VuZE9iamVjdChNdHBPYmplY3RJbmZvKiBpbmZvLCBpbnQgc3JjRkQpOworICAgIGJvb2wgICAgICAgICAgICAgICAgICAgIGRlbGV0ZU9iamVjdChNdHBPYmplY3RIYW5kbGUgaGFuZGxlKTsKKyAgICBNdHBPYmplY3RIYW5kbGUgICAgICAgICBnZXRQYXJlbnQoTXRwT2JqZWN0SGFuZGxlIGhhbmRsZSk7CisgICAgTXRwT2JqZWN0SGFuZGxlICAgICAgICAgZ2V0U3RvcmFnZUlEKE10cE9iamVjdEhhbmRsZSBoYW5kbGUpOworCisgICAgTXRwUHJvcGVydHkqICAgICAgICAgICAgZ2V0RGV2aWNlUHJvcERlc2MoTXRwRGV2aWNlUHJvcGVydHkgY29kZSk7CisKKyAgICAvLyByZXR1cm5zIHRoZSBmaWxlIGRlc2NyaXB0b3IgZm9yIGEgcGlwZSB0byByZWFkIHRoZSBvYmplY3QncyBkYXRhCisgICAgaW50ICAgICAgICAgICAgICAgICAgICAgcmVhZE9iamVjdChNdHBPYmplY3RIYW5kbGUgaGFuZGxlLCBpbnQgb2JqZWN0U2l6ZSk7CisKK3ByaXZhdGU6CisgICAgZnJpZW5kIGNsYXNzIFJlYWRPYmplY3RUaHJlYWQ7CisKKyAgICBib29sICAgIC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ZQorICogZGlzdHJpYnV0ZWQgdW5kZXIgdGhlIExpY2Vuc2UgaXMgZGlzdHJpYnV0ZWQgb24gYW4gIkFTIElTIiBCQVNJUywKKyAqIFdJVEhPVVQgV0FSUkFOVElFUyBPUiBDT05ESVRJT05TIE9GIEFOWSBLSU5ELCBlaXRoZXIgZXhwcmVzcyBvciBpbXBsaWVkLgorICogU2VlIHRoZSBMaWNlbnNlIGZvciB0aGUgc3BlY2lmaWMgbGFuZ3VhZ2UgZ292ZXJuaW5nIHBlcm1pc3Npb25zIGFuZAorICogbGltaXRhdGlvbnMgdW5kZXIgdGhlIExpY2Vuc2UuCisgKi8KKworI2lmbmRlZiBfTVRQX0RFVklDRV9JTkZPX0gKKyNkZWZpbmUgX01UUF9ERVZJQ0VfSU5GT19ICisKK3N0cnVjdCBzdGF0OworCituYW1lc3BhY2UgYW5kcm9pZCB7CisKK2NsYXNzIE10cERhdGFQYWNrZXQ7CisKK2NsYXNzIE10cERldmljZUluZm8geworcHVibGljOgorICAgIHVpbnQxNl90ICAgICAgICAgICAgICAgIG1TdGFuZGFyZFZlcnNpb247CisgICAgdWludDMyX3QgICAgICAgICAgICAgICAgbVZlbmRvckV4dGVuc2lvbklEOworICAgIHVpbnQxNl90ICAgICAgICAgICAgICAgIG1WZW5kb3JFeHRlbnNpb25WZXJzaW9uOworICAgIGNoYXIqICAgICAgICAgICAgICAgICAgIG1WZW5kb3JFeHRlbnNpb25EZXNjOworICAgIHVpbnQxNl90ICAgICAgICAgICAgICAgIG1GdW5jdGlvbmFsQ29kZTsKKyAgICBVSW50MTZMaXN0KiAgICAgICAgICAgICBtT3BlcmF0aW9uczsKKyAgICBVSW50MTZMaXN0KiAgICAgICAgICAgICBtRXZlbnRzOworICAgIE10cERldmljZVByb3BlcnR5TGlzdCogIG1EZXZpY2VQcm9wZXJ0aWVzOworICAgIE10cE9iamVjdEZvcm1hdExpc3QqICAgIG1DYXB0dXJlRm9ybWF0czsKKyAgICBNdHBPYmplY3RGb3JtYXRMaXN0KiAgICBtUGxheWJhY2tGb3JtYXRzOworICAgIGNoYXIqICAgICAgICAgICAgICAgICAgIG1NYW51ZmFjdHVyZXI7CisgICAgY2hhciogICAgICAgICAgICAgICAgICAgbU1vZGVsOworICAgIGNoYXIqICAgICAgICAgICAgICAgICAgIG1WZXJzaW9uOworICAgIGNoYXIqICAgICAgICAgICAgICAgICAgIG1TZXJpYWw7CisKK3B1YmxpYzoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBNdHBEZXZpY2VJbmZvKCk7CisgICAgdmlydHVhbCAgICAgICAgICAgICAgICAgfk10cERldmljZUluZm8oKTsKKworICAgIHZvaWQgICAgICAgICAgICAgICAgICAgIHJlYWQoTXRwRGF0YVBhY2tldCYgcGFja2V0KTsKKworICAgIHZvaWQgICAgICAgICAgICAgICAgICAgIHByaW50KCk7Cit9OworCit9OyAvLyBuYW1lc3BhY2UgYW5kcm9pZAorCisjZW5kaWYgLy8gX01UUF9ERVZJQ0VfSU5GT19ICmRpZmYgLS1naXQgYS9tZWRpYS9tdHAvTXRwRXZlbnRQYWNrZXQuY3BwIGIvbWVkaWEvbXRwL010cEV2ZW50UGFja2V0LmNwcApuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi5mYzc0NTQyCi0tLSAvZGV2L251bGwKKysrIGIvbWVkaWEvbXRwL010cEV2ZW50UGFja2V0LmNwcApAQCAtMCwwICsxLDY3IEBACisvKgorICogQ29weXJpZ2h0IChDKSAyMDEwIFRoZSBBbmRyb2lkIE9wZW4gU291cmNlIFByb2plY3QKKyAqCisgKiBMaWNlbnNlZCB1bmRlciB0aGUgQXBhY2hlIExpY2Vuc2UsIFZlcnNpb24gMi4wICh0aGUgIkxpY2Vuc2UiKTsKKyAqIHlvdSBtYXkgbm90IHVzZSB0aGlzIGZpbGUgZXhjZXB0IGluIGNvbXBsaWFuY2Ugd2l0aCB0aGUgTGljZW5zZS4KKyAqIFlvdSBtYXkgb2J0YWluIGEgY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ICAgICAgICAgICAgICAgIE10cEV2ZW50UGFja2V0KCk7CisgICAgdmlydHVhbCAgICAgICAgICAgICB+TXRwRXZlbnRQYWNrZXQoKTsKKworI2lmZGVmIE1UUF9ERVZJQ0UKKyAgICAvLyB3cml0ZSBvdXIgZGF0YSB0byB0aGUgZ2l2ZW4gZmlsZSBkZXNjcmlwdG9yCisgICAgaW50ICAgICAgICAgICAgICAgICB3cml0ZShpbnQgZmQpOworI2VuZGlmCisKKyNpZmRlZiBNVFBfSE9TVAorICAgIC8vIHJlYWQgb3VyIGJ1ZmZlciBmcm9tIHRoZSBnaXZlbiBlbmRwb2ludAorICAgIGludCAgICAgICAgICAgICAgICAgcmVhZChzdHJ1Y3QgdXNiX2VuZHBvaW50ICplcCk7CisjZW5kaWYKKworICAgIGlubGluZSBNdHBFdmVudENvZGUgICAgIGdldEV2ZW50Q29kZSgpIGNvbnN0IHsgcmV0dXJuIGdldENvbnRhaW5lckNvZGUoKTsgfQorICAgIGlubGluZSB2b2lkICAgICAgICAgICAgIHNldEV2ZW50Q29kZShNdHBFdmVudENvZGUgY29kZSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeyByZXR1cm4gc2V0Q29udGFpbmVyQ29kZShjb2RlKTsgfQorfTsKKworfTsgLy8gbmFtZXNwYWNlIGFuZHJvaWQKKworI2VuZGlmIC8vIF9NVFBfRVZFTlRfUEFDS0VUX0gKZGlmZiAtLWdpdCBhL21lZGlhL210cC9NdHBPYmplY3RJbmZvLmNwcCBiL21lZGlhL210cC9NdHBPYmplY3RJbmZvLmNwcApuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi5kZDQzMDRlCi0tLSAvZGV2L251bGwKKysrIGIvbWVkaWEvbXRwL010cE9iamVjdEluZm8uY3BwCkBAIC0wLDAgKzEsMTA4IEBACisvKgorICogQ29weXJpZ2h0IChDKSAyMDEwIFRoZSBBbmRyb2lkIE9wZW4gU291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yhNdHBPYmplY3RIYW5kbGUgaGFuZGxlKQorICAgIDogICBtSGFuZGxlKGhhbmRsZSksCisgICAgICAgIG1TdG9yYWdlSUQoMCksCisgICAgICAgIG1Gb3JtYXQoMCksCisgICAgICAgIG1Qcm90ZWN0aW9uU3RhdHVzKDApLAorICAgICAgICBtQ29tcHJlc3NlZFNpemUoMCksCisgICAgICAgIG1UaHVtYkZvcm1hdCgwKSwKKyAgICAgICAgbVRodW1iQ29tcHJlc3NlZFNpemUoMCksCisgICAgICAgIG1UaHVtYlBpeFdpZHRoKDApLAorICAgICAgICBtVGh1bWJQaXhIZWlnaHQoMCksCisgICAgICAgIG1JbWFnZVBpeFdpZHRoKDApLAorICAgICAgICBtSW1hZ2VQaXhIZWlnaHQoMCksCisgICAgICAgIG1JbWFnZVBpeERlcHRoKDApLAorICAgICAgICBtUGFyZW50KDApLAorICAgICAgICBtQXNzb2NpYXRpb25UeXBlKDApLAorICAgICAgICBtQXNzb2NpYXRpb25EZXNjKDApLAorICAgICAgICBtU2VxdWVuY2VOdW1iZXIoMCksCisgICAgICAgIG1OYW1lKE5VTEwpLAorICAgICAgICBtRGF0ZUNyZWF0ZWQoMCksCisgICAgICAgIG1EYXRlTW9kaWZpZWQoMCksCisgICAgICAgIG1LZXl3b3JkcyhOVUxMKQoreworfQorCitNdHBPYmplY3RJbmZvOjp+TXRwT2JqZWN0SW5mbygpIHsKKyAgICBpZiAobU5hbWUpCisgICAgICAgIGZyZWUobU5hbWUpOworICAgIGlmIChtS2V5d29yZHMpCisgICAgICAgIGZyZWUobUtleXdvcmRzKTsKK30KKwordm9pZCBNdHBPYmplY3RJbmZvOjpyZWFkKE10cERhdGFQYWNrZXQmIHBhY2tldCkgeworICAgIE10cFN0cmluZ0J1ZmZlciBzdHJpbmc7CisgICAgdGltZV90IHRpbWU7CisKKyAgICBtU3RvcmFnZUlEID0gcGFja2V0LmdldFVJbnQzMigpOworICAgIG1Gb3JtYXQgPSBwYWNrZXQuZ2V0VUludDE2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peERlcHRoOworICAgIE10cE9iamVjdEhhbmRsZSAgICAgbVBhcmVudDsKKyAgICB1aW50MTZfdCAgICAgICAgICAgIG1Bc3NvY2lhdGlvblR5cGU7CisgICAgdWludDMyX3QgICAgICAgICAgICBtQXNzb2NpYXRpb25EZXNjOworICAgIHVpbnQzMl90ICAgICAgICAgICAgbVNlcXVlbmNlTnVtYmVyOworICAgIGNoYXIqICAgICAgICAgICAgICAgbU5hbWU7CisgICAgdGltZV90ICAgICAgICAgICAgICBtRGF0ZUNyZWF0ZWQ7CisgICAgdGltZV90ICAgICAgICAgICAgICBtRGF0ZU1vZGlmaWVkOworICAgIGNoYXIqICAgICAgICAgICAgICAgbUtleXdvcmRzOworCitwdWJsaWM6CisgICAgICAgICAgICAgICAgICAgICAgICBNdHBPYmplY3RJbmZvKE10cE9iamVjdEhhbmRsZSBoYW5kbGUpOworICAgIHZpcnR1YWwgICAgICAgICAgICAgfk10cE9iamVjdEluZm8oKTsKKworICAgIHZvaWQgICAgICAgICAgICAgICAgcmVhZChNdHBEYXRhUGFja2V0JiBwYWNrZXQpOworCisgICAgdm9pZCAgICAgICAgICAgICAgICBwcmludCgpOworfTsKKworfTsgLy8gbmFtZXNwYWNlIGFuZHJvaWQKKworI2VuZGlmIC8vIF9NVFBfT0JKRUNUX0lORk9fSApkaWZmIC0tZ2l0IGEvbWVkaWEvbXRwL010cFBhY2tldC5jcHAgYi9tZWRpYS9tdHAvTXRwUGFja2V0LmNwcApuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi40MmJmOGJhCi0tLSAvZGV2L251bGwKKysrIGIvbWVkaWEvbXRwL010cFBhY2tldC5jcHAKQEAgLTAsMCArMSwxNTQgQEAKKy8qCisgKiBDb3B5cmlnaHQgKEMpIDIwMTAgVGhlIEFuZHJvaWQgT3BlbiBTb3VyY2UgUHJvamVjdAorICoKKyAqIExpY2Vuc2VkIHVuZGVyIHRoZSBBcGFjaGUgTGljZW5zZSwgVmVyc2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2CisgICAgY2hhciBidWZmZXJbNTAwXTsKKyAgICBjaGFyKiBidWZwdHIgPSBidWZmZXI7CisKKyAgICBmb3IgKGludCBpID0gMDsgaSA8IG1QYWNrZXRTaXplOyBpKyspIHsKKyAgICAgICAgc3ByaW50ZihidWZwdHIsICIlMDJYICIsIG1CdWZmZXJbaV0pOworICAgICAgICBidWZwdHIgKz0gc3RybGVuKGJ1ZnB0cik7CisgICAgICAgIGlmIChpICUgRFVNUF9CWVRFU19QRVJfUk9XID09IChEVU1QX0JZVEVTX1BFUl9ST1cgLSAxKSkgeworICAgICAgICAgICAgTE9HVigiJXMiLCBidWZmZXIpOworICAgICAgICAgICAgYnVmcHRyID0gYnVmZmVyOworICAgICAgICB9CisgICAgfQorICAgIGlmIChidWZwdHIgIT0gYnVmZmVyKSB7CisgICAgICAgIC8vIHByaW50IGxhc3QgbGluZQorICAgICAgICBMT0dWKCIlcyIsIGJ1ZmZlcik7CisgICAgfQorICAgIExPR1YoIlxuIik7Cit9CisKK3VpbnQxNl90IE10cFBhY2tldDo6Z2V0VUludDE2KGludCBvZmZzZXQpIGNvbnN0IHsKKyAgICByZXR1cm4gKCh1aW50MTZfdCltQnVmZmVyW29mZnNldCArIDFdIDw8IDgpIHwgKHVpbnQxNl90KW1CdWZmZXJbb2Zmc2V0XTsKK30KKwordWludDMyX3QgTXRwUGFja2V0OjpnZXRVSW50MzIoaW50IG9mZnNldCkgY29uc3QgeworICAgIHJldHVybiAoKHVpbnQzMl90KW1CdWZmZXJbb2Zmc2V0ICsgM10gPDwgMjQpIHwgKCh1aW50MzJfdCltQnVmZmVyW29mZnNldCArIDJdIDw8IDE2KSB8CisgICAgICAgICAgICgodWludDMyX3QpbUJ1ZmZlcltvZmZzZXQgKyAxXSA8PCA4KSAgfCAodWludDMyX3QpbUJ1ZmZlcltvZmZzZXRdOworfQorCit2b2lkIE10cFBhY2tldDo6cHV0VUludDE2KGludCBvZmZzZXQsIHVpbnQxNl90IHZhbHVlKSB7CisgICAg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AgdmlydHVhbCB2b2lkICAgICAgICByZXNldCgpOworCisgICAgdm9pZCAgICAgICAgICAgICAgICBhbGxvY2F0ZShpbnQgbGVuZ3RoKTsKKyAgICB2b2lkICAgICAgICAgICAgICAgIGR1bXAoKTsKKworICAgIHVpbnQxNl90ICAgICAgICAgICAgZ2V0Q29udGFpbmVyQ29kZSgpIGNvbnN0OworICAgIHZvaWQgICAgICAgICAgICAgICAgc2V0Q29udGFpbmVyQ29kZSh1aW50MTZfdCBjb2RlKTsKKworICAgIE10cFRyYW5zYWN0aW9uSUQgICAgZ2V0VHJhbnNhY3Rpb25JRCgpIGNvbnN0OworICAgIHZvaWQgICAgICAgICAgICAgICAgc2V0VHJhbnNhY3Rpb25JRChNdHBUcmFuc2FjdGlvbklEIGlkKTsKKworICAgIHVpbnQzMl90ICAgICAgICAgICAgZ2V0UGFyYW1ldGVyKGludCBpbmRleCkgY29uc3Q7CisgICAgdm9pZCAgICAgICAgICAgICAgICBzZXRQYXJhbWV0ZXIoaW50IGluZGV4LCB1aW50MzJfdCB2YWx1ZSk7CisKKyNpZmRlZiBNVFBfSE9TVAorICAgIGludCAgICAgICAgICAgICAgICAgdHJhbnNmZXIoc3RydWN0IHVzYl9lbmRwb2ludCAqZXAsIHZvaWQqIGJ1ZmZlciwgaW50IGxlbmd0aCk7CisjZW5kaWYKKworcHJvdGVjdGVkOgorICAgIHVpbnQxNl90ICAgICAgICAgICAgZ2V0VUludDE2KGludCBvZmZzZXQpIGNvbnN0OworICAgIHVpbnQzMl90ICAgICAgICAgICAgZ2V0VUludDMyKGludCBvZmZzZXQpIGNvbnN0OworICAgIHZvaWQgICAgICAgICAgICAgICAgcHV0VUludDE2KGludCBvZmZzZXQsIHVpbnQxNl90IHZhbHVlKTsKKyAgICB2b2lkICAgICAgICAgICAgICAgIHB1dFVJbnQzMihpbnQgb2Zmc2V0LCB1aW50MzJfdCB2YWx1ZSk7Cit9OworCit9OyAvLyBuYW1lc3BhY2UgYW5kcm9pZAorCisj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ciB0aGUgTGljZW5zZS4KKyAqLworCisjZGVmaW5lIExPR19UQUcgIk10cFByb3BlcnR5IgorCisjaW5jbHVkZSAiTXRwRGF0YVBhY2tldC5oIgorI2luY2x1ZGUgIk10cFByb3BlcnR5LmgiCisjaW5jbHVkZSAiTXRwU3RyaW5nQnVmZmVyLmgiCisjaW5jbHVkZSAiTXRwVXRpbHMuaCIKKworbmFtZXNwYWNlIGFuZHJvaWQgeworCitNdHBQcm9wZXJ0eTo6TXRwUHJvcGVydHkoKQorICAgIDogICBtQ29kZSgwKSwKKyAgICAgICAgbVR5cGUoMCksCisgICAgICAgIG1Xcml0ZWFibGUoZmFsc2UpLAorICAgICAgICBtRGVmYXVsdEFycmF5TGVuZ3RoKDApLAorICAgICAgICBtRGVmYXVsdEFycmF5VmFsdWVzKE5VTEwpLAorICAgICAgICBtQ3VycmVudEFycmF5TGVuZ3RoKDApLAorICAgICAgICBtQ3VycmVudEFycmF5VmFsdWVzKE5VTEwpLAorICAgICAgICBtR3JvdXBDb2RlKDApLAorICAgICAgICBtRm9ybUZsYWcoa0Zvcm1Ob25lKSwKKyAgICAgICAgbUVudW1MZW5ndGgoMCksCisgICAgICAgIG1FbnVtVmFsdWVzKE5VTEwpCit7CisgICAgbURlZmF1bHRWYWx1ZS5zdHIgPSBOVUxMOworICAgIG1DdXJyZW50VmFsdWUuc3RyID0gTlVMTDsKKyAgICBtTWluaW11bVZhbHVlLnN0ciA9IE5VTEw7CisgICAgbU1heGltdW1WYWx1ZS5zdHIgPSBOVUxMOworfQorCitNdHBQcm9wZXJ0eTo6TXRwUHJvcGVydHkoTXRwUHJvcGVydHlDb2RlIHByb3BDb2RlLAorICAgICAgICAgICAgICAgICAgICAgICAgIE10cERhdGFUeXBlIHR5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCB3cml0ZWFibGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGRlZmF1bHRWYWx1ZSkKKyAgICA6ICAgbUNvZGUocHJvcENvZGUpLAorICAgICAgICBtVHlwZSh0eXBlKSwKKyAgICAgICAgbVdyaXRlYWJsZSh3cml0ZWFibGUpLAorICAgICAgICBtRGVmYXVsdEFycmF5TGVuZ3RoKDApLAorICAgICAgICBtRGVmYXVsdEFycmF5VmFsdWVzKE5VTEwpLAorICAgICAgICBtQ3VycmVudEFycmF5TGVuZ3RoKDApLAorICAgICAgICBtQ3VycmVudEFycmF5VmFsdWVzKE5VTEwpLAorICAgICAgICBtR3JvdXBDb2RlKDApLAorICAgICAgICBtRm9ybUZsYWcoa0Zvcm1Ob25lKSwKKyAgICAgICAgbUVudW1MZW5ndGgoMCksCisgICAgICAgIG1FbnVtVmFsdWVzKE5VTEwpCit7CisgICAgbWVtc2V0KCZtRGVmYXVsdFZhbHVlLCAwLCBzaXplb2YobURlZmF1bHRWYWx1ZSkpOworICAgIG1lbXNldCgmbUN1cnJlbnRWYWx1ZSwgMCwgc2l6ZW9mKG1DdXJyZW50VmFsdWUpKTsKKyAgICBtZW1zZXQoJm1NaW5pbXVtVmFsdWUsIDAsIHNpemVvZihtTWluaW11bVZhbHVlKSk7CisgICAgbWVtc2V0KCZtTWF4aW11bVZhbHVlLCAwLCBzaXplb2YobU1heGltdW1WYWx1ZSkpOworCisgICAgaWYgKGRlZmF1bHRWYWx1ZSkgeworICAgICAgICBzd2l0Y2ggKHR5cGUpIHsKKyAgICAgICAgICAgIGNhc2UgTVRQX1RZUEVfSU5UODoKKyAgICAgICAgICAgICAgICBtRGVmYXVsdFZhbHVlLmk4ID0gZGVmYXVsdFZhbHVlOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBNVFBfVFlQRV9VSU5UODoKKyAgICAgICAgICAgICAgICBtRGVmYXVsdFZhbHVlLnU4ID0gZGVmYXVsdFZhbHVlOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBNVFBfVFlQRV9JTlQxNjoKKyAgICAgICAgICAgICAgICBtRGVmYXVsdFZhbHVlLmkxNiA9IGRlZmF1bHRWYWx1ZTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgTVRQX1RZUEVfVUlOVDE2OgorICAgICAgICAgICAgICAgIG1EZWZhdWx0VmFsdWUudTE2ID0gZGVmYXVsdFZhbHVlOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBNVFBfVFlQRV9JTlQzMjoKKyAgICAgICAgICAgICAgICBtRGVmYXVsdFZhbHVlLmkzMiA9IGRlZmF1bHRWYWx1ZTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgTVRQX1RZUEVfVUlOVDMyOgorICAgICAgICAgICAgICAgIG1EZWZhdWx0VmFsdWUudTMyID0gZGVmYXVsdFZhbHVlOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBNVFBfVFlQRV9JTlQ2NDoKKyAgICAgICAgICAgICAgICBtRGVmYXVsdFZhbHVlLmk2NCA9IGRlZmF1bHRWYWx1ZTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgTVRQX1RZUEVfVUlOVDY0OgorICAgICAgICAgICAgICAgIG1EZWZhdWx0VmFsdWUudTY0ID0gZGVmYXVsdFZhbHVlOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICBMT0dFKCJ1bmtub3duIHR5cGUgJTA0WCBpbiBNdHBQcm9wZXJ0eTo6TXRwUHJvcGVydHkiLCB0eXBlKTsKKyAgICAgICAgfQorICAgIH0KK30KKworTXRwUHJvcGVydHk6On5NdHBQcm9wZXJ0eSgpIHsKKyAgICBpZiAobVR5cGUgPT0gTVRQX1RZUEVfU1RSKSB7CisgICAgICAgIC8vIGZyZWUgYWxsIHN0cmluZ3MKKyAgICAgICAgZnJlZShtRGVmYXVsdFZhbHVlLnN0cik7CisgICAgICAgIGZyZWUobUN1cnJlbnRWYWx1ZS5zdHIpOworICAgICAgICBmcmVlKG1NaW5pbXVtVmFsdWUuc3RyKTsKKyAgICAgICAgZnJlZShtTWF4aW11bVZhbHVlLnN0cik7CisgICAgICAgIGlmIChtRGVmYXVsdEFycmF5VmFsdWVzKSB7CisgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IG1EZWZhdWx0QXJyYXlMZW5ndGg7IGkrKykKKyAgICAgICAgICAgICAgICBmcmVlKG1EZWZhdWx0QXJyYXlWYWx1ZXNbaV0uc3RyKTsKKyAgICAgICAgfQorICAgICAgICBpZiAobUN1cnJlbnRBcnJheVZhbHVlcykgeworICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBtQ3VycmVudEFycmF5TGVuZ3RoOyBpKyspCisgICAgICAgICAgICAgICAgZnJlZShtQ3VycmVudEFycmF5VmFsdWVzW2ldLnN0cik7CisgICAgICAgIH0KKyAgICAgICAgaWYgKG1FbnVtVmFsdWVzKSB7CisgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IG1FbnVtTGVuZ3RoOyBpKyspCisgICAgICAgICAgICAgICAgZnJlZShtRW51bVZhbHVlc1tpXS5zdHIpOworICAgICAgICB9CisgICAgfQorICAgIGRlbGV0ZVtdIG1EZWZhdWx0QXJyYXlWYWx1ZXM7CisgICAgZGVsZXRlW10gbUN1cnJlbnRBcnJheVZhbHVlczsKKyAgICBkZWxldGVbXSBtRW51bVZhbHVlczsKK30KKwordm9pZCBNdHBQcm9wZXJ0eTo6cmVhZChNdHBEYXRhUGFja2V0JiBwYWNrZXQsIGJvb2wgZGV2aWNlUHJvcCkgeworCisgICAgbUNvZGUgPSBwYWNrZXQuZ2V0VUludDE2KCk7CisgICAgbVR5cGUgPSBwYWNrZXQuZ2V0VUludDE2KCk7CisgICAgbVdyaXRlYWJsZSA9IChwYWNrZXQuZ2V0VUludDgoKSA9PSAxKTsKKyAgICBzd2l0Y2ggKG1UeXBlKSB7CisgICAg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x1ZSk7CisgICAgICAgICAgICByZWFkVmFsdWUocGFja2V0LCBtU3RlcFNpemUpOworICAgIH0gZWxzZSBpZiAobUZvcm1GbGFnID09IGtGb3JtRW51bSkgeworICAgICAgICBtRW51bUxlbmd0aCA9IHBhY2tldC5nZXRVSW50MTYoKTsKKyAgICAgICAgbUVudW1WYWx1ZXMgPSBuZXcgTXRwUHJvcGVydHlWYWx1ZVttRW51bUxlbmd0aF07CisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbUVudW1MZW5ndGg7IGkrKykKKyAgICAgICAgICAgIHJlYWRWYWx1ZShwYWNrZXQsIG1FbnVtVmFsdWVzW2ldKTsKKyAgICB9Cit9CisKKy8vIEZJWE1FIC0gb25seSB3b3JrcyBmb3Igb2JqZWN0IHByb3BlcnRpZXMKK3ZvaWQgTXRwUHJvcGVydHk6OndyaXRlKE10cERhdGFQYWNrZXQmIHBhY2tldCkgeworICAgIHBhY2tldC5wdXRVSW50MTYobUNvZGUpOworICAgIHBhY2tldC5wdXRVSW50MTYobVR5cGUpOworICAgIHBhY2tldC5wdXRVSW50OChtV3JpdGVhYmxlID8gMSA6IDApOworCisgICAgc3dpdGNoIChtVHlwZSkgeworICAgICAgICBjYXNlIE1UUF9UWVBFX0FJTlQ4OgorICAgICAgICBjYXNlIE1UUF9UWVBFX0FVSU5UODoKKyAgICAgICAgY2FzZSBNVFBfVFlQRV9BSU5UMTY6CisgICAgICAgIGNhc2UgTVRQX1RZUEVfQVVJTlQxNjoKKyAgICAgICAgY2FzZSBNVFBfVFlQRV9BSU5UMzI6CisgICAgICAgIGNhc2UgTVRQX1RZUEVfQVVJTlQzMjoKKyAgICAgICAgY2FzZSBNVFBfVFlQRV9BSU5UNjQ6CisgICAgICAgIGNhc2UgTVRQX1RZUEVfQVVJTlQ2NDoKKyAgICAgICAgY2FzZSBNVFBfVFlQRV9BSU5UMTI4OgorICAgICAgICBjYXNlIE1UUF9UWVBFX0FVSU5UMTI4OgorICAgICAgICAgICA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HVlJiB2YWx1ZSkgeworICAgIE10cFN0cmluZ0J1ZmZlciBzdHJpbmdCdWZmZXI7CisKKyAgICBzd2l0Y2ggKG1UeXBlKSB7CisgICAgICAgIGNhc2UgTVRQX1RZUEVfSU5UODoKKyAgICAgICAgY2FzZSBNVFBfVFlQRV9BSU5UODoKKyAgICAgICAgICAgIHZhbHVlLmk4ID0gcGFja2V0LmdldEludDgoKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIE1UUF9UWVBFX1VJTlQ4OgorICAgICAgICBjYXNlIE1UUF9UWVBFX0FVSU5UODoKKyAgICAgICAgICAgIHZhbHVlLnU4ID0gcGFja2V0LmdldFVJbnQ4KCk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBNVFBfVFlQRV9JTlQxNjoKKyAgICAgICAgY2FzZSBNVFBfVFlQRV9BSU5UMTY6CisgICAgICAgICAgICB2YWx1ZS5pMTYgPSBwYWNrZXQuZ2V0SW50MTYoKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIE1UUF9UWVBFX1VJTlQxNjoKKyAgICAgICAgY2FzZSBNVFBfVFlQRV9BVUlOVDE2OgorICAgICAgICAgICAgdmFsdWUudTE2ID0gcGFja2V0LmdldFVJbnQxNigpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgTVRQX1RZUEVfSU5UMzI6CisgICAgICAgIGNhc2UgTVRQX1RZUEVfQUlOVDMyOgorICAgICAgICAgICAgdmFsdWUuaTMyID0gcGFja2V0LmdldEludDMyKCk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBNVFBfVFlQRV9VSU5UMzI6CisgICAgICAgIGNhc2UgTVRQX1RZUEVfQVVJTlQzMjoKKyAgICAgICAgICAgIHZhbHVlLnUzMiA9IHBhY2tldC5nZXRVSW50MzIoKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIE1UUF9UWVBFX0lOVDY0OgorICAgICAgICBjYXNlIE1UUF9UWVBFX0FJTlQ2NDoKKyAgICAgICAgICAgIHZhbHVlLmk2NCA9IHBhY2tldC5nZXRJbnQ2NCgpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgTVRQX1RZUEVfVUlOVDY0OgorICAgICAgICBjYXNlIE1UUF9UWVBFX0FVSU5UNjQ6CisgICAgICAgICAgICB2YWx1ZS51NjQgPSBwYWNrZXQuZ2V0VUludDY0KCk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBNVFBfVFlQRV9JTlQxMjg6CisgICAgICAgIGNhc2UgTVRQX1RZUEVfQUlOVDEyODoKKyAgICAgICAgICAgIHBhY2tldC5nZXRJbnQxMjgodmFsdWUuaTEyOCk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBNVFBfVFlQRV9VSU5UMTI4OgorICAgICAgICBjYXNlIE1UUF9UWVBFX0FVSU5UMTI4OgorICAgICAgICAgICAgcGFja2V0LmdldFVJbnQxMjgodmFsdWUudTEyOCk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBNVFBfVFlQRV9TVFI6CisgICAgICAgICAgICBwYWNrZXQuZ2V0U3RyaW5nKHN0cmluZ0J1ZmZlcik7CisgICAgICAgICAgICB2YWx1ZS5zdHIgPSBzdHJkdXAoc3RyaW5nQnVmZmVyKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgTE9HRSgidW5rbm93biB0eXBlICUwNFggaW4gTXRwUHJvcGVydHk6OnJlYWRWYWx1ZSIsIG1UeXBlKTsKKyAgICB9Cit9CisKK3ZvaWQgTXRwUHJvcGVydHk6OndyaXRlVmFsdWUoTXRwRGF0YVBhY2tldCYgcGFja2V0LCBNdHBQcm9wZXJ0eVZhbHVlJiB2YWx1ZSkgeworICAgIE10cFN0cmluZ0J1ZmZlciBzdHJpbmdCdWZmZXI7CisKKyAgICBzd2l0Y2ggKG1UeXBlKSB7CisgICAgICAgIGNhc2UgTVRQX1RZUEVfSU5UODoKKyAgICAgICAgY2FzZSBNVFBfVFlQRV9BSU5UODoKKyAgICAgICAgICAgIHBhY2tldC5wdXRJbnQ4KHZhbHVlLmk4KTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIE1UUF9UWVBFX1VJTlQ4OgorICAgICAgICBjYXNlIE1UUF9UWVBFX0FVSU5UODoKKyAgICAgICAgICAgIHBhY2tldC5wdXRVSW50OCh2YWx1ZS51OCk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBNVFBfVFlQRV9JTlQxNjoKKyAgICAgICAgY2FzZSBNVFBfVFlQRV9BSU5UMTY6CisgICAgICAgICAgICBwYWNrZXQucHV0SW50MTYodmFsdWUuaTE2KTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIE1UUF9UWVBFX1VJTlQxNjoKKyAgICAgICAgY2FzZSBNVFBfVFlQRV9BVUlOVDE2OgorICAgICAgICAgICAgcGFja2V0LnB1dFVJbnQxNih2YWx1ZS51MTYpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgTVRQX1RZUEVfSU5UMzI6CisgICAgICAgIGNhc2UgTVRQX1RZUEVfQUlOVDMyOgorICAgICAgICAgICAgcGFja2V0LnB1dEludDMyKHZhbHVlLmkzMik7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBNVFBfVFlQRV9VSU5UMzI6CisgICAgICAgIGNhc2UgTVRQX1RZUEVfQVVJTlQzMjoKKyAgICAgICAgICAgIHBhY2tldC5wdXRVSW50MzIodmFsdWUudTMyKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIE1UUF9UWVBFX0lOVDY0OgorICAgICAgICBjYXNlIE1UUF9UWVBFX0FJTlQ2NDoKKyAgICAgICAgICAgIHBhY2tldC5wdXRJbnQ2NCh2YWx1ZS5pNjQpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgTVRQX1RZUEVfVUlOVDY0OgorICAgICAgICBjYXNlIE1UUF9UWVBFX0FVSU5UNjQ6CisgICAgICAgICAgICBwYWNrZXQucHV0VUludDY0KHZhbHVlLnU2NCk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBNVFBfVFlQRV9JTlQxMjg6CisgICAgICAgIGNhc2UgTVRQX1RZUEVfQUlOVDEyODoKKyAgICAgICAgICAgIHBhY2tldC5wdXRJbnQxMjgodmFsdWUuaTEyOCk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBNVFBfVFlQRV9VSU5UMTI4OgorICAgICAgICBjYXNlIE1UUF9UWVBFX0FVSU5UMTI4OgorICAgICAgICAgICAgcGFja2V0LnB1dFVJbnQxMjgodmFsdWUudTEyOCk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBNVFBfVFlQRV9TVFI6CisgICAgICAgICAgICBpZiAodmFsdWUuc3RyKQorICAgICAgICAgICAgICAgIHBhY2tldC5wdXRTdHJpbmcodmFsdWUuc3RyKTsKKyAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICBwYWNrZXQucHV0RW1wdHlTdHJpbmcoKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgTE9HRSgidW5rbm93biB0eXBlICUwNFggaW4gTXRwUHJvcGVydHk6OndyaXRlVmFsdWUiLCBtVHlwZSk7CisgICAgfQorfQorCitNdHBQcm9wZXJ0eVZhbHVlKiBNdHBQcm9wZXJ0eTo6cmVhZEFycmF5VmFsdWVzKE10cERhdGFQYWNrZXQmIHBhY2tldCwgaW50JiBsZW5ndGgpIHsKKyAgICBsZW5ndGggPSBwYWNrZXQuZ2V0VUludDMyKCk7CisgICAgaWYgKGxlbmd0aCA9PSAwKQorICAgICAgICByZXR1cm4gTlVMTDsKKyAgICBNdHBQcm9wZXJ0eVZhbHVlKiByZ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3VycmVudEFycmF5TGVuZ3RoOworICAgIE10cFByb3BlcnR5VmFsdWUqICAgbUN1cnJlbnRBcnJheVZhbHVlczsKKworICAgIGVudW0geworICAgICAgICBrRm9ybU5vbmUgPSAwLAorICAgICAgICBrRm9ybVJhbmdlID0gMSwKKyAgICAgICAga0Zvcm1FbnVtID0gMiwKKyAgICB9OworCisgICAgdWludDMyX3QgICAgICAgICAgICBtR3JvdXBDb2RlOworICAgIHVpbnQ4X3QgICAgICAgICAgICAgbUZvcm1GbGFnOworCisgICAgLy8gZm9yIHJhbmdlIGZvcm0KKyAgICBNdHBQcm9wZXJ0eVZhbHVlICAgIG1NaW5pbXVtVmFsdWU7CisgICAgTXRwUHJvcGVydHlWYWx1ZSAgICBtTWF4aW11bVZhbHVlOworICAgIE10cFByb3BlcnR5VmFsdWUgICAgbVN0ZXBTaXplOworCisgICAgLy8gZm9yIGVudW0gZm9ybQorICAgIGludCAgICAgICAgICAgICAgICAgbUVudW1MZW5ndGg7CisgICAgTXRwUHJvcGVydHlWYWx1ZSogICBtRW51bVZhbHVlczsKKworcHVibGljOgorICAgICAgICAgICAgICAgICAgICAgICAgTXRwUHJvcGVydHkoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIE10cFByb3BlcnR5KE10cFByb3BlcnR5Q29kZSBwcm9wQ29kZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNdHBEYXRhVHlwZSB0eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgd3JpdGVhYmxlID0gZmFsc2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGRlZmF1bHRWYWx1ZSA9IDApOworICAgIHZpcnR1YWwgICAgICAgICAgICAgfk10cFByb3BlcnR5KCk7CisKKyAgICBpbmxpbmUgTXRwUHJvcGVydHlDb2RlIGdldFByb3BlcnR5Q29kZSgpIGNvbnN0IHsgcmV0dXJuIG1Db2RlOyB9CisKKyAgICB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2UgYW5kcm9pZCB7CisKK2NsYXNzIE10cFJlc3BvbnNlUGFja2V0IDogcHVibGljIE10cFBhY2tldCB7CisKK3B1YmxpYzoKKyAgICAgICAgICAgICAgICAgICAgICAgIE10cFJlc3BvbnNlUGFja2V0KCk7CisgICAgdmlydHVhbCAgICAgICAgICAgICB+TXRwUmVzcG9uc2VQYWNrZXQoKTsKKworI2lmZGVmIE1UUF9ERVZJQ0UKKyAgICAvLyB3cml0ZSBvdXIgZGF0YSB0byB0aGUgZ2l2ZW4gZmlsZSBkZXNjcmlwdG9yCisgICAgaW50ICAgICAgICAgICAgICAgICB3cml0ZShpbnQgZmQpOworI2VuZGlmCisKKyNpZmRlZiBNVFBfSE9TVAorICAgIC8vIHJlYWQgb3VyIGJ1ZmZlciBmcm9tIHRoZSBnaXZlbiBlbmRwb2ludAorICAgIGludCAgICAgICAgICAgICAgICAgcmVhZChzdHJ1Y3QgdXNiX2VuZHBvaW50ICplcCk7CisjZW5kaWYKKworICAgIGlubGluZSBNdHBSZXNwb25zZUNvZGUgICAgICBnZXRSZXNwb25zZUNvZGUoKSBjb25zdCB7IHJldHVybiBnZXRDb250YWluZXJDb2RlKCk7IH0KKyAgICBpbmxpbmUgdm9pZCAgICAgICAgICAgICAgICAgc2V0UmVzcG9uc2VDb2RlKE10cFJlc3BvbnNlQ29kZSBjb2RlKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7IHJldHVybiBzZXRDb250YWluZXJDb2RlKGNvZGUpOyB9Cit9OworCit9OyAvLyBuYW1lc3BhY2UgYW5kcm9pZAorCisjZW5kaWYgLy8gX01UUF9SRVNQT05TRV9QQUNLRVRfSApkaWZmIC0tZ2l0IGEvbWVkaWEvbXRwL010cFNlcnZlci5jcHAgYi9tZWRpYS9tdHAvTXRwU2VydmVyLmNwcApuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi4zMGFiZmI4Ci0tLSAvZGV2L251b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29kZSgpOworICAgICAgICBNdHBUcmFuc2FjdGlvbklEIHRyYW5zYWN0aW9uID0gbVJlcXVlc3QuZ2V0VHJhbnNhY3Rpb25JRCgpOworCisgICAgICAgIExPR1YoIm9wZXJhdGlvbjogJXMiLCBNdHBEZWJ1Zzo6Z2V0T3BlcmF0aW9uQ29kZU5hbWUob3BlcmF0aW9uKSk7CisgICAgICAgIG1SZXF1ZXN0LmR1bXAoKTsKKworICAgICAgICAvLyBGSVhNRSBuZWVkIHRvIGdlbmVyYWxpemUgdGhpcworICAgICAgICBib29sIGRhdGFJbiA9IChvcGVyYXRpb24gPT0gTVRQX09QRVJBVElPTl9TRU5EX09CSkVDVF9JTkZPCisgICAgICAgICAgICAgICAgICAgIHx8IG9wZXJhdGlvbiA9PSBNVFBfT1BFUkFUSU9OX1NFVF9PQkpFQ1RfUkVGRVJFTkNFUyk7CisgICAgICAgIGlmIChkYXRhSW4pIHsKKyAgICAgICAgICAgIGludCByZXQgPSBtRGF0YS5yZWFkKGZkKTsKKyAgICAgICAgICAgIGlmIChyZXQgPCAwKSB7CisgICAgICAgICAgICAgICAgTE9HRSgiZGF0YSByZWFkIHJldHVybmVkICVkLCBlcnJubzogJWQiLCByZXQsIGVycm5vKTsKKyAgICAgICAgICAgICAgICBpZiAoZXJybm8gPT0gRUNBTkNFTEVEKSB7CisgICAgICAgICAgICAgICAgICAgIC8vIHJldHVybiB0byB0b3Agb2YgbG9vcCBhbmQgd2FpdCBmb3IgbmV4dCBjb21tYW5kCisgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIExPR1YoInJlY2VpdmVkIGRhdGE6Iik7CisgICAgICAgICAgICBtRGF0YS5kdW1wKCk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBtRGF0YS5yZXNldCgpOworICAgICAgICB9CisKKyAgICAgICAgaWYgKGhhbmRsZVJlcXVlc3QoKSkgeworICAgICAgICAgICAgaWYgKCFkYXRhSW4gJiYgbURhdGEuaGFzRGF0YSgpKSB7CisgICAgICAgICAgICAgICAgbURhdGEuc2V0T3BlcmF0aW9uQ29kZShvcGVyYXRpb24pOworICAgICAgICAgICAgICAgIG1EYXRhLnNldFRyYW5zYWN0aW9uSUQodHJhbnNhY3Rpb24pOworICAgICAgICAgICAgICAgIExPR1YoInNlbmRpbmcgZGF0YToiKTsKKyAgICAgICAgICAgICAgICBtRGF0YS5kdW1wKCk7CisgICAgICAgICAgICAgICAgcmV0ID0gbURhdGEud3JpdGUoZmQpOworICAgICAgICAgICAgICAgIGlmIChyZXQgPCAwKSB7CisgICAgICAgICAgICAgICAgICAgIExPR0UoInJlcXVlc3Qgd3JpdGUgcmV0dXJuZWQgJWQsIGVycm5vOiAlZCIsIHJldCwgZXJybm8pOworICAgICAgICAgICAgICAgICAgICBpZiAoZXJybm8gPT0gRUNBTkNFTEVEKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAvLyByZXR1cm4gdG8gdG9wIG9mIGxvb3AgYW5kIHdhaXQgZm9yIG5leHQgY29tbWFuZAorICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorCisgICAgICAgICAgICBtUmVzcG9uc2Uuc2V0VHJhbnNhY3Rpb25JRCh0cmFuc2FjdGlvbik7CisgICAgICAgICAgICBMT0dWKCJzZW5kaW5nIHJlc3BvbnNlICUwNFgiLCBtUmVzcG9uc2UuZ2V0UmVzcG9uc2VDb2RlKCkpOworICAgICAgICAgICAgcmV0ID0gbVJlc3BvbnNlLndyaXRlKGZkKTsKKyAgICAgICAgICAgIGlmIChyZXQgPCAwKSB7CisgICAgICAgICAgICAgICAgTE9HRSgicmVxdWVzdCB3cml0ZSByZXR1cm5lZCAlZCwgZXJybm86ICVkIiwgcmV0LCBlcnJubyk7CisgICAgICAgICAgICAgICAgaWYgKGVycm5vID09IEVDQU5DRUxFRCkgeworICAgICAgICAgICAgICAgICAgICAvLyByZXR1cm4gdG8gdG9wIG9mIGxvb3AgYW5kIHdhaXQgZm9yIG5leHQgY29tbWFuZAorICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBMT0dWKCJza2lwcGluZyByZXNwb25zZVxuIik7CisgICAgICAgIH0KKyAgICB9Cit9CisKK010cFByb3BlcnR5KiBNdHBTZXJ2ZXI6OmdldE9iamVjdFByb3BlcnR5KE10cFByb3BlcnR5Q29kZSBwcm9wQ29kZSkgeworICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbU9iamVjdFByb3BlcnRpZXMuc2l6ZSgpOyBpKyspIHsKKyAgICAgICAgTXRwUHJvcGVydHkqIHByb3BlcnR5ID0gbU9iamVjdFByb3BlcnRpZXNbaV07CisgICAgICAgIGlmIChwcm9wZXJ0eS0+Z2V0UHJvcGVydHlDb2RlKCkgPT0gcHJvcENvZGUpCisgICAgICAgICAgICByZXR1cm4gcHJvcGVydHk7CisgICAgfQorICAgIHJldHVybiBOVUxMOworfQorCitNdHBQcm9wZXJ0eSogTXRwU2VydmVyOjpnZXREZXZpY2VQcm9wZXJ0eShNdHBQcm9wZXJ0eUNvZGUgcHJvcENvZGUpIHsKKyAgICBmb3IgKGludCBpID0gMDsgaSA8IG1EZXZpY2VQcm9wZXJ0aWVzLnNpemUoKTsgaSsrKSB7CisgICAgICAgIE10cFByb3BlcnR5KiBwcm9wZXJ0eSA9IG1EZXZpY2VQcm9wZXJ0aWVzW2ldOworICAgICAgICBpZiAocHJvcGVydHktPmdldFByb3BlcnR5Q29kZSgpID09IHByb3BDb2RlKQorICAgICAgICAgICAgcmV0dXJuIHByb3B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CJleHBlY3RlZCBTZW5kT2JqZWN0IGFmdGVyIFNlbmRPYmplY3RJbmZvIik7CisgICAgICAgIG1TZW5kT2JqZWN0SGFuZGxlID0ga0ludmFsaWRPYmplY3RIYW5kbGU7CisgICAgfQorCisgICAgc3dpdGNoIChvcGVyYXRpb24pIHsKKyAgICAgICAgY2FzZSBNVFBfT1BFUkFUSU9OX0dFVF9ERVZJQ0VfSU5GTzoKKyAgICAgICAgICAgIHJlc3BvbnNlID0gZG9HZXREZXZpY2VJbmZvKCk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBNVFBfT1BFUkFUSU9OX09QRU5fU0VTU0lPTjoKKyAgICAgICAgICAgIHJlc3BvbnNlID0gZG9PcGVuU2Vzc2lvbigpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgTVRQX09QRVJBVElPTl9DTE9TRV9TRVNTSU9OOgorICAgICAgICAgICAgcmVzcG9uc2UgPSBkb0Nsb3NlU2Vzc2lvbigpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgTVRQX09QRVJBVElPTl9HRVRfU1RPUkFHRV9JRFM6CisgICAgICAgICAgICByZXNwb25zZSA9IGRvR2V0U3RvcmFnZUlEcygpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICBjYXNlIE1UUF9PUEVSQVRJT05fR0VUX1NUT1JBR0VfSU5GTzoKKyAgICAgICAgICAgIHJlc3BvbnNlID0gZG9HZXRTdG9yYWdlSW5mbygpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgTVRQX09QRVJBVElPTl9HRVRfT0JKRUNUX1BST1BTX1NVUFBPUlRFRDoKKyAgICAgICAgICAgIHJlc3BvbnNlID0gZG9HZXRPYmplY3RQcm9wc1N1cHBvcnRlZCgpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgTVRQX09QRVJBVElPTl9HRVRfT0JKRUNUX0hBTkRMRVM6CisgICAgICAgICAgICByZXNwb25zZSA9IGRvR2V0T2JqZWN0SGFuZGxlcygpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgTVRQX09QRVJBVElPTl9HRVRfTlVNX09CSkVDVFM6CisgICAgICAgICAgICByZXNwb25zZSA9IGRvR2V0TnVtT2JqZWN0cygpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgTVRQX09QRVJBVElPTl9HRVRfT0JKRUNUX1JFRkVSRU5DRVM6CisgICAgICAgICAgICByZXNwb25zZSA9IGRvR2V0T2JqZWN0UmVmZXJlbmNlcygpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgTVRQX09QRVJBVElPTl9TRVRfT0JKRUNUX1JFRkVSRU5DRVM6CisgICAgICAgICAgICByZXNwb25zZSA9IGRvU2V0T2JqZWN0UmVmZXJlbmNlcygpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgTVRQX09QRVJBVElPTl9HRVRfT0JKRUNUX1BST1BfVkFMVUU6CisgICAgICAgICAgICByZXNwb25zZSA9IGRvR2V0T2JqZWN0UHJvcFZhbHVlKCk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBNVFBfT1BFUkFUSU9OX0dFVF9PQkpFQ1RfSU5GTzoKKyAgICAgICAgICAgIHJlc3BvbnNlID0gZG9HZXRPYmplY3RJbmZvKCk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBNVFBfT1BFUkFUSU9OX0dFVF9PQkpFQ1Q6CisgICAgICAgICAgICByZXNwb25zZSA9IGRvR2V0T2JqZWN0KCk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBNVFBfT1BFUkFUSU9OX1NFTkRfT0JKRUNUX0lORk86CisgICAgICAgICAgICByZXNwb25zZSA9IGRvU2VuZE9iamVjdEluZm8oKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIE1UUF9PUEVSQVRJT05fU0VORF9PQkpFQ1Q6CisgICAgICAgICAgICByZXNwb25zZSA9IGRvU2VuZE9iamVjdCgpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgTVRQX09QRVJBVElPTl9ERUxFVEVfT0JKRUNUOgorICAgICAgICAgICAgcmVzcG9uc2UgPSBkb0RlbGV0ZU9iamVjdCgpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgTVRQX09QRVJBVElPTl9HRVRfT0JKRUNUX1BST1BfREVTQzoKKyAgICAgICAgICAgIHJlc3BvbnNlID0gZG9HZXRPYmplY3RQcm9wRGVzYygpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICByZXNwb25zZSA9IE1UUF9SRVNQT05TRV9PUEVSQVRJT05fTk9UX1NVUFBPUlRFRDsKKyAgICAgICAgICAgIGJyZWFrOworICAgIH0KKworICAgIGlmIChyZXNwb25zZSA9PSBNVFBfUkVTUE9OU0VfVFJBTlNBQ1RJT05fQ0FOQ0VMTEVEKQorICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgbVJlc3BvbnNlLnNldFJlc3BvbnNlQ29kZShyZXNwb25zZSk7CisgICAgcmV0dXJuIHRydWU7Cit9CisKK010cFJlc3BvbnNlQ29kZSBNdHBTZXJ2ZXI6OmRvR2V0RGV2aWNlSW5mbygpIHsKKyAgICBNdHBTdHJpbmdCdWZmZXIgICBzdHJpbmc7CisgICAgY2hhciBwcm9wX3ZhbHVlW1BST1BFUlRZX1ZBTFVFX01BWF07CisKKyAgICBNdHBPYmplY3RGb3JtYXRMaXN0KiBwbGF5YmFja0Zvcm1hdHMgPSBtRGF0YWJhc2UtPmdldFN1cHBvcnRlZFBsYXliYWNrRm9ybWF0cygpOworICAgIE10cE9iamVjdEZvcm1hdExpc3QqIGNhcHR1cmVGb3JtYXRzID0gbURhdGFiYXNlLT5nZXRTdXBwb3J0ZWRDYXB0dXJlRm9ybWF0cygpOworICAgIE10cERldmljZV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SByZXN1bHQgPSBNVFBfUkVTUE9OU0VfT0s7CisgICAgbW9kZV90IG1hc2s7CisgICAgaW50IHJldDsKKworICAgIGlmIChtU2VuZE9iamVjdEhhbmRsZSA9PSBrSW52YWxpZE9iamVjdEhhbmRsZSkgeworICAgICAgICBMT0dFKCJFeHBlY3RlZCBTZW5kT2JqZWN0SW5mbyBiZWZvcmUgU2VuZE9iamVjdCIpOworICAgICAgICByZXN1bHQgPSBNVFBfUkVTUE9OU0VfTk9fVkFMSURfT0JKRUNUX0lORk87CisgICAgICAgIGdvdG8gZG9uZTsKKyAgICB9CisKKyAgICAvLyByZWFkIHRoZSBoZWFkZXIKKyAgICByZXQgPSBtRGF0YS5yZWFkRGF0YUhlYWRlcihtRkQpOworICAgIC8vIEZJWE1FIC0gY2hlY2sgZm9yIGVycm9ycyBoZXJlLgorCisgICAgLy8gcmVzZXQgc28gd2UgZG9uJ3QgYXR0ZW1wdCB0byBzZW5kIHRoaXMgYmFjaworICAgIG1EYXRhLnJlc2V0KCk7CisKKyAgICBtdHBfZmlsZV9yYW5nZSAgbWZyOworICAgIG1mci5mZCA9IG9wZW4obVNlbmRPYmplY3RGaWxlUGF0aCwgT19SRFdSIHwgT19DUkVBVCB8IE9fVFJVTkMpOworICAgIGlmIChtZnIuZmQgPCAwKSB7CisgICAgICAgIHJlc3VsdCA9IE1UUF9SRVNQT05TRV9HRU5FUkFMX0VSUk9SOworICAgICAgICBnb3RvIGRvbmU7CisgICAgfQorICAgIGZjaG93bihtZnIuZmQsIGdldHVpZCgpLCBtRmlsZUdyb3VwKTsKKyAgICAvLyBzZXQgcGVybWlzc2lvbnMKKyAgICBtYXNrID0gdW1hc2soMCk7CisgICAgZmNobW9kKG1mci5mZCwgbUZpbGVQZXJtaXNzaW9uKTsKKyAgICB1bWFzayhtYXNrKTsKKworICAgIG1mci5vZmZzZXQgPSAwOworICAgIG1mci5sZW5ndGggPSBtU2VuZE9iamVjdEZpbGVTaXplOworCisgICAgLy8gdHJhbnN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W4gc2Vzc2lvbiBhbmQgbVNlc3Npb25JRCBpcyB2YWxpZAorICAgIGJvb2wgICAgICAgICAgICAgICAgbVNlc3Npb25PcGVuOworCisgICAgTXRwUmVxdWVzdFBhY2tldCAgICBtUmVxdWVzdDsKKyAgICBNdHBEYXRhUGFja2V0ICAgICAgIG1EYXRhOworICAgIE10cFJlc3BvbnNlUGFja2V0ICAgbVJlc3BvbnNlOworICAgIE10cEV2ZW50UGFja2V0ICAgICAgbUV2ZW50OworCisgICAgTXRwU3RvcmFnZUxpc3QgICAgICBtU3RvcmFnZXM7CisKKyAgICBNdHBQcm9wZXJ0eUxpc3QgICAgIG1PYmplY3RQcm9wZXJ0aWVzOworICAgIE10cFByb3BlcnR5TGlzdCAgICAgbURldmljZVByb3BlcnRpZXM7CisKKyAgICAvLyBoYW5kbGUgZm9yIG5ldyBvYmplY3QsIHNldCBieSBTZW5kT2JqZWN0SW5mbyBhbmQgdXNlZCBieSBTZW5kT2JqZWN0CisgICAgTXRwT2JqZWN0SGFuZGxlICAgICBtU2VuZE9iamVjdEhhbmRsZTsKKyAgICBNdHBPYmplY3RGb3JtYXQgICAgIG1TZW5kT2JqZWN0Rm9ybWF0OworICAgIE10cFN0cmluZyAgICAgICAgICAgbVNlbmRPYmplY3RGaWxlUGF0aDsKKyAgICBzaXplX3QgICAgICAgICAgICAgIG1TZW5kT2JqZWN0RmlsZVNpemU7CisKK3B1YmxpYzoKKyAgICAgICAgICAgICAgICAgICAgICAgIE10cFNlcnZlcihpbnQgZmQsIE10cERhdGFiYXNlKiBkYXRhYmFzZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBmaWxlR3JvdXAsIGludCBmaWxlUGVybSwgaW50IGRpcmVjdG9yeVBlcm0pOworICAgIHZpcnR1YWwgICAgICAgICAgICAgfk10cFNlcnZlcigpOworCisgICAgdm9pZCAgICAgICAgICAgICAgICBhZGRTdG9yYWdlKGNvbnN0IGNoYXIqIGZpbGVQYXRoKTs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ICAgbUFjY2Vzc0NhcGFiaWxpdHk7CisgICAgdWludDY0X3QgICAgICAgICAgICBtTWF4Q2FwYWNpdHk7CisgICAgdWludDY0X3QgICAgICAgICAgICBtRnJlZVNwYWNlQnl0ZXM7CisgICAgdWludDMyX3QgICAgICAgICAgICBtRnJlZVNwYWNlT2JqZWN0czsKKyAgICBjaGFyKiAgICAgICAgICAgICAgIG1TdG9yYWdlRGVzY3JpcHRpb247CisgICAgY2hhciogICAgICAgICAgICAgICBtVm9sdW1lSWRlbnRpZmllcjsKKworcHVibGljOgorICAgICAgICAgICAgICAgICAgICAgICAgTXRwU3RvcmFnZUluZm8oTXRwU3RvcmFnZUlEIGlkKTsKKyAgICB2aXJ0dWFsICAgICAgICAgICAgIH5NdHBTdG9yYWdlSW5mbygpOworCisgICAgdm9pZCAgICAgICAgICAgICAgICByZWFkKE10cERhdGFQYWNrZXQmIHBhY2tldCk7CisKKyAgICB2b2lkICAgICAgICAgICAgICAgIHByaW50KCk7Cit9OworCit9OyAvLyBuYW1lc3BhY2UgYW5kcm9pZAorCisjZW5kaWYgLy8gX01UUF9TVE9SQUdFX0lORk9fSApkaWZmIC0tZ2l0IGEvbWVkaWEvbXRwL010cFN0cmluZ0J1ZmZlci5jcHAgYi9tZWRpYS9tdHAvTXRwU3RyaW5nQnVmZmVyLmNwcApuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi44YmY2NzMxCi0tLSAvZGV2L251bGwKKysrIGIvbWVkaWEvbXRwL010cFN0cmluZ0J1ZmZlci5jcHAKQEAgLTAsMCArMSwxNDEgQEAKKy8qCisgKiBDb3B5cmlnaHQgKEMpIDIwMTAgVGhlIEFuZHJvaWQgT3BlbiBTb3VyY2UgUHJvamVjdAorICoKKyAqIExpY2Vuc2VkIHVuZGVyIHRoZSBBcGFjaGUgTGljZW5zZSwgVmVyc2lvbiAyLjAgKHRoZSAiTGljZW5zZSIpOworICogeW91IG1heSBub3QgdXNlIHRoaXMgZmlsZ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lYWs7CisgICAgICAgICAgICB9CisgICAgICAgIH0gZWxzZSBpZiAoKGNoICYgMHhGMCkgPT0gMHhFMCkgeworICAgICAgICAgICAgLy8gMyBieXRlIGNoYXIKKyAgICAgICAgICAgIGlmICghICpzcmMrKykgeworICAgICAgICAgICAgICAgIC8vIGxhc3QgY2hhcmFjdGVyIHdhcyB0cnVuY2F0ZWQsIHNvIGlnbm9yZSBsYXN0IGJ5dGUKKyAgICAgICAgICAgICAgICBsZW5ndGgtLTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmICghICpzcmMrKykgeworICAgICAgICAgICAgICAgIC8vIGxhc3QgY2hhcmFjdGVyIHdhcyB0cnVuY2F0ZWQsIHNvIGlnbm9yZSBsYXN0IHR3byBieXRlcworICAgICAgICAgICAgICAgIGxlbmd0aCAtPSAyOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIGNvdW50Kys7CisgICAgfQorCisgICAgbUJ5dGVDb3VudCA9IGxlbmd0aCArIDE7CisgICAgbUJ1ZmZlcltsZW5ndGhdID0gMDsKKyAgICBtQ2hhckNvdW50ID0gY291bnQ7Cit9CisKK3ZvaWQgTXRwU3RyaW5nQnVmZmVyOjpyZWFkRnJvbVBhY2tldChNdHBEYXRhUGFja2V0KiBwYWNrZXQpIHsKKyAgICBpbnQgY291bnQgPSBwYWNrZXQtPmdldFVJbnQ4KCk7CisgICAgdWludDhfdCogZGVzdCA9IG1CdWZmZXI7CisgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBjb3VudDsgaSsrKSB7CisgICAgICAgIHVpbnQxNl90IGNoID0gcGFja2V0LT5nZXRVSW50MTYoKTsKKyAgICAgICAgaWYgKGNoID49IDB4MDgwMCkgeworICAgICAgICAgICAgKmRlc3QrKyA9ICh1aW50OF90KSgweEUwIHwgKGNoID4+IDEyKSk7CisgICAgICAgICAgICAqZGVzdCsrID0gKHVpbnQ4X3QpKDB4ODAgfCAoKGNoID4+IDYpICYgMHgzRikpOworICAgICAgICAgICAgKmRlc3QrKyA9ICh1aW50OF90KSgweDgwIHwgKGNoICYgMHgzRikpOworICAgICAgICB9IGVsc2UgaWYgKGNoID49IDB4ODApIHsKKyAgICAgICAgICAgICpkZXN0KysgPSAodWludDhfdCkoMHhDMCB8IChjaCA+PiA2KSk7CisgICAgICAgICAgICAqZGVzdCsrID0gKHVpbnQ4X3QpKDB4ODAgfCAoY2ggJiAweDNGKSk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAqZGVzdCsrID0gY2g7CisgICAgICAgIH0KKyAgICB9CisgICAgKmRlc3QrKyA9IDA7CisgICAgbUNoYXJDb3VudCA9IGNvdW50OworICAgIG1CeXRlQ291bnQgPSBkZXN0IC0gbUJ1ZmZlcjsKK30KKwordm9pZCBNdHBTdHJpbmdCdWZmZXI6OndyaXRlVG9QYWNrZXQoTXRwRGF0YVBhY2tldCogcGFja2V0KSBjb25zdCB7CisgICAgaW50IGNvdW50ID0gbUNoYXJDb3VudDsKKyAgICBjb25zdCB1aW50OF90KiBzcmMgPSBtQnVmZmVyOworICAgIHBhY2tldC0+cHV0VUludDgoY291bnQgPiAwID8gY291bnQgKyAxIDogMCk7CisKKyAgICAvLyBleHBhbmQgdXRmOCB0byAxNiBiaXQgY2hhcnMKKyAgICBmb3IgKGludCBpID0gMDsgaSA8IGNvdW50OyBpKyspIHsKKyAgICAgICAgdWludDE2X3QgY2g7CisgICAgICAgIHVpbnQxNl90IGNoMSA9ICpzcmMrKzsKKyAgICAgICAgaWYgKChjaDEgJiAweDgwKSA9PSAwKSB7CisgICAgICAgICAgICAvLyBzaW5nbGUgYnl0ZSBjaGFyYWN0ZXIKKyAgICAgICAgICAgIGNoID0gY2gxOworICAgICAgICB9IGVsc2UgaWYgKChjaDEgJiAweEUwKSA9PSAweEMwKSB7CisgICAgICAgICAgICAvLyB0d28gYnl0ZSBjaGFyYWN0ZXIKK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cyByZXBsYWNlZCBieSB0aGUgaG91ciAoMDAtMjMpLCBtbSBpcyByZXBsYWNlZCBieSB0aGUgbWludXRlICgwMC01OSksIGFuZCBzcyBieSB0aGUKK3NlY29uZCAoMDAtNTkpLiBUaGUgIi5zIiBpcyBvcHRpb25hbCwgYW5kIHJlcHJlc2VudHMgdGVudGhzIG9mIGEgc2Vjb25kLgorKi8KKworYm9vbCBwYXJzZURhdGVUaW1lKGNvbnN0IGNoYXIqIGRhdGVUaW1lLCB0aW1lX3QmIG91dFNlY29uZHMpIHsKKyAgICBpbnQgeWVhciwgbW9udGgsIGRheSwgaG91ciwgbWludXRlLCBzZWNvbmQ7CisgICAgc3RydWN0IHRtIHRtOworCisgICAgaWYgKHNzY2FuZihkYXRlVGltZSwgIiUwNGQlMDJkJTAyZFQlMDJkJTAyZCUwMmQiLAorICAgICAgICAgICAgJnllYXIsICZtb250aCwgJmRheSwgJmhvdXIsICZtaW51dGUsICZzZWNvbmQpICE9IDYpCisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICBjb25zdCBjaGFyKiB0YWlsID0gZGF0ZVRpbWUgKyAxNTsKKyAgICAvLyBza2lwIG9wdGlvbmFsIHRlbnRoIG9mIHNlY29uZAorICAgIGlmICh0YWlsWzBdID09ICcuJyAmJiB0YWlsWzFdKQorICAgICAgICB0YWlsICs9IDI7CisgICAgLy9GSVhNRSAtIHN1cHBvcnQgKy8taGhtbQorICAgIGJvb2wgdXNlVVRDID0gKHRhaWxbMF0gPT0gJ1onKTsKKworICAgIC8vIGhhY2sgdG8gY29tcHV0ZSB0aW1lem9uZQorICAgIHRpbWVfdCBkdW1teTsKKyAgICBsb2NhbHRpbWVfcigmZHVtbXksICZ0bSk7CisKKyAgICB0bS50bV9zZWMgPSBzZWNvbmQ7CisgICAgdG0udG1fbWluID0gbWludXRlOworICAgIHRtLnRtX2hvdXIgPSBob3VyOworICAgIHRtLnRtX21kYXkgPSBkYXk7CisgICAgdG0udG1fbW9uID0gbW9udGg7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USU9OICAgICAgICAgICAgICAgICAgICAgICAgICAweDMwMDEgICAvLyBBc3NvY2lhdGlvbiAoZm9yIGV4YW1wbGUsIGEgZm9sZGVyKQorI2RlZmluZSBNVFBfRk9STUFUX1NDUklQVCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDMwMDIgICAvLyBEZXZpY2UgbW9kZWwtc3BlY2lmaWMgc2NyaXB0CisjZGVmaW5lIE1UUF9GT1JNQVRfRVhFQ1VUQUJMRSAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4MzAwMyAgIC8vIERldmljZSBtb2RlbC1zcGVjaWZpYyBiaW5hcnkgZXhlY3V0YWJsZQorI2RlZmluZSBNVFBfRk9STUFUX1RFWFQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDMwMDQgICAvLyBUZXh0IGZpbGUKKyNkZWZpbmUgTVRQX0ZPUk1BVF9IVE1MICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHgzMDA1ICAgLy8gSHlwZXJ0ZXh0IE1hcmt1cCBMYW5ndWFnZSBmaWxlICh0ZXh0KQorI2RlZmluZSBNVFBfRk9STUFUX0RQT0YgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDMwMDYgICAvLyBEaWdpdGFsIFByaW50IE9yZGVyIEZvcm1hdCBmaWxlICh0ZXh0KQorI2RlZmluZSBNVFBfRk9STUFUX0FJRkYgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDMwMDcgICAvLyBBdWRpbyBjbGlwCisjZGVmaW5lIE1UUF9GT1JNQVRfV0FWICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4MzAwOCAgIC8vIEF1ZGlvIGNsaXAKKyNkZWZpbmUgTVRQX0ZPUk1BVF9NUDMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHgzMDA5ICAgLy8gQXVkaW8gY2xpcAorI2RlZmluZSBNVFBfRk9STUFUX0FWSSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDMwMEEgICAvLyBWaWRlbyBjbGlwCisjZGVmaW5lIE1UUF9GT1JNQVRfTVBFRyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4MzAwQiAgIC8vIFZpZGVvIGNsaXAKKyNkZWZpbmUgTVRQX0ZPUk1BVF9BU0YgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHgzMDBDICAgLy8gTWljcm9zb2Z0IEFkdmFuY2VkIFN0cmVhbWluZyBGb3JtYXQgKHZpZGVvKQorI2RlZmluZSBNVFBfRk9STUFUX0RFRklORUQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDM4MDAgICAvLyBVbmtub3duIGltYWdlIG9iamVjdAorI2RlZmluZSBNVFBfRk9STUFUX0VYSUZfSlBFRyAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDM4MDEgICAvLyBFeGNoYW5nZWFibGUgRmlsZSBGb3JtYXQsIEpFSURBIHN0YW5kYXJkCisjZGVmaW5lIE1UUF9GT1JNQVRfVElGRl9FUCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4MzgwMiAgIC8vIFRhZyBJbWFnZSBGaWxlIEZvcm1hdCBmb3IgRWxlY3Ryb25pYyBQaG90b2dyYXBoeQorI2RlZmluZSBNVFBfRk9STUFUX0ZMQVNIUElYICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDM4MDMgICAvLyBTdHJ1Y3R1cmVkIFN0b3JhZ2UgSW1hZ2UgRm9ybWF0CisjZGVmaW5lIE1UUF9GT1JNQVRfQk1QICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4MzgwNCAgIC8vIE1pY3Jvc29mdCBXaW5kb3dzIEJpdG1hcCBmaWxlCisjZGVmaW5lIE1UUF9GT1JNQVRfQ0lGRiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4MzgwNSAgIC8vIENhbm9uIENhbWVyYSBJbWFnZSBGaWxlIEZvcm1hdAorI2RlZmluZSBNVFBfRk9STUFUX0dJRiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDM4MDcgICAvLyBHcmFwaGljcyBJbnRlcmNoYW5nZSBGb3JtYXQKKyNkZWZpbmUgTVRQX0ZPUk1BVF9KRklGICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHgzODA4ICAgLy8gSlBFRyBGaWxlIEludGVyY2hhbmdlIEZvcm1hdAorI2RlZmluZSBNVFBfRk9STUFUX0NEICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDM4MDkgICAvLyBQaG90b0NEIEltYWdlIFBhYworI2RlZmluZSBNVFBfRk9STUFUX1BJQ1QgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDM4MEEgICAvLyBRdWlja2RyYXcgSW1hZ2UgRm9ybWF0CisjZGVmaW5lIE1UUF9GT1JNQVRfUE5HICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4MzgwQiAgIC8vIFBvcnRhYmxlIE5ldHdvcmsgR3JhcGhpY3MKKyNkZWZpbmUgTVRQX0ZPUk1BVF9USUZGICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHgzODBEICAgLy8gVGFnIEltYWdlIEZpbGUgRm9ybWF0CisjZGVmaW5lIE1UUF9GT1JNQVRfVElGRl9JVCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4MzgwRSAgIC8vIFRhZyBJbWFnZSBGaWxlIEZvcm1hdCBmb3IgSW5mb3JtYXRpb24gVGVjaG5vbG9neSAoZ3JhcGhpYyBhcnRzKQorI2RlZmluZSBNVFBfRk9STUFUX0pQMiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDM4MEYgICAvLyBKUEVHMjAwMCBCYXNlbGluZSBGaWxlIEZvcm1hdAorI2RlZmluZSBNVFBfRk9STUFUX0pQWCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDM4MTAgICAvLyBKUEVHMjAwMCBFeHRlbmRlZCBGaWxlIEZvcm1hdAorI2RlZmluZSBNVFBfRk9STUFUX1VOREVGSU5FRF9GSVJNV0FSRSAgICAgICAgICAgICAgICAgICAweEI4MDIKKyNkZWZpbmUgTVRQX0ZPUk1BVF9XSU5ET1dTX0lNQUdFX0ZPUk1BVCAgICAgICAgICAgICAgICAgMHhCODgxCisjZGVmaW5lIE1UUF9GT1JNQVRfVU5ERUZJTkVEX0FVRElPICAgICAgICAgICAgICAgICAgICAgIDB4QjkwMAorI2RlZmluZSBNVFBfRk9STUFUX1dNQSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweEI5MDEKKyNkZWZpbmUgTVRQX0ZPUk1BVF9PR0cgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHhCOTAyCisjZGVmaW5lIE1UUF9GT1JNQVRfQUFDICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4QjkwMworI2RlZmluZSBNVFBfRk9STUFUX0FVRElCTEUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweEI5MDQKKyNkZWZpbmUgTVRQX0ZPUk1BVF9GTEFDICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHhCOTA2CisjZGVmaW5lIE1UUF9GT1JNQVRfVU5ERUZJTkVEX1ZJREVPICAgICAgICAgICAgICAgICAgICAgIDB4Qjk4MAorI2RlZmluZSBNVFBfRk9STUFUX1dNViAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweEI5ODEKKyNkZWZpbmUgTVRQX0ZPUk1BVF9NUDRfQ09OVEFJTkVSICAgICAgICAgICAgICAgICAgICAgICAgMHhCOTgyICAvLyBJU08gMTQ0OTYtMQorI2RlZmluZSBNVFBfRk9STUFUX01QMiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweEI5ODMKKyNkZWZpbmUgTVRQX0ZPUk1BVF8zR1BfQ09OVEFJTkVSICAgICAgICAgICAgICAgICAgICAgICAgMHhCOTg0ICAvLyAzR1BQIGZpb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TVRQX0ZPUk1BVF9BQlNUUkFDVF9WSURFT19QTEFZTElTVCAgICAgICAgICAgICAgMHhCQTBBCisjZGVmaW5lIE1UUF9GT1JNQVRfQUJTVFJBQ1RfTUVESUFDQVNUICAgICAgICAgICAgICAgICAgIDB4QkEwQiAvLyBGb3IgdXNlIHdpdGggbWVkaWFjYXN0czsgcmVmZXJlbmNlcyBtdWx0aW1lZGlhIGVuY2xvc3VyZXMgb2YgUlNTIGZlZWRzIG9yIGVwaXNvZGljIGNvbnRlbnQKKyNkZWZpbmUgTVRQX0ZPUk1BVF9XUExfUExBWUxJU1QgICAgICAgICAgICAgICAgICAgICAgICAgMHhCQTEwCisjZGVmaW5lIE1UUF9GT1JNQVRfTTNVX1BMQVlMSVNUICAgICAgICAgICAgICAgICAgICAgICAgIDB4QkExMQorI2RlZmluZSBNVFBfRk9STUFUX01QTF9QTEFZTElTVCAgICAgICAgICAgICAgICAgICAgICAgICAweEJBMTIKKyNkZWZpbmUgTVRQX0ZPUk1BVF9BU1hfUExBWUxJU1QgICAgICAgICAgICAgICAgICAgICAgICAgMHhCQTEzCisjZGVmaW5lIE1UUF9GT1JNQVRfUExTX1BMQVlMSVNUICAgICAgICAgICAgICAgICAgICAgICAgIDB4QkExNAorI2RlZmluZSBNVFBfRk9STUFUX1VOREVGSU5FRF9ET0NVTUVOVCAgICAgICAgICAgICAgICAgICAweEJBODAKKyNkZWZpbmUgTVRQX0ZPUk1BVF9BQlNUUkFDVF9ET0NVTUVOVCAgICAgICAgICAgICAgICAgICAgMHhCQTgxCisjZGVmaW5lIE1UUF9GT1JNQVRfWE1MX0RPQ1VNRU5UICAgICAgICAgICAgICAgICAgICAgICAgIDB4QkE4MgorI2RlZmluZSBNVFBfRk9STUFUX01TX1dPUkRfRE9DVU1FTlQgICAgICAgICAgICAgICAgICAgICAweEJBODMKKyNkZWZpbmUgTVRQX0ZPUk1BVF9NSFRfQ09NUElMRURfSFRNTF9ET0NVTUVOVCAgICAgICAgICAgMHhCQTg0CisjZGVmaW5lIE1UUF9GT1JNQVRfTVNfRVhDRUxfU1BSRUFEU0hFRVQgICAgICAgICAgICAgICAgIDB4QkE4NQorI2RlZmluZSBNVFBfRk9STUFUX01TX1BPV0VSUE9JTlRfUFJFU0VOVEFUSU9OICAgICAgICAgICAweEJBODYKKyNkZWZpbmUgTVRQX0ZPUk1BVF9VTkRFRklORURfTUVTU0FHRSAgICAgICAgICAgICAgICAgICAgMHhCQjAwCisjZGVmaW5lIE1UUF9GT1JNQVRfQUJTVFJBQ1RfTUVTU1NBR0UgICAgICAgICAgICAgICAgICAgIDB4QkIwMQorI2RlZmluZSBNVFBfRk9STUFUX1VOREVGSU5FRF9DT05UQUNUICAgICAgICAgICAgICAgICAgICAweEJCODAKKyNkZWZpbmUgTVRQX0ZPUk1BVF9BQlNUUkFDVF9DT05UQUNUICAgICAgICAgICAgICAgICAgICAgMHhCQjgxCisjZGVmaW5lIE1UUF9GT1JNQVRfVkNBUkRfMiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4QkI4MgorCisvLyBNVFAgT2JqZWN0IFByb3BlcnR5IENvZGVzCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9TVE9SQUdFX0lEICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweERDMDEKKyNkZWZpbmUgTVRQX1BST1BFUlRZX09CSkVDVF9GT1JNQVQgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REMwMgorI2RlZmluZSBNVFBfUFJPUEVSVFlfUFJPVEVDVElPTl9TVEFUVVMgICAgICAgICAgICAgICAgICAgICAgMHhEQzAzCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9PQkpFQ1RfU0laRSAgICAgICAgICAgICAgICAgICAgICAgICAgICAweERDMDQKKyNkZWZpbmUgTVRQX1BST1BFUlRZX0FTU09DSUFUSU9OX1RZUEUgICAgICAgICAgICAgICAgICAgICAgIDB4REMwNQorI2RlZmluZSBNVFBfUFJPUEVSVFlfQVNTT0NJQVRJT05fREVTQyAgICAgICAgICAgICAgICAgICAgICAgMHhEQzA2CisjZGVmaW5lIE1UUF9QUk9QRVJUWV9PQkpFQ1RfRklMRV9OQU1FICAgICAgICAgICAgICAgICAgICAgICAweERDMDcKKyNkZWZpbmUgTVRQX1BST1BFUlRZX0RBVEVfQ1JFQVRFRCAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REMwOAorI2RlZmluZSBNVFBfUFJPUEVSVFlfREFURV9NT0RJRklFRCAgICAgICAgICAgICAgICAgICAgICAgICAgMHhEQzA5CisjZGVmaW5lIE1UUF9QUk9QRVJUWV9LRVlXT1JEUyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweERDMEEKKyNkZWZpbmUgTVRQX1BST1BFUlRZX1BBUkVOVF9PQkpFQ1QgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REMwQgorI2RlZmluZSBNVFBfUFJPUEVSVFlfQUxMT1dFRF9GT0xERVJfQ09OVEVOVFMgICAgICAgICAgICAgICAgMHhEQzBDCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9ISURERU4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweERDMEQKKyNkZWZpbmUgTVRQX1BST1BFUlRZX1NZU1RFTV9PQkpFQ1QgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REMwRQorI2RlZmluZSBNVFBfUFJPUEVSVFlfUEVSU0lTVEVOVF9VSUQgICAgICAgICAgICAgICAgICAgICAgICAgMHhEQzQxCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9TWU5DX0lEICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweERDNDIKKyNkZWZpbmUgTVRQX1BST1BFUlRZX1BST1BFUlRZX0JBRyAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM0MworI2RlZmluZSBNVFBfUFJPUEVSVFlfTkFNRSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHhEQzQ0CisjZGVmaW5lIE1UUF9QUk9QRVJUWV9DUkVBVEVEX0JZICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweERDNDUKKyNkZWZpbmUgTVRQX1BST1BFUlRZX0FSVElTVCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM0NgorI2RlZmluZSBNVFBfUFJPUEVSVFlfREFURV9BVVRIT1JFRCAgICAgICAgICAgICAgICAgICAgICAgICAgMHhEQzQ3CisjZGVmaW5lIE1UUF9QUk9QRVJUWV9ERVNDUklQVElPTiAgICAgICAgICAgICAgICAgICAgICAgICAgICAweERDNDgKKyNkZWZpbmUgTVRQX1BST1BFUlRZX1VSTF9SRUZFUkVOQ0UgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM0OQorI2RlZmluZSBNVFBfUFJPUEVSVFlfTEFOR1VBR0VfTE9DQUxFICAgICAgICAgICAgICAgICAgICAgICAgMHhEQzRBCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9DT1BZUklHSFRfSU5GT1JNQVRJT04gICAgICAgICAgICAgICAgICAweERDNEIKKyNkZWZpbmUgTVRQX1BST1BFUlRZX1NPVVJDRSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM0QworI2RlZmluZSBNVFBfUFJPUEVSVFlfT1JJR0lOX0xPQ0FUSU9OICAgICAgICAgICAgICAgICAgICAgICAgMHhEQzRECisjZGVmaW5lIE1UUF9QUk9QRVJUWV9EQVRFX0FEREVEICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweERDNEUKKyNkZWZpbmUgTVRQX1BST1BFUlRZX05PTl9DT05TVU1BQkxFICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM0RgorI2RlZmluZSBNVFBfUFJPUEVSVFlfQ09SUlVQVF9VTlBMQVlBQkxFICAgICAgICAgICAgICAgICAgICAgMHhEQzUwCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9QUk9EVUNFUl9TRVJJQUxfTlVNQkVSICAgICAgICAgICAgICAgICAweERDNTEKKyNkZWZpbmUgTVRQX1BST1BFUlRZX1JFUFJFU0VOVEFUSVZFX1NBTVBMRV9GT1JNQVQgICAgICAgICAgIDB4REM4MQorI2RlZmluZSBNVFBfUFJPUEVSVFlfUkVQUkVTRU5UQVRJVkVfU0FNUExFX1NJWkUgICAgICAgICAgICAgMHhEQzgyCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9SRVBSRVNFTlRBVElWRV9TQU1QTEVfSEVJR0hUICAgICAgICAgICAweERDODMKKyNkZWZpbmUgTVRQX1BST1BFUlRZX1JFUFJFU0VOVEFUSVZFX1NBTVBMRV9XSURUSCAgICAgICAgICAgIDB4REM4NAorI2RlZmluZSBNVFBfUFJPUEVSVFlfUkVQUkVTRU5UQVRJVkVfU0FNUExFX0RVUkFUSU9OICAgICAgICAgMHhEQzg1CisjZGVmaW5lIE1UUF9QUk9QRVJUWV9SRVBSRVNFTlRBVElWRV9TQU1QTEVfREFUQSAgICAgICAgICAgICAweERDODYKKyNkZWZpbmUgTVRQX1BST1BFUlRZX1dJRFRIICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM4NworI2RlZmluZSBNVFBfUFJPUEVSVFlfSEVJR0hUICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHhEQzg4CisjZGVmaW5lIE1UUF9QUk9QRVJUWV9EVVJBVElPTiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweERDODkKKyNkZWZpbmUgTVRQX1BST1BFUlRZX1JBVElORyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM4QQorI2RlZmluZSBNVFBfUFJPUEVSVFlfVFJBQ0sgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHhEQzhCCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9HRU5SRSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweERDOEMKKyNkZWZpbmUgTVRQX1BST1BFUlRZX0NSRURJVFMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM4RAorI2RlZmluZSBNVFBfUFJPUEVSVFlfTFlSSUNTICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHhEQzhFCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9TVUJTQ1JJUFRJT05fQ09OVEVOVF9JRCAgICAgICAgICAgICAgICAweERDOEYKKyNkZWZpbmUgTVRQX1BST1BFUlRZX1BST0RVQ0VEX0JZICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM5MAorI2RlZmluZSBNVFBfUFJPUEVSVFlfVVNFX0NPVU5UICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHhEQzkxCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9TS0lQX0NPVU5UICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweERDOTIKKyNkZWZpbmUgTVRQX1BST1BFUlRZX0xBU1RfQUNDRVNTRUQgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM5MworI2RlZmluZSBNVFBfUFJPUEVSVFlfUEFSRU5UQUxfUkFUSU5HICAgICAgICAgICAgICAgICAgICAgICAgMHhEQzk0CisjZGVmaW5lIE1UUF9QUk9QRVJUWV9NRVRBX0dFTlJFICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweERDOTUKKyNkZWZpbmUgTVRQX1BST1BFUlRZX0NPTVBPU0VSICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM5NgorI2RlZmluZSBNVFBfUFJPUEVSVFlfRUZGRUNUSVZFX1JBVElORyAgICAgICAgICAgICAgICAgICAgICAgMHhEQzk3CisjZGVmaW5lIE1UUF9QUk9QRVJUWV9TVUJUSVRMRSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweERDOTgKKyNkZWZpbmUgTVRQX1BST1BFUlRZX09SSUdJTkFMX1JFTEVBU0VfREFURSAgICAgICAgICAgICAgICAgIDB4REM5OQorI2RlZmluZSBNVFBfUFJPUEVSVFlfQUxCVU1fTkFNRSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHhEQzlBCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9BTEJVTV9BUlRJU1QgICAgICAgICAgICAgICAgICAgICAgICAgICAweERDOUIKKyNkZWZpbmUgTVRQX1BST1BFUlRZX01PT0QgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM5QworI2RlZmluZSBNVFBfUFJPUEVSVFlfRFJNX1NUQVRVUyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHhEQzlECisjZGVmaW5lIE1UUF9QUk9QRVJUWV9TVUJfREVTQ1JJUFRJT04gICAgICAgICAgICAgICAgICAgICAgICAweERDOUUKKyNkZWZpbmUgTVRQX1BST1BFUlRZX0lTX0NST1BQRUQgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4RENEMQorI2RlZmluZSBNVFBfUFJPUEVSVFlfSVNfQ09MT1VSX0NPUlJFQ1RFRCAgICAgICAgICAgICAgICAgICAgMHhEQ0QyCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9JTUFHRV9CSVRfREVQVEggICAgICAgICAgICAgICAgICAgICAgICAweERDRDMKKyNkZWZpbmUgTVRQX1BST1BFUlRZX0ZfTlVNQkVSICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4RENENAorI2RlZmluZSBNVFBfUFJPUEVSVFlfRVhQT1NVUkVfVElNRSAgICAgICAgICAgICAgICAgICAgICAgICAgMHhEQ0Q1CisjZGVmaW5lIE1UUF9QUk9QRVJUWV9FWFBPU1VSRV9JTkRFWCAgICAgICAgICAgICAgICAgICAgICAgICAweERDRDYKKyNkZWZpbmUgTVRQX1BST1BFUlRZX1RPVEFMX0JJVFJBVEUgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REU5MQorI2RlZmluZSBNVFBfUFJPUEVSVFlfQklUUkFURV9UWVBFICAgICAgICAgICAgICAgICAgICAgICAgICAgMHhERTkyCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9TQU1QTEVfUkFURSAgICAgICAgICAgICAgICAgICAgICAgICAgICAweERFOTMKKyNkZWZpbmUgTVRQX1BST1BFUlRZX05VTUJFUl9PRl9DSEFOTkVMUyAgICAgICAgICAgICAgICAgICAgIDB4REU5NAorI2RlZmluZSBNVFBfUFJPUEVSVFlfQVVESU9fQklUX0RFUFRIICAgICAgICAgICAgICAgICAgICAgICAgMHhERTk1CisjZGVmaW5lIE1UUF9QUk9QRVJUWV9TQ0FOX1RZUEUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweERFOTcKKyNkZWZpbmUgTVRQX1BST1BFUlRZX0FVRElPX1dBVkVfQ09ERUMgICAgICAgICAgICAgICAgICAgICAgIDB4REU5OQorI2RlZmluZSBNVFBfUFJPUEVSVFlfQVVESU9fQklUUkFURSAgICAgICAgICAgICAgICAgICAgICAgICAgMHhERTlBCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9WSURFT19GT1VSQ0NfQ09ERUMgICAgICAgICAgICAgICAgICAgICAweERFOUIKKyNkZWZpbmUgTVRQX1BST1BFUlRZX1ZJREVPX0JJVFJBVEUgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REU5QworI2RlZmluZSBNVFBfUFJPUEVSVFlfRlJBTUVTX1BFUl9USE9VU0FORF9TRUNPTkRTICAgICAgICAgICAgMHhERTlECisjZGVmaW5lIE1UUF9QUk9QRVJUWV9LRVlGUkFNRV9ESVNUQU5DRSAgICAgICAgICAgICAgICAgICAgICAweERFOUUKKyNkZWZpbmUgTVRQX1BST1BFUlRZX0JVRkZFUl9TSVpFICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REU5RgorI2RlZmluZSBNVFBfUFJPUEVSVFlfRU5DT0RJTkdfUVVBTElUWSAgICAgICAgICAgICAgICAgICAgICAgMHhERUEwCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9FTkNPRElOR19QUk9GSUxFICAgICAgICAgICAgICAgICAgICAgICAweERFQTEKKyNkZWZpbmUgTVRQX1BST1BFUlRZX0RJU1BMQVlfTkFNRSAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4RENFMAorI2RlZmluZSBNVFBfUFJPUEVSVFlfQk9EWV9URVhUICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHhEQ0UxCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9TVUJKRUNUICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweERDRTIKKyNkZWZpbmUgTVRQX1BST1BFUlRZX1BSSU9SSVRZICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4RENFMworI2RlZmluZSBNVFBfUFJPUEVSVFlfR0lWRU5fTkFNRSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHhERDAwCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9NSURETEVfTkFNRVMgICAgICAgICAgICAgICAgICAgICAgICAgICAweEREMDEKKyNkZWZpbmUgTVRQX1BST1BFUlRZX0ZBTUlMWV9OQU1FICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQwMgorI2RlZmluZSBNVFBfUFJPUEVSVFlfUFJFRklYICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHhERDAzCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9TVUZGSVggICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweEREMDQKKyNkZWZpbmUgTVRQX1BST1BFUlRZX1BIT05FVElDX0dJVkVOX05BTUUgICAgICAgICAgICAgICAgICAgIDB4REQwNQorI2RlZmluZSBNVFBfUFJPUEVSVFlfUEhPTkVUSUNfRkFNSUxZX05BTUUgICAgICAgICAgICAgICAgICAgMHhERDA2CisjZGVmaW5lIE1UUF9QUk9QRVJUWV9FTUFJTF9QUklNQVJZICAgICAgICAgICAgICAgICAgICAgICAgICAweEREMDcKKyNkZWZpbmUgTVRQX1BST1BFUlRZX0VNQUlMX1BFUlNPTkFMXzEgICAgICAgICAgICAgICAgICAgICAgIDB4REQwOAorI2RlZmluZSBNVFBfUFJPUEVSVFlfRU1BSUxfUEVSU09OQUxfMiAgICAgICAgICAgICAgICAgICAgICAgMHhERDA5CisjZGVmaW5lIE1UUF9QUk9QRVJUWV9FTUFJTF9CVVNJTkVTU18xICAgICAgICAgICAgICAgICAgICAgICAweEREMEEKKyNkZWZpbmUgTVRQX1BST1BFUlRZX0VNQUlMX0JVU0lORVNTXzIgICAgICAgICAgICAgICAgICAgICAgIDB4REQwQgorI2RlZmluZSBNVFBfUFJPUEVSVFlfRU1BSUxfT1RIRVJTICAgICAgICAgICAgICAgICAgICAgICAgICAgMHhERDBDCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9QSE9ORV9OVU1CRVJfUFJJTUFSWSAgICAgICAgICAgICAgICAgICAweEREMEQKKyNkZWZpbmUgTVRQX1BST1BFUlRZX1BIT05FX05VTUJFUl9QRVJTT05BTCAgICAgICAgICAgICAgICAgIDB4REQwRQorI2RlZmluZSBNVFBfUFJPUEVSVFlfUEhPTkVfTlVNQkVSX1BFUlNPTkFMXzIgICAgICAgICAgICAgICAgMHhERDBGCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9QSE9ORV9OVU1CRVJfQlVTSU5FU1MgICAgICAgICAgICAgICAgICAweEREMTAKKyNkZWZpbmUgTVRQX1BST1BFUlRZX1BIT05FX05VTUJFUl9CVVNJTkVTU18yICAgICAgICAgICAgICAgIDB4REQxMQorI2RlZmluZSBNVFBfUFJPUEVSVFlfUEhPTkVfTlVNQkVSX01PQklMRSAgICAgICAgICAgICAgICAgICAgMHhERDEyCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9QSE9ORV9OVU1CRVJfTU9CSUxFXzIgICAgICAgICAgICAgICAgICAweEREMTMKKyNkZWZpbmUgTVRQX1BST1BFUlRZX0ZBWF9OVU1CRVJfUFJJTUFSWSAgICAgICAgICAgICAgICAgICAgIDB4REQxNAorI2RlZmluZSBNVFBfUFJPUEVSVFlfRkFYX05VTUJFUl9QRVJTT05BTCAgICAgICAgICAgICAgICAgICAgMHhERDE1CisjZGVmaW5lIE1UUF9QUk9QRVJUWV9GQVhfTlVNQkVSX0JVU0lORVNTICAgICAgICAgICAgICAgICAgICAweEREMTYKKyNkZWZpbmUgTVRQX1BST1BFUlRZX1BBR0VSX05VTUJFUiAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQxNworI2RlZmluZSBNVFBfUFJPUEVSVFlfUEhPTkVfTlVNQkVSX09USEVSUyAgICAgICAgICAgICAgICAgICAgMHhERDE4CisjZGVmaW5lIE1UUF9QUk9QRVJUWV9QUklNQVJZX1dFQl9BRERSRVNTICAgICAgICAgICAgICAgICAgICAweEREMTkKKyNkZWZpbmUgTVRQX1BST1BFUlRZX1BFUlNPTkFMX1dFQl9BRERSRVNTICAgICAgICAgICAgICAgICAgIDB4REQxQQorI2RlZmluZSBNVFBfUFJPUEVSVFlfQlVTSU5FU1NfV0VCX0FERFJFU1MgICAgICAgICAgICAgICAgICAgMHhERDFCCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9JTlNUQU5UX01FU1NBTkdFUl9BRERSRVNTICAgICAgICAgICAgICAweEREMUMKKyNkZWZpbmUgTVRQX1BST1BFUlRZX0lOU1RBTlRfTUVTU0FOR0VSX0FERFJFU1NfMiAgICAgICAgICAgIDB4REQxRAorI2RlZmluZSBNVFBfUFJPUEVSVFlfSU5TVEFOVF9NRVNTQU5HRVJfQUREUkVTU18zICAgICAgICAgICAgMHhERDFFCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9QT1NUQUxfQUREUkVTU19QRVJTT05BTF9GVUxMICAgICAgICAgICAweEREMUYKKyNkZWZpbmUgTVRQX1BST1BFUlRZX1BPU1RBTF9BRERSRVNTX1BFUlNPTkFMX0xJTkVfMSAgICAgICAgIDB4REQyMAorI2RlZmluZSBNVFBfUFJPUEVSVFlfUE9TVEFMX0FERFJFU1NfUEVSU09OQUxfTElORV8yICAgICAgICAgMHhERDIxCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9QT1NUQUxfQUREUkVTU19QRVJTT05BTF9DSVRZICAgICAgICAgICAweEREMjIKKyNkZWZpbmUgTVRQX1BST1BFUlR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xJTkVfMiAgICAgICAgICAgIDB4REQyRgorI2RlZmluZSBNVFBfUFJPUEVSVFlfUE9TVEFMX0FERFJFU1NfT1RIRVJfQ0lUWSAgICAgICAgICAgICAgMHhERDMwCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9QT1NUQUxfQUREUkVTU19PVEhFUl9SRUdJT04gICAgICAgICAgICAweEREMzEKKyNkZWZpbmUgTVRQX1BST1BFUlRZX1BPU1RBTF9BRERSRVNTX09USEVSX1BPU1RBTF9DT0RFICAgICAgIDB4REQzMgorI2RlZmluZSBNVFBfUFJPUEVSVFlfUE9TVEFMX0FERFJFU1NfT1RIRVJfQ09VTlRSWSAgICAgICAgICAgMHhERDMzCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9PUkdBTklaQVRJT05fTkFNRSAgICAgICAgICAgICAgICAgICAgICAweEREMzQKKyNkZWZpbmUgTVRQX1BST1BFUlRZX1BIT05FVElDX09SR0FOSVpBVElPTl9OQU1FICAgICAgICAgICAgIDB4REQzNQorI2RlZmluZSBNVFBfUFJPUEVSVFlfUk9MRSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHhERDM2CisjZGVmaW5lIE1UUF9QUk9QRVJUWV9CSVJUSERBVEUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweEREMzcKKyNkZWZpbmUgTVRQX1BST1BFUlRZX01FU1NBR0VfVE8gICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQ0MAorI2RlZmluZSBNVFBfUFJPUEVSVFlfTUVTU0FHRV9DQyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHhERDQxCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9NRVNTQUdFX0JDQyAgICAgICAgICAgICAgICAgICAgICAgICAgICAweERENDIKKyNkZWZpbmUgTVRQX1BST1BFUlRZX01FU1NBR0VfUkVBRCAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQ0MworI2RlZmluZSBNVFBfUFJPUEVSVFlfTUVTU0FHRV9SRUNFSVZFRF9USU1FICAgICAgICAgICAgICAgICAgMHhERDQ0CisjZGVmaW5lIE1UUF9QUk9QRVJUWV9NRVNTQUdFX1NFTkRFUiAgICAgICAgICAgICAgICAgICAgICAgICAweERENDUKKyNkZWZpbmUgTVRQX1BST1BFUlRZX0FDVElWSVRZX0JFR0lOX1RJTUUgICAgICAgICAgICAgICAgICAgIDB4REQ1MAorI2RlZmluZSBNVFBfUFJPUEVSVFlfQUNUSVZJVFlfRU5EX1RJTUUgICAgICAgICAgICAgICAgICAgICAgMHhERDUxCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9BQ1RJVklUWV9MT0NBVElPTiAgICAgICAgICAgICAgICAgICAgICAweERENTIKKyNkZWZpbmUgTVRQX1BST1BFUlRZX0FDVElWSVRZX1JFUVVJUkVEX0FUVEVOREVFUyAgICAgICAgICAgIDB4REQ1NAorI2RlZmluZSBNVFBfUFJPUEVSVFlfQUNUSVZJVFlfT1BUSU9OQUxfQVRURU5ERUVTICAgICAgICAgICAgMHhERDU1CisjZGVmaW5lIE1UUF9QUk9QRVJUWV9BQ1RJVklUWV9SRVNPVVJDRVMgICAgICAgICAgICAgICAgICAgICAweERENTYKKyNkZWZpbmUgTVRQX1BST1BFUlRZX0FDVElWSVRZX0FDQ0VQVEVEICAgICAgICAgICAgICAgICAgICAgIDB4REQ1NworI2RlZmluZSBNVFBfUFJPUEVSVFlfQUNUSVZJVFlfVEVOVEFUSVZFICAgICAgICAgICAgICAgICAgICAgMHhERDU4CisjZGVmaW5lIE1UUF9QUk9QRVJUWV9BQ1RJVklUWV9ERUNMSU5FRCAgICAgICAgICAgICAgICAgICAgICAweERENTkKKyNkZWZpbmUgTVRQX1BST1BFUlRZX0FDVElWSVRZX1JFTUFJTkRFUl9USU1FICAgICAgICAgICAgICAgIDB4REQ1QQorI2RlZmluZSBNVFBfUFJPUEVSVFlfQUNUSVZJVFlfT1dORVIgICAgICAgICAgICAgICAgICAgICAgICAgMHhERDVCCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9BQ1RJVklUWV9TVEFUVVMgICAgICAgICAgICAgICAgICAgICAgICAweERENUMKKyNkZWZpbmUgTVRQX1BST1BFUlRZX09XTkVSICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQ1RAorI2RlZmluZSBNVFBfUFJPUEVSVFlfRURJVE9SICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHhERDVFCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9XRUJNQVNURVIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweERENUYKKyNkZWZpbmUgTVRQX1BST1BFUlRZX1VSTF9TT1VSQ0UgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQ2MAorI2RlZmluZSBNVFBfUFJPUEVSVFlfVVJMX0RFU1RJTkFUSU9OICAgICAgICAgICAgICAgICAgICAgICAgMHhERDYxCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9USU1FX0JPT0tNQVJLICAgICAgICAgICAgICAgICAgICAgICAgICAweERENjIKKyNkZWZpbmUgTVRQX1BST1BFUlRZX09CSkVDVF9CT09LTUFSSyAgICAgICAgICAgICAgICAgICAgICAgIDB4REQ2MworI2RlZmluZSBNVFBfUFJPUEVSVFlfQllURV9CT09LTUFSSyAgICAgICAgICAgICAgICAgICAgICAgICAgMHhERDY0CisjZGVmaW5lIE1UUF9QUk9QRVJUWV9MQVNUX0JVSUxEX0RBVEUgICAgICAgICAgICAgICAgICAgICAgICAweERENzAKKyNkZWZpbmUgTVRQX1BST1BFUlRZX1RJTUVfVE9fTElWRSAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQ3MQorI2RlZmluZSBNVFBfUFJPUEVSVFlfTUVESUFfR1VJRCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHhERDcyCisKKy8vIE1UUCBEZXZpY2UgUHJvcGVydHkgQ29kZXMKKyNkZWZpbmUgTVRQX0RFVklDRV9QUk9QRVJUWV9VTkRFRklORUQgICAgICAgICAgICAgICAgICAgICAgIDB4NTAwMAorI2RlZmluZSBNVFBfREVWSUNFX1BST1BFUlRZX0JBVFRFUllfTEVWRUwgICAgICAgICAgICAgICAgICAgMHg1MDAxCisjZGVmaW5lIE1UUF9ERVZJQ0VfUFJPUEVSVFlfRlVOQ1RJT05BTF9NT0RFICAgICAgICAgICAgICAgICAweDUwMDIKKyNkZWZpbmUgTVRQX0RFVklDRV9QUk9QRVJUWV9JTUFHRV9TSVpFICAgICAgICAgICAgICAgICAgICAgIDB4NTAwMworI2RlZmluZSBNVFBfREVWSUNFX1BST1BFUlRZX0NPTVBSRVNTSU9OX1NFVFRJTkcgICAgICAgICAgICAgMHg1MDA0CisjZGVmaW5lIE1UUF9ERVZJQ0VfUFJPUEVSVFlfV0hJVEVfQkFMQU5DRSAgICAgICAgICAgICAgICAgICAweDUwMDUKKyNkZWZpbmUgTVRQX0RFVklDRV9QUk9QRVJUWV9SR0JfR0FJTiAgICAgICAgICAgICAgICAgICAgICAgIDB4NTAwNgorI2RlZmluZSBNVFBfREVWSUNFX1BST1BFUlRZX0ZfTlVNQkVSICAgICAgICAgICAgICAgICAgICAgICAgMHg1MDA3CisjZGVmaW5lIE1UUF9ERVZJQ0VfUFJPUEVSVFlfRk9DQUxfTEVOR1RIICAgICAgICAgICAgICAgICAgICAweDUwMDgKKyNkZWZpbmUgTVRQX0RFVklDRV9QUk9QRVJUWV9GT0NVU19ESVNUQU5DRSAgICAgICAgICAgICAgICAgIDB4NTAwOQorI2RlZmluZSBNVFBfREVWSUNFX1BST1BFUlRZX0ZPQ1VTX01PREUgICAgICAgICAgICAgICAgICAgICAgMHg1MDBBCisjZGVmaW5lIE1UUF9ERVZJQ0VfUFJPUEVSVFlfRVhQT1NVUkVfTUVURVJJTkdfTU9ERSAgICAgICAgICAweDUwMEIKKyNkZWZpbmUgTVRQX0RFVklDRV9QUk9QRVJUWV9GTEFTSF9NT0RFICAgICAgICAgICAgICAgICAgICAgIDB4NTAwQworI2RlZmlu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AgICAgMHhENDEwCisjZGVmaW5lIE1UUF9ERVZJQ0VfUFJPUEVSVFlfUExBWUJBQ0tfT0JKRUNUICAgICAgICAgICAgICAgICAweEQ0MTEKKyNkZWZpbmUgTVRQX0RFVklDRV9QUk9QRVJUWV9QTEFZQkFDS19DT05UQUlORVJfSU5ERVggICAgICAgIDB4RDQxMgorI2RlZmluZSBNVFBfREVWSUNFX1BST1BFUlRZX1NFU1NJT05fSU5JVElBVE9SX1ZFUlNJT05fSU5GTyAgMHhENDA2CisjZGVmaW5lIE1UUF9ERVZJQ0VfUFJPUEVSVFlfUEVSQ0VJVkVEX0RFVklDRV9UWVBFICAgICAgICAgICAweEQ0MDcKKworLy8gTVRQIE9wZXJhdGlvbiBDb2RlcworI2RlZmluZSBNVFBfT1BFUkFUSU9OX0dFVF9ERVZJQ0VfSU5GTyAgICAgICAgICAgICAgICAgICAgICAgMHgxMDAxCisjZGVmaW5lIE1UUF9PUEVSQVRJT05fT1BFTl9TRVNTSU9OICAgICAgICAgICAgICAgICAgICAgICAgICAweDEwMDIKKyNkZWZpbmUgTVRQX09QRVJBVElPTl9DTE9TRV9TRVNTSU9OICAgICAgICAgICAgICAgICAgICAgICAgIDB4MTAwMworI2RlZmluZSBNVFBfT1BFUkFUSU9OX0dFVF9TVE9SQUdFX0lEUyAgICAgICAgICAgICAgICAgICAgICAgMHgxMDA0CisjZGVmaW5lIE1UUF9PUEVSQVRJT05fR0VUX1NUT1JBR0VfSU5GTyAgICAgICAgICAgICAgICAgICAgICAweDEwMDUKKyNkZWZpbmUgTVRQX09QRVJBVElPTl9HRVRfTlVNX09CSkVDVFMgICAgICAgICAgICAgICAgICAgICAgIDB4MTAwNgorI2RlZmluZSBNVFBfT1BFUkFUSU9OX0dFVF9PQkpFQ1RfSEFORExFUyAgICAgICAgICAgICAgICAgICAgMHgxMDA3CisjZGVmaW5lIE1UUF9PUEVSQVRJT05fR0VUX09CSkVDVF9JTkZPICAgICAgICAgICAgICAgICAgICAgICAweDEwMDgKKyNkZWZpbmUgTVRQX09QRVJBVElPTl9HRVRfT0JKRUNUICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4MTAwOQorI2RlZmluZSBNVFBfT1BFUkFUSU9OX0dFVF9USFVNQiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHgxMDBBCisjZGVmaW5lIE1UUF9PUEVSQVRJT05fREVMRVRFX09CSkVDVCAgICAgICAgICAgICAgICAgICAgICAgICAweDEwMEIKKyNkZWZpbmUgTVRQX09QRVJBVElPTl9TRU5EX09CSkVDVF9JTkZPICAgICAgICAgICAgICAgICAgICAgIDB4MTAwQworI2RlZmluZSBNVFBfT1BFUkFUSU9OX1NFTkRfT0JKRUNUICAgICAgICAgICAgICAgICAgICAgICAgICAgMHgxMDBECisjZGVmaW5lIE1UUF9PUEVSQVRJT05fSU5JVElBVEVfQ0FQVFVSRSAgICAgICAgICAgICAgICAgICAgICAweDEwMEUKKyNkZWZpbmUgTVRQX09QRVJBVElPTl9GT1JNQVRfU1RPUkUgICAgICAgICAgICAgICAgICAgICAgICAgIDB4MTAwRgorI2RlZmluZSBNVFBfT1BFUkFUSU9OX1JFU0VUX0RFVklDRSAgICAgICAgICAgICAgICAgICAgICAgICAgMHgxMDEwCisjZGVmaW5lIE1UUF9PUEVSQVRJT05fU0VMRl9URVNUICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDEwMTEKKyNkZWZpbmUgTVRQX09QRVJBVElPTl9TRVRfT0JKRUNUX1BST1RFQ1RJT04gICAgICAgICAgICAgICAgIDB4MTAxMgorI2RlZmluZSBNVFBfT1BFUkFUSU9OX1BPV0VSX0RPV04gICAgICAgICAgICAgICAgICAgICAgICAgICAgMHgxMDEzCisjZGVmaW5lIE1UUF9PUEVSQVRJT05fR0VUX0RFVklDRV9QUk9QX0RFU0MgICAgICAgICAgICAgICAgICAweDEwMTQKKyNkZWZpbmUgTVRQX09QRVJBVElPTl9HRVRfREVWSUNFX1BST1BfVkFMVUUgICAgICAgICAgICAgICAgIDB4MTAxNQorI2RlZmluZSBNVFBfT1BFUkFUSU9OX1NFVF9ERVZJQ0VfUFJPUF9WQUxVRSAgICAgICAgICAgICAgICAgMHgxMDE2CisjZGVmaW5lIE1UUF9PUEVSQVRJT05fUkVTRVRfREVWSUNFX1BST1BfVkFMVUUgICAgICAgICAgICAgICAweDEwMTcKKyNkZWZpbmUgTVRQX09QRVJBVElPTl9URVJNSU5BVEVfT1BFTl9DQVBUVVJFICAgICAgICAgICAgICAgIDB4MTAxOAorI2RlZmluZSBNVFBfT1BFUkFUSU9OX01PVkVfT0JKRUNUICAgICAgICAgICAgICAgICAgICAgICAgICAgMHgxMDE5CisjZGVmaW5lIE1UUF9PUEVSQVRJT05fQ09QWV9PQkpFQ1QgICAgICAgICAgICAgICAgICAgICAgICAgICAweDEwMUEKKyNkZWZpbmUgTVRQX09QRVJBVElPTl9HRVRfUEFSVElBTF9PQkpFQ1QgICAgICAgICAgICAgICAgICAgIDB4MTAxQgorI2RlZmluZSBNVFBfT1BFUkFUSU9OX0lOSVRJQVRFX09QRU5fQ0FQVFVSRSAgICAgICAgICAgICAgICAgMHgxMDFDCisjZGVmaW5lIE1UUF9PUEVSQVRJT05fR0VUX09CSkVDVF9QUk9QU19TVVBQT1JURUQgICAgICAgICAgICAweDk4MDEKKyNkZWZpbmUgTVRQX09QRVJBVElPTl9HRVRfT0JKRUNUX1BST1BfREVTQyAgICAgICAgICAgICAgICAgIDB4OTgwMgorI2RlZmluZSBNVFBfT1BFUkFUSU9OX0dFVF9PQkpFQ1RfUFJPUF9WQUxVRSAgICAgICAgICAgICAgICAgMHg5ODAzCisjZGVmaW5lIE1UUF9PUEVSQVRJT05fU0VUX09CSkVDVF9QUk9QX1ZBTFVFICAgICAgICAgICAgICAgICAweDk4MDQKKyNkZWZpbmUgTVRQX09QRVJBVElPTl9HRVRfT0JKRUNUX1JFRkVSRU5DRVMgICAgICAgICAgICAgICAgIDB4OTgxMAorI2RlZmluZSBNVFBfT1BFUkFUSU9OX1NFVF9PQkpFQ1RfUkVGRVJFTkNFUyAgICAgICAgICAgICAgICAgMHg5ODExCisjZGVmaW5lIE1UUF9PUEVSQVRJT05fU0tJUCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDk4MjAKKworLy8gTVRQIFJlc3BvbnNlIENvZGVzCisjZGVmaW5lIE1UUF9SRVNQT05TRV9VTkRFRklORUQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHgyMDAwCisjZGVmaW5lIE1UUF9SRVNQT05TRV9PSyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHgyMDAxCisjZGVmaW5lIE1UUF9SRVNQT05TRV9HRU5FUkFMX0VSUk9SICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHgyMDAyCisjZGVmaW5lIE1UUF9SRVNQT05TRV9TRVNTSU9OX05PVF9PUEVOICAgICAgICAgICAgICAgICAgICAgICAgICAgMHgyMDAzCisjZGVmaW5lIE1UUF9SRVNQT05TRV9JTlZBTElEX1RSQU5TQUNUSU9OX0lEICAgICAgICAgICAgICAgICAgICAgMHgyMDA0CisjZGVmaW5lIE1UUF9SRVNQT05TRV9PUEVSQVRJT05fTk9UX1NVUFBPUlRFRCAgICAgICAgICAgICAgICAgICAgMHgyMDA1CisjZGVmaW5lIE1UUF9SRVNQT05TRV9QQVJBTUVURVJfTk9UX1NVUFBPUlRFRCAgICAgICAgICAgICAgICAgICAgMHgyMDA2CisjZGVmaW5lIE1UUF9SRVNQT05TRV9JTkNPTVBMRVRFX1RSQU5TRkVSICAgICAgICAgICAgICAgICAgICAgICAgMHgyMDA3CisjZGVmaW5lIE1UUF9SRVNQT05TRV9JTlZBTElEX1NUT1JBR0VfSUQgICAgICAgICAgICAgICAgICAgICAgICAgMHgyMDA4CisjZGVmaW5lIE1UUF9SRVNQT05TRV9JTlZBTElEX09CSkVDVF9IQU5ETEUgICAgICAgICAgICAgICAgICAgICAgMHgyMDA5CisjZGVmaW5lIE1UUF9SRVNQT05TRV9ERVZJQ0VfUFJPUF9OT1RfU1VQUE9SVEVEICAgICAgICAgICAgICAgICAgMHgyMDBBCisjZGVmaW5lIE1UUF9SRVNQT05TRV9JTlZBTElEX09CSkVDVF9GT1JNQVRfQ09ERSAgICAgICAgICAgICAgICAgMHgyMDBCCisjZGVmaW5lIE1UUF9SRVNQT05TRV9TVE9SQUdFX0ZVTEwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHgyMDBDCisjZGVmaW5lIE1UUF9SRVNQT05TRV9PQkpFQ1RfV1JJVEVfUFJPVEVDVEVEICAgICAgICAgICAgICAgICAgICAgMHgyMDBECisjZGVmaW5lIE1UUF9SRVNQT05TRV9TVE9SRV9SRUFEX09OTFkgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHgyMDBFCisjZGVmaW5lIE1UUF9SRVNQT05TRV9BQ0NFU1NfREVOSUVEICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHgyMDBGCisjZGVmaW5lIE1UUF9SRVNQT05TRV9OT19USFVNQk5BSUxfUFJFU0VOVCAgICAgICAgICAgICAgICAgICAgICAgMHgyMDEwCisjZGVmaW5lIE1UUF9SRVNQT05TRV9TRUxGX1RFU1RfRkFJTEVEICAgICAgICAgICAgICAgICAgICAgICAgICAgMHgyMDExCisjZGVmaW5lIE1UUF9SRVNQT05TRV9QQVJUSUFMX0RFTEVUSU9OICAgICAgICAgICAgICAgICAgICAgICAgICAgMHgyMDEyCisjZGVmaW5lIE1UUF9SRVNQT05TRV9TVE9SRV9OT1RfQVZBSUxBQkxFICAgICAgICAgICAgICAgICAgICAgICAgMHgyMDEzCisjZGVmaW5lIE1UUF9SRVNQT05TRV9TUEVDSUZJQ0FUSU9OX0JZX0ZPUk1BVF9VTlNVUFBPUlRFRCAgICAgICAgMHgyMDE0CisjZGVmaW5lIE1UUF9SRVNQT05TRV9OT19WQUxJRF9PQkpFQ1RfSU5GTyAgICAgICAgICAgICAgICAgICAgICAgMHgyMDE1CisjZGVmaW5lIE1UUF9SRVNQT05TRV9JTlZBTElEX0NPREVfRk9STUFUICAgICAgICAgICAgICAgICAgICAgICAgMHgyMDE2CisjZGVmaW5lIE1UUF9SRVNQT05TRV9VTktOT1dOX1ZFTkRPUl9DT0RFICAgICAgICAgICAgICAgICAgICAgICAgMHgyMDE3CisjZGVmaW5lIE1UUF9SRVNQT05TRV9DQVBUVVJFX0FMUkVBRFlfVEVSTUlOQVRFRCAgICAgICAgICAgICAgICAgMHgyMDE4CisjZGVmaW5lIE1UUF9SRVNQT05TRV9ERVZJQ0VfQlVTWSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHgyMDE5CisjZGVmaW5lIE1UUF9SRVNQT05TRV9JTlZBTElEX1BBUkVOVF9PQkpFQ1QgICAgICAgICAgICAgICAgICAgICAgMHgyMDFBCisjZGVmaW5lIE1UUF9SRVNQT05TRV9JTlZBTElEX0RFVklDRV9QUk9QX0ZPUk1BVCAgICAgICAgICAgICAgICAgMHgyMDFCCisjZGVmaW5lIE1UUF9SRVNQT05TRV9JTlZBTElEX0RFVklDRV9QUk9QX1ZBTFVFICAgICAgICAgICAgICAgICAgMHgyMDFDCisjZGVmaW5lIE1UUF9SRVNQT05TRV9JTlZBTElEX1BBUkFNRVRFUiAgICAgICAgICAgICAgICAgICAgICAgICAgMHgyMDFECisjZGVmaW5lIE1UUF9SRVNQT05TRV9TRVNTSU9OX0FMUkVBRFlfT1BFTiAgICAgICAgICAgICAgICAgICAgICAgMHgyMDFFCisjZGVmaW5lIE1UUF9SRVNQT05TRV9UUkFOU0FDVElPTl9DQU5DRUxMRUQgICAgICAgICAgICAgICAgICAgICAgMHgyMDFGCisjZGVmaW5lIE1UUF9SRVNQT05TRV9TUEVDSUZJQ0FUSU9OX09GX0RFU1RJTkFUSU9OX1VOU1VQUE9SVEVEICAgMHgyMDIwCisjZGVmaW5lIE1UUF9SRVNQT05TRV9JTlZBTElEX09CSkVDVF9QUk9QX0NPREUgICAgICAgICAgICAgICAgICAgMHhBODAxCisjZGVmaW5lIE1UUF9SRVNQT05TRV9JTlZBTElEX09CSkVDVF9QUk9QX0ZPUk1BVCAgICAgICAgICAgICAgICAgMHhBODAyCisjZGVmaW5lIE1UUF9SRVNQT05TRV9JTlZBTElEX09CSkVDVF9QUk9QX1ZBTFVFICAgICAgICAgICAgICAgICAgMHhBODAzCisjZGVmaW5lIE1UUF9SRVNQT05TRV9JTlZBTElEX09CSkVDVF9SRUZFUkVOQ0UgICAgICAgICAgICAgICAgICAgMHhBODA0CisjZGVmaW5lIE1UUF9SRVNQT05TRV9HUk9VUF9OT1RfU1VQUE9SVEVEICAgICAgICAgICAgICAgICAgICAgICAgMHhBODA1CisjZGVmaW5lIE1UUF9SRVNQT05TRV9JTlZBTElEX0RBVEFTRVQgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHhBODA2CisjZGVmaW5lIE1UUF9SRVNQT05TRV9TUEVDSUZJQ0FUSU9OX0JZX0dST1VQX1VOU1VQUE9SVEVEICAgICAgICAgMHhBODA3CisjZGVmaW5lIE1UUF9SRVNQT05TRV9TUEVDSUZJQ0FUSU9OX0JZX0RFUFRIX1VOU1VQUE9SVEVEICAgICAgICAgMHhBODA4CisjZGVmaW5lIE1UUF9SRVNQT05TRV9PQkpFQ1RfVE9PX0xBUkdFICAgICAgICAgICAgICAgICAgICAgICAgICAgMHhBODA5CisjZGVmaW5lIE1UUF9SRVNQT05TRV9PQkpFQ1RfUFJPUF9OT1RfU1VQUE9SVEVEICAgICAgICAgICAgICAgICAgMHhBODBBCisKKy8vIE1UUCBFdmVudCBDb2RlcworI2RlZmluZSBNVFBfRVZFTlRfVU5ERUZJTkVEICAgICAgICAgICAgICAgICAgICAgICAgIDB4NDAwMAorI2RlZmluZSBNVFBfRVZFTlRfQ0FOQ0VMX1RSQU5TQUNUSU9OICAgICAgICAgICAgICAgIDB4NDAwMQorI2RlZmluZSBNVFBfRVZFTlRfT0JKRUNUX0FEREVEICAgICAgICAgICAgICAgICAgICAgIDB4NDAwMgorI2RlZmluZSBNVFBfRVZFTlRfT0JKRUNUX1JFTU9WRUQgICAgICAgICAgICAgICAgICAgIDB4NDAwMworI2RlZmluZSBNVFBfRVZFTlRfU1RPUkVfQURERUQgICAgICAgICAgICAgICAgICAgICAgIDB4NDAwNAorI2RlZmluZSBNVFBfRVZFTlRfU1RPUkVfUkVNT1ZFRCAgICAgICAgICAgICAgICAgICAgIDB4NDAwNQorI2RlZmluZSBNVFBfRVZFTlRfREVWSUNFX1BST1BfQ0hBTkdFRCAgICAgICAgICAgICAgIDB4NDAwNgorI2RlZmluZSBNVFBfRVZFTlRfT0JKRUNUX0lORk9fQ0hBTkdFRCAgICAgICAgICAgICAgIDB4NDAwNworI2RlZmluZSBNVFBfRVZFTlRfREVWSUNFX0lORk9fQ0hBTkdFRCAgICAgICAgICAgICAgIDB4NDAwOAorI2RlZmluZSBNVFBfRVZFTlRfUkVRVUVTVF9PQkpFQ1RfVFJBTlNGRVIgICAgICAgICAgIDB4NDAwOQorI2RlZmluZSBNVFBfRVZFTlRfU1RPUkVfRlVMTCAgICAgICAgICAgICAgICAgICAgICAgIDB4NDAwQQorI2RlZmluZSBNVFBfRVZFTlRfREVWSUNFX1JFU0VUICAgICAgICAgICAgICAgICAgICAgIDB4NDAwQgorI2RlZmluZSBNVFBfRVZFTlRfU1RPUkFHRV9JTkZPX0NIQU5HRUQgICAgICAgICAgICAgIDB4NDAwQworI2RlZmluZSBNVFBfRVZFTlRfQ0FQVFVSRV9DT01QTEVURSAgICAgICAgICAgICAgICAgIDB4NDAwRAorI2RlZmluZSBNVFBfRVZFTlRfVU5SRVBPUlRFRF9TVEFUVVMgICAgICAgICAgICAgICAgIDB4NDAwRQorI2RlZmluZSBNVFBfRVZFTlRfT0JKRUNUX1BST1BfQ0hBTkdFRCAgICAgICAgICAgICAgIDB4QzgwMQorI2RlZmluZSBNVFBfRVZFTlRfT0JKRUNUX1BST1BfREVTQ19DSEFOR0VEICAgICAgICAgIDB4Q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3Vyc29yIG1DdXJzb3I7CisKKyAgICBwcml2YXRlIGNsYXNzIERldmljZU9ic2VydmVyIGV4dGVuZHMgQ29udGVudE9ic2VydmVyIHsKKyAgICAgICAgRGV2aWNlT2JzZXJ2ZXIoSGFuZGxlciBoYW5kbGVyKSB7CisgICAgICAgICAgICBzdXBlcihoYW5kbGVyKTsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgdm9pZCBvbkNoYW5nZShib29sZWFuIHNlbGZDaGFuZ2UpIHsKKyAgICAgICAgICAgIExvZy5kKFRBRywgIkRldmljZU9ic2VydmVyLm9uQ2hhbmdlIik7CisgICAgICAgICAgICBpZiAobUN1cnNvciAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgbUN1cnNvci5yZXF1ZXJ5KCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBTdHJpbmdbXSBERVZJQ0VfQ09MVU1OUyA9CisgICAgICAgICBuZXcgU3RyaW5nW10geyBNdHAuRGV2aWNlLl9JRCwgTXRwLkRldmljZS5NQU5VRkFDVFVSRVIsIE10cC5EZXZpY2UuTU9ERUwgfTsKKworICAgIEBPdmVycmlkZQorICAgIHByb3RlY3RlZCB2b2lkIG9uQ3JlYXRlKEJ1bmRsZSBzYXZlZEluc3RhbmNlU3RhdGUpIHsKKyAgICAgICAgc3VwZXIub25DcmVhdGUoc2F2ZWRJbnN0YW5jZVN0YXRlKTsKKyAgICAgICAgbVJlc29sdmVyID0gZ2V0Q29udGVudFJlc29sdmVyKCk7CisgICAgICAgIG1EZXZpY2VPYnNlcnZlciA9IG5ldyBEZXZpY2VPYnNlcnZlcihuZXcgSGFuZGxlcigpKTsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwcm90ZWN0ZWQgdm9pZCBvblJlc3VtZSgpIHsKKyAgICAgICAgc3VwZXIub25SZXN1bWUoKTsKKworICAg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ludCBOQU1FX0NPTFVNTiA9IDE7CisgICAgc3RhdGljIGZpbmFsIGludCBGT1JNQVRfQ09MVU1OID0gMjsKKyAgICBzdGF0aWMgZmluYWwgaW50IFRIVU1CX0NPTFVNTiA9IDM7CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwcm90ZWN0ZWQgdm9pZCBvbkNyZWF0ZShCdW5kbGUgc2F2ZWRJbnN0YW5jZVN0YXRlKSB7CisgICAgICAgIHN1cGVyLm9uQ3JlYXRlKHNhdmVkSW5zdGFuY2VTdGF0ZSk7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHJvdGVjdGVkIHZvaWQgb25SZXN1bWUoKSB7CisgICAgICAgIHN1cGVyLm9uUmVzdW1lKCk7CisKKyAgICAgICAgbURldmljZUlEID0gZ2V0SW50ZW50KCkuZ2V0SW50RXh0cmEoImRldmljZSIsIDApOworICAgICAgICBtU3RvcmFnZUlEID0gZ2V0SW50ZW50KCkuZ2V0SW50RXh0cmEoInN0b3JhZ2UiLCAwKTsKKyAgICAgICAgbU9iamVjdElEID0gZ2V0SW50ZW50KCkuZ2V0SW50RXh0cmEoIm9iamVjdCIsIDApOworICAgICAgICBpZiAobURldmljZUlEICE9IDAgJiYgbVN0b3JhZ2VJRCAhPSAwKSB7CisgICAgICAgICAgICBDdXJzb3IgYzsKKyAgICAgICAgICAgIFVyaSB1cmk7CisgICAgICAgICAgICBpZiAobU9iamVjdElEID09IDApIHsKKyAgICAgICAgICAgICAgICB1cmkgPSBNdHAuT2JqZWN0LmdldENvbnRlbnRVcmlGb3JTdG9yYWdlQ2hpbGRyZW4obURldmljZUlELCBtU3RvcmFnZUlEKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgdXJpID0gTXRwLk9iamVjdC5nZXRDb250ZW50VXJpRm9yT2JqZWN0Q2hpbGRyZW4obURldmljZUlELCBtT2JqZWN0SUQpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgTG9nLmQoVEFHLCAicXVlcnkgIiArIHVyaSk7CisgICAgICAgICAgICBjID0gZ2V0Q29udGVudFJlc29sdmVyKCkucXVlcnkodXJpLCBPQkpFQ1RfQ09MVU1OUywgbnVsbCwgbnVsbCwgbnVsbCk7CisgICAgICAgICAgICBzdGFydE1hbmFnaW5nQ3Vyc29yKGMpOworICAgICAgICAgICAgbUN1cnNvciA9IGM7CisKKyAgICAgICAgICAgIC8vIE1hcCBDdXJzb3IgY29sdW1ucyB0byB2aWV3cyBkZWZpbmVkIGluIHNpbXBsZV9saXN0X2l0ZW1fMS54bWwKKyAgICAgICAgICAgIG1BZGFwdGVyID0gbmV3IE9iamVjdEN1cnNvckFkYXB0ZXIodGhpcywgYyk7CisgICAgICAgICAgICBzZXRMaXN0QWRhcHRlcihtQWRhcHRlcik7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwcm90ZWN0ZWQgdm9pZCBvbkxpc3RJdGVtQ2xpY2soTGlzdFZpZXcgbCwgVmlldyB2LCBpbnQgcG9zaXRpb24sIGxvbmcgaWQpIHsKKyAgICAgICAgaW50IHJvd0lEID0gKGludCltQWRhcHRlci5nZXRJdGVtSWQocG9zaXRpb24pOworICAgICAgICBDdXJzb3IgYyA9IGdldENvbnRlbnRSZXNvbHZlcigpLnF1ZXJ5KAorICAgICAgICAgICAgICAgICAgICAgICAgTXRwLk9iamVjdC5nZXRDb250ZW50VXJpKG1EZXZpY2VJRCwgcm93SUQpLAorICAgICAgICAgICAgICAgICAgICAgICAgT0JKRUNUX0NPTFVNTlMsIG51bGwsIG51bGwsIG51bGwpOworICAgICAgICBMb2cuZChUQUcsICJxdWVyeSByZXR1cm5lZCAiICsgYyArICIgY291bnQ6ICIgKyBjLmdldENvdW50KCkpOworICAgICAgICBsb25nIGZvcm1hdCA9IDA7CisgICAgICAgIGlmIChjICE9IG51bGwgJiYgYy5nZXRDb3VudCgpID09IDEpIHsKKyAgICAgICAgICAgIGMubW92ZVRvRmlyc3QoKTsKKyAgICAgICAgICAgIGxvbmcgcm93SWQgPSBjLmdldExvbmcoSURfQ09MVU1OKTsKKyAgICAgICAgICAgIFN0cmluZyBuYW1lID0gYy5nZXRTdHJpbmcoTkFNRV9DT0xVTU4pOworICAgICAgICAgICAgZm9ybWF0ID0gYy5nZXRMb25nKEZPUk1BVF9DT0xVTU4pOworICAgICAgICAgICAgTG9nLmQoVEFHLCAicm93SWQ6ICIgKyByb3dJZCArICIgbmFtZTogIiArIG5hbWUgKyAiIGZvcm1hdDogIiArIGZvcm1hdCk7CisgICAgICAgIH0KKyAgICAgICAgaWYgKGZvcm1hdCA9PSBNdHAuT2JqZWN0LkZPUk1BVF9KRklGKSB7CisgICAgICAgICAgICBJbnRlbnQgaW50ZW50ID0gbmV3IEludGVudCh0aGlzLCBPYmplY3RWaWV3ZXIuY2xhc3MpOworICAgICAgICAgICAgaW50ZW50LnB1dEV4dHJhKCJkZXZpY2UiLCBtRGV2aWNlSUQpOworICAgICAgICAgICAgaW50ZW50LnB1dEV4dHJhKCJzdG9yYWdlIiwgbVN0b3JhZ2VJRCk7CisgICAgICAgICAgICBpbnRlbnQucHV0RXh0cmEoIm9iamVjdCIscm93SUQpOworICAgICAgICAgICAgc3RhcnRBY3Rpdml0eShpbnRlbnQpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgSW50ZW50IGludGVudCA9IG5ldyBJbnRlbnQodGhpcywgT2JqZWN0QnJvd3Nlci5jbGFzcyk7CisgICAgICAgICAgICBpbnRlbnQucHV0RXh0cmEoImRldmljZSIsIG1EZXZpY2VJRCk7CisgICAgICAgICAgICBpbnRlbnQucHV0RXh0cmEoInN0b3JhZ2UiLCBtU3RvcmFnZUlEKTsKKyAgICAgICAgICAgIGludGVudC5wdXRFeHRyYSgib2JqZWN0Iiwgcm93SUQpOworICAgICAgICAgICAgc3RhcnRBY3Rpdml0eShpbnRlbnQpOworICAgICAgICB9CisgICAgfQorCisgICAgcHJpdmF0ZSBjbGFzcyBPYmplY3RDdXJzb3JBZGFwdGVyIGV4dGVuZHMgUmVzb3VyY2VDdXJzb3JBZGFwdGVyIHsKKworICAgICAgICBwdWJsaWMgT2JqZWN0Q3Vyc29yQWRhcHRlcihDb250ZXh0IGNvbnRleHQsIEN1cnNvciBjKSB7CisgICAgICAgICAgICBzdXBlcihjb250ZXh0LCBSLmxheW91dC5vYmplY3RfbGlzdCwgYyk7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIHZvaWQgYmluZFZpZXcoVmlldyB2aWV3LCBDb250ZXh0IGNvbnRleHQsIEN1cnNvciBjdXJzb3IpIHsKKyAgICAgICAgICAgIEltYWdlVmlldyB0aHVtYlZpZXcgPSAoSW1hZ2VWaWV3KXZpZXcuZmluZFZpZXdCeUlkKFIuaWQudGh1bWJuYWlsKTsKKyAgICAgICAgICAgIFRleHRWaWV3IG5hbWVWaWV3ID0gKFRleHRWaWV3KXZpZXcuZmluZFZpZXdCeUlkKFIuaWQubmFtZSk7CisKKyAgICAgICAgICAgIC8vIGdldCB0aGUgdGh1bWJuYWlsCisgICAgICAgICAgICBieXRlW10gdGh1bWJuYWlsID0gY3Vyc29yLmdldEJsb2IoVEhVTUJfQ09MVU1OKTsKKyAgICAgICAgICAgIGlmICh0aHVtYm5haWwgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIEJpdG1hcCBiaXRtYXAgPSBCaXRtYXBGYWN0b3J5LmRlY29kZUJ5dGVBcnJheSh0aHVtYm5haWwsIDAsIHRodW1ibmFpbC5sZW5ndGgpOworICAgICAgICAgICAgICAgIGlmIChiaXRtYXAgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICB0aHVtYlZpZXcuc2V0SW1hZ2VCaXRtYXAoYml0bWFwKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIC8vIGdldCB0aGUgbmFtZQorICAgICAgICAgICAgU3RyaW5nIG5hbWUgPSBjdXJzb3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VyOworaW1wb3J0IGFuZHJvaWQudmlldy5NZW51SXRlbTsKK2ltcG9ydCBhbmRyb2lkLnZpZXcuVmlldzsKK2ltcG9ydCBhbmRyb2lkLndpZGdldC5JbWFnZVZpZXc7CitpbXBvcnQgYW5kcm9pZC53aWRnZXQuVGV4dFZpZXc7CitpbXBvcnQgYW5kcm9pZC53aWRnZXQuVG9hc3Q7CisKK2ltcG9ydCBqYXZhLmlvLkZpbGU7CitpbXBvcnQgamF2YS5pby5GaWxlRGVzY3JpcHRvcjsKK2ltcG9ydCBqYXZhLmlvLkZpbGVJbnB1dFN0cmVhbTsKK2ltcG9ydCBqYXZhLmlvLkZpbGVPdXRwdXRTdHJlYW07CitpbXBvcnQgamF2YS51dGlsLkNhbGVuZGFyOworaW1wb3J0IGphdmEudXRpbC5EYXRlOworCisvKioKKyAqIEEgdmlldyB0byBkaXNwbGF5IHRoZSBwcm9wZXJ0aWVzIG9mIGFuIG9iamVjdC4KKyAqLworcHVibGljIGNsYXNzIE9iamVjdFZpZXdlciBleHRlbmRzIEFjdGl2aXR5IHsKKworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIFN0cmluZyBUQUcgPSAiT2JqZWN0Vmlld2VyIjsKKworICAgIHByaXZhdGUgaW50IG1EZXZpY2VJRDsKKyAgICBwcml2YXRlIGludCBtU3RvcmFnZUlEOworICAgIHByaXZhdGUgaW50IG1PYmplY3RJRDsKKworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIFN0cmluZ1tdIE9CSkVDVF9DT0xVTU5TID0KKyAgICAgICAgbmV3IFN0cmluZ1tdIHsgIE10cC5PYmplY3QuX0lELAorICAgICAgICAgICAgICAgICAgICAgICAgTXRwLk9iamVjdC5OQU1FLAorICAgICAgICAgICAgICAgICAgICAgICAgTXRwLk9iamVjdC5TSVpFLAorICAgICAgICAgICAgICAgICAgICAgICAgTXRwLk9iamVjdC5USFVNQl9XSURUSCwKKyAgICAgICAgICAgICAgICAgICAgICAgIE10cC5PYmplY3QuVEhVTUJfSEVJR0hULAorICAgICAgICAgICAgICAgICAgICAgICAgTXRwLk9iamVjdC5USFVNQl9TSVpFLAorICAgICAgICAgICAgICAgICAgICAgICAgTXRwLk9iamVjdC5JTUFHRV9XSURUSCwKKyAgICAgICAgICAgICAgICAgICAgICAgIE10cC5PYmplY3QuSU1BR0VfSEVJR0hULAorICAgICAgICAgICAgICAgICAgICAgICAgTXRwLk9iamVjdC5JTUFHRV9ERVBUSCwKKyAgICAgICAgICAgICAgICAgICAgICAgIE10cC5PYmplY3QuU0VRVUVOQ0VfTlVNQkVSLAorICAgICAgICAgICAgICAgICAgICAgICAgTXRwLk9iamVjdC5EQVRFX0NSRUFURUQsCisgICAgICAgICAgICAgICAgICAgICAgICBNdHAuT2JqZWN0LkRBVEVfTU9ESUZJRUQsCisgICAgICAgICAgICAgICAgICAgICAgICBNdHAuT2JqZWN0LktFWVdPUkRTLAorICAgICAgICAgICAgICAgICAgICAgICAgTXRwLk9iamVjdC5USFVNQiwKKyAgICAgICAgICAgICAgICAgICAgICAgIH07CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwcm90ZWN0ZWQgdm9pZCBvbkNyZWF0ZShCdW5kbGUgc2F2ZWRJbnN0YW5jZVN0YXRlKSB7CisgICAgICAgIHN1cGVyLm9uQ3JlYXRlKHNhdmVkSW5zdGFuY2VTdGF0ZSk7CisKKyAgICAgICAgc2V0Q29udGVudFZpZXcoUi5sYXlvdXQub2JqZWN0X2luZm8pOworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHByb3RlY3RlZCB2b2lkIG9uUmVzdW1lKCkgeworICAgICAgICBzdXBlci5vblJlc3VtZSgpOworCisgICAgICAgIG1EZXZpY2VJRCA9IGdldEludGVudCgpLmdldEludEV4dHJhKCJkZXZpY2UiLCAwKTsKKyAgICAgICAgbVN0b3JhZ2VJRCA9IGdldEludGVudCgpLmdldEludEV4dHJhKCJzdG9yYWdlIiwgMCk7CisgICAgICAgIG1PYmplY3RJRCA9IGdldEludGVudCgpLmdldEludEV4dHJhKCJvYmplY3QiLCAwKTsKKworICAgICAgICBpZiAobURldmljZUlEICE9IDAgJiYgbU9iamVjdElEICE9IDApIHsKKyAgICAgICAgQ3Vyc29yIGMgPSBnZXRDb250ZW50UmVzb2x2ZXIoKS5xdWVyeSgKKyAgICAgICAgICAgICAgICAgICAgICAgIE10cC5PYmplY3QuZ2V0Q29udGVudFVyaShtRGV2aWNlSUQsIG1PYmplY3RJRCksCisgICAgICAgICAgICAgICAgICAgICAgICBPQkpFQ1RfQ09MVU1OUywgbnVsbCwgbnVsbCwgbnVsbCk7CisgICAgICAgICAgICBjLm1vdmVUb0ZpcnN0KCk7CisgICAgICAgICAgICBUZXh0VmlldyB2aWV3ID0gKFRleHRWaWV3KWZpbmRWaWV3QnlJZChSLmlkLm5hbWUpOworICAgICAgICAgICAgdmlldy5zZXRUZXh0KGMuZ2V0U3RyaW5nKDEpKTsKKyAgICAgICAgICAgIHZpZXcgPSAoVGV4dFZpZXcpZmluZFZpZXdCeUlkKFIuaWQuc2l6ZSk7CisgICAgICAgICAgICB2aWV3LnNldFRleHQoTG9uZy50b1N0cmluZyhjLmdldExvbmcoMikpKTsKKyAgICAgICAgICAgIHZpZXcgPSAoVGV4dFZpZXcpZmluZFZpZXdCeUlkKFIuaWQudGh1bWJfd2lkdGgpOworICAgICAgICAgICAgdmlldy5zZXRUZXh0KExvbmcudG9TdHJpbmcoYy5nZXRMb25nKDMpKSk7CisgICAgICAgICAgICB2aWV3ID0gKFRleHRWaWV3KWZpbmRWaWV3QnlJZChSLmlkLnRodW1iX2hlaWdodCk7CisgICAgICAgICAgICB2aWV3LnNldFRleHQoTG9uZy50b1N0cmluZyhjLmdldExvbmcoNCkpKTsKKyAgICAgICAgICAgIHZpZXcgPSAoVGV4dFZpZXcpZmluZFZpZXdCeUlkKFIuaWQudGh1bWJfc2l6ZSk7CisgICAgICAgICAgICB2aWV3LnNldFRleHQoTG9uZy50b1N0cmluZyhjLmdldExvbmcoNSkpKTsKKyAgICAgICAgICAgIHZpZXcgPSAoVGV4dFZpZXcpZmluZFZpZXdCeUlkKFIuaWQud2lkdGgpOworICAgICAgICAgICAgdmlldy5zZXRUZXh0KExvbmcudG9TdHJpbmcoYy5nZXRMb25nKDYpKSk7CisgICAgICAgICAgICB2aWV3ID0gKFRleHRWaWV3KWZpbmRWaWV3QnlJZChSLmlkLmhlaWdodCk7CisgICAgICAgICAgICB2aWV3LnNldFRleHQoTG9uZy50b1N0cmluZyhjLmdldExvbmcoNykpKTsKKyAgICAgICAgICAgIHZpZXcgPSAoVGV4dFZpZXcpZmluZFZpZXdCeUlkKFIuaWQuZGVwdGgpOworICAgICAgICAgICAgdmlldy5zZXRUZXh0KExvbmcudG9TdHJpbmcoYy5nZXRMb25nKDgpKSk7CisgICAgICAgICAgICB2aWV3ID0gKFRleHRWaWV3KWZpbmRWaWV3QnlJZChSLmlkLnNlcXVlbmNlKTsKKyAgICAgICAgICAgIHZpZXcuc2V0VGV4dChMb25nLnRvU3RyaW5nKGMuZ2V0TG9uZyg5KSkpOworICAgICAgICAgICAgdmlldyA9IChUZXh0VmlldylmaW5kVmlld0J5SWQoUi5pZC5jcmVhdGVkKTsKKyAgICAgICAgICAgIERhdGUgZGF0ZSA9IG5ldyBEYXRlKGMuZ2V0TG9uZygxMCkgKiAxMDAwKTsKKyAgICAgICAgICAgIHZpZXcuc2V0VGV4dChkYXRlLnRvU3RyaW5nKCkpOworICAgICAgICAgICAgdmlldyA9IChUZXh0VmlldylmaW5kVmlld0J5SWQoUi5pZC5tb2RpZmllZCk7CisgICAgICAgICAgICBkYXRlID0gbmV3IERhdGUoYy5nZXRMb25nKDExKSAqIDEwMDApOworICAgICAgICAgICAgdmlldy5zZXRUZXh0KGRhdGUudG9TdHJpbmcoKSk7CisgICAgICAgICAgICB2aWV3ID0gKFRleHRWaWV3KWZpbmRWaWV3QnlJZChSLmlkLmtleXdvcmRzKTsKKyAgICAgICAgICAgIHZpZXcuc2V0VGV4dChjLmdldFN0cmluZygxMikpOworICAgICAgICAgICAgYnl0ZVtdIHRodW1ibmFpbCA9IGMuZ2V0QmxvYigxMyk7CisgICAgICAgICAgICBpZiAodGh1bWJuYWlsICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBJbWFnZVZpZXcgdGh1bWJWaWV3ID0gKEltYWdlVmlldylmaW5kVmlld0J5SWQoUi5pZC50aHVtYm5haWwpOworICAgICAgICAgICAgICAgIEJpdG1hcCBiaXRtYXAgPSBCaXRtYXBGYWN0b3J5LmRlY29kZUJ5dGVBcnJheSh0aHVtYm5haWwsIDAsIHRodW1ibmFpbC5sZW5ndGgpOworICAgICAgICAgICAgICAgIGlmIChiaXRtYXAgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICB0aHVtYlZpZXcuc2V0SW1hZ2VCaXRtYXAoYml0bWFwKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgYm9vbGVhbiBvbkNyZWF0ZU9wdGlvbnNNZW51KE1lbnUgbWVudSkgeworICAgICAgICBNZW51SW5mbGF0ZXIgaW5mbGF0ZXIgPSBnZXRNZW51SW5mbGF0ZXIoKTsKKyAgICAgICAgaW5mbGF0ZXIuaW5mbGF0ZShSLm1lbnUub2JqZWN0X21lbnUsIG1lbnUpOworICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgYm9vbGVhbiBvblByZXBhcmVPcHRpb25zTWVudShNZW51IG1lbnUpIHsKKyAgICAgICAgTWVudUl0ZW0gaXRlbSA9IG1lbnUuZmluZEl0ZW0oUi5pZC5zYXZlKTsKKyAgICAgICAgaXRlbS5zZXRFbmFibGVkKHRydWUpOworICAgICAgICBpdGVtID0gbWVudS5maW5kSXRlbShSLmlkLmRlbGV0ZSk7CisgICAgICAgIGl0ZW0uc2V0RW5hYmxlZCh0cnVlKTsKKyAgICAgICAgcmV0dXJuIHRydWU7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIGJvb2xlYW4gb25PcHRpb25zSXRlbVNlbGVjdGVkKE1lbnVJdGVtIGl0ZW0pIHsKKyAgICAgICAgc3dpdGNoIChpdGVtLmdldEl0ZW1JZCgpKSB7CisgICAgICAgICAgICBjYXNlIFIuaWQuc2F2ZToKKyAgICAgICAgICAgICAgICBzYXZlKCk7CisgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICBjYXNlIFIuaWQuZGVsZXRlOgorICAgICAgICAgICAgICAgIGRlbGV0ZSgpOworICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICB9CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisKKyAgICBwcml2YXRlIHN0YXRpYyBTdHJpbmcgZ2V0VGltZXN0YW1wKCkgeworICAgICAgICBDYWxlbmRhciBjID0gQ2FsZW5kYXIuZ2V0SW5zdGFuY2UoKTsKKyAgICAgICAgYy5zZXRUaW1lSW5NaWxsaXMoU3lzdGVtLmN1cnJlbnRUaW1lTWlsbGlzKCkpOworICAgICAgICByZXR1cm4gU3RyaW5nLmZvcm1hdCgiJXRZLSV0bS0ldGQtJXRILSV0TS0ldFMiLCBjLCBjLCBjLCBjLCBjLCBjKTsKKyAgICB9CisKKyAgICBwcml2YXRlIHZvaWQgc2F2ZSgpIHsKKyAgICAgICAgYm9vbGVhbiBzdWNjZXNzID0gZmFsc2U7CisgICAgICAgIFVyaSB1cmkgPSBNdHAuT2JqZWN0LmdldENvbnRlbnRVcmkobURldmljZUlELCBtT2JqZWN0SUQpOworICAgICAgICBGaWxlIGRlc3RGaWxlID0gbnVsbDsKKyAgICAgICAgUGFyY2VsRmlsZURlc2NyaXB0b3IgcGZkID0gbnVsbDsKKyAgICAgICAgRmlsZUlucHV0U3RyZWFtIGZpcyA9IG51bGw7CisgICAgICAgIEZpbGVPdXRwdXRTdHJlYW0gZm9zID0gbnVsbDsKKworICAgICAgICB0cnkgeworICAgICAgICAgICAgcGZkID0gZ2V0Q29udGVudFJlc29sdmVyKCkub3BlbkZpbGVEZXNjcmlwdG9yKHVyaSwgInIiKTsKKyAgICAgICAgICAgIExvZy5kKFRBRywgInNhdmUgZ290IHBmZCAiICsgcGZkKTsKKyAgICAgICAgICAgIGlmIChwZmQgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIGZpcyA9IG5ldyBGaWxlSW5wdXRTdHJlYW0ocGZkLmdldEZpbGVEZXNjcmlwdG9yKCkpOworICAgICAgICAgICAgICAgIExvZy5kKFRBRywgInNhdmUgZ290IGZpcyAiICsgZmlzKTsKKyAgICAgICAgICAgICAgICBGaWxlIGRlc3REaXIgPSBFbnZpcm9ubWVudC5nZXRFeHRlcm5hbFN0b3JhZ2VQdWJsaWNEaXJlY3RvcnkoCisgICAgICAgICAgICAgICAgICAgICAgICBFbnZpcm9ubWVudC5ESVJFQ1RPUllfRENJTSk7CisgICAgICAgICAgICAgICAgZGVzdERpci5ta2RpcnMoKTsKKyAgICAgICAgICAgICAgICBkZXN0RmlsZSA9IG5ldyBGaWxlKGRlc3REaXIsICJDYW1lcmFCcm93c2VyLSIgKyBnZXRUaW1lc3RhbXAoKSArICIuanBlZyIpOworCisKKyAgICAgICAgICAgICAgICBMb2cuZChUQUcsICJzYXZlIGdvdCBkZXN0RmlsZSAiICsgZGVzdEZpbGUpOworCisgICAgICAgICAgICAgICAgaWYgKGRlc3RGaWxlLmV4aXN0cygpKSB7CisgICAgICAgICAgICAgICAgICAgIGRlc3RGaWxlLmRlbGV0ZSgpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBmb3MgPSBuZXcgRmlsZU91dHB1dFN0cmVhbShkZXN0RmlsZSk7CisKKyAgICAgICAgICAgICAgICBieXRlW10gYnVmZmVyID0gbmV3IGJ5dGVbNjU1MzZdOworICAgICAgICAgICAgICAgIGludCBieXRlc1JlYWQ7CisgICAgICAgICAgICAgICAgd2hpbGUgKChieXRlc1JlYWQgPSBmaXMucmVhZChidWZmZXIpKSA+PSAwKSB7CisgICAgICAgICAgICAgICAgICAgIGZvcy53cml0ZShidWZmZXIsIDAsIGJ5dGVzUmVhZCk7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgLy8gdGVtcG9yYXJ5IHdvcmthcm91bmQgdW50aWwgd2Ugc3RyYWlnaHRlbiBvdXQgcGVybWlzc2lvbnMgaW4gL2RhdGEvbWVkaWEKKyAgICAgICAgICAgICAgICAvLyAxMDE1IGlzIEFJRF9TRENBUkRfUlcKKyAgICAgICAgICAgICAgICBGaWxlVXRpbHMuc2V0UGVybWlzc2lvbnMoZGVzdERpci5nZXRQYXRoKCksIDA3NzUsIFByb2Nlc3MubXlVaWQoKSwgMTAxNSk7CisgICAgICAgICAgICAgICAgRmlsZVV0aWxzLnNldFBlcm1pc3Npb25zKGRlc3RGaWxlLmdldFBhdGgoKSwgMDY2NCwgUHJvY2Vzcy5teVVpZCgpLCAxMDE1KTsKKworICAgICAgICAgICAgICAgIHN1Y2Nlc3MgPSB0cnVlOworICAgICAgICAgICAgfQorICAgICAgICB9IGNhdGNoIChFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgTG9nLmUoVEFHLCAiRXhjZXB0aW9uIGluIE9iamVjdFZpZXcuc2F2ZSIsIGUpOworICAgICAgICB9IGZpbmFsbHkgeworICAgICAgICAgICAgaWYgKGZpcyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICAgICAgZmlzLmNsb3NlKCk7CisgICAgICAgICAgICAgICAgfSBjYXRjaCAoRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoZm9zICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgICAgICBmb3MuY2xvc2UoKTsKKyAgICAgICAgICAgICAgICB9IGNhdGNoIChFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmIChwZmQgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgICAgIHBmZC5jbG9zZSgpOworICAgICAgICAgICAgICAgIH0gY2F0Y2ggKEV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgaWYgKHN1Y2Nlc3MpIHsKKyAgICAgICAgICAgIEludGVudCBpbnRlbnQgPSBuZXcgSW50ZW50KEludGVudC5BQ1RJT05fTUVESUFfU0NBTk5FUl9TQ0FOX0ZJTEUpOworICAgICAgICAgICAgaW50ZW50LnNldERhdGEoVXJpLmZyb21GaWxlKGRlc3RGaWxlKSk7CisgICAgICAgICAgICBzZW5kQnJvYWRjYXN0KGludGVudCk7CisgICAgICAgICAgICBUb2FzdC5tYWtlVGV4dCh0aGlzLCBSLnN0cmluZy5vYmplY3Rfc2F2ZWRfbWVzc2FnZSwgVG9hc3QuTEVOR1RIX1NIT1JUKS5zaG93KCk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBUb2FzdC5tYWtlVGV4dCh0aGlzLCBSLnN0cmluZy5zYXZlX2ZhaWxlZF9tZXNzYWdlLCBUb2FzdC5MRU5HVEhfU0hPUlQpLnNob3coKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgdm9pZCBkZWxldGUoKSB7CisgICAgICAgIFVyaSB1cmkgPSBNdHAuT2JqZWN0LmdldENvbnRlbnRVcmkobURldmljZUlELCBtT2JqZWN0SUQpOworCisgICAgICAgIExvZy5kKFRBRywgImRlbGV0aW5nICIgKyB1cmkpOworCisgICAgICAgIGludCByZXN1bHQgPSBnZXRDb250ZW50UmVzb2x2ZXIoKS5kZWxldGUodXJpLCBudWxsLCBudWxsKTsKK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TG9nLmQoVEFHLCAicXVlcnkgcmV0dXJuZWQgIiArIGMpOworICAgICAgICAgICAgc3RhcnRNYW5hZ2luZ0N1cnNvcihjKTsKKworICAgICAgICAgICAgLy8gTWFwIEN1cnNvciBjb2x1bW5zIHRvIHZpZXdzIGRlZmluZWQgaW4gc2ltcGxlX2xpc3RfaXRlbV8xLnhtbAorICAgICAgICAgICAgbUFkYXB0ZXIgPSBuZXcgU2ltcGxlQ3Vyc29yQWRhcHRlcih0aGlzLAorICAgICAgICAgICAgICAgICAgICBhbmRyb2lkLlIubGF5b3V0LnNpbXBsZV9saXN0X2l0ZW1fMSwgYywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXcgU3RyaW5nW10geyBNdHAuU3RvcmFnZS5ERVNDUklQVElPTiB9LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5ldyBpbnRbXSB7IGFuZHJvaWQuUi5pZC50ZXh0MSwgYW5kcm9pZC5SLmlkLnRleHQyIH0pOworICAgICAgICAgICAgc2V0TGlzdEFkYXB0ZXIobUFkYXB0ZXIpOworICAgICAgICB9CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHJvdGVjdGVkIHZvaWQgb25MaXN0SXRlbUNsaWNrKExpc3RWaWV3IGwsIFZpZXcgdiwgaW50IHBvc2l0aW9uLCBsb25nIGlkKSB7CisgICAgICAgIEludGVudCBpbnRlbnQgPSBuZXcgSW50ZW50KHRoaXMsIE9iamVjdEJyb3dzZXIuY2xhc3MpOworICAgICAgICBpbnRlbnQucHV0RXh0cmEoImRldmljZSIsIG1EZXZpY2VJRCk7CisgICAgICAgIGludGVudC5wdXRFeHRyYSgic3RvcmFnZSIsIChpbnQpbUFkYXB0ZXIuZ2V0SXRlbUlkKHBvc2l0aW9uKSk7CisgICAgICAgIHN0YXJ0QWN0aXZpdHkoaW50ZW50KTsKKyAgICB9Cit9CmRpZmYgLS1naXQgYS9tZWRpYS90ZXN0cy9DYW1lcmFCcm93c2VyL3NyYy9j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isgICAgOiAgIG1EZXZpY2UoZmlsZS0+bURldmljZSksCisgICAgICAgIG1TdG9yYWdlKGZpbGUtPm1TdG9yYWdlKSwKKyAgICAgICAgbUhhbmRsZShmaWxlLT5tSGFuZGxlKQoreworfQorCitNdHBGaWxlOjp+TXRwRmlsZSgpIHsKK30KKwordm9pZCBNdHBGaWxlOjpwcmludCgpIHsKKyAgICBpZiAobUhhbmRsZSkgeworCisgICAgfSBlbHNlIGlmIChtU3RvcmFnZSkgeworICAgICAgICBwcmludGYoIiV4XG4iLCBtU3RvcmFnZSk7CisgICAgfSBlbHNlIHsKKyAgICAgICAgaW50IGlkID0gbURldmljZS0+Z2V0SUQoKTsKKyAgICAgICAgTXRwRGV2aWNlSW5mbyogaW5mbyA9IG1EZXZpY2UtPmdldERldmljZUluZm8oKTsKKyAgICAgICAgaWYgKGluZm8pCisgICAgICAgICAgICBwcmludGYoIiVkXHQlcyAlcyAlc1xuIiwgaWQsIGluZm8tPm1NYW51ZmFjdHVyZXIsIGluZm8tPm1Nb2RlbCwgaW5mby0+bVNlcmlhbCk7CisgICAgICAgIGVsc2UKKyAgICAgICAgICAgIHByaW50ZigiJWRcdChubyBkZXZpY2UgaW5mbyBhdmFpbGFibGUpXG4iLCBpZCk7CisgICAgICAgIGRlbGV0ZSBpbmZvOworICAgIH0KK30KKworTXRwT2JqZWN0SW5mbyogTXRwRmlsZTo6Z2V0T2JqZWN0SW5mbygpIHsKKyAgICByZXR1cm4gbURldmljZS0+Z2V0T2JqZWN0SW5mbyhtSGFuZGxlKTsKK30KKwordm9pZCBNdHBGaWxlOjpsaXN0KCkgeworICAgIGlmIChtU3RvcmFnZSkgeworICAgICAgICBNdHBPYmplY3RIYW5kbGVMaXN0KiBoYW5kbGVzID0gbURldmljZS0+Z2V0T2JqZWN0SGFuZGxlcyhtU3RvcmFnZSwgMCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChtSGFuZGxlID8gbUhhbmRsZSA6IC0xKSk7CisgICAgICAgIGlmIChoYW5kbGVzKSB7CisgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGhhbmRsZXMtPnNpemUoKTsgaSsrKSB7CisgICAgICAgICAgICAgICAgTXRwT2JqZWN0SGFuZGxlIGhhbmRsZSA9ICgqaGFuZGxlcylbaV07CisgICAgICAgICAgICAgICAgTXRwT2JqZWN0SW5mbyogaW5mbyA9IG1EZXZpY2UtPmdldE9iamVjdEluZm8oaGFuZGxlKTsKKyAgICAgICAgICAgICAgICBpZiAoaW5mbykgeworICAgICAgICAgICAgICAgICAgICBjaGFyIG1vZGlmaWVkWzEwMF07CisgICAgICAgICAgICAgICAgICAgIHN0cnVjdCB0bSB0bTsKKworICAgICAgICAgICAgICAgICAgICBnbXRpbWVfcigmaW5mby0+bURhdGVNb2RpZmllZCwgJnRtKTsKKyAgICAgICAgICAgICAgICAgICAgc3RyZnRpbWUobW9kaWZpZWQsIHNpemVvZihtb2RpZmllZCksICIlYSAlYiAlZSAlSDolTTolUyBHTVQgJVkiLCAmdG0pOworICAgICAgICAgICAgICAgICAgICBwcmludGYoIiVzIEhhbmRsZTogJWQgRm9ybWF0OiAlMDRYIFNpemU6ICVkIE1vZGlmaWVkOiAlc1xuIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbmZvLT5tTmFtZSwgaGFuZGxlLCBpbmZvLT5tRm9ybWF0LCBpbmZvLT5tQ29tcHJlc3NlZFNpemUsIG1vZGlmaWVkKTsKKyAgICAgICAgICAgICAgICAgICAgZGVsZXRlIGluZm87CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgZGVsZXRlIGhhbmRsZXM7CisgICAgICAgIH0KKyAgICB9IGVsc2UgeworICAgICAgICAvLyBsaXN0IHN0b3JhZ2UgdW5pdHMgZm9yIGRldmljZQorICAgICAgICBNdHBTdG9yYWdlSURMaXN0KiBzdG9yYWdlTGlzdCA9IG1EZXZpY2UtPmdldFN0b3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orICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChoYW5kbGUgPyBoYW5kbGUgOiAtMSkpOworICAgICAgICAgICAgTXRwT2JqZWN0SGFuZGxlIGNoaWxkSGFuZGxlID0gMDsKKworICAgICAgICAgICAgaWYgKGhhbmRsZXMpIHsKKyAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGhhbmRsZXMtPnNpemUoKSAmJiAhY2hpbGRIYW5kbGU7IGkrKykgeworICAgICAgICAgICAgICAgICAgICBNdHBPYmplY3RIYW5kbGUgaGFuZGxlID0gKCpoYW5kbGVzKVtpXTsKKyAgICAgICAgICAgICAgICAgICAgTXRwT2JqZWN0SW5mbyogaW5mbyA9IGRldmljZS0+Z2V0T2JqZWN0SW5mbyhoYW5kbGUpOworICAgICAgICAgICAgICAgICAgICBpZiAoaW5mbyAmJiAhc3RyY21wKHRvaywgaW5mby0+bU5hbWUpKQorICAgICAgICAgICAgICAgICAgICAgICAgY2hpbGRIYW5kbGUgPSBoYW5kbGU7CisgICAgICAgICAgICAgICAgICAgIGRlbGV0ZSBpbmZvOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBkZWxldGUgaGFuZGxlczsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmIChjaGlsZEhhbmRsZSkKKyAgICAgICAgICAgICAgICBoYW5kbGUgPSBjaGlsZEhhbmRsZTsKKyAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICByZXR1cm4gTlVMTDsKKyAgICAgICAgfSBlbHNlIGlmIChkZXZpY2UpIHsKKyAgICAgICAgICAgIHVuc2lnbmVkIGludCBpZDsKKyAgICAgICAgICAgIC8vIGZpbmQgc3RvcmFnZSBmb3IgdGhlIGRldmljZQorICAgICAgICAgICAgaWYgKHNzY2FuZih0b2ssICIleCIsICZpZCkgPT0gMSkgeworICAgICAgICAgICAgICAgIE10cFN0b3JhZ2VJRExpc3QqIHN0b3JhZ2VMaXN0ID0gZGV2aWNlLT5nZXRTdG9yYWdlSURzKCk7CisgICAgICAgICAgICAgICAgYm9vbCBmb3VuZCA9IGZhbHNlOworICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgc3RvcmFnZUxpc3QtPnNpemUoKTsgaSsrKSB7CisgICAgICAgICAgICAgICAgICAgIGlmICgoKnN0b3JhZ2VMaXN0KVtpXSA9PSBpZCkgeworICAgICAgICAgICAgICAgICAgICAgICAgZm91bmQgPSB0cnVlOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaWYgKGZvdW5kKQorICAgICAgICAgICAgICAgICAgICBzdG9yYWdlID0gaWQ7CisgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgICAgICByZXR1cm4gTlVMTDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIC8vIGZpbmQgZGV2aWNlCisgICAgICAgICAgICB1bnNpZ25lZCBpbnQgaWQ7CisgICAgICAgICAgICBpZiAoc3NjYW5mKHRvaywgIiVkIiwgJmlkKSA9PSAxKQorICAgICAgICAgICAgICAgIGRldmljZSA9IHNDbGllbnQtPmdldERldmljZShpZCk7CisgICAgICAgICAgICBpZiAoIWRldmljZSkKKyAgICAgICAgICAgICAgICByZXR1cm4gTlVMTDsKKyAgICAgICAgfQorCisgICAgICAgIHRvayA9IHN0cnRvayhOVUxMLCAiLyIpOworICAgIH0KKworICAgIGlmIChkZXZpY2UpCisgICAgICAgIHJldHVybiBuZXcgTXRwRmlsZShkZXZpY2UsIHN0b3JhZ2UsIGhhbmRsZSk7CisgICAgZWxzZQorICAgICAgICByZXR1cm4gTlVMTDsKK30KKworfQpkaWZmIC0tZ2l0IGEvbWVkaWEvdGVzdHMvbXRwL010cEZpbGUuaCBiL21lZGlhL3Rlc3RzL210cC9NdH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CB2b2lkIGRldmljZUFkZGVkKE10cERldmljZSAqZGV2aWNlKSB7CisgICAgfQorCisgICAgdmlydHVhbCB2b2lkIGRldmljZVJlbW92ZWQoTXRwRGV2aWNlICpkZXZpY2UpIHsKKyAgICB9CisKK3B1YmxpYzoKK307CisKK3N0YXRpYyB2b2lkIGluaXQoKSB7CisgICAgc0NsaWVudCA9IG5ldyBNeUNsaWVudDsKKyAgICBzQ2xpZW50LT5zdGFydCgpOworICAgIE10cEZpbGU6OmluaXQoc0NsaWVudCk7Cit9CisKK3N0YXRpYyBpbnQgc2V0X2N3ZChpbnQgYXJnYywgY2hhciogYXJndltdKSB7CisgICAgaWYgKGFyZ2MgIT0gMSkgeworICAgICAgICBmcHJpbnRmKHN0ZGVyciwgImNkIHNob3VsZCBoYXZlIG9uZSBhcmd1bWVudFxuIik7CisgICAgICAgIHJldHVybiAtMTsKKyAgICB9CisgICAgaWYgKCFzdHJjbXAoYXJndlswXSwgIi8iKSkgeworICAgICAgICBkZWxldGUgc0N1cnJlbnREaXJlY3Rvcnk7CisgICAgICAgIHNDdXJyZW50RGlyZWN0b3J5ID0gTlVMTDsKKyAgICB9CisgICAgZWxzZSB7CisgICAgICAgIE10cEZpbGUqIGZpbGUgPSBwYXJzZV9wYXRoKGFyZ3ZbMF0pOworICAgICAgICBpZiAoZmlsZSkgeworICAgICAgICAgICAgZGVsZXRlIHNDdXJyZW50RGlyZWN0b3J5OworICAgICAgICAgICAgc0N1cnJlbnREaXJlY3RvcnkgPSBmaWxlOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgZnByaW50ZihzdGRlcnIsICJjb3VsZCBub3QgZmluZCAlc1xuIiwgYXJndlswXSk7CisgICAgICAgICAgICByZXR1cm4gLTE7CisgICAgICAgIH0KKyAgICB9CisgICAgcmV0dXJuIDA7Cit9CisKK3N0YXRpYyB2b2lkIGxpc3RfZGV2aWNlcygpIHsKKyAgICAvLyBUT0RPIC0gbmVlZCB0byBtYWtlIHN1cmUgdGhlIGxpc3Qgd2lsbCBub3QgY2hhbmdlIHdoaWxlIGl0ZXJhdGluZworICAgIE10cERldmljZUxpc3QmIGRldmljZXMgPSBzQ2xpZW50LT5nZXREZXZpY2VMaXN0KCk7CisgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBkZXZpY2VzLnNpemUoKTsgaSsrKSB7CisgICAgICAgIE10cERldmljZSogZGV2aWNlID0gZGV2aWNlc1tpXTsKKyAgICAgICAgTXRwRmlsZSogZmlsZSA9IG5ldyBNdHBGaWxlKGRldmljZSk7CisgICAgICAgIGZpbGUtPnByaW50KCk7CisgICAgICAgIGRlbGV0ZSBmaWxlOworICAgIH0KK30KKworc3RhdGljIGludCBsaXN0KGludCBhcmdjLCBjaGFyKiBhcmd2W10pIHsKKyAgICBpZiAoYXJnYyA9PSAwKSB7CisgICAgICAgIC8vIGxpc3QgY3dkCisgICAgICAgIGlmIChzQ3VycmVudERpcmVjdG9yeSkgeworICAgICAgICAgICAgc0N1cnJlbnREaXJlY3RvcnktPmxpc3QoKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIGxpc3RfZGV2aWNlcygpOworICAgICAgICB9CisgICAgfQorCisgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBhcmdjOyBpKyspIHsKKyAgICAgICAgY2hhciogcGF0aCA9IGFyZ3ZbaV07CisgICAgICAgIGlmICghc3RyY21wKHBhdGgsICIvIikpIHsKKyAgICAgICAgICAgIGxpc3RfZGV2aWNlcygpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgTXRwRmlsZSogZmlsZSA9IHBhcnNlX3BhdGgocGF0aCk7CisgICAgICAgICAgICBpZiAoIWZpbGUpIHsKKyAgICAgICAgICAgICAgICBmcHJpbnRmKHN0ZGVyciwgImNvdWxkIG5vdCBmaW5kICVzXG4iLCBwYXRoKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gLTE7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBmaWxlLT5saXN0KCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICByZXR1cm4gMDsKK30KKworc3RhdGljIGludCBnZXRfZmlsZShpbnQgYXJnYywgY2hhciogYXJndltdKSB7CisgICAgaW50IHJldCA9IC0xOworICAgIGludCBzcmNGRCA9IC0xOworICAgIGludCBkZXN0RkQgPSAtMTsKKyAgICBNdHBGaWxlKiBzcmNGaWxlID0gTlVMTDsKKyAgICBNdHBPYmplY3RJbmZvKiBpbmZvID0gTlVMTDsKKyAgICBjaGFyKiBkZXN0OworCisgICAgaWYgKGFyZ2MgPCAxKSB7CisgICAgICAgIGZwcmludGYoc3RkZXJyLCAibm90IGVub3VnaCBhcmd1bWVudHNcbiIpOworICAgICAgICByZXR1cm4gLTE7CisgICAgfSBlbHNlIGlmIChhcmdjID4gMikgeworICAgICAgICBmcHJpbnRmKHN0ZGVyciwgInRvbyBtYW55IGFyZ3VtZW50c1xuIik7CisgICAgICAgIHJldHVybiAtMTsKKyAgICB9CisKKyAgICAvLyBmaW5kIHNvdXJjZSBvYmplY3QKKyAgICBjaGFyKiBzcmMgPSBhcmd2WzBdOworICAgIHNyY0ZpbGUgPSBwYXJzZV9wYXRoKHNyYyk7CisgICAgaWYgKCFzcmNGaWxlKSB7CisgICAgICAgIGZwcmludGYoc3RkZXJyLCAiY291bGQgbm90IGZpbmQgJXNcbiIsIHNyYyk7CisgICAgICAgIHJldHVybiAtMTsKKyAgICB9CisgICAgaW5mbyA9IHNyY0ZpbGUtPmdldE9iamVjdEluZm8oKTsKKyAgICBpZiAoIWluZm8pIHsKKyAgICAgICAgZnByaW50ZihzdGRlcnIsICJjb3VsZCBub3QgZmluZCBvYmplY3QgaW5mbyBmb3IgJXNcbiIsIHNyYyk7CisgICAgICAgIGdvdG8gZmFpbDsKKyAgICB9CisgICAgaWYgKGluZm8tPm1Gb3JtYXQgPT0gTVRQX0ZPUk1BVF9BU1NPQ0lBVElPTikgeworICAgICAgICBmcHJpbnRmKHN0ZGVyciwgImNvcHlpbmcgZGlyZWN0b3JpZXMgbm90IGltcGxlbWVudGVkIHlldFxuIik7CisgICAgICAgIGdvdG8gZmFpbDsKKyAgICB9CisKKyAgICBkZXN0ID0gKGFyZ2MgPiAxID8gYXJndlsxXSA6IGluZm8tPm1OYW1lKTsKKyAgICBkZXN0RkQgPSBvcGVuKGRlc3QsIE9fV1JPTkxZIHwgT19DUkVBVCB8IE9fVFJVTkMsIFNfSVJVU1IgfCBTX0lXVVNSIHwgU19JUkdSUCB8IFNfSVJPVEgpOworICAgIGlmIChkZXN0RkQgPCAwKSB7CisgICAgICAgIGZwcmludGYoc3RkZXJyLCAiY291bGQgbm90IGNyZWF0ZSAlc1xuIiwgZGVzdCk7CisgICAgICAgIGdvdG8gZmFpbDsKKyAgICB9CisgICAgc3JjRkQgPSBzcmNGaWxlLT5nZXREZXZpY2UoKS0+cmVhZE9iamVjdChpbmZvLT5tSGFuZGxlLCBpbmZvLT5tQ29tcHJlc3NlZFNpemUpOworICAgIGlmIChzcmNGRCA8IDApCisgICAgICAgIGdvdG8gZmFpbDsKKworICAgIGNoYXIgYnVmZmVyWzY1NTM2XTsKKyAgICB3aGlsZSAoMSkgeworICAgICAgICBpbnQgY291bnQgPSByZWFkKHNyY0ZELCBidWZmZXIsIHNpemVvZihidWZmZXIpKTsKKyAgICAgICAgaWYgKGNvdW50IDw9IDApCisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgd3JpdGUoZGVzdEZELCBidWZmZXIsIGNvdW50KTsKKyAgICB9CisgICAgLy8gRklYTUUgLSBlcnJvciBjaGVja2luZyBhbmQgcmVwb3J0aW5nCisgICAgcmV0ID0gMDsKKworZmFpbDoKKyAgICBkZWxldGUgc3JjRmlsZTsKKyAgICBkZWxldGUgaW5mbzsKKyAgICBpZiAoc3JjRkQgPj0gMCkKKyAgICAgICAgY2xvc2Uoc3JjRkQpOworICAgIGlmIChkZXN0RkQgPj0gMCkKKyAgICAgICAgY2xvc2UoZGVzdEZEKTsKKyAgICByZXR1cm4gcmV0OworfQorCitzdGF0aWMgaW50IHB1dF9maWxlKGludCBhcmdjLCBjaGFyKiBhcmd2W10pIHsKKyAgICBpbnQgcmV0ID0gLTE7CisgICAgaW50IHNyY0ZEID0gLTE7CisgICAgTXRwRmlsZSogZGVzdEZpbGUgPSBOVUxMOworICAgIE10cE9iamVjdEluZm8qIHNyY0luZm8gPSBOVUxMOworICAgIE10cE9iamVjdEluZm8qIGRlc3RJbmZvID0gTlVMTDsKKyAgICBNdHBPYmplY3RIYW5kbGUgaGFuZGxlOworICAgIHN0cnVjdCBzdGF0IHN0YXRidWY7CisgICAgY29uc3QgY2hhciogbGFzdFNsYXNoOworCisgICAgaWYgKGFyZ2MgPCAxKSB7CisgICAgICAgIGZwcmludGYoc3RkZXJyLCAibm90IGVub3VnaCBhcmd1bWVudHNcbiIpOworICAgICAgICByZXR1cm4gLTE7CisgICAgfSBlbHNlIGlmIChhcmdjID4gMikgeworICAgICAgICBmcHJpbnRmKHN0ZGVyciwgInRvbyBtYW55IGFyZ3VtZW50c1xuIik7CisgICAgICAgIHJldHVybiAtMTsKKyAgICB9CisgICAgY29uc3QgY2hhciogc3JjID0gYXJndlswXTsKKyAgICBzcmNGRCA9IG9wZW4oc3JjLCBPX1JET05MWSk7CisgICAgaWYgKHNyY0ZEIDwgMCkgeworICAgICAgICBmcHJpbnRmKHN0ZGVyciwgImNvdWxkIG5vdCBvcGVuICVzXG4iLCBzcmMpOworICAgICAgICBnb3RvIGZhaWw7CisgICAgfQorICAgIGlmIChhcmdjID09IDIpIHsKKyAgICAgICAgIGNoYXIqIGRlc3QgPSBhcmd2WzFdOworICAgICAgICBkZXN0RmlsZSA9IHBhcnNlX3BhdGgoZGVzdCk7CisgICAgICAgIGlmICghZGVzdEZpbGUpIHsKKyAgICAgICAgICAgIGZwcmludGYoc3RkZXJyLCAiY291bGQgbm90IGZpbmQgJXNcbiIsIGRlc3QpOworICAgICAgICAgICAgZ290byBmYWlsOworICAgICAgICB9CisgICAgfSBlbHNlIHsKKyAgICAgICAgaWYgKCFzQ3VycmVudERpcmVjdG9yeSkgeworICAgICAgICAgICAgZnByaW50ZihzdGRlcnIsICJjdXJyZW50IHdvcmtpbmcgZGlyZWN0b3J5IG5vdCBzZXRcbiIpOworICAgICAgICAgICAgZ290byBmYWlsOworICAgICAgICB9CisgICAgICAgIGRlc3RGaWxlID0gbmV3IE10cEZpbGUoc0N1cnJlbnREaXJlY3RvcnkpOworICAgIH0KKworICAgIGRlc3RJbmZvID0gZGVzdEZpbGUtPmdldE9iamVjdEluZm8oKTsKKyAgICBpZiAoIWRlc3RJbmZvKSB7CisgICAgICAgIGZwcmludGYoc3RkZXJyLCAiY291bGQgbm90IGZpbmQgb2JqZWN0IGluZm8gZGVzdGluYXRpb24gZGlyZWN0b3J5XG4iKTsKKyAgICAgICAgZ290byBmYWlsOworICAgIH0KKyAgICBpZiAoZGVzdEluZm8tPm1Gb3JtYXQgIT0gTVRQX0ZPUk1BVF9BU1NPQ0lBVElPTikgeworICAgICAgICBmcHJpbnRmKHN0ZGVyciwgImRlc3RpbmF0aW9uIG5vdCBhIGRpcmVjdG9yeVxuIik7CisgICAgICAgIGdvdG8gZmFpbDsKKyAgICB9CisKKyAgICBpZiAoZnN0YXQoc3JjRkQsICZzdGF0YnVmKSkKKyAgICAgICAgZ290byBmYWlsOworCisgICAgc3JjSW5mbyA9IG5ldyBNdHBPYmplY3RJbmZvKDApOworICAgIHNyY0luZm8tPm1TdG9yYWdlSUQgPSBkZXN0SW5mby0+bVN0b3JhZ2VJRDsKKyAgICBzcmNJbmZvLT5tRm9ybWF0ID0gTVRQX0ZPUk1BVF9FWElGX0pQRUc7ICAvLyBGSVhNRQorICAgIHNyY0luZm8tPm1Db21wcmVzc2VkU2l6ZSA9IHN0YXRidWYuc3Rfc2l6ZTsKKyAgICBzcmNJbmZvLT5tUGFyZW50ID0gZGVzdEluZm8tPm1IYW5kbGU7CisgICAgbGFzdFNsYXNoID0gc3RycmNocihzcmMsICcvJyk7CisgICAgc3JjSW5mby0+bU5hbWUgPSBzdHJkdXAobGFzdFNsYXNoID8gbGFzdFNsYXNoICsgMSA6IHNyYyk7CisgICAgc3JjSW5mby0+bURhdGVNb2RpZmllZCA9IHN0YXRidWYuc3RfbXRpbWU7CisgICAgaGFuZGxlID0gZGVzdEZpbGUtPmdldERldmljZSgpLT5zZW5kT2JqZWN0SW5mbyhzcmNJbmZvKTsKKyAgICBpZiAoaGFuZGxlIDw9IDApIHsKKyAgICAgICAgcHJpbnRmKCJzZW5kT2JqZWN0SW5mbyByZXR1cm5lZCAlMDRYXG4iLCBoYW5kbGUpOworICAgICAgICBnb3RvIGZhaWw7CisgICAgfQorICAgIGlmIChkZXN0RmlsZS0+Z2V0RGV2aWNlKCktPnNlbmRPYmplY3Qoc3JjSW5mbywgc3JjRkQpKQorICAgICAgICByZXQgPSAwOworCitmYWlsOgorICAgIGRlbGV0ZSBkZXN0RmlsZTsKKyAgICBkZWxldGUgc3JjSW5mbzsKKyAgICBkZWxldGUgZGVzdEluZm87CisgICAgaWYgKHNyY0ZEID49IDApCisgICAgICAgIGNsb3NlKHNyY0ZEKTsKKyAgICBwcmludGYoInJldHVybmluZyAlZFxuIiwgcmV0KTsKKyAgICByZXR1cm4gcmV0OworfQorCit0eXBlZGVmIGludCAoKiBjb21tYW5kX2Z1bmMpKGludCBhcmdjLCBjaGFyKiBhcmd2W10pOworCitzdHJ1Y3QgY29tbWFuZF90YWJsZV9lbnRyeSB7CisgICAgY29uc3QgY2hhciogbmFtZTsKKyAgICBjb21tYW5kX2Z1bmMgZnVuYzsKK307CisKK2NvbnN0IGNvbW1hbmRfdGFibGVfZW50cnkgY29tbWFuZF9saXN0W10gPSB7CisgICAgeyAgICJjZCIsICAgICAgIHNldF9jd2QgICAgICAgICB9LAorICAgIHsgICAibHMiLCAgICAgICBsaXN0ICAgICAgICAgICAgfSwKKyAgICB7ICAgImdldCIsICAgICAgZ2V0X2ZpbGUgICAgICAgIH0sCisgICAgeyAgICJwdXQiLCAgICAgIHB1dF9maWxlICAgICAgICB9LAorICAgIHsgICBOVUxMLCAgICAgICBOVUxMICAgICAgICAgICAgfSwKK307CisKKworc3RhdGljIGludCBkb19jb21tYW5kKGludCBhcmdjLCBjaGFyKiBhcmd2W10pIHsKKyAgICBjb25zdCBjb21tYW5kX3RhYmxlX2VudHJ5KiBjb21tYW5kID0gY29tbWFuZF9saXN0OworICAgIGNvbnN0IGNoYXIqIG5hbWUgPSAqYXJndisrOworICAgIGFyZ2MtLTsKKworICAgIHdoaWxlIChjb21tYW5kLT5uYW1lKSB7CisgICAgICAgIGlmICghc3RyY21wKGNvbW1hbmQtPm5hbWUsIG5hbWUpKQorICAgICAgICAgICAgcmV0dXJuIGNvbW1hbmQtPmZ1bmMoYXJnYywgYXJndik7CisgICAgICAgIGVsc2UKKyAgICAgICAgICAgIGNvbW1hbmQrKzsKKyAgICB9CisgICAgZnByaW50ZihzdGRlcnIsICJ1bmtub3duIGNvbW1hbmQgJXNcbiIsIG5hbWUpOworICAgIHJldHVybiAtMTsKK30KKworc3RhdGljIGludCBzaGVsbCgpIHsKKyAgICBpbnQgYXJnYzsKKyAgICBpbnQgcmVzdWx0ID0gMDsKKyNkZWZpbmUgTUFYX0FSR1MgICAgMTAwCisgICAgY2hhciogYXJndltNQVhfQVJHU107CisKKyNpZiBIQVZFX1JFQURMSU5FCisgICAgdXNpbmdfaGlzdG9yeSgpOworI2VuZGlmCisKKyAgICB3aGlsZSAoMSkgeworI2lmIEhBVkVfUkVBRExJTkUKKyAgICAgICAgY2hhciogbGluZSA9IHJlYWRsaW5lKFBST01QVCk7CisgICAgICAgIGlmICghbGluZSkgeworICAgICAgICAgICAgcHJpbnRmKCJcbiIpOworICAgICAgICAgICAgZXhpdCgwKTsKKyAgICAgICAgfQorI2Vsc2UKKyAgICAgICAgY2hhciAgICBidWZmZXJbMTAwMF07CisgICAgICAgIHByaW50ZigiJXMiLCBQUk9NUFQpOworICAgICAgICBjaGFyKiBsaW5lID0gTlVMTDsKKyAgICAgICAgc2l6ZV90IGxlbmd0aCA9IDA7CisKKyAgICAgICAgYnVmZmVyWzBdID0gMDsKKyAgICAgICAgZmdldHMoYnVmZmVyLCBzaXplb2YoYnVmZmVyKSwgc3RkaW4pOworICAgICAgICBpbnQgY291bnQgPSBzdHJsZW4oYnVmZmVyKTsKKyAgICAgICAgaWYgKGNvdW50ID4gMCAmJiBidWZmZXJbMF0gPT0gRU9GKSB7CisgICAgICAgICAgICBwcmludGYoIlxuIik7CisgICAgICAgICAgICBleGl0KDApOworICAgICAgICB9CisgICAgICAgIGlmIChjb3VudCA+IDAgJiYgbGluZVtjb3VudCAtIDFdID09ICdcbicpCisgICAgICAgICAgICBsaW5lW2NvdW50IC0gMV0gPT0gMDsKKyNlbmRpZgorICAgICAgICBjaGFyKiB0b2sgPSBzdHJ0b2sobGluZSwgIiBcdFxuXHIiKTsKKyAgICAgICAgaWYgKCF0b2spCisgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgaWYgKCFzdHJjbXAodG9rLCAicXVpdCIpIHx8ICFzdHJjbXAodG9rLCAiZXhpdCIpKSB7CisgICAgICAgICAgICBleGl0KDApOworICAgICAgICB9CisjaWYgSEFWRV9SRUFETElORQorICAgICAgICBhZGRfaGlzdG9yeShsaW5lKTsKKyNlbmRpZgorICAgICAgICBhcmdjID0gMDsKKyAgICAgICAgd2hpbGUgKHRvaykgeworICAgICAgICAgICAgaWYgKGFyZ2MgKyAxID09IE1BWF9BUkdTKSB7CisgICAgICAgICAgICAgICAgZnByaW50ZihzdGRlcnIsICJ0b28gbWFueSBhcmd1bWVudHNcbiIpOworICAgICAgICAgICAgICAgIHJlc3VsdCA9IC0xOworICAgICAgICAgICAgICAgIGdvdG8gYm90dG9tX29mX2xvb3A7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGFyZ3ZbYXJnYysrXSA9IHN0cmR1cCh0b2spOworICAgICAgICAgICAgdG9rID0gc3RydG9rKE5VTEwsICIgXHRcblxyIik7CisgICAgICAgIH0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VDb25maWciCisjZGVmaW5lIEFORFJPSURfVFRTX0VOR0lORV9QUk9QRVJUWV9QSVRDSCAgInBpdGNoIgorI2RlZmluZSBBTkRST0lEX1RUU19FTkdJTkVfUFJPUEVSVFlfUkFURSAgICJyYXRlIgorI2RlZmluZSBBTkRST0lEX1RUU19FTkdJTkVfUFJPUEVSVFlfVk9MVU1FICJ2b2x1bWUiCisKK3R5cGVkZWYgZW51bSB7CisgICAgQU5EUk9JRF9UVFNfU1VDQ0VTUyAgICAgICAgICAgICAgICAgPSAwLAorICAgIEFORFJPSURfVFRTX0ZBSUxVUkUgICAgICAgICAgICAgICAgID0gLTEsCisgICAgQU5EUk9JRF9UVFNfRkVBVFVSRV9VTlNVUFBPUlRFRCAgICAgPSAtMiwKKyAgICBBTkRST0lEX1RUU19WQUxVRV9JTlZBTElEICAgICAgICAgICA9IC0zLAorICAgIEFORFJPSURfVFRTX1BST1BFUlRZX1VOU1VQUE9SVEVEICAgID0gLTQsCisgICAgQU5EUk9JRF9UVFNfUFJPUEVSVFlfU0laRV9UT09fU01BTEwgPSAtNSwKKyAgICBBTkRST0lEX1RUU19NSVNTSU5HX1JFU09VUkNFUyAgICAgICA9IC02Cit9IGFuZHJvaWRfdHRzX3Jlc3VsdF90OworCit0eXBlZGVmIGVudW0geworICAgIEFORFJPSURfVFRTX0xBTkdfQ09VTlRSWV9WQVJfQVZBSUxBQkxFID0gMiwKKyAgICBBTkRST0lEX1RUU19MQU5HX0NPVU5UUllfQVZBSUxBQkxFICAgID0gMSwKKyAgICBBTkRST0lEX1RUU19MQU5HX0FWQUlMQUJMRSAgICAgICAgICAgID0gMCwKKyAgICBBTkRST0lEX1RUU19MQU5HX01JU1NJTkdfREFUQSAgICAgICAgID0gLTEsCisgICAgQU5EUk9JRF9UVFNfTEFOR19OT1RfU1VQUE9SVEVEICAgICAgICA9IC0yCit9IGFuZHJvaWRfdHRzX3N1cHBvcnRfcmVzdWx0X3Q7CisKK3R5cGVkZWYgZW51bSB7Cisg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W5lLAorICAgICAgICAgICAgIGNvbnN0IGNoYXIgKnByb3BlcnR5LAorICAgICAgICAgICAgIGNvbnN0IGNoYXIgKnZhbHVlLAorICAgICAgICAgICAgIGNvbnN0IHNpemVfdCBzaXplKTsKKworICAgIC8vIFJldHJpZXZlIGEgcHJvcGVydHkgZnJvbSB0aGUgVFRTIGVuZ2luZQorICAgIC8vIEBwYXJhbSAgICAgICAgcHJvcGVydHkgcG9pbnRlciB0byB0aGUgcHJvcGVydHkgbmFtZQorICAgIC8vIEBwYXJhbVtvdXRdICAgdmFsdWUgICAgcG9pbnRlciB0byB0aGUgcmV0cmlldmVkIGxhbmd1YWdlIHZhbHVlCisgICAgLy8gQHBhcmFtW2lub3V0XSBpb3NpemUgICBpbjogc3RvcmVzIHRoZSBzaXplIGF2YWlsYWJsZSB0byBzdG9yZSB0aGUKKyAgICAvLyAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvcGVydHkgdmFsdWUuCisgICAgLy8gICAgICAgICAgICAgICAgICAgICAgICBvdXQ6IHN0b3JlcyB0aGUgc2l6ZSByZXF1aXJlZCB0byBob2xkIHRoZSBsYW5ndWFnZQorICAgIC8vICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZSBpZiBnZXRMYW5ndWFnZSgpIHJldHVybmVkCisgICAgLy8gICAgICAgICAgICAgICAgICAgICAgICAgIFRUU19QUk9QRVJUWV9TSVpFX1RPT19TTUFMTCwgdW5jaGFuZ2VkIG90aGVyd2lzZQorICAgIC8vIEByZXR1cm4gVFRTX1BST1BFUlRZX1VOU1VQUE9SVEVELCBvciBUVFNfU1VDQ0VTUywKKyAgICAvLyAgICAgICAgIG9yIFRUU19QUk9QRVJUWV9TSVpFX1RPT19TTUFMTAorICAgIGFuZHJvaWRfdHRzX3Jlc3VsdF90ICgqZ2V0UHJvcGVydHkpCisgICAgICAgICAgICAodm9pZCAqZW5naW5lLAorICAgICAgICAgICAgIGNvbnN0IGNoYXIgKnByb3BlcnR5LAorICAgICAgIC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gIC8vICAgICAgICAgIG8gc3RyZW5ndGgsCisgICAgLy8gICAgICAgICAgbyB0aW1lCisgICAgLy8gICAgKiBwcm9zb2R5OgorICAgIC8vICAgICAgICAgIG8gcGl0Y2gsCisgICAgLy8gICAgICAgICAgbyBjb250b3VyLAorICAgIC8vICAgICAgICAgIG8gcmFuZ2UsCisgICAgLy8gICAgICAgICAgbyByYXRlLAorICAgIC8vICAgICAgICAgIG8gZHVyYXRpb24sCisgICAgLy8gICAgICAgICAgbyB2b2x1bWUKKyAgICAvLyAgICAqIG1hcmsKKyAgICAvLyBEaWZmZXJlbmNlcyBiZXR3ZWVuIHRoaXMgdGV4dCBmb3JtYXQgYW5kIFNTTUwgYXJlOgorICAgIC8vICAgICogZnVsbCBTU01MIGRvY3VtZW50cyBhcmUgbm90IHN1cHBvcnRlZAorICAgIC8vICAgICogbmFtZXNwYWNlcyBhcmUgbm90IHN1cHBvcnRlZAorICAgIC8vIFRleHQgaXMgY29kZWQgaW4gVVRGLTguCisgICAgLy8gQHBhcmFtIHRleHQgICAgICB0aGUgVVRGLTggdGV4dCB0byBzeW50aGVzaXplCisgICAgLy8gQHBhcmFtIHVzZXJkYXRhICBwb2ludGVyIHRvIGJlIHJldHVybmVkIHdoZW4gdGhlIGNhbGwgaXMgaW52b2tlZAorICAgIC8vIEBwYXJhbSBidWZmZXIgICAgdGhlIGxvY2F0aW9uIHdoZXJlIHRoZSBzeW50aGVzaXplZCBkYXRhIG11c3QgYmUgd3JpdHRlbgorICAgIC8vIEBwYXJhbSBidWZmZXJTaXplIHRoZSBudW1iZXIgb2YgYnl0ZXMgdGhhdCBjYW4gYmUgd3JpdHRlbiBpbiBidWZmZXIKKyAgICAvLyBAcmV0dXJuICAgICAgICAgIFRUU19TVUNDRVNTIG9yIFRUU19GQUlMVVJFCisgICAgYW5kcm9pZF90dHNfcmVzdWx0X3QgKCpzeW50aGVzaXplVGV4dCkKKyAgICAgICAgICAgICh2b2lkICplbmdpbmUsCisgICAgICAgICAg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KyAgICAgICAgICAgIEdMaW50IGluZm9MZW4gPSAwOworICAgICAgICAgICAgZ2xHZXRTaGFkZXJpdihzaGFkZXIsIEdMX0lORk9fTE9HX0xFTkdUSCwgJmluZm9MZW4pOworICAgICAgICAgICAgaWYgKGluZm9MZW4pIHsKKyAgICAgICAgICAgICAgICBjaGFyKiBidWYgPSAoY2hhciopIG1hbGxvYyhpbmZvTGVuKTsKKyAgICAgICAgICAgICAgICBpZiAoYnVmKSB7CisgICAgICAgICAgICAgICAgICAgIGdsR2V0U2hhZGVySW5mb0xvZyhzaGFkZXIsIGluZm9MZW4sIE5VTEwsIGJ1Zik7CisgICAgICAgICAgICAgICAgICAgIExPR0UoIkNvdWxkIG5vdCBjb21waWxlIHNoYWRlciAlZDpcbiVzXG4iLCBzaGFkZXJUeXBlLCBidWYpOworICAgICAgICAgICAgICAgICAgICBmcmVlKGJ1Zik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGdsRGVsZXRlU2hhZGVyKHNoYWRlcik7CisgICAgICAgICAgICAgICAgc2hhZGVyID0gMDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKyAgICByZXR1cm4gc2hhZGVyOworfQorCitlbnVtIHsKKyAgICBBX1BPUywKKyAgICBBX0NPTE9SLAorICAgIEFfVEVYMCwKKyAgICBBX1RFWDEKK307CisKK0dMdWludCBjcmVhdGVQcm9ncmFtKGNvbnN0IGNoYXIqIHBWZXJ0ZXhTb3VyY2UsIGNvbnN0IGNoYXIqIHBGcmFnbWVudFNvdXJjZSkgeworICAgIEdMdWludCB2ZXJ0ZXhTaGFkZXIgPSBsb2FkU2hhZGVyKEdMX1ZFUlRFWF9TSEFERVIsIHBWZXJ0ZXhTb3VyY2UpOworICAgIGlmICghdmVydGV4U2hhZGVyKSB7CisgICAgICAgIHJldHVybiAwOworICAgIH0KKworICAgIEdMdWludCBwaXhlbFNoYWRlciA9IGxvYWRTaGFkZXIoR0xfRlJBR01FTlRfU0hBRE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ChidWZMZW5ndGgpIHsKKyAgICAgICAgICAgICAgICBjaGFyKiBidWYgPSAoY2hhciopIG1hbGxvYyhidWZMZW5ndGgpOworICAgICAgICAgICAgICAgIGlmIChidWYpIHsKKyAgICAgICAgICAgICAgICAgICAgZ2xHZXRQcm9ncmFtSW5mb0xvZyhwcm9ncmFtLCBidWZMZW5ndGgsIE5VTEwsIGJ1Zik7CisgICAgICAgICAgICAgICAgICAgIExPR0UoIkNvdWxkIG5vdCBsaW5rIHByb2dyYW06XG4lc1xuIiwgYnVmKTsKKyAgICAgICAgICAgICAgICAgICAgZnJlZShidWYpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGdsRGVsZXRlUHJvZ3JhbShwcm9ncmFtKTsKKyAgICAgICAgICAgIHByb2dyYW0gPSAwOworICAgICAgICB9CisgICAgfQorICAgIGNoZWNrR2xFcnJvcigiY3JlYXRlUHJvZ3JhbSIpOworICAgIGdsVXNlUHJvZ3JhbShwcm9ncmFtKTsKKyAgICByZXR1cm4gcHJvZ3JhbTsKK30KKwordWludDY0X3QgZ2V0VGltZSgpIHsKKyAgICBzdHJ1Y3QgdGltZXNwZWMgdDsKKyAgICBjbG9ja19nZXR0aW1lKENMT0NLX01PTk9UT05JQywgJnQpOworICAgIHJldHVybiB0LnR2X25zZWMgKyAoKHVpbnQ2NF90KXQudHZfc2VjICogMTAwMCAqIDEwMDAgKiAxMDAwKTsKK30KKwordWludDY0X3QgZ1RpbWU7Cit2b2lkIHN0YXJ0VGltZXIoKSB7CisgICAgZ1RpbWUgPSBnZXRUaW1lKCk7Cit9CisKK3ZvaWQgZW5kVGltZXIoY29uc3QgY2hhciAqc3RyLCBpbnQgdywgaW50IGgsIGRvdWJsZSBkYywgaW50IGNvdW50KSB7CisgICAgdWludDY0X3QgdDIgPSBnZXRUaW1lKCk7CisgICAgZG91YmxlIGRlbHRhID0gKChkb3VibGUpKHQyIC0gZ1RpbWUpKSAvIDEwMDAwMDAw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VHTFV0aWxzOjpzdHJlcnJvcihlcnJvciksCisgICAgICAgICAgICAgICAgZXJyb3IpOworICAgIH0KK30KKworc3RhdGljIHZvaWQgY2hlY2tHbEVycm9yKGNvbnN0IGNoYXIqIG9wKSB7CisgICAgZm9yIChHTGludCBlcnJvciA9IGdsR2V0RXJyb3IoKTsgZXJyb3I7IGVycm9yCisgICAgICAgICAgICA9IGdsR2V0RXJyb3IoKSkgeworICAgICAgICBmcHJpbnRmKHN0ZGVyciwgImFmdGVyICVzKCkgZ2xFcnJvciAoMHgleClcbiIsIG9wLCBlcnJvcik7CisgICAgfQorfQorCitib29sIGRvVGVzdCh1aW50MzJfdCB3LCB1aW50MzJfdCBoKTsKKworc3RhdGljIEVHTERpc3BsYXkgZHB5Oworc3RhdGljIEVHTFN1cmZhY2Ugc3VyZmFjZTsKKworaW50IG1haW4oaW50IGFyZ2MsIGNoYXIqKiBhcmd2KSB7CisgICAgRUdMQm9vbGVhbiByZXR1cm5WYWx1ZTsKKyAgICBFR0xDb25maWcgbXlDb25maWcgPSB7MH07CisKKyAgICBFR0xpbnQgY29udGV4dF9hdHRyaWJzW10gPSB7IEVHTF9DT05URVhUX0NMSUVOVF9WRVJTSU9OLCAyLCBFR0xfTk9ORSB9OworICAgIEVHTGludCBzX2NvbmZpZ0F0dHJpYnNbXSA9IHsKKyAgICAgICAgICAgIEVHTF9TVVJGQUNFX1RZUEUsIEVHTF9XSU5ET1dfQklULAorICAgICAgICAgICAgRUdMX1JFTkRFUkFCTEVfVFlQRSwgRUdMX09QRU5HTF9FUzJfQklULAorICAgICAgICAgICAgRUdMX05PTkUgfTsKKyAgICBFR0xpbnQgbWFqb3JWZXJzaW9uOworICAgIEVHTGludCBtaW5vclZlcnNpb247CisgICAgRUdMQ29udGV4dCBjb250ZXh0OworICAgIEVHTGludCB3LCBoOworCisKKyAgICBjaGVja0VnbEVycm9yKCI8aW5pdD4iKTsKKyAgICBkcHkgPSBlZ2xHZXREaXNwbGF5KEVHTF9ERU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ZXhDb3VudCwgbW9kdWxhdGVGaXJzdFRleCwgZXh0cmFNYXRoLCB0ZXgwKTsKKworICAgIAkgICAgZG9Mb29wKChzdGF0ZUNsb2NrICUgZG9Mb29wU3RhdGVzKSAhPSAwLCBwZ20sIHcsIGgsIHN0cjIpOworCSB9CisgICAgICAgICBicmVhazsKKyAgICAgICAgIGNhc2UgMTogeworICAgICAgICAgICAgY2hhciBzdHIyWzEwMjRdOworCSAgICBnbEVuYWJsZShHTF9CTEVORCk7CisJICAgIHNwcmludGYoc3RyMiwgIiVpLCAlaSwgJWksICVpLCAlaSwgMSIsCisJCSAgICB1c2VWYXJDb2xvciwgdGV4Q291bnQsIG1vZHVsYXRlRmlyc3RUZXgsIGV4dHJhTWF0aCwgdGV4MCk7CisJICAgIGRvTG9vcCgoc3RhdGVDbG9jayAlIGRvTG9vcFN0YXRlcykgIT0gMCwgcGdtLCB3LCBoLCBzdHIyKTsKKyAgICAgICAgfQorICAgICAgICBicmVhazsKKyAgICB9Cit9CisKKwordm9pZCBkb1Rlc3QodWludDMyX3QgdywgdWludDMyX3QgaCkgeworICAgIGludCB0ZXN0U3RhdGUgPSBzdGF0ZUNsb2NrIC8gKGRvTG9vcFN0YXRlcyAqIGRvU2luZ2xlVGVzdFN0YXRlcyk7CisgICAgaW50IHRleENvdW50OworICAgIGludCBleHRyYU1hdGg7CisgICAgaW50IHRlc3RTdWJTdGF0ZTsKKyAgICBjb25zdCBpbnQgZXh0cmFNYXRoQ291bnQgPSA1OworICAgIGNvbnN0IGludCB0ZXhDb3VudDBTdWJUZXN0Q291bnQgPSAyOworICAgIGNvbnN0IGludCB0ZXhDb3VudE5TdWJUZXN0Q291bnQgPSA4OworCisgICAgaWYgKCB0ZXN0U3RhdGUgPCBleHRyYU1hdGhDb3VudCAqIHRleENvdW50MFN1YlRlc3RDb3VudCkgeworICAgICAgIHRleENvdW50ID0gMDsgLy8gT25seSAxMCB0ZXN0cyBmb3IgdGV4Q291bnQgMAorICAgICAgIGV4d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VHTF9CTFVFX1NJWkUsIDQsCisgICAgICAgICAgICBFR0wxMC5FR0xfUkVOREVSQUJMRV9UWVBFLCBFR0xfT1BFTkdMX0VTMl9CSVQsCisgICAgICAgICAgICBFR0wxMC5FR0xfTk9ORQorICAgICAgICB9OworCisgICAgICAgIHB1YmxpYyBDb25maWdDaG9vc2VyKGludCByLCBpbnQgZywgaW50IGIsIGludCBhLCBpbnQgZGVwdGgsIGludCBzdGVuY2lsKSB7CisgICAgICAgICAgICBtUmVkU2l6ZSA9IHI7CisgICAgICAgICAgICBtR3JlZW5TaXplID0gZzsKKyAgICAgICAgICAgIG1CbHVlU2l6ZSA9IGI7CisgICAgICAgICAgICBtQWxwaGFTaXplID0gYTsKKyAgICAgICAgICAgIG1EZXB0aFNpemUgPSBkZXB0aDsKKyAgICAgICAgICAgIG1TdGVuY2lsU2l6ZSA9IHN0ZW5jaWw7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgRUdMQ29uZmlnIGNob29zZUNvbmZpZyhFR0wxMCBlZ2wsIEVHTERpc3BsYXkgZGlzcGxheSkgeworCisgICAgICAgICAgICBpbnRbXSBudW1fY29uZmlnID0gbmV3IGludFsxXTsKKyAgICAgICAgICAgIGVnbC5lZ2xDaG9vc2VDb25maWcoZGlzcGxheSwgc19jb25maWdBdHRyaWJzMiwgbnVsbCwgMCwgbnVtX2NvbmZpZyk7CisKKyAgICAgICAgICAgIGludCBudW1Db25maWdzID0gbnVtX2NvbmZpZ1swXTsKKworICAgICAgICAgICAgaWYgKG51bUNvbmZpZ3MgPD0gMCkgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oIk5vIGNvbmZpZ3MgbWF0Y2ggY29uZmlnU3BlYyIpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgRUdMQ29uZmlnW10gY29uZmlncyA9IG5ldyBFR0xDb25maWdbbnVtQ29uZmlnc107CisgICAgICAgICAgICBlZ2wuZWdsQ2hvb3NlQ29uZmlnKGRpc3BsYXksIHNfY29uZmlnQXR0cmliczIsIGNvbmZpZ3MsIG51bUNvbmZpZ3MsIG51bV9jb25maWcpOworICAgICAgICAgICAgLy8gcHJpbnRDb25maWdzKGVnbCwgZGlzcGxheSwgY29uZmlncyk7CisgICAgICAgICAgICByZXR1cm4gY2hvb3NlQ29uZmlnKGVnbCwgZGlzcGxheSwgY29uZmlncyk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgRUdMQ29uZmlnIGNob29zZUNvbmZpZyhFR0wxMCBlZ2wsIEVHTERpc3BsYXkgZGlzcGxheSwKKyAgICAgICAgICAgICAgICBFR0xDb25maWdbXSBjb25maWdzKSB7CisgICAgICAgICAgICBFR0xDb25maWcgY2xvc2VzdENvbmZpZyA9IG51bGw7CisgICAgICAgICAgICBpbnQgY2xvc2VzdERpc3RhbmNlID0gMTAwMDsKKyAgICAgICAgICAgIGZvcihFR0xDb25maWcgY29uZmlnIDogY29uZmlncykgeworICAgICAgICAgICAgICAgIGludCBkID0gZmluZENvbmZpZ0F0dHJpYihlZ2wsIGRpc3BsYXksIGNvbmZpZywKKyAgICAgICAgICAgICAgICAgICAgICAgIEVHTDEwLkVHTF9ERVBUSF9TSVpFLCAwKTsKKyAgICAgICAgICAgICAgICBpbnQgcyA9IGZpbmRDb25maWdBdHRyaWIoZWdsLCBkaXNwbGF5LCBjb25maWcsCisgICAgICAgICAgICAgICAgICAgICAgICBFR0wxMC5FR0xfU1RFTkNJTF9TSVpFLCAwKTsKKyAgICAgICAgICAgICAgICBpZiAoZCA+PSBtRGVwdGhTaXplICYmIHM+PSBtU3RlbmNpbFNpemUpIHsKKyAgICAgICAgICAgICAgICAgICAgaW50IHIgPSBmaW5kQ29uZmlnQXR0cmliKGVnbCwgZGlzcGxheSwgY29uZmlnLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIEVHTDEwLkVHTF9SRURfU0laRSwgMCk7CisgICAgICAgICAgICAgICAgICAgIGludCBnID0gZmluZENvbmZpZ0F0dHJpYihlZ2wsIGRpc3BsYXksIGNvbmZpZywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRUdMMTAuRUdMX0dSRUVOX1NJWkUsIDApOworICAgICAgICAgICAgICAgICAgICBpbnQgYiA9IGZpbmRDb25maWdBdHRyaWIoZWdsLCBkaXNwbGF5LCBjb25maWcsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBFR0wxMC5FR0xfQkxVRV9TSVpFLCAwKTsKKyAgICAgICAgICAgICAgICAgICAgaW50IGEgPSBmaW5kQ29uZmlnQXR0cmliKGVnbCwgZGlzcGxheSwgY29uZmlnLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIEVHTDEwLkVHTF9BTFBIQV9TSVpFLCAwKTsKKyAgICAgICAgICAgICAgICAgICAgaW50IGRpc3RhbmNlID0gTWF0aC5hYnMociAtIG1SZWRTaXplKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIE1hdGguYWJzKGcgLSBtR3JlZW5TaXplKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIE1hdGguYWJzKGIgLSBtQmx1ZVNpemUpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgTWF0aC5hYnMoYSAtIG1BbHBoYVNpemUpOworICAgICAgICAgICAgICAgICAgICBpZiAoZGlzdGFuY2UgPCBjbG9zZXN0RGlzdGFuY2UpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNsb3Nlc3REaXN0YW5jZSA9IGRpc3RhbmNlOworICAgICAgICAgICAgICAgICAgICAgICAgY2xvc2VzdENvbmZpZyA9IGNvbmZpZzsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHJldHVybiBjbG9zZXN0Q29uZmlnOworICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSBpbnQgZmluZENvbmZpZ0F0dHJpYihFR0wxMCBlZ2wsIEVHTERpc3BsYXkgZGlzcGxheSwKKyAgICAgICAgICAgICAgICBFR0xDb25maWcgY29uZmlnLCBpbnQgYXR0cmlidXRlLCBpbnQgZGVmYXVsdFZhbHVlKSB7CisKKyAgICAgICAgICAgIGlmIChlZ2wuZWdsR2V0Q29uZmlnQXR0cmliKGRpc3BsYXksIGNvbmZpZywgYXR0cmlidXRlLCBtVmFsdWUpKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIG1WYWx1ZVswXTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHJldHVybiBkZWZhdWx0VmFsdWU7CisgICAgICAgIH0KKworICAgICAgICBwcml2YXRlIHZvaWQgcHJpbnRDb25maWdzKEVHTDEwIGVnbCwgRUdMRGlzcGxheSBkaXNwbGF5LAorICAgICAgICAgICAgRUdMQ29uZmlnW10gY29uZmlncykgeworICAgICAgICAgICAgaW50IG51bUNvbmZpZ3MgPSBjb25maWdzLmxlbmd0aDsKKyAgICAgICAgICAgIExvZy53KFRBRywgU3RyaW5nLmZvcm1hdCgiJWQgY29uZmlndXJhdGlvbnMiLCBudW1Db25maWdzKSk7CisgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IG51bUNvbmZpZ3M7IGkrKykgeworICAgICAgICAgICAgICAgIExvZy53KFRBRywgU3RyaW5nLmZvcm1hdCgiQ29uZmlndXJhdGlvbiAlZDpcbiIsIGkpKTsKKyAgICAgICAgICAgICAgICBwcmludENvbmZpZyhlZ2wsIGRpc3BsYXksIGNvbmZpZ3NbaV0pOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSB2b2lkIHByaW50Q29uZmlnKEVHTDEwIGVnbCwgRUdMRGlzcGxheSBkaXNwbGF5LAorICAgICAgICAgICAgICAgIEVHTENvbmZpZyBjb25maWcpIHsKKyAgICAgICAgICAgIGludFtdIGF0dHJpYnV0ZXMgPSB7CisgICAgICAgICAgICAgICAgICAgIEVHTDEwLkVHTF9CVUZGRVJfU0laRSwKKyAgICAgICAgICAgICAgICAgICAgRUdMMTAuRUdMX0FMUEhBX1NJWkUsCisgICAgICAgICAgICAgICAgICAgIEVHTDEwLkVHTF9CTFVFX1NJWkUsCisgICAgICAgICAgICAgICAgICAgIEVHTDEwLkVHTF9HUkVFTl9TSVpFLAorICAgICAgICAgICAgICAgICAgICBFR0wxMC5FR0xfUkVEX1NJWkUsCisgICAgICAgICAgICAgICAgICAgIEVHTDEwLkVHTF9ERVBUSF9TSVpFLAorICAgICAgICAgICAgICAgICAgICBFR0wxMC5FR0xfU1RFTkNJTF9TSVpFLAorICAgICAgICAgICAgICAgICAgICBFR0wxMC5FR0xfQ09ORklHX0NBVkVBVCwKKyAgICAgICAgICAgICAgICAgICAgRUdMMTAuRUdMX0NPTkZJR19JRCwKKyAgICAgICAgICAgICAgICAgICAgRUdMMTAuRUdMX0xFVkVMLAorICAgICAgICAgICAgICAgICAgICBFR0wxMC5FR0xfTUFYX1BCVUZGRVJfSEVJR0hULAorICAgICAgICAgICAgICAgICAgICBFR0wxMC5FR0xfTUFYX1BCVUZGRVJfUElYRUxTLAorICAgICAgICAgICAgICAgICAgICBFR0wxMC5FR0xfTUFYX1BCVUZGRVJfV0lEVEgsCisgICAgICAgICAgICAgICAgICAgIEVHTDEwLkVHTF9OQVRJVkVfUkVOREVSQUJMRSwKKyAgICAgICAgICAgICAgICAgICAgRUdMMTAuRUdMX05BVElWRV9WSVNVQUxfSUQsCisgICAgICAgICAgICAgICAgICAgIEVHTDEwLkVHTF9OQVRJVkVfVklTVUFMX1RZUEUsCisgICAgICAgICAgICAgICAgICAgIDB4MzAzMCwgLy8gRUdMMTAuRUdMX1BSRVNFUlZFRF9SRVNPVVJDRVMsCisgICAgICAgICAgICAgICAgICAgIEVHTDEwLkVHTF9TQU1QTEVTLAorICAgICAgICAgICAgICAgICAgICBFR0wxMC5FR0xfU0FNUExFX0JVRkZFUlMsCisgICAgICAgICAgICAgICAgICAgIEVHTDEwLkVHTF9TVVJGQUNFX1RZUEUsCisgICAgICAgICAgICAgICAgICAgIEVHTDEwLkVHTF9UUkFOU1BBUkVOVF9UWVBFLAorICAgICAgICAgICAgICAgICAgICBFR0wxMC5FR0xfVFJBTlNQQVJFTlRfUkVEX1ZBTFVFLAorICAgICAgICAgICAgICAgICAgICBFR0wxMC5FR0xfVFJBTlNQQVJFTlRfR1JFRU5fVkFMVUUsCisgICAgICAgICAgICAgICAgICAgIEVHTDEwLkVHTF9UUkFOU1BBUkVOVF9CTFVFX1ZBTFVFLAorICAgICAgICAgICAgICAgICAgICAweDMwMzksIC8vIEVHTDEwLkVHTF9CSU5EX1RPX1RFWFRVUkVfUkdCLAorICAgICAgICAgICAgICAgICAgICAweDMwM0EsIC8vIEVHTDEwLkVHTF9CSU5EX1RPX1RFWFRVUkVfUkdCQSwKKyAgICAgICAgICAgICAgICAgICAgMHgzMDNCLCAvLyBFR0wxMC5FR0xfTUlOX1NXQVBfSU5URVJWQUwsCisgICAgICAgICAgICAgICAgICAgIDB4MzAzQywgLy8gRUdMMTAuRUdMX01BWF9TV0FQX0lOVEVSVkFMLAorICAgICAgICAgICAgICAgICAgICBFR0wxMC5FR0xfTFVNSU5BTkNFX1NJWkUsCisgICAgICAgICAgICAgICAgICAgIEVHTDEwLkVHTF9BTFBIQV9NQVNLX1NJWkUsCisgICAgICAgICAgICAgICAgICAgIEVHTDEwLkVHTF9DT0xPUl9CVUZGRVJfVFlQRSwKKyAgICAgICAgICAgICAgICAgICAgRUdMMTAuRUdMX1JFTkRFUkFCTEVfVFlQRSwKKyAgICAgICAgICAgICAgICAgICAgMHgzMDQyIC8vIEVHTDEwLkVHTF9DT05GT1JNQU5UCisgICAgICAgICAgICB9OworICAgICAgICAgICAgU3RyaW5nW10gbmFtZXMgPSB7CisgICAgICAgICAgICAgICAgICAgICJFR0xfQlVGRkVSX1NJWkUiLAorICAgICAgICAgICAgICAgICAgICAiRUdMX0FMUEhBX1NJWkUiLAorICAgICAgICAgICAgICAgICAgICAiRUdMX0JMVUVfU0laRSIsCisgICAgICAgICAgICAgICAgICAgICJFR0xfR1JFRU5fU0laRSIsCisgICAgICAgICAgICAgICAgICAgICJFR0xfUkVEX1NJWkUiLAorICAgICAgICAgICAgICAgICAgICAiRUdMX0RFUFRIX1NJWkUiLAorICAgICAgICAgICAgICAgICAgICAiRUdMX1NURU5DSUxfU0laRSIsCisgICAgICAgICAgICAgICAgICAgICJFR0xfQ09ORklHX0NBVkVBVCIsCisgICAgICAgICAgICAgICAgICAgICJFR0xfQ09ORklHX0lEIiwKKyAgICAgICAgICAgICAgICAgICAgIkVHTF9MRVZFTCIsCisgICAgICAgICAgICAgICAgICAgICJFR0xfTUFYX1BCVUZGRVJfSEVJR0hUIiwKKyAgICAgICAgICAgICAgICAgICAgIkVHTF9NQVhfUEJVRkZFUl9QSVhFTFMiLAorICAgICAgICAgICAgICAgICAgICAiRUdMX01BWF9QQlVGRkVSX1dJRFRIIiwKKyAgICAgICAgICAgICAgICAgICAgIkVHTF9OQVRJVkVfUkVOREVSQUJMRSIsCisgICAgICAgICAgICAgICAgICAgICJFR0xfTkFUSVZFX1ZJU1VBTF9JRCIsCisgICAgICAgICAgICAgICAgICAgICJFR0xfTkFUSVZFX1ZJU1VBTF9UWVBFIiwKKyAgICAgICAgICAgICAgICAgICAgIkVHTF9QUkVTRVJWRURfUkVTT1VSQ0VTIiwKKyAgICAgICAgICAgICAgICAgICAgIkVHTF9TQU1QTEVTIiwKKyAgICAgICAgICAgICAgICAgICAgIkVHTF9TQU1QTEVfQlVGRkVSUyIsCisgICAgICAgICAgICAgICAgICAgICJFR0xfU1VSRkFDRV9UWVBFIiwKKyAgICAgICAgICAgICAgICAgICAgIkVHTF9UUkFOU1BBUkVOVF9UWVBFIiwKKyAgICAgICAgICAgICAgICAgICAgIkVHTF9UUkFOU1BBUkVOVF9SRURfVkFMVUUiLAorICAgICAgICAgICAgICAgICAgICAiRUdMX1RSQU5TUEFSRU5UX0dSRUVOX1ZBTFVFIiwKKyAgICAgICAgICAgICAgICAgICAgIkVHTF9UUkFOU1BBUkVOVF9CTFVFX1ZBTFVFIiwKKyAgICAgICAgICAgICAgICAgICAgIkVHTF9CSU5EX1RPX1RFWFRVUkVfUkdCIiwKKyAgICAgICAgICAgICAgICAgICAgIkVHTF9CSU5EX1RPX1RFWFRVUkVfUkdCQSIsCisgICAgICAgICAgICAgICAgICAgICJFR0xfTUlOX1NXQVBfSU5URVJWQUwiLAorICAgICAgICAgICAgICAgICAgICAiRUdMX01BWF9TV0FQX0lOVEVSVkFMIiwKKyAgICAgICAgICAgICAgICAgICAgIkVHTF9MVU1JTkFOQ0VfU0laRSIsCisgICAgICAgICAgICAgICAgICAgICJFR0xfQUxQSEFfTUFTS19TSVpFIiwKKyAgICAgICAgICAgICAgICAgICAgIkVHTF9DT0xPUl9CVUZGRVJfVFlQRSIsCisgICAgICAgICAgICAgICAgICAgICJFR0xfUkVOREVSQUJMRV9UWVBFIiwKKyAgICAgICAgICAgICAgICAgICAgIkVHTF9DT05GT1JNQU5UIgorICAgICAgICAgICAgfTsKKyAgICAgICAgICAgIGludFtdIHZhbHVlID0gbmV3IGludFsxXTsKKyAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgYXR0cmlidXRlcy5sZW5ndGg7IGkrKykgeworICAgICAgICAgICAgICAgIGludCBhdHRyaWJ1dGUgPSBhdHRyaWJ1dGVzW2ldOworICAgICAgICAgICAgICAgIFN0cmluZyBuYW1lID0gbmFtZXNbaV07CisgICAgICAgICAgICAgICAgaWYgKCBlZ2wuZWdsR2V0Q29uZmlnQXR0cmliKGRpc3BsYXksIGNvbmZpZywgYXR0cmlidXRlLCB2YWx1ZSkpIHsKKyAgICAgICAgICAgICAgICAgICAgTG9nLncoVEFHLCBTdHJpbmcuZm9ybWF0KCIgICVzOiAlZFxuIiwgbmFtZSwgdmFsdWVbMF0pKTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAvLyBMb2cudyhUQUcsIFN0cmluZy5mb3JtYXQoIiAgJXM6IGZhaWxlZFxuIiwgbmFtZSkpOworICAgICAgICAgICAgICAgICAgICB3aGlsZSAoZWdsLmVnbEdldEVycm9yKCkgIT0gRUdMMTAuRUdMX1NVQ0NFU1MpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIC8vIFN1YmNsYXNzZXMgY2FuIGFkanVzdCB0aGVzZSB2YWx1ZXM6CisgICAgICAgIHByb3RlY3RlZCBpbnQgbVJlZFNpemU7CisgICAgICAgIHByb3RlY3RlZCBpbnQgbUdyZWVuU2l6ZTsKKyAgICAgICAgcHJvdGVjdGVkIGludCBtQmx1ZVNpemU7CisgICAgICAgIHByb3RlY3RlZCBpbnQgbUFscGhhU2l6ZTsKKyAgICAgICAgcHJvdGVjdGVkIGludCBtRGVwdGhTaXplOworICAgICAgICBwcm90ZWN0ZWQgaW50IG1TdGVuY2lsU2l6ZTsKKyAgICAgICAgcHJpdmF0ZSBpbnRbXSBtVmFsdWUgPSBuZXcgaW50WzFdOworICAgIH0KKworICAgIHByaXZhdGUgc3RhdGljIGNsYXNzIFJlbmRlcmVyIGltcGxlbWVudHMgR0xTdXJmYWNlVmlldy5SZW5kZXJlciB7CisgICAgICAgIHB1YmxpYyB2b2lkIG9uRHJhd0ZyYW1lKEdMMTAgZ2wpIHsKKyAgICAgICAgICAgIEdMUGVyZkxpYi5zdGVwKCk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCBvblN1cmZhY2VDaGFuZ2VkKEdMMTAgZ2wsIGludCB3aWR0aCwgaW50IGhlaWdodCkgeworICAgICAgICAgICAgR0xQZXJmTGliLmluaXQod2lkdGgsIGhlaWdodCk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCBvblN1cmZhY2VDcmVhdGVkKEdMMTAgZ2wsIEVHTENvbmZpZyBjb25maWcpIHsKKyAgICAgICAgICAgIC8vIERvIG5vdGhpbmc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ICAgICAgaWYgKGggPCAwIHx8IGggPj0gNjU1MzYpIHsKKyAgICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oImgiKTsKKyAgICAgICAgICAgfQorICAgICAgICAgICBpZiAodyAqIGggPj0gNjU1MzYpIHsKKyAgICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oIncgKiBoID49IDY1NTM2Iik7CisgICAgICAgICAgIH0KKworICAgICAgICAgICBtVyA9IHc7CisgICAgICAgICAgIG1IID0gaDsKKyAgICAgICAgICAgaW50IHNpemUgPSB3ICogaDsKKworICAgICAgICAgICBtVmVydGV4Qnl0ZUJ1ZmZlciA9IEJ5dGVCdWZmZXIuYWxsb2NhdGVEaXJlY3QoVkVSVEVYX1NJWkUgKiBzaXplKQorICAgICAgICAgICAgICAgLm9yZGVyKEJ5dGVPcmRlci5uYXRpdmVPcmRlcigpKTsKKyAgICAgICAgICAgbVZlcnRleEJ1ZmZlciA9IG1WZXJ0ZXhCeXRlQnVmZmVyLmFzRmxvYXRCdWZmZXIoKTsKKworICAgICAgICAgICBpbnQgcXVhZFcgPSBtVyAtIDE7CisgICAgICAgICAgIGludCBxdWFkSCA9IG1IIC0gMTsKKyAgICAgICAgICAgaW50IHF1YWRDb3VudCA9IHF1YWRXICogcXVhZEg7CisgICAgICAgICAgIGludCBpbmRleENvdW50ID0gcXVhZENvdW50ICogNjsKKyAgICAgICAgICAgbUluZGV4Q291bnQgPSBpbmRleENvdW50OworICAgICAgICAgICBtSW5kZXhCdWZmZXIgPSBCeXRlQnVmZmVyLmFsbG9jYXRlRGlyZWN0KENIQVJfU0laRSAqIGluZGV4Q291bnQpCisgICAgICAgICAgICAgICAub3JkZXIoQnl0ZU9yZGVyLm5hdGl2ZU9yZGVyKCkpLmFzQ2hhckJ1ZmZlcigpOworCisgICAgICAgICAgIC8qCisgICAgICAgICAgICAqIEluaXRpYWxpemUgdHJpYW5nbGUgbGlzdCBtZXNoLgorICAgICAgICAgICAgKgorICAgICAgICAgICAgKiAgICAgWzBdLS0tLS1bICAxXSAuLi4KKyAgICAgICAgICAgICogICAgICB8ICAgIC8gICB8CisgICAgICAgICAgICAqICAgICAgfCAgIC8gICAgfAorICAgICAgICAgICAgKiAgICAgIHwgIC8gICAgIHwKKyAgICAgICAgICAgICogICAgIFt3XS0tLS0tW3crMV0gLi4uCisgICAgICAgICAgICAqICAgICAgfCAgICAgICB8CisgICAgICAgICAgICAqCisgICAgICAgICAgICAqLworCisgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgIGludCBpID0gMDsKKyAgICAgICAgICAgICAgIGZvciAoaW50IHkgPSAwOyB5IDwgcXVhZEg7IHkrKykgeworICAgICAgICAgICAgICAgICAgIGZvciAoaW50IHggPSAwOyB4IDwgcXVhZFc7IHgrKykgeworICAgICAgICAgICAgICAgICAgICAgICBjaGFyIGEgPSAoY2hhcikgKHkgKiBtVyArIHgpOworICAgICAgICAgICAgICAgICAgICAgICBjaGFyIGIgPSAoY2hhcikgKHkgKiBtVyArIHggKyAxKTsKKyAgICAgICAgICAgICAgICAgICAgICAgY2hhciBjID0gKGNoYXIpICgoeSArIDEpICogbVcgKyB4KTsKKyAgICAgICAgICAgICAgICAgICAgICAgY2hhciBkID0gKGNoYXIpICgoeSArIDEpICogbVcgKyB4ICsgMSk7CisKKyAgICAgICAgICAgICAgICAgICAgICAgbUluZGV4QnVmZmVyLnB1dChpKyssIGEpOworICAgICAgICAgICAgICAgICAgICAgICBtSW5kZXhCdWZmZXIucHV0KGkrKywgYyk7CisgICAgICAgICAgICAgICAgICAgICAgIG1JbmRleEJ1ZmZlci5wdXQoaSsrLCBiKTsKKworICAgICAgICAgICAgICAgICAgICAgICBtSW5kZXhCdWZmZXIucHV0KGkrKywgYik7CisgICAgICAgICAgICAgICAgICAgICAgIG1JbmRleEJ1ZmZlci5wdXQoaSsrLCBjKTsKKyAgICAgICAgICAgICAgICAgICAgICAgbUluZGV4QnVmZmVyLnB1dChpKyssIGQpOworICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgfQorCisgICAgICAgfQorCisgICAgICAgcHVibGljIHZvaWQgc2V0KGludCBpLCBpbnQgaiwgZmxvYXQgeCwgZmxvYXQgeSwgZmxvYXQgeikgeworICAgICAgICAgICBpZiAoaSA8IDAgfHwgaSA+PSBtVykgeworICAgICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigiaSIpOworICAgICAgICAgICB9CisgICAgICAgICAgIGlmIChqIDwgMCB8fCBqID49IG1IKSB7CisgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCJqIik7CisgICAgICAgICAgIH0KKworICAgICAgICAgICBpbnQgaW5kZXggPSBtVyAqIGogKyBpOworCisgICAgICAgICAgIG1WZXJ0ZXhCdWZmZXIucG9zaXRpb24oaW5kZXggKiBWRVJURVhfU0laRSAvIEZMT0FUX1NJWkUpOworICAgICAgICAgICBtVmVydGV4QnVmZmVyLnB1dCh4KTsKKyAgICAgICAgICAgbVZlcnRleEJ1ZmZlci5wdXQoeSk7CisgICAgICAgICAgIG1WZXJ0ZXhCdWZmZXIucHV0KHopOworICAgICAgIH0KKworICAgICAgIHB1YmxpYyB2b2lkIGNyZWF0ZUJ1ZmZlck9iamVjdHMoR0wgZ2wpIHsKKyAgICAgICAgICAgLy8gR2VuZXJhdGUgYSB0aGUgdmVydGV4IGFuZCBlbGVtZW50IGJ1ZmZlciBJRHMKKyAgICAgICAgICAgaW50W10gdmJvSWRzID0gbmV3IGludFsyXTsKKyAgICAgICAgICAgR0wxMSBnbDExID0gKEdMMTEpIGdsOworICAgICAgICAgICBnbDExLmdsR2VuQnVmZmVycygyLCB2Ym9JZHMsIDApOworICAgICAgICAgICBtVmVydGV4QnVmZmVyT2JqZWN0SWQgPSB2Ym9JZHNbMF07Cisg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AgICAgICAgID4KKyAgICAgICAgICAgIDxJbWFnZVZpZXcKKyAgICAgICAgICAgICAgICBjbGFzcz0iY29tLmFuZHJvaWQuc3lzdGVtdWkuc3RhdHVzYmFyLnRhYmxldC5Ob3RpZmljYXRpb25JY29uQXJlYSRNb3JlVmlldyIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmlkPSJAK2lkL2V4cGFuZCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF93aWR0aD0id3JhcF9jb250ZW50IgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X2hlaWdodD0id3JhcF9jb250ZW50IgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6c3JjPSJAZHJhd2FibGUvc3RhdHVzX2Jhcl9leHBhbmQiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpvbkNsaWNrPSJub3RpZmljYXRpb25JY29uc0NsaWNrZWQiCisgICAgICAgICAgICAgICAgLz4KKyAgICAgICAgICAgIDx2aWV3CisgICAgICAgICAgICAgICAgY2xhc3M9ImNvbS5hbmRyb2lkLnN5c3RlbXVpLnN0YXR1c2Jhci50YWJsZXQuTm90aWZpY2F0aW9uSWNvbkFyZWEkSWNvbkxheW91dCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmlkPSJAK2lkL2ljb25zIgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X3dpZHRoPSJ3cmFwX2NvbnRlbnQiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfaGVpZ2h0PSJAKmFuZHJvaWQ6ZGltZW4vc3RhdHVzX2Jhcl9pY29uX3NpemUiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfbWFyZ2luTGVmdD0iOGRpcCIKKyAgICAgICAgICAgICAgICAvPgorICAgICAgICAgICAgPHZpZXcKKyAgICAgICAgICAgICAgICBjbGFzcz0iY29tLmFuZHJvaWQuc3lzdGVtdWkuc3RhdHVzYmFyLnRhYmxldC5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aWQ6bGF5b3V0X3dpZHRoPSJ3cmFwX2NvbnRlbnQiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfaGVpZ2h0PSJtYXRjaF9wYXJlbnQiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfbWFyZ2luUmlnaHQ9IjhkaXAiCisgICAgICAgICAgICAgICAgLz4KKyAgICAgICAgICAgIDxjb20uYW5kcm9pZC5zeXN0ZW11aS5zdGF0dXNiYXIuVGlja2VyVmlldyBhbmRyb2lkOmlkPSJAK2lkL3RpY2tlclRleHQiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfd2lkdGg9IjBkaXAiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfd2VpZ2h0PSIxIgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X2hlaWdodD0id3JhcF9jb250ZW50IgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6cGFkZGluZ1RvcD0iMmRpcCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOnBhZGRpbmdSaWdodD0iMTBkaXAiPgorICAgICAgICAgICAgICAgIDxUZXh0VmlldworICAgICAgICAgICAgICAgICAgICBhbmRyb2lkOnRleHRBcHBlYXJhbmNlPSJAKmFuZHJvaWQ6c3R5bGUvVGV4dEFwcGVhcmFuY2UuU3RhdHVzQmFyLlRpY2tlciIKKyAgICAgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfd2lkdGg9Im1hdGNoX3BhcmVudCIKKyAgICAgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfaGVpZ2h0PSJ3cmFwX2NvbnRlbnQiCisgICAgICAgICAgICAgICAgICAgIGFuZHJvaWQ6c2luZ2xlTGluZT0idHJ1ZSIKKyAgICAgICAgICAgICAgICAgICAgLz4KKyAgICAgICAgICAgICAgICA8VGV4dFZpZXcKKyAgICAgICAgICAgICAgICAgICAgYW5kcm9pZDp0ZXh0QXBwZWF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sb2NrIgorICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfd2lkdGg9IndyYXBfY29udGVudCIKKyAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X2hlaWdodD0id3JhcF9jb250ZW50IgorICAgICAgICAgICAgYW5kcm9pZDpzaW5nbGVMaW5lPSJ0cnVlIgorICAgICAgICAgICAgYW5kcm9pZDp0ZXh0U2l6ZT0iMjBzcCIKKyAgICAgICAgICAgIGFuZHJvaWQ6dGV4dFN0eWxlPSJib2xkIgorICAgICAgICAgICAgYW5kcm9pZDpwYWRkaW5nPSIyZGlwIgorICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfY2VudGVySG9yaXpvbnRhbD0idHJ1ZSIKKyAgICAgICAgICAgIC8+CisKKyAgICAgICAgPFRleHRWaWV3IGFuZHJvaWQ6aWQ9IkAraWQvZGF0ZSIKKyAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X3dpZHRoPSJ3cmFwX2NvbnRlbnQiCisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9oZWlnaHQ9IndyYXBfY29udGVudCIKKyAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X2JlbG93PSJAaWQvY2xvY2siCisgICAgICAgICAgICAvPgorCisgICAgICAgIDxSZWxhdGl2ZUxheW91dAorICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfd2lkdGg9IjEyMGRpcCIKKyAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X2hlaWdodD0id3JhcF9jb250ZW50IgorICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfYWxpZ25QYXJlbnRSaWdodD0idHJ1ZSIKKyAgICAgICAgICAgID4KKyAgICAgICAgICAgIDxJbWFnZVZpZXcgYW5kcm9pZDppZD0iQCtpZC9zaWduYWxfbWV0ZXIiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfd2lkdGg9IndyYXBfY29udGVudCIKKyAgICAgICAgICAgICAgICBhbmRyb2lk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yk7CisKKyAgICAgICAgVHlwZWRBcnJheSBhID0gY29udGV4dC5vYnRhaW5TdHlsZWRBdHRyaWJ1dGVzKGF0dHJzLCBSLnN0eWxlYWJsZS5LZXlCdXR0b25WaWV3LAorICAgICAgICAgICAgICAgIGRlZlN0eWxlLCAwKTsKKworICAgICAgICBtQ29kZSA9IGEuZ2V0SW50ZWdlcihSLnN0eWxlYWJsZS5LZXlCdXR0b25WaWV3X2tleUNvZGUsIDApOworICAgICAgICBpZiAobUNvZGUgPT0gMCkgeworICAgICAgICAgICAgU2xvZy53KFN0YXR1c0JhclNlcnZpY2UuVEFHLCAiS2V5QnV0dG9uVmlldyB3aXRob3V0IGtleSBjb2RlIGlkPTB4IgorICAgICAgICAgICAgICAgICAgICArIEludGVnZXIudG9IZXhTdHJpbmcoZ2V0SWQoKSkpOworICAgICAgICB9CisgICAgICAgIAorICAgICAgICBhLnJlY3ljbGUoKTsKKworICAgICAgICBtV2luZG93TWFuYWdlciA9IElXaW5kb3dNYW5hZ2VyLlN0dWIuYXNJbnRlcmZhY2UoCisgICAgICAgICAgICAgICAgU2VydmljZU1hbmFnZXIuZ2V0U2VydmljZShDb250ZXh0LldJTkRPV19TRVJWSUNFKSk7CisgICAgfQorCisgICAgcHVibGljIGJvb2xlYW4gb25Ub3VjaEV2ZW50KE1vdGlvbkV2ZW50IGV2KSB7CisgICAgICAgIGZpbmFsIGludCBhY3Rpb24gPSBldi5nZXRBY3Rpb24oKTsKKyAgICAgICAgaW50IHgsIHk7CisKKyAgICAgICAgc3dpdGNoIChhY3Rpb24pIHsKKyAgICAgICAgICAgIGNhc2UgTW90aW9uRXZlbnQuQUNUSU9OX0RPV046CisgICAgICAgICAgICAgICAgbURvd25UaW1lID0gU3lzdGVtQ2xvY2sudXB0aW1lTWlsbGlzKCk7CisgICAgICAgICAgICAgICAgbVJlcGVhdCA9IDA7CisgICAgICAgICAgICAgICAgbVNlbmRpbmcgPSB0cnVlOworICAgICAgICAgICAgICAgIHNlbmRFdmVudChLZXlFdmVudC5BQ1RJT05fRE9XTiwKKyAgICAgICAgICAgICAgICAgICAgICAgIEtleUV2ZW50LkZMQUdfRlJPTV9TWVNURU0gfCBLZXlFdmVudC5GTEFHX1NPRlRfS0VZQk9BUkQsIG1Eb3duVGltZSk7CisgICAgICAgICAgICAgICAgc2V0UHJlc3NlZCh0cnVlKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgTW90aW9uRXZlbnQuQUNUSU9OX01PVkU6CisgICAgICAgICAgICAgICAgaWYgKG1TZW5kaW5nKSB7CisgICAgICAgICAgICAgICAgICAgIHggPSAoaW50KWV2LmdldFgoKTsKKyAgICAgICAgICAgICAgICAgICAgeSA9IChpbnQpZXYuZ2V0WSgpOworICAgICAgICAgICAgICAgICAgICBpZiAoeCA8IDAgfHwgeCA+PSBnZXRXaWR0aCgpIHx8IHkgPCAwIHx8IHkgPj0gZ2V0SGVpZ2h0KCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1TZW5kaW5nID0gZmFsc2U7CisgICAgICAgICAgICAgICAgICAgICAgICBzZW5kRXZlbnQoS2V5RXZlbnQuQUNUSU9OX1VQLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBLZXlFdmVudC5GTEFHX0ZST01fU1lTVEVNIHwgS2V5RXZlbnQuRkxBR19TT0ZUX0tFWUJPQVJECisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCBLZXlFdmVudC5GTEFHX0NBTkNFTEVEKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHNldFByZXNzZWQoZmFsc2UpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBNb3Rpb25FdmVudC5BQ1RJT05fVVA6CisgICAgICAgICAgICBjYXNlIE1vdGlvbkV2ZW50LkFDVElPTl9DQU5DRUw6CisgICAgICAgICAgICAgICAgaWYgKG1TZW5kaW5nKSB7CisgICAgICAgICAgICAgICAgICAgIG1TZW5kaW5nID0gZmFsc2U7CisgICAgICAgICAgICAgICAgICAgIHNlbmRFdmVudChLZXlFdmVudC5BQ1RJT05fVVAsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgS2V5RXZlbnQuRkxBR19GUk9NX1NZU1RFTSB8IEtleUV2ZW50LkZMQUdfU09GVF9LRVlCT0FSRCk7CisgICAgICAgICAgICAgICAgICAgIHNldFByZXNzZWQoZmFsc2UpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorCisgICAgICAgIHJldHVybiB0cnVlOworICAgIH0KKworICAgIHZvaWQgc2VuZEV2ZW50KGludCBhY3Rpb24sIGludCBmbGFncykgeworICAgICAgICBzZW5kRXZlbnQoYWN0aW9uLCBmbGFncywgU3lzdGVtQ2xvY2sudXB0aW1lTWlsbGlzKCkpOworICAgIH0KKworICAgIHZvaWQgc2VuZEV2ZW50KGludCBhY3Rpb24sIGludCBmbGFncywgbG9uZyB3aGVuKSB7CisgICAgICAgIGZpbmFsIEtleUV2ZW50IGV2ID0gbmV3IEtleUV2ZW50KG1Eb3duVGltZSwgd2hlbiwgYWN0aW9uLCBtQ29kZSwgbVJlcGVhdCwKKyAgICAgICAgICAgICAgICAwLCAwLCAwLCBmbGFncywgSW5wdXREZXZpY2UuU09VUkNFX0tFWUJPQVJEKTsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIFNsb2cuZChTdGF0dXNCYXJTZXJ2aWNlLlRBRywgImluamVjdGluZyBldmVudCAiICsgZXYpOworICAgICAgICAgICAgbVdpbmRvd01hbmFnZXIuaW5qZWN0SW5wdXRFdmVudE5vV2FpdChldik7CisgICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBleCkgeworICAgICAgICAgICAgLy8gU3lzdGVtIHByb2Nlc3MgaXMgZGVhZAorICAgICAgICB9CisgICAgfQor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pb24gbiwgU3RhdHVzQmFySWNvblZpZXcgaWMpIHsKKyAgICAgICAgICAgIHRoaXMua2V5ID0ga2V5OworICAgICAgICAgICAgdGhpcy5ub3RpZmljYXRpb24gPSBuOworICAgICAgICAgICAgdGhpcy5pY29uID0gaWM7CisgICAgICAgIH0KICAgICB9CiAgICAgcHJpdmF0ZSBmaW5hbCBBcnJheUxpc3Q8RW50cnk+IG1FbnRyaWVzID0gbmV3IEFycmF5TGlzdDxFbnRyeT4oKTsKKyAgICBwcml2YXRlIGZpbmFsIENvbXBhcmF0b3I8RW50cnk+IG1FbnRyeUNtcCA9IG5ldyBDb21wYXJhdG9yPEVudHJ5PigpIHsKKyAgICAgICAgcHVibGljIGludCBjb21wYXJlKEVudHJ5IGEsIEVudHJ5IGIpIHsKKyAgICAgICAgICAgIHJldHVybiAoaW50KShhLm5vdGlmaWNhdGlvbi5ub3RpZmljYXRpb24ud2hlbiAtIGIubm90aWZpY2F0aW9uLm5vdGlmaWNhdGlvbi53aGVuKTsKKyAgICAgICAgfQorICAgIH07CiAKICAgICBwdWJsaWMgaW50IHNpemUoKSB7CiAgICAgICAgIHJldHVybiBtRW50cmllcy5zaXplKCk7CiAgICAgfQogCi0gICAgcHVibGljIEVudHJ5IGdldEVudHJ5QXQoaW50IGluZGV4KSB7Ci0gICAgICAgIHJldHVybiBtRW50cmllcy5nZXQoaW5kZXgpOworICAgIHB1YmxpYyBFbnRyeSBnZXQoaW50IGkpIHsKKyAgICAgICAgcmV0dXJuIG1FbnRyaWVzLmdldChpKTsKICAgICB9CiAKLSAgICBwdWJsaWMgaW50IGZpbmRFbnRyeShJQmluZGVyIGtleSkgewotICAgICAgICBmaW5hbCBpbnQgTiA9IG1FbnRyaWVzLnNpemUoKTsKLSAgICAgICAgZm9yIChpbnQgaT0wOyBpPE47IGkrKykgewotICAgICAgICAgICAgRW50cnkgZW50cnkgPSBtRW50cmllcy5nZXQoaSk7Ci0gICAgICAgICAgICBpZiAoZW50cnkua2V5ID09IGtleSkgewotICAgICAgICAgICAgICAgIHJldHVybiBpOworICAgIHB1YmxpYyBFbnRyeSBmaW5kQnlLZXkoSUJpbmRlciBrZXkpIHsKKyAgICAgICAgZm9yIChFbnRyeSBlIDogbUVudHJpZXMpIHsKKyAgICAgICAgICAgIGlmIChlLmtleSA9PSBrZXkpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgIH0KICAgICAgICAgfQotICAgICAgICByZXR1cm4gLTE7CisgICAgICAgIHJldHVybiBudWxsOworICAgIH0KKworICAgIHB1YmxpYyBpbnQgYWRkKEVudHJ5IGVudHJ5KSB7CisgICAgICAgIGludCBpOworICAgICAgICBpbnQgTiA9IG1FbnRyaWVzLnNpemUoKTsKKyAgICAgICAgZm9yIChpPTA7IGk8TjsgaSsrKSB7CisgICAgICAgICAgICBpZiAobUVudHJ5Q21wLmNvbXBhcmUobUVudHJpZXMuZ2V0KGkpLCBlbnRyeSkgPiAwKSB7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgbUVudHJpZXMuYWRkKGksIGVudHJ5KTsKKyAgICAgICAgcmV0dXJuIGk7CiAgICAgfQogCiAgICAgcHVibGljIGludCBhZGQoSUJpbmRlciBrZXksIFN0YXR1c0Jhck5vdGlmaWNhdGlvbiBub3RpZmljYXRpb24sIFZpZXcgcm93LCBWaWV3IGNvbnRlbnQsCkBAIC02Niw0MiArODgsMjMgQEAKICAgICAgICAgZW50cnkuY29udGVudCA9IGNvbnRlbnQ7CiAgICAgICAgIGVudHJ5LmV4cGFuZGVkID0gZXhwYW5kZWQ7CiAgICAgICAgIGVudHJ5Lmljb24gPSBpY29uOwotICAgICAgICBmaW5hbCBpbnQgaW5kZXggPSBjaG9vc2VJbmRleChub3RpZmljYXRpb24ubm90aWZpY2F0aW9uLndoZW4pOwotICAgICAgICBtRW50cmllcy5hZGQoaW5kZXgsIGVudHJ5KTsKLSAgICAgICAgcmV0dXJuIGluZGV4OworICAgICAgICByZXR1cm4gYWRkKGVudHJ5KTsKICAgICB9CiAKICAgICBwdWJsaWMgRW50cnkgcmVtb3ZlKElCaW5kZXIga2V5KSB7Ci0gICAgICAgIGZpbmFsIGludCBOID0gbUVudHJpZXMuc2l6ZSgpOwotICAgICAgICBmb3IgKGludCBpPTA7IGk8TjsgaSsrKSB7Ci0gICAgICAgICAgICBFbnRyeSBlbnRyeSA9IG1FbnRyaWVzLmdldChpKTsKLSAgICAgICAgICAgIGlmIChlbnRyeS5rZXkgPT0ga2V5KSB7Ci0gICAgICAgICAgICAgICAgbUVudHJpZXMucmVtb3ZlKGkpOwotICAgICAgICAgICAgICAgIHJldHVybiBlbnRyeTsKLSAgICAgICAgICAgIH0KKyAgICAgICAgRW50cnkgZSA9IGZpbmRCeUtleShrZXkpOworICAgICAgICBpZiAoZSAhPSBudWxsKSB7CisgICAgICAgICAgICBtRW50cmllcy5yZW1vdmUoZSk7CiAgICAgICAgIH0KLSAgICAgICAgcmV0dXJuIG51bGw7Ci0gICAgfQotCi0gICAgcHJpdmF0ZSBpbnQgY2hvb3NlSW5kZXgoZmluYWwgbG9uZyB3aGVuKSB7Ci0gICAgICAgIGZpbmFsIGludCBOID0gbUVudHJpZXMuc2l6ZSgpOwotICAgICAgICBmb3IgKGludCBpPTA7IGk8TjsgaSsrKSB7Ci0gICAgICAgICAgICBFbnRyeSBlbnRyeSA9IG1FbnRyaWVzLmdldChpKTsKLSAgICAgICAgICAgIGlmIChlbnRyeS5ub3RpZmljYXRpb24ubm90aWZpY2F0aW9uLndoZW4gPiB3aGVuKSB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIGk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLSAgICAgICAgcmV0dXJuIE47CisgICAgICAgIHJldHVybiBlOwogICAgIH0KIAogICAgIC8qKgogICAgICAqIFJldHVybiB3aGV0aGVyIHRoZXJlIGFyZSBhbnkgdmlzaWJsZSBpdGVtcyAoaS5lLi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SU5UUlVERVJfQUxFUlRfREVDQVlfTVMgPSAxMDAwMDsKKworICAgIFN0YXR1c0JhclBvbGljeSBtSWNvblBvbGljeTsKKworICAgIGludCBtSWNvblNpemU7CisgICAgRGlzcGxheSBtRGlzcGxheTsKKworICAgIFN0YXR1c0JhclZpZXcgbVN0YXR1c0JhclZpZXc7CisgICAgaW50IG1QaXhlbEZvcm1hdDsKKyAgICBIIG1IYW5kbGVyID0gbmV3IEgoKTsKKyAgICBPYmplY3QgbVF1ZXVlTG9jayA9IG5ldyBPYmplY3QoKTsKKworICAgIC8vIGljb25zCisgICAgTGluZWFyTGF5b3V0IG1JY29uczsKKyAgICBJY29uTWVyZ2VyIG1Ob3RpZmljYXRpb25JY29uczsKKyAgICBMaW5lYXJMYXlvdXQgbVN0YXR1c0ljb25zOworCisgICAgLy8gZXhwYW5kZWQgbm90aWZpY2F0aW9ucworICAgIERpYWxvZyBtRXhwYW5kZWREaWFsb2c7CisgICAgRXhwYW5kZWRWaWV3IG1FeHBhbmRlZFZpZXc7CisgICAgV2luZG93TWFuYWdlci5MYXlvdXRQYXJhbXMgbUV4cGFuZGVkUGFyYW1zOworICAgIFNjcm9sbFZpZXcgbVNjcm9sbFZpZXc7CisgICAgVmlldyBtTm90aWZpY2F0aW9uTGluZWFyTGF5b3V0OworICAgIFZpZXcgbUV4cGFuZGVkQ29udGVudHM7CisgICAgLy8gdG9wIGJhcgorICAgIFRleHRWaWV3IG1Ob05vdGlmaWNhdGlvbnNUaXRsZTsKKyAgICBUZXh0VmlldyBtQ2xlYXJCdXR0b247CisgICAgLy8gZHJhZyBiYXIKKyAgICBDbG9zZURyYWdIYW5kbGUgbUNsb3NlVmlldzsKKyAgICAvLyBvbmdvaW5nCisgICAgTm90aWZpY2F0aW9uRGF0YSBtT25nb2luZyA9IG5ldyBOb3RpZmljYXRpb25EYXRhKCk7CisgICAgVGV4dFZpZXcgbU9uZ29pbmdUaXRsZTsKKyAgICBMaW5lYXJMYXlvdXQgbU9uZ29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vcmUKKyAgICBib29sZWFuIG1UcmFja2luZzsKKyAgICBWZWxvY2l0eVRyYWNrZXIgbVZlbG9jaXR5VHJhY2tlcjsKKworICAgIHN0YXRpYyBmaW5hbCBpbnQgQU5JTV9GUkFNRV9EVVJBVElPTiA9ICgxMDAwLzYwKTsKKworICAgIGJvb2xlYW4gbUFuaW1hdGluZzsKKyAgICBsb25nIG1DdXJBbmltYXRpb25UaW1lOworICAgIGZsb2F0IG1EaXNwbGF5SGVpZ2h0OworICAgIGZsb2F0IG1BbmltWTsKKyAgICBmbG9hdCBtQW5pbVZlbDsKKyAgICBmbG9hdCBtQW5pbUFjY2VsOworICAgIGxvbmcgbUFuaW1MYXN0VGltZTsKKyAgICBib29sZWFuIG1BbmltYXRpbmdSZXZlYWwgPSBmYWxzZTsKKyAgICBpbnQgbVZpZXdEZWx0YTsKKyAgICBpbnRbXSBtQWJzUG9zID0gbmV3IGludFsyXTsKKworICAgIC8vIGZvciBkaXNhYmxpbmcgdGhlIHN0YXR1cyBiYXIKKyAgICBpbnQgbURpc2FibGVkID0gMDsKKworICAgIHByaXZhdGUgY2xhc3MgRXhwYW5kZWREaWFsb2cgZXh0ZW5kcyBEaWFsb2cgeworICAgICAgICBFeHBhbmRlZERpYWxvZyhDb250ZXh0IGNvbnRleHQpIHsKKyAgICAgICAgICAgIHN1cGVyKGNvbnRleHQsIGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3R5bGUuVGhlbWVfTGlnaHRfTm9UaXRsZUJhcik7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIGJvb2xlYW4gZGlzcGF0Y2hLZXlFdmVudChLZXlFdmVudCBldmVudCkgeworICAgICAgICAgICAgYm9vbGVhbiBkb3duID0gZXZlbnQuZ2V0QWN0aW9uKCkgPT0gS2V5RXZlbnQuQUNUSU9OX0RPV047CisgICAgICAgICAgICBzd2l0Y2ggKGV2ZW50LmdldEtleUNvZGUoKSkgeworICAgICAgICAgICAgY2FzZSBLZXlFdmVudC5LRVlDT0RFX0JBQ0s6CisgICAgICAgICAgICAgICAgaWYgKCFkb3duKSB7CisgICAgICAgICAgICAgICAgICAgIGFuaW1hdGVDb2xsYXBzZSgpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHJldHVybiBzdXBlci5kaXNwYXRjaEtleUV2ZW50KGV2ZW50KTsKKyAgICAgICAgfQorICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIG9uQ3JlYXRlKCkgeworICAgICAgICBtRGlzcGxheSA9ICgoV2luZG93TWFuYWdlcilnZXRTeXN0ZW1TZXJ2aWNlKENvbnRleHQuV0lORE9XX1NFUlZJQ0UpKS5nZXREZWZhdWx0RGlzcGxheSgpOworCisgICAgICAgIHN1cGVyLm9uQ3JlYXRlKCk7CisKKyAgICAgICAgYWRkSW50cnVkZXJWaWV3KCk7CisKKyAgICAgICAgLy8gTGFzdGx5LCBjYWxsIHRvIHRoZSBpY29uIHBvbGljeSB0byBpbnN0YWxsL3VwZGF0ZSBhbGwgdGhlIGljb25zLgorICAgICAgICBtSWNvblBvbGljeSA9IG5ldyBTdGF0dXNCYXJQb2xpY3kodGhpcyk7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgb25EZXN0cm95KCkgeworICAgICAgICAvLyB3ZSdyZSBuZXZlciBkZXN0cm95ZWQKKyAgICB9CisKKyAgICAvLyA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQorICAgIC8vIENvbnN0cnVjdGluZyB0aGUgdmlldworICAgIC8vID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09CisgICAgcHJvdGVjdGVkIF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IFIubGF5b3V0LnN0YXR1c19iYXJfdHJhY2tpbmcsIG51bGwpOworICAgICAgICBtVHJhY2tpbmdWaWV3Lm1TZXJ2aWNlID0gdGhpczsKKyAgICAgICAgbUNsb3NlVmlldyA9IChDbG9zZURyYWdIYW5kbGUpbVRyYWNraW5nVmlldy5maW5kVmlld0J5SWQoUi5pZC5jbG9zZSk7CisgICAgICAgIG1DbG9zZVZpZXcubVNlcnZpY2UgPSB0aGlzOworCisgICAgICAgIG1FZGdlQm9yZGVyID0gcmVzLmdldERpbWVuc2lvblBpeGVsU2l6ZShSLmRpbWVuLnN0YXR1c19iYXJfZWRnZV9pZ25vcmUpOworCisgICAgICAgIC8vIHRoZSBtb3JlIG5vdGlmaWNhdGlvbnMgaWNvbgorICAgICAgICBTdGF0dXNCYXJJY29uVmlldyBtb3JlVmlldyA9IG5ldyBTdGF0dXNCYXJJY29uVmlldyh0aGlzLCAibW9yZSIpOworICAgICAgICBtb3JlVmlldy5zZXQobmV3IFN0YXR1c0Jhckljb24obnVsbCwgUi5kcmF3YWJsZS5zdGF0X25vdGlmeV9tb3JlLCAwKSk7CisgICAgICAgIG1Ob3RpZmljYXRpb25JY29ucy5hZGRNb3JlVmlldyhtb3JlVmlldywKKyAgICAgICAgICAgICAgICBuZXcgTGluZWFyTGF5b3V0LkxheW91dFBhcmFtcyhtSWNvblNpemUsIG1JY29uU2l6ZSkpOworCisgICAgICAgIC8vIHNldCB0aGUgaW5pdGFsIHZpZXcgdmlzaWJpbGl0eQorICAgICAgICBzZXRBcmVUaGVyZU5vdGlmaWNhdGlvbnMoKTsKKyAgICAgICAgbURhdGVWaWV3LnNldFZpc2liaWxpdHkoVmlldy5JTlZJU0lCTEUpOworCisgICAgICAgIC8vIHJlY2VpdmUgYnJvYWRjYXN0cworICAgICAgICBJbnRlbnRGaWx0ZXIgZmlsdGVyID0gbmV3IEludGVudEZpbHRlcigpOworICAgICAgICBmaWx0ZXIuYWRkQWN0aW9uKEludGVudC5BQ1RJT05f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0NSRUVOCisgICAgICAgICAgICAgICAgICAgIHwgV2luZG93TWFuYWdlci5MYXlvdXRQYXJhbXMuRkxBR19MQVlPVVRfTk9fTElNSVRTCisgICAgICAgICAgICAgICAgICAgIHwgV2luZG93TWFuYWdlci5MYXlvdXRQYXJhbXMuRkxBR19OT1RfVE9VQ0hfTU9EQUwKKyAgICAgICAgICAgICAgICAgICAgfCBXaW5kb3dNYW5hZ2VyLkxheW91dFBhcmFtcy5GTEFHX05PVF9GT0NVU0FCTEUKKyAgICAgICAgICAgICAgICAgICAgfCBXaW5kb3dNYW5hZ2VyLkxheW91dFBhcmFtcy5GTEFHX0FMVF9GT0NVU0FCTEVfSU0sCisgICAgICAgICAgICAgICAgUGl4ZWxGb3JtYXQuVFJBTlNMVUNFTlQpOworICAgICAgICBscC5ncmF2aXR5ID0gR3Jhdml0eS5UT1AgfCBHcmF2aXR5LkZJTExfSE9SSVpPTlRBTDsKKyAgICAgICAgbHAueSArPSBoZWlnaHQgKiAxLjU7IC8vIEZJWE1FCisgICAgICAgIGxwLnNldFRpdGxlKCJJbnRydWRlckFsZXJ0Iik7CisgICAgICAgIGxwLndpbmRvd0FuaW1hdGlvbnMgPSBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0eWxlLkFuaW1hdGlvbl9TdGF0dXNCYXJfSW50cnVkZXJBbGVydDsKKworICAgICAgICBXaW5kb3dNYW5hZ2VySW1wbC5nZXREZWZhdWx0KCkuYWRkVmlldyhtSW50cnVkZXJBbGVydFZpZXcsIGxwKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBhZGRJY29uKFN0cmluZyBzbG90LCBpbnQgaW5kZXgsIGludCB2aWV3SW5kZXgsIFN0YXR1c0Jhckljb24gaWNvbikgeworICAgICAgICBpZiAoU1BFVykgU2xvZy5kKFRBRywgImFkZEljb24gc2xvdD0iICsgc2xvdCArICIgaW5kZXg9IiArIGluZGV4ICsgIiB2aWV3SW5kZXg9IiArIHZpZXdJbmRleAorICAgICAgICAgICAgICAgICsgIiBpY29uPSIgKyBpY29uKTsKKyAgICAgICAgU3RhdHVzQmFySWNvblZpZXcgdmlldyA9IG5ldyBTdGF0dXNCYXJJY29uVmlldyh0aGlzLCBzbG90KTsKKyAgICAgICAgdmlldy5zZXQoaWNvbik7CisgICAgICAgIG1TdGF0dXNJY29ucy5hZGRWaWV3KHZpZXcsIHZpZXdJbmRleCwgbmV3IExpbmVhckxheW91dC5MYXlvdXRQYXJhbXMobUljb25TaXplLCBtSWNvblNpemUpKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCB1cGRhdGVJY29uKFN0cmluZyBzbG90LCBpbnQgaW5kZXgsIGludCB2aWV3SW5kZXgsCisgICAgICAgICAgICBTdGF0dXNCYXJJY29uIG9sZCwgU3RhdHVzQmFySWNvbiBpY29uKSB7CisgICAgICAgIGlmIChTUEVXKSBTbG9nLmQoVEFHLCAidXBkYXRlSWNvbiBzbG90PSIgKyBzbG90ICsgIiBpbmRleD0iICsgaW5kZXggKyAiIHZpZXdJbmRleD0iICsgdmlld0luZGV4CisgICAgICAgICAgICAgICAgKyAiIG9sZD0iICsgb2xkICsgIiBpY29uPSIgKyBpY29uKTsKKyAgICAgICAgU3RhdHVzQmFySWNvblZpZXcgdmlldyA9IChTdGF0dXNCYXJJY29uVmlldyltU3RhdHVzSWNvbnMuZ2V0Q2hpbGRBdCh2aWV3SW5kZXgpOworICAgICAgICB2aWV3LnNldChpY29uKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCByZW1vdmVJY29uKFN0cmluZyBzbG90LCBpbnQgaW5kZXgsIGludCB2aWV3SW5kZXgpIHsKKyAgICAgICAgaWYgKFNQRVcpIFNsb2cuZChUQUcsICJyZW1vdmVJY29uIHNsb3Q9IiArIHNsb3QgKyAiIGluZGV4PSIgKyBpbmRleCArICIgdmlld0luZGV4PSIgKyB2aWV3SW5kZXgpOworICAgICAgICBtU3RhdHVzSWNvbnMucmVtb3ZlVmlld0F0KHZpZXdJ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VydEljb24gPSAoSW1hZ2VWaWV3KSBtSW50cnVkZXJBbGVydFZpZXcuZmluZFZpZXdCeUlkKFIuaWQuYWxlcnRJY29uKTsKKyAgICAgICAgICAgICAgICBUZXh0VmlldyBhbGVydFRleHQgPSAoVGV4dFZpZXcpIG1JbnRydWRlckFsZXJ0Vmlldy5maW5kVmlld0J5SWQoUi5pZC5hbGVydFRleHQpOworICAgICAgICAgICAgICAgIGFsZXJ0SWNvbi5zZXRJbWFnZURyYXdhYmxlKFN0YXR1c0Jhckljb25WaWV3LmdldEljb24oCisgICAgICAgICAgICAgICAgICAgIGFsZXJ0SWNvbi5nZXRDb250ZXh0KCksCisgICAgICAgICAgICAgICAgICAgIGljb25WaWV3LmdldFN0YXR1c0Jhckljb24oKSkpOworICAgICAgICAgICAgICAgIGFsZXJ0VGV4dC5zZXRUZXh0KG5vdGlmaWNhdGlvbi5ub3RpZmljYXRpb24udGlja2VyVGV4dCk7CisKKyAgICAgICAgICAgICAgICBWaWV3IGJ1dHRvbiA9IG1JbnRydWRlckFsZXJ0Vmlldy5maW5kVmlld0J5SWQoUi5pZC5pbnRydWRlcl9hbGVydF9jb250ZW50KTsKKyAgICAgICAgICAgICAgICBidXR0b24uc2V0T25DbGlja0xpc3RlbmVyKAorICAgICAgICAgICAgICAgICAgICBuZXcgTGF1bmNoZXIobm90aWZpY2F0aW9uLm5vdGlmaWNhdGlvbi5jb250ZW50SW50ZW50LAorICAgICAgICAgICAgICAgICAgICAgICAgbm90aWZpY2F0aW9uLnBrZywgbm90aWZpY2F0aW9uLnRhZywgbm90aWZpY2F0aW9uLmlkKSk7CisKKyAgICAgICAgICAgICAgICAvLyAyLiBBbmltYXRlIG1JbnRydWRlckFsZXJ0VmlldyBpbgorICAgICAgICAgICAgICAgIG1IYW5kbGVyLnNlbmRFbXB0eU1lc3NhZ2UoTVNHX1NIT1dfSU5UUlVERVIpOworCisgICAgICAgICAgICAgICAgLy8gMy4gU2V0IGFsYXJtIHRvIGFnZSB0aGUgbm90aWZpY2F0aW9uIG9mZiAoVE9ETykKKyAgICAgICAgICAgICAgICBtSGFuZGxlci5yZW1vdmVNZXNzYWdlcyhNU0dfSElERV9JTlRSVURFUik7CisgICAgICAgICAgICAgICAgbUhhbmRsZXIuc2VuZEVtcHR5TWVzc2FnZURlbGF5ZWQoTVNHX0hJREVfSU5UUlVERVIsIElOVFJVREVSX0FMRVJUX0RFQ0FZX01TKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfSBlbHNlIGlmIChub3RpZmljYXRpb24ubm90aWZpY2F0aW9uLmZ1bGxTY3JlZW5JbnRlbnQgIT0gbnVsbCkgeworICAgICAgICAgICAgLy8gbm90IGltbWVyc2l2ZSAmIGEgZnVsbC1zY3JlZW4gYWxlcnQgc2hvdWxkIGJlIHNob3duCisgICAgICAgICAgICBTbG9nLmQoVEFHLCAiTm90aWZpY2F0aW9uIGhhcyBmdWxsU2NyZWVuSW50ZW50IGFuZCBhY3Rpdml0eSBpcyBub3QgaW1tZXJzaXZlOyIKKyAgICAgICAgICAgICAgICAgICAgKyAiIHNlbmRpbmcgZnVsbFNjcmVlbkludGVudCIpOworICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICBub3RpZmljYXRpb24ubm90aWZpY2F0aW9uLmZ1bGxTY3JlZW5JbnRlbnQuc2VuZCgpOworICAgICAgICAgICAgfSBjYXRjaCAoUGVuZGluZ0ludGVudC5DYW5jZWxlZEV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICB9CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAvLyB1c3VhbCBjYXNlOiBzdGF0dXMgYmFyIHZpc2libGUgJiBub3QgaW1tZXJzaXZlCisKKyAgICAgICAgICAgIC8vIHNob3cgdGhlIHRpY2tlcgorICAgICAgICAgICAgdGljayhub3RpZmljYXRpb24pOworICAgICAgICB9CisKKyAgICAgICAgLy8gUmVjYWxjdWxhdGUgdGhlIHBvc2l0aW9uIG9mIHRoZSBzbGlkaW5nIHdpbmRvd3MgYW5kIHRoZSB0aXRsZXMuCisgICAgICAgIHNldEFyZVRoZXJlTm90aWZpY2F0aW9ucygpOworICAgICAgICB1cGRhdGVFeHBhbmRlZFZpZXdQb3MoRVhQQU5ERURfTEVBVkVfQUxPTkUpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHVwZGF0ZU5vdGlmaWNhdGlvbihJQmluZGVyIGtleSwgU3RhdHVzQmFyTm90aWZpY2F0aW9uIG5vdGlmaWNhdGlvbikgeworICAgICAgICBTbG9nLmQoVEFHLCAidXBkYXRlTm90aWZpY2F0aW9uIGtleT0iICsga2V5ICsgIiBub3RpZmljYXRpb249IiArIG5vdGlmaWNhdGlvbik7CisKKyAgICAgICAgTm90aWZpY2F0aW9uRGF0YSBvbGRMaXN0OworICAgICAgICBOb3RpZmljYXRpb25EYXRhLkVudHJ5IG9sZEVudHJ5ID0gbU9uZ29pbmcuZmluZEJ5S2V5KGtleSk7CisgICAgICAgIGlmIChvbGRFbnRyeSAhPSBudWxsKSB7CisgICAgICAgICAgICBvbGRMaXN0ID0gbU9uZ29pbmc7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBvbGRFbnRyeSA9IG1MYXRlc3QuZmluZEJ5S2V5KGtleSk7CisgICAgICAgICAgICBpZiAob2xkRW50cnkgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgIFNsb2cudyhUQUcsICJ1cGRhdGVOb3RpZmljYXRpb24gZm9yIHVua25vd24ga2V5OiAiICsga2V5KTsKKyAgICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgICAgICB9CisgICAgICAgICAgICBvbGRMaXN0ID0gbUxhdGVzdDsKKyAgICAgICAgfQorICAgICAgICBmaW5hbCBTdGF0dXNCYXJOb3RpZmljYXRpb24gb2xkTm90aWZpY2F0aW9uID0gb2xkRW50cnkubm90aWZpY2F0aW9uOworICAgICAgICBmaW5hbCBSZW1vdGVWaWV3cyBvbGRDb250ZW50VmlldyA9IG9sZE5vdGlmaWNhdGlvbi5ub3RpZmljYXRpb24uY29udGVudFZpZXc7CisKKyAgICAgICAgZmluYWwgUmVtb3RlVmlld3MgY29udGVudFZpZXcgPSBub3RpZmljYXRpb24ubm90aWZpY2F0aW9uLmNvbnRlbnRWaWV3OworCisgICAgICAgIGlmIChmYWxzZSkgeworICAgICAgICAgICAgU2xvZy5kKFRBRywgIm9sZCBub3RpZmljYXRpb246IHdoZW49IiArIG9sZE5vdGlmaWNhdGlvbi5ub3RpZmljYXRpb24ud2hlbgorICAgICAgICAgICAgICAgICAgICArICIgb25nb2luZz0iICsgb2xkTm90aWZpY2F0aW9uLmlzT25nb2luZygpCisgICAgICAgICAgICAgICAgICAgICsgIiBleHBhbmRlZD0iICsgb2xkRW50cnkuZXhwYW5kZWQKKyAgICAgICAgICAgICAgICAgICAgKyAiIGNvbnRlbnRWaWV3PSIgKyBvbGRDb250ZW50Vmlldyk7CisgICAgICAgICAgICBTbG9nLmQoVEFHLCAibmV3IG5vdGlmaWNhdGlvbjogd2hlbj0iICsgbm90aWZpY2F0aW9uLm5vdGlmaWNhdGlvbi53aGVuCisgICAgICAgICAgICAgICAgICAgICsgIiBvbmdvaW5nPSIgKyBvbGROb3RpZmljYXRpb24uaXNPbmdvaW5nKCkKKyAgICAgICAgICAgICAgICAgICAgKyAiIGNvbnRlbnRWaWV3PSIgKyBjb250ZW50Vmlldyk7CisgICAgICAgIH0KKworICAgICAgICAvLyBDYW4gd2UganVzdCByZWFwcGx5IHRoZSBSZW1vdGVWaWV3cyBpbiBwbGFjZT8gIElmIHdoZW4gZGlkbid0IGNoYW5nZSwgdGhlIG9yZGVyCisgICAgICAgIC8vIGRpZG4ndCBjaGFuZ2UuCisgICAgICAgIGlmIChub3RpZmljYXRpb24ubm90aWZpY2F0aW9uLndoZW4gPT0gb2xkTm90aWZpY2F0aW9uLm5vdGlmaWNhdGlvbi53aGVuCisgICAgICAgICAgICAgICAgJiYgbm90aWZpY2F0aW9uLmlzT25nb2luZygpID09IG9sZE5vdGlmaWNhdGlvbi5pc09uZ29pbmcoKQorICAgICAgICAgICAgICAgICYmIG9sZEVudHJ5LmV4cGFuZGVkICE9IG51bGwKKyAgICAgICAgICAgICAgICAmJiBjb250ZW50VmlldyAhPSBudWxsICYmIG9sZENvbnRlbnRWaWV3ICE9IG51bGwKKyAgICAgICAgICAgICAgICAmJiBjb250ZW50Vmlldy5nZXRQYWNrYWdlKCkgIT0gbnVsbAorICAgICAgICAgICAgICAgICYmIG9sZENvbnRlbnRWaWV3LmdldFBhY2thZ2UoKSAhPSBudWxsCisgICAgICAgICAgICAgICAgJiYgb2xkQ29udGVudFZpZXcuZ2V0UGFja2FnZSgpLmVxdWFscyhjb250ZW50Vmlldy5nZXRQYWNrYWdlKCkpCisgICAgICAgICAgICAgICAgJiYgb2xkQ29udGVudFZpZXcuZ2V0TGF5b3V0SWQoKSA9PSBjb250ZW50Vmlldy5nZXRMYXlvdXRJZCgpKSB7CisgICAgICAgICAgICBpZiAoU1BFVykgU2xvZy5kKFRBRywgInJldXNpbmcgbm90aWZpY2F0aW9uIik7CisgICAgICAgICAgICBvbGRFbnRyeS5ub3RpZmljYXRpb24gPSBub3RpZmljYXRpb247CisgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIC8vIFJlYXBwbHkgdGhlIFJlbW90ZVZpZXdzCisgICAgICAgICAgICAgICAgY29udGVudFZpZXcucmVhcHBseSh0aGlzLCBvbGRFbnRyeS5jb250ZW50KTsKKyAgICAgICAgICAgICAgICAvLyB1cGRhdGUgdGhlIGNvbnRlbnRJbnRlbnQKKyAgICAgICAgICAgICAgICBmaW5hbCBQZW5kaW5nSW50ZW50IGNvbnRlbnRJbnRlbnQgPSBub3RpZmljYXRpb24ubm90aWZpY2F0aW9uLmNvbnRlbnRJbnRlbnQ7CisgICAgICAgICAgICAgICAgaWYgKGNvbnRlbnRJbnRlbnQgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICBvbGRFbnRyeS5jb250ZW50LnNldE9uQ2xpY2tMaXN0ZW5lcihuZXcgTGF1bmNoZXIoY29udGVudEludGVudCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbm90aWZpY2F0aW9uLnBrZywgbm90aWZpY2F0aW9uLnRhZywgbm90aWZpY2F0aW9uLmlkKSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIC8vIFVwZGF0ZSB0aGUgaWNvbi4KKyAgICAgICAgICAgICAgICBmaW5hbCBTdGF0dXNCYXJJY29uIGljID0gbmV3IFN0YXR1c0Jhckljb24obm90aWZpY2F0aW9uLnBrZywKKyAgICAgICAgICAgICAgICAgICAgICAgIG5vdGlmaWNhdGlvbi5ub3RpZmljYXRpb24uaWNvbiwgbm90aWZpY2F0aW9uLm5vdGlmaWNhdGlvbi5pY29uTGV2ZWwsCisgICAgICAgICAgICAgICAgICAgICAgICBub3RpZmljYXRpb24ubm90aWZpY2F0aW9uLm51bWJlcik7CisgICAgICAgICAgICAgICAgaWYgKCFvbGRFbnRyeS5pY29uLnNldChpYykpIHsKKyAgICAgICAgICAgICAgICAgICAgaGFuZGxlTm90aWZpY2F0aW9uRXJyb3Ioa2V5LCBub3RpZmljYXRpb24sICJDb3VsZG4ndCB1cGRhdGUgaWNvbjogIiArIGljKTsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhdGNoIChSdW50aW1lRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICAvLyBJdCBmYWlsZWQgdG8gYWRkIGNsZWFubHkuICBMb2csIGFuZCByZW1vdmUgdGhlIHZpZXcgZnJvbSB0aGUgcGFuZWwuCisgICAgICAgICAgICAgICAgU2xvZy53KFRBRywgIkNvdWxkbid0IHJlYXBwbHkgdmlld3MgZm9yIHBhY2thZ2UgIiArIGNvbnRlbnRWaWV3LmdldFBhY2thZ2UoKSwgZSk7CisgICAgICAgICAgICAgICAgcmVtb3ZlTm90aWZpY2F0aW9uVmlld3Moa2V5KTsKKyAgICAgICAgICAgICAgICBhZGROb3RpZmljYXRpb25WaWV3cyhrZXksIG5vdGlmaWNhdGlvbik7CisgICAgICAgICAgICB9CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBpZiAoU1BFVykgU2xvZy5kKFRBRywgIm5vdCByZXVzaW5nIG5vdGlmaWNhdGlvbiIpOworICAgICAgICAgICAgcmVtb3ZlTm90aWZpY2F0aW9uVmlld3Moa2V5KTsKKyAgICAgICAgICAgIGFkZE5vdGlmaWNhdGlvblZpZXdzKGtleSwgbm90aWZpY2F0aW9uKTsKKyAgICAgICAgfQorCisgICAgICAgIC8vIFJlc3RhcnQgdGhlIHRpY2tlciBpZiBpdCdzIHN0aWxsIHJ1bm5pbmcKKyAgICAgICAgdGljayhub3RpZmljYXRpb24pOworCisgICAgICAgIC8vIFJlY2FsY3VsYXRlIHRoZSBwb3NpdGlvbiBvZiB0aGUgc2xpZGluZyB3aW5kb3dzIGFuZCB0aGUgdGl0bGVzLgorICAgICAgICBzZXRBcmVUaGVyZU5vdGlmaWNhdGlvbnMoKTsKKyAgICAgICAgdXBkYXRlRXhwYW5kZWRWaWV3UG9zKEVYUEFOREVEX0xFQVZFX0FMT05FKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCByZW1vdmVOb3RpZmljYXRpb24oSUJpbmRlciBrZXkpIHsKKyAgICAgICAgaWYgKFNQRVcpIFNsb2cuZChUQUcsICJyZW1vdmVOb3RpZmljYXRpb24ga2V5PSIgKyBrZXkpOworICAgICAgICBTdGF0dXNCYXJOb3RpZmljYXRpb24gb2xkID0gcmVtb3ZlTm90aWZpY2F0aW9uVmlld3Moa2V5KTsKKworICAgICAgICBpZiAob2xkICE9IG51bGwpIHsKKyAgICAgICAgICAgIC8vIENhbmNlbCB0aGUgdGlja2VyIGlmIGl0J3Mgc3RpbGwgcnVubmluZworICAgICAgICAgICAgbVRpY2tlci5yZW1vdmVFbnRyeShvbGQpOworCisgICAgICAgICAgICAvLyBSZWNhbGN1bGF0ZSB0aGUgcG9zaXRpb24gb2YgdGhlIHNsaWRpbmcgd2luZG93cyBhbmQgdGhlIHRpdGxlcy4KKyAgICAgICAgICAgIHNldEFyZVRoZXJlTm90aWZpY2F0aW9ucygpOworICAgICAgICAgICAgdXBkYXRlRXhwYW5kZWRWaWV3UG9zKEVYUEFOREVEX0xFQVZFX0FMT05FKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgaW50IGNob29zZUljb25JbmRleChib29sZWFuIGlzT25nb2luZywgaW50IHZpZXdJbmRleCkgeworICAgICAgICBmaW5hbCBpbnQgbGF0ZXN0U2l6ZSA9IG1MYXRlc3Quc2l6ZSgpOworICAgICAgICBpZiAoaXNPbmdvaW5nKSB7CisgICAgICAgICAgICByZXR1cm4gbGF0ZXN0U2l6ZSArIChtT25nb2luZy5zaXplKCkgLSB2aWV3SW5kZXgpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgcmV0dXJuIGxhdGVzdFNpemUgLSB2aWV3SW5kZXg7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBWaWV3W10gbWFrZU5vdGlmaWNhdGlvblZpZXcoU3RhdHVzQmFyTm90aWZpY2F0aW9uIG5vdGlmaWNhdGlvbiwgVmlld0dyb3VwIHBhcmVudCkgeworICAgICAgICBOb3RpZmljYXRpb24gbiA9IG5vdGlmaWNhdGlvbi5ub3RpZmljYXRpb247CisgICAgICAgIFJlbW90ZVZpZXdzIHJlbW90ZVZpZXdzID0gbi5jb250ZW50VmlldzsKKyAgICAgICAgaWYgKHJlbW90ZVZpZXdzID09IG51bGwpIHsKKyAgICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICB9CisKKyAgICAgICAgLy8gY3JlYXRlIHRoZSByb3cgdmlldworICAgICAgICBMYXlvdXRJbmZsYXRlciBpbmZsYXRlciA9IChMYXlvdXRJbmZsYXRlcilnZXRTeXN0ZW1TZXJ2aWNlKENvbnRleHQuTEFZT1VUX0lORkxBVEVSX1NFUlZJQ0UpOworICAgICAgICBWaWV3IHJvdyA9IGluZmxhdGVyLmluZmxhdGUoUi5sYXlvdXQuc3RhdHVzX2Jhcl9sYXRlc3RfZXZlbnQsIHBhcmVudCwgZmFsc2UpOworCisgICAgICAgIC8vIGJpbmQgdGhlIGNsaWNrIGV2ZW50IHRvIHRoZSBjb250ZW50IGFyZWEKKyAgICAgICAgVmlld0dyb3VwIGNvbnRlbnQgPSAoVmlld0dyb3VwKXJvdy5maW5kVmlld0J5SWQoUi5pZC5jb250ZW50KTsKKyAgICAgICAgY29udGVudC5zZXREZXNjZW5kYW50Rm9jdXNhYmlsaXR5KFZpZXdHcm91cC5GT0NVU19CTE9DS19ERVNDRU5EQU5UUyk7CisgICAgICAgIGNvbnRlbnQuc2V0T25Gb2N1c0NoYW5nZUxpc3RlbmVyKG1Gb2N1c0NoYW5nZUxpc3RlbmVyKTsKKyAgICAgICAgUGVuZGluZ0ludGVudCBjb250ZW50SW50ZW50ID0gbi5jb250ZW50SW50ZW50OworICAgICAgICBpZiAoY29udGVudEludGVudCAhPSBudWxsKSB7CisgICAgICAgICAgICBjb250ZW50LnNldE9uQ2xpY2tMaXN0ZW5lcihuZXcgTGF1bmNoZXIoY29udGVudEludGVudCwgbm90aWZpY2F0aW9uLnBrZywKKyAgICAgICAgICAgICAgICAgICAgICAgIG5vdGlmaWNhdGlvbi50YWcsIG5vdGlmaWNhdGlvbi5pZCkpOworICAgICAgICB9CisKKyAgICAgICAgVmlldyBleHBhbmRlZCA9IG51bGw7CisgICAgICAgIEV4Y2VwdGlvbiBleGNlcHRpb24gPSBudWxsOworICAgICAgICB0cnkgeworICAgICAgICAgICAgZXhwYW5kZWQgPSByZW1vdGVWaWV3cy5hcHBseSh0aGlzLCBjb250ZW50KTsKKyAgICAgICAgfQorICAgICAgICBjYXRjaCAoUnVudGltZUV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICBleGNlcHRpb24gPSBlOworICAgICAgICB9CisgICAgICAgIGlmIChleHBhbmRlZCA9PSBudWxsKSB7CisgICAgICAgICAgICBTdHJpbmcgaWRlbnQgPSBub3RpZmljYXRpb24ucGtnICsgIi8weCIgKyBJbnRlZ2VyLnRvSGV4U3RyaW5nKG5vdGlmaWNhdGlvbi5pZCk7CisgICAgICAgICAgICBTbG9nLmUoVEFHLCAiY291bGRuJ3QgaW5mbGF0ZSB2aWV3IGZvciBub3RpZmljYXRpb24gIiArIGlkZW50LCBleGNlcHRpb24pOworICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBjb250ZW50LmFkZFZpZXcoZXhwYW5kZWQpOworICAgICAgICAgICAgcm93LnNldERyYXdpbmdDYWNoZUVuYWJsZWQodHJ1ZSk7CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gbmV3IFZpZXdbXSB7IHJvdywgY29udGVudCwgZXhwYW5kZWQgfTsKKyAgICB9CisKKyAgICBTdGF0dXNCYXJJY29uVmlldyBhZGROb3RpZmljYXRpb25WaWV3cyhJQmluZGVyIGtleSwgU3RhdHVzQmFyTm90aWZpY2F0aW9uIG5vdGlmaWNhdGlvbikgeworICAgICAgICBOb3RpZmljYXRpb25EYXRhIGxpc3Q7CisgICAgICAgIFZpZXdHcm91cCBwYXJlbnQ7CisgICAgICAgIGZpbmFsIGJvb2xlYW4gaXNPbmdvaW5nID0gbm90aWZpY2F0aW9uLmlzT25nb2luZygpOworICAgICAgICBpZiAoaXNPbmdvaW5nKSB7CisgICAgICAgICAgICBsaXN0ID0gbU9uZ29pbmc7CisgICAgICAgICAgICBwYXJlbnQgPSBtT25nb2luZ0l0ZW1zOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgbGlzdCA9IG1MYXRlc3Q7CisgICAgICAgICAgICBwYXJlbnQgPSBtTGF0ZXN0SXRlbXM7CisgICAgICAgIH0KKyAgICAgICAgLy8gQ29uc3RydWN0IHRoZSBleHBhbmRlZCB2aWV3LgorICAgICAgICBmaW5hbCBWaWV3W10gdmlld3MgPSBtYWtlTm90aWZpY2F0aW9uVmlldyhub3RpZmljYXRpb24sIHBhcmVudCk7CisgICAgICAgIGlmICh2aWV3cyA9PSBudWxsKSB7CisgICAgICAgICAgICBoYW5kbGVOb3RpZmljYXRpb25FcnJvcihrZXksIG5vdGlmaWNhdGlvbiwgIkNvdWxkbid0IGV4cGFuZCBSZW1vdGVWaWV3cyBmb3I6ICIKKyAgICAgICAgICAgICAgICAgICAgKyBub3RpZmljYXRpb24pOworICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgIH0KKyAgICAgICAgZmluYWwgVmlldyByb3cgPSB2aWV3c1swXTsKKyAgICAgICAgZmluYWwgVmlldyBjb250ZW50ID0gdmlld3NbMV07CisgICAgICAgIGZpbmFsIFZpZXcgZXhwYW5kZWQgPSB2aWV3c1syXTsKKyAgICAgICAgLy8gQ29uc3RydWN0IHRoZSBpY29uLgorICAgICAgICBmaW5hbCBTdGF0dXNCYXJJY29uVmlldyBpY29uVmlldyA9IG5ldyBTdGF0dXNCYXJJY29uVmlldyh0aGlzLAorICAgICAgICAgICAgICAgIG5vdGlmaWNhdGlvbi5wa2cgKyAiLzB4IiArIEludGVnZXIudG9IZXhTdHJpbmcobm90aWZpY2F0aW9uLmlkKSk7CisgICAgICAgIGZpbmFsIFN0YXR1c0Jhckljb24gaWMgPSBuZXcgU3RhdHVzQmFySWNvbihub3RpZmljYXRpb24ucGtnLCBub3RpZmljYXRpb24ubm90aWZpY2F0aW9uLmljb24sCisgICAgICAgICAgICAgICAgICAgIG5vdGlmaWNhdGlvbi5ub3RpZmljYXRpb24uaWNvbkxldmVsLCBub3RpZmljYXRpb24ubm90aWZpY2F0aW9uLm51bWJlcik7CisgICAgICAgIGlmICghaWNvblZpZXcuc2V0KGljKSkgeworICAgICAgICAgICAgaGFuZGxlTm90aWZpY2F0aW9uRXJyb3Ioa2V5LCBub3RpZmljYXRpb24sICJDb3VsZGluZyBjcmVhdGUgaWNvbjogIiArIGljKTsKKyAgICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICB9CisgICAgICAgIC8vIEFkZCB0aGUgZXhwYW5kZWQgdmlldy4KKyAgICAgICAgZmluYWwgaW50IHZpZXdJbmRleCA9IGxpc3QuYWRkKGtleSwgbm90aWZpY2F0aW9uLCByb3csIGNvbnRlbnQsIGV4cGFuZGVkLCBpY29uVmlldyk7CisgICAgICAgIHBhcmVudC5hZGRWaWV3KHJvdywgdmlld0luZGV4KTsKKyAgICAgICAgLy8gQWRkIHRoZSBpY29uLgorICAgICAgICBmaW5hbCBpbnQgaWNvbkluZGV4ID0gY2hvb3NlSWNvbkluZGV4KGlzT25nb2luZywgdmlld0luZGV4KTsKKyAgICAgICAgbU5vdGlmaWNhdGlvbkljb25zLmFkZFZpZXcoaWNvblZpZXcsIGljb25JbmRleCwKKyAgICAgICAgICAgICAgICBuZXcgTGluZWFyTGF5b3V0LkxheW91dFBhcmFtcyhtSWNvblNpemUsIG1JY29uU2l6ZSkpOworICAgICAgICByZXR1cm4gaWNvblZpZXc7CisgICAgfQorCisgICAgU3RhdHVzQmFyTm90aWZpY2F0aW9uIHJlbW92ZU5vdGlmaWNhdGlvblZpZXdzKElCaW5kZXIga2V5KSB7CisgICAgICAgIE5vdGlmaWNhdGlvbkRhdGEuRW50cnkgZW50cnkgPSBtT25nb2luZy5yZW1vdmUoa2V5KTsKKyAgICAgICAgaWYgKGVudHJ5ID09IG51bGwpIHsKKyAgICAgICAgICAgIGVudHJ5ID0gbUxhdGVzdC5yZW1vdmUoa2V5KTsKKyAgICAgICAgICAgIGlmIChlbnRyeSA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgU2xvZy53KFRBRywgInJlbW92ZU5vdGlmaWNhdGlvbiBmb3IgdW5rbm93biBrZXk6ICIgKyBrZXkpOworICAgICAgICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIC8vIFJlbW92ZSB0aGUgZXhwYW5kZWQgdmlldy4KKyAgICAgICAgKChWaWV3R3JvdXApZW50cnkucm93LmdldFBhcmVudCgpKS5yZW1vdmVWaWV3KGVudHJ5LnJvdyk7CisgICAgICAgIC8vIFJlbW92ZSB0aGUgaWNvbi4KKyAgICAgICAgKChWaWV3R3JvdXApZW50cnkuaWNvbi5nZXRQYXJlbnQoKSkucmVtb3ZlVmlldyhlbnRyeS5pY29uKTsKKworICAgICAgICByZXR1cm4gZW50cnkubm90aWZpY2F0aW9uOworICAgIH0KKworICAgIHByaXZhdGUgdm9pZCBzZXRBcmVUaGVyZU5vdGlmaWNhdGlvbnMoKSB7CisgICAgICAgIGJvb2xlYW4gb25nb2luZyA9IG1PbmdvaW5nLmhhc1Zpc2libGVJdGVtcygpOworICAgICAgICBib29sZWFuIGxhdGVzdCA9IG1MYXRlc3QuaGFzVmlzaWJsZUl0ZW1zKCk7CisKKyAgICAgICAgLy8gKG5vIG9uZ29pbmcgbm90aWZpY2F0aW9ucyBhcmUgY2xlYXJhYmxlKQorICAgICAgICBpZiAobUxhdGVzdC5oYXNDbGVhcmFibGVJdGVtcygpKSB7CisgICAgICAgICAgICBtQ2xlYXJCdXR0b24uc2V0VmlzaWJpbGl0eShWaWV3LlZJU0lCTEUpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgbUNsZWFyQnV0dG9uLnNldFZpc2liaWxpdHkoVmlldy5JTlZJU0lCTEUpOworICAgICAgICB9CisKKyAgICAgICAgbU9uZ29pbmdUaXRsZS5zZXRWaXNpYmlsaXR5KG9uZ29pbmcgPyBWaWV3LlZJU0lCTEUgOiBWaWV3LkdPTkUpOworICAgICAgICBtTGF0ZXN0VGl0bGUuc2V0VmlzaWJpbGl0eShsYXRlc3QgPyBWaWV3LlZJU0lCTEUgOiBWaWV3LkdPTkUpOworCisgICAgICAgIGlmIChvbmdvaW5nIHx8IGxhdGVzdCkgeworICAgICAgICAgICAgbU5vTm90aWZpY2F0aW9uc1RpdGxlLnNldFZpc2liaWxpdHkoVmlldy5HT05FKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIG1Ob05vdGlmaWNhdGlvbnNUaXRsZS5zZXRWaXNpYmlsaXR5KFZpZXcuVklTSUJMRSk7CisgICAgICAgIH0KKyAgICB9CisKKworICAgIC8qKgorICAgICAqIFN0YXRlIGlzIG9uZSBvciBtb3JlIG9mIHRoZSBESVNBQkxFIGNvbnN0YW50cyBmcm9tIFN0YXR1c0Jhck1hbmFnZXIuCisgICAgICovCisgICAgcHVibGljIHZvaWQgZGlzYWJsZShpbnQgc3RhdGUpIHsKKyAgICAgICAgZmluYWwgaW50IG9sZCA9IG1EaXNhYmxlZDsKKyAgICAgICAgZmluYWwgaW50IGRpZmYgPSBzdGF0ZSBeIG9sZDsKKyAgICAgICAgbURpc2FibGVkID0gc3RhdGU7CisKKyAgICAgICAgaWYgKChkaWZmICYgU3RhdHVzQmFyTWFuYWdlci5ESVNBQkxFX0VYUEFORCkgIT0gMCkgeworICAgICAgICAgICAgaWYgKChzdGF0ZSAmIFN0YXR1c0Jhck1hbmFnZXIuRElTQUJMRV9FWFBBTkQpICE9IDApIHsKKyAgICAgICAgICAgICAgICBTbG9nLmQoVEFHLCAiRElTQUJMRV9FWFBBTkQ6IHllcyIpOworICAgICAgICAgICAgICAgIGFuaW1hdGVDb2xsYXBzZSgpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIGlmICgoZGlmZiAmIFN0YXR1c0Jhck1hbmFnZXIuRElTQUJMRV9OT1RJRklDQVRJT05fSUNPTlMpICE9IDApIHsKKyAgICAgICAgICAgIGlmICgoc3RhdGUgJiBTdGF0dXNCYXJNYW5hZ2VyLkRJU0FCTEVfTk9USUZJQ0FUSU9OX0lDT05TKSAhPSAwKSB7CisgICAgICAgICAgICAgICAgU2xvZy5kKFRBRywgIkRJU0FCTEVfTk9USUZJQ0FUSU9OX0lDT05TOiB5ZXMiKTsKKyAgICAgICAgICAgICAgICBpZiAobVRpY2tpbmcpIHsKKyAgICAgICAgICAgICAgICAgICAgbVRpY2tlci5oYWx0KCk7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgc2V0Tm90aWZpY2F0aW9uSWNvblZpc2liaWxpdHkoZmFsc2UsIGNvbS5hbmRyb2lkLmludGVybmFsLlIuYW5pbS5mYWRlX291dCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBTbG9nLmQoVEFHLCAiRElTQUJMRV9OT1RJRklDQVRJT05fSUNPTlM6IG5vIik7CisgICAgICAgICAgICAgICAgaWYgKCFtRXhwYW5kZWRWaXNpYmxlKSB7CisgICAgICAgICAgICAgICAgICAgIHNldE5vdGlmaWNhdGlvbkljb25WaXNpYmlsaXR5KHRydWUsIGNvbS5hbmRyb2lkLmludGVybmFsLlIuYW5pbS5mYWRlX2luKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0gZWxzZSBpZiAoKGRpZmYgJiBTdGF0dXNCYXJNYW5hZ2VyLkRJU0FCTEVfTk9USUZJQ0FUSU9OX1RJQ0tFUikgIT0gMCkgeworICAgICAgICAgICAgaWYgKG1UaWNraW5nICYmIChzdGF0ZSAmIFN0YXR1c0Jhck1hbmFnZXIuRElTQUJMRV9OT1RJRklDQVRJT05fVElDS0VSKSAhPSAwKSB7CisgICAgICAgICAgICAgICAgU2xvZy5kKFRBRywgIkRJU0FCTEVfTk9USUZJQ0FUSU9OX1RJQ0tFUjogeWVzIik7CisgICAgICAgICAgICAgICAgbVRpY2tlci5oYWx0KCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBBbGwgY2hhbmdlcyB0byB0aGUgc3RhdHVzIGJhciBhbmQgbm90aWZpY2F0aW9ucyBmdW5uZWwgdGhyb3VnaCBoZXJlIGFuZCBhcmUgYmF0Y2hlZC4KKyAgICAgKi8KKyAgICBwcml2YXRlIGNsYXNzIEggZXh0ZW5kcyBIYW5kbGVyIHsKKyAgICAgICAgcHVibGljIHZvaWQgaGFuZGxlTWVzc2FnZShNZXNzYWdlIG0pIHsKKyAgICAgICAgICAgIHN3aXRjaCAobS53aGF0KSB7CisgICAgICAgICAgICAgICAgY2FzZSBNU0dfQU5JTUFURToKKyAgICAgICAgICAgICAgICAgICAgZG9BbmltYXRpb24oKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBNU0dfQU5JTUFURV9SRVZFQUw6CisgICAgICAgICAgICAgICAgICAgIGRvUmV2ZWFsQW5pbWF0aW9uKCk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgTVNHX1NIT1dfSU5UUlVERVI6CisgICAgICAgICAgICAgICAgICAgIHNldEludHJ1ZGVyQWxlcnRWaXNpYmlsaXR5KHRydWUpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIE1TR19ISURFX0lOVFJVREVSOgorICAgICAgICAgICAgICAgICAgICBzZXRJbnRydWRlckFsZXJ0VmlzaWJpbGl0eShmYWxzZSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgVmlldy5PbkZvY3VzQ2hhbmdlTGlzdGVuZXIgbUZvY3VzQ2hhbmdlTGlzdGVuZXIgPSBuZXcgVmlldy5PbkZvY3VzQ2hhbmdlTGlzdGVuZXIoKSB7CisgICAgICAgIHB1YmxpYyB2b2lkIG9uRm9jdXNDaGFuZ2UoVmlldyB2LCBib29sZWFuIGhhc0ZvY3VzKSB7CisgICAgICAgICAgICAvLyBCZWNhdXNlICd2JyBpcyBhIFZpZXdHcm91cCwgYWxsIGl0cyBjaGlsZHJlbiB3aWxsIGJlICh1bilzZWxlY3RlZAorICAgICA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mlzaWJpbGl0eSh0cnVlLCBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLmFuaW0uZmFkZV9pbik7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBhbmltYXRlRXhwYW5kKCkgeworICAgICAgICBpZiAoU1BFVykgU2xvZy5kKFRBRywgIkFuaW1hdGUgZXhwYW5kOiBleHBhbmRlZD0iICsgbUV4cGFuZGVkKTsKKyAgICAgICAgaWYgKChtRGlzYWJsZWQgJiBTdGF0dXNCYXJNYW5hZ2VyLkRJU0FCTEVfRVhQQU5EKSAhPSAwKSB7CisgICAgICAgICAgICByZXR1cm4gOworICAgICAgICB9CisgICAgICAgIGlmIChtRXhwYW5kZWQpIHsKKyAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfQorCisgICAgICAgIHByZXBhcmVUcmFja2luZygwLCB0cnVlKTsKKyAgICAgICAgcGVyZm9ybUZsaW5nKDAsIDIwMDAuMGYsIHRydWUpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIGFuaW1hdGVDb2xsYXBzZSgpIHsKKyAgICAgICAgaWYgKFNQRVcpIHsKKyAgICAgICAgICAgIFNsb2cuZChUQUcsICJhbmltYXRlQ29sbGFwc2UoKTogbUV4cGFuZGVkPSIgKyBtRXhwYW5kZWQKKyAgICAgICAgICAgICAgICAgICAgKyAiIG1FeHBhbmRlZFZpc2libGU9IiArIG1FeHBhbmRlZFZpc2libGUKKyAgICAgICAgICAgICAgICAgICAgKyAiIG1FeHBhbmRlZD0iICsgbUV4cGFuZGVkCisgICAgICAgICAgICAgICAgICAgICsgIiBtQW5pbWF0aW5nPSIgKyBtQW5pbWF0aW5nCisgICAgICAgICAgICAgICAgICAgICsgIiBtQW5pbVk9IiArIG1BbmltWQorICAgICAgICAgICAgICAgICAgICArICIgbUFuaW1WZWw9IiArIG1BbmltVmVsKTsKKyAgICAgICAgfQorCisgICAgICAgIGlmICghbUV4cGFuZGVkVmlzaWJsZSkgeworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisKKyAgICAgICAgaW50IHk7CisgICAgICAgIGlmIChtQW5pbWF0aW5nKSB7CisgICAgICAgICAgICB5ID0gKGludCltQW5pbVk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICB5ID0gbURpc3BsYXkuZ2V0SGVpZ2h0KCktMTsKKyAgICAgICAgfQorICAgICAgICAvLyBMZXQgdGhlIGZsaW5nIHRoaW5rIHRoYXQgd2UncmUgb3BlbiBzbyBpdCBnb2VzIGluIHRoZSByaWdodCBkaXJlY3Rpb24KKyAgICAgICAgLy8gYW5kIGRvZXNuJ3QgdHJ5IHRvIHJlLW9wZW4gdGhlIHdpbmRvd3NoYWRlLgorICAgICAgICBtRXhwYW5kZWQgPSB0cnVlOworICAgICAgICBwcmVwYXJlVHJhY2tpbmcoeSwgZmFsc2UpOworICAgICAgICBwZXJmb3JtRmxpbmcoeSwgLTIwMDAuMGYsIHRydWUpOworICAgIH0KKworICAgIHZvaWQgcGVyZm9ybUV4cGFuZCgpIHsKKyAgICAgICAgaWYgKFNQRVcpIFNsb2cuZChUQUcsICJwZXJmb3JtRXhwYW5kOiBtRXhwYW5kZWQ9IiArIG1FeHBhbmRlZCk7CisgICAgICAgIGlmICgobURpc2FibGVkICYgU3RhdHVzQmFyTWFuYWdlci5ESVNBQkxFX0VYUEFORCkgIT0gMCkgeworICAgICAgICAgICAgcmV0dXJuIDsKKyAgICAgICAgfQorICAgICAgICBpZiAobUV4cGFuZGVkKSB7CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKworICAgICAgICBtRXhwYW5kZWQgPSB0cnVlOworICAgICAgICBtYWtlRXhwYW5kZWRWaXNpYmxlKCk7CisgICAgICAgIHVwZGF0ZUV4cGFuZGVkVmlld1BvcyhFWFBBTkRFRF9GVUxMX09QRU4pOworCisgICAgICAgIGlmIChmYWxzZSkgcG9zdFN0YXJ0VHJhY2luZygpOworICAgIH0KKworICAgIHZvaWQgcGVyZm9ybUNvbGxhcHNlKCkgeworICAgICAgICBpZiAoU1BFVykgU2xvZy5kKFRBRywgInBlcmZvcm1Db2xsYXBzZTogbUV4cGFuZGVkPSIgKyBtRXhwYW5kZWQKKyAgICAgICAgICAgICAgICArICIgbUV4cGFuZGVkVmlzaWJsZT0iICsgbUV4cGFuZGVkVmlzaWJsZSk7CisKKyAgICAgICAgaWYgKCFtRXhwYW5kZWRWaXNpYmxlKSB7CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKyAgICAgICAgbUV4cGFuZGVkVmlzaWJsZSA9IGZhbHNlOworICAgICAgICB2aXNpYmlsaXR5Q2hhbmdlZChmYWxzZSk7CisgICAgICAgIG1FeHBhbmRlZFBhcmFtcy5mbGFncyB8PSBXaW5kb3dNYW5hZ2VyLkxheW91dFBhcmFtcy5GTEFHX05PVF9GT0NVU0FCTEU7CisgICAgICAgIG1FeHBhbmRlZFBhcmFtcy5mbGFncyAmPSB+V2luZG93TWFuYWdlci5MYXlvdXRQYXJhbXMuRkxBR19BTFRfRk9DVVNBQkxFX0lNOworICAgICAgICBtRXhwYW5kZWREaWFsb2cuZ2V0V2luZG93KCkuc2V0QXR0cmlidXRlcyhtRXhwYW5kZWRQYXJhbXMpOworICAgICAgICBtVHJhY2tpbmdWaWV3LnNldFZpc2liaWxpdHkoVmlldy5HT05FKTsKKworICAgICAgICBpZiAoKG1EaXNhYmxlZCAmIFN0YXR1c0Jhck1hbmFnZXIuRElTQUJMRV9OT1RJRklDQVRJT05fSUNPTlMpID09IDApIHsKKyAgICAgICAgICAgIHNldE5vdGlmaWNhdGlvbkljb25WaXNpYmlsaXR5KHRydWUsIGNvbS5hbmRyb2lkLmludGVybmFsLlIuYW5pbS5mYWRlX2luKTsKKyAgICAgICAgfQorICAgICAgICBzZXREYXRlVmlld1Zpc2liaWxpdHkoZmFsc2UsIGNvbS5hbmRyb2lkLmludGVybmFsLlIuYW5pbS5mYWRlX291dCk7CisKKyAgICAgICAgaWYgKCFtRXhwYW5kZWQpIHsKKyAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfQorICAgICAgICBtRXhwYW5kZWQgPSBmYWxzZTsKKyAgICB9CisKKyAgICB2b2lkIGRvQW5pbWF0aW9uKCkgeworICAgICAgICBpZiAobUFuaW1hdGluZykgeworICAgICAgICAgICAgaWYgKFNQRVcpIFNsb2cuZChUQUcsICJkb0FuaW1hdGlvbiIpOworICAgICAgICAgICAgaWYgKFNQRVcpIFNsb2cuZChUQUcsICJkb0FuaW1hdGlvbiBiZWZvcmUgbUFuaW1ZPSIgKyBtQW5pbVkpOworICAgICAgICAgICAgaW5jcmVtZW50QW5pbSgpOworICAgICAgICAgICAgaWYgKFNQRVcpIFNsb2cuZChUQUcsICJkb0FuaW1hdGlvbiBhZnRlciAgbUFuaW1ZPSIgKyBtQW5pbVkpOworICAgICAgICAgICAgaWYgKG1BbmltWSA+PSBtRGlzcGxheS5nZXRIZWlnaHQoKS0xKSB7CisgICAgICAgICAgICAgICAgaWYgKFNQRVcpIFNsb2cuZChUQUcsICJBbmltYXRpb24gY29tcGxldGVkIHRvIGV4cGFuZGVkIHN0YXRlLiIpOworICAgICAgICAgICAgICAgIG1BbmltYXRpbmcgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICB1cGRhdGVFeHBhbmRlZFZpZXdQb3MoRVhQQU5ERURfRlVMTF9PUEVOKTsKKyAgICAgICAgICAgICAgICBwZXJmb3JtRXhwYW5kKCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBlbHNlIGlmIChtQW5pbVkgPCBtU3RhdHVzQmFyVmlldy5nZXRIZWlnaHQoKSkgeworICAgICAgICAgICAgICAgIGlmIChTUEVXKSBTbG9nLmQoVEFHLCAiQW5pbWF0aW9uIGNvbXBsZXRlZCB0byBjb2xsYXBzZWQgc3RhdGUuIik7CisgICAgICAgICAgICAgICAgbUFuaW1hdGluZyA9IGZhbHNlOworICAgICAgICAgICAgICAgIHVwZGF0ZUV4cGFuZGVkVmlld1BvcygwKTsKKyAgICAgICAgICAgICAgICBwZXJmb3JtQ29sbGFwc2UoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGVsc2UgeworICAgICAgICAgICAgICAgIHVwZGF0ZUV4cGFuZGVkVmlld1BvcygoaW50KW1BbmltWSk7CisgICAgICAgICAgICAgICAgbUN1ckFuaW1hdGlvblRpbWUgKz0gQU5JTV9GUkFNRV9EVVJBVElPTjsKKyAgICAgICAgICAgICAgICBtSGFuZGxlci5zZW5kTWVzc2FnZUF0VGltZShtSGFuZGxlci5vYnRhaW5NZXNzYWdlKE1TR19BTklNQVRFKSwgbUN1ckFuaW1hdGlvblRpbWUpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgdm9pZCBzdG9wVHJhY2tpbmcoKSB7CisgICAgICAgIG1UcmFja2luZyA9IGZhbHNlOworICAgICAgICBtVmVsb2NpdHlUcmFja2VyLnJlY3ljbGUoKTsKKyAgICAgICAgbVZlbG9jaXR5VHJhY2tlciA9IG51bGw7CisgICAgfQorCisgICAgdm9pZCBpbmNyZW1lbnRBbmltKCkgeworICAgICAgICBsb25nIG5vdyA9IFN5c3RlbUNsb2NrLnVwdGltZU1pbGxpcygpOworICAgICAgICBmbG9hdCB0ID0gKChmbG9hdCkobm93IC0gbUFuaW1MYXN0VGltZSkpIC8gMTAwMDsgICAgICAgICAgICAvLyBtcyAtPiBzCisgICAgICAgIGZpbmFsIGZsb2F0IHkgPSBtQW5pbVk7CisgICAgICAgIGZpbmFsIGZsb2F0IHYgPSBtQW5pbVZlbDsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHB4L3MKKyAgICAgICAgZmluYWwgZmxvYXQgYSA9IG1BbmltQWNjZWw7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gcHgvcy9zCisgICAgICAgIG1BbmltWSA9IHkgKyAodip0KSArICgwLjVmKmEqdCp0KTsgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHB4CisgICAgICAgIG1BbmltVmVsID0gdiArIChhKnQpOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHB4L3MKKyAgICAgICAgbUFuaW1MYXN0VGltZSA9IG5vdzsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gbXMKKyAgICAgICAgLy9TbG9nLmQoVEFHLCAieT0iICsgeSArICIgdj0iICsgdiArICIgYT0iICsgYSArICIgdD0iICsgdCArICIgbUFuaW1ZPSIgKyBtQW5pbVkKKyAgICAgICAgLy8gICAgICAgICsgIiBtQW5pbUFjY2VsPSIgKyBtQW5pbUFjY2VsKTsKKyAgICB9CisKKyAgICB2b2lkIGRvUmV2ZWFsQW5pbWF0aW9uKCkgeworICAgICAgICBmaW5hbCBpbnQgaCA9IG1DbG9zZVZpZXcuZ2V0SGVpZ2h0KCkgKyBtU3RhdHVzQmFyVmlldy5nZXRIZWlnaHQoKTsKKyAgICAgICAgaWYgKG1BbmltYXRpbmdSZXZlYWwgJiYgbUFuaW1hdGluZyAmJiBtQW5pbVkgPCBoKSB7CisgICAgICAgICAgICBpbmNyZW1lbnRBbmltKCk7CisgICAgICAgICAgICBpZiAobUFuaW1ZID49IGgpIHsKKyAgICAgICAgICAgICAgICBtQW5pbVkgPSBoOworICAgICAgICAgICAgICAgIHVwZGF0ZUV4cGFuZGVkVmlld1BvcygoaW50KW1BbmltWSk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIHVwZGF0ZUV4cGFuZGVkVmlld1BvcygoaW50KW1BbmltWSk7CisgICAgICAgICAgICAgICAgbUN1ckFuaW1hdGlvblRpbWUgKz0gQU5JTV9GUkFNRV9EVVJBVElPTjsKKyAgICAgICAgICAgICAgICBtSGFuZGxlci5zZW5kTWVzc2FnZUF0VGltZShtSGFuZGxlci5vYnRhaW5NZXNzYWdlKE1TR19BTklNQVRFX1JFVkVBTCksCisgICAgICAgICAgICAgICAgICAgICAgICBtQ3VyQW5pbWF0aW9uVGltZSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICB2b2lkIHByZXBhcmVUcmFja2luZyhpbnQgeSwgYm9vbGVhbiBvcGVuaW5nKSB7CisgICAgICAgIG1UcmFja2luZyA9IHRydWU7CisgICAgICAgIG1WZWxvY2l0eVRyYWNrZXIgPSBWZWxvY2l0eVRyYWNrZXIub2J0YWluKCk7CisgICAgICAgIGlmIChvcGVuaW5nKSB7CisgICAgICAgICAgICBtQW5pbUFjY2VsID0gMjAwMC4wZjsKKyAgICAgICAgICAgIG1BbmltVmVsID0gMjAwOworICAgICAgICAgICAgbUFuaW1ZID0gbVN0YXR1c0JhclZpZXcuZ2V0SGVpZ2h0KCk7CisgICAgICAgICAgICB1cGRhdGVFeHBhbmRlZFZpZXdQb3MoKGludCltQW5pbVkpOworICAgICAgICAgICAgbUFuaW1hdGluZyA9IHRydWU7CisgICAgICAgICAgICBtQW5pbWF0aW5nUmV2ZWFsID0gdHJ1ZTsKKyAgICAgICAgICAgIG1IYW5kbGVyLnJlbW92ZU1lc3NhZ2VzKE1TR19BTklNQVRFKTsKKyAgICAgICAgICAgIG1IYW5kbGVyLnJlbW92ZU1lc3NhZ2VzKE1TR19BTklNQVRFX1JFVkVBTCk7CisgICAgICAgICAgICBsb25nIG5vdyA9IFN5c3RlbUNsb2NrLnVwdGltZU1pbGxpcygpOworICAgICAgICAgICAgbUFuaW1MYXN0VGltZSA9IG5vdzsKKyAgICAgICAgICAgIG1DdXJBbmltYXRpb25UaW1lID0gbm93ICsgQU5JTV9GUkFNRV9EVVJBVElPTjsKKyAgICAgICAgICAgIG1BbmltYXRpbmcgPSB0cnVlOworICAgICAgICAgICAgbUhhbmRsZXIuc2VuZE1lc3NhZ2VBdFRpbWUobUhhbmRsZXIub2J0YWluTWVzc2FnZShNU0dfQU5JTUFURV9SRVZFQUwpLAorICAgICAgICAgICAgICAgICAgICBtQ3VyQW5pbWF0aW9uVGltZSk7CisgICAgICAgICAgICBtYWtlRXhwYW5kZWRWaXNpYmxlKCk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAvLyBpdCdzIG9wZW4sIGNsb3NlIGl0PworICAgICAgICAgICAgaWYgKG1BbmltYXRpbmcpIHsKKyAgICAgICAgICAgICAgICBtQW5pbWF0aW5nID0gZmFsc2U7CisgICAgICAgICAgICAgICAgbUhhbmRsZXIucmVtb3ZlTWVzc2FnZXMoTVNHX0FOSU1BVEUpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgdXBkYXRlRXhwYW5kZWRWaWV3UG9zKHkgKyBtVmlld0RlbHRhKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHZvaWQgcGVyZm9ybUZsaW5nKGludCB5LCBmbG9hdCB2ZWwsIGJvb2xlYW4gYWx3YXlzKSB7CisgICAgICAgIG1BbmltYXRpbmdSZXZlYWwgPSBmYWxzZTsKKyAgICAgICAgbURpc3BsYXlIZWlnaHQgPSBtRGlzcGxheS5nZXRIZWlnaHQoKTsKKworICAgICAgICBtQW5pbVkgPSB5OworICAgICAgICBtQW5pbVZlbCA9IHZlbDsKKworICAgICAgICAvL1Nsb2cuZChUQUcsICJzdGFydGluZyB3aXRoIG1BbmltWT0iICsgbUFuaW1ZICsgIiBtQW5pbVZlbD0iICsgbUFuaW1WZWwpOworCisgICAgICAgIGlmIChtRXhwYW5kZWQpIHsKKyAgICAgICAgICAgIGlmICghYWx3YXlzICYmICgKKyAgICAgICAgICAgICAgICAgICAgdmVsID4gMjAwLjBmCisgICAgICAgICAgICAgICAgICAgIHx8ICh5ID4gKG1EaXNwbGF5SGVpZ2h0LTI1KSAmJiB2ZWwgPiAtMjAwLjBmKSkpIHsKKyAgICAgICAgICAgICAgICAvLyBXZSBhcmUgZXhwYW5kZWQsIGJ1dCB0aGV5IGRpZG4ndCBtb3ZlIHN1ZmZpY2llbnRseSB0byBjYXVzZQorICAgICAgICAgICAgICAgIC8vIHVzIHRvIHJldHJhY3QuICBBbmltYXRlIGJhY2sgdG8gdGhlIGV4cGFuZGVkIHBvc2l0aW9uLgorICAgICAgICAgICAgICAgIG1BbmltQWNjZWwgPSAyMDAwLjBmOworICAgICAgICAgICAgICAgIGlmICh2ZWwgPCAwKSB7CisgICAgICAgICAgICAgICAgICAgIG1BbmltVmVsID0gMDsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBlbHNlIHsKKyAgICAgICAgICAgICAgICAvLyBXZSBhcmUgZXhwYW5kZWQgYW5kIGFyZSBub3cgZ29pbmcgdG8gYW5pbWF0ZSBhd2F5LgorICAgICAgICAgICAgICAgIG1BbmltQWNjZWwgPSAtMjAwMC4wZjsKKyAgICAgICAgICAgICAgICBpZiAodmVsID4gMCkgeworICAgICAgICAgICAgICAgICAgICBtQW5pbVZlbCA9IDA7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgaWYgKGFsd2F5cyB8fCAoCisgICAgICAgICAgICAgICAgICAgIHZlbCA+IDIwMC4wZgorICAgICAgICAgICAgICAgICAgICB8fCAoeSA+IChtRGlzcGxheUhlaWdodC8yKSAmJiB2ZWwgPiAtMjAwLjBmKSkpIHsKKyAgICAgICAgICAgICAgICAvLyBXZSBhcmUgY29sbGFwc2VkLCBhbmQgdGhleSBtb3ZlZCBlbm91Z2ggdG8gYWxsb3cgdXMgdG8KKyAgICAgICAgICAgICAgICAvLyBleHBhbmQuICBBbmltYXRlIGluIHRoZSBub3RpZmljYXRpb25zLgorICAgICAgICAgICAgICAgIG1BbmltQWNjZWwgPSAyMDAwLjBmOworICAgICAgICAgICAgICAgIGlmICh2ZWwgPCAwKSB7CisgICAgICAgICAgICAgICAgICAgIG1BbmltVmVsID0gMDsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBlbHNlIHsKKyAgICAgICAgICAgICAgICAvLyBXZSBhcmUgY29sbGFwc2VkLCBidXQgdGhleSBkaWRuJ3QgbW92ZSBzdWZmaWNpZW50bHkgdG8gY2F1c2UKKyAgICAgICAgICAgICAgICAvLyB1cyB0byByZXRyYWN0LiAgQW5pbWF0ZSBiYWNrIHRvIHRoZSBjb2xsYXBzZWQgcG9zaXRpb24uCisgICAgICAgICAgICAgICAgbUFuaW1BY2NlbCA9IC0yMDAwLjBmOworICAgICAgICAgICAgICAgIGlmICh2ZWwgPiAwKSB7CisgICAgICAgICAgICAgICAgICAgIG1BbmltVmVsID0gMDsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgLy9TbG9nLmQoVEFHLCAibUFuaW1ZPSIgKyBtQW5pbVkgKyAiIG1BbmltVmVsPSIgKyBtQW5pbVZlbAorICAgICAgICAvLyAgICAgICAgKyAiIG1BbmltQWNjZWw9IiArIG1BbmltQWNjZWwpOworCisgICAgICAgIGxvbmcgbm93ID0gU3lzdGVtQ2xvY2sudXB0aW1lTWlsbGlzKCk7CisgICAgICAgIG1BbmltTGFzdFRpbWUgPSBub3c7CisgICAgICAgIG1DdXJBbmltYXRpb25UaW1lID0gbm93ICsgQU5JTV9GUkFNRV9EVVJBVElPTjsKKyAgICAgICAgbUFuaW1hdGluZyA9IHRydWU7CisgICAgICAgIG1IYW5kbGVyLnJlbW92ZU1lc3NhZ2VzKE1TR19BTklNQVRFKTsKKyAgICAgICAgbUhhbmRsZXIucmVtb3ZlTWVzc2FnZXMoTVNHX0FOSU1BVEVfUkVWRUFMKTsKKyAgICAgICAgbUhhbmRsZXIuc2VuZE1lc3NhZ2VBdFRpbWUobUhhbmRsZXIub2J0YWluTWVzc2FnZShNU0dfQU5JTUFURSksIG1DdXJBbmltYXRpb25UaW1lKTsKKyAgICAgICAgc3RvcFRyYWNraW5nKCk7CisgICAgfQorCisgICAgYm9vbGVhbiBpbnRlcmNlcHRUb3VjaEV2ZW50KE1vdGlvbkV2ZW50IGV2ZW50KSB7CisgICAgICAgIGlmIChTUEVXKSB7CisgICAgICAgICAgICBTbG9nLmQoVEFHLCAiVG91Y2g6IHJhd1k9IiArIGV2ZW50LmdldFJhd1koKSArICIgZXZlbnQ9IiArIGV2ZW50ICsgIiBtRGlzYWJsZWQ9IgorICAgICAgICAgICAgICAgICsgbURpc2FibGVkKTsKKyAgICAgICAgfQorCisgICAgICAgIGlmICgobURpc2FibGVkICYgU3RhdHVzQmFyTWFuYWdlci5ESVNBQkxFX0VYUEFORCkgIT0gMCkgeworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisKKyAgICAgICAgZmluYWwgaW50IHN0YXR1c0JhclNpemUgPSBtU3RhdHVzQmFyVmlldy5nZXRIZWlnaHQoKTsKKyAgICAgICAgZmluYWwgaW50IGhpdFNpemUgPSBzdGF0dXNCYXJTaXplKjI7CisgICAgICAgIGlmIChldmVudC5nZXRBY3Rpb24oKSA9PSBNb3Rpb25FdmVudC5BQ1RJT05fRE9XTikgeworICAgICAgICAgICAgZmluYWwgaW50IHkgPSAoaW50KWV2ZW50LmdldFJhd1koKTsKKworICAgICAgICAgICAgaWYgKCFtRXhwYW5kZWQpIHsKKyAgICAgICAgICAgICAgICBtVmlld0RlbHRhID0gc3RhdHVzQmFyU2l6ZSAtIHk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIG1UcmFja2luZ1ZpZXcuZ2V0TG9jYXRpb25PblNjcmVlbihtQWJzUG9zKTsKKyAgICAgICAgICAgICAgICBtVmlld0RlbHRhID0gbUFic1Bvc1sxXSArIG1UcmFja2luZ1ZpZXcuZ2V0SGVpZ2h0KCkgLSB5OworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKCghbUV4cGFuZGVkICYmIHkgPCBoaXRTaXplKSB8fAorICAgICAgICAgICAgICAgICAgICAobUV4cGFuZGVkICYmIHkgPiAobURpc3BsYXkuZ2V0SGVpZ2h0KCktaGl0U2l6ZSkpKSB7CisKKyAgICAgICAgICAgICAgICAvLyBXZSBkcm9wIGV2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mF3WSgpOworICAgICAgICAgICAgICAgIGlmIChtQW5pbWF0aW5nUmV2ZWFsICYmIHkgPCBtaW5ZKSB7CisgICAgICAgICAgICAgICAgICAgIC8vIG5vdGhpbmcKKyAgICAgICAgICAgICAgICB9IGVsc2UgIHsKKyAgICAgICAgICAgICAgICAgICAgbUFuaW1hdGluZ1JldmVhbCA9IGZhbHNlOworICAgICAgICAgICAgICAgICAgICB1cGRhdGVFeHBhbmRlZFZpZXdQb3MoeSArIG1WaWV3RGVsdGEpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0gZWxzZSBpZiAoZXZlbnQuZ2V0QWN0aW9uKCkgPT0gTW90aW9uRXZlbnQuQUNUSU9OX1VQKSB7CisgICAgICAgICAgICAgICAgbVZlbG9jaXR5VHJhY2tlci5jb21wdXRlQ3VycmVudFZlbG9jaXR5KDEwMDApOworCisgICAgICAgICAgICAgICAgZmxvYXQgeVZlbCA9IG1WZWxvY2l0eVRyYWNrZXIuZ2V0WVZlbG9jaXR5KCk7CisgICAgICAgICAgICAgICAgYm9vbGVhbiBuZWdhdGl2ZSA9IHlWZWwgPCAwOworCisgICAgICAgICAgICAgICAgZmxvYXQgeFZlbCA9IG1WZWxvY2l0eVRyYWNrZXIuZ2V0WFZlbG9jaXR5KCk7CisgICAgICAgICAgICAgICAgaWYgKHhWZWwgPCAwKSB7CisgICAgICAgICAgICAgICAgICAgIHhWZWwgPSAteFZlbDsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaWYgKHhWZWwgPiAxNTAuMGYpIHsKKyAgICAgICAgICAgICAgICAgICAgeFZlbCA9IDE1MC4wZjsgLy8gbGltaXQgaG93IG11Y2ggd2UgY2FyZSBhYm91dCB0aGUgeCBheGlzCisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgZmxvYXQgdmVsID0gKGZsb2F0KU1hdGguaHlwb3QoeVZlbCwgeFZlbCk7CisgICAgICAgICAgICAgICAgaWYgKG5lZ2F0aXZlKSB7CisgICAgICAgICAgICAgICAgICAgIHZlbCA9IC12ZWw7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgcGVyZm9ybUZsaW5nKChpbnQpZXZlbnQuZ2V0UmF3WSgpLCB2ZWwsIGZhbHNlKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICB9CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisKKyAgICBwcml2YXRlIGNsYXNzIExhdW5jaGVyIGltcGxlbWVudHMgVmlldy5PbkNsaWNrTGlzdGVuZXIgeworICAgICAgICBwcml2YXRlIFBlbmRpbmdJbnRlbnQgbUludGVudDsKKyAgICAgICAgcHJpdmF0ZSBTdHJpbmcgbVBrZzsKKyAgICAgICAgcHJpdmF0ZSBTdHJpbmcgbVRhZzsKKyAgICAgICAgcHJpdmF0ZSBpbnQgbUlkOworCisgICAgICAgIExhdW5jaGVyKFBlbmRpbmdJbnRlbnQgaW50ZW50LCBTdHJpbmcgcGtnLCBTdHJpbmcgdGFnLCBpbnQgaWQpIHsKKyAgICAgICAgICAgIG1JbnRlbnQgPSBpbnRlbnQ7CisgICAgICAgICAgICBtUGtnID0gcGtnOworICAgICAgICAgICAgbVRhZyA9IHRhZzsKKyAgICAgICAgICAgIG1JZCA9IGlkOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgb25DbGljayhWaWV3IHYpIHsKKyAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgLy8gVGhlIGludGVudCB3ZSBhcmUgc2VuZGluZyBpcyBmb3IgdGhlIGFwcGxpY2F0aW9uLCB3aGljaAorICAgICAgICAgICAgICAgIC8vIHdvbid0IGhhdmUgcGVybWlzc2lvbiB0byBpbW1lZGlhdGVseSBzdGFydCBhbiBhY3Rpdml0eSBhZnRlcgorICAgICAgICAgICAgICAgIC8vIHRoZSB1c2VyIHN3aXRjaGVzIHRvIGhvbWUuICBXZSBrbm93IGl0IGlzIHNhZmUgdG8gZG8gYXQgdGhpcworICAgICAgICAgICAgICAgIC8vIHBvaW50LCBzbyBtYWtlIHN1cmUgbmV3IGFjdGl2aXR5IHN3aXRjaGVzIGFyZSBub3cgYWxsb3dlZC4KKyAgICAgICAgICAgICAgICBBY3Rpdml0eU1hbmFnZXJOYXRpdmUuZ2V0RGVmYXVsdCgpLnJlc3VtZUFwcFN3aXRjaGVzKCk7CisgICAgICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpZiAobUludGVudCAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgaW50W10gcG9zID0gbmV3IGludFsyXTsKKyAgICAgICAgICAgICAgICB2LmdldExvY2F0aW9uT25TY3JlZW4ocG9zKTsKKyAgICAgICAgICAgICAgICBJbnRlbnQgb3ZlcmxheSA9IG5ldyBJbnRlbnQoKTsKKyAgICAgICAgICAgICAgICBvdmVybGF5LnNldFNvdXJjZUJvdW5kcygKKyAgICAgICAgICAgICAgICAgICAgICAgIG5ldyBSZWN0KHBvc1swXSwgcG9zWzFdLCBwb3NbMF0rdi5nZXRXaWR0aCgpLCBwb3NbMV0rdi5nZXRIZWlnaHQoKSkpOworICAgICAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgICAgIG1JbnRlbnQuc2VuZChQaG9uZVN0YXR1c0JhclNlcnZpY2UudGhpcywgMCwgb3ZlcmxheSk7CisgICAgICAgICAgICAgICAgfSBjYXRjaCAoUGVuZGluZ0ludGVudC5DYW5jZWxlZEV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgICAgIC8vIHRoZSBzdGFjayB0cmFjZSBpc24ndCB2ZXJ5IGhlbHBmdWwgaGVyZS4gIEp1c3QgbG9nIHRoZSBleGNlcHRpb24gbWVzc2FnZS4KKyAgICAgICAgICAgICAgICAgICAgU2xvZy53KFRBRywgIlNlbmRpbmcgY29udGVudEludGVudCBmYWlsZWQ6ICIgKyBlKTsKKyAgICAgIC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iBtU3RhdHVzQmFyVmlldy5nZXRXaW5kb3dUb2tlbigpICE9IG51bGwpIHsKKyAgICAgICAgICAgIGlmICgwID09IChtRGlzYWJsZWQgJiAoU3RhdHVzQmFyTWFuYWdlci5ESVNBQkxFX05PVElGSUNBVElPTl9JQ09OUworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgU3RhdHVzQmFyTWFuYWdlci5ESVNBQkxFX05PVElGSUNBVElPTl9USUNLRVIpKSkgeworICAgICAgICAgICAgICAgIG1UaWNrZXIuYWRkRW50cnkobik7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBDYW5jZWwgdGhpcyBub3RpZmljYXRpb24gYW5kIHRlbGwgdGhlIFN0YXR1c0Jhck1hbmFnZXJTZXJ2aWNlIC8gTm90aWZpY2F0aW9uTWFuYWdlclNlcnZpY2UKKyAgICAgKiBhYm91dCB0aGUgZmFpbHVyZS4KKyAgICAgKgorICAgICAqIFdBUk5JTkc6IHRoaXMgd2lsbCBjYWxsIGJhY2sgaW50byB1cy4gIERvbid0IGhvbGQgYW55IGxvY2tzLgorICAgICAqLworICAgIHZvaWQgaGFuZGxlTm90aWZpY2F0aW9uRXJyb3IoSUJpbmRlciBrZXksIFN0YXR1c0Jhck5vdGlmaWNhdGlvbiBuLCBTdHJpbmcgbWVzc2FnZSkgeworICAgICAgICByZW1vdmVOb3RpZmljYXRpb24oa2V5KTsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIG1CYXJTZXJ2aWNlLm9uTm90aWZpY2F0aW9uRXJyb3Iobi5wa2csIG4udGFnLCBuLmlkLCBuLnVpZCwgbi5pbml0aWFsUGlkLCBtZXNzYWdlKTsKKyAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGV4KSB7CisgICAgICAgICAgICAvLyBUaGUgZW5kIGlzIG5pZ2guCisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcml2YXRlIGNsYXNzIE15VGlja2VyIGV4dGVuZHMgVGlja2VyIHsKKyAgICAgICAgTXlUaWNrZXIoQ29udGV4dCBjb250ZXh0LCBWaWV3IHNiKSB7CisgICAgICAgICAgICBzdXBlcihjb250ZXh0LCBzYik7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIHZvaWQgdGlja2VyU3RhcnRpbmcoKSB7CisgICAgICAgICAgICBtVGlja2luZyA9IHRydWU7CisgICAgICAgICAgICBtSWNvbnMuc2V0VmlzaWJpbGl0eShWaWV3LkdPTkUpOworICAgICAgICAgICAgbVRpY2tlclZpZXcuc2V0VmlzaWJpbGl0eShWaWV3LlZJU0lCTEUpOworICAgICAgICAgICAgbVRpY2tlclZpZXcuc3RhcnRBbmltYXRpb24obG9hZEFuaW0oY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5hbmltLnB1c2hfdXBfaW4sIG51bGwpKTsKKyAgICAgICAgICAgIG1JY29ucy5zdGFydEFuaW1hdGlvbihsb2FkQW5pbShjb20uYW5kcm9pZC5pbnRlcm5hbC5SLmFuaW0ucHVzaF91cF9vdXQsIG51bGwpKTsKKyAgICAgICAgICAgIGlmIChtRXhwYW5kZWRWaXNpYmxlKSB7CisgICAgICAgICAgICAgICAgc2V0RGF0ZVZpZXdWaXNpYmlsaXR5KGZhbHNlLCBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLmFuaW0ucHVzaF91cF9vdXQpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyB2b2lkIHRpY2tlckRvbmUoKSB7CisgICAgICAgICAgICBtSWNvbnMuc2V0VmlzaWJpbGl0eShWaWV3LlZJU0lCTEUpOworICAgICAgICAgICAgbVRpY2tlclZpZXcuc2V0VmlzaWJpbGl0eShWaWV3LkdPTkUpOworICAgICAgICAgICAgbUljb25zLnN0YXJ0QW5pbWF0aW9uKGxvYWRBbmltKGNvbS5hbmRyb2lkLmludGVybmFsLlIuYW5pbS5wdXNoX2Rvd25faW4sIG51bGwpKTsKKyAgICAgICAgICAgIG1UaWNrZXJWaWV3LnN0YXJ0QW5pbWF0aW9uKGxvYWRBbmltKGNvbS5hbmRyb2lkLmludGVybmFsLlIuYW5pbS5wdXNoX2Rvd25fb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgbVRpY2tpbmdEb25lTGlzdGVuZXIpKTsKKyAgICAgICAgICAgIGlmIChtRXhwYW5kZWRWaXNpYmxlKSB7CisgICAgICAgICAgICAgICAgc2V0RGF0ZVZpZXdWaXNpYmlsaXR5KHRydWUsIGNvbS5hbmRyb2lkLmludGVybmFsLlIuYW5pbS5wdXNoX2Rvd25faW4pOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgdGlja2VySGFsdGluZygpIHsKKyAgICAgICAgICAgIG1JY29ucy5zZXRWaXNpYmlsaXR5KFZpZXcuVklTSUJMRSk7CisgICAgICAgICAgICBtVGlja2VyVmlldy5zZXRWaXNpYmlsaXR5KFZpZXcuR09ORSk7CisgICAgICAgICAgICBtSWNvbnMuc3RhcnRBbmltYXRpb24obG9hZEFuaW0oY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5hbmltLmZhZGVfaW4sIG51bGwpKTsKKyAgICAgICAgICAgIG1UaWNrZXJWaWV3LnN0YXJ0QW5pbWF0aW9uKGxvYWRBbmltKGNvbS5hbmRyb2lkLmludGVybmFsLlIuYW5pbS5mYWRlX291dCwKKyAgICAgICAgICAgICAgICAgICAgICAgIG1UaWNraW5nRG9uZUxpc3RlbmVyKSk7CisgICAgICAgICAgICBpZiAobUV4cGFuZGVkVmlzaWJsZSkgeworICAgICAgICAgICAgICAgIHNldERhdGVWaWV3VmlzaWJpbGl0eSh0cnVlLCBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLmFuaW0uZmFkZV9pbik7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICBBbmltYXRpb24uQW5pbWF0aW9uTGlzdGVuZXIgbVRpY2tpbmdEb25lTGlzdGVuZXIgPSBuZXcgQW5pbWF0aW9uLkFuaW1hdGlvbkxpc3RlbmVyKCkgezsKKyAgICAgICAgcHVibGljIHZvaWQgb25BbmltYXRpb25FbmQoQW5pbWF0aW9uIGFuaW1hdGlvbikgeworICAgICAgICAgICAgbVRpY2tpbmcgPSBmYWxzZTsKKyAgICAgICAgfQorICAgICAgICBwdWJsaWMgdm9pZCBvbkFuaW1hdGlvblJlcGVhdChBbmltYXRpb24gYW5pbWF0aW9uKSB7CisgICAgICAgIH0KKyAgICAgICAgcHVibGljIHZvaWQgb25BbmltYXRpb25TdGFydChBbmltYXRpb24gYW5pbWF0aW9uKSB7CisgICAgICAgIH0KKyAgICB9OworCisgICAgcHJpdmF0ZSBBbmltYXRpb24gbG9hZEFuaW0oaW50IGlkLCBBbmltYXRpb24uQW5pbWF0aW9uTGlzdGVuZXIgbGlzdGVuZXIpIHsKKyAgICAgICAgQW5pbWF0aW9uIGFuaW0gPSBBbmltYXRpb25VdGlscy5sb2FkQW5pbWF0aW9uKFBob25lU3RhdHVzQmFyU2VydmljZS50aGlzLCBpZCk7CisgICAgICAgIGlmIChsaXN0ZW5lciAhPSBudWxsKSB7CisgICAgICAgICAgICBhbmltLnNldEFuaW1hdGlvbkxpc3RlbmVyKGxpc3RlbmVyKTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gYW5pbTsKKyAgICB9CisKKyAgICBwdWJsaWMgU3RyaW5nIHZpZXdJbmZvKFZpZXcgdikgeworICAgICAgICByZXR1cm4gIigiICsgdi5nZXRMZWZ0KCkgKyAiLCIgKyB2LmdldFRvcCgpICsgIikoIiArIHYuZ2V0UmlnaHQoKSArICIsIiArIHYuZ2V0Qm90dG9tKCkKKyAgICAgICAgICAgICAgICArICIgIiArIHYuZ2V0V2lkdGgoKSArICJ4IiArIHYuZ2V0SGVpZ2h0KCkgKyAiKSI7CisgICAgfQorCisgICAgcHJvdGVjdGVkIHZvaWQgZHVtcChGaWxlRGVzY3JpcHRvciBmZCwgUHJpbnRXcml0ZXIgcHcsIFN0cmluZ1tdIGFyZ3MpIHsKKyAgICAgICAgaWYgKGNoZWNrQ2FsbGluZ09yU2VsZlBlcm1pc3Npb24oYW5kcm9pZC5NYW5pZmVzdC5wZXJtaXNzaW9uLkRVTVApCisgICAgICAgICAgICAgICAgIT0gUGFja2FnZU1hbmFnZXIuUEVSTUlTU0lPTl9HUkFOVEVEKSB7CisgICAgICAgICAgICBwdy5wcmludGxuKCJQZXJtaXNzaW9uIERlbmlhbDogY2FuJ3QgZHVtcCBTdGF0dXNCYXIgZnJvbSBmcm9tIHBpZD0iCisgICAgICAgICAgICAgICAgICAgICsgQmluZGVyLmdldENhbGxpbmdQaWQoKQorICAgICAgICAgICAgICAgICAgICArICIsIHVpZD0iICsgQmluZGVyLmdldENhbGxpbmdVaWQoKSk7CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKworICAgICAgICBzeW5jaHJvbml6ZWQgKG1RdWV1ZUxvY2spIHsKKyAgICAgICAgICAgIHB3LnByaW50bG4oIkN1cnJlbnQgU3RhdHVzIEJhciBzdGF0ZToiKTsKKyAgICAgICAgICAgIHB3LnByaW50bG4oIiAgbUV4cGFuZGVkPSIgKyBtRXhwYW5kZWQKKyAgICAgICAgICAgICAgICAgICAgKyAiLCBtRXhwYW5kZWRWaXNpYmxlPSIgKyBtRXhwYW5kZWRWaXNpYmxlKTsKKyAgICAgICAgICAgIHB3LnByaW50bG4oIiAgbVRpY2tpbmc9IiArIG1UaWNraW5nKTsKKyAgICAgICAgICAgIHB3LnByaW50bG4oIiAgbVRyYWNraW5nPSIgKyBtVHJhY2tpbmcpOworICAgICAgICAgICAgcHcucHJpbnRsbigiICBtQW5pbWF0aW5nPSIgKyBtQW5pbWF0aW5nCisgICAgICAgICAgICAgICAgICAgICsgIiwgbUFuaW1ZPSIgKyBtQW5pbVkgKyAiLCBtQW5pbVZlbD0iIC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0bGUpKTsKKyAgICAgICAgICAgIHB3LnByaW50bG4oIiAgbU9uZ29pbmdJdGVtczogIiArIHZpZXdJbmZvKG1PbmdvaW5nSXRlbXMpKTsKKyAgICAgICAgICAgIHB3LnByaW50bG4oIiAgbUxhdGVzdFRpdGxlOiAiICsgdmlld0luZm8obUxhdGVzdFRpdGxlKSk7CisgICAgICAgICAgICBwdy5wcmludGxuKCIgIG1MYXRlc3RJdGVtczogIiArIHZpZXdJbmZvKG1MYXRlc3RJdGVtcykpOworICAgICAgICAgICAgcHcucHJpbnRsbigiICBtTm9Ob3RpZmljYXRpb25zVGl0bGU6ICIgKyB2aWV3SW5mbyhtTm9Ob3RpZmljYXRpb25zVGl0bGUpKTsKKyAgICAgICAgICAgIHB3LnByaW50bG4oIiAgbUNsb3NlVmlldzogIiArIHZpZXdJbmZvKG1DbG9zZVZpZXcpKTsKKyAgICAgICAgICAgIHB3LnByaW50bG4oIiAgbVRpY2tlclZpZXc6ICIgKyB2aWV3SW5mbyhtVGlja2VyVmlldykpOworICAgICAgICAgICAgcHcucHJpbnRsbigiICBtU2Nyb2xsVmlldzogIiArIHZpZXdJbmZvKG1TY3JvbGxWaWV3KQorICAgICAgICAgICAgICAgICAgICArICIgc2Nyb2xsICIgKyBtU2Nyb2xsVmlldy5nZXRTY3JvbGxYKCkgKyAiLCIgKyBtU2Nyb2xsVmlldy5nZXRTY3JvbGxZKCkpOworICAgICAgICAgICAgcHcucHJpbnRsbigibU5vdGlmaWNhdGlvbkxpbmVhckxheW91dDogIiArIHZpZXdJbmZvKG1Ob3RpZmljYXRpb25MaW5lYXJMYXlvdXQpKTsKKyAgICAgICAgfQorICAgICAgICAvKgorICAgICAgICBzeW5jaHJvbml6ZWQgKG1Ob3RpZmljYXRpb25EYXRhKSB7CisgICAgICAgICAgICBpbnQgTiA9IG1Ob3RpZmljYXRpb25EYXRhLm9uZ29pbmdDb3VudCgpOworICAgICAgICAgICAgcHcucHJpbnRsbigiICBvbmdvaW5nQ291bnQuc2l6ZT0iICsgTik7CisgICAgICAgICAgICBmb3IgKGludCBpPTA7IGk8TjsgaSsrKSB7CisgICAgICAgICAgICAgICAgU3RhdHVzQmFyTm90aWZpY2F0aW9uIG4gPSBtTm90aWZpY2F0aW9uRGF0YS5nZXRPbmdvaW5nKGkpOworICAgICAgICAgICAgICAgIHB3LnByaW50bG4oIiAgICBbIiArIGkgKyAiXSBrZXk9IiArIG4ua2V5ICsgIiB2aWV3PSIgKyBuLnZpZXcpOworICAgICAgICAgICAgICAgIHB3LnByaW50bG4oIiAgICAgICAgICAgZGF0YT0iICsgbi5kYXRhKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIE4gPSBtTm90aWZpY2F0aW9uRGF0YS5sYXRlc3RDb3VudCgpOworICAgICAgICAgICAgcHcucHJpbnRsbigiICBvbmdvaW5nQ291bnQuc2l6ZT0iICsgTik7CisgICAgICAgICAgICBmb3IgKGludCBpPTA7IGk8TjsgaSsrKSB7CisgICAgICAgICAgICAgICAgU3RhdHVzQmFyTm90aWZpY2F0aW9uIG4gPSBtTm90aWZpY2F0aW9uRGF0YS5nZXRMYXRlc3QoaSk7CisgICAgICAgICAgICAgICAgcHcucHJpbnRsbigiICAgIFsiICsgaSArICJdIGtleT0iICsgbi5rZXkgKyAiIHZpZXc9IiArIG4udmlldyk7CisgICAgICAgICAgICAgICAgcHcucHJpbnRsbigiICAgICAgICAgICBkYXRhPSIgKyBuLmRhdGEpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgICovCisKKyAgICAgICAgaWYgKGZhbHNlKSB7CisgICAgICAgICAgICBwdy5wcmludGxuKCJzZWUgdGhlIGxvZ2NhdCBmb3IgYSBkdW1wIG9mIHRoZSB2aWV3cyB3ZSBoYXZlIGNyZWF0ZWQuIik7CisgICAgICAgICAgICAvLyBtdXN0IGhhcHBlbiBvbiB1aSB0aHJlYWQKKyAgICAgICAgICAgIG1IYW5kbGVyLnBvc3QobmV3IFJ1bm5hYmxlKCkgeworICAgICAgICAgICAgICAgICAgICBwdWJsaWMgdm9pZCBydW4oKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBtU3RhdHVzQmFyVmlldy5nZXRMb2NhdGlvbk9uU2NyZWVuKG1BYnNQb3MpOworICAgICAgICAgICAgICAgICAgICAgICAgU2xvZy5kKFRBRywgIm1TdGF0dXNCYXJWaWV3OiAtLS0tLSAoIiArIG1BYnNQb3NbMF0gKyAiLCIgKyBtQWJzUG9zWzFdCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgIikgIiArIG1TdGF0dXNCYXJWaWV3LmdldFdpZHRoKCkgKyAieCIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyBtU3RhdHVzQmFyVmlldy5nZXRIZWlnaHQoKSk7CisgICAgICAgICAgICAgICAgICAgICAgICBtU3RhdHVzQmFyVmlldy5kZWJ1ZygpOworCisgICAgICAgICAgICAgICAgICAgICAgICBtRXhwYW5kZWRWaWV3LmdldExvY2F0aW9uT25TY3JlZW4obUFic1Bvcyk7CisgICAgICAgICAgICAgICAgICAgICAgICBTbG9nLmQoVEFHLCAibUV4cGFuZGVkVmlldzogLS0tLS0gKCIgKyBtQWJzUG9zWzBdICsgIiwiICsgbUFic1Bvc1sxXQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArICIpICIgKyBtRXhwYW5kZWRWaWV3LmdldFdpZHRoKCkgKyAieCIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyBtRXhwYW5kZWRWaWV3LmdldEhlaWdodCgpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1FeHBhbmRlZFZpZXcuZGVidWcoKTsKKworICAgICAgICAgICAgICAgICAgICAgICAgbVRyYWNraW5nVmlldy5nZXRMb2NhdGlvbk9uU2NyZWVuKG1BYnNQb3MpOworICAgICAgICAgICAgICAgICAgICAgICAgU2xvZy5kKFRBRywgIm1UcmFja2luZ1ZpZXc6IC0tLS0tICgiICsgbUFic1Bvc1swXSArICIsIiArIG1BYnNQb3NbMV0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyAiKSAiICsgbVRyYWNraW5nVmlldy5nZXRXaWR0aCgpICsgIngiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgbVRyYWNraW5nVmlldy5nZXRIZWlnaHQoKSk7CisgICAgICAgICAgICAgICAgICAgICAgICBtVHJhY2tpbmdWaWV3LmRlYnVnKCk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9KTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHZvaWQgb25CYXJWaWV3QXR0YWNoZWQoKSB7CisgICAgICAgIFdpbmRvd01hbmFnZXIuTGF5b3V0UGFyYW1zIGxwOworICAgICAgICBpbnQgcGl4ZWxGb3JtYXQ7CisgICAgICAgIERyYXdhYmxlIGJnOworCisgICAgICAgIC8vLyAtLS0tLS0tLS0tIFRyYWNraW5nIFZpZXcgLS0tLS0tLS0tLS0tLS0KKyAgICAgICAgcGl4ZWxGb3JtYXQgPSBQaXhlbEZvcm1hdC5SR0JYXzg4ODg7CisgICAgICAgIGJnID0gbVRyYWNraW5nVmlldy5nZXRCYWNrZ3JvdW5kKCk7CisgICAgICAgIGlmIChiZyAhPSBudWxsKSB7CisgICAgICAgICAgICBwaXhlbEZvcm1hdCA9IGJnLmdldE9wYWNpdHkoKTsKKyAgICAgICAgfQorCisgICAgICAgIGxwID0gbmV3IFdpbmRvd01hbmFnZXIuTGF5b3V0UGFyYW1zKAorICAgICAgICAgICAgICAgIFZpZXdHcm91cC5MYXlvdXRQYXJhbXMuTUFUQ0hfUEFSRU5ULAorICAgICAgICAgICAgICAgIFZpZXdHcm91cC5MYXlvdXRQYXJhbXMuTUFUQ0hfUEFSRU5ULAorICAgICAgICAgICAgICAgIFdpbmRvd01hbmFnZXIuTGF5b3V0UGFyYW1zLlRZUEVfU1RBVFVTX0JBUl9QQU5FTCwKKyAgICAgICAgICAgICAgICBXaW5kb3dNY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Rm9ybWF0KTsKKyAgICAgICAgbUV4cGFuZGVkUGFyYW1zID0gbHA7CisKKyAgICAgICAgbUV4cGFuZGVkRGlhbG9nLmdldFdpbmRvdygpLnJlcXVlc3RGZWF0dXJlKFdpbmRvdy5GRUFUVVJFX05PX1RJVExFKTsKKyAgICAgICAgbUV4cGFuZGVkRGlhbG9nLnNldENvbnRlbnRWaWV3KG1FeHBhbmRlZFZpZXcsCisgICAgICAgICAgICAgICAgbmV3IFZpZXdHcm91cC5MYXlvdXRQYXJhbXMoVmlld0dyb3VwLkxheW91dFBhcmFtcy5NQVRDSF9QQVJFTlQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVmlld0dyb3VwLkxheW91dFBhcmFtcy5NQVRDSF9QQVJFTlQpKTsKKyAgICAgICAgbUV4cGFuZGVkRGlhbG9nLmdldFdpbmRvdygpLnNldEJhY2tncm91bmREcmF3YWJsZShudWxsKTsKKyAgICAgICAgbUV4cGFuZGVkRGlhbG9nLnNob3coKTsKKyAgICAgICAgRnJhbWVMYXlvdXQgaGFjayA9IChGcmFtZUxheW91dCltRXhwYW5kZWRWaWV3LmdldFBhcmVudCgpOworICAgIH0KKworICAgIHZvaWQgc2V0RGF0ZVZpZXdWaXNpYmlsaXR5KGJvb2xlYW4gdmlzaWJsZSwgaW50IGFuaW0pIHsKKyAgICAgICAgbURhdGVWaWV3LnNldFVwZGF0ZXModmlzaWJsZSk7CisgICAgICAgIG1EYXRlVmlldy5zZXRWaXNpYmlsaXR5KHZpc2libGUgPyBWaWV3LlZJU0lCTEUgOiBWaWV3LklOVklTSUJMRSk7CisgICAgICAgIG1EYXRlVmlldy5zdGFydEFuaW1hdGlvbihsb2FkQW5pbShhbmltLCBudWxsKSk7CisgICAgfQorCisgICAgdm9pZCBzZXROb3RpZmljYXRpb25JY29uVmlzaWJpbGl0eShib29sZWFuIHZpc2libGUsIGludCBhbmltKSB7CisgICAgICAgIGludCBvbGQgPSBtTm90aWZpY2F0aW9uSWNvbnMuZ2V0VmlzaWJpbGl0eSgpOworICAgICAgICBpbnQgdiA9IHZpc2libGUgPyBWaWV3LlZJU0lCTEUgOiBWaWV3LklOVklTSUJMRTsKKyAgICAgICAgaWYgKG9sZCAhPSB2KSB7CisgICAgICAgICAgICBtTm90aWZpY2F0aW9uSWNvbnMuc2V0VmlzaWJpbGl0eSh2KTsKKyAgICAgICAgICAgIG1Ob3RpZmljYXRpb25JY29ucy5zdGFydEFuaW1hdGlvbihsb2FkQW5pbShhbmltLCBudWxsKSk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICB2b2lkIHVwZGF0ZUV4cGFuZGVkVmlld1BvcyhpbnQgZXhwYW5kZWRQb3NpdGlvbikgeworICAgICAgICBpZiAoU1BFVykgeworICAgICAgICAgICAgU2xvZy5kKFRBRywgInVwZGF0ZUV4cGFuZGVkVmlld1BvcyBiZWZvcmUgZXhwYW5kZWRQb3NpdGlvbj0iICsgZXhwYW5kZWRQb3NpdGlvbgorICAgICAgICAgICAgICAgICAgICArICIgbVRyYWNraW5nUGFyYW1zLnk9IiArIG1UcmFja2luZ1BhcmFtcy55CisgICAgICAgICAgICAgICAgICAgICsgIiBtVHJhY2tpbmdQb3NpdGlvbj0iICsgbVRyYWNraW5nUG9zaXRpb24pOworICAgICAgICB9CisKKyAgICAgICAgaW50IGggPSBtU3RhdHVzQmFyVmlldy5nZXRIZWlnaHQoKTsKKyAgICAgICAgaW50IGRpc3BoID0gbURpc3BsYXkuZ2V0SGVpZ2h0KCk7CisKKyAgICAgICAgLy8gSWYgdGhlIGV4cGFuZGVkIHZpZXcgaXMgbm90IHZpc2libGUsIG1ha2Ugc3VyZSB0aGV5J3JlIHN0aWxsIG9mZiBzY3JlZW4uCisgICAgICAgIC8vIE1heWJlIHRoZSB2aWV3IHdhcyByZXNpemVkLgorICAgICAgICBpZiAoIW1FeHBhbmRlZFZpc2libGUpIHsKKyAgICAgICAgICAgIGlmIChtVHJhY2tpbmdWaWV3ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBtVHJhY2tpbmdQb3NpdGlvbiA9IC1kaXNwaDsKKyAgICAgICAgICAgICAgICBpZiAobVRyYWNraW5nUGFyYW1zICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgbVRyYWNraW5nUGFyYW1zLnkgPSBtVHJhY2tpbmdQb3NpdGlvbjsKKyAgICAgICAgICAgICAgICAgICAgV2luZG93TWFuYWdlckltcGwuZ2V0RGVmYXVsdCgpLnVwZGF0ZVZpZXdMYXlvdXQobVRyYWNraW5nVmlldywgbVRyYWNraW5nUGFyYW1zKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAobUV4cGFuZGVkUGFyYW1zICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBtRXhwYW5kZWRQYXJhbXMueSA9IC1kaXNwaDsKKyAgICAgICAgICAgICAgICBtRXhwYW5kZWREaWFsb2cuZ2V0V2luZG93KCkuc2V0QXR0cmlidXRlcyhtRXhwYW5kZWRQYXJhbXMpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisKKyAgICAgICAgLy8gdHJhY2tpbmcgdmlldy4uLgorICAgICAgICBpbnQgcG9zOworICAgICAgICBpZiAoZXhwYW5kZWRQb3NpdGlvbiA9PSBFWFBBTkRFRF9GVUxMX09QRU4pIHsKKyAgICAgICAgICAgIHBvcyA9IGg7CisgICAgICAgIH0KKyAgICAgICAgZWxzZSBpZiAoZXhwYW5kZWRQb3NpdGlvbiA9PSBFWFBBTkRFRF9MRUFWRV9BTE9ORSkgeworICAgICAgICAgICAgcG9zID0gbVRyYWNraW5nUG9zaXRpb247CisgICAgICAgIH0KKyAgICAgICAgZWxzZSB7CisgICAgICAgICAgICBpZiAoZXhwYW5kZWRQb3NpdGlvbiA8PSBkaXNwaCkgeworICAgICAgICAgICAgICAgIHBvcyA9IGV4cGFuZGVkUG9zaXRpb247CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIHBvcyA9IGRpc3BoOworICAgICAgICAgICAgfQorICAgICAgICAgICAgcG9zIC09IGRpc3BoLWg7CisgICAgICAgIH0KKyAgICAgICAgbVRyYWNraW5nUG9zaXRpb24gPSBtVHJhY2tpbmdQYXJhbXMueSA9IHBvczsKKyAgICAgICAgbVRyYWNraW5nUGFyYW1zLmhlaWdodCA9IGRpc3BoLWg7CisgICAgICAgIFdpbmRvd01hbmFnZXJJbXBsLmdldERlZmF1bHQoKS51cGRhdGVWaWV3TGF5b3V0KG1UcmFja2luZ1ZpZXcsIG1UcmFja2luZ1BhcmFtcyk7CisKKyAgICAgICAgaWYgKG1FeHBhbmRlZFBhcmFtcyAhPSBudWxsKSB7CisgICAgICAgICAgICBtQ2xvc2VWaWV3LmdldExvY2F0aW9uSW5XaW5kb3cobVBvc2l0aW9uVG1wKTsKKyAgICAgICAgICAgIGZpbmFsIGludCBjbG9zZVBvcyA9IG1Qb3NpdGlvblRtcFsxXTsKKworICAgICAgICAgICAgbUV4cGFuZGVkQ29udGVudHMuZ2V0TG9jYXRpb25JbldpbmRvdyhtUG9zaXRpb25UbXApOworICAgICAgICAgICAgZmluYWwgaW50IGNvbnRlbnRzQm90dG9tID0gbVBvc2l0aW9uVG1wWzFdICsgbUV4cGFuZGVkQ29udGVudHMuZ2V0SGVpZ2h0KCk7CisKKyAgICAgICAgICAgIG1FeHBhbmRlZFBhcmFtcy55ID0gcG9zICsgbVRyYWNraW5nVmlldy5nZXRIZWlnaHQoKQorICAgICAgICAgICAgICAgICAgICAtIChtVHJhY2tpbmdQYXJhbXMuaGVpZ2h0LWNsb3NlUG9zKSAtIGNvbnRlbnRzQm90dG9tOworICAgICAgICAgICAgaW50IG1heCA9IGg7CisgICAgICAgICAgICBpZiAobUV4cGFuZGVkUGFyYW1zLnkgPiBtYXgpIHsKKyAgICAgICAgICAgICAgICBtRXhwYW5kZWRQYXJhbXMueSA9IG1heDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGludCBtaW4gPSBtVHJhY2tpbmdQb3NpdGlvbjsKKyAgICAgICAgICAgIGlmIChtRXhwYW5kZWRQYXJhbXMueSA8IG1pbikgeworICAgICAgICAgICAgICAgIG1FeHBhbmRlZFBhcmFtcy55ID0gbWluOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBib29sZWFuIHZpc2libGUgPSAobVRyYWNraW5nUG9zaXRpb24gKyBtVHJhY2tpbmdWaWV3LmdldEhlaWdodCgpKSA+IGg7CisgICAgICAgICAgICBpZiAoIXZpc2libGUpIHsKKyAgICAgICAgICAgICAgICAvLyBpZiB0aGUgY29udGVudHMgYXJlbid0IHZpc2libGUsIG1vdmUgdGhlIGV4cGFuZGVkIHZpZXcgd2F5IG9mZiBzY3JlZW4KKyAgICAgICAgICAgICAgICAvLyBiZWNhdXNlIHRoZSB3aW5kb3cgaXRzZWxmIGV4dGVuZHMgYmVsb3cgdGhlIGNvbnRlbnQgdmlldy4KKyAgICAgICAgICAgICAgICBtRXhwYW5kZWRQYXJhbXMueSA9IC1kaXNwaDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1FeHBhbmRlZERpYWxvZy5nZXRXaW5kb3coKS5zZXRBdHRyaWJ1dGVzKG1FeHBhbmRlZFBhcmFtcyk7CisKKyAgICAgICAgICAgIC8vIEFzIGxvbmcgYXMgdGhpcyBpc24ndCBqdXN0IGEgcmVwb3NpdGlvbmluZyB0aGF0J3Mgbm90IHN1cHBvc2VkIHRvIGFmZmVjdAorICAgICAgICAgICAgLy8gdGhlIHVzZXIncyBwZXJjZXB0aW9uIG9mIHdoYXQncyBzaG93aW5nLCBjYWxsIHRvIHNheSB0aGF0IHRoZSB2aXNpYmlsaXR5CisgICAgICAgICAgICAvLyBoYXMgY2hhbmdlZC4gKE90aGVyd2lzZSwgc29tZW9uZSBlbHNlIHdpbGwgY2FsbCB0byBkbyB0aGF0KS4KKyAgICAgICAgICAgIGlmIChleHBhbmRlZFBvc2l0aW9uICE9IEVYUEFOREVEX0xFQVZFX0FMT05FKSB7CisgICAgICAgICAgICAgICAgaWYgKFNQRVcpIFNsb2cuZChUQUcsICJ1cGRhdGVFeHBhbmRlZFZpZXdQb3MgdmlzaWJpbGl0eUNoYW5nZWQoIiArIHZpc2libGUgKyAiKSIpOworICAgICAgICAgICAgICAgIHZpc2liaWxpdHlDaGFuZ2VkKHZpc2libGUpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgaWYgKFNQRVcpIHsKKyAgICAgICAgICAgIFNsb2cuZChUQUcsICJ1cGRhdGVFeHBhbmRlZFZpZXdQb3MgYWZ0ZXIgIGV4cGFuZGVkUG9zaXRpb249IiArIGV4cGFuZGVkUG9zaXRpb24KKyAgICAgICAgICAgICAgICAgICAgKyAiIG1UcmFja2luZ1BhcmFtcy55PSIgKyBtVHJhY2tpbmdQYXJhbXMueQorICAgICAgICAgICAgICAgICAgICArICIgbVRyYWNraW5nUG9zaXRpb249IiArIG1UcmFja2luZ1Bvc2l0aW9uCisgICAgICAgICAgICAgICAgICAgICsgIiBtRXhwYW5kZWRQYXJhbXMueT0iICsgbUV4cGFuZGVkUGFyYW1zLnkKKyAgICAgICAgICAgICAgICAgICAgKyAiIG1FeHBhbmRlZFBhcmFtcy5oZWlnaHQ9IiArIG1FeHBhbmRlZFBhcmFtcy5oZWlnaHQpOworICAgICAgICB9CisgICAgfQorCisgICAgaW50IGdldEV4cGFuZGVkSGVpZ2h0KCkgeworICAgICAgICByZXR1cm4gbURpc3BsYXkuZ2V0SGVpZ2h0KCkgLSBtU3RhdHVzQmFyVmlldy5nZXRIZWlnaHQoKSAtIG1DbG9zZVZpZXcuZ2V0SGVpZ2h0KCk7CisgICAgfQorCisgICAgdm9pZCB1cGRhdGVFeHBhbmRlZEhlaWdodCgpIHsKKyAgICAgICAgaWYgKG1FeHBhbmRlZFZpZXcgIT0gbnVsbCkgeworICAgICAgICAgICAgbUV4cGFuZGVkUGFyYW1zLmhlaWdodC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ICAgICAgLy8gV29uJ3QgZmFpbCB1bmxlc3MgdGhlIHdvcmxkIGhhcyBlbmRlZC4KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIHZvaWQgcGVyZm9ybURpc2FibGVBY3Rpb25zKGludCBuZXQpIHsKKyAgICAgICAgaW50IG9sZCA9IG1EaXNhYmxlZDsKKyAgICAgICAgaW50IGRpZmYgPSBuZXQgXiBvbGQ7CisgICAgICAgIG1EaXNhYmxlZCA9IG5ldDsKKworICAgICAgICAvLyBhY3QgYWNjb3JkaW5nbHkKKyAgICAgICAgaWYgKChkaWZmICYgU3RhdHVzQmFyTWFuYWdlci5ESVNBQkxFX0VYUEFORCkgIT0gMCkgeworICAgICAgICAgICAgaWYgKChuZXQgJiBTdGF0dXNCYXJNYW5hZ2VyLkRJU0FCTEVfRVhQQU5EKSAhPSAwKSB7CisgICAgICAgICAgICAgICAgU2xvZy5kKFRBRywgIkRJU0FCTEVfRVhQQU5EOiB5ZXMiKTsKKyAgICAgICAgICAgICAgICBhbmltYXRlQ29sbGFwc2UoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICBpZiAoKGRpZmYgJiBTdGF0dXNCYXJNYW5hZ2VyLkRJU0FCTEVfTk9USUZJQ0FUSU9OX0lDT05TKSAhPSAwKSB7CisgICAgICAgICAgICBpZiAoKG5ldCAmIFN0YXR1c0Jhck1hbmFnZXIuRElTQUJMRV9OT1RJRklDQVRJT05fSUNPTlMpICE9IDApIHsKKyAgICAgICAgICAgICAgICBTbG9nLmQoVEFHLCAiRElTQUJMRV9OT1RJRklDQVRJT05fSUNPTlM6IHllcyIpOworICAgICAgICAgICAgICAgIGlmIChtVGlja2luZykgeworICAgICAgICAgICAgICAgICAgICBtTm90aWZpY2F0aW9uSWNvbnMuc2V0VmlzaWJpbGl0eShWaWV3LklOVklTSUJMRSk7CisgICAgICAgICAgICAgICAgICAgIG1UaWNrZXIuaGFsdCgpOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIHNldE5vdGlmaWNhdGlvbkljb25WaXNpYmlsaXR5KGZhbHNlLCBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLmFuaW0uZmFkZV9vdXQpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgU2xvZy5kKFRBRywgIkRJU0FCTEVfTk9USUZJQ0FUSU9OX0lDT05TOiBubyIpOworICAgICAgICAgICAgICAgIGlmICghbUV4cGFuZGVkVmlzaWJsZSkgeworICAgICAgICAgICAgICAgICAgICBzZXROb3RpZmljYXRpb25JY29uVmlzaWJpbGl0eSh0cnVlLCBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLmFuaW0uZmFkZV9pbik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9IGVsc2UgaWYgKChkaWZmICYgU3RhdHVzQmFyTWFuYWdlci5ESVNBQkxFX05PVElGSUNBVElPTl9USUNLRVIpICE9IDApIHsKKyAgICAgICAgICAgIGlmIChtVGlja2luZyAmJiAobmV0ICYgU3RhdHVzQmFyTWFuYWdlci5ESVNBQkxFX05PVElGSUNBVElPTl9USUNLRVIpICE9IDApIHsKKyAgICAgICAgICAgICAgICBtVGlja2VyLmhhbHQoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgVmlldy5PbkNsaWNrTGlzdGVuZXIgbUNsZWFyQnV0dG9uTGlzdGVuZXIgPSBuZXcgVmlldy5PbkNsaWNrTGlzdGVuZXIoKSB7CisgICAgICAgIHB1YmxpYyB2b2lkIG9uQ2xpY2soVmlldyB2KSB7CisgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIG1CYXJTZXJ2aWNlLm9uQ2xlYXJBbGxOb3RpZmljYXRpb25zKCk7CisgICAgICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZXgpIHsKKyAgICAgICAgICAgICAgICAvLyBzeXN0ZW0gcHJvY2VzcyBpcyBkZWFkIGlmIHdlJ3JlIGhlcmUuCisgICAgICAgICAgICB9CisgICAgICAgICAgICBhbmltYXRlQ29sbGFwc2UoKTsKKyAgICAgICAgfQorICAgIH07CisKKyAgICBwcml2YXRlIEJyb2FkY2FzdFJlY2VpdmVyIG1Ccm9hZGNhc3RSZWNlaXZlciA9IG5ldyBCcm9hZGNhc3RSZWNlaXZlcigpIHsKKyAgICAgICAgcHVibGljIHZvaWQgb25SZWNlaXZlKENvbnRleHQgY29udGV4dCwgSW50ZW50IGludGVudCkgeworICAgICAgICAgICAgU3RyaW5nIGFjdGlvbiA9IGludGVudC5nZXRBY3Rpb24oKTsKKyAgICAgICAgICAgIGlmIChJbnRlbnQuQUNUSU9OX0NMT1NFX1NZU1RFTV9ESUFMT0dTLmVxdWFscyhhY3Rpb24pCisgICAgICAgICAgICAgICAgICAgIHx8IEludGVudC5BQ1RJT05fU0NSRUVOX09GRi5lcXVhbHMoYWN0aW9uKSkgeworICAgICAgICAgICAgICAgIC8vY29sbGFwc2UoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGVsc2UgaWYgKEludGVudC5BQ1RJT05fQ09ORklHVVJBVElPTl9DSEFOR0VELmVxdWFscyhhY3Rpb24pKSB7CisgICAgICAgICAgICAgICAgdXBkYXRlUmVzb3VyY2VzKCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9OworCisgICAgcHJpdmF0ZSB2b2lkIHNldEludHJ1ZGVyQWxlcnRWaXNpYmlsaXR5KGJvb2xlYW4gdmlzKSB7CisgICAgICAgIG1JbnRydWRlckFsZXJ0Vmlldy5zZXRWaXNpYmlsaXR5KHZpcyA/IFZpZXcuVklTSUJMRSA6IFZpZXcuR09ORSk7CisgICAgfQorCisgICAgLyoqCisgICAgICogUmVsb2FkIHNvbWUgb2Ygb3VyIHJlc291cmNlcyB3aGVuIHRoZSBjb25maWd1cmF0aW9u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yB0cmFjaW5nCisgICAgLy8KKworICAgIHZvaWQgcG9zdFN0YXJ0VHJhY2luZygpIHsKKyAgICAgICAgbUhhbmRsZXIucG9zdERlbGF5ZWQobVN0YXJ0VHJhY2luZywgMzAwMCk7CisgICAgfQorCisgICAgdm9pZCB2aWJyYXRlKCkgeworICAgICAgICBhbmRyb2lkLm9zLlZpYnJhdG9yIHZpYiA9IChhbmRyb2lkLm9zLlZpYnJhdG9yKWdldFN5c3RlbVNlcnZpY2UoQ29udGV4dC5WSUJSQVRPUl9TRVJWSUNFKTsKKyAgICAgICAgdmliLnZpYnJhdGUoMjUwKTsKKyAgICB9CisKKyAgICBSdW5uYWJsZSBtU3RhcnRUcmFjaW5nID0gbmV3IFJ1bm5hYmxlKCkgeworICAgICAgICBwdWJsaWMgdm9pZCBydW4oKSB7CisgICAgICAgICAgICB2aWJyYXRlKCk7CisgICAgICAgICAgICBTeXN0ZW1DbG9jay5zbGVlcCgyNTApOworICAgICAgICAgICAgU2xvZy5kKFRBRywgInN0YXJ0VHJhY2luZyIpOworICAgICAgICAgICAgYW5kcm9pZC5vcy5EZWJ1Zy5zdGFydE1ldGhvZFRyYWNpbmcoIi9kYXRhL3N0YXR1c2Jhci10cmFjZXMvdHJhY2UiKTsKKyAgICAgICAgICAgIG1IYW5kbGVyLnBvc3REZWxheWVkKG1TdG9wVHJhY2luZywgMTAwMDApOworICAgICAgICB9CisgICAgfTsKKworICAgIFJ1bm5hYmxlIG1TdG9wVHJhY2luZyA9IG5ldyBSdW5uYWJsZSgpIHsKKyAgICAgICAgcHVibGljIHZvaWQgcnVuKCkgeworICAgICAgICAgICAgYW5kcm9pZC5vcy5EZWJ1Zy5zdG9wTWV0aG9kVHJhY2luZygpOworICAgICAgICAgICAgU2xvZy5kKFRBRywgInN0b3BUcmFjaW5nIik7CisgICAgICAgICAgICB2aWJyYXRlKCk7CisgICAgICAgIH0KKyAgICB9OworfQorCmRpZmYgLS1naXQgYS9wYWNrYWdlcy9TeXN0ZW1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jYXNlIEtleUV2ZW50LktFWUNPREVfQkFDSzoKLSAgICAgICAgICAgICAgICBpZiAoIWRvd24pIHsKLSAgICAgICAgICAgICAgICAgICAgYW5pbWF0ZUNvbGxhcHNlKCk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgcmV0dXJuIHN1cGVyLmRpc3BhdGNoS2V5RXZlbnQoZXZlbnQpOwotICAgICAgICB9CisgICAgLyoqCisgICAgICogTm9ib2R5IGJpbmRzIHRvIHVzLgorICAgICAqLworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyBJQmluZGVyIG9uQmluZChJbnRlbnQgaW50ZW50KSB7CisgICAgICAgIHJldHVybiBudWxsOwogICAgIH0KIAotCiAgICAgQE92ZXJyaWRlCiAgICAgcHVibGljIHZvaWQgb25DcmVhdGUoKSB7CiAgICAgICAgIC8vIEZpcnN0IHNldCB1cCBvdXIgdmlld3MgYW5kIHN0dWZmLgotICAgICAgICBtRGlzcGxheSA9ICgoV2luZG93TWFuYWdlcilnZXRTeXN0ZW1TZXJ2aWNlKENvbnRleHQuV0lORE9XX1NFUlZJQ0UpKS5nZXREZWZhdWx0RGlzcGxheSgpOwotICAgICAgICBtYWtlU3RhdHVzQmFyVmlldyh0aGlzKTsKKyAgICAgICAgVmlldyBzYiA9IG1ha2VTdGF0dXNCYXJWaWV3KCk7CiAKICAgICAgICAgLy8gQ29ubmVjdCBpbiB0byB0aGUgc3RhdHVzIGJhciBtYW5hZ2VyIHNlcnZpY2UKICAgICAgICAgU3RhdHVzQmFySWNvbkxpc3QgaWNvbkxpc3QgPSBuZXcgU3RhdHVzQmFySWNvbkxpc3QoKTsKQEAgLTIzNiwxMzcxICsxMDEsMjIgQEAKICAgICAgICAgfQogCiAgICAgICAgIC8vIFB1dCB1cCB0aGUgdmlldwotICAgICAgICBhZGRTdGF0dXNCYXJWaWV3KCk7Ci0KLSAgICAgICAgLy8gTGFzdGx5LCBjYWxsIHRvIHRoZSBpY29uIHBvbGljeSB0byBpbnN0YWxsL3VwZGF0ZSBhbGwgdGhlIGljb25zLgotICAgICAgICBtSWNvblBvbGljeSA9IG5ldyBTdGF0dXNCYXJQb2xpY3kodGhpcyk7Ci0gICAgfQotCi0gICAgQE92ZXJyaWRlCi0gICAgcHVibGljIHZvaWQgb25EZXN0cm95KCkgewotICAgICAgICAvLyB3ZSdyZSBuZXZlciBkZXN0cm95ZWQKLSAgICB9Ci0KLSAgICAvLyBmb3IgaW1tZXJzaXZlIGFjdGl2aXRpZXMKLSAgICBwcml2YXRlIFZpZXcgbUludHJ1ZGVyQWxlcnRWaWV3OwotCi0gICAgLyoqCi0gICAgICogTm9ib2R5IGJpbmRzIHRvIHVzLgotICAgICAqLwotICAgIEBPdmVycmlkZQotICAgIHB1YmxpYyBJQmluZGVyIG9uQmluZChJbnRlbnQgaW50ZW50KSB7Ci0gICAgICAgIHJldHVybiBudWxsOwotICAgIH0KLQotICAgIC8vID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0gICAgLy8gQ29uc3RydWN0aW5nIHRoZSB2aWV3Ci0gICAgLy8gPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLSAgICBwcml2YXRlIHZvaWQgbWFrZVN0YXR1c0JhclZpZXcoQ29udGV4dCBjb250ZXh0KSB7Ci0gICAgICAgIFJlc291cmNlcyByZXMgPSBjb250ZXh0LmdldFJlc291cmNlcygpOwotCi0gICAgICAgIG1JY29uU2l6ZSA9IHJlcy5nZXREaW1lbnNpb25QaXhlbFNpemUoY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5kaW1lbi5zdGF0dXNfYmFyX2ljb25fc2l6ZSk7Ci0KLSAgICAgICAgRXhwYW5kZWRWaWV3IGV4cGFu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eS5GSUxMX0hPUklaT05UQUw7CisgICAgICAgIGxwLmdyYXZpdHkgPSBnZXRTdGF0dXNCYXJHcmF2aXR5KCk7CiAgICAgICAgIGxwLnNldFRpdGxlKCJTdGF0dXNCYXIiKTsKICAgICAgICAgLy8gVE9ETyBscC53aW5kb3dBbmltYXRpb25zID0gUi5zdHlsZS5BbmltYXRpb25fU3RhdHVzQmFyOworICAgICAgICBXaW5kb3dNYW5hZ2VySW1wbC5nZXREZWZhdWx0KCkuYWRkVmlldyhzYiwgbHApOwogCi0gICAgICAgIFdpbmRvd01hbmFnZXJJbXBsLmdldERlZmF1bHQoKS5hZGRWaWV3KHZpZXcsIGxwKTsKLQotICAgICAgICBscCA9IG5ldyBXaW5kb3dNYW5hZ2VyLkxheW91dFBhcmFtcygKLSAgICAgICAgICAgICAgICBWaWV3R3JvdXAuTGF5b3V0UGFyYW1zLk1BVENIX1BBUkVOVCwKLSAgICAgICAgICAgICAgICBWaWV3R3JvdXAuTGF5b3V0UGFyYW1zLldSQVBfQ09OVEVOVCwKLSAgICAgICAgICAgICAgICBXaW5kb3dNYW5hZ2VyLkxheW91dFBhcmFtcy5UWVBFX1NUQVRVU19CQVJfUEFORUwsCi0gICAgICAgICAgICAgICAgV2luZG93TWFuYWdlci5MYXlvdXRQYXJhbXMuRkxBR19MQVlPVVRfSU5fU0NSRUVOCi0gICAgICAgICAgICAgICAgICAgIHwgV2luZG93TWFuYWdlci5MYXlvdXRQYXJhbXMuRkxBR19MQVlPVVRfTk9fTElNSVRTCi0gICAgICAgICAgICAgICAgICAgIHwgV2luZG93TWFuYWdlci5MYXlvdXRQYXJhbXMuRkxBR19OT1RfVE9VQ0hfTU9EQUwKLSAgICAgICAgICAgICAgICAgICAgfCBXaW5kb3dNYW5hZ2VyLkxheW91dFBhcmFtcy5GTEFHX05PVF9GT0NVU0FCTEUKLSAgICAgICAgICAgICAgICAgICAgfCBXaW5kb3dNYW5hZ2VyLkxheW91dFBhcmFtcy5GTEFHX0FMVF9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TGluZWFyTGF5b3V0LkxheW91dFBhcmFtcyhtSWNvblNpemUsIG1JY29uU2l6ZSkpOwotICAgIH0KLQotICAgIHB1YmxpYyB2b2lkIHVwZGF0ZUljb24oU3RyaW5nIHNsb3QsIGludCBpbmRleCwgaW50IHZpZXdJbmRleCwKLSAgICAgICAgICAgIFN0YXR1c0Jhckljb24gb2xkLCBTdGF0dXNCYXJJY29uIGljb24pIHsKLSAgICAgICAgaWYgKFNQRVcpIFNsb2cuZChUQUcsICJ1cGRhdGVJY29uIHNsb3Q9IiArIHNsb3QgKyAiIGluZGV4PSIgKyBpbmRleCArICIgdmlld0luZGV4PSIgKyB2aWV3SW5kZXgKLSAgICAgICAgICAgICAgICArICIgb2xkPSIgKyBvbGQgKyAiIGljb249IiArIGljb24pOwotICAgICAgICBTdGF0dXNCYXJJY29uVmlldyB2aWV3ID0gKFN0YXR1c0Jhckljb25WaWV3KW1TdGF0dXNJY29ucy5nZXRDaGlsZEF0KHZpZXdJbmRleCk7Ci0gICAgICAgIHZpZXcuc2V0KGljb24pOwotICAgIH0KLQotICAgIHB1YmxpYyB2b2lkIHJlbW92ZUljb24oU3RyaW5nIHNsb3QsIGludCBpbmRleCwgaW50IHZpZXdJbmRleCkgewotICAgICAgICBpZiAoU1BFVykgU2xvZy5kKFRBRywgInJlbW92ZUljb24gc2xvdD0iICsgc2xvdCArICIgaW5kZXg9IiArIGluZGV4ICsgIiB2aWV3SW5kZXg9IiArIHZpZXdJbmRleCk7Ci0gICAgICAgIG1TdGF0dXNJY29ucy5yZW1vdmVWaWV3QXQodmlld0luZGV4KTsKLSAgICB9Ci0KLSAgICBwdWJsaWMgdm9pZCBhZGROb3RpZmljYXRpb24oSUJpbmRlciBrZXksIFN0YXR1c0Jhck5vdGlmaWNhdGlvbiBub3RpZmljYXRpb24pIHsKLSAgICAgICAgU3RhdHVzQmFySWNvblZpZXcgaWNvblZpZXcgPSBhZGROb3RpZmljYXRpb25WaWV3cyhrZXksIG5vdGlmaWNhdG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QpOwotICAgICAgICAgICAgICAgIGFsZXJ0SWNvbi5zZXRJbWFnZURyYXdhYmxlKFN0YXR1c0Jhckljb25WaWV3LmdldEljb24oCi0gICAgICAgICAgICAgICAgICAgIGFsZXJ0SWNvbi5nZXRDb250ZXh0KCksCi0gICAgICAgICAgICAgICAgICAgIGljb25WaWV3LmdldFN0YXR1c0Jhckljb24oKSkpOwotICAgICAgICAgICAgICAgIGFsZXJ0VGV4dC5zZXRUZXh0KG5vdGlmaWNhdGlvbi5ub3RpZmljYXRpb24udGlja2VyVGV4dCk7Ci0KLSAgICAgICAgICAgICAgICBWaWV3IGJ1dHRvbiA9IG1JbnRydWRlckFsZXJ0Vmlldy5maW5kVmlld0J5SWQoUi5pZC5pbnRydWRlcl9hbGVydF9jb250ZW50KTsKLSAgICAgICAgICAgICAgICBidXR0b24uc2V0T25DbGlja0xpc3RlbmVyKAotICAgICAgICAgICAgICAgICAgICBuZXcgTGF1bmNoZXIobm90aWZpY2F0aW9uLm5vdGlmaWNhdGlvbi5jb250ZW50SW50ZW50LAotICAgICAgICAgICAgICAgICAgICAgICAgbm90aWZpY2F0aW9uLnBrZywgbm90aWZpY2F0aW9uLnRhZywgbm90aWZpY2F0aW9uLmlkKSk7Ci0KLSAgICAgICAgICAgICAgICAvLyAyLiBBbmltYXRlIG1JbnRydWRlckFsZXJ0VmlldyBpbgotICAgICAgICAgICAgICAgIG1IYW5kbGVyLnNlbmRFbXB0eU1lc3NhZ2UoTVNHX1NIT1dfSU5UUlVERVIpOwotCi0gICAgICAgICAgICAgICAgLy8gMy4gU2V0IGFsYXJtIHRvIGFnZSB0aGUgbm90aWZpY2F0aW9uIG9mZiAoVE9ETykKLSAgICAgICAgICAgICAgICBtSGFuZGxlci5yZW1vdmVNZXNzYWdlcyhNU0dfSElERV9JTlRSVURFUik7Ci0gICAgICAgICAgICAgICAgbUhhbmRsZXIuc2VuZEVtcHR5TWVzc2FnZURlbGF5ZWQoTVNHX0hJREVfSU5UUlVERVIsIElO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IHVwZGF0ZU5vdGlmaWNhdGlvbihJQmluZGVyIGtleSwgU3RhdHVzQmFyTm90aWZpY2F0aW9uIG5vdGlmaWNhdGlvbikgewotICAgICAgICBTbG9nLmQoVEFHLCAidXBkYXRlTm90aWZpY2F0aW9uIGtleT0iICsga2V5ICsgIiBub3RpZmljYXRpb249IiArIG5vdGlmaWNhdGlvbik7Ci0KLSAgICAgICAgTm90aWZpY2F0aW9uRGF0YSBvbGRMaXN0OwotICAgICAgICBpbnQgb2xkSW5kZXggPSBtT25nb2luZy5maW5kRW50cnkoa2V5KTsKLSAgICAgICAgaWYgKG9sZEluZGV4ID49IDApIHsKLSAgICAgICAgICAgIG9sZExpc3QgPSBtT25nb2luZzsKLSAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgIG9sZEluZGV4ID0gbUxhdGVzdC5maW5kRW50cnkoa2V5KTsKLSAgICAgICAgICAgIGlmIChvbGRJbmRleCA8IDApIHsKLSAgICAgICAgICAgICAgICBTbG9nLncoVEFHLCAidXBkYXRlTm90aWZpY2F0aW9uIGZvciB1bmtub3duIGtleTogIiArIGtleSk7Ci0gICAgICAgICAgICAgICAgcmV0dXJuOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgb2xkTGlzdCA9IG1MYXRlc3Q7Ci0gICAgICAgIH0KLSAgICAgICAgZmluYWwgTm90aWZpY2F0aW9uRGF0YS5FbnRyeSBvbGRFbnRyeSA9IG9sZExpc3QuZ2V0RW50cnlBdChvbGRJbmRleCk7Ci0gICAgICAgIGZpbmFsIFN0YXR1c0Jhck5vdGlmaWNhdGlvbiBvbGROb3RpZmljYXRpb24gPSBvbGRFbnRyeS5ub3RpZmljYXRpb247Ci0gICAgICAgIGZpbmFsIFJlbW90ZVZpZXdzIG9sZENvbnRlbnRWaWV3ID0gb2xkTm90aWZpY2F0aW9uLm5vdGlmaWNhdGlvbi5jb250ZW50VmlldzsKLQotICAgICAgICBmaW5hbCBSZW1vdGVWaWV3cyBjb250ZW50VmlldyA9IG5vdGlmaWNhdGlvbi5ub3RpZmljYXRpb24uY29udGVudFZpZXc7Ci0KLSAgICAgICAgaWYgKGZhbHNlKSB7Ci0gICAgICAgICAgICBTbG9nLmQoVEFHLCAib2xkIG5vdGlmaWNhdGlvbjogd2hlbj0iICsgb2xkTm90aWZpY2F0aW9uLm5vdGlmaWNhdGlvbi53aGVuCi0gICAgICAgICAgICAgICAgICAgICsgIiBvbmdvaW5nPSIgKyBvbGROb3RpZmljYXRpb24uaXNPbmdvaW5nKCkKLSAgICAgICAgICAgICAgICAgICAgKyAiIGV4cGFuZGVkPSIgKyBvbGRFbnRyeS5leHBhbmRlZAotICAgICAgICAgICAgICAgICAgICArICIgY29udGVudFZpZXc9IiArIG9sZENvbnRlbnRWaWV3KTsKLSAgICAgICAgICAgIFNsb2cuZChUQUcsICJuZXcgbm90aWZpY2F0aW9uOiB3aGVuPSIgKyBub3RpZmljYXRpb24ubm90aWZpY2F0aW9uLndoZW4KLSAgICAgICAgICAgICAgICAgICAgKyAiIG9uZ29pbmc9IiArIG9sZE5vdGlmaWNhdGlvbi5pc09uZ29pbmcoKQotICAgICAgICAgICAgICAgICAgICArICIgY29udGVudFZpZXc9IiArIGNvbnRlbnRWaWV3KTsKLSAgICAgICAgfQotCi0gICAgICAgIC8vIENhbiB3ZSBqdXN0IHJlYXBwbHkgdGhlIFJlbW90ZVZpZXdzIGluIHBsYWNlPyAgSWYgd2hlbiBkaWRuJ3QgY2hhbmdlLCB0aGUgb3JkZXIKLSAgICAgICAgLy8gZGlkbid0IGNoYW5nZS4KLSAgICAgICAgaWYgKG5vdGlmaWNhdGlvbi5ub3RpZmljYXRpb24ud2hlbiA9PSBvbGROb3RpZmljYXRpb24ubm90aWZpY2F0aW9uLndoZW4KLSAgICAgICAgICAgICAgICAmJiBub3RpZmljYXRpb24uaXNPbmdvaW5nKCkgPT0gb2xkTm90aWZpY2F0aW9uLmlzT25nb2luZygpCi0gICAgICAgICAgICAgICAgJiYgb2xkRW50cnkuZXhwYW5kZWQgIT0gbnVsbAotICAgICAgICAgICAgICAgICYmIGNvbnRlbnRWaWV3ICE9IG51bGwgJiYgb2xkQ29udGVudFZpZXcgIT0gbnVsbAotICAgICAgICAgICAgICAgICYmIGNvbnRlbnRWaWV3LmdldFBhY2thZ2UoKSAhPSBudWxsCi0gICAgICAgICAgICAgICAgJiYgb2xkQ29udGVudFZpZXcuZ2V0UGFja2FnZSgpICE9IG51bGwKLSAgICAgICAgICAgICAgICAmJiBvbGRDb250ZW50Vmlldy5nZXRQYWNrYWdlKCkuZXF1YWxzKGNvbnRlbnRWaWV3LmdldFBhY2thZ2UoKSkKLSAgICAgICAgICAgICAgICAmJiBvbGRDb250ZW50Vmlldy5nZXRMYXlvdXRJZCgpID09IGNvbnRlbnRWaWV3LmdldExheW91dElkKCkpIHsKLSAgICAgICAgICAgIGlmIChTUEVXKSBTbG9nLmQoVEFHLCAicmV1c2luZyBub3RpZmljYXRpb24iKTsKLSAgICAgICAgICAgIG9sZEVudHJ5Lm5vdGlmaWNhdGlvbiA9IG5vdGlmaWNhdGlvbjsKLSAgICAgICAgICAgIHRyeSB7Ci0gICAgICAgICAgICAgICAgLy8gUmVhcHBseSB0aGUgUmVtb3RlVmlld3MKLSAgICAgICAgICAgICAgICBjb250ZW50Vmlldy5yZWFwcGx5KHRoaXMsIG9sZEVudHJ5LmNvbnRlbnQpOwotICAgICAgICAgICAgICAgIC8vIHVwZGF0ZSB0aGUgY29udGVudEludGVudAotICAgICAgICAgICAgICAgIGZpbmFsIFBlbmRpbmdJbnRlbnQgY29udGVudEludGVudCA9IG5vdGlmaWNhdGlvbi5ub3RpZmljYXRpb24uY29udGVudEludGVudDsKLSAgICAgICAgICAgICAgICBpZiAoY29udGVudEludGVudCAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIG9sZEVudHJ5LmNvbnRlbnQuc2V0T25DbGlja0xpc3RlbmVyKG5ldyBMYXVuY2hlcihjb250ZW50SW50ZW50LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBub3RpZmljYXRpb24ucGtnLCBub3RpZmljYXRpb24udGFnLCBub3RpZmljYXRpb24uaWQpKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgLy8gVXBkYXRlIHRoZSBpY29uLgotICAgICAgICAgICAgICAgIGZpbmFsIFN0YXR1c0Jhckljb24gaWMgPSBuZXcgU3RhdHVzQmFySWNvbihub3RpZmljYXRpb24ucGtnLAotICAgICAgICAgICAgICAgICAgICAgICAgbm90aWZpY2F0aW9uLm5vdGlmaWNhdGlvbi5pY29uLCBub3RpZmljYXRpb24ubm90aWZpY2F0aW9uLmljb25MZXZlbCwKLSAgICAgICAgICAgICAgICAgICAgICAgIG5vdGlmaWNhdGlvbi5ub3RpZmljYXRpb24ubnVtYmVyKTsKLSAgICAgICAgICAgICAgICBpZiAoIW9sZEVudHJ5Lmljb24uc2V0KGljKSkgewotICAgICAgICAgICAgICAgICAgICBoYW5kbGVOb3RpZmljYXRpb25FcnJvcihrZXksIG5vdGlmaWNhdGlvbiwgIkNvdWxkbid0IHVwZGF0ZSBpY29uOiAiICsgaWMpOwotICAgICAgICAgICAgICAgICAgICByZXR1cm47Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICAgICAgY2F0Y2ggKFJ1bnRpbWVFeGNlcHRpb24gZSkgewotICAgICAgICAgICAgICAgIC8vIEl0IGZhaWxlZCB0byBhZGQgY2xlYW5seS4gIExvZywgYW5kIHJlbW92ZSB0aGUgdmlldyBmcm9tIHRoZSBwYW5lbC4KLSAgICAgICAgICAgICAgICBTbG9nLncoVEFHLCAiQ291bGRuJ3QgcmVhcHBseSB2aWV3cyBmb3IgcGFja2FnZSAiICsgY29udGVudFZpZXcuZ2V0UGFja2FnZSgpLCBlKTsKLSAgICAgICAgICAgICAgICByZW1vdmVOb3RpZmljYXRpb25WaWV3cyhrZXkpOwotICAgICAgICAgICAgICAgIGFkZE5vdGlmaWNhdGlvblZp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oaWMpKSB7Ci0gICAgICAgICAgICBoYW5kbGVOb3RpZmljYXRpb25FcnJvcihrZXksIG5vdGlmaWNhdGlvbiwgIkNvdWxkaW5nIGNyZWF0ZSBpY29uOiAiICsgaWMpOwotICAgICAgICAgICAgcmV0dXJuIG51bGw7Ci0gICAgICAgIH0KLSAgICAgICAgLy8gQWRkIHRoZSBleHBhbmRlZCB2aWV3LgotICAgICAgICBmaW5hbCBpbnQgdmlld0luZGV4ID0gbGlzdC5hZGQoa2V5LCBub3RpZmljYXRpb24sIHJvdywgY29udGVudCwgZXhwYW5kZWQsIGljb25WaWV3KTsKLSAgICAgICAgcGFyZW50LmFkZFZpZXcocm93LCB2aWV3SW5kZXgpOwotICAgICAgICAvLyBBZGQgdGhlIGljb24uCi0gICAgICAgIGZpbmFsIGludCBpY29uSW5kZXggPSBjaG9vc2VJY29uSW5kZXgoaXNPbmdvaW5nLCB2aWV3SW5kZXgpOwotICAgICAgICBtTm90aWZpY2F0aW9uSWNvbnMuYWRkVmlldyhpY29uVmlldywgaWNvbkluZGV4LAotICAgICAgICAgICAgICAgIG5ldyBMaW5lYXJMYXlvdXQuTGF5b3V0UGFyYW1zKG1JY29uU2l6ZSwgbUljb25TaXplKSk7Ci0gICAgICAgIHJldHVybiBpY29uVmlldzsKLSAgICB9Ci0KLSAgICBTdGF0dXNCYXJOb3RpZmljYXRpb24gcmVtb3ZlTm90aWZpY2F0aW9uVmlld3MoSUJpbmRlciBrZXkpIHsKLSAgICAgICAgTm90aWZpY2F0aW9uRGF0YS5FbnRyeSBlbnRyeSA9IG1PbmdvaW5nLnJlbW92ZShrZXkpOwotICAgICAgICBpZiAoZW50cnkgPT0gbnVsbCkgewotICAgICAgICAgICAgZW50cnkgPSBtTGF0ZXN0LnJlbW92ZShrZXkpOwotICAgICAgICAgICAgaWYgKGVudHJ5ID09IG51bGwpIHsKLSAgICAgICAgICAgICAgICBTbG9nLncoVEFHLCAicmVtb3ZlTm90aWZpY2F0aW9uIGZvciB1bm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RV9OT1RJRklDQVRJT05fSUNPTlMpICE9IDApIHsKLSAgICAgICAgICAgICAgICBTbG9nLmQoVEFHLCAiRElTQUJMRV9OT1RJRklDQVRJT05fSUNPTlM6IHllcyIpOwotICAgICAgICAgICAgICAgIGlmIChtVGlja2luZykgewotICAgICAgICAgICAgICAgICAgICBtVGlja2VyLmhhbHQoKTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICBzZXROb3RpZmljYXRpb25JY29uVmlzaWJpbGl0eShmYWxzZSwgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5hbmltLmZhZGVfb3V0KTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIFNsb2cuZChUQUcsICJESVNBQkxFX05PVElGSUNBVElPTl9JQ09OUzogbm8iKTsKLSAgICAgICAgICAgICAgICBpZiAoIW1FeHBhbmRlZFZpc2libGUpIHsKLSAgICAgICAgICAgICAgICAgICAgc2V0Tm90aWZpY2F0aW9uSWNvblZpc2liaWxpdHkodHJ1ZSwgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5hbmltLmZhZGVfaW4pOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgfSBlbHNlIGlmICgoZGlmZiAmIFN0YXR1c0Jhck1hbmFnZXIuRElTQUJMRV9OT1RJRklDQVRJT05fVElDS0VSKSAhPSAwKSB7Ci0gICAgICAgICAgICBpZiAobVRpY2tpbmcgJiYgKHN0YXRlICYgU3RhdHVzQmFyTWFuYWdlci5ESVNBQkxFX05PVElGSUNBVElPTl9USUNLRVIpICE9IDApIHsKLSAgICAgICAgICAgICAgICBTbG9nLmQoVEFHLCAiRElTQUJMRV9OT1RJRklDQVRJT05fVElDS0VSOiB5ZXMiKTsKLSAgICAgICAgICAgICAgICBtVGlja2VyLmhhbHQoKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgIH0KLQotICAgIC8qKgotICAgICAqIEFsbCBjaGFuZ2VzIHRvIHRoZSBzdGF0dXMgYmFyIGFuZCBub3RpZmljYXRpb25zIGZ1bm5lbCB0aHJvdWdoIGhlcmUgYW5kIGFyZSBiYXRjaGVkLgotICAgICAqLwotICAgIHByaXZhdGUgY2xhc3MgSCBleHRlbmRzIEhhbmRsZXIgewotICAgICAgICBwdWJsaWMgdm9pZCBoYW5kbGVNZXNzYWdlKE1lc3NhZ2UgbSkgewotICAgICAgICAgICAgc3dpdGNoIChtLndoYXQpIHsKLSAgICAgICAgICAgICAgICBjYXNlIE1TR19BTklNQVRFOgotICAgICAgICAgICAgICAgICAgICBkb0FuaW1hdGlvbigpOwotICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICBjYXNlIE1TR19BTklNQVRFX1JFVkVBTDoKLSAgICAgICAgICAgICAgICAgICAgZG9SZXZlYWxBbmltYXRpb24oKTsKLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgY2FzZSBNU0dfU0hPV19JTlRSVURFUjoKLSAgICAgICAgICAgICAgICAgICAgc2V0SW50cnVkZXJBbGVydFZpc2liaWxpdHkodHJ1ZSk7Ci0gICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgIGNhc2UgTVNHX0hJREVfSU5UUlVERVI6Ci0gICAgICAgICAgICAgICAgICAgIHNldEludHJ1ZGVyQWxlcnRWaXNpYmlsaXR5KGZhbHNlKTsKLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLSAgICB9Ci0KLSAgICBWaWV3Lk9uRm9jdXNDaGFuZ2VMaXN0ZW5lciBtRm9jdXNDaGFuZ2VMaXN0ZW5lciA9IG5ldyBWaWV3Lk9uRm9jdXNDaGFuZ2VMaXN0ZW5lcigpIHsKLSAgICAgICAgcHVibGljIHZvaWQgb25Gb2N1c0NoYW5nZShWaWV3IHYsI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T0NVU19GT1JXQVJEKTsKLSAgICAgICAgbVRyYWNraW5nVmlldy5zZXRWaXNpYmlsaXR5KFZpZXcuVklTSUJMRSk7Ci0KLSAgICAgICAgaWYgKCFtVGlja2luZykgewotICAgICAgICAgICAgc2V0RGF0ZVZpZXdWaXNpYmlsaXR5KHRydWUsIGNvbS5hbmRyb2lkLmludGVybmFsLlIuYW5pbS5mYWRlX2luKTsKLSAgICAgICAgfQotICAgIH0KLQotICAgIHB1YmxpYyB2b2lkIGFuaW1hdGVFeHBhbmQoKSB7Ci0gICAgICAgIGlmIChTUEVXKSBTbG9nLmQoVEFHLCAiQW5pbWF0ZSBleHBhbmQ6IGV4cGFuZGVkPSIgKyBtRXhwYW5kZWQpOwotICAgICAgICBpZiAoKG1EaXNhYmxlZCAmIFN0YXR1c0Jhck1hbmFnZXIuRElTQUJMRV9FWFBBTkQpICE9IDApIHsKLSAgICAgICAgICAgIHJldHVybiA7Ci0gICAgICAgIH0KLSAgICAgICAgaWYgKG1FeHBhbmRlZCkgewotICAgICAgICAgICAgcmV0dXJuOwotICAgICAgICB9Ci0KLSAgICAgICAgcHJlcGFyZVRyYWNraW5nKDAsIHRydWUpOwotICAgICAgICBwZXJmb3JtRmxpbmcoMCwgMjAwMC4wZiwgdHJ1ZSk7Ci0gICAgfQotCi0gICAgcHVibGljIHZvaWQgYW5pbWF0ZUNvbGxhcHNlKCkgewotICAgICAgICBpZiAoU1BFVykgewotICAgICAgICAgICAgU2xvZy5kKFRBRywgImFuaW1hdGVDb2xsYXBzZSgpOiBtRXhwYW5kZWQ9IiArIG1FeHBhbmRlZAotICAgICAgICAgICAgICAgICAgICArICIgbUV4cGFuZGVkVmlzaWJsZT0iICsgbUV4cGFuZGVkVmlzaWJsZQotICAgICAgICAgICAgICAgICAgICArICIgbUV4cGFuZGVkPSIgKyBtRXhwYW5kZWQKLSAgICAgICAgICAgICAgICAgICAgKyAiIG1BbmltYXRpbmc9IiArIG1BbmltYXRpbmcKLSAgICAgICAgICA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gICAgc2V0Tm90aWZpY2F0aW9uSWNvblZpc2liaWxpdHkodHJ1ZSwgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5hbmltLmZhZGVfaW4pOwotICAgICAgICB9Ci0gICAgICAgIHNldERhdGVWaWV3VmlzaWJpbGl0eShmYWxzZSwgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5hbmltLmZhZGVfb3V0KTsKLQotICAgICAgICBpZiAoIW1FeHBhbmRlZCkgewotICAgICAgICAgICAgcmV0dXJuOwotICAgICAgICB9Ci0gICAgICAgIG1FeHBhbmRlZCA9IGZhbHNlOwotICAgIH0KLQotICAgIHZvaWQgZG9BbmltYXRpb24oKSB7Ci0gICAgICAgIGlmIChtQW5pbWF0aW5nKSB7Ci0gICAgICAgICAgICBpZiAoU1BFVykgU2xvZy5kKFRBRywgImRvQW5pbWF0aW9uIik7Ci0gICAgICAgICAgICBpZiAoU1BFVykgU2xvZy5kKFRBRywgImRvQW5pbWF0aW9uIGJlZm9yZSBtQW5pbVk9IiArIG1BbmltWSk7Ci0gICAgICAgICAgICBpbmNyZW1lbnRBbmltKCk7Ci0gICAgICAgICAgICBpZiAoU1BFVykgU2xvZy5kKFRBRywgImRvQW5pbWF0aW9uIGFmdGVyICBtQW5pbVk9IiArIG1BbmltWSk7Ci0gICAgICAgICAgICBpZiAobUFuaW1ZID49IG1EaXNwbGF5LmdldEhlaWdodCgpLTEpIHsKLSAgICAgICAgICAgICAgICBpZiAoU1BFVykgU2xvZy5kKFRBRywgIkFuaW1hdGlvbiBjb21wbGV0ZWQgdG8gZXhwYW5kZWQgc3RhdGUuIik7Ci0gICAgICAgICAgICAgICAgbUFuaW1hdGluZyA9IGZhbHNlOwotICAgICAgICAgICAgICAgIHVwZGF0ZUV4cGFuZGVkVmlld1BvcyhFWFBBTkRFRF9GVUxMX09QRU4pOwotICAgICAgICAgICAgICAgIHBlcmZvcm1FeHBhbmQoKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGVsc2U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YXQgeSA9IG1BbmltWTsKLSAgICAgICAgZmluYWwgZmxvYXQgdiA9IG1BbmltVmVsOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gcHgvcwotICAgICAgICBmaW5hbCBmbG9hdCBhID0gbUFuaW1BY2NlbDsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBweC9zL3MKLSAgICAgICAgbUFuaW1ZID0geSArICh2KnQpICsgKDAuNWYqYSp0KnQpOyAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gcHgKLSAgICAgICAgbUFuaW1WZWwgPSB2ICsgKGEqdCk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gcHgvcwotICAgICAgICBtQW5pbUxhc3RUaW1lID0gbm93OyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBtcwotICAgICAgICAvL1Nsb2cuZChUQUcsICJ5PSIgKyB5ICsgIiB2PSIgKyB2ICsgIiBhPSIgKyBhICsgIiB0PSIgKyB0ICsgIiBtQW5pbVk9IiArIG1BbmltWQotICAgICAgICAvLyAgICAgICAgKyAiIG1BbmltQWNjZWw9IiArIG1BbmltQWNjZWwpOwotICAgIH0KLQotICAgIHZvaWQgZG9SZXZlYWxBbmltYXRpb24oKSB7Ci0gICAgICAgIGZpbmFsIGludCBoID0gbUNsb3NlVmlldy5nZXRIZWlnaHQoKSArIG1TdGF0dXNCYXJWaWV3LmdldEhlaWdodCgpOwotICAgICAgICBpZiAobUFuaW1hdGluZ1JldmVhbCAmJiBtQW5pbWF0aW5nICYmIG1BbmltWSA8IGgpIHsKLSAgICAgICAgICAgIGluY3JlbWVudEFuaW0oKTsKLSAgICAgICAgICAgIGlmIChtQW5pbVkgPj0gaCkgewotICAgICAgICAgICAgICAgIG1BbmltWSA9IGg7Ci0gICAgICAgICAgICAgICAgdXBkYXRlRXhwYW5kZWRWaWV3UG9zKChpbnQpbUFuaW1ZKTsKLSAgICAgICAgICAgIH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bGlzKCk7Ci0gICAgICAgICAgICBtQW5pbUxhc3RUaW1lID0gbm93OwotICAgICAgICAgICAgbUN1ckFuaW1hdGlvblRpbWUgPSBub3cgKyBBTklNX0ZSQU1FX0RVUkFUSU9OOwotICAgICAgICAgICAgbUFuaW1hdGluZyA9IHRydWU7Ci0gICAgICAgICAgICBtSGFuZGxlci5zZW5kTWVzc2FnZUF0VGltZShtSGFuZGxlci5vYnRhaW5NZXNzYWdlKE1TR19BTklNQVRFX1JFVkVBTCksCi0gICAgICAgICAgICAgICAgICAgIG1DdXJBbmltYXRpb25UaW1lKTsKLSAgICAgICAgICAgIG1ha2VFeHBhbmRlZFZpc2libGUoKTsKLSAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgIC8vIGl0J3Mgb3BlbiwgY2xvc2UgaXQ/Ci0gICAgICAgICAgICBpZiAobUFuaW1hdGluZykgewotICAgICAgICAgICAgICAgIG1BbmltYXRpbmcgPSBmYWxzZTsKLSAgICAgICAgICAgICAgICBtSGFuZGxlci5yZW1vdmVNZXNzYWdlcyhNU0dfQU5JTUFURSk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICB1cGRhdGVFeHBhbmRlZFZpZXdQb3MoeSArIG1WaWV3RGVsdGEpOwotICAgICAgICB9Ci0gICAgfQotCi0gICAgdm9pZCBwZXJmb3JtRmxpbmcoaW50IHksIGZsb2F0IHZlbCwgYm9vbGVhbiBhbHdheXMpIHsKLSAgICAgICAgbUFuaW1hdGluZ1JldmVhbCA9IGZhbHNlOwotICAgICAgICBtRGlzcGxheUhlaWdodCA9IG1EaXNwbGF5LmdldEhlaWdodCgpOwotCi0gICAgICAgIG1BbmltWSA9IHk7Ci0gICAgICAgIG1BbmltVmVsID0gdmVsOwotCi0gICAgICAgIC8vU2xvZy5kKFRBRywgInN0YXJ0aW5nIHdpdGggbUFuaW1ZPSIgKyBtQW5pbVkgKyAiIG1BbmltVmVsPSIgKyBtQW5pbVZlbCk7Ci0KLSAgICAgICAgaWYgKG1FeHBhbmRlZCkgewotICAgICAgICAgICAgaWYgKCFhbHdheXMgJiYgKAotICAgICAgICAgICAgICAgICAgICB2ZWwgPiAyMDAuMGYKLSAgICAgICAgICAgICAgICAgICAgfHwgKHkgPiAobURpc3BsYXlIZWlnaHQtMjUpICYmIHZlbCA+IC0yMDAuMGYpKSkgewotICAgICAgICAgICAgICAgIC8vIFdlIGFyZSBleHBhbmRlZCwgYnV0IHRoZXkgZGlkbid0IG1vdmUgc3VmZmljaWVudGx5IHRvIGNhdXNlCi0gICAgICAgICAgICAgICAgLy8gdXMgdG8gcmV0cmFjdC4gIEFuaW1hdGUgYmFjayB0byB0aGUgZXhwYW5kZWQgcG9zaXRpb24uCi0gICAgICAgICAgICAgICAgbUFuaW1BY2NlbCA9IDIwMDAuMGY7Ci0gICAgICAgICAgICAgICAgaWYgKHZlbCA8IDApIHsKLSAgICAgICAgICAgICAgICAgICAgbUFuaW1WZWwgPSAwOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGVsc2UgewotICAgICAgICAgICAgICAgIC8vIFdlIGFyZSBleHBhbmRlZCBhbmQgYXJlIG5vdyBnb2luZyB0byBhbmltYXRlIGF3YXkuCi0gICAgICAgICAgICAgICAgbUFuaW1BY2NlbCA9IC0yMDAwLjBmOwotICAgICAgICAgICAgICAgIGlmICh2ZWwgPiAwKSB7Ci0gICAgICAgICAgICAgICAgICAgIG1BbmltVmVsID0gMDsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICBpZiAoYWx3YXlzIHx8ICgKLSAgICAgICAgICAgICAgICAgICAgdmVsID4gMjAwLjBmCi0gICAgICAgICAgICAgICAgICAgIHx8ICh5ID4gKG1EaXNwbGF5SGVpZ2h0LzIpICYmIHZlbCA+IC0yMDAuMGYpKSkgewotICAgICAgICAgICAgICAgIC8vIFdlIGFyZSBjb2xsYXBzZWQsIGFuZCB0aGV5IG1vdmVkIGVub3VnaCB0byBhbGxvdyB1cyB0bwotICAgICAgICAgICAgICAgIC8vIGV4cGFuZC4gIEFuaW1hdGUgaW4gdGhlIG5vdGlmaWNhdGlvbnMuCi0gICAgICAgICAgICAgICAgbUFuaW1BY2NlbCA9IDIwMDAuMGY7Ci0gICAgICAgICAgICAgICAgaWYgKHZlbCA8IDApIHsKLSAgICAgICAgICAgICAgICAgICAgbUFuaW1WZWwgPSAwOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGVsc2UgewotICAgICAgICAgICAgICAgIC8vIFdlIGFyZSBjb2xsYXBzZWQsIGJ1dCB0aGV5IGRpZG4ndCBtb3ZlIHN1ZmZpY2llbnRseSB0byBjYXVzZQotICAgICAgICAgICAgICAgIC8vIHVzIHRvIHJldHJhY3QuICBBbmltYXRlIGJhY2sgdG8gdGhlIGNvbGxhcHNlZCBwb3NpdGlvbi4KLSAgICAgICAgICAgICAgICBtQW5pbUFjY2VsID0gLTIwMDAuMGY7Ci0gICAgICAgICAgICAgICAgaWYgKHZlbCA+IDApIHsKLSAgICAgICAgICAgICAgICAgICAgbUFuaW1WZWwgPSAwOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgICAgICAvL1Nsb2cuZChUQUcsICJtQW5pbVk9IiArIG1BbmltWSArICIgbUFuaW1WZWw9IiArIG1BbmltVmVsCi0gICAgICAgIC8vICAgICAgICArICIgbUFuaW1BY2NlbD0iICsgbUFuaW1BY2NlbCk7Ci0KLSAgICAgICAgbG9uZyBub3cgPSBTeXN0ZW1DbG9jay51cHRpbWVNaWxsaXMoKTsKLSAgICAgICAgbUFuaW1MYXN0VGltZSA9IG5vdzsKLSAgICAgICAgbUN1ckFuaW1hdGlvblRpbWUgPSBub3cgKyBBTklNX0ZSQU1FX0RVUkFUSU9OOwotICAgICAgICBtQW5pbWF0aW5nID0gdHJ1ZTsKLSAgIC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XJTaXplIC0geTsKLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgbVRyYWNraW5nVmlldy5nZXRMb2NhdGlvbk9uU2NyZWVuKG1BYnNQb3MpOwotICAgICAgICAgICAgICAgIG1WaWV3RGVsdGEgPSBtQWJzUG9zWzFdICsgbVRyYWNraW5nVmlldy5nZXRIZWlnaHQoKSAtIHk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAoKCFtRXhwYW5kZWQgJiYgeSA8IGhpdFNpemUpIHx8Ci0gICAgICAgICAgICAgICAgICAgIChtRXhwYW5kZWQgJiYgeSA+IChtRGlzcGxheS5nZXRIZWlnaHQoKS1oaXRTaXplKSkpIHsKLQotICAgICAgICAgICAgICAgIC8vIFdlIGRyb3AgZXZlbnRzIGF0IHRoZSBlZGdlIG9mIHRoZSBzY3JlZW4gdG8gbWFrZSB0aGUgd2luZG93c2hhZGUgY29tZQotICAgICAgICAgICAgICAgIC8vIGRvd24gYnkgYWNjaWRlbnQgbGVzcywgZXNwZWNpYWxseSB3aGVuIHB1c2hpbmcgb3BlbiBhIGRldmljZSB3aXRoIGEga2V5Ym9hcmQKLSAgICAgICAgICAgICAgICAvLyB0aGF0IHJvdGF0ZXMgKGxpa2UgZzEgYW5kIGRyb2lkKQotICAgICAgICAgICAgICAgIGludCB4ID0gKGludClldmVudC5nZXRSYXdYKCk7Ci0gICAgICAgICAgICAgICAgZmluYWwgaW50IGVkZ2VCb3JkZXIgPSBtRWRnZUJvcmRlcjsKLSAgICAgICAgICAgICAgICBpZiAoeCA+PSBlZGdlQm9yZGVyICYmIHggPCBtRGlzcGxheS5nZXRXaWR0aCgpIC0gZWRnZUJvcmRlcikgewotICAgICAgICAgICAgICAgICAgICBwcmVwYXJlVHJhY2tpbmcoeSwgIW1FeHBhbmRlZCk7Ly8gb3BlbmluZyBpZiB3ZSdyZSBub3QgYWxyZWFkeSBmdWxseSB2aXNpYmxlCi0gICAgICAgICAgICAgICAgICAgIG1WZWxvY2l0eVRyYWNrZXIuYWRkTW92ZW1lbnQoZXZlbnQpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgfSBlbHNlIGlmIChtVHJhY2tpbmcpIHsKLSAgICAgICAgICAgIG1WZWxvY2l0eVRyYWNrZXIuYWRkTW92ZW1lbnQoZXZlbnQpOwotICAgICAgICAgICAgZmluYWwgaW50IG1pblkgPSBzdGF0dXNCYXJTaXplICsgbUNsb3NlVmlldy5nZXRIZWlnaHQoKTsKLSAgICAgICAgICAgIGlmIChldmVudC5nZXRBY3Rpb24oKSA9PSBNb3Rpb25FdmVudC5BQ1RJT05fTU9WRSkgewotICAgICAgICAgICAgICAgIGludCB5ID0gKGludClldmVudC5nZXRSYXdZKCk7Ci0gICAgICAgICAgICAgICAgaWYgKG1BbmltYXRpbmdSZXZlYWwgJiYgeSA8IG1pblkpIHsKLSAgICAgICAgICAgICAgICAgICAgLy8gbm90aGluZwotICAgICAgICAgICAgICAgIH0gZWxzZSAgewotICAgICAgICAgICAgICAgICAgICBtQW5pbWF0aW5nUmV2ZWFsID0gZmFsc2U7Ci0gICAgICAgICAgICAgICAgICAgIHVwZGF0ZUV4cGFuZGVkVmlld1Bvcyh5ICsgbVZpZXdEZWx0YSk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfSBlbHNlIGlmIChldmVudC5nZXRBY3Rpb24oKSA9PSBNb3Rpb25FdmVudC5BQ1RJT05fVVApIHsKLSAgICAgICAgICAgICAgICBtVmVsb2NpdHlUcmFja2VyLmNvbXB1dGVDdXJyZW50VmVsb2NpdHkoMTAwMCk7Ci0KLSAgICAgICAgICAgICAgICBmbG9hdCB5VmVsID0gbVZlbG9jaXR5VHJhY2tlci5nZXRZVmVsb2NpdHkoKTsKLSAgICAgICAgICAgICAgICBib29sZWFuIG5lZ2F0aXZlID0geVZlbCA8IDA7Ci0KLSAgICAgICAgICAgICAgICBmbG9hdCB4VmVsID0gbVZlbG9jaXR5VHJhY2tlci5nZXRYVmVsb2NpdHkoKTsKLSAgICAgICAgICAgICAgICBpZiAoeFZlbCA8IDApIHsKLSAgICAgICAgICAgICAgICAgICAgeFZlbCA9IC14VmVsOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBpZiAoeFZlbCA+IDE1MC4wZikgewotICAgICAgICAgICAgICAgICAgICB4VmVsID0gMTUwLjBmOyAvLyBsaW1pdCBob3cgbXVjaCB3ZSBjYXJlIGFib3V0IHRoZSB4IGF4aXMKLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICBmbG9hdCB2ZWwgPSAoZmxvYXQpTWF0aC5oeXBvdCh5VmVsLCB4VmVsKTsKLSAgICAgICAgICAgICAgICBpZiAobmVnYXRpdmUpIHsKLSAgICAgICAgICAgICAgICAgICAgdmVsID0gLXZlbDsKLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICBwZXJmb3JtRmxpbmcoKGludClldmVudC5nZXRSYXdZKCksIHZlbCwgZmFsc2UpOwotICAgICAgICAgICAgfQotCi0gICAgICAgIH0KLSAgICAgICAgcmV0dXJuIGZhbHNlOwotICAgIH0KLQotICAgIHByaXZhdGUgY2xhc3MgTGF1bmNoZXIgaW1wbGVtZW50cyBWaWV3Lk9uQ2xpY2tMaXN0ZW5lciB7Ci0gICAgICAgIHByaXZhdGUgUGVuZGluZ0ludGVudCBtSW50ZW50OwotICAgICAgICBwcml2YXRlIFN0cmluZyBtUGtnOwotICAgICAgICBwcml2YXRlIFN0cmluZyBtVGFnOwotICAgICAgICBwcml2YXRlIGludCBtSWQ7Ci0KLSAgICAgICAgTGF1bmNoZXIoUGVuZGluZ0ludGVudCBpbnRlbnQsIFN0cmluZyBwa2csIFN0cmluZyB0YWcsIGludCBpZCkgewotICAgICAgICAgICAgbUludGVudCA9IGludGVudDsKLSAgICAgICAgICAgIG1Qa2cgPSBwa2c7Ci0gICAgICAgICAgICBtVGFnID0gdGFnOwotICAgICAgICAgICAgbUlkID0gaWQ7Ci0gICAgICAgIH0KLQotICAgICAgICBwdWJsaWMgdm9pZCBvbkNsaWNrKFZpZXcgdikgewotICAgICAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgICAgICAvLyBUaGUgaW50ZW50IHdlIGFyZSBzZW5kaW5nIGlzIGZvciB0aGUgYXBwbGljYXRpb24sIHdoaWNoCi0gICAgICAgICAgICAgICAgLy8gd29uJ3QgaGF2ZSBwZXJtaXNzaW9uIHRvIGltbWVkaWF0ZWx5IHN0YXJ0IGFuIGFjdGl2aXR5IGFmdGVyCi0gICAgICAgICAgICAgICAgLy8gdGhlIHVzZXIgc3dpdGNoZXMgdG8gaG9tZS4gIFdlIGtub3cgaXQgaXMgc2FmZSB0byBkbyBhdCB0aGlzCi0gICAgICAgICAgICAgICAgLy8gcG9pbnQsIHNvIG1ha2Ugc3VyZSBuZXcgYWN0aXZpdHkgc3dpdGNoZXMgYXJlIG5vdyBhbGxvd2VkLgotICAgICAgICAgICAgICAgIEFjdGl2aXR5TWFuYWdlck5hdGl2ZS5nZXREZWZhdWx0KCkucmVzdW1lQXBwU3dpdGNoZXMoKTsKLSAgICAgICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBlKSB7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIGlmIChtSW50ZW50ICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICBpbnRbXSBwb3MgPSBuZXcgaW50WzJdOwotICAgICAgICAgICAgICAgIHYuZ2V0TG9jYXRpb25PblNjcmVlbihwb3MpOwotICAgICAgICAgICAgICAgIEludGVudCBvdmVybGF5ID0gbmV3IEludGVudCgpOwotICAgICAgICAgICAgICAgIG92ZXJsYXkuc2V0U291cmNlQm91bmRzKAotICAgICAgICAgICAgICAgICAgICAgICAgbmV3IFJlY3QocG9zWzBdLCBwb3NbMV0sIHBvc1swXSt2LmdldFdpZHRoKCksIHBvc1sxXSt2LmdldEhlaWdodCgpKSk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dCwgbnVsbCkpOwotICAgICAgICAgICAgaWYgKG1FeHBhbmRlZFZpc2libGUpIHsKLSAgICAgICAgICAgICAgICBzZXREYXRlVmlld1Zpc2liaWxpdHkoZmFsc2UsIGNvbS5hbmRyb2lkLmludGVybmFsLlIuYW5pbS5wdXNoX3VwX291dCk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQotICAgICAgICBAT3ZlcnJpZGUKLSAgICAgICAgdm9pZCB0aWNrZXJEb25lKCkgewotICAgICAgICAgICAgbUljb25zLnNldFZpc2liaWxpdHkoVmlldy5WSVNJQkxFKTsKLSAgICAgICAgICAgIG1UaWNrZXJWaWV3LnNldFZpc2liaWxpdHkoVmlldy5HT05FKTsKLSAgICAgICAgICAgIG1JY29ucy5zdGFydEFuaW1hdGlvbihsb2FkQW5pbShjb20uYW5kcm9pZC5pbnRlcm5hbC5SLmFuaW0ucHVzaF9kb3duX2luLCBudWxsKSk7Ci0gICAgICAgICAgICBtVGlja2VyVmlldy5zdGFydEFuaW1hdGlvbihsb2FkQW5pbShjb20uYW5kcm9pZC5pbnRlcm5hbC5SLmFuaW0ucHVzaF9kb3duX291dCwKLSAgICAgICAgICAgICAgICAgICAgICAgIG1UaWNraW5nRG9uZUxpc3RlbmVyKSk7Ci0gICAgICAgICAgICBpZiAobUV4cGFuZGVkVmlzaWJsZSkgewotICAgICAgICAgICAgICAgIHNldERhdGVWaWV3VmlzaWJpbGl0eSh0cnVlLCBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLmFuaW0ucHVzaF9kb3duX2luKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCi0gICAgICAgIHZvaWQgdGlja2VySGFsdGluZygpIHsKLSAgICAgICAgICAgIG1JY29ucy5zZXRWaXNpYmlsaXR5KFZpZXcuVklTSUJMRSk7Ci0gICAgICAgICAgICBtVGlja2VyVmlldy5zZXRWaXNpYmlsaXR5KFZpZXcuR09ORSk7Ci0gICAgICAgICAgICBtSWNvbnMuc3RhcnRB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0YXR1c0JhclNlcnZpY2UudGhpcywgaWQpOwotICAgICAgICBpZiAobGlzdGVuZXIgIT0gbnVsbCkgewotICAgICAgICAgICAgYW5pbS5zZXRBbmltYXRpb25MaXN0ZW5lcihsaXN0ZW5lcik7Ci0gICAgICAgIH0KLSAgICAgICAgcmV0dXJuIGFuaW07Ci0gICAgfQotCi0gICAgcHVibGljIFN0cmluZyB2aWV3SW5mbyhWaWV3IHYpIHsKLSAgICAgICAgcmV0dXJuICIoIiArIHYuZ2V0TGVmdCgpICsgIiwiICsgdi5nZXRUb3AoKSArICIpKCIgKyB2LmdldFJpZ2h0KCkgKyAiLCIgKyB2LmdldEJvdHRvbSgpCi0gICAgICAgICAgICAgICAgKyAiICIgKyB2LmdldFdpZHRoKCkgKyAieCIgKyB2LmdldEhlaWdodCgpICsgIikiOwotICAgIH0KLQotICAgIHByb3RlY3RlZCB2b2lkIGR1bXAoRmlsZURlc2NyaXB0b3IgZmQsIFByaW50V3JpdGVyIHB3LCBTdHJpbmdbXSBhcmdzKSB7Ci0gICAgICAgIGlmIChjaGVja0NhbGxpbmdPclNlbGZQZXJtaXNzaW9uKGFuZHJvaWQuTWFuaWZlc3QucGVybWlzc2lvbi5EVU1QKQotICAgICAgICAgICAgICAgICE9IFBhY2thZ2VNYW5hZ2VyLlBFUk1JU1NJT05fR1JBTlRFRCkgewotICAgICAgICAgICAgcHcucHJpbnRsbigiUGVybWlzc2lvbiBEZW5pYWw6IGNhbid0IGR1bXAgU3RhdHVzQmFyIGZyb20gZnJvbSBwaWQ9IgotICAgICAgICAgICAgICAgICAgICArIEJpbmRlci5nZXRDYWxsaW5nUGlkKCkKLSAgICAgICAgICAgICAgICAgICAgKyAiLCB1aWQ9IiArIEJpbmRlci5nZXRDYWxsaW5nVWlkKCkpOwotICAgICAgICAgICAgcmV0dXJuOwotICAgICAgICB9Ci0KLSAgICAgICAgc3luY2hyb25pemVkIChtUXVldWVMb2NrKSB7Ci0gICAgICAgICAgICBwdy5wcmludGxuKCJDdXJyZW50IFN0YXR1cyBCYXIgc3RhdGU6Iik7Ci0gICAgICAgICAgICBwdy5wcmludGxuKCIgIG1FeHBhbmRlZD0iICsgbUV4cGFuZGVkCi0gICAgICAgICAgICAgICAgICAgICsgIiwgbUV4cGFuZGVkVmlzaWJsZT0iICsgbUV4cGFuZGVkVmlzaWJsZSk7Ci0gICAgICAgICAgICBwdy5wcmludGxuKCIgIG1UaWNraW5nPSIgKyBtVGlja2luZyk7Ci0gICAgICAgICAgICBwdy5wcmludGxuKCIgIG1UcmFja2luZz0iICsgbVRyYWNraW5nKTsKLSAgICAgICAgICAgIHB3LnByaW50bG4oIiAgbUFuaW1hdGluZz0iICsgbUFuaW1hdGluZwotICAgICAgICAgICAgICAgICAgICArICIsIG1BbmltWT0iICsgbUFuaW1ZICsgIiwgbUFuaW1WZWw9IiArIG1BbmltVmVsCi0gICAgICAgICAgICAgICAgICAgICsgIiwgbUFuaW1BY2NlbD0iICsgbUFuaW1BY2NlbCk7Ci0gICAgICAgICAgICBwdy5wcmludGxuKCIgIG1DdXJBbmltYXRpb25UaW1lPSIgKyBtQ3VyQW5pbWF0aW9uVGltZQotICAgICAgICAgICAgICAgICAgICArICIgbUFuaW1MYXN0VGltZT0iICsgbUFuaW1MYXN0VGltZSk7Ci0gICAgICAgICAgICBwdy5wcmludGxuKCIgIG1EaXNwbGF5SGVpZ2h0PSIgKyBtRGlzcGxheUhlaWdodAotICAgICAgICAgICAgICAgICAgICArICIgbUFuaW1hdGluZ1JldmVhbD0iICsgbUFuaW1hdGluZ1JldmVhbAotICAgICAgICAgICAgICAgICAgICArICIgbVZpZXdEZWx0YT0iICsgbVZpZXdEZWx0YSk7Ci0gICAgICAgICAgICBwdy5wcmludGxuKCIgIG1EaXNwbGF5SGVpZ2h0PSIgKyBtRGlzcGxheUhlaWdodCk7Ci0gICAgICAgICAgICBwdy5wcmludGxuKCIgIG1FeHBhbmRlZFBhcmFtczogIiArIG1FeHBhbmRlZFBhcmFtcyk7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W5mbyhtU2Nyb2xsVmlldykKLSAgICAgICAgICAgICAgICAgICAgKyAiIHNjcm9sbCAiICsgbVNjcm9sbFZpZXcuZ2V0U2Nyb2xsWCgpICsgIiwiICsgbVNjcm9sbFZpZXcuZ2V0U2Nyb2xsWSgpKTsKLSAgICAgICAgICAgIHB3LnByaW50bG4oIm1Ob3RpZmljYXRpb25MaW5lYXJMYXlvdXQ6ICIgKyB2aWV3SW5mbyhtTm90aWZpY2F0aW9uTGluZWFyTGF5b3V0KSk7Ci0gICAgICAgIH0KLSAgICAgICAgLyoKLSAgICAgICAgc3luY2hyb25pemVkIChtTm90aWZpY2F0aW9uRGF0YSkgewotICAgICAgICAgICAgaW50IE4gPSBtTm90aWZpY2F0aW9uRGF0YS5vbmdvaW5nQ291bnQoKTsKLSAgICAgICAgICAgIHB3LnByaW50bG4oIiAgb25nb2luZ0NvdW50LnNpemU9IiArIE4pOwotICAgICAgICAgICAgZm9yIChpbnQgaT0wOyBpPE47IGkrKykgewotICAgICAgICAgICAgICAgIFN0YXR1c0Jhck5vdGlmaWNhdGlvbiBuID0gbU5vdGlmaWNhdGlvbkRhdGEuZ2V0T25nb2luZyhpKTsKLSAgICAgICAgICAgICAgICBwdy5wcmludGxuKCIgICAgWyIgKyBpICsgIl0ga2V5PSIgKyBuLmtleSArICIgdmlldz0iICsgbi52aWV3KTsKLSAgICAgICAgICAgICAgICBwdy5wcmludGxuKCIgICAgICAgICAgIGRhdGE9IiArIG4uZGF0YSk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBOID0gbU5vdGlmaWNhdGlvbkRhdGEubGF0ZXN0Q291bnQoKTsKLSAgICAgICAgICAgIHB3LnByaW50bG4oIiAgb25nb2luZ0NvdW50LnNpemU9IiArIE4pOwotICAgICAgICAgICAgZm9yIChpbnQgaT0wOyBpPE47IGkrKykgewotICAgICAgICAgICAgICAgIFN0YXR1c0Jhck5vdGlmaWNhdGlvbiBuID0gbU5vdGlmaWNhdGlvbkRhdGEuZ2V0TGF0ZXN0KGkpOwotICAgICAgICAgICAgICAgIHB3LnByaW50bG4oIiAgICBbIiArIGkgKyAiXSBrZXk9IiArIG4ua2V5ICsgIiB2aWV3PSIgKyBuLnZpZXcpOwotICAgICAgICAgICAgICAgIHB3LnByaW50bG4oIiAgICAgICAgICAgZGF0YT0iICsgbi5kYXRhKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgICAgICAqLwotCi0gICAgICAgIGlmIChmYWxzZSkgewotICAgICAgICAgICAgcHcucHJpbnRsbigic2VlIHRoZSBsb2djYXQgZm9yIGEgZHVtcCBvZiB0aGUgdmlld3Mgd2UgaGF2ZSBjcmVhdGVkLiIpOwotICAgICAgICAgICAgLy8gbXVzdCBoYXBwZW4gb24gdWkgdGhyZWFkCi0gICAgICAgICAgICBtSGFuZGxlci5wb3N0KG5ldyBSdW5uYWJsZSgpIHsKLSAgICAgICAgICAgICAgICAgICAgcHVibGljIHZvaWQgcnVuKCkgewotICAgICAgICAgICAgICAgICAgICAgICAgbVN0YXR1c0JhclZpZXcuZ2V0TG9jYXRpb25PblNjcmVlbihtQWJzUG9zKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIFNsb2cuZChUQUcsICJtU3RhdHVzQmFyVmlldzogLS0tLS0gKCIgKyBtQWJzUG9zWzBdICsgIiwiICsgbUFic1Bvc1sxXQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArICIpICIgKyBtU3RhdHVzQmFyVmlldy5nZXRXaWR0aCgpICsgIngiCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgbVN0YXR1c0JhclZpZXcuZ2V0SGVpZ2h0KCkpOwotICAgICAgICAgICAgICAgICAgICAgICAgbVN0YXR1c0JhclZpZXcuZGVidWcoKTsKLQotICAgICAgICAgICAgICAgICAgICAgICAgbUV4cGFuZGVkVmlldy5nZXRMb2NhdGlvbk9uU2NyZWVuKG1BYnNQb3MpOwotICAgICAgICAgICAgICAgICAgICAgICAgU2xvZy5kKFRBRywgIm1FeHBhbmRlZFZpZXc6IC0tLS0tICgiICsgbUFic1Bvc1swXSArICIsIiArIG1BYnNQb3NbMV0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyAiKSAiICsgbUV4cGFuZGVkVmlldy5nZXRXaWR0aCgpICsgIngiCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgbUV4cGFuZGVkVmlldy5nZXRIZWlnaHQoKSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBtRXhwYW5kZWRWaWV3LmRlYnVnKCk7Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgIG1UcmFja2luZ1ZpZXcuZ2V0TG9jYXRpb25PblNjcmVlbihtQWJzUG9zKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIFNsb2cuZChUQUcsICJtVHJhY2tpbmdWaWV3OiAtLS0tLSAoIiArIG1BYnNQb3NbMF0gKyAiLCIgKyBtQWJzUG9zWzFdCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgIikgIiArIG1UcmFja2luZ1ZpZXcuZ2V0V2lkdGgoKSArICJ4IgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIG1UcmFja2luZ1ZpZXcuZ2V0SGVpZ2h0KCkpOwotICAgICAgICAgICAgICAgICAgICAgICAgbVRyYWNraW5nVmlldy5kZWJ1ZygpOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfSk7Ci0gICAgICAgIH0KLSAgICB9Ci0KLSAgICB2b2lkIG9uQmFyVmlld0F0dGFjaGVkKCkgewotICAgICAgICBXaW5kb3dNYW5hZ2VyLkxheW91dFBhcmFtcyBscDsKLSAgICAgICAgaW50IHBpeGVsRm9ybWF0OwotICAgICAgICBEcmF3YWJsZSBiZzsKLQotICAgICAgICAvLy8gLS0tLS0tLS0tLSBUcmFja2luZyBWaWV3IC0tLS0tLS0tLS0tLS0tCi0gICAgICAgIHBpeGVsRm9ybWF0ID0gUGl4ZWxG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kUG9zaXRpb249IiArIGV4cGFuZGVkUG9zaXRpb24KLSAgICAgICAgICAgICAgICAgICAgKyAiIG1UcmFja2luZ1BhcmFtcy55PSIgKyBtVHJhY2tpbmdQYXJhbXMueQotICAgICAgICAgICAgICAgICAgICArICIgbVRyYWNraW5nUG9zaXRpb249IiArIG1UcmFja2luZ1Bvc2l0aW9uKTsKLSAgICAgICAgfQotCi0gICAgICAgIGludCBoID0gbVN0YXR1c0JhclZpZXcuZ2V0SGVpZ2h0KCk7Ci0gICAgICAgIGludCBkaXNwaCA9IG1EaXNwbGF5LmdldEhlaWdodCgpOwotCi0gICAgICAgIC8vIElmIHRoZSBleHBhbmRlZCB2aWV3IGlzIG5vdCB2aXNpYmxlLCBtYWtlIHN1cmUgdGhleSdyZSBzdGlsbCBvZmYgc2NyZWVuLgotICAgICAgICAvLyBNYXliZSB0aGUgdmlldyB3YXMgcmVzaXplZC4KLSAgICAgICAgaWYgKCFtRXhwYW5kZWRWaXNpYmxlKSB7Ci0gICAgICAgICAgICBpZiAobVRyYWNraW5nVmlldyAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgbVRyYWNraW5nUG9zaXRpb24gPSAtZGlzcGg7Ci0gICAgICAgICAgICAgICAgaWYgKG1UcmFja2luZ1BhcmFtcyAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIG1UcmFja2luZ1BhcmFtcy55ID0gbVRyYWNraW5nUG9zaXRpb247Ci0gICAgICAgICAgICAgICAgICAgIFdpbmRvd01hbmFnZXJJbXBsLmdldERlZmF1bHQoKS51cGRhdGVWaWV3TGF5b3V0KG1UcmFja2luZ1ZpZXcsIG1UcmFja2luZ1BhcmFtcyk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKG1FeHBhbmRlZFBhcmFtcyAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgbUV4cGFuZGVkUGFyYW1zLnkgPSAtZGlzcGg7Ci0gICAgICAgICAgICAgICAgbUV4cGFuZGVkRGlhbG9nLmdldFdpbmRvdygpLnNldEF0dHJpYnV0ZXMobUV4cGFuZGVkUGFyYW1zKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgfQotCi0gICAgICAgIC8vIHRyYWNraW5nIHZpZXcuLi4KLSAgICAgICAgaW50IHBvczsKLSAgICAgICAgaWYgKGV4cGFuZGVkUG9zaXRpb24gPT0gRVhQQU5ERURfRlVMTF9PUEVOKSB7Ci0gICAgICAgICAgICBwb3MgPSBoOwotICAgICAgICB9Ci0gICAgICAgIGVsc2UgaWYgKGV4cGFuZGVkUG9zaXRpb24gPT0gRVhQQU5ERURfTEVBVkVfQUxPTkUpIHsKLSAgICAgICAgICAgIHBvcyA9IG1UcmFja2luZ1Bvc2l0aW9uOwotICAgICAgICB9Ci0gICAgICAgIGVsc2UgewotICAgICAgICAgICAgaWYgKGV4cGFuZGVkUG9zaXRpb24gPD0gZGlzcGgpIHsKLSAgICAgICAgICAgICAgICBwb3MgPSBleHBhbmRlZFBvc2l0aW9uOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBwb3MgPSBkaXNwaDsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHBvcyAtPSBkaXNwaC1oOwotICAgICAgICB9Ci0gICAgICAgIG1UcmFja2luZ1Bvc2l0aW9uID0gbVRyYWNraW5nUGFyYW1zLnkgPSBwb3M7Ci0gICAgICAgIG1UcmFja2luZ1BhcmFtcy5oZWlnaHQgPSBkaXNwaC1oOwotICAgICAgICBXaW5kb3dNYW5hZ2VySW1wbC5nZXREZWZhdWx0KCkudXBkYXRlVmlld0xheW91dChtVHJhY2tpbmdWaWV3LCBtVHJhY2tpbmdQYXJhbXMpOwotCi0gICAgICAgIGlmIChtRXhwYW5kZWRQYXJhbXMgIT0gbnVsbCkgewotICAgICAgICAgICAgbUNsb3NlVmlldy5nZXRMb2NhdGlvbkluV2luZG93KG1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ICAgIGlmICgobmV0ICYgU3RhdHVzQmFyTWFuYWdlci5ESVNBQkxFX0VYUEFORCkgIT0gMCkgewotICAgICAgICAgICAgICAgIFNsb2cuZChUQUcsICJESVNBQkxFX0VYUEFORDogeWVzIik7Ci0gICAgICAgICAgICAgICAgYW5pbWF0ZUNvbGxhcHNlKCk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLSAgICAgICAgaWYgKChkaWZmICYgU3RhdHVzQmFyTWFuYWdlci5ESVNBQkxFX05PVElGSUNBVElPTl9JQ09OUykgIT0gMCkgewotICAgICAgICAgICAgaWYgKChuZXQgJiBTdGF0dXNCYXJNYW5hZ2VyLkRJU0FCTEVfTk9USUZJQ0FUSU9OX0lDT05TKSAhPSAwKSB7Ci0gICAgICAgICAgICAgICAgU2xvZy5kKFRBRywgIkRJU0FCTEVfTk9USUZJQ0FUSU9OX0lDT05TOiB5ZXMiKTsKLSAgICAgICAgICAgICAgICBpZiAobVRpY2tpbmcpIHsKLSAgICAgICAgICAgICAgICAgICAgbU5vdGlmaWNhdGlvbkljb25zLnNldFZpc2liaWxpdHkoVmlldy5JTlZJU0lCTEUpOwotICAgICAgICAgICAgICAgICAgICBtVGlja2VyLmhhbHQoKTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICBzZXROb3RpZmljYXRpb25JY29uVmlzaWJpbGl0eShmYWxzZSwgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5hbmltLmZhZGVfb3V0KTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIFNsb2cuZChUQUcsICJESVNBQkxFX05PVElGSUNBVElPTl9JQ09OUzogbm8iKTsKLSAgICAgICAgICAgICAgICBpZiAoIW1FeHBhbmRlZFZpc2libGUpIHsKLSAgICAgICAgICAgICAgICAgICAgc2V0Tm90aWZpY2F0aW9uSWNvblZpc2liaWxpdHkodHJ1ZSwgY29tLmFuZHJvaW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b2FkY2FzdFJlY2VpdmVyKCkgeworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIHZvaWQgb25SZWNlaXZlKENvbnRleHQgY29udGV4dCwgSW50ZW50IGludGVudCkgeworICAgICAgICAgICAgZmluYWwgU3RyaW5nIGFjdGlvbiA9IGludGVudC5nZXRBY3Rpb24oKTsKKyAgICAgICAgICAgIGlmIChhY3Rpb24uZXF1YWxzKEF1ZGlvTWFuYWdlci5SSU5HRVJfTU9ERV9DSEFOR0VEX0FDVElPTikpIHsKKyAgICAgICAgICAgICAgICBtU291bmRCdXR0b24uc2V0QWxwaGEoZ2V0U2lsZW50TW9kZSgpID8gMHg3RiA6IDB4RkYpOworICAgICAgICAgICAgfSBlbHNlIGlmIChhY3Rpb24uZXF1YWxzKEludGVudC5BQ1RJT05fQkFUVEVSWV9DSEFOR0VEKSkgeworICAgICAgICAgICAgICAgIHVwZGF0ZUJhdHRlcnkoaW50ZW50KTsKKyAgICAgICAgICAgIH0gZWxzZSBpZiAoYWN0aW9uLmVxdWFscyhXaWZpTWFuYWdlci5SU1NJX0NIQU5HRURfQUNUSU9OKQorICAgICAgICAgICAgICAgICAgICB8fCBhY3Rpb24uZXF1YWxzKFdpZmlNYW5hZ2VyLldJRklfU1RBVEVfQ0hBTkdFRF9BQ1RJT04pCisgICAgICAgICAgICAgICAgICAgIHx8IGFjdGlvbi5lcXVhbHMoV2lmaU1hbmFnZXIuU1VQUExJQ0FOVF9TVEFURV9DSEFOR0VEX0FDVElPTikKKyAgICAgICAgICAgICAgICAgICAgfHwgYWN0aW9uLmVxdWFscyhXaWZpTWFuYWdlci5ORVRXT1JLX1NUQVRFX0NIQU5HRURfQUNUSU9OKSkgeworICAgICAgICAgICAgICAgIHVwZGF0ZVdpZmkoaW50ZW50KTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH07CisKKyAgICBib29sZWFuIG1XaWZpRW5hYmxlZCwgbVdpZmlDb25uZWN0ZWQ7CisgICAg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ICAgICAgICAgICAgU2xvZy5kKFRhYmxldFN0YXR1c0JhclNlcnZpY2UuVEFHLCAidXBkYXRlV2lmaToganVzdCBjb25uZWN0ZWQ6IGluZm89IiArIGluZm8pOworCisgICAgICAgICAgICBpZiAoaW5mbyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgLy8gZ3JhYiB0aGUgaW5pdGlhbCBzaWduYWwgc3RyZW5ndGgKKyAgICAgICAgICAgICAgICBtV2lmaUxldmVsID0gV2lmaU1hbmFnZXIuY2FsY3VsYXRlU2lnbmFsTGV2ZWwoaW5mby5nZXRSc3NpKCksIDEwMSk7CisKKyAgICAgICAgICAgICAgICAvLyBmaW5kIHRoZSBTU0lECisgICAgICAgICAgICAgICAgbVdpZmlTc2lkID0gaW5mby5nZXRTU0lEKCk7CisgICAgICAgICAgICAgICAgaWYgKG1XaWZpU3NpZCA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIC8vIE9LLCBpdCdzIG5vdCBpbiB0aGUgY29ubmVjdGlvbkluZm87IHdlIGhhdmUgdG8gZ28gaHVudGluZyBmb3IgaXQKKyAgICAgICAgICAgICAgICAgICAgTGlzdDxXaWZpQ29uZmlndXJhdGlvbj4gbmV0d29ya3MgPSBtV2lmaU1hbmFnZXIuZ2V0Q29uZmlndXJlZE5ldHdvcmtzKCk7CisgICAgICAgICAgICAgICAgICAgIGZvciAoV2lmaUNvbmZpZ3VyYXRpb24gbmV0IDogbmV0d29ya3MpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuZXQubmV0d29ya0lkID09IGluZm8uZ2V0TmV0d29ya0lkKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBtV2lmaVNzaWQgPSBuZXQuU1NJRDsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIGlmICghbVdpZmlFbmFibGVkKSB7CisgICAgICAgICAgICBtV2lmaVNzaWQgPSAiZGlzYWJsZWQiOworICAgICAgICAgICAgbVdpZmlMZXZlbCA9IDA7CisgICAgICAgIH0gZWxzZSBpZiAoIW1XaWZpQ29ubmVjdGVkKSB7CisgICAgICAgICAgICBtV2lmaVNzaWQgPSAiZGlzY29ubmVjdGVkIjsKKyAgICAgICAgICAgIG1XaWZpTGV2ZWwgPSAwOworICAgICAgICB9IGVsc2UgaWYgKG1XaWZpU3NpZCA9PSBudWxsKSB7CisgICAgICAgICAgICBtV2lmaVNzaWQgPSAidW5rbm93biI7CisgICAgICAgIH0KKworICAgICAgICBtU2lnbmFsTWV0ZXIuc2V0SW1hZ2VSZXNvdXJjZShSLmRyYXdhYmxlLnNpZ25hbCk7CisgICAgICAgIG1TaWduYWxNZXRlci5zZXRJbWFnZUxldmVsKG1XaWZpTGV2ZWwpOworICAgICAgICBtU2lnbmFsVGV4dC5zZXRUZXh0KFN0cmluZy5mb3JtYXQoIldpLUZpOiAlcyIsIG1XaWZpU3NpZCkpOyAvLyBYWFg6IGxvY2FsaXplCisKKyAgICAgICAgLy8gaGFjayBmb3Igbm93CisgICAgICAgIG1CYXIuc2V0V2lmaU1ldGVyKG1XaWZpTGV2ZWwpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHNldEJhcihUYWJsZXRTdGF0dXNCYXJTZXJ2aWNlIGJhcikgeworICAgICAgICBtQmFyID0gYmFyOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHVwZGF0ZUJhdHRlcnkoSW50ZW50IGludGVudCkgeworICAgICAgICBmaW5hbCBpbnQgbGV2ZWwgPSBpbnRlbnQuZ2V0SW50RXh0cmEoImxldmVsIiwgMCk7CisgICAgICAgIGZpbmFsIGJvb2xlYW4gcGx1Z2dlZCA9IGludGVudC5nZXRJbnRFeHRyYSgicGx1Z2dlZCIsIDApICE9IDA7CisKKyAgICAgICAgb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dGVuZXIoKSB7CisgICAgICAgICAgICBwdWJsaWMgdm9pZCBvbkNsaWNrKFZpZXcgdikgeworICAgICAgICAgICAgICAgIHJvdGF0ZUJyaWdodG5lc3MoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfSk7CisKKyAgICAgICAgbVNvdW5kQnV0dG9uID0gKEltYWdlQnV0dG9uKWZpbmRWaWV3QnlJZChSLmlkLnNvdW5kKTsKKyAgICAgICAgbVNvdW5kQnV0dG9uLnNldE9uQ2xpY2tMaXN0ZW5lcihuZXcgVmlldy5PbkNsaWNrTGlzdGVuZXIoKSB7CisgICAgICAgICAgICBwdWJsaWMgdm9pZCBvbkNsaWNrKFZpZXcgdikgeworICAgICAgICAgICAgICAgIHNldFNpbGVudE1vZGUoIWdldFNpbGVudE1vZGUoKSk7CisgICAgICAgICAgICAgICAgbVNvdW5kQnV0dG9uLnNldEFscGhhKGdldFNpbGVudE1vZGUoKSA/IDB4N0YgOiAweEZGKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfSk7CisgICAgICAgIG1PcmllbnRhdGlvbkJ1dHRvbiA9IChJbWFnZUJ1dHRvbilmaW5kVmlld0J5SWQoUi5pZC5vcmllbnRhdGlvbik7CisgICAgICAgIG1PcmllbnRhdGlvbkJ1dHRvbi5zZXRPbkNsaWNrTGlzdGVuZXIobmV3IFZpZXcuT25DbGlja0xpc3RlbmVyKCkgeworICAgICAgICAgICAgcHVibGljIHZvaWQgb25DbGljayhWaWV3IHYpIHsKKyAgICAgICAgICAgICAgICBUb2FzdC5tYWtlVGV4dChnZXRDb250ZXh0KCksICJPcmllbnRhdGlvbiBjb250cm9sIG5vdCBpbXBsZW1lbnRlZDsgcGxlYXNlIGFkanVzdCBuZWNrIGFuZ2xlLiIsIFRvYXN0LkxFTkdUSF9TSE9SVCkuc2hvdygpOworICAgICAgICAgICAgfQorICAgICAgICB9KTsKKworICAgICAgICBtQWlycGxhbmVCdXR0b24gPSAoSW1hZ2VCdXR0b24pZmluZFZ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0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQorCisvLyAgICBwcml2YXRlIGJvb2xlYW4gaXNBdXRvQnJpZ2h0bmVzcygpIHsKKy8vICAgICAgICBDb250ZXh0IGNvbnRleHQgPSBnZXRDb250ZXh0KCk7CisvLyAgICAgICAgdHJ5IHsKKy8vICAgICAgICAgICAgSVBvd2VyTWFuYWdlciBwb3dlciA9IElQb3dlck1hbmFnZXIuU3R1Yi5hc0ludGVyZmFjZSgKKy8vICAgICAgICAgICAgICAgICAgICBTZXJ2aWNlTWFuYWdlci5nZXRTZXJ2aWNlKCJwb3dlciIpKTsKKy8vICAgICAgICAgICAgaWYgKHBvd2VyICE9IG51bGwpIHsKKy8vICAgICAgICAgICAgICAgIGludCBicmlnaHRuZXNzTW9kZSA9IFNldHRpbmdzLlN5c3RlbS5nZXRJbnQoY29udGV4dC5nZXRDb250ZW50UmVzb2x2ZXIoKSwKKy8vICAgICAgICAgICAgICAgICAgICAgICAgU2V0dGluZ3MuU3lzdGVtLlNDUkVFTl9CUklHSFRORVNTX01PREUpOworLy8gICAgICAgICAgICAgICAgcmV0dXJuIGJyaWdodG5lc3NNb2RlID09IFNldHRpbmdzLlN5c3RlbS5TQ1JFRU5fQlJJR0hUTkVTU19NT0RFX0FVVE9NQVRJQzsKKy8vICAgICAgICAgICAgfQorLy8gICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBlKSB7CisvLyAgICAgICAgfSBjYXRjaCAoU2V0dGluZ3MuU2V0dGluZ05vdEZvdW5kRXhjZXB0aW9uIGUpIHsKKy8vICAgICAgICB9CisvLyAgICAgICAgcmV0dXJuIGZhbHNlOworLy8gICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIHJvdGF0ZUJyaWdodG5lc3MoKSB7CisgICAgICAgIGludCBhbHBoYSA9IDB4RkY7CisgICAgICAgIENvbnRleHQgY29udGV4dCA9IGdldENvbnRleHQoKTsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIElQb3dlck1hbmFnZXIgcG93ZXIgPSBJUG93ZXJNYW5hZ2VyLlN0dWIuYXNJbnRlcmZhY2UoCisgICAgICAgICAgICAgICAgICAgIFNlcnZpY2VNYW5hZ2VyLmdldFNlcnZpY2UoInBvd2VyIikpOworICAgICAgICAgICAgaWYgKHBvd2VyICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBDb250ZW50UmVzb2x2ZXIgY3IgPSBjb250ZXh0LmdldENvbnRlbnRSZXNvbHZlcigpOworICAgICAgICAgICAgICAgIGludCBicmlnaHRuZXNzID0gU2V0dGluZ3MuU3lzdGVtLmdldEludChjciwKKyAgICAgICAgICAgICAgICAgICAgICAgIFNldHRpbmdzLlN5c3RlbS5TQ1JFRU5fQlJJR0hUTkVTUyk7CisgICAgICAgICAgICAgICAgaW50IGJyaWdodG5lc3NNb2RlID0gU2V0dGluZ3MuU3lzdGVtLlNDUkVFTl9CUklHSFRORVNTX01PREVfTUFOVUFMOworICAgICAgICAgICAgICAgIC8vT25seSBnZXQgYnJpZ2h0bmVzcyBzZXR0aW5nIGlmIGF2YWlsYWJsZQorICAgICAgICAgICAgICAgIGlmIChjb250ZXh0LmdldFJlc291cmNlcygpLmdldEJvb2xlYW4oCisgICAgICAgICAgICAgICAgICAgICAgICBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLmJvb2wuY29uZmlnX2F1dG9tYXRpY19icmlnaHRuZXNzX2F2YWlsYWJsZSkpIHsKKyAgICAgICAgICAgICAgICAgICAgYnJpZ2h0bmVzc01vZGUgPSBTZXR0aW5ncy5TeXN0ZW0uZ2V0SW50KGNyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNldHRpbmdzLlN5c3RlbS5TQ1JFRU5fQlJJR0hUTkVTU19NT0RFKTsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAvLyBSb3RhdGUgQVVUTyAtPiBNSU5JTVVNIC0+IERFRkFVTFQgLT4gTUFYSU1VTQorICAgICAgICAgICAgICAgIC8vIFRlY2huaWNhbGx5LCBub3QgYSB0b2dnbGUuLi4KKyAgICAgICAgICAgICAgICBpZiAoYnJpZ2h0bmVzc01vZGUgPT0gU2V0dGluZ3MuU3lzdGVtLlNDUkVFTl9CUklHSFRORVNTX01PREVfQVVUT01BVElDKSB7CisgICAgICAgICAgICAgICAgICAgIGJyaWdodG5lc3MgPSBNSU5JTVVNX0JBQ0tMSUdIVDsKKyAgICAgICAgICAgICAgICAgICAgYnJpZ2h0bmVzc01vZGUgPSBTZXR0aW5ncy5TeXN0ZW0uU0NSRUVOX0JSSUdIVE5FU1NfTU9ERV9NQU5VQUw7CisgICAgICAgICAgICAgICAgICAgIGFscGhhID0gMHg0MDsKKyAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGJyaWdodG5lc3MgPCBERUZBVUxUX0JBQ0tMSUdIVCkgeworICAgICAgICAgICAgICAgICAgICBicmlnaHRuZXNzID0gREVGQVVMVF9CQUNLTElHSFQ7CisgICAgICAgICAgICAgICAgICAgIGFscGhhID0gMHhDMDsKKyAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGJyaWdodG5lc3MgPCBNQVhJTVVNX0JBQ0tMSUdIVCkgeworICAgICAgICAgICAgICAgICAgICBicmlnaHRuZXNzID0gTUFYSU1VTV9CQUNLTElHSFQ7CisgICAgICAgICAgICAgICAgICAgIGFscGhhID0gMHhGRjsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICBicmlnaHRuZXNzTW9kZSA9IFNldHRpbmdzLlN5c3RlbS5TQ1JFRU5fQlJJR0hUTkVTU19NT0RFX0FVVE9NQVRJQzsKKyAgICAgICAgICAgICAgICAgICAgYnJpZ2h0bmVzcyA9IE1JTklNVU1fQkFDS0xJR0hUOworICAgICAgICAgICAgICAgICAgICBhbHBoYSA9IDB4NjA7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgaWYgKGNvbnRleHQuZ2V0UmVzb3VyY2VzKCkuZ2V0Qm9vbGVhbigKKyAgICAgICAgICAgICAgICAgICAgICAgIGNvbS5hbmRyb2lkLmludGVybmFsLlIuYm9vbC5jb25maWdfYXV0b21hdGljX2JyaWdodG5lc3NfYXZhaWxhYmxlKSkgeworICAgICAgICAgICAgICAgICAgICAvLyBTZXQgc2NyZWVuIGJyaWdodG5lc3MgbW9kZSAoYXV0b21hdGljIG9yIG1hbnVhbCkKKyAgICAgICAgICAgICAgICAgICAgU2V0dGluZ3MuU3lzdGVtLnB1dEludChjb250ZXh0LmdldENvbnRlbnRSZXNvbHZlcigpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNldHRpbmdzLlN5c3RlbS5TQ1JFRU5fQlJJR0hUTkVTU19NT0RFLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyaWdodG5lc3NNb2RlKTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAvLyBNYWtlIHN1cmUgd2Ugc2V0IHRoZSBicmlnaHRuZXNzIGlmIGF1dG9tYXRpYyBtb2RlIGlzbid0IGF2YWlsYWJsZQorICAgICAgICAgICAgICAgICAgICBicmlnaHRuZXNzTW9kZSA9IFNldHRpbmdzLlN5c3RlbS5TQ1JFRU5fQlJJR0hUTkVTU19NT0RFX01BTlVBTDsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaWYgKGJyaWdodG5lc3NNb2RlID09IFNldHRpbmdzLlN5c3RlbS5TQ1JFRU5fQlJJR0hUTkVTU19NT0RFX01BTlVBTCkgeworICAgICAgICAgICAgICAgICAgICBwb3dlci5zZXRCYWNrbGlnaHRCcmlnaHRuZXNzKGJyaWdodG5lc3MpOworICAgICAgICAgICAgICAgICAgICBTZXR0aW5ncy5TeXN0ZW0ucHV0SW50KGNyLCBTZXR0aW5ncy5TeXN0ZW0uU0NSRUVOX0JSSUdIVE5FU1MsIGJyaWdodG5lc3MpOworICAgIC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XRJbnQoCisgICAgICAgICAgICAgICAgbUNvbnRleHQuZ2V0Q29udGVudFJlc29sdmVyKCksCisgICAgICAgICAgICAgICAgU2V0dGluZ3MuU3lzdGVtLkFJUlBMQU5FX01PREVfT04sCisgICAgICAgICAgICAgICAgb24gPyAxIDogMCk7CisgICAgICAgIEludGVudCBpbnRlbnQgPSBuZXcgSW50ZW50KEludGVudC5BQ1RJT05fQUlSUExBTkVfTU9ERV9DSEFOR0VEKTsKKyAgICAgICAgaW50ZW50LmFkZEZsYWdzKEludGVudC5GTEFHX1JFQ0VJVkVSX1JFUExBQ0VfUEVORElORyk7CisgICAgICAgIGludGVudC5wdXRFeHRyYSgic3RhdGUiLCBvbik7CisgICAgICAgIGdldENvbnRleHQoKS5zZW5kQnJvYWRjYXN0KGludGVudCk7CisgICAgfQorCisgICAgYm9vbGVhbiBnZXRTaWxlbnRNb2RlKCkgeworICAgICAgICByZXR1cm4gbUF1ZGlvTWFuYWdlci5nZXRSaW5nZXJNb2RlKCkgIT0gQXVkaW9NYW5hZ2VyLlJJTkdFUl9NT0RFX05PUk1BTDsKKyAgICB9CisKKyAgICB2b2lkIHNldFNpbGVudE1vZGUoYm9vbGVhbiBvbikgeworICAgICAgICBpZiAob24pIHsKKyAgICAgICAgICAgIG1BdWRpb01hbmFnZXIuc2V0UmluZ2VyTW9kZSgoU2V0dGluZ3MuU3lzdGVtLmdldEludChtQ29udGV4dC5nZXRDb250ZW50UmVzb2x2ZXIoKSwKKyAgICAgICAgICAgICAgICBTZXR0aW5ncy5TeXN0ZW0uVklCUkFURV9JTl9TSUxFTlQsIDEpID09IDEpCisgICAgICAgICAgICAgICAgPyBBdWRpb01hbmFnZXIuUklOR0VSX01PREVfVklCUkFURQorICAgICAgICAgICAgICAgIDogQXVkaW9NYW5hZ2VyLlJJTkdFUl9NT0RFX1NJTEVOVCk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBtQXVkaW9NYW5hZ2VyLnNldFJpbmdlck1vZGUoQ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WNhdGlvbnMgcGFuZWwiKTsKKyAgICAgICAgICAgICAgICAgICAgbU5vdGlmaWNhdGlvblBhbmVsLnNldFZpc2liaWxpdHkoVmlldy5WSVNJQkxFKTsKKyAgICAgICAgICAgICAgICAgICAgbUV4cGFuZGVkVmlzaWJsZSA9IHRydWU7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgTVNHX0NMT1NFX05PVElGSUNBVElPTl9QQU5FTDoKKyAgICAgICAgICAgICAgICAgICAgaWYgKERFQlVHKSBTbG9nLmQoVEFHLCAiY2xvc2luZyBub3RpZmljYXRpb25zIHBhbmVsIik7CisgICAgICAgICAgICAgICAgICAgIG1Ob3RpZmljYXRpb25QYW5lbC5zZXRWaXNpYmlsaXR5KFZpZXcuR09ORSk7CisgICAgICAgICAgICAgICAgICAgIG1FeHBhbmRlZFZpc2libGUgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBNU0dfT1BFTl9TWVNURU1fUEFORUw6CisgICAgICAgICAgICAgICAgICAgIGlmIChERUJVRykgU2xvZy5kKFRBRywgIm9wZW5pbmcgc3lzdGVtIHBhbmVsIik7CisgICAgICAgICAgICAgICAgICAgIG1TeXN0ZW1QYW5lbC5zZXRWaXNpYmlsaXR5KFZpZXcuVklTSUJMRSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgTVNHX0NMT1NFX1NZU1RFTV9QQU5FTDoKKyAgICAgICAgICAgICAgICAgICAgaWYgKERFQlVHKSBTbG9nLmQoVEFHLCAiY2xvc2luZyBzeXN0ZW0gcGFuZWwiKTsKKyAgICAgICAgICAgICAgICAgICAgbVN5c3RlbVBhbmVsLnNldFZpc2liaWxpdHkoVmlldy5HT05FKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisgICAgCisgICAgcHVibGljIHZvaWQgc2V0QmF0dGVyeU1ldGVyKGludCBsZXZlbCwgYm9vbGVhbiBwbHVnZ2VkKSB7CisgICAgICAgIGlmIChERUJVRykgU2xvZy5kKFRBRywgImJhdHRlcnk9IiArIGxldmVsICsgKHBsdWdnZWQgPyAiIC0gcGx1Z2dlZCIgOiAiIC0gdW5wbHVnZ2VkIikpOworICAgICAgICBtQmF0dGVyeU1ldGVyLnNldEltYWdlUmVzb3VyY2UocGx1Z2dlZCA/IFIuZHJhd2FibGUuYmF0dGVyeV9jaGFyZ2luZyA6IFIuZHJhd2FibGUuYmF0dGVyeSk7CisgICAgICAgIG1CYXR0ZXJ5TWV0ZXIuc2V0SW1hZ2VMZXZlbChsZXZlbCk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgc2V0V2lmaU1ldGVyKGludCBsZXZlbCkgeworICAgICAgICBpZiAoREVCVUcpIFNsb2cuZChUQUcsICJ3aWZpPSIgKyBsZXZlbCk7CisgICAgICAgIG1TaWduYWxNZXRlci5zZXRJbWFnZVJlc291cmNlKFIuZHJhd2FibGUuc2lnbmFsKTsKKyAgICAgICAgbVNpZ25hbE1ldGVyLnNldEltYWdlTGV2ZWwobGV2ZWwpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIGFkZEljb24oU3RyaW5nIHNsb3QsIGludCBpbmRleCwgaW50IHZpZXdJbmRleCwgU3RhdHVzQmFySWNvbiBpY29uKSB7CisgICAgICAgIGlmIChERUJVRykgU2xvZy5kKFRBRywgImFkZEljb24oIiArIHNsb3QgKyAiKSAtPiAiICsgaWNvbik7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgdXBkYXRlSWNvbihTdHJpbmcgc2xvdCwgaW50IGluZGV4LCBpbnQgdmlld0luZGV4LAorICAgICAgICAgICAgU3RhdHVzQmFySWNvbiBvbGQsIFN0YXR1c0Jhckljb24gaWNvbikgeworICAgICAgICBpZiAoREVCVUcpIFNsb2cuZChUQUcsICJ1cGRhdGVJY29uKC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Ly8gbm90IGltbWVyc2l2ZSAmIGEgZnVsbC1zY3JlZW4gYWxlcnQgc2hvdWxkIGJlIHNob3duCisgICAgICAgICAgICBTbG9nLmQoVEFHLCAiTm90aWZpY2F0aW9uIGhhcyBmdWxsU2NyZWVuSW50ZW50IGFuZCBhY3Rpdml0eSBpcyBub3QgaW1tZXJzaXZlOyIKKyAgICAgICAgICAgICAgICAgICAgKyAiIHNlbmRpbmcgZnVsbFNjcmVlbkludGVudCIpOworICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICBub3RpZmljYXRpb24ubm90aWZpY2F0aW9uLmZ1bGxTY3JlZW5JbnRlbnQuc2VuZCgpOworICAgICAgICAgICAgfSBjYXRjaCAoUGVuZGluZ0ludGVudC5DYW5jZWxlZEV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICB9CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAvLyB0aWNrKCkKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHVwZGF0ZU5vdGlmaWNhdGlvbihJQmluZGVyIGtleSwgU3RhdHVzQmFyTm90aWZpY2F0aW9uIG5vdGlmaWNhdGlvbikgeworICAgICAgICBpZiAoREVCVUcpIFNsb2cuZChUQUcsICJ1cGRhdGVOb3RpZmljYXRpb24oIiArIGtleSArICIgLT4gIiArIG5vdGlmaWNhdGlvbiArICIpIC8vIFRPRE8iKTsKKyAgICAgICAgCisgICAgICAgIGZpbmFsIE5vdGlmaWNhdGlvbkRhdGEuRW50cnkgb2xkRW50cnkgPSBtTm90bnMuZmluZEJ5S2V5KGtleSk7CisgICAgICAgIGlmIChvbGRFbnRyeSA9PSBudWxsKSB7CisgICAgICAgICAgICBTbG9nLncoVEFHLCAidXBkYXRlTm90aWZpY2F0aW9uIGZvciB1bmtub3duIGtleTogIiArIGtleSk7CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKworICAgICAgICBmaW5hbCBTdGF0dXNCYXJOb3RpZmljYXRpb24gb2xkTm90aWZpY2F0aW9uID0gb2xkRW50cnkubm90aWZpY2F0aW9uOworICAgICAgICBmaW5hbCBSZW1vdGVWaWV3cyBvbGRDb250ZW50VmlldyA9IG9sZE5vdGlmaWNhdGlvbi5ub3RpZmljYXRpb24uY29udGVudFZpZXc7CisKKyAgICAgICAgZmluYWwgUmVtb3RlVmlld3MgY29udGVudFZpZXcgPSBub3RpZmljYXRpb24ubm90aWZpY2F0aW9uLmNvbnRlbnRWaWV3OworCisgICAgICAgIGlmIChmYWxzZSkgeworICAgICAgICAgICAgU2xvZy5kKFRBRywgIm9sZCBub3RpZmljYXRpb246IHdoZW49IiArIG9sZE5vdGlmaWNhdGlvbi5ub3RpZmljYXRpb24ud2hlbgorICAgICAgICAgICAgICAgICAgICArICIgb25nb2luZz0iICsgb2xkTm90aWZpY2F0aW9uLmlzT25nb2luZygpCisgICAgICAgICAgICAgICAgICAgICsgIiBleHBhbmRlZD0iICsgb2xkRW50cnkuZXhwYW5kZWQKKyAgICAgICAgICAgICAgICAgICAgKyAiIGNvbnRlbnRWaWV3PSIgKyBvbGRDb250ZW50Vmlldyk7CisgICAgICAgICAgICBTbG9nLmQoVEFHLCAibmV3IG5vdGlmaWNhdGlvbjogd2hlbj0iICsgbm90aWZpY2F0aW9uLm5vdGlmaWNhdGlvbi53aGVuCisgICAgICAgICAgICAgICAgICAgICsgIiBvbmdvaW5nPSIgKyBvbGROb3RpZmljYXRpb24uaXNPbmdvaW5nKCkKKyAgICAgICAgICAgICAgICAgICAgKyAiIGNvbnRlbnRWaWV3PSIgKyBjb250ZW50Vmlldyk7CisgICAgICAgIH0KKworICAgICAgICAvLyBDYW4gd2UganVzdCByZWFwcGx5IHRoZSBSZW1vdGVWaWV3cyBpbiBwbGFjZT8gIElmIHdoZW4gZGlkbid0IGNoYW5nZSwgdGhlIG9yZGVyCisgICAgICAgIC8vIGRpZG4ndCBjaGFuZ2UuCisgICAgICAgIGlmIChub3RpZmljYXRpb24ubm90aWZpY2F0aW9uLndoZW4gPT0gb2xkTm90aWZpY2F0aW9uLm5vdGlmaWNhdGlvbi53aGVuCisgICAgICAgICAgICAgICAgJiYgbm90aWZpY2F0aW9uLmlzT25nb2luZygpID09IG9sZE5vdGlmaWNhdGlvbi5pc09uZ29pbmcoKQorICAgICAgICAgICAgICAgICYmIG9sZEVudHJ5LmV4cGFuZGVkICE9IG51bGwKKyAgICAgICAgICAgICAgICAmJiBjb250ZW50VmlldyAhPSBudWxsCisgICAgICAgICAgICAgICAgJiYgb2xkQ29udGVudFZpZXcgIT0gbnVsbAorICAgICAgICAgICAgICAgICYmIGNvbnRlbnRWaWV3LmdldFBhY2thZ2UoKSAhPSBudWxsCisgICAgICAgICAgICAgICAgJiYgb2xkQ29udGVudFZpZXcuZ2V0UGFja2FnZSgpICE9IG51bGwKKyAgICAgICAgICAgICAgICAmJiBvbGRDb250ZW50Vmlldy5nZXRQYWNrYWdlKCkuZXF1YWxzKGNvbnRlbnRWaWV3LmdldFBhY2thZ2UoKSkKKyAgICAgICAgICAgICAgICAmJiBvbGRDb250ZW50Vmlldy5nZXRMYXlvdXRJZCgpID09IGNvbnRlbnRWaWV3LmdldExheW91dElkKCkpIHsKKyAgICAgICAgICAgIGlmIChERUJVRykgU2xvZy5kKFRBRywgInJldXNpbmcgbm90aWZpY2F0aW9uIGZvciBrZXk6ICIgKyBrZXkpOworICAgICAgICAgICAgb2xkRW50cnkubm90aWZpY2F0aW9uID0gbm90aWZpY2F0aW9uOworICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICAvLyBSZWFwcGx5IHRoZSBSZW1vdGVWaWV3cworICAgICAgICAgICAgICAgIGNvbnRlbnRWaWV3LnJlYXBwbHkodGhpcywgb2xkRW50cnkuY29udGVudCk7CisgICAgICAgICAgICAgICAgLy8gdXBkYXRlIHRoZSBjb250ZW50SW50ZW50CisgICAgICAgICAgICAgICAgZmluYWwgUGVuZGluZ0ludGVudCBjb250ZW50SW50ZW50ID0gbm90aWZpY2F0aW9uLm5vdGlmaWNhdGlvbi5jb250ZW50SW50ZW50OworICAgICAgICAgICAgICAgIGlmIChjb250ZW50SW50ZW50ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgb2xkRW50cnkuY29udGVudC5zZXRPbkNsaWNrTGlzdGVuZXIobmV3IE5vdGlmaWNhdGlvbkNsaWNrZXIoY29udGVudEludGVudCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbm90aWZpY2F0aW9uLnBrZywgbm90aWZpY2F0aW9uLnRhZywgbm90aWZpY2F0aW9uLmlkKSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIC8vIFVwZGF0ZSB0aGUgaWNvbi4KKyAgICAgICAgICAgICAgICBmaW5hbCBTdGF0dXNCYXJJY29uIGljID0gbmV3IFN0YXR1c0Jhckljb24obm90aWZpY2F0aW9uLnBrZywKKyAgICAgICAgICAgICAgICAgICAgICAgIG5vdGlmaWNhdGlvbi5ub3RpZmljYXRpb24uaWNvbiwgbm90aWZpY2F0aW9uLm5vdGlmaWNhdGlvbi5pY29uTGV2ZWwsCisgICAgICAgICAgICAgICAgICAgICAgICBub3RpZmljYXRpb24ubm90aWZpY2F0aW9uLm51bWJlcik7CisgICAgICAgICAgICAgICAgaWYgKCFvbGRFbnRyeS5pY29uLnNldChpYykpIHsKKyAgICAgICAgICAgICAgICAgICAgaGFuZGxlTm90aWZpY2F0aW9uRXJyb3Ioa2V5LCBub3RpZmljYXRpb24sICJDb3VsZG4ndCB1cGRhdGUgaWNvbjogIiArIGljKTsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhdGNoIChSdW50aW1lRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICAvLyBJdCBmYWlsZWQgdG8gYWRkIGNsZWFubHkuICBMb2csIGFuZCByZW1vdmUgdGhlIHZpZXcgZnJvbSB0aGUgcGFuZWwuCisgICAgICAgICAgICAgICAgU2xvZy53KFRBRywgIkNvdWxkbid0IHJlYXBwbHkgdmlld3MgZm9yIHBhY2thZ2UgIiArIGNvbnRlbnRWaWV3LmdldFBhY2thZ2UoKSwgZSk7CisgICAgICAgICAgICAgICAgcmVtb3ZlTm90aWZpY2F0aW9uVmlld3Moa2V5KTsKKyAgICAgICAgICAgICAgICBhZGROb3RpZmljYXRpb25WaWV3cyhrZXksIG5vdGlmaWNhdGlvbik7CisgICAgICAgICAgICB9CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBpZiAoREVCVUcpIFNsb2cuZChUQUcsICJub3QgcmV1c2luZyBub3RpZmljYXRpb24gZm9yIGtleTogIiArIGtleSk7CisgICAgICAgICAgICByZW1vdmVOb3RpZmljYXRpb25WaWV3cyhrZXkpOworICAgICAgICAgICAgYWRkTm90aWZpY2F0aW9uVmlld3Moa2V5LCBub3RpZmljYXRpb24pOworICAgICAgICB9CisgICAgICAgIC8vIFRPRE86IGtpY2tlcjsgaW1tZXJzaXZlIG1vZGUKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCByZW1vdmVOb3RpZmljYXRpb24oSUJpbmRlciBrZXkpIHsKKyAgICAgICAgaWYgKERFQlVHKSBTbG9nLmQoVEFHLCAicmVtb3ZlTm90aWZpY2F0aW9uKCIgKyBrZXkgKyAiKSAvLyBUT0RPIik7CisgICAgICAgIHJlbW92ZU5vdGlmaWNhdGlvblZpZXdzKGtleSk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgZGlzYWJsZShpbnQgc3RhdGUpIHsKKyAgICAgICAgLyoKKyAgICAgICAgZmluYWwgaW50IG9sZCA9IG1EaXNhYmxlZDsKKyAgICAgICAgZmluYWwgaW50IGRpZmYgPSBzdGF0ZSBeIG9sZDsKKyAgICAgICAgbURpc2FibGVkID0gc3RhdGU7CisKKyAgICAgICAgaWYgKChkaWZmICYgU3RhdHVzQmFyTWFuYWdlci5ESVNBQkxFX0VYUEFORCkgIT0gMCkgeworICAgICAgICAgICAgaWYgKChzdGF0ZSAmIFN0YXR1c0Jhck1hbmFnZXIuRElTQUJMRV9FWFBBTkQpICE9IDApIHsKKyAgICAgICAgICAgICAgICBTbG9nLmQoVEFHLCAiRElTQUJMRV9FWFBBTkQ6IHllcyIpOworICAgICAgICAgICAgICAgIGFuaW1hdGVDb2xsYXBzZSgpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIGlmICgoZGlmZiAmIFN0YXR1c0Jhck1hbmFnZXIuRElTQUJMRV9OT1RJRklDQVRJT05fSUNPTlMpICE9IDApIHsKKyAgICAgICAgICAgIGlmICgoc3RhdGUgJiBTdGF0dXNCYXJNYW5hZ2VyLkRJU0FCTEVfTk9USUZJQ0FUSU9OX0lDT05TKSAhPSAwKSB7CisgICAgICAgICAgICAgICAgU2xvZy5kKFRBRywgIkRJU0FCTEVfTk9USUZJQ0FUSU9OX0lDT05TOiB5ZXMiKTsKKyAgICAgICAgICAgICAgICBpZiAobVRpY2tpbmcpIHsKKyAgICAgICAgICAgICAgICAgICAgbUtpY2tlci5oYWx0KCk7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgbU5vdGlmaWNhdGlvbkljb25BcmVhLnNldFZpc2liaWxpdHkoVmlldy5JTlZJU0lCTEUpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgU2xvZy5kKFRBRywgIkRJU0FCTEVfTk9USUZJQ0FUSU9OX0lDT05TOiBubyIpOworICAgICAgICAgICAgICAgIGlmICghbUV4cGFuZGVkVmlzaWJsZSkgeworICAgICAgICAgICAgICAgICAgICBtTm90aWZpY2F0aW9uSWNvbkFyZWEuc2V0VmlzaWJpbGl0eShWaWV3LlZJU0lCTEUpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfSBlbHNlIGlmICgoZGlmZiAmIFN0YXR1c0Jhck1hbmFnZXIuRElTQUJMRV9OT1RJRklDQVRJT05fVElDS0VSKSAhPSAwKSB7CisgICAgICAgICAgICBpZiAobVRpY2tpbmcgJiYgKHN0YXRlICYgU3RhdHVzQmFyTWFuYWdlci5ESVNBQkxFX05PVElGSUNBVElPTl9USUNLRVIpICE9IDApIHsKKyAgICAgICAgICAgICAgICBTbG9nLmQoVEFHLCAiRElTQUJMRV9OT1RJRklDQVRJT05fVElDS0VSOiB5ZXMiKTsKKyAgICAgICAgICAgICAgICBtS2lja2VyLmhhbHQoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICAqLworICAgIH0KKworICAgIHZvaWQgcGVyZm9ybURpc2FibGVBY3Rpb25zKGludCBuZXQpIHsKKyAgICAgICAgLyoKKyAgICAgICAgaW50IG9sZCA9IG1EaXNhYmxlZDsKKyAgICAgICAgaW50IGRpZmYgPSBuZXQgXiBvbGQ7CisgICAgICAgIG1EaXNhYmxlZCA9IG5ldDsKKworICAgICAgICAvLyBhY3QgYWNjb3JkaW5nbHkKKyAgICAgICAgaWYgKChkaWZmICYgU3RhdHVzQmFyTWFuYWdlci5ESVNBQkxFX0VYUEFORCkgIT0gMCkgeworICAgICAgICAgICAgaWYgKChuZXQgJiBTdGF0dXNCYXJNYW5hZ2VyLkRJU0FCTEVfRVhQQU5EKSAhPSAwKSB7CisgICAgICAgICAgICAgICAgU2xvZy5kKFRBRywgIkRJU0FCTEVfRVhQQU5EOiB5ZXMiKTsKKyAgICAgICAgICAgICAgICBhbmltYXRlQ29sbGFwc2UoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICBpZiAoKGRpZmYgJiBTdGF0dXNCYXJNYW5hZ2VyLkRJU0FCTEVfTk9USUZJQ0FUSU9OX0lDT05TKSAhPSAwKSB7CisgICAgICAgICAgICBpZiAoKG5ldCAmIFN0YXR1c0Jhck1hbmFnZXIuRElTQUJMRV9OT1RJRklDQVRJT05fSUNPTlMpICE9IDApIHsKKyAgICAgICAgICAgICAgICBTbG9nLmQoVEFHLCAiRElTQUJMRV9OT1RJRklDQVRJT05fSUNPTlM6IHllcyIpOworICAgICAgICAgICAgICAgIGlmIChtVGlja2luZykgeworICAgICAgICAgICAgICAgICAgICBtTm90aWZpY2F0aW9uSWNvbkFyZWEuc2V0VmlzaWJpbGl0eShWaWV3LklOVklTSUJMRSk7CisgICAgICAgICAgICAgICAgICAgIG1LaWNrZXIuaGFsdCgpOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIG1Ob3RpZmljYXRpb25JY29uQXJlYS5zZXRWaXNpYmlsaXR5KFZpZXcuSU5WSVNJQkxFKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIFNsb2cuZChUQUcsICJESVNBQkxFX05PVElGSUNBVElPTl9JQ09OUzogbm8iKTsKKyAgICAgICAgICAgICAgICBpZiAoIW1FeHBhbmRlZFZpc2libGUpIHsKKyAgICAgICAgICAgICAgICAgICAgbU5vdGlmaWNhdGlvbkljb25BcmVhLnNldFZpc2liaWxpdHkoVmlldy5WSVNJQkxFKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0gZWxzZSBpZiAoKGRpZmYgJiBTdGF0dXNCYXJNYW5hZ2VyLkRJU0FCTEVfTk9USUZJQ0FUSU9OX1RJQ0tFUikgIT0gMCkgeworICAgICAgICAgICAgaWYgKG1UaWNraW5nICYmIChuZXQgJiBTdGF0dXNCYXJNYW5hZ2VyLkRJU0FCTEVfTk9USUZJQ0FUSU9OX1RJQ0tFUikgIT0gMCkgeworICAgICAgICAgICAgICAgIG1LaWNrZXIuaGFsdCgpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgICovCisgICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIHRpY2soU3RhdHVzQmFyTm90aWZpY2F0aW9uIG4pIHsKKyAgICAgICAgLy8gU2hvdyB0aGUgdGlja2VyIGlmIG9uZSBpcyByZXF1ZXN0ZWQuIEFsc28gZG9uJ3QgZG8gdGhpcworICAgICAgICAvLyB1bnRpbCBzdGF0dXMgYmFyIHdpbmRvdyBpcyBhdHRhY2hlZCB0byB0aGUgd2luZG93IG1hbmFnZXIsCisgICAgICAgIC8vIGJlY2F1c2UuLi4gIHdlbGwsIHdoYXQncyB0aGUgcG9pbnQgb3RoZXJ3aXNlPyAgQW5kIHRyeWluZyB0bworICAgICAgICAvLyBydW4gYSB0aWNrZXIgd2l0aG91dCBiZWluZyBhdHRhY2hlZCB3aWxsIGNyYXNoIQorICAgICAgICBpZiAobi5ub3RpZmljYXRpb24udGlja2VyVGV4dCAhPSBudWxsICYmIG1TdGF0dXNCYXJWaWV3LmdldFdpbmRvd1Rva2VuKCkgIT0gbnVsbCkgeworICAgICAgICAgICAgaWYgKDAgPT0gKG1EaXNhYmxlZCAmIChTdGF0dXNCYXJNYW5hZ2VyLkRJU0FCTEVfTk9USUZJQ0FUSU9OX0lDT05TCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCBTdGF0dXNCYXJNYW5hZ2VyLkRJU0FCTEVfTk9USUZJQ0FUSU9OX1RJQ0tFUikpKSB7CisgICAgICAgICAgICAgICAgbUtpY2tlci5hZGRFbnRyeShuKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgY2xhc3MgS2lja2VyQ29udHJvbGxlciB7CisgICAgICAgIFZpZXcgbVZpZXc7CisgICAgICAgIEltYWdlVmlldyBtS2lja2VySWNvbjsKKyAgICAgICAgVGV4dFN3aXRjaGVyIG1LaWNrZXJUZXh0OworCisgICAgICAgIHB1YmxpYyBLaWNrZXJDb250cm9sbGVyKENvbnRleHQgY29udGV4dCwgVmlldyBzYikgeworICAgICAgICAgICAgbVZpZXcgPSBzYi5maW5kVmlld0J5SWQoUi5pZC50aWNrZXIpOworICAgICAgICAgICAgbUtpY2tlckljb24gPSAoSW1hZ2VWaWV3KSBtVmlldy5maW5kVmlld0J5SWQoUi5pZC50aWNrZXJJY29uKTsKKyAgICAgICAgICAgIG1LaWNrZXJUZXh0ID0gKFRleHRTd2l0Y2hlcikgbVZpZXcuZmluZFZpZXdCeUlkKFIuaWQudGlja2VyVGV4dCk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCBoYWx0KCkgeworICAgICAgICAgICAgdGlja2VySGFsdGluZygpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgYWRkRW50cnkoU3RhdHVzQmFyTm90aWZpY2F0aW9uIG4pIHsKKyAgICAgICAgICAgIG1LaWNrZXJJY29uLnNldEltYWdlUmVzb3VyY2Uobi5ub3RpZmljYXRpb24uaWNvbik7CisgICAgICAgICAgICBtS2lja2VyVGV4dC5zZXRDdXJyZW50VGV4dChuLm5vdGlmaWNhdGlvbi50aWNrZXJUZXh0KTsKKyAgICAgICAgICAgIHRpY2tlclN0YXJ0aW5nKCk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCB0aWNrZXJTdGFydGluZygpIHsKKyAgICAgICAgICAgIG1UaWNraW5nID0gdHJ1ZTsKKyAgICAgICAgICAgIG1JY29uTGF5b3V0LnNldFZpc2liaWxpdHkoVmlldy5HT05FKTsKKyAgICAgICAgICAgIG1LaWNrZXJWaWV3LnNldFZpc2liaWxpdHkoVmlldy5WSVNJQkxFKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyB2b2lkIHRpY2tlckRvbmUoKSB7CisgICAgICAgICAgICBtSWNvbkxheW91dC5zZXRWaXNpYmlsaXR5KFZpZXcuVklTSUJMRSk7CisgICAgICAgICAgICBtS2lja2VyVmlldy5zZXRWaXNpYmlsaXR5KFZpZXcuR09ORSk7CisgICAgICAgICAgICBtVGlja2luZyA9IGZhbHNlOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgdGlja2VySGFsdGluZygpIHsKKyAgICAgICAgICAgIG1JY29uTGF5b3V0LnNldFZpc2liaWxpdHkoVmlldy5WSVNJQkxFKTsKKyAgICAgICAgICAgIG1LaWNrZXJWaWV3LnNldFZpc2liaWxpdHkoVmlldy5HT05FKTsKKyAgICAgICAgICAgIG1UaWNraW5nID0gZmFsc2U7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBhbmltYXRlRXhwYW5kKCkgeworICAgICAgICBtSGFuZGxlci5yZW1vdmVNZXNzYWdlcyhILk1TR19PUEVOX05PVElGSUNBVElPTl9QQU5FTCk7CisgICAgICAgIG1IYW5kbGVyLnNlbmRFbXB0eU1lc3NhZ2UoSC5NU0dfT1BFTl9OT1RJRklDQVRJT05fUEFORUwpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIGFuaW1hdGVDb2xsYXBzZSgpIHsKKyAgICAgICAgbUhhbmRsZXIucmVtb3ZlTWVzc2FnZXMoSC5NU0dfQ0xPU0VfTk9USUZJQ0FUSU9OX1BBTkVMKTsKKyAgICAgICAgbUhhbmRsZXIuc2VuZEVtcHR5TWVzc2FnZShILk1TR19DTE9TRV9OT1RJRklDQVRJT05fUEFORUwpOworICAgICAgICBtSGFuZGxlci5yZW1vdmVNZXNzYWdlcyhILk1TR19DTE9TRV9TWVNURU1fUEFORUwpOworICAgICAgICBtSGFuZGxlci5zZW5kRW1wdHlNZXNzYWdlKEguTVNHX0NMT1NFX1NZU1RFTV9QQU5FTCk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgbm90aWZpY2F0aW9uSWNvbnNDbGlja2VkKFZpZXcgdikgeworICAgICAgICBpZiAoREVCVUcpIFNsb2cuZChUQUcsICJjbGlja2VkIG5vdGlmaWNhdGlvbiBpY29ucyIpOworICAgICAgICBtSGFuZGxlci5yZW1vdmVNZXNzYWdlcyhILk1TR19DTE9TRV9TWVNURU1fUEFORUwpOworICAgICAgICBtSGFuZGxlci5zZW5kRW1wdHlNZXNzYWdlKEguTVNHX0NMT1NFX1NZU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G9ja3MuCisgICAgICovCisgICAgdm9pZCBoYW5kbGVOb3RpZmljYXRpb25FcnJvcihJQmluZGVyIGtleSwgU3RhdHVzQmFyTm90aWZpY2F0aW9uIG4sIFN0cmluZyBtZXNzYWdlKSB7CisgICAgICAgIHJlbW92ZU5vdGlmaWNhdGlvbihrZXkpOworICAgICAgICB0cnkgeworICAgICAgICAgICAgbUJhclNlcnZpY2Uub25Ob3RpZmljYXRpb25FcnJvcihuLnBrZywgbi50YWcsIG4uaWQsIG4udWlkLCBuLmluaXRpYWxQaWQsIG1lc3NhZ2UpOworICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZXgpIHsKKyAgICAgICAgICAgIC8vIFRoZSBlbmQgaXMgbmlnaC4KKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgVmlldy5PbkNsaWNrTGlzdGVuZXIgbUNsZWFyQnV0dG9uTGlzdGVuZXIgPSBuZXcgVmlldy5PbkNsaWNrTGlzdGVuZXIoKSB7CisgICAgICAgIHB1YmxpYyB2b2lkIG9uQ2xpY2soVmlldyB2KSB7CisgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIG1CYXJTZXJ2aWNlLm9uQ2xlYXJBbGxOb3RpZmljYXRpb25zKCk7CisgICAgICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZXgpIHsKKyAgICAgICAgICAgICAgICAvLyBzeXN0ZW0gcHJvY2VzcyBpcyBkZWFkIGlmIHdlJ3JlIGhlcmUuCisgICAgICAgICAgICB9CisgICAgICAgICAgICBhbmltYXRlQ29sbGFwc2UoKTsKKyAgICAgICAgfQorICAgIH07CisKKyAgICBwcml2YXRlIGNsYXNzIE5vdGlmaWNhdGlvbkNsaWNrZXIgaW1wbGVtZW50cyBWaWV3Lk9uQ2xpY2tMaXN0ZW5lciB7CisgICAgICAgIHByaXZhdGUgUGVuZGluZ0ludGVudCBtSW50ZW50OworICAgICAgICBwcml2YXRlIFN0cmluZyBtUGtnOworICAgICAgICBwcml2YXRlIFN0cmluZyBtVGFnOworICAgICAgICBwcml2YXRlIGludCBtSWQ7CisKKyAgICAgICAgTm90aWZpY2F0aW9uQ2xpY2tlcihQZW5kaW5nSW50ZW50IGludGVudCwgU3RyaW5nIHBrZywgU3RyaW5nIHRhZywgaW50IGlkKSB7CisgICAgICAgICAgICBtSW50ZW50ID0gaW50ZW50OworICAgICAgICAgICAgbVBrZyA9IHBrZzsKKyAgICAgICAgICAgIG1UYWcgPSB0YWc7CisgICAgICAgICAgICBtSWQgPSBpZDsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyB2b2lkIG9uQ2xpY2soVmlldyB2KSB7CisgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIC8vIFRoZSBpbnRlbnQgd2UgYXJlIHNlbmRpbmcgaXMgZm9yIHRoZSBhcHBsaWNhdGlvbiwgd2hpY2gKKyAgICAgICAgICAgICAgICAvLyB3b24ndCBoYXZlIHBlcm1pc3Npb24gdG8gaW1tZWRpYXRlbHkgc3RhcnQgYW4gYWN0aXZpdHkgYWZ0ZXIKKyAgICAgICAgICAgICAgICAvLyB0aGUgdXNlciBzd2l0Y2hlcyB0byBob21lLiAgV2Uga25vdyBpdCBpcyBzYWZlIHRvIGRvIGF0IHRoaXMKKyAgICAgICAgICAgICAgICAvLyBwb2ludCwgc28gbWFrZSBzdXJlIG5ldyBhY3Rpdml0eSBzd2l0Y2hlcyBhcmUgbm93IGFsbG93ZWQuCisgICAgICAgICAgICAgICAgQWN0aXZpdHlNYW5hZ2VyTmF0aXZlLmdldERlZmF1bHQoKS5yZXN1bWVBcHBTd2l0Y2hlcygpOworICAgICAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKG1JbnRlbnQgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIGludFtdIHBvcyA9IG5ldyBpbnRbMl07CisgICAgICAgICAgICAgICAgdi5nZXRMb2NhdGlvbk9uU2NyZWVuKHBvcyk7CisgICAgICAgICAgICAgICAgSW50ZW50IG92ZXJsYXkgPSBuZXcgSW50ZW50KCk7CisgICAgICAgICAgICAgICAgb3ZlcmxheS5zZXRTb3VyY2VCb3VuZHMoCisgICAgICAgICAgICAgICAgICAgICAgICBuZXcgUmVjdChwb3NbMF0sIHBvc1sxXSwgcG9zWzBdK3YuZ2V0V2lkdGgoKSwgcG9zWzFdK3YuZ2V0SGVpZ2h0KCkpKTsKKyAgICAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgICAgICBtSW50ZW50LnNlbmQoVGFibGV0U3RhdHVzQmFyU2VydmljZS50aGlzLCAwLCBvdmVybGF5KTsKKyAgICAgICAgICAgICAgICB9IGNhdGNoIChQZW5kaW5nSW50ZW50LkNhbmNlbGVkRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gdGhlIHN0YWNrIHRyYWNlIGlzbid0IHZlcnkgaGVscGZ1bCBoZXJlLiAgSnVzdCBsb2cgdGhlIGV4Y2VwdGlvbiBtZXNzYWdlLgorICAgICAgICAgICAgICAgICAgICBTbG9nLncoVEFHLCAiU2VuZGluZyBjb250ZW50SW50ZW50IGZhaWxlZDogIiArIGUpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICBtQmFyU2VydmljZS5vbk5vdGlmaWNhdGlvbkNsaWNrKG1Qa2csIG1UYWcsIG1JZCk7CisgICAgICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZXgpIHsKKyAgICAgICAgICAgICAgICAvLyBzeXN0ZW0gcHJvY2VzcyBpcyBkZWFkIGlmIHdlJ3JlIGhlcmUuCisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIC8vIGNsb3NlIHRoZSBzaGFkZSBpZiBpdCB3YXMgb3BlbgorICAgICAgICAgICAgYW5pbWF0ZUNvbGxhcHNlKCk7CisKKyAgICAgICAgICAgIC8vIElmIHRoaXMgY2xpY2sgd2FzIG9uIHRoZSBpbnRydWRlciBhbGVydCwgaGlkZSB0aGF0IGluc3RlYWQKKy8vICAgICAgICAgICAgbUhhbmRsZXIuc2VuZEVtcHR5TWVzc2FnZShNU0dfSElERV9JTlRSVURFUik7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBTdGF0dXNCYXJOb3RpZmljYXRpb24gcmVtb3ZlTm90aWZpY2F0aW9uVmlld3MoSUJpbmRlciBrZXkpIHsKKyAgICAgICAgTm90aWZpY2F0aW9uRGF0YS5FbnRyeSBlbnRyeSA9IG1Ob3Rucy5yZW1vdmUoa2V5KTsKKyAgICAgICAgaWYgKGVudHJ5ID09IG51bGwpIHsKKyAgICAgICAgICAgIFNsb2cudyhUQUcsICJyZW1vdmVOb3RpZmljYXRpb24gZm9yIHVua25vd24ga2V5OiAiICsga2V5KTsKKyAgICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICB9CisgICAgICAgIC8vIFJlbW92ZSB0aGUgZXhwYW5kZWQgdmlldy4KKyAgICAgICAgVmlld0dyb3VwIHJvd1BhcmVudCA9IChWaWV3R3JvdXApZW50cnkucm93LmdldFBhcmVudCgpOworICAgICAgICBpZiAocm93UGFyZW50ICE9IG51bGwpIHJvd1BhcmVudC5yZW1vdmVWaWV3KGVudHJ5LnJvdyk7CisgICAgICAgIC8vIFJlbW92ZSB0aGUgaWNvbi4KKy8vICAgICAgICBWaWV3R3JvdXAgaWNvblBhcmVudCA9IChWaWV3R3JvdXApZW50cnkuaWNvbi5nZXRQYXJlbnQoKTsKKy8vICAgICAgICBpZiAoaWNvblBhcmVudCAhPSBudWxsKSBpY29uUGFyZW50LnJlbW92ZVZpZXcoZW50cnkuaWNvbik7CisgICAgICAgIHJlZnJlc2hJY29ucygpOworCisgICAgICAgIHJldHVybiBlbnRyeS5ub3RpZmljYXRpb247CisgICAgfQorCisgICAgU3RhdHVzQmFySWNvblZpZXcgYWRkTm90aWZpY2F0aW9uVmlld3MoSUJpbmRlciBrZXksIFN0YXR1c0Jhck5vdGlmaWNhdGlvbiBub3RpZmljYXRpb24pIHsKKyAgICAgICAgaWYgKERFQlVHKSB7CisgICAgICAgICAgICBTbG9nLmQoVEFHLCAiYWRkTm90aWZpY2F0aW9uVmlld3Moa2V5PSIgKyBrZXkgKyAiLCBub3RpZmljYXRpb249IiArIG5vdGlmaWNhdGlvbik7CisgICAgICAgIH0KKyAgICAgICAgLy8gQ29uc3RydWN0IHRoZSBpY29uLgorICAgICAgICBmaW5hbCBTdGF0dXNCYXJJY29uVmlldyBpY29uVmlldyA9IG5ldyBTdGF0dXNCYXJJY29uVmlldyh0aGlzLAorICAgICAgICAgICAgICAgIG5vdGlmaWNhdGlvbi5wa2cgKyAiLzB4IiArIEludGVnZXIudG9IZXhTdHJpbmcobm90aWZpY2F0aW9uLmlkKSk7CisgICAgICAgIGljb25WaWV3LnNldFNjYWxlVHlwZShJbWFnZVZpZXcuU2NhbGVUeXBlLkNFTlRFUl9JTlNJREUpOworCisgICAgICAgIGZpbmFsIFN0YXR1c0Jhckljb24gaWMgPSBuZXcgU3RhdHVzQmFySWNvbihub3RpZmljYXRpb24ucGtnLAorICAgICAgICAgICAgICAgICAgICBub3RpZmljYXRpb24ubm90aWZpY2F0aW9uLmljb24sCisgICAgICAgICAgICAgICAgICAgIG5vdGlmaWNhdGlvbi5ub3RpZmljYXRpb24uaWNvbkxldmVsLAorICAgICAgICAgICAgICAgICAgICBub3RpZmljYXRpb24ubm90aWZpY2F0aW9uLm51bWJlcik7CisgICAgICAgIGlmICghaWNvblZpZXcuc2V0KGljKSkgeworICAgICAgICAgICAgaGFuZGxlTm90aWZpY2F0aW9uRXJyb3Ioa2V5LCBub3RpZmljYXRpb24sICJDb3VsZG4ndCBhdHRhY2ggU3RhdHVzQmFySWNvbjogIiArIGljKTsKKyAgICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICB9CisgICAgICAgIC8vIENvbnN0cnVjdCB0aGUgZXhwYW5kZWQgdmlldy4KKyAgICAgICAgTm90aWZpY2F0aW9uRGF0YS5FbnRyeSBlbnRyeSA9IG5ldyBOb3RpZmljYXRpb25EYXRhLkVudHJ5KGtleSwgbm90aWZpY2F0aW9uLCBpY29uVmlldyk7CisgICAgICAgIGlmICghaW5mbGF0ZVZpZXdzKGVudHJ5LCBtUGlsZSkpIHsKKyAgICAgICAgICAgIGhhbmRsZU5vdGlmaWNhdGlvbkVycm9yKGtleSwgbm90aWZpY2F0aW9uLCAiQ291bGRuJ3QgZXhwYW5kIFJlbW90ZVZpZXdzIGZvcjogIgorICAgICAgICAgICAgICAgICAgICArIG5vdGlmaWNhdGlvbik7CisgICAgICAgICAgICByZXR1cm4gbnVsbDsKKyAgICAgICAgfQorICAgICAgICAvLyBBZGQgdGhlIGljb24uCisgICAgICAgIG1Ob3Rucy5hZGQoZW50cnkpOworICAgICAgICByZWZyZXNoSWNvbnMoKTsKKworICAgICAgICByZXR1cm4gaWNvblZpZXc7CisgICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIHJlZnJlc2hJY29ucygpIHsKKyAgICAgICAgLy8gWFhYOiBuZWVkIHRvIGltcGxlbWVudCBhIG5ldyBsaW1pdGVkIGxpbmVhciBsYXlvdXQgY2xhc3MKKyAgICAgICAgLy8gdG8gYXZvaWQgcmVtb3ZpbmcgJiByZWFkZGluZyBldmVyeXRoaW5nCisKKyAgICAgICAgaW50IE4gPSBtTm90bnMuc2l6ZSgpOworICAgICAgICBMaW5lYXJMYXlvdXQuTGF5b3V0UGFyYW1zIHBhcmFtcyA9IG5ldyBMaW5lYXJMYXlvdXQuTGF5b3V0UGFyYW1zKG1JY29uU2l6ZSwgbUljb25TaXplKTsKKworICAgICAgICBpZiAoREVCVUcpIHsKKyAgICAgICAgICAgIFNsb2cuZChUQUcsICJyZWZyZXNoaW5nIGljb25zICgiICsgTiArICIgbm90aWZpY2F0aW9ucywgbUljb25MYXlvdXQ9IgorICAgICAgICAgICAgICAgICAgICArIG1JY29uTGF5b3V0ICsgIiwgbVBpbGU9IiArIG1QaWxlKTsKKyAgICAgICAgfQorCisgICAgICAgIG1JY29uTGF5b3V0LnJlbW92ZUFsbFZpZXdzKCk7CisgICAgICAgIGZvciAoaW50IGk9MDsgaTw0OyBpKyspIHsKKyAgICAgICAgICAgIGlmIChpPj1OKSBicmVhazsKKyAgICAgICAgICAgIG1JY29uTGF5b3V0LmFkZFZpZXcobU5vdG5zLmdldChOLWktMSkuaWNvbiwgaSwgcGFyYW1zKTsKKyAgICAgICAgfQorCisgICAgICAgIG1QaWxlLnJlbW92ZUFsbFZpZXdzKCk7CisgICAgICAgIGZvciAoaW50IGk9MDsgaTxOOyBpKyspIHsKKyAgICAgICAgICAgIG1QaWxlLmFkZFZpZXcobU5vdG5zLmdldChOLWktMSkucm93KTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgYm9vbGVhbiBpbmZsYXRlVmlld3MoTm90aWZpY2F0aW9uRGF0YS5FbnRyeSBlbnRyeSwgVmlld0dyb3VwIHBhcmVudCkgeworICAgICAgICBTdGF0dXNCYXJOb3RpZmljYXRpb24gc2JuID0gZW50cnkubm90aWZpY2F0aW9uOworICAgICAgICBSZW1vdGVWaWV3cyByZW1vdGVWaWV3cyA9IHNibi5ub3RpZmljYXRpb24uY29udGVudFZpZXc7CisgICAgICAgIGlmIChyZW1vdGVWaWV3cyA9PSBudWxsKSB7CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKworICAgICAgICAvLyBjcmVhdGUgdGhlIHJvdyB2aWV3CisgICAgICAgIExheW91dEluZmxhdGVyIGluZmxhdGVyID0gKExheW91dEluZmxhdGVyKWdldFN5c3RlbVNlcnZpY2UoQ29udGV4dC5MQVlPVVRfSU5GTEFURVJfU0VSVklDRSk7CisgICAgICAgIFZpZXcgcm93ID0gaW5mbGF0ZXIuaW5mbGF0ZShSLmxheW91dC5zdGF0dXNfYmFyX2xhdGVzdF9ldmVudCwgcGFyZW50LCBmYWxzZSk7CisgICAgICAgIFZpZXcgdmV0b0J1dHRvbiA9IHJvdy5maW5kVmlld0J5SWQoUi5pZC52ZXRvKTsKKyAgICAgICAgZmluYWwgU3RyaW5nIF9wa2cgPSBzYm4ucGtnOworICAgICAgICBmaW5hbCBTdHJpbmcgX3RhZyA9IHNibi50YWc7CisgICAgICAgIGZpbmFsIGludCBfaWQgPSBzYm4uaWQ7CisgICAgICAgIHZldG9CdXR0b24uc2V0T25DbGlja0xpc3RlbmVyKG5ldyBWaWV3Lk9uQ2xpY2tMaXN0ZW5lcigpIHsgCisgICAgICAgICAgICAgICAgcHVibGljIHZvaWQgb25DbGljayhWaWV3IHYpIHsKKyAgICAgICAgICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1CYXJTZXJ2aWNlLm9uTm90aWZpY2F0aW9uQ2xlYXIoX3BrZywgX3RhZywgX2lkKTsKKyAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGV4KSB7CisgICAgICAgICAgICAgICAgICAgICAgICAvLyBzeXN0ZW0gcHJvY2VzcyBpcyBkZWFkIGlmIHdlJ3JlIGhlcmUuCisgICAgICAgICAgICAgICAgICAgIH0KKy8vICAgICAgICAgICAgICAgICAgICBhbmltYXRlQ29sbGFwc2UoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9KTsKKworICAgICAgICAvLyBiaW5kIHRoZSBjbGljayBldmVudCB0byB0aGUgY29udGVudCBhcmVhCisgICAgICAgIFZpZXdHcm91cCBjb250ZW50ID0gKFZpZXdHcm91cClyb3cuZmluZFZpZXdCeUlkKFIuaWQuY29udGVudCk7CisgICAgICAgIC8vIFhYWDogdXBkYXRlIHRvIGFsbG93IGNvbnRyb2xzIHdpdGhpbiBub3RpZmljYXRpb24gdmlld3MKKyAgICAgICAgY29udGVudC5zZXREZXNjZW5kYW50Rm9jdXNhYmlsaXR5KFZpZXdHcm91cC5GT0NVU19CTE9DS19ERVNDRU5EQU5UUyk7CisvLyAgICAgICAgY29udGVudC5zZXRPbkZvY3VzQ2hhbmdlTGlzdGVuZXIobUZvY3VzQ2hhbmdlTGlzdGVuZXIpOworICAgICAgICBQZW5kaW5nSW50ZW50IGNvbnRlbnRJbnRlbnQgPSBzYm4ubm90aWZpY2F0aW9uLmNvbnRlbnRJbnRlbnQ7CisgICAgICAgIGlmIChjb250ZW50SW50ZW50ICE9IG51bGwpIHsKKyAgICAgICAgICAgIGNvbnRlbnQuc2V0T25DbGlja0xpc3RlbmVyKG5ldyBOb3RpZmljYXRpb25DbGlja2VyKGNvbnRlbnRJbnRlbnQsCisgICAgICAgICAgICAgICAgICAgICAgICBzYm4ucGtnLCBzYm4udGFnLCBzYm4uaWQpKTsKKyAgICAgICAgfQorCisgICAgICAgIFZpZXcgZXhwYW5kZWQgPSBudWxsOworICAgICAgICBFeGNlcHRpb24gZXhjZXB0aW9uID0gbnVsbDsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIGV4cGFuZGVkID0gcmVtb3RlVmlld3MuYXBwbHkodGhpcywgY29udGVudCk7CisgICAgICAgIH0KKyAgICAgICAgY2F0Y2ggKFJ1bnRpbWVFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgZXhjZXB0aW9uID0gZTsKKyAgICAgICAgfQorICAgICAgICBpZiAoZXhwYW5kZWQgPT0gbnVsbCkgeworICAgICAgICAgICAgU3RyaW5nIGlkZW50ID0gc2JuLnBrZyArICIvMHgiICsgSW50ZWdlci50b0hleFN0cmluZyhzYm4uaWQpOworICAgICAgICAgICAgU2xvZy5lKFRBRywgImNvdWxkbid0IGluZmxhdGUgdmlldyBmb3Igbm90aWZpY2F0aW9uICIgKyBpZGVudCwgZXhjZXB0aW9uKTsKKyAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIGNvbnRlbnQuYW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NyArMTY4LDcgQEAKIAogICAgICAgICBTeW50aFByb3h5Sm5pU3RvcmFnZSgpIHsKICAgICAgICAgICAgIHR0c19yZWYgPSBOVUxMOwotICAgICAgICAgICAgbU5hdGl2ZVN5bnRoSW50ZXJmYWNlID0gTlVMTDsKKyAgICAgICAgICAgIG1FbmdpbmUgPSBOVUxMOwogICAgICAgICAgICAgbUVuZ2luZUxpYkhhbmRsZSA9IE5VTEw7CiAgICAgICAgICAgICBtQXVkaW9PdXQgPSBOVUxMOwogICAgICAgICAgICAgbVBsYXlTdGF0ZSA9ICBTWU5USFBMQVlTVEFURV9JU19TVE9QUEVEOwpAQCAtMTg0LDkgKzE4NCw5IEBACiAgICAgICAgIH5TeW50aFByb3h5Sm5pU3RvcmFnZSgpIHsKICAgICAgICAgICAgIC8vTE9HVigiZW50ZXJpbmcgflN5bnRoUHJveHlKbmlTdG9yYWdlKCkiKTsKICAgICAgICAgICAgIGtpbGxBdWRpbygpOwotICAgICAgICAgICAgaWYgKG1OYXRpdmVTeW50aEludGVyZmFjZSkgewotICAgICAgICAgICAgICAgIG1OYXRpdmVTeW50aEludGVyZmFjZS0+c2h1dGRvd24oKTsKLSAgICAgICAgICAgICAgICBtTmF0aXZlU3ludGhJbnRlcmZhY2UgPSBOVUxMOworICAgICAgICAgICAgaWYgKG1FbmdpbmUpIHsKKyAgICAgICAgICAgICAgICBtRW5naW5lLT5mdW5jcy0+c2h1dGRvd24obUVuZ2luZSk7CisgICAgICAgICAgICAgICAgbUVuZ2luZSA9IE5VTEw7CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBpZiAobUVuZ2luZUxpYkhhbmRsZSkgewogICAgICAgICAgICAgICAgIC8vTE9HRSgiflN5bnRoUHJveHlKbmlTdG9yYWdlKCk6IGJlZm9yZSBjbG9zZSBsaWJyYXJ5Iik7CkBAIC0yNzMsMjggKzI3Myw0NSBAQAogICogQ2FsbGJhY2sgZnJvbSBUVFMgZW5naW5lLgogICogRGlyZWN0bHkgc3Bl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gICAgICAgIH0KIAotICAgICAgICBpZiAoYnVmZmVyU2l6ZSA+IDApIHsKLSAgICAgICAgICAgIHByZXBBdWRpb1RyYWNrKHBKbmlEYXRhLCBwRm9yQWZ0ZXItPnN0cmVhbVR5cGUsIHJhdGUsIChBdWRpb1N5c3RlbTo6YXVkaW9fZm9ybWF0KWZvcm1hdCwgY2hhbm5lbCk7CisgICAgICAgIGlmICgqcEJ1ZmZlclNpemUgPiAwKSB7CisgICAgICAgICAgICBwcmVwQXVkaW9UcmFjayhwSm5pRGF0YSwgcEZvckFmdGVyLT5zdHJlYW1UeXBlLCByYXRlLCBlbmNvZGluZywgY2hhbm5lbCk7CiAgICAgICAgICAgICBpZiAocEpuaURhdGEtPm1BdWRpb091dCkgewogICAgICAgICAgICAgICAgIHBKbmlEYXRhLT5tUGxheUxvY2subG9jaygpOwogICAgICAgICAgICAgICAgIGlmKHBKbmlEYXRhLT5tQXVkaW9PdXQtPnN0b3BwZWQoKQpAQCAtMzAzLDI4ICszMjAsMzEgQEAKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgcEpuaURhdGEtPm1QbGF5TG9jay51bmxvY2soKTsKICAgICAgICAgICAgICAgICBpZiAoYlVzZUZpbHRlcikgewotICAgICAgICAgICAgICAgICAgICBhcHBseUZpbHRlcigoaW50MTZfdCopd2F2LCBidWZmZXJTaXplLzIpOworICAgICAgICAgICAgICAgICAgICBhcHBseUZpbHRlcigoaW50MTZfdCopKnBXYXYsICpwQnVmZmVyU2l6ZS8yKTsKICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgcEpuaURhdGEtPm1BdWRpb091dC0+d3JpdGUod2F2LCBidWZmZXJTaXplKTsKLSAgICAgICAgICAgICAgICBtZW1zZXQod2F2LCAwLCBidWZmZXJTaXplKTsKKyAgICAgICAgICAgICAgICBwSm5pRGF0YS0+bUF1ZGlvT3V0LT53cml0ZSgqcFdhdiwgKnBCdWZmZXJTaXplKTsKKyAgICAgICAgICAgICAgICBtZW1zZXQoKnBXYXYsIDAsICpwQnVmZmVyU2l6ZSk7CiAgICAgICAgICAgICAgICAgLy9MT0dWKCJBdWRpb1RyYWNrIHdyb3RlOiAlZCBieXRlcyIsIGJ1ZmZlclNpemUpOwogICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICBMT0dFKCJDYW4ndCBwbGF5LCBudWxsIGF1ZGlvdHJhY2siKTsKKyAgICAgICAgICAgICAgICBkZWxldGUgcEZvckFmdGVyOworICAgICAgICAgICAgICAgIHBGb3JBZnRlciA9IE5VTEw7CisgICAgICAgICAgICAgICAgcmV0dXJuIEFORFJPSURfVFRTX0NBTExCQUNLX0hBTFQ7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KICAgICB9IGVsc2UgIGlmIChwRm9yQWZ0ZXItPnVzYWdlTW9kZSA9PSBVU0FHRU1PREVfV1JJVEVfVE9fRklMRSkgewogICAgICAgICAvL0xPR1YoIlNhdmUgdG8gZmlsZSIpOwotICAgICAgICBpZiAod2F2ID09IE5VTEwpIHsKKyAgICAgICAgaWYgKCpwV2F2ID09IE5VTEwpIHsKICAgICAgICAgICAgIGRlbGV0ZSBwRm9yQWZ0ZXI7CiAgICAgICAgICAgICBMT0dWKCJOdWxsOiBzcGVlY2ggaGFzIGNvbXBsZXRlZCIpOwotICAgICAgICAgICAgcmV0dXJuIFRUU19DQUxMQkFDS19IQUxUOworICAgICAgICAgICAgcmV0dXJuIEFORFJPSURfVFRTX0NBTExCQUNLX0hBTFQ7CiAgICAgICAgIH0KLSAgICAgICAgaWYgKGJ1ZmZlclNpemUgPiAwKXsKKyAgICAgICAgaWYgKCpwQnVmZmVyU2l6ZSA+IDApewogICAgICAgICAgICAgaWYgKGJVc2VGaWx0ZXIpIHsKLSAgICAgICAgICAgICAgICBhcHBseUZpbHRlcigoaW50MTZfdCopd2F2LCBidWZmZXJTaXplLzIpOworICAgICAgICAgICAgICAgIGFwcGx5RmlsdGVyKChpbnQxNl90KikqcFd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ICAgaW50IHJlc3VsdCA9IFRUU19GQUlMVVJFOworICAgIGludCByZXN1bHQgPSBBTkRST0lEX1RUU19GQUlMVVJFOwogCiAgICAgaWYgKGpuaURhdGEgPT0gMCkgewogICAgICAgICBMT0dFKCJhbmRyb2lkX3R0c19TeW50aFByb3h5X3N0b3AoKTogaW52YWxpZCBKTkkgZGF0YSIpOwpAQCAtNzkwLDggKzg0MCw5IEBACiAgICAgfQogICAgIHBTeW50aERhdGEtPm1QbGF5TG9jay51bmxvY2soKTsKIAotICAgIGlmIChwU3ludGhEYXRhLT5tTmF0aXZlU3ludGhJbnRlcmZhY2UpIHsKLSAgICAgICAgcmVzdWx0ID0gcFN5bnRoRGF0YS0+bU5hdGl2ZVN5bnRoSW50ZXJmYWNlLT5zdG9wKCk7CisgICAgYW5kcm9pZF90dHNfZW5naW5lX3QgKmVuZ2luZSA9IHBTeW50aERhdGEtPm1FbmdpbmU7CisgICAgaWYgKGVuZ2luZSkgeworICAgICAgICByZXN1bHQgPSBlbmdpbmUtPmZ1bmNzLT5zdG9wKGVuZ2luZSk7CiAgICAgfQogCiAgICAgcmV0dXJuIHJlc3VsdDsKQEAgLTgwMSw3ICs4NTIsNyBAQAogc3RhdGljIGludAogYW5kcm9pZF90dHNfU3ludGhQcm94eV9zdG9wU3luYyhKTklFbnYgKmVudiwgam9iamVjdCB0aGl6LCBqaW50IGpuaURhdGEpCiB7Ci0gICAgaW50IHJlc3VsdCA9IFRUU19GQUlMVVJFOworICAgIGludCByZXN1bHQgPSBBTkRST0lEX1RUU19GQUlMVVJFOwogCiAgICAgaWYgKGpuaURhdGEgPT0gMCkgewogICAgICAgICBMT0dFKCJhbmRyb2lkX3R0c19TeW50aFByb3h5X3N0b3AoKTogaW52YWxpZCBKTkkgZGF0YSIpOwpAQCAtODI5LDcgKzg4MCw3IEBACiAKICAgICBTeW50aFByb3h5Sm5pU3RvcmFnZSogcFN5bnRoRGF0YSA9IChTeW50aFByb3h5Sm5pU3RvcmFnZSopam5p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DaGFyZ2luZyA9PSBudWxsKSB7Ci0gICAgICAgICAgICAvLyBuZXh0IGFsYXJtIG9ubHkKLSAgICAgICAgICAgIG1TdGF0dXMxLnNldFZpc2liaWxpdHkoVmlldy5WSVNJQkxFKTsKLSAgICAgICAgICAgIG1TdGF0dXMyLnNldFZpc2liaWxpdHkoVmlldy5JTlZJU0lCTEUpOwotCi0gICAgICAgICAgICBtU3RhdHVzMS5zZXRUZXh0KG1OZXh0QWxhcm0pOwotICAgICAgICAgICAgbVN0YXR1czEuc2V0Q29tcG91bmREcmF3YWJsZXNXaXRoSW50cmluc2ljQm91bmRzKG1BbGFybUljb24sIG51bGwsIG51bGwsIG51bGwpOwotICAgICAgICB9IGVsc2UgaWYgKG1DaGFyZ2luZyAhPSBudWxsICYmIG1OZXh0QWxhcm0gIT0gbnVsbCkgewotICAgICAgICAgICAgLy8gYm90aCBjaGFyZ2luZyBhbmQgbmV4dCBhbGFybQotICAgICAgICAgICAgbVN0YXR1czEuc2V0VmlzaWJpbGl0eShWaWV3LlZJU0lCTEUpOwotICAgICAgICAgICAgbVN0YXR1czIuc2V0VmlzaWJpbGl0eShWaWV3LlZJU0lCTEUpOwotCi0gICAgICAgICAgICBtU3RhdHVzMS5zZXRUZXh0KG1DaGFyZ2luZyk7Ci0gICAgICAgICAgICBtU3RhdHVzMS5zZXRDb21wb3VuZERyYXdhYmxlc1dpdGhJbnRyaW5zaWNCb3VuZHMobUNoYXJnaW5nSWNvbiwgbnVsbCwgbnVsbCwgbnVsbCk7Ci0gICAgICAgICAgICBtU3RhdHVzMi5zZXRUZXh0KG1OZXh0QWxhcm0pOwotICAgICAgICAgICAgbVN0YXR1czIuc2V0Q29tcG91bmREcmF3YWJsZXNXaXRoSW50cmluc2ljQm91bmRzKG1BbGFybUljb24sIG51bGwsIG51bGwsIG51bGwpOwotICAgICAgICB9CisgICAgICAgIG1TdGF0dXNWaWV3LnVwZGF0ZVN0YXR1c0xpbmVzKG1TdGF0dXMuc2hvd1N0YXR1c0xpbmVzKCksIG1DaGFyZ2luZywgbUNoYXJnaW5nSWNvbiwgbUFsYXJtSWNvbik7CiAgICAgfQogCiAgICAgLyoqIHtAaW5oZXJpdERvY30gKi8KQEAgLTUwOSw3ICs0NzEsNyBAQAogICAgICAgICBzd2l0Y2ggKHN0YXR1cykgewogICAgICAgICAgICAgY2FzZSBOb3JtYWw6CiAgICAgICAgICAgICAgICAgLy8gdGV4dAotICAgICAgICAgICAgICAgIG1DYXJyaWVyLnNldFRleHQoCisgICAgICAgICAgICAgICAgbVN0YXR1c1ZpZXcuc2V0Q2FycmllclRleHQoCiAgICAgICAgICAgICAgICAgICAgICAgICBnZXRDYXJyaWVyU3RyaW5nKAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtVXBkYXRlTW9uaXRvci5nZXRUZWxlcGhvbnlQbG1uKCksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1VcGRhdGVNb25pdG9yLmdldFRlbGVwaG9ueVNwbigpKSk7CkBAIC01MTgsMTQgKzQ4MCwxNCBAQAogICAgICAgICAgICAgICAgIG1TY3JlZW5Mb2NrZWQuc2V0VGV4dCgiIik7CiAKICAgICAgICAgICAgICAgICAvLyBsYXlvdXQKLSAgICAgICAgICAgICAgICBtU2NyZWVuTG9ja2VkLnNldFZpc2liaWxpdHkoVmlldy5WSVNJQkxFKTsKKyAgICAgICAgICAgICAgICBtU2NyZWVuTG9ja2VkLnNldFZpc2liaWxpdHkoVmlldy5JTlZJU0lCTEUpOwogICAgICAgICAgICAgICAgIG1TZWxlY3Rvci5zZXRWaXNpYmlsaXR5KFZpZXcuVklTSUJMRSk7CiAgICAgICAgICAgICAgICAgbUVtZXJnZW5jeUNhbGxUZXh0LnNldFZpc2liaWxpdHkoVmlldy5HT05FKTsKICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgIGNhc2UgTmV0d29ya0xvY2tlZDoKICAgICAgICAgICAgICAgICAvLyBUaGUgY2FycmllciBzdHJpbmcgc2hvd3MgYm90aCBzaW0gY2FyZCBzdGF0dXMgKGkuZS4gTm8gU2ltIENhcmQpIGFuZAogICAgICAgICAgICAgICAgIC8vIGNhcnJpZXIncyBuYW1lIGFuZC9vciAiRW1lcmdlbmN5IENhbGxzIE9ubHkiIHN0YXR1cwotICAgICAgICAgICAgICAgIG1DYXJyaWVyLnNldFRleHQoCisgICAgICAgICAgICAgICAgbVN0YXR1c1ZpZXcuc2V0Q2FycmllclRleHQoCiAgICAgICAgICAgICAgICAgICAgICAgICBnZXRDYXJyaWVyU3RyaW5nKAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtVXBkYXRlTW9uaXRvci5nZXRUZWxlcGhvbnlQbG1uKCksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldENvbnRleHQoKS5nZXRUZXh0KFIuc3RyaW5nLmxvY2tzY3JlZW5fbmV0d29ya19sb2NrZWRfbWVzc2FnZSkpKTsKQEAgLTUzOCw3ICs1MDAsNyBAQAogICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgY2FzZSBTaW1NaXNzaW5nOgogICAgICAgICAgICAgICAgIC8vIHRleHQKLSAgICAgICAgICAgICAgICBtQ2Fycmllci5zZXRUZXh0KFIuc3RyaW5nLmxvY2tzY3JlZW5fbWlzc2luZ19zaW1fbWVzc2FnZV9zaG9ydCk7CisgICAgICAgICAgICAgICAgbVN0YXR1c1ZpZXcuc2V0Q2FycmllclRleHQoUi5zdHJpbmcubG9ja3NjcmVlbl9taXNzaW5nX3NpbV9tZXNzYWdlX3Nob3J0KTsKICAgICAgICAgICAgICAgICBtU2NyZWVuTG9ja2VkLnNldFRleHQoUi5zdHJpbmcubG9ja3NjcmVlbl9taXNzaW5nX3NpbV9pbnN0cnVjdGlvbnMpOwogCiAgICAgICAgICAgICAgICAgLy8gbGF5b3V0CkBAIC01NDksNyArNTExLDcgQEAKICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgIGNhc2UgU2ltTWlzc2luZ0xvY2tlZDoKICAgICAgICAgICAgICAgICAvLyB0ZXh0Ci0gICAgICAgICAgICAgICAgbUNhcnJpZXIuc2V0VGV4dCgKKyAgICAgICAgICAgICAgICBtU3RhdHVzVmlldy5zZXRDYXJyaWVyVGV4dCgKICAgICAgICAgICAgICAgICAgICAgICAgIGdldENhcnJpZXJTdHJpbmcoCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1VcGRhdGVNb25pdG9yLmdldFRlbGVwaG9ueVBsbW4oKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0Q29udGV4dCgpLmdldFRleHQoUi5zdHJpbmcubG9ja3NjcmVlbl9taXNzaW5nX3NpbV9tZXNzYWdlX3Nob3J0KSkpOwpAQCAtNTYzLDcgKzUyNSw3IEBACiAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICBjYXNlIFNpbUxvY2tlZDoKICAgICAgICAgICAgICAgICAvLyB0ZXh0Ci0gICAgICAgICAgICAgICAgbUNhcnJpZXIuc2V0VGV4dCgKKyAgICAgICAgICAgICAgICBtU3RhdHVzVmlldy5zZXRDYXJyaWVyVGV4dCgKICAgICAgICAgICAgICAgICAgICAgICAgIGdldENhcnJpZXJTdHJpbmcoCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1VcGRhdGVNb25pdG9yLmdldFRlbGVwaG9ueVBsbW4oKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0Q29udGV4dCgpLmdldFRleHQoUi5zdHJpbmcubG9ja3NjcmVlbl9zaW1fbG9ja2VkX21lc3NhZ2UpKSk7CkBAIC01NzUsNyArNTM3LDcgQEAKICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgIGNhc2UgU2ltUHVrTG9ja2VkOgogICAgICAgICAgICAgICAgIC8vIHRleHQKLSAgICAgICAgICAgICAgICBtQ2Fycmllci5zZXRUZXh0KAorICAgICAgICAgICAgICAgIG1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Xlib2FyZE1vZGUobUlzQWxwaGEgPworICAgICAgICAgICAgICAgICAgICBQYXNzd29yZEVudHJ5S2V5Ym9hcmRIZWxwZXIuS0VZQk9BUkRfTU9ERV9BTFBIQQorICAgICAgICAgICAgICAgICAgICA6IFBhc3N3b3JkRW50cnlLZXlib2FyZEhlbHBlci5LRVlCT0FSRF9NT0RFX05VTUVSSUMpOworICAgICAgICAgICAgbUtleWJvYXJkVmlldy5zZXRWaXNpYmlsaXR5KAorICAgICAgICAgICAgICAgICAgICBtQ3JlYXRpb25IYXJkS2V5Ym9hcmRIaWRkZW4gPT0gQ29uZmlndXJhdGlvbi5IQVJES0VZQk9BUkRISURERU5fTk8KKyAgICAgICAgICAgICAgICAgICAgPyBWaWV3LklOVklTSUJMRSA6IFZpZXcuVklTSUJMRSk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBtS2V5Ym9hcmRIZWxwZXJBbHBoYSA9IG5ldyBQYXNzd29yZEVudHJ5S2V5Ym9hcmRIZWxwZXIoY29udGV4dCwgbUtleWJvYXJkVmlld0FscGhhLAorICAgICAgICAgICAgICAgICAgICB0aGlzLCBmYWxzZSk7CisgICAgICAgICAgICBtS2V5Ym9hcmRIZWxwZXIuc2V0S2V5Ym9hcmRNb2RlKFBhc3N3b3JkRW50cnlLZXlib2FyZEhlbHBlci5LRVlCT0FSRF9NT0RFX05VTUVSSUMpOworICAgICAgICAgICAgbUtleWJvYXJkSGVscGVyQWxwaGEuc2V0S2V5Ym9hcmRNb2RlKFBhc3N3b3JkRW50cnlLZXlib2FyZEhlbHBlci5LRVlCT0FSRF9NT0RFX0FMUEhBKTsKKyAgICAgICAgICAgIG1LZXlib2FyZFZpZXcuc2V0VmlzaWJpbGl0eShWaWV3LkdPTkUpOworICAgICAgICAgICAgbUtleWJvYXJkVmlld0FscGhhLnNldFZpc2liaWxpdHkoCisgICAgICAgICAgICAgICAgICAgIG1DcmVhdGlvbkhhcmRLZXlib2FyZEhpZGRlbiA9PSBDb25maWd1cmF0aW9uLkhBUkRLRVlCT0FSREhJRERFTl9OTworICAgICAgICAgICAgICAgICAgICA/IFZpZXcuSU5WSVNJQkxFIDogVmlldy5WSVNJQkxFKTsKKyAgICAgICAgICAgIG1QYXNzd29yZEVudHJ5LnNldFdpZHRoKG1LZXlib2FyZFZpZXdBbHBoYS5nZXRMYXlvdXRQYXJhbXMoKS53aWR0aCk7CisgICAgICAgIH0KIAotICAgICAgICBtS2V5Ym9hcmRWaWV3LnNldFZpc2liaWxpdHkobUNyZWF0aW9uSGFyZEtleWJvYXJkSGlkZGVuID09IENvbmZpZ3VyYXRpb24uSEFSREtFWUJPQVJESElEREVOX05PCi0gICAgICAgICAgICAgICAgPyBWaWV3LklOVklTSUJMRSA6IFZpZXcuVklTSUJMRSk7CisgICAgICAgIG1QYXNzd29yZEVudHJ5LnNldENvbXBvdW5kRHJhd2FibGVzV2l0aEludHJpbnNpY0JvdW5kcyhSLmRyYXdhYmxlLmljX2xvY2tfaWRsZV9sb2NrLCAwLAorICAgICAgICAgICAgICAgIDAsIDApOwogICAgICAgICBtUGFzc3dvcmRFbnRyeS5yZXF1ZXN0Rm9jdXMoKTsKIAogICAgICAgICAvLyBUaGlzIGFsbG93cyBrZXlib2FyZHMgd2l0aCBvdmVybGFwcGluZyBxd2VydHkvbnVtZXJpYyBrZXlzIHRvIGNob29zZSBqdXN0IHRoZQogICAgICAgICAvLyBudW1lcmljIGtleXMuCi0gICAgICAgIGlmIChpc0FscGhhKSB7CisgICAgICAgIGlmIChtSXNBbHBoYSkgewogICAgICAgICAgICAgbVBhc3N3b3JkRW50cnkuc2V0S2V5TGlzdGVuZXIoVGV4dEtleUxpc3RlbmVyLmdldEluc3RhbmNlKCkpOwogICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgbVBhc3N3b3JkRW50cnkuc2V0S2V5TGlzdGVuZXIoRGlnaXRzS2V5TGlzdGVuZXIuZ2V0SW5zdGFuY2UoKSk7CisgICAgICAgICAgICBtU3RhdHVz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nLmxvY2tzY3JlZW5fdG9vX21hbnlfZmFpbGVkX2F0dGVtcHRzX2NvdW50ZG93biwKICAgICAgICAgICAgICAgICAgICAgICAgIHNlY29uZHNSZW1haW5pbmcpOwotICAgICAgICAgICAgICAgIG1UaXRsZS5zZXRUZXh0KGluc3RydWN0aW9ucyk7CisgICAgICAgICAgICAgICAgbVN0YXR1c1ZpZXcuc2V0SW5zdHJ1Y3Rpb25UZXh0KGluc3RydWN0aW9ucyk7CiAgICAgICAgICAgICB9CiAKICAgICAgICAgICAgIEBPdmVycmlkZQogICAgICAgICAgICAgcHVibGljIHZvaWQgb25GaW5pc2goKSB7CiAgICAgICAgICAgICAgICAgbVBhc3N3b3JkRW50cnkuc2V0RW5hYmxlZCh0cnVlKTsKLSAgICAgICAgICAgICAgICBtVGl0bGUuc2V0VGV4dChSLnN0cmluZy5rZXlndWFyZF9wYXNzd29yZF9lbnRlcl9wYXNzd29yZF9jb2RlKTsKICAgICAgICAgICAgICAgICBtS2V5Ym9hcmRWaWV3LnNldEVuYWJsZWQodHJ1ZSk7CisgICAgICAgICAgICAgICAgcmVzZXRTdGF0dXNJbmZvKCk7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0uc3RhcnQoKTsKICAgICB9CkBAIC0yNDQsMjQgKzI4Nyw0MSBAQAogICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgfQogCisgICAgLy8gLS0tLS0tLS0tLSBJbmZvQ2FsbGJhY2sKKworICAgIC8qKiB7QGluaGVyaXREb2N9ICovCisgICAgcHVibGljIHZvaWQgb25SZWZyZXNoQmF0dGVyeUluZm8oYm9vbGVhbiBzaG93QmF0dGVyeUluZm8sIGJvb2xlYW4gcGx1Z2dlZEluLCBpbnQgYmF0dGVyeUxldmVsKSB7CisgICAgICAgIG1TdGF0dXNWaWV3Lm9uUmVmcmVzaEJhdHRlcnlJbmZvKHNob3dCYXR0ZXJ5SW5mbywgcGx1Z2dlZEluLCBiYXR0ZXJ5TGV2ZWwpOworICAgIH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hbmRsZUF0dGVtcHRMb2Nrb3V0KGRlYWRsaW5lKTsKICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAvLyBUT0RPIG1VbmxvY2tJY29uLnNldFZpc2liaWxpdHkoVmlldy5WSVNJQkxFKTsKLSAgICAgICAgICAgICAgICAgICAgbUluc3RydWN0aW9ucyA9IGdldENvbnRleHQoKS5nZXRTdHJpbmcoUi5zdHJpbmcubG9ja3NjcmVlbl9wYXR0ZXJuX3dyb25nKTsKLSAgICAgICAgICAgICAgICAgICAgdXBkYXRlU3RhdHVzTGluZXMoKTsKKyAgICAgICAgICAgICAgICAgICAgbVN0YXR1c1ZpZXcuc2V0SW5zdHJ1Y3Rpb25zKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldENvbnRleHQoKS5nZXRTdHJpbmcoUi5zdHJpbmcubG9ja3NjcmVlbl9wYXR0ZXJuX3dyb25nKSk7CisgICAgICAgICAgICAgICAgICAgIG1TdGF0dXNWaWV3LnVwZGF0ZVN0YXR1c0xpbmVzKCk7CiAgICAgICAgICAgICAgICAgICAgIG1Mb2NrUGF0dGVyblZpZXcucG9zdERlbGF5ZWQoCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUNhbmNlbFBhdHRlcm5SdW5uYWJsZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQQVRURVJOX0NMRUFSX1RJTUVPVVRfTVMpOwpAQCAtNTUyLDE3ICs0MzQsMTggQEAKICAgICAgICAgICAgIEBPdmVycmlkZQogICAgICAgICAgICAgcHVibGljIHZvaWQgb25UaWNrKGxvbmcgbWlsbGlzVW50aWxGaW5pc2hlZCkgewogICAgICAgICAgICAgICAgIGludCBzZWNvbmRzUmVtYWluaW5nID0gKGludCkgKG1pbGxpc1VudGlsRmluaXNoZWQgLyAxMDAwKTsKLSAgICAgICAgICAgICAgICBtSW5zdHJ1Y3Rpb25zID0gZ2V0Q29udGV4dCgpLmdldFN0cmluZygKKyAgICAgICAgICAgICAgICBtU3RhdHVzVmlldy5zZXRJbnN0cnVjdGlvbnMoZ2V0Q29udGV4dCgpLmdldFN0cmluZygKICAgICAgICAgICAgICAgICAgICAgICAgIFIuc3RyaW5nLmxvY2tzY3JlZW5fdG9vX21hbnlfZmFpbGVkX2F0dGVtcHRzX2NvdW50ZG93biwKLSAgICAgICAgICAgICAgICAgICAgICAgIHNlY29uZHNSZW1haW5pbmcpOwotICAgICAgICAgICAgICAgIHVwZGF0ZVN0YXR1c0xpbmVzKCk7CisgICAgICAgICAgICAgICAgICAgICAgICBzZWNvbmRzUmVtYWluaW5nKSk7CisgICAgICAgICAgICAgICAgbVN0YXR1c1ZpZXcudXBkYXRlU3RhdHVzTGluZXMoKTsKICAgICAgICAgICAgIH0KIAogICAgICAgICAgICAgQE92ZXJyaWRlCiAgICAgICAgICAgICBwdWJsaWMgdm9pZCBvbkZpbmlzaCgpIHsKICAgICAgICAgICAgICAgICBtTG9ja1BhdHRlcm5WaWV3LnNldEVuYWJsZWQodHJ1ZSk7Ci0gICAgICAgICAgICAgICAgbUluc3RydWN0aW9ucyA9IGdldENvbnRleHQoKS5nZXRTdHJpbmcoUi5zdHJpbmcubG9ja3NjcmVlbl9wYXR0ZXJuX2luc3RydWN0aW9ucyk7Ci0gICAgICAgICAgICAgICAgdXBkYXRlU3RhdHVzTGluZXMoKTsKKyAgICAgICAgICAgICAgICBtU3RhdHVzVmlldy5zZXRJbnN0cnVjdGlvbnMoZ2V0Q29udGV4dCgpLmdldFN0cmluZygKKyAgICAgICAgICAgICAgICAgICAgICAgIFIuc3RyaW5nLmxvY2tzY3JlZW5fcGF0dGVybl9pbnN0cnVjdGlvbnMpKTsKKyAgICAgICAgICAgICAgICBtU3RhdHVzVmlldy51cGRhdGVTdGF0dXNMaW5lcygpOwogICAgICAgICAgICAgICAgIC8vIFRPRE8gbVVubG9ja0ljb24uc2V0VmlzaWJpbGl0eShWaWV3LlZJU0lCTEUpOwogICAgICAgICAgICAgICAgIG1GY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sKG1QcmVwYXJlZFBhbmVsLCBmYWxzZSk7CkBAIC0zMTUsOSArMzIyLDExIEBACiAKICAgICAgICAgaWYgKHN0LmNyZWF0ZWRQYW5lbFZpZXcgPT0gbnVsbCkgewogICAgICAgICAgICAgLy8gSW5pdCB0aGUgcGFuZWwgc3RhdGUncyBtZW51LS1yZXR1cm4gZmFsc2UgaWYgaW5pdCBmYWlsZWQKLSAgICAgICAgICAgIGlmIChzdC5tZW51ID09IG51bGwpIHsKLSAgICAgICAgICAgICAgICBpZiAoIWluaXRpYWxpemVQYW5lbE1lbnUoc3QpIHx8IChzdC5tZW51ID09IG51bGwpKSB7Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgIGlmIChzdC5tZW51ID09IG51bGwgfHwgc3QucmVmcmVzaE1lbnVDb250ZW50KSB7CisgICAgICAgICAgICAgICAgaWYgKHN0Lm1lbnUgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICBpZiAoIWluaXRpYWxpemVQYW5lbE1lbnUoc3QpIHx8IChzdC5tZW51ID09IG51bGwpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgLy8gQ2FsbCBjYWxsYmFjaywgYW5kIHJldHVybiBpZiBpdCBkb2Vzbid0IHdhbnQgdG8gZGlzcGxheSBtZW51CiAgICAgICAgICAgICAgICAgaWYgKChjYiA9PSBudWxsKSB8fCAhY2Iub25DcmVhdGVQYW5lbE1lbnUoc3QuZmVhdHVyZUlkLCBzdC5tZW51KSkgewpAQCAtMzI2LDYgKzMzNSwxMiBAQAogCiAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgCisgICAgICAgICAgICAgICAgc3QucmVmcmVzaE1lbnVDb250ZW50ID0gZmFsc2U7CisK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3RhdGUoZmVhdHVyZUlkLCB0cnVlKTsKKyAgICAgICAgICAgIGlmIChmZWF0dXJlSWQgPT0gRkVBVFVSRV9PUFRJT05TX1BBTkVMICYmIG1BY3Rpb25CYXIgIT0gbnVsbCAmJgorICAgICAgICAgICAgICAgICAgICBtQWN0aW9uQmFyLmlzT3ZlcmZsb3dSZXNlcnZlZCgpKSB7CisgICAgICAgICAgICAgICAgaWYgKCFtQWN0aW9uQmFyLmlzT3ZlcmZsb3dNZW51U2hvd2luZygpKSB7CisgICAgICAgICAgICAgICAgICAgIGZpbmFsIENhbGxiYWNrIGNiID0gZ2V0Q2FsbGJhY2soKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGNiICE9IG51bGwgJiYKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYi5vblByZXBhcmVQYW5lbChmZWF0dXJlSWQsIHN0LmNyZWF0ZWRQYW5lbFZpZXcsIHN0Lm1lbnUpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBwbGF5U291bmRFZmZlY3QgPSBtQWN0aW9uQmFyLnNob3dPdmVyZmxvd01lbnUoKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIHBsYXlTb3VuZEVmZmVjdCA9IG1BY3Rpb25CYXIuaGlkZU92ZXJmbG93TWVudSgpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgaWYgKHN0LmlzT3BlbiB8fCBzdC5pc0hhbmRsZWQpIHsKIAotICAgICAgICAgICAgICAgIC8vIFBsYXkgdGhlIHNvdW5kIGVmZmVjdCBpZiB0aGUgdXNlciBjbG9zZWQgYW4gb3BlbiBtZW51IChhbmQgbm90IGlmCi0gICAgICAgICAgICAgICAgLy8gdGhleSBqdXN0IHJlbGVhc2VkIGEgbWVudSBzaG9ydGN1dCkKLSAgICAgICAgICAgICAgICBwbGF5U291bmRFZmZlY3QgPSBzdC5pc09wZW47CisgICAgICAgICAgICAgICAgICAgIC8vIFBsYXkgdGhlIHNvdW5kIGVmZmVjdCBpZiB0aGUgdXNlciBjbG9zZWQgYW4gb3BlbiBtZW51IChhbmQgbm90IGlmCisgICAgICAgICAgICAgICAgICAgIC8vIHRoZXkganVzdCByZWxlYXNlZCBhIG1lbnUgc2hvcnRjdXQpCisgICAgICAgICAgICAgICAgICAgIHBsYXlTb3VuZEVmZmVjdCA9IHN0LmlzT3BlbjsKIAotICAgICAgICAgICAgICAgIC8vIENsb3NlIG1lbnUKLSAgICAgICAgICAgICAgICBjbG9zZVBhbmVsKHN0LCB0cnVlKTsKKyAgICAgICAgICAgICAgICAgICAgLy8gQ2xvc2UgbWVudQorICAgICAgICAgICAgICAgICAgICBjbG9zZVBhbmVsKHN0LCB0cnVlKTsKIAotICAgICAgICAgICAgfSBlbHNlIGlmIChzdC5pc1ByZXBhcmVkKSB7CisgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChzdC5pc1ByZXBhcmVkKSB7CiAKLSAgICAgICAgICAgICAgICAvLyBXcml0ZSAnbWVudSBvcGVuZWQnIHRvIGV2ZW50IGxvZwotICAgICAgICAgICAgICAgIEV2ZW50TG9nLndyaXRlRXZlbnQoNTAwMDEsIDApOworICAgICAgICAgICAgICAgICAgICAvLyBXcml0ZSAnbWVudSBvcGVuZWQnIHRvIGV2ZW50IGxvZworICAgICAgICAgICAgICAgICAgICBFdmVudExvZy53cml0ZUV2ZW50KDUwMDAxLCAwKTsKIAotICAgICAgICAgICAgICAgIC8vIFNob3cgbWVudQotICAgICAgICAgICAgICAgIG9wZW5QYW5lbChzdCwgZXZlbnQpOworICAgICAgICAgICAgICAgICAgICAvLyBTaG93IG1lbnUKKyAgICAgICAgICAgICAgICAgICAgb3BlblBhbmVsKHN0LCBldmVudCk7CiAKLSAgICAgICAgICAgICAgICBwbGF5U291bmRFZmZlY3QgPSB0cnVlOworICAgICAgICAgICAgICAgICAgICBwbGF5U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wpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgbmV3IE1lbnVQb3B1cEhlbHBlcihnZXRDb250ZXh0KCksIHN1Yk1lbnUpLnNob3coKTsKKyAgICAgICAgfQogCiAgICAgICAgIHJldHVybiB0cnVlOwogICAgIH0KQEAgLTc4OCw2ICs4NTMsMjEgQEAKICAgICB9CiAKICAgICBwcml2YXRlIHZvaWQgcmVvcGVuTWVudShib29sZWFuIHRvZ2dsZU1lbnVNb2RlKSB7CisgICAgICAgIGlmIChtQWN0aW9uQmFyICE9IG51bGwpIHsKKyAgICAgICAgICAgIGlmICghbUFjdGlvbkJhci5pc092ZXJmbG93TWVudVNob3dpbmcoKSB8fCAhdG9nZ2xlTWVudU1vZGUpIHsKKyAgICAgICAgICAgICAgICBmaW5hbCBDYWxsYmFjayBjYiA9IGdldENhbGxiYWNrKCk7CisgICAgICAgICAgICAgICAgaWYgKGNiICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgZmluYWwgUGFuZWxGZWF0dXJlU3RhdGUgc3QgPSBnZXRQYW5lbFN0YXRlKEZFQVRVUkVfT1BUSU9OU19QQU5FTCwgdHJ1ZSk7CisgICAgICAgICAgICAgICAgICAgIGlmIChjYi5vblByZXBhcmVQYW5lbChGRUFUVVJFX09QVElPTlNfUEFORUwsIHN0LmNyZWF0ZWRQYW5lbFZpZXcsIHN0Lm1lbnUpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBtQWN0aW9uQmFyLnNob3dPdmVyZmxvd01lbnUoKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgbUFjdGlvbkJhci5oaWRlT3ZlcmZsb3dNZW51KCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKwogICAgICAgICBQYW5lbEZlYXR1cmVTdGF0ZSBzdCA9IGdldFBhbmVsU3RhdGUoRkVB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aXRoaW4gdGhlIHBsYXkgc291bmQgZGVsYXksIHRoZW4KQEAgLTE2NTcsNiArMTc0MSwxNCBAQAogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KIAorICAgICAgICAgICAgLy8gQmFjayBjYW5jZWxzIGFjdGlvbiBtb2RlcyBmaXJzdC4KKyAgICAgICAgICAgIGlmIChtQWN0aW9uTW9kZSAhPSBudWxsICYmIGtleUNvZGUgPT0gS2V5RXZlbnQuS0VZQ09ERV9CQUNLKSB7CisgICAgICAgICAgICAgICAgaWYgKGFjdGlvbiA9PSBLZXlFdmVudC5BQ1RJT05fVVApIHsKKyAgICAgICAgICAgICAgICAgICAgbUFjdGlvbk1vZGUuZmluaXNoKCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICAgICAgfQorCiAgICAgICAgICAgICBmaW5hbCBDYWxsYmFjayBjYiA9IGdldENhbGxiYWNrKCk7CiAgICAgICAgICAgICBmaW5hbCBib29sZWFuIGhhbmRsZWQgPSBjYiAhPSBudWxsICYmIG1GZWF0dXJlSWQgPCAwID8gY2IuZGlzcGF0Y2hLZXlFdmVudChldmVudCkKICAgICAgICAgICAgICAgICAgICAgOiBzdXBlci5kaXNwYXRjaEtleUV2ZW50KGV2ZW50KTsKQEAgLTE4NzksNiArMTk3MSw1NSBAQAogICAgICAgICAgICAgcmV0dXJuIG1Db250ZXh0TWVudUhlbHBlciAhPSBudWxsOwogICAgICAgICB9CiAKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyBBY3Rpb25Nb2RlIHN0YXJ0QWN0aW9uTW9kZUZvckNoaWxkKFZpZXcgb3JpZ2luYWxWaWV3LAorICAgICAgICAgICAgICAgIEFjdGlvbk1vZGUuQ2FsbGJhY2sgY2FsbGJhY2spIHsKKyAgICAgICAgICAgIC8vIG9yaWdpbmFsVmlldyBjYW4gYmUgdXNlZCBoZXJlIHRvIGJlIHN1cmUgdGhhdCB3ZSBkb24ndCBvYnNjdXJlCisgICAgICAgICAgICAvLyByZWxldmFudCBjb250ZW50IHdpdGggdGhlIGNvbnRleHQgbW9kZSBVSS4KKyAgICAgICAgICAgIHJldHVybiBzdGFydEFjdGlvbk1vZGUoY2FsbGJhY2spOworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyBBY3Rpb25Nb2RlIHN0YXJ0QWN0aW9uTW9kZShBY3Rpb25Nb2RlLkNhbGxiYWNrIGNhbGxiYWNrKSB7CisgICAgICAgICAgICBpZiAobUFjdGlvbk1vZGUgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIG1BY3Rpb25Nb2RlLmZpbmlzaCgpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBmaW5hbCBBY3Rpb25Nb2RlLkNhbGxiYWNrIHdyYXBwZWRDYWxsYmFjayA9IG5ldyBBY3Rpb25Nb2RlQ2FsbGJhY2tXcmFwcGVyKGNhbGxiYWNrKTsKKyAgICAgICAgICAgIEFjdGlvbk1vZGUgbW9kZSA9IGdldENhbGxiYWNrKCkub25TdGFydEFjdGlvbk1vZGUod3JhcHBlZENhbGxiYWNrKTsKKyAgICAgICAgICAgIGlmIChtb2RlICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBtQWN0aW9uTW9kZSA9IG1vZGU7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIGlmIChtQWN0aW9uTW9kZVZpZXcgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICBpZiAoaGFzRmVhdHVyZShGRUFUVVJFX0FDVElPTl9NT0RFX09WRVJMQVkpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBtQWN0aW9uTW9kZVZpZXcgPSBuZXcgQWN0aW9uQmFyQ29udGV4dFZpZXcobUNvbnRleHQpOworICAgICAgICAgICAgICAgICAgICAgICAgRnJhbWVMYXlvdXQuTGF5b3V0UGFyYW1zIHBhcmFtcyA9IG5ldyBGcmFtZUxheW91dC5MYXlvdXRQYXJhbXMoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1BVENIX1BBUkVOVCwgV1JBUF9DT05URU5UKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGFkZFZpZXcobUFjdGlvbk1vZGVWaWV3LCBwYXJhbXMpOworICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAgICAgVmlld1N0dWIgc3R1YiA9IChWaWV3U3R1YikgZmluZFZpZXdCeUlkKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLmlkLmFjdGlvbl9tb2RlX2Jhcl9zdHViKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzdHViICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBtQWN0aW9uTW9kZVZpZXcgPSAoQWN0aW9uQmFyQ29udGV4dFZpZXcpIHN0dWIuaW5mbGF0ZSgpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgaWYgKG1BY3Rpb25Nb2RlVmlldyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIG1vZGUgPSBuZXcgU3RhbmRhbG9uZUFjdGlvbk1vZGUoZ2V0Q29udGV4dCgpLCBtQWN0aW9uTW9kZVZpZXcsIHdyYXBwZWRDYWxsYmFjayk7CisgICAgICAgICAgICAgICAgICAgIGlmIChjYWxsYmFjay5vbkNyZWF0ZUFjdGlvbk1vZGUobW9kZSwgbW9kZS5nZXRNZW51KCkpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBtb2RlLmludmFsaWRhdGUoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1BY3Rpb25Nb2RlVmlldy5pbml0Rm9yTW9kZShtb2RlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1BY3Rpb25Nb2RlVmlldy5zZXRWaXNpYmlsaXR5KFZpZXcuVklTSUJMRSk7CisgICAgICAgICAgICAgICAgICAgICAgICBtQWN0aW9uTW9kZSA9IG1vZGU7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICBtQWN0aW9uTW9kZSA9IG51bGw7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gbUFjdGlvbk1vZGU7CisgICAgICAgIH0KKwogICAgICAgICBwdWJsaWMgdm9pZCBzdGFydENoYW5naW5nKCkgewogICAgICAgICAgICAgbUNoYW5naW5nID0gdHJ1ZTsKICAgICAgICAgfQpAQCAtMjA1OCw2ICsyMTk5LDM3IEBACiAgICAgICAgICAgICBpZiAoa2VlcE9uKSBQaG9uZVdpbmRvdy50aGlzLmFkZEZsYWdzKFdpbmRvd01hbmFnZXIuTGF5b3V0UGFyYW1zLkZMQUdfS0VFUF9TQ1JFRU5fT04pOwogICAgICAgICAgICAgZWxzZSBQaG9uZVdpbmRvdy50aGlzLmNsZWFyRmxhZ3MoV2luZG93TWFuYWdlci5MYXlvdXRQYXJhbXMuRkxBR19LRUVQX1NDUkVFTl9PTik7CiAgICAgICAgIH0KKworICAgICAgICAvKioKKyAgICAgICAgICogQ2xlYXJzIG91dCBpbnRlcm5hbCByZWZlcmVuY2Ugd2hlbiB0aGUgYWN0aW9uIG1vZGUgaXMgZGVzdHJveWVkLgorICAgICAgICAgKi8KKyAgICAgICAgcHJpdmF0ZSBjbGFzcyBBY3Rpb25Nb2RlQ2FsbGJhY2tXcmFwcGVyIGltcGxlbWVudHMgQWN0aW9uTW9kZS5DYWxsYmFjayB7CisgICAgICAgICAgICBwcml2YXRlIEFjdGlvbk1vZGUuQ2FsbGJhY2sgbVdyYXBwZWQ7CisKKyAgICAgICAgICAgIHB1YmxpYyBBY3Rpb25Nb2RlQ2FsbGJhY2tXcmFwcGVyKEFjdGlvbk1vZGUuQ2FsbGJhY2sgd3JhcHBlZCkgeworICAgICAgICAgICAgICAgIG1XcmFwcGVkID0gd3JhcHBlZDsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcHVibGljIGJvb2xlYW4gb25DcmVhdGVBY3Rpb25Nb2RlKEFjdGlvbk1vZGUgbW9kZSwgTWVudSBtZW51KSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIG1XcmFwcGVkLm9uQ3JlYXRlQWN0aW9uTW9kZShtb2RlLCBtZW51KTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcHVibGljIGJvb2xlYW4gb25QcmVwYXJlQWN0aW9uTW9kZShBY3Rpb25Nb2RlIG1vZGUsIE1lbnUgbWVudSkgeworICAgICAgICAgICAgICAgIHJldHVybiBtV3JhcHBlZC5vblByZXBhcmVBY3Rpb25Nb2RlKG1vZGUsIG1lbnUpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBwdWJsaWMgYm9vbGVhbiBvbkFjdGlvbkl0ZW1DbGlja2VkKEFjdGlvbk1vZGUgbW9kZSwgTWVudUl0ZW0gaXRlbSkgeworICAgICAgICAgICAgICAgIHJldHVybiBtV3JhcHBlZC5vbkFjdGlvbkl0ZW1DbGlja2VkKG1vZGUsIGl0ZW0pOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBwdWJsaWMgdm9pZCBvbkRlc3Ryb3lBY3Rpb25Nb2RlKEFjdGlvbk1vZGUgbW9kZSkgeworICAgICAgICAgICAgICAgIG1XcmFwcGVkLm9uRGVzdHJveUFjdGlvbk1vZGUobW9kZSk7CisgICAgICAgICAgICAgICAgaWYgKG1BY3Rpb25Nb2RlVmlldyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIG1BY3Rpb25Nb2RlVmlldy5yZW1vdmVBbGxWaWV3cygpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBtQWN0aW9uTW9kZSA9IG51bG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bihjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0eWxlYWJsZS5XaW5kb3dfd2luZG93RnVsbHNjcmVlbiwgZmFsc2UpKSB7CkBAIC0yMTg5LDYgKzIzNzIsMTIgQEAKICAgICAgICAgICAgIC8vIElmIHRoZSB3aW5kb3cgaXMgZmxvYXRpbmcsIHdlIG5lZWQgYSBkaWFsb2cgbGF5b3V0CiAgICAgICAgICAgICBpZiAobUlzRmxvYXRpbmcpIHsKICAgICAgICAgICAgICAgICBsYXlvdXRSZXNvdXJjZSA9IGNvbS5hbmRyb2lkLmludGVybmFsLlIubGF5b3V0LmRpYWxvZ190aXRsZTsKKyAgICAgICAgICAgIH0gZWxzZSBpZiAoKGZlYXR1cmVzICYgKDEgPDwgRkVBVFVSRV9BQ1RJT05fQkFSKSkgIT0gMCkgeworICAgICAgICAgICAgICAgIGlmICgoZmVhdHVyZXMgJiAoMSA8PCBGRUFUVVJFX0FDVElPTl9CQVJfT1ZFUkxBWSkpICE9IDApIHsKKyAgICAgICAgICAgICAgICAgICAgbGF5b3V0UmVzb3VyY2UgPSBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLmxheW91dC5zY3JlZW5fYWN0aW9uX2Jhcl9vdmVybGF5OworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIGxheW91dFJlc291cmNlID0gY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5sYXlvdXQuc2NyZWVuX2FjdGlvbl9iYXI7CisgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICBsYXlvdXRSZXNvdXJjZSA9IGNvbS5hbmRyb2lkLmludGVybmFsLlIubGF5b3V0LnNjcmVlbl90aXRsZTsKICAgICAgICAgICAgIH0KQEAgLTIyNzMsNiArMjQ2MiwyMiBAQAogICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgIG1UaXRsZVZpZXcuc2V0VGV4dChtVGl0bGUpOwogICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgbUFjdGlvbkJhciA9IChBY3Rpb25CYXJWaWV3KSBmaW5kVmlld0J5SWQoY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5pZC5hY3Rpb25fYmFyKTsKKyAgICAgICAgICAgICAgICBpZiAobUFjdGlvbkJhciAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIGlmIChtQWN0aW9uQmFyLmdldFRpdGxlKCkgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgbUFjdGlvbkJhci5zZXRXaW5kb3dUaXRsZShtVGl0bGUpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIC8vIFBvc3QgdGhlIHBhbmVsIGludmFsaWRhdGUgZm9yIGxhdGVyOyBhdm9pZCBhcHBsaWNhdGlvbiBvbkNyZWF0ZU9wdGlvbnNNZW51CisgICAgICAgICAgICAgICAgICAgIC8vIGJlaW5nIGNhbGxlZCBpbiB0aGUgbWlkZGxlIG9mIG9uQ3JlYXRlIG9yIHNpbWlsYXIuCisgICAgICAgICAgICAgICAgICAgIG1EZWNvci5wb3N0KG5ldyBSdW5uYWJsZSgpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHB1YmxpYyB2b2lkIHJ1bigpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWlzRGVzdHJveWVkKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW52YWxpZGF0ZVBhbmVsTWVudShGRUFUVVJFX0FDVElPTl9CQVIpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfSk7CisgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogICAgICAgICB9CiAgICAgfQpAQCAtMjYyNiw2ICsyODMxLDggQEA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GZyb20KKyAgICAgICAgLy8gY29uZmlnX3N0YXR1c0JhckNhbkhpZGUgYmVjYXVzZSB0aGUgbGF0dGVyIGRlcGVuZHMgb24gdGhlIHNjcmVlbiBzaXplCiAgICAgfQogCiAgICAgcHVibGljIHZvaWQgdXBkYXRlU2V0dGluZ3MoKSB7CkBAIC05NzUsNiArOTc5LDExIEBACiAgICAgICAgICAgICAgICAgICAgIHJldHVybiBXaW5kb3dNYW5hZ2VySW1wbC5BRERfTVVMVElQTEVfU0lOR0xFVE9OOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBtU3RhdHVzQmFyID0gd2luOworCisgICAgICAgICAgICAgICAgLy8gVGhlIENvbmZpZ3VyYXRpb24gd2lsbCBiZSBzdGFibGUgYnkgbm93LCBzbyB3ZSBjYW4gbG9hZCB0aGlzCisgICAgICAgICAgICAgICAgbVN0YXR1c0JhckNhbkhpZGUgPSBtQ29udGV4dC5nZXRSZXNvdXJjZXMoKS5nZXRCb29sZWFuKAorICAgICAgICAgICAgICAgICAgICAgICAgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5ib29sLmNvbmZpZ19zdGF0dXNCYXJDYW5IaWRlKTsKKwogICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgY2FzZSBUWVBFX1NUQVRVU19CQVJfUEFORUw6CiAgICAgICAgICAgICAgICAgbUNvbnRleHQuZW5mb3JjZUNhbGxpbmdPclNlbGZQZXJtaXNzaW9uKApAQCAtMTIzMyw3ICsxMjQyLDcgQEAKICAgICBwdWJsaWMgdm9pZCBnZXRDb250ZW50SW5zZXRIaW50THcoV2luZG93TWFuYWdlci5MYXlvdXRQYXJhbXMgYXR0cnMsIFJlY3QgY29udGVudEluc2V0KSB7CiAgICAgICAgIGZpbmFsIGludCBmbCA9IGF0dHJzLmZsYWdzOwogICAgICAgICAKLSAgICAgICAgaWYgKChmbCAmCisgICAgICAgIGlmIChtU3RhdHVzQmFyQ2FuSGlkZSAmJiAoZmwgJgogICAgICAgICAgICAgICAgIChGTEFHX0xBWU9VVF9JTl9TQ1JFRU4gfCBGTEFHX0ZVTExTQ1JFRU4gfCBGTEFHX0xBWU9VVF9JTlNFVF9ERUNPUikpCiAgICAgICAgICAgICAgICAgPT0gKEZMQUdfTEFZT1VUX0lOX1NDUkVFTiB8IEZMQUdfTEFZT1VUX0lOU0VUX0RFQ09SKSkgewogICAgICAgICAgICAgY29udGVudEluc2V0LnNldChtQ3VyTGVmdCwgbUN1clRvcCwgbVcgLSBtQ3VyUmlnaHQsIG1IIC0gbUN1ckJvdHRvbSk7CkBAIC0xMjY2LDEwICsxMjc1LDE3IEBACiAgICAgICAgICAgICBpZiAobVN0YXR1c0Jhci5pc1Zpc2libGVMdygpKSB7CiAgICAgICAgICAgICAgICAgLy8gSWYgdGhlIHN0YXR1cyBiYXIgaXMgaGlkZGVuLCB3ZSBkb24ndCB3YW50IHRvIGNhdXNlCiAgICAgICAgICAgICAgICAgLy8gd2luZG93cyBiZWhpbmQgaXQgdG8gc2Nyb2xsLgotICAgICAgICAgICAgICAgIG1Eb2NrVG9wID0gbUNvbnRlbnRUb3AgPSBtQ3VyVG9wID0gbVN0YXR1c0Jhci5nZXRGcmFtZUx3KCkuYm90dG9tOwotICAgICAgICAgICAgICAgIGlmIChERUJVR19MQVlPVVQpIExvZy52KFRBRywgIlN0YXR1cyBiYXI6IG1Eb2NrQm90dG9tPSIKLSAgICAgICAgICAgICAgICAgICAgICAgICsgbURvY2tCb3R0b20gKyAiIG1Db250ZW50Qm90dG9tPSIKLSAgICAgICAgICAgICAgICAgICAgICAgICsgbUNvbnRlbnRCb3R0b20gKyAiIG1DdXJCb3R0b209IiArIG1DdXJCb3R0b20pOworICAgICAgICAgICAgICAgIGZpbmFsIFJlY3QgciA9IG1TdGF0dXNCYXIuZ2V0RnJhbWVMdygpOworICAgICAgICAgICAgICAgIGlmIChtRG9ja1RvcCA9PSByLnRvcCkgbURvY2tUb3AgPSByLmJvdHRvbTsKKyAgICAgICAgICAgICAgICBlbHNlIGlmIChtRG9ja0JvdHRvbSA9PSByLmJvdHRvbSkgbURvY2tCb3R0b20gPSByLnRvcDsKKyAgICAgICAgICAgICAgICBtQ29udGVudFRvcCA9IG1DdXJUb3AgPSBtRG9ja1RvcDsKKyAgICAgICAgICAgICAgICBtQ29udGVudEJvdHRvbSA9IG1DdXJCb3R0b20gPSBtRG9ja0JvdHRvbTsKKyAgICAgICAgICAgICAgICBpZiAoREVCVUdfTEFZT1VUKSBMb2cudihUQUcsICJTdGF0dXMgYmFyOiBtRG9ja1RvcD0iICsgbURvY2tUb3AKKyAgICAgICAgICAgICAgICAgICAgICAgICsgIiBtQ29udGVudFRvcD0iICsgbUNvbnRlbnRUb3AKKyAgICAgICAgICAgICAgICAgICAgICAgICsgIiBtQ3VyVG9wPSIgKyBtQ3VyVG9wCisgICAgICAgICAgICAgICAgICAgICAgICArICIgbURvY2tCb3R0b209IiArIG1Eb2NrQm90dG9tCisgICAgICAgICAgICAgICAgICAgICAgICArICIgbUNvbnRlbnRCb3R0b209IiArIG1Db250ZW50Qm90dG9tCisgICAgICAgICAgICAgICAgICAgICAgICArICIgbUN1ckJvdHRvbT0iICsgbUN1ckJvdHRvbSk7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KICAgICB9CkBAIC0xMzU0LDcgKzEzNzAsNyBAQAogICAgICAgICAgICAgYXR0cnMuZ3Jhdml0eSA9IEdyYXZpdHkuQk9UVE9NOwogICAgICAgICAgICAgbURvY2tMYXllciA9IHdpbi5nZXRTdXJmYWNlTGF5ZXIoKTsKICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgIGlmICgoZmwgJgorICAgICAgICAgICAgaWYgKG1TdGF0dXNCYXJDYW5IaWRlICYmIChmbCAmCiAgICAgICAgICAgICAgICAgICAgIChGTEFHX0xBWU9VVF9JTl9TQ1JFRU4gfCBGTEFHX0ZVTExTQ1JFRU4gfCBGTEFHX0xBWU9VVF9JTlNFVF9ERUNPUikpCiAgICAgICAgICAgICAgICAgICAgID09IChGTEFHX0xBWU9VVF9JTl9TQ1JFRU4gfCBGTEFHX0xBWU9VVF9JTlNFVF9ERUNPUikpIHsKICAgICAgICAgICAgICAgICAvLyBUaGlzIGlzIHRoZSBjYXNlIGZvciBhIG5vcm1hbCBhY3Rpdml0eSB3aW5kb3c6IHdlIHdhbnQgaXQKQEAgLTEzODYsNyArMTQwMiw3IEBACiAgICAgICAgICAgICAgICAgICAgIHZmLnJpZ2h0ID0gbUN1clJpZ2h0OwogICAgICAgICAgICAgICAgICAgICB2Zi5ib3R0b20gPSBtQ3VyQm90dG9tOwogICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0gZWxzZSBpZiAoKGZsICYgRkxBR19MQVlPVVRfSU5fU0NSRUVOKSAhPSAwKSB7CisgICAgICAgICAgICB9IGVsc2UgaWYgKG1TdGF0dXNCYXJDYW5IaWRlICYmIChmbCAmIEZMQUdfTEFZT1VUX0lOX1NDUkVFTikgIT0gMCkgewogICAgICAgICAgICAgICAgIC8vIEEgd2luZG93IHRoYXQgaGFzIHJlcXVlc3RlZCB0byBmaWxsIHRoZSBlbnRpcmUgc2NyZWVuIGp1c3QKICAgICAgICAgICAgICAgICAvLyBnZXRzIGV2ZXJ5dGhpbmcsIHBlcmlvZC4KICAgICAgICAgICAgICAgICBwZi5sZWZ0ID0gZGYubGVmdCA9IGNmLmxlZnQgPSAwOwpAQCAtMTUzMCw5ICsxNTQ2LDEzIEBACiAgICAgICAgICAgICAgICAgYm9vbGVhbiBoaWRlU3RhdHVzQmFyID0KICAgICAgICAgICAgICAgICAgICAgKGxwLmZsYWdzICYgV2luZG93TWFuYWdlci5MYXlvdXRQYXJhbXMuRkxBR19GVUxMU0NSRUVOKSAhPSAwOwogICAgICAgICAgICAgICAgIGlmIChoaWRlU3RhdHVzQmFyKSB7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChERUJVR19MQVlPVVQpIExvZy52KFRBRywgIkhpZGluZyBzdGF0dXMgYmFyIik7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChtU3RhdHVzQmFyLmhpZGVMdyh0cnVlKSkgY2hhbmdlcyB8PSBGSU5JU0hfTEFZT1VUX1JFRE9fTEFZT1VUOwotICAgICAgICAgICAgICAgICAgICBoaWRpbmcgPSB0cnVlOworICAgICAgICAgICAgICAgICAgICBpZiAobVN0YXR1c0JhckNhbkhpZGUpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChERUJVR19MQVlPVVQpIExvZy52KFRBRywgIkhpZGluZyBzdGF0dXMgYmFyIik7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAobVN0YXR1c0Jhci5oaWRlTHcodHJ1ZSkpIGNoYW5nZXMgfD0gRklOSVNIX0xBWU9VVF9SRURPX0xBWU9VVDsKKyAgICAgICAgICAgICAgICAgICAgICAgIGhpZGluZyA9IHRydWU7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAobG9jYWxMT0dWKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBMb2cudihUQUcsICJQcmV2ZW50aW5nIHN0YXR1cyBiYXIgZnJvbSBoaWRpbmcgYnkgcG9saWN5Iik7CisgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICBpZiAoREVCVUdfTEFZT1VUKSBMb2cudihUQUcsICJTaG93aW5nIHN0YXR1cyBiYXIiKTsKICAgICAgICAgICAgICAgICAgICAgaWYgKG1TdGF0dXNCYXIuc2hvd0x3KHRydWUpKSBjaGFuZ2VzIHw9IEZJTklTSF9MQVlPVVRfUkVET19MQVlPVVQ7CmRpZmYgLS1naXQgYS9wb2xpY3kvc3JjL2NvbS9hbmRyb2lkL2ludGVybmFsL3BvbGljeS9pbXBsL1N0YXR1c1ZpZXcuamF2YSBiL3BvbGljeS9zcmMvY29tL2FuZHJvaWQvaW50ZXJuYWwvcG9saWN5L2ltcGwvU3RhdHVzVmlldy5qYXZhCm5ldy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Qgc3RyaW5nSWQpIHsKKyAgICAgICAgbUNhcnJpZXIuc2V0VGV4dChzdHJpbmdJZCk7CisgICAgfQorICAgIHZvaWQgc2V0Q2FycmllclRleHQoU3RyaW5nIHN0cmluZykgeworICAgICAgICBtQ2Fycmllci5zZXRUZXh0KHN0cmluZyk7CisgICAgfQorCisgICAgLyoqIE9yaWdpbmF0ZWQgZnJvbSBQYXR0ZXJuVW5sb2NrU2NyZWVuICoqLworICAgIHZvaWQgdXBkYXRlU3RhdHVzTGluZXMoKSB7CisgICAgICAgIGlmIChtSGFzUHJvcGVydHkpIHsKKyAgICAgICAgICAgIC8vIFRPRE8gR2V0IGFjdHVhbCBuYW1lICYgZW1haWwKKyAgICAgICAgICAgIFN0cmluZyBuYW1lID0gIkpvaG4gU21pdGgiOworICAgICAgICAgICAgU3RyaW5nIGVtYWlsID0gImpzbWl0aEBnbWFpbC5jb20iOworICAgICAgICAgICAgbVByb3BlcnR5T2Yuc2V0VGV4dCgiUHJvcGVydHkgb2Y6XG4iICsgbmFtZSArICJcbiIgKyBlbWFpbCk7CisgICAgICAgICAgICBtUHJvcGVydHlPZi5zZXRWaXNpYmlsaXR5KFZpZXcuVklTSUJMRSk7CisgICAgICAgIH0KKworICAgICAgICBpZiAoIW1IYXNTdGF0dXMyKSByZXR1cm47CisKKyAgICAgICAgaWYgKG1JbnN0cnVjdGlvbnMgIT0gbnVsbCkgeworICAgICAgICAgICAgLy8gaW5zdHJ1Y3Rpb25zIG9ubHkKKyAgICAgICAgICAgIG1TdGF0dXMxLnNldFRleHQobUluc3RydWN0aW9ucyk7CisgICAgICAgICAgICBpZiAoVGV4dFV0aWxzLmlzRW1wdHkobUluc3RydWN0aW9ucykpIHsKKyAgICAgICAgICAgICAgICBtU3RhdHVzMS5zZXRDb21wb3VuZERyYXdhYmxlc1dpdGhJbnRyaW5zaWNCb3VuZHMoMCwgMCwgMCwgMCk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIG1TdGF0dXMxLnNldENvbXBvdW5kRHJhd2FibGVzV2l0aEludHJpbnNpY0JvdW5kcygKKyAgICAgICAgICAgICAgICAgICAgICAgIFIuZHJhd2FibGUuaWNfbG9ja19pZGxlX2xvY2ssIDAsIDAsIDApOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBtU3RhdHVzMS5zZXRWaXNpYmlsaXR5KFZpZXcuVklTSUJMRSk7CisgICAgICAgICAgICBtU3RhdHVzMi5zZXRWaXNpYmlsaXR5KFZpZXcuSU5WSVNJQkxFKTsKKyAgICAgICAgfSBlbHNlIGlmIChtU2hvd2luZ0JhdHRlcnlJbmZvICYmIG1OZXh0QWxhcm0gPT0gbnVsbCkgeworICAgICAgICAgICAgLy8gYmF0dGVyeSBvbmx5CisgICAgICAgICAgICBpZiAobVBsdWdnZWRJbikgeworICAgICAgICAgICAgICBpZiAobUJhdHRlcnlMZXZlbCA+PSAxMDApIHsKKyAgICAgICAgICAgICAgICBtU3RhdHVzMS5zZXRUZXh0KGdldENvbnRleHQoKS5nZXRTdHJpbmcoUi5zdHJpbmcubG9ja3NjcmVlbl9jaGFyZ2VkKSk7CisgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICBtU3RhdHVzMS5zZXRUZXh0KGdldENvbnRleHQoKS5nZXRTdHJpbmcoUi5zdHJpbmcubG9ja3NjcmVlbl9wbHVnZ2VkX2luLAorICAgICAgICAgICAgICAgICAgICAgICAgICBtQmF0dGVyeUxldmVsKSk7CisgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgbVN0YXR1czEuc2V0VGV4dChnZXRDb250ZXh0KCkuZ2V0U3RyaW5nKFIuc3RyaW5nLmxvY2tzY3JlZW5fbG93X2JhdHRlcnkpKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1TdGF0dXMxLnNldENvbXBvdW5kRHJhd2FibGVzV2l0aEludHJpbnNpY0JvdW5kcyhSLmRyYXdhYmxlLmljX2xvY2tfaWRsZV9jaGFyZ2luZywgMCwKKyAgICAgICAgICAgICAgICAgICAgMCwgMCk7CisKKyAgICAgICAgICAgIG1TdGF0dXMxLnNldFZpc2liaWxpdHkoVmlldy5WSVNJQkxFKTsKKyAgICAgICAgICAgIG1TdGF0dXMyLnNldFZpc2liaWxpdHkoVmlldy5JTlZJU0lCTEUpOworCisgICAgICAgIH0gZWxzZSBpZiAobU5leHRBbGFybSAhPSBudWxsICYmICFtU2hvd2luZ0JhdHRlcnlJbmZvKSB7CisgICAgICAgICAgICAvLyBhbGFybSBvbmx5CisgICAgICAgICAgICBtU3RhdHVzMS5zZXRUZXh0KG1OZXh0QWxhcm0pOworICAgICAgICAgICAgbVN0YXR1czEuc2V0Q29tcG91bmREcmF3YWJsZXNXaXRoSW50cmluc2ljQm91bmRzKFIuZHJhd2FibGUuaWNfbG9ja19pZGxlX2FsYXJtLCAwLAorICAgICAgICAgICAgICAgICAgICAwLCAwKTsKKworICAgICAgICAgICAgbVN0YXR1czEuc2V0VmlzaWJpbGl0eShWaWV3LlZJU0lCTEUpOworICAgICAgICAgICAgbVN0YXR1czIuc2V0VmlzaWJpbGl0eShWaWV3LklOVklTSUJMRSk7CisgICAgICAgIH0gZWxzZSBpZiAobU5leHRBbGFybSAhPSBudWxsICYmIG1TaG93aW5nQmF0dGVyeUluZm8pIHsKKyAgICAgICAgICAgIC8vIGJvdGggYmF0dGVyeSBhbmQgbmV4dCBhbGFybQorICAgICAgICAgICAgbVN0YXR1czEuc2V0VGV4dChtTmV4dEFsYXJtKTsKKyAgICAgICAgICAgIG1TdGF0dXMyLnNldFRleHQoZ2V0Q29udGV4dCgpLmdldFN0cmluZygKKyAgICAgICAgICAgICAgICAgICAgUi5zdHJpbmcubG9ja3NjcmVlbl9iYXR0ZXJ5X3Nob3J0LAorICAgICAgICAgICAgICAgICAgICBNYXRoLm1pbigxMDAsIG1CYXR0ZXJ5TGV2ZWwpKSk7CisgICAgICAgICAgICBtU3RhdHVzMS5zZXRDb21wb3VuZERyYXdhYmxlc1dpdGhJbnRyaW5zaWNCb3VuZHMoUi5kcmF3YWJsZS5pY19sb2NrX2lkbGVfYWxhcm0sIDAsCisgICAgICAgICAgICAgICAgICAgIDAsIDApOworICAgICAgICAgICAgaWYgKG1QbHVnZ2VkSW4pIHsKKyAgICAgICAgICAgICAgICBtU3RhdHVzMi5zZXRDb21wb3VuZERyYXdhYmxlc1dpdGhJbnRyaW5zaWNCb3VuZHMoUi5kcmF3YWJsZS5pY19sb2NrX2lkbGVfY2hhcmdpbmcsCisgICAgICAgICAgICAgICAgICAgICAgICAwLCAwLCAwKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgbVN0YXR1czIuc2V0Q29tcG91bmREcmF3YWJsZXNXaXRoSW50cmluc2ljQm91bmRzKDAsIDAsIDAsIDApOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBtU3RhdHVzMS5zZXRWaXNpYmlsaXR5KFZpZXcuVklTSUJMRSk7CisgICAgICAgICAgICBtU3RhdHVzMi5zZXRWaXNpYmlsaXR5KFZpZXcuVklTSUJMRSk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAvLyBub3RoaW5nIHNwZWNpZmljIHRvIHNob3c7IHNob3cgZ2VuZXJhbCBpbnN0cnVjdGlvbnMKKyAgICAgICAgICAgIG1TdGF0dXMxLnNldFRleHQoUi5zdHJpbmcubG9ja3NjcmVlbl9wYXR0ZXJuX2luc3RydWN0aW9ucyk7CisgICAgICAgICAgICBtU3RhdHVzMS5zZXRDb21wb3VuZERyYXdhYmxlc1dpdGhJbnRyaW5zaWNCb3VuZHMoUi5kcmF3YWJsZS5pY19sb2NrX2lkbGVfbG9jaywgMCwKKyAgICAgICAgICAgICAgICAgICAgMCwgMCk7CisKKyAgICAgICAgICAgIG1TdGF0dXMxLnNldFZpc2liaWxpdHkoVmlldy5WSVNJQkxFKTsKKyAgICAgICAgICAgIG1TdGF0dXMyLn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ICAgICAvLyBuZXh0IGFsYXJtIG9ubHkKKyAgICAgICAgICAgIG1TdGF0dXMxLnNldFZpc2liaWxpdHkoVmlldy5WSVNJQkxFKTsKKyAgICAgICAgICAgIG1TdGF0dXMyLnNldFZpc2liaWxpdHkoVmlldy5JTlZJU0lCTEUpOworCisgICAgICAgICAgICBtU3RhdHVzMS5zZXRUZXh0KG1OZXh0QWxhcm0pOworICAgICAgICAgICAgbVN0YXR1czEuc2V0Q29tcG91bmREcmF3YWJsZXNXaXRoSW50cmluc2ljQm91bmRzKGFsYXJtSWNvbiwgbnVsbCwgbnVsbCwgbnVsbCk7CisgICAgICAgIH0gZWxzZSBpZiAoY2hhcmdpbmcgIT0gbnVsbCAmJiBtTmV4dEFsYXJtICE9IG51bGwpIHsKKyAgICAgICAgICAgIC8vIGJvdGggY2hhcmdpbmcgYW5kIG5leHQgYWxhcm0KKyAgICAgICAgICAgIG1TdGF0dXMxLnNldFZpc2liaWxpdHkoVmlldy5WSVNJQkxFKTsKKyAgICAgICAgICAgIG1TdGF0dXMyLnNldFZpc2liaWxpdHkoVmlldy5WSVNJQkxFKTsKKworICAgICAgICAgICAgbVN0YXR1czEuc2V0VGV4dChjaGFyZ2luZyk7CisgICAgICAgICAgICBtU3RhdHVzMS5zZXRDb21wb3VuZERyYXdhYmxlc1dpdGhJbnRyaW5zaWNCb3VuZHMoY2hhcmdpbmdJY29uLCBudWxsLCBudWxsLCBudWxsKTsKKyAgICAgICAgICAgIG1TdGF0dXMyLnNldFRleHQobU5leHRBbGFybSk7CisgICAgICAgICAgICBtU3RhdHVzMi5zZXRDb21wb3VuZERyYXdhYmxlc1dpdGhJbnRyaW5zaWNCb3VuZHMoYWxhcm1JY29uLCBudWxsLCBudWxsLCBudWxsKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHZvaWQgcmVmcmVzaFRpbWVBbmREYXRlRGlzcGxheSgpIHsKKyAgICAgICAgaWYgKG1IYXNEYXRlKSB7CisgICAgICAgICAgICBtRGF0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OyBpPE47IGkrKykgeworICAgICAgICAgICAgICAgIEFwcFdpZGdldElkIGlkID0gbG9va3VwQXBwV2lkZ2V0SWRMb2NrZWQoYXBwV2lkZ2V0SWRzW2ldKTsKKyAgICAgICAgICAgICAgICB1cGRhdGVBcHBXaWRnZXRJbnN0YW5jZUxvY2tlZChpZCwgdmlld3MsIHRydWUpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHZvaWQgbm90aWZ5QXBwV2lkZ2V0Vmlld0RhdGFDaGFuZ2VkKGludFtdIGFwcFdpZGdldElkcywgaW50IHZpZXdJZCkgeworICAgICAgICBpZiAoYXBwV2lkZ2V0SWRzID09IG51bGwpIHsKKyAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfQorICAgICAgICBpZiAoYXBwV2lkZ2V0SWRzLmxlbmd0aCA9PSAwKSB7CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKyAgICAgICAgZmluYWwgaW50IE4gPSBhcHBXaWRnZXRJZHMubGVuZ3RoOworCisgICAgICAgIHN5bmNocm9uaXplZCAobUFwcFdpZGdldElkcykgeworICAgICAgICAgICAgZm9yIChpbnQgaT0wOyBpPE47IGkrKykgeworICAgICAgICAgICAgICAgIEFwcFdpZGdldElkIGlkID0gbG9va3VwQXBwV2lkZ2V0SWRMb2NrZWQoYXBwV2lkZ2V0SWRzW2ldKTsKKyAgICAgICAgICAgICAgICBub3RpZnlBcHBXaWRnZXRWaWV3RGF0YUNoYW5nZWRJbnN0YW5jZUxvY2tlZChpZCwgdmlld0lkKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKwogICAgIHB1YmxpYyB2b2lkIHVwZGF0ZUFwcFdpZGdldFByb3ZpZGVyKENvbXBvbmVudE5hbWUgcHJvdmlkZXIsIFJlbW90ZVZpZXdzIHZpZXdzKSB7CiAgICAgICAgIHN5bmNocm9uaXplZCAobUFwcFdpZGdldElkcykgewogICAgICAgICAgICAgUHJvd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lbW92ZSB0aGUgY2FsbGJhY2suIE5vIG5lZWQgdG8gcHJ1bmUgYmVjYXVzZQorICAgICAgICAgICAgICAgICAgICAvLyB3ZSBrbm93IHRoYXQgdGhpcyBob3N0IGlzIHN0aWxsIHJlZmVyZW5jZWQgYnkgdGhpcyBpbnN0YW5jZS4KKyAgICAgICAgICAgICAgICAgICAgaWQuaG9zdC5jYWxsYmFja3MgPSBudWxsOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKwogICAgIHB1YmxpYyBpbnRbXSBzdGFydExpc3RlbmluZyhJQXBwV2lkZ2V0SG9zdCBjYWxsYmFja3MsIFN0cmluZyBwYWNrYWdlTmFtZSwgaW50IGhvc3RJZCwKICAgICAgICAgICAgIExpc3Q8UmVtb3RlVmlld3M+IHVwZGF0ZWRWaWV3cykgewogICAgICAgICBpbnQgY2FsbGluZ1VpZCA9IGVuZm9yY2VDYWxsaW5nVWlkKHBhY2thZ2VOYW1lKTsKQEAgLTc0MSw2ICs4MDAsOSBAQAogICAgICAgICAgICAgfQogICAgICAgICAgICAgaW5mby5sYWJlbCA9IGFjdGl2aXR5SW5mby5sb2FkTGFiZWwobVBhY2thZ2VNYW5hZ2VyKS50b1N0cmluZygpOwogICAgICAgICAgICAgaW5mby5pY29uID0gcmkuZ2V0SWNvblJlc291cmNlKCk7CisgICAgICAgICAgICBpbmZvLnByZXZpZXdJbWFnZSA9IHNhLmdldFJlc291cmNlSWQoCisgICAgICAgICAgICAJCWNvbS5hbmRyb2lkLmludGVybmFsLlIuc3R5bGVhYmxlLkFwcFdpZGdldFByb3ZpZGVySW5mb19wcmV2aWV3SW1hZ2UsIDApOworCiAgICAgICAgICAgICBzYS5yZWN5Y2xlKCk7CiAgICAgICAgIH0gY2F0Y2ggKEV4Y2VwdGlvbiBlKSB7CiAgICAgICAgICAgICAvLyBPayB0byBjYXRjaCBFeGNlcHRpb24gaGVyZSwgYmVjYXVzZSBhbnl0aGluZ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gICAgICAgICAgICAgICAgICBtUHJpbWFyeUNsaXBMaXN0ZW5lcnMuZ2V0QnJvYWRjYXN0SXRlbShpKS5kaXNwYXRjaFByaW1hcnlDbGlwQ2hhbmdlZCgpOworICAgICAgICAgICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBlKSB7CisKKyAgICAgICAgICAgICAgICAgICAgLy8gVGhlIFJlbW90ZUNhbGxiYWNrTGlzdCB3aWxsIHRha2UgY2FyZSBvZiByZW1vdmluZworICAgICAgICAgICAgICAgICAgICAvLyB0aGUgZGVhZCBvYmplY3QgZm9yIHVzLgorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1QcmltYXJ5Q2xpcExpc3RlbmVycy5maW5pc2hCcm9hZGNhc3QoKTsKKyAgICAgICAgfQorICAgIH0KICAgICAKLSAgICAgICAgICAgIG1DbGlwYm9hcmQgPSB0ZXh0OwotICAgICAgICB9Ci0gICAgfQotCi0gICAgLy8gamF2YWRvYyBmcm9tIGludGVyZmFjZQotICAgIHB1YmxpYyBDaGFyU2VxdWVuY2UgZ2V0Q2xpcGJvYXJkVGV4dCgpIHsKKyAgICBwdWJsaWMgQ2xpcHBlZERhdGEgZ2V0UHJpbWFyeUNsaXAoKSB7CiAgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgewotICAgICAgICAgICAgcmV0dXJuIG1DbGlwYm9hcmQ7CisgICAgICAgICAgICByZXR1cm4gbVByaW1hcnlDbGlwOwogICAgICAgICB9CiAgICAgfQogCi0gICAgLy8gamF2YWRvYyBmcm9tIGludGVyZmFjZQorICAgIHB1YmxpYyBib29sZWFuIGhhc1ByaW1hcnlDbGlwKCkgeworICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKKyAgICAgICAgICAgIHJldHVybiBtUHJpbWFyeUNsaXAgIT0gbnVsbDsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyB2b2lkIGFkZFByaW1hcnlDbGlwQ2hhbmdlZExpc3RlbmVyKElPblByaW1hcnlDbGlwQ2hhbmdlZExpc3RlbmVyIGxpc3RlbmVyKSB7CisgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgeworICAgICAgICAgICAgbVByaW1hcnlDbGlwTGlzdGVuZXJzLnJlZ2lzdGVyKGxpc3RlbmVyKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHJlbW92ZVByaW1hcnlDbGlwQ2hhbmdlZExpc3RlbmVyKElPblByaW1hcnlDbGlwQ2hhbmdlZExpc3RlbmVyIGxpc3RlbmVyKSB7CisgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgeworICAgICAgICAgICAgbVByaW1hcnlDbGlwTGlzdGVuZXJzLnVucmVnaXN0ZXIobGlzdGVuZXIpOworICAgICAgICB9CisgICAgfQorCiAgICAgcHVibGljIGJvb2xlYW4gaGFzQ2xpcGJvYXJkVGV4dCgpIHsKICAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7Ci0gICAgICAgICAgICByZXR1cm4gbUNsaXBib2FyZC5sZW5ndGgoKSA+IDA7CisgICAgICAgICAgICBpZiAobVByaW1hcnlDbGlwICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBDaGFyU2VxdWVuY2UgdGV4dCA9IG1QcmltYXJ5Q2xpcC5nZXRJdGVtKDApLmdldFRleHQoKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gdGV4dCAhPSBudWxsICYmIHRleHQubGVuZ3RoKCkgPiAwOworICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICB9CiAgICAgfQogfQpkaWZmIC0tZ2l0IGEvc2VydmljZXMvamF2YS9jb20vYW5kcm9pZC9zZXJ2ZXIvQ29ubmVjdGl2aXR5U2VydmljZS5qYXZhIGIvc2VydmljZXMvamF2YS9jb20vYW5kcm9pZC9zZXJ2ZXIvQ29ubmVjdGl2aXR5U2VydmljZS5qYXZhCmlu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J0ZWFyaW5nIGRvd24gTW9iaWxlIG5ldHdvcmtzIGR1ZSB0byBzZXR0aW5nIik7CiAgICAgICAgICAgICAgICAgICAgIG1OZXRUcmFja2Vyc1tuZXRUeXBlXS50ZWFyZG93bigpOwpAQCAtMzIxLDcgKzM0NCw4IEBACiAgICAgICAgIG1UZXRoZXJpbmdDb25maWdWYWxpZCA9ICgoKG1OZXRUcmFja2Vyc1tDb25uZWN0aXZpdHlNYW5hZ2VyLlRZUEVfTU9CSUxFX0RVTl0gIT0gbnVsbCkgfHwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAhbVRldGhlcmluZy5pc0R1blJlcXVpcmVkKCkpICYmCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAobVRldGhlcmluZy5nZXRUZXRoZXJhYmxlVXNiUmVnZXhzKCkubGVuZ3RoICE9IDAgfHwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtVGV0aGVyaW5nLmdldFRldGhlcmFibGVXaWZpUmVnZXhzKCkubGVuZ3RoICE9IDApICYmCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVRldGhlcmluZy5nZXRUZXRoZXJhYmxlV2lmaVJlZ2V4cygpLmxlbmd0aCAhPSAwIHx8CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVRldGhlcmluZy5nZXRUZXRoZXJhYmxlQmx1ZXRvb3RoUmVnZXhzKCkubGVuZ3RoICE9IDApICYmCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtVGV0aGVyaW5nLmdldFVwc3RyZWFtSWZhY2VSZWdleHMoKS5sZW5ndGggIT0gMCk7CiAKICAgICB9CkBAIC01OTcsMTUgKzYyMSw3IEBACiAgICAgICAgICAgICAgICAgbmV0d29yay5yZWNvbm5lY3QoKTsKICAgICAgICAgICAgICAgICByZXR1cm4gUGhvbmUuQVBOX1JFUVVFU1RfU1RBUlRFRDsKICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgc3luY2hyb25pemVkKHRoaXMpIHsKLSAgICAgICAgICAgICAgICAgICAgbUZlYXR1cmVVc2Vycy5hZGQoZik7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIG1IYW5kbGVyLnNlbmRNZXNzYWdlRGVsYXllZChtSGFuZGxlci5vYnRhaW5NZXNzYWdlKAotICAgICAgICAgICAgICAgICAgICAgICAgTmV0d29ya1N0YXRlVHJhY2tlci5FVkVOVF9SRVNUT1JFX0RFRkFVTFRfTkVUV09SSywKLSAgICAgICAgICAgICAgICAgICAgICAgIGYpLCBnZXRSZXN0b3JlRGVmYXVsdE5ldHdvcmtEZWxheSgpKTsKLQotICAgICAgICAgICAgICAgIHJldHVybiBuZXR3b3JrLnN0YXJ0VXNpbmdOZXR3b3JrRmVhdHVyZShmZWF0dXJlLAotICAgICAgICAgICAgICAgICAgICAgICAgZ2V0Q2FsbGluZ1BpZCgpLCBnZXRDYWxsaW5nVWlkKCkpOworICAgICAgICAgICAgICAgIHJldHVybiAtMTsKICAgICAgICAgICAgIH0KICAgICAgICAgfQogICAgICAgICByZXR1cm4gUGhvbmUuQVBOX1RZUEVfTk9UX0FWQUlMQUJMRTsKQEAgLTcyNCw4ICs3NDAsNyBAQAogICAgICAgICAgICAgdHJhY2tlci50ZWFyZG93bigpOwogICAgICAgICAgICAgcmV0dXJuIDE7CiAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAvLyBkbyBpdCB0aGUgb2xkIGZhc2hpb25lZCB3YXkKLSAgICAgICAgICAgIHJldHVybiB0cmFja2VyLnN0b3BVc2luZ05ldHdvcmtGZWF0dXJlKGZlYXR1cmUsIHBpZCwgdWlkKTsKKyAgICAgICAgICAgIHJldHVybiAtMTsKICAgICAgICAgfQogICAgIH0KIApAQCAtNzM2LDYgKzc1MSw3IEBACiAgICAgICogc3BlY2lmaWVkIGhvc3QgaXMgdG8gYmUgcm91dGVkCiAgICAgICogQHBhcm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IGludGVyZmFjZSBuYW1lIik7CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KICAgICB9CiAKICAgICAvKioKQEAgLTg1OSw2ICs5MDcsMTIgQEAKICAgICAgICAgICAgICAgICAiQ29ubmVjdGl2aXR5U2VydmljZSIpOwogICAgIH0KIAorICAgIHByaXZhdGUgdm9pZCBlbmZvcmNlQ29ubmVjdGl2aXR5SW50ZXJuYWxQZXJtaXNzaW9uKCkgeworICAgICAgICBtQ29udGV4dC5lbmZvcmNlQ2FsbGluZ09yU2VsZlBlcm1pc3Npb24oCisgICAgICAgICAgICAgICAgYW5kcm9pZC5NYW5pZmVzdC5wZXJtaXNzaW9uLkNPTk5FQ1RJVklUWV9JTlRFUk5BTCwKKyAgICAgICAgICAgICAgICAiQ29ubmVjdGl2aXR5U2VydmljZSIpOworICAgIH0KKwogICAgIC8qKgogICAgICAqIEhhbmRsZSBhIHtAY29kZSBESVNDT05ORUNURUR9IGV2ZW50LiBJZiB0aGlzIHBlcnRhaW5zIHRvIHRoZSBub24tYWN0aXZlCiAgICAgICogbmV0d29yaywgd2UgaWdub3JlIGl0LiBJZiBpdCBpcyBmb3IgdGhlIGFjdGl2ZSBuZXR3b3JrLCB3ZSBzZW5kIG91dCBhCkBAIC0xMTMxLDQ0ICsxMTg1LDMwIEBACiAgICAgICAgICAgICAgICAgICAgICAgICBTbG9nLmUoVEFHLCAiTmV0d29yayBkZWNsaW5lZCB0ZWFyZG93biByZXF1ZXN0Iik7CiAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgaWYgKGlzRmFpbG92ZXIpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIG90aGVyTmV0LnJlbGVhc2VXYWtlTG9jaygpOwotICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgc3luY2hyb25pemVkIChDb25uZWN0aXZpdHlTZXJ2aWNlLnRoaXMpIHsKKyAgICAgICAgICAgICAgICAvLyBoYXZlIGEgbmV3IGRlZmF1bHQgbmV0d29yaywgcmVsZWFzZSB0aGUgdHJhbnNpdGlvbiB3YWtlbG9jayBpbiBhIHNlY29uZAorICAgICAgICAgICAgICAgIC8vIGlmIGl0J3MgaGVsZC4gIFRoZSBzZWNvbmQgcGF1c2UgaXMgdG8gYWxsb3cgYXBwcyB0byByZWNvbm5lY3Qgb3ZlciB0aGUKKyAgICAgICAgICAgICAgICAvLyBuZXcgbmV0d29yaworICAgICAgICAgICAgICAgIGlmIChtTmV0VHJhbnNpdGlvbldha2VMb2NrLmlzSGVsZCgpKSB7CisgICAgICAgICAgICAgICAgICAgIG1IYW5kbGVyLnNlbmRNZXNzYWdlRGVsYXllZChtSGFuZGxlci5vYnRhaW5NZXNzYWdlKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5ldHdvcmtTdGF0ZVRyYWNrZXIuRVZFTlRfQ0xFQVJfTkVUX1RSQU5TSVRJT05fV0FLRUxPQ0ssCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbU5ldFRyYW5zaXRpb25XYWtlTG9ja1NlcmlhbE51bWJlciwgMCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTAwMCk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogICAgICAgICAgICAgbUFjdGl2ZURlZmF1bHROZXR3b3JrID0gdHlwZTsKICAgICAgICAgfQogICAgICAgICB0aGlzTmV0LnNldFRlYXJkb3duUmVxdWVzdGVkKGZhbHNlKTsKLSAgICAgICAgdGhpc05ldC51cGRhdGVOZXR3b3JrU2V0dGluZ3MoKTsKKyAgICAgICAgdXBkYXRlTmV0d29ya1NldHRpbmdzKHRoaXNOZXQpOwogICAgICAgICBoYW5kbGVDb25uZWN0aXZpdHlDaGFuZ2UodHlwZSk7CiAgICAgICAgIHNlbmRDb25uZWN0ZWRCcm9hZGNhc3QoaW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WRkUHJpdmF0ZURuc1JvdXRlcyhtTmV0VHJhY2tlcnNbbmV0VHlwZV0pOwogICAgICAgICAgICAgfQogICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgaWYgKG1OZXRBdHRyaWJ1dGVzW25ldFR5cGVdLmlzRGVmYXVsdCgpKSB7Ci0gICAgICAgICAgICAgICAgbU5ldFRyYWNrZXJzW25ldFR5cGVdLnJlbW92ZURlZmF1bHRSb3V0ZSgpOworICAgICAgICAgICAgICAgIHJlbW92ZURlZmF1bHRSb3V0ZShtTmV0VHJhY2tlcnNbbmV0VHlwZV0pOwogICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBtTmV0VHJhY2tlcnNbbmV0VHlwZV0ucmVtb3ZlUHJpdmF0ZURuc1JvdXRlcygpOworICAgICAgICAgICAgICAgIHJlbW92ZVByaXZhdGVEbnNSb3V0ZXMobU5ldFRyYWNrZXJzW25ldFR5cGVdKTsKICAgICAgICAgICAgIH0KICAgICAgICAgfQogICAgIH0KIAorICAgIHByaXZhdGUgdm9pZCBhZGRQcml2YXRlRG5zUm91dGVzKE5ldHdvcmtTdGF0ZVRyYWNrZXIgbnQpIHsKKyAgICAgICAgYm9vbGVhbiBwcml2YXRlRG5zUm91dGVTZXQgPSBudC5pc1ByaXZhdGVEbnNSb3V0ZVNldCgpOworICAgICAgICBOZXR3b3JrUHJvcGVydGllcyBwID0gbnQuZ2V0TmV0d29ya1Byb3BlcnRpZXMoKTsKKyAgICAgICAgaWYgKHAgPT0gbnVsbCkgcmV0dXJuOworICAgICAgICBTdHJpbmcgaW50ZXJmYWNlTmFtZSA9IHAuZ2V0SW50ZXJmYWNlTmFtZSgpOworCisgICAgICAgIGlmIChEQkcpIHsKKyAgICAgICAgICAgIFNsb2cuZChUQUcsICJhZGRQcml2YXRlRG5zUm91dGVzIGZvciAiICsgbnQgKworICAgICAgICAgICAgICAgICAgICAiKCIgKyBpbnRlcmZhY2VOYW1lICsgIikgLSBtUHJpdm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0KCk7CisgICAgICAgIGlmIChpbnRlcmZhY2VOYW1lICE9IG51bGwgJiYgcHJpdmF0ZURuc1JvdXRlU2V0KSB7CisgICAgICAgICAgICBpZiAoREJHKSB7CisgICAgICAgICAgICAgICAgU2xvZy5kKFRBRywgInJlbW92ZVByaXZhdGVEbnNSb3V0ZXMgZm9yICIgKyBudC5nZXROZXR3b3JrSW5mbygpLmdldFR5cGVOYW1lKCkgKworICAgICAgICAgICAgICAgICAgICAgICAgIiAoIiArIGludGVyZmFjZU5hbWUgKyAiKSIpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgTmV0d29ya1V0aWxzLnJlbW92ZUhvc3RSb3V0ZXMoaW50ZXJmYWNlTmFtZSk7CisgICAgICAgICAgICBudC5wcml2YXRlRG5zUm91dGVTZXQoZmFsc2UpOworICAgICAgICB9CisgICAgfQorCisKKyAgICBwcml2YXRlIHZvaWQgYWRkRGVmYXVsdFJvdXRlKE5ldHdvcmtTdGF0ZVRyYWNrZXIgbnQpIHsKKyAgICAgICAgTmV0d29ya1Byb3BlcnRpZXMgcCA9IG50LmdldE5ldHdvcmtQcm9wZXJ0aWVzKCk7CisgICAgICAgIGlmIChwID09IG51bGwpIHJldHVybjsKKyAgICAgICAgU3RyaW5nIGludGVyZmFjZU5hbWUgPSBwLmdldEludGVyZmFjZU5hbWUoKTsKKyAgICAgICAgSW5ldEFkZHJlc3MgZGVmYXVsdEdhdGV3YXlBZGRyID0gcC5nZXRHYXRld2F5KCk7CisKKyAgICAgICAgaWYgKChpbnRlcmZhY2VOYW1lICE9IG51bGwpICYmIChkZWZhdWx0R2F0ZXdheUFkZHIgIT0gbnVsbCApKSB7CisgICAgICAgICAgICBpZiAoKE5ldHdvcmtVdGlscy5zZXREZWZhdWx0Um91dGUoaW50ZXJmYWNlTmFtZSwgZGVmYXVsdEdhdGV3YXlBZGRyKSA+PSAwKSAmJiBEQkcpIHsKKyAgICAgICAgICAgICAgICBOZXR3b3JrSW5mbyBuZXR3b3JrSW5mbyA9IG50LmdldE5ldHdvcmtJbmZvKCk7CisgICAgICAgICAgICAgICAgU2xvZy5kKFRBRywgImFkZERlZmF1bHRSb3V0ZSBmb3IgIiArIG5ldHdvcmtJbmZvLmdldFR5cGVOYW1lKCkgKworICAgICAgICAgICAgICAgICAgICAgICAgIiAoIiArIGludGVyZmFjZU5hbWUgKyAiKSwgR2F0ZXdheUFkZHI9IiArIGRlZmF1bHRHYXRld2F5QWRkcik7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKworICAgIHB1YmxpYyB2b2lkIHJlbW92ZURlZmF1bHRSb3V0ZShOZXR3b3JrU3RhdGVUcmFja2VyIG50KSB7CisgICAgICAgIE5ldHdvcmtQcm9wZXJ0aWVzIHAgPSBudC5nZXROZXR3b3JrUHJvcGVydGllcygpOworICAgICAgICBpZiAocCA9PSBudWxsKSByZXR1cm47CisgICAgICAgIFN0cmluZyBpbnRlcmZhY2VOYW1lID0gcC5nZXRJbnRlcmZhY2VOYW1lKCk7CisKKyAgICAgICAgaWYgKGludGVyZmFjZU5hbWUgIT0gbnVsbCkgeworICAgICAgICAgICAgaWYgKChOZXR3b3JrVXRpbHMucmVtb3ZlRGVmYXVsdFJvdXRlKGludGVyZmFjZU5hbWUpID49IDApICYmIERCRykgeworICAgICAgICAgICAgICAgIE5ldHdvcmtJbmZvIG5ldHdvcmtJbmZvID0gbnQuZ2V0TmV0d29ya0luZm8oKTsKKyAgICAgICAgICAgICAgICBTbG9nLmQoVEFHLCAicmVtb3ZlRGVmYXVsdFJvdXRlIGZvciAiICsgbmV0d29ya0luZm8uZ2V0VHlwZU5hbWUoKSArICIgKCIgKworICAgICAgICAgICAgICAgICAgICAgICAgaW50ZXJmYWNlTmFtZSArICIpIik7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgIC8qKgorICAgICAqIFJlYWRzIHRoZSBuZXR3b3JrIHNwZWNpZmljIFRDUCBidWZmZXIgc2l6ZXMgZnJvbSBTeXN0ZW1Qcm9wZXJ0aWVzCisgICAgICogbmV0LnRjcC5idWZmZXJzaXplLltkZWZhdWx0fHdpZml8dW10c3xlZGdlfGdwcnNdIGFuZCBzZXQgdGhlbSBmb3Igc3lzdGVtCisgICAgICogd2lkZSB1c2UKKyAgICAgKi8KKyAgIHB1YmxpYyB2b2lkIHVwZGF0ZU5ldHdvcmtTZXR0aW5ncyhOZXR3b3JrU3RhdGVUcmFja2VyIG50KSB7CisgICAgICAgIFN0cmluZyBrZXkgPSBudC5nZXRUY3BCdWZmZXJTaXplc1Byb3BOYW1lKCk7CisgICAgICAgIFN0cmluZyBidWZmZXJTaXplcyA9IFN5c3RlbVByb3BlcnRpZXMuZ2V0KGtleSk7CisKKyAgICAgICAgaWYgKGJ1ZmZlclNpemVzLmxlbmd0aCgpID09IDApIHsKKyAgICAgICAgICAgIFNsb2cuZShUQUcsIGtleSArICIgbm90IGZvdW5kIGluIHN5c3RlbSBwcm9wZXJ0aWVzLiBVc2luZyBkZWZhdWx0cyIpOworCisgICAgICAgICAgICAvLyBTZXR0aW5nIHRvIGRlZmF1bHQgdmFsdWVzIHNvIHdlIHdvbid0IGJlIHN0dWNrIHRvIHByZXZpb3VzIHZhbHVlcworICAgICAgICAgICAga2V5ID0gIm5ldC50Y3AuYnVmZmVyc2l6ZS5kZWZhdWx0IjsKKyAgICAgICAgICAgIGJ1ZmZlclNpemVzID0gU3lzdGVtUHJvcGVydGllcy5nZXQoa2V5KTsKKyAgICAgICAgfQorCisgICAgICAgIC8vIFNldCB2YWx1ZXMgaW4ga2VybmVsCisgICAgICAgIGlmIChidWZmZXJTaXplcy5sZW5ndGgoKSAhPSAwKSB7CisgICAgICAgICAgICBpZiAoREJHKSB7CisgICAgICAgICAgICAgICAgU2xvZy52KFRBRywgIlNldHRpbmcgVENQIHZhbHVlczogWyIgKyBidWZmZXJTaXplcworICAgICAgICAgICAgICAgICAgICAgICAgKyAiXSB3aGljaCBjb21lcyBmcm9tIFsiICsga2V5ICsgIl0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WzNdKTsKKyAgICAgICAgICAgICAgICBzdHJpbmdUb0ZpbGUocHJlZml4ICsgIndtZW1fZGVmIiwgdmFsdWVzWzRdKTsKKyAgICAgICAgICAgICAgICBzdHJpbmdUb0ZpbGUocHJlZml4ICsgIndtZW1fbWF4IiwgdmFsdWVzWzVdKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgU2xvZy5lKFRBRywgIkludmFsaWQgYnVmZmVyc2l6ZSBzdHJpbmc6ICIgKyBidWZmZXJTaXplcyk7CisgICAgICAgICAgICB9CisgICAgICAgIH0gY2F0Y2ggKElPRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgIFNsb2cuZShUQUcsICJDYW4ndCBzZXQgdGNwIGJ1ZmZlciBzaXplczoiICsgZSk7CisgICAgICAgIH0KKyAgICB9CisKKyAgIC8qKgorICAgICAqIFdyaXRlcyBzdHJpbmcgdG8gZmlsZS4gQmFzaWNhbGx5IHNhbWUgYXMgImVjaG8gLW4gJHN0cmluZyA+ICRmaWxlbmFtZSIKKyAgICAgKgorICAgICAqIEBwYXJhbSBmaWxlbmFtZQorICAgICAqIEBwYXJhbSBzdHJpbmcKKyAgICAgKiBAdGhyb3dzIElPRXhjZXB0aW9uCisgICAgICovCisgICAgcHJpdmF0ZSB2b2lkIHN0cmluZ1RvRmlsZShTdHJpbmcgZmlsZW5hbWUsIFN0cmluZyBzdHJpbmcpIHRocm93cyBJT0V4Y2VwdGlvbiB7CisgICAgICAgIEZpbGVXcml0ZXIgb3V0ID0gbmV3IEZpbGVXcml0ZXIoZmlsZW5hbWUpOworICAgICAgICB0cnkgeworICAgICAgICAgICAgb3V0LndyaXRlKHN0cmluZyk7CisgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICBvdXQuY2xvc2UoKTsKKyAgICAgICAgfQorICAgIH0KKworCiAgICAgLyoqCiAgICAgICogQWRqdXN0IHRoZSBwZXItcHJvY2VzcyBkbnMgZW50cmllcyAobmV0LmRuczx4Pi48cGlkPikgYmFzZWQKICAgICAgKiBvbiB0aGUgaGlnaGVzdCBwcmlvcml0eSBhY3RpdmUgbmV0IHdoaWNoIHRoaXMgcHJvY2VzcyByZXF1ZXN0ZWQuCkBAIC0xMjA5LDEyICsxMzg4LDE0IEBACiAgICAgICAgICAgICBOZXR3b3JrU3RhdGVUcmFja2VyIG50ID0gbU5ldFRyYWNrZXJzW2ldOwogICAgICAgICAgICAgaWYgKG50LmdldE5ldHdvcmtJbmZvKCkuaXNDb25uZWN0ZWQoKSAmJgogICAgICAgICAgICAgICAgICAgICAhbnQuaXNUZWFyZG93blJlcXVlc3RlZCgpKSB7CisgICAgICAgICAgICAgICAgTmV0d29ya1Byb3BlcnRpZXMgcCA9IG50LmdldE5ldHdvcmtQcm9wZXJ0aWVzKCk7CisgICAgICAgICAgICAgICAgaWYgKHAgPT0gbnVsbCkgY29udGludWU7CiAgICAgICAgICAgICAgICAgTGlzdCBwaWRzID0gbU5ldFJlcXVlc3RlcnNQaWRzW2ldOwogICAgICAgICAgICAgICAgIGZvciAoaW50IGo9MDsgajxwaWRzLnNpemUoKTsgaisrKSB7CiAgICAgICAgICAgICAgICAgICAgIEludGVnZXIgcGlkID0gKEludGVnZXIpcGlkcy5nZXQoaik7CiAgICAgICAgICAgICAgICAgICAgIGlmIChwaWQuaW50VmFsdWUoKSA9PSBteVBpZCkgewotICAgICAgICAgICAgICAgICAgICAgICAgU3RyaW5nW10gZG5zTGlzdCA9IG50LmdldE5hbWVTZXJ2ZXJzKCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB3cml0ZVBpZERucyhkbnNMaXN0LCBteVBpZCk7CisgICAgICAgICAgICAgICAgICAgICAgICBDb2xsZWN0aW9uPEluZXRBZGRyZXNzPiBkbnNlcyA9IHAuZ2V0RG5zZXMoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHdyaXRlUGlkRG5zKGRuc2VzLCBteVBpZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZG9CdW1wKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnVtcERucygpOwogICAgICAgICAgICAgICAgICAgICAgICAgfQpAQCAtMTIzNiwxMiArMTQxNywxMCBAQAogICAgICAgICB9CiAgICAgfQogCi0gICAgcHJpdmF0ZSB2b2lkIHdyaXRlUGlkRG5zKFN0cmluZ1tdIGRuc0xpc3QsIGludCBwaWQpIHsKKyAgICBwcml2YXRlIHZvaWQgd3JpdGVQaWREbnMoQ29sbGVjdGlvbiA8SW5ldEFkZHJlc3M+IGRuc2VzLCBpbnQgcGlkKSB7CiAgICAgICAgIGludCBqID0gMTsKLSAgICAgICAgZm9yIChTdHJpbmcgZG5zIDogZG5zTGlzdCkgewotICAgICAgICAgICAgaWYgKGRucyAhPSBudWxsICYmICFUZXh0VXRpbHMuZXF1YWxzKGRucywgIjAuMC4wLjAiKSkgewotICAgICAgICAgICAgICAgIFN5c3RlbVByb3BlcnRpZXMuc2V0KCJuZXQuZG5zIiArIGorKyArICIuIiArIHBpZCwgZG5zKTsKLSAgICAgICAgICAgIH0KKyAgICAgICAgZm9yIChJbmV0QWRkcmVzcyBkbnMgOiBkbnNlcykgeworICAgICAgICAgICAgU3lzdGVtUHJvcGVydGllcy5zZXQoIm5ldC5kbnMiICsgaisrICsgIi4iICsgcGlkLCBkbnMuZ2V0SG9zdEFkZHJlc3MoKSk7CiAgICAgICAgIH0KICAgICB9CiAKQEAgLTEyNjQsMTcgKzE0NDMsMTcgQEAKICAgICAgICAgLy8gYWRkIGRlZmF1bHQgbmV0J3MgZG5zIGVudHJpZXMKICAgICAgICAgTmV0d29ya1N0YXRlVHJhY2tlciBudCA9IG1OZXRUcmFja2Vyc1tuZXRUeXBlXTsKICAgICAgICAgaWYgKG50ICE9IG51bGwgJiYgbnQuZ2V0TmV0d29ya0luZm8oKS5pc0Nvbm5lY3RlZCgpICYmICFudC5pc1RlYXJkb3duUmVxdWVzdGVkKCkpIHsKLSAgICAgICAgICAgIFN0cmluZ1tdIGRuc0xpc3QgPSBudC5nZXROYW1lU2VydmVycygpOworICAgICAgICAgICAgTmV0d29ya1Byb3BlcnRpZXMgcCA9IG50LmdldE5ldHdvcmtQcm9wZXJ0aWVzKCk7CisgICAgICAgICAgICBpZiAocCA9PSBudWxsKSByZXR1cm47CisgICAgICAgICAgICBDb2xsZWN0aW9uPEluZXRBZGRyZXNzPiBkbnNlcyA9IHAuZ2V0RG5zZXMoKTsKICAgICAgICAgICAgIGlmIChtTmV0QXR0cmlidXRlc1tuZXRUeXBlXS5pc0RlZmF1bHQoKSkgewogICAgICAgICAgICAgICAgIGludCBqID0gMTsKLSAgICAgICAgICAgICAgICBmb3IgKFN0cmluZyBkbnMgOiBkbnNMaXN0KSB7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChkbnMgIT0gbnVsbCAmJiAhVGV4dFV0aWxzLmVxdWFscyhkbnMsICIwLjAuMC4wIikpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBTbG9nLmQoVEFHLCAiYWRkaW5nIGRucyAiICsgZG5zICsgIiBmb3IgIiArCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudC5nZXROZXR3b3JrSW5mbygpLmdldFR5cGVOYW1lKCkpOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgU3lzdGVtUHJvcGVydGllcy5zZXQoIm5ldC5kbnMiICsgaisrLCBkbnMpOworICAgICAgICAgICAgICAgIGZvciAoSW5ldEFkZHJlc3MgZG5zIDogZG5zZXMpIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKERCRykgeworICAgICAgICAgICAgICAgICAgICAgICAgU2xvZy5kKFRBRywgImFkZGluZyBkbnMgIiArIGRucyArICIgZm9yICIgKworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudC5nZXROZXR3b3JrSW5mbygpLmdldFR5cGVOYW1lKCkpOwogICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIFN5c3RlbVByb3BlcnRpZXMuc2V0KCJuZXQuZG5zIiArIGorKywgZG5zLmdldEhvc3RBZGRyZXNzKCkpOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBmb3IgKGludCBrPWogOyBrPG1OdW1EbnNFbnRyaWVzOyBrKyspIHsKICAgICAgICAgICAgICAgICAgICAgaWYgKERCRykgU2xvZy5kKFRBRywgImVyYXNpbmcgbmV0LmRucyIgKyBrKTsKQEAgLTEyODYsMTEgKzE0NjUsMTEgQEAKICAgICAgICAgICAgICAgICBMaXN0IHBpZHMgPSBtTmV0UmVxdWVzdGVyc1BpZHNbbmV0VHlwZV07CiAgICAgICAgICAgICAgICAgZm9yIChpbnQgeT0wOyB5PCBwaWRzLnNpemUoKTsgeSsrKSB7CiAgICAgICAgICAgICAgICAgICAgIEludGVnZXIgcGlkID0gKEludGVnZXIpcGlkcy5nZXQoeSk7Ci0gICAgICAgICAgICAgICAgICAgIHdyaXRlUGlkRG5zKGRuc0xpc3QsIHBpZC5pbnRWYWx1ZSgpKTsKKyAgICAgICAgICAgICAgICAgICAgd3JpdGVQaWREbnMoZG5zZXMsIHBpZC5pbnRWYWx1ZSgpKTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CisgICAgICAgICAgICBidW1wRG5zKCk7CiAgICAgICAgIH0KLSAgICAgICAgYnVtcERucygpOwogICAgIH0KIAogICAgIHByaXZhdGUgaW50IGdldFJlc3RvcmVEZWZhdWx0TmV0d29ya0RlbGF5KCkgewpAQCAtMTM0NSw2ICsxNTI0LDEzIEBACiAgICAgICAgIH0KICAgICAgICAgcHcucHJpbnRsbigpOwogCisgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgeworICAgICAgICAgICAgcHcucHJpbnRsbigiTmV0d29ya1RyYW5zdGlvbldha2VMb2NrIGlzIGN1cnJlbnRseSAiICsKKyAgICAgICAgICAgICAgICAgICAgKG1OZXRUcmFuc2l0aW9uV2FrZUxvY2suaXNIZWxkKCkgPyAiIiA6ICJub3QgIikgKyAiaGVsZC4iKTsKKyAgICAgICAgICAgIHB3LnByaW50bG4oIkl0IHdhcyBsYXN0IHJlcXVlc3RlZCBmb3IgIittTmV0VHJhbnNpdGlvbldha2VMb2NrQ2F1c2VkQnkpOworICAgICAgICB9CisgICAgICAgIHB3LnByaW50bG4oKTsKKwogICAgICAgICBtVGV0aGVyaW5nLmR1bXAoZmQsIHB3LCBhcmdzKTsKICAgICB9CiAKQEAgLTE0MTEsMzQgKzE1OTcsMzAgQEAKICAgICAgICAgICAgICAgICAgICAgICAgIGhhbmRsZUNvbm5lY3QoaW5mbyk7CiAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0KLSAgICAgICAgICAgICAgICBjYXNlIE5ldHdvcmtTdGF0ZVRyYWNrZXIuRVZFTlRfU0NBTl9SRVNVTFRTX0FWQUlMQUJMRToKLSAgICAgICAgICAgICAgICAgICAgaW5mbyA9IChOZXR3b3JrSW5mbykgbXNnLm9iajsKLSAgICAgICAgICAgICAgICAgICAgaGFuZGxlU2NhblJlc3VsdHNBdmFpbGFibGUoaW5mbyk7Ci0gICAgICAgICAgICAgICAgICAgIGJyZWFrOwotCi0gICAgICAgICAgICAgICAgY2FzZSBOZXR3b3JrU3RhdGVUcmFja2VyLkVWRU5UX05PVElGSUNBVElPTl9DSEFOR0VEOgotICAgICAgICAgICAgICAgICAgICBoYW5kbGVOb3RpZmljYXRpb25DaGFuZ2UobXNnLmFyZzEgPT0gMSwgbXNnLmFyZzIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgKE5vdGlmaWNhdGlvbikgbXNnLm9iaik7Ci0gICAgICAgICAgICAgICAgICAgIGJyZWFrOwotCiAgICAgICAgICAgICAgICAgY2FzZSBOZXR3b3JrU3RhdGVUcmFja2VyLkVWRU5UX0NPTkZJR1VSQVRJT05fQ0hBTkdFRDoKKyAgICAgICAgICAgICAgICAgICAgLy8gVE9ETyAtIG1ha2UgdGhpcyBoYW5kbGUgaXAvcHJveHkvZ2F0ZXdheS9kbnMgY2hhbmdlcwogICAgICAgICAgICAgICAgICAgICBpbmZvID0gKE5ldHdvcmtJbmZvKSBtc2cub2JqOwogICAgICAgICAgICAgICAgICAgICB0eXBlID0gaW5mby5nZXRUeXBlKCk7CiAgICAgICAgICAgICAgICAgICAgIGhhbmRsZURuc0NvbmZpZ3VyYXRpb25DaGFuZ2UodHlwZSk7CiAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwotCi0gICAgICAgICAgICAgICAgY2FzZSBOZXR3b3JrU3RhdGVUcmFja2VyLkVWRU5UX1JPQU1JTkdfQ0hBTkdFRDoKLSAgICAgICAgICAgICAgICAgICAgLy8gZmlsbCBtZSBpbgotICAgICAgICAgICAgICAgICAgICBicmVhazsKLQotICAgICAgICAgICAgICAgIGNhc2UgTmV0d29ya1N0YXRlVHJhY2tlci5FVkVOVF9ORVRXT1JLX1NVQlRZUEVfQ0hBTkdFRDoKLSAgICAgICAgICAgICAgICAgICAgLy8gZmlsbCBtZSBpbgotICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICBjYXNlIE5ldHdvcmtTdGF0ZVRyYWNrZXIuRVZFTlRfUkVTVE9SRV9ERUZBVUxUX05FVFdPUks6CiAgICAgICAgICAgICAgICAgICAgIEZlYXR1cmVVc2VyIHUgPSAoRmVhdHVyZVVzZXIpbXNnLm9iajsKICAgICAgICAgICAgICAgICAgICAgdS5leHBpcmUoKTsKICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBOZXR3b3JrU3RhdGVUcmFja2VyLkVWRU5UX0NMRUFSX05FVF9UUkFOU0lUSU9OX1dBS0VMT0NLOgorICAgICAgICAgICAgICAgICAgICBTdHJpbmcgY2F1c2VkQnkgPSBudWxsOworICAgICAgICAgICAgICAgICAgICBzeW5jaHJvbml6ZWQgKENvbm5lY3Rpdml0eVNlcnZpY2UudGhpcykgeworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1zZy5hcmcxID09IG1OZXRUcmFuc2l0aW9uV2FrZUxvY2tTZXJpYWxOdW1iZXIgJiYKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbU5ldFRyYW5zaXRpb25XYWtlTG9jay5pc0hlbGQoKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1OZXRUcmFuc2l0aW9uV2FrZUxvY2sucmVsZWFzZSgpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhdXNlZEJ5ID0gbU5ldFRyYW5zaXRpb25XYWtlTG9ja0NhdXNlZEJ5OworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGlmIChjYXVzZWRCeSAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBTbG9nLmQoVEFHLCAiTmV0VHJhbnNpdGlvbiBXYWtlbG9jayBmb3IgIiArCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhdXNlZEJ5ICsgIiByZWxlYXNlZCBieSB0aW1lb3V0Iik7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KICAgICB9CkBAIC0xNDk1LDYgKzE2NzcsMTUgQEAKICAgICAgICAgfQogICAgIH0KIAorICAgIHB1YmxpYyBTdHJpbmdbXSBnZXRUZXRoZXJhYmxlQmx1ZXRvb3RoUmVnZXhzKCkgeworICAgICAgICBlbmZvcmNlVGV0aGVyQWNjZXNzUGVybWlzc2lvbigpOworICAgICAgICBpZiAoaXNUZXRoZXJpbmdTdXBwb3J0ZWQoKSkgeworICAgICAgICAgICAgcmV0dXJuIG1UZXRoZXJpbmcuZ2V0VGV0aGVyYWJsZUJsdWV0b290aFJlZ2V4cygpOworICA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ZXIgbGlzdGVuZXIpIHsKKyAgICAgICAgICAgIG1MaXN0ZW5lciA9IGxpc3RlbmVyOworICAgICAgICAgICAgbUtleSA9IGxpc3RlbmVyLmFzQmluZGVyKCk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCBiaW5kZXJEaWVkKCkgeworICAgICAgICAgICAgcmVtb3ZlTGlzdGVuZXIobUtleSk7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIGJvb2xlYW4gZXF1YWxzKE9iamVjdCBvdGhlck9iaikgeworICAgICAgICAgICAgaWYgKG90aGVyT2JqIGluc3RhbmNlb2YgUmVjZWl2ZXIpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gbUtleS5lcXVhbHMoKChSZWNlaXZlcikgb3RoZXJPYmopLm1LZXkpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyBpbnQgaGFzaENvZGUoKSB7CisgICAgICAgICAgICByZXR1cm4gbUtleS5oYXNoQ29kZSgpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIElDb3VudHJ5TGlzdGVuZXIgZ2V0TGlzdGVuZXIoKSB7CisgICAgICAgICAgICByZXR1cm4gbUxpc3RlbmVyOworICAgICAgICB9CisgICAgfQorCisgICAgcHJpdmF0ZSBmaW5hbCBzdGF0aWMgU3RyaW5nIFRBRyA9ICJDb3VudHJ5RGV0ZWN0b3JTZXJ2aWNlIjsKKworICAgIHByaXZhdGUgZmluYWwgSGFzaE1hcDxJQmluZGVyLCBSZWNlaXZlcj4gbVJlY2VpdmVyczsKKyAgICBwcml2YXRlIGZpbmFsIENvbnRleHQgbUNvbnRleHQ7CisgICAgcHJpdmF0ZSBDb21wcmVoZW5zaXZlQ291bnRyeURldGVjdG9yIG1Db3VudHJ5RGV0ZWN0b3I7CisgICAgcHJpdmF0ZSBib29sZWFuIG1TeXN0ZW1SZWFkeTsKKyAgICBwcml2YXRlIEhhbmRsZXIgbUhhbmRsZXI7CisgICAgcHJpdmF0ZSBDb3VudHJ5TGlzdGVuZXIgbUxvY2F0aW9uQmFzZWREZXRlY3Rvckxpc3RlbmVyOworCisgICAgcHVibGljIENvdW50cnlEZXRlY3RvclNlcnZpY2UoQ29udGV4dCBjb250ZXh0KSB7CisgICAgICAgIHN1cGVyKCk7CisgICAgICAgIG1SZWNlaXZlcnMgPSBuZXcgSGFzaE1hcDxJQmluZGVyLCBSZWNlaXZlcj4oKTsKKyAgICAgICAgbUNvbnRleHQgPSBjb250ZXh0OworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyBDb3VudHJ5IGRldGVjdENvdW50cnkoKSB0aHJvd3MgUmVtb3RlRXhjZXB0aW9uIHsKKyAgICAgICAgaWYgKCFtU3lzdGVtUmVhZHkpIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBSZW1vdGVFeGNlcHRpb24oKTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gbUNvdW50cnlEZXRlY3Rvci5kZXRlY3RDb3VudHJ5KCk7CisgICAgfQorCisgICAgLyoqCisgICAgICogQWRkIHRoZSBJQ291bnRyeUxpc3RlbmVyIGludG8gdGhlIGxpc3RlbmVyIGxpc3QuCisgICAgICovCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgYWRkQ291bnRyeUxpc3RlbmVyKElDb3VudHJ5TGlzdGVuZXIgbGlzdGVuZXIpIHRocm93cyBSZW1vdGVFeGNlcHRpb24geworICAgICAgICBpZiAoIW1TeXN0ZW1SZWFkeSkgeworICAgICAgICAgICAgdGhyb3cgbmV3IFJlbW90ZUV4Y2VwdGlvbigpOworICAgICAgICB9CisgICAgICAgIGFkZExpc3RlbmVyKGxpc3RlbmVyKTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBSZW1vdmUgdGhlIElDb3VudHJ5TGlzdGVuZXIgZn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aWxlZDoiLCBlKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgdm9pZCByZW1vdmVMaXN0ZW5lcihJQmluZGVyIGtleSkgeworICAgICAgICBzeW5jaHJvbml6ZWQgKG1SZWNlaXZlcnMpIHsKKyAgICAgICAgICAgIG1SZWNlaXZlcnMucmVtb3ZlKGtleSk7CisgICAgICAgICAgICBpZiAobVJlY2VpdmVycy5pc0VtcHR5KCkpIHsKKyAgICAgICAgICAgICAgICBzZXRDb3VudHJ5TGlzdGVuZXIobnVsbCk7CisgICAgICAgICAgICAgICAgU2xvZy5kKFRBRywgIk5vIGxpc3RlbmVyIGlzIGxlZnQiKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworCisgICAgcHJvdGVjdGVkIHZvaWQgbm90aWZ5UmVjZWl2ZXJzKENvdW50cnkgY291bnRyeSkgeworICAgICAgICBzeW5jaHJvbml6ZWQobVJlY2VpdmVycykgeworICAgICAgICAgICAgZm9yIChSZWNlaXZlciByZWNlaXZlciA6IG1SZWNlaXZlcnMudmFsdWVzKCkpIHsKKyAgICAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgICAgICByZWNlaXZlci5nZXRMaXN0ZW5lcigpLm9uQ291bnRyeURldGVjdGVkKGNvdW50cnkpOworICAgICAgICAgICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgICAgIC8vIFRPRE86IFNoYWxsIHdlIHJlbW92ZSB0aGUgcmVjZWl2ZXI/CisgICAgICAgICAgICAgICAgICAgIFNsb2cuZShUQUcsICJub3RpZnlSZWNlaXZlcnMgZmFpbGVkOiIsIGUpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIHZvaWQgc3lzdGVtUmVhZHkoKSB7CisgICAgICAgIC8vIFNoYWxsIHdlIHdhaXQgZm9yIHRoZSBpbml0aWFsaXphdGlvbiBmaW5pc2guCisgICAgICAgIFRocmVhZCB0aHJlYWQgPSBuZXcgVGhyZWFkKHRoaXMsICJDb3VudHJ5RGV0ZWN0b3JTZXJ2aWNlIik7CisgICAgICAgIHRocmVhZC5zdGFydCgpOworICAgIH0KKworICAgIHByaXZhdGUgdm9pZCBpbml0aWFsaXplKCkgeworICAgICAgICBtQ291bnRyeURldGVjdG9yID0gbmV3IENvbXByZWhlbnNpdmVDb3VudHJ5RGV0ZWN0b3IobUNvbnRleHQpOworICAgICAgICBtTG9jYXRpb25CYXNlZERldGVjdG9yTGlzdGVuZXIgPSBuZXcgQ291bnRyeUxpc3RlbmVyKCkgeworICAgICAgICAgICAgcHVibGljIHZvaWQgb25Db3VudHJ5RGV0ZWN0ZWQoZmluYWwgQ291bnRyeSBjb3VudHJ5KSB7CisgICAgICAgICAgICAgICAgbUhhbmRsZXIucG9zdChuZXcgUnVubmFibGUoKSB7CisgICAgICAgICAgICAgICAgICAgIHB1YmxpYyB2b2lkIHJ1bigpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIG5vdGlmeVJlY2VpdmVycyhjb3VudHJ5KTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0pOworICAgICAgICAgICAgfQorICAgICAgICB9OworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHJ1bigpIHsKKyAgICAgICAgUHJvY2Vzcy5zZXRUaHJlYWRQcmlvcml0eShQcm9jZXNzLlRIUkVBRF9QUklPUklUWV9CQUNLR1JPVU5EKTsKKyAgICAgICAgTG9vcGVyLnByZXBhcmUoKTsKKyAgICAgICAgbUhhbmRsZXIgPSBuZXcgSGFuZGxlcigpOworICAgICAgICBpbml0aWFsaXplKCk7CisgICAgICAgIG1TeXN0ZW1SZWFkeSA9IHRydWU7CisgICAgICAgIExvb3Blci5sb29wKCk7CisgICAgfQorCisgICAgcHJvdGVjdGVkIHZvaWQgc2V0Q291bnRyeUxpc3RlbmV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VjdG9yeSwgImltYWdlcyIpLmxpc3QoKTsKLSAgICAgICAgaW50IGNvdW50ID0gZmlsZXMubGVuZ3RoOwotCi0gICAgICAgIGlmIChjb3VudCA9PSAwKSB7Ci0gICAgICAgICAgICBTbG9nLmkoTE9HX1RBRywgImFkZERlZmF1bHRJbWFnZXM6IG5vIGltYWdlcyBmb3VuZCEiKTsKLSAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgfQotCi0gICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgY291bnQ7IGkrKykKLSAgICAgICAgewotICAgICAgICAgICAgU3RyaW5nIG5hbWUgPSBmaWxlc1tpXTsKLSAgICAgICAgICAgIFN0cmluZyBwYXRoID0gcm9vdERpcmVjdG9yeSArICIvIiArIG5hbWU7Ci0gICAgICAgICAgICAKLSAgICAgICAgICAgIHRyeSB7Ci0gICAgICAgICAgICAgICAgSW1hZ2VzLk1lZGlhLmluc2VydEltYWdlKG1Db250ZW50UmVzb2x2ZXIsIHBhdGgsIG5hbWUsIG51bGwpOwotICAgICAgICAgICAgfSBjYXRjaCAoRmlsZU5vdEZvdW5kRXhjZXB0aW9uIGUpIHsKLSAgICAgICAgICAgICAgICBTbG9nLmUoTE9HX1RBRywgIkZhaWxlZCB0byBpbXBvcnQgaW1hZ2UgIiArIHBhdGgsIGUpOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgfQotICAgIAotICAgIHByaXZhdGUgZmluYWwgdm9pZCBhZGREZWZhdWx0RGF0YSgpCi0gICAgewotICAgICAgICBTbG9nLmkoTE9HX1RBRywgIkFkZGluZyBkZWZhdWx0IGRhdGEuLi4iKTsKLQotLy8gICAgICAgYWRkSW1hZ2UoIlZpb2xldCIsICJpbWFnZXMvdmlvbGV0LnBuZyIpOwotLy8gICAgICAgYWRkSW1hZ2UoIkNvcmt5IiwgImltYWdlcy9jb3JreS5wbmciKTsKLQotICAgICAgICAvLyBQRU5ESU5HOiBzaG91bGQgdGhpcyBiZSBkb25lIGhlcmU/IT8hCi0gICAgICAgIEludGVudCBpbnRlbnQgPSBuZXcgSW50ZW50KAotICAgICAgICAgICAgICAgIEludGVudC5BQ1RJT05fQ0FMTCwgVXJpLmZyb21QYXJ0cygidm9pY2VtYWlsIiwgIiIsIG51bGwpKTsKLSAgICAgICAgYWRkU2hvcnRjdXQoIjEiLCBpbnRlbnQpOwotICAgIH0KLQotICAgIHByaXZhdGUgZmluYWwgVXJpIGFkZEltYWdlKFN0cmluZyBuYW1lLCBVcmkgZmlsZSkKLSAgICB7Ci0gICAgICAgIENvbnRlbnRWYWx1ZXMgaW1hZ2V2ID0gbmV3IENvbnRlbnRWYWx1ZXMoKTsKLSAgICAgICAgaW1hZ2V2LnB1dCgibmFtZSIsIG5hbWUpOwotCi0gICAgICAgIFVyaSB1cmwgPSBudWxsOwotCi0gICAgICAgIEFzc2V0TWFuYWdlciBhc3MgPSBBc3NldE1hbmFnZXIuZ2V0U3lzdGVtKCk7Ci0gICAgICAgIElucHV0U3RyZWFtIGluID0gbnVsbDsKLSAgICAgICAgT3V0cHV0U3RyZWFtIG91dCA9IG51bGw7Ci0gICAgICAgIAotICAgICAgICB0cnkKLSAgICAgICAgewotICAgICAgICAgICAgaW4gPSBhc3Mub3BlbihmaWxlLnRvU3RyaW5nKCkpOwotCi0gICAgICAgICAgICB1cmwgPSBtQ29udGVudFJlc29sdmVyLmluc2VydChJbWFnZXMuTWVkaWEuSU5URVJOQUxfQ09OVEVOVF9VUkksIGltYWdldik7Ci0gICAgICAgICAgICBvdXQgPSBtQ29udGVudFJlc29sdmVyLm9wZW5PdXRwdXRTdHJlYW0odXJsKTsKLQotICAgICAgICAgICAgZmluYWwgaW50IHNpemUgPSA4ICogMTAyNDsKLSAgICAgICAgICAgIGJ5dGVbXSBidWYgPSBuZXcgYnl0ZVtzaXplXTsKLQotICAgICAgICAgICAgaW50IGNvdW50ID0gMDsKLSAgICAgICAgICAgIGRvCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgY291b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A9IDA7CisgICAgaW50IG1BY3RpdmVQYXNzd29yZE5vbkxldHRlciA9IDA7CiAgICAgaW50IG1GYWlsZWRQYXNzd29yZEF0dGVtcHRzID0gMDsKLSAgICAKKwogICAgIGludCBtUGFzc3dvcmRPd25lciA9IC0xOwotICAgIAorCiAgICAgZmluYWwgSGFzaE1hcDxDb21wb25lbnROYW1lLCBBY3RpdmVBZG1pbj4gbUFkbWluTWFwCiAgICAgICAgICAgICA9IG5ldyBIYXNoTWFwPENvbXBvbmVudE5hbWUsIEFjdGl2ZUFkbWluPigpOwogICAgIGZpbmFsIEFycmF5TGlzdDxBY3RpdmVBZG1pbj4gbUFkbWluTGlzdAogICAgICAgICAgICAgPSBuZXcgQXJyYXlMaXN0PEFjdGl2ZUFkbWluPigpOwotICAgIAorCiAgICAgc3RhdGljIGNsYXNzIEFjdGl2ZUFkbWluIHsKICAgICAgICAgZmluYWwgRGV2aWNlQWRtaW5JbmZvIGluZm87Ci0gICAgICAgIAorCiAgICAgICAgIGludCBwYXNzd29yZFF1YWxpdHkgPSBEZXZpY2VQb2xpY3lNYW5hZ2VyLlBBU1NXT1JEX1FVQUxJVFlfVU5TUEVDSUZJRUQ7CiAgICAgICAgIGludCBtaW5pbXVtUGFzc3dvcmRMZW5ndGggPSAwOworICAgICAgICBpbnQgcGFzc3dvcmRIaXN0b3J5TGVuZ3RoID0gMDsKKyAgICAgICAgaW50IG1pbmltdW1QYXNzd29yZFVwcGVyQ2FzZSA9IDA7CisgICAgICAgIGludCBtaW5pbXVtUGFzc3dvcmRMb3dlckNhc2UgPSAwOworICAgICAgICBpbnQgbWluaW11bVBhc3N3b3JkTGV0dGVycyA9IDE7CisgICAgICAgIGludCBtaW5pbXVtUGFzc3dvcmROdW1lcmljID0gMTsKKyAgICAgICAgaW50IG1pbmltdW1QYXNzd29yZFN5bWJvbHMgPSAxOworICAgICAgICBpbnQgbWluaW11bVBhc3N3b3JkTm9uTGV0dGVyID0gMDsKICAgICAgICAgbG9uZyBtYXhpbXVtVGltZVRvVW5sb2NrID0gMDsKICAgICAgICAgaW50IG1heGltdW1GYWlsZWRQYXNzd29yZHNGb3JXaXBlID0gMDsKLSAgICAgICAgCisKKyAgICAgICAgLy8gVE9ETzogcmV2aWV3IGltcGxlbWVudGF0aW9uIGRlY2lzaW9ucyB3aXRoIGZyYW1ld29ya3MgdGVhbQorICAgICAgICBib29sZWFuIHNwZWNpZmllc0dsb2JhbFByb3h5ID0gZmFsc2U7CisgICAgICAgIFN0cmluZyBnbG9iYWxQcm94eVNwZWMgPSBudWxsOworICAgICAgICBTdHJpbmcgZ2xvYmFsUHJveHlFeGNsdXNpb25MaXN0ID0gbnVsbDsKKwogICAgICAgICBBY3RpdmVBZG1pbihEZXZpY2VBZG1pbkluZm8gX2luZm8pIHsKICAgICAgICAgICAgIGluZm8gPSBfaW5mbzsKICAgICAgICAgfQotICAgICAgICAKKwogICAgICAgICBpbnQgZ2V0VWlkKCkgeyByZXR1cm4gaW5mby5nZXRBY3Rpdml0eUluZm8oKS5hcHBsaWNhdGlvbkluZm8udWlkOyB9Ci0gICAgICAgIAorCiAgICAgICAgIHZvaWQgd3JpdGVUb1htbChYbWxTZXJpYWxpemVyIG91dCkKICAgICAgICAgICAgICAgICB0aHJvd3MgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uLCBJbGxlZ2FsU3RhdGVFeGNlcHRpb24sIElPRXhjZXB0aW9uIHsKICAgICAgICAgICAgIG91dC5zdGFydFRhZyhudWxsLCAicG9saWNpZXMiKTsKQEAgLTExMCw3ICsxMzMsNDIgQEAKICAgICAgICAgICAgICAgICBpZiAobWluaW11bVBhc3N3b3JkTGVuZ3RoID4gMCkgewogICAgICAgICAgICAgICAgICAgICBvdXQuc3RhcnRUYWcobnVsbCwgIm1pbi1wYXNzd29yZC1sZW5ndGgiKTsKICAgICAgICAgICAgICAgICAgICAgb3V0LmF0dHJpYnV0ZShudWxsLCAidmFsdWUiLCBJbnRlZ2VyLnRvU3RyaW5nKG1pbmltdW1QYXNzd29yZExlbmd0aCkpOwotICAgICAgICAgICAgICAgICAgICBvdXQuZW5kVGFnKG51bGwsICJtbi1wYXNzd29yZC1sZW5ndGgiKTsKKyAgICAgICAgICAgICAgICAgICAgb3V0LmVuZFRhZyhudWxsLCAibWluLXBhc3N3b3JkLWxlbmd0aCIpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBpZihwYXNzd29yZEhpc3RvcnlMZW5ndGggPiAwKSB7CisgICAgICAgICAgICAgICAgICAgIG91dC5zdGFydFRhZyhudWxsLCAicGFzc3dvcmQtaGlzdG9yeS1sZW5ndGgiKTsKKyAgICAgICAgICAgICAgICAgICAgb3V0LmF0dHJpYnV0ZShudWxsLCAidmFsdWUiLCBJbnRlZ2VyLnRvU3RyaW5nKHBhc3N3b3JkSGlzdG9yeUxlbmd0aCkpOworICAgICAgICAgICAgICAgICAgICBvdXQuZW5kVGFnKG51bGwsICJwYXNzd29yZC1oaXN0b3J5LWxlbmd0aCIpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBpZiAobWluaW11bVBhc3N3b3JkVXBwZXJDYXNlID4gMCkgeworICAgICAgICAgICAgICAgICAgICBvdXQuc3RhcnRUYWcobnVsbCwgIm1pbi1wYXNzd29yZC11cHBlcmNhc2UiKTsKKyAgICAgICAgICAgICAgICAgICAgb3V0LmF0dHJpYnV0ZShudWxsLCAidmFsdWUiLCBJbnRlZ2VyLnRvU3RyaW5nKG1pbmltdW1QYXNzd29yZFVwcGVyQ2FzZSkpOworICAgICAgICAgICAgICAgICAgICBvdXQuZW5kVGFnKG51bGwsICJtaW4tcGFzc3dvcmQtdXBwZXJjYXNlIik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGlmIChtaW5pbXVtUGFzc3dvcmRMb3dlckNhc2UgPiAwKSB7CisgICAgICAgICAgICAgICAgICAgIG91dC5zdGFydFRhZyhudWxsLCAibWluLXBhc3N3b3JkLWxvd2VyY2FzZSIpOworICAgICAgICAgICAgICAgICAgICBvdXQuYXR0cmlidXRlKG51bGwsICJ2YWx1ZSIsIEludGVnZXIudG9TdHJpbmcobWluaW11bVBhc3N3b3JkTG93ZXJDYXNlKSk7CisgICAgICAgICAgICAgICAgICAgIG91dC5lbmRUYWcobnVsbCwgIm1pbi1wYXNzd29yZC1sb3dlcmNhc2UiKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaWYgKG1pbmltdW1QYXNzd29yZExldHRlcnMgPiAwKSB7CisgICAgICAgICAgICAgICAgICAgIG91dC5zdGFydFRhZyhudWxsLCAibWluLXBhc3N3b3JkLWxldHRlcnMiKTsKKyAgICAgICAgICAgICAgICAgICAgb3V0LmF0dHJpYnV0ZShudWxsLCAidmFsdWUiLCBJbnRlZ2VyLnRvU3RyaW5nKG1pbmltdW1QYXNzd29yZExldHRlcnMpKTsKKyAgICAgICAgICAgICAgICAgICAgb3V0LmVuZFRhZyhudWxsLCAibWluLXBhc3N3b3JkLWxldHRlcnMiKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaWYgKG1pbmltdW1QYXNzd29yZE51bWVyaWMgPiAwKSB7CisgICAgICAgICAgICAgICAgICAgIG91dC5zdGFydFRhZyhudWxsLCAibWluLXBhc3N3b3JkLW51bWVyaWMiKTsKKyAgICAgICAgICAgICAgICAgICAgb3V0LmF0dHJpYnV0ZShudWxsLCAidmFsdWUiLCBJbnRlZ2VyLnRvU3RyaW5nKG1pbmltdW1QYXNzd29yZE51bWVyaWMpKTsKKyAgICAgICAgICAgICAgICAgICAgb3V0LmVuZFRhZyhudWxsLCAibWluLXBhc3N3b3JkLW51bWVyaWMiKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaWYgKG1pbmltdW1QYXNzd29yZFN5bWJvbHMgPiAwKSB7CisgICAgICAgICAgICAgICAgICAgIG91dC5zdGFydFRhZyhudWxsLCAibWluLXBhc3N3b3JkLXN5bWJvbHMiKTsKKyAgICAgICAgICAgICAgICAgICAgb3V0LmF0dHJpYnV0ZShudWxsLCAidmFsdWUiLCBJbnRlZ2VyLnRvU3RyaW5nKG1pbmltdW1QYXNzd29yZFN5bWJvbHMpKTsKKyAgICAgICAgICAgICAgICAgICAgb3V0LmVuZFRhZyhudWxsLCAibWluLXBhc3N3b3JkLXN5bWJvbHMiKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaWYgKG1pbmltdW1QYXNzd29yZE5vbkxldHRlciA+IDApIHsKKyAgICAgICAgICAgICAgICAgICAgb3V0LnN0YXJ0VGFnKG51bGwsICJtaW4tcGFzc3dvcmQtbm9ubGV0dGVyIik7CisgICAgICAgICAgICAgICAgICAgIG91dC5hdHRyaWJ1dGUobnVsbCwgInZhbHVlIiwgSW50ZWdlci50b1N0cmluZyhtaW5pbXVtUGFzc3dvcmROb25MZXR0ZXIpKTsKKyAgICAgICAgICAgICAgICAgICAgb3V0LmVuZFRhZyhudWxsLCAibWluLXBhc3N3b3JkLW5vbmxldHRlciIpOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KICAgICAgICAgICAgIGlmIChtYXhpbXVtVGltZVRvVW5sb2NrICE9IERldmljZVBvbGljeU1hbmFnZXIuUEFTU1dPUkRfUVVBTElUWV9VTlNQRUNJRklFRCkgewpAQCAtMTIzLDggKzE4MSwyMyBAQAogICAgICAgICAgICAgICAgIG91dC5hdHRyaWJ1dGUobnVsbCwgInZhbHVlIiwgSW50ZWdlci50b1N0cmluZyhtYXhpbXVtRmFpbGVkUGFzc3dvcmRzRm9yV2lwZSkpOwogICAgICAgICAgICAgICAgIG91dC5lbmRUYWcobnVsbCwgIm1heC1mYWlsZWQtcGFzc3dvcmQtd2lwZSIpOwogICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKHNwZWNpZmllc0dsb2JhbFByb3h5KSB7CisgICAgICAgICAgICAgICAgb3V0LnN0YXJ0VGFnKG51bGwsICJzcGVjaWZpZXMtZ2xvYmFsLXByb3h5Iik7CisgICAgICAgICAgICAgICAgb3V0LmF0dHJpYnV0ZShudWxsLCAidmFsdWUiLCBCb29sZWFuLnRvU3RyaW5nKHNwZWNpZmllc0dsb2JhbFByb3h5KSk7CisgICAgICAgICAgICAgICAgb3V0LmVuZFRhZyhudWxsLCAic3BlY2lmaWVzX2dsb2JhbF9wcm94eSIpOworICAgICAgICAgICAgICAgIGlmIChnbG9iYWxQcm94eVNwZWMgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICBvdXQuc3RhcnRUYWcobnVsbCwgImdsb2JhbC1wcm94eS1zcGVjIik7CisgICAgICAgICAgICAgICAgICAgIG91dC5hdHRyaWJ1dGUobnVsbCwgInZhbHVlIiwgZ2xvYmFsUHJveHlTcGVjKTsKKyAgICAgICAgICAgICAgICAgICAgb3V0LmVuZFRhZyhudWxsLCAiZ2xvYmFsLXByb3h5LXNwZWMiKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaWYgKGdsb2JhbFByb3h5RXhjbHVzaW9uTGlzdCAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIG91dC5zdGFydFRhZyhudWxsLCAiZ2xvYmFsLXByb3h5LWV4Y2x1c2lvbi1saXN0Iik7CisgICAgICAgICAgICAgICAgICAgIG91dC5hdHRyaWJ1dGUobnVsbCwgInZhbHVlIiwgZ2xvYmFsUHJveHlFeGNsdXNpb25MaXN0KTsKKyAgICAgICAgICAgICAgICAgICAgb3V0LmVuZFRhZyhudWxsLCAiZ2xvYmFsLXByb3h5LWV4Y2x1c2lvbi1saXN0Iik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQogICAgICAgICB9Ci0gICAgICAgIAorCiAgICAgICAgIHZvaWQgcmVhZEZyb21YbWwoWG1sUHVsbFBhcnNlciBwYXJzZXIpCiAgICAgICAgICAgICAgICAgdGhyb3dzIFhtbFB1bGxQYXJzZXJFeGNlcHRpb24sIElPRXhjZXB0aW9uIHsKICAgICAgICAgICAgIGludCBvdXRlckRlcHRoID0gcGFyc2VyLmdldERlcHRoKCk7CkBAIC0xNDMsMTkgKzIxNiw0OSBAQAogICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoIm1pbi1wYXNzd29yZC1sZW5ndGgiLmVxdWFscyh0YWcpKSB7CiAgICAgICAgICAgICAgICAgICAgIG1pbmltdW1QYXNzd29yZExlbmd0aCA9IEludGVnZXIucGFyc2VJbnQoCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyc2VyLmdldEF0dHJpYnV0ZVZhbHVlKG51bGwsICJ2YWx1ZSIpKTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKCJwYXNzd29yZC1oaXN0b3J5LWxlbmd0aCIuZXF1YWxzKHRhZykpIHsKKyAgICAgICAgICAgICAgICAgICAgcGFzc3dvcmRIaXN0b3J5TGVuZ3RoID0gSW50ZWdlci5wYXJzZUludCgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJzZXIuZ2V0QXR0cmlidXRlVmFsdWUobnVsbCwgInZhbHVlIikpOworICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoIm1pbi1wYXNzd29yZC11cHBlcmNhc2UiLmVxdWFscyh0YWcpKSB7CisgICAgICAgICAgICAgICAgICAgIG1pbmltdW1QYXNzd29yZFVwcGVyQ2FzZSA9IEludGVnZXIucGFyc2VJbnQoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyc2VyLmdldEF0dHJpYnV0ZVZhbHVlKG51bGwsICJ2YWx1ZSIpKTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKCJtaW4tcGFzc3dvcmQtbG93ZXJjYXNlIi5lcXVhbHModGFnKSkgeworICAgICAgICAgICAgICAgICAgICBtaW5pbXVtUGFzc3dvcmRMb3dlckNhc2UgPSBJbnRlZ2VyLnBhcnNlSW50KAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcnNlci5nZXRBdHRyaWJ1dGVWYWx1ZShudWxsLCAidmFsdWUiKSk7CisgICAgICAgICAgICAgICAgfSBlbHNlIGlmICgibWluLXBhc3N3b3JkLWxldHRlcnMiLmVxdWFscyh0YWcpKSB7CisgICAgICAgICAgICAgICAgICAgIG1pbmltdW1QYXNzd29yZExldHRlcnMgPSBJbnRlZ2VyLnBhcnNlSW50KAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcnNlci5nZXRBdHRyaWJ1dGVWYWx1ZShudWxsLCAidmFsdWUiKSk7CisgICAgICAgICAgICAgICAgfSBlbHNlIGlmICgibWluLXBhc3N3b3JkLW51bWVyaWMiLmVxdWFscyh0YWcpKSB7CisgICAgICAgICAgICAgICAgICAgIG1pbmltdW1QYXNzd29yZE51bWVyaWMgPSBJbnRlZ2VyLnBhcnNlSW50KAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcnNlci5nZXRBdHRyaWJ1dGVWYWx1ZShudWxsLCAidmFsdWUiKSk7CisgICAgICAgICAgICAgICAgfSBlbHNlIGlmICgibWluLXBhc3N3b3JkLXN5bWJvbHMiLmVxdWFscyh0YWcpKSB7CisgICAgICAgICAgICAgICAgICAgIG1pbmltdW1QYXNzd29yZFN5bWJvbHMgPSBJbnRlZ2VyLnBhcnNlSW50KAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcnNlci5nZXRBdHRyaWJ1dGVWYWx1ZShudWxsLCAidmFsdWUiKSk7CisgICAgICAgICAgICAgICAgfSBlbHNlIGlmICgibWluLXBhc3N3b3JkLW5vbmxldHRlciIuZXF1YWxzKHRhZykpIHsKKyAgICAgICAgICAgICAgICAgICAgbWluaW11bVBhc3N3b3JkTm9uTGV0dGVyID0gSW50ZWdlci5wYXJzZUludCgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJzZXIuZ2V0QXR0cmlidXRlVmFsdWUobnVsbCwgInZhbHVlIikpOwogICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoIm1heC10aW1lLXRvLXVubG9jayIuZXF1YWxzKHRhZykpIHsKICAgICAgICAgICAgICAgICAgICAgbWF4aW11bVRpbWVUb1VubG9jayA9IExvbmcucGFyc2VMb25nKAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcnNlci5nZXRBdHRyaWJ1dGVWYWx1ZShudWxsLCAidmFsdWUiKSk7CiAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICgibWF4LWZhaWxlZC1wYXNzd29yZC13aXBlIi5lcXVhbHModGFnKSkgewogICAgICAgICAgICAgICAgICAgICBtYXhpbXVtRmFpbGVkUGFzc3dvcmRzRm9yV2lwZSA9IEludGVnZXIucGFyc2VJbnQoCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyc2VyLmdldEF0dHJpYnV0ZVZhbHVlKG51bGwsICJ2YWx1ZSIpKTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKCJzcGVjaWZpZXMtZ2xvYmFsLXByb3h5Ii5lcXVhbHModGFnKSkgeworICAgICAgICAgICAgICAgICAgICBzcGVjaWZpZXNHbG9iYWxQcm94eSA9IEJvb2xlYW4uZ2V0Qm9vbGVhbigKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJzZXIuZ2V0QXR0cmlidXRlVmFsdWUobnVsbCwgInZhbHVlIikpOworICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoImdsb2JhbC1wcm94eS1zcGVjIi5lcXVhbHModGFnKSkgeworICAgICAgICAgICAgICAgICAgICBnbG9iYWxQcm94eVNwZWMgPQorICAgICAgICAgICAgICAgICAgICAgICAgcGFyc2VyLmdldEF0dHJpYnV0ZVZhbHVlKG51bGwsICJ2YWx1ZSIpOworICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoImdsb2JhbC1wcm94eS1leGNsdXNpb24tbGlzdCIuZXF1YWxzKHRhZykpIHsKKyAgICAgICAgICAgICAgICAgICAgZ2xvYmFsUHJveHlFeGNsdXNpb25MaXN0ID0KKyAgICAgICAgICAgICAgICAgICAgICAgIHBhcnNlci5nZXRBdHRyaWJ1dGVWYWx1ZShudWxsLCAidmFsdWUiKTsKICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICBTbG9nLncoVEFHLCAiVW5rbm93biBhZG1pbiB0YWc6ICIgKyB0YWcpOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBYbWxVdGlscy5za2lwQ3VycmVudFRhZyhwYXJzZXIpOwogICAgICAgICAgICAgfQogICAgICAgICB9Ci0gICAgICAgIAorCiAgICAgICAgIHZvaWQgZHVtcChTdHJpbmcgcHJlZml4LCBQcmludFdyaXRlciBwdykgewogICAgICAgICAgICAgcHcucHJpbnQocHJlZml4KTsgcHcucHJpbnQoInVpZD0iKTsgcHcucHJpbnRsbihnZXRVaWQoKSk7CiAgICAgICAgICAgICBwdy5wcmludChwcmVmaXgpOyBwdy5wcmludGxuKCJwb2xpY2llczoiKTsKQEAgLTE2NiwyMyArMjY5LDQ3IEBACiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogICAgICAgICAgICAgcHcucHJpbnQocHJlZml4KTsgcHcucHJpbnQoInBhc3N3b3JkUXVhbGl0eT0weCIpOwotICAgICAgICAgICAgICAgICAgICBwdy5wcmludChJbnRlZ2VyLnRvSGV4U3RyaW5nKHBhc3N3b3JkUXVhbGl0eSkpOwotICAgICAgICAgICAgICAgICAgICBwdy5wcmludCgiIG1pbmltdW1QYXNzd29yZExlbmd0aD0iKTsKKyAgICAgICAgICAgICAgICAgICAgcHcucHJpbnRsbihJbnRlZ2VyLnRvSGV4U3RyaW5nKHBhc3N3b3JkUXVhbGl0eSkpOworICAgICAgICAgICAgcHcucHJpbnQocHJlZml4KTsgcHcucHJpbnQoIm1pbmltdW1QYXNzd29yZExlbmd0aD0iKTsKICAgICAgICAgICAgICAgICAgICAgcHcucHJpbnRsbihtaW5pbXVtUGFzc3dvcmRMZW5ndGgpOworICAgICAgICAgICAgcHcucHJpbnQocHJlZml4KTsgcHcucHJpbnQoInBhc3N3b3JkSGlzdG9yeUxlbmd0aD0iKTsKKyAgICAgICAgICAgICAgICAgICAgcHcucHJpbnRsbihwYXNzd29yZEhpc3RvcnlMZW5ndGgpOworICAgICAgICAgICAgcHcucHJpbnQocHJlZml4KTsgcHcucHJpbnQoIm1pbmltdW1QYXNzd29yZFVwcGVyQ2FzZT0iKTsKKyAgICAgICAgICAgICAgICAgICAgcHcucHJpbnRsbihtaW5pbXVtUGFzc3dvcmRVcHBlckNhc2UpOworICAgICAgICAgICAgcHcucHJpbnQocHJlZml4KTsgcHcucHJpbnQoIm1pbmltdW1QYXNzd29yZExvd2VyQ2FzZT0iKTsKKyAgICAgICAgICAgICAgICAgICAgcHcucHJpbnRsbihtaW5pbXVtUGFzc3dvcmRMb3dlckNhc2UpOworICAgICAgICAgICAgcHcucHJpbnQocHJlZml4KTsgcHcucHJpbnQoIm1pbmltdW1QYXNzd29yZExldHRlcnM9Iik7CisgICAgICAgICAgICAgICAgICAgIHB3LnByaW50bG4obWluaW11bVBhc3N3b3JkTGV0dGVycyk7CisgICAgICAgICAgICBwdy5wcmludChwcmVmaXgpOyBwdy5wcmludCgibWluaW11bVBhc3N3b3JkTnVtZXJpYz0iKTsKKyAgICAgICAgICAgICAgICAgICAgcHcucHJpbnRsbihtaW5pbXVtUGFzc3dvcmROdW1lcmljKTsKKyAgICAgICAgICAgIHB3LnByaW50KHByZWZpeCk7IHB3LnByaW50KCJtaW5pbXVtUGFzc3dvcmRTeW1ib2xzPSIpOworICAgICAgICAgICAgICAgICAgICBwdy5wcmludGxuKG1pbmltdW1QYXNzd29yZFN5bWJvbHMpOworICAgICAgICAgICAgcHcucHJpbnQocHJlZml4KTsgcHcucHJpbnQoIm1pbmltdW1QYXNzd29yZE5vbkxldHRlcj0iKTsKKyAgICAgICAgICAgICAgICAgICAgcHcucHJpbnRsbihtaW5pbXVtUGFzc3dvcmROb25MZXR0ZXIpOwogICAgICAgICAgICAgcHcucHJpbnQocHJlZml4KTsgcHcucHJpbnQoIm1heGltdW1UaW1lVG9VbmxvY2s9Iik7CiAgICAgICAgICAgICAgICAgICAgIHB3LnByaW50bG4obWF4aW11bVRpbWVUb1VubG9jayk7CiAgICAgICAgICAgICBwdy5wcmludChwcmVmaXgpOyBwdy5wcmludCgibWF4aW11bUZhaWxlZFBhc3N3b3Jkc0ZvcldpcGU9Iik7CiAgICAgICAgICAgICAgICAgICAgIHB3LnByaW50bG4obWF4aW11bUZhaWxlZFBhc3N3b3Jkc0ZvcldpcGUpOworICAgICAgICAgICAgcHcucHJpbnQocHJlZml4KTsgcHcucHJpbnQoInNwZWNpZmllc0dsb2JhbFByb3h5PSIpOworICAgICAgICAgICAgICAgICAgICBwdy5wcmludGxuKHNwZWNpZmllc0dsb2JhbFByb3h5KTsKKyAgICAgICAgICAgIGlmIChnbG9iYWxQcm94eVNwZWMgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIHB3LnByaW50KHByZWZpeCk7IHB3LnByaW50KCJnbG9iYWxQcm94eVNwZWM9Iik7CisgICAgICAgICAgICAgICAgICAgICAgICBwdy5wcmludGxuKGdsb2JhbFByb3h5U3BlYyk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoZ2xvYmFsUHJveHlFeGNsdXNpb25MaXN0ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBwdy5wcmludChwcmVmaXgpOyBwdy5wcmludCgiZ2xvYmFsUHJveHlFY2x1c2lvbkxpc3Q9Iik7CisgICAgICAgICAgICAgICAgICAgICAgICBwdy5wcmludGxuKGdsb2JhbFByb3h5RXhjbHVzaW9uTGlzdCk7CisgICAgICAgICAgICB9CiAgICAgICAgIH0KICAgICB9Ci0gICAgCisKICAgICBjbGFzcyBNeVBhY2thZ2VNb25pdG9yIGV4dGVuZHMgUGFja2FnZU1vbml0b3IgewogICAgICAgICBwdWJsaWMgdm9pZCBvblNvbWVQYWNrYWdlc0NoYW5nZWQoKSB7CiAgICAgICAgICAgICBzeW5jaHJvbml6ZWQgKERldmljZVBvbGljeU1hbmFnZXJTZXJ2aWNlLnRoaXMpIHsKICAgICAgICAgICAgICAgICBib29sZWFuIHJlbW92ZWQgPSBmYWxzZTsKICAgICAgICAgICAgICAgICBmb3IgKGludCBpPW1BZG1pbkxpc3Quc2l6ZSgpLTE7IGk+PTA7IGktLSkgewogICAgICAgICAgICAgICAgICAgICBBY3RpdmVBZG1pbiBhYSA9IG1BZG1pbkxpc3QuZ2V0KGkpOwotICAgICAgICAgICAgICAgICAgICBpbnQgY2hhbmdlID0gaXNQYWNrYWdlRGlzYXBwZWFyaW5nKGFhLmluZm8uZ2V0UGFja2FnZU5hbWUoKSk7IAorICAgICAgICAgICAgICAgICAgICBpbnQgY2hhbmdlID0gaXNQYWNrYWdlRGlzYXBwZWFyaW5nKGFhLmluZm8uZ2V0UGFja2FnZU5hbWUoKSk7CiAgICAgICAgICAgICAgICAgICAgIGlmIChjaGFuZ2UgPT0gUEFDS0FHRV9QRVJNQU5FTlRfQ0hBTkdFCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfHwgY2hhbmdlID09IFBBQ0tBR0VfVEVNUE9SQVJZX0NIQU5HRSkgewogICAgICAgICAgICAgICAgICAgICAgICAgU2xvZy53KFRBRywgIkFkbWluIHVuZXhwZWN0ZWRseSB1bmluc3RhbGxlZDogIgpAQCAtMjA3LDcgKzMzNCw3IEBACiAgICAgICAgICAgICB9CiAgICAgICAgIH0KICAgICB9Ci0gICAgCisKICAgICAvKioKICAgICAgKiBJbnN0YW50aWF0ZXMgdGhlIHNlcnZpY2UuCiAgICAgICovCkBAIC0yMjQsNyArMzUxLDcgQEAKICAgICAgICAgfQogICAgICAgICByZXR1cm4gbUlQb3dlck1hbmFnZXI7CiAgICAgfQotICAgIAorCiAgICAgQWN0aXZlQWRtaW4gZ2V0QWN0aXZlQWRtaW5VbmNoZWNrZWRMb2NrZWQoQ29tcG9uZW50TmFtZSB3aG8pIHsKICAgICAgICAgQWN0aXZlQWRtaW4gYWRtaW4gPSBtQWRtaW5NYXAuZ2V0KHdobyk7CiAgICAgICAgIGlmIChhZG1pbiAhPSBudWxsCkBAIC0yMzQsNyArMzYxLDcgQEAKICAgICAgICAgfQogICAgICAgICByZXR1cm4gbnVsbDsKICAgICB9Ci0gICAgCisKICAgICBBY3RpdmVBZG1pbiBnZXRBY3RpdmVBZG1pbkZvckNhbGxlckxvY2tlZChDb21wb25lbnROYW1lIHdobywgaW50IHJlcVBvbGljeSkKICAgICAgICAgICAgIHRocm93cyBTZWN1cml0eUV4Y2VwdGlvbiB7CiAgICAgICAgIGZpbmFsIGludCBjYWxsaW5nVWlkID0gQmluZGVyLmdldENhbGxpbmdVaWQoKTsKQEAgLTI2NSwxMyArMzkyLDEzIEBACiAgICAgICAgICAgICAgICAgICAgICsgQmluZGVyLmdldENhbGxpbmdVaWQoKSArICIgZm9yIHBvbGljeSAjIiArIHJlcVBvbGljeSk7CiAgICAgICAgIH0KICAgICB9Ci0gICAgCisKICAgICB2b2lkIHNlbmRBZG1pbkNvbW1hbmRMb2NrZWQoQWN0aXZlQWRtaW4gYWRtaW4sIFN0cmluZyBhY3Rpb24pIHsKICAgICAgICAgSW50ZW50IGludGVudCA9IG5ldyBJbnRlbnQoYWN0aW9uKTsKICAgICAgICAgaW50ZW50LnNldENvbXBvbmVudChhZG1pbi5pbmZvLmdldENvbXBvbmVudCgpKTsKICAgICAgICAgbUNvbnRleHQuc2VuZEJyb2FkY2FzdChpbnRlbnQpOwogICAgIH0KLSAgICAKKwogICAgIHZvaWQgc2VuZEFkbWluQ29tbWFuZExvY2tlZChTdHJpbmcgYWN0aW9uLCBpbnQgcmVxUG9saWN5KSB7CiAgICAgICAgIGZpbmFsIGludCBOID0gbUFkbWluTGlzdC5zaXplKCk7CiAgICAgICAgIGlmIChOID4gMCkgewpAQCAtMjgzLDE5ICs0MTAsMjQgQEAKICAgICAgICAgICAgIH0KICAgICAgICAgfQogICAgIH0KLSAgICAKKwogICAgIHZvaWQgcmVtb3ZlQWN0aXZlQWRtaW5Mb2NrZWQoQ29tcG9uZW50TmFtZSBhZG1pblJlY2VpdmVyKSB7CiAgICAgICAgIEFjdGl2ZUFkbWluIGFkbWluID0gZ2V0QWN0aXZlQWRtaW5VbmNoZWNrZWRMb2NrZWQoYWRtaW5SZWNlaXZlcik7CiAgICAgICAgIGlmIChhZG1pbiAhPSBudWxsKSB7CisgICAgICAgICAgICBib29sZWFuIGRvUHJveHlDbGVhbnVwID0KKyAgICAgICAgICAgICAgICBhZG1pbi5pbmZvLnVzZXNQb2xpY3koRGV2aWNlQWRtaW5JbmZvLlVTRVNfUE9MSUNZX1NFVFNfR0xPQkFMX1BST1hZKTsKICAgICAgICAgICAgIHNlbmRBZG1pbkNvbW1hbmRMb2NrZWQoYWRtaW4sCiAgICAgICAgICAgICAgICAgICAgIERldmljZUFkbWluUmVjZWl2ZXIuQUNUSU9OX0RFVklDRV9BRE1JTl9ESVNBQkxFRCk7CiAgICAgICAgICAgICAvLyBYWFggbmVlZCB0byB3YWl0IGZvciBpdCB0byBjb21wbGV0ZS4KICAgICAgICAgICAgIG1BZG1pbkxpc3QucmVtb3ZlKGFkbWluKTsKICAgICAgICAgICAgIG1BZG1pbk1hcC5yZW1vdmUoYWRtaW5SZWNlaXZlcik7CiAgICAgICAgICAgICB2YWxpZGF0ZVBhc3N3b3JkT3duZXJMb2NrZWQoKTsKKyAgICAgICAgICAgIGlmIChkb1Byb3h5Q2xlYW51cCkgeworICAgICAgICAgICAgICAgIHJlc2V0R2xvYmFsUHJveHkoKTsKKyAgICAgICAgICAgIH0KICAgICAgICAgfQogICAgIH0KLSAgICAKKwogICAgIHB1YmxpYyBEZXZpY2VBZG1pbkluZm8gZmluZEFkbWluKENvbXBvbmVudE5hbWUgYWRtaW5OYW1lKSB7CiAgICAgICAgIEludGVudCByZXNvbHZlSW50ZW50ID0gbmV3IEludGVudCgpOwogICAgICAgICByZXNvbHZlSW50ZW50LnNldENvbXBvbmVudChhZG1pbk5hbWUpOwpAQCAtMzA0LDcgKzQzNiw3IEBACiAgICAgICAgIGlmIChpbmZvcyA9PSBudWxsIHx8IGluZm9zLnNpemUoKSA8PSAwKSB7CiAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCJVbmtub3duIGFkbWluOiAiICsgYWRtaW5OYW1lKTsKICAgICAgICAgfQotICAgICAgICAKKwogICAgICAgICB0cnkgewogICAgICAgICAgICAgcmV0dXJuIG5ldyBEZXZpY2VBZG1pbkluZm8obUNvbnRleHQsIGluZm9zLmdldCgwKSk7CiAgICAgICAgIH0gY2F0Y2ggKFhtbFB1bGxQYXJzZXJFeGNlcHRpb24gZSkgewpAQCAtMzE1LDcgKzQ0Nyw3IEBACiAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgfQogICAgIH0KLSAgICAKKwogICAgIHByaXZhdGUgc3RhdGljIEpvdXJuYWxlZEZpbGUgbWFrZUpvdXJuYWxlZEZpbGUoKSB7CiAgICAgICAgIGZpbmFsIFN0cmluZyBiYXNlID0gIi9kYXRhL3N5c3RlbS9kZXZpY2VfcG9saWNpZXMueG1sIjsKICAgICAgICAgcmV0dXJuIG5ldyBKb3VybmFsZWRGaWxlKG5ldyBGaWxlKGJhc2UpLCBuZXcgRmlsZShiYXNlICsgIi50bXAiKSk7CkBAIC0zMzEsNyArNDYzLDcgQEAKICAgICAgICAgICAgIG91dC5zdGFydERvY3VtZW50KG51bGwsIHRydWUpOwogCiAgICAgICAgICAgICBvdXQuc3RhcnRUYWcobnVsbCwgInBvbGljaWVzIik7Ci0gICAgICAgICAgICAKKwogICAgICAgICAgICAgZmluYWwgaW50IE4gPSBtQWRtaW5MaXN0LnNpemUoKTsKICAgICAgICAgICAgIGZvciAoaW50IGk9MDsgaTxOOyBpKyspIHsKICAgICAgICAgICAgICAgICBBY3RpdmVBZG1pbiBhcCA9IG1BZG1pbkxpc3QuZ2V0KGkpOwpAQCAtMzQyLDI2ICs0NzQsMzYgQEAKICAgICAgICAgICAgICAgICAgICAgb3V0LmVuZFRhZyhudWxsLCAiYWRtaW4iKTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAKKwogICAgICAgICAgICAgaWYgKG1QYXNzd29yZE93bmVyID49IDApIHsKICAgICAgICAgICAgICAgICBvdXQuc3RhcnRUYWcobnVsbCwgInBhc3N3b3JkLW93bmVyIik7CiAgICAgICAgICAgICAgICAgb3V0LmF0dHJpYnV0ZShudWxsLCAidmFsdWUiLCBJbnRlZ2VyLnRvU3RyaW5nKG1QYXNzd29yZE93bmVyKSk7CiAgICAgICAgICAgICAgICAgb3V0LmVuZFRhZyhudWxsLCAicGFzc3dvcmQtb3duZXIiKTsKICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIAorCiAgICAgICAgICAgICBpZiAobUZhaWxlZFBhc3N3b3JkQXR0ZW1wdHMgIT0gMCkgewogICAgICAgICAgICAgICAgIG91dC5zdGFydFRhZyhudWxsLCAiZmFpbGVkLXBhc3N3b3JkLWF0dGVtcHRzIik7CiAgICAgICAgICAgICAgICAgb3V0LmF0dHJpYnV0ZShudWxsLCAidmFsdWUiLCBJbnRlZ2VyLnRvU3RyaW5nKG1GYWlsZWRQYXNzd29yZEF0dGVtcHRzKSk7CiAgICAgICAgICAgICAgICAgb3V0LmVuZFRhZyhudWxsLCAiZmFpbGVkLXBhc3N3b3JkLWF0dGVtcHRzIik7CiAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAKLSAgICAgICAgICAgIGlmIChtQWN0aXZlUGFzc3dvcmRRdWFsaXR5ICE9IDAgfHwgbUFjdGl2ZVBhc3N3b3JkTGVuZ3RoICE9IDApIHsKKworICAgICAgICAgICAgaWYgKG1BY3RpdmVQYXNzd29yZFF1YWxpdHkgIT0gMCB8fCBtQWN0aXZlUGFzc3dvcmRMZW5ndGggIT0gMAorICAgICAgICAgICAgICAgICAgICB8fCBtQWN0aXZlUGFzc3dvcmRVcHBlckN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KTsKKyAgICAgICAgICAgICAgICBvdXQuYXR0cmlidXRlKG51bGwsICJzeW1ib2xzIiwgSW50ZWdlci50b1N0cmluZyhtQWN0aXZlUGFzc3dvcmRTeW1ib2xzKSk7CisgICAgICAgICAgICAgICAgb3V0LmF0dHJpYnV0ZShudWxsLCAibm9ubGV0dGVyIiwgSW50ZWdlci50b1N0cmluZyhtQWN0aXZlUGFzc3dvcmROb25MZXR0ZXIpKTsKICAgICAgICAgICAgICAgICBvdXQuZW5kVGFnKG51bGwsICJhY3RpdmUtcGFzc3dvcmQiKTsKICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIAorCiAgICAgICAgICAgICBvdXQuZW5kVGFnKG51bGwsICJwb2xpY2llcyIpOwogCiAgICAgICAgICAgICBvdXQuZW5kRG9jdW1lbnQoKTsKQEAgLTQzOSw2ICs1ODEsMTggQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJzZXIuZ2V0QXR0cmlidXRlVmFsdWUobnVsbCwgInF1YWxpdHkiKSk7CiAgICAgICAgICAgICAgICAgICAgIG1BY3RpdmVQYXNzd29yZExlbmd0aCA9IEludGVnZXIucGFyc2VJbnQoCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyc2VyLmdldEF0dHJpYnV0ZVZhbHVlKG51bGwsICJsZW5ndGgiKSk7CisgICAgICAgICAgICAgICAgICAgIG1BY3RpdmVQYXNzd29yZFVwcGVyQ2FzZSA9IEludGVnZXIucGFyc2VJbnQoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyc2VyLmdldEF0dHJpYnV0ZVZhbHVlKG51bGwsICJ1cHBlcmNhc2UiKSk7CisgICAgICAgICAgICAgICAgICAgIG1BY3RpdmVQYXNzd29yZExvd2VyQ2FzZSA9IEludGVnZXIucGFyc2VJbnQoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyc2VyLmdldEF0dHJpYnV0ZVZhbHVlKG51bGwsICJsb3dlcmNhc2UiKSk7CisgICAgICAgICAgICAgICAgICAgIG1BY3RpdmVQYXNzd29yZExldHRlcnMgPSBJbnRlZ2VyLnBhcnNlSW50KAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcnNlci5nZXRBdHRyaWJ1dGVWYWx1ZShudWxsLCAibGV0dGVycyIpKTsKKyAgICAgICAgICAgICAgICAgICAgbUFjdGl2ZVBhc3N3b3JkTnVtZXJpYyA9IEludGVnZXIucGFyc2VJbnQoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyc2VyLmdldEF0dHJpYnV0ZVZhbHVlKG51bGwsICJudW1lcmljIikpOworICAgICAgICAgICAgICAgICAgICBtQWN0aXZlUGFzc3dvcmRTeW1ib2xzID0gSW50ZWdlci5wYXJzZUludCgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJzZXIuZ2V0QXR0cmlidXRlVmFsdWUobnVsbCwgInN5bWJvbHMiKSk7CisgICAgICAgICAgICAgICAgICAgIG1BY3RpdmVQYXNzd29yZE5vbkxldHRlciA9IEludGVnZXIucGFyc2VJbnQoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyc2VyLmdldEF0dHJpYnV0ZVZhbHVlKG51bGwsICJub25sZXR0ZXIiKSk7CiAgICAgICAgICAgICAgICAgICAgIFhtbFV0aWxzLnNraXBDdXJyZW50VGFnKHBhcnNlcik7CiAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgU2xvZy53KFRBRywgIlVua25vd24gdGFnOiAiICsgdGFnKTsKQEAgLTQ3NiwxMCArNjMwLDE2IEBACiAgICAgICAgICAgICAgICAgICAgICsgSW50ZWdlci50b0hleFN0cmluZyh1dGlscy5nZXRBY3RpdmVQYXNzd29yZFF1YWxpdHkoKSkpOwogICAgICAgICAgICAgbUFjdGl2ZVBhc3N3b3JkUXVhbGl0eSA9IERldmljZVBvbGljeU1hbmFnZXIuUEFTU1dPUkRfUVVBTElUWV9VTlNQRUNJRklFRDsKICAgICAgICAgICAgIG1BY3RpdmVQYXNzd29yZExlbmd0aCA9IDA7CisgICAgICAgICAgICBtQWN0aXZlUGFzc3dvcmRVcHBlckNhc2UgPSAwOworICAgICAgICAgICAgbUFjdGl2ZVBhc3N3b3JkTG93ZXJDYXNlID0gMDsKKyAgICAgICAgICAgIG1BY3RpdmVQYXNzd29yZExldHRlcnMgPSAwOworICAgICAgICAgICAgbUFjdGl2ZVBhc3N3b3JkTnVtZXJpYyA9IDA7CisgICAgICAgICAgICBtQWN0aXZlUGFzc3dvcmRTeW1ib2xzID0gMDsKKyAgICAgICAgICAgIG1BY3RpdmVQYXNzd29yZE5vbkxldHRlciA9IDA7CiAgICAgICAgIH0KLSAgICAgICAgCisKICAgICAgICAgdmFsaWRhdGVQYXNzd29yZE93bmVyTG9ja2VkKCk7Ci0gICAgICAgIAorCiAgICAgICAgIGxvbmcgdGltZU1zID0gZ2V0TWF4aW11bVRpbWVUb0xvY2sobnVsbCk7CiAgICAgICAgIGlmICh0aW1lTXMgPD0gMCkgewogICAgICAgICAgICAgdGltZU1zID0gSW50ZWdlci5NQVhfVkFMVUU7CkBAIC00OTgsMTIgKzY1OCwxMyBAQAogICAgICAgICAgICAgY2FzZSBEZXZpY2VQb2xpY3lNYW5hZ2VyLlBBU1NXT1JEX1FVQUxJVFlfTlVNRVJJQzoKICAgICAgICAgICAgIGNhc2UgRGV2aWNlUG9saWN5TWFuYWdlci5QQVNTV09SRF9RVUFMSVRZX0FMUEhBQkVUSUM6CiAgICAgICAgICAgICBjYXNlIERldmljZVBvbGljeU1hbmFnZXIuUEFTU1dPUkRfUVVBTElUWV9BTFBIQU5VTUVSSUM6CisgICAgICAgICAgICBjYXNlIERldmljZVBvbGljeU1hbmFnZXIuUEFTU1dPUkRfUVVBTElUWV9DT01QTEVYOgogICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgfQogICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCJJbnZhbGlkIHF1YWxpdHkgY29uc3RhbnQ6IDB4IgogICAgICAgICAgICAgICAgICsgSW50ZWdlci50b0hleFN0cmluZyhxdWFsaXR5KSk7CiAgICAgfQotICAgIAorCiAgICAgdm9pZCB2YWxpZGF0ZVBhc3N3b3JkT3duZXJMb2NrZWQoKSB7CiAgICAgICAgIGlmIChtUGFzc3dvcmRPd25lciA+PSAwKSB7CiAgICAgICAgICAgICBib29sZWFuIGhhdmVPd25lciA9IGZhbHNlOwpAQCAtNTIwLDE3ICs2ODEsMTcgQEAKICAgICAgICAgICAgIH0KICAgICAgICAgfQogICAgIH0KLSAgICAKKwogICAgIHB1YmxpYyB2b2lkIHN5c3RlbVJlYWR5KCkgewogICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKICAgICAgICAgICAgIGxvYWRTZXR0aW5nc0xvY2tlZCgpOwogICAgICAgICB9CiAgICAgfQotICAgIAorCiAgICAgcHVibGljIHZvaWQgc2V0QWN0aXZlQWRtaW4oQ29tcG9uZW50TmFtZSBhZG1pblJlY2VpdmVyKSB7CiAgICAgICAgIG1Db250ZXh0LmVuZm9yY2VDYWxsaW5nT3JTZWxmUGVybWlzc2lvbigKICAgICAgICAgICAgICAgICBhbmRyb2lkLk1hbmlmZXN0LnBlcm1pc3Npb24uQklORF9ERVZJQ0VfQURNSU4sIG51bGwpOwotICAgICAgICAKKwogICAgICAgICBEZXZpY2VBZG1pbkluZm8gaW5mbyA9IGZpbmRBZG1pbihhZG1pblJlY2VpdmVyKTsKICAgICAgICAgaWYgKGluZm8gPT0gbnVsbCkgewogICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigiQmFkIGFkbWluOiAiICsgYWRtaW5SZWNlaXZlcik7CkBAIC01NTIsMTMgKzcxMywxMyBAQAogICAgICAgICAgICAgfQogICAgICAgICB9CiAgICAgfQotICAgIAorCiAgICAgcHVibGljIGJvb2xlYW4gaXNBZG1pbkFjdGl2ZShDb21wb25lbnROYW1lIGFkbWluUmVjZWl2ZXIpIHsKICAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CiAgICAgICAgICAgICByZXR1cm4gZ2V0QWN0aXZlQWRtaW5VbmNoZWNrZWRMb2NrZWQoYWRtaW5SZWNlaXZlcikgIT0gbnVsbDsKICAgICAgICAgfQogICAgIH0KLSAgICAKKwogICAgIHB1YmxpYyBMaXN0PENvbXBvbmVudE5hbWU+IGdldEFjdGl2ZUFkbWlucygpIHsKICAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CiAgICAgICAgICAgICBmaW5hbCBpbnQgTiA9IG1BZG1pbkxpc3Quc2l6ZSgpOwpAQCAtNTcyLDcgKzczMyw3IEBACiAgICAgICAgICAgICByZXR1cm4gcmVzOwogICAgICAgICB9CiAgICAgfQotICAgIAorCiAgICAgcHVibGljIGJvb2xlYW4gcGFja2FnZUhhc0FjdGl2ZUFkbWlucyhTdHJpbmcgcGFja2FnZU5hbWUpIHsKICAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CiAgICAgICAgICAgICBmaW5hbCBpbnQgTiA9IG1BZG1pbkxpc3Quc2l6ZSgpOwpAQCAtNTg0LDcgKzc0NSw3IEBACiAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgIH0KICAgICB9Ci0gICAgCisKICAgICBwdWJsaWMgdm9pZCByZW1vdmVBY3RpdmVBZG1pbihDb21wb25lbnROYW1lIGFkbWluUmVjZWl2ZXIpIHsKICAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CiAgICAgICAgICAgICBBY3RpdmVBZG1pbiBhZG1pbiA9IGdldEFjdGl2ZUFkbWluVW5jaGVja2VkTG9ja2VkKGFkbWluUmVjZWl2ZXIpOwpAQCAtNjAzLDEwICs3NjQsMTAgQEAKICAgICAgICAgICAgIH0KICAgICAgICAgfQogICAgIH0KLSAgICAKKwogICAgIHB1YmxpYyB2b2lkIHNldFBhc3N3b3JkUXVhbGl0eShDb21wb25lbnROYW1lIHdobywgaW50IHF1YWxpdHkpIHsKICAgICAgICAgdmFsaWRhdGVRdWFsaXR5Q29uc3RhbnQocXVhbGl0eSk7Ci0gICAgICAgIAorCiAgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgewogICAgICAgICAgICAgaWYgKHdobyA9PSBudWxsKSB7CiAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IE51bGxQb2ludGVyRXhjZXB0aW9uKCJDb21wb25lbnROYW1lIGlzIG51bGwiKTsKQEAgLTYxOSwxNiArNzgwLDE2IEBACiAgICAgICAgICAgICB9CiAgICAgICAgIH0KICAgICB9Ci0gICAgCisKICAgICBwdWJsaWMgaW50IGdldFBhc3N3b3JkUXVhbGl0eShDb21wb25lbnROYW1lIHdobykgewogICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKICAgICAgICAgICAgIGludCBtb2RlID0gRGV2aWNlUG9saWN5TWFuYWdlci5QQVNTV09SRF9RVUFMSVRZX1VOU1BFQ0lGSUVEOwotICAgICAgICAgICAgCisKICAgICAgICAgICAgIGlmICh3aG8gIT0gbnVsbCkgewogICAgICAgICAgICAgICAgIEFjdGl2ZUFkbWluIGFkbWluID0gZ2V0QWN0aXZlQWRtaW5VbmNoZWNrZWRMb2NrZWQod2hvKTsKICAgICAgICAgICAgICAgICByZXR1cm4gYWRtaW4gIT0gbnVsbCA/IGFkbWluLnBhc3N3b3JkUXVhbGl0eSA6IG1vZGU7CiAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAKKwogICAgICAgICAgICAgZmluYWwgaW50IE4gPSBtQWRtaW5MaXN0LnNpemUoKTsKICAgICAgICAgICAgIGZvciAgKGludCBpPTA7IGk8TjsgaSsrKSB7CiAgICAgICAgICAgICAgICAgQWN0aXZlQWRtaW4gYWRtaW4gPSBtQWRtaW5MaXN0LmdldChpKTsKQEAgLTYzOSw3ICs4MDAsNyBAQAogICAgICAgICAgICAgcmV0dXJuIG1vZGU7CiAgICAgICAgIH0KICAgICB9Ci0gICAgCisKICAgICBwdWJsaWMgdm9pZCBzZXRQYXNzd29yZE1pbmltdW1MZW5ndGgoQ29tcG9uZW50TmFtZSB3aG8sIGludCBsZW5ndGgpIHsKICAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CiAgICAgICAgICAgICBpZiAod2hvID09IG51bGwpIHsKQEAgLTY1MywxNiArODE0LDE2IEBACiAgICAgICAgICAgICB9CiAgICAgICAgIH0KICAgICB9Ci0gICAgCisKICAgICBwdWJsaWMgaW50IGdldFBhc3N3b3JkTWluaW11bUxlbmd0aChDb21wb25lbnROYW1lIHdobykgewogICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKICAgICAgICAgICAgIGludCBsZW5ndGggPSAwOwotICAgICAgICAgICAgCisKICAgICAgICAgICAgIGlmICh3aG8gIT0gbnVsbCkgewogICAgICAgICAgICAgICAgIEFjdGl2ZUFkbWluIGFkbWluID0gZ2V0QWN0aXZlQWRtaW5VbmNoZWNrZWRMb2NrZWQod2hvKTsKICAgICAgICAgICAgICAgICByZXR1cm4gYWRtaW4gIT0gbnVsbCA/IGFkbWluLm1pbmltdW1QYXNzd29yZExlbmd0aCA6IGxlbmd0aDsKICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIAorCiAgICAgICAgICAgICBmaW5hbCBpbnQgTiA9IG1BZG1pbkxpc3Quc2l6ZSgpOwogICAgICAgICAgICAgZm9yICAoaW50IGk9MDsgaTxOOyBpKyspIHsKICAgICAgICAgICAgICAgICBBY3RpdmVBZG1pbiBhZG1pbiA9IG1BZG1pbkxpc3QuZ2V0KGkpOwpAQCAtNjczLDE4ICs4MzQsMjY3IEBACiAgICAgICAgICAgICByZXR1cm4gbGVuZ3RoOwogICAgICAgICB9CiAgICAgfQotICAgIAorCisgICAgcHVibGljIHZvaWQgc2V0UGFzc3dvcmRIaXN0b3J5TGVuZ3RoKENvbXBvbmVudE5hbWUgd2hvLCBpbnQgbGVuZ3RoKSB7CisgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgeworICAgICAgICAgICAgaWYgKHdobyA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IE51bGxQb2ludGVyRXhjZXB0aW9uKCJDb21wb25lbnROYW1lIGlzIG51bGwiKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIEFjdGl2ZUFkbWluIGFwID0gZ2V0QWN0aXZlQWRtaW5Gb3JDYWxsZXJMb2NrZWQod2hvLAorICAgICAgICAgICAgICAgICAgICBEZXZpY2VBZG1pbkluZm8uVVNFU19QT0xJQ1lfTElNSVRfUEFTU1dPUkQpOworICAgICAgICAgICAgaWYgKGFwLnBhc3N3b3JkSGlzdG9yeUxlbmd0aCAhPSBsZW5ndGgpIHsKKyAgICAgICAgICAgICAgICBhcC5wYXNzd29yZEhpc3RvcnlMZW5ndGggPSBsZW5ndGg7CisgICAgICAgICAgICAgICAgc2F2ZVNldHRpbmdzTG9ja2VkKCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgaW50IGdldFBhc3N3b3JkSGlzdG9yeUxlbmd0aChDb21wb25lbnROYW1lIHdobykgeworICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKKyAgICAgICAgICAgIGludCBsZW5ndGggPSAwOworCisgICAgICAgICAgICBpZiAod2hvICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBBY3RpdmVBZG1pbiBhZG1pbiA9IGdldEFjdGl2ZUFkbWluVW5jaGVja2VkTG9ja2VkKHdobyk7CisgICAgICAgICAgICAgICAgcmV0dXJuIGFkbWluICE9IG51bGwgPyBhZG1pbi5wYXNzd29yZEhpc3RvcnlMZW5ndGggOiBsZW5ndGg7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGZpbmFsIGludCBOID0gbUFkbWluTGlzdC5zaXplKCk7CisgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IE47IGkrKykgeworICAgICAgICAgICAgICAgIEFjdGl2ZUFkbWluIGFkbWluID0gbUFkbWluTGlzdC5nZXQoaSk7CisgICAgICAgICAgICAgICAgaWYgKGxlbmd0aCA8IGFkbWluLnBhc3N3b3JkSGlzdG9yeUxlbmd0aCkgeworICAgICAgICAgICAgICAgICAgICBsZW5ndGggPSBhZG1pbi5wYXNzd29yZEhpc3RvcnlMZW5ndGg7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuIGxlbmd0aDsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHNldFBhc3N3b3JkTWluaW11bVVwcGVyQ2FzZShDb21wb25lbnROYW1lIHdobywgaW50IGxlbmd0aCkgeworICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKKyAgICAgICAgICAgIGlmICh3aG8gPT0gbnVsbCkgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBOdWxsUG9pbnRlckV4Y2VwdGlvbigiQ29tcG9uZW50TmFtZSBpcyBudWxsIik7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBBY3RpdmVBZG1pbiBhcCA9IGdldEFjdGl2ZUFkbWluRm9yQ2FsbGVyTG9ja2VkKHdobywKKyAgICAgICAgICAgICAgICAgICAgRGV2aWNlQWRtaW5JbmZvLlVTRVNfUE9MSUNZX0xJTUlUX1BBU1NXT1JEKTsKKyAgICAgICAgICAgIGlmIChhcC5taW5pbXVtUGFzc3dvcmRVcHBlckNhc2UgIT0gbGVuZ3RoKSB7CisgICAgICAgICAgICAgICAgYXAubWluaW11bVBhc3N3b3JkVXBwZXJDYXNlID0gbGVuZ3RoOworICAgICAgICAgICAgICAgIHNhdmVTZXR0aW5nc0xvY2tlZCgpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIGludCBnZXRQYXNzd29yZE1pbmltdW1VcHBlckNhc2UoQ29tcG9uZW50TmFtZSB3aG8pIHsKKyAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CisgICAgICAgICAgICBpbnQgbGVuZ3RoID0gMDsKKworICAgICAgICAgICAgaWYgKHdobyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgQWN0aXZlQWRtaW4gYWRtaW4gPSBnZXRBY3RpdmVBZG1pblVuY2hlY2tlZExvY2tlZCh3aG8pOworICAgICAgICAgICAgICAgIHJldHVybiBhZG1pbiAhPSBudWxsID8gYWRtaW4ubWluaW11bVBhc3N3b3JkVXBwZXJDYXNlIDogbGVuZ3RoOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBmaW5hbCBpbnQgTiA9IG1BZG1pbkxpc3Quc2l6ZSgpOworICAgICAgICAgICAgZm9yIChpbnQgaT0wOyBpPE47IGkrKykgeworICAgICAgICAgICAgICAgIEFjdGl2ZUFkbWluIGFkbWluID0gbUFkbWluTGlzdC5nZXQoaSk7CisgICAgICAgICAgICAgICAgaWYgKGxlbmd0aCA8IGFkbWluLm1pbmltdW1QYXNzd29yZFVwcGVyQ2FzZSkgeworICAgICAgICAgICAgICAgICAgICBsZW5ndGggPSBhZG1pbi5taW5pbXVtUGFzc3dvcmRVcHBlckNhc2U7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuIGxlbmd0aDsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHNldFBhc3N3b3JkTWluaW11bUxvd2VyQ2FzZShDb21wb25lbnROYW1lIHdobywgaW50IGxlbmd0aCkgeworICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKKyAgICAgICAgICAgIGlmICh3aG8gPT0gbnVsbCkgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBOdWxsUG9pbnRlckV4Y2VwdGlvbigiQ29tcG9uZW50TmFtZSBpcyBudWxsIik7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBBY3RpdmVBZG1pbiBhcCA9IGdldEFjdGl2ZUFkbWluRm9yQ2FsbGVyTG9ja2VkKHdobywKKyAgICAgICAgICAgICAgICAgICAgRGV2aWNlQWRtaW5JbmZvLlVTRVNfUE9MSUNZX0xJTUlUX1BBU1NXT1JEKTsKKyAgICAgICAgICAgIGlmIChhcC5taW5pbXVtUGFzc3dvcmRMb3dlckNhc2UgIT0gbGVuZ3RoKSB7CisgICAgICAgICAgICAgICAgYXAubWluaW11bVBhc3N3b3JkTG93ZXJDYXNlID0gbGVuZ3RoOworICAgICAgICAgICAgICAgIHNhdmVTZXR0aW5nc0xvY2tlZCgpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIGludCBnZXRQYXNzd29yZE1pbmltdW1Mb3dlckNhc2UoQ29tcG9uZW50TmFtZSB3aG8pIHsKKyAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CisgICAgICAgICAgICBpbnQgbGVuZ3RoID0gMDsKKworICAgICAgICAgICAgaWYgKHdobyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgQWN0aXZlQWRtaW4gYWRtaW4gPSBnZXRBY3RpdmVBZG1pblVuY2hlY2tlZExvY2tlZCh3aG8pOworICAgICAgICAgICAgICAgIHJldHVybiBhZG1pbiAhPSBudWxsID8gYWRtaW4ubWluaW11bVBhc3N3b3JkTG93ZXJDYXNlIDogbGVuZ3RoOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBmaW5hbCBpbnQgTiA9IG1BZG1pbkxpc3Quc2l6ZSgpOworICAgICAgICAgICAgZm9yIChpbnQgaT0wOyBpPE47IGkrKykgeworICAgICAgICAgICAgICAgIEFjdGl2ZUFkbWluIGFkbWluID0gbUFkbWluTGlzdC5nZXQoaSk7CisgICAgICAgICAgICAgICAgaWYgKGxlbmd0aCA8IGFkbWluLm1pbmltdW1QYXNzd29yZExvd2VyQ2FzZSkgeworICAgICAgICAgICAgICAgICAgICBsZW5ndGggPSBhZG1pbi5taW5pbXVtUGFzc3dvcmRMb3dlckNhc2U7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuIGxlbmd0aDsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHNldFBhc3N3b3JkTWluaW11bUxldHRlcnMoQ29tcG9uZW50TmFtZSB3aG8sIGludCBsZW5ndGgpIHsKKyAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CisgICAgICAgICAgICBpZiAod2hvID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgTnVsbFBvaW50ZXJFeGNlcHRpb24oIkNvbXBvbmVudE5hbWUgaXMgbnVsbCIpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgQWN0aXZlQWRtaW4gYXAgPSBnZXRBY3RpdmVBZG1pbkZvckNhbGxlckxvY2tlZCh3aG8sCisgICAgICAgICAgICAgICAgICAgIERldmljZUFkbWluSW5mby5VU0VTX1BPTElDWV9MSU1JVF9QQVNTV09SRCk7CisgICAgICAgICAgICBpZiAoYXAubWluaW11bVBhc3N3b3JkTGV0dGVycyAhPSBsZW5ndGgpIHsKKyAgICAgICAgICAgICAgICBhcC5taW5pbXVtUGFzc3dvcmRMZXR0ZXJzID0gbGVuZ3RoOworICAgICAgICAgICAgICAgIHNhdmVTZXR0aW5nc0xvY2tlZCgpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIGludCBnZXRQYXNzd29yZE1pbmltdW1MZXR0ZXJzKENvbXBvbmVudE5hbWUgd2hvKSB7CisgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgeworICAgICAgICAgICAgaW50IGxlbmd0aCA9IDA7CisKKyAgICAgICAgICAgIGlmICh3aG8gIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIEFjdGl2ZUFkbWluIGFkbWluID0gZ2V0QWN0aXZlQWRtaW5VbmNoZWNrZWRMb2NrZWQod2hvKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gYWRtaW4gIT0gbnVsbCA/IGFkbWluLm1pbmltdW1QYXNzd29yZExldHRlcnMgOiBsZW5ndGg7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGZpbmFsIGludCBOID0gbUFkbWluTGlzdC5zaXplKCk7CisgICAgICAgICAgICBmb3IgKGludCBpPTA7IGk8TjsgaSsrKSB7CisgICAgICAgICAgICAgICAgQWN0aXZlQWRtaW4gYWRtaW4gPSBtQWRtaW5MaXN0LmdldChpKTsKKyAgICAgICAgICAgICAgICBpZiAobGVuZ3RoIDwgYWRtaW4ubWluaW11bVBhc3N3b3JkTGV0dGVycykgeworICAgICAgICAgICAgICAgICAgICBsZW5ndGggPSBhZG1pbi5taW5pbXVtUGFzc3dvcmRMZXR0ZXJzOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHJldHVybiBsZW5ndGg7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBzZXRQYXNzd29yZE1pbmltdW1OdW1lcmljKENvbXBvbmVudE5hbWUgd2hvLCBpbnQgbGVuZ3RoKSB7CisgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgeworICAgICAgICAgICAgaWYgKHdobyA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IE51bGxQb2ludGVyRXhjZXB0aW9uKCJDb21wb25lbnROYW1lIGlzIG51bGwiKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIEFjdGl2ZUFkbWluIGFwID0gZ2V0QWN0aXZlQWRtaW5Gb3JDYWxsZXJMb2NrZWQod2hvLAorICAgICAgICAgICAgICAgICAgICBEZXZpY2VBZG1pbkluZm8uVVNFU19QT0xJQ1lfTElNSVRfUEFTU1dPUkQpOworICAgICAgICAgICAgaWYgKGFwLm1pbmltdW1QYXNzd29yZE51bWVyaWMgIT0gbGVuZ3RoKSB7CisgICAgICAgICAgICAgICAgYXAubWluaW11bVBhc3N3b3JkTnVtZXJpYyA9IGxlbmd0aDsKKyAgICAgICAgICAgICAgICBzYXZlU2V0dGluZ3NMb2NrZWQoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyBpbnQgZ2V0UGFzc3dvcmRNaW5pbXVtTnVtZXJpYyhDb21wb25lbnROYW1lIHdobykgeworICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKKyAgICAgICAgICAgIGludCBsZW5ndGggPSAwOworCisgICAgICAgICAgICBpZiAod2hvICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBBY3RpdmVBZG1pbiBhZG1pbiA9IGdldEFjdGl2ZUFkbWluVW5jaGVja2VkTG9ja2VkKHdobyk7CisgICAgICAgICAgICAgICAgcmV0dXJuIGFkbWluICE9IG51bGwgPyBhZG1pbi5taW5pbXVtUGFzc3dvcmROdW1lcmljIDogbGVuZ3RoOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBmaW5hbCBpbnQgTiA9IG1BZG1pbkxpc3Quc2l6ZSgpOworICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBOOyBpKyspIHsKKyAgICAgICAgICAgICAgICBBY3RpdmVBZG1pbiBhZG1pbiA9IG1BZG1pbkxpc3QuZ2V0KGkpOworICAgICAgICAgICAgICAgIGlmIChsZW5ndGggPCBhZG1pbi5taW5pbXVtUGFzc3dvcmROdW1lcmljKSB7CisgICAgICAgICAgICAgICAgICAgIGxlbmd0aCA9IGFkbWluLm1pbmltdW1QYXNzd29yZE51bWVyaWM7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuIGxlbmd0aDsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHNldFBhc3N3b3JkTWluaW11bVN5bWJvbHMoQ29tcG9uZW50TmFtZSB3aG8sIGludCBsZW5ndGgpIHsKKyAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CisgICAgICAgICAgICBpZiAod2hvID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgTnVsbFBvaW50ZXJFeGNlcHRpb24oIkNvbXBvbmVudE5hbWUgaXMgbnVsbCIpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgQWN0aXZlQWRtaW4gYXAgPSBnZXRBY3RpdmVBZG1pbkZvckNhbGxlckxvY2tlZCh3aG8sCisgICAgICAgICAgICAgICAgICAgIERldmljZUFkbWluSW5mby5VU0VTX1BPTElDWV9MSU1JVF9QQVNTV09SRCk7CisgICAgICAgICAgICBpZiAoYXAubWluaW11bVBhc3N3b3JkU3ltYm9scyAhPSBsZW5ndGgpIHsKKyAgICAgICAgICAgICAgICBhcC5taW5pbXVtUGFzc3dvcmRTeW1ib2xzID0gbGVuZ3RoOworICAgICAgICAgICAgICAgIHNhdmVTZXR0aW5nc0xvY2tlZCgpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIGludCBnZXRQYXNzd29yZE1pbmltdW1TeW1ib2xzKENvbXBvbmVudE5hbWUgd2hvKSB7CisgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgeworICAgICAgICAgICAgaW50IGxlbmd0aCA9IDA7CisKKyAgICAgICAgICAgIGlmICh3aG8gIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIEFjdGl2ZUFkbWluIGFkbWluID0gZ2V0QWN0aXZlQWRtaW5VbmNoZWNrZWRMb2NrZWQod2hvKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gYWRtaW4gIT0gbnVsbCA/IGFkbWluLm1pbmltdW1QYXNzd29yZFN5bWJvbHMgOiBsZW5ndGg7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGZpbmFsIGludCBOID0gbUFkbWluTGlzdC5zaXplKCk7CisgICAgICAgICAgICBmb3IgIChpbnQgaT0wOyBpPE47IGkrKykgeworICAgICAgICAgICAgICAgIEFjdGl2ZUFkbWluIGFkbWluID0gbUFkbWluTGlzdC5nZXQoaSk7CisgICAgICAgICAgICAgICAgaWYgKGxlbmd0aCA8IGFkbWluLm1pbmltdW1QYXNzd29yZFN5bWJvbHMpIHsKKyAgICAgICAgICAgICAgICAgICAgbGVuZ3RoID0gYWRtaW4ubWluaW11bVBhc3N3b3JkU3ltYm9sczsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gbGVuZ3RoOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHZvaWQgc2V0UGFzc3dvcmRNaW5pbXVtTm9uTGV0dGVyKENvbXBvbmVudE5hbWUgd2hvLCBpbnQgbGVuZ3RoKSB7CisgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgeworICAgICAgICAgICAgaWYgKHdobyA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IE51bGxQb2ludGVyRXhjZXB0aW9uKCJDb21wb25lbnROYW1lIGlzIG51bGwiKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIEFjdGl2ZUFkbWluIGFwID0gZ2V0QWN0aXZlQWRtaW5Gb3JDYWxsZXJMb2NrZWQod2hvLAorICAgICAgICAgICAgICAgICAgICBEZXZpY2VBZG1pbkluZm8uVVNFU19QT0xJQ1lfTElNSVRfUEFTU1dPUkQpOworICAgICAgICAgICAgaWYgKGFwLm1pbmltdW1QYXNzd29yZE5vbkxldHRlciAhPSBsZW5ndGgpIHsKKyAgICAgICAgICAgICAgICBhcC5taW5pbXVtUGFzc3dvcmROb25MZXR0ZXIgPSBsZW5ndGg7CisgICAgICAgICAgICAgICAgc2F2ZVNldHRpbmdzTG9ja2VkKCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgaW50IGdldFBhc3N3b3JkTWluaW11bU5vbkxldHRlcihDb21wb25lbnROYW1lIHdobykgeworICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKKyAgICAgICAgICAgIGludCBsZW5ndGggPSAwOworCisgICAgICAgICAgICBpZiAod2hvICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBBY3RpdmVBZG1pbiBhZG1pbiA9IGdldEFjdGl2ZUFkbWluVW5jaGVja2VkTG9ja2VkKHdobyk7CisgICAgICAgICAgICAgICAgcmV0dXJuIGFkbWluICE9IG51bGwgPyBhZG1pbi5taW5pbXVtUGFzc3dvcmROb25MZXR0ZXIgOiBsZW5ndGg7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGZpbmFsIGludCBOID0gbUFkbWluTGlzdC5zaXplKCk7CisgICAgICAgICAgICBmb3IgKGludCBpPTA7IGk8TjsgaSsrKSB7CisgICAgICAgICAgICAgICAgQWN0aXZlQWRtaW4gYWRtaW4gPSBtQWRtaW5MaXN0LmdldChpKTsKKyAgICAgICAgICAgICAgICBpZiAobGVuZ3RoIDwgYWRtaW4ubWluaW11bVBhc3N3b3JkTm9uTGV0dGVyKSB7CisgICAgICAgICAgICAgICAgICAgIGxlbmd0aCA9IGFkbWluLm1pbmltdW1QYXNzd29yZE5vbkxldHRlcjsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gbGVuZ3RoOworICAgICAgICB9CisgICAgfQorCiAgICAgcHVibGljIGJvb2xlYW4gaXNBY3RpdmVQYXNzd29yZFN1ZmZpY2llbnQoKSB7CiAgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgewogICAgICAgICAgICAgLy8gVGhpcyBBUEkgY2FuIG9ubHkgYmUgY2FsbGVkIGJ5IGFuIGFjdGl2ZSBkZXZpY2UgYWRtaW4sCiAgICAgICAgICAgICAvLyBzbyB0cnkgdG8gcmV0cmlldmUgaXQgdG8gY2hlY2sgdGhhdCB0aGUgY2FsbGVyIGlzIG9uZS4KICAgICAgICAgICAgIGdldEFjdGl2ZUFkbWluRm9yQ2FsbGVyTG9ja2VkKG51bGwsCiAgICAgICAgICAgICAgICAgICAgIERldmljZUFkbWluSW5mby5VU0VTX1BPTElDWV9MSU1JVF9QQVNTV09SRCk7Ci0gICAgICAgICAgICByZXR1cm4gbUFjdGl2ZVBhc3N3b3JkUXVhbGl0eSA+PSBnZXRQYXNzd29yZFF1YWxpdHkobnVsbCkKLSAgICAgICAgICAgICAgICAgICAgJiYgbUFjdGl2ZVBhc3N3b3JkTGVuZ3RoID49IGdldFBhc3N3b3JkTWluaW11bUxlbmd0aChudWxsKTsKKyAgICAgICAgICAgIGlmIChtQWN0aXZlUGFzc3dvcmRRdWFsaXR5IDwgZ2V0UGFzc3dvcmRRdWFsaXR5KG51bGwpCisgICAgICAgICAgICAgICAgICAgIHx8IG1BY3RpdmVQYXNzd29yZExlbmd0aCA8IGdldFBhc3N3b3JkTWluaW11bUxlbmd0aChudWxsKSkgeworICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmKG1BY3RpdmVQYXNzd29yZFF1YWxpdHkgIT0gRGV2aWNlUG9saWN5TWFuYWdlci5QQVNTV09SRF9RVUFMSVRZX0NPTVBMRVgpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHJldHVybiBtQWN0aXZlUGFzc3dvcmRVcHBlckNhc2UgPj0gZ2V0UGFzc3dvcmRNaW5pbXVtVXBwZXJDYXNlKG51bGwpCisgICAgICAgICAgICAgICAgICAgICYmIG1BY3RpdmVQYXNzd29yZExvd2VyQ2FzZSA+PSBnZXRQYXNzd29yZE1pbmltdW1Mb3dlckNhc2UobnVsbCkKKyAgICAgICAgICAgICAgICAgICAgJiYgbUFjdGl2ZVBhc3N3b3JkTGV0dGVycyA+PSBnZXRQYXNzd29yZE1pbmltdW1MZXR0ZXJzKG51bGwpCisgICAgICAgICAgICAgICAgICAgICYmIG1BY3RpdmVQYXNzd29yZE51bWVyaWMgPj0gZ2V0UGFzc3dvcmRNaW5pbXVtTnVtZXJpYyhudWxsKQorICAgICAgICAgICAgICAgICAgICAmJiBtQWN0aXZlUGFzc3dvcmRTeW1ib2xzID49IGdldFBhc3N3b3JkTWluaW11bVN5bWJvbHMobnVsbCkKKyAgICAgICAgICAgICAgICAgICAgJiYgbUFjdGl2ZVBhc3N3b3JkTm9uTGV0dGVyID49IGdldFBhc3N3b3JkTWluaW11bU5vbkxldHRlcihudWxsKTsKICAgICAgICAgfQogICAgIH0KLSAgICAKKwogICAgIHB1YmxpYyBpbnQgZ2V0Q3VycmVudEZhaWxlZFBhc3N3b3JkQXR0ZW1wdHMoKSB7CiAgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgewogICAgICAgICAgICAgLy8gVGhpcyBBUEkgY2FuIG9ubHkgYmUgY2FsbGVkIGJ5IGFuIGFjdGl2ZSBkZXZpY2UgYWRtaW4sCkBAIC02OTQsNyArMTEwNCw3IEBACiAgICAgICAgICAgICByZXR1cm4gbUZhaWxlZFBhc3N3b3JkQXR0ZW1wdHM7CiAgICAgICAgIH0KICAgICB9Ci0gICAgCisKICAgICBwdWJsaWMgdm9pZCBzZXRNYXhpbXVtRmFpbGVkUGFzc3dvcmRzRm9yV2lwZShDb21wb25lbnROYW1lIHdobywgaW50IG51bSkgewogICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKICAgICAgICAgICAgIC8vIFRoaXMgQVBJIGNhbiBvbmx5IGJlIGNhbGxlZCBieSBhbiBhY3RpdmUgZGV2aWNlIGFkbWluLApAQCAtNzA5LDE2ICsxMTE5LDE2IEBACiAgICAgICAgICAgICB9CiAgICAgICAgIH0KICAgICB9Ci0gICAgCisKICAgICBwdWJsaWMgaW50IGdldE1heGltdW1GYWlsZWRQYXNzd29yZHNGb3JXaXBlKENvbXBvbmVudE5hbWUgd2hvKSB7CiAgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgewogICAgICAgICAgICAgaW50IGNvdW50ID0gMDsKLSAgICAgICAgICAgIAorCiAgICAgICAgICAgICBpZiAod2hvICE9IG51bGwpIHsKICAgICAgICAgICAgICAgICBBY3RpdmVBZG1pbiBhZG1pbiA9IGdldEFjdGl2ZUFkbWluVW5jaGVja2VkTG9ja2VkKHdobyk7CiAgICAgICAgICAgICAgICAgcmV0dXJuIGFkbWluICE9IG51bGwgPyBhZG1pbi5tYXhpbXVtRmFpbGVkUGFzc3dvcmRzRm9yV2lwZSA6IGNvdW50OwogICAgICAgICAgICAgfQotICAgICAgICAgICAgCisKICAgICAgICAgICAgIGZpbmFsIGludCBOID0gbUFkbWluTGlzdC5zaXplKCk7CiAgICAgICAgICAgICBmb3IgIChpbnQgaT0wOyBpPE47IGkrKykgewogICAgICAgICAgICAgICAgIEFjdGl2ZUFkbWluIGFkbWluID0gbUFkbWluTGlzdC5nZXQoaSk7CkBAIC03MzIsNyArMTE0Miw3IEBACiAgICAgICAgICAgICByZXR1cm4gY291bnQ7CiAgICAgICAgIH0KICAgICB9Ci0gICAgCisKICAgICBwdWJsaWMgYm9vbGVhbiByZXNldFBhc3N3b3JkKFN0cmluZyBwYXNzd29yZCwgaW50IGZsYWdzKSB7CiAgICAgICAgIGludCBxdWFsaXR5OwogICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKQEAgLTc0MywxNCArMTE1MywxNSBAQAogICAgICAgICAgICAgcXVhbGl0eSA9IGdldFBhc3N3b3JkUXVhbGl0eShudWxsKTsKICAgICAgICAgICAgIGlmIChxdWFsaXR5ICE9IERldmljZVBvbGljeU1hbmFnZXIuUEFTU1dPUkRfUVVBTElUWV9VTlNQRUNJRklFRCkgewogICAgICAgICAgICAgICAgIGludCByZWFsUXVhbGl0eSA9IExvY2tQYXR0ZXJuVXRpbHMuY29tcHV0ZVBhc3N3b3JkUXVhbGl0eShwYXNzd29yZCk7Ci0gICAgICAgICAgICAgICAgaWYgKHJlYWxRdWFsaXR5IDwgcXVhbGl0eSkgeworICAgICAgICAgICAgICAgIGlmIChyZWFsUXVhbGl0eSA8IHF1YWxpdHkKKyAgICAgICAgICAgICAgICAgICAgICAgICYmIHF1YWxpdHkgIT0gRGV2aWNlUG9saWN5TWFuYWdlci5QQVNTV09SRF9RVUFMSVRZX0NPTVBMRVgpIHsKICAgICAgICAgICAgICAgICAgICAgU2xvZy53KFRBRywgInJlc2V0UGFzc3dvcmQ6IHBhc3N3b3JkIHF1YWxpdHkgMHgiCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyBJbnRlZ2VyLnRvSGV4U3RyaW5nKHF1YWxpdHkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyAiIGRvZXMgbm90IG1lZXQgcmVxdWlyZWQgcXVhbGl0eSAweCIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIEludGVnZXIudG9IZXhTdHJpbmcocXVhbGl0eSkpOwogICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIHF1YWxpdHkgPSByZWFsUXVhbGl0eTsKKyAgICAgICAgICAgICAgICBxdWFsaXR5ID0gTWF0aC5tYXgocmVhbFF1YWxpdHksIHF1YWxpdHkpOwogICAgICAgICAgICAgfQogICAgICAgICAgICAgaW50IGxlbmd0aCA9IGdldFBhc3N3b3JkTWluaW11bUxlbmd0aChudWxsKTsKICAgICAgICAgICAgIGlmIChwYXNzd29yZC5sZW5ndGgoKSA8IGxlbmd0aCkgewpAQCAtNzU4LDE0ICsxMTY5LDg2IEBACiAgICAgICAgICAgICAgICAgICAgICAgICArICIgZG9lcyBub3QgbWVldCByZXF1aXJlZCBsZW5ndGggIiArIGxlbmd0aCk7CiAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKHF1YWxpdHkgPT0gRGV2aWNlUG9saWN5TWFuYWdlci5QQVNTV09SRF9RVUFMSVRZX0NPTVBMRVgpIHsKKyAgICAgICAgICAgICAgICBpbnQgbGV0dGVycyA9IDA7CisgICAgICAgICAgICAgICAgaW50IHVwcGVyY2FzZSA9IDA7CisgICAgICAgICAgICAgICAgaW50IGxvd2VyY2FzZSA9IDA7CisgICAgICAgICAgICAgICAgaW50IG51bWJlcnMgPSAwOworICAgICAgICAgICAgICAgIGludCBzeW1ib2xzID0gMDsKKyAgICAgICAgICAgICAgICBpbnQgbm9ubGV0dGVyID0gMDsKKyAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IHBhc3N3b3JkLmxlbmd0aCgpOyBpKyspIHsKKyAgICAgICAgICAgICAgICAgICAgY2hhciBjID0gcGFzc3dvcmQuY2hhckF0KGkpOworICAgICAgICAgICAgICAgICAgICBpZiAoYyA+PSAnQScgJiYgYyA8PSAnWicpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGxldHRlcnMrKzsKKyAgICAgICAgICAgICAgICAgICAgICAgIHVwcGVyY2FzZSsrOworICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGMgPj0gJ2EnICYmIGMgPD0gJ3onKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBsZXR0ZXJzKys7CisgICAgICAgICAgICAgICAgICAgICAgICBsb3dlcmNhc2UrKzsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChjID49ICcwJyAmJiBjIDw9ICc5JykgeworICAgICAgICAgICAgICAgICAgICAgICAgbnVtYmVycysrOworICAgICAgICAgICAgICAgICAgICAgICAgbm9ubGV0dGVyKys7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICBzeW1ib2xzKys7CisgICAgICAgICAgICAgICAgICAgICAgICBub25sZXR0ZXIrKzsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBpbnQgbmVlZGVkTGV0dGVycyA9IGdldFBhc3N3b3JkTWluaW11bUxldHRlcnMobnVsbCk7CisgICAgICAgICAgICAgICAgaWYobGV0dGVycyA8IG5lZWRlZExldHRlcnMpIHsKKyAgICAgICAgICAgICAgICAgICAgU2xvZy53KFRBRywgInJlc2V0UGFzc3dvcmQ6IG51bWJlciBvZiBsZXR0ZXJzICIgKyBsZXR0ZXJzCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyAiIGRvZXMgbm90IG1lZXQgcmVxdWlyZWQgbnVtYmVyIG9mIGxldHRlcnMgIiArIG5lZWRlZExldHRlcnMpOworICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGludCBuZWVkZWROdW1iZXJzID0gZ2V0UGFzc3dvcmRNaW5pbXVtTnVtZXJpYyhudWxsKTsKKyAgICAgICAgICAgICAgICBpZiAobnVtYmVycyA8IG5lZWRlZE51bWJlcnMpIHsKKyAgICAgICAgICAgICAgICAgICAgU2xvZworICAgICAgICAgICAgICAgICAgICAgICAgICAgIC53KFRBRywgInJlc2V0UGFzc3dvcmQ6IG51bWJlciBvZiBudW1lcmljYWwgZGlnaXRzICIgKyBudW1iZXJzCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArICIgZG9lcyBub3QgbWVldCByZXF1aXJlZCBudW1iZXIgb2YgbnVtZXJpY2FsIGRpZ2l0cyAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIG5lZWRlZE51bWJlcnMpOworICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGludCBuZWVkZWRMb3dlckNhc2UgPSBnZXRQYXNzd29yZE1pbmltdW1Mb3dlckNhc2UobnVsbCk7CisgICAgICAgICAgICAgICAgaWYgKGxvd2VyY2FzZSA8IG5lZWRlZExvd2VyQ2FzZSkgeworICAgICAgICAgICAgICAgICAgICBTbG9nLncoVEFHLCAicmVzZXRQYXNzd29yZDogbnVtYmVyIG9mIGxvd2VyY2FzZSBsZXR0ZXJzICIgKyBsb3dlcmNhc2UKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICArICIgZG9lcyBub3QgbWVldCByZXF1aXJlZCBudW1iZXIgb2YgbG93ZXJjYXNlIGxldHRlcnMgIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgbmVlZGVkTG93ZXJDYXNlKTsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBpbnQgbmVlZGVkVXBwZXJDYXNlID0gZ2V0UGFzc3dvcmRNaW5pbXVtVXBwZXJDYXNlKG51bGwpOworICAgICAgICAgICAgICAgIGlmICh1cHBlcmNhc2UgPCBuZWVkZWRVcHBlckNhc2UpIHsKKyAgICAgICAgICAgICAgICAgICAgU2xvZy53KFRBRywgInJlc2V0UGFzc3dvcmQ6IG51bWJlciBvZiB1cHBlcmNhc2UgbGV0dGVycyAiICsgdXBwZXJjYXNlCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyAiIGRvZXMgbm90IG1lZXQgcmVxdWlyZWQgbnVtYmVyIG9mIHVwcGVyY2FzZSBsZXR0ZXJzICIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICArIG5lZWRlZFVwcGVyQ2FzZSk7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaW50IG5lZWRlZFN5bWJvbHMgPSBnZXRQYXNzd29yZE1pbmltdW1TeW1ib2xzKG51bGwpOworICAgICAgICAgICAgICAgIGlmIChzeW1ib2xzIDwgbmVlZGVkU3ltYm9scykgeworICAgICAgICAgICAgICAgICAgICBTbG9nLncoVEFHLCAicmVzZXRQYXNzd29yZDogbnVtYmVyIG9mIHNwZWNpYWwgc3ltYm9scyAiICsgc3ltYm9scworICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgIiBkb2VzIG5vdCBtZWV0IHJlcXVpcmVkIG51bWJlciBvZiBzcGVjaWFsIHN5bWJvbHMgIiArIG5lZWRlZFN5bWJvbHMpOworICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGludCBuZWVkZWROb25MZXR0ZXIgPSBnZXRQYXNzd29yZE1pbmltdW1Ob25MZXR0ZXIobnVsbCk7CisgICAgICAgICAgICAgICAgaWYgKG5vbmxldHRlciA8IG5lZWRlZE5vbkxldHRlcikgeworICAgICAgICAgICAgICAgICAgICBTbG9nLncoVEFHLCAicmVzZXRQYXNzd29yZDogbnVtYmVyIG9mIG5vbi1sZXR0ZXIgY2hhcmFjdGVycyAiICsgbm9ubGV0dGVyCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyAiIGRvZXMgbm90IG1lZXQgcmVxdWlyZWQgbnVtYmVyIG9mIG5vbi1sZXR0ZXIgY2hhcmFjdGVycyAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyBuZWVkZWROb25MZXR0ZXIpOworICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorCisgICAgICAgICAgICBMb2NrUGF0dGVyblV0aWxzIHV0aWxzID0gbmV3IExvY2tQYXR0ZXJuVXRpbHMobUNvbnRleHQpOworICAgICAgICAgICAgaWYodXRpbHMuY2hlY2tQYXNzd29yZEhpc3RvcnkocGFzc3dvcmQpKSB7CisgICAgICAgICAgICAgICAgU2xvZy53KFRBRywgInJlc2V0UGFzc3dvcmQ6IHBhc3N3b3JkIGlzIHRoZSBzYW1lIGFzIG9uZSBvZiB0aGUgbGFzdCAiCisgICAgICAgICAgICAgICAgICAgICAgICArIGdldFBhc3N3b3JkSGlzdG9yeUxlbmd0aChudWxsKSArICIgcGFzc3dvcmRzIik7CisgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICAgICAgfQogICAgICAgICB9Ci0gICAgICAgIAorCiAgICAgICAgIGludCBjYWxsaW5nVWlkID0gQmluZGVyLmdldENhbGxpbmdVaWQoKTsKICAgICAgICAgaWYgKG1QYXNzd29yZE93bmVyID49IDAgJiYgbVBhc3N3b3JkT3duZXIgIT0gY2FsbGluZ1VpZCkgewogICAgICAgICAgICAgU2xvZy53KFRBRywgInJlc2V0UGFzc3dvcmQ6IGFscmVhZHkgc2V0IGJ5IGFub3RoZXIgdWlkIGFuZCBub3QgZW50ZXJlZCBieSB1c2VyIik7CiAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgIH0KLSAgICAgICAgCisKICAgICAgICAgLy8gRG9uJ3QgZG8gdGhpcyB3aXRoIHRoZSBsb2NrIGhlbGQsIGJlY2F1c2UgaXQgaXMgZ29pbmcgdG8gY2FsbAogICAgICAgICAvLyBiYWNrIGluIHRvIHRoZSBzZXJ2aWNlLgogICAgICAgICBsb25nIGlkZW50ID0gQmluZGVyLmNsZWFyQ2FsbGluZ0lkZW50aXR5KCk7CkBAIC03ODMsMTAgKzEyNjYsMTAgQEAKICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgIEJpbmRlci5yZXN0b3JlQ2FsbGluZ0lkZW50aXR5KGlkZW50KTsKICAgICAgICAgfQotICAgICAgICAKKwogICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICB9Ci0gICAgCisKICAgICBwdWJsaWMgdm9pZCBzZXRNYXhpbXVtVGltZVRvTG9jayhDb21wb25lbnROYW1lIHdobywgbG9uZyB0aW1lTXMpIHsKICAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CiAgICAgICAgICAgICBpZiAod2hvID09IG51bGwpIHsKQEAgLTc5NiwxNiArMTI3OSwxNiBAQAogICAgICAgICAgICAgICAgICAgICBEZXZpY2VBZG1pbkluZm8uVVNFU19QT0xJQ1lfRk9SQ0VfTE9DSyk7CiAgICAgICAgICAgICBpZiAoYXAubWF4aW11bVRpbWVUb1VubG9jayAhPSB0aW1lTXMpIHsKICAgICAgICAgICAgICAgICBhcC5tYXhpbXVtVGltZVRvVW5sb2NrID0gdGltZU1zOwotICAgICAgICAgICAgICAgIAorCiAgICAgICAgICAgICAgICAgbG9uZyBpZGVudCA9IEJpbmRlci5jbGVhckNhbGxpbmdJZGVudGl0eSgpOwogICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgIHNhdmVTZXR0aW5nc0xvY2tlZCgpOwotICAgICAgICAgICAgICAgICAgICAKKwogICAgICAgICAgICAgICAgICAgICB0aW1lTXMgPSBnZXRNYXhpbXVtVGltZVRvTG9jayhudWxsKTsKICAgICAgICAgICAgICAgICAgICAgaWYgKHRpbWVNcyA8PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICB0aW1lTXMgPSBJbnRlZ2VyLk1BWF9WQUxVRTsKICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAKKwogICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgZ2V0SVBvd2VyTWFuYWdlcigpLnNldE1heGltdW1TY3JlZW5PZmZUaW1lb3VudCgoaW50KXRpbWVNcyk7CiAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBlKSB7CkBAIC04MTcsMTYgKzEzMDAsMTYgQEAKICAgICAgICAgICAgIH0KICAgICAgICAgfQogICAgIH0KLSAgICAKKwogICAgIHB1YmxpYyBsb25nIGdldE1heGltdW1UaW1lVG9Mb2NrKENvbXBvbmVudE5hbWUgd2hvKSB7CiAgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgewogICAgICAgICAgICAgbG9uZyB0aW1lID0gMDsKLSAgICAgICAgICAgIAorCiAgICAgICAgICAgICBpZiAod2hvICE9IG51bGwpIHsKICAgICAgICAgICAgICAgICBBY3RpdmVBZG1pbiBhZG1pbiA9IGdldEFjdGl2ZUFkbWluVW5jaGVja2VkTG9ja2VkKHdobyk7CiAgICAgICAgICAgICAgICAgcmV0dXJuIGFkbWluICE9IG51bGwgPyBhZG1pbi5tYXhpbXVtVGltZVRvVW5sb2NrIDogdGltZTsKICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIAorCiAgICAgICAgICAgICBmaW5hbCBpbnQgTiA9IG1BZG1pbkxpc3Quc2l6ZSgpOwogICAgICAgICAgICAgZm9yICAoaW50IGk9MDsgaTxOOyBpKyspIHsKICAgICAgICAgICAgICAgICBBY3RpdmVBZG1pbiBhZG1pbiA9IG1BZG1pbkxpc3QuZ2V0KGkpOwpAQCAtODQwLDcgKzEzMjMsNyBAQAogICAgICAgICAgICAgcmV0dXJuIHRpbWU7CiAgICAgICAgIH0KICAgICB9Ci0gICAgCisKICAgICBwdWJsaWMgdm9pZCBsb2NrTm93KCkgewogICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKICAgICAgICAgICAgIC8vIFRoaXMgQVBJIGNhbiBvbmx5IGJlIGNhbGxlZCBieSBhbiBhY3RpdmUgZGV2aWNlIGFkbWluLApAQCAtODU3LDcgKzEzNDAsNyBAQAogICAgICAgICAgICAgfQogICAgICAgICB9CiAgICAgfQotICAgIAorCiAgICAgdm9pZCB3aXBlRGF0YUxvY2tlZChpbnQgZmxhZ3MpIHsKICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgIFJlY292ZXJ5U3lzdGVtLnJlYm9vdFdpcGVVc2VyRGF0YShtQ29udGV4dCk7CkBAIC04NjUsNyArMTM0OCw3IEBACiAgICAgICAgICAgICBTbG9nLncoVEFHLCAiRmFpbGVkIHJlcXVlc3RpbmcgZGF0YSB3aXBlIiwgZSk7CiAgICAgICAgIH0KICAgICB9Ci0gICAgCisKICAgICBwdWJsaWMgdm9pZCB3aXBlRGF0YShpbnQgZmxhZ3MpIHsKICAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CiAgICAgICAgICAgICAvLyBUaGlzIEFQSSBjYW4gb25seSBiZSBjYWxsZWQgYnkgYW4gYWN0aXZlIGRldmljZSBhZG1pbiwKQEAgLTg4MCwxMSArMTM2MywxMSBAQAogICAgICAgICAgICAgfQogICAgICAgICB9CiAgICAgfQotICAgIAorCiAgICAgcHVibGljIHZvaWQgZ2V0UmVtb3ZlV2FybmluZyhDb21wb25lbnROYW1lIGNvbXAsIGZpbmFsIFJlbW90ZUNhbGxiYWNrIHJlc3VsdCkgewogICAgICAgICBtQ29udGV4dC5lbmZvcmNlQ2FsbGluZ09yU2VsZlBlcm1pc3Npb24oCiAgICAgICAgICAgICAgICAgYW5kcm9pZC5NYW5pZmVzdC5wZXJtaXNzaW9uLkJJTkRfREVWSUNFX0FETUlOLCBudWxsKTsKLSAgICAgICAgCisKICAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CiAgICAgICAgICAgICBBY3RpdmVBZG1pbiBhZG1pbiA9IGdldEFjdGl2ZUFkbWluVW5jaGVja2VkTG9ja2VkKGNvbXApOwogICAgICAgICAgICAgaWYgKGFkbWluID09IG51bGwpIHsKQEAgLTkwNywyMCArMTM5MCwzMCBAQAogICAgICAgICAgICAgfSwgbnVsbCwgQWN0aXZpdHkuUkVTVUxUX09LLCBudWxsLCBudWxsKTsKICAgICAgICAgfQogICAgIH0KLSAgICAKLSAgICBwdWJsaWMgdm9pZCBzZXRBY3RpdmVQYXNzd29yZFN0YXRlKGludCBxdWFsaXR5LCBpbnQgbGVuZ3RoKSB7CisKKyAgICBwdWJsaWMgdm9pZCBzZXRBY3RpdmVQYXNzd29yZFN0YXRlKGludCBxdWFsaXR5LCBpbnQgbGVuZ3RoLCBpbnQgbGV0dGVycywgaW50IHVwcGVyY2FzZSwKKyAgICAgICAgICAgIGludCBsb3dlcmNhc2UsIGludCBudW1iZXJzLCBpbnQgc3ltYm9scywgaW50IG5vbmxldHRlcikgewogICAgICAgICBtQ29udGV4dC5lbmZvcmNlQ2FsbGluZ09yU2VsZlBlcm1pc3Npb24oCiAgICAgICAgICAgICAgICAgYW5kcm9pZC5NYW5pZmVzdC5wZXJtaXNzaW9uLkJJTkRfREVWSUNFX0FETUlOLCBudWxsKTsKLSAgICAgICAgCisKICAgICAgICAgdmFsaWRhdGVRdWFsaXR5Q29uc3RhbnQocXVhbGl0eSk7Ci0gICAgICAgIAorCiAgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgewogICAgICAgICAgICAgaWYgKG1BY3RpdmVQYXNzd29yZFF1YWxpdHkgIT0gcXVhbGl0eSB8fCBtQWN0aXZlUGFzc3dvcmRMZW5ndGggIT0gbGVuZ3RoCi0gICAgICAgICAgICAgICAgICAgIHx8IG1GYWlsZWRQYXNzd29yZEF0dGVtcHRzICE9IDApIHsKKyAgICAgICAgICAgICAgICAgICAgfHwgbUZhaWxlZFBhc3N3b3JkQXR0ZW1wdHMgIT0gMCB8fCBtQWN0aXZlUGFzc3dvcmRMZXR0ZXJzICE9IGxldHRlcnMKKyAgICAgICAgICAgICAgICAgICAgfHwgbUFjdGl2ZVBhc3N3b3JkVXBwZXJDYXNlICE9IHVwcGVyY2FzZQorICAgICAgICAgICAgICAgICAgICB8fCBtQWN0aXZlUGFzc3dvcmRMb3dlckNhc2UgIT0gbG93ZXJjYXNlIHx8IG1BY3RpdmVQYXNzd29yZE51bWVyaWMgIT0gbnVtYmVycworICAgICAgICAgICAgICAgICAgICB8fCBtQWN0aXZlUGFzc3dvcmRTeW1ib2xzICE9IHN5bWJvbHMgfHwgbUFjdGl2ZVBhc3N3b3JkTm9uTGV0dGVyICE9IG5vbmxldHRlcikgewogICAgICAgICAgICAgICAgIGxvbmcgaWRlbnQgPSBCaW5kZXIuY2xlYXJDYWxsaW5nSWRlbnRpdHkoKTsKICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICBtQWN0aXZlUGFzc3dvcmRRdWFsaXR5ID0gcXVhbGl0eTsKICAgICAgICAgICAgICAgICAgICAgbUFjdGl2ZVBhc3N3b3JkTGVuZ3RoID0gbGVuZ3RoOworICAgICAgICAgICAgICAgICAgICBtQWN0aXZlUGFzc3dvcmRMZXR0ZXJzID0gbGV0dGVyczsKKyAgICAgICAgICAgICAgICAgICAgbUFjdGl2ZVBhc3N3b3JkTG93ZXJDYXNlID0gbG93ZXJjYXNlOworICAgICAgICAgICAgICAgICAgICBtQWN0aXZlUGFzc3dvcmRVcHBlckNhc2UgPSB1cHBlcmNhc2U7CisgICAgICAgICAgICAgICAgICAgIG1BY3RpdmVQYXNzd29yZE51bWVyaWMgPSBudW1iZXJzOworICAgICAgICAgICAgICAgICAgICBtQWN0aXZlUGFzc3dvcmRTeW1ib2xzID0gc3ltYm9sczsKKyAgICAgICAgICAgICAgICAgICAgbUFjdGl2ZVBhc3N3b3JkTm9uTGV0dGVyID0gbm9ubGV0dGVyOwogICAgICAgICAgICAgICAgICAgICBtRmFpbGVkUGFzc3dvcmRBdHRlbXB0cyA9IDA7CiAgICAgICAgICAgICAgICAgICAgIHNhdmVTZXR0aW5nc0xvY2tlZCgpOwogICAgICAgICAgICAgICAgICAgICBzZW5kQWRtaW5Db21tYW5kTG9ja2VkKERldmljZUFkbWluUmVjZWl2ZXIuQUNUSU9OX1BBU1NXT1JEX0NIQU5HRUQsCkBAIC05MzEsMTEgKzE0MjQsMTEgQEAKICAgICAgICAgICAgIH0KICAgICAgICAgfQogICAgIH0KLSAgICAKKwogICAgIHB1YmxpYyB2b2lkIHJlcG9ydEZhaWxlZFBhc3N3b3JkQXR0ZW1wdCgpIHsKICAgICAgICAgbUNvbnRleHQuZW5mb3JjZUNhbGxpbmdPclNlbGZQZXJtaXNzaW9uKAogICAgICAgICAgICAgICAgIGFuZHJvaWQuTWFuaWZlc3QucGVybWlzc2lvbi5CSU5EX0RFVklDRV9BRE1JTiwgbnVsbCk7Ci0gICAgICAgIAorCiAgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgewogICAgICAgICAgICAgbG9uZyBpZGVudCA9IEJpbmRlci5jbGVhckNhbGxpbmdJZGVudGl0eSgpOwogICAgICAgICAgICAgdHJ5IHsKQEAgLTk1MiwxMSArMTQ0NSwxMSBAQAogICAgICAgICAgICAgfQogICAgICAgICB9CiAgICAgfQotICAgIAorCiAgICAgcHVibGljIHZvaWQgcmVwb3J0U3VjY2Vzc2Z1bFBhc3N3b3JkQXR0ZW1wdCgpIHsKICAgICAgICAgbUNvbnRleHQuZW5mb3JjZUNhbGxpbmdPclNlbGZQZXJtaXNzaW9uKAogICAgICAgICAgICAgICAgIGFuZHJvaWQuTWFuaWZlc3QucGVybWlzc2lvbi5CSU5EX0RFVklDRV9BRE1JTiwgbnVsbCk7Ci0gICAgICAgIAorCiAgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgewogICAgICAgICAgICAgaWYgKG1GYWlsZWRQYXNzd29yZEF0dGVtcHRzICE9IDAgfHwgbVBhc3N3b3JkT3duZXIgPj0gMCkgewogICAgICAgICAgICAgICAgIGxvbmcgaWRlbnQgPSBCaW5kZXIuY2xlYXJDYWxsaW5nSWRlbnRpdHkoKTsKQEAgLTk3Miw3ICsxNDY1LDk1IEBACiAgICAgICAgICAgICB9CiAgICAgICAgIH0KICAgICB9Ci0gICAgCisKKyAgICBwdWJsaWMgQ29tcG9uZW50TmFtZSBzZXRHbG9iYWxQcm94eShDb21wb25lbnROYW1lIHdobywgU3RyaW5nIHByb3h5U3BlYywKKyAgICAgICAgICAgIFN0cmluZyBleGNsdXNpb25MaXN0KSB7CisgICAgICAgIHN5bmNocm9uaXplZCh0aGlzKSB7CisgICAgICAgICAgICBpZiAod2hvID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgTnVsbFBvaW50ZXJFeGNlcHRpb24oIkNvbXBvbmVudE5hbWUgaXMgbnVsbCIpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBBY3RpdmVBZG1pbiBhZG1pbiA9IGdldEFjdGl2ZUFkbWluRm9yQ2FsbGVyTG9ja2VkKHdobywKKyAgICAgICAgICAgICAgICAgICAgRGV2aWNlQWRtaW5JbmZvLlVTRVNfUE9MSUNZX1NFVFNfR0xPQkFMX1BST1hZKTsKKworICAgICAgICAgICAgLy8gU2NhbiB0aHJvdWdoIGFjdGl2ZSBhZG1pbnMgYW5kIGZpbmQgaWYgYW55b25lIGhhcyBhbHJlYWR5CisgICAgICAgICAgICAvLyBzZXQgdGhlIGdsb2JhbCBwcm94eS4KKyAgICAgICAgICAgIGZpbmFsIGludCBOID0gbUFkbWluTGlzdC5zaXplKCk7CisgICAgICAgICAgICBTZXQ8Q29tcG9uZW50TmFtZT4gY29tcFNldCA9IG1BZG1pbk1hcC5rZXlTZXQoKTsKKyAgICAgICAgICAgIGZvciAgKENvbXBvbmVudE5hbWUgY29tcG9uZW50IDogY29tcFNldCkgeworICAgICAgICAgICAgICAgIEFjdGl2ZUFkbWluIGFwID0gbUFkbWluTWFwLmdldChjb21wb25lbnQpOworICAgICAgICAgICAgICAgIGlmICgoYXAuc3BlY2lmaWVzR2xvYmFsUHJveHkpICYmICghY29tcG9uZW50LmVxdWFscyh3aG8pKSkgeworICAgICAgICAgICAgICAgICAgICAvLyBBbm90aGVyIGFkbWluIGFscmVhZHkgc2V0cyB0aGUgZ2xvYmFsIHByb3h5CisgICAgICAgICAgICAgICAgICAgIC8vIFJldHVybiBpdCB0byB0aGUgY2FsbGVyLgorICAgICAgICAgICAgICAgICAgICByZXR1cm4gY29tcG9uZW50OworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmIChwcm94eVNwZWMgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgIGFkbWluLnNwZWNpZmllc0dsb2JhbFByb3h5ID0gZmFsc2U7CisgICAgICAgICAgICAgICAgYWRtaW4uZ2xvYmFsUHJveHlTcGVjID0gbnVsbDsKKyAgICAgICAgICAgICAgICBhZG1pbi5nbG9iYWxQcm94eUV4Y2x1c2lvbkxpc3QgPSBudWxsOworICAgICAgICAgICAgfSBlbHNlIHsKKworICAgICAgICAgICAgICAgIGFkbWluLnNwZWNpZmllc0dsb2JhbFByb3h5ID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICBhZG1pbi5nbG9iYWxQcm94eVNwZWMgPSBwcm94eVNwZWM7CisgICAgICAgICAgICAgICAgYWRtaW4uZ2xvYmFsUHJveHlFeGNsdXNpb25MaXN0ID0gZXhjbHVzaW9uTGlzdDsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgLy8gUmVzZXQgdGhlIGdsb2JhbCBwcm94eSBhY2NvcmRpbmdseQorICAgICAgICAgICAgLy8gRG8gdGhpcyB1c2luZyBzeXN0ZW0gcGVybWlzc2lvbnMsIGFzIGFwcHMgY2Fubm90IHdyaXRlIHRvIHNlY3VyZSBzZXR0aW5ncworICAgICAgICAgICAgbG9uZyBvcmlnSWQgPSBCaW5kZXIuY2xlYXJDYWxsaW5nSWRlbnRpdHkoKTsKKyAgICAgICAgICAgIHJlc2V0R2xvYmFsUHJveHkoKTsKKyAgICAgICAgICAgIEJpbmRlci5yZXN0b3JlQ2FsbGluZ0lkZW50aXR5KG9yaWdJZCk7CisgICAgICAgICAgICByZXR1cm4gbnVsbDsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyBDb21wb25lbnROYW1lIGdldEdsb2JhbFByb3h5QWRtaW4oKSB7CisgICAgICAgIHN5bmNocm9uaXplZCh0aGlzKSB7CisgICAgICAgICAgICAvLyBTY2FuIHRocm91Z2ggYWN0aXZlIGFkbWlucyBhbmQgZmluZCBpZiBhbnlvbmUgaGFzIGFscmVhZHkKKyAgICAgICAgICAgIC8vIHNldCB0aGUgZ2xvYmFsIHByb3h5LgorICAgICAgICAgICAgZmluYWwgaW50IE4gPSBtQWRtaW5MaXN0LnNpemUoKTsKKyAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgTjsgaSsrKSB7CisgICAgICAgICAgICAgICAgQWN0aXZlQWRtaW4gYXAgPSBtQWRtaW5MaXN0LmdldChpKTsKKyAgICAgICAgICAgICAgICBpZiAoYXAuc3BlY2lmaWVzR2xvYmFsUHJveHkpIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gRGV2aWNlIGFkbWluIHNldHMgdGhlIGdsb2JhbCBwcm94eQorICAgICAgICAgICAgICAgICAgICAvLyBSZXR1cm4gaXQgdG8gdGhlIGNhbGxlci4KKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGFwLmluZm8uZ2V0Q29tcG9uZW50KCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIC8vIE5vIGRldmljZSBhZG1pbiBzZXRzIHRoZSBnbG9iYWwgcHJveHkuCisgICAgICAgIHJldHVybiBudWxsOworICAgIH0KKworICAgIHByaXZhdGUgdm9pZCByZXNldEdsb2JhbFByb3h5KCkgeworICAgICAgICBmaW5hbCBpbnQgTiA9IG1BZG1pbkxpc3Quc2l6ZSgpOworICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IE47IGkrKykgeworICAgICAgICAgICAgQWN0aXZlQWRtaW4gYXAgPSBtQWRtaW5MaXN0LmdldChpKTsKKyAgICAgICAgICAgIGlmIChhcC5zcGVjaWZpZXNHbG9iYWxQcm94eSkgeworICAgICAgICAgICAgICAgIHNhdmVHbG9iYWxQcm94eShhcC5nbG9iYWxQcm94eVNwZWMsIGFwLmdsb2JhbFByb3h5RXhjbHVzaW9uTGlzdCk7CisgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIC8vIE5vIGRldmljZSBhZG1pbnMgZGVmaW5pbmcgZ2xvYmFsIHByb3hpZXMgLSByZXNldCBnbG9iYWwgcHJveHkgc2V0dGluZ3MgdG8gbm9uZQorICAgICAgICBzYXZlR2xvYmFsUHJveHkobnVsbCwgbnVsbCk7CisgICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIHNhdmVHbG9iYWxQcm94eShTdHJpbmcgcHJveHlTcGVjLCBTdHJpbmcgZXhjbHVzaW9uTGlzdCkgeworICAgICAgICBpZiAoZXhjbHVzaW9uTGlzdCA9PSBudWxsKSB7CisgICAgICAgICAgICBleGNsdXNpb25MaXN0ID0gIiI7CisgICAgICAgIH0KKyAgICAgICAgaWYgKHByb3h5U3BlYyA9PSBudWxsKSB7CisgICAgICAgICAgICBwcm94eVNwZWMgPSAiIjsKKyAgICAgICAgfQorICAgICAgICAvLyBSZW1vdmUgd2hpdGUgc3BhY2VzCisgICAgICAgIHByb3h5U3BlYyA9IHByb3h5U3BlYy50cmltKCk7CisgICAgICAgIGV4Y2x1c2lvbkxpc3QgPSBleGNsdXNpb25MaXN0LnRyaW0oKTsKKyAgICAgICAgQ29udGVudFJlc29sdmVyIHJlcyA9IG1Db250ZXh0LmdldENvbnRlbnRSZXNvbHZlcigpOworICAgICAgICBTZXR0aW5ncy5TZWN1cmUucHV0U3RyaW5nKHJlcywgU2V0dGluZ3MuU2VjdXJlLkhUVFBfUFJPWFksIHByb3h5U3BlYyk7CisgICAgICAgIFNldHRpbmdzLlNlY3VyZS5wdXRTdHJpbmcocmVzLCBTZXR0aW5ncy5TZWN1cmUuSFRUUF9QUk9YWV9FWENMVVNJT05fTElTVCwgZXhjbHVzaW9uTGlzdCk7CisgICAgfQorCiAgICAgQE92ZXJyaWRlCiAgICAgcHJvdGVjdGVkIHZvaWQgZHVtcChGaWxlRGVzY3JpcHRvciBmZCwgUHJpbnRXcml0ZXIgcHcsIFN0cmluZ1tdIGFyZ3MpIHsKICAgICAgICAgaWYgKG1Db250ZXh0LmNoZWNrQ2FsbGluZ09yU2VsZlBlcm1pc3Npb24oYW5kcm9pZC5NYW5pZmVzdC5wZXJtaXNzaW9uLkRVTVApCkBAIC05ODMsMTIgKzE1NjQsMTIgQEAKICAgICAgICAgICAgICAgICAgICAgKyAiLCB1aWQ9IiArIEJpbmRlci5nZXRDYWxsaW5nVWlkKCkpOwogICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICB9Ci0gICAgICAgIAorCiAgICAgICAgIGZpbmFsIFByaW50ZXIgcCA9IG5ldyBQcmludFdyaXRlclByaW50ZXIocHcpOwotICAgICAgICAKKwogICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKICAgICAgICAgICAgIHAucHJpbnRsbigiQ3VycmVudCBEZXZpY2UgUG9saWN5IE1hbmFnZXIgc3RhdGU6Iik7Ci0gICAgICAgICAgICAKKwogICAgICAgICAgICAgcC5wcmludGxuKCIgIEVuYWJsZWQgRGV2aWNlIEFkbWluczoiKTsKICAgICAgICAgICAgIGZpbmFsIGludCBOID0gbUFkbWluTGlzdC5zaXplKCk7CiAgICAgICAgICAgICBmb3IgKGludCBpPTA7IGk8TjsgaSsrKSB7CkBAIC05OTksMTEgKzE1ODAsMTcgQEAKICAgICAgICAgICAgICAgICAgICAgYXAuZHVtcCgiICAgICIsIHB3KTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAKKwogICAgICAgICAgICAgcHcucHJpbnRsbigiICIpOwogICAgICAgICAgICAgcHcucHJpbnQoIiAgbUFjdGl2ZVBhc3N3b3JkUXVhbGl0eT0weCIpOwogICAgICAgICAgICAgICAgICAgICBwdy5wcmludGxuKEludGVnZXIudG9IZXhTdHJpbmcobUFjdGl2ZVBhc3N3b3JkUXVhbGl0eSkpOwogICAgICAgICAgICAgcHcucHJpbnQoIiAgbUFjdGl2ZVBhc3N3b3JkTGVuZ3RoPSIpOyBwdy5wcmludGxuKG1BY3RpdmVQYXNzd29yZExlbmd0aCk7CisgICAgICAgICAgICBwdy5wcmludCgiICBtQWN0aXZlUGFzc3dvcmRVcHBlckNhc2U9Iik7IHB3LnByaW50bG4obUFjdGl2ZVBhc3N3b3JkVXBwZXJDYXNlKTsKKyAgICAgICAgICAgIHB3LnByaW50KCIgIG1BY3RpdmVQYXNzd29yZExvd2VyQ2FzZT0iKTsgcHcucHJpbnRsbihtQWN0aXZlUGFzc3dvcmRMb3dlckNhc2UpOworICAgICAgICAgICAgcHcucHJpbnQoIiAgbUFjdGl2ZVBhc3N3b3JkTGV0dGVycz0iKTsgcHcucHJpbnRsbihtQWN0aXZlUGFzc3dvcmRMZXR0ZXJzK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01PVU5URUQgc3RhdGUgZm9yIGV4dGVybmFsIHN0b3JhZ2UKKyAgICBwcml2YXRlIGJvb2xlYW4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUVtdWxhdGVFeHRlcm5hbFN0b3JhZ2UgPSBmYWxzZTsKIAogICAgIC8qKgogICAgICAqIFByaXZhdGUgaGFzaCBvZiBjdXJyZW50bHkgbW91bnRlZCBzZWN1cmUgY29udGFpbmVycy4KQEAgLTM5NSw3ICszOTcsOSBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIFN0cmluZyBwYXRoID0gRW52aXJvbm1lbnQuZ2V0RXh0ZXJuYWxTdG9yYWdlRGlyZWN0b3J5KCkuZ2V0UGF0aCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgIFN0cmluZyBzdGF0ZSA9IGdldFZvbHVtZVN0YXRlKHBhdGgpOwogCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHN0YXRlLmVxdWFscyhFbnZpcm9ubWVudC5NRURJQV9VTk1PVU5URUQpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1FbXVsYXRlRXh0ZXJuYWxTdG9yYWdlKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5vdGlmeVZvbHVtZVN0YXRlQ2hhbmdlKG51bGwsIHBhdGgsIFZvbHVtZVN0YXRlLk5vTWVkaWEsIFZvbHVtZVN0YXRlLk1vdW50ZWQpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoc3RhdGUuZXF1YWxzKEVudmlyb25tZW50Lk1FRElBX1VOTU9VTlRFRCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IHJjID0gZG9Nb3VudFZvbHVtZShwYXRoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHJjICE9IFN0b3JhZ2VSZXN1bHRDb2RlLk9wZXJhdGlvblN1Y2NlZWRlZCkgewogICA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2VydmVyL05hdGl2ZURhZW1vbkNvbm5lY3Rvci5qYXZhCmluZGV4IGM0NTI1OTAuLjI0OWMzMmIgMTAwNjQ0Ci0tLSBhL3NlcnZpY2VzL2phdmEvY29tL2FuZHJvaWQvc2VydmVyL05hdGl2ZURhZW1vbkNvbm5lY3Rvci5qYXZhCisrKyBiL3NlcnZpY2VzL2phdmEvY29tL2FuZHJvaWQvc2VydmVyL05hdGl2ZURhZW1vbkNvbm5lY3Rvci5qYXZhCkBAIC0xMjgsMTEgKzEyOCwxMiBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgU2xvZy5lKFRBRywgU3RyaW5nLmZvcm1hdCgKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIkVycm9yIGhhbmRsaW5nICclcyciLCBldmVudCksIGV4KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtUmVzcG9uc2VRdWV1ZS5wdXQoZXZlbnQpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKEludGVycnVwdGVkRXhjZXB0aW9uIGV4KSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNsb2cuZShUQUcsICJGYWlsZWQgdG8gcHV0IHJlc3BvbnNlIG9udG8gcXVldWUiLCBleCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1SZXNwb25zZVF1ZXVlLnB1dChldmVudCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKEludGVycnVwdGVkRXhjZXB0aW9uIGV4KSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTbG9nLmUoVEFHLCAiRmFpbGVkIHRvIHB1dCByZXNwb25zZSBvbnRvIHF1ZXVlIiwgZXgpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoTnVtYmVyRm9ybWF0RXhjZXB0aW9uIG5mZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNsb2cudyhUQUcsIFN0cmluZy5mb3JtYXQoIkJhZCBtc2cgKCVzKSIsIGV2ZW50KSk7CkBAIC0yMDksNiArMjEwLDcgQEAKICAgICAgKi8KICAgICBwdWJsaWMgc3luY2hyb25pemVkIEFycmF5TGlzdDxTdHJpbmc+IGRvQ29tbWFuZChTdHJpbmcgY21kKQogICAgICAgICAgICAgdGhyb3dzIE5hdGl2ZURhZW1vbkNvbm5lY3RvckV4Y2VwdGlvbiAgeworICAgICAgICBtUmVzcG9uc2VRdWV1ZS5jbGVhcigpOwogICAgICAgICBzZW5kQ29tbWFuZChjbWQpOwogCiAgICAgICAgIEFycmF5TGlzdDxTdHJpbmc+IHJlc3BvbnNlID0gbmV3IEFycmF5TGlzdDxTdHJpbmc+KCk7CmRpZmYgLS1naXQgYS9zZXJ2aWNlcy9qYXZhL2NvbS9hbmRyb2lkL3NlcnZlci9OZXR3b3JrTWFuYWdlbWVudFNlcnZpY2UuamF2YSBiL3NlcnZpY2VzL2phdmEvY29tL2FuZHJvaWQvc2VydmVyL05ldHdvcmtNYW5hZ2VtZW50U2VydmljZS5qYXZhCmluZGV4IGMxNTYxNTAuLmNiOGZhMzUgMTAwNjQ0Ci0tLSBhL3NlcnZpY2VzL2phdmEvY29tL2FuZHJvaWQvc2VydmVyL05ldHdvcmtNYW5hZ2VtZW50U2VydmljZS5qYXZhCisrKyBiL3NlcnZpY2VzL2phdmEvY29tL2FuZHJvaWQvc2VydmVyL05ldHdvcmtNYW5hZ2VtZW50U2VydmljZS5qYXZhCkBAIC0yMDMsMTAgKzIwMywxMCBAQAogICAgICAgICAgICAgICAgIHRocm93IG5ldyBVbmtub3duSG9zdEV4Y2VwdGlvbihhZGRyU3RyaW5nKTsKICAgICAgICAgICAgIH0KIAotICAgICAgICAgICAgaW50IGEgPSBJbnRlZ2VyLnBhcnNlSW50KHBhcnRzWzBdKSAgICAgIDsKLSAgICAgICAgICAgIGludCBiID0gSW50ZWdlci5wYXJzZUludChwYXJ0c1sxXSkgPDwgIDg7Ci0gICAgICAgICAgICBpbnQgYyA9IEludGVnZXIucGFyc2VJbnQocGFydHNbMl0pIDw8IDE2OwotICAgICAgICAgICAgaW50IGQgPSBJbnRlZ2VyLnBhcnNlSW50KHBhcnRzWzNdKSA8PCAyNDsKKyAgICAgICAgICAgIGludCBhID0gSW50ZWdlci5wYXJzZUludChwYXJ0c1swXSkgPDwgMjQ7CisgICAgICAgICAgICBpbnQgYiA9IEludGVnZXIucGFyc2VJbnQocGFydHNbMV0pIDw8IDE2OworICAgICAgICAgICAgaW50IGMgPSBJbnRlZ2VyLnBhcnNlSW50KHBhcnRzWzJdKSA8PCAgODsKKyAgICAgICAgICAgIGludCBkID0gSW50ZWdlci5wYXJzZUludChwYXJ0c1szXSkgICAgICA7CiAKICAgICAgICAgICAgIHJldHVybiBhIHwgYiB8IGMgfCBkOwogICAgICAgICB9IGNhdGNoIChOdW1iZXJGb3JtYXRFeGNlcHRpb24gZXgpIHsKZGlmZiAtLWdpdCBhL3NlcnZpY2VzL2phdmEvY29tL2FuZHJvaWQvc2VydmVyL05vdGlmaWNhdGlvbk1hbmFnZXJTZXJ2aWNlLmphdmEgYi9zZXJ2aWNlcy9qYXZhL2NvbS9hbmRyb2lkL3NlcnZlci9Ob3RpZmljYXRpb25NYW5hZ2VyU2VydmljZS5qYXZhCmluZGV4IGVkOGI5MGIuLjlkMjYyYjYgMTAwNzU1Ci0tLSBhL3NlcnZpY2VzL2phdmEv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AgICAgICAgICAgU2VydmljZU1hbmFnZXIuYWRkU2VydmljZShDb250ZXh0LkNPVU5UUllfREVURUNUT1IsIGNvdW50cnlEZXRlY3Rvcik7CisgICAgICAgICAgICB9IGNhdGNoIChUaHJvd2FibGUgZSkgeworICAgICAgICAgICAgICAgIFNsb2cuZShUQUcsICJGYWlsdXJlIHN0YXJ0aW5nIENvdW50cnkgRGV0ZWN0b3IiLCBlKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICBTbG9nLmkoVEFHLCAiU2VhcmNoIFNlcnZpY2UiKTsKICAgICAgICAgICAgICAgICBTZXJ2aWNlTWFuYWdlci5hZGRTZXJ2aWNlKENvbnRleHQuU0VBUkNIX1NFUlZJQ0UsCiAgICAgICAgICAgICAgICAgICAgICAgICBuZXcgU2VhcmNoTWFuYWdlclNlcnZpY2UoY29udGV4dCkpOwpAQCAtMzI3LDExICszMzMsNiBAQAogICAgICAgICAgICAgICAgIFNsb2cuZShUQUcsICJGYWlsdXJlIHN0YXJ0aW5nIFNlYXJjaCBTZXJ2aWNlIiwgZSk7CiAgICAgICAgICAgICB9CiAKLSAgICAgICAgICAgIGlmIChJTkNMVURFX0RFTU8pIHsKLSAgICAgICAgICAgICAgICBTbG9nLmkoVEFHLCAiSW5zdGFsbGluZyBkZW1vIGRhdGEuLi4iKTsKLSAgICAgICAgICAgICAgICAobmV3IERlbW9UaHJlYWQoY29udGV4dCkpLnN0YXJ0KCk7Ci0gICAgICAgICAgICB9Ci0KICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgU2xvZy5pKFRBRywgIkRyb3BCb3ggU2VydmljZSIpOwogICAgICAgICAgICAgICAgIFNlcnZpY2VNYW5hZ2VyLmFkZFNlcnZpY2UoQ29udGV4dC5EUk9QQk9YX1NFUlZJQ0UsCkBAIC00MTgsMTAgKzQxOSwyMiBAQAogICAgICAgICAgICAgfQogCiAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIC8vIG5lZWQgdG8gYWRkIHRoaXMgc2VydmljZSBldmVuIGlmIFNhbXBsaW5nUHJvZmlsZXJJbnRlZ3JhdGlvbi5pc0VuYWJsZWQoKQorICAgICAgICAgICAgICAgIC8vIGlzIGZhbHNlLCBiZWNhdXNlIGl0IGlzIHRoaXMgc2VydmljZSB0aGF0IGRldGVjdHMgc3lzdGVtIHByb3BlcnR5IGNoYW5nZSBhbmQKKyAgICAgICAgICAgICAgICAvLyB0dXJucyBvbiBTYW1wbGluZ1Byb2ZpbGVySW50ZWdyYXRpb24uIFBsdXMsIHdoZW4gc2FtcGxpbmcgcHJvZmlsZXIgZG9lc24ndCB3b3JrLAorICAgICAgICAgICAgICAgIC8vIHRoZXJlIGlzIGxpdHRsZSBvdmVyaGVhZCBmb3IgcnVubmluZyB0aGlzIHNlcnZpY2UuCisgICAgICAgICAgICAgICAgU2xvZy5pKFRBRywgIlNhbXBsaW5nUHJvZmlsZXIgU2VydmljZSIpOworICAgICAgICAgICAgICAgIFNlcnZpY2VNYW5hZ2VyLmFkZFNlcnZpY2UoInNhbXBsaW5ncHJvZmlsZXIiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5ldyBTYW1wbGluZ1Byb2ZpbGVyU2VydmljZShjb250ZXh0KSk7CisgICAgICAgICAgICB9IGNhdGNoIChUaHJvd2FibGUgZSkgeworICAgICAgICAgICAgICAgIFNsb2cuZShUQUcsICJGYWlsdXJlIHN0YXJ0aW5nIFNhbXBsaW5nUHJvZmlsZXIgU2VydmljZSIsIGUpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgIFNsb2cuaShUQUcsICJTaXAgU2VydmljZSIpOwogICAgICAgICAgICAgICAgIFNlcnZpY2VNYW5hZ2VyLmFkZFNlcnZpY2UoInNpcCIsIG5ldyBTaXBTZXJ2aWNlKGNvbnRleHQpKTsKICAgICAgICAgICAgIH0gY2F0Y2ggKFRocm93YWJsZSB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IT0gbnVsbCkgY291bnRyeURldGVjdG9yRi5zeXN0ZW1SZWFkeSgpOwogICAgICAgICAgICAgICAgIGlmICh0aHJvdHRsZUYgIT0gbnVsbCkgdGhyb3R0bGVGLnN5c3RlbVJlYWR5KCk7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0pOwpAQCAtNTE5LDM3ICs1MzQsNyBAQAogICAgIH0KIH0KIAotY2xhc3MgRGVtb1RocmVhZCBleHRlbmRzIFRocmVhZAotewotICAgIERlbW9UaHJlYWQoQ29udGV4dCBjb250ZXh0KQotICAgIHsKLSAgICAgICAgbUNvbnRleHQgPSBjb250ZXh0OwotICAgIH0KLQotICAgIEBPdmVycmlkZQotICAgIHB1YmxpYyB2b2lkIHJ1bigpCi0gICAgewotICAgICAgICB0cnkgewotICAgICAgICAgICAgQ3Vyc29yIGMgPSBtQ29udGV4dC5nZXRDb250ZW50UmVzb2x2ZXIoKS5xdWVyeShQZW9wbGUuQ09OVEVOVF9VUkksIG51bGwsIG51bGwsIG51bGwsIG51bGwpOwotICAgICAgICAgICAgYm9vbGVhbiBoYXNEYXRhID0gYyAhPSBudWxsICYmIGMubW92ZVRvRmlyc3QoKTsKLSAgICAgICAgICAgIGlmIChjICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICBjLmRlYWN0aXZhdGUoKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmICghaGFzRGF0YSkgewotICAgICAgICAgICAgICAgIERlbW9EYXRhU2V0IGRhdGFzZXQgPSBuZXcgRGVtb0RhdGFTZXQoKTsKLSAgICAgICAgICAgICAgICBkYXRhc2V0LmFkZChtQ29udGV4dCk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0gY2F0Y2ggKFRocm93YWJsZSBlKSB7Ci0gICAgICAgICAgICBTbG9nLmUoIlN5c3RlbVNlcnZlciIsICJGYWlsdXJlIGluc3RhbGxpbmcgZGVtbyBkYXRhIiwgZSk7Ci0gICAgICAgIH0KLQotICAgIH0KLQotICAg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IHsKICAgICAgICAgICAgIG1DYWxsU3RhdGUgPSBzdGF0ZTsKICAgICAgICAgICAgIG1DYWxsSW5jb21pbmdOdW1iZXIgPSBpbmNvbWluZ051bWJlcjsKLSAgICAgICAgICAgIGZvciAoaW50IGkgPSBtUmVjb3Jkcy5zaXplKCkgLSAxOyBpID49IDA7IGktLSkgewotICAgICAgICAgICAgICAgIFJlY29yZCByID0gbVJlY29yZHMuZ2V0KGkpOworICAgICAgICAgICAgZm9yIChSZWNvcmQgciA6IG1SZWNvcmRzKSB7CiAgICAgICAgICAgICAgICAgaWYgKChyLmV2ZW50cyAmIFBob25lU3RhdGVMaXN0ZW5lci5MSVNURU5fQ0FMTF9TVEFURSkgIT0gMCkgewogICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgci5jYWxsYmFjay5vbkNhbGxTdGF0ZUNoYW5nZWQoc3RhdGUsIGluY29taW5nTnVtYmVyKTsKICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGV4KSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICByZW1vdmUoci5iaW5kZXIpOworICAgICAgICAgICAgICAgICAgICAgICAgcmVtb3ZlTGlzdC5hZGQoci5iaW5kZXIpOwogICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQorICAgICAgICAgICAgZm9yIChJQmluZGVyIGIgOiByZW1vdmVMaXN0KSByZW1vdmUoYik7CiAgICAgICAgIH0KICAgICAgICAgYnJvYWRjYXN0Q2FsbFN0YXRlQ2hhbmdlZChzdGF0ZSwgaW5jb21pbmdOdW1iZXIpOwogICAgIH0KQEAgLTI1NSw4ICsyNTksNyBAQAogICAgICAgICB9CiAgICAgICAgIHN5bmNocm9uaXplZCAobVJlY29yZHMpIHsKICAgICAgICAgICAgIG1TZXJ2aWNlU3RhdGUgPSBzdGF0ZTsKLSAgICAgICAgICAgIGZvciAoaW50IGkgPSBtUmVjb3Jkcy5zaXplKCkgLSAxOyBpID49IDA7IGktLSkgewotICAgICAgICAgICAgICAgIFJlY29yZCByID0gbVJlY29yZHMuZ2V0KGkpOworICAgICAgICAgICAgZm9yIChSZWNvcmQgciA6IG1SZWNvcmRzKSB7CiAgICAgICAgICAgICAgICAgaWYgKChyLmV2ZW50cyAmIFBob25lU3RhdGVMaXN0ZW5lci5MSVNURU5fU0VSVklDRV9TVEFURSkgIT0gMCkgewogICAgICAgICAgICAgICAgICAgICBzZW5kU2VydmljZVN0YXRlKHIsIHN0YXRlKTsKICAgICAgICAgICAgICAgICB9CkBAIC0yNjksMTAgKzI3MiwxMCBAQAogICAgICAgICBpZiAoIWNoZWNrTm90aWZ5UGVybWlzc2lvbigibm90aWZ5U2lnbmFsU3RyZW5ndGgoKSIpKSB7CiAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgIH0KKyAgICAgICAgQXJyYXlMaXN0PElCaW5kZXI+IHJlbW92ZUxpc3QgPSBuZXcgQXJyYXlMaXN0PElCaW5kZXI+KCk7CiAgICAgICAgIHN5bmNocm9uaXplZCAobVJlY29yZHMpIHsKICAgICAgICAgICAgIG1TaWduYWxTdHJlbmd0aCA9IHNpZ25hbFN0cmVuZ3RoOwotICAgICAgICAgICAgZm9yIChpbnQgaSA9IG1SZWNvcmRzLnNpemUoKSAtIDE7IGkgPj0gMDsgaS0tKSB7Ci0gICAgICAgICAgICAgICAgUmVjb3JkIHIgPSBtUmVjb3Jkcy5nZXQoaSk7CisgICAgICAgICAgICBmb3IgKFJlY29yZCByIDogbVJlY29yZHMpIHsKICAgICAgICAgICAgICAgICBpZiAoKHIuZXZlbnRzICYgUGhvbmVTdGF0ZUxpc3RlbmVyLkxJU1RFTl9TSUdOQUxfU1RSRU5HVEhTKSAhPSAwKSB7CiAgICAgICAgICAgICAgICAgICAgIHNlbmRTaWduYWxTdHJlbmd0aChyLCBzaWduYWxTdHJlbmd0aCk7CiAgICAgICAgICAgICAgICAgfQpAQCAtMjgyLDEwICsyODUsMTEgQEAKICAgICAgICAgICAgICAgICAgICAgICAgIHIuY2FsbGJhY2sub25TaWduYWxTdHJlbmd0aENoYW5nZWQoKGdzbVNpZ25hbFN0cmVuZ3RoID09IDk5ID8gLTEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOiBnc21TaWduYWxTdHJlbmd0aCkpOwogICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZXgpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHJlbW92ZShyLmJpbmRlcik7CisgICAgICAgICAgICAgICAgICAgICAgICByZW1vdmVMaXN0LmFkZChyLmJpbmRlcik7CiAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CisgICAgICAgICAgICBmb3IgKElCaW5kZXIgYiA6IHJlbW92ZUxpc3QpIHJlbW92ZShiKTsKICAgICAgICAgfQogICAgICAgICBicm9hZGNhc3RTaWduYWxTdHJlbmd0aENoYW5nZWQoc2lnbmFsU3RyZW5ndGgpOwogICAgIH0KQEAgLTI5NCwxOCArMjk4LDE5IEBACiAgICAgICAgIGlmICghY2hlY2tOb3RpZnlQZXJtaXNzaW9uKCJub3RpZnlNZXNzYWdlV2FpdGluZ0NoYW5nZWQoKSIpKSB7CiAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgIH0KKyAgICAgICAgQXJyYXlMaXN0PElCaW5kZXI+IHJlbW92ZUxpc3QgPSBuZXcgQXJyYXlMaXN0PElCaW5kZXI+KCk7CiAgICAgICAgIHN5bmNocm9uaXplZCAobVJlY29yZHMpIHsKICAgICAgICAgICAgIG1NZXNzYWdlV2FpdGluZyA9IG13aTsKLSAgICAgICAgICAgIGZvciAoaW50IGkgPSBtUmVjb3Jkcy5zaXplKCkgLSAxOyBpID49IDA7IGktLSkgewotICAgICAgICAgICAgICAgIFJlY29yZCByID0gbVJlY29yZHMuZ2V0KGkpOworICAgICAgICAgICAgZm9yIChSZWNvcmQgciA6IG1SZWNvcmRzKSB7CiAgICAgICAgICAgICAgICAgaWYgKChyLmV2ZW50cyAmIFBob25lU3RhdGVMaXN0ZW5lci5MSVNURU5fTUVTU0FHRV9XQUlUSU5HX0lORElDQVRPUikgIT0gMCkgewogICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgci5jYWxsYmFjay5vbk1lc3NhZ2VXYWl0aW5nSW5kaWNhdG9yQ2hhbmdlZChtd2kpOwogICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZXgpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHJlbW92ZShyLmJpbmRlcik7CisgICAgICAgICAgICAgICAgICAgICAgICByZW1vdmVMaXN0LmFkZChyLmJpbmRlcik7CiAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CisgICAgICAgICAgICBmb3IgKElCaW5kZXIgYiA6IHJlbW92ZUxpc3QpIHJlbW92ZShiKTsKICAgICAgICAgfQogICAgIH0KIApAQCAtMzEzLDE4ICszMTgsMTkgQEAKICAgICAgICAgaWYgKCFjaGVja05vdGlmeVBlcm1pc3Npb24oIm5vdGlmeUNhbGxGb3J3YXJkaW5nQ2hhbmdlZCgpIikpIHsKICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgfQorICAgICAgICBBcnJheUxpc3Q8SUJpbmRlcj4gcmVtb3ZlTGlzdCA9IG5ldyBBcnJheUxpc3Q8SUJpbmRlcj4oKTsKICAgICAgICAgc3luY2hyb25pemVkIChtUmVjb3JkcykgewogICAgICAgICAgICAgbUNhbGxGb3J3YXJkaW5nID0gY2ZpOwotICAgICAgICAgICAgZm9yIChpbnQgaSA9IG1SZWNvcmRzLnNpemUoKSAtIDE7IGkgPj0gMDsgaS0tKSB7Ci0gICAgICAgICAgICAgICAgUmVjb3JkIHIgPSBtUmVjb3Jkcy5nZXQoaSk7CisgICAgICAgICAgICBmb3IgKFJlY29yZCByIDogbVJlY29yZHMpIHsKICAgICAgICAgICAgICAgICBpZiAoKHIuZXZlbnRzICYgUGhvbmVTdGF0ZUxpc3RlbmVyLkxJU1RFTl9DQUxMX0ZPUldBUkRJTkdfSU5ESUNBVE9SKSAhPSAwKSB7CiAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICByLmNhbGxiYWNrLm9uQ2FsbEZvcndhcmRpbmdJbmRpY2F0b3JDaGFuZ2VkKGNmaSk7CiAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBleCkgewotICAgICAgICAgICAgICAgICAgICAgICAgcmVtb3ZlKHIuYmluZGVyKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJlbW92ZUxpc3QuYWRkKHIuYmluZGVyKTsKICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGZvciAoSUJpbmRlciBiIDogcmVtb3ZlTGlzdCkgcmVtb3ZlKGIpOwogICAgICAgICB9CiAgICAgfQogCkBAIC0zMzIsNTYgKzMzOCw4MSBAQAogICAgICAgICBpZiAoIWNoZWNrTm90aWZ5UGVybWlzc2lvbigibm90aWZ5RGF0YUFjdGl2aXR5KCkiICkpIHsKICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgfQorICAgICAgICBBcnJheUxpc3Q8SUJpbmRlcj4gcmVtb3ZlTGlzdCA9IG5ldyBBcnJheUxpc3Q8SUJpbmRlcj4oKTsKICAgICAgICAgc3luY2hyb25pemVkIChtUmVjb3JkcykgewogICAgICAgICAgICAgbURhdGFBY3Rpdml0eSA9IHN0YXRlOwotICAgICAgICAgICAgZm9yIChpbnQgaSA9IG1SZWNvcmRzLnNpemUoKSAtIDE7IGkgPj0gMDsgaS0tKSB7Ci0gICAgICAgICAgICAgICAgUmVjb3JkIHIgPSBtUmVjb3Jkcy5nZXQoaSk7CisgICAgICAgICAgICBmb3IgKFJlY29yZCByIDogbVJlY29yZHMpIHsKICAgICAgICAgICAgICAgICBpZiAoKHIuZXZlbnRzICYgUGhvbmVTdGF0ZUxpc3RlbmVyLkxJU1RFTl9EQVRBX0FDVElWSVRZKSAhPSAwKSB7CiAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICByLmNhbGxiYWNrLm9uRGF0YUFjdGl2aXR5KHN0YXRlKTsKICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGV4KSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICByZW1vdmUoci5iaW5kZXIpOworICAgICAgICAgICAgICAgICAgICAgICAgcmVtb3ZlTGlzdC5hZGQoci5iaW5kZXIpOwogICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQorICAgICAgICAgICAgZm9yIChJQmluZGVyIGIgOiByZW1vdmVMaXN0KSByZW1vdmUoYik7CiAgICAgICAgIH0KICAgICB9CiAKICAgICBwdWJsaWMgdm9pZCBub3RpZnlEYXRhQ29ubmVjdGlvbihpbnQgc3RhdGUsIGJvb2xlYW4gaXNEYXRhQ29ubmVjdGl2aXR5UG9zc2libGUsCi0gICAgICAgICAgICBTdHJpbmcgcmVhc29uLCBTdHJpbmcgYXBuLCBTdHJpbmdbXSBhcG5UeXBlcywgU3RyaW5nIGludGVyZmFjZU5hbWUsIGludCBuZXR3b3JrVHlwZSkgeworICAgICAgICAgICAgU3RyaW5nIHJlYXNvbiwgU3RyaW5nIGFwbiwgU3RyaW5nIGFwblR5cGUsIE5ldHdvcmtQcm9wZXJ0aWVzIG5ldHdvcmtQcm9wZXJ0aWVzLAorICAgICAgICAgICAgaW50IG5ldHdvcmtUeXBlKSB7CiAgICAgICAgIGlmICghY2hlY2tOb3RpZnlQZXJtaXNzaW9uKCJub3RpZnlEYXRhQ29ubmVjdGlvbigpIiApKSB7CiAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgIH0KICAgICAgICAgc3luY2hyb25pemVkIChtUmVjb3JkcykgewotICAgICAgICAgICAgbURhdGFDb25uZWN0aW9uU3RhdGUgPSBzdGF0ZTsKKyAgICAgICAgICAgIGJvb2xlYW4gbW9kaWZpZWQgPSBmYWxzZTsKKyAgICAgICAgICAgIGlmIChzdGF0ZSA9PSBUZWxlcGhvbnlNYW5hZ2VyLkRBVEFfQ09OTkVDVEVEKSB7CisgICAgICAgICAgICAgICAgaWYgKCFtQ29ubmVjdGVkQXBucy5jb250YWlucyhhcG5UeXBlKSkgeworICAgICAgICAgICAgICAgICAgICBtQ29ubmVjdGVkQXBucy5hZGQoYXBuVHlwZSk7CisgICAgICAgICAgICAgICAgICAgIGlmIChtRGF0YUNvbm5lY3Rpb25TdGF0ZSAhPSBzdGF0ZSkgeworICAgICAgICAgICAgICAgICAgICAgICAgbURhdGFDb25uZWN0aW9uU3RhdGUgPSBzdGF0ZTsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1vZGlmaWVkID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgbUNvbm5lY3RlZEFwbnMucmVtb3ZlKGFwblR5cGUpOworICAgICAgICAgICAgICAgIGlmIChtQ29ubmVjdGVkQXBucy5pc0VtcHR5KCkpIHsKKyAgICAgICAgICAgICAgICAgICAgbURhdGFDb25uZWN0aW9uU3RhdGUgPSBzdGF0ZTsKKyAgICAgICAgICAgICAgICAgICAgbW9kaWZpZWQgPSB0cnVlOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIC8vIGxlYXZlIG1EYXRhQ29ubmVjdGlvblN0YXRlIGFzIGlzIGFuZAorICAgICAgICAgICAgICAgICAgICAvLyBzZW5kIG91dCB0aGUgbmV3IHN0YXR1cyBmb3IgdGhlIEFQTiBpbiBxdWVzdGlvbi4KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CiAgICAgICAgICAgICBtRGF0YUNvbm5lY3Rpb25Qb3NzaWJsZSA9IGlzRGF0YUNvbm5lY3Rpdml0eVBvc3NpYmxlOwogICAgICAgICAgICAgbURhdGFDb25uZWN0aW9uUmVhc29uID0gcmVhc29uOwogICAgICAgICAgICAgbURhdGFDb25uZWN0aW9uQXBuID0gYXBuOwotICAgICAgICAgICAgbURhdGFDb25uZWN0aW9uQXBuVHlwZXMgPSBhcG5UeXBlczsKLSAgICAgICAgICAgIG1EYXRhQ29ubmVjdGlvbkludGVyZmFjZU5hbWUgPSBpbnRlcmZhY2VOYW1lOwotICAgICAgICAgICAgbURhdGFDb25uZWN0aW9uTmV0d29ya1R5cGUgPSBuZXR3b3JrVHlwZTsKLSAgICAgICAgICAgIGZvciAoaW50IGkgPSBtUmVjb3Jkcy5zaXplKCkgLSAxOyBpID49IDA7IGktLSkgewotICAgICAgICAgICAgICAgIFJlY29yZCByID0gbVJlY29yZHMuZ2V0KGkpOwotICAgICAgICAgICAgICAgIGlmICgoci5ldmVudHMgJiBQaG9uZVN0YXRlTGlzdGVuZXIuTElTVEVOX0RBVEFfQ09OTkVDVElPTl9TVEFURSkgIT0gMCkgewotICAgICAgICAgICAgICAgICAgICB0cnkgewotICAgICAgICAgICAgICAgICAgICAgICAgci5jYWxsYmFjay5vbkRhdGFDb25uZWN0aW9uU3RhdGVDaGFuZ2VkKHN0YXRlLCBuZXR3b3JrVHlwZSk7Ci0gICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBleCkgewotICAgICAgICAgICAgICAgICAgICAgICAgcmVtb3ZlKHIuYmluZGVyKTsKKyAgICAgICAgICAgIG1EYXRhQ29ubmVjdGlvblByb3BlcnRpZXMgPSBuZXR3b3JrUHJvcGVydGllczsKKyAgICAgICAgICAgIGlmIChtRGF0YUNvbm5lY3Rpb25OZXR3b3JrVHlwZSAhPSBuZXR3b3JrVHlwZSkgeworICAgICAgICAgICAgICAgIG1EYXRhQ29ubmVjdGlvbk5ldHdvcmtUeXBlID0gbmV0d29ya1R5cGU7CisgICAgICAgICAgICAgICAgbW9kaWZpZWQgPSB0cnVlOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKG1vZGlmaWVkKSB7CisgICAgICAgICAgICAgICAgQXJyYXlMaXN0PElCaW5kZXI+IHJlbW92ZUxpc3QgPSBuZXcgQXJyYXlMaXN0PElCaW5kZXI+KCk7CisgICAgICAgICAgICAgICAgZm9yIChSZWNvcmQgciA6IG1SZWNvcmRzKSB7CisgICAgICAgICAgICAgICAgICAgIGlmICgoci5ldmVudHMgJiBQaG9uZVN0YXRlTGlzdGVuZXIuTElTVEVOX0RBVEFfQ09OTkVDVElPTl9TVEFURSkgIT0gMCkgeworICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICByLmNhbGxiYWNrLm9uRGF0YUNvbm5lY3Rpb25TdGF0ZUNoYW5nZWQoc3RhdGUsIG5ldHdvcmtUeXBlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBleCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlbW92ZUxpc3QuYWRkKHIuYmluZGVyKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBmb3IgKElCaW5kZXIgYiA6IHJlbW92ZUxpc3QpIHJlbW92ZShiKTsKICAgICAgICAgICAgIH0KICAgICAgICAgfQogICAgICAgICBicm9hZGNhc3REYXRhQ29ubmVjdGlvblN0YXRlQ2hhbmdlZChzdGF0ZSwgaXNEYXRhQ29ubmVjdGl2aXR5UG9zc2libGUsIHJlYXNvbiwgYXBuLA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Y3Rpb25GYWlsZWQocmVhc29uKTsKKyAgICAgICAgYnJvYWRjYXN0RGF0YUNvbm5lY3Rpb25GYWlsZWQocmVhc29uLCBhcG5UeXBlKTsKICAgICB9CiAKICAgICBwdWJsaWMgdm9pZCBub3RpZnlDZWxsTG9jYXRpb24oQnVuZGxlIGNlbGxMb2NhdGlvbikgewpAQCAtNDAyLDggKzQzMyw3IEBACiAgICAgICAgIH0KICAgICAgICAgc3luY2hyb25pemVkIChtUmVjb3JkcykgewogICAgICAgICAgICAgbUNlbGxMb2NhdGlvbiA9IGNlbGxMb2NhdGlvbjsKLSAgICAgICAgICAgIGZvciAoaW50IGkgPSBtUmVjb3Jkcy5zaXplKCkgLSAxOyBpID49IDA7IGktLSkgewotICAgICAgICAgICAgICAgIFJlY29yZCByID0gbVJlY29yZHMuZ2V0KGkpOworICAgICAgICAgICAgZm9yIChSZWNvcmQgciA6IG1SZWNvcmRzKSB7CiAgICAgICAgICAgICAgICAgaWYgKChyLmV2ZW50cyAmIFBob25lU3RhdGVMaXN0ZW5lci5MSVNURU5fQ0VMTF9MT0NBVElPTikgIT0gMCkgewogICAgICAgICAgICAgICAgICAgICBzZW5kQ2VsbExvY2F0aW9uKHIsIGNlbGxMb2NhdGlvbik7CiAgICAgICAgICAgICAgICAgfQpAQCAtNDE0LDcgKzQ0NCw3IEBACiAgICAgLyoqCiAgICAgICogQ29weSB0aGUgc2VydmljZSBzdGF0ZSBvYmplY3Qgc28gdGhleSBjYW4ndCBtZXNzIGl0IHVwIGluIHRoZSBsb2NhbCBjYWxscwogICAgICAqLwotICAgIHB1YmxpYyB2b2lkIHNlbmRTZXJ2aWNlU3RhdGUoUmVjb3JkIHIsIFNlcnZpY2VTdGF0ZSBzdGF0ZSkgeworICAgIHByaXZhdGUgdm9pZCBzZW5kU2VydmljZVN0YXRlKFJlY29yZCByLCBTZXJ2aWNlU3RhdGUgc3RhdGUpIHsKICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgIHIuY2FsbGJhY2sub25TZXJ2aWNlU3RhdGVDaGFuZ2VkKG5ldyBTZXJ2aWNlU3RhdGUoc3RhdGUpKTsKICAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGV4KSB7CkBAIC00NjAsMTEgKzQ5MCwxMCBAQAogICAgICAgICAgICAgcHcucHJpbnRsbigiICBtRGF0YUNvbm5lY3Rpb25Qb3NzaWJsZT0iICsgbURhdGFDb25uZWN0aW9uUG9zc2libGUpOwogICAgICAgICAgICAgcHcucHJpbnRsbigiICBtRGF0YUNvbm5lY3Rpb25SZWFzb249IiArIG1EYXRhQ29ubmVjdGlvblJlYXNvbik7CiAgICAgICAgICAgICBwdy5wcmludGxuKCIgIG1EYXRhQ29ubmVjdGlvbkFwbj0iICsgbURhdGFDb25uZWN0aW9uQXBuKTsKLSAgICAgICAgICAgIHB3LnByaW50bG4oIiAgbURhdGFDb25uZWN0aW9uSW50ZXJmYWNlTmFtZT0iICsgbURhdGFDb25uZWN0aW9uSW50ZXJmYWNlTmFtZSk7CisgICAgICAgICAgICBwdy5wcmludGxuKCIgIG1EYXRhQ29ubmVjdGlvblByb3BlcnRpZXM9IiArIG1EYXRhQ29ubmVjdGlvblByb3BlcnRpZXMpOwogICAgICAgICAgICAgcHcucHJpbnRsbigiICBtQ2VsbExvY2F0aW9uPSIgKyBtQ2VsbExvY2F0aW9uKTsKICAgICAgICAgICAgIHB3LnByaW50bG4oInJlZ2lzdHJhdGlvbnM6IGNvdW50PSIgKyByZWNvcmRDb3VudCk7Ci0gICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IHJlY29yZENvdW50OyBpKyspIHsKLSAgICAgICAgICAgICAgICBSZWNvcmQgciA9IG1SZWNvcmRzLmdldChpKTsKKyAgICAgICAgICAgIGZvciAoUmVjb3JkIHIgOiBtUmVjb3JkcykgewogICAgICAgICAgICAgICAgIHB3LnByaW50bG4oIiAgIiArIHIucGtnRm9yRGVidWcgKyAiIDB4IiArIEludGVnZXIudG9IZX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udGhpcyk7CiAKQEAgLTQwMywxNSArNDEwLDE2IEBACiAgICAgICAgICAgICAgICAgICAgIFIuaW50ZWdlci5jb25maWdfZGF0YXVzZV90aHJlc2hvbGRfYnl0ZXMpOwogICAgICAgICAgICAgaW50IGRlZmF1bHRWYWx1ZSA9IG1Db250ZXh0LmdldFJlc291cmNlcygpLmdldEludGVnZXIoCiAgICAgICAgICAgICAgICAgICAgIFIuaW50ZWdlci5jb25maWdfZGF0YXVzZV90aHJvdHRsZV9rYml0c3BzKTsKLSAgICAgICAgICAgIHN5bmNocm9uaXplZCAoVGhyb3R0bGVTZXJ2aWNlLnRoaXMpIHsKLSAgICAgICAgICAgICAgICBtUG9saWN5VGhyZXNob2xkID0gU2V0dGluZ3MuU2VjdXJlLmdldExvbmcobUNvbnRleHQuZ2V0Q29udGVudFJlc29sdmVyKCksCi0gICAgICAgICAgICAgICAgICAgICAgICBTZXR0aW5ncy5TZWN1cmUuVEhST1RUTEVfVEhSRVNIT0xEX0JZVEVTLCBkZWZhdWx0VGhyZXNob2xkKTsKLSAgICAgICAgICAgICAgICBtUG9saWN5VGhyb3R0bGVWYWx1ZSA9IFNldHRpbmdzLlNlY3VyZS5nZXRJbnQobUNvbnRleHQuZ2V0Q29udGVudFJlc29sdmVyKCksCi0gICAgICAgICAgICAgICAgICAgICAgICBTZXR0aW5ncy5TZWN1cmUuVEhST1RUTEVfVkFMVUVfS0JJVFNQUywgZGVmYXVsdFZhbHVlKTsKLSAgICAgICAgICAgICAgICBpZiAodGVzdGluZykgewotICAgICAgICAgICAgICAgICAgICBtUG9saWN5UG9sbFBlcmlvZFNlYyA9IFRFU1RJTkdfUE9MTElOR19QRVJJT0RfU0VDOwotICAgICAgICAgICAgICAgICAgICBtUG9saWN5VGhyZXNob2xkID0gVEVTVElOR19USFJFU0hPTEQ7Ci0gICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgbG9uZyB0aHJlc2hvbGQgPSBTZXR0aW5ncy5TZWN1cmUuZ2V0TG9uZyhtQ29udGV4dC5nZXRDb250ZW50UmVzb2x2ZXIoKSwKKyAgICAgICAgICAgICAgICAgICAgU2V0dGluZ3MuU2VjdXJlLlRIUk9UVExFX1RIUkVTSE9MRF9CWVRFUywgZGVmYXVsdFRocmVzaG9sZCk7CisgICAgICAgICAgICBpbnQgdmFsdWUgPSBTZXR0aW5ncy5TZWN1cmUuZ2V0SW50KG1Db250ZXh0LmdldENvbnRlbnRSZXNvbHZlcigpLAorICAgICAgICAgICAgICAgICAgICBTZXR0aW5ncy5TZWN1cmUuVEhST1RUTEVfVkFMVUVfS0JJVFNQUywgZGVmYXVsdFZhbHVlKTsKKworICAgICAgICAgICAgbVBvbGljeVRocmVzaG9sZC5zZXQodGhyZXNob2xkKTsKKyAgICAgICAgICAgIG1Qb2xpY3lUaHJvdHRsZVZhbHVlLnNldCh2YWx1ZSk7CisgICAgICAgICAgICBpZiAodGVzdGluZykgeworICAgICAgICAgICAgICAgIG1Qb2xpY3lQb2xsUGVyaW9kU2VjID0gVEVTVElOR19QT0xMSU5HX1BFUklPRF9TRUM7CisgICAgICAgICAgICAgICAgbVBvbGljeVRocmVzaG9sZC5zZXQoVEVTVElOR19USFJFU0hPTEQpOwogICAgICAgICAgICAgfQogCiAgICAgICAgICAgICBtUG9saWN5UmVzZXREYXkgPSBTZXR0aW5ncy5TZWN1cmUuZ2V0SW50KG1Db250ZXh0LmdldENvbnRlbnRSZXNvbHZlcigpLApAQCAtNDIzLDEwICs0MzEsOCBAQAogICAgICAgICAgICAgICAgIFNldHRpbmdzLlNlY3VyZS5wdXRJbnQobUNvbnRleHQuZ2V0Q29udGVudFJlc29sdmVyKCksCiAgICAgICAgICAgICAgICAgU2V0dGluZ3MuU2VjdXJlLlRIUk9UVExFX1JFU0VUX0RBWSwgbVBvbGljeVJlc2V0RGF5KTsKICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHN5bmNocm9uaXplZCAoVGhyb3R0bGVTZXJ2aWNlLnRoaXMpIHsKLSAgICAgICAgICAgICAgICBpZiAobUlmYWNlID09IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgbVBvbGljeVRocmVzaG9sZCA9IDA7Ci0gICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKG1JZmFjZSA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgbVBvbGljeVRocmVzaG9sZC5zZXQoMCk7CiAgICAgICAgICAgICB9CiAKICAgICAgICAgICAgIGludCBkZWZhdWx0Tm90aWZpY2F0aW9uVHlwZSA9IG1Db250ZXh0LmdldFJlc291cmNlcygpLmdldEludGVnZXIoCkBAIC00MzcsMTUgKzQ0MywxNiBAQAogICAgICAgICAgICAgbU1heE50cENhY2hlQWdlU2VjID0gU2V0dGluZ3MuU2VjdXJlLmdldEludChtQ29udGV4dC5nZXRDb250ZW50UmVzb2x2ZXIoKSwKICAgICAgICAgICAgICAgICAgICAgU2V0dGluZ3MuU2VjdXJlLlRIUk9UVExFX01BWF9OVFBfQ0FDSEVfQUdFX1NFQywgTUFYX05UUF9DQUNIRV9BR0VfU0VDKTsKIAotICAgICAgICAgICAgaWYgKFZEQkcgfHwgKG1Qb2xpY3lUaHJlc2hvbGQgIT0gMCkpIHsKKyAgICAgICAgICAgIGlmIChWREJHIHx8IChtUG9saWN5VGhyZXNob2xkLmdldCgpICE9IDApKSB7CiAgICAgICAgICAgICAgICAgU2xvZy5kKFRBRywgIm9uUG9saWN5Q2hhbmdlZCB0ZXN0aW5nPSIgKyB0ZXN0aW5nICsiLCBwZXJpb2Q9IiArCi0gICAgICAgICAgICAgICAgICAgICAgICBtUG9saWN5UG9sbFBlcmlvZFNlYyArICIsIHRocmVzaG9sZD0iICsgbVBvbGljeVRocmVzaG9sZCArICIsIHZhbHVlPSIgKwotICAgICAgICAgICAgICAgICAgICAgICAgbVBvbGljeVRocm90dGxlVmFsdWUgKyAiLCByZXNldERheT0iICsgbVBvbGljeVJlc2V0RGF5ICsgIiwgbm90ZVR5cGU9IiArCi0gICAgICAgICAgICAgICAgICAgICAgICBtUG9saWN5Tm90aWZpY2F0aW9uc0FsbG93ZWRNYXNrICsgIiwgbWF4TnRwQ2FjaGVBZ2U9IiArIG1NYXhOdHBDYWNoZUFnZVNlYyk7CisgICAgICAgICAgICAgICAgICAgICAgICBtUG9saWN5UG9sbFBlcmlvZFNlYyArICIsIHRocmVzaG9sZD0iICsgbVBvbGljeVRocmVzaG9sZC5nZXQoKSArCisgICAgICAgICAgICAgICAgICAgICAgICAiLCB2YWx1ZT0iICsgbVBvbGljeVRocm90dGxlVmFsdWUuZ2V0KCkgKyAiLCByZXNldERheT0iICsgbVBvbGljeVJlc2V0RGF5ICsKKyAgICAgICAgICAgICAgICAgICAgICAgICIsIG5vdGVUeXBlPSIgKyBtUG9saWN5Tm90aWZpY2F0aW9uc0FsbG93ZWRNYXNrICsgIiwgbWF4TnRwQ2FjaGVBZ2U9IiArCisgICAgICAgICAgICAgICAgICAgICAgICBtTWF4TnRwQ2FjaGVBZ2VTZWMpOwogICAgICAgICAgICAgfQogCiAgICAgICAgICAgICAvLyBmb3JjZSB1cGRhdGVzCi0gICAgICAgICAgICBtVGhyb3R0bGVJbmRleCA9IFRIUk9UVExFX0lOREVYX1VOSU5JVElBTElaRUQ7CisgICAgICAgICAgICBtVGhyb3R0bGVJbmRleC5zZXQoVEhST1RUTEVfSU5ERVhfVU5JTklUSUFMSVpFRCk7CiAKICAgICAgICAgICAgIG9uUmVzZXRBbGFybSgpOwogCkBAIC00ODcsNyArNDk0LDcgQEAKICAgICAgICAgICAgIGxvbmcgcGVyaW9kUnggPSBtUmVjb3JkZXIuZ2V0UGVyaW9kUngoMCk7CiAgICAgICAgICAgICBsb25nIHBlcmlvZFR4ID0gbVJlY29yZGVyLmdldFBlcmlvZFR4KDApOwogICAgICAgICAgICAgbG9uZyB0b3RhbCA9IHBlcmlvZFJ4ICsgcGVyaW9kVHg7Ci0gICAgICAgICAgICBpZiAoVkRCRyB8fCAobVBvbGljeVRocmVzaG9sZCAhPSAwKSkgeworICAgICAgICAgICAgaWYgKFZEQkcgfHwgKG1Qb2xpY3lUaHJlc2hvbGQuZ2V0KCkgIT0gMCkpIHsKICAgICAgICAgICAgICAgICBTbG9nLmQoVEFHLCAib25Qb2xsQWxhcm0gLSByb2FtaW5nID0iICsgcm9hbWluZyArCiAgICAgICAgICAgICAgICAgICAgICAgICAiLCByZWFkID0iICsgaW5jUmVhZCArICIsIHdyaXR0ZW4gPSIgKyBpbmNXcml0ZSArICIsIG5ldyB0b3RhbCA9IiArIHRvdGFsKTsKICAgICAgICAgICAgIH0KQEAgLTUxMCwxMSArNTE3LDExIEBACiAgICAgICAgIHByaXZhdGUgdm9pZCBvbklmYWNlVXAoKSB7CiAgICAgICAgICAgICAvLyBpZiB3ZSB3ZXJlIHRocm90dGxlZCBiZWZvcmUsIGJlIHN1cmUgYW5kIHNldCBpdCBhZ2FpbiAtIHRoZSBpZmFjZSB3ZW50IGRvd24KICAgICAgICAgICAgIC8vIChhbmQgbWF5IGhhdmUgZGlzYXBwZWFyZWQgYWxsIHRvZ2V0aGVyKSBhbmQgdGhlc2Ugc2V0dGluZ3Mgd2VyZSBsb3N0Ci0gICAgICAgICAgICBpZiAobVRocm90dGxlSW5kZXggPT0gMSkgeworICAgICAgICAgICAgaWYgKG1UaHJvdHRsZUluZGV4LmdldCgpID09IDEpIHsKICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICBtTk1TZXJ2aWNlLnNldEludGVyZmFjZVRocm90dGxlKG1JZmFjZSwgLTEsIC0xKTsKICAgICAgICAgICAgICAgICAgICAgbU5NU2VydmljZS5zZXRJbnRlcmZhY2VUaHJvdHRsZShtSWZhY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgbVBvbGljeVRocm90dGxlVmFsdWUsIG1Qb2xpY3lUaHJvdHRsZVZhbHVlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBtUG9saWN5VGhyb3R0bGVWYWx1ZS5nZXQoKSwgbVBvbGljeVRocm90dGxlVmFsdWUuZ2V0KCkpOwogICAgICAgICAgICAgICAgIH0gY2F0Y2ggKEV4Y2VwdGlvbiBlKSB7CiAgICAgICAgICAgICAgICAgICAgIFNsb2cuZShUQUcsICJlcnJvciBzZXR0aW5nIFRocm90dGxlOiAiICsgZSk7CiAgICAgICAgICAgICAgICAgfQpAQCAtNTIzLDcgKzUzMCw4IEBACiAKICAgICAgICAgcHJpdmF0ZSB2b2lkIGNoZWNrVGhyb3R0bGVBbmRQb3N0Tm90aWZpY2F0aW9uKGxvbmcgY3VycmVudFRvdGFsKSB7CiAgICAgICAgICAgICAvLyBpcyB0aHJvdHRsaW5nIGVuYWJsZWQ/Ci0gICAgICAgICAgICBpZiAobVBvbGljeVRocmVzaG9sZCA9PSAwKSB7CisgICAgICAgICAgICBsb25nIHRocmVzaG9sZCA9IG1Qb2xpY3lUaHJlc2hvbGQuZ2V0KCk7CisgICAgICAgICAgICBpZiAodGhyZXNob2xkID09IDApIHsKICAgICAgICAgICAgICAgICBjbGVhclRocm90dGxlQW5kTm90aWZpY2F0aW9uKCk7CiAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgfQpAQCAtNTM1LDE1ICs1NDMsMTMgQEAKICAgICAgICAgICAgIH0KIAogICAgICAgICAgICAgLy8gY2hlY2sgaWYgd2UgbmVlZCB0byB0aHJvdHRsZQotICAgICAgICAgICAgaWYgKGN1cnJlbnRUb3RhbCA+IG1Qb2xpY3lUaHJlc2hvbGQpIHsKLSAgICAgICAgICAgICAgICBpZiAobVRocm90dGxlSW5kZXggIT0gMSkgewotICAgICAgICAgICAgICAgICAgICBzeW5jaHJvbml6ZWQgKFRocm90dGxlU2VydmljZS50aGlzKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBtVGhyb3R0bGVJbmRleCA9IDE7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgaWYgKERCRykgU2xvZy5kKFRBRywgIlRocmVzaG9sZCAiICsgbVBvbGljeVRocmVzaG9sZCArICIgZXhjZWVkZWQhIik7CisgICAgICAgICAgICBpZiAoY3VycmVudFRvdGFsID4gdGhyZXNob2xkKSB7CisgICAgICAgICAgICAgICAgaWYgKG1UaHJvdHRsZUluZGV4LmdldCgpICE9IDEpIHsKKyAgICAgICAgICAgICAgICAgICAgbVRocm90dGxlSW5kZXguc2V0KDEpOworICAgICAgICAgICAgICAgICAgICBpZiAoREJHKSBTbG9nLmQoVEFHLCAiVGhyZXNob2xkICIgKyB0aHJlc2hvbGQgKyAiIGV4Y2VlZGVkISIpOwogICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgbU5NU2VydmljZS5zZXRJbnRlcmZhY2VUaHJvdHRsZShtSWZhY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1Qb2xpY3lUaHJvdHRsZVZhbHVlLCBtUG9saWN5VGhyb3R0bGVWYWx1ZSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1Qb2xpY3lUaHJvdHRsZVZhbHVlLmdldCgpLCBtUG9saWN5VGhyb3R0bGVWYWx1ZS5nZXQoKSk7CiAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKEV4Y2VwdGlvbiBlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBTbG9nLmUoVEFHLCAiZXJyb3Igc2V0dGluZyBUaHJvdHRsZTogIiArIGUpOwogICAgICAgICAgICAgICAgICAgICB9CkBAIC01NTYsNyArNTYyLDggQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBOb3RpZmljYXRpb24uRkxBR19PTkdPSU5HX0VWRU5UKTsKIAogICAgICAgICAgICAgICAgICAgICBJbnRlbnQgYnJvYWRjYXN0ID0gbmV3IEludGVudChUaHJvdHRsZU1hbmFnZXIuVEhST1RUTEVfQUNUSU9OKTsKLSAgICAgICAgICAgICAgICAgICAgYnJvYWRjYXN0LnB1dEV4dHJhKFRocm90dGxlTWFuYWdlci5FWFRSQV9USFJPVFRMRV9MRVZFTCwgbVBvbGljeVRocm90dGxlVmFsdWUpOworICAgICAgICAgICAgICAgICAgICBicm9hZGNhc3QucHV0RXh0cmEoVGhyb3R0bGVNYW5hZ2VyLkVYVFJBX1RIUk9UVExFX0xFVkVMLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1Qb2xpY3lUaHJvdHRsZVZhbHVlLmdldCgpKTsKICAgICAgICAgICAgICAgICAgICAgbUNvbnRleHQuc2VuZFN0aWNreUJyb2FkY2FzdChicm9hZGNhc3QpOwogCiAgICAgICAgICAgICAgICAgfSAvLyBlbHNlIGFscmVhZHkgdXAhCkBAIC01NzksOCArNTg2LDggQEAKICAgICAgICAgICAgICAgICAgICAgbG9uZyBwZXJpb2RMZW5ndGggPSBlbmQgLSBzdGFydDsKICAgICAgICAgICAgICAgICAgICAgbG9uZyBub3cgPSBTeXN0ZW0uY3VycmVudFRpbWVNaWxsaXMoKTsKICAgICAgICAgICAgICAgICAgICAgbG9uZyB0aW1lVXNlZCA9IG5vdyAtIHN0YXJ0OwotICAgICAgICAgICAgICAgICAgICBsb25nIHdhcm5pbmdUaHJlc2hvbGQgPSAyKm1Qb2xpY3lUaHJlc2hvbGQqdGltZVVzZWQvKHRpbWVVc2VkK3BlcmlvZExlbmd0aCk7Ci0gICAgICAgICAgICAgICAgICAgIGlmICgoY3VycmVudFRvdGFsID4gd2FybmluZ1RocmVzaG9sZCkgJiYgKGN1cnJlbnRUb3RhbCA+IG1Qb2xpY3lUaHJlc2hvbGQvNCkpIHsKKyAgICAgICAgICAgICAgICAgICAgbG9uZyB3YXJuaW5nVGhyZXNob2xkID0gMip0aHJlc2hvbGQqdGltZVVzZWQvKHRpbWVVc2VkK3BlcmlvZExlbmd0aCk7CisgICAgICAgICAgICAgICAgICAgIGlmICgoY3VycmVudFRvdGFsID4gd2FybmluZ1RocmVzaG9sZCkgJiYgKGN1cnJlbnRUb3RhbCA+IHRocmVzaG9sZC80KSkgewogICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1XYXJuaW5nTm90aWZpY2F0aW9uU2VudCA9PSBmYWxzZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1XYXJuaW5nTm90aWZpY2F0aW9uU2VudCA9IHRydWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbU5vdGlmaWNhdGlvbk1hbmFnZXIuY2FuY2VsKFIuZHJhd2FibGUuc3RhdF9zeXNfdGhyb3R0bGVkKTsKQEAgLTYyNSwxMSArNjMyLDkgQEAKICAgICAgICAgfQogCiAKLSAgICAgICAgcHJpdmF0ZSBzeW5jaHJvbml6ZWQgdm9pZCBjbGVhclRocm90dGxlQW5kTm90aWZpY2F0aW9uKCkgewotICAgICAgICAgICAgaWYgKG1UaHJvdHRsZUluZGV4ICE9IFRIUk9UVExFX0lOREVYX1VOVEhST1RUTEVEKSB7Ci0gICAgICAgICAgICAgICAgc3luY2hyb25pemVkIChUaHJvdHRsZVNlcnZpY2UudGhpcykgewotICAgICAgICAgICAgICAgICAgICBtVGhyb3R0bGVJbmRleCA9IFRIUk9UVExFX0lOREVYX1VOVEhST1RUTEVEOwotICAgICAgICAgICAgICAgIH0KKyAgICAgICAgcHJpdmF0ZSB2b2lkIGNsZWFyVGhyb3R0bGVBbmROb3RpZmljYXRpb24oKSB7CisgICAgICAgICAgICBpZiAobVRocm90dGxlSW5kZXguZ2V0KCkgIT0gVEhST1RUTEVfSU5ERVhfVU5USFJPVFRMRUQpIHsKKyAgICAgICAgICAgICAgICBtVGhyb3R0bGVJbmRleC5zZXQoVEhST1RUTEVfSU5ERVhfVU5USFJPVFRMRUQpOwogICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgIG1OTVNlcnZpY2Uuc2V0SW50ZXJmYWNlVGhyb3R0bGUobUlmYWNlLCAtMSwgLTEpOwogICAgICAgICAgICAgICAgIH0gY2F0Y2ggKEV4Y2VwdGlvbiBlKSB7CkBAIC02ODcsMTIgKzY5MiwxMiBAQAogICAgICAgICB9CiAKICAgICAgICAgcHJpdmF0ZSB2b2lkIG9uUmVzZXRBbGFybSgpIHsKLSAgICAgICAgICAgIGlmIChWREJHIHx8IChtUG9saWN5VGhyZXNob2xkICE9IDApKSB7CisgICAgICAgICAgICBpZiAoVkRCRyB8fCAobVBvbGljeVRocmVzaG9sZC5nZXQoKSAhPSAwKSkgewogICAgICAgICAgICAgICAgIFNsb2cuZChUQUcsICJvblJlc2V0QWxhcm0gLSBsYXN0IHBlcmlvZCBoYWQgIiArIG1SZWNvcmRlci5nZXRQZXJpb2RSeCgwKSArCiAgICAgICAgICAgICAgICAgICAgICAgICAiIGJ5dGVzIHJlYWQgYW5kICIgKyBtUmVjb3JkZXIuZ2V0UGVyaW9kVHgoMCkgKyAiIHdyaXR0ZW4iKTsKICAgICAgICAgICAgIH0KIAotICAgICAgICAgICAgbG9uZyBub3cgPSBnZXRCZXN0VGltZSgpOworICAgICAgICAgICAgbG9uZyBub3cgPSBnZXRCZXN0VGltZShmYWxzZSk7CiAKICAgICAgICAgICAgIGlmIChtTnRwQWN0aXZlIHx8IChtTnRwU2VydmVyID09IG51bGwpKSB7CiAgICAgICAgICAgICAgICAgQ2FsZW5kYXIgZW5kID0gY2FsY3VsYXRlUGVyaW9kRW5kKG5vdyk7CkBAIC03MTksMjAgKzcyNCwyMyBAQAogCiAgICAgICAgIC8vIHdpbGwgdHJ5IHRvIGdldCB0aGUgbnRwIHRpbWUgYW5kIHN3aXRjaCB0byBpdCBpZiBmb3VuZC4KICAgICAgICAgLy8gd2lsbCBhbHNvIGNhY2hlIHRoZSB0aW1lIHNvIHdlIGRvbid0IGZldGNoIGl0IHJlcGVhdGVkbHkuCi0gICAgICAgIGdldEJlc3RUaW1lKCk7CisgICAgICAgIGdldEJlc3RUaW1lKGZhbHNlKTsKICAgICB9CiAKICAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgTUFYX05UUF9DQUNIRV9BR0VfU0VD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IGZhc3QpIHsKICAgICAgICAgICAgICAgICAgICAgaWYgKFZEQkcpIFNsb2cudihUQUcsICJ1c2luZyBjYWNoZWQgdGltZSIpOwogICAgICAgICAgICAgICAgICAgICByZXR1cm4gY2FjaGVkTnRwICsgbnRwQWdlOwogICAgICAgICAgICAgICAgIH0KQEAgLTEwMjUsMzkgKzEwMzMsNTcgQEAKICAgICAgICAgICAgICAgICBpZiAoREJHKSBTbG9nLmQoVEFHLCAiZGF0YSBmaWxlIGVtcHR5Iik7CiAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgfQotICAgICAgICAgICAgc3luY2hyb25pemVkIChtUGFyZW50KSB7Ci0gICAgICAgICAgICAgICAgU3RyaW5nW10gcGFyc2VkID0gZGF0YS5zcGxpdCgiOiIpOwotICAgICAgICAgICAgICAgIGludCBwYXJzZWRVc2VkID0gMDsKLSAgICAgICAgICAgICAgICBpZiAocGFyc2VkLmxlbmd0aCA8IDYpIHsKLSAgICAgICAgICAgICAgICAgICAgU2xvZy5lKFRBRywgInJlYWRpbmcgZGF0YSBmaWxlIHdpdGggaW5zdWZmaWNpZW50IGxlbmd0aCAtIGlnbm9yaW5nIik7Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICBTdHJpbmdbXSBwYXJzZWQgPSBkYXRhLnNwbGl0KCI6Iik7CisgICAgICAgICAgICBpbnQgcGFyc2VkVXNlZCA9IDA7CisgICAgICAgICAgICBpZiAocGFyc2VkLmxlbmd0aCA8IDYpIHsKKyAgICAgICAgICAgICAgICBTbG9nLmUoVEFHLCAicmVhZGluZyBkYXRhIGZpbGUgd2l0aCBpbnN1ZmZpY2llbnQgbGVuZ3RoIC0gaWdub3JpbmciKTsKKyAgICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgICAgICB9CiAKKyAgICAgICAgICAgIGludCBwZXJpb2RDb3VudDsKKyAgICAgICAgICAgIGxvbmdbXSBwZXJpb2RSeERhdGE7CisgICAgICAgICAgICBsb25nW10gcGVyaW9kVHhEYXRhOworICAgICAgICAgICAgaW50IGN1cnJlbnRQZXJpb2Q7CisgICAgICAgICAgICBDYWxlbmRhciBwZXJpb2RTdGFydDsKKyAgICAgICAgICAgIENhbGVuZGFyIHBlcmlvZEVuZDsKKyAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgaWYgKEludGVnZXIucGFyc2VJbnQocGFyc2VkW3BhcnNlZFVzZWQrK10pICE9IERBVEFfRklMRV9WRVJTSU9OKSB7CiAgICAgICAgICAgICAgICAgICAgIFNsb2cuZShUQUcsICJyZWFkaW5nIGRhdGEgZmlsZSB3aXRoIGJhZCB2ZXJzaW9uIC0gaWdub3JpbmciKTsKICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgIH0KIAotICAgICAgICAgICAgICAgIG1QZXJpb2RDb3VudCA9IEludGVnZXIucGFyc2VJbnQocGFyc2VkW3BhcnNlZFVzZWQrK10pOwotICAgICAgICAgICAgICAgIGlmIChwYXJzZWQubGVuZ3RoICE9IDUgKyAoMiAqIG1QZXJpb2RDb3VudCkpIHsKKyAgICAgICAgICAgICAgICBwZXJpb2RDb3VudCA9IEludGVnZXIucGFyc2VJbnQocGFyc2VkW3BhcnNlZFVzZWQrK10pOworICAgICAgICAgICAgICAgIGlmIChwYXJzZWQubGVuZ3RoICE9IDUgKyAoMiAqIHBlcmlvZENvdW50KSkgewogICAgICAgICAgICAgICAgICAgICBTbG9nLmUoVEFHLCAicmVhZGluZyBkYXRhIGZpbGUgd2l0aCBiYWQgbGVuZ3RoICgiICsgcGFyc2VkLmxlbmd0aCArCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgIiAhPSAiICsgKDUrKDIqbVBlcmlvZENvdW50KSkgKyAiKSAtIGlnbm9yaW5nIik7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIiAhPSAiICsgKDUgKyAoMiAqIHBlcmlvZENvdW50KSkgKyAiKSAtIGlnbm9yaW5nIik7CiAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgcGVyaW9kUnhEYXRhID0gbmV3IGxvbmdbcGVyaW9kQ291bnRdOworICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgcGVyaW9kQ291bnQ7IGkrKykgeworICAgICAgICAgICAgICAgICAgICBwZXJpb2RSeERhdGFbaV0gPSBMb25nLnBhcnNlTG9uZyhwYXJzZWRbcGFyc2VkVXNlZCsrXSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHBlcmlvZFR4RGF0YSA9IG5ldyBsb25nW3BlcmlvZENvdW50XTsKKyAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IHBlcmlvZENvdW50OyBpKyspIHsKKyAgICAgICAgICAgICAgICAgICAgcGVyaW9kVHhEYXRhW2ldID0gTG9uZy5wYXJzZUxvbmcocGFyc2VkW3BhcnNlZFVzZWQrK10pOworICAgICAgICAgICAgICAgIH0KIAotICAgICAgICAgICAgICAgIG1QZXJpb2RSeERhdGEgPSBuZXcgbG9uZ1ttUGVyaW9kQ291bnRdOwotICAgICAgICAgICAgICAgIGZvcihpbnQgaSA9IDA7IGkgPCBtUGVyaW9kQ291bnQ7IGkrKykgewotICAgICAgICAgICAgICAgICAgICBtUGVyaW9kUnhEYXRhW2ldID0gTG9uZy5wYXJzZUxvbmcocGFyc2VkW3BhcnNlZFVzZWQrK10pOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBtUGVyaW9kVHhEYXRhID0gbmV3IGxvbmdbbVBlcmlvZENvdW50XTsKLSAgICAgICAgICAgICAgICBmb3IoaW50IGkgPSAwOyBpIDwgbVBlcmlvZENvdW50OyBpKyspIHsKLSAgICAgICAgICAgICAgICAgICAgbVBlcmlvZFR4RGF0YVtpXSA9IExvbmcucGFyc2VMb25nKHBhcnNlZFtwYXJzZWRVc2VkKytdKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgbUN1cnJlbnRQZXJpb2QgPSBJbnRlZ2VyLnBhcnNlSW50KHBhcnNlZFtwYXJzZWRVc2VkKytdKTsKLSAgICAgICAgICAgICAgICBtUGVyaW9kU3RhcnQgPSBuZXcgR3JlZ29yaWFuQ2FsZW5kYXIoKTsKLSAgICAgICAgICAgICAgICBtUGVyaW9kU3RhcnQuc2V0VGltZUluTWlsbGlzKExvbmcucGFyc2VMb25nKHBhcnNlZFtwYXJzZWRVc2VkKytdKSk7Ci0gICAgICAgICAgICAgICAgbVBlcmlvZEVuZCA9IG5ldyBHcmVnb3JpYW5DYWxlbmRhcigpOwotICAgICAgICAgICAgICAgIG1QZXJpb2RFbmQuc2V0VGltZUluTWlsbGlzKExvbmcucGFyc2VMb25nKHBhcnNlZFtwYXJzZWRVc2VkKytdKSk7CisgICAgICAgICAgICAgICAgY3VycmVudFBlcmlvZCA9IEludGVnZXIucGFyc2VJbnQocGFyc2VkW3BhcnNlZFVzZWQrK10pOworCisgICAgICAgICAgICAgICAgcGVyaW9kU3RhcnQgPSBuZXcgR3JlZ29yaWFuQ2FsZW5kYXIoKTsKKyAgICAgICAgICAgICAgICBwZXJpb2RTdGFydC5zZXRUaW1lSW5NaWxsaXMoTG9uZy5wYXJzZUxvbmcocGFyc2VkW3BhcnNlZFVzZWQrK10pKTsKKyAgICAgICAgICAgICAgICBwZXJpb2RFbmQgPSBuZXcgR3JlZ29yaWFuQ2FsZW5kYXIoKTsKKyAgICAgICAgICAgICAgICBwZXJpb2RFbmQuc2V0VGltZUluTWlsbGlzKExvbmcucGFyc2VMb25nKHBhcnNlZFtwYXJzZWRVc2VkKytdKSk7CisgICAgICAgICAgICB9IGNhdGNoIChFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgIFNsb2cuZShUQUcsICJFcnJvciBwYXJzaW5nIGRhdGEgZmlsZSAtIGlnbm9yaW5nIik7CisgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgfQorICAgICAgICAgICAgc3luY2hyb25pemVkIChtUGFyZW50KSB7CisgICAgICAgICAgICAgICAgbVBlcmlvZENvdW50ID0gcGVyaW9kQ291bnQ7CisgICAgICAgICAgICAgICAgbVBlcmlvZFJ4RGF0YSA9IHBlcmlvZFJ4RGF0YTsKKyAgICAgICAgICAgICAgICBtUGVyaW9kVHhEYXRhID0gcGVyaW9kVHhEYXRhOworICAgICAgICAgICAgICAgIG1DdXJyZW50UGVyaW9kID0gY3VycmVudFBlcmlvZDsKKyAgICAgICAgICAgICAgICBtUGVyaW9kU3RhcnQgPSBwZXJpb2RTdGFydDsKKyAgICAgICAgICAgICAgICBtUGVyaW9kRW5kID0gcGVyaW9kRW5kOwogICAgICAgICAgICAgfQogICAgICAgICB9CiAKQEAgLTEwOTEsMTUgKzExMTcsMTUgQEAKICAgICAgICAgfQogICAgICAgICBwdy5wcmludGxuKCk7CiAKLSAgICAgICAgcHcucHJpbnRsbigiVGhlIHRocmVzaG9sZCBpcyAiICsgbVBvbGljeVRocmVzaG9sZCArCisgICAgICAgIHB3LnByaW50bG4oIlRoZSB0aHJlc2hvbGQgaXMgIiArIG1Qb2xpY3lUaHJlc2hvbGQuZ2V0KCkgKwogICAgICAgICAgICAgICAgICIsIGFmdGVyIHdoaWNoIHlvdSBleHBlcmluY2UgdGhyb3R0bGluZyB0byAiICsKLSAgICAgICAgICAgICAgICBtUG9saWN5VGhyb3R0bGVWYWx1ZSArICJrYnBzIik7CisgICAgICAgICAgICAgICAgbVBvbGljeVRocm90dGxlVmFsdWUuZ2V0KCkgKyAia2JwcyIpOwogICAgICAgICBwdy5wcmludGxuKCJDdXJyZW50IHBlcmlvZCBpcyAiICsKICAgICAgICAgICAgICAgICAobVJlY29yZGVyLmdldFBlcmlvZEVuZCgpIC0gbVJlY29yZGVyLmdldFBlcmlvZFN0YXJ0KCkpLzEwMDAgKyAiIHNlY29uZHMgbG9uZyAiICsKICAgICA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bmcgIiArIGludGVudCk7CisgICAgICAgIG1Db250ZXh0LnNlbmRCcm9hZGNhc3QoaW50ZW50KTsKKyAgICB9CisKKyAgICBwcml2YXRlIHZvaWQgaW5pdEhvc3RTdXBwb3J0KCkgeworICAgICAgICAvLyBDcmVhdGUgYSB0aHJlYWQgdG8gY2FsbCBpbnRvIG5hdGl2ZSBjb2RlIHRvIHdhaXQgZm9yIFVTQiBob3N0IGV2ZW50cy4KKyAgICAgICAgLy8gVGhpcyB0aHJlYWQgd2lsbCBjYWxsIHVzIGJhY2sgb24gdXNiQ2FtZXJhQWRkZWQgYW5kIHVzYkNhbWVyYVJlbW92ZWQuCisgICAgICAgIFJ1bm5hYmxlIHJ1bm5hYmxlID0gbmV3IFJ1bm5hYmxlKCkgeworICAgICAgICAgICAgcHVibGljIHZvaWQgcnVuKCkgeworICAgICAgICAgICAgICAgIG1vbml0b3JVc2JIb3N0QnVzKCk7CisgICAgICAgICAgICB9CisgICAgICAgIH07CisgICAgICAgIG5ldyBUaHJlYWQobnVsbCwgcnVubmFibGUsICJVc2JPYnNlcnZlciBob3N0IHRocmVhZCIpLnN0YXJ0KCk7CisgICAgfQorCiAgICAgdm9pZCBzeXN0ZW1SZWFkeSgpIHsKICAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CisgICAgICAgICAgICBpZiAobUNvbnRleHQuZ2V0UmVzb3VyY2VzKCkuZ2V0Qm9vbGVhbigKKyAgICAgICAgICAgICAgICAgICAgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5ib29sLmNvbmZpZ19oYXNVc2JIb3N0U3VwcG9ydCkpIHsKKyAgICAgICAgICAgICAgICAvLyBzdGFydCBtb25pdG9yaW5nIGZvciBjb25uZWN0ZWQgVVNCIGRldmljZXMKKyAgICAgICAgICAgICAgICBpbml0SG9zdFN1cHBvcnQoKTsKKyAgICAgICAgICAgIH0KKwogICAgICAgICAgICAgdXBkYXRlKCk7CiAgICAgICAgICAgICBtU3lzdGVtUmVhZHkgPS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AgICAgICAgICAgICAgICAgQE92ZXJyaWRlCisgICAgICAgICAgICAgICAgICAgIHB1YmxpYyB2b2lkIG9uUmVjZWl2ZShDb250ZXh0IGNvbnRleHQsIEludGVudCBpbnRlbnQpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpbnRlbnQuZ2V0QWN0aW9uKCkuZXF1YWxzKFdpZmlNYW5hZ2VyLldJRklfU1RBVEVfQ0hBTkdFRF9BQ1RJT04pKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gcmVzZXQgJiBjbGVhciBub3RpZmljYXRpb24gb24gYW55IHdpZmkgc3RhdGUgY2hhbmdlCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzZXROb3RpZmljYXRpb24oKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoaW50ZW50LmdldEFjdGlvbigpLmVxdWFscygKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgV2lmaU1hbmFnZXIuTkVUV09SS19TVEFURV9DSEFOR0VEX0FDVElPTikpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBtTmV0d29ya0luZm8gPSAoTmV0d29ya0luZm8pIGludGVudC5nZXRQYXJjZWxhYmxlRXh0cmEoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBXaWZpTWFuYWdlci5FWFRSQV9ORVRXT1JLX0lORk8pOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHJlc2V0ICYgY2xlYXIgbm90aWZpY2F0aW9uIG9uIGEgbmV0d29yayBjb25uZWN0ICYgZGlzY29ubmVjdAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaChtTmV0d29ya0luZm8uZ2V0RGV0YWlsZWRTdGF0ZSgpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgQ09OTkVDVEVEOgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIERJU0NPTk5FQ1RFRDoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc2V0Tm90aWZpY2F0aW9uKCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGludGVudC5nZXRBY3Rpb24oKS5lcXVhbHMoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFdpZmlNYW5hZ2VyLlNDQU5fUkVTVUxUU19BVkFJTEFCTEVfQUNUSU9OKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoZWNrQW5kU2V0Tm90aWZpY2F0aW9uKCk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9LCBmaWx0ZXIpOworCisgICAgICAgIC8vIFNldHRpbmcgaXMgaW4gc2Vjb25kcworICAgICAgICBOT1RJRklDQVRJT05fUkVQRUFUX0RFTEFZX01TID0gU2V0dGluZ3MuU2VjdXJlLmdldEludChjb250ZXh0LmdldENvbnRlbnRSZXNvbHZlcigpLAorICAgICAgICAgICAgICAgIFNldHRpbmdzLlNlY3VyZS5XSUZJX05FVFdPUktTX0FWQUlMQUJMRV9SRVBFQVRfREVMQVksIDkwMCkgKiAxMDAwbDsKKyAgICAgICAgbU5vdGlmaWNhdGlvbkVuYWJsZWRTZXR0aW5nT2JzZXJ2ZXIgPSBuZXcgTm90aWZpY2F0aW9uRW5hYmxlZFNldHRpbmdPYnNlcnZlcihuZXcgSGFuZGxlcigpKTsKKyAgICAgICAgbU5vdGlmaWNhdGlvbkVuYWJsZWRTZXR0aW5nT2JzZXJ2ZXIucmVnaXN0ZXIoKTsKICAgICB9CiAKICAgICAvKioKQEAgLTI3OCw3ICsyNjgsNyBAQAogICAgICAqCiAgICAgICogVGhpcyBmdW5jdGlvbiBpcyB1c2VkIG9ubHkgY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ZSkgewpAQCAtMzE1LDE3ICszMDgsMTQgQEAKICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoRXhjZXB0aW9uIGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgIFNsb2cuZShUQUcsICJFcnJvciBjb25maWd1cmluZyBpbnRlcmZhY2UgIiArIGludGYgKyAiLCA6IiArIGUpOwotICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBud1NlcnZpY2Uuc3RvcEFjY2Vzc1BvaW50KCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChFeGNlcHRpb24gZWUpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBTbG9nLmUoVEFHLCAiQ291bGQgbm90IHN0b3AgQVAsIDoiICsgZWUpOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgc2V0V2lmaUFwRW5hYmxlZFN0YXRlKFdJRklfQVBfU1RBVEVfRkFJTEVELCAwLCBEcml2ZXJBY3Rpb24uRFJJVkVSX1VOTE9BRCk7CisgICAgICAgICAgICAgICAgICAgICAgICBzZXRXaWZpQXBFbmFibGVkKG51bGwsIGZhbHNlKTsKICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgICAgICAgfQogCiAgICAgICAgICAgICAgICAgICAgIGlmKG1DbS50ZXRoZXIoaW50ZikgIT0gQ29ubmVjdGl2aXR5TWFuYWdlci5URVRIRVJfRVJST1JfTk9fRVJST1IpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIFNsb2cuZShUQUcsICJFcnJvciB0ZXRoZXJpbmcgIitpbnRmKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIFNsb2cuZShUQUcsICJFcnJvciB0ZXRoZXJpbmcgb24gIiArIGludGYpOworICAgICAgICAgICAgICAgICAgICAgICAgc2V0V2lmaUFwRW5hYmxlZChudWxsLCBmYWxzZSk7CisgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgfQpAQCAtMzYxLDE5MCArMzUxLDIxIEBACiAgICAgICAgIFNldHRpbmdzLlNlY3VyZS5wdXRJbnQoY3IsIFNldHRpbmdzLlNlY3VyZS5XSUZJX09OLCBlbmFibGVkID8gMSA6IDApOwogICAgIH0KIAotICAgIE5ldHdvcmtTdGF0ZVRyYWNrZXIgZ2V0TmV0d29ya1N0YXRlVHJhY2tlcigpIHsKLSAgICAgICAgcmV0dXJuIG1XaWZpU3RhdGVUcmFja2VyOwotICAgIH0KLQogICAgIC8qKgogICAgICAqIHNlZSB7QGxpbmsgYW5kcm9pZC5uZXQud2lmaS5XaWZpTWFuYWdlciNwaW5nU3VwcGxpY2FudCgpfQotICAgICAqIEByZXR1cm4ge0Bjb2RlIHRydWV9IGlmIHRoZSBvcGVyYXRpb24gc3VjY2VlZHMKKyAgICAgKiBAcmV0dXJuIHtAY29kZSB0cnVlfSBpZiB0aGUgb3BlcmF0aW9uIHN1Y2NlZWRzLCB7QGNvZGUgZmFsc2V9IG90aGVyd2lzZQogICAgICAqLwogICAgIHB1YmxpYyBib29sZWFuIHBpbmdTdXBwbGljYW50KCkgewotICAgICAgICBlbmZvcmNlQ2hhbmdlUGVybWlzc2lvbigpOwotCi0gICAgICAgIHJldHVybiBtV2lmaVN0YXRlVHJhY2tlci5waW5nKCk7CisgICAgICAgIGVuZm9yY2VBY2Nlc3NQZXJtaXNzaW9uKCk7CisgICAgICAgIHJldHVybiBtV2lmaVN0YXRlTWFjaGluZS5waW5nU3VwcGxpY2FudCgpOwogICAgIH0KIAogICAgIC8qKgogICAgICAqIHNlZSB7QGxpbmsgYW5kcm9pZC5uZXQud2lmaS5XaWZpTWFuYWdlciNzdGFydFNjYW4oKX0KLSAgICAgKiBAcm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dGF0ZShXSUZJX1NUQVRFX1VOS05PV04sIHVpZCk7Ci0gICAgICAgICAgICByZXR1cm4gZmFsc2U7Ci0gICAgICAgIH0KLQotICAgICAgICBzZXRXaWZpRW5hYmxlZFN0YXRlKGVuYWJsZSA/IFdJRklfU1RBVEVfRU5BQkxJTkcgOiBXSUZJX1NUQVRFX0RJU0FCTElORywgdWlkKTsKLQotICAgICAgICBpZiAoZW5hYmxlKSB7Ci0gICAgICAgICAgICBpZiAoIW1XaWZpU3RhdGVUcmFja2VyLmxvYWREcml2ZXIoKSkgewotICAgICAgICAgICAgICAgIFNsb2cuZShUQUcsICJGYWlsZWQgdG8gbG9hZCBXaS1GaSBkcml2ZXIuIik7Ci0gICAgICAgICAgICAgICAgc2V0V2lmaUVuYWJsZWRTdGF0ZShXSUZJX1NUQVRFX1VOS05PV04sIHVpZCk7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKCFtV2lmaVN0YXRlVHJhY2tlci5zdGFydFN1cHBsaWNhbnQoKSkgewotICAgICAgICAgICAgICAgIG1XaWZpU3RhdGVUcmFja2VyLnVubG9hZERyaXZlcigpOwotICAgICAgICAgICAgICAgIFNsb2cuZShUQUcsICJGYWlsZWQgdG8gc3RhcnQgc3VwcGxpY2FudCBkYWVtb24uIik7Ci0gICAgICAgICAgICAgICAgc2V0V2lmaUVuYWJsZWRTdGF0ZShXSUZJX1NUQVRFX1VOS05PV04sIHVpZCk7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICByZWdpc3RlckZvckJyb2FkY2FzdHMoKTsKLSAgICAgICAgICAgIG1XaWZpU3RhdGVUcmFja2VyLnN0YXJ0RXZlbnRMb29wKCk7Ci0KLSAgICAgICAgfSBlbHNlIHsKLQotICAgICAgICAgICAgbUNvbnRleHQudW5yZWdpc3RlclJlY2VpdmVyKG1SZWNlaXZlcik7Ci0gICAgICAgICAgIC8vIFJlbW92ZSBub3RpZmljYXRpb24gKGl0IHdpbGwgbm8tb3AgaWYgaXQgaXNuJ3QgdmlzaWJsZSkKLSAgICAgICAgICAgIG1XaWZpU3RhdGVUcmFja2VyLnNldE5vdGlmaWNhdGlvblZpc2libGUoZmFsc2UsIDAsIGZhbHNlLCAwKTsKLQotICAgICAgICAgICAgYm9vbGVhbiBmYWlsZWRUb1N0b3BTdXBwbGljYW50T3JVbmxvYWREcml2ZXIgPSBmYWxzZTsKLQotICAgICAgICAgICAgaWYgKCFtV2lmaVN0YXRlVHJhY2tlci5zdG9wU3VwcGxpY2FudCgpKSB7Ci0gICAgICAgICAgICAgICAgU2xvZy5lKFRBRywgIkZhaWxlZCB0byBzdG9wIHN1cHBsaWNhbnQgZGFlbW9uLiIpOwotICAgICAgICAgICAgICAgIHNldFdpZmlFbmFibGVkU3RhdGUoV0lGSV9TVEFURV9VTktOT1dOLCB1aWQpOwotICAgICAgICAgICAgICAgIGZhaWxlZFRvU3RvcFN1cHBsaWNhbnRPclVubG9hZERyaXZlciA9IHRydWU7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIC8qKgotICAgICAgICAgICAgICogUmVzZXQgY29ubmVjdGlvbnMgYW5kIGRpc2FibGUgaW50ZXJmYWNlCi0gICAgICAgICAgICAgKiBiZWZvcmUgd2UgdW5sb2FkIHRoZSBkcml2ZXIKLSAgICAgICAgICAgICAqLwotICAgICAgICAgICAgbVdpZmlTdGF0ZVRyYWNrZXIucmVzZXRDb25uZWN0aW9ucyh0cnVlKTsKLQotICAgICAgICAgICAgaWYgKCFtV2lmaVN0YXRlVHJhY2tlci51bmxvYWREcml2ZXIoKSkgewotICAgICAgICAgICAgICAgIFNsb2cuZShUQUcsICJGYWlsZWQgdG8gdW5sb2FkIFdpLUZpIGRyaXZlci4iKTsKLSAgICAgICAgICAgICAgICBpZiAoIWZhaWxlZFRvU3RvcFN1cHBsaWNhbnRPclVubG9hZERyaXZ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ICAgICAgKi8KKyAgICAgICAgbG9uZyBpZGVudCA9IEJpbmRlci5jbGVhckNhbGxpbmdJZGVudGl0eSgpOworICAgICAgICBwZXJzaXN0V2lmaUVuYWJsZWQoZW5hYmxlKTsKKyAgICAgICAgQmluZGVyLnJlc3RvcmVDYWxsaW5nSWRlbnRpdHkoaWRlbnQpOworCisgICAgICAgIGlmIChlbmFibGUpIHsKKyAgICAgICAgICAgIGlmICghbUlzUmVjZWl2ZXJSZWdpc3RlcmVkKSB7CisgICAgICAgICAgICAgICAgcmVnaXN0ZXJGb3JCcm9hZGNhc3RzKCk7CisgICAgICAgICAgICAgICAgbUlzUmVjZWl2ZXJSZWdpc3RlcmVkID0gdHJ1ZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfSBlbHNlIGlmIChtSXNSZWNlaXZlclJlZ2lzdGVyZWQpeworICAgICAgICAgICAgbUNvbnRleHQudW5yZWdpc3RlclJlY2VpdmVyKG1SZWNlaXZlcik7CisgICAgICAgICAgICBtSXNSZWNlaXZlclJlZ2lzdGVyZWQgPSBmYWxzZTsKKyAgICAgICAgfQorCisgICAgICAgIHJldHVybiB0cnVlOworICAgIH0KKworICAgIC8qKgogICAgICAqIHNlZSB7QGxpbmsgV2lmaU1hbmFnZXIjZ2V0V2lmaVN0YXRlKCl9CiAgICAgICogQHJldHVybiBPbmUgb2Yge0BsaW5rIFdpZmlNYW5hZ2VyI1dJRklfU1RBVEVfRElTQUJMRUR9LAogICAgICAqICAgICAgICAge0BsaW5rIFdpZmlNYW5hZ2VyI1dJRklfU1RBVEVfRElTQUJMSU5HfSwKQEAgLTU3NCw2NiArNDM2LDU5IEBACiAgICAgICovCiAgICAgcHVibGljIGludCBnZXRXaWZpRW5hYmxlZFN0YXRlKCkgewogICAgICAgICBlbmZvcmNlQWNjZXNzUGVybWlzc2lvbigpOwotICAgICAgICByZXR1cm4gbVdpZmlTdGF0ZVRyYWNrZXIuZ2V0V2lmaVN0YXRlKCk7Ci0gICAgfQotCi0g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Y29uZmlnIGlmIHRoZXJlIGlzIG5vIGV4aXN0aW5nIGNvbmZpZyAqLworICAgICAgICAgICAgaWYgKHdpZmlDb25maWcgPT0gbnVsbCAmJiAoKHdpZmlDb25maWcgPSBnZXRXaWZpQXBDb25maWd1cmF0aW9uKCkpID09IG51bGwpKSB7CisgICAgICAgICAgICAgICAgd2lmaUNvbmZpZyA9IG5ldyBXaWZpQ29uZmlndXJhdGlvbigpOworICAgICAgICAgICAgICAgIHdpZmlDb25maWcuU1NJRCA9IG1Db250ZXh0LmdldFN0cmluZyhSLnN0cmluZy53aWZpX3RldGhlcl9jb25maWd1cmVfc3NpZF9kZWZhdWx0KTsKKyAgICAgICAgICAgICAgICB3aWZpQ29uZmlnLmFsbG93ZWRLZXlNYW5hZ2VtZW50LnNldChLZXlNZ210Lk5PTkUpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgLyoKKyAgICAgICAgICAgICAqIENhbGxlciBtaWdodCBub3QgaGF2ZSBXUklURV9TRUNVUkVfU0VUVElOR1MsCisgICAgICAgICAgICAgKiBvbmx5IENIQU5HRV9XSUZJX1NUQVRFIGlzIGVuZm9yY2VkCisgICAgICAgICAgICAgKi8KICAgICAgICAgICAgIGxvbmcgaWRlbnQgPSBCaW5kZXIuY2xlYXJDYWxsaW5nSWRlbnRpdHkoKTsKLSAgICAgICAgICAgIHNXYWtlTG9jay5hY3F1aXJlKCk7CisgICAgICAgICAgICBzZXRXaWZpQXBDb25maWd1cmF0aW9uKHdpZmlDb25maWcpOwogICAgICAgICAgICAgQmluZGVyLnJlc3RvcmVDYWxsaW5nSWRlbnRpdHkoaWRlbnQpOwotCi0gICAgICAgICAgICBtTGFzdEFwRW5hYmxlVWlkID0gQmluZGVyLmdldENhbGxpbmdVaWQoKTsKLSAgICAgICAgICAgIHNlbmRBY2Nlc3NQb2ludE1lc3NhZ2UoZW5hYmxlZCwgd2lmaUNvbmZpZywgQmluZGVyLmdldENhbGxpbmdVaWQoKSk7CiAgICAgICAgIH0K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gdHJ5IHsKLSAgICAgICAgICAgICAgICAgICAgbndTZXJ2aWNlLnNldEFjY2Vzc1BvaW50KHdpZmlDb25maWcsIG1XaWZpU3RhdGVUcmFja2VyLmdldEludGVyZmFjZU5hbWUoKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNPRlRBUF9JRkFDRSk7Ci0gICAgICAgICAgICAgICAgICAgIHNldFdpZmlBcENvbmZpZ3VyYXRpb24od2lmaUNvbmZpZyk7Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwotICAgICAgICAgICAgICAgIH0gY2F0Y2goRXhjZXB0aW9uIGUpIHsKLSAgICAgICAgICAgICAgICAgICAgU2xvZy5lKFRBRywgIkV4Y2VwdGlvbiBpbiBud1NlcnZpY2UgZHVyaW5nIEFQIHJlc3RhcnQiKTsKLSAgICAgICAgICAgICAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgICAgICAgICAgICAgIG53U2VydmljZS5zdG9wQWNjZXNzUG9pbnQoKTsKLSAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoRXhjZXB0aW9uIGVlKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBTbG9nLmUoVEFHLCAiQ291bGQgbm90IHN0b3AgQVAsIDoiICsgZWUpOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIHNldFdpZmlBcEVuYWJsZWRTdGF0ZShXSUZJX0FQX1NUQVRFX0ZBSUxFRCwgdWlkLCBEcml2ZXJBY3Rpb24uRFJJVkVSX1VOTE9BRCk7Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgLyoqCi0gICAgICAgICAqIEZhaWwgQVAgaWYgV2lmaSBpcyBlbmFibGVkCi0gICAgICAgICAqLwotICAgICAgICBpZiAoKG1XaWZpU3RhdGVUcmFja2VyLmdldFdpZmlTdGF0ZSgpID09IFdJRklfU1RBVEVfRU5BQkxFRCkgJiYgZW5hYmxlKSB7Ci0gICAgICAgICAgICBzZXRXaWZpQXBFbmFibGVkU3RhdGUoV0lGSV9BUF9TVEFURV9GQUlMRUQsIHVpZCwgRHJpdmVyQWN0aW9uLk5PX0RSSVZFUl9VTkxPQUQpOwotICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwotICAgICAgICB9Ci0KLSAgICAgICAgc2V0V2lmaUFwRW5hYmxlZFN0YXRlKGVuYWJsZSA/IFdJRklfQVBfU1RBVEVfRU5BQkxJTkcgOgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgV0lGSV9BUF9TVEFURV9ESVNBQkxJTkcsIHVpZCwgRHJpdmVyQWN0aW9uLk5PX0RSSVZFUl9VTkxPQUQpOwotCi0gICAgICAgIGlmIChlbmFibGUpIHsKLQotICAgICAgICAgICAgLyogVXNlIGRlZmF1bHQgY29uZmlnIGlmIHRoZXJlIGlzIG5vIGV4aXN0aW5nIGNvbmZpZyAqLwotICAgICAgICAgICAgaWYgKHdpZmlDb25maWcgPT0gbnVsbCAmJiAoKHdpZmlDb25maWcgPSBnZXRXaWZpQXBDb25maWd1cmF0aW9uKCkpID09IG51bGwpKSB7Ci0gICAgICAgICAgICAgICAgd2lmaUNvbmZpZyA9IG5ldyBXaWZpQ29uZmlndXJhdGlvbigpOwotICAgICAgICAgICAgICAgIHdpZmlDb25maWcuU1NJRCA9IG1Db250ZXh0LmdldFN0cmluZyhSLnN0cmluZy53aWZpX3RldGhlcl9jb25maWd1cmVfc3NpZF9kZWZhdWx0KTsKLSAgICAgICAgICAgICAgICB3aWZpQ29uZmlnLmFsbG93ZWRLZXlNYW5hZ2VtZW50LnNldChLZXlNZ210Lk5PTkUpOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBpZiAoIW1XaWZpU3RhdGVUcmFja2VyLmxvYWREcml2ZXIoKSkgewotICAgICAgICAgICAgICAgIFNsb2cuZShUQUcsICJGYWlsZWQgdG8gbG9hZCBXaS1GaSBkcml2ZXIgZm9yIEFQIG1vZGUiKTsKLSAgICAgICAgICAgICAgICBzZXRXaWZpQXBFbmFibGVkU3RhdGUoV0lGSV9BUF9TVEFURV9GQUlMRUQsIHVpZCwgRHJpdmVyQWN0aW9uLk5PX0RSSVZFUl9VTkxPQUQpOwotICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgICAgICBud1NlcnZpY2Uuc3RhcnRBY2Nlc3NQb2ludCh3aWZpQ29uZmlnLCBtV2lmaVN0YXRlVHJhY2tlci5nZXRJbnRlcmZhY2VOYW1lKCksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgU09GVEFQX0lGQUNFKTsKLSAgICAgICAgICAgIH0gY2F0Y2goRXhjZXB0aW9uIGUpIHsKLSAgICAgICAgICAgICAgICBTbG9nLmUoVEFHLCAiRXhjZXB0aW9uIGluIHN0YXJ0QWNjZXNzUG9pbnQoKSIpOwotICAgICAgICAgICAgICAgIHNldFdpZmlBcEVuYWJsZWRTdGF0ZShXSUZJX0FQX1NUQVRFX0ZBSUxFRCwgdWlkLCBEcml2ZXJBY3Rpb24uRFJJVkVSX1VOTE9BRCk7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBzZXRXaWZpQXBDb25maWd1cmF0aW9uKHdpZmlDb25maWcpOwotCi0gICAgICAgIH0gZWxzZSB7Ci0KLSAgICAgICAgICAgIHRyeSB7Ci0gICAgICAgICAgICAgICAgbndTZXJ2aWNlLnN0b3BBY2Nlc3NQb2ludCgpOwotICAgICAgICAgICAgfSBjYXRjaChFeGNlcHRpb24gZSkgewotICAgICAgIC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xXaWZpQ29uZmlndXJhdGlvbj4gbmV0d29ya3MgPQotICAgICAgICAgICAgbmV3IEFycmF5TGlzdDxXaWZpQ29uZmlndXJhdGlvbj4oKTsKLSAgICAgICAgaWYgKGxpc3RTdHIgPT0gbnVsbCkKLSAgICAgICAgICAgIHJldHVybiBuZXR3b3JrczsKLQotICAgICAgICBTdHJpbmdbXSBsaW5lcyA9IGxpc3RTdHIuc3BsaXQoIlxuIik7Ci0gICAgICAgIC8vIFNraXAgdGhlIGZpcnN0IGxpbmUsIHdoaWNoIGlzIGEgaGVhZGVyCi0gICAgICAgZm9yIChpbnQgaSA9IDE7IGkgPCBsaW5lcy5sZW5ndGg7IGkrKykgewotICAgICAgICAgICBTdHJpbmdbXSByZXN1bHQgPSBsaW5lc1tpXS5zcGxpdCgiXHQiKTsKLSAgICAgICAgICAgLy8gbmV0d29yay1pZCB8IHNzaWQgfCBic3NpZCB8IGZsYWdzCi0gICAgICAgICAgIFdpZmlDb25maWd1cmF0aW9uIGNvbmZpZyA9IG5ldyBXaWZpQ29uZmlndXJhdGlvbigpOwotICAgICAgICAgICB0cnkgewotICAgICAgICAgICAgICAgY29uZmlnLm5ldHdvcmtJZCA9IEludGVnZXIucGFyc2VJbnQocmVzdWx0WzBdKTsKLSAgICAgICAgICAgfSBjYXRjaChOdW1iZXJGb3JtYXRFeGNlcHRpb24gZSkgewotICAgICAgICAgICAgICAgY29udGludWU7Ci0gICAgICAgICAgIH0KLSAgICAgICAgICAgaWYgKHJlc3VsdC5sZW5ndGggPiAzKSB7Ci0gICAgICAgICAgICAgICBpZiAocmVzdWx0WzNdLmluZGV4T2YoIltDVVJSRU5UXSIpICE9IC0xKQotICAgICAgICAgICAgICAgICAgIGNvbmZpZy5zdGF0dXMgPSBXaWZpQ29uZmlndXJhdGlvbi5TdGF0dXMuQ1VSUkVOVDsKLSAgICAgICAgICAgICAgIGVsc2UgaWYgKHJlc3VsdFszXS5pbmRleE9mKCJbRElTQUJMRURdIikgIT0gLTEpCi0gICAgICAgICAgICAgICAgICAgY29uZmlnLnN0YXR1cyA9IFdpZmlDb25maWd1cmF0aW9uLlN0YXR1cy5ESVNBQkxFRDsKLSAgICAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgICAgICAgICBjb25maWcuc3RhdHVzID0gV2lmaUNvbmZpZ3VyYXRpb24uU3RhdHVzLkVOQUJMRUQ7Ci0gICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICBjb25maWcuc3RhdHVzID0gV2lmaUNvbmZpZ3VyYXRpb24uU3RhdHVzLkVOQUJMRUQ7Ci0gICAgICAgICAgIH0KLSAgICAgICAgICAgcmVhZE5ldHdvcmtWYXJpYWJsZXMoY29uZmlnKTsKLSAgICAgICAgICAgbmV0d29ya3MuYWRkKGNvbmZpZyk7Ci0gICAgICAgfQotCi0gICAgICAgIHJldHVybiBuZXR3b3JrczsKLSAgICB9Ci0KLSAgICAvKioKLSAgICAgKiBSZWFkIHRoZSB2YXJpYWJsZXMgZnJvbSB0aGUgc3VwcGxpY2FudCBkYWVtb24gdGhhdCBhcmUgbmVlZGVkIHRvCi0gICAgICogZmlsbCBpbiB0aGUgV2lmaUNvbmZpZ3VyYXRpb24gb2JqZWN0LgotICAgICAqIDxwLz4KLSAgICAgKiBUaGUgY2FsbGVyIG11c3QgaG9sZCB0aGUgc3luY2hyb25pemF0aW9uIG1vbml0b3IuCi0gICAgICogQHBhcmFtIGNvbmZpZyB0aGUge0BsaW5rIFdpZmlDb25maWd1cmF0aW9ufSBvYmplY3QgdG8gYmUgZmlsbGVkIGluLgotICAgICAqLwotICAgIHByaXZhdGUgdm9pZCByZWFkTmV0d29ya1ZhcmlhYmxlcyhXaWZpQ29uZmlndXJhdGlvbiBjb25maWcpIHsKLQotICAgICAgICBpbnQgbmV0SWQgPSBjb25maWcubmV0d29ya0lkOwotICAgICAgICBpZiAobmV0SWQgPCAwKQotICAgICAgICAgICAgcmV0dXJuOwotCi0gICAgICAgIC8qCi0gICAgICAgIC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OwotICAgICAgICBpZiAoIVRleHRVdGlscy5pc0VtcHR5KHZhbHVlKSkgewotICAgICAgICAgICAgY29uZmlnLnByZVNoYXJlZEtleSA9IHZhbHVlOwotICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgY29uZmlnLnByZVNoYXJlZEtleSA9IG51bGw7Ci0gICAgICAgIH0KLQotICAgICAgICB2YWx1ZSA9IG1XaWZpU3RhdGVUcmFja2VyLmdldE5ldHdvcmtWYXJpYWJsZShjb25maWcubmV0d29ya0lkLAotICAgICAgICAgICAgICAgIFdpZmlDb25maWd1cmF0aW9uLlByb3RvY29sLnZhck5hbWUpOwotICAgICAgICBpZiAoIVRleHRVdGlscy5pc0VtcHR5KHZhbHVlKSkgewotICAgICAgICAgICAgU3RyaW5nIHZhbHNbXSA9IHZhbHVlLnNwbGl0KCIgIik7Ci0gICAgICAgICAgICBmb3IgKFN0cmluZyB2YWwgOiB2YWxzKSB7Ci0gICAgICAgICAgICAgICAgaW50IGluZGV4ID0KLSAgICAgICAgICAgICAgICAgICAgbG9va3VwU3RyaW5nKHZhbCwgV2lmaUNvbmZpZ3VyYXRpb24uUHJvdG9jb2wuc3RyaW5ncyk7Ci0gICAgICAgICAgICAgICAgaWYgKDAgPD0gaW5kZXgpIHsKLSAgICAgICAgICAgICAgICAgICAgY29uZmlnLmFsbG93ZWRQcm90b2NvbHMuc2V0KGluZGV4KTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQotICAgICAgICB2YWx1ZSA9IG1XaWZpU3RhdGVUcmFja2VyLmdldE5ldHdvcmtWYXJpYWJsZShjb25maWcubmV0d29ya0lkLAotICAgICAgICAgICAgICAgIFdpZmlDb25maWd1cmF0aW9uLktleU1nbXQudmFyTmFtZSk7Ci0gICAgICAgIGlmICghVGV4dFV0aWxzLmlzRW1wdHkodmFsdWUpKSB7Ci0gICAgICAgICAgICBTdHJpbmcgdmFsc1tdID0gdmFsdWUuc3BsaXQoIiAiKTsKLSAgICAgICAgICAgIGZvciAoU3RyaW5nIHZhbCA6IHZhbHMpIHsKLSAgICAgICAgICAgICAgICBpbnQgaW5kZXggPQotICAgICAgICAgICAgICAgICAgICBsb29rdXBTdHJpbmcodmFsLCBXaWZpQ29uZmlndXJhdGlvbi5LZXlNZ210LnN0cmluZ3MpOwotICAgICAgICAgICAgICAgIGlmICgwIDw9IGluZGV4KSB7Ci0gICAgICAgICAgICAgICAgICAgIGNvbmZpZy5hbGxvd2VkS2V5TWFuYWdlbWVudC5zZXQoaW5kZXgpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCi0gICAgICAgIHZhbHVlID0gbVdpZmlTdGF0ZVRyYWNrZXIuZ2V0TmV0d29ya1ZhcmlhYmxlKGNvbmZpZy5uZXR3b3JrSWQsCi0gICAgICAgICAgICAgICAgV2lmaUNvbmZpZ3VyYXRpb24uQXV0aEFsZ29yaXRobS52YXJOYW1lKTsKLSAgICAgICAgaWYgKCFUZXh0VXRpbHMuaXNFbXB0eSh2YWx1ZSkpIHsKLSAgICAgICAgICAgIFN0cmluZyB2YWxzW10gPSB2YWx1ZS5zcGxpdCgiICIpOwotICAgICAgICAgICAgZm9yIChTdHJpbmcgdmFsIDogdmFscykgewotICAgICAgICAgICAgICAgIGludCBpbmRleCA9Ci0gICAgICAgICAgICAgICAgICAgIGxvb2t1cFN0cmluZyh2YWwsIFdpZmlDb25maWd1cmF0aW9uLkF1dGhBbGdvcml0aG0uc3RyaW5ncyk7Ci0gICAgICAgICAgICAgICAgaWYgKDAgPD0gaW5kZXgpIHsKLSAgICAgICAgICAgICAgICAgICAgY29uZmlnLmFsbG93ZWRBdXRoQWxnb3JpdGhtcy5zZXQoaW5kZXgpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCi0gICAgICAgIHZhbHVlID0gbVdpZmlTdGF0ZVRyYWNrZXIuZ2V0TmV0d29ya1ZhcmlhYmxlKGNvbmZpZy5uZXR3b3JrSWQsCi0gICAgICAgICAgICAgICAgV2lmaUNvbmZpZ3VyYXRpb24uUGFpcndpc2VDaXBoZXIudmFyTmFtZSk7Ci0gICAgICAgIGlmICghVGV4dFV0aWxzLmlzRW1wdHkodmFsdWUpKSB7Ci0gICAgICAgICAgICBTdHJpbmcgdmFsc1tdID0gdmFsdWUuc3BsaXQoIiAiKTsKLSAgICAgICAgICAgIGZvciAoU3RyaW5nIHZhbCA6IHZhbHMpIHsKLSAgICAgICAgICAgICAgICBpbnQgaW5kZXggPQotICAgICAgICAgICAgICAgICAgICBsb29rdXBTdHJpbmcodmFsLCBXaWZpQ29uZmlndXJhdGlvbi5QYWlyd2lzZUNpcGhlci5zdHJpbmdzKTsKLSAgICAgICAgICAgICAgICBpZiAoMCA8PSBpbmRleCkgewotICAgICAgICAgICAgICAgICAgICBjb25maWcuYWxsb3dlZFBhaXJ3aXNlQ2lwaGVycy5zZXQoaW5kZXgpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCi0gICAgICAgIHZhbHVlID0gbVdpZmlTdGF0ZVRyYWNrZXIuZ2V0TmV0d29ya1ZhcmlhYmxlKGNvbmZpZy5uZXR3b3JrSWQsCi0gICAgICAgICAgICAgICAgV2lmaUNvbmZpZ3VyYXRpb24uR3JvdXBDaXBoZXIudmFyTmFtZSk7Ci0gICAgICAgIGlmICghVGV4dFV0aWxzLmlzRW1wdHkodmFsdWUpKSB7Ci0gICAgICAgICAgICBTdHJpbmcgdmFsc1tdID0gdmFsdWUuc3BsaXQoIiAiKTsKLSAgICAgICAgICAgIGZvciAoU3RyaW5nIHZhbCA6IHZhbHMpIHsKLSAgICAgICAgICAgICAgICBpbnQgaW5kZXggPQotICAgICAgICAgICAgICAgICAgICBsb29rdXBTdHJpbmcodmFsLCBXaWZpQ29uZmlndXJhdGlvbi5Hcm91cENpcGhlci5zdHJpbmdzKTsKLSAgICAgICAgICAgICAgICBpZiAoMCA8PSBpbmRleCkgewotICAgICAgICAgICAgICAgICAgICBjb25maWcuYWxsb3dlZEdyb3VwQ2lwaGVycy5zZXQoaW5kZXgpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCi0gICAgICAgIGZvciAoV2lmaUNvbmZpZ3VyYXRpb24uRW50ZXJwcmlzZUZpZWxkIGZpZWxkIDoKLSAgICAgICAgICAgICAgICBjb25maWcuZW50ZXJwcmlzZUZpZWxkcykgewotICAgICAgICAgICAgdmFsdWUgPSBtV2lmaVN0YXRlVHJhY2tlci5nZXROZXR3b3JrVmFyaWFibGUobmV0SWQsCi0gICAgICAgICAgICAgICAgICAgIGZpZWxkLnZhck5hbWUoKSk7Ci0gICAgICAgICAgICBpZiAoIVRleHRVdGlscy5pc0VtcHR5KHZhbHVlKSkgewotICAgICAgICAgICAgICAgIGlmIChmaWVsZCAhPSBjb25maWcuZWFwKSB2YWx1ZSA9IHJlbW92ZURvdWJsZVF1b3Rlcyh2YWx1ZSk7Ci0gICAgICAgICAgICAgICAgZmllbGQuc2V0VmFsdWUodmFsdWUpOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgfQotCi0gICAgcHJpdmF0ZSBzdGF0aWMgU3RyaW5nIHJlbW92ZURvdWJsZVF1b3RlcyhTdHJpbmcgc3RyaW5nKSB7Ci0gICAgICAgIGlmIChzdHJpbmcubGVuZ3RoKCkgPD0gMikgcmV0dXJuICIiOwotICAgICAgICByZXR1cm4gc3RyaW5nLnN1YnN0cmluZygxLCBzdHJpbmcubGVuZ3RoKCkgLSAxKTsKLSAgICB9Ci0KLSAgICBwcml2YXRlIHN0YXRpYyBTdHJpbmcgY29udmVydFRvUXVvdGVkU3RyaW5nKFN0cmluZyBzdHJpbmcpIHsKLSAgICAgICAgcmV0dXJuICJcIiIgKyBzdHJpbmcgKyAiXCIiOworICAgICAgICByZXR1cm4gbVdpZmlTdGF0ZU1hY2hpbmUuZ2V0Q29uZmlndXJlZE5ldHdvcmtzKCk7CiAgICAgfQogCiAgICAgLyoqCkBAIC0xMDMyLDI4MCArNTY1LDEwIEBACiAgICAgICovCiAgICAgcHVibGljIGludCBhZGRPclVwZGF0ZU5ldHdvcmsoV2lmaUNvbmZpZ3VyYXRpb24gY29uZmlnKSB7CiAgICAgICAgIGVuZm9yY2VDaGFuZ2VQZXJtaXNzaW9uKCk7Ci0KLSAgICAgICAgLyoKLSAgICAgICAgICogSWYgdGhlIHN1cHBsaWVkIG5ldHdvcmtJZCBpcyAtMSwgd2UgY3JlYXRlIGEgbmV3IGVtcHR5Ci0gICAgICAgICAqIG5ldHdvcmsgY29uZmlndXJhdGlvbi4gT3RoZXJ3aXNlLCB0aGUgbmV0d29ya0lkIHNob3VsZAotICAgICAgICAgKiByZWZlciB0byBhbiBleGlzdGluZyBjb25maWd1cmF0aW9uLgotICAgICAgICAgKi8KLSAgICAgICAgaW50IG5ldElkID0gY29uZmlnLm5ldHdvcmtJZDsKLSAgICAgICAgYm9vbGVhbiBuZXdOZXR3b3JrID0gbmV0SWQgPT0gLTE7Ci0gICAgICAgIGJvb2xlYW4gZG9SZWNvbmZpZyA9IGZhbHNlOwotICAgICAgICAvLyBuZXR3b3JrSWQgb2YgLTEgbWVhbnMgd2Ugd2FudCB0byBjcmVhdGUgYSBuZXcgbmV0d29yawotICAgICAgICBzeW5jaHJvbml6ZWQgKG1XaWZpU3RhdGVUcmFja2VyKSB7Ci0gICAgICAgICAgICBpZiAobmV3TmV0d29yaykgewotICAgICAgICAgICAgICAgIG5ldElkID0gbVdpZmlTdGF0ZVRyYWNrZXIuYWRkTmV0d29yaygpOwotICAgICAgICAgICAgICAgIGlmIChuZXRJZCA8IDApIHsKLSAgICAgICAgICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgICAgICAgICAgU2xvZy5kKFRBRywgIkZhaWxlZCB0byBhZGQgYSBuZXR3b3JrISIpOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybiAtMTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgZG9SZWNvbmZpZyA9IHRydWU7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBtTmVlZFJlY29uZmlnID0gbU5lZWRSZWNvbmZpZyB8fCBkb1JlY29uZmlnOwotICAgICAgICB9Ci0KLSAgICAgICAgc2V0VmFyaWFibGVzOiB7Ci0gICAgICAgICAgICAvKgotICAgICAgICAgICAgICogTm90ZSB0aGF0IGlmIGEgbmV0d29ya0lkIGZvciBhIG5vbi1leGlzdGVudCBuZXR3b3JrCi0gICAgICAgICAgICAgKiB3YXMgc3VwcGxpZWQsIHRoZW4gdGhlIGZpcnN0IHNldE5ldHdvcmtWYXJpYWJsZSgpCi0gICAgICAgICAgICAgKiB3aWxsIGZhaWwsIHNvIHdlIGRvbid0IGJvdGhlciB0byBtYWtlIGEgc2VwYXJhdGUgY2hlY2sKLSAgICAgICAgICAgICAqIGZvciB0aGUgdmFsaWRpdHkgb2YgdGhlIElEIHVwIGZyb250LgotICAgICAgICAgICAgICovCi0gICAgICAgICAgICBpZiAoY29uZmlnLlNTSUQgIT0gbnVsbCAmJgotICAgICAgICAgICAgICAgICAgICAhbVdpZmlTdGF0ZVRyYWNrZXIuc2V0TmV0d29ya1ZhcmlhYmxlKAotICAgICAgICAgICAgICAgICAgICAgICAgbmV0SWQsCi0gICAgICAgICAgICAgICAgICAgICAgICBXaWZpQ29uZmlndXJhdGlvbi5zc2lkVmFyTmFtZSwKLSAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZy5TU0lEKSkgewotICAgICAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICAgICAgU2xvZy5kKFRBRywgImZhaWxlZCB0byBzZXQgU1NJRDogIitjb25maWcuU1NJRCk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGJyZWFrIHNldFZhcmlhYmxlczsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgaWYgKGNvbmZpZy5CU1NJRCAhPSBudWxsICYmCi0gICAgICAgICAgICAgICAgICAgICFtV2lmaVN0YXRlVHJhY2tlci5zZXROZXR3b3JrVmFyaWFibGUoCi0gICAgICAgICAgICAgICAgICAgICAgICBuZXRJZCwKLSAgICAgICAgICAgICAgICAgICAgICAgIFdpZmlDb25maWd1cmF0aW9uLmJzc2lkVmFyTmFtZSwKLSAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZy5CU1NJRCkpIHsKLSAgICAgICAgICAgICAgICBpZiAoREJHKSB7Ci0gICAgICAgICAgICAgICAgICAgIFNsb2cuZChUQUcsICJmYWlsZWQgdG8gc2V0IEJTU0lEOiAiK2NvbmZpZy5CU1NJRCk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGJyZWFrIHNldFZhcmlhYmxlczsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgU3RyaW5nIGFsbG93ZWRLZXlNYW5hZ2VtZW50U3RyaW5nID0KLSAgICAgICAgICAgICAgICBtYWtlU3RyaW5nKGNvbmZpZy5hbGxvd2VkS2V5TWFuYWdlbWVudCwgV2lmaUNvbmZpZ3VyYXRpb24uS2V5TWdtdC5zdHJpbmdzKTsKLSAgICAgICAgICAgIGlmIChjb25maWcuYWxsb3dlZEtleU1hbmFnZW1lbnQuY2FyZGluYWxpdHkoKSAhPSAwICYmCi0gICAgICAgICAgICAgICAgICAgICFtV2lmaVN0YXRlVHJhY2tlci5zZXROZXR3b3JrVmFyaWFibGUoCi0gICAgICAgICAgICAgICAgICAgICAgICBuZXRJZCwKLSAgICAgICAgICAgICAgICAgICAgICAgIFdpZmlDb25maWd1cmF0aW9uLktleU1nbXQudmFyTmFtZSwKLSAgICAgICAgICAgICAgICAgICAgICAgIGFsbG93ZWRLZXlNYW5hZ2VtZW50U3RyaW5nKSkgewotICAgICAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICAgICAgU2xvZy5kKFRBRywgImZhaWxlZCB0byBzZXQga2V5X21nbXQ6ICIrCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgYWxsb3dlZEtleU1hbmFnZW1lbnRTdHJpbmcpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBicmVhayBzZXRWYXJpYWJsZXM7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIFN0cmluZyBhbGxvd2VkUHJvdG9jb2xzU3RyaW5nID0KLSAgICAgICAgICAgICAgICBtYWtlU3RyaW5nKGNvbmZpZy5hbGxvd2VkUHJvdG9jb2xzLCBXaWZpQ29uZmlndXJhdGlvbi5Qcm90b2NvbC5zdHJpbmdzKTsKLSAgICAgICAgICAgIGlmIChjb25maWcuYWxsb3dlZFByb3RvY29scy5jYXJkaW5hbGl0eSgpICE9IDAgJiYKLSAgICAgICAgICAgICAgICAgICAgIW1XaWZpU3RhdGVUcmFja2VyLnNldE5ldHdvcmtWYXJpYWJsZSgKLSAgICAgICAgICAgICAgICAgICAgICAgIG5ldElkLAotICAgICAgICAgICAgICAgICAgICAgICAgV2lmaUNvbmZpZ3VyYXRpb24uUHJvdG9jb2wudmFyTmFtZSwKLSAgICAgICAgICAgICAgICAgICAgICAgIGFsbG93ZWRQcm90b2NvbHNTdHJpbmcpKSB7Ci0gICAgICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgICAgICBTbG9nLmQoVEFHLCAiZmFpbGVkIHRvIHNldCBwcm90bzogIisKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBhbGxvd2VkUHJvdG9jb2xzU3RyaW5nKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgYnJlYWsgc2V0VmFyaWFibGVzOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBTdHJpbmcgYWxsb3dlZEF1dGhBbGdvcml0aG1zU3RyaW5nID0KLSAgICAgICAgICAgICAgICBtYWtlU3RyaW5nKGNvbmZpZy5hbGxvd2VkQXV0aEFsZ29yaXRobXMsIFdpZmlDb25maWd1cmF0aW9uLkF1dGhBbGdvcml0aG0uc3RyaW5ncyk7Ci0gICAgICAgICAgICBpZiAoY29uZmlnLmFsbG93ZWRBdXRoQWxnb3JpdGhtcy5jYXJkaW5hbGl0eSgpICE9IDAgJiYKLSAgICAgICAgICAgICAgICAgICAgIW1XaWZpU3RhdGVUcmFja2VyLnNldE5ldHdvcmtWYXJpYWJsZSgKLSAgICAgICAgICAgICAgICAgICAgICAgIG5ldElkLAotICAgICAgICAgICAgICAgICAgICAgICAgV2lmaUNvbmZpZ3VyYXRpb24uQXV0aEFsZ29yaXRobS52YXJOYW1lLAotICAgICAgICAgICAgICAgICAgICAgICAgYWxsb3dlZEF1dGhBbGdvcml0aG1zU3RyaW5nKSkgewotICAgICAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICAgICAgU2xvZy5kKFRBRywgImZhaWxlZCB0byBzZXQgYXV0aF9hbGc6ICIrCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgYWxsb3dlZEF1dGhBbGdvcml0aG1zU3RyaW5nKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgYnJlYWsgc2V0VmFyaWFibGVzOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBTdHJpbmcgYWxsb3dlZFBhaXJ3aXNlQ2lwaGVyc1N0cmluZyA9Ci0gICAgICAgICAgICAgICAgbWFrZVN0cmluZyhjb25maWcuYWxsb3dlZFBhaXJ3aXNlQ2lwaGVycywgV2lmaUNvbmZpZ3VyYXRpb24uUGFpcndpc2VDaXBoZXIuc3RyaW5ncyk7Ci0gICAgICAgICAgICBpZiAoY29uZmlnLmFsbG93ZWRQYWlyd2lzZUNpcGhlcnMuY2FyZGluYWxpdHkoKSAhPSAwICYmCi0gICAgICAgICAgICAgICAgICAgICFtV2lmaVN0YXRlVHJhY2tlci5zZXROZXR3b3JrVmFyaWFibGUoCi0gICAgICAgICAgICAgICAgICAgICAgICBuZXRJZCwKLSAgICAgICAgICAgICAgICAgICAgICAgIFdpZmlDb25maWd1cmF0aW9uLlBhaXJ3aXNlQ2lwaGVyLnZhck5hbWUsCi0gICAgICAgICAgICAgICAgICAgICAgICBhbGxvd2VkUGFpcndpc2VDaXBoZXJzU3RyaW5nKSkgewotICAgICAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICAgICAgU2xvZy5kKFRBRywgImZhaWxlZCB0byBzZXQgcGFpcndpc2U6ICIrCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgYWxsb3dlZFBhaXJ3aXNlQ2lwaGVyc1N0cmluZyk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGJyZWFrIHNldFZhcmlhYmxlczsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgU3RyaW5nIGFsbG93ZWRHcm91cENpcGhlcnNTdHJpbmcgPQotICAgICAgICAgICAgICAgIG1ha2VTdHJpbmcoY29uZmlnLmFsbG93ZWRHcm91cENpcGhlcnMsIFdpZmlDb25maWd1cmF0aW9uLkdyb3VwQ2lwaGVyLnN0cmluZ3MpOwotICAgICAgICAgICAgaWYgKGNvbmZpZy5hbGxvd2VkR3JvdXBDaXBoZXJzLmNhcmRpbmFsaXR5KCkgIT0gMCAmJgotICAgICAgICAgICAgICAgICAgICAhbVdpZmlTdGF0ZVRyYWNrZXIuc2V0TmV0d29ya1ZhcmlhYmxlKAotICAgICAgICAgICAgICAgICAgICAgICAgbmV0SWQsCi0gICAgICAgICAgICAgICAgICAgICAgICBXaWZpQ29uZmlndXJhdGlvbi5Hcm91cENpcGhlci52YXJOYW1lLAotICAgICAgICAgICAgICAgICAgICAgICAgYWxsb3dlZEdyb3VwQ2lwaGVyc1N0cmluZykpIHsKLSAgICAgICAgICAgICAgICBpZiAoREJHKSB7Ci0gICAgICAgICAgICAgICAgICAgIFNsb2cuZChUQUcsICJmYWlsZWQgdG8gc2V0IGdyb3VwOiAiKwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFsbG93ZWRHcm91cENpcGhlcnNTdHJpbmcpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBicmVhayBzZXRWYXJpYWJsZXM7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIC8vIFByZXZlbnQgY2xpZW50IHNjcmV3LXVwIGJ5IHBhc3NpbmcgaW4gYSBXaWZpQ29uZmlndXJhdGlvbiB3ZSBnYXZlIGl0Ci0gICAgICAgICAgICAvLyBieSBwcmV2ZW50aW5nICIqIiBhcyBhIGtleS4KLSAgICAgICAgICAgIGlmIChjb25maWcucHJlU2hhcmVkS2V5ICE9IG51bGwgJiYgIWNvbmZpZy5wcmVTaGFyZWRLZXkuZXF1YWxzKCIqIikgJiYKLSAgICAgICAgICAgICAgICAgICAgIW1XaWZpU3RhdGVUcmFja2VyLnNldE5ldHdvcmtWYXJpYWJsZSgKLSAgICAgICAgICAgICAgICAgICAgICAgIG5ldElkLAotICAgICAgICAgICAgICAgICAgICAgICAgV2lmaUNvbmZpZ3VyYXRpb24ucHNrVmFyTmFtZSwKLSAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZy5wcmVTaGFyZWRLZXkpKSB7Ci0gICAgICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgICAgICBTbG9nLmQoVEFHLCAiZmFpbGVkIHRvIHNldCBwc2s6ICIrY29uZmlnLnByZVNoYXJlZEtleSk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGJyZWFrIHNldFZhcmlhYmxlczsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgYm9vbGVhbiBoYXNTZXRLZXkgPSBmYWxzZTsKLSAgICAgICAgICAgIGlmIChjb25maWcud2VwS2V5cyAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBjb25maWcud2VwS2V5cy5sZW5ndGg7IGkrKykgewotICAgICAgICAgICAgICAgICAgICAvLyBQcmV2ZW50IGNsaWVudCBzY3Jldy11cCBieSBwYXNzaW5nIGluIGEgV2lmaUNvbmZpZ3VyYXRpb24gd2UgZ2F2ZSBpdAotICAgICAgICAgICAgICAgICAgICAvLyBieSBwcmV2ZW50aW5nICIqIiBhcyBhIGtleS4KLSAgICAgICAgICAgICAgICAgICAgaWYgKGNvbmZpZy53ZXBLZXlzW2ldICE9IG51bGwgJiYgIWNvbmZpZy53ZXBLZXlzW2ldLmVxdWFscygiKiIpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoIW1XaWZpU3RhdGVUcmFja2VyLnNldE5ldHdvcmtWYXJpYWJsZSgKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5ldElkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgV2lmaUNvbmZpZ3VyYXRpb24ud2VwS2V5VmFyTmFtZXNbaV0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWcud2VwS2V5c1tpXSkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoREJHKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNsb2cuZChUQUcsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImZhaWxlZCB0byBzZXQgd2VwX2tleSIraSsiOiAiICsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWcud2VwS2V5c1tpXSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIHNldFZhcmlhYmxlczsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgIGhhc1NldEtleSA9IHRydWU7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIGlmIChoYXNTZXRLZXkpIHsKLSAgICAgICAgICAgICAgICBpZiAoIW1XaWZpU3RhdGVUcmFja2VyLnNldE5ldHdvcmtWYXJpYWJsZSgKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXRJZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBXaWZpQ29uZmlndXJhdGlvbi53ZXBUeEtleUlkeFZhck5hbWUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgSW50ZWdlci50b1N0cmluZyhjb25maWcud2VwVHhLZXlJbmRleCkpKSB7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIFNsb2cuZChUQUcsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJmYWlsZWQgdG8gc2V0IHdlcF90eF9rZXlpZHg6ICIrCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZy53ZXBUeEtleUluZGV4KTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBicmVhayBzZXRWYXJpYWJsZXM7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBpZiAoIW1XaWZpU3RhdGVUcmFja2VyLnNldE5ldHdvcmtWYXJpYWJsZSgKLSAgICAgICAgICAgICAgICAgICAgICAgIG5ldElkLAotICAgICAgICAgICAgICAgICAgICAgICAgV2lmaUNvbmZpZ3VyYXRpb24ucHJpb3JpdHlWYXJOYW1lLAotICAgICAgICAgICAgICAgICAgICAgICAgSW50ZWdlci50b1N0cmluZyhjb25maWcucHJpb3JpdHkpKSkgewotICAgICAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICAgICAgU2xvZy5kKFRBRywgY29uZmlnLlNTSUQgKyAiOiBmYWlsZWQgdG8gc2V0IHByaW9yaXR5OiAiCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgK2NvbmZpZy5wcmlvcml0eSk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGJyZWFrIHNldFZhcmlhYmxlczsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgaWYgKGNvbmZpZy5oaWRkZW5TU0lEICYmICFtV2lmaVN0YXRlVHJhY2tlci5zZXROZXR3b3JrVmFyaWFibGUoCi0gICAgICAgICAgICAgICAgICAgICAgICBuZXRJZCwKLSAgICAgICAgICAgICAgICAgICAgICAgIFdpZmlDb25maWd1cmF0aW9uLmhpZGRlblNTSURWYXJOYW1lLAotICAgICAgICAgICAgICAgICAgICAgICAgSW50ZWdlci50b1N0cmluZyhjb25maWcuaGlkZGVuU1NJRCA/IDEgOiAwKSkpIHsKLSAgICAgICAgICAgICAgICBpZiAoREJHKSB7Ci0gICAgICAgICAgICAgICAgICAgIFNsb2cuZChUQUcsIGNvbmZpZy5TU0lEICsgIjogZmFpbGVkIHRvIHNldCBoaWRkZW5TU0lEOiAiKwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZy5oaWRkZW5TU0lEKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgYnJlYWsgc2V0VmFyaWFibGVzOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBmb3IgKFdpZmlDb25maWd1cmF0aW9uLkVudGVycHJpc2VGaWVsZCBmaWVsZAotICAgICAgICAgICAgICAgICAgICA6IGNvbmZpZy5lbnRlcnByaXNlRmllbGRzKSB7Ci0gICAgICAgICAgICAgICAgU3RyaW5nIHZhck5hbWUgPSBmaWVsZC52YXJOYW1lKCk7Ci0gICAgICAgICAgICAgICAgU3RyaW5nIHZhbHVlID0gZmllbGQudmFsdWUoKTsKLSAgICAgICAgICAgICAgICBpZiAodmFsdWUgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICBpZiAoZmllbGQgIT0gY29uZmlnLmVhcCkgewotICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWUgPSAodmFsdWUubGVuZ3RoKCkgPT0gMCkgPyAiTlVMTCIgOiBjb252ZXJ0VG9RdW90ZWRTdHJpbmcodmFsdWUpOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIGlmICghbVdpZmlTdGF0ZVRyYWNrZXIuc2V0TmV0d29ya1ZhcmlhYmxlKAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXRJZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyTmFtZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWUpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoREJHKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgU2xvZy5kKFRBRywgY29uZmlnLlNTSUQgKyAiOiBmYWlsZWQgdG8gc2V0ICIgKyB2YXJOYW1lICsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICI6ICIgKyB2YWx1ZSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICBicmVhayBzZXRWYXJpYWJsZXM7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICByZXR1cm4gbmV0SWQ7Ci0gICAgICAgIH0KLQotICAgICAgICAvKgotICAgICAgICAgKiBGb3IgYW4gdXBkYXRlLCBpZiBvbmUgb2YgdGhlIHNldE5ldHdvcmtWYXJpYWJsZSBvcGVyYXRpb25zIGZhaWxzLAotICAgICAgICAgKiB3ZSBtaWdodCB3YW50IHRvIHJvbGwgYmFjayBhbGwgdGhlIGNoYW5nZXMgYWxyZWFkeSBtYWRlLiBCdXQgdGhlCi0gICAgICAgICAqIGNoYW5jZXMgYXJlIHRoYXQgaWYgYW55dGhpbmcgaXMgZ29pbmcgdG8gZ28gd3JvbmcsIGl0J2xs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AgICAgICAgICAgYnVmLmFwcGVuZChzdHJpbmdzW25leHRTZXRCaXRdLnJlcGxhY2UoJ18nLCAnLScpKS5hcHBlbmQoJyAnKTsKLSAgICAgICAgfQotCi0gICAgICAgIC8vIHJlbW92ZSB0cmFpbGluZyBzcGFjZQotICAgICAgICBpZiAoc2V0LmNhcmRpbmFsaXR5KCkgPiAwKSB7Ci0gICAgICAgICAgICBidWYuc2V0TGVuZ3RoKGJ1Zi5sZW5ndGgoKSAtIDEpOwotICAgICAgICB9Ci0KLSAgICAgICAgcmV0dXJuIGJ1Zi50b1N0cmluZygpOwotICAgIH0KLQotICAgIHByaXZhdGUgc3RhdGljIGludCBsb29rdXBTdHJpbmcoU3RyaW5nIHN0cmluZywgU3RyaW5nW10gc3RyaW5ncykgewotICAgICAgICBpbnQgc2l6ZSA9IHN0cmluZ3MubGVuZ3RoOwotCi0gICAgICAgIHN0cmluZyA9IHN0cmluZy5yZXBsYWNlKCctJywgJ18nKTsKLQotICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IHNpemU7IGkrKykKLSAgICAgICAgICAgIGlmIChzdHJpbmcuZXF1YWxzKHN0cmluZ3NbaV0pKQotICAgICAgICAgICAgICAgIHJldHVybiBpOwotCi0gICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgIC8vIGlmIHdlIGV2ZXIgZ2V0IGhlcmUsIHdlIHNob3VsZCBwcm9iYWJseSBhZGQgdGhlCi0gICAgICAgICAgICAvLyB2YWx1ZSB0byBXaWZpQ29uZmlndXJhdGlvbiB0byByZWZsZWN0IHRoYXQgaXQncwotICAgICAgICAgICAgLy8gc3VwcG9ydGVkIGJ5IHRoZSBXUEEgc3VwcGxpY2FudAotICAgICAgICAgICAgU2xvZy53KFRBRywgIkZhaWxlZCB0byBsb29rLXVwIGEgc3RyaW5nOiAiICsgc3RyaW5nKTsKLSAgICAgICAgfQotCi0gICAgICAgIHJldHVybiAtMTsKLSAgICB9Ci0KLSAgICAvKioKKyAgICAgLyo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Jlc3VsdHMoKTsKLSAgICAgICAgaWYgKHJlcGx5ID09IG51bGwpIHsKLSAgICAgICAgICAgIHJldHVybiBudWxsOwotICAgICAgICB9Ci0KLSAgICAgICAgTGlzdDxTY2FuUmVzdWx0PiBzY2FuTGlzdCA9IG5ldyBBcnJheUxpc3Q8U2NhblJlc3VsdD4oKTsKLQotICAgICAgICBpbnQgbGluZUNvdW50ID0gMDsKLQotICAgICAgICBpbnQgcmVwbHlMZW4gPSByZXBseS5sZW5ndGgoKTsKLSAgICAgICAgLy8gUGFyc2UgdGhlIHJlc3VsdCBzdHJpbmcsIGtlZXBpbmcgaW4gbWluZCB0aGF0IHRoZSBsYXN0IGxpbmUgZG9lcwotICAgICAgICAvLyBub3QgZW5kIHdpdGggYSBuZXdsaW5lLgotICAgICAgICBmb3IgKGludCBsaW5lQmVnID0gMCwgbGluZUVuZCA9IDA7IGxpbmVFbmQgPD0gcmVwbHlMZW47ICsrbGluZUVuZCkgewotICAgICAgICAgICAgaWYgKGxpbmVFbmQgPT0gcmVwbHlMZW4gfHwgcmVwbHkuY2hhckF0KGxpbmVFbmQpID09ICdcbicpIHsKLSAgICAgICAgICAgICAgICArK2xpbmVDb3VudDsKLSAgICAgICAgICAgICAgICAvKgotICAgICAgICAgICAgICAgICAqIFNraXAgdGhlIGZpcnN0IGxpbmUsIHdoaWNoIGlzIGEgaGVhZGVyCi0gICAgICAgICAgICAgICAgICovCi0gICAgICAgICAgICAgICAgaWYgKGxpbmVDb3VudCA9PSAxKSB7Ci0gICAgICAgICAgICAgICAgICAgIGxpbmVCZWcgPSBsaW5lRW5kICsgMTsKLSAgICAgICAgICAgICAgICAgICAgY29udGludWU7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGlmIChsaW5lRW5kID4gbGluZUJlZykgewotICAgICAgICAgICAgICAgICAgICBTdHJpbmcgbGluZSA9IHJlcGx5LnN1YnN0cmluZyhsaW5lQmVnLCBsaW5lRW5kKTsKLSAgICAgICAgICAgICAgICAgICAgU2NhblJlc3VsdCBzY2FuUmVzdWx0ID0gcGFyc2VTY2FuUmVzdWx0KGxpbmUpOwotICAgICAgICAgICAgICAgICAgICBpZiAoc2NhblJlc3VsdCAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBzY2FuTGlzdC5hZGQoc2NhblJlc3VsdCk7Ci0gICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoREJHKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBTbG9nLncoVEFHLCAibWlzZm9ybWF0dGVkIHNjYW4gcmVzdWx0IGZvcjogIiArIGxpbmUpOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGxpbmVCZWcgPSBsaW5lRW5kICsgMTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgICAgICBtV2lmaVN0YXRlVHJhY2tlci5zZXRTY2FuUmVzdWx0c0xpc3Qoc2Nhbkxpc3QpOwotICAgICAgICByZXR1cm4gc2Nhbkxpc3Q7Ci0gICAgfQotCi0gICAgLyoqCi0gICAgICogUGFyc2UgdGhlIHNjYW4gcmVzdWx0IGxpbmUgcGFzc2VkIHRvIHVzIGJ5IHdwYV9zdXBwbGljYW50IChoZWxwZXIpLgotICAgICAqIEBwYXJhbSBsaW5lIHRoZSBsaW5lIHRvIHBhcnNlCi0gICAgICogQHJldHVybiB0aGUge0BsaW5rIFNjYW5SZXN1bHR9IG9iamVjdAotICAgICAqLwotICAgIHByaXZhdGUgU2NhblJlc3VsdCBwYXJzZVNjYW5SZXN1bHQoU3RyaW5nIGxpbmUpIHsKLSAgICAgICAgU2NhblJlc3VsdCBzY2FuUmVzdWx0ID0gbnVsbDsKLSAgICAgICAgaWYgKGxpbmUgIT0gbnVsbCkgewotICAgICAgICAgICAgLyoKLSAgICAgICAgICAgICAqIENhY2hlIGltcGxlbWVudGF0aW9uIChMaW5rZWRIYXNoTWFwKSBpcyBub3Qgc3luY2hyb25pemVkLCB0aHVzLAotICAgICAgICAgICAgICogbXVzdCBzeW5jaHJvbml6ZWQgaGVyZSEKLSAgICAgICAgICAgICAqLwotICAgICAgICAgICAgc3luY2hyb25pemVkIChtU2NhblJlc3VsdENhY2hlKSB7Ci0gICAgICAgICAgICAgICAgU3RyaW5nW10gcmVzdWx0ID0gc2NhblJlc3VsdFBhdHRlcm4uc3BsaXQobGluZSk7Ci0gICAgICAgICAgICAgICAgaWYgKDMgPD0gcmVzdWx0Lmxlbmd0aCAmJiByZXN1bHQubGVuZ3RoIDw9IDUpIHsKLSAgICAgICAgICAgICAgICAgICAgU3RyaW5nIGJzc2lkID0gcmVzdWx0WzBdOwotICAgICAgICAgICAgICAgICAgICAvLyBic3NpZCB8IGZyZXF1ZW5jeSB8IGxldmVsIHwgZmxhZ3MgfCBzc2lkCi0gICAgICAgICAgICAgICAgICAgIGludCBmcmVxdWVuY3k7Ci0gICAgICAgICAgICAgICAgICAgIGludCBsZXZlbDsKLSAgICAgICAgICAgICAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGZyZXF1ZW5jeSA9IEludGVnZXIucGFyc2VJbnQocmVzdWx0WzFdKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGxldmVsID0gSW50ZWdlci5wYXJzZUludChyZXN1bHRbMl0pOwotICAgICAgICAgICAgICAgICAgICAgICAgLyogc29tZSBpbXBsZW1lbnRhdGlvbnMgYXZvaWQgbmVnYXRpdmUgdmFsdWVzIGJ5IGFkZGluZyAyNTYKLSAgICAgICAgICAgICAgICAgICAgICAgICAqIHNvIHdlIG5lZWQgdG8gYWRqdXN0IGZvciB0aGF0IGhlcmUuCi0gICAgICAgICAgICAgICAgICAgICAgICAgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChsZXZlbCA+IDApIGxldmVsIC09IDI1NjsKLSAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoTnVtYmVyRm9ybWF0RXhjZXB0aW9uIGUpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGZyZXF1ZW5jeSA9IDA7Ci0gICAgICAgICAgICAgICAgICAgICAgICBsZXZlbCA9IDA7Ci0gICAgICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgICAgICAvKgotICAgICAgICAgICAgICAgICAgICAgKiBUaGUgZm9ybWF0dGluZyBvZiB0aGUgcmVzdWx0cyByZXR1cm5lZCBieQotICAgICAgICAgICAgICAgICAgICAgKiB3cGFfc3VwcGxpY2FudCBpcyBpbnRlbmRlZCB0byBtYWtlIHRoZSBmaWVsZHMKLSAgICAgICAgICAgICAgICAgICAgICogbGluZSB1cCBuaWNlbHkgd2hlbiBwcmludGVkLAotICAgICAgICAgICAgICAgICAgICAgKiBub3QgdG8gbWFrZSB0aGVtIGVhc3kgdG8gcGFyc2UuIFNvIHdlIGhhdmUgdG8KLSAgICAgICAgICAgICAgICAgICAgICogYXBwbHkgc29tZSBoZXVyaXN0aWNzIHRvIGZpZ3VyZSBvdXQgd2hpY2ggZmllbGQKLSAgICAgICAgICAgICAgICAgICAgICogaXMgdGhlIFNTSUQgYW5kIHdoaWNoIGZpZWxkIGlzIHRoZSBmbGFncy4KLSAgICAgICAgICAgICAgICAgICAgICovCi0gICAgICAgICAgICAgICAgICAgIFN0cmluZyBzc2lkOwotICAgICAgICAgICAgICAgICAgICBTdHJpbmcgZmxhZ3M7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChyZXN1bHQubGVuZ3RoID09IDQpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyZXN1bHRbM10uY2hhckF0KDApID09ICdbJykgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsYWdzID0gcmVzdWx0WzNdOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNzaWQgPSAiIjsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxhZ3MgPSAiIjsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBzc2lkID0gcmVzdWx0WzNdOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHJlc3VsdC5sZW5ndGggPT0gNSkgewotICAgICAgICAgICAgICAgICAgICAgICAgZmxhZ3MgPSByZXN1bHRbM107Ci0gICAgICAgICAgICAgICAgICAgICAgICBzc2lkID0gcmVzdWx0WzRdOwotICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICAgICAgLy8gSGVyZSwgd2UgbXVzdCBoYXZlIDMgZmllbGRzOiBubyBmbGFncyBhbmQgc3NpZAotICAgICAgICAgICAgICAgICAgICAgICAgLy8gc2V0Ci0gICAgICAgICAgICAgICAgICAgICAgICBmbGFncyA9ICIiOwotICAgICAgICAgICAgICAgICAgICAgICAgc3NpZCA9ICIiOwotICAgICAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICAgICAgLy8gYnNzaWQgKyBzc2lkIGlzIHRoZSBoYXNoIGtleQotICAgICAgICAgICAgICAgICAgICBTdHJpbmcga2V5ID0gYnNzaWQgKyBzc2lkOwotICAgICAgICAgICAgICAgICAgICBzY2FuUmVzdWx0ID0gbVNjYW5SZXN1bHRDYWNoZS5nZXQoa2V5KTsKLSAgICAgICAgICAgICAgICAgICAgaWYgKHNjYW5SZXN1bHQgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICAgICAgc2NhblJlc3VsdC5sZXZlbCA9IGxldmVsOwotICAgICAgICAgICAgICAgICAgICAgICAgc2NhblJlc3VsdC5TU0lEID0gc3NpZDsKLSAgICAgICAgICAgICAgICAgICAgICAgIHNjYW5SZXN1bHQuY2FwYWJpbGl0aWVzID0gZmxhZ3M7Ci0gICAgICAgICAgICAgICAgICAgICAgICBzY2FuUmVzdWx0LmZyZXF1ZW5jeSA9IGZyZXF1ZW5jeTsKLSAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIC8vIERvIG5vdCBhZGQgc2NhbiByZXN1bHRzIHRoYXQgaGF2ZSBubyBTU0lEIHNldAotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDAgPCBzc2lkLnRyaW0oKS5sZW5ndGgoKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjYW5SZXN1bHQgPQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXcgU2NhblJlc3VsdCgKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNzaWQsIGJzc2lkLCBmbGFncywgbGV2ZWwsIGZyZXF1ZW5jeSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgbVNjYW5SZXN1bHRDYWNoZS5wdXQoa2V5LCBzY2FuUmVzdWx0KTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIFNsb2cudyhUQUcsICJNaXNmb3JtYXR0ZWQgc2NhbiByZXN1bHQgdGV4dCB3aXRoICIgKwotICAgICAgICAgICAgICAgICAgICAgICAgICByZXN1bHQubGVuZ3RoICsgIiBmaWVsZHM6ICIgKyBsaW5lKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQotICAgICAgICByZXR1cm4gc2NhblJlc3VsdDsKLSAgICB9Ci0KLSAgICAvKioKLSAgICAgKiBQYXJzZSB0aGUgImZsYWdzIiBmaWVsZCBwYXNzZWQgYmFjayBpbiBhIHNjYW4gcmVzdWx0IGJ5IHdwYV9zdXBwbGljYW50LAotICAgICAqIGFuZCBjb25zdHJ1Y3QgYSB7QGNvZGUgV2lmaUNvbmZpZ3VyYXRpb259IHRoYXQgZGVzY3JpYmVzIHRoZSBlbmNyeXB0aW9uLAotICAgICAqIGtleSBtYW5hZ2VtZW50LCBhbmQ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lc3VsdCA9IHRydWU7CiAgICAgICAgIGVuZm9yY2VDaGFuZ2VQZXJtaXNzaW9uKCk7Ci0KLSAgICAgICAgc3luY2hyb25pemVkIChtV2lmaVN0YXRlVHJhY2tlcikgewotICAgICAgICAgICAgcmVzdWx0ID0gbVdpZmlTdGF0ZVRyYWNrZXIuc2F2ZUNvbmZpZygpOwotICAgICAgICAgICAgaWYgKHJlc3VsdCAmJiBtTmVlZFJlY29uZmlnKSB7Ci0gICAgICAgICAgICAgICAgbU5lZWRSZWNvbmZpZyA9IGZhbHNlOwotICAgICAgICAgICAgICAgIHJlc3VsdCA9IG1XaWZpU3RhdGVUcmFja2VyLnJlbG9hZENvbmZpZygpOwotCi0gICAgICAgICAgICAgICAgaWYgKHJlc3VsdCkgewotICAgICAgICAgICAgICAgICAgICBJbnRlbnQgaW50ZW50ID0gbmV3IEludGVudChXaWZpTWFuYWdlci5ORVRXT1JLX0lEU19DSEFOR0VEX0FDVElPTik7Ci0gICAgICAgICAgICAgICAgICAgIG1Db250ZXh0LnNlbmRCcm9hZGNhc3QoaW50ZW50KTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLSAgICAgICAgLy8gSW5mb3JtIHRoZSBiYWNrdXAgbWFuYWdlciBhYm91dCBhIGRhdGEgY2hhbmdlCi0gICAgICAgIElCYWNrdXBNYW5hZ2VyIGlibSA9IElCYWNrdXBNYW5hZ2VyLlN0dWIuYXNJbnRlcmZhY2UoCi0gICAgICAgICAgICAgICAgU2VydmljZU1hbmFnZXIuZ2V0U2VydmljZShDb250ZXh0LkJBQ0tVUF9TRVJWSUNFKSk7Ci0gICAgICAgIGlmIChpYm0gIT0gbnVsbCkgewotICAgICAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgICAgICBpYm0uZGF0YUNoYW5nZWQoImNvbS5hbmRyb2lkLnByb3ZpZGVycy5zZXR0aW5ncyIpOwotICAgICAgICAgICAgfSBjYXRjaCAoRXhjZXB0aW9uIGUpIHsKLSAgICAgICAgICAgICAgICAvLyBUcnkgYWdhaW4gbGF0ZXIKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgICAgICByZXR1cm4gcmVzdWx0OworICAgICAgICByZXR1cm4gbVdpZmlTdGF0ZU1hY2hpbmUuc2F2ZUNvbmZpZygpOwogICAgIH0KIAogICAgIC8qKgpAQCAtMTU1Niw3ICs2NDksNyBAQAogICAgICAqIEByZXR1cm4ge0Bjb2RlIHRydWV9IGlmIHRoZSBvcGVyYXRpb24gc3VjY2VlZHMsIHtAY29kZSBmYWxzZX0gb3RoZXJ3aXNlLCBlLmcuLAogICAgICAqIHtAY29kZSBudW1DaGFubmVsc30gaXMgb3V0c2lkZSB0aGUgdmFsaWQgcmFuZ2UuCiAgICAgICovCi0gICAgcHVibGljIGJvb2xlYW4gc2V0TnVtQWxsb3dlZENoYW5uZWxzKGludCBudW1DaGFubmVscywgYm9vbGVhbiBwZXJzaXN0KSB7CisgICAgcHVibGljIHN5bmNocm9uaXplZCBib29sZWFuIHNldE51bUFsbG93ZWRDaGFubmVscyhpbnQgbnVtQ2hhbm5lbHMsIGJvb2xlYW4gcGVyc2lzdCkgewogICAgICAgICBTbG9nLmkoVEFHLCAiV2lmaVNlcnZpY2UgdHJ5aW5nIHRvIHNldE51bUFsbG93ZWQgdG8gIitudW1DaGFubmVscysKICAgICAgICAgICAgICAgICAiIHdpdGggcGVyc2lzdCBzZXQgdG8gIitwZXJzaXN0KTsKICAgICAgICAgZW5mb3JjZUNoYW5nZVBlcm1pc3Npb24oKTsKQEAgLTE1NzgsMjggKzY3MSwxNSBAQAogICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICB9CiAKLSAgICAgICAgaWYgKG1XaWZpSGFuZGxlciA9PSBudWxsKSByZXR1cm4gZmFsc2U7Ci0KLSAgICAgICAgTWVzc2FnZS5vYnRhaW4obVdpZmlIYW5kbGVyLAotICAgICAgICAgICAgICAgIE1FU1NBR0VfU0VUX0N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nNldE51bUFsbG93ZWRDaGFubmVscyhudW1DaGFubmVscyk7CisKKyAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgfQogCiAgICAgLyoqCkBAIC0xNjE3LDcgKzY5Nyw3IEBACiAgICAgICAgICAqIFdpLUZpIGlzIG5vdCBjdXJyZW50bHkgZW5hYmxlZCksIGdldCB0aGUgdmFsdWUgZnJvbQogICAgICAgICAgKiBTZXR0aW5ncy4KICAgICAgICAgICovCi0gICAgICAgIG51bUNoYW5uZWxzID0gbVdpZmlTdGF0ZVRyYWNrZXIuZ2V0TnVtQWxsb3dlZENoYW5uZWxzKCk7CisgICAgICAgIG51bUNoYW5uZWxzID0gbVdpZmlTdGF0ZU1hY2hpbmUuZ2V0TnVtQWxsb3dlZENoYW5uZWxzKCk7CiAgICAgICAgIGlmIChudW1DaGFubmVscyA8IDApIHsKICAgICAgICAgICAgIG51bUNoYW5uZWxzID0gU2V0dGluZ3MuU2VjdXJlLmdldEludChtQ29udGV4dC5nZXRDb250ZW50UmVzb2x2ZXIoKSwKICAgICAgICAgICAgICAgICAgICAgU2V0dGluZ3MuU2VjdXJlLldJRklfTlVNX0FMTE9XRURfQ0hBTk5FTFMsCkBAIC0xNjQzLDcgKzcyMyw3NiBAQAogICAgICAqLwogICAgIHB1YmxpYyBEaGNwSW5mbyBnZXREaGNwSW5mbygpIHsKICAgICAgICAgZW5mb3JjZUFjY2Vzc1Blcm1pc3Npb24oKTsKLSAgICAgICAgcmV0dXJuIG1XaWZpU3RhdGVUcmFja2VyLmdldERoY3BJbmZvKCk7CisgICAgICAgIHJldHVybiBtV2lmaVN0YXRlTWFjaGluZS5nZXREaGNwSW5mbygpOworICAgIH0KKworICAgIC8qKgorICAgICAqIHNlZSB7QGxpbmsgYW5kcm9pZC5uZXQud2lmaS5XaWZpTWFuYWdlciNzdGFydFdpZml9CisgICAgICoKKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBzdGFydFdpZmkoKSB7CisgICAgICAgIGVuZm9yY2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AvKgogICAgICAgICAgICAgICAgICAqIFNldCBhIHRpbWVyIHRvIHB1dCBXaS1GaSB0byBzbGVlcCwgYnV0IG9ubHkgaWYgdGhlIHNjcmVlbiBpcyBvZmYKICAgICAgICAgICAgICAgICAgKiBBTkQgdGhlICJzdGF5IG9uIHdoaWxlIHBsdWdnZWQgaW4iIHNldHRpbmcgZG9lc24ndCBtYXRjaCB0aGUKQEAgLTE2NzQsMTEgKzgyMywxMSBAQAogICAgICAgICAgICAgICAgICAqIG9yIHBsdWdnZWQgaW4gdG8gQUMpLgogICAgICAgICAgICAgICAgICAqLwogICAgICAgICAgICAgICAgIGlmICghc2hvdWxkV2lmaVN0YXlBd2FrZShzdGF5QXdha2VDb25kaXRpb25zLCBtUGx1Z2dlZFR5cGUpKSB7Ci0gICAgICAgICAgICAgICAgICAgIFdpZmlJbmZvIGluZm8gPSBtV2lmaVN0YXRlVHJhY2tlci5yZXF1ZXN0Q29ubmVjdGlvbkluZm8oKTsKKyAgICAgICAgICAgICAgICAgICAgV2lmaUluZm8gaW5mbyA9IG1XaWZpU3RhdGVNYWNoaW5lLnJlcXVlc3RDb25uZWN0aW9uSW5mbygpOwogICAgICAgICAgICAgICAgICAgICBpZiAoaW5mby5nZXRTdXBwbGljYW50U3RhdGUoKSAhPSBTdXBwbGljYW50U3RhdGUuQ09NUExFVEVEKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAvLyB3ZSB1c2VkIHRvIGdvIHRvIHNsZWVwIGltbWVkaWF0ZWx5LCBidXQgdGhpcyBjYXVzZWQgc29tZSByYWNlIGNvbmRpdGlvbnMKLSAgICAgICAgICAgICAgICAgICAgICAgIC8vIHdlIGRvbid0IGhhdmUgdGltZSB0byB0cmFjayBkb3duIGZvciB0aGlzIHJlbGVhc2UuICBEZWxheSBpbnN0ZWFkLCBidXQgbm90Ci0gICAgICAgICAgICAgICAgICAgICAgICAvLyBhcyBsb25nIGFzIHdlIHdvdWxkIGlmIGNvbm5lY3RlZCAoYmVsb3cpCisgICAgICAgICAgICAgICAgICAgICAgICAvLyB3ZSBkb24ndCBoYXZlIHRpbWUgdG8gdHJhY2sgZG93biBmb3IgdGhpcyByZWxlYXNlLiAgRGVsYXkgaW5zdGVhZCwKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIGJ1dCBub3QgYXMgbG9uZyBhcyB3ZSB3b3VsZCBpZiBjb25uZWN0ZWQgKGJlbG93KQogICAgICAgICAgICAgICAgICAgICAgICAgLy8gVE9ETyAtIGZpeCB0aGUgcmFjZSBjb25kaXRpb25zIGFuZCBzd2l0Y2ggYmFjayB0byB0aGUgaW1tZWRpYXRlIHR1cm4tb2ZmCiAgICAgICAgICAgICAgICAgICAgICAgICBsb25nIHRyaWdnZXJUaW1lID0gU3lzdGVtLmN1cnJlbnRUaW1lTWlsbGlzKCkgKyAoMio2MCoxMDAwKTsgLy8gMiBtaW4KICAgICAgICAgICAgICAgICAgICAgICAgIFNsb2cuZChUQUcsICJzZXR0aW5nIEFDVElPTl9ERVZJQ0VfSURMRSB0aW1lciBmb3IgMTIwLDAwMCBtcyIpOwpAQCAtMTcyNSw3ICs4NzQsNyBAQAogICAgICAgICAgICAgICAgICAgICAgICAgaXNCbHVldG9vdGhQbGF5aW5nID0gdHJ1ZTsKICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBtV2lmaVN0YXRlVHJhY2tlci5zZXRCbHVldG9vdGhTY2FuTW9kZShpc0JsdWV0b290aFBsYXlpbmcpOworICAgICAgICAgICAgICAgIG1XaWZpU3RhdGVNYWNoaW5lLnNldEJsdWV0b290aFNjYW5Nb2RlKGlzQmx1ZXRvb3RoUGxheWluZyk7CiAKICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgcmV0dXJuOwpAQCAtMTc3Nyw4MSArOTI2LDM2IEBACiAgICAgICAgIH0KICAgICB9OwogCi0gICAgcHJpdmF0ZSB2b2lkIHNlbmRFbmFibGVNZ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ICovCi0gICAgICAgIGlmICghbURldmljZUlkbGUgJiYgc3Ryb25nZXN0TG9ja01vZGUgPT0gV2lmaU1hbmFnZXIuV0lGSV9NT0RFX1NDQU5fT05MWSkgeworICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgc3Ryb25nZXN0TG9ja01vZGUgPSBXaWZpTWFuYWdlci5XSUZJX01PREVfRlVMTDsKICAgICAgICAgfQogCi0gICAgICAgIHN5bmNocm9uaXplZCAobVdpZmlIYW5kbGVyKSB7Ci0gICAgICAgICAgICBpZiAoKG1XaWZpU3RhdGVUcmFja2VyLmdldFdpZmlTdGF0ZSgpID09IFdJRklfU1RBVEVfRU5BQkxJTkcpICYmICFhaXJwbGFuZU1vZGUpIHsKLSAgICAgICAgICAgICAgICByZXR1cm47Ci0gICAgICAgICAgICB9CisgICAgICAgIC8qIERpc2FibGUgdGV0aGVyaW5nIHdoZW4gYWlycGxhbmUgbW9kZSBpcyBlbmFibGVkICovCisgICAgICAgIGlmIChhaXJwbGFuZU1vZGUpIHsKKyAgICAgICAgICAgIG1XaWZpU3RhdGVNYWNoaW5lLnNldFdpZmlBcEVuYWJsZWQobnVsbCwgZmFsc2UpOworICAgICAgICB9CiAKLSAgICAgICAgICAgIC8qIERpc2FibGUgdGV0aGVyaW5nIHdoZW4gYWlycGxhbmUgbW9kZSBpcyBlbmFibGVkICovCi0gICAgICAgICAgICBpZiAoYWlycGxhbmVNb2RlICYmCi0gICAgICAgICAgICAgICAgKG1XaWZpQXBTdGF0ZSA9PSBXSUZJX0FQX1NUQVRFX0VOQUJMSU5HIHx8IG1XaWZpQXBTdGF0ZSA9PSBXSUZJX0FQX1NUQVRFX0VOQUJMRUQpKSB7Ci0gICAgICAgICAgICAgICAgc1dha2VMb2NrLmFjcXVpcmUoKTsKLSAgICAgICAgICAgICAgICBzZW5kQWNjZXNzUG9pbnRNZXNzYWdlKGZhbHNlLCBudWxsLCBtTGFzdEFwRW5hYmxlVWlkKTsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgaWYgKHdpZmlTaG91bGRCZUVuYWJsZWQpIHsKLSAgICAgICAgICAgICAgICBpZiAod2lmaVNob3VsZEJlU3RhcnRlZCkgewotICAgICAgICAgICAgICAgICAgICBzV2FrZUxvY2suYWNxdWlyZSgpOwotICAgICAgICAgICAgICAgICAgICBzZW5kRW5hYmxlTWVzc2FnZSh0cnVlLCBmYWxzZSwgbUxhc3RFbmFibGVVaWQpOwotICAgICAgICAgICAgICAgICAgICBzV2FrZUxvY2suYWNxdWlyZSgpOwotICAgICAgICAgICAgICAgICAgICBzZW5kU3RhcnRNZXNzYWdlKHN0cm9uZ2VzdExvY2tNb2RlKTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKCFtV2lmaVN0YXRlVHJhY2tlci5pc0RyaXZlclN0b3BwZWQoKSkgewotICAgICAgICAgICAgICAgICAgICBpbnQgd2FrZUxvY2tUaW1lb3V0ID0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBTZXR0aW5ncy5TZWN1cmUuZ2V0SW50KAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUNvbnRleHQuZ2V0Q29udGVudFJlc29sdmVyKCksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTZXR0aW5ncy5TZWN1cmUuV0lGSV9NT0JJTEVfREFUQV9UUkFOU0lUSU9OX1dBS0VMT0NLX1RJTUVPVVRfTVMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBERUZBVUxUX1dBS0VMT0NLX1RJTUVPVVQpOwotICAgICAgICAgICAgICAgICAgICAvKgotICAgICAgICAgICAgICAgICAgICAgKiBXZSBhcmUgYXNzdW1pbmcgdGhhdCBDb25uZWN0aXZpdHlTZXJ2aWNlIGNhbiBtYWtlCi0gICAgICAgICAgICAgICAgICAgICAqIGEgdHJhbnNpdGlvbiB0byBjZWxsdWxhciBkYXRhIHdpdGhpbiB3YWtlTG9ja1RpbWVvdXQgdGltZS4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xvY2soKTsKKyAgICAgICAgICAgICAgICBtV2lmaVN0YXRlTWFjaGluZS5zZXREcml2ZXJTdGFydChmYWxzZSk7CiAgICAgICAgICAgICB9CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBtV2lmaVN0YXRlTWFjaGluZS5zZXRXaWZpRW5hYmxlZChmYWxzZSk7CiAgICAgICAgIH0KICAgICB9CiAKQEAgLTE4ODksNzcgKzk5Myw2IEBACiAgICAgICAgICAgICAgICAgU2V0dGluZ3MuU3lzdGVtLkFJUlBMQU5FX01PREVfT04sIDApID09IDE7CiAgICAgfQogCi0gICAgLyoqCi0gICAgICogSGFuZGxlciB0aGF0IGFsbG93cyBwb3N0aW5nIHRvIHRoZSBXaWZpVGhyZWFkLgotICAgICAqLwotICAgIHByaXZhdGUgY2xhc3MgV2lmaUhhbmRsZXIgZXh0ZW5kcyBIYW5kbGVyIHsKLSAgICAgICAgcHVibGljIFdpZmlIYW5kbGVyKExvb3BlciBsb29wZXIpIHsKLSAgICAgICAgICAgIHN1cGVyKGxvb3Blcik7Ci0gICAgICAgIH0KLQotICAgICAgICBAT3ZlcnJpZGUKLSAgICAgICAgcHVibGljIHZvaWQgaGFuZGxlTWVzc2FnZShNZXNzYWdlIG1zZykgewotICAgICAgICAgICAgc3dpdGNoIChtc2cud2hhdCkgewotCi0gICAgICAgICAgICAgICAgY2FzZSBNRVNTQUdFX0VOQUJMRV9XSUZJOgotICAgICAgICAgICAgICAgICAgICBzZXRXaWZpRW5hYmxlZEJsb2NraW5nKHRydWUsIG1zZy5hcmcxID09IDEsIG1zZy5hcmcyKTsKLSAgICAgICAgICAgICAgICAgICAgaWYgKG1XaWZpV2F0Y2hkb2dTZXJ2aWNlID09IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIG1XaWZpV2F0Y2hkb2dTZXJ2aWNlID0gbmV3IFdpZmlXYXRjaGRvZ1NlcnZpY2UobUNvbnRleHQsIG1XaWZpU3RhdGVUcmFja2VyKTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBzV2FrZUxvY2sucmVsZWFzZSgpOwotICAgICAgICAgICAgICAgICAgICBicmVhazsKLQotICAgICAgICAgICAgICAgIGNhc2UgTUVTU0FHRV9TVEFSVF9XSUZJOgotICAgICAgICAgICAgICAgICAgICBtV2lmaVN0YXRlVHJhY2tlci5zZXRTY2FuT25seU1vZGUobXNnLmFyZzEgPT0gV2lmaU1hbmFnZXIuV0lGSV9NT0RFX1NDQU5fT05MWSk7Ci0gICAgICAgICAgICAgICAgICAgIG1XaWZpU3RhdGVUcmFja2VyLnJlc3RhcnQoKTsKLSAgICAgICAgICAgICAgICAgICAgbVdpZmlTdGF0ZVRyYWNrZXIuc2V0SGlnaFBlcmZNb2RlKG1zZy5hcmcxID09Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgV2lmaU1hbmFnZXIuV0lGSV9NT0RFX0ZVTExfSElHSF9QRVJGKTsKLSAgICAgICAgICAgICAgICAgICAgc1dha2VMb2NrLnJlbGVhc2UoKTsKLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0KLSAgICAgICAgICAgICAgICBjYXNlIE1FU1NBR0VfVVBEQVRFX1NUQVRFOgotICAgICAgICAgICAgICAgICAgICBkb1VwZGF0ZVdpZmlTdGF0ZSgpOwotICAgICAgICAgICAgICAgICAgICBicmVhazsKLQotICAgICAgICAgICAgICAgIGNhc2UgTUVTU0FHRV9ESVNBQkxFX1dJRkk6Ci0gICAgICAgICAgICAgICAgICAgIC8vIGEgbm9uLXplcm8gbXNnLmFyZzEgdmFsdWUgbWVhbnMgdGhlICJlbmFibGVkIiBzZXR0aW5nCi0gICAgICAgICAgICAgICAgICAgIC8vIHNob3VsZCBiZSBwZXJzaXN0ZWQKLSAgICAgICAgICAgICAgICAgICAgc2V0V2lmaUVuYWJsZWRCbG9ja2luZyhmYWxzZSwgbXNnLmFyZzEgPT0gMSwgbXNnLmFyZzIpOwotICAgICAgICAgICAgICAgICAgICBtV2lmaVdhdGNoZG9nU2VydmljZSA9IG51bGw7Ci0gICAgICAgICAgICAgICAgICAgIHNXYWtlTG9jay5yZWxlYXNlKCk7Ci0gICAgICAgICAgICAgICAgICAgIGJyZWFrOwotCi0gICAgICAgICAgICAgICAgY2FzZSBNRVNTQUdFX1NUT1BfV0lGSToKLSAgICAgICAgICAgICAgICAgICAgbVdpZmlTdGF0ZVRyYWNrZXIuZGlzY29ubmVjdEFuZFN0b3AoKTsKLSAgICAgICAgICAgICAgICAgICAgLy8gZG9uJ3QgcmVsZWFzZSB3YWtlbG9jawotICAgICAgICAgICAgICAgICAgICBicmVhazsKLQotICAgICAgICAgICAgICAgIGNhc2UgTUVTU0FHRV9SRUxFQVNFX1dBS0VMT0NLOgotICAgICAgICAgICAgICAgICAgICBzRHJpdmVyU3RvcFdha2VMb2NrLnJlbGVhc2UoKTsKLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0KLSAgICAgICAgICAgICAgICBjYXNlIE1FU1NBR0VfU1RBUlRfQUNDRVNTX1BPSU5UOgotICAgICAgICAgICAgICAgICAgICBzZXRXaWZpQXBFbmFibGVkQmxvY2tpbmcodHJ1ZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1zZy5hcmcxLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKFdpZmlDb25maWd1cmF0aW9uKSBtc2cub2JqKTsKLSAgICAgICAgICAgICAgICAgICAgc1dha2VMb2NrLnJlbGVhc2UoKTsKLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0KLSAgICAgICAgICAgICAgICBjYXNlIE1FU1NBR0VfU1RPUF9BQ0NFU1NfUE9JTlQ6Ci0gICAgICAgICAgICAgICAgICAgIHNldFdpZmlBcEVuYWJsZWRCbG9ja2luZyhmYWxzZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1zZy5hcmcxLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKFdpZmlDb25maWd1cmF0aW9uKSBtc2cub2JqKTsKLSAgICAgICAgICAgICAgICAgICAgc1dha2VMb2NrLnJlbGVhc2UoKTsKLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0KLSAgICAgICAgICAgICAgICBjYXNlIE1FU1NBR0VfU0VUX0NIQU5ORUxTOgotICAgICAgICAgICAgICAgICAgICBzZXROdW1BbGxvd2VkQ2hhbm5lbHNCbG9ja2luZyhtc2cuYXJnMSwgbXNnLmFyZzIgPT0gMSk7Ci0gICAgICAgICAgICAgICAgICAgIGJyZWFrOwotCi0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLSAgICB9Ci0KICAgICBAT3ZlcnJpZGUKICAgICBwcm90ZWN0ZWQgdm9pZCBkdW1wKEZpbGVEZXNjcmlwdG9yIGZkLCBQcmludFdyaXRlciBwdywgU3RyaW5nW10gYXJncykgewogICAgICAgICBpZiAobUNvbnRleHQuY2hlY2tDYWxsaW5nT3JTZWxmUGVybWlzc2lvbihhbmRyb2lkLk1hbmlmZXN0LnBlcm1pc3Npb24uRFVNUCkKQEAgLTE5NjksMTcgKzEwMDIsMTcgQEAKICAgICAgICAgICAgICAgICAgICAgKyAiLCB1aWQ9IiArIEJpbmRlci5nZXRDYWxsaW5nVWlkKCkpOwogICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICB9Ci0gICAgICAgIHB3LnByaW50bG4oIldpLUZpIGlzICIgKyBzdGF0ZU5hbWUobVdpZmlTdGF0ZVRyYWNrZXIuZ2V0V2lmaVN0YXRlKCkpKTsKKyAgICAgICAgcHcucHJpbnRsbigiV2ktRmkgaXMgIiArIG1XaWZpU3RhdGVNYWNoaW5lLmdldFdpZmlTdGF0ZUJ5TmFtZSgpKTsKICAgICAgICAgcHcucHJpbnRsbigiU3RheS1hd2FrZSBjb25kaXRpb25zOiAiICsKICAgICAgICAgICAgICAgICBTZXR0aW5ncy5TeXN0ZW0uZ2V0SW50KG1Db250ZXh0LmdldENvbnRlbnRSZXNvbHZlcigpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgU2V0dGluZ3MuU3lzdGVtLlNUQVlfT05fV0hJTEVfUExVR0dFRF9JTiwgMCkpOwogICAgICAgICBwdy5wcmludGxuKCk7CiAKICAgICAgICAgcHcucHJpbnRsbigiSW50ZXJuYWwgc3RhdGU6Iik7Ci0gICAgICAgIHB3LnByaW50bG4obVdpZmlTdGF0ZVRyYWNrZXIpOworICAgICAgICBwdy5wcmludGxuKG1XaWZpU3RhdGVNYWNoaW5lKTsKICAgICAgICAgcHcucHJpbnRsbigpOwogICAgICAgICBwdy5wcmludGxuKCJMYXRlc3Qgc2NhbiByZXN1bHRzOiIpOwotICAgICAgICBMaXN0PFNjYW5SZXN1bHQ+IHNjYW5SZXN1bHRzID0gbVdpZmlTdGF0ZVRyYWNrZXIuZ2V0U2NhblJlc3VsdHNMaXN0KCk7CisgICAgICAgIExpc3Q8U2NhblJlc3VsdD4gc2NhblJlc3VsdHMgPSBtV2lmaVN0YXRlTWFjaGluZS5nZXRTY2FuUmVzdWx0c0xpc3QoKTsKICAgICAgICAgaWYgKHNjYW5SZXN1bHRzICE9IG51bGwgJiYgc2NhblJlc3VsdHMuc2l6ZSgpICE9IDApIHsKICAgICAgICAgICAgIHB3LnByaW50bG4oIiAgQlNTSUQgICAgICAgICAgICAgIEZyZXF1ZW5jeSAgIFJTU0kgIEZsYWdzICAgICAgICAgICAgIFNTSUQiKTsKICAgICAgICAgICAgIGZvciAoU2NhblJlc3VsdCByIDogc2NhblJlc3VsdHMpIHsKQEAgLTE5OTMsMzMgKzEwMjYsMTQgQEAKICAgICAgICAgfQogICAgICAgICBwdy5wcmludGxuKCk7CiAgICAgICAgIHB3LnByaW50bG4oIkxvY2tzIGFjcXVpcmVkOiAiICsgbUZ1bGxMb2Nrc0FjcXVpcmVkICsgIiBmdWxsLCAiICsKLSAgICAgICAgICAgICAgICBtRnVsbEhpZ2hQZXJmTG9ja3NBY3F1aXJlZCArICIgZnVsbCBoaWdoIHBlcmYsICIgKwogICAgICAgICAgICAgICAgIG1TY2FuTG9ja3NBY3F1aXJlZCArICIgc2NhbiIpOwogICAgICAgICBwdy5wcmludGxuKCJMb2NrcyByZWxlYXNlZDogIiArIG1GdWxsTG9ja3NSZWxlYXNlZCArICIgZnVsbCwgIiArCi0gICAgICAgICAgICAgICAgbUZ1bGxIaWdoUGVyZkxvY2tzUmVsZWFzZWQgKyAiIGZ1bGwgaGlnaCBwZXJmLCAiICsKICAgICAgICAgICAgICAgICBtU2NhbkxvY2tzUmVsZWFzZWQgKyAiIHNjYW4iKTsKICAgICAgICAgcHcucHJpbnRsbigpOwogICAgICAgICBwdy5wcmludGxuKCJMb2NrcyBoZWxkOiIpOwogICAgICAgICBtTG9ja3MuZHVtcChwdyk7CiAgICAgfQogCi0gICAgcHJpdmF0ZSBzdGF0aWMgU3RyaW5nIHN0YXRlTmFtZShpbnQgd2lmaVN0YXRlKSB7Ci0gICAgICAgIHN3aXRjaCAod2lmaVN0YXRlKSB7Ci0gICAgICAgICAgICBjYXNlIFdJRklfU1RBVEVfRElTQUJMSU5HOgotICAgICAgICAgICAgICAgIHJldHVybiAiZGlzYWJsaW5nIjsKLSAgICAgICAgICAgIGNhc2UgV0lGSV9TVEFURV9ESVNBQkxFRDoKLSAgICAgICAgICAgICAgICByZXR1cm4gImRpc2FibGVkIjsKLSAgICAgICAgICAgIGNhc2UgV0lGSV9TVEFURV9FTkFCTElORzoKLSAgICAgICAgICAgICAgICByZXR1cm4gImVuYWJsaW5nIjsKLSAgICAgICAgICAgIGNhc2UgV0lGSV9TVEFURV9FTkFCTEVEOgotICAgICAgICAgICAgICAgIHJldHVybiAiZW5hYmxlZCI7Ci0gICAgICAgICAgICBjYXNlIFdJRklfU1RBVEVfVU5LTk9XTjoKLSAgICAgICAgICAgICAgICByZXR1cm4gInVua25vd24gc3RhdGUiOwotICAgICAgICAgICAgZGVmYXVsdDoKLSAgICAgICAgICAgICAgICByZXR1cm4gIltpbnZhbGlkIHN0YXRlXSI7Ci0gICAgICAgIH0KLSAgICB9Ci0KICAgICBwcml2YXRlIGNsYXNzIFdpZmlMb2NrIGV4dGVuZHMgRGVhdGhSZWNpcGllbnQgewogICAgICAgICBXaWZpTG9jayhpbnQgbG9ja01vZGUsIFN0cmluZyB0YWcsIElCaW5kZXIgYmluZGVyKSB7CiAgICAgICAgICAgICBzdXBlcihsb2NrTW9kZSwgdGFnLCBiaW5kZXIpOwpAQCAtMjA1MSwxNSArMTA2NSwxMSBAQAogICAgICAgICAgICAgaWYgKG1MaXN0LmlzRW1wdHkoKSkgewogICAgICAgICAgICAgICAgIHJldHVybiBXaWZpTWFuYWdlci5XSUZJX01PREVfRlVMTDsKICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgaWYgKG1GdWxsSGlnaFBlcmZMb2Nrc0FjcXVpcmVkID4gbUZ1bGxIaWdoUGVyZkxvY2tzUmVsZWFzZWQpIHsKLSAgICAgICAgICAgICAgICByZXR1cm4gV2lmaU1hbmFnZXIuV0lGSV9NT0RFX0ZVTExfSElHSF9QRVJGOworICAgICAgICAgICAgZm9yIChXaWZpTG9jayBsIDogbUxpc3QpIHsKKyAgICAgICAgICAgICAgICBpZiAobC5tTW9kZSA9PSBXaWZpTWFuYWdlci5XSUZJX01PREVfRlVMTCkgeworICAgICAgICAgICAgICAgICAgICByZXR1cm4gV2lmaU1hbmFnZXIuV0lGSV9NT0RFX0ZVTEw7CisgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBpZiAobUZ1bGxMb2Nrc0FjcXVpcmVkID4gbUZ1bGxMb2Nrc1JlbGVhc2VkKSB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIFdpZmlNYW5hZ2VyLldJRklfTU9ERV9GVUxMOwotICAgICAgICAgICAgfQotCiAgICAgICAgICAgICByZXR1cm4gV2lmaU1hbmFn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Q7CiAgICAgICAgICAgICAgICAgbUJhdHRlcnlTdGF0cy5ub3RlRnVsbFdpZmlMb2NrQWNxdWlyZWQodWlkKTsKICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIGNhc2UgV2lmaU1hbmFnZXIuV0lGSV9NT0RFX0ZVTExfSElHSF9QRVJGOgotICAgICAgICAgICAgICAgICsrbUZ1bGxIaWdoUGVyZkxvY2tzQWNxdWlyZWQ7Ci0gICAgICAgICAgICAgICAgLyogVHJlYXQgaGlnaCBwb3dlciBhcyBhIGZ1bGwgbG9jayBmb3IgYmF0dGVyeSBzdGF0cyAqLwotICAgICAgICAgICAgICAgIG1CYXR0ZXJ5U3RhdHMubm90ZUZ1bGxXaWZpTG9ja0FjcXVpcmVkKHVpZCk7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0KICAgICAgICAgICAgIGNhc2UgV2lmaU1hbmFnZXIuV0lGSV9NT0RFX1NDQU5fT05MWToKICAgICAgICAgICAgICAgICArK21TY2FuTG9ja3NBY3F1aXJlZDsKICAgICAgICAgICAgICAgICBtQmF0dGVyeVN0YXRzLm5vdGVTY2FuV2lmaUxvY2tBY3F1aXJlZCh1aWQpOwpAQCAtMjE2OSwxMCArMTE2OSw2IEBACiAgICAgICAgICAgICAgICAgICAgICAgICArK21GdWxsTG9ja3NSZWxlYXNlZDsKICAgICAgICAgICAgICAgICAgICAgICAgIG1CYXR0ZXJ5U3RhdHMubm90ZUZ1bGxXaWZpTG9ja1JlbGVhc2VkKHVpZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICAgICAgY2FzZSBXaWZpTWFuYWdlci5XSUZJX01PREVfRlVMTF9ISUdIX1BFUkY6Ci0gICAgICAgICAgICAgICAgICAgICAgICArK21GdWxsSGlnaFBlcmZMb2Nrc1JlbGVhc2VkOwotICAgICAgICAgICAgICAgICAgICAgICAgbUJhdHRlcnlTdGF0cy5ub3RlRnVsbFdpZmlMb2NrUmVsZWFzZWQodWlkKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICBjYXNlIFdpZmlNYW5hZ2VyLldJRklfTU9ERV9TQ0FOX09OTFk6CiAgICAgICAgICAgICAgICAgICAgICAgICArK21TY2FuTG9ja3NSZWxlYXNlZDsKICAgICAgICAgICAgICAgICAgICAgICAgIG1CYXR0ZXJ5U3RhdHMubm90ZVNjYW5XaWZpTG9ja1JlbGVhc2VkKHVpZCk7CkBAIC0yMjQzLDcgKzEyMzksNyBAQAogICAgICAgICAgICAgaWYgKG1NdWx0aWNhc3RlcnMuc2l6ZSgpICE9IDApIHsKICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIG1XaWZpU3RhdGVUcmFja2VyLnN0YXJ0UGFja2V0RmlsdGVyaW5nKCk7CisgICAgICAgICAgICAgICAgbVdpZmlTdGF0ZU1hY2hpbmUuc3RhcnRQYWNrZXRGaWx0ZXJpbmcoKTsKICAgICAgICAgICAgIH0KICAgICAgICAgfQogICAgIH0KQEAgLTIyNTgsNyArMTI1NCw3IEBACiAgICAgICAgICAgICAvLyBvdXIgbmV3IHNpemUgPT0gMSAoZmlyc3QgY2FsbCksIGJ1dCB0aGlzIGZ1bmN0aW9uIHdvbid0CiAgICAgICAgICAgICAvLyBiZSBjYWxsZWQgb2Z0ZW4gYW5kIGJ5IG1ha2luZyB0aGUgc3RvcFBhY2tldCBjYWxsIGVhY2gKICAgICAgICAgICAgIC8vIHRpbWUgd2UncmUgbGVzcyBmcmFnaWxlIGFuZCBzZWxmLWhlYWxpbmcuCi0gICAgICAgICAgICBtV2lmaVN0YXRlVHJhY2tlci5zdG9wUGFja2V0RmlsdGVyaW5nKCk7CisgICAgICAgICAgICBtV2lmaVN0YXRlTWFjaGluZS5zdG9wUGFja2V0RmlsdGVyaW5nKCk7CiAgICAgICAgIH0KIAogICAgICAgICBpbnQgdWlkID0gQmluZGVyLmdldENhbGxpbmdVaWQoKTsKQEAgLTIyOTUsNyArMTI5MSw3IEBACiAgICAgICAgICAgICByZW1vdmVkLnVubGlua0RlYXRoUmVjaXBpZW50KCk7CiAgICAgICAgIH0KICAgICAgICAgaWYgKG1NdWx0aWNhc3RlcnMuc2l6ZSgpID09IDApIHsKLSAgICAgICAgICAgIG1XaWZpU3RhdGVUcmFja2VyLnN0YXJ0UGFja2V0RmlsdGVyaW5nKCk7CisgICAgICAgICAgICBtV2lmaVN0YXRlTWFjaGluZS5zdGFydFBhY2tldEZpbHRlcmluZygpOwogICAgICAgICB9CiAKICAgICAgICAgTG9uZyBpZGVudCA9IEJpbmRlci5jbGVhckNhbGxpbmdJZGVudGl0eSgpOwpAQCAtMjMxNCw0ICsxMzEwLDE0NCBAQAogICAgICAgICAgICAgcmV0dXJuIChtTXVsdGljYXN0ZXJzLnNpemUoKSA+IDApOwogICAgICAgICB9CiAgICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIGNoZWNrQW5kU2V0Tm90aWZpY2F0aW9uKCkgeworICAgICAgICAvLyBJZiB3ZSBzaG91bGRuJ3QgcGxhY2UgYSBub3RpZmljYXRpb24gb24gYXZhaWxhYmxlIG5ldHdvcmtzLCB0aGVuCisgICAgICAgIC8vIGRvbid0IGJvdGhlciBkb2luZyBhbnkgb2YgdGhlIGZvbGxvd2luZworICAgICAgICBpZiAoIW1Ob3RpZmljYXRpb25FbmFibGVkKSByZXR1cm47CisKKyAgICAgICAgU3RhdGUgc3RhdGUgPSBtTmV0d29ya0luZm8uZ2V0U3RhdGUoKTsKKyAgICAgICAgaWYgKChzdGF0ZSA9PSBOZXR3b3JrSW5mby5TdGF0ZS5ESVNDT05ORUNURUQpCisgICAgICAgICAgICAgICAgfHwgKHN0YXRlID09IE5ldHdvcmtJbmZvLlN0YXRlLlVOS05PV04pKSB7CisgICAgICAgICAgICAvLyBMb29rIGZvciBhbiBvcGVuIG5ldHdvcmsKKyAgICAgICAgICAgIExpc3Q8U2NhblJlc3VsdD4gc2NhblJlc3VsdHMgPSBtV2lmaVN0YXRlTWFjaGluZS5nZXRTY2FuUmVzdWx0c0xpc3QoKTsKKyAgICAgICAgICAgIGlmIChzY2FuUmVzdWx0cyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgaW50IG51bU9wZW5OZXR3b3JrcyA9IDA7CisgICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IHNjYW5SZXN1bHRzLnNpemUoKSAtIDE7IGkgPj0gMDsgaS0tKSB7CisgICAgICAgICAgICAgICAgICAgIFNjYW5SZXN1bHQgc2NhblJlc3VsdCA9IHNjYW5SZXN1bHRzLmdldChpKTsKKworICAgICAgICAgICAgICAgICAgICBpZiAoVGV4dFV0aWxzLmlzRW1wdHkoc2NhblJlc3VsdC5jYXBhYmlsaXRpZXMpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBudW1PcGVuTmV0d29ya3MrKzsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIGlmIChudW1PcGVuTmV0d29ya3MgPiAwKSB7CisgICAgICAgICAgICAgICAgICAgIGlmICgrK21OdW1TY2Fuc1NpbmNlTmV0d29ya1N0YXRlQ2hhbmdlID49IE5VTV9TQ0FOU19CRUZPUkVfQUNUVUFMTFlfU0NBTk5JTkcpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIC8qCisgICAgICAgICAgICAgICAgICAgICAgICAgKiBXZSd2ZSBzY2FubmVkIGNvbnRpbnVvdXNseSBhdCBsZWFzdAorICAgICAgICAgICAgICAgICAgICAgICAgICogTlVNX1NDQU5TX0JFRk9SRV9OT1RJRklDQVRJT04gdGltZXMuIFRoZSB1c2VyCisgICAgICAgICAgICAgICAgICAgICAgICAgKiBwcm9iYWJseSBkb2VzIG5vdCBoYXZlIGEgcmVtZW1iZXJlZCBuZXR3b3JrIGluIHJhbmdlLAorICAgICAgICAgICAgICAgICAgICAgICAgICogc2luY2Ugb3RoZXJ3aXNlIHN1cHBsaWNhbnQgd291bGQgaGF2ZSB0cmllZCB0bworICAgICAgICAgICAgICAgICAgICAgICAgICogYXNzb2NpYXRlIGFuZCB0aHVzIHJlc2V0dGluZyB0aGlzIGNvdW50ZXIuCisgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgIHNldE5vdGlmaWNhdGlvblZpc2libGUodHJ1ZSwgbnVtT3Blbk5ldHdvcmtzLCBmYWxzZSwgMCk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIC8vIE5vIG9wZW4gbmV0d29ya3MgaW4gcmFuZ2UsIHJlbW92ZSB0aGUgbm90aWZpY2F0aW9uCisgICAgICAgIHNldE5vdGlmaWNhdGlvblZpc2libGUoZmFsc2UsIDAsIGZhbHNlLCAwKTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBDbGVhcnMgdmFyaWFibGVzIHJlbGF0ZWQgdG8gdHJhY2tpbmcgd2hldGhlciBhIG5vdGlmaWNhdGlvbiBoYXMgYmVlbgorICAgICAqIHNob3duIHJlY2VudGx5IGFuZCBjbGVhcnMgdGhlIGN1cnJlbnQgbm90aWZpY2F0aW9uLgorICAgICAqLworICAgIHByaXZhdGUgdm9pZCByZXNldE5vdGlmaWNhdGlvbigpIHsKKyAgICAgICAgbU5vdGlmaWNhdGlvblJlcGVhdFRpbWUgPSAwOworICAgICAgICBtTnVtU2NhbnNTaW5jZU5ldHdvcmtTdGF0ZUNoYW5nZSA9IDA7CisgICAgICAgIHNldE5vdGlmaWNhdGlvblZpc2libGUoZmFsc2UsIDAsIGZhbHNlLCAwKTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBEaXNwbGF5IG9yIGRvbid0IGRpc3BsYXkgYSBub3RpZmljYXRpb24gdGhhdCB0a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lsbCBub3QgYmUgc2hvd24gYW55IG90aGVyCisgICAgICAgIC8vIHBsYWNlIHRoYW4gaGVyZSkKKworICAgICAgICAvLyBJZiBpdCBzaG91bGQgYmUgaGlkZGVuIGFuZCBpdCBpcyBhbHJlYWR5IGhpZGRlbiwgdGhlbiBub29wCisgICAgICAgIGlmICghdmlzaWJsZSAmJiAhbU5vdGlmaWNhdGlvblNob3duICYmICFmb3JjZSkgeworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisKKyAgICAgICAgTm90aWZpY2F0aW9uTWFuYWdlciBub3RpZmljYXRpb25NYW5hZ2VyID0gKE5vdGlmaWNhdGlvbk1hbmFnZXIpIG1Db250ZXh0CisgICAgICAgICAgICAgICAgLmdldFN5c3RlbVNlcnZpY2UoQ29udGV4dC5OT1RJRklDQVRJT05fU0VSVklDRSk7CisKKyAgICAgICAgTWVzc2FnZSBtZXNzYWdlOworICAgICAgICBpZiAodmlzaWJsZSkgeworCisgICAgICAgICAgICAvLyBOb3QgZW5vdWdoIHRpbWUgaGFzIHBhc3NlZCB0byBzaG93IHRoZSBub3RpZmljYXRpb24gYWdhaW4KKyAgICAgICAgICAgIGlmIChTeXN0ZW0uY3VycmVudFRpbWVNaWxsaXMoKSA8IG1Ob3RpZmljYXRpb25SZXBlYXRUaW1lKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpZiAobU5vdGlmaWNhdGlvbiA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgLy8gQ2FjaGUgdGhlIE5vdGlmaWNhdGlvbiBvYmplY3QuCisgICAgICAgICAgICAgICAgbU5vdGlmaWNhdGlvbiA9IG5ldyBOb3RpZmljYXRpb24oKTsKKyAgICAgICAgICAgICAgICBtTm90aWZpY2F0aW9uLndoZW4gPSAwOworICAgICAgICAgICAgICAgIG1Ob3RpZmljYXRpb24uaWNvbiA9IElDT05fTkVUV09SS1NfQVZBSUxBQkxFOworICAgICAgICAgICAgICAgIG1Ob3RpZmljYXRpb24uZmxhZ3MgPSBOb3RpZmljYXRpb24uRkxBR19BVVRPX0NBTkNFTDsKKyAgICAgICAgICAgICAgICBtTm90aWZpY2F0aW9uLmNvbnRlbnRJbnRlbnQgPSBQZW5kaW5nSW50ZW50LmdldEFjdGl2aXR5KG1Db250ZXh0LCAwLAorICAgICAgICAgICAgICAgICAgICAgICAgbmV3IEludGVudChXaWZpTWFuYWdlci5BQ1RJT05fUElDS19XSUZJX05FVFdPUkspLCAwKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgQ2hhclNlcXVlbmNlIHRpdGxlID0gbUNvbnRleHQuZ2V0UmVzb3VyY2VzKCkuZ2V0UXVhbnRpdHlUZXh0KAorICAgICAgICAgICAgICAgICAgICBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnBsdXJhbHMud2lmaV9hdmFpbGFibGUsIG51bU5ldHdvcmtzKTsKKyAgICAgICAgICAgIENoYXJTZXF1ZW5jZSBkZXRhaWxzID0gbUNvbnRleHQuZ2V0UmVzb3VyY2VzKCkuZ2V0UXVhbnRpdHlUZXh0KAorICAgICAgICAgICAgICAgICAgICBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnBsdXJhbHMud2lmaV9hdmFpbGFibGVfZGV0YWlsZWQsIG51bU5ldHdvcmtzKTsKKyAgICAgICAgICAgIG1Ob3RpZmljYXRpb24udGlja2VyVGV4dCA9IHRpdGxlOworICAgICAgICAgICAgbU5vdGlmaWNhdGlvbi5zZXRMYXRlc3RFdmVudEluZm8obUNvbnRleHQsIHRpdGxlLCBkZXRhaWxzLCBtTm90aWZpY2F0aW9uLmNvbnRlbnRJbnRlbnQpOworCisgICAgICAgICAgICBtTm90aWZpY2F0aW9uUmVwZWF0VGltZSA9IFN5c3RlbS5jdXJyZW50VGltZU1pbGxpcygpICsgTk9USUZJQ0FUSU9OX1JFUEVBVF9ERUxBWV9NUzsKKworICAgICAgICAgICAgbm90aWZpY2F0aW9uTWFuYWdlci5ub3RpZnkoSUNPTl9ORVRXT1JLU19BVkFJTEFCTEUsIG1Ob3RpZmljYXRpb24pOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgbm90aWZpY2F0aW9uTWFuYWdlci5jYW5jZWwoSUNPTl9ORVRXT1JLU19BVkFJTEFCTEUpOworICAgICAgICB9CisKKyAgICAgICAgbU5vdGlmaWNhdGlvblNob3duID0gdmlzaWJsZTsKKyAgICB9CisKKyAgICBwcml2YXRlIGNsYXNzIE5vdGlmaWNhdGlvbkVuYWJsZWRTZXR0aW5nT2JzZXJ2ZXIgZXh0ZW5kcyBDb250ZW50T2JzZXJ2ZXIgeworCisgICAgICAgIHB1YmxpYyBOb3RpZmljYXRpb25FbmFibGVkU2V0dGluZ09ic2VydmVyKEhhbmRsZXIgaGFuZGxlcikgeworICAgICAgICAgICAgc3VwZXIoaGFuZGxlcik7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCByZWdpc3RlcigpIHsKKyAgICAgICAgICAgIENvbnRlbnRSZXNvbHZlciBjciA9IG1Db250ZXh0LmdldENvbnRlbnRSZXNvbHZlcigpOworICAgICAgICAgICAgY3IucmVnaXN0ZXJDb250ZW50T2JzZXJ2ZXIoU2V0dGluZ3MuU2VjdXJlLmdldFVyaUZvcigKKyAgICAgICAgICAgICAgICBTZXR0aW5ncy5TZWN1cmUuV0lGSV9ORVRXT1JLU19BVkFJTEFCTEVfTk9USUZJQ0FUSU9OX09OKSwgdHJ1ZSwgdGhpcyk7CisgICAgICAgICAgICBtTm90aWZpY2F0aW9uRW5hYmxlZCA9IGdldFZhbHVlKCk7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIHZvaWQgb25DaGFuZ2UoYm9vbGVhbiBzZWxmQ2hhbmdlKSB7CisgICAgICAgICAgICBzdXBlci5vbkNoYW5nZShzZWxmQ2hhbmdlKTsKKworICAgICAgICAgICAgbU5vdGlmaWNhdGlvbkVuYWJsZ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3dTdGF0ZSB3aW4gPSBudWxsOworICAgICAgICBsb25nIG9yaWdJZDsKIAogICAgICAgICBzeW5jaHJvbml6ZWQobVdpbmRvd01hcCkgewotICAgICAgICAgICAgLy8gSW5zdGFudGlhdGluZyBhIERpc3BsYXkgcmVxdWlyZXMgdGFsa2luZyB3aXRoIHRoZSBzaW11bGF0b3IsCi0gICAgICAgICAgICAvLyBzbyBkb24ndCBkbyBpdCB1bnRpbCB3ZSBrbm93IHRoZSBzeXN0ZW0gaXMgbW9zdGx5IHVwIGFuZAotICAgICAgICAgICAgLy8gcnVubmluZy4KICAgICAgICAgICAgIGlmIChtRGlzcGxheSA9PSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgV2luZG93TWFuYWdlciB3bSA9IChXaW5kb3dNYW5hZ2VyKW1Db250ZXh0LmdldFN5c3RlbVNlcnZpY2UoQ29udGV4dC5XSU5ET1dfU0VSVklDRSk7Ci0gICAgICAgICAgICAgICAgbURpc3BsYXkgPSB3bS5nZXREZWZhdWx0RGlzcGxheSgpOwotICAgICAgICAgICAgICAgIG1Jbml0aWFsRGlzcGxheVdpZHRoID0gbURpc3BsYXkuZ2V0V2lkdGgoKTsKLSAgICAgICAgICAgICAgICBtSW5pdGlhbERpc3BsYXlIZWlnaHQgPSBtRGlzcGxheS5nZXRIZWlnaHQoKTsKLSAgICAgICAgICAgICAgICBtSW5wdXRNYW5hZ2VyLnNldERpc3BsYXlTaXplKDAsIG1Jbml0aWFsRGlzcGxheVdpZHRoLCBtSW5pdGlhbERpc3BsYXlIZWlnaHQpOwotICAgICAgICAgICAgICAgIHJlcG9ydE5ld0NvbmZpZyA9IHRydWU7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigiRGlzcGxheSBoYXMgbm90IGJlZW4gaW5pdGlhbGlhbGl6ZWQiKTsKICAgICAgICAgICAgIH0KIAogICAgICAgICAgICAgaWYgKG1XaW5kb3dNYXAuY29udGFpbnNLZ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AgLTMxMTIsOCArMzEwMCwxMSBAQAogICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgfSBlbHNlIGlmIChjdXJyZW50Q29uZmlnICE9IG51bGwpIHsKICAgICAgICAgICAgICAgICAvLyBObyBvYnZpb3VzIGFjdGlvbiB3ZSBuZWVkIHRvIHRha2UsIGJ1dCBpZiBvdXIgY3VycmVudAotICAgICAgICAgICAgICAgIC8vIHN0YXRlIG1pc21hdGNoZXMgdGhlIGFjdGl2aXR5IG1hYW5hZ2VyJ3MsIHVwZGF0ZSBpdAorICAgICAgICAgICAgICAgIC8vIHN0YXRlIG1pc21hdGNoZXMgdGhlIGFjdGl2aXR5IG1hbmFnZXIncywgdXBkYXRlIGl0LAorICAgICAgICAgICAgICAgIC8vIGRpc3JlZ2FyZGluZyBmb250IHNjYWxlLCB3aGljaCBzaG91bGQgcmVtYWluIHNldCB0bworICAgICAgICAgICAgICAgIC8vIHRoZSB2YWx1ZSBvZiB0aGUgcHJldmlvdXMgY29uZmlndXJhdGlvbi4KICAgICAgICAgICAgICAgICBtVGVtcENvbmZpZ3VyYXRpb24uc2V0VG9EZWZhdWx0cygpOworICAgICAgICAgICAgICAgIG1UZW1wQ29uZmlndXJhdGlvbi5mb250U2NhbGUgPSBjdXJyZW50Q29uZmlnLmZvbnRTY2FsZTsKICAgICAgICAgICAgICAgICBpZiAoY29tcHV0ZU5ld0NvbmZpZ3VyYXRpb25Mb2NrZWQobVRlbXBDb25maWd1cmF0aW9uKSkgewogICAgICAgICAgICAgICAgICAgICBpZiAoY3VycmVudENvbmZpZy5kaWZmKG1UZW1wQ29uZmlndXJhdGlvbikgIT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgICAgbVdhaXRpbmdGb3JDb25maWcgPSB0cnVlOwpAQCAtNDQzNyw4ICs0NDI4LDcgQEAKICAgICAgICAgICAgIGZpbmFsIGludCBOID0gbVdpbmRvd3Muc2l6ZSgpOwogICAgICAgICAgICAgZm9yIChpbnQgaT0wOyBpPE47IGkrKykgewogICAgICAgICAgICAgICAgIFdpbmRvd1N0YXRlIHcgPSBtV2luZG93cy5nZXQoaSk7Ci0gICAgICAgICAgICAgICAgaWYgKHcuaXNWaXNpYmxlTHcoKSAmJiAhdy5tT2JzY3VyZWQKLSAgICAgICAgICAgICAgICAgICAgICAgICYmICh3Lm1PcmllbnRhdGlvbkNoYW5naW5nIHx8ICF3LmlzRHJhd25MdygpKSkgeworICAgICAgICAgICAgICAgIGlmICh3LmlzVmlzaWJsZUx3KCkgJiYgIXcubU9ic2N1cmVkICYmICF3LmlzRHJhd25MdygpKSB7CiAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CkBAIC01NjAyLDYgKzU1OTIsMjIgQEAKICAgICB9CiAKICAgICBwdWJsaWMgdm9pZCBzeXN0ZW1SZWFkeSgpIHsKKyAgICAgICAgc3luY2hyb25pemVkKG1XaW5kb3dNYXApIHsKKyAgICAgICAgICAgIGlmIChtRGlzcGxheSAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigiRGlzcGxheSBhbHJlYWR5IGluaXRpYWxpemVkIik7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBXaW5kb3dNYW5hZ2VyIHdtID0gKFdpbmRvd01hbmFnZXIpbUNvbnRleHQuZ2V0U3lzdGVtU2VydmljZShDb250ZXh0LldJTkRPV19TRVJWSUNFKTsKKyAgICAgICAgICAgIG1EaXNwbGF5ID0gd20uZ2V0RGVmYXVsdERpc3BsYXkoKTsKKyAgICAgICAgICAgIG1Jbml0aWFsRGlzcGxheVdpZHRoID0gbURpc3BsYXkuZ2V0V2lkdGgoKTsKKyAgICAgICAgICAgIG1Jbml0aWFsRGlzcGxheUhlaWdodCA9IG1EaXNwbGF5LmdldEhlaWdodCgpOworICAgICAgICAgICAgbUlucHV0TWFuYWdlci5zZXREaXNwbGF5U2l6ZSgwLC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WUgaWYgdGhlIG9yaWVudGF0aW9uCi0gICAgICAgICAqIGlzIGNoYW5naW5nIGV2ZW4gaWYgdGhlIHdpbmRvdyBoYXNuJ3QgcmVkcmF3biBiZWNhdXNlIHdlIGRvbid0IHdhbnQKLSAgICAgICAgICogdG8gc3RvcCB0aGluZ3MgZnJvbSBleGVjdXRpbmcgZHVyaW5nIHRoYXQgdGltZS4KKyAgICAgICAgICogY29tcGxldGUgVUkgaW4gdG8uCiAgICAgICAgICAqLwogICAgICAgICBwdWJsaWMgYm9vbGVhbiBpc0RyYXduTHcoKSB7CiAgICAgICAgICAgICBmaW5hbCBBcHBXaW5kb3dUb2tlbiBhdG9rZW4gPSBtQXBwVG9rZW47CiAgICAgICAgICAgICByZXR1cm4gbVN1cmZhY2UgIT0gbnVsbCAmJiAhbURlc3Ryb3lpbmcKLSAgICAgICAgICAgICAgICAmJiAobU9yaWVudGF0aW9uQ2hhbmdpbmcgfHwgKCFtRHJhd1BlbmRpbmcgJiYgIW1Db21taXREcmF3UGVuZGluZykpOworICAgICAgICAgICAgICAgICYmICFtRHJhd1BlbmRpbmcgJiYgIW1Db21taXREcmF3UGVuZGluZzsKICAgICAgICAgfQogCiAgICAgICAgIHB1YmxpYyBib29sZWFuIGZpbGxzU2NyZWVuTHcoaW50IHNjcmVlbldpZHRoLCBpbnQgc2NyZWVuSGVpZ2h0LApAQCAtODUxMSw2ICs4NTE1LDExIEBACiAKICAgICBwcml2YXRlIGZpbmFsIHZvaWQgcGVyZm9ybUxheW91dEFuZFBsYWNlU3VyZmFjZXNMb2NrZWRJbm5lcigKICAgICAgICAgICAgIGJvb2xlYW4gcmVjb3ZlcmluZ01lbW9yeSkgeworICAgICAgICBpZiAobURpc3BsYXkgPT0gbnVsbCkgeworICAgICAgICAgICAgU2xvZy5pKFRBRywgInNraXBwaW5nIHBlcmZvcm1MYXlvdXRBbmRQbGFjZVN1cmZhY2VzTG9ja2VkSW5uZXIgd2l0aCBubyBtRGlzcGxheSIpOworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisKICAgICAgICAgZmluYWwgbG9uZyBjdXJyZW50VGltZSA9IFN5c3RlbUNsb2NrLnVwdGltZU1pbGxpcygpOwogICAgICAgICBmaW5hbCBpbnQgZHcgPSBtRGlzcGxheS5nZXRXaWR0aCgpOwogICAgICAgICBmaW5hbCBpbnQgZGggPSBtRGlzcGxheS5nZXRIZWlnaHQoKTsKQEAgLTkyOTksMTIgKzkzMDgsNiBAQAogICAgICAgICAgICAgICAgICAgICBpZiAody5tQXR0YWNoZWRIaWRkZW4gfHwgIXcuaXNSZWFkeUZvckRpc3BsYXkoKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF3Lm1MYXN0SGlkZGVuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy9kdW1wKCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKERFQlVHX0NPTkZJR1VSQVRJT04pIFNsb2cudihUQUcsICJXaW5kb3cgaGlkaW5nOiB3YWl0aW5nVG9TaG93PSIKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgdy5tUm9vdFRva2VuLndhaXRpbmdUb1Nob3cgKyAiIHBvbHZpcz0iCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIHcubVBvbGljeVZpc2liaWxpdHkgKyAiIGF0dGhpZD0iCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIHcubUF0dGFjaGVkSGlkZGVuICsgIiB0b2toaWQ9IgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyB3Lm1Sb290VG9rZW4uaGlkZGVuICsgIiB2aXM9IgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyB3Lm1WaWV3VmlzaWJpbGl0eSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdy5tTGFzdEhpZGRlbiA9IHRydWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKFNIT1dfVFJBTlNBQ1RJT05TKSBsb2dTdXJmYWNlKHcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiSElERSAocGVyZm9ybUxheW91dCkiLCBudWxsKTsKQEAgLTk3MDEsMzAgKzk3MDQsMjYgQEAKICAgICAgICAgfSBlbHNlIGlmIChhbmltYXRpbmcpIHsKICAgICAgICAgICAgIHJlcXVlc3RBbmltYXRpb25Mb2NrZWQoY3VycmVudFRpbWUrKDEwMDAvNjApLVN5c3RlbUNsb2NrLnVwdGltZU1pbGxpcygpKTsKICAgICAgICAgfQotICAgICAgICAKKwogICAgICAgICBtSW5wdXRNb25pdG9yLnVwZGF0ZUlucHV0V2luZG93c0x3KCk7Ci0gICAgICAgIAotICAgICAgICBpZiAoREVCVUdfRlJFRVpFKSBTbG9nLnYoVEFHLCAiTGF5b3V0OiBtRGlzcGxheUZyb3plbj0iICsgbURpc3BsYXlGcm96ZW4KLSAgICAgICAgICAgICAgICArICIgaG9sZFNjcmVlbj0iICsgaG9sZFNjcmVlbik7Ci0gICAgICAgIGlmICghbURpc3BsYXlGcm96ZW4pIHsKLSAgICAgICAgICAgIHNldEhvbGRTY3JlZW5Mb2NrZWQoaG9sZFNjcmVlbiAhPSBudWxsKTsKLSAgICAgICAgICAgIGlmIChzY3JlZW5CcmlnaHRuZXNzIDwgMCB8fCBzY3JlZW5CcmlnaHRuZXNzID4gMS4wZikgewotICAgICAgICAgICAgICAgIG1Qb3dlck1hbmFnZXIuc2V0U2NyZWVuQnJpZ2h0bmVzc092ZXJyaWRlKC0xKTsKLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgbVBvd2VyTWFuYWdlci5zZXRTY3JlZW5CcmlnaHRuZXNzT3ZlcnJpZGUoKGludCkKLSAgICAgICAgICAgICAgICAgICAgICAgIChzY3JlZW5CcmlnaHRuZXNzICogUG93ZXIuQlJJR0hUTkVTU19PTikpOwotICAgICAgICAgICAgfQotICAgIC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T04pKTsKKyAgICAgICAgfQorICAgICAgICBpZiAoYnV0dG9uQnJpZ2h0bmVzcyA8IDAgfHwgYnV0dG9uQnJpZ2h0bmVzcyA+IDEuMGYpIHsKKyAgICAgICAgICAgIG1Qb3dlck1hbmFnZXIuc2V0QnV0dG9uQnJpZ2h0bmVzc092ZXJyaWRlKC0xKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIG1Qb3dlck1hbmFnZXIuc2V0QnV0dG9uQnJpZ2h0bmVzc092ZXJyaWRlKChpbnQpCisgICAgICAgICAgICAgICAgICAgIChidXR0b25CcmlnaHRuZXNzICogUG93ZXIuQlJJR0hUTkVTU19PTikpOworICAgICAgICB9CisgICAgICAgIGlmIChob2xkU2NyZWVuICE9IG1Ib2xkaW5nU2NyZWVuT24pIHsKKyAgICAgICAgICAgIG1Ib2xkaW5nU2NyZWVuT24gPSBob2xkU2NyZWVuOworICAgICAgICAgICAgTWVzc2FnZSBtID0gbUgub2J0YWluTWVzc2FnZShILkhPTERfU0NSRUVOX0NIQU5HRUQsIGhvbGRTY3JlZW4pOworICAgICAgICAgICAgbUguc2VuZE1lc3NhZ2UobSk7CiAgICAgICAgIH0KIAogICAgICAgICBpZiAobVR1cm5PblNjcmVlbikgewpAQCAtMTAwMTMsOCArMTAwMTIsNiBAQAogICAgICAgICAgICAgbUZyZWV6ZUdjUGVuZGluZyA9IG5vdzsKICAgICAgICAgfQogCi0gICAgICAgIGlmIChERUJVR19GUkVFWkUpIFNsb2cudihUQUcsICIqKiogRlJFRVpJTkcgRElTUExBWSIsIG5ldyBSdW50aW1lRXhjZXB0aW9uKCkpOwotICAgICAgICAKICAgICAgICAgbURpc3BsYXlGcm96ZW4gPSB0cnVlOwogICAgICAgICAKICAgICAgICAgbUlucHV0TW9uaXRvci5mcmVlemVJbnB1dERpc3BhdGNoaW5nTHcoKTsKQEAgLTEwMDQxLDggKzEwMDM4LDYgQEAKICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgfQogICAgICAgICAKLSAgICAgICAgaWYgKERFQlVHX0ZSRUVaRSkgU2xvZy52KFRBRywgIioqKiBVTkZSRUVaSU5HIERJU1BMQVkiLCBuZXcgUnVudGltZUV4Y2VwdGlvbigpKTsKLSAgICAgICAgCiAgICAgICAgIG1EaXNwbGF5RnJvemVuID0gZmFsc2U7CiAgICAgICAgIG1ILnJlbW92ZU1lc3NhZ2VzKEguQVBQX0ZSRUVaRV9USU1FT1VUKTsKICAgICAgICAgaWYgKFBST0ZJTEVfT1JJRU5UQVRJT04pIHsKZGlmZiAtLWdpdCBhL3NlcnZpY2VzL2phdmEvY29tL2FuZHJvaWQvc2VydmVyL2FtL0FjdGl2aXR5TWFuYWdlclNlcnZpY2UuamF2YSBiL3NlcnZpY2VzL2phdmEvY29tL2FuZHJvaWQvc2VydmVyL2FtL0FjdGl2aXR5TWFuYWdlclNlcnZpY2UuamF2YQppbmRleCBhM2JhNGVkLi42Mzc0NmU3YiAxMDA2NDQKLS0tIGEvc2VydmljZXMvamF2YS9jb20vYW5kcm9pZC9zZXJ2ZXIvYW0vQWN0aXZpdHlNYW5hZ2VyU2VydmljZS5qYXZhCisrKyBiL3NlcnZpY2VzL2phdmEvY29tL2FuZHJvaWQvc2VydmVyL2FtL0FjdGl2aXR5TWFuYWdlclNlcnZpY2UuamF2YQpAQCAtMjM3NSw2ICsyMzc1LDEwIEBACiAgICAgICAgICAgICB9CiAgICAgICAgICAgICAKICAgICAgICAgICAgIGlmIChwcm9jLnRocmVhZCAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgaWYgKHByb2MucGlkID09IFByb2Nlc3MubXlQaWQoKSkgeworICAgICAgICAgICAgICAgICAgICBMb2cudyhUQUcsICJjcmFzaEFwcGxpY2F0aW9uOiB0cnlpbmcgdG8gY3Jhc2ggc2VsZiEiKTsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBsb25nIGlkZW50ID0gQmluZGVyLmNsZWFyQ2FsbGluZ0lkZW50aXR5KCk7CiAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgcHJvYy50aHJlYWQuc2NoZWR1bGVDcmFzaChtZXNzYWdlKTsKQEAgLTExODMwLDcgKzExODM0LDY5IEBACiAgICAgICAgICAgICB9CiAgICAgICAgIH0KICAgICB9Ci0gICAgCisKKyAgICBwdWJsaWMgYm9vbGVhbiBkdW1wSGVhcChTdHJpbmcgcHJvY2VzcywgYm9vbGVhbiBtYW5hZ2VkLAorICAgICAgICAgICAgU3RyaW5nIHBhdGgsIFBhcmNlbEZpbGVEZXNjcmlwdG9yIGZkKSB0aHJvd3MgUmVtb3RlRXhjZXB0aW9uIHsKKworICAgICAgICB0cnkgeworICAgICAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CisgICAgICAgICAgICAgICAgLy8gbm90ZTogaGlqYWNraW5nIFNFVF9BQ1RJVklUWV9XQVRDSEVSLCBidXQgc2hvdWxkIGJlIGNoYW5nZWQgdG8KKyAgICAgICAgICAgICAgICAvLyBpdHMgb3duIHBlcm1pc3Npb24gKHNhbWUgYXMgcHJvZmlsZUNvbnRyb2wpLgorICAgICAgICAgICAgICAgIGlmIChjaGVja0NhbGxpbmdQZXJtaXNzaW9uKGFuZHJvaWQuTWFuaWZlc3QucGVybWlzc2lvbi5TRVRfQUNUSVZJVFlfV0FUQ0hFUikKKyAgICAgICAgICAgICAgICAgICAgICAgICE9IFBhY2thZ2VNYW5hZ2VyLlBFUk1JU1NJT05fR1JBTlRFRCkgeworICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgU2VjdXJpdHlFeGNlcHRpb24oIlJlcXVpcmVzIHBlcm1pc3Npb24gIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgYW5kcm9pZC5NYW5pZmVzdC5wZXJtaXNzaW9uLlNFVF9BQ1RJVklUWV9XQVRDSEVSKTsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICBpZiAoZmQgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCJudWxsIGZkIik7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgUHJvY2Vzc1JlY29yZCBwcm9jID0gbnVsbDsKKyAgICAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgICAgICBpbnQgcGlkID0gSW50ZWdlci5wYXJzZUludChwcm9jZXNzKTsKKyAgICAgICAgICAgICAgICAgICAgc3luY2hyb25pemVkIChtUGlkc1NlbGZMb2NrZWQpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHByb2MgPSBtUGlkc1NlbGZMb2NrZWQuZ2V0KHBpZCk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9IGNhdGNoIChOdW1iZXJGb3JtYXRFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIGlmIChwcm9jID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgSGFzaE1hcDxTdHJpbmcsIFNwYXJzZUFycmF5PFByb2Nlc3NSZWNvcmQ+PiBhbGwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICA9IG1Qcm9jZXNzTmFtZXMuZ2V0TWFwKCk7CisgICAgICAgICAgICAgICAgICAgIFNwYXJzZUFycmF5PFByb2Nlc3NSZWNvcmQ+IHByb2NzID0gYWxsLmdldChwcm9jZXNzKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKHByb2NzICE9IG51bGwgJiYgcHJvY3Muc2l6ZSgpID4gMCkgeworICAgICAgICAgICAgICAgICAgICAgICAgcHJvYyA9IHByb2NzLnZhbHVlQXQoMCk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICBpZiAocHJvYyA9PSBudWxsIHx8IHByb2MudGhyZWFkID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigiVW5rbm93biBwcm9jZXNzOiAiICsgcHJvY2Vzcyk7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgYm9vbGVhbiBpc1NlY3VyZSA9ICIxIi5lcXVhbHMoU3lzdGVtUHJvcGVydGllcy5nZXQoU1lTVEVNX1NFQ1VSRSwgIjAiKSk7CisgICAgICAgICAgICAgICAgaWYgKGlzU2VjdXJlKSB7CisgICAgICAgICAgICAgICAgICAgIGlmICgocHJvYy5pbmZvLmZsYWdzJkFwcGxpY2F0aW9uSW5mby5GTEFHX0RFQlVHR0FCTEUpID09IDApIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBTZWN1cml0eUV4Y2VwdGlvbigiUHJvY2VzcyBub3QgZGVidWdnYWJsZTogIiArIHByb2MpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgcHJvYy50aHJlYWQuZHVtcEhlYXAobWFuYWdlZCwgcGF0aCwgZmQpOworICAgICAgICAgICAgICAgIGZkID0gbnVsbDsKKyAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oIlByb2Nlc3MgZGlzYXBwZWFyZWQiKTsKKyAgICAgICAgfSBmaW5hbGx5IHsKKyAgICAgICAgICAgIGlmIChmZCAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICAgICAgZmQuY2xvc2UoKTsKKyAgICAgICAgICAgICAgICB9IGNhdGNoIChJT0V4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgfQorICAg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AgICAgaWYgKGlzV2lmaShpZmFjZSkpIHsKQEAgLTE4Miw2ICsxOTAsOCBAQAogICAgICAgICB9IGVsc2UgaWYgKGlzVXNiKGlmYWNlKSkgewogICAgICAgICAgICAgZm91bmQgPSB0cnVlOwogICAgICAgICAgICAgdXNiID0gdHJ1ZTsKKyAgICAgICAgfSBlbHNlIGlmIChpc0JsdWV0b290aChpZmFjZSkpIHsKKyAgICAgICAgICAgIGZvdW5kID0gdHJ1ZTsKICAgICAgICAgfQogICAgICAgICBpZiAoZm91bmQgPT0gZmFsc2UpIHJldHVybjsKIApAQCAtMjE2LDYgKzIyNiwxMiBAQAogICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgfQogCisgICAgcHVibGljIGJvb2xlYW4gaXNCbHVldG9vdGgoU3RyaW5nIGlmYWNlKSB7CisgICAgICAgIGZvciAoU3RyaW5nIHJlZ2V4IDogbVRldGhlcmFibGVCbHVldG9vdGhSZWdleHMpIHsKKyAgICAgICAgICAgIGlmIChpZmFjZS5tYXRjaGVzKHJlZ2V4KSkgcmV0dXJuIHRydWU7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KICAgICBwdWJsaWMgdm9pZCBpbnRlcmZhY2VBZGRlZChTdHJpbmcgaWZhY2UpIHsKICAgICAgICAgSUJpbmRlciBiID0gU2VydmljZU1hbmFnZXIuZ2V0U2VydmljZShDb250ZXh0Lk5FVFdPUktNQU5BR0VNRU5UX1NFUlZJQ0UpOwogICAgICAgICBJTmV0d29ya01hbmFnZW1lbnRTZXJ2aWNlIHNlcnZpY2UgPSBJTmV0d29ya01hbmFnZW1lbnRTZXJ2aWNlLlN0dWIuYXNJbnRlcmZhY2UoYik7CkBAIC0yMjgsMjkgKzI0NCwzNCBAQAogICAgICAgICAgICAgZm91bmQgPSB0cnVlOwogICAgICAgICAgICAgdXNiID0gdHJ1ZTsKICAgICAgICAgfQorICAgICAgICBpZiAoaXNCbHVldG9vdGgoaWZhY2UpKSB7CisgICAgICAgICAgICBmb3VuZCA9IHRydWU7CisgICAgICAgIH0KICAgICAgICAgaWYgKGZvdW5kID09IGZhbHNlKSB7Ci0gICAgICAgICAgICBMb2cuZChUQUcsIGlmYWNlICsgIiBpcyBub3QgYSB0ZXRoZXJhYmxlIGlmYWNlLCBpZ25vcmluZyIpOworICAgICAgICAgICAgaWYgKERFQlVHKSBMb2cuZChUQUcsIGlmYWNlICsgIiBpcyBub3QgYSB0ZXRoZXJhYmxlIGlmYWNlLCBpZ25vcmluZyIpOwogICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICB9CiAKICAgICAgICAgc3luY2hyb25pemVkIChtSWZhY2VzKSB7CiAgICAgICAgICAgICBUZXRoZXJJbnRlcmZhY2VTTSBzbSA9IG1JZmFjZXMuZ2V0KGlmYWNlKTsKICAgICAgICAgICAgIGlmIChzbSAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgTG9nLmUoVEFHLCAiYWN0aXZlIGlmYWNlICgiICsgaWZhY2UgKyAiKSByZXBvcnRlZCBhcyBhZGRlZCwgaWdub3JpbmciKTsKKyAgICAgICAgICAgICAgICBpZiAoREVCVUcpIExvZy5kKFRBRywgImFjdGl2ZSBpZmFjZSAoIiArIGlmYWNlICsgIikgcmVwb3J0ZWQgYXMgYWRkZWQsIGlnbm9yaW5nIik7CiAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgfQogICAgICAgICAgICAgc20gPSBuZXcgVGV0aGVySW50ZXJmYWNlU00oaWZhY2UsIG1Mb29wZXIsIHVzYik7CiAgICAgICAgICAgICBtSWZhY2VzLnB1dChpZmFjZSwgc20pOwogICAgICAgICAgICAgc20uc3RhcnQoKTsKICAgICAgICAgfQotICAgICAgICBMb2cuZChUQUcsICJpbnRlcmZhY2VBZGRlZCA6IiArIGlmYWNlKTsKKyAgICAgICAgaWYgKERFQlVHKSBMb2cuZChUQUcsICJpbnRlcmZhY2VBZGRlZCA6IiArIGlmYWNlKTsKICAgICB9CiAKICAgICBwdWJsaWMgdm9pZCBpbnRlcmZhY2VSZW1vdmVkKFN0cmluZyBpZmFjZSkgewogICAgICAgICBzeW5jaHJvbml6ZWQgKG1JZmFjZXMpIHsKICAgICAgICAgICAgIFRldGhlckludGVyZmFjZVNNIHNtID0gbUlmYWNlcy5nZXQoaWZhY2UpOwogICAgICAgICAgICAgaWYgKHNtID09IG51bGwpIHsKLSAgICAgICAgICAgICAgICBMb2cuZShUQUcsICJhdHRlbXB0aW5nIHRvIHJlbW92ZSB1bmtub3duIGlmYWNlICgiICsgaWZhY2UgKyAiKSwgaWdub3JpbmciKTsKKyAgICAgICAgICAgICAgICBpZiAoREVCVUcpIHsKKyAgICAgICAgICAgICAgICAgICAgTG9nLmUoVEFHLCAiYXR0ZW1wdGluZyB0byByZW1vdmUgdW5rbm93biBpZmFjZSAoIiArIGlmYWNlICsgIiksIGlnbm9yaW5nIik7CisgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgIH0KICAgICAgICAgICAgIHNtLnNlbmRNZXNzYWdlKFRldGhlckludGVyZmFjZVNNLkNNRF9JTlRFUkZBQ0VfRE9XTik7CkBAIC0zMjEsMTMgKzM0MiwxNCBAQAogCiAgICAgICAgIGJvb2xlYW4gd2lmaVRldGhlcmVkID0gZmFsc2U7CiAgICAgICAgIGJvb2xlYW4gdXNiVGV0aGVyZWQgPSBmYWxzZTsKKyAgICAgICAgYm9vbGVhbiBibHVldG9vdGhUZXRoZXJlZCA9IGZhbHNlOwogCiAgICAgICAgIHN5bmNocm9uaXplZCAobUlmYWNlcykgewogICAgICAgICAgICAgU2V0IGlmYWNlcyA9IG1JZmFjZXMua2V5U2V0KCk7CiAgICAgICAgICAgICBmb3IgKE9iamVjdCBpZmFjZSA6IGlmYWNlcykgewogICAgICAgICAgICAgICAgIFRldGhlckludGVyZmFjZVNNIHNtID0gbUlmYWNlcy5nZXQoaWZhY2UpOwogICAgICAgICAgICAgICAgIGlmIChzbSAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIGlmKHNtLmlzRXJyb3JlZCgpKSB7CisgICAgICAgICAgICAgICAgICAgIGlmIChzbS5pc0Vycm9yZWQoKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3JlZExpc3QuYWRkKChTdHJpbmcpaWZhY2UpOwogICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHNtLmlzQXZhaWxhYmxlKCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgIGF2YWlsYWJsZUxpc3QuYWRkKChTdHJpbmcpaWZhY2UpOwpAQCAtMzM2LDYgKzM1OCw4IEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXNiVGV0aGVyZWQgPSB0cnVlOwogICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChpc1dpZmkoKFN0cmluZylpZmFjZSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aWZpVGV0aGVyZWQgPSB0cnVlOworICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoaXNCbHVldG9vdGgoKFN0cmluZylpZmFjZSkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBibHVldG9vdGhUZXRoZXJlZCA9IHRydWU7CiAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICBhY3RpdmVMaXN0LmFkZCgoU3RyaW5nKWlmYWNlKTsKICAgICAgICAgICAgICAgICAgICAgfQpAQCAtMzUwLDE3ICszNzQsMjUgQEAKICAgICAgICAgYnJvYWRjYXN0LnB1dFN0cmluZ0FycmF5TGlzdEV4dHJhKENvbm5lY3Rpdml0eU1hbmFnZXIuRVhUUkFfRVJST1JFRF9URVRIRVIsCiAgICAgICAgICAgICAgICAgZXJyb3JlZExpc3QpOwogICAgICAgICBtQ29udGV4dC5zZW5kU3RpY2t5QnJvYWRjYXN0KGJyb2FkY2FzdCk7Ci0gICAgICAgIExvZy5kKFRBRywgInNlbmRUZXRoZXJTdGF0ZUNoYW5nZWRCcm9hZGNhc3QgIiArIGF2YWlsYWJsZUxpc3Quc2l6ZSgpICsgIiwgIiArCi0gICAgICAgICAgICAgICAgYWN0aXZlTGlzdC5zaXplKCkgKyAiLCAiICsgZXJyb3JlZExpc3Quc2l6ZSgpKTsKKyAgICAgICAgaWYgKERFQlVHKSB7CisgICAgICAgICAgICBMb2cuZChUQUcsICJzZW5kVGV0aGVyU3RhdGVDaGFuZ2VkQnJvYWRjYXN0ICIgKyBhdmFpbGFibGVMaXN0LnNpemUoKSArICIsICIgKworICAgICAgICAgICAgICAgICAgICBhY3RpdmVMaXN0LnNpemUoKSArICIsICIgKyBlcnJvcmVkTGlzdC5zaXplKCkpOworICAgICAgICB9CiAKICAgICAgICAgaWYgKHVzYlRldGhlcmVkKSB7Ci0gICAgICAgICAgICBpZiAod2lmaVRldGhlcmVkKSB7CisgICAgICAgICAgICBpZiAod2lmaVRldGhlcmVkIHx8IGJsdWV0b290aFRldGhlcmVkKSB7CiAgICAgICAgICAgICAgICAgc2hvd1RldGhlcmVkTm90aWZpY2F0aW9uKGNvbS5hbmRyb2lkLmludGVybmFsLlIuZHJhd2FibGUuc3RhdF9zeXNfdGV0aGVyX2dlbmVyYWwpOwogICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICBzaG93VGV0aGVyZWROb3RpZmljYXRpb24oY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5kcmF3YWJsZS5zdGF0X3N5c190ZXRoZXJfdXNiKTsKICAgICAgICAgICAgIH0KICAgICAgICAgfSBlbHNlIGlmICh3aWZpVGV0aGVyZWQpIHsKLSAgICAgICAgICAgIHNob3dUZXRoZXJlZE5vdGlmaWNhdGlvbihjb20uYW5kcm9pZC5pbnRlcm5hbC5SLmRyYXdhYmxlLnN0YXRfc3lzX3RldGhlcl93aWZpKTsKKyAgICAgICAgICAgIGlmIChibHVldG9vdGhUZXRoZXJlZCkgeworICAgICAgICAgICAgICAgIHNob3dUZXRoZXJlZE5vdGlmaWNhdGlvbihjb20uYW5kcm9pZC5pbnRlcm5hbC5SLmRyYXdhYmxlLnN0YXRfc3lzX3RldGhlcl9nZW5lcmFsKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgc2hvd1RldGhlcmVkTm90aWZpY2F0aW9uKGNvbS5hbmRyb2lkLmludGVybmFsLlIuZHJhd2FibGUuc3RhdF9zeXNfdGV0aGVyX3dpZmkpOworICAgICAgICAgICAgfQorICAgICAgICB9IGVsc2UgaWYgKGJsdWV0b290aFRldGhlcmVkKSB7CisgICAgICAgICAgICBzaG93VGV0aGVyZWROb3RpZmljYXRpb24oY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5kcmF3YWJsZS5zdGF0X3N5c190ZXRoZXJfYmx1ZXRvb3RoKTsKICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgIGNsZWFyVGV0aGVyZWROb3RpZmljYXRpb24oKTsKICAgICAgICAgfQpAQCAtMzkxLDcgKzQyMyw3IEBACiAgICAgICAgIENoYXJTZXF1ZW5jZSBtZXNzYWdlID0gci5nZXRUZXh0KGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3RyaW5nLgogICAgICAgICAgICAgICAgIHRldGhlcmVkX25vdGlmaWNhdGlvbl9tZXNzYWdlKTsKIAotICAgICAgICBpZihtVGV0aGVyZWROb3RpZmljYXRpb24gPT0gbnVsbCkgeworICAgICAgICBpZiAobVRldGhlcmVkTm90aWZpY2F0aW9uID09IG51bGwpIHsKICAgICAgICAgICAgIG1UZXRoZXJlZE5vdGlmaWNhdGlvbiA9IG5ldyBOb3RpZmljYXRpb24oKTsKICAgICAgICAgICAgIG1UZXRoZXJlZE5vdGlmaWNhdGlvbi53aGVuID0gMDsKICAgICAgICAgfQpAQCAtNDM1LDcgKzQ2Nyw3IEBACiAgICAgICAgICAgICAgICAgbVVzYk1hc3NTdG9yYWdlT2ZmID0gdHJ1ZTsKICA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gLy8gbWF5YmUgYSBwYXJlbnQgY2xhc3M/CkBAIC04MzMsNyArODY5LDcgQEAKICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBpZiAobVVzYikgVGV0aGVyaW5nLnRoaXMuZW5hYmxlVXNiUm5kaXModHJ1ZSk7Ci0gICAgICAgICAgICAgICAgTG9nLmQoVEFHLCAiVGV0aGVyZWQgIiArIG1JZmFjZU5hbWUpOworICAgICAgICAgICAgICAgIGlmIChERUJVRykgTG9nLmQoVEFHLCAiVGV0aGVyZWQgIiArIG1JZmFjZU5hbWUpOwogICAgICAgICAgICAgICAgIHNldEF2YWlsYWJsZShmYWxzZSk7CiAgICAgICAgICAgICAgICAgc2V0VGV0aGVyZWQodHJ1ZSk7CiAgICAgICAgICAgICAgICAgc2VuZFRldGhlclN0YXRlQ2hhbmdlZEJyb2FkY2FzdCgpOwpAQCAtODQ0LDcgKzg4MCw3IEBACiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBAT3ZlcnJpZGUKICAgICAgICAgICAgIHB1YmxpYyBib29sZWFuIHByb2Nlc3NNZXNzYWdlKE1lc3NhZ2UgbWVzc2FnZSkgewotICAgICAgICAgICAgICAgIExvZy5kKFRBRywgIlRldGhlcmVkU3RhdGUucHJvY2Vzc01lc3NhZ2Ugd2hhdD0iICsgbWVzc2FnZS53aGF0KTsKKyAgICAgICAgICAgICAgICBpZiAoREVCVUcpIExvZy5kKFRBRywgIlRldGhlcmVkU3RhdGUucHJvY2Vzc01lc3NhZ2Ugd2hhdD0iICsgbWVzc2FnZS53aGF0KTsKICAgICAgICAgICAgICAgICBib29sZWFuIHJldFZhbHVlID0gdHJ1ZTsKICAgICAgICAgICAgICAgICBib29sZWFuIGVycm9yID0gZmFsc2U7CiAgICAgICAgICAgICAgICAgc3dpdGNoIChtZXNzYWdlLndoYXQpIHsKQEAgLTg4Nyw3ICs5MjMsNyBAQAogICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChtZXNzYWdlLndoYXQgPT0gQ01EX0lOVEVSRkFDRV9ET1dOKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhbnNpdGlvblRvKG1VbmF2YWlsYWJsZVN0YXRlKTsKICAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgIExvZy5kKFRBRywgIlVudGV0aGVyZWQgIiArIG1JZmFjZU5hbWUpOworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKERFQlVHKSBMb2cuZChUQUcsICJVbnRldGhlcmVkICIgKyBtSWZhY2VOYW1lKTsKICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICBjYXNlIENNRF9URVRIRVJfQ09OTkVDVElPTl9DSEFOR0VEOgogICAgICAgICAgICAgICAgICAgICAgICAgU3RyaW5nIG5ld1Vwc3RyZWFtSWZhY2VOYW1lID0gKFN0cmluZykobWVzc2FnZS5vYmopOwpAQCAtOTYwLDcgKzk5Niw3IEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDb25uZWN0aXZpdHlNYW5hZ2VyLlRFVEhFUl9FUlJPUl9NQVNURVJfRVJST1IpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgTG9nLmQoVEFHLCAiVGV0aGVyIGxvc3QgdXBzdHJlYW0gY29ubmVjdGlvbiAiICsgbUlmYWNlTmFtZSk7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoREVCVUcpIExvZy5kKFRBRywgIlRldGhlciBsb3N0IHVwc3RyZWFtIGNvbm5lY3Rpb24gIiArIG1JZmFjZU5hbWUpOwogICAgICAgICAgICAgICAgICAgICAgICAgc2VuZFRldGhlclN0YXRlQ2hhbmdlZEJyb2FkY2FzdCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1Vc2IpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIVRldGhlcmluZy50aGlzLmNvbmZpZ3VyZVVzYklmYWNlKGZhbHNlKSkgewpAQCAtMTE5OCw4ICsxMjM0LDEwIEBACiAgICAgICAgICAgICAgICAgSUJpbmRlciBiID0gU2VydmljZU1hbmFnZXIuZ2V0U2VydmljZShDb250ZXh0LkNPTk5FQ1RJVklUWV9TRVJWSUNFKTsKICAgICAgICAgICAgICAgICBJQ29ubmVjdGl2aXR5TWFuYWdlciBjbSA9IElDb25uZWN0aXZpdHlNYW5hZ2VyLlN0dWIuYXNJbnRlcmZhY2UoYik7CiAgICAgICAgICAgICAgICAgbUNvbm5lY3Rpb25SZXF1ZXN0ZWQgPSBmYWxzZTsKLSAgICAgICAgICAgICAgICBMb2cuZChUQUcsICJjaG9vc2VVcHN0cmVhbVR5cGUoIiArIHRyeUNlbGwgKyAiKSwgIGR1blJlcXVpcmVkID0iCi0gICAgICAgICAgICAgICAgICAgICAgICArIG1EdW5SZXF1aXJlZCArICIsIGlmYWNlPSIgKyBpZmFjZSk7CisgICAgICAgICAgICAgICAgaWYgKERFQlVHKSB7CisgICAgICAgICAgICAgICAgICAgIExvZy5kKFRBRywgImNob29zZVVwc3RyZWFtVHlwZSgiICsgdHJ5Q2VsbCArICIpLCAgZHVuUmVxdWlyZWQgPSIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICArIG1EdW5SZXF1aXJlZCArICIsIGlmYWNlPSIgKyBpZmFjZSk7CisgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIGlmIChpZmFjZSAhPSBudWxsKSB7CiAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobUR1blJlcXVpcmVkKSB7CkBAIC0xMjA3LDcgKzEyNDUsNyBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5ldHdvcmtJbmZvIGluZm8gPSBjbS5nZXROZXR3b3JrSW5mbygKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENvbm5lY3Rpdml0eU1hbmFnZXIuVFlQRV9NT0JJTEVfRFVOKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaW5mby5pc0Nvbm5lY3RlZCgpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExvZy5kKFRBRywgInNldHRpbmcgZHVuIGlmYWNlbmFtZSA9IiArIGlmYWNlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKERFQlVHKSBMb2cuZChUQUcsICJzZXR0aW5nIGR1biBpZmFjZW5hbWUgPSIgKyBpZmFjZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGV2ZW4gaWYgd2UncmUgYWxyZWFkeSBjb25uZWN0ZWQgLSBpdCBtYXkgYmUgc29tZWJvZHkgZWxzZSdzCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHJlZmNvdW50LCBzbyBhZGQgb3VyIG93bgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0dXJuT25Nb2JpbGVDb25uZWN0aW9uKCk7CkBAIC0xMjE5LDExICsxMjU3LDExIEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIExvZy5kKFRBRywgImNoZWNraW5nIGlmIGhpcHJpIGJyb3VnaHQgdXMgdGhpcyBjb25uZWN0aW9uIik7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKERFQlVHKSBMb2cuZChUQUcsICJjaGVja2luZyBpZiBoaXByaSBicm91Z2h0IHVzIHRoaXMgY29ubmVjdGlvbiIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5ldHdvcmtJbmZvIGluZm8gPSBjbS5nZXROZXR3b3JrSW5mbygKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENvbm5lY3Rpdml0eU1hbmFnZXIuVFlQRV9NT0JJTEVfSElQUkkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpbmZvLmlzQ29ubmVjdGVkKCkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTG9nLmQoVEFHLCAieWVzIC0gaGlwcmkgaW4gdXNlIik7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChERUJVRykgTG9nLmQoVEFHLCAieWVzIC0gaGlwcmkgaW4gdXNlIik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGV2ZW4gaWYgd2UncmUgYWxyZWFkeSBjb25uZWN0ZWQgLSBpdCBtYXkgYmUgc29tYm9keSBlbHNlJ3MKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gcmVmY291bnQsIHNvIGFkZCBvdXIgb3duCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR1cm5Pbk1vYmlsZUNvbm5lY3Rpb24oKTsKQEAgLTEyNDUsNyArMTI4Myw3IEBACiAgICAgICAgICAgICAgICAgbm90aWZ5VGV0aGVyZWRPZk5ld1Vwc3RyZWFtSWZhY2UoaWZhY2UpOwogICAgICAgICAgICAgfQogICAgICAgICAgICAgcHJvdGVjdGVkIHZvaWQgbm90aWZ5VGV0aGVyZWRPZk5ld1Vwc3RyZWFtSWZhY2UoU3RyaW5nIGlmYWNlTmFtZSkgewotICAgICAgICAgICAgICAgIExvZy5kKFRBRywgIm5vdGlmeWluZyB0ZXRoZXJlZCB3aXRoIGlmYWNlID0iICsgaWZhY2VOYW1lKTsKKyAgICAgICAgICAgICAgICBpZiAoREVCVUcpIExvZy5kKFRBRywgIm5vdGlmeWluZyB0ZXRoZXJlZCB3aXRoIGlmYWNlID0iICsgaWZhY2VOYW1lKTsKICAgICAgICAgICAgICAgICBtVXBzdHJlYW1JZmFjZU5hbWUgPSBpZmFjZU5hbWU7CiAgICAgICAgICAgICAgICAgZm9yIChPYmplY3QgbyA6IG1Ob3RpZnlMaXN0KSB7CiAgICAgICAgICAgICAgICAgICAgIFRldGhlckludGVyZmFjZVNNIHNtID0gKFRldGhlckludGVyZmFjZVNNKW87CkBAIC0xMjYyLDE5ICsxMzAwLDE5IEBACiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBAT3ZlcnJpZGUKICAgICAgICAgICAgIHB1YmxpYyBib29sZWFuIHByb2Nlc3NNZXNzYWdlKE1lc3NhZ2UgbWVzc2FnZSkgewotICAgICAgICAgICAgICAgIExvZy5kKFRBRywgIk1hc3RlckluaXRpYWxTdGF0ZS5wcm9jZXNzTWVzc2FnZSB3aGF0PSIgKyBtZXNzYWdlLndoYXQpOworICAgICAgICAgICAgICAgIGlmIChERUJVRykgTG9nLmQoVEFHLCAiTWFzdGVySW5pdGlhbFN0YXRlLnByb2Nlc3NNZXNzYWdlIHdoYXQ9IiArIG1lc3NhZ2Uud2hhdCk7CiAgICAgICAgICAgICAgICAgYm9vbGVhbiByZXRWYWx1ZSA9IHRydWU7CiAgICAgICAgICAgICAgICAgc3dpdGNoIChtZXNzYWdlLndoYXQpIHsKICAgICAgICAgICAgICAgICAgICAgY2FzZSBDTURfVEVUSEVSX01PREVfUkVRVUVTVEVEOgogICAgICAgICAgICAgICAgICAgICAgICAgbUR1blJlcXVpcmVkID0gaXNEdW5SZXF1aXJlZCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgVGV0aGVySW50ZXJmYWNlU00gd2hvID0gKFRldGhlckludGVyZmFjZVNNKW1lc3NhZ2Uub2JqOwotICAgICAgICAgICAgICAgICAgICAgICAgTG9nLmQoVEFHLCAiVGV0aGVyIE1vZGUgcmVxdWVzdGVkIGJ5ICIgKyB3aG8udG9TdHJpbmcoKSk7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoREVCVUcpIExvZy5kKFRBRywgIlRldGhlciBNb2RlIHJlcXVlc3RlZCBieSAiICsgd2hvLnRvU3RyaW5nKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgbU5vdGlmeUxpc3QuYWRkKHdobyk7CiAgICAgICAgICAgICAgICAgICAgICAgICB0cmFuc2l0aW9uVG8obVRldGhlck1vZGVBbGl2ZVN0YXRlKTsKICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICBjYXNlIENNRF9URVRIRVJfTU9ERV9VTlJFUVVFU1RFRDoKICAgICAgICAgICAgICAgICAgICAgICAgIHdobyA9IChUZXRoZXJJbnRlcmZhY2VTTSltZXNzYWdlLm9iajsKLSAgICAgICAgICAgICAgICAgICAgICAgIExvZy5kKFRBRywgIlRldGhlciBNb2RlIHVucmVxdWVzdGVkIGJ5ICIgKyB3aG8udG9TdHJpbmcoKSk7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoREVCVUcpIExvZy5kKFRBRywgIlRldGhlciBNb2RlIHVucmVxdWVzdGVkIGJ5ICIgKyB3aG8udG9TdHJpbmcoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgaW5kZXggPSBtTm90aWZ5TGlzdC5pbmRleE9mKHdobyk7CiAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaW5kZXggIT0gLTEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtTm90aWZ5TGlzdC5yZW1vdmUod2hvKTsKQEAgLTEzMDQsNyArMTM0Miw3IEBACiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBAT3ZlcnJpZGUKICAgICAgICAgICAgIHB1YmxpYyBib29sZWFuIHByb2Nlc3NNZXNzYWdlKE1lc3NhZ2UgbWVzc2FnZSkgewotICAgICAgICAgICAgICAgIExvZy5kKFRBRywgIlRldGhlck1vZGVBbGl2ZVN0YXRlLnByb2Nlc3NNZXNzYWdlIHdoYXQ9IiArIG1lc3NhZ2Uud2hhdCk7CisgICAgICAgICAgICAgICAgaWYgKERFQlVHKSBMb2cuZChUQUcsICJUZXRoZXJNb2RlQWxpdmVTdGF0ZS5wcm9jZXNzTWVzc2FnZSB3aGF0PSIgKyBtZXNzYWdlLndoYXQpOwogICAgICAgICAgICAgICAgIGJvb2xlYW4gcmV0VmFsdWUgPSB0cnVlOwogICAgICAgICAgICAgICAgIHN3aXRjaCAobWVzc2FnZS53aGF0KSB7CiAgICAgICAgICAgICAgICAgICAgIGNhc2UgQ01EX1RFVEhFUl9NT0RFX1JFUVVFU1RFRDoKQEAgLTEzMzIsOCArMTM3MCwxMCBAQAogICAgICAgICAgICAgICAgICAgICAgICAgLy8gbWFrZSBzdXJlIHdlJ3JlIHN0aWxsIHVzaW5nIGEgcmVxdWVzdGVkIGNvbm5lY3Rpb24gLSBtYXkgaGF2ZSBmb3VuZAogICAgICAgICAgICAgICAgICAgICAgICAgLy8gd2lmaSBvciBzb21ldGhpbmcgc2luY2UgdGhlbi4KICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtQ29ubmVjdGlvblJlcXVlc3RlZCkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIExvZy5kKFRBRywgInJlbmV3aW5nIG1vYmlsZSBjb25uZWN0aW9uIC0gcmVxdWV1aW5nIGZvciBhbm90aGVyICIgKwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ0VMTF9DT05ORUNUSU9OX1JFTkVXX01TICsgIm1zIik7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKERFQlVHKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExvZy5kKFRBRywgInJlbmV3aW5nIG1vYmlsZSBjb25uZWN0aW9uIC0gcmVxdWV1aW5nIGZvciBhbm90aGVyICIgKworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENFTExfQ09OTkVDVElPTl9SRU5FV19NUyArICJtcyIpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICA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RBRywgIm9uU2VydmljZVN0YXRlQ2hhbmdlZCIpOworICAgICAgICAgICAgLy8gV2Ugb25seSBjYXJlIHRoZSBzdGF0ZSBjaGFuZ2UKKyAgICAgICAgICAgIGlmIChtTGFzdFN0YXRlID09IG51bGwgfHwgbUxhc3RTdGF0ZS5nZXRTdGF0ZSgpICE9IHNlcnZpY2VTdGF0ZS5nZXRTdGF0ZSgpKSB7CisgICAgICAgICAgICAgICAgZGV0ZWN0Q291bnRyeSh0cnVlLCB0cnVlKTsKKyAgICAgICAgICAgICAgICBtTGFzdFN0YXRlID0gbmV3IFNlcnZpY2VTdGF0ZShzZXJ2aWNlU3RhdGUpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfTsKKworICAgIC8qKgorICAgICAqIFRoZSBsaXN0ZW5lciBmb3IgcmVjZWl2aW5nIHRoZSBub3RpZmljYXRpb24gZnJvbSBMb2NhdGlvbkJhc2VkQ291bnRyeURldGVjdG9yLgorICAgICAqLworICAgIHByaXZhdGUgQ291bnRyeUxpc3RlbmVyIG1Mb2NhdGlvbkJhc2VkQ291bnRyeURldGVjdGlvbkxpc3RlbmVyID0gbmV3IENvdW50cnlMaXN0ZW5lcigpIHsKKyAgICAgICAgcHVibGljIHZvaWQgb25Db3VudHJ5RGV0ZWN0ZWQoQ291bnRyeSBjb3VudHJ5KSB7CisgICAgICAgICAgICBtQ291bnRyeUZyb21Mb2NhdGlvbiA9IGNvdW50cnk7CisgICAgICAgICAgICAvLyBEb24ndCBzdGFydCB0aGUgTG9jYXRpb25CYXNlZENvdW50cnlEZXRlY3Rvci4KKyAgICAgICAgICAgIGRldGVjdENvdW50cnkodHJ1ZSwgZmFsc2UpOworICAgICAgICAgICAgc3RvcExvY2F0aW9uQmFzZWREZXRlY3RvcigpOworICAgICAgICB9CisgICAgfTsKKworICAgIHB1YmxpYyBDb21wcmVoZW5zaXZlQ291bnRyeURldGVjdG9yKENvbnRleHQgY29udGV4dCkgeworICAgICAgICBzdXBlcihjb250Z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iAocmVzdWx0ID09IG51bGwpIHsKKyAgICAgICAgICAgIHJlc3VsdCA9IGdldExhc3RLbm93bkxvY2F0aW9uQmFzZWRDb3VudHJ5KCk7CisgICAgICAgIH0KKyAgICAgICAgaWYgKHJlc3VsdCA9PSBudWxsKSB7CisgICAgICAgICAgICByZXN1bHQgPSBnZXRTaW1CYXNlZENvdW50cnkoKTsKKyAgICAgICAgfQorICAgICAgICBpZiAocmVzdWx0ID09IG51bGwpIHsKKyAgICAgICAgICAgIHJlc3VsdCA9IGdldExvY2FsZUNvdW50cnkoKTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gcmVzdWx0OworICAgIH0KKworICAgIC8qKgorICAgICAqIEByZXR1cm4gdGhlIGNvdW50cnkgZnJvbSB0aGUgbW9iaWxlIG5ldHdvcmsuCisgICAgICovCisgICAgcHJvdGVjdGVkIENvdW50cnkgZ2V0TmV0d29ya0Jhc2VkQ291bnRyeSgpIHsKKyAgICAgICAgU3RyaW5nIGNvdW50cnlJc28gPSBudWxsOworICAgICAgICAvLyBUT0RPOiBUaGUgZG9jdW1lbnQgc2F5cyB0aGUgcmVzdWx0IG1heSBiZSB1bnJlbGlhYmxlIG9uIENETUEgbmV0d29ya3MuIFNoYWxsIHdlIHVzZQorICAgICAgICAvLyBpdCBvbiBDRE1BIHBob25lPyBXZSBtYXkgdGVzdCB0aGUgQW5kcm9pZCBwcmltYXJpbHkgdXNlZCBjb3VudHJpZXMuCisgICAgICAgIGlmIChtUGhvbmVUeXBlID09IFRlbGVwaG9ueU1hbmFnZXIuUEhPTkVfVFlQRV9HU00pIHsKKyAgICAgICAgICAgIGNvdW50cnlJc28gPSBtVGVsZXBob255TWFuYWdlci5nZXROZXR3b3JrQ291bnRyeUlzbygpOworICAgICAgICAgICAgaWYgKCFUZXh0VXRpbHMuaXNFbXB0eShjb3VudHJ5SXNvKSkgeworICAgICAgICAgICAgICAgIHJldHVybiBuZXcgQ291bnRyeShjb3VudHJ5SXNvLCBDb3VudHJ5LkNPVU5UUllfU09VUkNFX05FVFdPUkspOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHJldHVybiBudWxsOworICAgIH0KKworICAgIC8qKgorICAgICAqIEByZXR1cm4gdGhlIGNhY2hlZCBsb2NhdGlvbiBiYXNlZCBjb3VudHJ5LgorICAgICAqLworICAgIHByb3RlY3RlZCBDb3VudHJ5IGdldExhc3RLbm93bkxvY2F0aW9uQmFzZWRDb3VudHJ5KCkgeworICAgICAgICByZXR1cm4gbUNvdW50cnlGcm9tTG9jYXRpb247CisgICAgfQorCisgICAgLyoqCisgICAgICogQHJldHVybiB0aGUgY291bnRyeSBmcm9tIFNJTSBjYXJkCisgICAgICovCisgICAgcHJvdGVjdGVkIENvdW50cnkgZ2V0U2ltQmFzZWRDb3VudHJ5KCkgeworICAgICAgICBTdHJpbmcgY291bnRyeUlzbyA9IG51bGw7CisgICAgICAgIGNvdW50cnlJc28gPSBtVGVsZXBob255TWFuYWdlci5nZXRTaW1Db3VudHJ5SXNvKCk7CisgICAgICAgIGlmICghVGV4dFV0aWxzLmlzRW1wdHkoY291bnRyeUlzbykpIHsKKyAgICAgICAgICAgIHJldHVybiBuZXcgQ291bnRyeShjb3VudHJ5SXNvLCBDb3VudHJ5LkNPVU5UUllfU09VUkNFX1NJTSk7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIG51bGw7CisgICAgfQorCisgICAgLyoqCisgICAgICogQHJldHVybiB0aGUgY291bnRyeSBmcm9tIHRoZSBzeXN0ZW0ncyBsb2NhbGUuCisgICAgICovCisgICAgcHJvdGVjdGVkIENvdW50cnkgZ2V0TG9jYWxlQ291bnRyeSgpIHsKKyAgICAgICAgTG9jYWxlIGRlZmF1bHRMb2NhbGUgPSBMb2NhbGUuZ2V0RGVmYXVsdCgpOworICAgICAgICBpZiAoZGVmYXVsdExvY2FsZSAhPSBudWxsKSB7CisgICAgICAgICAgICByZXR1cm4gbmV3IENvdW50cnkoZGVmYXVsdExvY2FsZS5nZXRDb3VudHJ5KCksIENvdW50cnkuQ09VTlRSWV9TT1VSQ0VfTE9DQUxFKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogQHBhcmFtIG5vdGlmeUNoYW5nZSBpbmRpY2F0ZXMgd2hldGhlciB0aGUgbGlzdGVuZXIgc2hvdWxkIGJlIG5vdGlmaWVkIHRoZSBjaGFuZ2Ugb2YgdGhlCisgICAgICogY291bnRyeQorICAgICAqIEBwYXJhbSBzdGFydExvY2F0aW9uQmFzZWREZXRlY3Rpb24gaW5kaWNhdGVzIHdoZXRoZXIgdGhlIExvY2F0aW9uQmFzZWRDb3VudHJ5RGV0ZWN0b3IgY291bGQKKyAgICAgKiBiZSBzdGFydGVkIGlmIHRoZSBjdXJyZW50IGNvdW50cnkgc291cmNlIGlzIGxlc3MgcmVsaWFibGUgdGhhbiB0aGUgbG9jYXRpb24uCisgICAgICogQHJldHVybiB0aGUgY3VycmVudCBhdmFpbGFibGUgVXNlckNvdW50cnkKKyAgICAgKi8KKyAgICBwcml2YXRlIENvdW50cnkgZGV0ZWN0Q291bnRyeShib29sZWFuIG5vdGlmeUNoYW5nZSwgYm9vbGVhbiBzdGFydExvY2F0aW9uQmFzZWREZXRlY3Rpb24pIHsKKyAgICAgICAgQ291bnRyeSBjb3VudHJ5ID0gZ2V0Q291bnRyeSgpOworICAgICAgICBydW5BZnRlckRldGVjdGlvbkFzeW5jKG1Db3VudHJ5ICE9IG51bGwgPyBuZXcgQ291bnRyeShtQ291bnRyeSkgOiBtQ291bnRyeSwgY291bnRyeSwKKyAgICAgICAgICAgICAgICBub3RpZnlDaGFuZ2UsIHN0YXJ0TG9jYXRpb25CYXNlZERldGVjdGlvbik7CisgICAgICAgIG1Db3VudHJ5ID0gY291bnRyeTsKKyAgICAgICAgcmV0dXJuIG1Db3VudHJ5OworICAgIH0KKworICAgIC8qKgorICAgICAqIFJ1biB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9yKCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBGaW5kIHRoZSBjb3VudHJ5IGZyb20gTG9jYXRpb25Qcm92aWRlci4KKyAgICAgKi8KKyAgICBwcml2YXRlIHN5bmNocm9uaXplZCB2b2lkIHN0YXJ0TG9jYXRpb25CYXNlZERldGVjdG9yKENvdW50cnlMaXN0ZW5lciBsaXN0ZW5lcikgeworICAgICAgICBpZiAobUxvY2F0aW9uQmFzZWRDb3VudHJ5RGV0ZWN0b3IgIT0gbnVsbCkgeworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisgICAgICAgIG1Mb2NhdGlvbkJhc2VkQ291bnRyeURldGVjdG9yID0gY3JlYXRlTG9jYXRpb25CYXNlZENvdW50cnlEZXRlY3RvcigpOworICAgICAgICBtTG9jYXRpb25CYXNlZENvdW50cnlEZXRlY3Rvci5zZXRDb3VudHJ5TGlzdGVuZXIobGlzdGVuZXIpOworICAgICAgICBtTG9jYXRpb25CYXNlZENvdW50cnlEZXRlY3Rvci5kZXRlY3RDb3VudHJ5KCk7CisgICAgfQorCisgICAgcHJpdmF0ZSBzeW5jaHJvbml6ZWQgdm9pZCBzdG9wTG9jYXRpb25CYXNlZERldGVjdG9yKCkgeworICAgICAgICBpZiAobUxvY2F0aW9uQmFzZWRDb3VudHJ5RGV0ZWN0b3IgIT0gbnVsbCkgeworICAgICAgICAgICAgbUxvY2F0aW9uQmFzZWRDb3VudHJ5RGV0ZWN0b3Iuc3RvcCgpOworICAgICAgICAgICAgbUxvY2F0aW9uQmFzZWRDb3VudHJ5RGV0ZWN0b3IgPSBudWxsOworICAgICAgICB9CisgICAgfQorCisgICAgcHJvdGVjdGVkIENvdW50cnlEZXRlY3RvckJhc2UgY3JlYXRlTG9jYXRpb25CYXNlZENvdW50cnlEZXRlY3RvcigpIHsKKyAgICAgICAgcmV0dXJuIG5ldyBMb2NhdGlvbkJhc2VkQ291bnRyeURldGVjdG9yKG1Db250ZXh0KTsKKy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XN0cy4KKyAgICAgKi8KKyAgICBwcml2YXRlIHN5bmNocm9uaXplZCB2b2lkIHNjaGVkdWxlTG9jYXRpb25SZWZyZXNoKCkgeworICAgICAgICBpZiAobUxvY2F0aW9uUmVmcmVzaFRpbWVyICE9IG51bGwpIHJldHVybjsKKyAgICAgICAgbUxvY2F0aW9uUmVmcmVzaFRpbWVyID0gbmV3IFRpbWVyKCk7CisgICAgICAgIG1Mb2NhdGlvblJlZnJlc2hUaW1lci5zY2hlZHVsZShuZXcgVGltZXJUYXNrKCkgeworICAgICAgICAgICAgQE92ZXJyaWRlCisgICAgICAgICAgICBwdWJsaWMgdm9pZCBydW4oKSB7CisgICAgICAgICAgICAgICAgbUxvY2F0aW9uUmVmcmVzaFRpbWVyID0gbnVsbDsKKyAgICAgICAgICAgICAgICBkZXRlY3RDb3VudHJ5KGZhbHNlLCB0cnVlKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfSwgTE9DQVRJT05fUkVGUkVTSF9JTlRFUlZBTCk7CisgICAgfQorCisgICAgLyoqCisgICAgICogQ2FuY2VsIHRoZSBzY2hlZHVsZWQgcmVmcmVzaCB0YXNrIGlmIGl0IGV4aXN0cworICAgICAqLworICAgIHByaXZhdGUgc3luY2hyb25pemVkIHZvaWQgY2FuY2VsTG9jYXRpb25SZWZyZXNoKCkgeworICAgICAgICBpZiAobUxvY2F0aW9uUmVmcmVzaFRpbWVyICE9IG51bGwpIHsKKyAgICAgICAgICAgIG1Mb2NhdGlvblJlZnJlc2hUaW1lci5jYW5jZWwoKTsKKyAgICAgICAgICAgIG1Mb2NhdGlvblJlZnJlc2hUaW1lciA9IG51bGw7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcm90ZWN0ZWQgc3luY2hyb25pemVkIHZvaWQgYWRkUGhvbmVTdGF0ZUxpc3RlbmVyKCkgeworICAgICAgICBpZiAobVBob25lU3RhdGVMaXN0ZW5lciA9PSBudWxsICYmIG1QaG9uZVR5cGUgPT0gVGVsZXBob255TWFuYWdlci5QSE9ORV9UWVBFX0dTTSkgeworICAgICAgICAgICAgbUxhc3RTdGF0ZSA9IG51bGw7CisgICAgICAgICAgICBtUGhvbmVTdGF0ZUxpc3RlbmVyID0gbmV3IFBob25lU3RhdGVMaXN0ZW5lcigpIHsKKyAgICAgICAgICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgICAgICAgICBwdWJsaWMgdm9pZCBvblNlcnZpY2VTdGF0ZUNoYW5nZWQoU2VydmljZVN0YXRlIHNlcnZpY2VTdGF0ZSkgeworICAgICAgICAgICAgICAgICAgICAvLyBUT0RPOiBGaW5kIG91dCBob3cgb2Z0ZW4gd2Ugd2lsbCBiZSBub3RpZmllZCwgaWYgdGhpcworICAgICAgICAgICAgICAgICAgICAvLyBtZXRob2QgaXMgY2FsbGVkIHRvbworICAgICAgICAgICAgICAgICAgICAvLyBtYW55IHRpbWVzLCBsZXQncyBjb25zaWRlciBxdWVyeWluZyB0aGUgbmV0d29yay4KKyAgICAgICAgICAgICAgICAgICAgU2xvZy5kKFRBRywgIm9uU2VydmljZVN0YXRlQ2hhbmdlZCIpOworICAgICAgICAgICAgICAgICAgICAvLyBXZSBvbmx5IGNhcmUgdGhlIHN0YXRlIGNoYW5nZQorICAgICAgICAgICAgICAgICAgICBpZiAobUxhc3RTdGF0ZSA9PSBudWxsIHx8IG1MYXN0U3RhdGUuZ2V0U3RhdGUoKSAhPSBzZXJ2aWNlU3RhdGUuZ2V0U3RhdGUoKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgZGV0ZWN0Q291bnRyeSh0cnVlLCB0cnVlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1MYXN0U3RhdGUgPSBuZXcgU2VydmljZVN0YXRlKHNlcnZpY2VTdGF0ZSk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9OworICAgICAgICAgICAgbVRlbGVwaG9ueU1hbmFnZXIubGlzdGVuKG1QaG9uZVN0YX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saW5rICNkZXRlY3RDb3VudHJ5fSB0byBzdGFydCBkZXRlY3RpbmcgdGhlIGNvdW50cnkuIFRoZSBjb3VudHJ5CisgKiBjb3VsZCBiZSByZXR1cm5lZCBpbW1lZGlhdGVseSBpZiBpdCBpcyBhdmFpbGFibGUuCisgKgorICogQGhpZGUKKyAqLworcHVibGljIGFic3RyYWN0IGNsYXNzIENvdW50cnlEZXRlY3RvckJhc2UgeworICAgIHByb3RlY3RlZCBmaW5hbCBIYW5kbGVyIG1IYW5kbGVyOworICAgIHByb3RlY3RlZCBmaW5hbCBDb250ZXh0IG1Db250ZXh0OworICAgIHByb3RlY3RlZCBDb3VudHJ5TGlzdGVuZXIgbUxpc3RlbmVyOworICAgIHByb3RlY3RlZCBDb3VudHJ5IG1EZXRlY3RlZENvdW50cnk7CisKKyAgICBwdWJsaWMgQ291bnRyeURldGVjdG9yQmFzZShDb250ZXh0IGN0eCkgeworICAgICAgICBtQ29udGV4dCA9IGN0eDsKKyAgICAgICAgbUhhbmRsZXIgPSBuZXcgSGFuZGxlcigpOworICAgIH0KKworICAgIC8qKgorICAgICAqIFN0YXJ0IGRldGVjdGluZyB0aGUgY291bnRyeSB0aGF0IHRoZSB1c2VyIGlzIGluLgorICAgICAqCisgICAgICogQHJldHVybiB0aGUgY291bnRyeSBpZiBpdCBpcyBhdmFpbGFibGUgaW1tZWRpYXRlbHksIG90aGVyd2lzZSBudWxsIHNob3VsZAorICAgICAqICAgICAgICAgYmUgcmV0dXJuZWQuCisgICAgICovCisgICAgcHVibGljIGFic3RyYWN0IENvdW50cnkgZGV0ZWN0Q291bnRyeSgpOworCisgICAgLyoqCisgICAgICogUmVnaXN0ZXIgYSBsaXN0ZW5lciB0byByZWNlaXZlIHRoZSBub3RpZmljYXRpb24gd2hlbiB0aGUgY291bnRyeSBpcyBkZXRlY3RlZCBvciBjaGFuZ2VkLgorICAgICAqIDxwPgorICAgICAqIFRoZSBwcmV2aW91cyBsaXN0ZW5lciB3aWxsIGJlIH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ICAgcHJvdGVjdGVkIFN0cmluZyBnZXRDb3VudHJ5RnJvbUxvY2F0aW9uKExvY2F0aW9uIGxvY2F0aW9uKSB7CisgICAgICAgIFN0cmluZyBjb3VudHJ5ID0gbnVsbDsKKyAgICAgICAgR2VvY29kZXIgZ2VvQ29kZXIgPSBuZXcgR2VvY29kZXIobUNvbnRleHQpOworICAgICAgICB0cnkgeworICAgICAgICAgICAgTGlzdDxBZGRyZXNzPiBhZGRyZXNzZXMgPSBnZW9Db2Rlci5nZXRGcm9tTG9jYXRpb24oCisgICAgICAgICAgICAgICAgICAgIGxvY2F0aW9uLmdldExhdGl0dWRlKCksIGxvY2F0aW9uLmdldExvbmdpdHVkZSgpLCAxKTsKKyAgICAgICAgICAgIGlmIChhZGRyZXNzZXMgIT0gbnVsbCAmJiBhZGRyZXNzZXMuc2l6ZSgpID4gMCkgeworICAgICAgICAgICAgICAgIGNvdW50cnkgPSBhZGRyZXNzZXMuZ2V0KDApLmdldENvdW50cnlDb2RlKCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0gY2F0Y2ggKElPRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgIFNsb2cudyhUQUcsICJFeGNlcHRpb24gb2NjdXJzIHdoZW4gZ2V0dGluZyBjb3VudHJ5IGZyb20gbG9jYXRpb24iKTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gY291bnRyeTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBSZWdpc3RlciB0aGUgbGlzdGVuZXJzIHdpdGggdGhlIGxvY2F0aW9uIHByb3ZpZGVycworICAgICAqLworICAgIHByb3RlY3RlZCB2b2lkIHJlZ2lzdGVyRW5hYmxlZFByb3ZpZGVycyhMaXN0PExvY2F0aW9uTGlzdGVuZXI+IGxpc3RlbmVycykgeworICAgICAgICBpbnQgdG90YWwgPSBsaXN0ZW5lcnMuc2l6ZSgpOworICAgICAgICBmb3IgKGludCBpID0gMDsgaTwgdG90YWw7IGkrKykgeworICAgICAgICAgICAgbUxvY2F0aW9uTWFuYWdlci5yZXF1ZXN0TG9jYXRpb25VcGRhdGVzKAorICAgICAgICAgICAgICAgICAgICBtRW5hYmxlZFByb3ZpZGVycy5nZXQoaSksIDAsIDAsIGxpc3RlbmVycy5nZXQoaSkpOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogVW5yZWdpc3RlciB0aGUgbGlzdGVuZXJzIHdpdGggdGhlIGxvY2F0aW9uIHByb3ZpZGVycworICAgICAqLworICAgIHByb3RlY3RlZCB2b2lkIHVucmVnaXN0ZXJQcm92aWRlcnMoTGlzdDxMb2NhdGlvbkxpc3RlbmVyPiBsaXN0ZW5lcnMpIHsKKyAgICAgICAgZm9yIChMb2NhdGlvbkxpc3RlbmVyIGxpc3RlbmVyIDogbGlzdGVuZXJzKSB7CisgICAgICAgICAgICBtTG9jYXRpb25NYW5hZ2VyLnJlbW92ZVVwZGF0ZXMobGlzdGVuZXIpOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogQHJldHVybiB0aGUgbGFzdCBrbm93biBsb2NhdGlvbiBmcm9tIGFsbCBwcm92aWRlcnMKKyAgICAgKi8KKyAgICBwcm90ZWN0ZWQgTG9jYXRpb24gZ2V0TGFzdEtub3duTG9jYXRpb24oKSB7CisgICAgICAgIExpc3Q8U3RyaW5nPiBwcm92aWRlcnMgPSBtTG9jYXRpb25NYW5hZ2VyLmdldEFsbFByb3ZpZGVycygpOworICAgICAgICBMb2NhdGlvbiBiZXN0TG9jYXRpb24gPSBudWxsOworICAgICAgICBmb3IgKFN0cmluZyBwcm92aWRlciA6IHByb3ZpZGVycykgeworICAgICAgICAgICAgTG9jYXRpb24gbGFzdEtub3duTG9jYXRpb24gPSBtTG9jYXRpb25NYW5hZ2VyLmdldExhc3RLbm93bkxvY2F0aW9uKHByb3ZpZGVyKTsKKyAgICAgICAgICAgIGlmIChsYXN0S25vd25Mb2NhdGlvbiAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgaWYgKGJlc3RMb2NhdGlvbiA9PSBudWxsIHx8IGJlc3RMb2NhdGlvbi5nZXRUaW1lKCkgPCBsYXN0S25vd25Mb2NhdGlvbi5nZXRUaW1lKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgYmVzdExvY2F0aW9uID0gbGFzdEtub3duTG9jYXRpb247CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHJldHVybiBiZXN0TG9jYXRpb247CisgICAgfQorCisgICAgLyoqCisgICAgICogQHJldHVybiB0aGUgdGltZW91dCBmb3IgcXVlcnlpbmcgdGhlIGxvY2F0aW9uLgorICAgICAqLworICAgIHByb3RlY3RlZCBsb25nIGdldFF1ZXJ5TG9jYXRpb25UaW1lb3V0KCkgeworICAgICAgICByZXR1cm4gUVVFUllfTE9DQVRJT05fVElNRU9VVDsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBAcmV0dXJuIHRoZSB0b3RhbCBudW1iZXIgb2YgZW5hYmxlZCBsb2NhdGlvbiBwcm92aWRlcnMKKyAgICAgKi8KKyAgICBwcm90ZWN0ZWQgaW50IGdldFRvdGFsRW5hYmxlZFByb3ZpZGVycygpIHsKKyAgICAgICAgaWYgKG1FbmFibGVkUHJvdmlkZXJzID09IG51bGwpIHsKKyAgICAgICAgICAgIG1FbmFibGVkUHJvdmlkZXJzID0gbUxvY2F0aW9uTWFuYWdlci5nZXRQcm92aWRlcnModHJ1ZSk7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIG1FbmFibGVkUHJvdmlkZXJzLnNpemUoKTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBTdGFydCBkZXRlY3RpbmcgdGhlIGNvdW50cnkuCisgICAgICogPHA+CisgICAgICogUXVlcmllcyB0aGUgbG9jYXRpb24gZnJvbSBhbGwgbG9jYXRpb24gcHJvdmlkZXJzLCB0aGVuIHN0YXJ0cyBhIHRocmVhZCB0byBxdWVyeSB0aGUKKyAgICAgKiBjb3VudHJ5IGZyb20gR2VvQ29kZXIuCisgICAgICovCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHN5bmNocm9uaXplZCBDb3VudHJ5IGRldGVjdENvdW50cnkoKSB7CisgICAgICAgIGlmIChtTG9jYXRpb25MaXN0ZW5lcnMgICE9IG51bGwpIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oKTsKKyAgICAgICAgfQorICAgICAgICAvLyBSZXF1ZXN0IHRoZSBsb2NhdGlvbiBmcm9tIGFsbCBlbmFibGVkIHByb3ZpZGVycy4KKyAgICAgICAgaW50IHRvdGFsUHJvdmlkZXJzID0gZ2V0VG90YWxFbmFibGVkUHJvdmlkZXJzKCk7CisgICAgICAgIGlmICh0b3RhbFByb3ZpZGVycyA+IDApIHsKKyAgICAgICAgICAgIG1Mb2NhdGlvbkxpc3RlbmVycyA9IG5ldyBBcnJheUxpc3Q8TG9jYXRpb25MaXN0ZW5lcj4odG90YWxQcm92aWRlcnMpOworICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCB0b3RhbFByb3ZpZGVyczsgaSsrKSB7CisgICAgICAgICAgICAgICAgTG9jYXRpb25MaXN0ZW5lciBsaXN0ZW5lciA9IG5ldyBMb2NhdGlvbkxpc3RlbmVyICgpIHsKKyAgICAgICAgICAgICAgICAgICAgcHVibGljIHZvaWQgb25Mb2NhdGlvbkNoYW5nZWQoTG9jYXRpb24gbG9jYXRpb24pIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChsb2NhdGlvbiAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgTG9jYXRpb25CYXNlZENvdW50cnlEZXRlY3Rvci50aGlzLnN0b3AoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBxdWVyeUNvdW50cnlDb2RlKGxvY2F0aW9uKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBwdWJsaWMgdm9pZCBvblByb3ZpZGVyRGlzYWJsZWQoU3RyaW5nIHByb3ZpZGVyKSB7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgcHVibGljIHZvaWQgb25Qcm92aWRlckVuYWJsZWQoU3RyaW5nIHByb3ZpZGVyKSB7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgcHVibGljIHZvaWQgb25TdGF0dXNDaGFuZ2VkKFN0cmluZyBwcm92aWRlciwgaW50IHN0YXR1cywgQnVuZGxlIGV4dHJhcykgeworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfTsKKyAgICAgICAgICAgICAgICBtTG9jYXRpb25MaXN0ZW5lcnMuYWRkKGxpc3RlbmVyKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHJlZ2lzdGVyRW5hYmxlZFByb3ZpZGVycyhtTG9jYXRpb25MaXN0ZW5lcnMpOworICAgICAgICAgICAgbVRpbWVyID0gbmV3IFRpbWVyKCk7CisgICAgICAgICAgICBtVGltZXIuc2NoZWR1bGUobmV3IFRpbWVyVGFzaygpIHsKKyAgICAgICAgICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgICAgICAgICBwdWJsaWMgdm9pZCBydW4oKSB7CisgICAgICAgICAgICAgICAgICAgIG1UaW1lciA9IG51bGw7CisgICAgICAgICAgICAgICAgICAgIExvY2F0aW9uQmFzZWRDb3VudHJ5RGV0ZWN0b3IudGhpcy5zdG9wKCk7CisgICAgICAgICAgICAgICAgICAgIC8vIExvb2tzIGxpa2Ugbm8gcHJvdmlkZXIgY291bGQgcHJvdmlkZSB0aGUgbG9jYXRpb24sIGxldCdzIHRyeSB0aGUgbGFzdAorICAgICAgICAgICAgICAgICAgICAvLyBrbm93biBsb2NhdGlvbi4KKyAgICAgICAgICAgICAgICAgICAgcXVlcnlDb3VudHJ5Q29kZShnZXRMYXN0S25vd25Mb2NhdGlvbigpKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9LCBnZXRRdWVyeUxvY2F0aW9uVGltZW91dCgpKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIC8vIFRoZXJlIGlzIG5vIHByb3ZpZGVyIGVuYWJsZWQuCisgICAgICAgICAgICBxdWVyeUNvdW50cnlDb2RlKGdldExhc3RLbm93bkxvY2F0aW9uKCkpOworICAgICAgICB9CisgICAgICAgIHJldHVybiBtRGV0ZWN0ZWRDb3VudHJ5OworICAgIH0KKworICAgIC8qKgorICAgICAqIFN0b3AgdGhlIGN1cnJlbnQgcXVlcnkgd2l0aG91dCBub3RpZnlpbmcgdGhlIGxpc3RlbmVyLgorICAgICAqLworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyBzeW5jaHJvbml6ZWQgdm9pZCBzdG9wKCkgeworICAgICAgICBpZiAobUxvY2F0aW9uTGlzdGVuZXJzICE9IG51bGwpIHsKKyAgICAgICAgICAgIHVucmVnaXN0ZXJQcm92aWRlcnMobUxvY2F0aW9uTGlzdGVuZXJzKTsKKyAgICAgICAgICAgIG1Mb2NhdGlvbkxpc3RlbmVycyA9IG51bGw7CisgICAgICAgIH0KKyAgICAgICAgaWYgKG1UaW1lciAhPSBudWxsKSB7CisgICAgICAgICAgICBtVGltZXIuY2FuY2VsKCk7CisgICAgICAgICAgICBtVGltZXIgPSBudWxsOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogU3RhcnQgYSBuZXcgdGhyZWFkIHRvIHF1ZXJ5IHRoZSBjb3VudHJ5IGZyb20gR2VvY29kZXIuCisgICAgICovCisgICAgcHJpdmF0ZSBzeW5jaHJvbml6ZWQgdm9pZCBxdWVyeUNvdW50cnlDb2RlKGZpbmFsIExvY2F0aW9uIGxvY2F0aW9uKSB7CisgICAgICAgIGlmIChsb2NhdGlvbiA9PSBudWxsKSB7CisgICAgICAgICAgICBub3RpZnlMaXN0ZW5lcihudWxsKTsKKyAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfQorICAgICAgICBpZiAobVF1ZXJ5VGhyZWFkICE9IG51bGwpIHJldHVybjsKKyAgICAgICAgbVF1ZXJ5VGhyZWFkID0gbmV3IFRocmVhZChuZXcgUnVubmFibGUoKSB7CisgICAgICAgICAgICBwdWJsaWMgdm9pZCBydW4oKSB7CisgICAgICAgICAgICAgICAgU3RyaW5nIGNvdW50cnlJc28gPSBudWxsOworICAgICAgICAgICAgICAgIGlmIChsb2NhdGlvbiAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIGNvdW50cnlJc28gPSBnZXRDb3VudHJ5RnJvbUxvY2F0aW9uKGxvY2F0aW9uKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaWYgKGNvdW50cnlJc28gIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICBtRGV0ZWN0ZWRDb3VudHJ5ID0gbmV3IENvdW50cnkoY291bnRyeUlzbywgQ291bnRyeS5DT1VOVFJZX1NPVVJDRV9MT0NBVElPTik7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgbURldGVjdGVkQ291bnRyeSA9IG51bGw7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIG5vdGlmeUxpc3RlbmVyKG1EZXRlY3RlZENvdW50cnkpOworICAgICAgICAgICAgICAgIG1RdWVyeVRocmVhZCA9IG51bGw7CisgICAgICAgICAgICB9CisgICAgICAgIH0pOworICAgICAgICBtUXVlcnlUaHJlYWQuc3RhcnQoKTsKKyAgICB9Cit9CmRpZmYgLS1naXQgYS9zZXJ2aWNlcy9qbmkvQW5kcm9pZC5tayBiL3NlcnZpY2VzL2puaS9BbmRyb2lkLm1rCmluZGV4IGNkYzBhNmYuLjQ1OTU1MWQgMTAwNjQ0Ci0tLSBhL3NlcnZpY2VzL2puaS9BbmRyb2lkLm1rCisrKyBiL3NlcnZpY2VzL2puaS9BbmR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3JpcHRvciAqZXA7CisgICAgICAgICAgICAgICAgc3RydWN0IHVzYl9lbmRwb2ludF9kZXNjcmlwdG9yICplcF9pbl9kZXNjID0gTlVMTDsKKyAgICAgICAgICAgICAgICBzdHJ1Y3QgdXNiX2VuZHBvaW50X2Rlc2NyaXB0b3IgKmVwX291dF9kZXNjID0gTlVMTDsKKyAgICAgICAgICAgICAgICBzdHJ1Y3QgdXNiX2VuZHBvaW50X2Rlc2NyaXB0b3IgKmVwX2ludHJfZGVzYyA9IE5VTEw7CisgICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCAzOyBpKyspIHsKKyAgICAgICAgICAgICAgICAgICAgZXAgPSAoc3RydWN0IHVzYl9lbmRwb2ludF9kZXNjcmlwdG9yICopdXNiX2Rlc2NyaXB0b3JfaXRlcl9uZXh0KCZpdGVyKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKCFlcCB8fCBlcC0+YkRlc2NyaXB0b3JUeXBlICE9IFVTQl9EVF9FTkRQT0lOVCkgeworICAgICAgICAgICAgICAgICAgICAgICAgTE9HRSgiZW5kcG9pbnRzIG5vdCBmb3VuZFxuIik7CisgICAgICAgICAgICAgICAgICAgICAgICBnb3RvIGRvbmU7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgaWYgKGVwLT5ibUF0dHJpYnV0ZXMgPT0gVVNCX0VORFBPSU5UX1hGRVJfQlVMSykgeworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGVwLT5iRW5kcG9pbnRBZGRyZXNzICYgVVNCX0VORFBPSU5UX0RJUl9NQVNLKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVwX2luX2Rlc2MgPSBlcDsKKyAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcF9vdXRfZGVzYyA9IGVwOworICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGVwLT5ibUF0dHJpYnV0ZXMgPT0gVVNCX0VORFBPSU5UX1hGRVJfSU5UICYmCisgICAgICAgICAgICAgICAgICAgICAgICBlcC0+YkVuZHBvaW50QWRkcmVzcyAmIFVTQl9FTkRQT0lOVF9ESVJfTUFTSykgeworICAgICAgICAgICAgICAgICAgICAgICAgZXBfaW50cl9kZXNjID0gZXA7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaWYgKCFlcF9pbl9kZXNjIHx8ICFlcF9vdXRfZGVzYyB8fCAhZXBfaW50cl9kZXNjKSB7CisgICAgICAgICAgICAgICAgICAgIExPR0UoImVuZHBvaW50cyBub3QgZm91bmRcbiIpOworICAgICAgICAgICAgICAgICAgICBnb3RvIGRvbmU7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgLy8gaWYgd2UgZ290IGhlcmUsIHdlIGZvdW5kIGEgY2FtZXJhCisgICAgICAgICAgICAgICAgSk5JRW52KiBlbnYgPSBBbmRyb2lkUnVudGltZTo6Z2V0Sk5JRW52KCk7CisgICAgICAgICAgICAgICAgam9iamVjdCB0aGl6ID0gKGpvYmplY3QpY2xpZW50X2RhdGE7CisKKyAgICAgICAgICAgICAgICBpbnQgaWQgPSB1c2JfZGV2aWNlX2dldF91bmlxdWVfaWRfZnJvbV9uYW1lKGRldm5hbWUpOworICAgICAgICAgICAgICAgIG1EZXZpY2VMaXN0LmFkZChpZCk7CisKKyAgICAgICAgICAgICAgICBlbnYtPkNhbGxWb2lkTWV0aG9kKHRoaXosIG1ldGhvZF91c2JDYW1lcmFBZGRlZCwgaWQpOworICAgICAgICAgICAgICAgIGNoZWNrQW5kQ2xlYXJFeGNlcHRpb25Gcm9tQ2FsbGJhY2soZW52LCBfX0ZVTkNUSU9OX18pOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorZG9uZToKKyAgICB1c2JfZGV2aWNlX2Nsb3NlKGRldmljZSk7CisgICAgcmV0dXJuIDA7Cit9Cis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yYW1lRGF0YSgmY3VyW2ldKTsKKyAgICAgICAgICAgIGlmIChjdXJbaV0uaGludHMgJiBIV0NfSElOVF9DTEVBUl9GQikgeworICAgICAgICAgICAgICAgIGlmICghKGxheWVyLT5uZWVkc0JsZW5kaW5nKCkpKSB7CisgICAgICAgICAgICAgICAgICAgIHRyYW5zcGFyZW50Lm9yU2VsZihsYXllci0+dmlzaWJsZVJlZ2lvblNjcmVlbik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIGVyciA9IGh3Yy5wcmVwYXJlKCk7CisgICAgICAgIExPR0VfSUYoZXJyLCAiSFdDb21wb3Nlcjo6cHJlcGFyZSBmYWlsZWQgKCVzKSIsIHN0cmVycm9yKC1lcnIpKTsKKyAgICB9CisKKyAgICAvKgorICAgICAqICBjbGVhciB0aGUgYXJlYSBvZiB0aGUgRkIgdGhhdCBuZWVkIHRvIGJlIHRyYW5zcGFyZW50CisgICAgICovCisgICAgdHJhbnNwYXJlbnQuYW5kU2VsZihkaXJ0eSk7CisgICAgaWYgKCF0cmFuc3BhcmVudC5pc0VtcHR5KCkpIHsKKyAgICAgICAgZ2xDbGVhckNvbG9yKDAsMCwwLDApOworICAgICAgICBSZWdpb246OmNvbnN0X2l0ZXJhdG9yIGl0ID0gdHJhbnNwYXJlbnQuYmVnaW4oKTsKKyAgICAgICAgUmVnaW9uOjpjb25zdF9pdGVyYXRvciBjb25zdCBlbmQgPSB0cmFuc3BhcmVudC5lbmQoKTsKKyAgICAgICAgY29uc3QgaW50MzJfdCBoZWlnaHQgPSBody5nZXRIZWlnaHQoKTsKKyAgICAgICAgd2hpbGUgKGl0ICE9IGVuZCkgeworICAgICAgICAgICAgY29uc3QgUmVjdCYgcigqaXQrKyk7CisgICAgICAgICAgICBjb25zdCBHTGludCBzeSA9IGhlaWdodCAtIChyLnRvcCArIHIuaGVpZ2h0KCkpOworICAgICAgICAgICAgZ2xTY2lzc29yKHIubGVmdCwgc3ksI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TYsNyBAQAogICAgICAgICAgICAgdm9pZCAgICAgICAgaGFuZGxlUGFnZUZsaXAoKTsKICAgICAgICAgICAgIGJvb2wgICAgICAgIGxvY2tQYWdlRmxpcChjb25zdCBMYXllclZlY3RvciYgY3VycmVudExheWVycyk7CiAgICAgICAgICAgICB2b2lkICAgICAgICB1bmxvY2tQYWdlRmxpcChjb25zdCBMYXllclZlY3RvciYgY3VycmVudExheWVycyk7CisgICAgICAgICAgICB2b2lkICAgICAgICBoYW5kbGVXb3JrTGlzdCgpOwogICAgICAgICAgICAgdm9pZCAgICAgICAgaGFuZGxlUmVwYWludCgpOwogICAgICAgICAgICAgdm9pZCAgICAgICAgcG9zdEZyYW1lYnVmZmVyKCk7CiAgICAgICAgICAgICB2b2lkICAgICAgICBjb21wb3NlU3VyZmFjZXMoY29uc3QgUmVnaW9uJiBkaXJ0eSk7CkBAIC0zNzAsNiArMzcxLDcgQEAKICAgICAgICAgICAgICAgICBSZWdpb24gICAgICAgICAgICAgICAgICAgICAgbUludmFsaWRSZWdpb247CiAgICAgICAgICAgICAgICAgUmVnaW9uICAgICAgICAgICAgICAgICAgICAgIG1Xb3JtaG9sZVJlZ2lvbjsKICAgICAgICAgICAgICAgICBib29sICAgICAgICAgICAgICAgICAgICAgICAgbVZpc2libGVSZWdpb25zRGlydHk7CisgICAgICAgICAgICAgICAgYm9vbCAgICAgICAgICAgICAgICAgICAgICAgIG1Id1dvcmtMaXN0RGlydHk7CiAgICAgICAgICAgICAgICAgYm9vbCAgICAgICAgICAgICAgICAgICAgICAgIG1EZWZlclJlbGVhc2VDb25zb2xlOwogICAgICAgICAgICAgICAgIGJvb2wgICAgICAgICAgICAgICAgICAgICAgICBtRnJlZXplRGlzcGxheTsKICAgICAgICAgICAgICAgICBpbnQzMl90ICAgICAgICAgICAgICAgICAgICAgbUZyZWV6ZUNvdW50OwpkaWZmIC0tZ2l0IGEvc2VydmljZXMvdGVzdHMvc2VydmljZXN0ZXN0cy9BbmRyb2lkLm1rI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dXNlZCBmb3IgdGVzdGluZyB0aGF0IGEgc2VydmljZSBpcyBub3RpZmllZCBvbmx5IHVwb24gYQorICAgICAqIG5vdGlmaWNhdGlvbiB0aW1lb3V0LgorICAgICAqLworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGxvbmcgVElNRU9VVF9URVNUX05PVElGSUNBVElPTl9USU1FT1VUID0gMzAwOworCisgICAgLyoqCisgICAgICogVGhlIHBhY2thZ2UgbmFtZS4KKyAgICAgKi8KKyAgICBwcml2YXRlIHN0YXRpYyBTdHJpbmcgc1BhY2thZ2VOYW1lOworCisgICAgLyoqCisgICAgICogVGhlIGludGVyZmFjZSB1c2VkIHRvIHRhbGsgdG8gdGhlIHRlc3RlZCBzZXJ2aWNlLgorICAgICAqLworICAgIHByaXZhdGUgSUFjY2Vzc2liaWxpdHlNYW5hZ2VyIG1NYW5hZ2VyU2VydmljZTsKKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIHNldENvbnRleHQoQ29udGV4dCBjb250ZXh0KSB7CisgICAgICAgIHN1cGVyLnNldENvbnRleHQoY29udGV4dCk7CisgICAgICAgIGlmIChzUGFja2FnZU5hbWUgPT0gbnVsbCkgeworICAgICAgICAgICAgc1BhY2thZ2VOYW1lID0gY29udGV4dC5nZXRQYWNrYWdlTmFtZSgpOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogQ3JlYXRlcyBhIG5ldyBpbnN0YW5jZS4KKyAgICAgKi8KKyAgICBwdWJsaWMgQWNjZXNzaWJpbGl0eU1hbmFnZXJTZXJ2aWNlVGVzdCgpIHsKKyAgICAgICAgSUJpbmRlciBpQmluZGVyID0gU2VydmljZU1hbmFnZXIuZ2V0U2VydmljZShDb250ZXh0LkFDQ0VTU0lCSUxJVFlfU0VSVklDRSk7CisgICAgICAgIG1NYW5hZ2VyU2VydmljZSA9IElBY2Nlc3NpYmlsaXR5TWFuYWdlci5TdHViLmFzSW50ZXJmYWNlKGlCaW5kZXIpOwor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B0cnkgeworICAgICAgICAgICAgICAgIFRocmVhZC5zbGVlcChwb2xsVG1lb3V0KTsKKyAgICAgICAgICAgIH0gY2F0Y2ggKEludGVycnVwdGVkRXhjZXB0aW9uIGllKSB7CisgICAgICAgICAgICAgICAgLyogaWdub3JlICovCisgICAgICAgICAgICB9CisgICAgICAgICAgICAvLyBwb2xsIGZvciB2ZXJpZmljYXRpb24gYW5kIGlmIHRoaXMgZmFpbHMgc2F2ZSB0aGUgZXhjZXB0aW9uIGFuZAorICAgICAgICAgICAgLy8ga2VlcCBwb2xsaW5nCisgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIHNlcnZpY2UudmVyaWZ5KCk7CisgICAgICAgICAgICAgICAgLy8gcmVzZXQgc28gaXQgZG9lcyBub3QgYWNjZXB0IG1vcmUgZXZlbnRzCisgICAgICAgICAgICAgICAgc2VydmljZS5yZXNldCgpOworICAgICAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgICAgIH0gY2F0Y2ggKEV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgbGFzdFZlcmlmeUV4Y2VwdGlvbiA9IGU7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICAvLyByZXNldCwgd2UgaGF2ZSBhbHJlYWR5IGZhaWxlZAorICAgICAgICBzZXJ2aWNlLnJlc2V0KCk7CisKKyAgICAgICAgLy8gYWx3YXlzIG5vdCBudWxsCisgICAgICAgIHRocm93IGxhc3RWZXJpZnlFeGNlcHRpb247CisgICAgfQorCisgICAgLyoqCisgICAgICogVGhpcyBjbGFzcyBpcyB0aGUgZmlyc3QgbW9jayB7QGxpbmsgQWNjZXNzaWJpbGl0eVNlcnZpY2V9LgorICAgICAqLworICAgIHB1YmxpYyBzdGF0aWMgY2xhc3MgTXlGaXJzdE1vY2tBY2Nlc3NpYmlsaXR5U2VydmljZSBleHRlbmRzIE1vY2tBY2Nlc3NpYmlsaXR5U2VydmljZSB7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFRoZSBzZXJ2aWNlIHtAbGluayBDb21wb25lbnROYW1lfSBmbGF0dGVuZWQgYXMgYSBzdHJpbmcuCisgICAgICAgICAqLworICAgICAgICBzdGF0aWMgZmluYWwgU3RyaW5nIHNDb21wb25lbnROYW1lID0gbmV3IENvbXBvbmVudE5hbWUoCisgICAgICAgICAgICAgICAgc1BhY2thZ2VOYW1lLAorICAgICAgICAgICAgICAgIE15Rmlyc3RNb2NrQWNjZXNzaWJpbGl0eVNlcnZpY2UuY2xhc3MuZ2V0TmFtZSgpCisgICAgICAgICAgICAgICAgKS5mbGF0dGVuVG9TaG9ydFN0cmluZygpOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBIYW5kbGUgdG8gdGhlIHNlcnZpY2UgaW5zdGFuY2UuCisgICAgICAgICAqLworICAgICAgICBzdGF0aWMgTXlGaXJzdE1vY2tBY2Nlc3NpYmlsaXR5U2VydmljZSBzSW5zdGFuY2U7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIENyZWF0ZXMgYSBuZXcgaW5zdGFuY2UuCisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgTXlGaXJzdE1vY2tBY2Nlc3NpYmlsaXR5U2VydmljZSgpIHsKKyAgICAgICAgICAgIHNJbnN0YW5jZSA9IHRoaXM7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBUaGlzIGNsYXNzIGlzIHRoZSBmaXJzdCBtb2NrIHtAbGluayBBY2Nlc3NpYmlsaXR5U2VydmljZX0uCisgICAgICovCisgICAgcHVibGljIHN0YXRpYyBjbGFzcyBNeVNlY29uZE1vY2tBY2Nlc3NpYmlsaXR5U2VydmljZSBleHRlbmRzIE1vY2tBY2Nlc3NpYmlsaXR5U2VydmljZSB7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFRoZSBzZXJ2aWNlIHtAbGluayBDb21wb25lbnROYW1lfSBmbGF0dGVuZWQgYXMgYSBzdHJpbmcuCisgICAgICAgICAqLworICAg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gcmV0dXJuIG51bGw7CisgICAgfQorCisgICAgLyoqCisgICAgICogTWF0Y2hlciBmb3Ige0BsaW5rIEFjY2Vzc2liaWxpdHlFdmVudH1zLgorICAgICAqLworICAgIHByaXZhdGUgc3RhdGljIGNsYXNzIEFjY2Vzc2liaWxpdHlFdmVudE1hdGhlciBpbXBsZW1lbnRzIElBcmd1bWVudE1hdGNoZXIgeworICAgICAgICBwcml2YXRlIEFjY2Vzc2liaWxpdHlFdmVudCBtRXhwZWN0ZWRFdmVudDsKKworICAgICAgICBwdWJsaWMgQWNjZXNzaWJpbGl0eUV2ZW50TWF0aGVyKEFjY2Vzc2liaWxpdHlFdmVudCBleHBlY3RlZEV2ZW50KSB7CisgICAgICAgICAgICBtRXhwZWN0ZWRFdmVudCA9IGV4cGVjdGVkRXZlbnQ7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgYm9vbGVhbiBtYXRjaGVzKE9iamVjdCBtYXRjaGVkKSB7CisgICAgICAgICAgICBpZiAoIShtYXRjaGVkIGluc3RhbmNlb2YgQWNjZXNzaWJpbGl0eUV2ZW50KSkgeworICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIEFjY2Vzc2liaWxpdHlFdmVudCByZWNlaXZlZEV2ZW50ID0gKEFjY2Vzc2liaWxpdHlFdmVudCkgbWF0Y2hlZDsKKyAgICAgICAgICAgIHJldHVybiBtRXhwZWN0ZWRFdmVudC5nZXRFdmVudFR5cGUoKSA9PSByZWNlaXZlZEV2ZW50LmdldEV2ZW50VHlwZSgpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgYXBwZW5kVG8oU3RyaW5nQnVmZmVyIGJ1ZmZlcikgeworICAgICAgICAgICAgYnVmZmVyLmFwcGVuZCgic2VuZEFjY2Vzc2liaWxpdHlFdmVudCgpIik7CisgICAgICAgICAgICBidWZmZXIuYXBwZW5kKCIgd2l0aCBldmVudCB0eXBlIFwiIik7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HsKKworICAgICAgICBwcml2YXRlIENvdW50cnlMaXN0ZW5lciBtTGlzdGVuZXI7CisKKyAgICAgICAgcHVibGljIENvdW50cnlEZXRlY3RvclNlcnZpY2VUZXN0ZXIoQ29udGV4dCBjb250ZXh0KSB7CisgICAgICAgICAgICBzdXBlcihjb250ZXh0KTsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgdm9pZCBub3RpZnlSZWNlaXZlcnMoQ291bnRyeSBjb3VudHJ5KSB7CisgICAgICAgICAgICBzdXBlci5ub3RpZnlSZWNlaXZlcnMoY291bnRyeSk7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHJvdGVjdGVkIHZvaWQgc2V0Q291bnRyeUxpc3RlbmVyKGZpbmFsIENvdW50cnlMaXN0ZW5lciBsaXN0ZW5lcikgeworICAgICAgICAgICAgbUxpc3RlbmVyID0gbGlzdGVuZXI7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgYm9vbGVhbiBpc0xpc3RlbmVyU2V0KCkgeworICAgICAgICAgICAgcmV0dXJuIG1MaXN0ZW5lciAhPSBudWxsOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHZvaWQgdGVzdEFkZFJlbW92ZUxpc3RlbmVyKCkgdGhyb3dzIFJlbW90ZUV4Y2VwdGlvbiB7CisgICAgICAgIENvdW50cnlEZXRlY3RvclNlcnZpY2VUZXN0ZXIgc2VydmljZVRlc3RlciA9IG5ldyBDb3VudHJ5RGV0ZWN0b3JTZXJ2aWNlVGVzdGVyKGdldENvbnRleHQoKSk7CisgICAgICAgIHNlcnZpY2VUZXN0ZXIuc3lzdGVtUmVhZHkoKTsKKyAgICAgICAgd2FpdEZvclN5c3RlbVJlYWR5KHNlcnZpY2VUZXN0ZXIpOworICAgICAgICBDb3VudHJ5TGlzdGVuZXJUZXN0ZXIgbGlzdGVuZXJUZXN0ZXIgPSBuZXcgQ291bnRyeUxpc3Rl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cGVzID0gQWNjZXNzaWJpbGl0eUV2ZW50LlRZUEVfVklFV19DTElDS0VEOworICAgICAgICBkZWZhdWx0SW5mby5mZWVkYmFja1R5cGUgPSBBY2Nlc3NpYmlsaXR5U2VydmljZUluZm8uRkVFREJBQ0tfQVVESUJMRTsKKyAgICAgICAgZGVmYXVsdEluZm8uZmxhZ3MgPSAwOworICAgICAgICBkZWZhdWx0SW5mby5ub3RpZmljYXRpb25UaW1lb3V0ID0gMDsKKyAgICAgICAgZGVmYXVsdEluZm8ucGFja2FnZU5hbWVzID0gbmV3IFN0cmluZ1tdIHsKKyAgICAgICAgICAgICJmb28uYmFyLmJheiIKKyAgICAgICAgfTsKKworICAgICAgICByZXR1cm4gZGVmYXVsdEluZm87CisgICAgfQorCisgICAgLyoqCisgICAgICogU3RhcnRzIHJlcGxheWluZyB0aGUgbW9jay4KKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCByZXBsYXkoKSB7CisgICAgICAgIG1SZXBsYXlpbmcgPSB0cnVlOworICAgIH0KKworICAgIC8qKgorICAgICAqIFZlcmlmaWVzIGlmIGFsbCBleHBlY3RlZCBzZXJ2aWNlIG1ldGhvZHMgaGF2ZSBiZWVuIGNhbGxlZC4KKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCB2ZXJpZnkoKSB7CisgICAgICAgIGlmICghbVJlcGxheWluZykgeworICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigiRGlkIHlvdSBmb3JnZXQgdG8gY2FsbCByZXBsYXkoKSIpOworICAgICAgICB9CisKKyAgICAgICAgaWYgKG1FeHBlY3RlZEludGVycnVwdCkgeworICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigiRXhwZWN0ZWQgY2FsbCB0byAjaW50ZXJydXB0KCkgbm90IHJlY2VpdmVkIik7CisgICAgICAgIH0KKyAgICAgICAgaWYgKCFtRXhwZWN0ZWRFdmVudHMu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HQoKSB7CisgICAgICAgIG1FeHBlY3RlZEludGVycnVwdCA9IHRydWU7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgb25BY2Nlc3NpYmlsaXR5RXZlbnQoQWNjZXNzaWJpbGl0eUV2ZW50IHJlY2VpdmVkRXZlbnQpIHsKKyAgICAgICAgaWYgKCFtUmVwbGF5aW5nKSB7CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKworICAgICAgICBpZiAobUV4cGVjdGVkRXZlbnRzLmlzRW1wdHkoKSkgeworICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigiVW5leHBlY3RlZCBldmVudDogIiArIHJlY2VpdmVkRXZlbnQpOworICAgICAgICB9CisKKyAgICAgICAgQWNjZXNzaWJpbGl0eUV2ZW50IGV4cGVjdGVkRXZlbnQgPSBtRXhwZWN0ZWRFdmVudHMucG9sbCgpOworICAgICAgICBhc3NlcnRFcXVhbHNBY2Nlc3NpYmxpdHlFdmVudChleHBlY3RlZEV2ZW50LCByZWNlaXZlZEV2ZW50KTsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgdm9pZCBvbkludGVycnVwdCgpIHsKKyAgICAgICAgaWYgKCFtUmVwbGF5aW5nKSB7CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKworICAgICAgICBpZiAoIW1FeHBlY3RlZEludGVycnVwdCkgeworICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigiVW5leHBlY3RlZCBjYWxsIHRvIG9uSW50ZXJydXB0KCkiKTsKKyAgICAgICAgfQorCisgICAgICAgIG1FeHBlY3RlZEludGVycnVwdCA9IGZhbHNlOworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHByb3RlY3RlZCB2b2lkIG9uU2VydmljZUNvbm5lY3RlZCgpIHsKKyAgICAgICAgbUlzU3lzdGVtQm91bmRBc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HJ1ZTsKKyAgICAgICAgICAgIG1Ob3RpZmllZENvdW50cnkgPSBjb3VudHJ5OworICAgICAgICAgICAgbUxvY2F0aW9uQmFzZWRDb3VudHJ5RGV0ZWN0b3Iubm90aWZ5TGlzdGVuZXIoY291bnRyeSk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgYm9vbGVhbiBsb2NhdGlvbkJhc2VkRGV0ZWN0b3JTdGFydGVkKCkgeworICAgICAgICAgICAgcmV0dXJuIG1Mb2NhdGlvbkJhc2VkQ291bnRyeURldGVjdG9yICE9IG51bGwgJiYgbUxvY2F0aW9uQmFzZWREZXRlY3RvclN0YXJ0ZWQ7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgYm9vbGVhbiBsb2NhdGlvbkJhc2VkRGV0ZWN0b3JTdG9wcGVkKCkgeworICAgICAgICAgICAgcmV0dXJuIG1Mb2NhdGlvbkJhc2VkQ291bnRyeURldGVjdG9yID09IG51bGwgJiYgbUxvY2F0aW9uQmFzZWREZXRlY3RvclN0b3BwZWQ7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgYm9vbGVhbiBsb2NhdGlvblJlZnJlc2hTdGFydGVkKCkgeworICAgICAgICAgICAgcmV0dXJuIG1Mb2NhdGlvblJlZnJlc2hUaW1lciAhPSBudWxsOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIGJvb2xlYW4gbG9jYXRpb25SZWZyZXNoQ2FuY2VsbGVkKCkgeworICAgICAgICAgICAgcmV0dXJuIG1Mb2NhdGlvblJlZnJlc2hUaW1lciA9PSBudWxsOworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHByb3RlY3RlZCBDb3VudHJ5RGV0ZWN0b3JCYXNlIGNyZWF0ZUxvY2F0aW9uQmFzZWRDb3VudHJ5RGV0ZWN0b3IoKSB7CisgICAgICAgICAgICByZXR1cm4gbmV3IENvdW50cnlEZXRlY3RvckJhc2UobUNvbnRleHQpIHsKKyAgICAgICAgICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgICAgICAgICBwdWJsaWMgQ291bnRyeSBkZXRlY3RDb3VudHJ5KCkgeworICAgICAgICAgICAgICAgICAgICBtTG9jYXRpb25CYXNlZERldGVjdG9yU3RhcnRlZCA9IHRydWU7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIEBPdmVycmlkZQorICAgICAgICAgICAgICAgIHB1YmxpYyB2b2lkIHN0b3AoKSB7CisgICAgICAgICAgICAgICAgICAgIG1Mb2NhdGlvbkJhc2VkRGV0ZWN0b3JTdG9wcGVkID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9OworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHByb3RlY3RlZCBDb3VudHJ5IGdldE5ldHdvcmtCYXNlZENvdW50cnkoKSB7CisgICAgICAgICAgICByZXR1cm4gbnVsbDsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwcm90ZWN0ZWQgQ291bnRyeSBnZXRMYXN0S25vd25Mb2NhdGlvbkJhc2VkQ291bnRyeSgpIHsKKyAgICAgICAgICAgIHJldHVybiBtTm90aWZpZWRDb3VudHJ5OworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHByb3RlY3RlZCBDb3VudHJ5IGdldFNpbUJhc2VkQ291bnRyeSgpIHsKKyAgICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHByb3RlY3RlZCBDb3VudHJ5IGdldExvY2FsZUNvdW50cnkoKSB7CisgICAgICAgICAgICByZXR1cm4gbnVsbDsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwcm90ZWN0ZWQgdm9pZCBydW5BZnRlckRldGVjdGlvbkFzeW5jKGZpbmFsIENvdW50cnkgY291bnRyeSwgZmluYWwgQ291bnRyeSBkZXRlY3RlZENvdW50cnksCisgICAgICAgICAgICAgICAgZmluYWwgYm9vbGVhbiBub3RpZnlDaGFuZ2UsIGZpbmFsIGJvb2xlYW4gc3RhcnRMb2NhdGlvbkJhc2VkRGV0ZWN0aW9uKSB7CisgICAgICAgICAgICBydW5BZnRlckRldGVjdGlvbihjb3VudHJ5LCBkZXRlY3RlZENvdW50cnksIG5vdGlmeUNoYW5nZSwgc3RhcnRMb2NhdGlvbkJhc2VkRGV0ZWN0aW9uKTsKKyAgICAgICAgfTsKKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHJvdGVjdGVkIGJvb2xlYW4gaXNBaXJwbGFuZU1vZGVPZmYoKSB7CisgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwcm90ZWN0ZWQgc3luY2hyb25pemVkIHZvaWQgYWRkUGhvbmVTdGF0ZUxpc3RlbmVyKCkgeworICAgICAgICAgICAgbGlzdGVuZXJBZGRlZCA9IHRydWU7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHJvdGVjdGVkIHN5bmNocm9uaXplZCB2b2lkIHJlbW92ZVBob25lU3RhdGVMaXN0ZW5lcigpIHsKKyAgICAgICAgICAgIGxpc3RlbmVyQWRkZWQgPSBmYWxzZTsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwcm90ZWN0ZWQgYm9vbGVhbiBpc0dlb0NvZGVySW1wbGVtZW50ZWQoKSB7CisgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBib29sZWFuIGlzUGhvbmVTdGF0ZUxpc3RlbmVyQWRkZWQoKSB7CisgICAgICAgICAgICByZXR1cm4gbGlzdGVuZXJBZGRlZDsKKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgY2xhc3MgQ291bnRyeUxpc3RlbmVySW1wbCBpbXBsZW1lbnRzIENvdW50cnlMaXN0ZW5lciB7CisgICAgICAgIHByaXZhdGUgYm9vbGVhbiBtTm90aWZpZWQ7CisgICAgICAgIHByaXZhdGUgQ291bnRyeSBtQ291bnRyeTsKKworICAgICAgICBwdWJsaWMgdm9pZCBvbkNvdW50cnlEZXRlY3RlZChDb3VudHJ5IGNvdW50cnkpIHsKKyAgICAgICAgICAgIG1Ob3RpZmllZCA9IHRydWU7CisgICAgICAgICAgICBtQ291bnRyeSA9IGNvdW50cnk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgYm9vbGVhbiBub3RpZmllZCgpIHsKKyAgICAgICAgICAgIHJldHVybiBtTm90aWZpZWQ7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgQ291bnRyeSBnZXRDb3VudHJ5KCkgeworICAgICAgICAgICAgcmV0dXJuIG1Db3VudHJ5OworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHZvaWQgdGVzdERldGVjdE5ldHdvcmtCYXNlZENvdW50cnkoKSB7CisgICAgICAgIGZpbmFsIENvdW50cnkgcmVzdWx0Q291bnRyeSA9IG5ldyBDb3VudHJ5KAorICAgICAgICAgICAgICAgIFRlc3RDb3VudHJ5RGV0ZWN0b3IuQ09VTlRSWV9JU08sIENvdW50cnkuQ09VTlRSWV9TT1VSQ0VfTkVUV09SSyk7CisgICAgICAgIFRlc3RDb3VudHJ5RGV0ZWN0b3IgY291bnRyeURldGVjdG9yID0gbmV3IFRlc3RDb3VudHJ5RGV0ZWN0b3IoKSB7CisgICAgICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgICAgIHByb3RlY3RlZCBDb3VudHJ5IGdldE5ldHdvcmtCYXNlZENvdW50cnkoKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIHJlc3VsdENvdW50cnk7CisgICAgICAgICAgICB9CisgICAgICAgIH07CisgICAgICAgIENvdW50cnlMaXN0Z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yAgICAgICAgICAgIEBPdmVycmlkZQorICAgICAgICAgICAgcHJvdGVjdGVkIENvdW50cnkgZ2V0U2ltQmFzZWRDb3VudHJ5KCkgeworICAgICAgICAgICAgICAgIHJldHVybiByZXN1bHRDb3VudHJ5OworICAgICAgICAgICAgfQorICAgICAgICB9OworICAgICAgICBDb3VudHJ5TGlzdGVuZXJJbXBsIGxpc3RlbmVyID0gbmV3IENvdW50cnlMaXN0ZW5lckltcGwoKTsKKyAgICAgICAgY291bnRyeURldGVjdG9yLnNldENvdW50cnlMaXN0ZW5lcihsaXN0ZW5lcik7CisgICAgICAgIENvdW50cnkgY291bnRyeSA9IGNvdW50cnlEZXRlY3Rvci5kZXRlY3RDb3VudHJ5KCk7CisgICAgICAgIGFzc2VydFRydWUoc2FtZUNvdW50cnkoY291bnRyeSwgcmVzdWx0Q291bnRyeSkpOworICAgICAgICBhc3NlcnRUcnVlKGNvdW50cnlEZXRlY3Rvci5sb2NhdGlvbkJhc2VkRGV0ZWN0b3JTdGFydGVkKCkpOworICAgICAgICBjb3VudHJ5RGV0ZWN0b3Iubm90aWZ5TG9jYXRpb25CYXNlZExpc3RlbmVyKGxvY2F0aW9uQmFzZWRDb3VudHJ5KTsKKyAgICAgICAgYXNzZXJ0VHJ1ZShsaXN0ZW5lci5ub3RpZmllZCgpKTsKKyAgICAgICAgYXNzZXJ0VHJ1ZShzYW1lQ291bnRyeShsaXN0ZW5lci5nZXRDb3VudHJ5KCksIGxvY2F0aW9uQmFzZWRDb3VudHJ5KSk7CisgICAgICAgIGFzc2VydFRydWUoY291bnRyeURldGVjdG9yLmxvY2F0aW9uQmFzZWREZXRlY3RvclN0b3BwZWQoKSk7CisgICAgICAgIGFzc2VydFRydWUoY291bnRyeURldGVjdG9yLmxvY2F0aW9uUmVmcmVzaFN0YXJ0ZWQoKSk7CisgICAgICAgIGNvdW50cnlEZXRlY3Rvci5zdG9wKCk7CisgICAgICAgIGFzc2VydFRydWUoY291bnRyeURldGVjdG9yLmxvY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pOworICAgICAgICBjb3VudHJ5RGV0ZWN0b3Iuc3RvcCgpOworICAgICAgICBhc3NlcnRUcnVlKGNvdW50cnlEZXRlY3Rvci5sb2NhdGlvblJlZnJlc2hDYW5jZWxsZWQoKSk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgdGVzdFN0b3BwaW5nRGV0ZWN0b3IoKSB7CisgICAgICAgIC8vIFRlc3Qgc3RvcHBpbmcgZGV0ZWN0b3Igd2hlbiBMb2NhdGlvbkJhc2VkQ291bnRyeURldGVjdG9yIHdhcyBzdGFydGVkCisgICAgICAgIGZpbmFsIENvdW50cnkgcmVzdWx0Q291bnRyeSA9IG5ldyBDb3VudHJ5KAorICAgICAgICAgICAgICAgIFRlc3RDb3VudHJ5RGV0ZWN0b3IuQ09VTlRSWV9JU08sIENvdW50cnkuQ09VTlRSWV9TT1VSQ0VfU0lNKTsKKyAgICAgICAgVGVzdENvdW50cnlEZXRlY3RvciBjb3VudHJ5RGV0ZWN0b3IgPSBuZXcgVGVzdENvdW50cnlEZXRlY3RvcigpIHsKKyAgICAgICAgICAgIEBPdmVycmlkZQorICAgICAgICAgICAgcHJvdGVjdGVkIENvdW50cnkgZ2V0U2ltQmFzZWRDb3VudHJ5KCkgeworICAgICAgICAgICAgICAgIHJldHVybiByZXN1bHRDb3VudHJ5OworICAgICAgICAgICAgfQorICAgICAgICB9OworICAgICAgICBDb3VudHJ5TGlzdGVuZXJJbXBsIGxpc3RlbmVyID0gbmV3IENvdW50cnlMaXN0ZW5lckltcGwoKTsKKyAgICAgICAgY291bnRyeURldGVjdG9yLnNldENvdW50cnlMaXN0ZW5lcihsaXN0ZW5lcik7CisgICAgICAgIENvdW50cnkgY291bnRyeSA9IGNvdW50cnlEZXRlY3Rvci5kZXRlY3RDb3VudHJ5KCk7CisgICAgICAgIGFzc2VydFRydWUoc2FtZUNvdW50cnkoY291bnRyeSwgcmVzdWx0Q291bnRyeSkpOworICAgICAgICBhc3NlcnRUcnVlKGNvdW50cnlEZXRlY3Rvci5sb2NhdGlvbkJhc2VkRGV0ZWN0b3JTdGFydGVkKCkpOworICAgICAgICBjb3VudHJ5RGV0ZWN0b3Iuc3RvcCgpOworICAgICAgICAvLyBUaGUgTG9jYXRpb25CYXNlZERldGVjdG9yIHNob3VsZCBiZSBzdG9wcGVkLgorICAgICAgICBhc3NlcnRUcnVlKGNvdW50cnlEZXRlY3Rvci5sb2NhdGlvbkJhc2VkRGV0ZWN0b3JTdG9wcGVkKCkpOworICAgICAgICAvLyBUaGUgbG9jYXRpb24gcmVmcmVzaCBzaG91bGQgbm90IHJ1bm5pbmcuCisgICAgICAgIGFzc2VydFRydWUoY291bnRyeURldGVjdG9yLmxvY2F0aW9uUmVmcmVzaENhbmNlbGxlZCgpKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCB0ZXN0TG9jYXRpb25CYXNlZENvdW50cnlOb3RGb3VuZCgpIHsKKyAgICAgICAgZmluYWwgQ291bnRyeSByZXN1bHRDb3VudHJ5ID0gbmV3IENvdW50cnkoCisgICAgICAgICAgICAgICAgVGVzdENvdW50cnlEZXRlY3Rvci5DT1VOVFJZX0lTTywgQ291bnRyeS5DT1VOVFJZX1NPVVJDRV9TSU0pOworICAgICAgICBUZXN0Q291bnRyeURldGVjdG9yIGNvdW50cnlEZXRlY3RvciA9IG5ldyBUZXN0Q291bnRyeURldGVjdG9yKCkgeworICAgICAgICAgICAgQE92ZXJyaWRlCisgICAgICAgICAgICBwcm90ZWN0ZWQgQ291bnRyeSBnZXRTaW1CYXNlZENvdW50cnkoKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIHJlc3VsdENvdW50cnk7CisgICAgICAgICAgICB9CisgICAgICAgIH07CisgICAgICAgIENvdW50cnlMaXN0ZW5lckltcGwgbGlzdGVuZXIgPSBuZXcgQ291bnRyeUxpc3RlbmVySW1wbCgpOworICAgICAgICBjb3VudHJ5RGV0ZWN0b3Iuc2V0Q291bnRyeUxpc3RlbmVyKGxpc3RlbmVyKTsKK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IHF1ZXJ5TG9jYXRpb25UaW1lb3V0KSB7CisgICAgICAgICAgICBzdXBlcihnZXRDb250ZXh0KCkpOworICAgICAgICAgICAgbUNvdW50cnkgPSBjb3VudHJ5OworICAgICAgICAgICAgbUxvY2F0aW9uID0gbmV3IExvY2F0aW9uKHByb3ZpZGVyKTsKKyAgICAgICAgICAgIG1RdWVyeUxvY2F0aW9uVGltZW91dCA9IHF1ZXJ5TG9jYXRpb25UaW1lb3V0OworICAgICAgICAgICAgbUxpc3RlbmVycyA9IG5ldyBBcnJheUxpc3Q8TG9jYXRpb25MaXN0ZW5lcj4oKTsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwcm90ZWN0ZWQgU3RyaW5nIGdldENvdW50cnlGcm9tTG9jYXRpb24oTG9jYXRpb24gbG9jYXRpb24pIHsKKyAgICAgICAgICAgIHN5bmNocm9uaXplZCAoY291bnRyeUZvdW5kTG9ja2VyKSB7CisgICAgICAgICAgICAgICAgaWYgKCFub3RpZnlDb3VudHJ5KSB7CisgICAgICAgICAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgICAgICAgICBjb3VudHJ5Rm91bmRMb2NrZXIud2FpdCgpOworICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChJbnRlcnJ1cHRlZEV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAobUxvY2F0aW9uLmdldFByb3ZpZGVyKCkuZW5kc1dpdGgobG9jYXRpb24uZ2V0UHJvdmlkZXIoKSkpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gbUNvdW50cnk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHByb3RlY3RlZCBMb2NhdGlvbiBnZXRMYXN0S25vd25Mb2NhdGlvbigpIHsKKyAgICAgICAgICAgIHJldHVybiBtTG9jYXRpb247CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHJvdGVjdGVkIHZvaWQgcmVnaXN0ZXJFbmFibGVkUHJvdmlkZXJzKExpc3Q8TG9jYXRpb25MaXN0ZW5lcj4gbGlzdGVuZXJzKSB7CisgICAgICAgICAgICBtTGlzdGVuZXJzLmFkZEFsbChsaXN0ZW5lcnMpOworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHByb3RlY3RlZCB2b2lkIHVucmVnaXN0ZXJQcm92aWRlcnMoTGlzdDxMb2NhdGlvbkxpc3RlbmVyPiBsaXN0ZW5lcnMpIHsKKyAgICAgICAgICAgIGZvciAoTG9jYXRpb25MaXN0ZW5lciBsaXN0ZW5lciA6IG1Mb2NhdGlvbkxpc3RlbmVycykgeworICAgICAgICAgICAgICAgIGFzc2VydFRydWUobUxpc3RlbmVycy5yZW1vdmUobGlzdGVuZXIpKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwcm90ZWN0ZWQgbG9uZyBnZXRRdWVyeUxvY2F0aW9uVGltZW91dCgpIHsKKyAgICAgICAgICAgIHJldHVybiBtUXVlcnlMb2NhdGlvblRpbWVvdXQ7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHJvdGVjdGVkIGludCBnZXRUb3RhbEVuYWJsZWRQcm92aWRlcnMoKSB7CisgICAgICAgICAgICByZXR1cm4gVE9UQUxfUFJPVklERVJTOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgbm90aWZ5TG9jYXRpb25Gb3VuZCgpIHsKKyAgICAgICAgICAgIC8vIExpc3RlbmVyIGNvdWxkIGJlIHJlbW92ZWQgaW4gdGhlIG5vdGlmaWNhdGlvbi4KKyAgICAgICAgICAgIExvY2F0aW9uTGlzdGVuZXJbXSBsaXN0ZW5lcnMgPSBuZXcgTG9jYXRpb25MaXN0ZW5lclttTGlzdGVuZXJzLnNpemUoKV07CisgICAgICAgICAgICBtTG9jYXRpb25MaXN0ZW5lcnMudG9BcnJheShsaXN0ZW5lcnMpOworICAgICAgICAgICAgZm9yIChMb2NhdGlvbkxpc3RlbmVyIGxpc3RlbmVyIDpsaXN0ZW5lcnMpIHsKKyAgICAgICAgICAgICAgICBsaXN0ZW5lci5vbkxvY2F0aW9uQ2hhbmdlZChtTG9jYXRpb24pOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIGludCBnZXRMaXN0ZW5lcnNDb3VudCgpIHsKKyAgICAgICAgICAgIHJldHVybiBtTGlzdGVuZXJzLnNpemUoKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyB2b2lkIG5vdGlmeUNvdW50cnlGb3VuZCgpIHsKKyAgICAgICAgICAgIHN5bmNocm9uaXplZCAoY291bnRyeUZvdW5kTG9ja2VyKSB7CisgICAgICAgICAgICAgICAgbm90aWZ5Q291bnRyeSA9IHRydWU7CisgICAgICAgICAgICAgICAgY291bnRyeUZvdW5kTG9ja2VyLm5vdGlmeSgpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIFRpbWVyIGdldFRpbWVyKCkgeworICAgICAgICAgICAgcmV0dXJuIG1UaW1lcjsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBUaHJlYWQgZ2V0UXVlcnlUaHJlYWQoKSB7CisgICAgICAgICAgICByZXR1cm4gbVF1ZXJ5VGhyZWFkOworICAgICAgICB9CisgICAgfQorCisgICAgcHJpdmF0ZSBjbGFzcyBDb3VudHJ5TGlzdGVuZXJJbXBsIGltcGxlbWVudHMgQ291bnRyeUxpc3RlbmVyIHsKKyAgICAgICAgcHJpdmF0ZSBib29sZWFuIG1Ob3RpZmllZDsKKyAgICAgICAgcHJpdmF0ZSBTdHJpbmcgbUNvdW50cnlDb2RlOworICAgICAgICBwdWJsaWMgdm9pZCBvbkNvdW50cnlEZXRlY3RlZChDb3VudHJ5IGNvdW50cnkpIHsKKyAgICAgICAgICAgIG1Ob3RpZmllZCA9IHRydWU7CisgICAgICAgICAgICBpZiAoY291bnRyeSAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgbUNvdW50cnlDb2RlID0gY291bnRyeS5nZXRDb3VudHJ5SXNvKCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgYm9vbGVhbiBub3RpZmllZCgpIHsKKyAgICAgICAgICAgIHJldHVybiBtTm90aWZpZWQ7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgU3RyaW5nIGdldENvdW50cnkoKSB7CisgICAgICAgICAgICByZXR1cm4gbUNvdW50cnlDb2RlOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHZvaWQgdGVzdEZpbmRpbmdDb3VudHJ5KCkgeworICAgICAgICBmaW5hbCBTdHJpbmcgY291bnRyeSA9ICJ1cyI7CisgICAgICAgIGZpbmFsIFN0cmluZyBwcm92aWRlciA9ICJHb29kIjsKKyAgICAgICAgQ291bnRyeUxpc3RlbmVySW1wbCBjb3VudHJ5TGlzdGVuZXIgPSBuZXcgQ291bnRyeUxpc3RlbmVySW1wbCgpOworICAgICAgICBUZXN0Q291bnRyeURldGVjdG9yIGRldGVjdG9yID0gbmV3IFRlc3RDb3VudHJ5RGV0ZWN0b3IoY291bnRyeSwgcHJvdmlkZXIpOworICAgICAgICBkZXRlY3Rvci5zZXRDb3VudHJ5TGlzdGVuZXIoY291bnRyeUxpc3RlbmVyKTsKKyAgICAgICAgZGV0ZWN0b3IuZGV0ZWN0Q291bnRyeSgpOworICAgICAgICBhc3NlcnRFcXVhbHMoZGV0ZWN0b3IuZ2V0TGlzdGVuZXJzQ291bnQoKSwgVGVzdENvdW50cnlEZXRlY3Rvci5UT1RBTF9QUk9WSURFUlMpOworICAgIC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ydE51bGwoZGV0ZWN0b3IuZ2V0UXVlcnlUaHJlYWQoKSk7CisgICAgICAgIGFzc2VydFRydWUoY291bnRyeUxpc3RlbmVyLm5vdGlmaWVkKCkpOworICAgICAgICBhc3NlcnRFcXVhbHMoY291bnRyeUxpc3RlbmVyLmdldENvdW50cnkoKSwgY291bnRyeSk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgdGVzdEZpbmRpbmdMb2NhdGlvbkNhbmNlbGxlZCgpIHsKKyAgICAgICAgZmluYWwgU3RyaW5nIGNvdW50cnkgPSAidXMiOworICAgICAgICBmaW5hbCBTdHJpbmcgcHJvdmlkZXIgPSAiR29vZCI7CisgICAgICAgIENvdW50cnlMaXN0ZW5lckltcGwgY291bnRyeUxpc3RlbmVyID0gbmV3IENvdW50cnlMaXN0ZW5lckltcGwoKTsKKyAgICAgICAgVGVzdENvdW50cnlEZXRlY3RvciBkZXRlY3RvciA9IG5ldyBUZXN0Q291bnRyeURldGVjdG9yKGNvdW50cnksIHByb3ZpZGVyKTsKKyAgICAgICAgZGV0ZWN0b3Iuc2V0Q291bnRyeUxpc3RlbmVyKGNvdW50cnlMaXN0ZW5lcik7CisgICAgICAgIGRldGVjdG9yLmRldGVjdENvdW50cnkoKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKGRldGVjdG9yLmdldExpc3RlbmVyc0NvdW50KCksIFRlc3RDb3VudHJ5RGV0ZWN0b3IuVE9UQUxfUFJPVklERVJTKTsKKyAgICAgICAgZGV0ZWN0b3Iuc3RvcCgpOworICAgICAgICAvLyBBbGwgbGlzdGVuZXJzIHNob3VsZCBiZSB1bnJlZ2lzdGVyZWQKKyAgICAgICAgYXNzZXJ0RXF1YWxzKGRldGVjdG9yLmdldExpc3RlbmVyc0NvdW50KCksIDApOworICAgICAgICAvLyBUaGUgdGltZSBzaG91bGQgYmUgc3RvcHBlZAorICAgICAgICBhc3NlcnROdWxsKGRldGVjdG9yLmdldFRpbWVyKCkpOworICAgICAgICAvLyBRdWVyeVRocmVhZCBzaG91bGQgc3RpbGwgYmUgTlVMTAorICAgICAgICBhc3NlcnROdWxsKGRldGVjdG9yLmdldFF1ZXJ5VGhyZWFkKCkpOworICAgICAgICBhc3NlcnRGYWxzZShjb3VudHJ5TGlzdGVuZXIubm90aWZpZWQoKSk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgdGVzdEZpbmRpbmdMb2NhdGlvbkZhaWxlZCgpIHsKKyAgICAgICAgZmluYWwgU3RyaW5nIGNvdW50cnkgPSAidXMiOworICAgICAgICBmaW5hbCBTdHJpbmcgcHJvdmlkZXIgPSAiR29vZCI7CisgICAgICAgIGxvbmcgdGltZW91dCA9IDEwMDA7CisgICAgICAgIFRlc3RDb3VudHJ5RGV0ZWN0b3IgZGV0ZWN0b3IgPSBuZXcgVGVzdENvdW50cnlEZXRlY3Rvcihjb3VudHJ5LCBwcm92aWRlciwgdGltZW91dCkgeworICAgICAgICAgICAgQE92ZXJyaWRlCisgICAgICAgICAgICBwcm90ZWN0ZWQgTG9jYXRpb24gZ2V0TGFzdEtub3duTG9jYXRpb24oKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgICAgICB9CisgICAgICAgIH07CisgICAgICAgIENvdW50cnlMaXN0ZW5lckltcGwgY291bnRyeUxpc3RlbmVyID0gbmV3IENvdW50cnlMaXN0ZW5lckltcGwoKTsKKyAgICAgICAgZGV0ZWN0b3Iuc2V0Q291bnRyeUxpc3RlbmVyKGNvdW50cnlMaXN0ZW5lcik7CisgICAgICAgIGRldGVjdG9yLmRldGVjdENvdW50cnkoKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKGRldGVjdG9yLmdldExpc3RlbmVyc0NvdW50KCksIFRlc3RDb3VudHJ5RGV0ZWN0b3IuVE9UQUxfUFJPVklERVJTKTsKKyAgICAgICAgd2FpdEZvclRpbWVyUmVzZXQoZGV0ZWN0b3IpOworICAgICAgICAvLyBBbGwgbGlzdGVuZXJzIHNob3VsZCBiZSB1bnJlZ2lzdGVyZWQKKyAgICAgICAgYXNzZXJ0RXF1YWxzKGRldGVjdG9yLmdldExpc3RlbmVyc0NvdW50KCksIDApOworICAgICAgICAvLyBRdWVyeVRocmVhZCBzaG91bGQgc3RpbGwgYmUgTlVMTAorICAgICAgICBhc3NlcnROdWxsKGRldGVjdG9yLmdldFF1ZXJ5VGhyZWFkKCkpOworICAgICAgICBhc3NlcnRUcnVlKGNvdW50cnlMaXN0ZW5lci5ub3RpZmllZCgpKTsKKyAgICAgICAgYXNzZXJ0TnVsbChjb3VudHJ5TGlzdGVuZXIuZ2V0Q291bnRyeSgpKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCB0ZXN0RmluZGluZ0NvdW50cnlGYWlsZWQoKSB7CisgICAgICAgIGZpbmFsIFN0cmluZyBjb3VudHJ5ID0gInVzIjsKKyAgICAgICAgZmluYWwgU3RyaW5nIHByb3ZpZGVyID0gIkdvb2QiOworICAgICAgICBUZXN0Q291bnRyeURldGVjdG9yIGRldGVjdG9yID0gbmV3IFRlc3RDb3VudHJ5RGV0ZWN0b3IoY291bnRyeSwgcHJvdmlkZXIpIHsKKyAgICAgICAgICAgIEBPdmVycmlkZQorICAgICAgICAgICAgcHJvdGVjdGVkIFN0cmluZyBnZXRDb3VudHJ5RnJvbUxvY2F0aW9uKExvY2F0aW9uIGxvY2F0aW9uKSB7CisgICAgICAgICAgICAgICAgc3luY2hyb25pemVkIChjb3VudHJ5Rm91bmRMb2NrZXIpIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKCEgbm90aWZ5Q291bnRyeSkgeworICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb3VudHJ5Rm91bmRMb2NrZXIud2FpdCgpOworICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoSW50ZXJydXB0ZWRFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIC8vIFdlIGRpZG4ndCBmaW5kIGNvdW50cnkuCisgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgICAgICB9CisgICAgICAgIH07CisgICAgICAgIENvdW50cnlMaXN0ZW5lckltcGwgY291bnRyeUxpc3RlbmVyID0gbmV3IENvdW50cnlMaXN0ZW5lckltcGwoKTsKKyAgICAgICAgZGV0ZWN0b3Iuc2V0Q291bnRyeUxpc3RlbmVyKGNvdW50cnlMaXN0ZW5lcik7CisgICAgICAgIGRldGVjdG9yLmRldGVjdENvdW50cnkoKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKGRldGVjdG9yLmdldExpc3RlbmVyc0NvdW50KCksIFRlc3RDb3VudHJ5RGV0ZWN0b3IuVE9UQUxfUFJPVklERVJTKTsKKyAgICAgICAgZGV0ZWN0b3Iubm90aWZ5TG9jYXRpb25Gb3VuZCgpOworICAgICAgICAvLyBBbGwgbGlzdGVuZXJzIHNob3VsZCBiZSB1bnJlZ2lzdGVyZWQKKyAgICAgICAgYXNzZXJ0RXF1YWxzKGRldGVjdG9yLmdldExpc3RlbmVyc0NvdW50KCksIDApOworICAgICAgICBhc3NlcnROdWxsKGRldGVjdG9yLmdldFRpbWVyKCkpOworICAgICAgICBUaHJlYWQgcXVlcnlUaHJlYWQgPSB3YWl0Rm9yUXVlcnlUaHJlYWRMYXVuY2hlZChkZXRlY3Rvcik7CisgICAgICAgIGRldGVjdG9yLm5vdGlmeUNvdW50cnlGb3VuZCgpOworICAgICAgICAvLyBXYWl0IGZvciBxdWVyeSB0aHJlYWQgZW5kaW5nCisgICAgICAgIHdhaXRGb3JUaHJlYWRFbmRpbmcocXVlcnlUaHJlYWQpOworICAgICAgICAvLyBRdWVyeVRocmVhZCBzaG91bGQgYmUgc2V0IHRvIE5VTEwKKyAgICAgICAgYXNzZXJ0TnVsbChkZXRlY3Rvci5nZXRRdWVyeV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ICAgIH0KKworICAgIHByaXZhdGUgdm9pZCB3YWl0Rm9yVGhyZWFkRW5kaW5nKFRocmVhZCB0aHJlYWQpIHsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIHRocmVhZC5qb2luKDUwMDApOworICAgICAgICB9IGNhdGNoIChJbnRlcnJ1cHRlZEV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICBlLnByaW50U3RhY2tUcmFjZSgpOworICAgICAgICB9CisgICAgfQorCisgICAgcHJpdmF0ZSBUaHJlYWQgd2FpdEZvclF1ZXJ5VGhyZWFkTGF1bmNoZWQoVGVzdENvdW50cnlEZXRlY3RvciBkZXRlY3RvcikgeworICAgICAgICBpbnQgY291bnQgPSA1OworICAgICAgICBsb25nIGludGVydmFsID0gMTAwMDsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIHdoaWxlIChjb3VudC0tID4gMCAmJiBkZXRlY3Rvci5nZXRRdWVyeVRocmVhZCgpID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICBUaHJlYWQuc2xlZXAoaW50ZXJ2YWwpOworICAgICAgICAgICAgfQorICAgICAgICB9IGNhdGNoIChJbnRlcnJ1cHRlZEV4Y2VwdGlvbiBlKSB7CisgICAgICAgIH0KKyAgICAgICAgVGhyZWFkIHRocmVhZCA9IGRldGVjdG9yLmdldFF1ZXJ5VGhyZWFkKCk7CisgICAgICAgIGFzc2VydFRydWUodGhyZWFkICE9IG51bGwpOworICAgICAgICByZXR1cm4gdGhyZWFkOworICAgIH0KK30KZGlmZiAtLWdpdCBhL3RlbGVwaG9ueS9qYXZhL2FuZHJvaWQvdGVsZXBob255L1Bob25lTnVtYmVyRm9ybWF0dGluZ1RleHRXYXRjaGVyLmphdmEgYi90ZWxlcGhvbnkvamF2YS9hbmRyb2lkL3RlbGVwaG9ueS9QaG9uZU51bWJlckZvcm1hdHRpbmdUZXh0V2F0Y2hlci5qYXZhCmluZGV4IDhhNDczMzkuLmZmYWJiN2IgMTAwNjQ0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SkgewotICAgICAgICAgICAgICAgICAgICAgICAgdGV4dC5kZWxldGUobUh5cGhlblN0YXJ0IC0gMSwgbUh5cGhlblN0YXJ0KTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAobUh5cGhlblN0YXJ0IDwgdGV4dC5sZW5ndGgoKSkgewotICAgICAgICAgICAgICAgICAgICB0ZXh0LmRlbGV0ZShtSHlwaGVuU3RhcnQsIG1IeXBoZW5TdGFydCArIDEpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgUGhvbmVOdW1iZXJVdGlscy5mb3JtYXROdW1iZXIodGV4dCwgc0Zvcm1hdFR5cGUpOwotCi0gICAgICAgICAgICBtRm9ybWF0dGluZyA9IGZhbHNlOwotICAgICAgICB9CisgICAgLyoqCisgICAgICogVGhlIGZvcm1hdHRpbmcgaXMgYmFzZWQgb24gdGhlIGdpdmVuIDxjb2RlPmNvdW50cnlDb2RlPC9jb2RlPi4KKyAgICAgKgorICAgICAqIEBwYXJhbSBjb3VudHJ5Q29kZSB0aGUgSVNPIDMxNjYtMSB0d28tbGV0dGVyIGNvdW50cnkgY29kZSB0aGF0IGluZGljYXRlcyB0aGUgY291bnRyeS9yZWdpb24KKyAgICAgKiB3aGVyZSB0aGUgcGhvbmUgbnVtYmVyIGlzIGJlaW5nIGVudGVyZWQuCisgICAgICoKKyAgICAgKiBAaGlkZQorICAgICAqLworICAgIHB1YmxpYyBQaG9uZU51bWJlckZvcm1hdHRpbmdUZXh0V2F0Y2hlcihTdHJpbmcgY291bnRyeUNvZGUpIHsKKyAgICAgICAgaWYgKGNvdW50cnlDb2RlID09IG51bGwpIHRocm93IG5ldyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oKTsKKyAgICAgICAgbUZvcm1hdHRlciA9IFBob25lTnVtYmVyVXRpbC5nZXRJbnN0YW5jZSgpLmdldEFzWW91VHlwZUZvcm1hdHRlcihjb3V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ICAgICAgICAgICAgICBpZiAoc2VsU3RhcnQgPT0gc3RhcnQgKyAxKSB7Ci0gICAgICAgICAgICAgICAgICAgIG1EZWxldGluZ0JhY2t3YXJkID0gdHJ1ZTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICBtRGVsZXRpbmdCYWNrd2FyZCA9IGZhbHNlOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgbURlbGV0aW5nSHlwaGVuID0gZmFsc2U7Ci0gICAgICAgICAgICB9CisgICAgcHVibGljIHZvaWQgYmVmb3JlVGV4dENoYW5nZWQoQ2hhclNlcXVlbmNlIHMsIGludCBzdGFydCwgaW50IGNvdW50LAorICAgICAgICAgICAgaW50IGFmdGVyKSB7CisgICAgICAgIGlmIChtU2VsZkNoYW5nZSB8fCBtU3RvcEZvcm1hdHRpbmcpIHsKKyAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfQorICAgICAgICBpZiAoY291bnQgPT0gMCAmJiBzLmxlbmd0aCgpID09IHN0YXJ0KSB7CisgICAgICAgICAgICAvLyBBcHBlbmQgb25lIG9yIG1vcmUgbmV3IGNoYXJzCisgICAgICAgICAgICBtU3RhdGUgPSBTVEFURV9BUFBFTkQ7CisgICAgICAgIH0gZWxzZSBpZiAoYWZ0ZXIgPT0gMCAmJiBzdGFydCArIGNvdW50ID09IHMubGVuZ3RoKCkgJiYgY291bnQgPiAwKSB7CisgICAgICAgICAgICAvLyBSZW1vdmUgb25lIG9yIG1vcmUgY2hhcnMgZnJvbSB0aGUgZW5kIG9mIHN0cmluZy4KKyAgICAgICAgICAgIG1TdGF0ZSA9IFNUQVRFX1JFTU9WRV9MQVNUOworICAgICAgICB9IGVsc2UgaWYgKGNvdW50ID4gMCAmJiAhaGFzU2VwYXJhdG9yKHMsIHN0YXJ0LCBjb3VudCkpIHsKKyAgICAgICAgICAgIC8vIFJlbW92ZSB0aGUgZGlh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aW5nKCk7CisgICAgICAgIH0gZWxzZSBpZiAobVN0YXRlID09IFNUQVRFX09USEVSKSB7CisgICAgICAgICAgICAvLyBVc2VyIG11c3QgaW5zZXJ0IG9yIHJlbW92ZSB0aGUgbm9uLWRpYWxhYmxlIGNoYXJhY3RlcnMgaW4gdGhlIGJlZ2luIG9yIG1pZGRsZSBvZgorICAgICAgICAgICAgLy8gbnVtYmVyLCBzdG9wIGZvcm1hdHRpbmcuCisgICAgICAgICAgICBzdG9wRm9ybWF0dGluZygpOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHN5bmNocm9uaXplZCB2b2lkIGFmdGVyVGV4dENoYW5nZWQoRWRpdGFibGUgcykgeworICAgICAgICBpZiAobVN0b3BGb3JtYXR0aW5nKSB7CisgICAgICAgICAgICAvLyBSZXN0YXJ0IHRoZSBmb3JtYXR0aW5nIHdoZW4gYWxsIHRleHRzIHdlcmUgY2xlYXIuCisgICAgICAgICAgICBtU3RvcEZvcm1hdHRpbmcgPSAhKHMubGVuZ3RoKCkgPT0gMCk7CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKyAgICAgICAgaWYgKG1TZWxmQ2hhbmdlKSB7CisgICAgICAgICAgICAvLyBJZ25vcmUgdGhlIGNoYW5nZSBjYXVzZWQgYnkgcy5yZXBsYWNlKCkuCisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKyAgICAgICAgU3RyaW5nIGZvcm1hdHRlZCA9IHJlZm9ybWF0KHMsIFNlbGVjdGlvbi5nZXRTZWxlY3Rpb25FbmQocykpOworICAgICAgICBpZiAoZm9ybWF0dGVkICE9IG51bGwpIHsKKyAgICAgICAgICAgIGludCByZW1lbWJlcmVkUG9zID0gbUZvcm1hdHRlci5nZXRSZW1lbWJlcmVkUG9zaXRpb24oKTsKKyAgICAgICAgICAgIG1TZWxmQ2hhbmdlID0gdHJ1ZTsKKyAgICAgICAgICAgIHMucmVwbGFjZSgwLCBzLmxlbmd0aCgpLCBmb3JtY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VySW5kZXggPSBjdXJzb3IgLSAxOworICAgICAgICBTdHJpbmcgZm9ybWF0dGVkID0gbnVsbDsKKyAgICAgICAgbUZvcm1hdHRlci5jbGVhcigpOworICAgICAgICBjaGFyIGxhc3ROb25TZXBhcmF0b3IgPSAwOworICAgICAgICBib29sZWFuIGhhc0N1cnNvciA9IGZhbHNlOworICAgICAgICBpbnQgbGVuID0gcy5sZW5ndGgoKTsKKyAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBsZW47IGkrKykgeworICAgICAgICAgICAgY2hhciBjID0gcy5jaGFyQXQoaSk7CisgICAgICAgICAgICBpZiAoUGhvbmVOdW1iZXJVdGlscy5pc05vblNlcGFyYXRvcihjKSkgeworICAgICAgICAgICAgICAgIGlmIChsYXN0Tm9uU2VwYXJhdG9yICE9IDApIHsKKyAgICAgICAgICAgICAgICAgICAgZm9ybWF0dGVkID0gZ2V0Rm9ybWF0dGVkTnVtYmVyKGxhc3ROb25TZXBhcmF0b3IsIGhhc0N1cnNvcik7CisgICAgICAgICAgICAgICAgICAgIGhhc0N1cnNvciA9IGZhbHNlOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBsYXN0Tm9uU2VwYXJhdG9yID0gYzsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmIChpID09IGN1ckluZGV4KSB7CisgICAgICAgICAgICAgICAgaGFzQ3Vyc29yID0gdHJ1ZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICBpZiAobGFzdE5vblNlcGFyYXRvciAhPSAwKSB7CisgICAgICAgICAgICBmb3JtYXR0ZWQgPSBnZXRGb3JtYXR0ZWROdW1iZXIobGFzdE5vblNlcGFyYXRvciwgaGFzQ3Vyc29yKTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gZm9ybWF0dGVkOworICAgIH0KKworICAgIHByaXZhdGUgU3RyaW5nIGdldEZvcm1hdHRlZE51bWJlcihjaGFyIGxhc3ROb25TZXBhcmF0b3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zCisgICAgICogICAgICAgICBub3QgdmFsaWQuCisgICAgICoKKyAgICAgKiBAaGlkZQorICAgICAqLworICAgIHB1YmxpYyBzdGF0aWMgU3RyaW5nIGZvcm1hdE51bWJlclRvRTE2NChTdHJpbmcgcGhvbmVOdW1iZXIsIFN0cmluZyBkZWZhdWx0Q291bnRyeUlzbykgeworICAgICAgICBQaG9uZU51bWJlclV0aWwgdXRpbCA9IFBob25lTnVtYmVyVXRpbC5nZXRJbnN0YW5jZSgpOworICAgICAgICBTdHJpbmcgcmVzdWx0ID0gbnVsbDsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIFBob25lTnVtYmVyIHBuID0gdXRpbC5wYXJzZShwaG9uZU51bWJlciwgZGVmYXVsdENvdW50cnlJc28pOworICAgICAgICAgICAgaWYgKHV0aWwuaXNWYWxpZE51bWJlcihwbikpIHsKKyAgICAgICAgICAgICAgICByZXN1bHQgPSB1dGlsLmZvcm1hdChwbiwgUGhvbmVOdW1iZXJGb3JtYXQuRTE2NCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0gY2F0Y2ggKE51bWJlclBhcnNlRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gcmVzdWx0OworICAgIH0KKworICAgIC8qKgorICAgICAqIEZvcm1hdCBhIHBob25lIG51bWJlci4KKyAgICAgKiA8cD4KKyAgICAgKiBJZiB0aGUgZ2l2ZW4gbnVtYmVyIGRvZXNuJ3QgaGF2ZSB0aGUgY291bnRyeSBjb2RlLCB0aGUgcGhvbmUgd2lsbCBiZQorICAgICAqIGZvcm1hdHRlZCB0byB0aGUgZGVmYXVsdCBjb3VudHJ5J3MgY29udmVudGlvbi4KKyAgICAgKgorICAgICAqIEBwYXJhbSBwaG9uZU51bWJlcgorICAgICAqICAgICAgICAgICAgdGhlIG51bWJlciB0byBiZSBmb3JtYXR0ZWQuCisgICAgICogQHBhcmFtIGRlZmF1bHRDb3VudHJ5SXNvCisgICAgICogICAgICAgICA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bnZlcnRlZCB0bworICAgICAqIGRpZ2l0cyBmaXJzdC4KKyAgICAgKgorICAgICAqIEBwYXJhbSBwaG9uZU51bWJlcgorICAgICAqICAgICAgICAgICAgdGhlIG51bWJlciB0byBiZSBub3JtYWxpemVkLgorICAgICAqIEByZXR1cm4gdGhlIG5vcm1hbGl6ZWQgbnVtYmVyLgorICAgICAqCisgICAgICogQGhpZGUKKyAgICAgKi8KKyAgICBwdWJsaWMgc3RhdGljIFN0cmluZyBub3JtYWxpemVOdW1iZXIoU3RyaW5nIHBob25lTnVtYmVyKSB7CisgICAgICAgIFN0cmluZ0J1aWxkZXIgc2IgPSBuZXcgU3RyaW5nQnVpbGRlcigpOworICAgICAgICBpbnQgbGVuID0gcGhvbmVOdW1iZXIubGVuZ3RoKCk7CisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbGVuOyBpKyspIHsKKyAgICAgICAgICAgIGNoYXIgYyA9IHBob25lTnVtYmVyLmNoYXJBdChpKTsKKyAgICAgICAgICAgIGlmICgoaSA9PSAwICYmIGMgPT0gJysnKSB8fCBQaG9uZU51bWJlclV0aWxzLmlzSVNPRGlnaXQoYykpIHsKKyAgICAgICAgICAgICAgICBzYi5hcHBlbmQoYyk7CisgICAgICAgICAgICB9IGVsc2UgaWYgKChjID49ICdhJyAmJiBjIDw9ICd6JykgfHwgKGMgPj0gJ0EnICYmIGMgPD0gJ1onKSkgeworICAgICAgICAgICAgICAgIHJldHVybiBub3JtYWxpemVOdW1iZXIoUGhvbmVOdW1iZXJVdGlscy5jb252ZXJ0S2V5cGFkTGV0dGVyc1RvRGlnaXRzKHBob25lTnVtYmVyKSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIHNiLnRvU3RyaW5nKCk7CisgICAgfQorCiAgICAgLy8gVGhyZWUgYW5kIGZvdXIgZGlnaXQgcGhvbmUgbnVtYmVycyBmb3IgZWl0aGVyIHNwZWNpYWwgc2VydmljZXMsCiAgICAgLy8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ZXQuIiArIGludGVyZmFjZU5hbWUgKyAiLiI7CisgICAgICAgICAgICAgICAgZ2F0ZXdheUFkZHJlc3MgPSBTeXN0ZW1Qcm9wZXJ0aWVzLmdldChwcmVmaXggKyAiZ3ciKTsKKyAgICAgICAgICAgICAgICBkbnNTZXJ2ZXJzWzBdID0gU3lzdGVtUHJvcGVydGllcy5nZXQocHJlZml4ICsgImRuczEiKTsKKyAgICAgICAgICAgICAgICBkbnNTZXJ2ZXJzWzFdID0gU3lzdGVtUHJvcGVydGllcy5nZXQocHJlZml4ICsgImRuczIiKTsKKwogICAgICAgICAgICAgICAgIGlmIChyZXNwb25zZS5sZW5ndGggPiAyKSB7CiAgICAgICAgICAgICAgICAgICAgIGlwQWRkcmVzcyA9IHJlc3BvbnNlWzJdOwotICAgICAgICAgICAgICAgICAgICBTdHJpbmcgcHJlZml4ID0gIm5ldC4iICsgaW50ZXJmYWNlTmFtZSArICIuIjsKLSAgICAgICAgICAgICAgICAgICAgZ2F0ZXdheUFkZHJlc3MgPSBTeXN0ZW1Qcm9wZXJ0aWVzLmdldChwcmVmaXggKyAiZ3ciKTsKLSAgICAgICAgICAgICAgICAgICAgZG5zU2VydmVyc1swXSA9IFN5c3RlbVByb3BlcnRpZXMuZ2V0KHByZWZpeCArICJkbnMxIik7Ci0gICAgICAgICAgICAgICAgICAgIGRuc1NlcnZlcnNbMV0gPSBTeXN0ZW1Qcm9wZXJ0aWVzLmdldChwcmVmaXggKyAiZG5zMiIpOwotICAgICAgICAgICAgICAgICAgICBpZiAoREJHKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBsb2coImludGVyZmFjZT0iICsgaW50ZXJmYWNlTmFtZSArICIgaXBBZGRyZXNzPSIgKyBpcEFkZHJlc3MKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICArICIgZ2F0ZXdheT0iICsgZ2F0ZXdheUFkZHJlc3MgKyAiIEROUzE9IiArIGRuc1NlcnZlcnNbMF0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICArICIgRE5TMj0iICsgZG5zU2VydmVyc1sxXSk7Ci0gICAgICAgICAgICAgICAgICAgIH0KIAogICAgICAgICAgICAgICAgICAgICBpZiAoaXNEbnNPayhkbnNTZXJ2ZXJzKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0ID0gU2V0dXBSZXN1bHQuU1VDQ0VTUzsKQEAgLTQ0NCw3ICs0NDEsMTQgQEAKICAgICAgICAgICAgIH0KICAgICAgICAgfQogCi0gICAgICAgIGlmIChEQkcpIGxvZygiRGF0YUNvbm5lY3Rpb24gc2V0dXAgcmVzdWx0PSciICsgcmVzdWx0ICsgIicgb24gY2lkPSIgKyBjaWQpOworICAgICAgICBpZiAoREJHKSB7CisgICAgICAgICAgICBsb2coIkRhdGFDb25uZWN0aW9uIHNldHVwIHJlc3VsdD0nIiArIHJlc3VsdCArICInIG9uIGNpZD0iICsgY2lkKTsKKyAgICAgICAgICAgIGlmIChyZXN1bHQgPT0gU2V0dXBSZXN1bHQuU1VDQ0VTUykgeworICAgICAgICAgICAgICAgIGxvZygiaW50ZXJmYWNlPSIgKyBpbnRlcmZhY2VOYW1lICsgIiBpcEFkZHJlc3M9IiArIGlwQWRkcmVzcworICAgICAgICAgICAgICAgICAgICAgICAgKyAiIGdhdGV3YXk9IiArIGdhdGV3YXlBZGRyZXNzICsgIiBETlMxPSIgKyBkbnNTZXJ2ZXJzWzBdCisgICAgICAgICAgICAgICAgICAgICAgICArICIgRE5TMj0iICsgZG5zU2VydmVyc1sxXSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KICAgICAgICAgcmV0dXJuIHJlc3VsdDsKICAgICB9CiAKZGlmZiAtLWdpdCBhL3RlbGVwaG9ueS9qYXZhL2NvbS9hbmRyb2lkL2ludGVybmFsL3RlbGVwaG9ueS9EYXRhQ29ubmVjdGlvblRyYWNrZXIuamF2YSBiL3RlbGVwaG9ueS9qYXZhL2NvbS9hbmRyb2lkL2ludGVybmFsL3RlbGVwaG9ueS9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Bmb3IgKGludCBpZCA9IDA7IGlkIDwgQVBOX05VTV9UWVBFUzsgaWQrKykgeworICAgICAgICAgICAgaWYgKGRhdGFFbmFibGVkW2lkXSkgeworICAgICAgICAgICAgICAgIHBob25lLm5vdGlmeURhdGFDb25uZWN0aW9uKHJlYXNvbiwgYXBuSWRUb1R5cGUoaWQpKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICBub3RpZnlEYXRhQXZhaWxhYmlsaXR5KHJlYXNvbik7CisgICAgfQorCisgICAgLy8gYSBuZXcgQVBOIGhhcyBnb25lIGFjdGl2ZSBhbmQgbmVlZHMgdG8gc2VuZCBldmVudHMgdG8gY2F0Y2ggdXAgd2l0aCB0aGUgY3VycmVudCBjb25kaXRpb24KKyAgICBwcml2YXRlIHZvaWQgbm90aWZ5QXBuSWRVcFRvQ3VycmVudChTdHJpbmcgcmVhc29uLCBpbnQgYXBuSWQpIHsKKyAgICAgICAgc3dpdGNoIChzdGF0ZSkgeworICAgICAgICAgICAgY2FzZSBJRExFOgorICAgICAgICAgICAgY2FzZSBJTklUSU5HOgorICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBDT05ORUNUSU5HOgorICAgICAgICAgICAgY2FzZSBTQ0FOTklORzoKKyAgICAgICAgICAgICAgICBwaG9uZS5ub3RpZnlEYXRhQ29ubmVjdGlvbihyZWFzb24sIGFwbklkVG9UeXBlKGFwbklkKSwgUGhvbmUuRGF0YVN0YXRlLkNPTk5FQ1RJTkcpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBDT05ORUNURUQ6CisgICAgICAgICAgICBjYXNlIERJU0NPTk5FQ1RJTkc6CisgICAgICAgICAgICAgICAgcGhvbmUubm90aWZ5RGF0YUNvbm5lY3Rpb24ocmVhc29uLCBhcG5JZFRvVHlwZShhcG5JZCksIFBob25lLkRhdGFTdGF0ZS5DT05ORUNUSU5HKTsKKyAgICAgICAgICAgICAgICBwaG9u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JzZXRFbmFibGVkKCIgKyBpZCArICIsICIgKyBlbmFibGUgKyAiKSB3aXRoIG9sZCBzdGF0ZSA9ICIgKwotICAgICAgICAgICAgICAgIGRhdGFFbmFibGVkW2lkXSArICIgYW5kIGVuYWJsZWRDb3VudCA9ICIgKyBlbmFibGVkQ291bnQpOwotCisgICAgICAgIGlmIChEQkcpIHsKKyAgICAgICAgICAgIExvZy5kKExPR19UQUcsICJzZXRFbmFibGVkKCIgKyBpZCArICIsICIgKyBlbmFibGUgKyAiKSB3aXRoIG9sZCBzdGF0ZSA9ICIKKyAgICAgICAgICAgICAgICAgICAgKyBkYXRhRW5hYmxlZFtpZF0gKyAiIGFuZCBlbmFibGVkQ291bnQgPSAiICsgZW5hYmxlZENvdW50KTsKKyAgICAgICAgfQogICAgICAgICBNZXNzYWdlIG1zZyA9IG9idGFpbk1lc3NhZ2UoRVZFTlRfRU5BQkxFX05FV19BUE4pOwogICAgICAgICBtc2cuYXJnMSA9IGlkOwogICAgICAgICBtc2cuYXJnMiA9IChlbmFibGUgPyBFTkFCTEVEIDogRElTQUJMRUQpOwpAQCAtNTA3LDkgKzYwNCw4IEBACiAgICAgcHJvdGVjdGVkIHN5bmNocm9uaXplZCB2b2lkIG9uRW5hYmxlQXBuKGludCBhcG5JZCwgaW50IGVuYWJsZWQpIHsKICAgICAgICAgaWYgKERCRykgewogICAgICAgICAgICAgTG9nLmQoTE9HX1RBRywgIkVWRU5UX0FQTl9FTkFCTEVfUkVRVUVTVCAiICsgYXBuSWQgKyAiLCAiICsgZW5hYmxlZCk7Ci0gICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiIGRhdGFFbmFibGVkID0gIiArIGRhdGFFbmFibGVkW2FwbklkXSArCi0gICAgICAgICAgICAgICAgICAgICIsIGVuYWJsZWRDb3VudCA9ICIgKyBlbmFibGVkQ291bnQgKwotICAgICAgICAgICAgICAgICAgICAiLCBpc0FwblR5cGVBY3RpdmUgPSAiICsgaXNBcG5UeXBlQWN0aXZlKGFwbklkVG9UeXBlKGFwbklkKSkpOworICAgICAgICAgICAgTG9nLmQoTE9HX1RBRywgIiBkYXRhRW5hYmxlZCA9ICIgKyBkYXRhRW5hYmxlZFthcG5JZF0gKyAiLCBlbmFibGVkQ291bnQgPSAiCisgICAgICAgICAgICAgICAgICAgICsgZW5hYmxlZENvdW50ICsgIiwgaXNBcG5UeXBlQWN0aXZlID0gIiArIGlzQXBuVHlwZUFjdGl2ZShhcG5JZFRvVHlwZShhcG5JZCkpKTsKICAgICAgICAgfQogICAgICAgICBpZiAoZW5hYmxlZCA9PSBFTkFCTEVEKSB7CiAgICAgICAgICAgICBpZiAoIWRhdGFFbmFibGVkW2FwbklkXSkgewpAQCAtNTIwLDYgKzYxNiw4IEBACiAgICAgICAgICAgICBpZiAoIWlzQXBuVHlwZUFjdGl2ZSh0eXBlKSkgewogICAgICAgICAgICAgICAgIG1SZXF1ZXN0ZWRBcG5UeXBlID0gdHlwZTsKICAgICAgICAgICAgICAgICBvbkVuYWJsZU5ld0FwbigpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBub3RpZnlBcG5JZFVwVG9DdXJyZW50KFBob25lLlJFQVNPTl9BUE5fU1dJVENIRUQsIGFwbklkKTsKICAgICAgICAgICAgIH0KICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgIC8vIGRpc2FibGUKQEAgLTUyOCw4ICs2MjYsMTcgQEAKICAgICAgICAgICAgICAgICBlbmFibGVkQ291bnQtLTsKICAgICAgICAgICAgICAgICBpZiAoZW5hYmxlZENvdW50ID09IDApIHsKICAgICAgICAgICAgICAgICAgICAgb25DbGVhblVwQ29ubmVjdGlvbih0cnVlLCBQaG9uZS5SRUFTT05fREFUQV9ESVNBQkxFRCk7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChkYXRhRW5hYmxlZFtBUE5fREVGQVVMVF9JRF0gPT0gdHJ1ZSAmJgotICAgICAgICAgICAgICAgICAgICAgICAgIWlzQXBuVHlwZUFjdGl2ZShQaG9uZS5BUE5fVFlQRV9ERUZBVUxUKSkgeworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIC8vIHNlbmQgdGhlIGRpc2Nvbm5lY3QgbXNnIG1hbnVhbGx5LCBzaW5jZSB0aGUgbm9ybWFsIHJvdXRlIHdvbnQgc2VuZAorICAgICAgICAgICAgICAgIC8vIGl0IChpdCdzIG5vdCBlbmFibGVkKQorICAgICAgICAgICAgICAgIG5vdGlmeUFwbklkRGlzY29ubmVjdGVkKFBob25lLlJFQVNPTl9EQVRBX0RJU0FCTEVELCBhcG5JZCk7CisgICAgICAgICAgICAgICAgaWYgKGRhdGFFbmFibGVkW0FQTl9ERUZBVUxUX0lEXSA9PSB0cnVlCisgICAgICAgICAgICAgICAgICAgICAgICAmJiAhaXNBcG5UeXBlQWN0aXZlKFBob25lLkFQTl9UWVBFX0RFRkFVTFQpKSB7CisgICAgICAgICAgICAgICAgICAgIC8vIFRPRE8gLSB0aGlzIGlzIGFuIHVnbHkgd2F5IHRvIHJlc3RvcmUgdGhlIGRlZmF1bHQgY29ubiAtIHNob3VsZCBiZSBkb25lCisgICAgICAgICAgICAgICAgICAgIC8vIGJ5IGEgcmVhbCBjb250ZW50aW9uIG1hbmFnZXIgYW5kIHBvbGljeSB0aGF0IGRpc2Nvbm5lY3RzIHRoZSBsb3dlciBwcmkKKyAgICAgICAgICAgICAgICAgICAgLy8gc3R1ZmYgYXMgZW5hYmxlIHJlcXVlc3RzIGNvbWUgaW4gYW5kIHBvcHMgdGhlbSBiYWNrIG9uIGFzIHdlIGRpc2FibGUgYmFjaworICAgICAgICAgICAgICAgICAgICAvLyBkb3duIHRvIHRoZSBsb3dlciBwcmkgc3R1ZmYKICAgICAgICAgICAgICAgICAgICAgbVJlcXVlc3RlZEFwblR5cGUgPSBQaG9uZS5BUE5fVFlQRV9ERUZBVUxUOwogICAgICAgICAgICAgICAgICAgICBvbkVuYWJsZU5ld0FwbigpOwogICAgICAgICAgICAgICAgIH0KQEAgLTU3NCw5ICs2ODEsNDcgQEAKICAgICAgICAgICAgICAgICBvblRyeVNldHVwRGF0YShQaG9uZS5SRUFTT05fREFUQV9FTkFCTEVEKTsKICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgb25DbGVhblVwQ29ubmVjdGlvbih0cnVlLCBQaG9uZS5SRUFTT05fREFUQV9ESVNBQkxFRCk7Ci0gICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KICAgICAgICAgfQogICAgIH0KIAorICAgIHByb3RlY3RlZCBOZXR3b3JrUHJvcGVydGllcyBtYWtlTmV0d29ya1Byb3BlcnRpZXMoRGF0YUNvbm5lY3Rpb24gY29ubmVjdGlvbikgeworICAgICAgICBOZXR3b3JrUHJvcGVydGllcyBwcm9wZXJ0aWVzID0gbmV3IE5ldHdvcmtQcm9wZXJ0aWVzKCk7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBwcm9wZXJ0aWVzLnNldEludGVyZmFjZShOZXR3b3JrSW50ZXJmYWNlLmdldEJ5TmFtZShjb25uZWN0aW9uLmdldEludGVyZmFjZSgpKSk7CisgICAgICAgIH0gY2F0Y2ggKFNvY2tldEV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICBMb2cuZShMT0dfVEFHLCAiU29ja2V0RXhjZXB0aW9uIGNyZWF0aW5nIE5ldHdvcmtJbnRlcmZhY2U6ICIgKyBlKTsKKyAgICAgICAgfSBjYXRjaCAoTnVsbFBvaW50ZXJFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgTG9nLmUoTE9HX1RBRywgIk5QRSB0cnlpbmcgdG8gbWFrZU5ldHdvcmtQcm9wZXJ0aWVzOiAiICsgZSk7CisgICAgICAgIH0KIAorICAgICAgICB0cnkgeworICAgICAgICAgICAgcHJvcGVydGllcy5hZGRBZGRyZXNzKEluZXRBZGRyZXNzLmdldEJ5TmFtZShjb25uZWN0aW9uLmdldElwQWRkcmVzcygpKSk7CisgICAgICAgIH0gY2F0Y2ggKFVua25vd25Ib3N0RXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgIExvZy5lKExPR19UQUcsICJVbmtub3duSG9zdEV4Y2VwdGlvbiBzZXR0aW5nIElwQWRkcmVzczogIiArIGUpOworICAgICAgICB9IGNhdGNoIChTZWN1cml0eUV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICBMb2cuZShMT0dfVEFHLCAiU2VjdXJpdHlFeGNlcHRpb24gc2V0dGluZyBJcEFkZHJlc3M6ICIgKyBlKTsKKyAgICAgICAgfQorCisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBwcm9wZXJ0aWVzLnNldEdhdGV3YXkoSW5ldEFkZHJlc3MuZ2V0QnlOYW1lKGNvbm5lY3Rpb24uZ2V0R2F0ZXdheUFkZHJlc3MoKSkpOworICAgICAgICB9IGNhdGNoIChVbmtub3duSG9zdEV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICBMb2cuZShMT0dfVEFHLCAiVW5rbm93bkhvc3RFeGNlcHRpb24gc2V0dGluZyBHYXRld2F5QWRkcmVzczogIiArIGUpOworICAgICAgICB9IGNhdGNoIChTZWN1cml0eUV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICBMb2cuZShMT0dfVEFHLCAiU2VjdXJpdHlFeGNlcHRpb24gc2V0dGluZyBHYXRld2F5QWRkcmVzczogIiArIGUpOworICAgICAgICB9CisKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIFN0cmluZ1tdIGRuc1N0cmluZ3MgPSBjb25uZWN0aW9uLmdldERuc1NlcnZlcnMoKTsKKyAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpPGRuc1N0cmluZ3MubGVuZ3RoOyBpKyspIHsKKyAgICAgICAgICAgICAgICBwcm9wZXJ0aWVzLmFkZERucyhJbmV0QWRkcmVzcy5nZXRCeU5hbWUoZG5zU3RyaW5nc1tpXSkpOworICAgICAgICAgICAgfQorICAgICAgICB9IGNhdGNoIChVbm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ID0gVGVsZXBob255TWFuYWdlci5nZXREZWZhdWx0KCk7CisgICAgICAgIE5ldHdvcmtQcm9wZXJ0aWVzIG5ldHdvcmtQcm9wZXJ0aWVzID0gbnVsbDsKKyAgICAgICAgaWYgKHN0YXRlID09IFBob25lLkRhdGFTdGF0ZS5DT05ORUNURUQpIHsKKyAgICAgICAgICAgIG5ldHdvcmtQcm9wZXJ0aWVzID0gc2VuZGVyLmdldE5ldHdvcmtQcm9wZXJ0aWVzKGFwblR5cGUpOworICAgICAgICB9CiAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICBtUmVnaXN0cnkubm90aWZ5RGF0YUNvbm5lY3Rpb24oCi0gICAgICAgICAgICAgICAgICAgIGNvbnZlcnREYXRhU3RhdGUoc2VuZGVyLmdldERhdGFDb25uZWN0aW9uU3RhdGUoKSksCisgICAgICAgICAgICAgICAgICAgIGNvbnZlcnREYXRhU3RhdGUoc3RhdGUpLAogICAgICAgICAgICAgICAgICAgICBzZW5kZXIuaXNEYXRhQ29ubmVjdGl2aXR5UG9zc2libGUoKSwgcmVhc29uLAogICAgICAgICAgICAgICAgICAgICBzZW5kZXIuZ2V0QWN0aXZlQXBuKCksCi0gICAgICAgICAgICAgICAgICAgIHNlbmRlci5nZXRBY3RpdmVBcG5UeXBlcygpLAotICAgICAgICAgICAgICAgICAgICBzZW5kZXIuZ2V0SW50ZXJmYWNlTmFtZShudWxsKSwKKyAgICAgICAgICAgICAgICAgICAgYXBuVHlwZSwKKyAgICAgICAgICAgICAgICAgICAgbmV0d29ya1Byb3BlcnRpZXMsCiAgICAgICAgICAgICAgICAgICAgICgodGVsZXBob255IT1udWxsKSA/IHRlbGVwaG9ueS5nZXROZXR3b3JrVHlwZSgpIDoKICAgICAgICAgICAgICAgICAgICAgVGVsZXBob255TWFuYWdlci5ORVRXT1JLX1RZUEVfVU5LTk9XTikpOwogICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZXgpIHsKQEAgLTEwOCw5ICsxM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3QoJ3Nob3J0W10gTUNDX0NPREVTJywgbWNjX2NvZGVzLCAxMCkKLWRvX2F1dG9nZW5fY29tbWVudChbJ1RoZSB2YWx1ZXMgaW4gdGhpcyB0YWJsZSBhcmUgYnJva2VuIGRvd24gYXMgZm9sbG93cyAobXNiIHRvIGxzYik6JywKLSAgICAgICAgICAgICAgICAgICAgJyAgICBpc28gY291bnRyeSBjb2RlIDE2IGJpdHMnLAotICAgICAgICAgICAgICAgICAgICAnICAgICh1bnVzZWQpICAgICAgICAgIDEgYml0JywKLSAgICAgICAgICAgICAgICAgICAgJyAgICB3aWZpIGNoYW5uZWwgICAgICA0IGJpdHMnLAotICAgICAgICAgICAgICAgICAgICAnICAgIHNtYWxsZWQgZGlnaXQgICAgIDIgYml0cycsCi0gICAgICAgICAgICAgICAgICAgICcgICAgZGVmYXVsdCB0aW1lem9uZSAgNSBiaXRzJywKLSAgICAgICAgICAgICAgICAgICAgJyAgICBkZWZhdWx0IGxhbmd1YWdlICA0IGJpdHMnXSkKLXByaW50IGZtdF9saXN0KCdpbnRbXSBJTkRfQ09ERVMnLCBpbmRfY29kZXMsIDYpCi0KLWRlZiBwYXJzZV9pbmRfY29kZShpbmQpOgotICBtY2MgPSBldmFsKG1jY19jb2Rlc1tpbmRdKQotICBjb2RlID0gZXZhbChpbmRfY29kZXNbaW5kXSkKLSAgaXNvX2xzYiA9IGludCgoY29kZSA+PiAxNikgJiAweDAwRkYpCi0gIGlzb19tc2IgPSBpbnQoKGNvZGUgPj4gMjQpICYgMHgwMEZGKQotICBpc28gPSAnJXMlcycgJSAoY2hyKGlzb19tc2IpLCBjaHIoaXNvX2xzYikpCi0gIHdpZmkgPSBpbnQoKGNvZGUgPj4gMTEpICYgMHgwMDBGKQotICBzZCA9IGludCgoY29kZSA+PiA5KSAmIDB4MDAwMykKLSAgdHpfaW5kID0gKGNvZGUgPj4gNCkgJiAweDAwMUYKLSAgbGFuZ19pbmQgPSAoY29kZSA+PiAwKSAmIDB4MDAwRgot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AqLwotICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIFN0cmluZ1tdIFRaX1NUUklOR1MgPSB7Ci0gICAgICAgICIiLAotICAgICAgICAiQWZyaWNhL0pvaGFubmVzYnVyZyIsCi0gICAgICAgICJBc2lhL0JlaWppbmciLAotICAgICAgICAiQXNpYS9TaW5nYXBvcmUiLAotICAgICAgICAiQXNpYS9Ub2t5byIsCi0gICAgICAgICJBdXN0cmFsaWEvU3lkbmV5IiwKLSAgICAgICAgIkV1cm9wZS9BbXN0ZXJkYW0iLAotICAgICAgICAiRXVyb3BlL0JlcmxpbiIsCi0gICAgICAgICJFdXJvcGUvRHVibGluIiwKLSAgICAgICAgIkV1cm9wZS9Mb25kb24iLAotICAgICAgICAiRXVyb3BlL01hZHJpZCIsCi0gICAgICAgICJFdXJvcGUvUGFyaXMiLAotICAgICAgICAiRXVyb3BlL1ByYWd1ZSIsCi0gICAgICAgICJFdXJvcGUvUm9tZSIsCi0gICAgICAgICJFdXJvcGUvVmllbm5hIiwKLSAgICAgICAgIkV1cm9wZS9XYXJzYXciLAotICAgICAgICAiRXVyb3BlL1p1cmljaCIsCi0gICAgICAgICJQYWNpZmljL0F1Y2tsYW5kIgotICAgIH07Ci0KLSAgICAvKioKLSAgICAgKiBBVVRPIEdFTkVSQVRFRCAoYnkgdGhlIFB5dGhvbiBjb2RlIGFib3ZlKQotICAgICAqLwotICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIFN0cmluZ1tdIExBTkdfU1RSSU5HUyA9IHsKLSAgICAgICAgIiIsICJjcyIsICJkZSIsICJlbiIsICJlcyIsICJmciIsICJpdCIsICJqYSIsICJubCIsICJ6aCIKLSAgICB9OwotCi0gICAgLyoqCi0gICAgICogQVVUTyBHRU5FUkFURUQgKGJ5IHRoZSBQeXRob24gY29kZSBhYm92ZSkKLSAgICAgKiBUaGlzIHRhYmxlIGlzIGEgbGlzdCBvZiBNQ0MgY29kZXMuICBUaGUgaW5kZXggaW4gdGhpcyB0YWJsZ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IHNtYWxsZXN0RGlnaXRzTUNDLCBsYW5ndWFnZSwgMCk7CisgICAgICAgIH0KKworICAgICAgICBNY2NFbnRyeShpbnQgbW5jLCBTdHJpbmcgaXNvLCBpbnQgc21hbGxlc3REaWdpdHNNQ0MsIFN0cmluZyBsYW5ndWFnZSwgaW50IHdpZmlDaGFubmVscykgeworICAgICAgICAgICAgdGhpcy5tY2MgPSBtbmM7CisgICAgICAgICAgICB0aGlzLmlzbyA9IGlzbzsKKyAgICAgICAgICAgIHRoaXMuc21hbGxlc3REaWdpdHNNbmMgPSBzbWFsbGVzdERpZ2l0c01DQzsKKyAgICAgICAgICAgIHRoaXMubGFuZ3VhZ2UgPSBsYW5ndWFnZTsKKyAgICAgICAgICAgIHRoaXMud2lmaUNoYW5uZWxzID0gd2lmaUNoYW5uZWxzOworICAgICAgICB9CisKKworICAgICAgICBwdWJsaWMgaW50IGNvbXBhcmVUbyhNY2NFbnRyeSBvKQorICAgICAgICB7CisgICAgICAgICAgICByZXR1cm4gbWNjIC0gby5tY2M7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcml2YXRlIHN0YXRpYyBNY2NFbnRyeQorICAgIGVudHJ5Rm9yTWNjKGludCBtY2MpCisgICAgeworICAgICAgICBpbnQgaW5kZXg7CisKKyAgICAgICAgTWNjRW50cnkgbTsKKworICAgICAgICBtID0gbmV3IE1jY0VudHJ5KG1jYywgbnVsbCwgMCk7CisKKyAgICAgICAgaW5kZXggPSBDb2xsZWN0aW9ucy5iaW5hcnlTZWFyY2godGFibGUsIG0pOworCisgICAgICAgIGlmIChpbmRleCA8IDApIHsKKyAgICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgcmV0dXJuIHRhYmxlLmdldChpbmRleCk7CisgICAgICAgIH0KKyAgICB9CisKICAgICAvKioKLSAgICAgKiBHaXZlbiBhIE1vYmlsZSBDb3VudHJ5IENvZGUsIHJldHVybnMgYSBkZWZhdWx0IHRpbWUgem9uZSBJRAotICAgICAqIGlmIGF2YWlsYWJsZS4gIFJldHVybnMgbnVsbCBpZiB1bmF2YWlsYWJsZS4KKyAgICAgKiBSZXR1cm5zIGEgZGVmYXVsdCB0aW1lIHpvbmUgSUQgZm9yIHRoZSBnaXZlbiBNQ0MuCisgICAgICogQHBhcmFtIG1jYyBNb2JpbGUgQ291bnRyeSBDb2RlCisgICAgICogQHJldHVybiBkZWZhdWx0IFRpbWVab25lIElELCBvciBudWxsIGlmIG5vdCBzcGVjaWZpZWQKICAgICAgKi8KICAgICBwdWJsaWMgc3RhdGljIFN0cmluZyBkZWZhdWx0VGltZVpvbmVGb3JNY2MoaW50IG1jYykgewotICAgICAgICBpbnQgaW5kZXggPSBBcnJheXMuYmluYXJ5U2VhcmNoKE1DQ19DT0RFUywgKHNob3J0KW1jYyk7Ci0gICAgICAgIGlmIChpbmRleCA8IDApIHsKKyAgICAgICAgTWNjRW50cnkgZW50cnk7CisKKyAgICAgICAgZW50cnkgPSBlbnRyeUZvck1jYyhtY2MpOworICAgICAgICBpZiAoZW50cnkgPT0gbnVsbCB8fCBlbnRyeS5pc28gPT0gbnVsbCkgewogICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBMb2NhbGUgbG9jYWxlOworICAgICAgICAgICAgaWYgKGVudHJ5Lmxhbmd1YWdlID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICBsb2NhbGUgPSBuZXcgTG9jYWxlKGVudHJ5Lmlzbyk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIGxvY2FsZSA9IG5ldyBMb2NhbGUoZW50cnkubGFuZ3VhZ2UsIGVudHJ5Lmlzbyk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBTdHJpbmdbXSB0eiA9IFRpbWVab25lcy5mb3JMb2NhbGUobG9jYWxlKTsKKyAgICAgICAgICAgIGlmICh0ei5sZW5ndGggPT0gMCkgcmV0dXJuIG51bGw7CisgICAgICAgICAgICByZXR1cm4gdHpbMF07CiAgICAgICAgIH0KLSAgICAgICAgaW50IGluZENvZGUgPSBJTkRfQ09ERVNbaW5kZXhdOwotICAgICAgICBpbnQgdHpJbmQgPSAoaW5kQ29kZSA+Pj4gNCkgJiAweDAwMUY7Ci0gICAgICAgIFN0cmluZyB0eiA9IFRaX1NUUklOR1NbdHpJbmRdOwotICAgICAgICBpZiAodHogPT0gIiIpIHsKLSAgICAgICAgICAgIHJldHVybiBudWxsOwotICAgICAgICB9Ci0gICAgICAgIHJldHVybiB0ejsKICAgICB9CiAKICAgICAvKioKLSAgICAgKiBHaXZlbiBhIE1vYmlsZSBDb3VudHJ5IENvZGUsIHJldHVybnMgYW4gSVNPIHR3by1jaGFyYWN0ZXIKLSAgICAgKiBjb3VudHJ5IGNvZGUgaWYgYXZhaWxhYmxlLiAgUmV0dXJucyAiIiBpZiB1bmF2YWlsYWJsZS4KKyAgICAgKiBHaXZlbiBhIEdTTSBNb2JpbGUgQ291bnRyeSBDb2RlLCByZXR1cm5zCisgICAgICogYW4gSVNPIHR3by1jaGFyYWN0ZXIgY291bnRyeSBjb2RlIGlmIGF2YWlsYWJsZS4KKyAgICAgKiBSZXR1cm5zICIiIGlmIHVuYXZhaWxhYmxlLgogICAgICAqLwotICAgIHB1YmxpYyBzdGF0aWMgU3RyaW5nIGNvdW50cnlDb2RlRm9yTWNjKGludCBtY2MpIHsKLSAgICAgICAgaW50IGluZGV4ID0gQXJyYXlzLmJpbmFyeVNlYXJjaChNQ0NfQ09ERVMsIChzaG9ydCltY2MpOwotICAgICAgICBpZiAoaW5kZXggPCAwKSB7CisgICAgcHVibGljIHN0YXRpYyBTdHJpbmcKKyAgICBjb3VudHJ5Q29kZUZvck1jYyhpbnQgbWNjKQorICAgIHsKKyAgICAgICAgTWNjRW50cnkgZW50cnk7CisKKyAgICAgICAgZW50cnkgPSBlbnRyeUZvck1jYyhtY2MpOworCisgICAgICAgIGlmIChlbnRyeSA9PSBudWxsKSB7CiAgICAgICAgICAgICByZXR1cm4gIiI7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICByZXR1cm4gZW50cnkuaXNvOwogICAgICAgICB9Ci0gICAgICAgIGludCBpbmRDb2RlID0gSU5EX0NPREVTW2luZGV4XTsKLSAgICAgICAgYnl0ZVtdIGlzbyA9IHsoYnl0ZSkoKGluZENvZGUgPj4+IDI0KSAmIDB4MDBGRiksIChieXRlKSgoaW5kQ29kZSA+Pj4gMTYpICYgMHgwMEZGKX07Ci0gICAgICAgIHJldHVybiBuZXcgU3RyaW5nKGlzbyk7CiAgICAgfQogCiAgICAgLyoqCi0gICAgICogR2l2ZW4gYSBHU00gTW9iaWxlIENvdW50cnkgQ29kZSwgcmV0dXJucyBhbiBJU08gMi0zIGNoYXJhY3RlcgotICAgICAqIGxhbmd1YWdlIGNvZGUgaWYgYXZhaWxhYmxlLiAgUmV0dXJucyBudWxsIGlmIHVuYXZhaWxhYmxlLgorICAgICAqIEdpdmVuIGEgR1NNIE1vYmlsZSBDb3VudHJ5IENvZGUsIHJldHVybnMKKyAgICAgKiBhbiBJU08gMi0zIGNoYXJhY3RlciBsYW5ndWFnZSBjb2RlIGlmIGF2YWlsYWJsZS4KKyAgICAgKiBSZXR1cm5zIG51bGwgaWYgdW5hdmFpbGFibGUuCiAgICAgICovCiAgICAgcHVibGljIHN0YXRpYyBTdHJpbmcgZGVmYXVsdExhbmd1YWdlRm9yTWNjKGludCBtY2MpIHsKLSAgICAgICAgaW50IGluZGV4ID0gQXJyYXlzLmJpbmFyeVNlYXJjaChNQ0NfQ09ERVMsIChzaG9ydCltY2MpOwotICAgICAgICBpZiAoaW5kZXggPCAwKSB7CisgICAgICAgIE1jY0VudHJ5IGVudHJ5OworCisgICAgICAgIGVudHJ5ID0gZW50cnlGb3JNY2MobWNjKTsKKworICAgICAgICBpZiAoZW50cnkgPT0gbnVsbCkgewogICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICByZXR1cm4gZW50cnkubGFuZ3VhZ2U7CiAgICAgICAgIH0KLSAgICAgICAgaW50IGluZENvZGUgPSBJTkRfQ09ERVNbaW5kZXhdOwotICAgICAgICBpbnQgbGFuZ0luZCA9IGluZENvZGUgJiAweDAwMEY7Ci0gICAgICAgIFN0cmluZyBsYW5nID0gTEFOR19TVFJJTkdTW2xhbmdJbmRdOwotICAgICAgICBpZiAobGFuZyA9PSAiIikgewotICAgICAgICAgICAgcmV0dXJuIG51bGw7Ci0gICAgICAgIH0KLSAgICAgICAgcmV0dXJuIGxhbmc7CiAgICAgfQogCiAgICAgLyoqCi0gICAgICogR2l2ZW4gYSBHU00gTW9iaWxlIENvdW50cnkgQ29kZSwgcmV0dXJucyB0aGUgY29ycmVzcG9uZGluZwotICAgICAqIHNtYWxsZXN0IG51bWJlciBvZiBkaWdpdHMgZmllbGQuICBSZXR1cm5zIDIgaWYgdW5hdmFpbGFibGUuCisgICAgICogR2l2ZW4gYSBHU00gTW9iaWxlIENvdW50cnkgQ29kZSwgcmV0dXJucworICAgICAqIHRoZSBzbWFsbGVzdCBudW1iZXIgb2YgZGlnaXRzIHRoYXQgTSBpZiBhdmFpbGFibGUuCisgICAgICogUmV0dXJucyAyIGlmIHVuYXZhaWxhYmxlLgogICAgICAqLwotICAgIHB1YmxpYyBzdGF0aWMgaW50IHNtYWxsZXN0RGlnaXRzTWNjRm9yTW5jKGludCBtY2MpIHsKLSAgICAgICAgaW50IGluZGV4ID0gQXJyYXlzLmJpbmFyeVNlYXJjaChNQ0NfQ09ERVMsIChzaG9ydCltY2MpOwotICAgICAgICBpZiAoaW5kZXggPCAwKSB7CisgICAgcHVibGljIHN0YXRpYyBpbnQKKyAgICBzbWFsbGVzdERpZ2l0c01jY0Zvck1uYyhpbnQgbWNjKQorICAgIHsKKyAgICAgICAgTWNjRW50cnkgZW50cnk7CisKKyAgICAgICAgZW50cnkgPSBlbnRyeUZvck1jYyhtY2MpOworCisgICAgICAgIGlmIChlbnRyeSA9PSBudWxsKSB7CiAgICAgICAgICAgICByZXR1cm4gMjsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIHJldHVybiBlbnRyeS5zbWFsbGVzdERpZ2l0c01uYzsKICAgICAgICAgfQotICAgICAgICBpbnQgaW5kQ29kZSA9IElORF9DT0RFU1tpbmRleF07Ci0gICAgICAgIGludCBzbURpZyA9IChpbmRDb2RlID4+PiA5KSAmIDB4MDAwMzsKLSAgICAgICAgcmV0dXJuIHNtRGlnOwogICAgIH0KIAogICAgIC8qKgogICAgICAqIEdpdmVuIGEgR1NNIE1vYmlsZSBDb3VudHJ5IENvZGUsIHJldHVybnMgdGhlIG51bWJlciBvZiB3aWZpCiAgICAgICogY2hhbm5lbHMgYWxsb3dlZCBpbiB0aGF0IGNvdW50cnkuICBSZXR1cm5zIDAgaWYgdW5hdmFpbGFibGUuCiAgICAgICovCi0gICAgcHVibGljIHN0YXRpYyBpbnQgd2lmaUNoYW5uZWxzRm9yTWNjKGludCBtY2MpIHsKLSAgICAgICAgaW50IGluZGV4ID0gQXJyYXlzLmJpbmFyeVNlYXJjaChNQ0NfQ09ERVMsIChzaG9ydCltY2MpOwotICAgICAgICBpZiAoaW5kZXggPCAwKSB7CisgICAgcHVibGljIHN0YXRpYyBpbnQKKyAgICB3aWZpQ2hhbm5lbHNGb3JNY2MoaW50IG1jYykgeworICAgICAgICBNY2NFbnRyeSBlbnRyeTsKKworICAgICAgICBlbnRyeSA9IGVudHJ5Rm9yTWNjKG1jYyk7CisKKyAgICAgICAgaWYgKGVudHJ5ID09IG51bGwpIHsKICAgICAgICAgICAgIHJldHVybiAwOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgcmV0dXJuIGVudHJ5LndpZmlDaGFubmVsczsKICAgICAgICAgfQotICAgICAgICBpbnQgaW5kQ29kZSA9IElORF9DT0RFU1tpbmRleF07Ci0gICAgICAgIGludCB3aWZpID0gKGluZENvZGUgPj4+IDExKSAmIDB4MDAwRjsKLSAgICAgICAgcmV0dXJuIHdpZmk7CiAgICAgfQogCiAgICAgLyoqCkBAIC02NTYsNCArMjc2LDI2MiBAQAogICAgICAgICAgICAgd00uc2V0TnVtQWxsb3dlZENoYW5uZWxzKHdpZmlDaGFubmVscywgdHJ1ZSk7CiAgICAgICAgIH0KICAgICB9CisKKyAgICBzdGF0aWMgeworICAgICAgICB0YWJsZSA9IG5ldyBBcnJheUxpc3Q8TWNjRW50cnk+KDI0MCk7CisKKworICAgICAgICAvKgorICAgICAgICAgKiBUaGUgdGFibGUgYmVsb3cgaXMgYnVpbHQgZnJvbSB0d28gcmVzb3VyY2VzOgorICAgICAgICAgKgorICAgICAgICAgKiAxKSBJVFUgIk1vYmlsZSBOZXR3b3JrIENvZGUgKE1OQykgZm9yIHRoZSBpbnRlcm5hdGlvbmFsCisgICAgICAgICAqICAgaWRlbnRpZmljYXRpb24gcGxhbiBmb3IgbW9iaWxlIHRlcm1pbmFscyBhbmQgbW9iaWxlIHVzZXJzIgorICAgICAgICAgKiAgIHdoaWNoIGlzIGF2YWlsYWJsZSBhcyBhbiBhbm5leCB0byB0aGUgSVRVIG9wZXJhdGlvbmFsIGJ1bGxldGluCisgICAgICAgICAqICAgYXZhaWxhYmxlIGhlcmU6IGh0dHA6Ly93d3cuaXR1LmludC9pdHUtdC9idWxsZXRpbi9hbm5leC5odG1sCisgICAgICAgICAqCisgICAgICAgICAqIDIpIFRoZSBJU08gMzE2NiBjb3VudHJ5IGNvZGVzIGxpc3QsIGF2YWlsYWJsZSBoZXJlOgorICAgICAgICAgKiAgICBodHRwOi8vd3d3Lmlzby5vcmcvaXNvL2VuL3Byb2RzLXNlcnZpY2VzL2lzbzMxNjZtYS8wMmlzby0zMTY2LWNvZGUtbGlzdHMvaW5kZXguaHRtbAorICAgICAgICAgKgorICAgICAgICAgKiBUaGlzIHRhYmxlIGhhcyBub3QgYmVlbiB2ZXJpZmllZC4KKyAgICAgICAgICoKKyAgICAgICAgICovCisKKwkJdG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VEKTsKICAgICAgICAgICAgICAgICB9IGNhdGNoIChDYW5jZWxlZEV4Y2VwdGlvbiBleCkgewogICAgICAgICAgICAgICAgICAgICBMb2cuZShUQUcsICJmYWlsZWQgdG8gc2VuZCBiYWNrIFJFU1VMVF9FUlJPUl9MSU1JVF9FWENFRURFRCIpOwpAQCAtMzU4LDcgKzM1OSw3IEBACiAKICAgICAgICAgY2FzZSBFVkVOVF9TRU5EX0NPTkZJUk1FRF9TTVM6CiAgICAgICAgICAgICBpZiAobVNUcmFja2Vycy5pc0VtcHR5KCkgPT0gZmFsc2UpIHsKLSAgICAgICAgICAgICAgICBTbXNUcmFja2VyIHNUcmFja2VyID0gKFNtc1RyYWNrZXIpbVNUcmFja2Vycy5yZW1vdmUobVNUcmFja2Vycy5zaXplKCkgLSAxKTsKKyAgICAgICAgICAgICAgICBTbXNUcmFja2VyIHNUcmFja2VyID0gbVNUcmFja2Vycy5yZW1vdmUobVNUcmFja2Vycy5zaXplKCkgLSAxKTsKICAgICAgICAgICAgICAgICBpZiAoaXNNdWx0aXBhcnRUcmFja2VyKHNUcmFja2VyKSkgewogICAgICAgICAgICAgICAgICAgICBzZW5kTXVsdGlwYXJ0U21zKHNUcmFja2VyKTsKICAgICAgICAgICAgICAgICB9IGVsc2UgewpAQCAtMzcyLDcgKzM3Myw3IEBACiAgICAgICAgICAgICBpZiAobVNUcmFja2Vycy5pc0VtcHR5KCkgPT0gZmFsc2UpIHsKICAgICAgICAgICAgICAgICAvLyBSZW1vdmUgdGhlIGxhdGVzdCBvbmUuCiAgICAgICAgICAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgICAgICAgICAgU21zVHJhY2tlciBzVHJhY2tlciA9IChTbXNUcmFja2VyKW1TVHJhY2tlcnMucmVtb3ZlKG1TVHJhY2tlcnMuc2l6ZSgpIC0gMSk7CisgICAgICAgICAgICAgICAgICAgIFNtc1RyYWNrZXIgc1RyYWNrZXIgPSBtU1RyYWNrZXJzLnJlbW92ZShtU1RyYWNr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IG9uZS4KICAgICAgICAgVGVsZXBob255TWFuYWdlciB0ZWxlcGhvbnkgPSBUZWxlcGhvbnlNYW5hZ2VyLmdldERlZmF1bHQoKTsKKyAgICAgICAgTmV0d29ya1Byb3BlcnRpZXMgbmV0d29ya1Byb3BlcnRpZXMgPSBudWxsOworICAgICAgICBpZiAoc3RhdGUgPT0gUGhvbmUuRGF0YVN0YXRlLkNPTk5FQ1RFRCkgeworICAgICAgICAgICAgbmV0d29ya1Byb3BlcnRpZXMgPSBzZW5kZXIuZ2V0TmV0d29ya1Byb3BlcnRpZXMoYXBuVHlwZSk7CisgICAgICAgIH0KICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgIG1SZWdpc3RyeS5ub3RpZnlEYXRhQ29ubmVjdGlvbigKLSAgICAgICAgICAgICAgICAgICAgY29udmVydERhdGFTdGF0ZShzZW5kZXIuZ2V0RGF0YUNvbm5lY3Rpb25TdGF0ZSgpKSwKKyAgICAgICAgICAgICAgICAgICAgY29udmVydERhdGFTdGF0ZShzdGF0ZSksCiAgICAgICAgICAgICAgICAgICAgIHNlbmRlci5pc0RhdGFDb25uZWN0aXZpdHlQb3NzaWJsZSgpLCByZWFzb24sCiAgICAgICAgICAgICAgICAgICAgIHNlbmRlci5nZXRBY3RpdmVBcG4oKSwKLSAgICAgICAgICAgICAgICAgICAgc2VuZGVyLmdldEFjdGl2ZUFwblR5cGVzKCksCi0gICAgICAgICAgICAgICAgICAgIHNlbmRlci5nZXRJbnRlcmZhY2VOYW1lKG51bGwpLAorICAgICAgICAgICAgICAgICAgICBhcG5UeXBlLAorICAgICAgICAgICAgICAgICAgICBuZXR3b3JrUHJvcGVydGllcywKICAgICAgICAgICAgICAgICAgICAgKCh0ZWxlcGhvbnkhPW51bGwpID8gdGVsZXBob255LmdldE5ldHdvcmtUeXBlKCkgOgogICAgICAgICAgICAgICAgICAgICBUZWxlcGhvbnlNYW5hZ2VyLk5FVFdPUktfVFlQRV9VTktOT1dOKSk7CiAgICAgICAgIH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Tl9TRVJWSUNFKSByZWFzb24gKz0gIiAtIHBzU3RhdGU9ICIgKyBwc1N0YXRlOworICAgICAgICAgICAgaWYgKHBob25lLm1DTS5nZXRSYWRpb1N0YXRlKCkgIT0gQ29tbWFuZHNJbnRlcmZhY2UuUmFkaW9TdGF0ZS5OVl9SRUFEWSAmJgorICAgICAgICAgICAgICAgICAgICAhbUNkbWFQaG9uZS5tUnVpbVJlY29yZHMuZ2V0UmVjb3Jkc0xvYWRlZCgpKSB7CisgICAgICAgICAgICAgICAgcmVhc29uICs9ICIgLSByYWRpb1N0YXRlPSAiICsgcGhvbmUubUNNLmdldFJhZGlvU3RhdGUoKSArICIgLSBSVUlNIG5vdCBsb2FkZWQiOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKHBob25lLmdldFN0YXRlKCkgIT0gUGhvbmUuU3RhdGUuSURMRSAmJgorICAgICAgICAgICAgICAgICAgICBtQ2RtYVBob25lLm1TU1QuaXNDb25jdXJyZW50Vm9pY2VBbmREYXRhKCkpIHsKKyAgICAgICAgICAgICAgICByZWFzb24gKz0gIiAtIGNvbmN1cnJlbnRWb2ljZUFuZERhdGEgbm90IGFsbG93ZWQgYW5kIHN0YXRlPSAiICsgcGhvbmUuZ2V0U3RhdGUoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmIChyb2FtaW5nKSByZWFzb24gKz0gIiAtIFJvYW1pbmciOworICAgICAgICAgICAgaWYgKCFtTWFzdGVyRGF0YUVuYWJsZWQpIHJlYXNvbiArPSAiIC0gbU1hc3RlckRhdGFFbmFibGVkPSBmYWxzZSI7CisgICAgICAgICAgICBpZiAoIWRlc2lyZWRQb3dlclN0YXRlKSByZWFzb24gKz0gIiAtIGRlc2lyZWRQb3dlclN0YXRlPSBmYWxzZSI7CisgICAgICAgICAgICBpZiAobVBlbmRpbmdSZXN0YXJ0UmFkaW8pIHJlYXNvbiArPSAiIC0gbVBlbmRpbmdSZXN0YXJ0UmFkaW89IHRydWUiOworICAgICAgICAgICAgaWYgKG1DZG1hUGhvbmUubmVlZHNPdGFTZXJ2aWNlUHJvdmlzaW9uaW5nKCkpIHJlYXNvbiArPSAiIC0gbmVlZHMgUHJvdmlzaW9uaW5nIjsKKyAgICAgICAgICAgIGxvZygiRGF0YSBub3QgYWxsb3dlZCBkdWUgdG8iICsgcmVhc29uKTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gYWxsb3dlZDsKICAgICB9CiAKICAgICBwcml2YXRlIGJvb2xlYW4gdHJ5U2V0dXBEYXRhKFN0cmluZyByZWFzb24pIHsKQEAgLTMxNyw3ICszNDksOCBAQAogICAgICAgICAgICAgLy8gQXNzdW1lIGRhdGEgaXMgY29ubmVjdGVkIG9uIHRoZSBzaW11bGF0b3IKICAgICAgICAgICAgIC8vIEZJWE1FICB0aGlzIGNhbiBiZSBpbXByb3ZlZAogICAgICAgICAgICAgc2V0U3RhdGUoU3RhdGUuQ09OTkVDVEVEKTsKLSAgICAgICAgICAgIHBob25lLm5vdGlmeURhdGFDb25uZWN0aW9uKHJlYXNvbik7CisgICAgICAgICAgICBub3RpZnlEYXRhQ29ubmVjdGlvbihyZWFzb24pOworICAgICAgICAgICAgbm90aWZ5T2ZmQXBuc09mQXZhaWxhYmlsaXR5KHJlYXNvbiwgdHJ1ZSk7CiAKICAgICAgICAgICAgIExvZy5pKExPR19UQUcsICIoZml4PykgV2UncmUgb24gdGhlIHNpbXVsYXRvcjsgYXNzdW1pbmcgZGF0YSBpcyBjb25uZWN0ZWQiKTsKICAgICAgICAgICAgIHJldHVybiB0cnVlOwpAQCAtMzI3LDM2ICszNjAsMTMgQEAKICAgICAgICAgYm9vbGVhbiByb2FtaW5nID0gcGhvbmUuZ2V0U2VydmljZVN0YXRlKCkuZ2V0Um9hbWluZygpOwogICAgICAgICBib29sZWFuIGRlc2lyZWRQb3dlclN0YXRlID0gbUNkbWFQaG9uZS5tU1NULmdldERlc2lyZWRQb3dlclN0YXRlKCk7CiAKLSAgICAgICAgaWYgKChzdGF0ZSA9PSBTdGF0ZS5JRExFIHx8IHN0YXRlID09IFN0YXRlLlNDQU5OSU5HKQotICAgICAgICAgICAgICAgICYmIChwc1N0YXRlID09IFNlcnZpY2VTdGF0ZS5TVEFURV9JTl9TRVJWSUNFKQotICAgICAgICAgICAgICAgICYmICgocGhvbmUubUNNLmdldFJhZGlvU3RhdGUoKSA9PSBDb21tYW5kc0ludGVyZmFjZS5SYWRpb1N0YXRlLk5WX1JFQURZKSB8fAotICAgICAgICAgICAgICAgICAgICAgICAgbUNkbWFQaG9uZS5tUnVpbVJlY29yZHMuZ2V0UmVjb3Jkc0xvYWRlZCgpKQotICAgICAgICAgICAgICAgICYmIChtQ2RtYVBob25lLm1TU1QuaXNDb25jdXJyZW50Vm9pY2VBbmREYXRhKCkgfHwKLSAgICAgICAgICAgICAgICAgICAgICAgIHBob25lLmdldFN0YXRlKCkgPT0gUGhvbmUuU3RhdGUuSURMRSApCi0gICAgICAgICAgICAgICAgJiYgaXNEYXRhQWxsb3dlZCgpCi0gICAgICAgICAgICAgICAgJiYgZGVzaXJlZFBvd2VyU3RhdGUKLSAgICAgICAgICAgICAgICAmJiAhbVBlbmRpbmdSZXN0YXJ0UmFkaW8KLSAgICAgICAgICAgICAgICAmJiAhbUNkbWFQaG9uZS5uZWVkc090YVNlcnZpY2VQcm92aXNpb25pbmcoKSkgewotCi0gICAgICAgICAgICByZXR1cm4gc2V0dXBEYXRhKHJlYXNvbik7Ci0KKyAgICAgICAgaWYgKChzdGF0ZSA9PSBTdGF0ZS5JRExFIHx8IHN0YXRlID09IFN0YXRlLlNDQU5OSU5HKSAmJgorICAgICAgICAgICAgICAgIGlzRGF0YUFsbG93ZWQoKSAmJiBnZXRBbnlEYXRhRW5hYmxlZCgpKSB7CisgICAgICAgICAgICBib29sZWFuIHJldFZhbHVlID0gc2V0dXBEYXRhKHJlYXNvbik7CisgICAgICAgICAgICBub3RpZnlPZmZBcG5zT2ZBdmFpbGFiaWxpdHkocmVhc29uLCByZXRWYWx1ZSk7CisgICAgICAgICAgICByZXR1cm4gcmV0VmFsdWU7CiAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICBpZiAoREJHKSB7Ci0gICAgICAgICAgICAgICAgICAgIGxvZygidHJ5U2V0dXBEYXRhOiBOb3QgcmVhZHkgZm9yIGRhdGE6ICIgKwotICAgICAgICAgICAgICAgICAgICAiIGRhdGFTdGF0ZT0iICsgc3RhdGUgKwotICAgICAgICAgICAgICAgICAgICAiIFBTIHN0YXRlPSIgKyBwc1N0YXRlICsKLSAgICAgICAgICAgICAgICAgICAgIiByYWRpbyBzdGF0ZT0iICsgcGhvbmUubUNNLmdldFJhZGlvU3RhdGUoKSArCi0gICAgICAgICAgICAgICAgICAgICIgcnVpbT0iICsgbUNkbWFQaG9uZS5tUnVpbVJlY29yZHMuZ2V0UmVjb3Jkc0xvYWRlZCgpICsKLSAgICAgICAgICAgICAgICAgICAgIiBjb25jdXJyZW50Vm9pY2UmRGF0YT0iICsgbUNkbWFQaG9uZS5tU1NULmlzQ29uY3VycmVudFZvaWNlQW5kRGF0YSgpICsKLSAgICAgICAgICAgICAgICAgICAgIiBwaG9uZVN0YXRlPSIgKyBwaG9uZS5nZXRTdGF0ZSgpICsKLSAgICAgICAgICAgICAgICAgICAgIiBkYXRhRW5hYmxlZD0iICsgZ2V0QW55RGF0YUVuYWJsZWQoKSArCi0gICAgICAgICAgICAgICAgICAgICIgcm9hbWluZz0iICsgcm9hbWluZyArCi0gICAgICAgICAgICAgICAgICAgICIgZGF0YU9uUm9hbWluZ0VuYWJsZT0iICsgZ2V0RGF0YU9uUm9hbWluZ0VuYWJsZWQoKSArCi0gICAgICAgICAgICAgICAgICAgICIgZGVzaXJlZFBvd2VyU3RhdGU9IiArIGRlc2lyZWRQb3dlclN0YXRlICsKLSAgICAgICAgICAgICAgICAgICAgIiBQZW5kaW5nUmVzdGFydFJhZGlvPSIgKyBtUGVuZGluZ1Jlc3RhcnRSYWRpbyArCi0gICAgICAgICAgICAgICAgICAgICIgTWFzdGVyRGF0YUVuYWJsZWQ9IiArIG1NYXN0ZXJEYXRhRW5hYmxlZCArCi0gICAgICAgICAgICAgICAgICAgICIgbmVlZHNPdGFTZXJ2aWNlUHJvdmlzaW9uaW5nPSIgKyBtQ2RtYVBob25lLm5lZWRzT3RhU2VydmljZVByb3Zpc2lvbmluZygpKTsKLSAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG5vdGlmeU9mZkFwbnNPZkF2YWlsYWJpbGl0eShyZWFzb24sIGZhbHNlKTsKICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICAgfQogICAgIH0KQEAgLTM4Miw2ICszOTIsNyBAQAogICAgICAgICB9CiAKICAgICAgICAgc2V0U3RhdGUoU3RhdGUuRElTQ09OTkVDVElORyk7CisgICAgICAgIG5vdGlmeURhdGFBdmFpbGFiaWxpdHkocmVhc29uKTsKIAogICAgICAgICBib29sZWFuIG5vdGlmaWNhdGlvbkRlZmVycmVkID0gZmFsc2U7CiAgICAgICAgIGZvciAoRGF0YUNvbm5lY3Rpb24gY29ubiA6IGRhdGFDb25uZWN0aW9uTGlzdCkgewpAQCAtNDQwLDEzICs0NTEsMTMgQEAKICAgICAgICAgY29ubi5jb25uZWN0KG1zZywgbUFjdGl2ZUFwbik7CiAKICAgICAgICAgc2V0U3RhdGUoU3RhdGUuSU5JVElORyk7Ci0gICAgICAgIHBob25lLm5vdGlmeURhdGFDb25uZWN0aW9uKHJlYXNvbik7CisgICAgICAgIG5vdGlmeURhdGFDb25uZWN0aW9uKHJlYXNvbik7CiAgICAgICAgIHJldHVybiB0cnVlOwogICAgIH0KIAogICAgIHByaXZhdGUgdm9pZCBub3RpZnlEZWZhdWx0RGF0YShTdHJpbmcgcmVhc29uKSB7CiAgICAgICAgIHNldFN0YXRlKFN0YXRlLkNPTk5FQ1RFRCk7Ci0gICAgICAgIHBob25lLm5vdGlmeURhdGFDb25uZWN0aW9uKHJlYXNvbik7CisgICAgICAgIG5vdGlmeURhdGFDb25uZWN0aW9uKHJlYXNvbik7CiAgICAgICAgIHN0YXJ0TmV0U3RhdFBvbGwoKTsKICAgICAgICAgbVJldHJ5TWdyLnJlc2V0UmV0cnlDb3VudCgpOwogICAgIH0KQEAgLTYyMiwxMiArNjMzLDEzIEBACiAKICAgICBwcml2YXRlIHZvaWQgbm90aWZ5Tm9EYXRhKEZhaWxDYXVzZSBsYXN0RmFpbENhdXNlQ29kZSkgewogICAgICAgICBzZXRTdGF0ZShTdGF0ZS5GQUlMRUQpOworICAgICAgICBub3RpZnlEYXRhQXZhaWxhYmlsaXR5KG51bGwpOwogICAgIH0KIAogICAgIHByaXZhdGUgdm9pZCBnb3RvSWRsZUFuZE5vdGlmeURhdGFDb25uZWN0aW9uKFN0cmluZyByZWFzb24pIHsKICAgICAgICAgaWYgKERCRykgbG9nKCJnb3RvSWRsZUFuZE5vdGlmeURhdGFDb25uZWN0aW9uOiByZWFzb249IiArIHJlYXNvbik7CiAgICAgICAgIHNldFN0YXRlKFN0YXRlLklETEUpOwotICAgICAgICBwaG9uZS5ub3RpZnlEYXRhQ29ubmVjdGlvbihyZWFzb24pOworICAgICAgICBub3RpZnlEYXRhQ29ubmVjdGlvbihyZWFzb24pOwogICAgICAgICBtQWN0aXZlQXBuID0gbnVsbDsKICAgICB9CiAKQEAgLTY4NywxMSArNjk5LDEzIEBACiAgICAgICAgICAgICAvLyBBc3N1bWUgZGF0YSBpcyBjb25uZWN0ZWQgb24gdGhlIHNpbXVsYXRvcgogICAgICAgICAgICAgLy8gRklYTUUgIHRoaXMgY2FuIGJlIGltcHJvdmVkCiAgICAgICAgICAgICBzZXRTdGF0ZShTdGF0ZS5DT05ORUNURUQpOwotICAgICAgICAgICAgcGhvbmUubm90aWZ5RGF0YUNvbm5lY3Rpb24obnVsbCk7CisgICAgICAgICAgICBub3RpZnlEYXRhQ29ubmVjdGlvbihudWxsKTsKIAogICAgICAgICAgICAgTG9nLmkoTE9HX1RBRywgIldlJ3JlIG9uIHRoZSBzaW11bGF0b3I7IGFzc3VtaW5nIGRhdGEgaXMgY29ubmVjdGVkIik7CiAgICAgICAgIH0KIAorICAgICAgICBub3RpZnlEYXRhQXZhaWxhYmlsaXR5KG51bGwpOworCiAgICAgICAgIGlmIChzdGF0ZSAhPSBTdGF0ZS5JRExFKSB7CiAgICAgICAgICAgICBjbGVhblVwQ29ubmVjdGlvbih0cnVlLCBudWxsKTsKICAgICAgICAgfQpAQCAtNzIzLDYgKzczNyw4IEBACiAgICAgICAgIH0KIAogICAgICAgICBpZiAoYXIuZXhjZXB0aW9uID09IG51bGwpIHsKKyAgICAgICAgICAgIG1OZXR3b3JrUHJvcGVydGllcyA9IG1ha2VOZXR3b3JrUHJvcGVydGllcyhtQWN0aXZlRGF0YUNvbm5lY3Rpb24pOworCiAgICAgICAgICAgICAvLyBldmVyeXRoaW5nIGlzIHNldHVwCiAgICAgICAgICAgICBub3RpZnlEZWZhdWx0RGF0YShyZWFzb24pOwogICAgICAgICB9IGVsc2UgewpAQCAtNzYyLDcgKzc3OCw3IEBACiAgICAgICAgICAgICBvblJlc3RhcnRSYWRpbygpOwogICAgICAgICB9CiAKLSAgICAgICAgcGhvbmUubm90aWZ5RGF0YUNvbm5lY3Rpb24ocmVhc29uKTsKKyAgICAgICAgbm90aWZ5RGF0YUNvbm5lY3Rpb24ocmVhc29uKTsKICAgICAgICAgbUFjdGl2ZUFwbiA9IG51bGw7CiAgICAgICAgIGlmIChyZXRyeUFmdGVyRGlzY29ubmVjdGVkKHJlYXNvbikpIHsKICAgICAgICAgICB0cnlTZXR1cERhdGEocmVhc29uKTsKQEAgLTc4OSw3ICs4MDUsOCBAQAogICAgIHByb3RlY3RlZCB2b2lkIG9uVm9pY2VDYWxsU3RhcnRlZCgpIHsKICAgICAgICAgaWYgKHN0YXRlID09IFN0YXRlLkNPTk5FQ1RFRCAmJiAhbUNkbWFQaG9uZS5tU1NULmlzQ29uY3VycmVudFZvaWNlQW5kRGF0YSgpKSB7CiAgICAgICAgICAgICBzdG9wTmV0U3RhdFBvbGwoKTsKLSAgICAgICAgICAgIHBob25lLm5vdGlmeURhdGFDb25uZWN0aW9uKFBob25lLlJFQVNPTl9WT0lDRV9DQUxMX1NUQVJURUQpOworICAgICAgICAgICAgbm90aWZ5RGF0YUNvbm5lY3Rpb24oUGhvbmUuUkVBU09OX1ZPSUNFX0NBTExfU1RBUlRFRCk7CisgICAgICAgICAgICBub3RpZnlEYXRhQXZhaWxhYmlsaXR5KFBob25lLlJFQVNPTl9WT0lDRV9DQUxMX1NUQVJURUQpOwogICAgICAgICB9CiAgICAgfQogCkBAIC04MDAsMTEgKzgxNywxMiBAQAogICAgICAgICBpZiAoc3RhdGUgPT0gU3RhdGUuQ09OTkVDVEVEKSB7CiAgICAgICAgICAgICBpZiAoIW1DZG1hUGhvbmUubVNTVC5pc0NvbmN1cnJlbnRWb2ljZUFuZERhdGEoKSkgewogICAgICAgICAgICAgICAgIHN0YXJ0TmV0U3RhdFBvbGwoKTsKLSAgICAgICAgICAgICAgICBwaG9uZS5ub3RpZnlEYXRhQ29ubmVjdGlvbihQaG9uZS5SRUFTT05fVk9JQ0VfQ0FMTF9FTkRFRCk7CisgICAgICAgICAgICAgICAgbm90aWZ5RGF0YUNvbm5lY3Rpb24oUGhvbmUuUkVBU09OX1ZPSUNFX0NBTExfRU5ERUQpOwogICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAvLyBjbGVhbiBzbGF0ZSBhZnRlciBjYWxsIGVuZC4KICAgICAgICAgICAgICAgICByZXNldFBvbGxTdGF0cygpOwogICAgICAgICAgICAgfQorICAgICAgICAgICAgbm90aWZ5RGF0YUF2YWlsYWJpbGl0eShQaG9uZS5SRUFTT05fVk9JQ0VfQ0FMTF9FTkRFRCk7CiAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICBtUmV0cnlNZ3IucmVzZXRSZXRyeUNvdW50KCk7CiAgICAgICAgICAgICAvLyBpbiBjYXNlIGRhdGE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gICAgICAgICAgICAgICAgIHN5bmNocm9uaXplZCAobUxvY2spIHsKICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhci5leGNlcHRpb24gPT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1TbXMgID0gKExpc3Q8U21zUmF3RGF0YT4pCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWlsZFZhbGlkUmF3RGF0YSgoQXJyYXlMaXN0PGJ5dGVbXT4pIGFyLnJlc3VsdCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVNtcyA9IGJ1aWxkVmFsaWRSYXdEYXRhKChBcnJheUxpc3Q8Ynl0ZVtdPikgYXIucmVzdWx0KTsKICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYoREJHKSBsb2coIkNhbm5vdCBsb2FkIFNtcyByZWNvcmRzIik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1TbXMgIT0gbnVsbCkKZGlmZiAtLWdpdCBhL3RlbGVwaG9ueS9qYXZhL2NvbS9hbmRyb2lkL2ludGVybmFsL3RlbGVwaG9ueS9jZG1hL1Ntc01lc3NhZ2UuamF2YSBiL3RlbGVwaG9ueS9qYXZhL2NvbS9hbmRyb2lkL2ludGVybmFsL3RlbGVwaG9ueS9jZG1hL1Ntc01lc3NhZ2UuamF2YQppbmRleCAwZjNiOGZmLi5lOTViMmY5IDEwMDc1NQotLS0gYS90ZWxlcGhvbnkvamF2YS9jb20vYW5kcm9pZC9pbnRlcm5hbC90ZWxlcGhvbnkvY2RtYS9TbXNNZXNzYWdlLmphdmEKKysrIGIvdGVsZXBob255L2phdmEvY29tL2FuZHJvaWQvaW50ZXJuYWwvdGVsZXBob255L2NkbWEvU21zTWVzc2FnZS5qYXZhCkBAIC0xOCwxMSArMTgsOCBAQAogCiBpbXBvcnQgYW5kcm9pZC5vcy5QYXJjZWw7CiBpbXBv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bmRyb2lkLmludGVybmFsLnV0aWwuQml0d2lzZU91dHB1dFN0cmVhbTsKIApAQCAtNDUsMTMgKzQyLDEzIEBACiAgICAgcHJpdmF0ZSBmaW5hbCBzdGF0aWMgU3RyaW5nIExPR19UQUcgPSAiU01TIjsKIAogICAgIC8qKgotICAgICAqIEJlYXJlciBEYXRhIFN1YnBhcmFtZXRlciBJbmRlbnRpZmllcnMKKyAgICAgKiBCZWFyZXIgRGF0YSBTdWJwYXJhbWV0ZXIgSWRlbnRpZmllcnMKICAgICAgKiAoU2VlIDNHUFAyIEMuUzAwMTUtQiwgdjIuMCwgdGFibGUgNC41LTEpCiAgICAgICogTk9URTogQ29tbWVudGVkIHN1YnBhcmFtZXRlciB0eXBlcyBhcmUgbm90IGltcGxlbWVudGVkLgogICAgICAqLwogICAgIHByaXZhdGUgZmluYWwgc3RhdGljIGJ5dGUgU1VCUEFSQU1fTUVTU0FHRV9JREVOVElGSUVSICAgICAgICAgICAgICAgPSAweDAwOwogICAgIHByaXZhdGUgZmluYWwgc3RhdGljIGJ5dGUgU1VCUEFSQU1fVVNFUl9EQVRBICAgICAgICAgICAgICAgICAgICAgICAgPSAweDAxOwotICAgIHByaXZhdGUgZmluYWwgc3RhdGljIGJ5dGUgU1VCUEFSQU1fVVNFUl9SRVBPTlNFX0NPREUgICAgICAgICAgICAgICAgPSAweDAyOworICAgIHByaXZhdGUgZmluYWwgc3RhdGljIGJ5dGUgU1VCUEFSQU1fVVNFUl9SRVNQT05TRV9DT0RFICAgICAgICAgICAgICAgPSAweDAyOwogICAgIHByaXZhdGUgZmluYWwgc3RhdGljIGJ5dGUgU1VCUEFSQU1fTUVTU0FHRV9DRU5URVJfVElNRV9TVEFNUCAgICAgICAgPSAweDAzOwogICAgIHByaXZhdGUgZmluYWwgc3RhdGljIGJ5dGUgU1VCUEFSQU1fVkFMSURJVFlfUEVSSU9EX0FCU09MVVRFICAgICAgICAgPSAweDA0OwogICAgIHByaXZhdGUgZmluYWwgc3RhdGlj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taW5nRW5hYmxlZCgpKSB7CisgICAgICAgICAgICAgICAgcmVhc29uICs9ICIgLSBSb2FtaW5nIjsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmIChtSXNQc1Jlc3RyaWN0ZWQpIHJlYXNvbiArPSAiIC0gbUlzUHNSZXN0cmljdGVkPSB0cnVlIjsKKyAgICAgICAgICAgIGlmICghZGVzaXJlZFBvd2VyU3RhdGUpIHJlYXNvbiArPSAiIC0gZGVzaXJlZFBvd2VyU3RhdGU9IGZhbHNlIjsKKyAgICAgICAgICAgIGxvZygiRGF0YSBub3QgYWxsb3dlZCBkdWUgdG8iICsgcmVhc29uKTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gYWxsb3dlZDsKKyAgICB9CisKICAgICBwcml2YXRlIGJvb2xlYW4gdHJ5U2V0dXBEYXRhKFN0cmluZyByZWFzb24pIHsKICAgICAgICAgaWYgKERCRykgbG9nKCIqKip0cnlTZXR1cERhdGEgZHVlIHRvICIgKyAocmVhc29uID09IG51bGwgPyAiKHVuc3BlY2lmaWVkKSIgOiByZWFzb24pKTsKIApAQCAtNDMwLDcgKzQ1OCw3IEBACiAgICAgICAgICAgICAvLyBBc3N1bWUgZGF0YSBpcyBjb25uZWN0ZWQgb24gdGhlIHNpbXVsYXRvcgogICAgICAgICAgICAgLy8gRklYTUUgIHRoaXMgY2FuIGJlIGltcHJvdmVkCiAgICAgICAgICAgICBzZXRTdGF0ZShTdGF0ZS5DT05ORUNURUQpOwotICAgICAgICAgICAgcGhvbmUubm90aWZ5RGF0YUNvbm5lY3Rpb24ocmVhc29uKTsKKyAgICAgICAgICAgIG5vdGlmeURhdGFDb25uZWN0aW9uKHJlYXNvbik7CiAKICAgICAgICAgICAgIExvZy5pKExPR19UQUcsICIoZml4PykgV2UncmUgb24gdGhlIHNpbXVsYXRvcjsgYXNzdW1pbmcgZGF0YSBpcyBjb25uZWN0ZWQiKTsKICAgICAgICAgICAgIHJldHVybiB0cnVlOwpAQCAtNDM5LDE5ICs0NjcsMTUgQEAKICAgICAgICAgaW50IGdwcnNTdGF0ZSA9IG1Hc21QaG9uZS5tU1NULmdldEN1cnJlbnRHcHJzU3RhdGUoKTsKICAgICAgICAgYm9vbGVhbiBkZXNpcmVkUG93ZXJTdGF0ZSA9IG1Hc21QaG9uZS5tU1NULmdldERlc2lyZWRQb3dlclN0YXRlKCk7CiAKLSAgICAgICAgaWYgKChzdGF0ZSA9PSBTdGF0ZS5JRExFIHx8IHN0YXRlID09IFN0YXRlLlNDQU5OSU5HKQotICAgICAgICAgICAgICAgICYmIChncHJzU3RhdGUgPT0gU2VydmljZVN0YXRlLlNUQVRFX0lOX1NFUlZJQ0UgfHwgbm9BdXRvQXR0YWNoKQotICAgICAgICAgICAgICAgICYmIG1Hc21QaG9uZS5tU0lNUmVjb3Jkcy5nZXRSZWNvcmRzTG9hZGVkKCkKLSAgICAgICAgICAgICAgICAmJiBwaG9uZS5nZXRTdGF0ZSgpID09IFBob25lLlN0YXRlLklETEUKLSAgICAgICAgICAgICAgICAmJiBpc0RhdGFBbGxvd2VkKCkKLSAgICAgICAgICAgICAgICAmJiAhbUlzUHNSZXN0cmljdGVkCi0gICAgICAgICAgICAgICAgJiYgZGVzaXJlZFBvd2VyU3RhdGUgKSB7CisgICAgICAgIGlmICgoKHN0YXRlID09IFN0YXRlLklETEUpIHx8IChzdGF0ZSA9PSBTdGF0ZS5TQ0FOTklORykpICYmCisgICAgICAgICAgICAgICAgaXNEYXRhQWxsb3dlZCgpICYmIGdldEFueURhdGFFbmFibGVkKCkpIHsKIAogICAgICAgICAgICAgaWYgKHN0YXRlID09IFN0YXRlLklETEUpIHsKICAgICAgICAgICAgICAgICB3YWl0aW5nQXBucyA9IGJ1aWxkV2FpdGluZ0FwbnMoKTsKICAgICAgICAgICAgICAgICBpZiAod2FpdGluZ0FwbnMuaXNFbXB0eSgpKSB7CiAgICAgICAgICAgICAgICAgICAgIGlmIChEQkcpIGxvZygiTm8gQVBOIGZvdW5kIik7CiAgICAgICAgICAgICAgICAgICAgIG5vdGlmeU5vRGF0YShHc21EYXRhQ29ubmVjdGlvbi5GYWlsQ2F1c2UuTUlTU0lOR19VTktOT1dOX0FQTik7CisgICAgICAgICAgICAgICAgICAgIG5vdGlmeU9mZkFwbnNPZkF2YWlsYWJpbGl0eShyZWFzb24sIGZhbHNlKTsKICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgIGxvZyAoIkNyZWF0ZSBmcm9tIGFsbEFwbnMgOiAiICsgYXBuTGlzdFRvU3RyaW5nKGFsbEFwbnMpKTsKQEAgLTQ2MSwyMiArNDg1LDExIEBACiAgICAgICAgICAgICBpZiAoREJHKSB7CiAgICAgICAgICAgICAgICAgbG9nICgiU2V0dXAgd2FpdG5nQXBucyA6ICIgKyBhcG5MaXN0VG9TdHJpbmcod2FpdGluZ0FwbnMpKTsKICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHJldHVybiBzZXR1cERhdGEocmVhc29uKTsKKyAgICAgICAgICAgIGJvb2xlYW4gcmV0VmFsdWUgPSBzZXR1cERhdGEocmVhc29uKTsKKyAgICAgICAgICAgIG5vdGlmeU9mZkFwbnNPZkF2YWlsYWJpbGl0eShyZWFzb24sIHJldFZhbHVlKTsKKyAgICAgICAgICAgIHJldHVybiByZXRWYWx1ZTsKICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgIGlmIChEQkcpCi0gICAgICAgICAgICAgICAgbG9nKCJ0cnlTZXR1cERhdGE6IE5vdCByZWFkeSBmb3IgZGF0YTogIiArCi0gICAgICAgICAgICAgICAgICAgICIgZGF0YVN0YXRlPSIgKyBzdGF0ZSArCi0gICAgICAgICAgICAgICAgICAgICIgZ3Byc1N0YXRlPSIgKyBncHJzU3RhdGUgKwotICAgICAgICAgICAgICAgICAgICAiIHNpbT0iICsgbUdzbVBob25lLm1TSU1SZWNvcmRzLmdldFJlY29yZHNMb2FkZWQoKSArCi0gICAgICAgICAgICAgICAgICAgICIgVU1UUz0iICsgbUdzbVBob25lLm1TU1QuaXNDb25jdXJyZW50Vm9pY2VBbmREYXRhKCkgKwotICAgICAgICAgICAgICAgICAgICAiIHBob25lU3RhdGU9IiArIHBob25lLmdldFN0YXRlKCkgKwotICAgICAgICAgICAgICAgICAgICAiIGlzRGF0YUFsbG93ZWQ9IiArIGlzRGF0YUFsbG93ZWQoKSArCi0gICAgICAgICAgICAgICAgICAgICIgZGF0YUVuYWJsZWQ9IiArIGdldEFueURhdGFFbmFibGVkKCkgKwotICAgICAgICAgICAgICAgICAgICAiIHJvYW1pbmc9IiArIHBob25lLmdldFNlcnZpY2VTdGF0ZSgpLmdldFJvYW1pbmcoKSArCi0gICAgICAgICAgICAgICAgICAgICIgZGF0YU9uUm9hbWluZ0VuYWJsZT0iICsgZ2V0RGF0YU9uUm9hbWluZ0VuYWJsZWQoKSArCi0gICAgICAgICAgICAgICAgICAgICIgcHMgcmVzdHJpY3RlZD0iICsgbUlzUHNSZXN0cmljdGVkICsKLSAgICAgICAgICAgICAgICAgICAgIiBkZXNpcmVkUG93ZXJTdGF0ZT0iICsgZGVzaXJlZFBvd2VyU3RhdGUgKwotICAgICAgICAgICAgICAgICAgICAiIE1hc3RlckRhdGFFbmFibGVkPSIgKyBtTWFzdGVyRGF0YUVuYWJsZWQpOworICAgICAgICAgICAgbm90aWZ5T2ZmQXBuc09mQXZhaWxhYmlsaXR5KHJlYXNvbiwgZmFsc2UpOwogICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICB9CiAgICAgfQpAQCAtNTk1LDcgKzYwOCw3IEBACiAgICAgICAgIHBkcC5jb25uZWN0KG1zZywgYXBuKTsKIAogICAgICAgICBzZXRTdGF0ZShTdGF0ZS5JTklUSU5HKTsKLSAgICAgICAgcGhvbmUubm90aWZ5RGF0YUNvbm5lY3Rpb24ocmVhc29uKTsKKyAgICAgICAgbm90aWZ5RGF0YUNvbm5lY3Rpb24ocmVhc29uKTsKICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgfQogCkBAIC03NDYsNyArNzU5LDcgQEAKIAogICAgIHByaXZhdGUgdm9pZCBub3RpZnlEZWZhdWx0RGF0YShTdHJpbmcgcmVhc29uKSB7CiAgICAgICAgIHNldFN0YXRlKFN0YXRlLkNPTk5FQ1RFRCk7Ci0gICAgICAgIHBob25lLm5vdGlmeURhdGFDb25uZWN0aW9uKHJlYXNvbik7CisgICAgICAgIG5vdGlmeURhdGFDb25uZWN0aW9uKHJlYXNvbik7CiAgICAgICAgIHN0YXJ0TmV0U3RhdFBvbGwoKTsKICAgICAgICAgLy8gcmVzZXQgcmVjb25uZWN0IHRpbWVyCiAgICAgICAgIG1SZXRyeU1nci5yZXNldFJldHJ5Q291bnQoKTsKQEAgLTc1Niw3ICs3NjksNyBAQAogICAgIHByaXZhdGUgdm9pZCBnb3RvSWRsZUFuZE5vdGlmeURhdGFDb25uZWN0aW9uKFN0cmluZyByZWFzb24pIHsKICAgICAgICAgaWYgKERCRykgbG9nKCJnb3RvSWRsZUFuZE5vdGlmeURhdGFDb25uZWN0aW9uOiByZWFzb249IiArIHJlYXNvbik7CiAgICAgICAgIHNldFN0YXRlKFN0YXRlLklETEUpOwotICAgICAgICBwaG9uZS5ub3RpZnlEYXRhQ29ubmVjdGlvbihyZWFzb24pOworICAgICAgICBub3RpZnlEYXRhQ29ubmVjdGlvbihyZWFzb24pOwogICAgICAgICBtQWN0aXZlQXBuID0gbnVsbDsKICAgICB9CiAKQEAgLTk5OCw3ICsxMDExLDcgQEAKICAgICAgICAgICAgIGlmICghbVJldHJ5TWdyLmlzUmV0cnlOZWVkZWQoKSkgewogICAgICAgICAgICAgICAgIGlmICghbVJlcXVlc3RlZEFwblR5cGUuZXF1YWxzKFBob25lLkFQTl9UWVBFX0RFRkFVTFQpKSB7CiAgICAgICAgICAgICAgICAgICAgIC8vIGlmIG5vIG1vcmUgcmV0cmllcyBvbiB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aXZlUGRwLmdldEFwbigpOworICAgICAgICAgICAgaWYgKGFwbi5wcm94eSAhPSBudWxsICYmIGFwbi5wcm94eS5sZW5ndGgoKSAhPSAwKSB7CisgICAgICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICAgICAgUHJveHlQcm9wZXJ0aWVzIHByb3h5ID0gbmV3IFByb3h5UHJvcGVydGllcygpOworICAgICAgICAgICAgICAgICAgICBwcm94eS5zZXRBZGRyZXNzKEluZXRBZGRyZXNzLmdldEJ5TmFtZShhcG4ucHJveHkpKTsKKyAgICAgICAgICAgICAgICAgICAgcHJveHkuc2V0UG9ydChJbnRlZ2VyLnBhcnNlSW50KGFwbi5wb3J0KSk7CisgICAgICAgICAgICAgICAgICAgIG1OZXR3b3JrUHJvcGVydGllcy5zZXRIdHRwUHJveHkocHJveHkpOworICAgICAgICAgICAgICAgIH0gY2F0Y2ggKFVua25vd25Ib3N0RXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICAgICAgTG9nLmUoTE9HX1RBRywgIlVua25vd25Ib3N0RXhjZXB0aW9uIG1ha2luZyBQcm94eVByb3BlcnRpZXM6ICIgKyBlKTsKKyAgICAgICAgICAgICAgICB9IGNhdGNoIChTZWN1cml0eUV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgICAgIExvZy5lKExPR19UQUcsICJTZWN1cml0eUV4Y2VwdGlvbiBtYWtpbmcgUHJveHlQcm9wZXJ0aWVzOiAiICsgZSk7CisgICAgICAgICAgICAgICAgfSBjYXRjaCAoTnVtYmVyRm9ybWF0RXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICAgICAgTG9nLmUoTE9HX1RBRywgIk51bWJlckZvcm1hdEV4Y2VwdGlvbiBtYWtpbmcgUHJveHlQcm9wZXJ0aWVzICgiICsgYXBuLnBvcnQgKworICAgICAgICAgICAgICAgICAgICAgICAgICAgICIpOiAiICsgZSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorCiAgICAgICAgICAgICAvLyBldmVyeXRoaW5nIGlzIHNldHVwCiAgICAgICAgICAgICBpZiAoaXNBcG5UeXBlQWN0aXZlKFBob25lLkFQTl9UWVBFX0RFRkFVTFQpKSB7CiAgICAgICAgICAgICAgICAgU3lzdGVtUHJvcGVydGllcy5zZXQoImdzbS5kZWZhdWx0cGRwY29udGV4dC5hY3RpdmUiLCAidHJ1ZSIpOwpAQCAtMTE1OCw3ICsxMTkwLDcgQEAKICAgICAgICAgICAgIGlmIChjYXVzZS5pc1Blcm1hbmVudEZhaWwoKSkgewogICAgICAgICAgICAgICAgIG5vdGlmeU5vRGF0YShjYXVzZSk7CiAgICAgICAgICAgICAgICAgaWYgKCFtUmVxdWVzdGVkQXBuVHlwZS5lcXVhbHMoUGhvbmUuQVBOX1RZUEVfREVGQVVMVCkpIHsKLSAgICAgICAgICAgICAgICAgICAgcGhvbmUubm90aWZ5RGF0YUNvbm5lY3Rpb24oUGhvbmUuUkVBU09OX0FQTl9GQUlMRUQpOworICAgICAgICAgICAgICAgICAgICBub3RpZnlEYXRhQ29ubmVjdGlvbihQaG9uZS5SRUFTT05fQVBOX0ZBSUxFRCk7CiAgICAgICAgICAgICAgICAgICAgIG9uRW5hYmxlQXBuKGFwblR5cGVUb0lkKG1SZXF1ZXN0ZWRBcG5UeXBlKSwgRElTQUJMRUQpOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICByZXR1cm47CkBAIC0xMTg4LDcgKzEyMjAsNyBAQAogICAgICAgICAgICByZWFzb24gPSAoU3RyaW5nKSBhci51c2VyT2JqOwogICAgICAgICB9CiAgICAgICAgIHNldFN0YXRlKFN0YXRlLklETEUpOwotICAgICAgICBwaG9uZS5ub3RpZnlEYXRhQ29ubmVjdGlvbihyZWFzb24pOworICAgICAgICBub3RpZnlEYXRhQ29ubmVjdGlvbihyZWFzb24pOwogICAgICAgICBtQWN0aXZlQXBuID0gbnVsbDsKICAgICAgICAgaWYgKHJldHJ5QWZ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5kaW5nSW50ZW50PiBzZW50SW50ZW50cywKICAgICAgICAgICAgIEFycmF5TGlzdDxQZW5kaW5nSW50ZW50PiBkZWxpdmVyeUludGVudHMpIHsKQEAgLTMwNyw4ICszMTIsOSBAQAogICAgIH0KIAogICAgIC8qKiB7QGluaGVyaXREb2N9ICovCisgICAgQE92ZXJyaWRlCiAgICAgcHJvdGVjdGVkIHZvaWQgc2VuZFNtcyhTbXNUcmFja2VyIHRyYWNrZXIpIHsKLSAgICAgICAgSGFzaE1hcCBtYXAgPSB0cmFja2VyLm1EYXRhOworICAgICAgICBIYXNoTWFwPFN0cmluZywgT2JqZWN0PiBtYXAgPSB0cmFja2VyLm1EYXRhOwogCiAgICAgICAgIGJ5dGUgc21zY1tdID0gKGJ5dGVbXSkgbWFwLmdldCgic21zYyIpOwogICAgICAgICBieXRlIHBkdVtdID0gKGJ5dGVbXSkgbWFwLmdldCgicGR1Iik7CkBAIC0zMjMsMTIgKzMyOSwxMyBAQAogICAgICAqCiAgICAgICogQHBhcmFtIHRyYWNrZXIgaG9sZHMgdGhlIG11bHRpcGFydCBTbXMgdHJhY2tlciByZWFkeSB0byBiZSBzZW50CiAgICAgICovCisgICAgQE92ZXJyaWRlCiAgICAgcHJvdGVjdGVkIHZvaWQgc2VuZE11bHRpcGFydFNtcyAoU21zVHJhY2tlciB0cmFja2VyKSB7CiAgICAgICAgIEFycmF5TGlzdDxTdHJpbmc+IHBhcnRzOwogICAgICAgICBBcnJheUxpc3Q8UGVuZGluZ0ludGVudD4gc2VudEludGVudHM7CiAgICAgICAgIEFycmF5TGlzdDxQZW5kaW5nSW50ZW50PiBkZWxpdmVyeUludGVudHM7CiAKLSAgICAgICAgSGFzaE1hcCBtYXAgPSB0cmFja2VyLm1EYXRhOworICAgICAgICBIYXNoTWFwPFN0cmluZywgT2JqZWN0PiBtYXAgPSB0cmFja2VyLm1EYXRhOwogCiAgICAgICAgIFN0cmluZyBkZXN0aW5hdGlvbkFkZHJlc3MgPSAoU3Rya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Gxlbmd0aCB0byBiZSB0aGUgcmVtYWluZGVyIG9mCiAgICAgICAgICAgICAgICAgICogdGhlIHBkdSBtaW51cyB0aGUgdXNlciBkYXRhIGhlYWRlciwgc2luY2UgdXNlckRhdGFMZW5ndGggbWVhbnMKLSAgICAgICAgICAgICAgICAgKiB0aGUgbnVtYmVyIG9mIHVuY29tcHJlc3NlZCBzZXBldHMuCisgICAgICAgICAgICAgICAgICogdGhlIG51bWJlciBvZiB1bmNvbXByZXNzZWQgc2VwdGV0cy4KICAgICAgICAgICAgICAgICAgKi8KICAgICAgICAgICAgICAgICBidWZmZXJMZW4gPSBwZHUubGVuZ3RoIC0gb2Zmc2V0OwogICAgICAgICAgICAgfSBlbHNlIHsKQEAgLTY3MSwxMCArNjY2LDEwIEBACiAgICAgICAgIH0KIAogICAgICAgICAvKioKLSAgICAgICAgICogUmV0dXJucyB0aGUgbnVtYmVyIG9mIHBhZGRpbmcgYml0cyBhdCB0aGUgYmVnaW5pbmcgb2YgdGhlIHVzZXIgZGF0YQorICAgICAgICAgKiBSZXR1cm5zIHRoZSBudW1iZXIgb2YgcGFkZGluZyBiaXRzIGF0IHRoZSBiZWdpbm5pbmcgb2YgdGhlIHVzZXIgZGF0YQogICAgICAgICAgKiBhcnJheSBiZWZvcmUgdGhlIHN0YXJ0IG9mIHRoZSBzZXB0ZXRzLgogICAgICAgICAgKgotICAgICAgICAgKiBAcmV0dXJuIHRoZSBudW1iZXIgb2YgcGFkZGluZyBiaXRzIGF0IHRoZSBiZWdpbmluZyBvZiB0aGUgdXNlciBkYXRhCisgICAgICAgICAqIEByZXR1cm4gdGhlIG51bWJlciBvZiBwYWRkaW5nIGJpdHMgYXQgdGhlIGJlZ2lubmluZyBvZiB0aGUgdXNlciBkYXRhCiAgICAgICAgICAqIGFycmF5IGJlZm9yZSB0aGUgc3RhcnQgb2YgdGhlIHNlcHRldHMKICAgICAgICAgICovCiAgICAgICAgIGludCBnZXRVc2VyRGF0YVNlcHRldFBhZGRpbmcoKSB7CkBAIC02OTQsNyArNjg5LDcgQEAKICAgICAgICAgWFhYIE5vdCBzdXJlIHdoYXQgdGhpcyBvbmUgaXMgc3VwcG9zZWQgdG8gYmUgZG9pbmcsIGFuZCBubyBvbmUgaXMgdXNpbmcKICAgICAgICAgaXQuCiAgICAgICAgIFN0cmluZyBnZXRVc2VyRGF0YUdTTThiaXQoKSB7Ci0gICAgICAgICAgICAvLyBTeXN0ZW0ub3V0LnByaW50bG4oInJlbWFpbmRlciBvZiBwdWQ6IiArCisgICAgICAgICAgICAvLyBTeXN0ZW0ub3V0LnByaW50bG4oInJlbWFpbmRlciBvZiBwZHU6IiArCiAgICAgICAgICAgICAvLyBIZXhEdW1wLmR1bXBIZXhTdHJpbmcocGR1LCBjdXIsIHBkdS5sZW5ndGggLSBjdXIpKTsKICAgICAgICAgICAgIGludCBjb3VudCA9IHBkdVtjdXIrK10gJiAweGZmOwogICAgICAgICAgICAgaW50IHNpemUgPSBwZHVbY3VyKytdOwpAQCAtODI3LDExICs4MjIsMTMgQEAKICAgICB9CiAKICAgICAvKioge0Bpbmhlcml0RG9jfSAqLworICAgIEBPdmVycmlkZQogICAgIHB1YmxpYyBpbnQgZ2V0UHJvdG9jb2xJZGVudGlmaWVyKCkgewogICAgICAgICByZXR1cm4gcHJvdG9jb2xJZGVudGlmaWVyOwogICAgIH0KIAogICAgIC8qKiB7QGluaGVyaXREb2N9ICovCisgICAgQE92ZXJyaWRlCiAgICAgcHVibGljIGJvb2xlYW4gaXNSZXBsYWNlKCkgewogICAgICAgICByZXR1cm4gKHByb3RvY29sSWRlbnRpZmllciAmIDB4YzApID09IDB4NDAKICAgICAgICAgICAgICAgICAmJiAocHJvdG9jb2xJZGVudGlmaWVyICYgMHgzZikgPiAwCkBAIC04MzksMTIgKzgzNiwxNCBAQAogICAgIH0KIAogICAgIC8qKiB7QGluaGVyaXREb2N9ICovCisgICAgQE92ZXJyaWRlCiAgICAgcHVibGljIGJvb2xlYW4gaXNDcGhzTXdpTWVzc2FnZSgpIHsKICAgICAgICAgcmV0dXJuICgoR3NtU21zQWRkcmVzcykgb3JpZ2luYXRpbmdBZGRyZXNzKS5pc0NwaHNWb2ljZU1lc3NhZ2VDbGVhcigpCiAgICAgICAgICAgICAgICAgfHwgKChHc21TbXNBZGRyZXNzKSBvcmlnaW5hdGluZ0FkZHJlc3MpLmlzQ3Boc1ZvaWNlTWVzc2FnZVNldCgpOwogICAgIH0KIAogICAgIC8qKiB7QGluaGVyaXREb2N9ICovCisgICAgQE92ZXJyaWRlCiAgICAgcHVibGljIGJvb2xlYW4gaXNNV0lDbGVhck1lc3NhZ2UoKSB7CiAgICAgICAgIGlmIChpc013aSAmJiAobXdpU2Vuc2UgPT0gZmFsc2UpKSB7CiAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKQEAgLTg1NSw2ICs4NTQsNyBAQAogICAgIH0KIAogICAgIC8qKiB7QGluaGVyaXREb2N9ICovCisgICAgQE92ZXJyaWRlCiAgICAgcHVibGljIGJvb2xlYW4gaXNNV0lTZXRNZXNzYWdlKCkgewogICAgICAgICBpZiAoaXNNd2kgJiYgKG13aVNlbnNlID09IHRydWUpKSB7CiAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKQEAgLTg2NSw2ICs4NjUsNyBAQAogICAgIH0KIAogICAgIC8qKiB7QGluaGVyaXREb2N9ICovCisgICAgQE92ZXJyaWRlCiAgICAgcHVibGljIGJvb2xlYW4gaXNNd2lEb250U3RvcmUoKSB7CiAgICAgICAgIGlmIChpc013aSAmJiBtd2lEb250U3RvcmUpIHsKICAgICAgICAgICAgIHJldHVybiB0cnVlOwpAQCAtODg0LDMxICs4ODUsMzQgQEAKICAgICB9CiAKICAgICAvKioge0Bpbmhlcml0RG9jfSAqLworICAgIEBPdmVycmlkZQogICAgIHB1YmxpYyBpbnQgZ2V0U3RhdHVzKCkgewogICAgICAgICByZXR1cm4gc3RhdHVzOwogICAgIH0KIAogICAgIC8qKiB7QGluaGVyaXREb2N9ICovCis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HJldHVybiB0cnVlOworICAgIH0KKworICAgIC8qKgorICAgICAqIEdldCBjb250cm9sIHJlc3BvbnNlCisgICAgICogQHJldHVybiBNc2cgaWYgcmVzcG9uc2UgaXMgcmVjZWl2ZWQsIGVsc2UgcmV0dXJuIG51bGwuCisgICAgICovCisgICAgcHJpdmF0ZSBNc2cgZ2V0Q3RybFJlc3BvbnNlKCkgeworICAgICAgICBNc2cgcmVzcG9uc2UgPSBudWxsOworICAgICAgICB0cnkgeworICAgICAgICAgICAgcmVzcG9uc2UgPSBNc2cucmVjdihtUmlsQ2hhbm5lbCk7CisgICAgICAgIH0gY2F0Y2ggKElPRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgIExvZy52KFRBRywgInJlY2VpdmUgcmVzcG9uc2UgZm9yIGdldFJhZGlvU3RhdGUoKSBlcnJvcjogIiArIGUuZ2V0U3RhY2tUcmFjZSgpKTsKKyAgICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICB9CisgICAgICAgIHJldHVybiByZXNwb25zZTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBAcmV0dXJuIHRoZSByYWRpbyBzdGF0ZSBpZiBpdCBpcyB2YWxpZCwgb3RoZXJ3aXNlIHJldHVybiAtMQorICAgICAqLworICAgIHB1YmxpYyBpbnQgZ2V0UmFkaW9TdGF0ZSgpIHsKKyAgICAgICAgaWYgKCFzZW5kQ3RybENvbW1hbmQoUmlsQ3RybENtZHMuQ1RSTF9DTURfR0VUX1JBRElPX1NUQVRFLCAwLCAwLCBudWxsKSkgeworICAgICAgICAgICAgcmV0dXJuIC0xOworICAgICAgICB9CisgICAgICAgIE1zZyByZXNwb25zZSA9IGdldEN0cmxSZXNwb25zZSgpOworICAgICAgICBpZiAocmVzcG9uc2UgPT0gbnVsbCkgeworICAgICAgICAgICAgTG9nLnYoVEFHLCAiZmFpbGVkIHRvIGdldCByZXNwb25zZSIpOworICAgICAgICAgICAgcmV0dXJuIC0xOworICAgICAgICB9CisgICAgICAg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ICAgIC8vIFRoaXMgbWF5IHNlZW0gd3JvbmcsIGJ1dCBpdCdzIHByb2JhYmx5IG9rCi0gICAgICAgIGFzc2VydEVxdWFscygKLSAgICAgICAgICAgICAgICAiMTcwMDU1NTQxNDEqIyIsCi0gICAgICAgICAgICAgICAgUGhvbmVOdW1iZXJVdGlscy5leHRyYWN0TmV0d29ya1BvcnRpb24oIjEgKDcwMCkuNTU1LTQxNDEqIyIpCi0gICAgICAgICk7Ci0KLSAgICAgICAgYXNzZXJ0RXF1YWxzKAotICAgICAgICAgICAgICAgICIxNzAwNTU1NDFOTiIsCi0gICAgICAgICAgICAgICAgUGhvbmVOdW1iZXJVdGlscy5leHRyYWN0TmV0d29ya1BvcnRpb24oIjEgKDcwMCkuNTU1LTQxTk4iKQotICAgICAgICApOwotCi0gICAgICAgIGFzc2VydEVxdWFscygKLSAgICAgICAgICAgICAgICAiMTcwMDU1NTQxTk4iLAotICAgICAgICAgICAgICAgIFBob25lTnVtYmVyVXRpbHMuZXh0cmFjdE5ldHdvcmtQb3J0aW9uKCIxICg3MDApLjU1NS00MU5OLDEyMzQiKQotICAgICAgICApOwotCi0gICAgICAgIGFzc2VydEVxdWFscygKLSAgICAgICAgICAgICAgICAiMTcwMDU1NTQxTk4iLAotICAgICAgICAgICAgICAgIFBob25lTnVtYmVyVXRpbHMuZXh0cmFjdE5ldHdvcmtQb3J0aW9uKCIxICg3MDApLjU1NS00MU5OOzEyMzQiKQotICAgICAgICApOwotCi0gICAgICAgIC8vIEFuIE1NSSBzdHJpbmcgaXMgdW5wZXJ0ZXJiZWQsIGV2ZW4gdGhvdWdoIGl0IGNvbnRhaW5zIGEKLSAgICAgICAgLy8gKHZhbGlkIGluIHRoaXMgY2FzZSkgZW1iZWRkZWQgKwotICAgICAgICBhc3NlcnRFcXVhbHMoCi0gICAgICAgICAgICAgICAgIioqMjEqKjE3MDA1NTU0MTQxIyIsCi0gICAgICAgICAgICAgICAgUGhvbmVOdW1iZXJVdGlscy5leHRyYW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yZSgiMTIzIiwgbnVsbCkpOwotICAgICAgICBhc3NlcnROdWxsKFBob25lTnVtYmVyVXRpbHMudG9DYWxsZXJJRE1pbk1hdGNoKG51bGwpKTsKLSAgICAgICAgYXNzZXJ0TnVsbChQaG9uZU51bWJlclV0aWxzLmdldFN0cmlwcGVkUmV2ZXJzZWQobnVsbCkpOwotICAgICAgICBhc3NlcnROdWxsKFBob25lTnVtYmVyVXRpbHMuc3RyaW5nRnJvbVN0cmluZ0FuZFRPQShudWxsLCAxKSk7Ci0gICAgfQotCi0gICAgQFNtYWxsVGVzdAotICAgIHB1YmxpYyB2b2lkIHRlc3RFeHRyYWN0TmV0d29ya1BvcnRpb25BbHQoKSB0aHJvd3MgRXhjZXB0aW9uIHsKLSAgICAgICAgYXNzZXJ0RXF1YWxzKAotICAgICAgICAgICAgICAgICIrMTcwMDU1NTQxNDEiLAotICAgICAgICAgICAgICAgIFBob25lTnVtYmVyVXRpbHMuZXh0cmFjdE5ldHdvcmtQb3J0aW9uQWx0KCIrMTcwMDU1NTQxNDEiKQotICAgICAgICApOwotCi0gICAgICAgIGFzc2VydEVxdWFscygKLSAgICAgICAgICAgICAgICAiKzE3MDA1NTU0MTQxIiwKLSAgICAgICAgICAgICAgICBQaG9uZU51bWJlclV0aWxzLmV4dHJhY3ROZXR3b3JrUG9ydGlvbkFsdCgiKzEgKDcwMCkuNTU1LTQxNDEiKQotICAgICAgICApOwotCi0gICAgICAgIGFzc2VydEVxdWFscygKLSAgICAgICAgICAgICAgICAiMTcwMDU1NTQxNDEiLAotICAgICAgICAgICAgICAgIFBob25lTnVtYmVyVXRpbHMuZXh0cmFjdE5ldHdvcmtQb3J0aW9uQWx0KCIxICg3MDApLjU1NS00MTQxIikKLSAgICAgICAgKTsKLQotICAgICAgICAvLyBUaGlzIG1heSBzZWVtIHdyb25nLCBidXQgaXQncyBwcm9iYWJseSBvawotICAgICAgICBhc3NlcnRFcXVhbHMoCi0gICAgICAgICAgICAgICAgIjE3MDA1NTU0MTQxKiMiLAotICAgICAgICAgICAgICAgIFBob25lTnVtYmVyVXRpbHMuZXh0cmFjdE5ldHdvcmtQb3J0aW9uQWx0KCIxICg3MDApLjU1NS00MTQxKiMiKQotICAgICAgICApOwotCi0gICAgICAgIGFzc2VydEVxdWFscygKLSAgICAgICAgICAgICAgICAiMTcwMDU1NTQxTk4iLAotICAgICAgICAgICAgICAgIFBob25lTnVtYmVyVXRpbHMuZXh0cmFjdE5ldHdvcmtQb3J0aW9uQWx0KCIxICg3MDApLjU1NS00MU5OIikKLSAgICAgICAgKTsKLQotICAgICAgICBhc3NlcnRFcXVhbHMoCi0gICAgICAgICAgICAgICAgIjE3MDA1NTU0MU5OIiwKLSAgICAgICAgICAgICAgICBQaG9uZU51bWJlclV0aWxzLmV4dHJhY3ROZXR3b3JrUG9ydGlvbkFsdCgiMSAoNzAwKS41NTUtNDFOTiwxMjM0IikKLSAgICAgICAgKTsKLQotICAgICAgICBhc3NlcnRFcXVhbHMoCi0gICAgICAgICAgICAgICAgIjE3MDA1NTU0MU5OIiwKLSAgICAgICAgICAgICAgICBQaG9uZU51bWJlclV0aWxzLmV4dHJhY3ROZXR3b3JrUG9ydGlvbkFsdCgiMSAoNzAwKS41NTUtNDFOTjsxMjM0IikKLSAgICAgICAgKTsKLQotICAgICAgICAvLyBBbiBNTUkgc3RyaW5nIGlzIHVucGVydGVyYmVkLCBldmVuIHRob3VnaCBpdCBjb250YWlucyBhCi0gICAgICAgIC8vICh2YWxpZCBpbiB0aGlzIGNhc2UpIGVtYmVkZGVkICsKLSAgICAgICAgYXNzZXJ0RXF1YWxzKAotICAgICAgICAgICAgICAgICIqKjIxKiorMTcwMDU1NTQxNDEjIiwKLSAgICAgICAgICAgICAgICBQaG9uZU51bWJlclV0aWxzLmV4dHJhY3ROZXR3b3JrUG9ydGlvbkFsdCgiKioyMSoqKzE3MDA1NTU0MTQxIyIpCi0gICAgICAgICk7Ci0KLSAgICAgICAgYXNzZXJ0RXF1YWxzKAotICAgICA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NTUxMjEiKTsKLSAgICAgICAgUGhvbmVOdW1iZXJVdGlscy5mb3JtYXROYW5wTnVtYmVyKG51bWJlcik7Ci0gICAgICAgIGFzc2VydEVxdWFscygiODAwLTU1NS0xMjEiLCBudW1iZXIudG9TdHJpbmcoKSk7Ci0KLSAgICAgICAgbnVtYmVyLmNsZWFyKCk7Ci0gICAgICAgIG51bWJlci5hcHBlbmQoIjU1NS0xMjEyIik7Ci0gICAgICAgIFBob25lTnVtYmVyVXRpbHMuZm9ybWF0TmFucE51bWJlcihudW1iZXIpOwotICAgICAgICBhc3NlcnRFcXVhbHMoIjU1NS0xMjEyIiwgbnVtYmVyLnRvU3RyaW5nKCkpOwotCi0gICAgICAgIG51bWJlci5jbGVhcigpOwotICAgICAgICBudW1iZXIuYXBwZW5kKCI4MDAtNTU1MTIiKTsKLSAgICAgICAgUGhvbmVOdW1iZXJVdGlscy5mb3JtYXROYW5wTnVtYmVyKG51bWJlcik7Ci0gICAgICAgIGFzc2VydEVxdWFscygiODAwLTU1NS0xMiIsIG51bWJlci50b1N0cmluZygpKTsKLQotICAgICAgICBudW1iZXIuY2xlYXIoKTsKLSAgICAgICAgbnVtYmVyLmFwcGVuZCgiNDY2NDUiKTsKLSAgICAgICAgUGhvbmVOdW1iZXJVdGlscy5mb3JtYXROYW5wTnVtYmVyKG51bWJlcik7Ci0gICAgICAgIGFzc2VydEVxdWFscygiNDY2NDUiLCBudW1iZXIudG9TdHJpbmcoKSk7Ci0gICAgfQotCi0gICAgQFNtYWxsVGVzdAotICAgIHB1YmxpYyB2b2lkIHRlc3RDb252ZXJ0S2V5cGFkTGV0dGVyc1RvRGlnaXRzKCkgewotICAgICAgICBhc3NlcnRFcXVhbHMoIjEtODAwLTQ2NjQtNDExIiwKLSAgICAgICAgICAgICAgICAgICAgIFBob25lTnVtYmVyVXRpbHMuY29udmVydEtleXBhZExldHRlcnNUb0RpZ2l0cygiMS04MDAtR09PRy00MTEiKSk7Ci0gICAgICAgIGFzc2VydEVxdWFscygiMTgwMDQ2NjQ0MTEiLAotICAgICAgICAgICAgICAgICAgICAgUGhvbmVOdW1iZXJVdGlscy5jb252ZXJ0S2V5cGFkTGV0dGVyc1RvRGlnaXRzKCIxODAwR09PRzQxMSIpKTsKLSAgICAgICAgYXNzZXJ0RXF1YWxzKCIxLTgwMC00NjYtNDQxMSIsCi0gICAgICAgICAgICAgICAgICAgICBQaG9uZU51bWJlclV0aWxzLmNvbnZlcnRLZXlwYWRMZXR0ZXJzVG9EaWdpdHMoIjEtODAwLTQ2Ni00NDExIikpOwotICAgICAgICBhc3NlcnRFcXVhbHMoIjE4MDA0NjY0NDExIiwKLSAgICAgICAgICAgICAgICAgICAgIFBob25lTnVtYmVyVXRpbHMuY29udmVydEtleXBhZExldHRlcnNUb0RpZ2l0cygiMTgwMDQ2NjQ0MTEiKSk7Ci0gICAgICAgIGFzc2VydEVxdWFscygiMjIyLTMzMy00NDQtNTU1LTY2Ni03Nzc3LTg4OC05OTk5IiwKLSAgICAgICAgICAgICAgICAgICAgIFBob25lTnVtYmVyVXRpbHMuY29udmVydEtleXBhZExldHRlcnNUb0RpZ2l0cygKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIkFCQy1ERUYtR0hJLUpLTC1NTk8tUFFSUy1UVVYtV1hZWiIpKTsKLSAgICAgICAgYXNzZXJ0RXF1YWxzKCIyMjItMzMzLTQ0NC01NTUtNjY2LTc3NzctODg4LTk5OTkiLAotICAgICAgICAgICAgICAgICAgICAgUGhvbmVOdW1iZXJVdGlscy5jb252ZXJ0S2V5cGFkTGV0dGVyc1RvRGlnaXRzKAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiYWJjLWRlZi1naGktamtsLW1uby1wcXJzLXR1di13eHl6IikpOwotICAgICAgICBhc3NlcnRFcXVhbHMoIig4MDApIDIyMi0zMzM0IiwKLSAgICAgICAgICAgICAgICAgICAgIFBob25lTnVtYmVyVXRpbHMuY29udmVydEtleXBhZExldHRlcnNUb0RpZ2l0cyg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tYWxsVGVzdDsKK2ltcG9ydCBhbmRyb2lkLnRleHQuU3Bhbm5hYmxlU3RyaW5nQnVpbGRlcjsKK2ltcG9ydCBhbmRyb2lkLnRlbGVwaG9ueS5QaG9uZU51bWJlclV0aWxzOworaW1wb3J0IGFuZHJvaWQudGVsZXBob255LlRlbGVwaG9ueU1hbmFnZXI7CitpbXBvcnQgYW5kcm9pZC5jb250ZW50LkNvbnRleHQ7CisKK2ltcG9ydCBqdW5pdC5mcmFtZXdvcmsuVGVzdENhc2U7CisKK3B1YmxpYyBjbGFzcyBQaG9uZU51bWJlclV0aWxzVGVzdCBleHRlbmRzIEFuZHJvaWRUZXN0Q2FzZSB7CisKKyAgICBAU21hbGxUZXN0CisgICAgcHVibGljIHZvaWQgdGVzdEV4dHJhY3ROZXR3b3JrUG9ydGlvbigpIHRocm93cyBFeGNlcHRpb24geworICAgICAgICBhc3NlcnRFcXVhbHMoCisgICAgICAgICAgICAgICAgIisxNzAwNTU1NDE0MSIsCisgICAgICAgICAgICAgICAgUGhvbmVOdW1iZXJVdGlscy5leHRyYWN0TmV0d29ya1BvcnRpb24oIisxNzAwNTU1NDE0MSIpCisgICAgICAgICk7CisKKyAgICAgICAgYXNzZXJ0RXF1YWxzKAorICAgICAgICAgICAgICAgICIrMTcwMDU1NTQxNDEiLAorICAgICAgICAgICAgICAgIFBob25lTnVtYmVyVXRpbHMuZXh0cmFjdE5ldHdvcmtQb3J0aW9uKCIrMSAoNzAwKS41NTUtNDE0MSIpCisgICAgICAgICk7CisKKyAgICAgICAgYXNzZXJ0RXF1YWxzKAorICAgICAgICAgICAgICAgICIxNzAwNTU1NDE0MSIsCisgICAgICAgICAgICAgICAgUGhvbmVOdW1iZXJVdGlscy5leHRyYWN0TmV0d29ya1BvcnRpb24oIjEgKDcwMCkuNTU1LTQxNDEiKQorICAgICAgICApOworCisgICAgICAgIC8vIFRoaXMgbWF5IHNlZW0gd3JvbmcsIGJ1dCBpdCdzIHByb2JhYmx5IG9rCisgICAgICAgIGFzc2VydEVxdWFscygKKyAgICAgICAgICAgICAgICAiMTcwMDU1NTQxNDEqIyIsCisgICAgICAgICAgICAgICAgUGhvbmVOdW1iZXJVdGlscy5leHRyYWN0TmV0d29ya1BvcnRpb24oIjEgKDcwMCkuNTU1LTQxNDEqIyIpCisgICAgICAgICk7CisKKyAgICAgICAgYXNzZXJ0RXF1YWxzKAorICAgICAgICAgICAgICAgICIxNzAwNTU1NDFOTiIsCisgICAgICAgICAgICAgICAgUGhvbmVOdW1iZXJVdGlscy5leHRyYWN0TmV0d29ya1BvcnRpb24oIjEgKDcwMCkuNTU1LTQxTk4iKQorICAgICAgICApOworCisgICAgICAgIGFzc2VydEVxdWFscygKKyAgICAgICAgICAgICAgICAiMTcwMDU1NTQxTk4iLAorICAgICAgICAgICAgICAgIFBob25lTnVtYmVyVXRpbHMuZXh0cmFjdE5ldHdvcmtQb3J0aW9uKCIxICg3MDApLjU1NS00MU5OLDEyMzQiKQorICAgICAgICApOworCisgICAgICAgIGFzc2VydEVxdWFscygKKyAgICAgICAgICAgICAgICAiMTcwMDU1NTQxTk4iLAorICAgICAgICAgICAgICAgIFBob25lTnVtYmVyVXRpbHMuZXh0cmFjdE5ldHdvcmtQb3J0aW9uKCIxICg3MDApLjU1NS00MU5OOzEyMzQiKQorICAgICAgICApOworCisgICAgICAgIC8vIEFuIE1NSSBzdHJpbmcgaXMgdW5wZXJ0ZXJiZWQsIGV2ZW4gdGhvdWdoIGl0IGNvbnRhaW5zIGEKKyAgICAgICAgLy8gKHZhbGlkIGluIHRoaXMgY2FzZSkgZW1iZWRkZWQgKworICAgICAgICBhc3NlcnRFcXVhbHMoCisgICAgICAgICAgICAgICAgIioqMjEqKjE3MDA1NTU0MTQxIyIsCisgICAgICAgICAgICAgICAgUGhvbmVOdW1iZXJVdGlscy5leHRyYWN0TmV0d29ya1BvcnRpb24oIioqMjEqKisxNzAwNTU1NDE0MSMiKQorICAgICAgICAgICAgICAgIC8vVE9ETyB0aGlzIGl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zAwNTU1MDAyMCIsCisgICAgICAgICAgICBQaG9uZU51bWJlclV0aWxzLmNhbGxlZFBhcnR5QkNEVG9TdHJpbmcoYiwgMCwgOSkpOworCisgICAgICAgIGJbMF0gPSAoYnl0ZSkgMHg5MTsgYlsxXSA9IChieXRlKSAweDJBOyBiWzJdID0gKGJ5dGUpIDB4QjE7IGJbM10gPSAoYnl0ZSkgMHg3MTsKKyAgICAgICAgYls0XSA9IChieXRlKSAweDAwOyBiWzVdID0gKGJ5dGUpIDB4NTU7IGJbNl0gPSAoYnl0ZSkgMHgwNTsgYls3XSA9IChieXRlKSAweDIwOworICAgICAgICBiWzhdID0gKGJ5dGUpIDB4RjA7CisgICAgICAgIGFzc2VydEVxdWFscygiKjIxIysxNzAwNTU1MDAyMCIsCisgICAgICAgICAgICBQaG9uZU51bWJlclV0aWxzLmNhbGxlZFBhcnR5QkNEVG9TdHJpbmcoYiwgMCwgOSkpOworCisgICAgICAgIGFzc2VydE51bGwoUGhvbmVOdW1iZXJVdGlscy5leHRyYWN0TmV0d29ya1BvcnRpb24obnVsbCkpOworICAgICAgICBhc3NlcnROdWxsKFBob25lTnVtYmVyVXRpbHMuZXh0cmFjdFBvc3REaWFsUG9ydGlvbihudWxsKSk7CisgICAgICAgIGFzc2VydFRydWUoUGhvbmVOdW1iZXJVdGlscy5jb21wYXJlKG51bGwsIG51bGwpKTsKKyAgICAgICAgYXNzZXJ0RmFsc2UoUGhvbmVOdW1iZXJVdGlscy5jb21wYXJlKG51bGwsICIxMjMiKSk7CisgICAgICAgIGFzc2VydEZhbHNlKFBob25lTnVtYmVyVXRpbHMuY29tcGFyZSgiMTIzIiwgbnVsbCkpOworICAgICAgICBhc3NlcnROdWxsKFBob25lTnVtYmVyVXRpbHMudG9DYWxsZXJJRE1pbk1hdGNoKG51bGwpKTsKKyAgICAgICAgYXNzZXJ0TnVsbChQaG9uZU51bWJlclV0aWxzLmdldFN0cmlwcGVkUmV2ZXJzZWQobnVsbCkpOworICAgICAgICBhc3NlcnROdWxsKFBob25lTnVtYmVyVXRpbHMuc3RyaW5nRnJvbVN0cmluZ0FuZFRPQShudWxsLCAxKSk7CisgICAgfQorCisgICAgQFNtYWxsVGVzdAorICAgIHB1YmxpYyB2b2lkIHRlc3RFeHRyYWN0TmV0d29ya1BvcnRpb25BbHQoKSB0aHJvd3MgRXhjZXB0aW9uIHsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKAorICAgICAgICAgICAgICAgICIrMTcwMDU1NTQxNDEiLAorICAgICAgICAgICAgICAgIFBob25lTnVtYmVyVXRpbHMuZXh0cmFjdE5ldHdvcmtQb3J0aW9uQWx0KCIrMTcwMDU1NTQxNDEiKQorICAgICAgICApOworCisgICAgICAgIGFzc2VydEVxdWFscygKKyAgICAgICAgICAgICAgICAiKzE3MDA1NTU0MTQxIiwKKyAgICAgICAgICAgICAgICBQaG9uZU51bWJlclV0aWxzLmV4dHJhY3ROZXR3b3JrUG9ydGlvbkFsdCgiKzEgKDcwMCkuNTU1LTQxNDEiKQorICAgICAgICApOworCisgICAgICAgIGFzc2VydEVxdWFscygKKyAgICAgICAgICAgICAgICAiMTcwMDU1NTQxNDEiLAorICAgICAgICAgICAgICAgIFBob25lTnVtYmVyVXRpbHMuZXh0cmFjdE5ldHdvcmtQb3J0aW9uQWx0KCIxICg3MDApLjU1NS00MTQxIikKKyAgICAgICAgKTsKKworICAgICAgICAvLyBUaGlzIG1heSBzZWVtIHdyb25nLCBidXQgaXQncyBwcm9iYWJseSBvaworICAgICAgICBhc3NlcnRFcXVhbHMoCisgICAgICAgICAgICAgICAgIjE3MDA1NTU0MTQxKiMiLAorICAgICAgICAgICAgICAgIFBob25lTnVtYmVyVXRpbHMuZXh0cmFjdE5ldHdvcmtQb3J0aW9uQWx0KCIxICg3MDApLjU1NS00MTQxKiMiKQorICAgICAgICApOworCisgICAgICAgIGFzc2VydEVxdWFscygKKyAgICAgICAgICAgICAgICAiMTcwMDU1NTQxTk4iLAorICAgICAgICAgICAgICAgIFBob25lTnVtYmVyVXRpbHMuZXh0cmFjdE5ldHdvcmtQb3J0aW9uQWx0KCIxICg3MDApLjU1NS00MU5OIikKKyAgICAgICAgKTsKKworICAgICAgICBhc3NlcnRFcXVhbHMoCisgICAgICAgICAgICAgICAgIjE3MDA1NTU0MU5OIiwKKyAgICAgICAgICAgICAgICBQaG9uZU51bWJlclV0aWxzLmV4dHJhY3ROZXR3b3JrUG9ydGlvbkFsdCgiMSAoNzAwKS41NTUtNDFOTiwxMjM0IikKKyAgICAgICAgKTsKKworICAgICAgICBhc3NlcnRFcXVhbHMoCisgICAgICAgICAgICAgICAgIjE3MDA1NTU0MU5OIiwKKyAgICAgICAgICAgICAgICBQaG9uZU51bWJlclV0aWxzLmV4dHJhY3ROZXR3b3JrUG9ydGlvbkFsdCgiMSAoNzAwKS41NTUtNDFOTjsxMjM0IikKKyAgICAgICAgKTsKKworICAgICAgICAvLyBBbiBNTUkgc3RyaW5nIGlzIHVucGVydGVyYmVkLCBldmVuIHRob3VnaCBpdCBjb250YWlucyBhCisgICAgICAgIC8vICh2YWxpZCBpbiB0aGlzIGNhc2UpIGVtYmVkZGVkICsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKAorICAgICAgICAgICAgICAgICIqKjIxKiorMTcwMDU1NTQxNDEjIiwKKyAgICAgICAgICAgICAgICBQaG9uZU51bWJlclV0aWxzLmV4dHJhY3ROZXR3b3JrUG9ydGlvbkFsdCgiKioyMSoqKzE3MDA1NTU0MTQxIyIpCisgICAgICAgICk7CisKKyAgICAgICAgYXNzZXJ0RXF1YWxzKAorICAgICAgICAgICAgICAgICIqMzEjKzQ0Nzk2NjE2NDIwOCIsCisgICAgICAgICAgICAgICAgUGhvbmVOdW1iZXJVdGlscy5leHRyYWN0TmV0d29ya1BvcnRpb25BbHQoIiozMSMrNDQ3OTY2MTY0MjA4IikKKyAgICAgICAgKTsKKworICAgICAgICBhc3NlcnRFcXVhbHMoCisgICAgICAgICAgICAgICAgIiozMSMrNDQ3OTY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TsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKCIwMDMyIiwgUGhvbmVOdW1iZXJVdGlscy5nZXRTdHJpcHBlZFJldmVyc2VkKCIyMzAwIikpOworICAgICAgICBhc3NlcnRFcXVhbHMoIjAwMzIrIiwgUGhvbmVOdW1iZXJVdGlscy5nZXRTdHJpcHBlZFJldmVyc2VkKCIrMjMwMCIpKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKCIjMTMwIyoiLCBQaG9uZU51bWJlclV0aWxzLmdldFN0cmlwcGVkUmV2ZXJzZWQoIiojMDMxIyIpKTsKKyAgICB9CisKKyAgICBAU21hbGxUZXN0CisgICAgcHVibGljIHZvaWQgdGVzdE5hbnBGb3JtYXR0aW5nKCkgeworICAgICAgICBTcGFubmFibGVTdHJpbmdCdWlsZGVyIG51bWJlciA9IG5ldyBTcGFubmFibGVTdHJpbmdCdWlsZGVyKCk7CisgICAgICAgIG51bWJlci5hcHBlbmQoIjgwMDU1NTEyMTIiKTsKKyAgICAgICAgUGhvbmVOdW1iZXJVdGlscy5mb3JtYXROYW5wTnVtYmVyKG51bWJlcik7CisgICAgICAgIGFzc2VydEVxdWFscygiODAwLTU1NS0xMjEyIiwgbnVtYmVyLnRvU3RyaW5nKCkpOworCisgICAgICAgIG51bWJlci5jbGVhcigpOworICAgICAgICBudW1iZXIuYXBwZW5kKCI4MDA1NTUxMjEiKTsKKyAgICAgICAgUGhvbmVOdW1iZXJVdGlscy5mb3JtYXROYW5wTnVtYmVyKG51bWJlcik7CisgICAgICAgIGFzc2VydEVxdWFscygiODAwLTU1NS0xMjEiLCBudW1iZXIudG9TdHJpbmcoKSk7CisKKyAgICAgICAgbnVtYmVyLmNsZWFyKCk7CisgICAgICAgIG51bWJlci5hcHBlbmQoIjU1NS0xMjEyIik7CisgICAgICAgIFBob25lTnVtYmVyVXRpbHMuZm9ybWF0TmFucE51bWJlcihudW1iZXIpOworICAgICAgICBhc3NlcnRFcXVhbHMoIjU1NS0xMjEyIiwgbnVtYmVyLnRvU3RyaW5nKCkpOworCisgICAgICAgIG51bWJlci5jbGVhcigpOworICAgICAgICBudW1iZXIuYXBwZW5kKCI4MDAtNTU1MTIiKTsKKyAgICAgICAgUGhvbmVOdW1iZXJVdGlscy5mb3JtYXROYW5wTnVtYmVyKG51bWJlcik7CisgICAgICAgIGFzc2VydEVxdWFscygiODAwLTU1NS0xMiIsIG51bWJlci50b1N0cmluZygpKTsKKworICAgICAgICBudW1iZXIuY2xlYXIoKTsKKyAgICAgICAgbnVtYmVyLmFwcGVuZCgiNDY2NDUiKTsKKyAgICAgICAgUGhvbmVOdW1iZXJVdGlscy5mb3JtYXROYW5wTnVtYmVyKG51bWJlcik7CisgICAgICAgIGFzc2VydEVxdWFscygiNDY2NDUiLCBudW1iZXIudG9TdHJpbmcoKSk7CisgICAgfQorCisgICAgQFNtYWxsVGVzdAorICAgIHB1YmxpYyB2b2lkIHRlc3RDb252ZXJ0S2V5cGFkTGV0dGVyc1RvRGlnaXRzKCkgeworICAgICAgICBhc3NlcnRFcXVhbHMoIjEtODAwLTQ2NjQtNDExIiwKKyAgICAgICAgICAgICAgICAgICAgIFBob25lTnVtYmVyVXRpbHMuY29udmVydEtleXBhZExldHRlcnNUb0RpZ2l0cygiMS04MDAtR09PRy00MTEiKSk7CisgICAgICAgIGFzc2VydEVxdWFscygiMTgwMDQ2NjQ0MTEiLAorICAgICAgICAgICAgICAgICAgICAgUGhvbmVOdW1iZXJVdGlscy5jb252ZXJ0S2V5cGFkTGV0dGVyc1RvRGlnaXRzKCIxODAwR09PRzQxMSIpKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKCIxLTgwMC00NjYtNDQxMSIsCisgICAgICAgICAgICAgICAgICAgICBQaG9uZU51bWJlclV0aWxzLmNvbnZlcnRLZXlwYWRMZXR0ZXJzVG9EaWdpdHMoIjEtODAwLTQ2Ni00NDExIikpOworICAgICAgICBhc3NlcnRFcXVhbHMoIjE4MDA0NjY0NDExIiwKKyAgICAgICAgICAgICAgICAgICAgIFBob25lTnVtYmVyVXRpbHMuY29udmVydEtleXBhZExldHRlcnNUb0RpZ2l0cygiMTgwMDQ2NjQ0MTEiKSk7CisgICAgICAgIGFzc2VydEVxdWFscygiMjIyLTMzMy00NDQtNTU1LTY2Ni03Nzc3LTg4OC05OTk5IiwKKyAgICAgICAgICAgICAgICAgICAgIFBob25lTnVtYmVyVXRpbHMuY29udmVydEtleXBhZExldHRlcnNUb0RpZ2l0cygKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIkFCQy1ERUYtR0hJLUpLTC1NTk8tUFFSUy1UVVYtV1hZWiIpKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKCIyMjItMzMzLTQ0NC01NTUtNjY2LTc3NzctODg4LTk5OTkiLAorICAgICAgICAgICAgICAgICAgICAgUGhvbmVOdW1iZXJVdGlscy5jb252ZXJ0S2V5cGFkTGV0dGVyc1RvRGlnaXRzKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiYWJjLWRlZi1naGktamtsLW1uby1wcXJzLXR1di13eHl6IikpOworICAgICAgICBhc3NlcnRFcXVhbHMoIig4MDApIDIyMi0zMzM0IiwKKyAgICAgICAgICAgICAgICAgICAgIFBob25lTnVtYmVyVXRpbHMuY29udmVydEtleXBhZExldHRlcnNUb0RpZ2l0cygiKDgwMCkgQUJDLURFRkciKSk7CisgICAgfQorCisgICAgLy8gVG8gcnVuIHRoaXMgdGVzdCwgdGhlIGRldmljZSBoYXMgdG8gYmUgcmVnaXN0ZXJlZCB3aXRoIG5ldHdvcmsKKyAgICBwdWJsaWMgdm9pZCB0ZXN0Q2hlY2tBbmRQcm9jZXNzUGx1c0NvZGUoKSB7CisgICAgICAgIGFzc2VydEVxdWFscygiMDExODQ3NTc5NzAwMCIsCisgICAgICAgICAgICAgICAgUGhvbmVOdW1iZXJVdGlscy5jZG1hQ2hlY2tBbmRQcm9jZXNzUGx1c0NvZGUoIis4NDc1Nzk3MDAwIikpOworICAgICAgICBhc3N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AvLyB0aGUgY3Vyc29yIHNob3VsZCBzdGlsbCBhdCB0aGUgcmlnaHQgb2YgJzQnCisgICAgICAgIGFzc2VydEVxdWFscyhleHBlY3RlZDIubGVuZ3RoKCksIFNlbGVjdGlvbi5nZXRTZWxlY3Rpb25FbmQobnVtYmVyKSk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgdGVzdFRleHRDaGFuZ2VkQnlPdGhlclRleHRXYXRjaGVyKCkgeworICAgICAgICBmaW5hbCBUZXh0V2F0Y2hlciBjbGVhbnVwVGV4dFdhdGNoZXIgPSBuZXcgVGV4dFdhdGNoZXIoKSB7CisgICAgICAgICAgICBwdWJsaWMgdm9pZCBhZnRlclRleHRDaGFuZ2VkKEVkaXRhYmxlIHMpIHsKKyAgICAgICAgICAgICAgICBzLmNsZWFyKCk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHB1YmxpYyB2b2lkIGJlZm9yZVRleHRDaGFuZ2VkKENoYXJTZXF1ZW5jZSBzLCBpbnQgc3RhcnQsIGludCBjb3VudCwKKyAgICAgICAgICAgICAgICAgICAgaW50IGFmdGVyKSB7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHB1YmxpYyB2b2lkIG9uVGV4dENoYW5nZWQoQ2hhclNlcXVlbmNlIHMsIGludCBzdGFydCwgaW50IGJlZm9yZSwKKyAgICAgICAgICAgICAgICAgICAgaW50IGNvdW50KSB7CisgICAgICAgICAgICB9CisgICAgICAgIH07CisgICAgICAgIGZpbmFsIFN0cmluZyBpbml0ID0gIig2NTApIDEyMyI7CisgICAgICAgIGZpbmFsIFN0cmluZyBleHBlY3RlZDEgPSAiIjsKKyAgICAgICAgVGV4dFdhdGNoZXIgdGV4dFdhdGNoZXIgPSBnZXRUZXh0V2F0Y2hlcigpOworCisgICAgICAgIFNwYW5uYWJsZVN0cmluZ0J1aWxkZXIgbnVtYmVyID0gbmV3IFNwYW5uYWJsZVN0cmluZ0J1aWxkZXIoaW5pdCk7CisgICAgICAgI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ICVkIiwgbWhSZXN1bHQuZ2V0Q21kKCkpLAorICAgICAgICAgICAgICAgIG1oUmVzdWx0LmdldENtZCgpID09IDEyMzQ1KTsKKyAgICAgICAgYXNzZXJ0VHJ1ZShTdHJpbmcuZm9ybWF0KCJleHBlY3RlZCB0b2tlbiA9PSA5ODc2IHdhcyAlZCIsIG1oUmVzdWx0LmdldFRva2VuKCkpLAorICAgICAgICAgICAgICAgIG1oUmVzdWx0LmdldFRva2VuKCkgPT0gOTg3Nik7CisgICAgICAgIGFzc2VydFRydWUoU3RyaW5nLmZvcm1hdCgiZXhwZWN0ZWQgc3RhdHVzID09IDc2NTQgd2FzICVkIiwgbWhSZXN1bHQuZ2V0U3RhdHVzKCkpLAorICAgICAgICAgICAgICAgIG1oUmVzdWx0LmdldFN0YXR1cygpID09IDc2NTQpOworICAgICAgICBhc3NlcnRUcnVlKFN0cmluZy5mb3JtYXQoImV4cGVjdGVkIGxlbmd0aERhdGEgPT0gNDMyMSB3YXMgJWQiLCBtaFJlc3VsdC5nZXRMZW5ndGhEYXRhKCkpLAorICAgICAgICAgICAgICAgIG1oUmVzdWx0LmdldExlbmd0aERhdGEoKSA9PSA0MzIxKTsKKworICAgICAgICBsb2coInRlc3RHZXRBcyBYIik7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgdGVzdEdldFJhZGlvU3RhdGUoKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICBsb2coInRlc3RHZXRSYWRpb1N0YXRlIEUiKTsKKworICAgICAgICBNc2cuc2VuZChtTW9ja1JpbENoYW5uZWwsIDEsIDk4NzYsIDAsIG51bGwpOworCisgICAgICAgIE1zZyByZXNwID0gTXNnLnJlY3YobU1vY2tSaWxDaGFubmVsKTsKKyAgICAgICAgLy9yZXNwLnByaW50SGVhZGVyKCJ0ZXN0R2V0UmFkaW9TdGF0ZSIpOworCisgICAgICAgIGFzc2VydFRydWUoU3RyaW5nLmZvcm1hdCgiZXhwZWN0ZWQgY21kID09IDEgd2FzIC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NrCisgICAgICAgIGZpbmFsIEhhbmRsZXIgbWFpblRocmVhZEhhbmRsZXIgPSBuZXcgSGFuZGxlcihMb29wZXIuZ2V0TWFpbkxvb3BlcigpKSB7CisgICAgICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgICAgIHB1YmxpYyB2b2lkIGhhbmRsZU1lc3NhZ2UoTWVzc2FnZSBtc2cpIHsKKyAgICAgICAgICAgICAgICBsb2FkZXIucmVnaXN0ZXJMaXN0ZW5lcigwLCBsaXN0ZW5lcik7CisgICAgICAgICAgICAgICAgbG9hZGVyLnN0YXJ0TG9hZGluZygpOworICAgICAgICAgICAgfQorICAgICAgICB9OworCisgICAgICAgIC8vIEFzayB0aGUgbWFpbiB0aHJlYWQgdG8gc3RhcnQgdGhlIGxvYWRpbmcgcHJvY2VzcworICAgICAgICBtYWluVGhyZWFkSGFuZGxlci5zZW5kRW1wdHlNZXNzYWdlKDApOworCisgICAgICAgIC8vIEJsb2NrIG9uIHRoZSBxdWV1ZSB3YWl0aW5nIGZvciB0aGUgcmVzdWx0IG9mIHRoZSBsb2FkIHRvIGJlIGluc2VydGVkCisgICAgICAgIFQgcmVzdWx0OworICAgICAgICB3aGlsZSAodHJ1ZSkgeworICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICByZXN1bHQgPSBxdWV1ZS50YWtlKCk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9IGNhdGNoIChJbnRlcnJ1cHRlZEV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFJ1bnRpbWVFeGNlcHRpb24oIndhaXRpbmcgdGhyZWFkIGludGVycnVwdGVkIiwgZSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gcmVzdWx0OworICAgIH0KK30KZGlmZiAtLWdpdCBhL3Rlc3QtcnVubmVyL3NyYy9hbmRyb2lkL3Rlc3QvUHJvdmlkZXJUZXN0Q2FzZS5q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ja2FnZU5hbWUpOwogICAgICAgICAgICAgaWYgKGFkZGVkQ2xhc3Nlcy5pc0VtcHR5KCkpIHsKLSAgICAgICAgICAgICAgICBMb2cudygiVGVzdEdyb3VwaW5nIiwgIkludmFsaWQgUGFja2FnZTogJyIgKyBwYWNrYWdlTmFtZQorICAgICAgICAgICAgICAgIExvZy53KExPR19UQUcsICJJbnZhbGlkIFBhY2thZ2U6ICciICsgcGFja2FnZU5hbWUKICAgICAgICAgICAgICAgICAgICAgICAgICsgIicgY291bGQgbm90IGJlIGZvdW5kIG9yIGhhcyBubyB0ZXN0cyIpOwogICAgICAgICAgICAgfQogICAgICAgICAgICAgdGVzdENhc2VDbGFzc2VzLmFkZEFsbChhZGRlZENsYXNzZXMpOwpAQCAtMjM0LDYgKzIzNiwxMCBAQAogICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQorICAgICAgICAgICAgTG9nLmkoTE9HX1RBRywgU3RyaW5nLmZvcm1hdCgKKyAgICAgICAgICAgICAgICAgICAgIlRlc3RDYXNlIGNsYXNzICVzIGlzIG1pc3NpbmcgYSBwdWJsaWMgY29uc3RydWN0b3Igd2l0aCBubyBwYXJhbWV0ZXJzICIgKworICAgICAgICAgICAgICAgICAgICAib3IgYSBzaW5nbGUgU3RyaW5nIHBhcmFtZXRlciAtIHNraXBwaW5nIiwKKyAgICAgICAgICAgICAgICAgICAgYUNsYXNzLmdldE5hbWUoKSkpOwogICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICB9CiAgICAgfQpkaWZmIC0tZ2l0IGEvdGVzdC1ydW5uZXIvdGVzdHMvc3JjL2FuZHJvaWQvdGVzdC9zdWl0ZWJ1aWxkZXIvVGVzdEdyb3VwaW5nVGVzdC5qYXZhIGIvdGVzdC1ydW5uZXIvdGVzdHMvc3JjL2FuZHJvaWQvdGVzdC9zdWl0ZWJ1aWxkZXIvVGVzdEdyb3VwaW5nVGVzdC5qYXZhCm5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XZhdGUgc3RhdGljIGZpbmFsIGludCBTRVRfR0VPTE9DQVRJT05fUEVSTUlTU0lPTiA9IDQzOwogICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBPVkVSUklERV9QUkVGRVJFTkNFID0gNDQ7CisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IExBWU9VVF9EVU1QX0NISUxEX0ZSQU1FU19URVhUID0gNDU7CisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IFNFVF9YU1NfQVVESVRPUl9FTkFCTEVEID0gNDY7CiAgICAgCiAgICAgQ2FsbGJhY2tQcm94eShFdmVudFNlbmRlciBldmVudFNlbmRlciwgCiAgICAgICAgICAgICBMYXlvdXRUZXN0Q29udHJvbGxlciBsYXlvdXRUZXN0Q29udHJvbGxlcikgewpAQCAtMTc1LDcgKzE3NywxMSBAQAogICAgICAgICAgICAgYnJlYWs7CiAKICAgICAgICAgY2FzZSBMQVlPVVRfRFVNUF9URVhUOgotICAgICAgICAgICAgbUxheW91dFRlc3RDb250cm9sbGVyLmR1bXBBc1RleHQoKTsKKyAgICAgICAgICAgIG1MYXlvdXRUZXN0Q29udHJvbGxlci5kdW1wQXNUZXh0KG1zZy5hcmcxID09IDEpOworICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgY2FzZSBMQVlPVVRfRFVNUF9DSElMRF9GUkFNRVNfVEVYVDoKKyAgICAgICAgICAgIG1MYXlvdXRUZXN0Q29udHJvbGxlci5kdW1wQ2hpbGRGcmFtZXNBc1RleHQoKTsKICAgICAgICAgICAgIGJyZWFrOwogCiAgICAgICAgIGNhc2UgTEFZT1VUX0RVTVBfSElTVE9SWToKQEAgLTI3Myw2ICsyNzksMTAgQEAKICAgICAgICAgICAgIGJvb2xlYW4gdmFsdWUgPSBtc2cuZ2V0RGF0YSgpLmdldEJvb2xlYW4oInZhbHVlIik7CiAgICAgICAgICAgICBtTGF5b3V0VGVzdENvbnRyb2xsZXIub3ZlcnJpZGVQc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XZhCkBAIC00OSw4ICs0OSwxMyBAQAogICAgICAgICAvL25vIGNyZWF0aW9uIG9mIGluc3RhbmNlcwogICAgIH0KIAotICAgIHB1YmxpYyBzdGF0aWMgdm9pZCBmaW5kTGF5b3V0VGVzdHNSZWN1cnNpdmVseShCdWZmZXJlZE91dHB1dFN0cmVhbSBib3MsCisgICAgLyoqCisgICAgICogQHJldHVybiB0aGUgbnVtYmVyIG9mIHRlc3RzIGluIHRoZSBsaXN0LgorICAgICAqLworICAgIHB1YmxpYyBzdGF0aWMgaW50IHdyaXRlTGF5b3V0VGVzdExpc3RSZWN1cnNpdmVseShCdWZmZXJlZE91dHB1dFN0cmVhbSBib3MsCiAgICAgICAgICAgICBTdHJpbmcgZGlyLCBib29sZWFuIGlnbm9yZVJlc3VsdHNJbkRpcikgdGhyb3dzIElPRXhjZXB0aW9uIHsKKworICAgICAgICBpbnQgdGVzdENvdW50ID0gMDsKICAgICAgICAgTG9nLnYoTE9HVEFHLCAiU2VhcmNoaW5nIHRlc3RzIHVuZGVyICIgKyBkaXIpOwogCiAgICAgICAgIEZpbGUgZCA9IG5ldyBGaWxlKGRpcik7CkBAIC02OCw3ICs3Myw3IEBACiAgICAgICAgICAgICAgICAgLy8gSWYgdGhpcyBpcyBub3QgYSB0ZXN0IGRpcmVjdG9yeSwgd2UgZG9uJ3QgcmVjdXJzZSBpbnRvIGl0LgogICAgICAgICAgICAgICAgIGlmICghRmlsZUZpbHRlci5pc05vblRlc3REaXIocykpIHsKICAgICAgICAgICAgICAgICAgICAgTG9nLnYoTE9HVEFHLCAiUmVjdXJzaW5nIG9uICIgKyBzKTsKLSAgICAgICAgICAgICAgICAgICAgZmluZExheW91dFRlc3RzUmVjdXJzaXZlbHkoYm9zLCBzLCBpZ25vcmVSZXN1bHRzSW5EaXIpOworICAgICAgICAgICAgICAgICAgICB0ZXN0Q291bnQgKz0gd3JpdGVMYXlvdXRUZXN0TGlzdFJlY3Vyc2l2ZWx5KGJvcywgcywgaWdub3JlUmVzdWx0c0luRGlyKTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgICB9CkBAIC03OSw3ICs4NCw5IEBACiAgICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgICB9CiAKLSAgICAgICAgICAgIGlmICgocy50b0xvd2VyQ2FzZSgpLmVuZHNXaXRoKCIuaHRtbCIpIHx8IHMudG9Mb3dlckNhc2UoKS5lbmRzV2l0aCgiLnhtbCIpKQorICAgICAgICAgICAgaWYgKChzLnRvTG93ZXJDYXNlKCkuZW5kc1dpdGgoIi5odG1sIikKKyAgICAgICAgICAgICAgICAgICAgfHwgcy50b0xvd2VyQ2FzZSgpLmVuZHNXaXRoKCIueG1sIikKKyAgICAgICAgICAgICAgICAgICAgfHwgcy50b0xvd2VyQ2FzZSgpLmVuZHNXaXRoKCIueGh0bWwiKSkKICAgICAgICAgICAgICAgICAgICAgJiYgIXMuZW5kc1dpdGgoIlRFTVBMQVRFLmh0bWwiKSkgewogICAgICAgICAgICAgICAgIExvZy52KExPR1RBRywgIlJlY29yZGluZyAiICsgcyk7CiAgICAgICAgICAgICAgICAgYm9zLndyaXRlKHMuZ2V0Qnl0ZXMoKSk7CkBAIC04OCw4ICs5NSwxMCBAQAogICAgICAgICAgICAgICAgICAgICBib3Mud3JpdGUoKCIgSUdOT1JFX1JFU1VMVCIpLmdldEJ5dGVzKCkpOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBib3Mud3JpdGUoJ1xuJyk7CisgICAgICAgICAgICAgICAgdGVzdENvdW50Kys7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIHRlc3RDb3VudDsKICAgICB9CiAKICAgICBwdWJsaWMgc3RhdGljIHZvaWQgdXBkYXRlVGVzdFN0YXR1cyhTdHJpbmcgc3RhdHVzRmlsZSwgU3RyaW5nIHMpIHsKZGlmZiAtLWdpdCBhL3Rlc3RzL0R1bXB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sKICAgICAgICAgICAgIExvZy5lKExPR1RBRywgIkVycm9yIHdoaWxlIHJlYWRpbmcgdGVzdCBsaXN0IDogIiArIGUuZ2V0TWVzc2FnZSgpKTsKICAgICAgICAgfQorICAgICAgICBtVGVzdENvdW50ID0gbVRlc3RMaXN0LnNpemUoKTsKICAgICB9CiAKICAgICBwcml2YXRlIHZvaWQgcmVzdW1lVGVzdExpc3QoKSB7CkBAIC0yMDAsNiArMTkyLDcgQEAKICAgICAgICAgICAgICAgICBpZiAobVRlc3RMaXN0LmVsZW1lbnRBdChpKS5lcXVhbHMobGluZSkpIHsKICAgICAgICAgICAgICAgICAgICAgbVRlc3RMaXN0ID0gbmV3IFZlY3RvcjxTdHJpbmc+KG1UZXN0TGlzdC5zdWJMaXN0KGkrMSwgbVRlc3RMaXN0LnNpemUoKSkpOwogICAgICAgICAgICAgICAgICAgICBtVGVzdExpc3RJZ25vcmVSZXN1bHQgPSBuZXcgVmVjdG9yPEJvb2xlYW4+KG1UZXN0TGlzdElnbm9yZVJlc3VsdC5zdWJMaXN0KGkrMSwgbVRlc3RMaXN0SWdub3JlUmVzdWx0LnNpemUoKSkpOworICAgICAgICAgICAgICAgICAgICBtUmVzdW1lSW5kZXggPSBpICsgMTsKICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQpAQCAtMjMyLDE0ICsyMjUsMjIgQEAKICAgICAgICAgLy8gVGhlIGdlbmVyaWMgcmVzdWx0IGlzIGF0IDxwYXRoPi88bmFtZT4tZXhwZWN0ZWQudHh0CiAgICAgICAgIC8vIEZpcnN0IHRyeSB0aGUgQW5kcm9pZC1zcGVjaWZpYyByZXN1bHQgYXQKICAgICAgICAgLy8gcGxhdGZvcm0vYW5kcm9pZC08anMtZW5naW5lPi88cGF0aD4vPG5hbWU+LWV4cGVjdGVkLnR4dAorICAgICAgICAvLyB0aGVuCisgICAgICAgIC8vIHBsYXRmb3JtL2FuZHJvaWQvPHB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5nZXRVcmwoKTsKICAgICAgICAgICAgIExvZy52KExPR1RBRywgImR1bXBBc1RleHQgY2FsbGVkOiAiK3VybCk7CiAgICAgICAgIH0KICAgICB9CiAKKyAgICBwdWJsaWMgdm9pZCBkdW1wQ2hpbGRGcmFtZXNBc1RleHQoKSB7CisgICAgICAgIG1EdW1wRGF0YVR5cGUgPSBEdW1wRGF0YVR5cGUuRFVNUF9BU19URVhUOworICAgICAgICBtRHVtcENoaWxkRnJhbWVzQXNUZXh0ID0gdHJ1ZTsKKyAgICAgICAgaWYgKG1XZWJWaWV3ICE9IG51bGwpIHsKKyAgICAgICAgICAgIFN0cmluZyB1cmwgPSBtV2ViVmlldy5nZXRVcmwoKTsKKyAgICAgICAgICAgIExvZy52KExPR1RBRywgImR1bXBDaGlsZEZyYW1lc0FzVGV4dCBjYWxsZWQ6ICIrdXJsKTsKKyAgICAgICAgfQorICAgIH0KKwogICAgIHB1YmxpYyB2b2lkIHdhaXRVbnRpbERvbmUoKSB7CiAgICAgICAgIG1XYWl0VW50aWxEb25lID0gdHJ1ZTsKICAgICAgICAgU3RyaW5nIHVybCA9IG1XZWJWaWV3LmdldFVybCgpOwpAQCAtMzQ4LDcgKzM4MSw5IEBACiAgICAgICAgIExvZy52KExPR1RBRywgIm5vdGlmeURvbmUgY2FsbGVkOiAiICsgdXJsKTsKICAgICAgICAgaWYgKG1XYWl0VW50aWxEb25lKSB7CiAgICAgICAgICAgICBtV2FpdFVudGlsRG9uZSA9IGZhbHNlOwotICAgICAgICAgICAgbUNocm9tZUNsaWVudC5vblByb2dyZXNzQ2hhbmdlZChtV2ViVmlldywgMTAxKTsKKyAgICAgICAgICAgIGlmICghbVJlcXVlc3RlZFdlYktpdERhdGEgJiYgIW1UaW1lZE91dCAmJiAhZmluaXNoZWQoKSkgeworICAgICAgICAgICAgICAgIHJlcXVlc3RXZWJLaXREYXRhKCk7CisgICAgICAgICAgICB9CiAgICAgICAgIH0KICAgICB9CiAKQEAgLTQ1OSw4ICs0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OwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KKwogICAgICAgICAgICAgLy8gQ2FsbGluZyBmaW5pc2hlZCgpIHdpbGwgY2hlY2sgaWYgd2UndmUgbWV0IGFsbCB0aGUgY29uZGl0aW9ucyBmb3IgY29tcGxldGluZwotICAgICAgICAgICAgLy8gdGhpcyB0ZXN0IGFuZCBtb3ZlIHRvIHRoZSBuZXh0IG9uZSBpZiB3ZSBhcmUgcmVhZHkuCisgICAgICAgICAgICAvLyB0aGlzIHRlc3QgYW5kIG1vdmUgdG8gdGhlIG5leHQgb25lIGlmIHdlIGFyZSByZWFkeS4gT3RoZXJ3aXNlIHdlIGFzayBXZWJDb3JlIHRvCisgICAgICAgICAgICAvLyBkdW1wIHRoZSBwYWdlLgogICAgICAgICAgICAgaWYgKGZpbmlzaGVkKCkpIHsKICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmICghbVdhaXRVbnRpbERvbmUgJiYgIW1SZXF1ZXN0ZWRXZWJLaXREYXRhICYmICFtVGltZWRPdXQpIHsKKyAgICAgICAgICAgICAgICByZXF1ZXN0V2ViS2l0RGF0YSgpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBpZiAobVdhaXRVbnRpbERvbmUpIHsKKyAgICAgICAgICAgICAgICAgICAgTG9nLnYoTE9HVEFHLCAicGFnZSBmaW5pc2hlZCBsb2FkaW5nIGJ1dCB3YWl0aW5nIGZvciBub3RpZnlEb25lIHRvIGJlIGNhbGxlZDogIiArIHVybCk7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgaWYgKG1SZXF1ZXN0ZWRXZWJLaXREYXRhKSB7CisgICAgICAgICAgICAgICAgICAgIExvZy52KExPR1RBRywgInBhZ2UgZmluaXNoZWQgbG9hZGluZyBidXQgd2Via2l0IGRhdGEgaGFzIGFscmVhZHkgYmVlbiByZXF1ZXN0ZWQ6ICIgKyB1cmwpOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIGlmIChtVGltZWRPdXQpIHsKKyAgICAgICAgICAgICAgICAgICAgTG9nLnYoTE9HVEFHLCAicGFnZSBmaW5pc2hlZCBsb2FkaW5nIGJ1dCBhbHJlYWR5IHRpbWVkIG91dDogIiArIHVybCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorCiAgICAgICAgICAgICBzdXBlci5vblBhZ2VGaW5pc2hlZCh2aWV3LCB1cmwpOwogICAgICAgICB9CiAKQEAgLTUzNiw0NCArNjExLDggQEAKIAogICAgIHByaXZhdGUgZmluYWwgV2ViQ2hyb21lQ2xpZW50IG1DaHJvbWVDbGllbnQgPSBuZXcgV2ViQ2hyb21lQ2xpZW50KCkgewogICAgICAgICBAT3ZlcnJpZGUKLSAgICAgICAgcHVibGljIHZvaWQgb25Qcm9ncmVzc0NoYW5nZWQoV2ViVmlldyB2aWV3LCBpbnQgbmV3UHJvZ3Jlc3MpIHsKLQotICAgICAgICAgICAgLy8gbm90aWZ5RG9uZSBjYWxscyB0aGlzIHdpdGggMTAxJS4gV2Ugb25seSB3YW50IHRvIHVwZGF0ZSB0aGlzIGZsYWcgaWYgdGhpcwotICAgICAgICAgICAgLy8gaXMgdGhlIHJlYWwgY2FsbCBmcm9tIFdlYkNvcmUuCi0gICAgICAgICAgICBpZiAobmV3UHJvZ3Jlc3MgPT0gMTAwKSB7Ci0gICAgICAgICAgICAgICAgbU9uZUh1bmRyZWRQZXJjZW50Q29tcGxldGUgPSB0cnVlOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAvLyBXaXRoIHRoZSBmbGFnIHVwZGF0ZWQsIHdlIGNhbiBub3cgcHJvY2VlZCBhcyBub3JtYWwgd2hldGhlciB0aGUgcHJvZ3Jlc3MgdXBkYXRlIGNhbWUgZnJvbQotICAgICAgICAgICAgLy8gV2ViQ29yZSBvciBub3RpZnlEb25lLgotICAgICAgICAgICAgaWYgKG5ld1Byb2dyZXNzID49IDEwMCkgewotICAgICAgICAgICAgICAgIC8vIGZpbmlzaGVkKCkgd2lsbCBjaGVjayBpZiB3ZSBhcmUgcmVhZHkgdG8gbW92ZSB0byB0aGUgbmV4dCB0ZXN0IGFuZCBkbyBzbyBpZiB3ZSBhcmUuCi0gICAgICAgICAgICAgICAgaWYgKGZpbmlzaGVkKCkpIHsKLSAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwotICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgIGlmICghbVRpbWVkT3V0ICYmICFtV2FpdFVudGlsRG9uZSAmJiAhbVJlcXVlc3RlZFdlYktpdERhdGEpIHsKLSAgICAgICAgICAgICAgICAgICAgU3RyaW5nIHVybCA9IG1XZWJWaWV3LmdldFVybCgpOwotICAgICAgICAgICAgICAgICAgICBMb2cudihMT0dUQUcsICJGaW5pc2hlZDogIisgdXJsKTsKLSAgICAgICAgICAgICAgICAgICAgcmVxdWVzdFdlYktpdERhdGEoKTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICBTdHJpbmcgdXJsID0gbVdlYlZpZXcuZ2V0VXJsKCk7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChtVGltZWRPdXQpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIExvZy52KExPR1RBRywgIlRpbWVkIG91dCBiZWZvcmUgZmluaXNoaW5nOiAiICsgdXJsKTsKLSAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChtV2FpdFVudGlsRG9uZSkgewotICAgICAgICAgICAgICAgICAgICAgICAgTG9nLnYoTE9HVEFHLCAiV2FpdGluZyBmb3Igbm90aWZ5RG9uZTogIiArIHVybCk7Ci0gICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAobVJlcXVlc3RlZFdlYktpdERhdGEpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIExvZy52KExPR1RBRywgIlJlcXVlc3RlZCB3ZWJraXQgZGF0YSByZWFkeTogIiArIHVybCk7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQotICAgICAgICBAT3ZlcnJpZGUKICAgICAgICAgcHVibGljIHZvaWQgb25SZWNlaXZlZFRpdGxlKFdlYlZpZXcgdmlldywgU3RyaW5nIHRpdGxlKSB7Ci0gICAgICAgICAgICBpZiAodGl0bGUubGVuZ3RoKCkgPiAzMCkKLSAgICAgICAgICAgICAgICB0aXRsZSA9ICIuLi4iK3RpdGxlLnN1YnN0cmluZyh0aXRsZS5sZW5ndGgoKS0zMCk7Ci0gICAgICAgICAgICBzZXRUaXRsZSh0aXRsZSk7CisgICAgICAgICAgICBzZXRUaXRsZSgiVGVzdCAiICsgbUN1cnJlbnRUZXN0TnVtYmVyICsgIiBvZiAiICsgbVRvdGFsVGVzdENvdW50ICsgIjogIisgdGl0bGUpOwogICAgICAgICAgICAgaWYgKG1EdW1wVGl0bGVDaGFuZ2VzKSB7CiAgICAgICAgICAgICAgICAgbVRpdGxlQ2hhbmdlcy5hcHBlbmQoIlRJVExFIENIQU5HRUQ6ICIpOwogICAgICAgICAgICAgICAgIG1UaXRsZUNoYW5nZXMuYXBwZW5kKHRpdGxlKTsKQEAgLTY3MCwyMSArNzA5LDQwIEBACiAgICAgICAgIEBPdmVycmlkZQogICAgICAgICBwdWJsaWMgdm9pZCBvbkdlb2xvY2F0aW9uUGVybWlzc2lvbnNTaG93UHJvbXB0KFN0cmluZyBvcmlnaW4sCiAgICAgICAgICAgICAgICAgR2VvbG9jYXRpb25QZXJtaXNzaW9ucy5DYWxsYmFjayBjYWxsYmFjaykgewotICAgICAgICAgICAgaWYgKG1HZW9sb2NhdGlvblBlcm1pc3Npb25TZXQpIHsKKyAgICAgICAgICAgIGlmIChtSXNHZW9sb2NhdGlvblBlcm1pc3Npb25TZXQpIHsKICAgICAgICAgICAgICAgICBjYWxsYmFjay5pbnZva2Uob3JpZ2luLCBtR2VvbG9jYXRpb25QZXJtaXNzaW9uLCBmYWxzZSk7CisgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKG1QZW5kaW5nR2VvbG9jYXRpb25QZXJtaXNzaW9uQ2FsbGJhY2tzID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICBtUGVuZGluZ0dlb2xvY2F0aW9uUGVybWlzc2lvbkNhbGxiYWNrcyA9CisgICAgICAgICAgICAgICAgICAgICAgICBuZXcgSGFzaE1hcDxHZW9sb2NhdGlvblBlcm1pc3Npb25zLkNhbGxiYWNrLCBTdHJpbmc+KCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBtUGVuZGluZ0dlb2xvY2F0aW9uUGVybWlzc2lvbkNhbGxiYWNrcy5wdXQoY2FsbGJhY2ssIG9yaWdpbik7CiAgICAgICAgIH0KIAogICAgICAgICBAT3ZlcnJpZGUKLSAgICAgICAgcHVibGljIHZvaWQgb25Db25zb2xlTWVzc2FnZShTdHJpbmcgbWVzc2FnZSwgaW50IGxpbmVOdW1iZXIsCi0gICAgICAgICAgICAgICAgU3RyaW5nIHNvdXJjZUlEKSB7CisgICAgICAgIHB1YmxpYyBib29sZWFuIG9uQ29uc29sZU1lc3NhZ2UoQ29uc29sZU1lc3NhZ2UgY29uc29sZU1lc3NhZ2UpIHsKKyAgICAgICAgICAgIFN0cmluZyBtc2cgPSAiQ09OU09MRSBNRVNTQUdFOiBsaW5lICIgKyBjb25zb2xlTWVzc2FnZS5saW5lTnVtYmVyKCkgKyAiOiAiCisgICAgICAgICAgICAgICAgICAgICsgY29uc29sZU1lc3NhZ2UubWVzc2FnZSgpICsgIlxuIjsKICAgICAgICAgICAgIGlmIChtQ29uc29sZU1lc3NhZ2VzID09IG51bGwpIHsKICAgICAgICAgICAgICAgICBtQ29uc29sZU1lc3NhZ2VzID0gbmV3IFN0cmluZ0J1ZmZlcigpOwogICAgICAgICAgICAgfQotICAgICAgICAgICAgU3RyaW5nIGNvbnNvbGVNZXNzYWdlID0gIkNPTlNPTEUgTUVTU0FHRTogbGluZSAiCi0gICAgICAgICAgICAgICAgICAgICsgbGluZU51bWJlciArIjogIisgbWVzc2FnZSArIlxuIjsKLSAgICAgICAgICAgIG1Db25zb2xlTWVzc2FnZXMuYXBwZW5kKGNvbnNvbGVNZXNzYWdlKTsKLSAgICAgICAgICAgIExvZy52KExPR1RBRywgIkxPRzogIitjb25zb2xlTWVzc2FnZSk7CisgICAgICAgICAgICBtQ29uc29sZU1lc3NhZ2VzLmFwcGVuZChtc2cpOworICAgICAgICAgICAgTG9nLnYoTE9HVEFHLCAiTE9HOiAiICsgbXNnKTsKKyAgICAgICAgICAgIC8vIHRoZSByYXRpb25hbGUgaGVyZSBpcyB0aGF0IGlmIHRoZXJlJ3MgYW4gZXJyb3Igb2YgZWl0aGVyIHR5cGUsIGFuZCB0aGUgdGVzdCB3YXMKKyAgICAgICAgICAgIC8vIHdhaXRpbmcgZm9yICJub3RpZnlEb25lIiBzaWduYWwgdG8gZmluaXNoLCB0aGVuIHRoZXJlJ3Mgbm8gcG9pbnQgaW4gd2FpdGluZworICAgICAgICAgICAgLy8gYW55bW9yZSBiZWNhdXNlIHRoZSBKUyBleGVjdXRpb24gaXMgYWxyZWFkeSB0ZXJtaW5hdGVkIGF0IHRoaXMgcG9pbnQgYW5kIGEKKyAgICAgICAgICAgIC8vICJub3RpZnlEb25lIiB3aWxsIG5ldmVyIGNvbWUgb3V0IHNvIGl0J3MganVzdCB3YXN0aW5nIHRpbWUgdGlsbCB0aW1lb3V0IGtpY2tzIGluCisgICAgICAgICAgICBpZiAoKG1zZy5jb250YWlucygiVW5jYXVnaHQgUmVmZXJlbmNlRXJyb3I6IikgfHwgbXNnLmNvbnRhaW5zKCJVbmNhdWdodCBUeXBlRXJyb3I6IikpCisgICAgICAgICAgICAgICAgICAgICYmIG1XYWl0VW50aWxEb25lICYmIG1TdG9wT25SZWZFcnJvcikgeworICAgICAgICAgICAgICAgIExvZy53KExPR1RBRywgIlRlcm1pbmF0aW5nIHRlc3QgY2FzZSBvbiB1bmNhdWdodCBSZWZlcmVuY2VFcnJvciBvciBUeXBlRXJyb3IuIik7CisgICAgICAgICAgICAgICAgbUhhbmRsZXIucG9zdERlbGF5ZWQobmV3IFJ1bm5hYmxlKCkgeworICAgICAgICAgICAgICAgICAgICBwdWJsaWMgdm9pZCBydW4oKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBub3RpZnlEb25lKCk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9LCA1MDApOworICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgIH0KIAogICAgICAgICBAT3ZlcnJpZGUKQEAgLTcyMywxMyArNzgxLDE1IEBACiAKICAgICBwcml2YXRlIHN0YXRpYyBjbGFzcyBOZXdXaW5kb3dXZWJWaWV3IGV4dGVuZHMgV2ViVmlldyB7CiAgICAgICAgIHB1YmxpYyBOZXdXaW5kb3dXZWJWaWV3KENvbnRleHQgY29udGV4dCwgTWFwPFN0cmluZywgT2JqZWN0PiBqc0lmYWNlcykgewotICAgICAgICAgICAgc3VwZXIoY29udGV4dCwgbnVsbCwgMCwganNJZmFjZXMpOworICAgICAgICAgICAgc3VwZXIoY29udGV4dCwgbnVsbCwgMCwganNJZmFjZXMsIGZhbHNlKTsKICAgICAgICAgfQogICAgIH0KIAogICAgIHByaXZhdGUgdm9pZCByZXNldFRlc3RTdGF0dXMoKSB7CiAgICAgICAgIG1XYWl0VW50aWxEb25lID0gZmFsc2U7CiAgICAgICAgIG1EdW1wRGF0YVR5cGUgPSBtRGVmYXVsdER1bXBEYXRhVHlwZTsKKyAgICAgICAgbUR1bXBUb3BGcmFtZUFzVGV4dCA9IGZhbHNlOworICAgICAgICBtRHVtcENoaWxkRnJhbWVzQXNUZXh0ID0gZmFsc2U7CiAgICAgICAgIG1UaW1lZE91dCA9IGZhbHNlOwogICAgICAgICBtRHVtcFRpdGx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AiQWJzdHJhY3RSZXN1bHQiOworCisgICAgcHVibGljIGVudW0gVGVzdFR5cGUgeworICAgICAgICBURVhUIHsKKyAgICAgICAgICAgIEBPdmVycmlkZQorICAgICAgICAgICAgcHVibGljIEFic3RyYWN0UmVzdWx0IGNyZWF0ZVJlc3VsdChCdW5kbGUgYnVuZGxlKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBUZXh0UmVzdWx0KGJ1bmRsZSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0sCisgICAgICAgIFJFTkRFUl9UUkVFIHsKKyAgICAgICAgICAgIEBPdmVycmlkZQorICAgICAgICAgICAgcHVibGljIEFic3RyYWN0UmVzdWx0IGNyZWF0ZVJlc3VsdChCdW5kbGUgYnVuZGxlKSB7CisgICAgICAgICAgICAgICAgLyoqIFRPRE86IFJlbmRlclRyZWUgdGVzdHMgYXJlIG5vdCB5ZXQgc3VwcG9ydGVkICovCisgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgICAgICB9CisgICAgICAgIH07CisKKyAgICAgICAgcHVibGljIGFic3RyYWN0IEFic3RyYWN0UmVzdWx0IGNyZWF0ZVJlc3VsdChCdW5kbGUgYnVuZGxlKTsKKyAgICB9CisKKyAgICBwdWJsaWMgZW51bSBSZXN1bHRDb2RlIHsKKyAgICAgICAgUEFTUygiUGFzc2VkIiksCisgICAgICAgIEZBSUxfUkVTVUxUX0RJRkZFUlMoIlJlc3VsdCBkaWZmZXJzIiksCisgICAgICAgIEZBSUxfTk9fRVhQRUNURURfUkVTVUxUKCJObyBleHBlY3RlZCByZXN1bHQiKSwKKyAgICAgICAgRkFJTF9USU1FRF9PVVQoIlRpbWVkIG91dCIpLAorICAgICAgICBGQUlMX0NSQVNIRUQoIkNyYXNoZWQiKTsKKworICAgICAgICBwcml2YXRlIFN0cmluZyBtVGl0bGU7CisKKyAgICAgICAgcHJpdmF0ZSBSZXN1bHRDb2RlKFN0cmluZyB0aXRsZSkgeworICAgICAgIC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dHlwZXMgYXBwZWFyIGhlcmUuCisgICAgICovCisgICAgcHJpdmF0ZSBlbnVtIE91dHB1dFR5cGUgeworICAgICAgICBKU19ESUFMT0csCisgICAgICAgIEVYQ0VFREVEX0RCX1FVT1RBX01FU1NBR0UsCisgICAgICAgIENPTlNPTEVfTUVTU0FHRTsKKyAgICB9CisKKyAgICBTdHJpbmdCdWlsZGVyW10gbU91dHB1dHMgPSBuZXcgU3RyaW5nQnVpbGRlcltPdXRwdXRUeXBlLnZhbHVlcygpLmxlbmd0aF07CisKKyAgICBwcml2YXRlIFN0cmluZ0J1aWxkZXIgZ2V0U3RyaW5nQnVpbGRlckZvclR5cGUoT3V0cHV0VHlwZSBvdXRwdXRUeXBlKSB7CisgICAgICAgIGludCBpbmRleCA9IG91dHB1dFR5cGUub3JkaW5hbCgpOworICAgICAgICBpZiAobU91dHB1dHNbaW5kZXhdID09IG51bGwpIHsKKyAgICAgICAgICAgIG1PdXRwdXRzW2luZGV4XSA9IG5ldyBTdHJpbmdCdWlsZGVyKCk7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIG1PdXRwdXRzW2luZGV4XTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBhcHBlbmRFeGNlZWRlZERiUXVvdGFNZXNzYWdlKFN0cmluZyB1cmxTdHJpbmcsIFN0cmluZyBkYXRhYmFzZUlkZW50aWZpZXIpIHsKKyAgICAgICAgU3RyaW5nQnVpbGRlciBvdXRwdXQgPSBnZXRTdHJpbmdCdWlsZGVyRm9yVHlwZShPdXRwdXRUeXBlLkVYQ0VFREVEX0RCX1FVT1RBX01FU1NBR0UpOworCisgICAgICAgIFN0cmluZyBwcm90b2NvbCA9ICIiOworICAgICAgICBTdHJpbmcgaG9zdCA9ICIiOworICAgICAgICBpbnQgcG9ydCA9IDA7CisKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIFVSTCB1cmwgPSBuZXcgVVJMKHVybFN0cmluZyk7CisgICAgICAgICAgICBwcm90b2N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VtbXlSZXN1bHQoU3RyaW5nIHJlbGF0aXZlUGF0aCkgeworICAgICAgICBtUmVsYXRpdmVQYXRoID0gcmVsYXRpdmVQYXRoOworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyBieXRlW10gZ2V0QWN0dWFsSW1hZ2VSZXN1bHQoKSB7CisgICAgICAgIHJldHVybiBudWxsOworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyBTdHJpbmcgZ2V0QWN0dWFsVGV4dFJlc3VsdCgpIHsKKyAgICAgICAgcmV0dXJuIG51bGw7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIEJ1bmRsZSBnZXRCdW5kbGUoKSB7CisgICAgICAgIC8qKiBUT0RPOiAgKi8KKyAgICAgICAgcmV0dXJuIG51bGw7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIFN0cmluZyBnZXREaWZmQXNIdG1sKCkgeworICAgICAgICAvKiogVE9ETzogUHJvYmFibHkgc2hvdyBhdCBsZWFzdCBleHBlY3RlZCByZXN1bHRzICovCisgICAgICAgIHJldHVybiAiT29vcHMsIEkgY3Jhc2hlZC4uLiI7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIFN0cmluZyBnZXRSZWxhdGl2ZVBhdGgoKSB7CisgICAgICAgIHJldHVybiBtUmVsYXRpdmVQYXRoOworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyBSZXN1bHRDb2RlIGdldFJlc3VsdENvZGUoKSB7CisgICAgICAgIHJldHVybiBSZXN1bHRDb2RlLkZBSUxfQ1JBU0hFRDsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgVGVzdFR5cGUgZ2V0VHlwZSgpIHsKKyAgICAgICAgcmV0dXJuIG51bGw7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgb2J0YWluQWN0dWFsUmVzdWx0cyhX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QgY29udGFpbnMgdGhlIGxvZ2ljIG9mIGhvdyB0byBleGVjdXRlIHRoZSBtZXRob2RzLgorICovCitwdWJsaWMgY2xhc3MgRXZlbnRTZW5kZXIgeworICAgIEV2ZW50U2VuZGVySW1wbCBtRXZlbnRTZW5kZXJJbXBsID0gbmV3IEV2ZW50U2VuZGVySW1wbCgpOworCisgICAgcHVibGljIHZvaWQgcmVzZXQoV2ViVmlldyB3ZWJWaWV3KSB7CisgICAgICAgIG1FdmVudFNlbmRlckltcGwucmVzZXQod2ViVmlldyk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgZW5hYmxlRE9NVUlFdmVudExvZ2dpbmcoaW50IGRvbU5vZGUpIHsKKyAgICAgICAgbUV2ZW50U2VuZGVySW1wbC5lbmFibGVET01VSUV2ZW50TG9nZ2luZyhkb21Ob2RlKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBmaXJlS2V5Ym9hcmRFdmVudHNUb0VsZW1lbnQoaW50IGRvbU5vZGUpIHsKKyAgICAgICAgbUV2ZW50U2VuZGVySW1wbC5maXJlS2V5Ym9hcmRFdmVudHNUb0VsZW1lbnQoZG9tTm9kZSk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQga2V5RG93bihTdHJpbmcgY2hhcmFjdGVyLCBTdHJpbmdbXSB3aXRoTW9kaWZpZXJzKSB7CisgICAgICAgIG1FdmVudFNlbmRlckltcGwua2V5RG93bihjaGFyYWN0ZXIsIHdpdGhNb2RpZmllcnMpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIGtleURvd24oU3RyaW5nIGNoYXJhY3RlcikgeworICAgICAgICBrZXlEb3duKGNoYXJhY3RlciwgbnVsbCk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgbGVhcEZvcndhcmQoaW50IG1pbGxpc2Vjb25kcykgeworICAgICAgICBtRXZlbnRTZW5kZXJJbXBsLmxlYXBGb3J3YXJkKG1pbGxpc2Vjb25kcyk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgbW91c2VDbGljaygpIHsKKyAgICAgICAgbUV2ZW50U2VuZGVySW1wbC5tb3VzZUNsaWNrKCk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgbW91c2VEb3duKCkgeworICAgICAgICBtRXZlbnRTZW5kZXJJbXBsLm1vdXNlRG93bigpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIG1vdXNlTW92ZVRvKGludCB4LCBpbnQgeSkgeworICAgICAgICBtRXZlbnRTZW5kZXJJbXBsLm1vdXNlTW92ZVRvKHgsIHkpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIG1vdXNlVXAoKSB7CisgICAgICAgIG1FdmVudFNlbmRlckltcGwubW91c2VVcCgpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHRvdWNoU3RhcnQoKSB7CisgICAgICAgIG1FdmVudFNlbmRlckltcGwudG91Y2hTdGFydCgpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIGFkZFRvdWNoUG9pbnQoaW50IHgsIGludCB5KSB7CisgICAgICAgIG1FdmVudFNlbmRlckltcGwuYWRkVG91Y2hQb2ludCh4LCB5KTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCB1cGRhdGVUb3VjaFBvaW50KGludCBpZCwgaW50IHgsIGludCB5KSB7CisgICAgICAgIG1FdmVudFNlbmRlckltcGwudXBkYXRlVG91Y2hQb2ludChpZCwgeCwgeSk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgc2V0VG91Y2hNb2RpZmllcihTdHJpbmcgbW9kaWZpZXIsIGJvb2xlYW4gZW5hYmxlZCkgeworICAgICAgICBtRXZlbnRTZW5kZXJJbXBsLnNldFRvdWNoTW9kaWZpZXIobW9kaWZpZXIsIGVuYWJsZWQpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHRvdWNoTW92ZSgpIHsKKyAgICAgICAgbUV2ZW50U2VuZGVySW1wbC50b3VjaE1vdmUoKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm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isgICAgICAgICAgICBtWCA9IHNjYWxlWCh4KTsKKyAgICAgICAgICAgIG1ZID0gc2NhbGVZKHkpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIGludCBnZXRYKCkgeworICAgICAgICAgICAgcmV0dXJuIG1YOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIGludCBnZXRZKCkgeworICAgICAgICAgICAgcmV0dXJuIG1ZOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIGJvb2xlYW4gaGFzTW92ZWQoKSB7CisgICAgICAgICAgICByZXR1cm4gbU1vdmVkOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgbW92ZShpbnQgbmV3WCwgaW50IG5ld1kpIHsKKyAgICAgICAgICAgIG1YID0gc2NhbGVYKG5ld1gpOworICAgICAgICAgICAgbVkgPSBzY2FsZVkobmV3WSk7CisgICAgICAgICAgICBtTW92ZWQgPSB0cnVlOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgcmVzZXRIYXNNb3ZlZCgpIHsKKyAgICAgICAgICAgIG1Nb3ZlZCA9IGZhbHNlOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIGxvbmcgZ2V0RG93blRpbWUoKSB7CisgICAgICAgICAgICByZXR1cm4gbURvd25UaW1lOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgc2V0RG93blRpbWUobG9uZyBkb3duVGltZSkgeworICAgICAgICAgICAgbURvd25UaW1lID0gZG93blRpbWU7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgYm9vbGVhbiBpc1JlbGVhc2VkKCkgeworICAgICAgICAgICAgcmV0dXJuIG1SZWxlYXNlZDsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyB2b2lkIHJlbGVhc2UoKSB7CisgICAgICAgICAgICBtUmVsZWFzZWQgPSB0cnVlOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIGJvb2xlYW4gaXNDYW5jZWxsZWQoKSB7CisgICAgICAgICAgICByZXR1cm4gbUNhbmNlbGxlZDsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyB2b2lkIGNhbmNlbCgpIHsKKyAgICAgICAgICAgIG1DYW5jZWxsZWQgPSB0cnVlOworICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSBpbnQgc2NhbGVYKGludCB4KSB7CisgICAgICAgICAgICByZXR1cm4gKGludCkoeCAqIG1XZWJWaWV3LmdldFNjYWxlKCkpIC0gbVdlYlZpZXcuZ2V0U2Nyb2xsWCgpOworICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSBpbnQgc2NhbGVZKGludCB5KSB7CisgICAgICAgICAgICByZXR1cm4gKGludCkoeSAqIG1XZWJWaWV3LmdldFNjYWxlKCkpIC0gbVdlYlZpZXcuZ2V0U2Nyb2xsWSgpOworICAgICAgICB9CisgICAgfQorCisgICAgcHJpdmF0ZSBMaXN0PFRvdWNoUG9pbnQ+IG1Ub3VjaFBvaW50czsKKyAgICBwcml2YXRlIGludCBtVG91Y2hNZXRhU3RhdGU7CisgICAgcHJpdmF0ZSBpbnQgbU1vdXNlWDsKKyAgICBwcml2YXRlIGludCBtTW91c2VZOworCisgICAgcHJpdmF0ZSBXZWJWaWV3IG1XZWJWaWV3OworCisgICAgcHJpdmF0ZSBIYW5kbGVyIG1FdmVudFNlbmRlckhhbmRsZXIgPSBuZXcgSGFuZGxlcigpIHsKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyB2b2lkIGhhbmRsZU1lc3NhZ2UoTWVzc2FnZSBtc2cpIHsKKyAgICAgICAgICAgIFRvdWNoUG9pbnQgdG91Y2hQb2ludDsKKyAgICAgICAgICAgIEJ1bmRsZSBidW5kbGU7CisgICAgICAgICAgICBLZXlFdmVudCBldmVudDsKKworICAgICAgICAgICAgc3dpdGNoIChtc2cud2hhdCkgeworICAgICAgICAgICAgICAgIGNhc2UgTVNHX0VOQUJMRV9ET01fVUlfRVZFTlRfTE9HR0lORzoKKyAgICAgICAgICAgICAgICAgICAgLyoqIFRPRE86IGltcGxlbWVudCAqLworICAgICAgICAgICAgICAgICAgICBicmVhazsKKworICAgICAgICAgICAgICAgIGNhc2UgTVNHX0ZJUkVfS0VZQk9BUkRfRVZFTlRTX1RPX0VMRU1FTlQ6CisgICAgICAgICAgICAgICAgICAgIC8qKiBUT0RPOiBpbXBsZW1lbnQgKi8KKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICAgICAgICBjYXNlIE1TR19MRUFQX0ZPUldBUkQ6CisgICAgICAgICAgICAgICAgICAgIC8qKiBUT0RPOiBpbXBsZW1lbnQgKi8KKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICAgICAgICBjYXNlIE1TR19LRVlfRE9XTjoKKyAgICAgICAgICAgICAgICAgICAgYnVuZGxlID0gKEJ1bmRsZSltc2cub2JqOworICAgICAgICAgICAgICAgICAgICBTdHJpbmcgY2hhcmFjdGVyID0gYnVuZGxlLmdldFN0cmluZygiY2hhcmFjdGVyIik7CisgICAgICAgICAgICAgICAgICAgIFN0cmluZ1tdIHdpdGhNb2RpZmllcnMgPSBidW5kbGUuZ2V0U3RyaW5nQXJyYXkoIndpdGhNb2RpZmllcnMiKTsKKworICAgICAgICAgICAgICAgICAgICBpZiAod2l0aE1vZGlmaWVycyAhPSBudWxsICYmIHdpdGhNb2RpZmllcnMubGVuZ3RoID4gMCkgeworICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCB3aXRoTW9kaWZpZXJzLmxlbmd0aDsgaSsrKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXhlY3V0ZUtleUV2ZW50KEtleUV2ZW50LkFDVElPTl9ET1dOLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kaWZpZXJUb0tleUNvZGUod2l0aE1vZGlmaWVyc1tpXSkpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGV4ZWN1dGVLZXlFdmVudChLZXlFdmVudC5BQ1RJT05fRE9XTiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGFyVG9LZXlDb2RlKGNoYXJhY3Rlci50b0xvd2VyQ2FzZSgpLnRvQ2hhckFycmF5KClbMF0pKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICAgICAgICAvKiogTU9VU0UgKi8KKworICAgICAgICAgICAgICAgIGNhc2UgTVNHX01PVVNFX0RPV046CisgICAgICAgICAgICAgICAgICAgIC8qKiBUT0RPOiBJbXBsZW1lbnQgKi8KKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICAgICAgICBjYXNlIE1TR19NT1VTRV9VUDoKKyAgICAgICAgICAgICAgICAgICAgLyoqIFRPRE86IEltcGxlbWVudCAqLworICAgICAgICAgICAgICAgICAgICBicmVhazsKKworICAgICAgICAgICAgICAgIGNhc2UgTVNHX01PVVNFX0NMSUNLOgorICAgICAgICAgICAgICAgICAgICAvKiogVE9ETzogSW1wbGVtZW50ICovCisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICAgICAgY2FzZSBNU0dfTU9VU0VfTU9WRV9UTzoKKyAgICAgICAgICAgICAgICAgICAgaW50IHggPSBtc2cuYXJnMTsKKyAgICAgICAgICAgICAgICAgICAgaW50IHkgPSBtc2cuYXJnMjsKKworICAgICAgICAgICAgICAgICAgICBldmVudCA9IG51bGw7CisgICAgICAgICAgICAgICAgICAgIGlmICh4ID4gbU1vdXNlWCkgeworICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnQgPSBuZXcgS2V5RXZlbnQoS2V5RXZlbnQuQUNUSU9OX0RPV04sIEtleUV2ZW50LktFWUNPREVfRFBBRF9SSUdIVCk7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoeCA8IG1Nb3VzZVgpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50ID0gbmV3IEtleUV2ZW50KEtleUV2ZW50LkFDVElPTl9ET1dOLCBLZXlFdmVudC5LRVlDT0RFX0RQQURfTEVGVCk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgaWYgKGV2ZW50ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1XZWJWaWV3Lm9uS2V5RG93bihldmVudC5nZXRLZXlDb2RlKCksIGV2ZW50KTsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1XZWJWaWV3Lm9uS2V5VXAoZXZlbnQuZ2V0S2V5Q29kZSgpLCBldmVudCk7CisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICBldmVudCA9IG51bGw7CisgICAgICAgICAgICAgICAgICAgIGlmICh5ID4gbU1vdXNlWSkgeworICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnQgPSBuZXcgS2V5RXZlbnQoS2V5RXZlbnQuQUNUSU9OX0RPV04sIEtleUV2ZW50LktFWUNPREVfRFBBRF9ET1dOKTsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICh5IDwgbU1vdXNlWSkgeworICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnQgPSBuZXcgS2V5RXZlbnQoS2V5RXZlbnQuQUNUSU9OX0RPV04sIEtleUV2ZW50LktFWUNPREVfRFBBRF9VUCk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgaWYgKGV2ZW50ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1XZWJWaWV3Lm9uS2V5RG93bihldmVudC5nZXRLZXlDb2RlKCksIGV2ZW50KTsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1XZWJWaWV3Lm9uS2V5VXAoZXZlbnQuZ2V0S2V5Q29kZSgpLCBldmVudCk7CisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICBtTW91c2VYID0geDsKKyAgICAgICAgICAgICAgICAgICAgbU1vdXNlWSA9IHk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICAgICAgLyoqIFRPVUNIICovCisKKyAgICAgICAgICAgICAgICBjYXNlIE1TR19BRERfVE9VQ0hfUE9JTlQ6CisgICAgICAgICAgICAgICAgICAgIGdldFRvdWNoUG9pbnRzKCkuYWRkKG5ldyBUb3VjaFBvaW50KG1XZWJWaWV3LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1zZy5hcmcxLCBtc2cuYXJnMikpOworICAgICAgICAgICAgICAgICAgICBpZiAoZ2V0VG91Y2hQb2ludHMoKS5zaXplKCkgPiAxKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBMb2cudyhMT0dfVEFHICsgIjo6TVNHX0FERF9UT1VDSF9QT0lOVCIsICJBZGRlZCBtb3JlIHRoYW4gb25lIHRvdWNoIHBvaW50Iik7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICAgICAgICBjYXNlIE1TR19UT1VDSF9TVEFSVDoKKyAgICAgICAgICAgICAgICAgICAgLyoqCisgICAgICAgICAgICAgICAgICAgICAqIEZJWE1FOiBBdCB0aGUgbW9tZW50IHdlIGRvbid0IHN1cHBvcnQgbXVsdGktdG91Y2guIEhlbmNlLCB3ZSBvbmx5IGV4YW1pbmUKKyAgICAgICAgICAgICAgICAgICAgICogdGhlIGZpcnN0IHRvdWNoIHBvaW50LiBJbiBmdXR1cmUgdGhpcyBtZXRob2Qgd2lsbCBuZWVkIHJld3JpdGluZy4KKyAgICAgICAgICAgICAgICAgICAgICovCisgICAgICAgICAgICAgICAgICAgIGlmIChnZXRUb3VjaFBvaW50cygpLmlzRW1wdHkoKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIHRvdWNoUG9pbnQgPSBnZXRUb3VjaFBvaW50cygpLmdldCgwKTsKKworICAgICAgICAgICAgICAgICAgICB0b3VjaFBvaW50LnNldERvd25UaW1lKFN5c3RlbUNsb2NrLnVwdGltZU1pbGxpcygpKTsKKyAgICAgICAgICAgICAgICAgICAgZXhlY3V0ZVRvdWNoRXZlbnQodG91Y2hQb2ludCwgTW90aW9uRXZlbnQuQUNUSU9OX0RPV04pOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKworICAgICAgICAgICAgICAgIGNhc2UgTVNHX1VQREFURV9UT1VDSF9QT0lOVDoKKyAgICAgICAgICAgICAgICAgICAgYnVuZGxlID0gKEJ1bmRsZSltc2cub2JqOworCisgICAgICAgICAgICAgICAgICAgIGludCBpZCA9IGJ1bmRsZS5nZXRJbnQoImlkIik7CisgICAgICAgICAgICAgICAgICAgIGlmIChpZCA+PSBnZXRUb3VjaFBvaW50cygpLnNpemUoKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgTG9nLncoTE9HX1RBRyArICI6Ok1TR19VUERBVEVfVE9VQ0hfUE9JTlQiLCAiVG91Y2hQb2ludCBvdXQgb2YgYm91bmRzOiAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgaWQpOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICBnZXRUb3VjaFBvaW50cygpLmdldChpZCkubW92ZShidW5kbGUuZ2V0SW50KCJ4IiksIGJ1bmRsZS5nZXRJbnQoInkiKSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICAgICAgY2FzZSBNU0dfVE9VQ0hfTU9WRToKKyAgICAgICAgICAgICAgICAgICAgLyoqCisgICAgICAgICAgICAgICAgICAgICAqIEZJWE1FOiBBdCB0aGUgbW9tZW50IHdlIGRvbid0IHN1cHBvcnQgbXVsdGktdG91Y2guIEhlbmNlLCB3ZSBvbmx5IGV4YW1pbmUKKyAgICAgICAgICAgICAgICAgICAgICogdGhlIGZpcnN0IHRvdWNoIHBvaW50LiBJbiBmdXR1cmUgdGhpcyBtZXRob2Qgd2lsbCBuZWVkIHJld3JpdGluZy4KKyAgICAgICAgICAgICAgICAgICAgICovCisgICAgICAgICAgICAgICAgICAgIGlmIChnZXRUb3VjaFBvaW50cygpLmlzRW1wdHkoKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIHRvdWNoUG9pbnQgPSBnZXRUb3VjaFBvaW50cygpLmdldCgwKTsKKworICAgICAgICAgICAgICAgICAgICBpZiAoIXRvdWNoUG9pbnQuaGFzTW92ZWQoKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGV4ZWN1dGVUb3VjaEV2ZW50KHRvdWNoUG9pbnQsIE1vdGlvbkV2ZW50LkFDVElPTl9NT1ZFKTsKKyAgICAgICAgICAgICAgICAgICAgdG91Y2hQb2ludC5yZXNldEhhc01vdmVkKCk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICAgICAgY2FzZSBNU0dfQ0FOQ0VMX1RPVUNIX1BPSU5UOgorICAgICAgICAgICAgICAgICAgICBpZiAobXNnLmFyZzEgPj0gZ2V0VG91Y2hQb2ludHMoKS5zaXplKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIExvZy53KExPR19UQUcgKyAiOjpNU0dfUkVMRUFTRV9UT1VDSF9QT0lOVCIsICJUb3VjaFBvaW50IG91dCBvZiBib3VuZHM6ICIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyBtc2cuYXJnMSk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgIGdldFRvdWNoUG9pbnRzKCkuZ2V0KG1zZy5hcmcxKS5jYW5jZWwoKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICAgICAgICBjYXNlIE1TR19UT1VDSF9DQU5DRUw6CisgICAgICAgICAgICAgICAgICAgIC8qKgorICAgICAgICAgICAgICAgICAgICAgKiBGSVhNRTogQXQgdGhlIG1vbWVudCB3ZSBkb24ndCBzdXBwb3J0IG11bHRpLXRvdWNoLiBIZW5jZSwgd2Ugb25seSBleGFtaW5lCisgICAgICAgICAgICAgICAgICAgICAqIHRoZSBmaXJzdCB0b3VjaCBwb2ludC4gSW4gZnV0dXJlIHRoaXMgbWV0aG9kIHdpbGwgbmVlZCByZXdyaXRpbmcuCisgICAgICAgICAgICAgICAgICAgICAqLworICAgICAgICAgICAgICAgICAgICBpZiAoZ2V0VG91Y2hQb2ludHMoKS5pc0VtcHR5KCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB0b3VjaFBvaW50ID0gZ2V0VG91Y2hQb2ludHMoKS5nZXQoMCk7CisKKyAgICAgICAgICAgICAgICAgICAgaWYgKHRvdWNoUG9pbnQuaXNDYW5jZWxsZWQoKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgZXhlY3V0ZVRvdWNoRXZlbnQodG91Y2hQb2ludCwgTW90aW9uRXZlbnQuQUNUSU9OX0NBTkNFTCk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICAgICAgICBjYXNlIE1TR19SRUxFQVNFX1RPVUNIX1BPSU5UOgorICAgICAgICAgICAgICAgICAgICBpZiAobXNnLmFyZzEgPj0gZ2V0VG91Y2hQb2ludHMoKS5zaXplKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIExvZy53KExPR19UQUcgKyAiOjpNU0dfUkVMRUFTRV9UT1VDSF9QT0lOVCIsICJUb3VjaFBvaW50IG91dCBvZiBib3VuZHM6ICIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyBtc2cuYXJnMSk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgIGdldFRvdWNoUG9pbnRzKCkuZ2V0KG1zZy5hcmcxKS5yZWxlYXNlKCk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICAgICAgY2FzZSBNU0dfVE9VQ0hfRU5EOgorICAgICAgICAgICAgICAgICAgICAvKioKKyAgICAgICAgICAgICAgICAgICAgICogRklYTUU6IEF0IHRoZSBtb21lbnQgd2UgZG9uJ3Qgc3VwcG9ydCBtdWx0aS10b3VjaC4gSGVuY2UsIHdlIG9ubHkgZXhhbWluZQorICAgICAgICAgICAgICAgICAgICAgKiB0aGUgZmlyc3QgdG91Y2ggcG9pbnQuIEluIGZ1dHVyZSB0aGlzIG1ldGhvZCB3aWxsIG5lZWQgcmV3cml0aW5nLgorICAgICAgICAgICAgICAgICAgICAgKi8KKyAgICAgICAgICAgICAgICAgICAgaWYgKGdldFRvdWNoUG9pbnRzKCkuaXNFbXB0eSgpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgdG91Y2hQb2ludCA9IGdldFRvdWNoUG9pbnRzKCkuZ2V0KDApOworCisgICAgICAgICAgICAgICAgICAgIGV4ZWN1dGVUb3VjaEV2ZW50KHRvdWNoUG9pbnQsIE1vdGlvbkV2ZW50LkFDVElPTl9VUCk7CisgICAgICAgICAgICAgICAgICAgIGlmICh0b3VjaFBvaW50LmlzUmVsZWFzZWQoKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgZ2V0VG91Y2hQb2ludHMoKS5yZW1vdmUoMCk7CisgICAgICAgICAgICAgICAgICAgICAgICB0b3VjaFBvaW50ID0gbnVsbDsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBicmVhazsKKworICAgICAgICAgICAgICAgIGNhc2UgTVNHX1NFVF9UT1VDSF9NT0RJRklFUjoKKyAgICAgICAgICAgICAgICAgICAgYnVuZGxlID0gKEJ1bmRsZSltc2cub2JqOworICAgICAgICAgICAgICAgICAgICBTdHJpbmcgbW9kaWZpZXIgPSBidW5kbGUuZ2V0U3RyaW5nKCJtb2RpZmllciIpOworICAgICAgICAgICAgICAgICAgICBib29sZWFuIGVuYWJsZWQgPSBidW5kbGUuZ2V0Qm9vbGVhbigiZW5hYmxlZCIpOworCisgICAgICAgICAgICAgICAgICAgIGludCBtYXNrID0gMDsKKyAgICAgICAgICAgICAgICAgICAgaWYgKCJhbHQiLmVxdWFscyhtb2RpZmllci50b0xvd2VyQ2FzZSgpKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgbWFzayA9IEtleUV2ZW50Lk1FVEFfQUxUX09OOworICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKCJzaGlmdCIuZXF1YWxzKG1vZGlmaWVyLnRvTG93ZXJDYXNlKCkpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBtYXNrID0gS2V5RXZlbnQuTUVUQV9TSElGVF9PTjsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICgiY3RybCIuZXF1YWxzKG1vZGlmaWVyLnRvTG93ZXJDYXNlKCkpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBtYXNrID0gS2V5RXZlbnQuTUVUQV9TWU1fT047CisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICBpZiAoZW5hYmxlZCkgeworICAgICAgICAgICAgICAgICAgICAgICAgbVRvdWNoTWV0YVN0YXRlIHw9IG1hc2s7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICBtVG91Y2hNZXRhU3RhdGUgJj0gfm1hc2s7CisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICBicmVhazsKKworICAgICAgICAgICAgICAgIGNhc2UgTVNHX0NMRUFSX1RPVUNIX1BPSU5UUzoKKyAgICAgICAgICAgICAgICAgICAgZ2V0VG91Y2hQb2ludHMoKS5jbGVhcigpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKworICAgICAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfTsKKworICAgIHB1YmxpYyB2b2lkIHJlc2V0KFdlYlZpZXcgd2ViVmlldykgeworICAgICAgICBtV2ViVmlldyA9IHdlYlZpZXc7CisgICAgICAgIG1Ub3VjaFBvaW50cyA9IG51bGw7CisgICAgICAgIG1Ub3VjaE1ldGFTdGF0ZSA9IDA7CisgICAgICAgIG1Nb3VzZVggPSAwOworICAgICAgICBtTW91c2VZID0gMDsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBlbmFibGVET01VSUV2ZW50TG9nZ2luZyhpbnQgZG9tTm9kZSkgeworICAgICAgICBNZXNzYWdlIG1zZyA9IG1FdmVudFNlbmRlckhhbmRsZXIub2J0YWluTWVzc2FnZShNU0dfRU5BQkxFX0RPTV9VSV9FVkVOVF9MT0dHSU5HKTsKKyAgICAgICAgbXNnLmFyZzEgPSBkb21Ob2RlOworICAgICAgICBtc2cuc2VuZFRvVGFyZ2V0KCk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgZmlyZUtleWJvYXJkRXZlbnRzVG9FbGVtZW50KGludCBkb21Ob2RlKSB7CisgICAgICAgIE1lc3NhZ2UgbXNnID0gbUV2ZW50U2VuZGVySGFuZGxlci5vYnRhaW5NZXNzYWdlKE1TR19GSVJFX0tFWUJPQVJEX0VWRU5UU19UT19FTEVNRU5UKTsKKyAgICAgICAgbXNnLmFyZzEgPSBkb21Ob2RlOworICAgICAgICB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WdlKE1TR19NT1VTRV9DTElDSyk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgbW91c2VNb3ZlVG8oaW50IHgsIGludCB5KSB7CisgICAgICAgIG1FdmVudFNlbmRlckhhbmRsZXIub2J0YWluTWVzc2FnZShNU0dfTU9VU0VfTU9WRV9UTywgeCwgeSkuc2VuZFRvVGFyZ2V0KCk7CisgICAgfQorCisgICAgLyoqIFRPVUNIICovCisKKyAgICBwdWJsaWMgdm9pZCBhZGRUb3VjaFBvaW50KGludCB4LCBpbnQgeSkgeworICAgICAgICBtRXZlbnRTZW5kZXJIYW5kbGVyLm9idGFpbk1lc3NhZ2UoTVNHX0FERF9UT1VDSF9QT0lOVCwgeCwgeSkuc2VuZFRvVGFyZ2V0KCk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgdG91Y2hTdGFydCgpIHsKKyAgICAgICAgbUV2ZW50U2VuZGVySGFuZGxlci5zZW5kRW1wdHlNZXNzYWdlKE1TR19UT1VDSF9TVEFSVCk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgdXBkYXRlVG91Y2hQb2ludChpbnQgaWQsIGludCB4LCBpbnQgeSkgeworICAgICAgICBCdW5kbGUgYnVuZGxlID0gbmV3IEJ1bmRsZSgpOworICAgICAgICBidW5kbGUucHV0SW50KCJpZCIsIGlkKTsKKyAgICAgICAgYnVuZGxlLnB1dEludCgieCIsIHgpOworICAgICAgICBidW5kbGUucHV0SW50KCJ5IiwgeSk7CisgICAgICAgIG1FdmVudFNlbmRlckhhbmRsZXIub2J0YWluTWVzc2FnZShNU0dfVVBEQVRFX1RPVUNIX1BPSU5ULCBidW5kbGUpLnNlbmRUb1RhcmdldCgpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHRvdWNoTW92ZSgpIHsKKyAgICAgICAgbUV2ZW50U2VuZGVySGFuZGxlci5zZW5kRW1wdHlNZXNzYWdlKE1TR19UT1VDSF9NT1ZFKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZC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b2RlKCksIGV2ZW50KTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBBc3N1bWVzIGxvd2VyY2FzZSBjaGFycywgY2FzZSBuZWVkcyB0byBiZSBoYW5kbGVkIGJ5IGNhbGxpbmcgZnVuY3Rpb24uCisgICAgICovCisgICAgcHJpdmF0ZSBzdGF0aWMgaW50IGNoYXJUb0tleUNvZGUoY2hhciBjKSB7CisgICAgICAgIC8vIGhhbmRsZSBudW1iZXJzCisgICAgICAgIGlmIChjID49ICcwJyAmJiBjIDw9ICc5JykgeworICAgICAgICAgICAgaW50IG9mZnNldCA9IGMgLSAnMCc7CisgICAgICAgICAgICByZXR1cm4gS2V5RXZlbnQuS0VZQ09ERV8wICsgb2Zmc2V0OworICAgICAgICB9CisKKyAgICAgICAgLy8gaGFuZGxlIGNoYXJhY3RlcnMKKyAgICAgICAgaWYgKGMgPj0gJ2EnICYmIGMgPD0gJ3onKSB7CisgICAgICAgICAgICBpbnQgb2Zmc2V0ID0gYyAtICdhJzsKKyAgICAgICAgICAgIHJldHVybiBLZXlFdmVudC5LRVlDT0RFX0EgKyBvZmZzZXQ7CisgICAgICAgIH0KKworICAgICAgICAvLyBoYW5kbGUgYWxsIG90aGVycworICAgICAgICBzd2l0Y2ggKGMpIHsKKyAgICAgICAgICAgIGNhc2UgJyonOgorICAgICAgICAgICAgICAgIHJldHVybiBLZXlFdmVudC5LRVlDT0RFX1NUQVI7CisKKyAgICAgICAgICAgIGNhc2UgJyMnOgorICAgICAgICAgICAgICAgIHJldHVybiBLZXlFdmVudC5LRVlDT0RFX1BPVU5EOworCisgICAgICAgICAgICBjYXNlICcsJzoKKyAgICAgICAgICAgICAgICByZXR1cm4gS2V5RXZlbnQuS0VZQ09ERV9DT01NQTsKKworICAgICAgICAgICAgY2FzZSAnLic6CisgICAgICAgICAgICAgICAgcmV0dXJuIEtleUV2ZW50LktFWUNPREVfUEVSSU9EOworCisgICAgICAgICAgICBjYXNlICdcdCc6CisgICAgICAgICAgICAgICAgcmV0dXJuIEtleUV2ZW50LktFWUNPREVfVEFCOworCisgICAgICAgICAgICBjYXNlICcgJzoKKyAgICAgICAgICAgICAgICByZXR1cm4gS2V5RXZlbnQuS0VZQ09ERV9TUEFDRTsKKworICAgICAgICAgICAgY2FzZSAnXG4nOgorICAgICAgICAgICAgICAgIHJldHVybiBLZXlFdmVudC5LRVlDT0RFX0VOVEVSOworCisgICAgICAgICAgICBjYXNlICdcYic6CisgICAgICAgICAgICBjYXNlIDB4N0Y6CisgICAgICAgICAgICAgICAgcmV0dXJuIEtleUV2ZW50LktFWUNPREVfREVMOworCisgICAgICAgICAgICBjYXNlICd+JzoKKyAgICAgICAgICAgICAgICByZXR1cm4gS2V5RXZlbnQuS0VZQ09ERV9HUkFWRTsKKworICAgICAgICAgICAgY2FzZSAnLSc6CisgICAgICAgICAgICAgICAgcmV0dXJuIEtleUV2ZW50LktFWUNPREVfTUlOVVM7CisKKyAgICAgICAgICAgIGNhc2UgJz0nOgorICAgICAgICAgICAgICAgIHJldHVybiBLZXlFdmVudC5LRVlDT0RFX0VRVUFMUzsKKworICAgICAgICAgICAgY2FzZSAnKCc6CisgICAgICAgICAgICAgICAgcmV0dXJuIEtleUV2ZW50LktFWUNPREVfTEVGVF9CUkFDS0VUOworCisgICAgICAgICAgICBjYXNlICcpJzoKKyAgICAgICAgICAgICAgICByZXR1cm4gS2V5RXZlbnQuS0VZQ09ERV9SSUdIVF9CUkFDS0VUOworCisgICAgICAgICAgICBjYXNlICdcXCc6CisgICAgICAgICAgICAgICAgcmV0dXJuIEtleUV2ZW50LktFWUNPREVfQkFDS1NMQVNIOworCisgICAgICAgICAgICBjYXNlICc7JzoKKyAgICAgICAgICAgICAgICByZXR1cm4gS2V5RXZlbnQuS0VZQ09ERV9TRU1JQ09MT047CisKKyAgICAgICAgICAgIGNhc2UgJ1wnJzoKKyAgICAgICAgICAgICAgICByZXR1cm4gS2V5RXZlbnQuS0VZQ09ERV9BUE9TVFJPUEhFOworCisgICAgICA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aW5nPigpOworICAgIHByaXZhdGUgZmluYWwgU2V0PFN0cmluZz4gbVNsb3dMaXN0ID0gbmV3IEhhc2hTZXQ8U3RyaW5nPigpOworCisgICAgcHJpdmF0ZSBmaW5hbCBTdHJpbmcgbVJvb3REaXJQYXRoOworCisgICAgcHVibGljIEZpbGVGaWx0ZXIoU3RyaW5nIHJvb3REaXJQYXRoKSB7CisgICAgICAgIC8qKiBJdCBtYXkgb3IgbWF5IG5vdCBjb250YWluIGEgdHJhaWxpbmcgc2xhc2ggKi8KKyAgICAgICAgdGhpcy5tUm9vdERpclBhdGggPSByb290RGlyUGF0aDsKKworICAgICAgICByZWxvYWRDb25maWd1cmF0aW9uKCk7CisgICAgfQorCisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgU3RyaW5nIHRyaW1UcmFpbGluZ1NsYXNoSWZQcmVzZW50KFN0cmluZyBwYXRoKSB7CisgICAgICAgIEZpbGUgZmlsZSA9IG5ldyBGaWxlKHBhdGgpOworICAgICAgICByZXR1cm4gZmlsZS5nZXRQYXRoKCk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgcmVsb2FkQ29uZmlndXJhdGlvbigpIHsKKyAgICAgICAgRmlsZSB0eHRfZXhwID0gbmV3IEZpbGUobVJvb3REaXJQYXRoLCBURVNUX0VYUEVDVEFUSU9OU19UWFRfUEFUSCk7CisKKyAgICAgICAgQnVmZmVyZWRSZWFkZXIgYnVmZmVyZWRSZWFkZXI7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBidWZmZXJlZFJlYWRlciA9CisgICAgICAgICAgICAgICAgICAgIG5ldyBCdWZmZXJlZFJlYWRlcihuZXcgRmlsZVJlYWRlcih0eHRfZXhwKSk7CisKKyAgICAgICAgICAgIFN0cmluZyBsaW5lOworICAgICAgICAgICAgU3RyaW5nIGVudHJ5OworICAgICAgICAgICAgU3RyaW5nW10gcGFydHM7CisgICAgICAgICAgICBTdHJpbmcgcGF0aDsKKyAgICAgICAgICAgIFNldDxTdHJpbmc+IHRva2VuczsKKyAgICAgICAgICAgIEJvb2xlYW4gc2tpcHBlZDsKKyAgICAgICAgICAgIHdoaWxlICh0cnVlKSB7CisgICAgICAgICAgICAgICAgbGluZSA9IGJ1ZmZlcmVkUmVhZGVyLnJlYWRMaW5lKCk7CisgICAgICAgICAgICAgICAgaWYgKGxpbmUgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAvKiogUmVtb3ZlIHRoZSBjb21tZW50IGFuZCB0cmltICovCisgICAgICAgICAgICAgICAgZW50cnkgPSBsaW5lLnNwbGl0KCIvLyIsIDIpWzBdLnRyaW0oKTsKKworICAgICAgICAgICAgICAgIC8qKiBPbWl0IGVtcHR5IGxpbmVzLCBhZHZhbmNlIHRvIG5leHQgbGluZSAqLworICAgICAgICAgICAgICAgIGlmIChlbnRyeS5pc0VtcHR5KCkpIHsKKyAgICAgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgLyoqIFNwbGl0IG9uIHdoaXRlc3BhY2UgaW50byBwYXRoIHBhcnQgYW5kIHRoZSByZXN0ICovCisgICAgICAgICAgICAgICAgcGFydHMgPSBlbnRyeS5zcGxpdCgiXFxzIiwgMik7CisKKyAgICAgICAgICAgICAgICAvKiogQXQgdGhpcyBwb2ludCBwYXJ0cy5sZW5ndGggPj0gMSAqLworICAgICAgICAgICAgICAgIGlmIChwYXJ0cy5sZW5ndGggPT0gMSkgeworICAgICAgICAgICAgICAgICAgICBMb2cudyhMT0dfVEFHICsgIjo6cmVsb2FkQ29uZmlndXJhdGlvbiIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIlRoZXJlIGFyZSBubyBvcHRpb25zIHNwZWNpZmllZCBmb3IgdGhlIHRlc3QhIik7CisgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIHBhdGggPSB0cmltVHJhaWxpbmdTbGFzaElmUHJlc2VudChwYXJ0c1swXSk7CisKKyAgICAgICAgICAgICAgICAvKiogU3BsaXQgb24gd2hpdGVzcGFjZSAqLworICAgICAgICAgICAgICAgIHRva2VucyA9IG5ldyBIYXNoU2V0PFN0cmluZz4oQXJyYXlzLmFzTGlzdChwYXJ0c1sxXS5zcGxpdCgiXFxzIiwgMCkpKTsKKworICAgICAgICAgICAgICAgIC8qKiBDaG9zZSB0aGUgcmlnaHQgY29sbGVjdGlvbnMgdG8gYWRkIHRvICovCisgICAgICAgICAgICAgICAgc2tpcHBlZCA9IGZhbHNlOworICAgICAgICAgICAgICAgIGlmICh0b2tlbnMuY29udGFpbnMoVE9LRU5fU0tJUCkpIHsKKyAgICAgICAgICAgICAgICAgICAgbVNraXBMaXN0LmFkZChwYXRoKTsKKyAgICAgICAgICAgICAgICAgICAgc2tpcHBlZCA9IHRydWU7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgLyoqIElmIHRlc3QgaXMgb24gc2tpcCBsaXN0IHdlIGlnbm9yZSBhbnkgZnVydGhlciBvcHRpb25zICovCisgICAgICAgICAgICAgICAgaWYgKHNraXBwZWQpIHsKKyAgICAgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgaWYgKHRva2Vucy5jb250YWlucyhUT0tFTl9JR05PUkVfUkVTVUxUKSkgeworICAgICAgICAgICAgICAgICAgICBtSWdub3JlUmVzdWx0TGlzdC5hZGQocGF0aCk7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgaWYgKHRva2Vucy5jb250YWlucyhUT0tFTl9TTE9XKSkgeworICAgICAgICAgICAgICAgICAgICBtU2xvd0xpc3QuYWRkKHBhdGgpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfSBjYXRjaCAoRmlsZU5vdEZvdW5kRXhjZX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RmlsZSgpOworICAgICAgICB9IHdoaWxlIChmaWxlICE9IG51bGwpOworCisgICAgICAgIHJldHVybiBwcmVmaXhlczsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBDaGVja3MgaWYgdGhlIGRpcmVjdG9yeSBtYXkgY29udGFpbiB0ZXN0cyBvciBjb250YWlucyBqdXN0IGhlbHBlciBmaWxlcy4KKyAgICAgKgorICAgICAqIEBwYXJhbSBkaXJOYW1lCisgICAgICogQHJldHVybgorICAgICAqICAgICAgaWYgdGhlIGRpcmVjdG9yeSBtYXkgY29udGFpbiB0ZXN0cworICAgICAqLworICAgIHB1YmxpYyBzdGF0aWMgYm9vbGVhbiBpc1Rlc3REaXIoU3RyaW5nIGRpck5hbWUpIHsKKyAgICAgICAgcmV0dXJuICghZGlyTmFtZS5lcXVhbHMoInNjcmlwdC10ZXN0cyIpCisgICAgICAgICAgICAgICAgJiYgIWRpck5hbWUuZXF1YWxzKCJyZXNvdXJjZXMiKSAmJiAhZGlyTmFtZS5zdGFydHNXaXRoKCIuIikpOworICAgIH0KKworICAgIC8qKgorICAgICAqIENoZWNrcyBpZiB0aGUgZmlsZSBpcyBhIHRlc3QuCisgICAgICogQ3VycmVudGx5IHdlIHJ1biAuaHRtbCBhbmQgLnhodG1sIHRlc3RzLgorICAgICAqCisgICAgICogQHBhcmFtIHRlc3ROYW1lCisgICAgICogQHJldHVybgorICAgICAqICAgICAgaWYgdGhlIGZpbGUgaXMgYSB0ZXN0CisgICAgICovCisgICAgcHVibGljIHN0YXRpYyBib29sZWFuIGlzVGVzdEZpbGUoU3RyaW5nIHRlc3ROYW1lKSB7CisgICAgICAgIHJldHVybiB0ZXN0TmFtZS5lbmRzV2l0aCgiLmh0bWwiKSB8fCB0ZXN0TmFtZS5lbmRzV2l0aCgiLnhodG1sIik7CisgICAgfQorCisgICAgLyoqCisgICAgICogUmV0dXJuIHRoZSBwYXRoIHRvIHRoZSBmaWxlIHJlbGF0aXZlIHRvIHRoZSB0ZXN0cyByb290IGRpcgorICAgICAqCisgICAgICogQHBhcmFtIGZpbGVQYXRoCisgICAgICogQHJldHVybgorICAgICAqICAgICAgdGhlIHBhdGggcmVsYXRpdmUgdG8gdGhlIHRlc3RzIHJvb3QgZGlyCisgICAgICovCisgICAgcHVibGljIFN0cmluZyBnZXRSZWxhdGl2ZVBhdGgoU3RyaW5nIGZpbGVQYXRoKSB7CisgICAgICAgIEZpbGUgcm9vdERpciA9IG5ldyBGaWxlKG1Sb290RGlyUGF0aCk7CisgICAgICAgIHJldHVybiBmaWxlUGF0aC5yZXBsYWNlRmlyc3Qocm9vdERpci5nZXRQYXRoKCkgKyBGaWxlLnNlcGFyYXRvciwgIiIpOworICAgIH0KKworICAgIC8qKgorICAgICAqIFJldHVybiB0aGUgcGF0aCB0byB0aGUgZmlsZSByZWxhdGl2ZSB0byB0aGUgdGVzdHMgcm9vdCBkaXIKKyAgICAgKgorICAgICAqIEBwYXJhbSBmaWxlUGF0aAorICAgICAqIEByZXR1cm4KKyAgICAgKiAgICAgIHRoZSBwYXRoIHJlbGF0aXZlIHRvIHRoZSB0ZXN0cyByb290IGRpcgorICAgICAqLworICAgIHB1YmxpYyBTdHJpbmcgZ2V0UmVsYXRpdmVQYXRoKEZpbGUgZmlsZSkgeworICAgICAgICByZXR1cm4gZ2V0UmVsYXRpdmVQYXRoKGZpbGUuZ2V0QWJzb2x1dGVQYXRoKCkpOworICAgIH0KKworICAgIHB1YmxpYyBGaWxlIGdldEFic29sdXRlRmlsZShTdHJpbmcgcmVsYXRpdmVQYXRoKSB7CisgICAgICAgIHJldHVybiBuZXcgRmlsZShtUm9vdERpclBhdGgsIHJlbGF0aXZlUGF0aCk7CisgICAgfQorCisgICAgcHVibGljIFN0cmluZyBnZXRBYm9zbHV0ZVBhdGgoU3RyaW5nIHJlbGF0aXZlUGF0aCkgeworICAgICAgICByZXR1cm4gZ2V0QWJzb2x1dGVGaWxlKHJlbGF0aXZlUGF0aCkuZ2V0QWJzb2x1dGVQYXRoK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ICAgICAgICAgICAgICBvdXRwdXRTdHJlYW0ud3JpdGUoYnl0ZXMpOworICAgICAgICAgICAgfSBmaW5hbGx5IHsKKyAgICAgICAgICAgICAgICBpZiAob3V0cHV0U3RyZWFtICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgb3V0cHV0U3RyZWFtLmNsb3NlKCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9IGNhdGNoIChJT0V4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICBMb2cuZShMT0dfVEFHICsgIjo6d3JpdGVEYXRhVG9TdG9yYWdlIiwgZS5nZXRNZXNzYWdlKCkpOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHN0YXRpYyBieXRlW10gcmVhZERhdGFGcm9tU3RvcmFnZShGaWxlIGZpbGUpIHsKKyAgICAgICAgaWYgKCFmaWxlLmV4aXN0cygpKSB7CisgICAgICAgICAgICBMb2cuZChMT0dfVEFHICsgIjo6cmVhZERhdGFGcm9tU3RvcmFnZSIsICJGaWxlIGRvZXMgbm90IGV4aXN0OiAiCisgICAgICAgICAgICAgICAgICAgICsgZmlsZS5nZXRBYnNvbHV0ZVBhdGgoKSk7CisgICAgICAgICAgICByZXR1cm4gbnVsbDsKKyAgICAgICAgfQorCisgICAgICAgIGJ5dGVbXSBieXRlcyA9IG51bGw7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBGaWxlSW5wdXRTdHJlYW0gZmlzID0gbnVsbDsKKyAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgZmlzID0gbmV3IEZpbGVJbnB1dFN0cmVhbShmaWxlKTsKKyAgICAgICAgICAgICAgICBieXRlcyA9IG5ldyBieXRlWyhpbnQpIGZpbGUubGVuZ3RoKCldOworICAgICAgICAgICAgICAgIGZpcy5yZWFkKGJ5dGVzKTsKKyAgICAgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICAgICAgaWYgKGZpcyAhPSBudWxsKSB7C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FeGVjdXRvciBtTGF5b3V0VGVzdHNFeGVjdXRvcjsKKworICAgIHB1YmxpYyBMYXlvdXRUZXN0Q29udHJvbGxlcihMYXlvdXRUZXN0c0V4ZWN1dG9yIGxheW91dFRlc3RzRXhlY3V0b3IpIHsKKyAgICAgICAgbUxheW91dFRlc3RzRXhlY3V0b3IgPSBsYXlvdXRUZXN0c0V4ZWN1dG9yOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHdhaXRVbnRpbERvbmUoKSB7CisgICAgICAgIG1MYXlvdXRUZXN0c0V4ZWN1dG9yLndhaXRVbnRpbERvbmUoKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBub3RpZnlEb25lKCkgeworICAgICAgICBtTGF5b3V0VGVzdHNFeGVjdXRvci5ub3RpZnlEb25lKCk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgZHVtcEFzVGV4dCgpIHsKKyAgICAgICAgZHVtcEFzVGV4dChmYWxzZSk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgZHVtcEFzVGV4dChib29sZWFuIGVuYWJsZVBpeGVsVGVzdCkgeworICAgICAgICBtTGF5b3V0VGVzdHNFeGVjdXRvci5kdW1wQXNUZXh0KGVuYWJsZVBpeGVsVGVzdCk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgZHVtcENoaWxkRnJhbWVzQXNUZXh0KCkgeworICAgICAgICBtTGF5b3V0VGVzdHNFeGVjdXRvci5kdW1wQ2hpbGRGcmFtZXNBc1RleHQoKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBjbGVhckFsbERhdGFiYXNlcygpIHsKKyAgICAgICAgTG9nLncoTE9HX1RBRyArICI6OmNsZWFyQWxsRGF0YWJhc2VzIiwgImNhbGxlZCIpOworICAgICAgICBXZWJTdG9yYWdlLmdldEluc3RhbmNlKCkuZGVsZXRlQWxsRGF0YSgpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHNldENhbk9wZW5XaW5kb3dzKCkgeworIC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yAgICAgICAgUkVOREVSSU5HX1BBR0UsCisgICAgICAgIFdBSVRJTkdfRk9SX0FTWU5DSFJPTk9VU19URVNULAorICAgICAgICBPQlRBSU5JTkdfUkVTVUxUOworCisgICAgICAgIHB1YmxpYyBib29sZWFuIGlzUnVubmluZ1N0YXRlKCkgeworICAgICAgICAgICAgcmV0dXJuIHRoaXMgPT0gQ3VycmVudFN0YXRlLlJFTkRFUklOR19QQUdFIHx8CisgICAgICAgICAgICAgICAgICAgIHRoaXMgPT0gQ3VycmVudFN0YXRlLldBSVRJTkdfRk9SX0FTWU5DSFJPTk9VU19URVNUOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqIFRPRE86IG1ha2UgaXQgYSBzZXR0aW5nICovCisgICAgc3RhdGljIGZpbmFsIFN0cmluZyBURVNUU19ST09UX0RJUl9QQVRIID0KKyAgICAgICAgICAgIEVudmlyb25tZW50LmdldEV4dGVybmFsU3RvcmFnZURpcmVjdG9yeSgpICsKKyAgICAgICAgICAgIEZpbGUuc2VwYXJhdG9yICsgImFuZHJvaWQiICsKKyAgICAgICAgICAgIEZpbGUuc2VwYXJhdG9yICsgIkxheW91dFRlc3RzIjsKKworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIFN0cmluZyBMT0dfVEFHID0gIkxheW91dFRlc3RFeGVjdXRvciI7CisKKyAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBFWFRSQV9URVNUU19MSVNUID0gIlRlc3RzTGlzdCI7CisgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgRVhUUkFfVEVTVF9JTkRFWCA9ICJUZXN0SW5kZXgiOworCisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IE1TR19BQ1RVQUxfUkVTVUxUX09CVEFJTkVEID0gMDsKKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgTVNHX1RFU1RfVElNRURfT1VUID0gMTsKKworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGlud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ZQorICAgICAgICBwdWJsaWMgdm9pZCBvblNlcnZpY2VEaXNjb25uZWN0ZWQoQ29tcG9uZW50TmFtZSBuYW1lKSB7CisgICAgICAgICAgICAvKiogVE9ETyAqLworICAgICAgICB9CisgICAgfTsKKworICAgIHByaXZhdGUgZmluYWwgSGFuZGxlciBtUmVzdWx0SGFuZGxlciA9IG5ldyBIYW5kbGVyKCkgeworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIHZvaWQgaGFuZGxlTWVzc2FnZShNZXNzYWdlIG1zZykgeworICAgICAgICAgICAgc3dpdGNoIChtc2cud2hhdCkgeworICAgICAgICAgICAgICAgIGNhc2UgTVNHX0FDVFVBTF9SRVNVTFRfT0JUQUlORUQ6CisgICAgICAgICAgICAgICAgICAgIG9uQWN0dWFsUmVzdWx0c09idGFpbmVkKCk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICAgICAgY2FzZSBNU0dfVEVTVF9USU1FRF9PVVQ6CisgICAgICAgICAgICAgICAgICAgIG9uVGVzdFRpbWVkT3V0KCk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9OworCisgICAgLyoqIFdFQlZJRVcgQ09ORklHVVJBVElPTiAqLworCisgICAgcHJpdmF0ZSBXZWJWaWV3Q2xpZW50IG1XZWJWaWV3Q2xpZW50ID0gbmV3IFdlYlZpZXdDbGllbnQoKSB7CisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgdm9pZCBvblBhZ2VGaW5pc2hlZChXZWJWaWV3IHZpZXcsIFN0cmluZyB1cmwpIHsKKyAgICAgICAgICAgIC8qKiBTb21lIHRlc3RzIGZpcmUgdXAgbWFueSBwYWdlIGxvYWRzLCB3ZSBkb24ndCB3YW50IHRvIGRldGVjdCB0aGVtICovCisgICAgICAgICAgICBpZiAoIXVybC5lcXVhbHMobUN1cnJlbnRUZXN0VXJpKSkgeworICAgICAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKG1DdXJyZW50U3RhdGUgPT0gQ3VycmVudFN0YXRlLlJFTkRFUklOR19QQUdFKSB7CisgICAgICAgICAgICAgICAgb25UZXN0RmluaXNoZWQoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH07CisKKyAgICBwcml2YXRlIFdlYkNocm9tZUNsaWVudCBtV2ViQ2hyb21lQ2xpZW50ID0gbmV3IFdlYkNocm9tZUNsaWVudCgpIHsKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyB2b2lkIG9uRXhjZWVkZWREYXRhYmFzZVF1b3RhKFN0cmluZyB1cmwsIFN0cmluZyBkYXRhYmFzZUlkZW50aWZpZXIsCisgICAgICAgICAgICAgICAgbG9uZyBjdXJyZW50UXVvdGEsIGxvbmcgZXN0aW1hdGVkU2l6ZSwgbG9uZyB0b3RhbFVzZWRRdW90YSwKKyAgICAgICAgICAgICAgICBRdW90YVVwZGF0ZXIgcXVvdGFVcGRhdGVyKSB7CisgICAgICAgICAgICAvKiogVE9ETzogVGhpcyBzaG91bGQgYmUgcmVjb3JkZWQgYXMgcGFydCBvZiB0aGUgdGV4dCByZXN1bHQgKi8KKyAgICAgICAgICAgIC8qKiBUT0RPOiBUaGUgcXVvdGEgc2hvdWxkIGFsc28gcHJvYmFibHkgYmUgcmVzZXQgc29tZWhvdyBmb3IgZXZlcnkgdGVzdD8gKi8KKyAgICAgICAgICAgIGlmIChtRHVtcERhdGFiYXNlQ2FsbGJhY2tzKSB7CisgICAgICAgICAgICAgICAgZ2V0Q3VycmVudEFkZGl0aW9uYWxUZXh0T3V0cHV0KCkuYXBwZW5kRXhjZWVkZWREYlF1b3RhTWVzc2FnZSh1cmwsCisgICAgICAgICAgICAgICAgICAgICAgICBkYXRhYmFzZUlkZW50aWZpZXIpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgcXVvdGFVcGRhdGVyLnVwZGF0ZVF1b3RhKGN1cnJlbnRRdW90YSArIDUgKiAxMDI0ICogMTAyNCk7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIGJvb2xlYW4gb25Kc0FsZXJ0KFdlYlZpZXcgdmlldywgU3RyaW5nIHVybCwgU3RyaW5nIG1lc3NhZ2UsIEpzUmVzdWx0IHJlc3VsdCkgeworICAgICAgICAgICAgZ2V0Q3VycmVudEFkZGl0aW9uYWxUZXh0T3V0cHV0KCkuYXBwZW5kSnNBbGVydChtZXNzYWdlKTsKKyAgICAgICAgICAgIHJlc3VsdC5jb25maXJtKCk7CisgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgYm9vbGVhbiBvbkpzQ29uZmlybShXZWJWaWV3IHZpZXcsIFN0cmluZyB1cmwsIFN0cmluZyBtZXNzYWdlLCBKc1Jlc3VsdCByZXN1bHQpIHsKKyAgICAgICAgICAgIGdldEN1cnJlbnRBZGRpdGlvbmFsVGV4dE91dHB1dCgpLmFwcGVuZEpzQ29uZmlybShtZXNzYWdlKTsKKyAgICAgICAgICAgIHJlc3VsdC5jb25maXJtKCk7CisgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgYm9vbGVhbiBvbkpzUHJvbXB0KFdlYlZpZXcgdmlldywgU3RyaW5nIHVybCwgU3RyaW5nIG1lc3NhZ2UsIFN0cmluZyBkZWZhdWx0VmFsdWUsCisgICAgICAgICAgICAgICAgSnNQcm9tcHRSZXN1bHQgcmVzdWx0KSB7CisgICAgICAgICAgICBnZXRDdXJyZW50QWRkaXRpb25hbFRleHRPdXRwdXQoKS5hcHBlbmRKc1Byb21wdChtZXNzYWdlLCBkZWZhdWx0VmFsdWUpOworICAgICAgICAgICAgcmVzdWx0LmNvbmZpcm0oKTsKKyAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyBib29sZWFuIG9uQ29uc29sZU1lc3NhZ2UoQ29uc29sZU1lc3NhZ2UgY29uc29sZU1lc3NhZ2UpIHsKKyAgICAgICAgICAgIGdldEN1cnJlbnRBZGRpdGlvbmFsVGV4dE91dHB1dCgpLmFwcGVuZENvbnNvbGVNZXNzYWdlKGNvbnNvbGVNZXNzYWdlKTsKKyAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyBib29sZWFuIG9uQ3JlYXRlV2luZG93KFdlYlZpZXcgdmlldywgYm9vbGVhbiBkaWFsb2csIGJvb2xlYW4gdXNlckdlc3R1cmUsCisgICAgICAgICAgICAgICAgTWVzc2FnZSByZXN1bHRNc2cpIHsKKyAgICAgICAgICAgIFdlYlZpZXcuV2ViVmlld1RyYW5zcG9ydCB0cmFuc3BvcnQgPSAoV2ViVmlldy5XZWJWaWV3VHJhbnNwb3J0KXJlc3VsdE1zZy5vYmo7CisgICAgICAgICAgICAvKiogQnkgZGVmYXVsdCB3aW5kb3dzIGNhbm5vdCBiZSBvcGVuZWQsIHNvIGp1c3Qgc2VuZCBudWxsIGJhY2suICovCisgICAgICAgICAgICBXZWJWaWV3IG5ld1dpbmRvd1dlYlZpZXcgPSBudWxsOworCisgICAgICAgICAgICBpZiAobUNhbk9wZW5XaW5kb3dzKSB7CisgICAgICAgICAgICAgICAgLyoqCisgICAgICAgICAgICAgICAgICogV2UgbmV2ZXIgZGlzcGxheSB0aGUgbmV3IHdpbmRvdywganVzdCBjcmVhdGUgdGhlIHZpZXcgYW5kIGFsbG93IGl0J3MgY29udGVudCB0bworICAgICAgICAgICAgICAgICAqIGV4ZWN1dGUgYW5kIGJlIHJlY29yZGVkIGJ5IHRoZSBleGVjdXRvci4KKyAgICAgICAgICAgICAgICAgKi8KKyAgICAgICAgICAgICAgICBuZXdXaW5kb3dXZWJWaWV3ID0gbmV3IFdlYlZpZXcoTGF5b3V0VGVzdHNFeGVjdXRvci50aGlzKTsKKyAgICAgICAgICAgICAgICBzZXR1cFdlYlZpZXcobmV3V2luZG93V2ViVmlldyk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHRyYW5zcG9ydC5zZXRXZWJWaWV3KG5ld1dpbmRvd1dlYlZpZXcpOworICAgICAgICAgICAgcmVzdWx0TXNnLnNlbmRUb1RhcmdldCgpOworICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIHZvaWQgb25HZW9sb2NhdGlvblBlcm1pc3Npb25zU2hvd1Byb21wdChTdHJpbmcgb3JpZ2luLAorICAgICAgICAgICAgICAgIEdlb2xvY2F0aW9uUGVybWlzc2lvbnMuQ2FsbGJhY2sgY2FsbGJhY2spIHsKKyAgICAgICAgICAgIGlmIChtSXNHZW9sb2NhdGlvblBlcm1pc3Npb25TZXQpIHsKKyAgICAgICAgICAgICAgICBjYWxsYmFjay5pbnZva2Uob3JpZ2luLCBtR2VvbG9jYXRpb25QZXJtaXNzaW9uLCBmYWxzZSk7CisgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKG1QZW5kaW5nR2VvbG9jYXRpb25QZXJtaXNzaW9uQ2FsbGJhY2tzID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICBtUGVuZGluZ0dlb2xvY2F0aW9uUGVybWlzc2lvbkNhbGxiYWNrcyA9CisgICAgICAgICAgICAgICAgICAgICAgICBuZXcgSGFzaE1hcDxHZW9sb2NhdGlvblBlcm1pc3Npb25zLkNhbGxiYWNrLCBTdHJpbmc+KCk7CisgICAgICAgICA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AgICAgIGJpbmRTZXJ2aWNlKG5ldyBJbnRlbnQodGhpcywgTWFuYWdlclNlcnZpY2UuY2xhc3MpLCBtU2VydmljZUNvbm5lY3Rpb24sCisgICAgICAgICAgICAgICAgQ29udGV4dC5CSU5EX0FVVE9fQ1JFQVRFKTsKKyAgICB9CisKKyAgICBwcml2YXRlIHZvaWQgcmVzZXQoKSB7CisgICAgICAgIFdlYlZpZXcgcHJldmlvdXNXZWJWaWV3ID0gbUN1cnJlbnRXZWJWaWV3OworCisgICAgICAgIHJlc2V0TGF5b3V0VGVzdENvbnRyb2xsZXIoKTsKKworICAgICAgICBtQ3VycmVudFRlc3RUaW1lZE91dCA9IGZhbHNlOworICAgICAgICBtQ3VycmVudFJlc3VsdCA9IG51bGw7CisgICAgICAgIG1DdXJyZW50QWRkaXRpb25hbFRleHRPdXRwdXQgPSBudWxsOworCisgICAgICAgIG1DdXJyZW50V2ViVmlldyA9IG5ldyBXZWJWaWV3KHRoaXMpOworICAgICAgICBzZXR1cFdlYlZpZXcobUN1cnJlbnRXZWJWaWV3KTsKKworICAgICAgICBtRXZlbnRTZW5kZXIucmVzZXQobUN1cnJlbnRXZWJWaWV3KTsKKworICAgICAgICBzZXRDb250ZW50VmlldyhtQ3VycmVudFdlYlZpZXcpOworICAgICAgICBpZiAocHJldmlvdXNXZWJWaWV3ICE9IG51bGwpIHsKKyAgICAgICAgICAgIExvZy5kKExPR19UQUcgKyAiOjpyZXNldCIsICJwcmV2aW91c1dlYlZpZXcgIT0gbnVsbCIpOworICAgICAgICAgICAgcHJldmlvdXNXZWJWaWV3LmRlc3Ryb3koKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgdm9pZCBzZXR1cFdlYlZpZXcoV2ViVmlldyB3ZWJWaWV3KSB7CisgICAgICAgIHdlYlZpZXcuc2V0V2ViVmlld0NsaWVudChtV2ViVmlld0NsaWVudCk7CisgICAgICAgIHdlYlZpZXcuc2V0V2ViQ2hyb21lQ2xpZW50KG1X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1cnJlbnRXZWJWaWV3LnVzZU1vY2tEZXZpY2VPcmllbnRhdGlvbigpOworICAgIH0KKworICAgIHByaXZhdGUgdm9pZCBzdGFydFRlc3RzKCkgeworICAgICAgICB0cnkgeworICAgICAgICAgICAgTWVzc2FnZSBzZXJ2aWNlTXNnID0KKyAgICAgICAgICAgICAgICAgICAgTWVzc2FnZS5vYnRhaW4obnVsbCwgTWFuYWdlclNlcnZpY2UuTVNHX0ZJUlNUX1RFU1QpOworCisgICAgICAgICAgICBCdW5kbGUgYnVuZGxlID0gbmV3IEJ1bmRsZSgpOworICAgICAgICAgICAgaWYgKCFtVGVzdHNMaXN0LmlzRW1wdHkoKSkgeworICAgICAgICAgICAgICAgIGJ1bmRsZS5wdXRTdHJpbmcoImZpcnN0VGVzdCIsIG1UZXN0c0xpc3QuZ2V0KDApKTsKKyAgICAgICAgICAgICAgICBidW5kbGUucHV0SW50KCJpbmRleCIsIG1DdXJyZW50VGVzdEluZGV4KTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgc2VydmljZU1zZy5zZXREYXRhKGJ1bmRsZSk7CisgICAgICAgICAgICBtTWFuYWdlclNlcnZpY2VNZXNzZW5nZXIuc2VuZChzZXJ2aWNlTXNnKTsKKyAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgIExvZy5lKExPR19UQUcgKyAiOjpzdGFydFRlc3RzIiwgZS5nZXRNZXNzYWdlKCkpOworICAgICAgICB9CisKKyAgICAgICAgcnVuTmV4dFRlc3QoKTsKKyAgICB9CisKKyAgICBwcml2YXRlIHZvaWQgcnVuTmV4dFRlc3QoKSB7CisgICAgICAgIGFzc2VydCBtQ3VycmVudFN0YXRlID09IEN1cnJlbnRTdGF0ZS5JRExFIDogIm1DdXJyZW50U3RhdGUgPSAiICsgbUN1cnJlbnRTdGF0ZS5uYW1lKCk7CisKKyAgICAgICAgaWYgKG1UZXN0c0xpc3QuaXNFbXB0eSgpKSB7CisgICAgICAgICAgICBvbkFsbFRlc3RzRmluaXNoZWQoKTsKKyAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfQorCisgICAgICAgIG1DdXJyZW50VGVzdFJlbGF0aXZlUGF0aCA9IG1UZXN0c0xpc3QucmVtb3ZlKDApOworICAgICAgICBMb2cuZChMT0dfVEFHICsgIjo6cnVuTmV4dFRlc3QiLCAiU3RhcnQ6ICIgKyBtQ3VycmVudFRlc3RSZWxhdGl2ZVBhdGggKworICAgICAgICAgICAgICAgICIoIiArIG1DdXJyZW50VGVzdEluZGV4ICsgIikiKTsKKyAgICAgICAgbUN1cnJlbnRUZXN0VXJpID0KKyAgICAgICAgICAgICAgICBVcmkuZnJvbUZpbGUobmV3IEZpbGUoVEVTVFNfUk9PVF9ESVJfUEFUSCwgbUN1cnJlbnRUZXN0UmVsYXRpdmVQYXRoKSkudG9TdHJpbmcoKTsKKworICAgICAgICByZXNldCgpOworCisgICAgICAgIC8qKiBTdGFydCB0aW1lLW91dCBjb3VudGRvd24gYW5kIHRoZSB0ZXN0ICovCisgICAgICAgIG1DdXJyZW50U3RhdGUgPSBDdXJyZW50U3RhdGUuUkVOREVSSU5HX1BBR0U7CisgICAgICAgIG1SZXN1bHRIYW5kbGVyLnNlbmRFbXB0eU1lc3NhZ2VEZWxheWVkKE1TR19URVNUX1RJTUVEX09VVCwgREVGQVVMVF9USU1FX09VVF9NUyk7CisgICAgICAgIG1DdXJyZW50V2ViVmlldy5sb2FkVXJsKG1DdXJyZW50VGVzdFVyaSk7CisgICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIG9uVGVzdFRpbWVkT3V0KCkgeworICAgICAgICBhc3NlcnQgbUN1cnJlbnRTdGF0ZS5pc1J1bm5pbmdTdGF0ZSgpIDogIm1DdXJyZW50U3RhdGUgPSAiICsgbUN1cnJlbnRTdGF0ZS5uYW1lKCk7CisKKyAgICAgICAgbUN1cnJlbnRUZXN0VGltZWRPdXQgPSB0cnVlOworCisgICAgICAgIC8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TdGF0ZSA9ICIgKyBtQ3VycmVudFN0YXRlLm5hbWUoKTsKKworICAgICAgICAgICAgc3dpdGNoIChtc2cud2hhdCkgeworICAgICAgICAgICAgICAgIGNhc2UgTVNHX1dBSVRfVU5USUxfRE9ORToKKyAgICAgICAgICAgICAgICAgICAgbUN1cnJlbnRTdGF0ZSA9IEN1cnJlbnRTdGF0ZS5XQUlUSU5HX0ZPUl9BU1lOQ0hST05PVVNfVEVTVDsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICAgICAgICBjYXNlIE1TR19OT1RJRllfRE9ORToKKyAgICAgICAgICAgICAgICAgICAgaWYgKG1DdXJyZW50U3RhdGUgPT0gQ3VycmVudFN0YXRlLldBSVRJTkdfRk9SX0FTWU5DSFJPTk9VU19URVNUKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBvblRlc3RGaW5pc2hlZCgpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICAgICAgY2FzZSBNU0dfRFVNUF9BU19URVhUOgorICAgICAgICAgICAgICAgICAgICBpZiAobUN1cnJlbnRSZXN1bHQgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgbUN1cnJlbnRSZXN1bHQgPSBuZXcgVGV4dFJlc3VsdChtQ3VycmVudFRlc3RSZWxhdGl2ZVBhdGgpOworICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgICAgYXNzZXJ0IG1DdXJyZW50UmVzdWx0IGluc3RhbmNlb2YgVGV4dFJlc3VsdAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIDogIm1DdXJyZW50UmVzdWx0IGluc3RhbmNlb2YiICsgbUN1cnJlbnRSZXN1bHQuZ2V0Q2xhc3MoKS5nZXROYW1lKCk7CisKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICAgICAgICBjYXNlIE1TR19EVU1QX0NISUxEX0ZSQU1FU19BU19URVhUOgorICAgICAgICAgICAgICAgICAgICAvKiogSWYgZHVtcEFzVGV4dCB3YXMgbm90IGNhbGxlZCB3ZSBhc3N1bWUgdGhhdCB0aGUgcmVzdWx0IHNob3VsZCBiZSB0ZXh0ICovCisgICAgICAgICAgICAgICAgICAgIGlmIChtQ3VycmVudFJlc3VsdCA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBtQ3VycmVudFJlc3VsdCA9IG5ldyBUZXh0UmVzdWx0KG1DdXJyZW50VGVzdFJlbGF0aXZlUGF0aCk7CisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICBhc3NlcnQgbUN1cnJlbnRSZXN1bHQgaW5zdGFuY2VvZiBUZXh0UmVzdWx0CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgOiAibUN1cnJlbnRSZXN1bHQgaW5zdGFuY2VvZiIgKyBtQ3VycmVudFJlc3VsdC5nZXRDbGFzcygpLmdldE5hbWUoKTsKKworICAgICAgICAgICAgICAgICAgICAoKFRleHRSZXN1bHQpbUN1cnJlbnRSZXN1bHQpLnNldER1bXBDaGlsZEZyYW1lc0FzVGV4dCh0cnVlKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICAgICAgICBjYXNlIE1TR19TRVRfQ0FOX09QRU5fV0lORE9XUzoKKyAgICAgICAgICAgICAgICAgICAgbUNhbk9wZW5XaW5kb3dzID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICAgICAgICBjYXNlIE1TR19EVU1QX0RBVEFCQVNFX0NBTExCQUNLUzoKKyAgICAgICAgICAgICAgICAgICAgbUR1bXBEYXRhYmFzZUNhbGxiYWNrcyA9IHRydWU7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICAgICAgY2FzZSBNU0dfU0VUX0dFT0xPQ0FUSU9OX1BFUk1JU1NJT046CisgICAgICAgICAgICAgICAgICAgIG1Jc0dlb2xvY2F0aW9uUGVybWlzc2lvblNldCA9IHRydWU7CisgICAgICAgICAgICAgICAgICAgIG1HZW9sb2NhdGlvblBlcm1pc3Npb24gPSBtc2cuYXJnMSA9PSAxOworCisgICAgICAgICAgICAgICAgICAgIGlmIChtUGVuZGluZ0dlb2xvY2F0aW9uUGVybWlzc2lvbkNhbGxiYWNrcyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBJdGVyYXRvciBpdGVyID0gbVBlbmRpbmdHZW9sb2NhdGlvblBlcm1pc3Npb25DYWxsYmFja3Mua2V5U2V0KCkuaXRlcmF0b3IoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChpdGVyLmhhc05leHQoKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdlb2xvY2F0aW9uUGVybWlzc2lvbnMuQ2FsbGJhY2sgY2FsbGJhY2sgPQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKEdlb2xvY2F0aW9uUGVybWlzc2lvbnMuQ2FsbGJhY2spIGl0ZXIubmV4dCgpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIFN0cmluZyBvcmlnaW4gPSAoU3RyaW5nKSBtUGVuZGluZ0dlb2xvY2F0aW9uUGVybWlzc2lvbkNhbGxiYWNrcy5nZXQoY2FsbGJhY2spOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhbGxiYWNrLmludm9rZShvcmlnaW4sIG1HZW9sb2NhdGlvblBlcm1pc3Npb24sIGZhbHNlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIG1QZW5kaW5nR2VvbG9jYXRpb25QZXJtaXNzaW9uQ2FsbGJhY2tzID0gbnVsbDsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBicmVhazsKKworICAgICAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgICAgIExvZy53KExPR19UQUcgKyAiOjpoYW5kbGVNZXNzYWdlIiwgIk1lc3NhZ2UgY29kZSBkb2VzIG5vdCBleGlzdDogIiArIG1zZy53aGF0KTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9OworCisgICAgcHJpdmF0ZSB2b2lkIHJlc2V0TGF5b3V0VGVzdENvbnRyb2xsZXIoKSB7CisgICAgICAgIG1DYW5PcGVuV2luZG93cyA9IGZhbHNlOworICAgICAgICBtRHVtcERhdGFiYXNlQ2FsbGJhY2tzID0gZmFsc2U7CisgICAgICAgIG1Jc0dlb2xvY2F0aW9uUGVybWlzc2lvblNldCA9IGZhbHNlOworICAgICAgICBtUGVuZGluZ0dlb2xvY2F0aW9uUGVybWlzc2lvbkNhbGxiYWNrcyA9IG51bGw7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgd2FpdFVudGlsRG9uZSgpIHsKKyAgICAgICAgTG9nLncoTE9HX1RBRyArICI6OndhaXRVbnRpbERvbmUiLCAiY2FsbGVkIik7CisgICAgICAgIG1MYXlvdXRUZXN0Q29udHJvbGxlckhhbmRsZXIuc2VuZEVtcHR5TWVzc2FnZShNU0dfV0FJVF9VTlRJTF9ET05FKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBub3RpZnlEb25lKCkgeworICAgICAgICBMb2cudyhMT0dfVEFHICsgIjo6bm90aWZ5RG9uZSIsICJjYWxsZWQiKTsKKyAgICAgICAgbUxheW91dFRlc3RDb250cm9sbGVySGFuZGxlci5zZW5kRW1wdHlNZXNzYWdlKE1TR19OT1RJRllfRE9ORSk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgZHVtcEFzVGV4dChib29sZWFuIGVuYWJsZVBpeGVsVGVzdCkgeworICAgICAgICBMb2cudyhMT0dfVEFHICsgIjo6ZHVtcEFzVGV4dCgiICsgZW5hYmxlUGl4ZWxUZXN0ICsgIikiLCAiY2FsbGVkI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WRkKCIiKTsKKyAgICB9CisKKyAgICAvKiogVE9ETzogTWFrZSB0aGVzZSBzZXR0aW5ncyAqLworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIFN0cmluZyBURVhUX1JFU1VMVF9FWFRFTlNJT04gPSAidHh0IjsKKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBTdHJpbmcgSU1BR0VfUkVTVUxUX0VYVEVOU0lPTiA9ICJwbmciOworCisgICAgc3RhdGljIGZpbmFsIGludCBNU0dfUFJPQ0VTU19BQ1RVQUxfUkVTVUxUUyA9IDA7CisgICAgc3RhdGljIGZpbmFsIGludCBNU0dfQUxMX1RFU1RTX0ZJTklTSEVEID0gMTsKKyAgICBzdGF0aWMgZmluYWwgaW50IE1TR19GSVJTVF9URVNUID0gMjsKKworICAgIC8qKgorICAgICAqIFRoaXMgaGFuZGxlciBpcyBwdXJlbHkgZm9yIElQQy4gSXQgaXMgdXNlZCB0byBjcmVhdGUgbU1lc3NlbmdlcgorICAgICAqIHRoYXQgZ2VuZXJhdGVzIGEgYmluZGVyIHJldHVybmVkIGluIG9uQmluZCBtZXRob2QuCisgICAgICovCisgICAgcHJpdmF0ZSBIYW5kbGVyIG1JbmNvbWluZ0hhbmRsZXIgPSBuZXcgSGFuZGxlcigpIHsKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyB2b2lkIGhhbmRsZU1lc3NhZ2UoTWVzc2FnZSBtc2cpIHsKKyAgICAgICAgICAgIHN3aXRjaCAobXNnLndoYXQpIHsKKyAgICAgICAgICAgICAgICBjYXNlIE1TR19GSVJTVF9URVNUOgorICAgICAgICAgICAgICAgICAgICBtU3VtbWFyaXplci5yZXNldCgpOworICAgICAgICAgICAgICAgICAgICBCdW5kbGUgYnVuZGxlID0gbXNnLmdldERhdGEoKTsKKyAgICAgICAgICAgICAgICAgICAgZW5zdXJlTmV4dFRlc3RTZXR1cChidW5kbGUuZ2V0U3RyaW5nKCJmaXJzdFRlc3QiKSwgYnVuZGxlLmdldEludCgiaW5kZXgiKSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICAgICAgY2FzZSBNU0dfUFJPQ0VTU19BQ1RVQUxfUkVTVUxUUzoKKyAgICAgICAgICAgICAgICAgICAgTG9nLmQoTE9HX1RBRyArICIubUluY29taW5nSGFuZGxlciIsIG1zZy5nZXREYXRhKCkuZ2V0U3RyaW5nKCJyZWxhdGl2ZVBhdGgiKSk7CisgICAgICAgICAgICAgICAgICAgIG9uQWN0dWFsUmVzdWx0c09idGFpbmVkKG1zZy5nZXREYXRhKCkpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKworICAgICAgICAgICAgICAgIGNhc2UgTVNHX0FMTF9URVNUU19GSU5JU0hFRDoKKyAgICAgICAgICAgICAgICAgICAgbVN1bW1hcml6ZXIuc2V0VGVzdHNSZWxhdGl2ZVBhdGgobUFsbFRlc3RzUmVsYXRpdmVQYXRoKTsKKyAgICAgICAgICAgICAgICAgICAgbVN1bW1hcml6ZXIuc3VtbWFyaXplKCk7CisgICAgICAgICAgICAgICAgICAgIEludGVudCBpbnRlbnQgPSBuZXcgSW50ZW50KE1hbmFnZXJTZXJ2aWNlLnRoaXMsIFRlc3RzTGlzdEFjdGl2aXR5LmNsYXNzKTsKKyAgICAgICAgICAgICAgICAgICAgaW50ZW50LnNldEFjdGlvbihJbnRlbnQuQUNUSU9OX1NIVVRET1dOKTsKKyAgICAgICAgICAgICAgICAgICAgLyoqIFRoaXMgZmxhZyBpcyBuZWVkZWQgYmVjYXVzZSB3ZSBzZW5kIHRoZSBpbnRlbnQgZnJvbSB0aGUgc2VydmljZSAqLworICAgICAgICAgICAgICAgICAgICBpbnRlbnQuYWRkRmxhZ3MoSW50ZW50LkZMQUdfQUNUSVZJVFlfTkVXX1RBU0spOworICAgICAgICAgICAgICAgICAgICBzdGFydEFjdGl2aXR5KGludGVudCk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfTsKKworICAgIHByaXZhdGUgTWVzc2VuZ2VyIG1NZXNzZW5nZXIgPSBuZXcgTWVzc2VuZ2VyKG1JbmNvbWluZ0hhbmRsZXIpOworCisgICAgcHJpdmF0ZSBIYW5kbGVyIG1DcmFzaE1lc3NhZ2VzSGFuZGxlciA9IG5ldyBIYW5kbGVyKCkgeworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIHZvaWQgaGFuZGxlTWVzc2FnZShNZXNzYWdlIG1zZykgeworICAgICAgICAgICAgaWYgKG1zZy53aGF0ID09IE1TR19URVNUX0NSQVNIRUQpIHsKKyAgICAgICAgICAgICAgICBvblRlc3RDcmFzaGVkKCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9OworCisgICAgcHJpdmF0ZSBGaWxlRmlsdGVyIG1GaWxlRmlsdGVyOworICAgIHByaXZhdGUgU3VtbWFyaXplciBtU3VtbWFyaXplcjsKKworICAgIHByaXZhdGUgU3RyaW5nIG1DdXJyZW50bHlSdW5uaW5nVGVzdDsKKyAgICBwcml2YXRlIGludCBtQ3VycmVudGx5UnVubmluZ1Rlc3RJbmRleDsKKworICAgIHByaXZhdGUgU3RyaW5nIG1BbGxUZXN0c1JlbGF0aXZlUGF0aDsKKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIG9uQ3JlYXRlKCkgeworICAgICAgICBzdXBlci5vbkNyZWF0ZSgpOworCisgICAgICAgIG1GaWxlRmlsdGVyID0gbmV3IEZpbGVGaWx0ZXIoVEVTVFNfUk9PVF9ESVJfUEFUSCk7CisgICAgICAgIG1TdW1tYXJpemVyID0gbmV3IFN1bW1hcml6ZXIobUZpbGVGaWx0ZXIsIFJFU1VMVFNfUk9PVF9ESVJfUEFUSCk7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIGludCBvblN0YXJ0Q29tbWFuZChJbnRlbnQgaW50ZW50LCBpbnQgZmxhZ3MsIGlud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WF0aW9uIGFib3V0IHRlc3RzIHRoYXQgcmFuIGFuZCBjYW4gY3JlYXRlIEhUTUwKKyAqIGZpbGVzIHdpdGggc3VtbWFyaWVzIGFuZCBlYXN5IG5hdmlnYXRpb24uCisgKi8KK3B1YmxpYyBjbGFzcyBTdW1tYXJpemVyIHsKKworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIFN0cmluZyBMT0dfVEFHID0gIlN1bW1hcml6ZXIiOworCisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgU3RyaW5nIENTUyA9CisgICAgICAgICAgICAiPHN0eWxlIHR5cGU9XCJ0ZXh0L2Nzc1wiPiIgKworICAgICAgICAgICAgIiogeyIgKworICAgICAgICAgICAgIiAgICAgICBmb250LWZhbWlseTogVmVyZGFuYTsiICsKKyAgICAgICAgICAgICIgICAgICAgYm9yZGVyOiAwOyIgKworICAgICAgICAgICAgIiAgICAgICBtYXJnaW46IDA7IiArCisgICAgICAgICAgICAiICAgICAgIHBhZGRpbmc6IDA7fSIgKworICAgICAgICAgICAgImJvZHkgeyIgKworICAgICAgICAgICAgIiAgICAgICBtYXJnaW46IDEwcHg7fSIgKworICAgICAgICAgICAgImgxIHsiICsKKyAgICAgICAgICAgICIgICAgICAgZm9udC1zaXplOiAyNHB4OyIgKworICAgICAgICAgICAgIiAgICAgICBtYXJnaW46IDRweCAwIDRweCAwO30iICsKKyAgICAgICAgICAgICJoMiB7IiArCisgICAgICAgICAgICAiICAgICAgIGZvbnQtc2l6ZToxOHB4OyIgKworICAgICAgICAgICAgIiAgICAgICB0ZXh0LXRyYW5zZm9ybTogdXBwZXJjYXNlOyIgKworICAgICAgICAgICAgIiAgICAgICBtYXJnaW46IDIwcHggMCAzcHggMDt9IiArCisgICAgICAgICAgICAiaDMsIGgzIGEgeyIgKworICAgICAgICAgICAgIiAgICAgICBmb250LXNpemU6IDE0cHg7IiArCisgICAgICAgICAgICAiICAgICAgIGNvbG9yOiBibGFjazsiICsKKyAgICAgICAgICAgICIgICAgICAgdGV4dC1kZWNvcmF0aW9uOiBub25lOyIgKworICAgICAgICAgICAgIiAgICAgICBtYXJnaW4tYm90dG9tOiA0cHg7fSIgKworICAgICAgICAgICAgImgzIGEgc3Bhbi5wYXRoIHsiICsKKyAgICAgICAgICAgICIgICAgICAgdGV4dC1kZWNvcmF0aW9uOiB1bmRlcmxpbmU7fSIgKworICAgICAgICAgICAgImgzIHNwYW4udHJpIHsiICsKKyAgICAgICAgICAgICIgICAgICAgdGV4dC1kZWNvcmF0aW9uOiBub25lOyIgKworICAgICAgICAgICAgIiAgICAgICBmbG9hdDogbGVmdDsiICsKKyAgICAgICAgICAgICIgICAgICAgd2lkdGg6IDIwcHg7fSIgKworICAgICAgICAgICAgImgzIHNwYW4uc3FyIHsiICsKKyAgICAgICAgICAgICIgICAgICAgdGV4dC1kZWNvcmF0aW9uOiBub25lOyIgKworICAgICAgICAgICAgIiAgICAgICBjb2xvcjogIzhlZTEwMDsiICsKKyAgICAgICAgICAgICIgICAgICAgZmxvYXQ6IGxlZnQ7IiArCisgICAgICAgICAgICAiICAgICAgIHdpZHRoOiAyMHB4O30iICsKKyAgICAgICAgICAgICJoMyBpbWcgeyIgKworICAgICAgICAgICAgIiAgICAgICB3aWR0aDogOHB4OyIgKworICAgICAgICAgICAgIiAgICAgICBtYXJnaW4tcmlnaHQ6IDRweDt9IiArCisgICAgICAgICAgICAiZGl2LmRpZmYgeyIgKworICAgICAgICAgICAgIiAgICAgICBtYXJnaW4tYm90dG9tOiAyNXB4O30iICsKKyAgICAgICAgICAgICJkaXYuZGlmZiBhIHsiICsKKyAgICAgICAgICAgICIgICAgICAgZm9udC1zaXplOiAxMnB4OyIgKworICAgICAgICAgICAgIiAgICAgICBjb2xvcjogIzg4ODt9IiArCisgICAgICAgICAgICAidGFibGUudmlzdWFsX2RpZmYgeyIgKworICAgICAgICAgICAgIiAgICAgICBib3JkZXItYm90dG9tOiAwcHggc29saWQ7IiArCisgICAgICAgICAgICAiICAgICAgIGJvcmRlci1jb2xsYXBzZTogY29sbGFwc2U7IiArCisgICAgICAgICAgICAiICAgICAgIHdpZHRoOiAxMDAlOyIgKworICAgICAgICAgICAgIiAgICAgICBtYXJnaW4tYm90dG9tOiAycHg7fSIgKworICAgICAgICAgICAgInRhYmxlLnZpc3VhbF9kaWZmIHRyLmhlYWRlcnMgdGQgeyIgKworICAgICAgICAgICAgIiAgICAgICBib3JkZXItYm90dG9tOiAxcHggc29saWQ7IiArCisgICAgICAgICAgICAiICAgICAgIGJvcmRlci10b3A6IDA7IiArCisgICAgICAgICAgICAiICAgICAgIHBhZGRpbmctYm90dG9tOiAzcHg7fSIgKworICAgICAgICAgICAgInRhYmxlLnZpc3VhbF9kaWZmIHRyLnJlc3VsdHMgdGQgeyIgKworICAgICAgICAgICAgIiAgICAgICBib3JkZXItdG9wOiAxcHggZGFzaGVkOyIgKworICAgICAgICAgICAgIiAgICAgICBib3JkZXItcmlnaHQ6IDFweCBzb2xpZDsiICsKKyAgICAgICAgICAgICIgICAgICAgZm9udC1zaXplOiAxNXB4OyIgKworICAgICAgICAgICAgIiAgICAgICB2ZXJ0aWNhbC1hbGlnbjogdG9wO30iICsKKyAgICAgICAgICAgICJ0YWJsZS52aXN1YWxfZGlmZiB0ci5yZXN1bHRzIHRkLmxpbmVfY291bnQgeyIgKworICAgICAgICAgICAgIiAgICAgICBiYWNrZ3JvdW5kLWNvbG9yOiNhYWE7IiArCisgICAgICAgICAgICAiICAgICAgIG1pbi13aWR0aDoyMHB4OyIgKworICAgICAgICAgICAgIiAgICAgICB0ZXh0LWFsaWduOiByaWdodDsiICsKKyAgICAgICAgICAgICIgICAgICAgYm9yZGVyLXJpZ2h0OiAxcHggc29saWQ7IiArCisgICAgICAgICAgICAiICAgICAgIGJvcmRlci1sZWZ0OiAxcHggc29saWQ7IiArCisgICAgICAgICAgICAiICAgICAgIHBhZGRpbmc6IDJweCAxcHggMnB4IDBweDt9IiArCisgICAgICAgICAgICAidGFibGUudmlzdWFsX2RpZmYgdHIucmVzdWx0cyB0ZC5saW5lIHsiICsKKyAgICAgICAgICAgICIgICAgICAgcGFkZGluZzogMnB4IDBweCAycHggNHB4OyIgKworICAgICAgICAgICAgIiAgICAgICBib3JkZXItcmlnaHQ6IDFweCBzb2xpZDsiICsKKyAgICAgICAgICAgICIgICAgICAgd2lkdGg6IDQ5LjglO30iICsKKyAgICAgICAgICAgICJ0YWJsZS52aXN1YWxfZGlmZiB0ci5mb290ZXJzIHRkIHsiICsKKyAgICAgICAgICAgICIgICAgICAgYm9yZGVyLXRvcDogMXB4IHNvbGlkOyIgKworICAgICAgICAgICAgIiAgICAgICBib3JkZXItYm90dG9tOiAwO30iICsKKyAgICAgICAgICAgICJ0YWJsZS52aXN1YWxfZGlmZiB0ciB0ZC5zcGFjZSB7IiArCisgICAgICAgICAgICAiICAgICAgIGJvcmRlcjogMDsiICsKKyAgICAgICAgICAgICIgICAgICAgd2lkdGg6IDAuNCV9IiArCisgICAgICAgICAgICAiZGl2LnNwYWNlIHsiICsKKyAgICAgICAgICAgICIgICAgICAgbWFyZ2luLXRvcDo0cHg7fSIgKworICAgICAgICAgICAgInNwYW4uZXFsIHsiICsKKyAgICAgICAgICAgICIgICAgICAgYmFja2dyb3VuZC1jb2xvcjogI2YzZjNmMzt9IiArCisgICAgICAgICAgICAic3Bhbi5kZWwgeyIgKworICAgICAgICAgICAgIiAgICAgICBiYWNrZ3JvdW5kLWNvbG9yOiAjZmY4ODg4OyB9IiArCisgICAgICAgICAgICAic3Bhbi5pbnMgeyIgKworICAgICAgICAgICAgIiAgICAgICBiYWNrZ3JvdW5kLWNvbG9yOiAjODhmZjg4OyB9IiArCisgICAgICAgICAgICAic3Bhbi5mYWlsIHsiICsKKyAgICAgICAgICAgICIgICAgICAgY29sb3I6IHJlZDt9IiArCisgICAgICAgICAgICAic3Bhbi5wYXNzIHsiICsKKyAgICAgICAgICAgICIgICAgICAgY29sb3I6IGdyZWVuO30iICsKKyAgICAgICAgICAgICJzcGFuLnRpbWVfb3V0IHsiICsKKyAgICAgICAgICAgICIgICAgICAgY29sb3I6IG9yYW5nZTt9IiArCisgICAgICAgICAgICAidGFibGUuc3VtbWFyeSB7IiArCisgICAgICAgICAgICAiICAgICAgIGJvcmRlcjogMXB4IHNvbGlkIGJsYWNrOyIgKworICAgICAgICAgICAgIiAgICAgICBtYXJnaW4tdG9wOiAyMHB4O30iICsKKyAgICAgICAgICAgICJ0YWJsZS5zdW1tYXJ5IHRkIHsiICsKKyAgICAgICAgICAgICIgICAgICAgcGFkZGluZzogM3B4O30iICsKKyAgICAgICAgICAgICJzcGFuLmxpc3RJdGVtIHsiICsKKyAgICAgICAgICAgICIgICAgICAgZm9udC1zaXplOiAxMXB4OyIgKworICAgICAgICAgICAgIiAgICAgICBmb250LXdlaWdodDogbm9ybWFsOyIgKworICAgICAgICAgICAgIiAgICAgICB0ZXh0LXRyYW5zZm9ybTogdXBwZXJjYXNlOyIgKworICAgICAgICAgICAgIiAgICAgICBwYWRkaW5nOiAzcHg7IiArCisgICAgICAgICAgICAiICAgICAgIC13ZWJraXQtYm9yZGVyLXJhZGl1czogNHB4O30iICsKKyAgICAgICAgICAgICJzcGFuLiIgKyBBYnN0cmFjdFJlc3VsdC5SZXN1bHRDb2RlLlBBU1MubmFtZSgpICsgInsiICsKKyAgICAgICAgICAgICIgICAgICAgYmFja2dyb3VuZC1jb2xvcjogIzhlZTEwMDsiICsKKyAgICAgICAgICAgICIgICAgICAgY29sb3I6IGJsYWNrO30iICsKKyAgICAgICAgICAgICJzcGFuLiIgKyBBYnN0cmFjdFJlc3VsdC5SZXN1bHRDb2RlLkZBSUxfUkVTVUxUX0RJRkZFUlMubmFtZSgpICsgInsiICsKKyAgICAgICAgICAgICIgICAgICAgYmFja2dyb3VuZC1jb2xvcjogI2NjYzsiICsKKyAgICAgICAgICAgICIgICAgICAgY29sb3I6IGJsYWNrO30iICsKKyAgICAgICAgICAgICJzcGFuLiIgKyBBYnN0cmFjdFJlc3VsdC5SZXN1bHRDb2RlLkZBSUxfTk9fRVhQRUNURURfUkVTVUxULm5hbWUoKSArICJ7IiArCisgICAgICAgICAgICAiICAgICAgIGJhY2tncm91bmQtY29sb3I6ICNhNzAwZTQ7IiArCisgICAgICAgICAgICAiICAgICAgIGNvbG9yOiAjZmZmO30iICsKKyAgICAgICAgICAgICJzcGFuLiIgKyBBYnN0cmFjdFJlc3VsdC5SZXN1bHRDb2RlLkZBSUxfVElNRURfT1VULm5hbWUoKSArICJ7IiArCisgICAgICAgICAgICAiICAgICAgIGJhY2tncm91bmQtY29sb3I6ICNmM2NiMDA7IiArCisgICAgICAgICAgICAiICAgICAgIGNvbG9yOiBibGFjazt9IiArCisgICAgICAgICAgICAic3Bhbi4iICsgQWJzdHJhY3RSZXN1bHQuUmVzdWx0Q29kZS5GQUlMX0NSQVNIRUQubmFtZSgpICsgInsiICsKKyAgICAgICAgICAgICIgICAgICAgYmFja2dyb3VuZC1jb2xvcjogI2MzMDAwMDsiICsKKyAgICAgICAgICAgICIgICAgICAgY29sb3I6ICNmZmY7fSIgKworICAgICAgICAgICAgInNwYW4ubm9MdGMgeyIgKworICAgICAgICAgICAgIiAgICAgICBiYWNrZ3JvdW5kLWNvbG9yOiAjOTQ0MDAwOyIgKworICAgICAgICAgICAgIiAgICAgICBjb2xvcjogI2ZmZjt9IiArCisgICAgICAgICAgICAic3Bhbi5ub0V2ZW50U2VuZGVyIHsiICsKKyAgICAgICAgICAgICIgICAgICAgYmFja2dyb3VuZC1jb2xvcjogIzgxNTYwMDsiICsKKyAgICAgICAgICAgICIgICAgICAgY29sb3I6ICNmZmY7fSIgKworICAgICAgICAgICAgIjwvc3R5bGU+IjsKKworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIFN0cmluZyBTQ1JJUFQgPQorICAgICAgICAgICAgIjxzY3JpcHQgdHlwZT1cInRleHQvamF2YXNjcmlwdFwiPiIgKworICAgICAgICAgICAgIiAgICBmdW5jdGlvbiB0b2dnbGVEaXNwbGF5KGlkKSB7IiArCisgICAgICAgICAgICAiICAgICAgICBlbGVtZW50ID0gZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoaWQpOyIgKworICAgICAgICAgICAgIiAgICAgICAgdHJpYW5nbGUgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgndHJpLicgKyBpZCk7IiArCisgICAgICAgICAgICAiICAgICAgICBpZiAoZWxlbWVudC5zdHlsZS5kaXNwbGF5ID09ICdub25lJykgeyIgKworICAgICAgICAgICAgIiAgICAgICAgICAgIGVsZW1lbnQuc3R5bGUuZGlzcGxheSA9ICdpbmxpbmUnOyIgKworICAgICAgICAgICAgIiAgICAgICAgICAgIHRyaWFuZ2xlLmlubmVySFRNTCA9ICcmI3gyNWJjOyAnOyIgKworICAgICAgICAgICAgIiAgICAgICAgfSBlbHNlIHsiICsKKyAgICAgICAgICAgICIgICAgICAgICAgICBlbGVtZW50LnN0eWxlLmRpc3BsYXkgPSAnbm9uZSc7IiArCisgICAgICAgICAgICAiICAgICAgICAgICAgdHJpYW5nbGUuaW5uZXJIVE1MID0gJyYjeDI1YjY7ICc7IiArCisgICAgICAgICAgICAiICAgICAgICB9IiArCisgICAgICAgICAgICAiICAgIH0iICsKKyAgICAgICAgICAgICI8L3NjcmlwdD4iOworCisgICAgLyoqIFRPRE86IE1ha2UgaXQgYSBzZXR0aW5nICovCisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgU3RyaW5nIEhUTUxfREVUQUlMU19SRUxBVElWRV9QQVRIID0gImRldGFpbHMuaHRtbCI7CisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgU3RyaW5nIFRYVF9TVU1NQVJZX1JFTEFUSVZFX1BBVEggPSAic3VtbWFyeS50eHQiOworCisgICAgcHJpdmF0ZSBpbnQgbUNyYXNoZWRUZXN0c0NvdW50ID0gMDsKKyAgICBwcml2YXRlIExpc3Q8QWJzdHJhY3RSZXN1bHQ+IG1GYWlsZWROb3RJZ25vcmVkVGVzdHMgPSBuZXcgQXJ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JZX1JFTEFUSVZFX1BBVEgpLAorICAgICAgICAgICAgICAgIHR4dC50b1N0cmluZygpLmdldEJ5dGVzKCksIGZhbHNlKTsKKyAgICB9CisKKyAgICBwcml2YXRlIHZvaWQgY3JlYXRlSHRtbERldGFpbHMoKSB7CisgICAgICAgIFN0cmluZ0J1aWxkZXIgaHRtbCA9IG5ldyBTdHJpbmdCdWlsZGVyKCk7CisKKyAgICAgICAgaHRtbC5hcHBlbmQoIjxodG1sPjxoZWFkPiIpOworICAgICAgICBodG1sLmFwcGVuZChDU1MpOworICAgICAgICBodG1sLmFwcGVuZChTQ1JJUFQpOworICAgICAgICBodG1sLmFwcGVuZCgiPC9oZWFkPjxib2R5PiIpOworCisgICAgICAgIGNyZWF0ZVRvcFN1bW1hcnlUYWJsZShodG1sKTsKKworICAgICAgICBjcmVhdGVSZXN1bHRzTGlzdFdpdGhEaWZmKGh0bWwsICJGYWlsZWQiLCBtRmFpbGVkTm90SWdub3JlZFRlc3RzKTsKKworICAgICAgICBjcmVhdGVSZXN1bHRzTGlzdFdpdGhEaWZmKGh0bWwsICJJZ25vcmVkIiwgbUlnbm9yZWRUZXN0cyk7CisKKyAgICAgICAgY3JlYXRlUmVzdWx0c0xpc3ROb0RpZmYoaHRtbCwgIlBhc3NlZCIsIG1QYXNzZWROb3RJZ25vcmVkVGVzdHMpOworCisgICAgICAgIGh0bWwuYXBwZW5kKCI8L2JvZHk+PC9odG1sPiIpOworCisgICAgICAgIEZzVXRpbHMud3JpdGVEYXRhVG9TdG9yYWdlKG5ldyBGaWxlKG1SZXN1bHRzUm9vdERpclBhdGgsIEhUTUxfREVUQUlMU19SRUxBVElWRV9QQVRIKSwKKyAgICAgICAgICAgICAgICBodG1sLnRvU3RyaW5nKCkuZ2V0Qnl0ZXMoKSwgZmFsc2UpOworICAgIH0KKworICAgIHByaXZhdGUgaW50IGdldFRvdGFsVGVzdENvdW50KCkgeworICAgICAgICByZXR1cm4gbUZhaWxlZE5vdElnbm9yZWRUZXN0cy5zaXplKCkgKworICAgICAgICAgICAgICAgIG1QYXNzZWROb3RJZ25vcmVkVGVzdHMuc2l6ZSgpICsKKyAgICAgICAgICAgICAgICBtSWdub3JlZFRlc3RzLnNpemUoKTsKKyAgICB9CisKKyAgICBwcml2YXRlIFN0cmluZyBnZXRXZWJLaXRWZXJzaW9uRnJvbVVzZXJBZ2VudFN0cmluZygpIHsKKyAgICAgICAgUmVzb3VyY2VzIHJlc291cmNlcyA9IG5ldyBSZXNvdXJjZXMobmV3IEFzc2V0TWFuYWdlcigpLCBuZXcgRGlzcGxheU1ldHJpY3MoKSwKKyAgICAgICAgICAgICAgICBuZXcgQ29uZmlndXJhdGlvbigpKTsKKyAgICAgICAgU3RyaW5nIHVzZXJBZ2VudCA9CisgICAgICAgICAgICAgICAgcmVzb3VyY2VzLmdldFN0cmluZyhjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0cmluZy53ZWJfdXNlcl9hZ2VudCk7CisKKyAgICAgICAgTWF0Y2hlciBtYXRjaGVyID0gUGF0dGVybi5jb21waWxlKCJBcHBsZVdlYktpdC8oWzAtOV0rP1xcLlswLTldKSIpLm1hdGNoZXIodXNlckFnZW50KTsKKyAgICAgICAgaWYgKG1hdGNoZXIuZmluZCgpKSB7CisgICAgICAgICAgICByZXR1cm4gbWF0Y2hlci5ncm91cCgxKTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gInVua25vd24iOworICAgIH0KKworICAgIHByaXZhdGUgdm9pZCBjcmVhdGVUb3BTdW1tYXJ5VGFibGUoU3RyaW5nQnVpbGRlciBodG1sKSB7CisgICAgICAgIFNpbXBsZURhdGVGb3JtYXQgZGF0ZUZvcm1hdCA9IG5ldyBTaW1wbGVEYXRlRm9ybWF0KCJ5eXl5L01NL2RkIEhIOm1tOnNzIik7CisgICAgICAgIGh0bWwuYXBwZW5kKCI8aDE+IiArIG1UZXN0c1JlbGF0aXZlUGF0aCArICI8L2gxPiIpOworICAgICAgICBodG1sLmFwcGVuZCg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gICAgIGh0bWwuYXBwZW5kKCI8c3BhbiBjbGFzcz1cInBhdGhcIj4iICsgcmVsYXRpdmVQYXRoICsgIjwvc3Bhbj4iKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgLyoqCisgICAgICAgICAgICAgICAgICogVGVjaG5pY2FsbHksIHR3byBkaWZmZXJlbnQgcGF0aHMgY291bGQgZW5kIHVwIGJlaW5nIHRoZSBzYW1lLCBiZWNhdXNlCisgICAgICAgICAgICAgICAgICogJzonIGlzIGEgdmFsaWQgIGNoYXJhY3RlciBpbiBhIHBhdGguIEhvd2V2ZXIsIGl0IGlzIHByb2JhYmx5IG5vdCBnb2luZworICAgICAgICAgICAgICAgICAqIHRvIGNhdXNlIGFueSBwcm9ibGVtcyBpbiB0aGlzIGNhc2UKKyAgICAgICAgICAgICAgICAgKi8KKyAgICAgICAgICAgICAgICBpZCA9IHJlbGF0aXZlUGF0aC5yZXBsYWNlKEZpbGUuc2VwYXJhdG9yLCAiOiIpOworICAgICAgICAgICAgICAgIGh0bWwuYXBwZW5kKCI8YSBocmVmPVwiI1wiIG9uQ2xpY2s9XCJ0b2dnbGVEaXNwbGF5KCciICsgaWQgKyAiJyk7Iik7CisgICAgICAgICAgICAgICAgaHRtbC5hcHBlbmQoInJldHVybiBmYWxzZTtcIj4iKTsKKyAgICAgICAgICAgICAgICBodG1sLmFwcGVuZCgiPHNwYW4gY2xhc3M9XCJ0cmlcIiBpZD1cInRyaS4iICsgaWQgKyAiXCI+JiN4MjViNjsgPC9zcGFuPiIpOworICAgICAgICAgICAgICAgIGh0bWwuYXBwZW5kKCI8c3BhbiBjbGFzcz1cInBhdGhcIj4iICsgcmVsYXRpdmVQYXRoICsgIjwvc3Bhbj4iKTsKKyAgICAgICAgICAgICAgICBodG1sLmFwcGVuZCgiPC9hPiIpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBodG1sLmFwcGVuZCgiIDxzcGFuIGNsYXNzPVwibGlzdEl0ZW0gIiArIHJlc3VsdENvZGUubmFtZSgpICsgIlwiPiIpOworICAgICAgICAgICAgaHRtbC5hcHBlbmQocmVzdWx0Q29kZS50b1N0cmluZygpKTsKKyAgICAgICAgICAgIGh0bWwuYXBwZW5kKCI8L3NwYW4+Iik7CisKKyAgICAgICAgICAgIC8qKiBEZXRlY3QgbWlzc2luZyBMVEMgZnVuY3Rpb24gKi8KKyAgICAgICAgICAgIFN0cmluZyBhZGRpdGlvbmFsVGV4dE91dHB1dFN0cmluZyA9IHJlc3VsdC5nZXRBZGRpdGlvbmFsVGV4dE91dHB1dFN0cmluZygpOworICAgICAgICAgICAgaWYgKGFkZGl0aW9uYWxUZXh0T3V0cHV0U3RyaW5nICE9IG51bGwgJiYKKyAgICAgICAgICAgICAgICAgICAgYWRkaXRpb25hbFRleHRPdXRwdXRTdHJpbmcuY29udGFpbnMoImNvbS5hbmRyb2lkLmR1bXByZW5kZXJ0cmVlIikgJiYKKyAgICAgICAgICAgICAgICAgICAgYWRkaXRpb25hbFRleHRPdXRwdXRTdHJpbmcuY29udGFpbnMoImhhcyBubyBtZXRob2QiKSkgeworICAgICAgICAgICAgICAgIGlmIChhZGRpdGlvbmFsVGV4dE91dHB1dFN0cmluZy5jb250YWlucygiTGF5b3V0VGVzdENvbnRyb2xsZXIiKSkgeworICAgICAgICAgICAgICAgICAgICBodG1sLmFwcGVuZCgiIDxzcGFuIGNsYXNzPVwibGlzdEl0ZW0gbm9MdGNcIj5MVEMgZnVuY3Rpb24gbWlzc2luZzwvc3Bhbj4iKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaWYgKGFkZGl0aW9uYWxUZXh0T3V0cHV0U3RyaW5nLmNvbnRhaW5zKCJFdmVudFNlbmRlciIpKSB7CisgICAgICAgICAgICAgICAgICAgIGh0bWwuYXBwZW5kKCIgPHNwYW4gY2xhc3M9XCJsaXN0SXRlbSBub0V2ZW50U2VuZGVyXCI+Iik7CisgICAgICAgICAgICAgICAgICAgIGh0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dlKGdldFRleHQoUi5zdHJpbmcuZGlhbG9nX3Byb2dyZXNzX21zZykpOworCisgICAgICAgIHJlcXVlc3RXaW5kb3dGZWF0dXJlKFdpbmRvdy5GRUFUVVJFX1BST0dSRVNTKTsKKworICAgICAgICBJbnRlbnQgaW50ZW50ID0gZ2V0SW50ZW50KCk7CisgICAgICAgIGlmICghaW50ZW50LmdldEFjdGlvbigpLmVxdWFscyhJbnRlbnQuQUNUSU9OX1JVTikpIHsKKyAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfQorICAgICAgICBTdHJpbmcgcGF0aCA9IGludGVudC5nZXRTdHJpbmdFeHRyYShFWFRSQV9URVNUX1BBVEgpOworCisgICAgICAgIHNQcm9ncmVzc0RpYWxvZy5zaG93KCk7CisgICAgICAgIE1lc3NhZ2UgZG9uZU1zZyA9IE1lc3NhZ2Uub2J0YWluKG1IYW5kbGVyLCBNU0dfVEVTVF9MSVNUX1BSRUxPQURFUl9ET05FKTsKKworICAgICAgICBJbnRlbnQgc2VydmljZUludGVudCA9IG5ldyBJbnRlbnQodGhpcywgTWFuYWdlclNlcnZpY2UuY2xhc3MpOworICAgICAgICBzZXJ2aWNlSW50ZW50LnB1dEV4dHJhKCJwYXRoIiwgcGF0aCk7CisgICAgICAgIHN0YXJ0U2VydmljZShzZXJ2aWNlSW50ZW50KTsKKworICAgICAgICBuZXcgVGVzdHNMaXN0UHJlbG9hZGVyVGhyZWFkKHBhdGgsIGRvbmVNc2cpLnN0YXJ0KCk7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHJvdGVjdGVkIHZvaWQgb25OZXdJbnRlbnQoSW50ZW50IGludGVudCkgeworICAgICAgICBpZiAoaW50ZW50LmdldEFjdGlvbigpLmVxdWFscyhJbnRlbnQuQUNUSU9OX1JFQk9PVCkpIHsKKyAgICAgICAgICAgIG9uQ3Jhc2hJbnRlbnQoaW50ZW50KTsKKyAgICAgICAgfSBlbHNlIGlmIChpbnRlbnQuZ2V0QWN0aW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oqCisgICAgICogQSByZWxhdGl2ZSBwYXRoIHRvIHRoZSBmb2xkZXIgd2l0aCB0aGUgdGVzdHMgd2Ugd2FudCB0byBydW4gb3IgcGFydGljdWxhciB0ZXN0LgorICAgICAqIFVzZWQgdXAgdG8gYW5kIGluY2x1ZGluZyBwcmVsb2FkVGVzdHMoKS4KKyAgICAgKi8KKyAgICBwcml2YXRlIFN0cmluZyBtUmVsYXRpdmVQYXRoOworCisgICAgcHJpdmF0ZSBNZXNzYWdlIG1Eb25lTXNnOworCisgICAgLyoqCisgICAgICogVGhlIGdpdmVuIHBhdGggbXVzdCBiZSByZWxhdGl2ZSB0byB0aGUgcm9vdCBkaXIuCisgICAgICoKKyAgICAgKiBAcGFyYW0gcGF0aAorICAgICAqIEBwYXJhbSBkb25lTXNnCisgICAgICovCisgICAgcHVibGljIFRlc3RzTGlzdFByZWxvYWRlclRocmVhZChTdHJpbmcgcGF0aCwgTWVzc2FnZSBkb25lTXNnKSB7CisgICAgICAgIG1GaWxlRmlsdGVyID0gbmV3IEZpbGVGaWx0ZXIoVEVTVFNfUk9PVF9ESVJfUEFUSCk7CisgICAgICAgIG1SZWxhdGl2ZVBhdGggPSBwYXRoOworICAgICAgICBtRG9uZU1zZyA9IGRvbmVNc2c7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgcnVuKCkgeworICAgICAgICAvKiogQ2hlY2sgaWYgdGhlIHBhdGggaXMgY29ycmVjdCAqLworICAgICAgICBGaWxlIGZpbGUgPSBuZXcgRmlsZShURVNUU19ST09UX0RJUl9QQVRILCBtUmVsYXRpdmVQYXRoKTsKKyAgICAgICAgaWYgKCFmaWxlLmV4aXN0cygpKSB7CisgICAgICAgICAgICBMb2cuZShMT0dfVEFHICsgIjo6cnVuIiwgIlBhdGggZG9lcyBub3QgZXhpc3Q6ICIgKyBtUmVsYXRpdmVQYXRoKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIC8qKiBQb3B1b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lbW92ZUZpcnN0KCk7CisgICAgICAgICAgICBpdGVtcyA9IG5ldyBGaWxlKFRFU1RTX1JPT1RfRElSX1BBVEgsIGN1cnJlbnREaXJSZWxhdGl2ZVBhdGgpLmxpc3RGaWxlcygpOworICAgICAgICAgICAgZm9yIChGaWxlIGl0ZW0gOiBpdGVtcykgeworICAgICAgICAgICAgICAgIGl0ZW1OYW1lID0gaXRlbS5nZXROYW1lKCk7CisgICAgICAgICAgICAgICAgcmVsYXRpdmVQYXRoID0gY3VycmVudERpclJlbGF0aXZlUGF0aCArIEZpbGUuc2VwYXJhdG9yICsgaXRlbU5hbWU7CisKKyAgICAgICAgICAgICAgICBpZiAoaXRlbS5pc0RpcmVjdG9yeSgpICYmIEZpbGVGaWx0ZXIuaXNUZXN0RGlyKGl0ZW1OYW1lKSkgeworICAgICAgICAgICAgICAgICAgICBmb2xkZXJzTGlzdC5hZGQocmVsYXRpdmVQYXRoKTsKKyAgICAgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgaWYgKEZpbGVGaWx0ZXIuaXNUZXN0RmlsZShpdGVtTmFtZSkpIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKCFtRmlsZUZpbHRlci5pc1NraXAocmVsYXRpdmVQYXRoKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgbVRlc3RzTGlzdC5hZGQocmVsYXRpdmVQYXRoKTsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vbVN1bW1hcml6ZXIuYWRkU2tpcHBlZFRlc3QocmVsYXRpdmVQYXRoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIC8qKiBUT0RPOiBTdW1tYXJpemVyIGlzIG5vdyBpbiBzZXJ2aWNlIC0gZmlndXJlIG91dCBob3cgdG8gc2VuZCB0aGUgaW5mbyAqLworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQor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iik7CisgICAgICAgIGh0bWwuYXBwZW5kKCIgICAgPHRkIGNsYXNzPVwibGluZV9jb3VudFwiPiIpOworICAgICAgICBodG1sLmFwcGVuZCgiICAgIDwvdGQ+Iik7CisgICAgICAgIGh0bWwuYXBwZW5kKCIgICAgPHRkIGNsYXNzPVwibGluZVwiPiIpOworICAgICAgICBpZiAobUFjdHVhbFJlc3VsdCA9PSBudWxsKSB7CisgICAgICAgICAgICBodG1sLmFwcGVuZCgiQWN0dWFsIHJlc3VsdCB3YXMgTlVMTCIpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgaHRtbC5hcHBlbmQobUFjdHVhbFJlc3VsdC5yZXBsYWNlKCJcbiIsICI8YnIgLz4iKSk7CisgICAgICAgIH0KKyAgICAgICAgaHRtbC5hcHBlbmQoIiAgICAgICAgPC90ZD4iKTsKKyAgICAgICAgaHRtbC5hcHBlbmQoIiAgICA8L3RyPiIpOworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyBUZXN0VHlwZSBnZXRUeXBlKCkgeworICAgICAgICByZXR1cm4gVGVzdFR5cGUuVEVYVDsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgdm9pZCBvYnRhaW5BY3R1YWxSZXN1bHRzKFdlYlZpZXcgd2VidmlldywgTWVzc2FnZSByZXN1bHRPYnRhaW5lZE1zZykgeworICAgICAgICBtUmVzdWx0T2J0YWluZWRNc2cgPSByZXN1bHRPYnRhaW5lZE1zZzsKKyAgICAgICAgTWVzc2FnZSBtc2cgPSBtSGFuZGxlci5vYnRhaW5NZXNzYWdlKE1TR19ET0NVTUVOVF9BU19URVhUKTsKKworICAgICAgICAvKioKKyAgICAgICAgICogYXJnMSAtIHNob3VsZCBkdW1wIHRvcCBmcmFtZSBhcyB0ZXh0CisgICAgICAgICAqIGFyZzIgLSBzaG91bGQgZHVtcCBjaGlsZCBmcmFtZXMgYXMgdGV4dAorICAgICAgICAgKi8KKyAgICAgICAgb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gICAgICAgTGlua2VkTGlzdDxkaWZmX21hdGNoX3BhdGNoLkRpZmY+IG5ld0RpZmZzID0gbmV3IExpbmtlZExpc3Q8ZGlmZl9tYXRjaF9wYXRjaC5EaWZmPigpOworCisgICAgICAgIFN0cmluZ1tdIHBhcnRzOworICAgICAgICBpbnQgbGVuZ3RoTWludXNPbmU7CisgICAgICAgIGZvciAoZGlmZl9tYXRjaF9wYXRjaC5EaWZmIGRpZmYgOiBkaWZmcykgeworICAgICAgICAgICAgcGFydHMgPSBkaWZmLnRleHQuc3BsaXQoIlxuIiwgLTEpOworICAgICAgICAgICAgaWYgKHBhcnRzLmxlbmd0aCA9PSAxKSB7CisgICAgICAgICAgICAgICAgbmV3RGlmZnMuYWRkKGRpZmYpOworICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBsZW5ndGhNaW51c09uZSA9IHBhcnRzLmxlbmd0aCAtIDE7CisgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGxlbmd0aE1pbnVzT25lOyBpKyspIHsKKyAgICAgICAgICAgICAgICBuZXdEaWZmcy5hZGQobmV3IGRpZmZfbWF0Y2hfcGF0Y2guRGlmZihkaWZmLm9wZXJhdGlvbiwgcGFydHNbaV0gKyAiXG4iKSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoIXBhcnRzW2xlbmd0aE1pbnVzT25lXS5pc0VtcHR5KCkpIHsKKyAgICAgICAgICAgICAgICBuZXdEaWZmcy5hZGQobmV3IGRpZmZfbWF0Y2hfcGF0Y2guRGlmZihkaWZmLm9wZXJhdGlvbiwgcGFydHNbbGVuZ3RoTWludXNPbmVdKSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gbmV3RGlmZnM7CisgICAgfQorCisgICAgcHVibGljIHN0YXRpYyB2b2lkIGdlbmVyYXRlRXhwZWN0ZWRSZXN1bHRMaW5lcyhMaW5rZWRMaXN0PGRpZmZfbWF0Y2hfcGF0Y2guRGlmZj4gZGlmZnMsCisgICAgICAgICAgICBMaW5rZWRMaXN0PEludGVnZXI+IGxpbmVOdW1zLCBMaW5rZWRMaXN0PFN0cmluZz4gbGluZXMpIHsKKyAgICAgICAgU3RyaW5nIGRlbFNwYW4gPSAiPHNwYW4gY2xhc3M9XCJkZWxcIj4iOworICAgICAgICBTdHJpbmcgZXFsU3BhbiA9ICI8c3BhbiBjbGFzcz1cImVxbFwiPiI7CisKKyAgICAgICAgU3RyaW5nIGxpbmUgPSAiIjsKKyAgICAgICAgaW50IGkgPSAxOworICAgICAgICBmb3IgKGRpZmZfbWF0Y2hfcGF0Y2guRGlmZiBkaWZmIDogZGlmZnMpIHsKKyAgICAgICAgICAgIHN3aXRjaCAoZGlmZi5vcGVyYXRpb24pIHsKKyAgICAgICAgICAgICAgICBjYXNlIERFTEVURToKKyAgICAgICAgICAgICAgICAgICAgbGluZSA9IHByb2Nlc3NEaWZmKGRpZmYsIGxpbmVOdW1zLCBsaW5lcywgbGluZSwgaSwgZGVsU3Bhbik7CisgICAgICAgICAgICAgICAgICAgIGlmIChsaW5lLmVxdWFscygiIikpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGkrKzsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBicmVhazsKKworICAgICAgICAgICAgICAgIGNhc2UgSU5TRVJUOgorICAgICAgICAgICAgICAgICAgICBpZiAoZGlmZi50ZXh0LmVuZHNXaXRoKCJcbiIpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBsaW5lTnVtcy5hZGQoRE9OVF9QUklOVF9MSU5FX05VTUJFUik7CisgICAgICAgICAgICAgICAgICAgICAgICBsaW5lcy5hZGQoIiIpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICAgICAgY2FzZSBFUVVBTDoKKyAgICAgICAgICAgICAgICAgICAgbGluZSA9IHByb2Nlc3NEaWZmKGRpZmYsIGxpbmVOdW1zLCBsaW5lcywgbGluZSwgaSwgZXFsU3Bhbik7CisgICAgICAgICAgICAgICAgICAgIGlmIChsaW5lLmVxdWFscygiIikpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGkrKzsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIGlmICghbGluZS5pc0VtcHR5KCkpIHsKKyAgICAgICAgICAgIGxpbmVzLmFkZChsaW5lKTsKKyAgICAgICAgICAgIGxpbmVOdW1zLmFkZChpKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyBzdGF0aWMgdm9pZCBnZW5lcmF0ZUFjdHVhbFJlc3VsdExpbmVzKExpbmtlZExpc3Q8ZGlmZl9tYXRjaF9wYXRjaC5EaWZmPiBkaWZmcywKKyAgICAgICAgICAgIExpbmtlZExpc3Q8SW50ZWdlcj4gbGluZU51bXMsIExpbmtlZExpc3Q8U3RyaW5nPiBsaW5lcykgeworICAgICAgICBTdHJpbmcgaW5zU3BhbiA9ICI8c3BhbiBjbGFzcz1cImluc1wiPiI7CisgICAgICAgIFN0cmluZyBlcWxTcGFuID0gIjxzcGFuIGNsYXNzPVwiZXFsXCI+IjsKKworICAgICAgICBTdHJpbmcgbGluZSA9ICIiOworICAgICAgICBpbnQgaSA9IDE7CisgICAgICAgIGZvciAoZGlmZl9tYXRjaF9wYXRjaC5EaWZmIGRpZmYgOiBkaWZmcykgeworICAgICAgICAgICAgc3dpdGNoIChkaWZmLm9wZXJhdGlvbikgeworICAgICAgICAgICAgICAgIGNhc2UgSU5TRVJUOgorICAgICAgICAgICAgICAgICAgICBsaW5lID0gcHJvY2Vzc0RpZmYoZGlmZiwgbGluZU51bXMsIGxpbmVzLCBsaW5lLCBpLCBpbnNTcGFuKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGxpbmUuZXF1YWxzKCIiKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgaSsrOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICAgICAgY2FzZSBERUxFVEU6CisgICAgICAgICAgICAgICAgICAgIGlmIChkaWZmLnRleHQuZW5kc1dpdGgoIlxuIikpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGxpbmVOdW1zLmFkZChET05UX1BSSU5UX0xJTkVfTlVNQkVSKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGxpbmVzLmFkZCgiIik7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICAgICAgICBjYXNlIEVRVUFMOgorICAgICAgICAgICAgICAgICAgICBsaW5lID0gcHJvY2Vzc0RpZmYoZGlmZiwgbGluZU51bXMsIGxpbmVzLCBsaW5lLCBpLCBlcWxTcGFuKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGxpbmUuZXF1YWxzKCIiKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgaSsrOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgaWYgKCFsaW5lLmlzRW1wdHkoKSkgeworICAgICAgICAgICAgbGluZXMuYWRkKGxpbmUpOworICAgICAgICAgICAgbGluZU51bXMuYWRkKGkpOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogR2VuZXJhdGUgb3IgYXBwZW5kIGEgbGluZSBmb3IgYSBnaXZlbiBkaWZmIGFuZCBhZGQgaXQgdG8gZ2l2ZW4gY29sbGVjdGlvbnMgaWYgbmVjZXNzYXJ5LgorICAgICAqIEl0IHB1dHMgZGlmZnMgaW4gSFRNTCBzcGFucy4KKyAgICAgKgorICAgICAqIEBwYXJhbSBkaWZmCisgICAgICogQHBhcmFtIGxpbmVOdW1zCisgICAgICogQHBhcmFtIGxpbmVzCisgICAgICogQHBhcmFtIGxpbmUKKyAgICAgKiBAcGFyYW0gaQorICAgICAqIEBwYXJhbSBiZWdTcGFuCisgICAgICogQHJldHVybgorICAgICAqLworICAgIHB1YmxpYyBzdGF0aWMgU3RyaW5nIHByb2Nlc3NEaWZmKGRpZmZfbWF0Y2hfcGF0Y2guRGlmZiBkaWZmLCBMaW5rZWRMaXN0PEludGVnZXI+IGxpbmVOdW1zLAorICAgICAgICAgICAgTGlua2VkTGlzdDxTdHJpbmc+IGxpbmVzLCBTdHJpbmcgbGluZSwgaW50IGksIFN0cmluZyBiZWdTcGFuKSB7CisgICAgICAgIFN0cmluZyBlbmRTcGFuID0gIjwvc3Bhbj4iOworICAgICAgICBTdHJpbmcgYnIgPSAiJm5ic3A7IjsKKworICAgICAgICBpZiAoZGlmZi50ZXh0LmVuZHNXaXRoKCJcbiIpKSB7CisgICAgICAgICAgICBsaW5lTnVtcy5hZGQoaSsrKTsKKyAgICAgICAgICAgIC8qKiBUT0RPOiBUaGluayBvZiBiZXR0ZXIgd2F5IHRvIHJlcGxhY2Ugc3R1ZmYgKi8KKyAgICAgICAgICAgIGxpbmUgKz0gYmVnU3BhbiArIGRpZmYudGV4dC5yZXBsYWNlKCIgICIsICImbmJzcDsmbmJzcDsiKQorICAgICAgICAgICAgICAgICAgICArIGVuZFNwYW4gKyBicjsKKyAgICAgICAgICAgIGxpbmVzLmFkZChsaW5lKTsKKyAgICAgICAgICAgIGxpbmUgPSAiIjsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIGxpbmUgKz0gYmVnU3BhbiArIGRpZmYudGV4dC5yZXBsYWNlKCIgICIsICImbmJzcDsmbmJzcDsiKSArIGVuZFNwYW47CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gbGluZTsKKyAgICB9CisKKyAgICBwdWJsaWMgc3RhdGljIFN0cmluZyBnZXRIdG1sKExpbmtlZExpc3Q8SW50ZWdlcj4gbGluZU51bXMxLCBMaW5rZWRMaXN0PFN0cmluZz4gbGluZXMxLAorICAgICAgICAgICAgTGlua2VkTGlzdDxJbnRlZ2VyPiBsaW5lTnVtczIsIExpbmtlZExpc3Q8U3RyaW5nPiBsaW5lczIpIHsKKyAgICAgICAgU3RyaW5nQnVpbGRlciBodG1sID0gbmV3IFN0cmluZ0J1aWxkZXIoKTsKKyAgICAgICAgaW50IGxpbmVOdW07CisgICAgICAgIGludCBzaXplID0gbGluZXMxLnNpemUoKTsKKyAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBzaXplOyBpKyspIHsKKyAgICAgICAgICAgIGh0bWwuYXBwZW5kKCI8dHIgY2xhc3M9XCJyZXN1bHRzXCI+Iik7CisKKyAgICAgICAgICAgIGh0bWwuYXBwZW5kKCIgICAgPHRkIGNsYXNzPVwibGluZV9jb3VudFwiPiIpOworICAgICAgICAgICAgbGluZU51bSA9IGxpbmVOdW1zMS5yZW1vdmVGaXJzdCgpOworICAgICAgICAgICAgaWYgKGxpbmVOdW0gPiAwKSB7CisgICAgICAgICAgICAgICAgaHRtbC5hcHBlbmQobGluZU51bSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBodG1sLmFwcGVuZCgiICAgIDwvdGQ+Iik7CisKKyAgICAgICAgICAgIGh0bWwuYXBwZW5kKCIgICAgPHRkIGNsYXNzPVwibGluZVwiPiIpOworICAgICAgICAgICAgaHRtbC5hcHBlbmQobGluZXMxLnJlbW92ZUZpcnN0KCkpOworICAgICAgICAgICAgaHRtbC5hcHBlbmQoIiAgICA8L3RkPiIpOworCisgICAgICAgICAgICBodG1sLmFwcGVuZCgiICAgIDx0ZCBjbGFzcz1cInNwYWNlXCI+PC90ZD4iKTsKKworICAgICAgICAgICAgaHRtbC5hcHBlbmQoIiAgICA8dGQgY2xhc3M9XCJsaW5lX2NvdW50XCI+Iik7CisgICAgICAgICAgICBsaW5lTnVtID0gbGluZU51bXMyLnJlbW92ZUZpcnN0KCk7CisgICAgICAgICAgICBpZiAob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ZWRDYWxsYmFjaygpIHsKKyAgICAgICAgICAgIC8qKiBUaGlzIG1ldGhvZCBpcyBzYWZlIHRvIGNhbGwgb24gYW55IHRocmVhZCAqLworICAgICAgICAgICAgQE92ZXJyaWRlCisgICAgICAgICAgICBwdWJsaWMgdm9pZCBvbkZpbmlzaGVkKCkgeworICAgICAgICAgICAgICAgIHN5bmNocm9uaXplZCAoU3RhcnRlci50aGlzKSB7CisgICAgICAgICAgICAgICAgICAgIG1FdmVyeXRoaW5nRmluaXNoZWQgPSB0cnVlOworICAgICAgICAgICAgICAgICAgICBTdGFydGVyLnRoaXMubm90aWZ5QWxsKCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9KTsKKworICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKKyAgICAgICAgICAgIHdoaWxlICghbUV2ZXJ5dGhpbmdGaW5pc2hlZCkgeworICAgICAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgICAgIHRoaXMud2FpdCgpOworICAgICAgICAgICAgICAgIH0gY2F0Y2ggKEludGVycnVwdGVkRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICAgICAgTG9nLmUoTE9HX1RBRyArICI6OnN0YXJ0TGF5b3V0VGVzdHMiLCBlLmdldE1lc3NhZ2UoKSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorfQpcIE5vIG5ld2xpbmUgYXQgZW5kIG9mIGZpbGUKZGlmZiAtLWdpdCBhL3Rlc3RzL0R1bXBSZW5kZXJUcmVlMi9zcmMvY29tL2FuZHJvaWQvZHVtcHJlbmRlcnRyZWUyL3VpL0Rpckxpc3RBY3Rpdml0eS5qYXZhIGIvdGVzdHMvRHVtcFJlbmRlclRyZWUyL3NyYy9jb20vYW5kcm9pZC9kdW1wcmVuZGVydHJlZTIvdWkvRGlyTGlzdEFjdGl2aXR5LmphdmEKbmV3IGZpbGUgbW9kZSAx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cnkpIHsKKyAgICAgICAgICAgIG1SZWxhdGl2ZVBhdGggPSByZWxhdGl2ZVBhdGg7CisgICAgICAgICAgICBtTmFtZSA9IG5ldyBGaWxlKHJlbGF0aXZlUGF0aCkuZ2V0TmFtZSgpOworICAgICAgICAgICAgbUlzRGlyZWN0b3J5ID0gaXNEaXJlY3Rvcnk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgYm9vbGVhbiBpc0RpcmVjdG9yeSgpIHsKKyAgICAgICAgICAgIHJldHVybiBtSXNEaXJlY3Rvcnk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgU3RyaW5nIGdldFJlbGF0aXZlUGF0aCgpIHsKKyAgICAgICAgICAgIHJldHVybiBtUmVsYXRpdmVQYXRoOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIFN0cmluZyBnZXROYW1lKCkgeworICAgICAgICAgICAgcmV0dXJuIG1OYW1lOworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyBpbnQgY29tcGFyZVRvKExpc3RJdGVtIGFub3RoZXIpIHsKKyAgICAgICAgICAgIHJldHVybiBtUmVsYXRpdmVQYXRoLmNvbXBhcmVUbyhhbm90aGVyLmdldFJlbGF0aXZlUGF0aCgpKTsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgYm9vbGVhbiBlcXVhbHMoT2JqZWN0IG8pIHsKKyAgICAgICAgICAgIGlmICghKG8gaW5zdGFuY2VvZiBMaXN0SXRlbSkpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHJldHVybiBtUmVsYXRpdmVQYXRoLmVxdWFscygoKExpc3RJdGVtKSBvKS5nZXRSZWxhdGl2ZVBhdGgoKSk7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIGludCBoYXNoQ29kZSgpIHsKKyAgICAgICAgICAgIHJldHVybiBtUmVsYXRpdmVQYXRoLmhhc2hDb2RlKCk7CisgICAgICAgIH0KKworICAgIH0KKworICAgIC8qKgorICAgICAqIEEgY3VzdG9tIGFkYXB0ZXIgdGhhdCBzZXRzIHRoZSBwcm9wZXIgaWNvbiBhbmQgbGFiZWwgaW4gdGhlIGxpc3Qgdmlldy4KKyAgICAgKi8KKyAgICBwcml2YXRlIHN0YXRpYyBjbGFzcyBEaXJMaXN0QWRhcHRlciBleHRlbmRzIEFycmF5QWRhcHRlcjxMaXN0SXRlbT4geworICAgICAgICBwcml2YXRlIEFjdGl2aXR5IG1Db250ZXh0OworICAgICAgICBwcml2YXRlIExpc3RJdGVtW10gbUl0ZW1zOworCisgICAgICAgIHB1YmxpYyBEaXJMaXN0QWRhcHRlcihBY3Rpdml0eSBjb250ZXh0LCBMaXN0SXRlbVtdIGl0ZW1zKSB7CisgICAgICAgICAgICBzdXBlcihjb250ZXh0LCBSLmxheW91dC5kaXJsaXN0X3JvdywgaXRlbXMpOworCisgICAgICAgICAgICBtQ29udGV4dCA9IGNvbnRleHQ7CisgICAgICAgICAgICBtSXRlbXMgPSBpdGVtczsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgVmlldyBnZXRWaWV3KGludCBwb3NpdGlvbiwgVmlldyBjb252ZXJ0VmlldywgVmlld0dyb3VwIHBhcmVudCkgeworICAgICAgICAgICAgTGF5b3V0SW5mbGF0ZXIgaW5mbGF0ZXIgPSBtQ29udGV4dC5nZXRMYXlvdXRJbmZsYXRlcigpOworICAgICAgICAgICAgVmlldyByb3cgPSBpbmZsYXRlci5pbmZsYXRlKFIubGF5b3V0LmRpcmxpc3Rfcm93LCBudWxsKTsKKworICAgICAgICAgICAgVGV4dFZpZXcgbGFiZWwgPSAoVGV4dFZpZXcpIHJvdy5maW5kVmlld0J5SWQoUi5pZC5sYWJlbCk7CisgICAgICAgICAgICBsYWJlbC5zZXRUZXh0K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dGlvbihwb3NpdGlvbik7CisKKyAgICAgICAgICAgICAgICBpZiAoaXRlbS5pc0RpcmVjdG9yeSgpKSB7CisgICAgICAgICAgICAgICAgICAgIHNob3dEaXIoaXRlbS5nZXRSZWxhdGl2ZVBhdGgoKSk7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgLyoqIFJ1biB0aGUgdGVzdCAqLworICAgICAgICAgICAgICAgICAgICBJbnRlbnQgaW50ZW50ID0gbmV3IEludGVudCgpOworICAgICAgICAgICAgICAgICAgICBpbnRlbnQuc2V0Q2xhc3MoRGlyTGlzdEFjdGl2aXR5LnRoaXMsIFRlc3RzTGlzdEFjdGl2aXR5LmNsYXNzKTsKKyAgICAgICAgICAgICAgICAgICAgaW50ZW50LnNldEFjdGlvbihJbnRlbnQuQUNUSU9OX1JVTik7CisgICAgICAgICAgICAgICAgICAgIGludGVudC5wdXRFeHRyYShUZXN0c0xpc3RBY3Rpdml0eS5FWFRSQV9URVNUX1BBVEgsIGl0ZW0uZ2V0UmVsYXRpdmVQYXRoKCkpOworICAgICAgICAgICAgICAgICAgICBzdGFydEFjdGl2aXR5KGludGVudCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9KTsKKworICAgICAgICBtTGlzdFZpZXcuc2V0T25JdGVtTG9uZ0NsaWNrTGlzdGVuZXIobmV3IEFkYXB0ZXJWaWV3Lk9uSXRlbUxvbmdDbGlja0xpc3RlbmVyKCkgeworICAgICAgICAgICAgQE92ZXJyaWRlCisgICAgICAgICAgICBwdWJsaWMgYm9vbGVhbiBvbkl0ZW1Mb25nQ2xpY2soQWRhcHRlclZpZXc8Pz4gcGFyZW50LCBWaWV3IHZpZXcsIGludCBwb3NpdGlvbiwgbG9uZyBpZCkgeworICAgICAgICAgICAgICAgIExpc3RJdGVtIGl0ZW0gPSAoTGlzdEl0ZW0pIHBhcmVudC5nZXRJdGVtQXRQb3NpdGlvbihwb3NpdGlvbik7CisKKyAgICAgICAgICAgICAgICBpZiAoaXRlbS5pc0RpcmVjdG9yeSgpKSB7CisgICAgICAgICAgICAgICAgICAgIEJ1bmRsZSBhcmd1bWVudHMgPSBuZXcgQnVuZGxlKDEpOworICAgICAgICAgICAgICAgICAgICBhcmd1bWVudHMucHV0U3RyaW5nKCJuYW1lIiwgaXRlbS5nZXROYW1lKCkpOworICAgICAgICAgICAgICAgICAgICBhcmd1bWVudHMucHV0U3RyaW5nKCJyZWxhdGl2ZVBhdGgiLCBpdGVtLmdldFJlbGF0aXZlUGF0aCgpKTsKKyAgICAgICAgICAgICAgICAgICAgc2hvd0RpYWxvZyhESUFMT0dfUlVOX0FCT1JUX0RJUiwgYXJndW1lbnRzKTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAvKiogVE9ETzogTWF5YmUgc2hvdyBzb21lIGluZm8gYWJvdXQgYSB0ZXN0PyAqLworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICAgICAgfQorICAgICAgICB9KTsKKworICAgICAgICAvKiogQWxsIHRoZSBwYXRocyBhcmUgcmVsYXRpdmUgdG8gdGVzdCByb290IGRpciB3aGVyZSBwb3NzaWJsZSAqLworICAgICAgICBzaG93RGlyKCIiKTsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICAvKioKKyAgICAgKiBNb3ZlcyB0byB0aGUgcGFyZW50IGRpcmVjdG9yeSBpZiBvbmUgZXhpc3RzLiBEb2VzIG5vdCBhbGxvdyB0byBtb3ZlIGFib3ZlCisgICAgICogdGhlIHRlc3QgJ3Jvb3QnIGRpcmVjdG9yeS4KKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBvbkJhY2tQcmVzc2VkKCkgeworICAgICAgICBGaWxlIGN1cnJlbnREaXJQYXJlbnQgPSBuZXcgRmlsZShtQ3VycmVudERpclBhdGgpLmdldFBhcmVudEZpbGUoKTsKKyAgICAgICAgaWYgKGN1cnJlbnREaXJQYXJlbnQgIT0gbnVsbCkgeworICAgICAgICAgICAgc2hvd0RpcihjdXJyZW50RGlyUGFyZW50LmdldFBhdGgoKSk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBzaG93RGlyKCIiKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIFByZXZlbnRzIHRoZSBhY3Rpdml0eSBmcm9tIHJlY3JlYXRpbmcgb24gY2hhbmdlIG9mIG9yaWVudGF0aW9uLiBUaGUgdGl0bGUgbmVlZHMgdG8KKyAgICAgKiBiZSByZWNhbGN1bGF0ZWQuCisgICAgICovCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgb25Db25maWd1cmF0aW9uQ2hhbmdlZChDb25maWd1cmF0aW9uIG5ld0NvbmZpZykgeworICAgICAgICBzdXBlci5vbkNvbmZpZ3VyYXRpb25DaGFuZ2VkKG5ld0NvbmZpZyk7CisKKyAgICAgICAgc2V0VGl0bGUoc2hvcnRlblRpdGxlKG1DdXJyZW50RGlyUGF0aCkpOworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHByb3RlY3RlZCBEaWFsb2cgb25DcmVhdGVEaWFsb2coaW50IGlkLCBmaW5hbCBCdW5kbGUgYXJncykgeworICAgICAgICBEaWFsb2cgZGlhbG9nID0gbnVsbDsKKyAgICAgICAgQWxlcnREaWFsb2cuQnVpbGRlciBidWlsZGVyID0gbmV3IEFsZXJ0RGlhbG9nLkJ1aWxkZXIodGhpcyk7CisKKyAgICAgICAgc3dpdGNoIChpZCkgeworICAgICAgICAgICAgY2FzZSBESUFMT0dfUlVOX0FCT1JUX0RJUjoKKyAgICAgICAgICAgICAgICBidWlsZGVyLnNldFRpdGxlKGdldFRleHQoUi5zdHJpbmcuZGlhbG9nX3J1bl9hYm9ydF9kaXJfdGl0bGVfcHJlZml4KSArICIgIiArCisgICAgICAgICAgICAgICAgICAgICAgICBhcmdzLmdldFN0cmluZygibmFtZSIpKTsKKyAgICAgICAgICAgICAgICBidWlsZGVyLnNldE1lc3NhZ2UoUi5zdHJpbmcuZGlhbG9nX3J1bl9hYm9ydF9kaXJfbXNnKTsKKyAgICAgICAgICAgICAgICBidWlsZGVyLnNldENhbmNlbGFibGUodHJ1ZSk7CisKKyAgICAgICAgICAgICAgICBidWlsZGVyLnNldFBvc2l0aXZlQnV0dG9uKFIuc3RyaW5nLmRpYWxvZ19ydW5fYWJvcnRfZGlyX29rX2J1dHRvbiwKKyAgICAgICAgICAgICAgICAgICAgICAgIG5ldyBEaWFsb2dJbnRlcmZhY2UuT25DbGlja0xpc3RlbmVyKCkgeworICAgICAgICAgICAgICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgICAgICAgICAgICAgcHVibGljIHZvaWQgb25DbGljayhEaWFsb2dJbnRlcmZhY2UgZGlhbG9nLCBpbnQgd2hpY2gpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJlbW92ZURpYWxvZyhESUFMT0dfUlVOX0FCT1JUX0RJUik7CisgICAgICAgICAgICAgICAgICAgICAgICAvKiogUnVuIHRoZSB0ZXN0cyAqLworICAgICAgICAgICAgICAgICAgICAgICAgSW50ZW50IGludGVudCA9IG5ldyBJbnRlbnQoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGludGVudC5zZXRDbGFzcyhEaXJMaXN0QWN0aXZpdHkudGhpcywgVGVzdHNMaXN0QWN0aXZpdHkuY2xhc3MpOworICAgICAgICAgICAgICAgICAgICAgICAgaW50ZW50LnNldEFjdGlvbihJbnRlbnQuQUNUSU9OX1JVTik7CisgICAgICAgICAgICAgICAgICAgICAgICBpbnRlbnQucHV0RXh0cmEoVGVzdHNMaXN0QWN0aXZpdHkuRVhUUkFfVEVTVF9QQVRILAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhcmdzLmdldFN0cmluZygicmVsYXRpdmVQYXRoIikpOworICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnRBY3Rpdml0eShpbnRlbnQpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfSk7CisKKyAgICAgICAgICAgICAgICBidWlsZGVyLnNldE5lZ2F0aXZlQnV0dG9uKFIuc3RyaW5nLmRpYWxvZ19ydW5fYWJvcnRfZGlyX2Fib3J0X2J1dHRvbiwKKyAgICAgICAgICAgICAgICAgICAgICAgIG5ldyBEaWFsb2dJbnRlcmZhY2UuT25DbGlja0xpc3RlbmVyKCkgeworICAgICAgICAgICAgICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgICAgICAgICAgICAgcHVibGljIHZvaWQgb25DbGljayhEaWFsb2dJbnRlcmZhY2UgZGlhbG9nLCBpbnQgd2hpY2gpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJlbW92ZURpYWxvZyhESUFMT0dfUlVOX0FCT1JUX0RJUik7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9KTsKKworICAgICAgICAgICAgICAgIGRpYWxvZyA9IGJ1aWxkZXIuY3JlYXRlKCk7CisgICAgICAgICAgICAgICAgZGlhbG9nLnNldE9uQ2FuY2VsTGlzdGVuZXIobmV3IERpYWxvZ0ludGVyZmFjZS5PbkNhbmNlbExpc3RlbmVyKCkgeworICAgICAgICAgICAgICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgICAgICAgICAgICAgcHVibGljIHZvaWQgb25DYW5jZWwoRGlhbG9nSW50ZXJmYWNlIGRpYWxvZykgeworICAgICAgICAgICAgICAgICAgICAgICAgcmVtb3ZlRGlhbG9nKERJQUxPR19SVU5fQUJPUlRfRElSKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0pOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisKKyAgICAgICAgcmV0dXJuIGRpYWxvZzsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBMb2FkcyB0aGUgY29udGVudHMgb2YgZGlyIGludG8gdGhlIGxpc3Qgdmlldy4KKyAgICAgKgorICAgICAqIEBwYXJhbSBkaXJQYXRoCisgICAgICogICAgICBkaXJlY3RvcnkgdG8gbG9hZCBpbnRvIGxpc3QgdmlldworICAgICAqLworICAgIHByaXZhdGUgdm9pZCBzaG93RGlyKFN0cmluZyBkaXJQYXRoKSB7CisgICAgICAgIG1DdXJyZW50RGlyUGF0aCA9IGRpclBhdGg7CisKKyAgICAgICAgLyoqIFNob3cgcHJvZ3Jlc3MgZGlhbG9nIHdpdGggYSBkZWxheSAqLworICAgICAgICBmaW5hbCBIYW5kbGVyIGRlbGF5ZWREaWFsb2dIYW5kbGVyID0gbmV3IEhhbmRsZXIoKSB7CisgICAgICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgICAgIHB1YmxpYyB2b2lkIGhhbmRsZU1lc3NhZ2UoTWVzc2FnZSBtc2cpIHsKKyAgICAgICAgICAgICAgICBpZiAobXNnLndoYXQgPT0gTVNHX1NIT1dfUFJPR1JFU1NfRElBTE9HKSB7CisgICAgICAgICAgICAgICAgICAgIGlmIChzUHJvZ3Jlc3NEaWFsb2cgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgc1Byb2dyZXNzRGlhbG9nID0gbmV3IFByb2dyZXNzRGlhbG9nKERpckxpc3RBY3Rpdml0eS50aGlzKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHNQcm9ncmVzc0RpYWxvZy5zZXRDYW5jZWxhYmxlKGZhbHNlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHNQcm9ncmVzc0RpYWxvZy5zZXRQcm9ncmVzc1N0eWxlKFByb2dyZXNzRGlhbG9nLlNUWUxFX1NQSU5ORVIpOworICAgICAgICAgICAgICAgICAgICAgICAgc1Byb2dyZXNzRGlhbG9nLnNldFRpdGxlKFIuc3RyaW5nLmRpYWxvZ19wcm9ncmVzc190aXRsZSk7CisgICAgICAgICAgICAgICAgICAgICAgICBzUHJvZ3Jlc3NEaWFsb2cuc2V0TWVzc2FnZShnZXRUZXh0KFIuc3RyaW5nLmRpYWxvZ19wcm9ncmVzc19tc2cpKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBzUHJvZ3Jlc3NEaWFsb2cuc2hvdygpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfTsKKyAgICAgICAgTWVzc2FnZSBtc2dTaG93RGlhbG9nID0gZGVsYXllZERpYWxvZ0hhbmRsZXIub2J0YWluTWVzc2FnZShNU0dfU0hPV19QUk9HUkVTU19ESUFMT0cpOworICAgICAgICBkZWxheWVkRGlhbG9nSGFuZGxlci5zZW5kTWVzc2FnZURlbGF5ZWQobXNnU2hvd0RpYWxvZywgUFJPR1JFU1NfRElBTE9HX0RFTEFZX01TKTsKKworICAgICAgICAvKiogRGVsZWdhdGUgbG9hZGluZyBjb250ZW50cyBmcm9tIFNEIGNhcmQgdG8gYSBuZXcgdGhyZWFkICovCisgICAgICAgIG5ldyBMb2FkTGlzdEl0ZW1zVGhyZWFkKG1DdXJyZW50RGlyUGF0aCwgbmV3IEhhbmRsZXIoKSB7CisgICAgICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgICAgIHB1YmxpYyB2b2lkIGhhbmRsZU1lc3NhZ2UoTWVzc2FnZSBtc2cpIHsKKyAgICAgICAgICAgICAgICBpZiAobXNnLndoYXQgPT0gTVNHX0xPQURFRF9JVEVNUykgeworICAgICAgICAgICAgICAgICAgICBzZXRMaXN0QWRhcHRlcihuZXcgRGlyTGlzdEFkYXB0ZXIoRGlyTGlzdEFjdGl2aXR5LnRoaXMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgKExpc3RJdGVtW10pbXNnLm9iaikpOworICAgICAgICAgICAgICAgICAgICBkZWxheWVkRGlhbG9nSGFuZGxlci5yZW1vdmVNZXNzYWdlcyhNU0dfU0hPV19QUk9HUkVTU19ESUFMT0cpOworICAgICAgICAgICAgICAgICAgICBzZXRUaXRsZShzaG9ydGVuVGl0bGUobUN1cnJlbnREaXJQYXRoKSk7CisgICAgICAgICAgICAgICAgICAgIGlmIChzUHJvZ3Jlc3NEaWFsb2cgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgc1Byb2dyZXNzRGlhbG9nLmRpc21pc3MoKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfSkuc3RhcnQoKTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBUT0RPOiBmaW5kIGEgbmVhdCB3YXkgdG8gZGV0ZXJtaW5lIG51bWJlciBvZiBjaGFyYWN0ZXJzIHRoYXQgZml0IGluIHRoZSB0aXRsZQorICAgICAqIGJhci4KKyAgICAgKiAqLworICAgIHByaXZhdGUgU3RyaW5nIHNob3J0ZW5UaXRsZShTdHJpbmcgdGl0bGUpIHsKKyAgICAgICAgaWYgKHRpdGxlLmVxdWFscygiIikpIHsKKyAgICAgICAgICAgIHJldHVybiAiVGVzdHMnIHJvb3QgZGlyOiI7CisgICAgICAgIH0KKyAgICAgICAgaW50IGNoYXJDb3VudCA9IG1MaXN0Vmlldy5nZXRXaWR0aCgpIC8gTUVBTl9USVRMRV9DSEFSX1NJWkU7CisKKyAgICAgICAgaWYgKHRpdGxlLmxlbmd0aCgpID4gY2hhckNvdW50KSB7CisgICAgICAgICAgICByZXR1cm4gIi4uLiIgKyB0aXRsZS5zdWJzdHJpbmcodGl0bGUubGVuZ3RoKCkgLSBjaGFyQ291bnQpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgcmV0dXJuIHRpdGxlOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogUmV0dXJuIHRoZSBhcnJheSB3aXRoIGNvbnRlbnRzIG9mIHRoZSBnaXZlbiBkaXJlY3RvcnkuCisgICAgICogRmlyc3QgaXQgY29udGFpbnMgdGhlIHN1YmZvbGRlcnMsIHRoZW4gdGhlIGZpbGVzLiBCb3RoIHNvcnRlZAorICAgICAqIGFscGhhYmV0aWNhbGx5LgorICAgICAqCisgICAgICogVGhlIGRpclBhdGggaXMgcmVsYXRpdmUuCisgICAgICovCisgICAgcHJpdmF0ZSBMaXN0SXRlbVtdIGdldERpckxpc3QoU3RyaW5nIGRpclBhdGgpIHsKKyAgICAgICAgRmlsZSBkaXIgPSBuZXcgRmlsZShtUm9vdERpclBhdGgsIGRpclBhdGgpOworCisgICAgICAgIGlmICghZGlyLmV4aXN0cygpKSB7CisgICAgICAgICAgICByZXR1cm4gbmV3IExpc3RJdGVtWzBdOworICAgICAgICB9CisKKyAgICAgICAgTGlzdDxMaXN0SXRlbT4gc3ViRGlycyA9IG5ldyBBcnJheUxpc3Q8TGlzdEl0ZW0+KCk7CisgICAgICAgIExpc3Q8TGlzdEl0ZW0+IHN1YkZpbGVzID0gbmV3IEFycmF5TGlzdDxMaXN0SXRlbT4oKTsKKworICAgICAgICBmb3IgKEZpbGUgaXRlbSA6IGRpci5saXN0RmlsZXMoKSkgeworICAgICAgICAgICAgaWYgKGl0ZW0uaXNEaXJlY3RvcnkoKSAmJiBGaWxlRmlsdGVyLmlzVGVzdERpcihpdGVtLmdldE5hbWUoKSkpIHsKKyAgICAgICAgICAgICAgICBzdWJEaXJzLmFkZChuZXcgTGlzdEl0ZW0obUZpbGVGaWx0ZXIuZ2V0UmVsYXRpdmVQYXRoKGl0ZW0pLCB0cnVlKSk7CisgICAgICAgICAgICB9IGVsc2UgaWYgKEZpbGVGaWx0ZXIuaXNUZXN0RmlsZShpdGVtLmdldE5hbWUoKSkpIHsKKyAgICAgICAgICAgICAgICBzdWJGaWxlcy5hZGQobmV3IExpc3RJdGVtKG1GaWxlRmlsdGVyLmdldFJlbGF0aXZlUGF0aChpdGVtKSwgZmFsc2UpKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIENvbGxlY3Rpb25zLnNvcnQoc3ViRGlycyk7CisgICAgICAgIENvbGxlY3Rpb25zLnNvcnQoc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AgICAgICBhbmRyb2lkOmxhYmVsPSJfzrFMYXllcnMiPgorICAgICAgICAgICAgPGludGVudC1maWx0ZXI+CisgICAgICAgICAgICAgICAgPGFjdGlvbiBhbmRyb2lkOm5hbWU9ImFuZHJvaWQuaW50ZW50LmFjdGlvbi5NQUlOIiAvPgorICAgICAgICAgICAgICAgIDxjYXRlZ29yeSBhbmRyb2lkOm5hbWU9ImFuZHJvaWQuaW50ZW50LmNhdGVnb3J5LkxBVU5DSEVSIiAvPgorICAgICAgICAgICAgPC9pbnRlbnQtZmlsdGVyPgorICAgICAgICA8L2FjdGl2aXR5PgorICAgICAgICAKKyAgICAgICAgPGFjdGl2aXR5CisgICAgICAgICAgICAgICAgYW5kcm9pZDpuYW1lPSJMYXllcnNBY3Rpdml0eSIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxhYmVsPSJfTGF5ZXJzIgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6dGhlbWU9IkBhbmRyb2lkOnN0eWxlL1RoZW1lLlRyYW5zbHVjZW50Lk5vVGl0bGVCYXIiPgorICAgICAgICAgICAgPGludGVudC1maWx0ZXI+CisgICAgICAgICAgICAgICAgPGFjdGlvbiBhbmRyb2lkOm5hbWU9ImFuZHJvaWQuaW50ZW50LmFjdGlvbi5NQUlOIiAvPgorICAgICAgICAgICAgICAgIDxjYXRlZ29yeSBhbmRyb2lkOm5hbWU9ImFuZHJvaWQuaW50ZW50LmNhdGVnb3J5LkxBVU5DSEVSIiAvPgorICAgICAgICAgICAgPC9pbnRlbnQtZmlsdGVyPgorICAgICAgICA8L2FjdGl2aXR5PgorCisgICAgICAgIDxhY3Rpdml0eQorICAgICAgICAgICAgICAgIGFuZHJvaWQ6bmFtZT0iWGZlcm1vZGVBY3Rpdml0eSIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxhYmVsPSJfWGZlcm1vZGVzIgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6dGhlbWU9IkBhbmRyb2lkOnN0eWxlL1Ro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nQuY2F0ZWdvcnkuTEFVTkNIRVIiIC8+CisgICAgICAgICAgICA8L2ludGVudC1maWx0ZXI+CisgICAgICAgIDwvYWN0aXZpdHk+CisKKyAgICAgICAgPGFjdGl2aXR5CisgICAgICAgICAgICAgICAgYW5kcm9pZDpuYW1lPSJTaGFkZXJzQWN0aXZpdHkiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpsYWJlbD0iX1NoYWRlcnMiPgorICAgICAgICAgICAgPGludGVudC1maWx0ZXI+CisgICAgICAgICAgICAgICAgPGFjdGlvbiBhbmRyb2lkOm5hbWU9ImFuZHJvaWQuaW50ZW50LmFjdGlvbi5NQUlOIiAvPgorICAgICAgICAgICAgICAgIDxjYXRlZ29yeSBhbmRyb2lkOm5hbWU9ImFuZHJvaWQuaW50ZW50LmNhdGVnb3J5LkxBVU5DSEVSIiAvPgorICAgICAgICAgICAgPC9pbnRlbnQtZmlsdGVyPgorICAgICAgICA8L2FjdGl2aXR5PgorICAgICAgICAKKyAgICAgICAgPGFjdGl2aXR5CisgICAgICAgICAgICAgICAgYW5kcm9pZDpuYW1lPSJUZXh0QWN0aXZpdHkiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpsYWJlbD0iX1RleHQiCisgICAgICAgICAgICAgICAgYW5kcm9pZDp0aGVtZT0iQGFuZHJvaWQ6c3R5bGUvVGhlbWUuTm9UaXRsZUJhciI+CisgICAgICAgICAgICA8aW50ZW50LWZpbHRlcj4KKyAgICAgICAgICAgICAgICA8YWN0aW9uIGFuZHJvaWQ6bmFtZT0iYW5kcm9pZC5pbnRlbnQuYWN0aW9uLk1BSU4iIC8+CisgICAgICAgICAgICAgICAgPGNhdGVnb3J5IGFuZHJvaWQ6bmFtZT0iYW5kcm9pZC5pbnRlbnQuY2F0ZWdvcnkuTEFVTkNIRVIiIC8+CisgICAgICAgICAgICA8L2ludGVudC1maWx0ZXI+CisgICAgICAgIDwvYWN0aXZpdHk+CisKKyAgICAgICAgPGFjdGl2aXR5CisgICAgICAgICAgICAgICAgYW5kcm9pZDpuYW1lPSJMaXN0QWN0aXZpdHkiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpsYWJlbD0iX0xpc3QiPgorICAgICAgICAgICAgPGludGVudC1maWx0ZXI+CisgICAgICAgICAgICAgICAgPGFjdGlvbiBhbmRyb2lkOm5hbWU9ImFuZHJvaWQuaW50ZW50LmFjdGlvbi5NQUlOIiAvPgorICAgICAgICAgICAgICAgIDxjYXRlZ29yeSBhbmRyb2lkOm5hbWU9ImFuZHJvaWQuaW50ZW50LmNhdGVnb3J5LkxBVU5DSEVSIiAvPgorICAgICAgICAgICAgPC9pbnRlbnQtZmlsdGVyPgorICAgICAgICA8L2FjdGl2aXR5PgorICAgICAgICAKKyAgICAgICAgPGFjdGl2aXR5CisgICAgICAgICAgICAgICAgYW5kcm9pZDpuYW1lPSJNb3JlU2hhZGVyc0FjdGl2aXR5IgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGFiZWw9Il9TaGFkZXJzMiI+CisgICAgICAgICAgICA8aW50ZW50LWZpbHRlcj4KKyAgICAgICAgICAgICAgICA8YWN0aW9uIGFuZHJvaWQ6bmFtZT0iYW5kcm9pZC5pbnRlbnQuYWN0aW9uLk1BSU4iIC8+CisgICAgICAgICAgICAgICAgPGNhdGVnb3J5IGFuZHJvaWQ6bmFtZT0iYW5kcm9pZC5pbnRlbnQuY2F0ZWdvcnkuTEFVTkNIRVIiIC8+CisgICAgICAgICAgICA8L2ludGVudC1maWx0ZXI+CisgICAgICAgIDwvYWN0aXZpdHk+CisKKyAgICAgICAgPGFjdGl2aXR5CisgICAgICAgICAgICAgICAgYW5kcm9pZDpuYW1lPSJDb2xvckZpbHRlcnNBY3Rpdml0eSIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxhYmVsPSJfQ29sb3JGaWx0ZXJzIj4KKyAgICAgICAgICAgIDxpbnRlbnQtZmlsdGVyPgorICAgICAgICAgICAgICAgIDxhY3Rpb24gYW5kcm9pZDpuYW1lPSJhbmRyb2lkLmludGVudC5hY3Rpb24uTUFJTiIgLz4KKyAgICAgICAgICAgICAgICA8Y2F0ZWdvcnkgYW5kcm9pZDpuYW1lPSJhbmRyb2lkLmludGVudC5jYXRlZ29yeS5MQVVOQ0hFUiIgLz4KKyAgICAgICAgICAgIDwvaW50ZW50LWZpbHRlcj4KKyAgICAgICAgPC9hY3Rpdml0eT4KKworICAgICAgICA8YWN0aXZpdHkKKyAgICAgICAgICAgICAgICBhbmRyb2lkOm5hbWU9IkxpbmVzQWN0aXZpdHkiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpsYWJlbD0iX0xpbmVzIgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6aGFyZHdhcmVBY2NlbGVyYXRlZD0iZmFsc2UiPgorICAgICAgICAgICAgPGludGVudC1maWx0ZXI+CisgICAgICAgICAgICAgICAgPGFjdGlvbiBhbmRyb2lkOm5hbWU9ImFuZHJvaWQuaW50ZW50LmFjdGlvbi5NQUlOIiAvPgorICAgICAgICAgICAgICAgIDxjYXRlZ29yeSBhbmRyb2lkOm5hbWU9ImFuZHJvaWQuaW50ZW50LmNhdGVnb3J5LkxBVU5DSEVSIiAvPgorICAgICAgICAgICAgPC9pbnRlbnQtZmlsdGVyPgorICAgICAgICA8L2FjdGl2aXR5PgorCisgICAgICAgIDxhY3Rpdml0eQorICAgICAgICAgICAgICAgIGFuZHJvaWQ6bmFtZT0iUGF0aHNBY3Rpdml0eSIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxhYmVsPSJfUGF0aHMiPgorICAgICAgICAgICAgPGludGVudC1maWx0ZXI+CisgICAgICAgICAgICAgICAgPGFjdGlvbiBhbmRyb2lkOm5hbWU9ImFuZHJvaWQuaW50ZW50LmFjdGlvbi5NQUlOIiAvPgorICAgICAgICAgICAgICAgIDxjYXRlZ29yeSBhbmRyb2lkOm5hbWU9ImFuZHJvaWQuaW50ZW50LmNhdGVnb3J5LkxBVU5DSEVSIiAvPgorICAgICAgICAgICAgPC9pbnRlbnQtZmlsdGVyPgorICAgICAgICA8L2FjdGl2aXR5PgorCisgICAgICAgIDxhY3Rpdml0eQorICAgICAgICAgICAgICAgIGFuZHJvaWQ6bmFtZT0iVHJhbnNmb3JtM2RBY3Rpdml0eSIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxhYmVsPSJfM2QiPgorICAgICAgICAgICAgPGludGVudC1maWx0ZXI+CisgICAgICAgICAgICAgICAgPGFjdGlvbiBhbmRyb2lkOm5hbWU9ImFuZHJvaWQuaW50ZW50LmFjdGlvbi5NQUlOIiAvPgorICAgICAgICAgICAgICAgIDxjYXRlZ29yeSBhbmRyb2lkOm5hbWU9ImFuZHJvaWQuaW50ZW50LmNhdGVnb3J5LkxBVU5DSEVSIiAvPgorICAgICAgICAgICAgPC9pbnRlbnQtZmlsdGVyPgorICAgICAgICA8L2FjdGl2aXR5PgorCisgICAgICAgIDxhY3Rpdml0eQorICAgICAgICAgICAgICAgIGFuZHJvaWQ6bmFtZT0iU2ltcGxlUGF0aHNBY3Rpdml0eSIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxhYmVsPSJfU2ltcGxlUGF0aHMiPgorICAgICAgICAgICAgPGludGVudC1maWx0ZXI+CisgICAgICAgICAgICAgICAgPGFjdGlvbiBhbmRyb2lkOm5hbWU9ImFuZHJvaWQuaW50ZW50LmFjdGlvbi5NQUlOIiAvPgorICAgICAgICAgICAgICAgIDxjYXRlZ29yeSBhbmRyb2lkOm5hbWU9ImFuZHJvaWQuaW50ZW50LmNhdGVnb3J5LkxBVU5DSEVSIiAvPgorICAgICAgICAgICAgPC9pbnRlbnQtZmlsdGVyPgorICAgICAgICA8L2FjdGl2aXR5PgorCisgICAgICAgIDxhY3Rpdml0eQorICAgICAgICAgICAgICAgIGFuZHJvaWQ6bmFtZT0iQWR2YW5jZWRCbGVuZEFjdGl2aXR5IgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGFiZWw9Il9BZHZhbmNlZEJsZW5kIj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uZHJvaWQ6bGF5b3V0X3dlaWdodD0iMS4wIgorICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfaGVpZ2h0PSJ3cmFwX2NvbnRlbnQiCisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9tYXJnaW5MZWZ0PSIxMGRpcCIKKyAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X21hcmdpblJpZ2h0PSIzZGlwIgorCisgICAgICAgICAgICBhbmRyb2lkOnRleHQ9IkFkZCIgLz4KKyAgICAgICAgCisgICAgICAgIDxCdXR0b24KKyAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X3dpZHRoPSIwZGlwIgorICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfd2VpZ2h0PSIxLjAiCisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9oZWlnaHQ9IndyYXBfY29udGVudCIKKyAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X21hcmdpbkxlZnQ9IjNkaXAiCisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9tYXJnaW5SaWdodD0iMTBkaXAiCisKKyAgICAgICAgICAgIGFuZHJvaWQ6dGV4dD0iUmVtb3ZlIiAvPgorICAgICAgICAKKyAgICA8L0xpbmVhckxheW91dD4KKyAgICAKKyAgICA8TGlzdFZpZXcKKyAgICAgICAgYW5kcm9pZDppZD0iQCtpZC9saXN0IgorICAgICAgICBhbmRyb2lkOmxheW91dF93aWR0aD0ibWF0Y2hfcGFyZW50IgorICAgICAgICBhbmRyb2lkOmxheW91dF9oZWlnaHQ9IjBkaXAiCisgICAgICAgIGFuZHJvaWQ6bGF5b3V0X3dlaWdodD0iMS4wIiAvPgorCisgICAgPExpbmVhckxheW91dAorICAgICAgICBhbmRyb2lkOm9yaWVudGF0aW9uPSJob3Jpem9udGFsIgorICAgICAgICBhbmRyb2lkOmxheW91dF93aWR0aD0ibWF0Y2hfcGFyZW50IgorICAgICAgICBhbmRyb2lkOmxheW91dF9oZWlnaHQ9Ind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ICAgICAgU2hhZGVyc1ZpZXcoQ29udGV4dCBjKSB7CisgICAgICAgICAgICBzdXBlcihjKTsKKworICAgICAgICAgICAgQml0bWFwIHRleHR1cmUgPSBCaXRtYXBGYWN0b3J5LmRlY29kZVJlc291cmNlKGMuZ2V0UmVzb3VyY2VzKCksIFIuZHJhd2FibGUuc3Vuc2V0MSk7CisgICAgICAgICAgICBtVGV4V2lkdGggPSB0ZXh0dXJlLmdldFdpZHRoKCk7CisgICAgICAgICAgICBtVGV4SGVpZ2h0ID0gdGV4dHVyZS5nZXRIZWlnaHQoKTsKKyAgICAgICAgICAgIG1EcmF3V2lkdGggPSBtVGV4V2lkdGggKiAyLjJmOworICAgICAgICAgICAgbURyYXdIZWlnaHQgPSBtVGV4SGVpZ2h0ICogMS4yZjsKKworICAgICAgICAgICAgbVNjYWxlZFNoYWRlciA9IG5ldyBCaXRtYXBTaGFkZXIodGV4dHVyZSwgU2hhZGVyLlRpbGVNb2RlLk1JUlJPUiwKKyAgICAgICAgICAgICAgICAgICAgU2hhZGVyLlRpbGVNb2RlLk1JUlJPUik7CisgICAgICAgICAgICBNYXRyaXggbTIgPSBuZXcgTWF0cml4KCk7CisgICAgICAgICAgICBtMi5zZXRTY2FsZSgwLjVmLCAwLjVmKTsKKyAgICAgICAgICAgIG1TY2FsZWRTaGFkZXIuc2V0TG9jYWxNYXRyaXgobTIpOworICAgICAgICAgICAgCisgICAgICAgICAgICBtU2NhbGVkMlNoYWRlciA9IG5ldyBCaXRtYXBTaGFkZXIodGV4dHVyZSwgU2hhZGVyLlRpbGVNb2RlLk1JUlJPUiwKKyAgICAgICAgICAgICAgICAgICAgU2hhZGVyLlRpbGVNb2RlLk1JUlJPUik7CisgICAgICAgICAgICBNYXRyaXggbTMgPSBuZXcgTWF0cml4KCk7CisgICAgICAgICAgICBtMy5zZXRTY2FsZSgwLjFmLCAwLjFmKTsKKyAgICAgICAgICAgIG1TY2FsZWQyU2hhZGVyLnNldExvY2FsTWF0cml4KG0zKTsKKworICAgICAgICAgICAgbUhvckdyYWRpZW50ID0gbmV3IExpbmVhckdyYWRpZW50KDAuMGYsIDAuMGYsIG1EcmF3V2lkdGgsIDAuMGYsCisgICAgICAgICAgICAgICAgICAgIENvbG9yLkJMQUNLLCBDb2xvci5XSElURSwgU2hhZGVyLlRpbGVNb2RlLkNMQU1QKTsKKyAgICAgICAgICAgIAorICAgICAgICAgICAgbUNvbXBvc2VTaGFkZXIgPSBuZXcgQ29tcG9zZVNoYWRlcihtU2NhbGVkU2hhZGVyLCBtSG9yR3JhZGllbnQsCisgICAgICAgICAgICAgICAgICAgIFBvcnRlckR1ZmYuTW9kZS5EQVJLRU4pOworICAgICAgICAgICAgbUNvbXBvc2UyU2hhZGVyID0gbmV3IENvbXBvc2VTaGFkZXIobVNjYWxlZFNoYWRlciwgbUhvckdyYWRpZW50LAorICAgICAgICAgICAgICAgICAgICBQb3J0ZXJEdWZmLk1vZGUuTElHSFRFTik7CisgICAgICAgICAgICBtQ29tcG9zZTNTaGFkZXIgPSBuZXcgQ29tcG9zZVNoYWRlcihtU2NhbGVkU2hhZGVyLCBtSG9yR3JhZGllbnQsCisgICAgICAgICAgICAgICAgICAgIFBvcnRlckR1ZmYuTW9kZS5NVUxUSVBMWSk7CisgICAgICAgICAgICBtQ29tcG9zZTRTaGFkZXIgPSBuZXcgQ29tcG9zZVNoYWRlcihtU2NhbGVkU2hhZGVyLCBtSG9yR3JhZGllbnQsCisgICAgICAgICAgICAgICAgICAgIFBvcnRlckR1ZmYuTW9kZS5TQ1JFRU4pOworICAgICAgICAgICAgbUNvbXBvc2U1U2hhZGVyID0gbmV3IENvbXBvc2VTaGFkZXIobVNjYWxlZFNoYWRlciwgbUhvckdyYWRpZW50LAorICAgICAgICAgICAgICAgICAgICBQb3J0ZXJEdWZmLk1vZGUuQUREKTsKKyAgICAgICAgICAgIG1Db21wb3NlNlNoYWRlciA9IG5ldyBDb21wb3NlU2hhZGVyKG1Ib3JHcmFkaWVudCwgbVNjYWxlZFNoYWRlciwKKyAgICAgICAgICAgICAgICAgICAgUG9ydGVyRHVmZi5Nb2RlLk9WRVJMQVkpOworCisgICAgICAgICAgICBtUGFpbnQgPSBuZXcgUGFpbnQoKTsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwcm90ZWN0ZWQgdm9pZCBvbkRyYXcoQ2FudmFzIGNhbnZhcykgeworICAgICAgICAgICAgc3VwZXIub25EcmF3KGNhbnZhcyk7CisgICAgICAgICAgICBjYW52YXMuZHJhd1JHQigyNTUsIDI1NSwgMjU1KTsKKworICAgICAgICAgICAgY2FudmFzLnNhdmUoKTsKKyAgICAgICAgICAgIGNhbnZhcy50cmFuc2xhdGUoNDAuMGYsIDQwLjBmKTsKKworICAgICAgICAgICAgbVBhaW50LnNldFNoYWRlcihtQ29tcG9zZVNoYWRlcik7CisgICAgICAgICAgICBjYW52YXMuZHJhd1JlY3QoMC4wZiwgMC4wZiwgbURyYXdXaWR0aCwgbURyYXdIZWlnaHQsIG1QYWludCk7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIGNhbnZhcy50cmFuc2xhdGUoMC4wZiwgNDAuMGYgKyBtRHJhd0hlaWdodCk7CisgICAgICAgICAgICBtUGFpbnQuc2V0U2hhZGVyKG1Db21wb3NlMlNoYWRlcik7CisgICAgICAgICAgICBjYW52YXMuZHJhd1JlY3QoMC4wZiwgMC4wZiwgbURyYXdXaWR0aCwgbURyYXdIZWlnaHQsIG1QYWludCk7CisKKyAgICAgICAgICAgIGNhbnZhcy50cmFuc2xhdGUoMC4wZiwgNDAuMGYgKyBtRHJhd0hlaWdodCk7CisgICAgICAgICAgICBtUGFpbnQuc2V0U2hhZGVyKG1Db21wb3NlM1NoYWRlcik7CisgICAgICAgICAgICBjYW52YXMuZHJhd1JlY3QoMC4wZiwgMC4wZiwgbURyYXdXaWR0aCwgbURyYXdIZWlnaHQsIG1QYWludCk7CisKKyAgICAgICAgICAgIGNhbnZhcy5yZXN0b3JlKCk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WaWV3KGNvbG9yLCBuZXcgRGlydHlCaXRtYXBWaWV3LkxheW91dFBhcmFtcygKKyAgICAgICAgICAgICAgICBkaXBUb1B4KHRoaXMsIDEwMCksIGRpcFRvUHgodGhpcywgMTAwKSwgR3Jhdml0eS5DRU5URVIpKTsKKworICAgICAgICBBbHBoYUFuaW1hdGlvbiBhID0gbmV3IEFscGhhQW5pbWF0aW9uKDEuMGYsIDAuMGYpOworICAgICAgICBhLnNldER1cmF0aW9uKDIwMDApOworICAgICAgICBhLnNldFJlcGVhdENvdW50KEFuaW1hdGlvbi5JTkZJTklURSk7CisgICAgICAgIGEuc2V0UmVwZWF0TW9kZShBbmltYXRpb24uUkVWRVJTRSk7CisgICAgICAgIGNvbG9yLnN0YXJ0QW5pbWF0aW9uKGEpOworCisgICAgICAgIHNldENvbnRlbnRWaWV3KGNvbnRhaW5lcik7CisgICAgfQorICAgIAorICAgIEBTdXBwcmVzc1dhcm5pbmdzKHsiVW51c2VkRGVjbGFyYXRpb24ifSkKKyAgICBzdGF0aWMgaW50IGRpcFRvUHgoQ29udGV4dCBjLCBpbnQgZGlwKSB7CisgICAgICAgIHJldHVybiAoaW50KSAoYy5nZXRSZXNvdXJjZXMoKS5nZXREaXNwbGF5TWV0cmljcygpLmRlbnNpdHkgKiBkaXAgKyAwLjVmKTsKKyAgICB9CisKKyAgICBzdGF0aWMgY2xhc3MgQ29sb3JWaWV3IGV4dGVuZHMgVmlldyB7CisgICAgICAgIENvbG9yVmlldyhDb250ZXh0IGMpIHsKKyAgICAgICAgICAgIHN1cGVyKGMpOworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHByb3RlY3RlZCB2b2lkIG9uRHJhdyhDYW52YXMgY2FudmFzKSB7CisgICAgICAgICAgICBzdXBlci5vbkRyYXcoY2FudmFzKTsKKyAgICAgICAgICAgIGNhbnZhcy5kcmF3UkdCKDAsIDI1NSwgMCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBzdGF0aWMgY2xhc3MgRGlydHlCaXRtYXBWaWV3IGV4dGVuZHMgRnJhbWVMYXlvdXQgeworICAgICAgICBwcml2YXRlIGZpbmFsIFBhaW50IG1QYWludDsKKworICAgICAgICBEaXJ0eUJpdG1hcFZpZXcoQ29udGV4dCBjKSB7CisgICAgICAgICAgICBzdXBlcihjKTsKKyAgICAgICAgICAgIG1QYWludCA9IG5ldyBQYWludCgpOworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyB2b2lkIGRpc3BhdGNoRHJhdyhDYW52YXMgY2FudmFzKSB7CisgICAgICAgICAgICBjYW52YXMuZHJhd1JHQigyNTUsIDI1NSwgMjU1KTsKKworICAgICAgICAgICAgbVBhaW50LnNldENvbG9yKDB4ZmZmZjAwMDApOworICAgICAgICAgICAgY2FudmFzLmRyYXdSZWN0KDIwMC4wZiwgMC4wZiwgMjIwLjBmLCAyMC4wZiwgbVBhaW50KTsKKworICAgICAgICAgICAgY2FudmFzLnNhdmUoKTsKKyAgICAgICAgICAgIGNhbnZhcy5jbGlwUmVjdCgyMC4wZiwgMC4wZiwgNDAuMGYsIDIwLjBmKTsKKyAgICAgICAgICAgIExvZy5kKExPR19UQUcsICJjbGlwUmVjdCA9ICIgKyBjYW52YXMuZ2V0Q2xpcEJvdW5kcygpKTsKKyAgICAgICAgICAgIExvZy5kKExPR19UQUcsICJyZWplY3RlZCA9ICIgKyBjYW52YXMucXVpY2tSZWplY3QoMTAwLjBmLCAxMDAuMGYsIDExMC4wZiwgMTEwLjBmLAorICAgICAgICAgICAgICAgICAgICBDYW52YXMuRWRnZVR5cGUuQlcpKTsKKyAgICAgICAgICAgIExvZy5kKExPR19UQUcsICJyZWplY3RlZCA9ICIgKyBjYW52YXMucXVpY2tSZWplY3QoMjUuMGYsIDUuMGYsIDMwLjBmLCAxMC4wZiwKKyAgICAgICAgICAgICAgICAgICAgQ2FudmFzLkVkZ2VUeXBlLkJXKSk7CisgICAgICAgICAgICBjYW52YXMucmVzdG9yZSgpOworICAgICAgICAgICAgCisgICAgICAgICAgICBjYW52YXMuc2F2ZSgpOworICAgICAgICAgICAgY2FudmFzLnNjYWxlKDIuMGYsIDIuMGYpOworICAgICAgICAgICAgY2FudmFzLmNsaXBSZWN0KDIwLjBmLCAwLjBmLCA0MC4wZiwgMjAuMGYpOworICAgICAgICAgICAgTG9nLmQoTE9HX1RBRywgImNsaXBSZWN0ID0gIiArIGNhbnZhcy5nZXRDbGlwQm91bmRzKCkpOworICAgICAgICAgICAgTG9nLmQoTE9HX1RBRywgInJlamVjdGVkID0gIiArIGNhbnZhcy5xdWlja1JlamVjdCg1MC4wZiwgNTAuMGYsIDYwLjBmLCA2MC4wZiwKKyAgICAgICAgICAgICAgICAgICAgQ2FudmFzLkVkZ2VUeXBlLkJXKSk7CisgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAicmVqZWN0ZWQgPSAiICsgY2FudmFzLnF1aWNrUmVqZWN0KDI1LjBmLCA1LjBmLCAzMC4wZiwgMTAuMGYsCisgICAgICAgICAgICAgICAgICAgIENhbnZhcy5FZGdlVHlwZS5CVykpOworICAgICAgICAgICAgY2FudmFzLnJlc3RvcmUoKTsKKworICAgICAgICAgICAgY2FudmFzLnNhdmUoKTsKKyAgICAgICAgICAgIGNhbnZhcy50cmFuc2xhdGUoMjAuMGYsIDIwLjBmKTsKKyAgICAgICAgICAgIGNhbnZhcy5jbGlwUmVjdCgyMC4wZiwgMC4wZiwgNDAuMGYsIDIwLjBmKTsKKyAgICAgICAgICAgIExvZy5kKExPR19UQUcsICJjbGlwUmVjdCA9ICIgKyBjYW52YXMuZ2V0Q2xpcEJvdW5kcygpKTsKKyAgICAgICAgICAgIExvZy5kKExPR19UQUcsICJyZWplY3RlZCA9ICIgKyBjYW52YXMucXVpY2tSZWplY3QoODAuMGYsIDgwLjBmLCA5MC4wZiwgOTAuMGYsCisgICAgICAgICAgICAgICAgICAgIENhbnZhcy5FZGdlVHlwZS5CVykpOworICAgICAgICAgICAgTG9nLmQoTE9HX1RBRywgInJlamVjdGVkID0gIiArIGNhbnZhcy5xdWlja1JlamVjdCgyNS4wZiwgNS4wZiwgMzAuMGYsIDEwLjBmLAorICAgICAgICAgICAgICAgICAgICBDYW52YXMuRWRnZVR5cGUuQlcpKTsKKyAgICAgICAgICAgIGNhbnZhcy5yZXN0b3JlKCk7CisKKyAgICAgICAgICAgIGNhbnZhcy5zYXZlKCk7CisgICAgICAgICAgICBjYW52YXMuc2NhbGUoMi4wZiwgMi4wZik7ICAgICAgICAgICAgCisgICAgICAgICAgICBjYW52YXMuY2xpcFJlY3QoMjAuMGYsIDAuMGYsIDQwLjBmLCAyMC4wZik7CisKKyAgICAgICAgICAgIG1QYWludC5zZXRDb2xvcigweGZmMDBmZjAwKTsKKyAgICAgICAgICAgIGNhbnZhcy5kcmF3UmVjdCgwLjBmLCAwLjBmLCAyMC4wZiwgMjAuMGYsIG1QYWludCk7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIG1QYWludC5zZXRDb2xvcigweGZmMDAwMGZmKTsKKyAgICAgICAgICAgIGNhbnZhcy5kcmF3UmVjdCgyMC4wZiwgMC4wZiwgNDAuMGYsIDIwLjBmLCBtUGFpbnQpOworICAgICAgICAgICAgCisgICAgICAgICAgICBjYW52YXMucmVzdG9yZSgpOworCisgICAgICAgICAgICBmaW5hbCBpbnQgcmVzdG9yZVRvID0gY2FudmFzLnNhdmUoKTsKKyAgICAgICAgICAgIGNhbnZhcy5zYXZlTGF5ZXJBbHBoYSgwLjBmLCAxMDAuMGYsIGdldFdpZHRoKCksIDE1MC4wZiwgMTI3LAorICAgICAgICAgICAgICAgICAgICBDYW52YXMuSEFTX0FMUEhBX0xBWUVSX1NBVkVfRkxBRyB8IENhbnZhcy5DTElQX1RPX0xBWUVSX1NBVkVfRkxBRyk7CisgICAgICAgICAgICBtUGFpbnQuc2V0Q29sb3IoMHhmZjAwMDBmZik7CisgICAgICAgICAgICBjYW52YXMuZHJhd1JlY3Qo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xBVElWRV9UT19TRUxGLCAwLjVmLAorICAgICAgICAgICAgICAgIFNjYWxlQW5pbWF0aW9uLlJFTEFUSVZFX1RPX1NFTEYsMC41Zik7CisgICAgICAgIGEuc2V0RHVyYXRpb24oMjAwMCk7CisgICAgICAgIGEuc2V0UmVwZWF0Q291bnQoQW5pbWF0aW9uLklORklOSVRFKTsKKyAgICAgICAgYS5zZXRSZXBlYXRNb2RlKEFuaW1hdGlvbi5SRVZFUlNFKTsKKyAgICAgICAgdmlldy5zdGFydEFuaW1hdGlvbihhKTsKKyAgICB9CisKKyAgICBzdGF0aWMgY2xhc3MgQml0bWFwc1ZpZXcgZXh0ZW5kcyBWaWV3IHsKKyAgICAgICAgcHJpdmF0ZSBQYWludCBtQml0bWFwUGFpbnQ7CisgICAgICAgIHByaXZhdGUgZmluYWwgQml0bWFwIG1CaXRtYXAxOworICAgICAgICBwcml2YXRlIGZpbmFsIEJpdG1hcCBtQml0bWFwMjsKKyAgICAgICAgcHJpdmF0ZSBmaW5hbCBQb3J0ZXJEdWZmWGZlcm1vZGUgbURzdEluOworCisgICAgICAgIEJpdG1hcHNWaWV3KENvbnRleHQgYykgeworICAgICAgICAgICAgc3VwZXIoYyk7CisKKyAgICAgICAgICAgIG1CaXRtYXAxID0gQml0bWFwRmFjdG9yeS5kZWNvZGVSZXNvdXJjZShjLmdldFJlc291cmNlcygpLCBSLmRyYXdhYmxlLnN1bnNldDEpOworICAgICAgICAgICAgbUJpdG1hcDIgPSBCaXRtYXBGYWN0b3J5LmRlY29kZVJlc291cmNlKGMuZ2V0UmVzb3VyY2VzKCksIFIuZHJhd2FibGUuc3Vuc2V0Mik7CisKKyAgICAgICAgICAgIG1CaXRtYXBQYWludCA9IG5ldyBQYWludCgpOworICAgICAgICAgICAgbURzdEluID0gbmV3IFBvcnRlckR1ZmZYZmVybW9kZShQb3J0ZXJEdWZmLk1vZGUuRFNUX0lOKTsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwcm90ZWN0ZWQgdm9pZCBvbkRyYXcoQ2FudmFzIGNhbnZhcykgeworICAgICAgICAgICAgc3VwZXIub25EcmF3KGNhbnZhcyk7CisKKyAgICAgICAgICAgIGNhbnZhcy50cmFuc2xhdGUoMTIwLjBmLCA1MC4wZik7CisgICAgICAgICAgICBjYW52YXMuZHJhd0JpdG1hcChtQml0bWFwMSwgMC4wZiwgMC4wZiwgbUJpdG1hcFBhaW50KTsKKworICAgICAgICAgICAgY2FudmFzLnRyYW5zbGF0ZSgwLjBmLCBtQml0bWFwMS5nZXRIZWlnaHQoKSk7CisgICAgICAgICAgICBjYW52YXMudHJhbnNsYXRlKDAuMGYsIDI1LjBmKTsKKyAgICAgICAgICAgIGNhbnZhcy5kcmF3Qml0bWFwKG1CaXRtYXAyLCAwLjBmLCAwLjBmLCBudWxsKTsKKyAgICAgICAgICAgIAorICAgICAgICAgICAgbUJpdG1hcFBhaW50LnNldEFscGhhKDEyNyk7CisgICAgICAgICAgICBjYW52YXMudHJhbnNsYXRlKDAuMGYsIG1CaXRtYXAyLmdldEhlaWdodCgpKTsKKyAgICAgICAgICAgIGNhbnZhcy50cmFuc2xhdGUoMC4wZiwgMjUuMGYpOworICAgICAgICAgICAgY2FudmFzLmRyYXdCaXRtYXAobUJpdG1hcDEsIDAuMGYsIDAuMGYsIG1CaXRtYXBQYWludCk7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIG1CaXRtYXBQYWludC5zZXRBbHBoYSgyNTUpOworICAgICAgICAgICAgY2FudmFzLnRyYW5zbGF0ZSgwLjBmLCBtQml0bWFwMS5nZXRIZWlnaHQoKSk7CisgICAgICAgICAgICBjYW52YXMudHJhbnNsYXRlKDAuMGYsIDI1LjBmKTsKKyAgICAgICAgICAgIG1CaXRtYXBQYWludC5zZXRDb2xvcigweGZmZmYwMDAwKTsKKyAgICAgICAgICAgIGNhbnZhcy5kcmF3UmVjdCgwLjBmLCAwLjBmLCBtQml0bWFwMi5nZXRXaWR0aCgpLCB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XMoKSwgUi5kcmF3YWJsZS5zdW5zZXQxKTsKKyAgICAgICAgICAgIExvZy5kKCJPcGVuR0xSZW5kZXJlciIsICJMb2FkaW5nIHN1bnNldDIsIGRlZmF1bHQgb3B0aW9ucyIpOworICAgICAgICAgICAgbUJpdG1hcDIgPSBCaXRtYXBGYWN0b3J5LmRlY29kZVJlc291cmNlKGMuZ2V0UmVzb3VyY2VzKCksIFIuZHJhd2FibGUuc3Vuc2V0Mik7CisgICAgICAgICAgICBMb2cuZCgiT3BlbkdMUmVuZGVyZXIiLCAiTG9hZGluZyBzdW5zZXQzLCBmb3JjaW5nIEFSR0ItODg4OCIpOworICAgICAgICAgICAgQml0bWFwRmFjdG9yeS5PcHRpb25zIG9wdHMgPSBuZXcgQml0bWFwRmFjdG9yeS5PcHRpb25zKCk7CisgICAgICAgICAgICBvcHRzLmluUHJlZmVycmVkQ29uZmlnID0gQml0bWFwLkNvbmZpZy5BUkdCXzg4ODg7CisgICAgICAgICAgICBtQml0bWFwMyA9IEJpdG1hcEZhY3RvcnkuZGVjb2RlUmVzb3VyY2UoYy5nZXRSZXNvdXJjZXMoKSwgUi5kcmF3YWJsZS5zdW5zZXQzLCBvcHRzKTsKKyAgICAgICAgICAgIExvZy5kKCJPcGVuR0xSZW5kZXJlciIsICIgICAgaGFzIGJpdG1hcCBhbHBoYT8gIiArIG1CaXRtYXAzLmhhc0FscGhhKCkpOworCisgICAgICAgICAgICBtQml0bWFwUGFpbnQgPSBuZXcgUGFpbnQoKTsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwcm90ZWN0ZWQgdm9pZCBvbkRyYXcoQ2FudmFzIGNhbnZhcykgeworICAgICAgICAgICAgc3VwZXIub25EcmF3KGNhbnZhcyk7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIExvZy5kKCJPcGVuR0xSZW5kZXJlciIsICI9PT09PT09PT09PT09PT09PSBEcmF3Iik7CisKKyAgICAgICAgICAgIGNhbnZhcy50cm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gICAgUG9ydGVyRHVmZi5Nb2RlLlNSQ19PVkVSKSk7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHJvdGVjdGVkIHZvaWQgb25EcmF3KENhbnZhcyBjYW52YXMpIHsKKyAgICAgICAgICAgIHN1cGVyLm9uRHJhdyhjYW52YXMpOworCisgICAgICAgICAgICBjYW52YXMuZHJhd0FSR0IoMjU1LCAyNTUsIDI1NSwgMjU1KTsKKyAgICAgICAgICAgIAorICAgICAgICAgICAgY2FudmFzLnNhdmUoKTsKKyAgICAgICAgICAgIGNhbnZhcy50cmFuc2xhdGUoMTIwLjBmLCA1MC4wZik7CisgICAgICAgICAgICBjYW52YXMuZHJhd0JpdG1hcChtQml0bWFwMSwgMC4wZiwgMC4wZiwgbUNvbG9yTWF0cml4UGFpbnQpOworCisgICAgICAgICAgICBjYW52YXMudHJhbnNsYXRlKDAuMGYsIDUwLjBmICsgbUJpdG1hcDEuZ2V0SGVpZ2h0KCkpOworICAgICAgICAgICAgY2FudmFzLmRyYXdCaXRtYXAobUJpdG1hcDEsIDAuMGYsIDAuMGYsIG1MaWdodGluZ1BhaW50KTsKKyAgICAgICAgICAgIAorICAgICAgICAgICAgY2FudmFzLnRyYW5zbGF0ZSgwLjBmLCA1MC4wZiArIG1CaXRtYXAxLmdldEhlaWdodCgpKTsKKyAgICAgICAgICAgIGNhbnZhcy5kcmF3Qml0bWFwKG1CaXRtYXAxLCAwLjBmLCAwLjBmLCBtQmxlbmRQYWludCk7CisgICAgICAgICAgICBjYW52YXMucmVzdG9yZSgpOworCisgICAgICAgICAgICBjYW52YXMuc2F2ZSgpOworICAgICAgICAgICAgY2FudmFzLnRyYW5zbGF0ZSgxMjAuMGYgKyBtQml0bWFwMS5nZXRXaWR0aCgpICsgMTIwLjBmLCA1MC4wZik7CisgICAgICAgICAgICBjYW52YXMuZHJhd0JpdG1hcChtQml0bWFwMiwgMC4wZiwgMC4wZiwgbUNvbG9yTWF0cml4UGFp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worQFN1cHByZXNzV2FybmluZ3MoeyJVbnVzZWREZWNsYXJhdGlvbiJ9KQorcHVibGljIGNsYXNzIExheWVyc0FjdGl2aXR5IGV4dGVuZHMgQWN0aXZpdHkgeworICAgIEBPdmVycmlkZQorICAgIHByb3RlY3RlZCB2b2lkIG9uQ3JlYXRlKEJ1bmRsZSBzYXZlZEluc3RhbmNlU3RhdGUpIHsKKyAgICAgICAgc3VwZXIub25DcmVhdGUoc2F2ZWRJbnN0YW5jZVN0YXRlKTsKKyAgICAgICAgc2V0Q29udGVudFZpZXcobmV3IExheWVyc1ZpZXcodGhpcykpOworICAgIH0KKworICAgIHN0YXRpYyBjbGFzcyBMYXllcnNWaWV3IGV4dGVuZHMgVmlldyB7CisgICAgICAgIHByaXZhdGUgUGFpbnQgbUxheWVyUGFpbnQ7CisgICAgICAgIHByaXZhdGUgZmluYWwgUGFpbnQgbVJlY3RQYWludDsKKworICAgICAgICBMYXllcnNWaWV3KENvbnRleHQgYykgeworICAgICAgICAgICAgc3VwZXIoYyk7CisKKyAgICAgICAgICAgIG1MYXllclBhaW50ID0gbmV3IFBhaW50KCk7CisgICAgICAgICAgICBtUmVjdFBhaW50ID0gbmV3IFBhaW50KCk7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHJvdGVjdGVkIHZvaWQgb25EcmF3KENhbnZhcyBjYW52YXMpIHsKKyAgICAgICAgICAgIHN1cGVyLm9uRHJhdyhjYW52YXMpOworICAgICAgICAgICAgCisgICAgICAgICAgICBjYW52YXMudHJhbnNsYXRlKDE0MC4wZiwgMTAwLjBmKTsKKworICAgICAgICAgICAgLy9jYW52YXMuZHJhd1JHQigyNTUsIDI1NSwgMjU1KTsKKyAgICAgICAgICAgIAorICAgICAgICAgICAgaW50IGNvdW50ID0gY2FudmFzLnNhdmVMYXllcigwLjBmLCAwLjBmLCAyMDAuMGYsIDEwMC4wZiwgbUxheWVyUGFpbnQsCisgICAgICAgICAgICAgICAgICAgIENhbnZhcy5BTExfU0FWRV9GTEFHKTsKKworICAgICAgICAgICAgbVJlY3RQYWludC5zZXRDb2xvcigweGZmZmYwMDAwKTsKKyAgICAgICAgICAgIGNhbnZhcy5kcmF3UmVjdCgwLjBmLCAwLjBmLCAyMDAuMGYsIDEwMC4wZiwgbVJlY3RQYWludCk7CisKKyAgICAgICAgICAgIGNhbnZhcy5yZXN0b3JlVG9Db3VudChjb3VudCk7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIGNhbnZhcy50cmFuc2xhdGUoMC4wZiwgMTI1LjBmKTsKKyAgICAgICAgICAgIAorICAgICAgICAgICAgY291bnQgPSBjYW52YXMuc2F2ZUxheWVyKDAuMGYsIDAuMGYsIDIwMC4wZiwgMTAwLjBmLCBtTGF5ZXJQYWludCwKKyAgICAgICAgICAgICAgICAgICAgQ2FudmFzLkFMTF9TQVZFX0ZMQUcpOworCisgICAgICAgICAgICBtUmVjdFBhaW50LnNldENvbG9yKDB4ZmYwMGZmMDApOworICAgICAgICAgICAgbVJlY3RQYWludC5zZXRBbHBoYSg1MCk7CisgICAgICAgICAgICBjYW52YXMuZHJhd1JlY3QoMC4wZiwgMC4wZiwgMjAwLjBmLCAxMDAuMGYsIG1SZWN0UGFpbnQpOworCisgICAgICAgICAgICBjYW52YXMucmVzdG9yZVRvQ291bnQoY291bnQpOworCisgICAgICAgICAgICBjYW52YXMudHJhbnNsYXRlKDI1LjBmLCAxMjUuMGYpOworCisgICAgICAgICAgICBtUmVjdFBhaW50LnNldENvbG9yKDB4ZmYwMDAwZmYpOworICAgICAgICAgICAgbVJlY3RQYWludC5zZXRBbHBoYSgyNTUpOworICAgICAgICAgICAgY2FudmFzLmRyYXdSZWN0KDAuMGYsIDAuMGYsIDEwMC4wZiwgNTAuMGYsIG1SZWN0UGFpbnQpOyAgICAgICAgICAgIAorICAgICAgICAgICAgCisgICAgICAgICAgICBtTGF5ZXJQYWludC5zZXRBbHBoYSgxMjcpOworICAgICAgICAgICAgbUxheWVyUGFpbnQuc2V0WGZlcm1vZGUobmV3IFBvcnRlckR1ZmZYZmVybW9kZShQb3J0ZXJEdWZmLk1vZGUuU1JDX09VVCkpOworICAgICAgICAgICAgY291bnQgPSBjYW52YXMuc2F2ZUxheWVyKDUwLjBmLCAyNS4wZiwgMTUwLjBmLCA3NS4wZiwgbUxheWVyUGFpbnQsCisgICAgICAgICAgICAgICAgICAgIENhbnZhcy5BTExfU0FWRV9GTEFHKTsKKworICAgICAgICAgICAgbVJlY3RQYWludC5zZXRDb2xvcigweGZmZmYwMDAwKTsKKyAgICAgICAgICAgIGNhbnZhcy5kcmF3UmVjdCg1MC4wZiwgMjUuMGYsIDE1MC4wZiwgNzUuMGYsIG1SZWN0UGFpbnQpOworCisgICAgICAgICAgICBjYW52YXMucmVzdG9yZVRvQ291bnQoY291bnQpOworICAgICAgICAgICAgCisgICAgICAgICAgICBjYW52YXMudHJhbnNsYXRlKDAuMGYsIDEyNS4wZik7CisKKyAgICAgICAgICAgIG1SZWN0UGFpbnQuc2V0Q29sb3IoMHhmZjAwMDBmZik7CisgICAgICAgICAgICBtUmVjdFBhaW50LnNldEFscGhhKDI1NSk7CisgICAgICAgICAgICBjYW52YXMuZHJhd1JlY3QoMC4wZiwgMC4wZiwgMTAwLjBmLCA1MC4wZiwgbVJlY3RQYWludCk7ICAgICAgICAgICAgCisgICAgICAgICAgICAKKyAgICAgICAgICAgIG1MYXllclBhaW50LnNldENvbG9yKDB4ZmZmZjAwMDApOworICAgICAgICAgICAgbUxheWVyUGFpbnQuc2V0QWxwaGEoMTI3KTsKKyAgICAgICAgICAgIG1MYXllclBhaW50LnNldFhmZXJtb2RlKG5ldyBQb3J0ZXJEdWZmWGZlcm1vZGUoUG9ydGVyRHVmZi5Nb2RlLkRTVF9BVE9QKSk7CisgICAgICAgICAgICBjb3VudCA9IGNhbnZhcy5zYXZlTGF5ZXIoNTAuMGYsIDI1LjBmLCAxNTAuMGYsIDc1LjBmLCBtTGF5ZXJQYWludCwKKyAgICA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sbFBhaW50LnNldENvbG9yKDB4ZmZmZjAwMDApOworICAgICAgICAgICAgbVNtYWxsUGFpbnQuc2V0U3Ryb2tlV2lkdGgoMS4wZik7CisKKyAgICAgICAgICAgIG1NZWRpdW1QYWludCA9IG5ldyBQYWludCgpOworICAgICAgICAgICAgbU1lZGl1bVBhaW50LnNldEFudGlBbGlhcyh0cnVlKTsKKyAgICAgICAgICAgIG1NZWRpdW1QYWludC5zZXRDb2xvcigweGZmMDAwMGZmKTsKKyAgICAgICAgICAgIG1NZWRpdW1QYWludC5zZXRTdHJva2VXaWR0aCg0LjBmKTsKKworICAgICAgICAgICAgbUxhcmdlUGFpbnQgPSBuZXcgUGFpbnQoKTsKKyAgICAgICAgICAgIG1MYXJnZVBhaW50LnNldEFudGlBbGlhcyh0cnVlKTsKKyAgICAgICAgICAgIG1MYXJnZVBhaW50LnNldENvbG9yKDB4ZmYwMGZmMDApOworICAgICAgICAgICAgbUxhcmdlUGFpbnQuc2V0U3Ryb2tlV2lkdGgoMTUuMGYpOworCisgICAgICAgICAgICBtQWxwaGFQYWludCA9IG5ldyBQYWludCgpOworICAgICAgICAgICAgbUFscGhhUGFpbnQuc2V0QW50aUFsaWFzKHRydWUpOworICAgICAgICAgICAgbUFscGhhUGFpbnQuc2V0Q29sb3IoMHg3ZmZmMDA1MCk7CisgICAgICAgICAgICBtQWxwaGFQYWludC5zZXRTdHJva2VXaWR0aCgxMC4wZik7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIG1TaGFkZXIgPSBuZXcgQml0bWFwU2hhZGVyKG1CaXRtYXAxLCBCaXRtYXBTaGFkZXIuVGlsZU1vZGUuTUlSUk9SLAorICAgICAgICAgICAgICAgICAgICBCaXRtYXBTaGFkZXIuVGlsZU1vZGUuTUlSUk9SKTsKKworICAgICAgICAgICAgbVBvaW50cyA9IG5ldyBmbG9hdFtdIHsKKyAgICAgICAgICAgICAgICAgICAgNjIuMGYsIDAuMGYsIDMwMi4wZiwgNDAwLjBmLAorICAgICAgICAgICAgICAgICAgICAzMDIuMGYsIDQwMC4wZiwgMzUyLjBmLCA0MDAuMGYsCisgICAgICAgICAgICAgICAgICAgIDM1Mi4wZiwgNDAwLjBmLCAzNTIuMGYsIDUwMC4wZgorICAgICAgICAgICAgfTsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwcm90ZWN0ZWQgdm9pZCBvbkRyYXcoQ2FudmFzIGNhbnZhcykgeworICAgICAgICAgICAgc3VwZXIub25EcmF3KGNhbnZhcyk7CisKKyAgICAgICAgICAgIGNhbnZhcy5kcmF3QVJHQigyNTUsIDI1NSwgMjU1LCAyNTUpOworCisgICAgICAgICAgICBjYW52YXMuc2F2ZSgpOworICAgICAgICAgICAgY2FudmFzLnRyYW5zbGF0ZSgxMDAuMGYsIDIwLjBmKTsKKworICAgICAgICAgICAgY2FudmFzLmRyYXdMaW5lKDAuMGYsIDAuMGYsIDQwLjBmLCA0MDAuMGYsIG1TbWFsbFBhaW50KTsKKyAgICAgICAgICAgIGNhbnZhcy5kcmF3TGluZSg1LjBmLCAwLjBmLCA5NS4wZiwgNDAwLjBmLCBtTWVkaXVtUGFpbnQpOworICAgICAgICAgICAgY2FudmFzLmRyYXdMaW5lKDIyLjBmLCAwLjBmLCAxNjIuMGYsIDQwMC4wZiwgbUxhcmdlUGFpbnQpOworICAgICAgICAgICAgCisgICAgICAgICAgICBtTGFyZ2VQYWludC5zZXRTaGFkZXIobVNoYWRlcik7CisgICAgICAgICAgICBjYW52YXMuZHJhd0xpbmUoNDIuMGYsIDAuMGYsIDIyMi4wZiwgNDAwLjBmLCBtTGFyZ2VQYWludCk7CisgICAgICAgICAgICBtTGFyZ2VQYWludC5zZXRTaGFkZXIobnVsbCk7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIGNhbnZhcy5kcmF3TGluZXMobVBvaW50cywgbUFscGhhUGFpbnQpOworICAgICAgICAgICAgCisgICAgICAgICAgICBjYW52YXMudHJhbnNsYXRlKDEyMC4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VTaGFkZXIgbUNvbXBvc2UyU2hhZGVyOworICAgICAgICBwcml2YXRlIFBhaW50IG1MYXJnZVBhaW50OworICAgICAgICBwcml2YXRlIEJpdG1hcFNoYWRlciBtU2NhbGVkMlNoYWRlcjsKKyAgICAgICAgcHJpdmF0ZSBDb2xvckZpbHRlciBtQ29sb3JGaWx0ZXI7CisKKyAgICAgICAgU2hhZGVyc1ZpZXcoQ29udGV4dCBjKSB7CisgICAgICAgICAgICBzdXBlcihjKTsKKworICAgICAgICAgICAgQml0bWFwIHRleHR1cmUgPSBCaXRtYXBGYWN0b3J5LmRlY29kZVJlc291cmNlKGMuZ2V0UmVzb3VyY2VzKCksIFIuZHJhd2FibGUuc3Vuc2V0MSk7CisgICAgICAgICAgICBtVGV4V2lkdGggPSB0ZXh0dXJlLmdldFdpZHRoKCk7CisgICAgICAgICAgICBtVGV4SGVpZ2h0ID0gdGV4dHVyZS5nZXRIZWlnaHQoKTsKKyAgICAgICAgICAgIG1EcmF3V2lkdGggPSBtVGV4V2lkdGggKiAyLjJmOworICAgICAgICAgICAgbURyYXdIZWlnaHQgPSBtVGV4SGVpZ2h0ICogMS4yZjsKKworICAgICAgICAgICAgbVNjYWxlZFNoYWRlciA9IG5ldyBCaXRtYXBTaGFkZXIodGV4dHVyZSwgU2hhZGVyLlRpbGVNb2RlLk1JUlJPUiwKKyAgICAgICAgICAgICAgICAgICAgU2hhZGVyLlRpbGVNb2RlLk1JUlJPUik7CisgICAgICAgICAgICBNYXRyaXggbTIgPSBuZXcgTWF0cml4KCk7CisgICAgICAgICAgICBtMi5zZXRTY2FsZSgwLjVmLCAwLjVmKTsKKyAgICAgICAgICAgIG1TY2FsZWRTaGFkZXIuc2V0TG9jYWxNYXRyaXgobTIpOworICAgICAgICAgICAgCisgICAgICAgICAgICBtU2NhbGVkMlNoYWRlciA9IG5ldyBCaXRtYXBTaGFkZXIodGV4dHVyZSwgU2hhZGVyLlRpbGVNb2RlLk1JUlJPUiwKKyAgICAgICAgICAgICAgICAgICAgU2hhZGVyLlRpbGVNb2RlLk1JUlJPUik7CisgICAgICAgICAgICBNYXRyaXggbTMgPSBuZXcgTWF0cml4KCk7CisgICAgICAgICAgICBtMy5zZXRTY2FsZSgwLjFmLCAwLjFmKTsKKyAgICAgICAgICAgIG1TY2FsZWQyU2hhZGVyLnNldExvY2FsTWF0cml4KG0zKTsKKworICAgICAgICAgICAgbUhvckdyYWRpZW50ID0gbmV3IExpbmVhckdyYWRpZW50KDAuMGYsIDAuMGYsIG1EcmF3V2lkdGgsIDAuMGYsCisgICAgICAgICAgICAgICAgICAgIENvbG9yLlJFRCwgMHg3ZjAwZmYwMCwgU2hhZGVyLlRpbGVNb2RlLkNMQU1QKTsKKyAgICAgICAgICAgIAorICAgICAgICAgICAgbVZlcnRHcmFkaWVudCA9IG5ldyBMaW5lYXJHcmFkaWVudCgwLjBmLCAwLjBmLCAwLjBmLCBtRHJhd0hlaWdodCAvIDIuMGYsCisgICAgICAgICAgICAgICAgICAgIENvbG9yLllFTExPVywgQ29sb3IuTUFHRU5UQSwgU2hhZGVyLlRpbGVNb2RlLk1JUlJPUik7CisKKyAgICAgICAgICAgIG1Db21wb3NlU2hhZGVyID0gbmV3IENvbXBvc2VTaGFkZXIobVNjYWxlZFNoYWRlciwgbUhvckdyYWRpZW50LAorICAgICAgICAgICAgICAgICAgICBQb3J0ZXJEdWZmLk1vZGUuU1JDX09WRVIpOworICAgICAgICAgICAgbUNvbXBvc2UyU2hhZGVyID0gbmV3IENvbXBvc2VTaGFkZXIobUhvckdyYWRpZW50LCBtU2NhbGVkU2hhZGVyLAorICAgICAgICAgICAgICAgICAgICBQb3J0ZXJEdWZmLk1vZGUuU1JDX09VVCk7CisKKyAgICAgICAgICAgIG1Db2xvckZpbHRlciA9IG5ldyBMaWdodGluZ0NvbG9yRmlsdGVyKDB4MDA2MGZmZmYsIDB4MDAxMDEwMzApOworIAorICAgICAgICAgICAgbUxhcmdlUGFpbnQgPSBuZXcgUGFpbnQoKTsKKyAgICAgICAgICAgIG1MYXJnZVBhaW50LnNldEFudGlBbGlhcyh0cnVlKTsKKyAgICAgICAgICAgIG1MYXJnZVBhaW50LnNldFRleHRTaXplKDM2LjBmKTsKKyAgICAgICAgICAgIG1MYXJnZVBhaW50LnNldENvbG9yKDB4ZmYwMDAwMDApOworICAgICAgICAgICAgCisgICAgICAgICAgICBtUGFpbnQgPSBuZXcgUGFpbnQoKTsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwcm90ZWN0ZWQgdm9pZCBvbkRyYXcoQ2FudmFzIGNhbnZhcykgeworICAgICAgICAgICAgc3VwZXIub25EcmF3KGNhbnZhcyk7CisgICAgICAgICAgICBjYW52YXMuZHJhd1JHQigyNTUsIDI1NSwgMjU1KTsKKworICAgICAgICAgICAgY2FudmFzLnNhdmUoKTsKKyAgICAgICAgICAgIGNhbnZhcy50cmFuc2xhdGUoNDAuMGYsIDQwLjBmKTsKKworICAgICAgICAgICAgbVBhaW50LnNldFNoYWRlcihtQ29tcG9zZVNoYWRlcik7CisgICAgICAgICAgICBjYW52YXMuZHJhd1JlY3QoMC4wZiwgMC4wZiwgbURyYXdXaWR0aCwgbURyYXdIZWlnaHQsIG1QYWludCk7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIGNhbnZhcy50cmFuc2xhdGUoMC4wZiwgNDAuMGYgKyBtRHJhd0hlaWdodCk7CisgICAgICAgICAgICBtUGFpbnQuc2V0U2hhZGVyKG1Db21wb3NlMlNoYWRlcik7CisgICAgICAgICAgICBjYW52YXMuZHJhd1JlY3QoMC4wZiwgMC4wZiwgbURyYXdXaWR0aCwgbURyYXdIZWlnaHQsIG1QYWludCk7CisKKyAgICAgICAgICAgIGNhbnZhcy5yZXN0b3JlKCk7CisKKyAgICAgICAgICAgIGNhbnZhcy5zYXZlKCk7CisgICAgICAgICAgICBjYW52YXMudHJhbnNsYXRlKDQwLjBmICsgbURyYXdXaWR0aCArIDQwLjBmLCA0MC4wZik7CisKKyAgICAgICAgICAgIG1MYXJnZVBhaW50LnNldFNoYWRlcihtSG9yR3JhZGllbnQpOworICAgICAgICAgICAgY2FudmFzLmRyYXdUZXh0KCJPcGVuR0wgcmVuZGVyaW5nIiwgMC4wZiwgMjAuMGYsIG1MYXJnZVBhaW50KTsKKyAgICAgICAgICAgIAorICAgICAgICAgICAgbUxhcmdlUGFpbnQuc2V0U2hhZGVyKG1TY2FsZWQyU2hhZGVyKTsKKyAgICAgICAgICAgIGNhbnZhcy5kcmF3VGV4dCgiT3BlbkdMIHJlbmRlcmluZyIsIDAuMGYsIDYwLjBmLCBtTGFyZ2VQYWludCk7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIG1MYXJnZVBhaW50LnNldFNoYWRlcihtQ29tcG9zZTJTaGFkZXIpOworICAgICAgICAgICAgbUxhcmdlUGFpbnQuc2V0Q29sb3JGaWx0ZXIobUNvbG9yRmlsdGVyKTsKKyAgICAgICAgICAgIGNhbnZhcy5kcmF3VGV4dCgiT3BlbkdMIHJlbmRlcmluZyIsIDAuMGYsIDEwMC4wZiwgbUxhcmdlUGFpbnQpOworICAgICAgICAgICAgbUxhcmdlUGFpbnQuc2V0Q29sb3JGaWx0ZXIobnVsbCk7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIGNhbnZhcy50cmFuc2xhdGUoMC4wZiwgNDAuMGYgKyBtRHJhd0hlaWdodCk7CisgICAgICAgICAgICBtTGFyZ2VQYWludC5zZXRTaGFkZXIobVZlcnRHcmFkaWVudCk7CisgICAgICAgICAgICBjYW52YXMuZHJhd1RleHQoIk9wZW5HTCByZW5kZXJpbmciLCAwLjBmLCAyMC4wZiwgbUxhcmdlUGFpbnQpOworICAgICAgICAgICAgCisgICAgICAgICAgICBjYW52YXMucmVzdG9yZSgpOworICAgICAgICB9CisgICAgfQorfQpkaWZmIC0tZ2l0IGEvdGVzdHMvSHdBY2NlbGVyYXRpb25UZXN0L3NyYy9jb20vZ29vZ2xlL2FuZHJvaWQvdGVzd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GVjdGVkIHZvaWQgb25DcmVhdGUoQnVuZGxlIHNhdmVkSW5zdGFuY2VTdGF0ZSkgeworICAgICAgICBzdXBlci5vbkNyZWF0ZShzYXZlZEluc3RhbmNlU3RhdGUpOworICAgICAgICBmaW5hbCBQYXRoc1ZpZXcgdmlldyA9IG5ldyBQYXRoc1ZpZXcodGhpcyk7CisgICAgICAgIHNldENvbnRlbnRWaWV3KHZpZXcpOworICAgIH0KKworICAgIHN0YXRpYyBjbGFzcyBQYXRoc1ZpZXcgZXh0ZW5kcyBWaWV3IHsKKyAgICAgICAgcHJpdmF0ZSBmaW5hbCBCaXRtYXAgbUJpdG1hcDE7CisgICAgICAgIHByaXZhdGUgZmluYWwgUGFpbnQgbVNtYWxsUGFpbnQ7CisgICAgICAgIHByaXZhdGUgZmluYWwgUGFpbnQgbU1lZGl1bVBhaW50OworICAgICAgICBwcml2YXRlIGZpbmFsIFBhaW50IG1MYXJnZVBhaW50OworICAgICAgICBwcml2YXRlIGZpbmFsIEJpdG1hcFNoYWRlciBtU2hhZGVyOworICAgICAgICBwcml2YXRlIGZpbmFsIFBhdGggbVBhdGg7CisgICAgICAgIHByaXZhdGUgZmluYWwgUmVjdEYgbVBhdGhCb3VuZHM7CisgICAgICAgIHByaXZhdGUgZmluYWwgUGFpbnQgbUJvdW5kc1BhaW50OworICAgICAgICBwcml2YXRlIGZpbmFsIEJpdG1hcCBtQml0bWFwOworICAgICAgICBwcml2YXRlIGZpbmFsIGZsb2F0IG1PZmZzZXQ7CisgICAgICAgIHByaXZhdGUgZmluYWwgUGFpbnQgbUxpbmVQYWludDsKKworICAgICAgICBQYXRoc1ZpZXcoQ29udGV4dCBjKSB7CisgICAgICAgICAgICBzdXBlcihjKTsKKworICAgICAgICAgICAgbUJpdG1hcDEgPSBCaXRtYXBGYWN0b3J5LmRlY29kZVJlc291cmNlKGMuZ2V0UmVzb3VyY2VzKCksIFIuZHJhd2FibGUuc3Vuc2V0MSk7CisKKyAgICAgICAgICAgIG1TbWFsbFBhaW50ID0gbmV3IFBhaW50KCk7CisgICAgICAgICAgICBtU21hbGxQYWludC5zZXRBbnRpQWxpYXModHJ1ZSk7CisgICAgICAgICAgICBtU21hbGxQYWludC5zZXRDb2xvcigweGZmZmYwMDAwKTsKKyAgICAgICAgICAgIG1TbWFsbFBhaW50LnNldFN0cm9rZVdpZHRoKDEuMGYpOworICAgICAgICAgICAgbVNtYWxsUGFpbnQuc2V0U3R5bGUoUGFpbnQuU3R5bGUuU1RST0tFKTsKKyAgICAgICAgICAgIAorICAgICAgICAgICAgbUxpbmVQYWludCA9IG5ldyBQYWludCgpOworICAgICAgICAgICAgbUxpbmVQYWludC5zZXRBbnRpQWxpYXModHJ1ZSk7CisgICAgICAgICAgICBtTGluZVBhaW50LnNldENvbG9yKDB4ZmZmZjAwZmYpOworICAgICAgICAgICAgbUxpbmVQYWludC5zZXRTdHJva2VXaWR0aCgxLjBmKTsKKyAgICAgICAgICAgIG1MaW5lUGFpbnQuc2V0U3R5bGUoUGFpbnQuU3R5bGUuU1RST0tFKTsKKworICAgICAgICAgICAgbU1lZGl1bVBhaW50ID0gbmV3IFBhaW50KCk7CisgICAgICAgICAgICBtTWVkaXVtUGFpbnQuc2V0QW50aUFsaWFzKHRydWUpOworICAgICAgICAgICAgbU1lZGl1bVBhaW50LnNldENvbG9yKDB4ZmYwMDAwZmYpOworICAgICAgICAgICAgbU1lZGl1bVBhaW50LnNldFN0cm9rZVdpZHRoKDEwLjBmKTsKKyAgICAgICAgICAgIG1NZWRpdW1QYWludC5zZXRTdHlsZShQYWludC5TdHlsZS5TVFJPS0UpOworCisgICAgICAgICAgICBtTGFyZ2VQYWludCA9IG5ldyBQYWludCgpOworICAgICAgICAgICAgbUxhcmdlUGFpbnQuc2V0QW50aUFsaWFzKHRydWUpOworICAgICAgICAgICAgbUxhcmdlUGFpbnQuc2V0Q29sb3IoMHhmZjAwZmYwMCk7CisgICAgICAgICAgICBtTGFyZ2VQYWludC5zZXRTdHJva2VXaWR0aCgxNS4wZik7CisgICAgICAgICAgICBtTGFyZ2VQYWludC5zZXRTdHlsZShQYWludC5TdHlsZS5GSUxMKTsKKworICAgICAgICAgICAgbVNoYWRlciA9IG5ldyBCaXRtYXBTaGFkZXIobUJpdG1hcDEsIEJpdG1hcFNoYWRlci5UaWxlTW9kZS5NSVJST1IsCisgICAgICAgICAgICAgICAgICAgIEJpdG1hcFNoYWRlci5UaWxlTW9kZS5NSVJST1IpOworCisgICAgICAgICAgICBtUGF0aCA9IG5ldyBQYXRoKCk7CisgICAgICAgICAgICBtUGF0aC5tb3ZlVG8oMC4wZiwgMC4wZik7CisgICAgICAgICAgICBtUGF0aC5jdWJpY1RvKDAuMGYsIDAuMGYsIDEwMC4wZiwgMTUwLjBmLCAxMDAuMGYsIDIwMC4wZik7CisgICAgICAgICAgICBtUGF0aC5jdWJpY1RvKDEwMC4wZiwgMjAwLjBmLCA1MC4wZiwgMzAwLjBmLCAtODAuMGYsIDIwMC4wZik7CisgICAgICAgICAgICBtUGF0aC5jdWJpY1RvKC04MC4wZiwgMjAwLjBmLCAxMDAuMGYsIDIwMC4wZiwgMjAwLjBmLCAwLjBmKTsKKworICAgICAgICAgICAgbVBhdGhCb3VuZHMgPSBuZXcgUmVjdEYoKTsKKyAgICAgICAgICAgIG1QYXRoLmNvbXB1dGVCb3VuZHMobVBhdGhCb3VuZHMsIHRydWUpOworCisgICAgICAgICAgICBtQm91bmRzUGFpbnQgPSBuZXcgUGFpbnQoKTsKKyAgICAgICAgICAgIG1Cb3VuZHNQYWludC5zZXRDb2xvcigweDQwMDBmZjAwKTsKKworICAgICAgICAgICAgbU9mZnNldCA9IG1NZWRpdW1QYWludC5nZXRTdHJva2VXaWR0aCgpOworICAgICAgICAgICAgZmluYWwgaW50IHdpZHRoID0gKGludCkgKG1QYXRoQm91bmRzLndpZHRoKCkgKyBtT2Zmc2V0ICogMy4wZiArIDAuNWYpOworICAgICAgICAgICAgZmluYWwgaW50IGhlaWdodCA9IChpbnQpIChtUGF0aEJvdW5kcy5oZWlnaHQoKSArIG1PZmZzZXQgKiAzLjBmICsgMC41Zik7CisgICAgICAgICAgICBtQml0bWFwID0gQml0bWFwLmNyZWF0ZUJpdG1hcCh3aWR0aCwgaGVpZ2h0LCBCaXRtYXAuQ29uZmlnLkFMUEhBXzgpOworICAgICAgICAgICAgQ2FudmFzIGNhbnZhcyA9IG5ldyBDYW52YXMobUJpdG1hcCk7CisgICAgICAgICAgICBjYW52YXMudHJhbnNsYXRlKC1tUGF0aEJvdW5kcy5sZWZ0ICsgbU9mZnNldCAqIDEuNWYsIC1tUGF0aEJvdW5kcy50b3AgKyBtT2Zmc2V0ICogMS41Zik7CisgICAgICAgICAgICBjYW52YXMuZHJhd1BhdGgobVBhdGgsIG1NZWRpdW1QYWludCk7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHJvdGVjdGVkIHZvaWQgb25EcmF3KENhbnZhcyBjYW52YXMpIHsKKyAgICAgICAgICAgIHN1cGVyLm9uRHJhdyhjYW52YXMpOworCisgICAgICAgICAgICBjYW52YXMuZHJhd0FSR0IoMjU1LCAyNTUsIDI1NSwgMjU1KTsKKworICAgICAgICAgICAgY2FudmFzLnNhdmUoKTsKKyAgICAgICAgICAgIGNhbnZhcy50cmFuc2xhdGUoMjAwLjBmLCA2MC4wZik7CisgICAgICAgICAgICBjYW52YXMuZHJhd1BhdGgobVBhdGgsIG1TbWFsbFBhaW50KTsKKyAgICAgICAgICAgIAorICAgICAgICAgICAgY2FudmFzLnRyYW5zbGF0ZSgzNTAuMGYsIDAuMGYpOworICAgICAgICAgICAgY2FudmFzLmRyYXdQYXRoKG1QYXRoLCBtTWVkaXVtUGFpbnQpOworCisgICAgICAgICAgICBtTGFyZ2VQYWludC5zZXRTaGFkZXIobVNoYWRlcik7CisgICAgICAgICAgICBjYW52YXMudHJhbnNsYXRlKDM1MC4wZiwgMC4wZik7CisgICAgICAgICAgICBjYW52YXMuZHJhd1BhdGgobVBhdGgsIG1MYXJnZVBhaW50KTsKKyAgICAgICAgICAgIG1MYXJnZVBhaW50LnNldFNoYWRlcihudWxsKTsKKyAgICAgICAgICAgIGNhbnZhcy5yZXN0b3JlKCk7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIGNhbnZhcy5zYXZlKCk7CisgICAgICAgICAgICBjYW52YXMudHJhbnNsYXRlKDIwMC4wZiwgMzYwLjBmKTsKKyAgICAgICAgICAgIGNhbnZhcy5kcmF3UGF0aChtUGF0aCwgbVNtYWxsUGFpbnQpOworICAgICAgICAgICAgY2FudmFzLmRyYXdSZWN0KG1QYXRoQm91bmRzLCBtQm91bmRzUGFpbnQpOworICAgICAgICAgICAgCisgICAgICAgICAgICBjYW52YXMudHJhbnNsYXRlKDM1MC4wZiwgMC4wZik7CisgICAgICAgICAgICBjYW52YXMuZHJhd0JpdG1hcChtQml0bWFwLCBtUGF0aEJvdW5kcy5sZWZ0IC0gbU9mZnNldCAqIDEuNWYsCisgICAgICAgICAgICAgICAgICAgIG1QYXRoQm91bmRzLnRvcCAtIG1PZmZzZXQgKiAxLjVmLCBudWxsKTsKKyAgICAgICAgICAgIGNhbnZhcy5kcmF3UmVjdChtUGF0aEJvdW5kcywgbUJvdW5kc1BhaW50KTsKKyAgICAgICAgICAgIGNhbnZhcy5kcmF3TGluZSgwLjBmLCAtMzYwLjBmLCAwLjBmLCA1MDAuMGYsIG1MaW5lUGFpbnQpOworCisgICAgICAgICAgICBtTGFyZ2VQYWludC5zZXRTaGFkZXIobVNoYWRlcik7CisgICAgICAgICAgICBjYW52YXMudHJhbnNsYXRlKDM1MC4wZiwgMC4wZik7CisgICAgICAgICAgICBjYW52YXMuZHJhd1BhdGgobVBhdGgsIG1MYXJnZVBhaW50KTsKKyAgICAgICAgICAgIGNhbnZhcy5kcmF3UmVjdChtUGF0aEJvdW5kcywgbUJvdW5kc1BhaW50KTsKKyAgICAgICAgICAgIG1MYXJnZVBhaW50LnNldFNoYWRlcihudWxsKTsKKyAgICA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ZXcodGhpcyk7CisgICAgICAgIHNldENvbnRlbnRWaWV3KHZpZXcpOworICAgIH0KKworICAgIHN0YXRpYyBjbGFzcyBRdWlja1JlamVjdFZpZXcgZXh0ZW5kcyBWaWV3IHsKKyAgICAgICAgcHJpdmF0ZSBQYWludCBtQml0bWFwUGFpbnQ7CisgICAgICAgIHByaXZhdGUgZmluYWwgQml0bWFwIG1CaXRtYXAxOworCisgICAgICAgIFF1aWNrUmVqZWN0VmlldyhDb250ZXh0IGMpIHsKKyAgICAgICAgICAgIHN1cGVyKGMpOworCisgICAgICAgICAgICBtQml0bWFwMSA9IEJpdG1hcEZhY3RvcnkuZGVjb2RlUmVzb3VyY2UoYy5nZXRSZXNvdXJjZXMoKSwgUi5kcmF3YWJsZS5zdW5zZXQxKTsKKworICAgICAgICAgICAgbUJpdG1hcFBhaW50ID0gbmV3IFBhaW50KCk7CisgICAgICAgICAgICBtQml0bWFwUGFpbnQuc2V0RmlsdGVyQml0bWFwKHRydWUpOworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHByb3RlY3RlZCB2b2lkIG9uRHJhdyhDYW52YXMgY2FudmFzKSB7CisgICAgICAgICAgICBzdXBlci5vbkRyYXcoY2FudmFzKTsKKworICAgICAgICAgICAgaW50IGNvdW50ID0gY2FudmFzLmdldFNhdmVDb3VudCgpOworICAgICAgICAgICAgTG9nLmQoIk9wZW5HTFJlbmRlcmVyIiwgImNvdW50PSIgKyBjb3VudCk7CisgICAgICAgICAgICBjb3VudCA9IGNhbnZhcy5zYXZlKCk7CisgICAgICAgICAgICBMb2cuZCgiT3BlbkdMUmVuZGVyZXIiLCAiY291bnQgYWZ0ZXIgc2F2ZT0iICsgY291bnQpOworICAgICAgICAgICAgY291bnQgPSBjYW52YXMuZ2V0U2F2ZUNvdW50KCk7CisgICAgICAgICAgICBMb2cuZCgiT3BlbkdMUmVuZGVyZXIiLCAiZ2V0U2F2ZUNvdW50IGFmdGVyIHNhdmU9IiArIGNvdW50KTsKKyAgICAgICAgICAgIGNhbnZhcy5yZXN0b3JlKCk7CisgICAgICAgICAgICBjb3VudCA9IGNhbnZhcy5nZXRTYXZlQ291bnQoKTsKKyAgICAgICAgICAgIExvZy5kKCJPcGVuR0xSZW5kZXJlciIsICJjb3VudCBhZnRlciByZXN0b3JlPSIgKyBjb3VudCk7CisgICAgICAgICAgICBjYW52YXMuc2F2ZSgpOworICAgICAgICAgICAgTG9nLmQoIk9wZW5HTFJlbmRlcmVyIiwgImNvdW50IGFmdGVyIHNhdmU9IiArIGNhbnZhcy5nZXRTYXZlQ291bnQoKSk7CisgICAgICAgICAgICBjYW52YXMuc2F2ZSgpOworICAgICAgICAgICAgTG9nLmQoIk9wZW5HTFJlbmRlcmVyIiwgImNvdW50IGFmdGVyIHNhdmU9IiArIGNhbnZhcy5nZXRTYXZlQ291bnQoKSk7CisgICAgICAgICAgICBjYW52YXMuc2F2ZSgpOworICAgICAgICAgICAgTG9nLmQoIk9wZW5HTFJlbmRlcmVyIiwgImNvdW50IGFmdGVyIHNhdmU9IiArIGNhbnZhcy5nZXRTYXZlQ291bnQoKSk7CisgICAgICAgICAgICBjYW52YXMucmVzdG9yZVRvQ291bnQoY291bnQpOworICAgICAgICAgICAgY291bnQgPSBjYW52YXMuZ2V0U2F2ZUNvdW50KCk7CisgICAgICAgICAgICBMb2cuZCgiT3BlbkdMUmVuZGVyZXIiLCAiY291bnQgYWZ0ZXIgcmVzdG9yZVRvQ291bnQ9IiArIGNvdW50KTsKKyAgICAgICAgICAgIGNvdW50ID0gY2FudmFzLnNhdmVMYXllcigwLCAwLCAxMCwgMTAsIG1CaXRtYXBQYWludCwgQ2FudmFzLkFMTF9TQVZFX0ZMQUcpOworICAgICAgICAgICAgTG9nLmQoIk9wZW5HTFJlbmRlcmVyIiwgImNvdW50IGFmdGVyIHNhdmVMYXllcj0iICsgY291bnQpOworICAgICAgICAgICAgY291bnQgPSBjYW52YXMuZ2V0U2F2ZUNvdW50KCk7CisgICAg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gICAgIHByaXZhdGUgQml0bWFwU2hhZGVyIG1TY2FsZWRTaGFkZXI7CisgICAgICAgIHByaXZhdGUgaW50IG1UZXhXaWR0aDsKKyAgICAgICAgcHJpdmF0ZSBpbnQgbVRleEhlaWdodDsKKyAgICAgICAgcHJpdmF0ZSBQYWludCBtUGFpbnQ7CisgICAgICAgIHByaXZhdGUgZmxvYXQgbURyYXdXaWR0aDsKKyAgICAgICAgcHJpdmF0ZSBmbG9hdCBtRHJhd0hlaWdodDsKKyAgICAgICAgcHJpdmF0ZSBMaW5lYXJHcmFkaWVudCBtSG9yR3JhZGllbnQ7CisgICAgICAgIHByaXZhdGUgTGluZWFyR3JhZGllbnQgbURpYWdHcmFkaWVudDsKKyAgICAgICAgcHJpdmF0ZSBMaW5lYXJHcmFkaWVudCBtVmVydEdyYWRpZW50OworCisgICAgICAgIFNoYWRlcnNWaWV3KENvbnRleHQgYykgeworICAgICAgICAgICAgc3VwZXIoYyk7CisKKyAgICAgICAgICAgIEJpdG1hcCB0ZXh0dXJlID0gQml0bWFwRmFjdG9yeS5kZWNvZGVSZXNvdXJjZShjLmdldFJlc291cmNlcygpLCBSLmRyYXdhYmxlLnN1bnNldDEpOworICAgICAgICAgICAgbVRleFdpZHRoID0gdGV4dHVyZS5nZXRXaWR0aCgpOworICAgICAgICAgICAgbVRleEhlaWdodCA9IHRleHR1cmUuZ2V0SGVpZ2h0KCk7CisgICAgICAgICAgICBtRHJhd1dpZHRoID0gbVRleFdpZHRoICogMi4yZjsKKyAgICAgICAgICAgIG1EcmF3SGVpZ2h0ID0gbVRleEhlaWdodCAqIDEuMmY7CisKKyAgICAgICAgICAgIG1SZXBlYXRTaGFkZXIgPSBuZXcgQml0bWFwU2hhZGVyKHRleHR1cmUsIFNoYWRlci5UaWxlTW9kZS5SRVBFQVQsCisgICAgICAgICAgICAgICAgICAgIFNoYWRlci5UaWxlTW9kZS5SRVBFQVQpOworCisgICAgICAgICAgICBtVHJhbnNsYXRlZFNoYWRlciA9IG5ldyBCaXRtYXBTaGFkZXIodGV4dHVyZSwgU2hhZGVyLlRpbGVNb2RlLlJFUEVBVCwKKyAgICAgICAgICAgICAgICAgICAgU2hhZGVyLlRpbGVNb2RlLlJFUEVBVCk7CisgICAgICAgICAgICBNYXRyaXggbTEgPSBuZXcgTWF0cml4KCk7CisgICAgICAgICAgICBtMS5zZXRUcmFuc2xhdGUobVRleFdpZHRoIC8gMi4wZiwgbVRleEhlaWdodCAvIDIuMGYpOworICAgICAgICAgICAgbTEucG9zdFJvdGF0ZSg0NSwgMCwgMCk7CisgICAgICAgICAgICBtVHJhbnNsYXRlZFNoYWRlci5zZXRMb2NhbE1hdHJpeChtMSk7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIG1TY2FsZWRTaGFkZXIgPSBuZXcgQml0bWFwU2hhZGVyKHRleHR1cmUsIFNoYWRlci5UaWxlTW9kZS5NSVJST1IsCisgICAgICAgICAgICAgICAgICAgIFNoYWRlci5UaWxlTW9kZS5NSVJST1IpOworICAgICAgICAgICAgTWF0cml4IG0yID0gbmV3IE1hdHJpeCgpOworICAgICAgICAgICAgbTIuc2V0U2NhbGUoMC41ZiwgMC41Zik7CisgICAgICAgICAgICBtU2NhbGVkU2hhZGVyLnNldExvY2FsTWF0cml4KG0yKTsKKworICAgICAgICAgICAgbUhvckdyYWRpZW50ID0gbmV3IExpbmVhckdyYWRpZW50KDAuMGYsIDAuMGYsIG1EcmF3V2lkdGgsIDAuMGYsCisgICAgICAgICAgICAgICAgICAgIENvbG9yLlJFRCwgQ29sb3IuR1JFRU4sIFNoYWRlci5UaWxlTW9kZS5DTEFNUCk7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIG1EaWFnR3JhZGllbnQgPSBuZXcgTGluZWFyR3JhZGllbnQoMC4wZiwgMC4wZiwgbURyYXdXaWR0aCAvIDEuNWYsIG1EcmF3SGVpZ2h0LAorICAgICAgICAgICAgICAgICAgICBDb2xvci5CTFVFLCBDb2xvci5NQUdFTlRBLCBTaGFkZXIuVGlsZU1vZGUuQ0xBTVApOworICAgICAgICAgICAgCisgICAgICAgICAgICBtVmVydEdyYWRpZW50ID0gbmV3IExpbmVhckdyYWRpZW50KDAuMGYsIDAuMGYsIDAuMGYsIG1EcmF3SGVpZ2h0IC8gMi4wZiwKKyAgICAgICAgICAgICAgICAgICAgQ29sb3IuWUVMTE9XLCBDb2xvci5NQUdFTlRBLCBTaGFkZXIuVGlsZU1vZGUuTUlSUk9SKTsKKworICAgICAgICAgICAgbVBhaW50ID0gbmV3IFBhaW50KCk7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHJvdGVjdGVkIHZvaWQgb25EcmF3KENhbnZhcyBjYW52YXMpIHsKKyAgICAgICAgICAgIHN1cGVyLm9uRHJhdyhjYW52YXMpOworICAgICAgICAgICAgLy9jYW52YXMuZHJhd1JHQigyNTUsIDI1NSwgMjU1KTsKKworICAgICAgICAgICAgLy8gQml0bWFwIHNoYWRlcnMKKyAgICAgICAgICAgIGNhbnZhcy5zYXZlKCk7CisgICAgICAgICAgICBjYW52YXMudHJhbnNsYXRlKDQwLjBmLCA0MC4wZik7CisKKyAgICAgICAgICAgIG1QYWludC5zZXRTaGFkZXIobVJlcGVhdFNoYWRlcik7CisgICAgICAgICAgICBjYW52YXMuZHJhd1JlY3QoMC4wZiwgMC4wZiwgbURyYXdXaWR0aCwgbURyYXdIZWlnaHQsIG1QYWludCk7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIGNhbnZhcy50cmFuc2xhdGUoMC4wZiwgNDAuMGYgKyBtRHJhd0hlaWdodCk7CisgICAgICAgICAgICBtUGFpbnQuc2V0U2hhZGVyKG1UcmFuc2xhdGVkU2hhZGVyKTsKKyAgICAgICAgICAgIGNhbnZhcy5kcmF3UmVjdCgwLjBmLCAwLjBmLCBtRHJhd1dpZHRoLCBtRHJhd0hlaWdodCwgbVBhaW50KTsKKworICAgICAgICAgICAgY2FudmFzLnRyYW5zbGF0ZSgwLjBmLCA0MC4wZiArIG1EcmF3SGVpZ2h0KTsKKyAgICAgICAgICAgIG1QYWludC5zZXRTaGFkZXIobVNjYWxlZFNoYWRlcik7CisgICAgICAgICAgICBjYW52YXMuZHJhd1JlY3QoMC4wZiwgMC4wZiwgbURyYXdXaWR0aCwgbURyYXdIZWlnaHQsIG1QYWludCk7CisKKyAgICAgICAgICAgIGNhbnZhcy5yZXN0b3JlKCk7CisKKyAgICAgICAgICAgIC8vIEdyYWRpZW50cworICAgICAgICAgICAgY2FudmFzLnNhdmUoKTsKKyAgICAgICAgICAgIGNhbnZhcy50cmFuc2xhdGUoNDAuMGYgKyBtRHJhd1dpZHRoICsgNDAuMGYsIDQwLjBmKTsKKworICAgICAgICAgICAgbVBhaW50LnNldFNoYWRlcihtSG9yR3JhZGllbnQpOworICAgICAgICAgICAgY2FudmFzLmRyYXdSZWN0KDAuMGYsIDAuMGYsIG1EcmF3V2lkdGgsIG1EcmF3SGVpZ2h0LCBtUGFpbnQpOworICAgICAgICAgICAgCisgICAgICAgICAgICBjYW52YXMudHJhbnNsYXRlKDAuMGYsIDQwLjBmICsgbURyYXdIZWlnaHQpOworICAgICAgICAgICAgbVBhaW50LnNldFNoYWRlcihtRGlhZ0dyYWRpZW50KTsKKyAgICAgICAgICAgIGNhbnZhcy5kcmF3UmVjdCgwLjBmLCAwLjBmLCBtRHJhd1dpZHRoLCBtRHJhd0hlaWdodCwgbVBhaW50KTsKKworICAgICAgICAgICAgY2FudmFzLnRyYW5zbGF0ZSgwLjBmLCA0MC4wZiArIG1EcmF3SGVpZ2h0KTsKKyAgICAgICAgICAgIG1QYWludC5zZXRTaGFkZXIobVZlcnRHcmFkaWVudCk7CisgICAgICAgICAgICBjYW52YXMuZHJhd1JlY3QoMC4wZiwgMC4wZiwgbURyYXdXaWR0aCwgbURyYXdIZWlnaHQsIG1QYWludCk7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIGNhbnZhcy5yZXN0b3JlKCk7CisgICAgICAgIH0KKyA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gICAgICAgbVN0cmlrZVBhaW50LnNldEFudGlBbGlhcyh0cnVlKTsKKyAgICAgICAgICAgIG1TdHJpa2VQYWludC5zZXRUZXh0U2l6ZSgxNi4wZik7CisgICAgICAgICAgICBtU3RyaWtlUGFpbnQuc2V0VW5kZXJsaW5lVGV4dCh0cnVlKTsKKworICAgICAgICAgICAgbVNjYWxlZFBhaW50ID0gbmV3IFBhaW50KCk7CisgICAgICAgICAgICBtU2NhbGVkUGFpbnQuc2V0QW50aUFsaWFzKHRydWUpOworICAgICAgICAgICAgbVNjYWxlZFBhaW50LnNldFRleHRTaXplKDE2LjBmKTsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwcm90ZWN0ZWQgdm9pZCBvbkRyYXcoQ2FudmFzIGNhbnZhcykgeworICAgICAgICAgICAgc3VwZXIub25EcmF3KGNhbnZhcyk7CisgICAgICAgICAgICBjYW52YXMuZHJhd1JHQigyNTUsIDI1NSwgMjU1KTsKKworICAgICAgICAgICAgY2FudmFzLmRyYXdUZXh0KCJIZWxsbyBPcGVuR0wgcmVuZGVyZXIhIiwgMTAwLCAyMCwgbU1lZGl1bVBhaW50KTsKKyAgICAgICAgICAgIG1NZWRpdW1QYWludC5zZXRUZXh0QWxpZ24oUGFpbnQuQWxpZ24uQ0VOVEVSKTsKKyAgICAgICAgICAgIGNhbnZhcy5kcmF3VGV4dCgiSGVsbG8gT3BlbkdMIHJlbmRlcmVyISIsIDEwMCwgNDAsIG1NZWRpdW1QYWludCk7CisgICAgICAgICAgICBtTWVkaXVtUGFpbnQuc2V0VGV4dEFsaWduKFBhaW50LkFsaWduLlJJR0hUKTsKKyAgICAgICAgICAgIGNhbnZhcy5kcmF3VGV4dCgiSGVsbG8gT3BlbkdMIHJlbmRlcmVyISIsIDEwMCwgNjAsIG1NZWRpdW1QYWludCk7CisgICAgICAgICAgICBtTWVkaXVtUGFpbnQuc2V0VGV4dEFsaWduKFBhaW50LkFsaWduLkxFRlQpOworICAg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wMS5nZXRXaWR0aCgpIC8gMi4wZjsKKyAgICAgICAgICAgIGZpbmFsIGZsb2F0IGNlbnRlclkgPSBnZXRIZWlnaHQoKSAvIDIuMGYgLSBtQml0bWFwMS5nZXRIZWlnaHQoKSAvIDIuMGY7CisgICAgICAgICAgICBmaW5hbCBDYW1lcmEgY2FtZXJhID0gbUNhbWVyYTsKKyAgICAgICAgICAgIAorICAgICAgICAgICAgZmluYWwgTWF0cml4IG1hdHJpeCA9IG1NYXRyaXg7CisKKyAgICAgICAgICAgIHJvdGF0ZShjZW50ZXJYLCBjZW50ZXJZLCBjYW1lcmEsIG1hdHJpeCwgMzIuMGYpOworICAgICAgICAgICAgZHJhd0JpdG1hcChjYW52YXMsIGNlbnRlclgsIGNlbnRlclksIDAuMGYsIG1hdHJpeCk7CisKKyAgICAgICAgICAgIHJvdGF0ZShjZW50ZXJYLCBjZW50ZXJZLCBjYW1lcmEsIG1hdHJpeCwgMTIuMGYpOworICAgICAgICAgICAgZHJhd0JpdG1hcChjYW52YXMsIGNlbnRlclgsIGNlbnRlclksIC1tQml0bWFwMS5nZXRXaWR0aCgpLCBtYXRyaXgpOworICAgICAgICAgICAgCisgICAgICAgICAgICByb3RhdGUoY2VudGVyWCwgY2VudGVyWSwgY2FtZXJhLCBtYXRyaXgsIDUyLjBmKTsKKyAgICAgICAgICAgIGRyYXdCaXRtYXAoY2FudmFzLCBjZW50ZXJYLCBjZW50ZXJZLCBtQml0bWFwMS5nZXRXaWR0aCgpLCBtYXRyaXgpOworICAgICAgICAgICAgCisgICAgICAgICAgICByb3RhdGUoY2VudGVyWCwgY2VudGVyWSwgY2FtZXJhLCBtYXRyaXgsIDEyMi4wZik7CisgICAgICAgICAgICBkcmF3Qml0bWFwKGNhbnZhcywgY2VudGVyWCwgY2VudGVyWSwgbUJpdG1hcDEuZ2V0V2lkdGgoKSAqIDIuMGYsIG1hdHJpeCk7CisgICAgICAgICAgICAKKyAgICAgICAgfQorCisgICAgICAgIHByaXZhdGUgdm9pZCBkcmF3Qml0bWFwKENhbnZhcyBjYW52YXMsIGZsb2F0IGNlbnRlclgsIGZsb2F0IGNlbnRlclksIGZsb2F0IG9mZnNldCwKKyAgICAgICAgICAgICAgICBNYXRyaXggbWF0cml4KSB7CisgICAgICAgICAgICBjYW52YXMuc2F2ZSgpOworICAgICAgICAgICAgY2FudmFzLnRyYW5zbGF0ZShvZmZzZXQsIDAuMGYpOworICAgICAgICAgICAgY2FudmFzLmNvbmNhdChtYXRyaXgpOworICAgICAgICAgICAgY2FudmFzLmRyYXdCaXRtYXAobUJpdG1hcDEsIGNlbnRlclgsIGNlbnRlclksIG51bGwpOworICAgICAgICAgICAgY2FudmFzLnJlc3RvcmUoKTsKKyAgICAgICAgfQorCisgICAgICAgIHByaXZhdGUgdm9pZCByb3RhdGUoZmxvYXQgY2VudGVyWCwgZmxvYXQgY2VudGVyWSwgQ2FtZXJhIGNhbWVyYSwKKyAgICAgICAgICAgICAgICBNYXRyaXggbWF0cml4LCBmbG9hdCBhbmdsZSkgeworICAgICAgICAgICAgY2FtZXJhLnNhdmUoKTsKKyAgICAgICAgICAgIGNhbWVyYS5yb3RhdGVZKGFuZ2xlKTsKKyAgICAgICAgICAgIGNhbWVyYS5nZXRNYXRyaXgobWF0cml4KTsKKyAgICAgICAgICAgIGNhbWVyYS5yZXN0b3JlKCk7CisKKyAgICAgICAgICAgIG1hdHJpeC5wcmVUcmFuc2xhdGUoLWNlbnRlclgsIC1jZW50ZXJZKTsKKyAgICAgICAgICAgIG1hdHJpeC5wb3N0VHJhbnNsYXRlKGNlbnRlclgsIGNlbnRlclkpOworICAgICAgICB9CisgICAgfQorfQpkaWZmIC0tZ2l0IGEvdGVzdHMvSHdBY2NlbGVyYXRpb25UZXN0L3NyYy9jb20vZ29vZ2xlL2FuZHJvaWQvdGVzdC9od3VpL1hmZXJtb2RlQWN0aXZpdHkuamF2YSBiL3Rlc3RzL0h3QWNjZWxlcmF0aW9uVGVzdC9zcmMvY29tL2dvb2ds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vZGVzVmlldyhDb250ZXh0IGMpIHsKKyAgICAgICAgICAgIHN1cGVyKGMpOworCisgICAgICAgICAgICBtQmx1ZVBhaW50ID0gbmV3IFBhaW50KCk7CisgICAgICAgICAgICBtQmx1ZVBhaW50LnNldENvbG9yKDB4ZmYwMDAwZmYpOworICAgICAgICAgICAgCisgICAgICAgICAgICBtUmVkUGFpbnQgPSBuZXcgUGFpbnQoKTsKKyAgICAgICAgICAgIG1SZWRQYWludC5zZXRDb2xvcigweDdmZmYwMDAwKTsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwcm90ZWN0ZWQgdm9pZCBvbkRyYXcoQ2FudmFzIGNhbnZhcykgeworICAgICAgICAgICAgc3VwZXIub25EcmF3KGNhbnZhcyk7CisgICAgICAgICAgICAvL2NhbnZhcy5kcmF3UkdCKDI1NSwgMjU1LCAyNTUpOworCisgICAgICAgICAgICBjYW52YXMudHJhbnNsYXRlKDEwMC4wZiwgMTAwLjBmKTsKKyAgICAgICAgICAgIAorICAgICAgICAgICAgLy8gU1JDIG1vZGVzCisgICAgICAgICAgICBjYW52YXMuc2F2ZSgpOworCisgICAgICAgICAgICBkcmF3UmVjdHMoY2FudmFzLCBNb2RlLlNSQ19PVkVSKTsKKyAgICAgICAgICAgIGNhbnZhcy50cmFuc2xhdGUoMC4wZiwgMTAwLjBmKTsKKworICAgICAgICAgICAgZHJhd1JlY3RzKGNhbnZhcywgTW9kZS5TUkNfSU4pOworICAgICAgICAgICAgY2FudmFzLnRyYW5zbGF0ZSgwLjBmLCAxMDAuMGYpOyAgICAgICAgICAgIAorCisgICAgICAgICAgICBkcmF3UmVjdHMoY2FudmFzLCBNb2RlLlNSQ19PVVQpOworICAgICAgICAgICAgY2FudmFzLnRyYW5zbGF0ZSgwLjBmLCAxMDAuMGYpOworCisgICAgICAgICAgICBkcmF3UmVjdHMoY2FudmFzLCBNb2RlLlNSQ19BVE9QKTsKKyAgICAgICAgICAgIGNhbnZhcy50cmFuc2xhdGUoMC4wZiwgMTAwLjBmKTsKKyAgICAgICAgICAgIAorICAgICAgICAgICAgZHJhd1JlY3RzKGNhbnZhcywgTW9kZS5TUkMpOworCisgICAgICAgICAgICBjYW52YXMucmVzdG9yZSgpOworICAgICAgICAgICAgCisgICAgICAgICAgICBjYW52YXMudHJhbnNsYXRlKDEwMC4wZiwgMC4wZik7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIC8vIERTVCBtb2RlcworICAgICAgICAgICAgY2FudmFzLnNhdmUoKTsKKworICAgICAgICAgICAgZHJhd1JlY3RzKGNhbnZhcywgTW9kZS5EU1RfT1ZFUik7CisgICAgICAgICAgICBjYW52YXMudHJhbnNsYXRlKDAuMGYsIDEwMC4wZik7CisKKyAgICAgICAgICAgIGRyYXdSZWN0cyhjYW52YXMsIE1vZGUuRFNUX0lOKTsKKyAgICAgICAgICAgIGNhbnZhcy50cmFuc2xhdGUoMC4wZiwgMTAwLjBmKTsgICAgICAgICAgICAKKworICAgICAgICAgICAgZHJhd1JlY3RzKGNhbnZhcywgTW9kZS5EU1RfT1VUKTsKKyAgICAgICAgICAgIGNhbnZhcy50cmFuc2xhdGUoMC4wZiwgMTAwLjBmKTsKKworICAgICAgICAgICAgZHJhd1JlY3RzKGNhbnZhcywgTW9kZS5EU1RfQVRPUCk7CisgICAgICAgICAgICBjYW52YXMudHJhbnNsYXRlKDAuMGYsIDEwMC4wZik7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIGRyYXdSZWN0cyhjYW52YXMsIE1vZGUuRFNUKTsKKworICAgICAgICAgICAgY2FudmFzLnJlc3RvcmUoKTsKKyAgICAgICAgICAgIAorICAgICAgICAgICAgY2FudmFzLnRyYW5zbGF0ZSgxMDAuMGYsIDAuMGYpOworICAgICAgICAgICAgCisgICAgICAgICAgICAvLyBPdGhlciBtb2RlcworICAgICAgICAgICAgY2FudmFzLnNhdmUoKTsKKworICAgICAgICAgICAgZHJhd1JlY3RzKGNhbnZhcywgTW9kZS5DTEVBUik7CisgICAgICAgICAgICBjYW52YXMudHJhbnNsYXRlKDAuMGYsIDEwMC4wZik7CisKKyAgICAgICAgICAgIGRyYXdSZWN0cyhjYW52YXMsIE1vZGUuWE9SKTsKKyAgICAgICAgICAgIAorICAgICAgICAgICAgY2FudmFzLnRyYW5zbGF0ZSgwLjBmLCAxMDAuMGYpOworICAgICAgICAgICAgCisgICAgICAgICAgICBtQmx1ZVBhaW50LnNldEFscGhhKDEyNyk7CisgICAgICAgICAgICBjYW52YXMuZHJhd1JlY3QoMC4wZiwgMC4wZiwgNTAuMGYsIDUwLjBmLCBtQmx1ZVBhaW50KTsKKyAgICAgICAgICAgIAorICAgICAgICAgICAgY2FudmFzLnRyYW5zbGF0ZSgwLjBmLCAxMDAuMGYpOworICAgICAgICAgICAgCisgICAgICAgICAgICBtQmx1ZVBhaW50LnNldEFscGhhKDEwKTsKKyAgICAgICAgICAgIG1CbHVlUGFpbnQuc2V0Q29sb3IoMHg3ZjAwMDBmZik7CisgICAgICAgICAgICBjYW52YXMuZHJhd1JlY3QoMC4wZiwgMC4wZiwgNTAuMGYsIDUwLjBmLCBtQmx1ZVBhaW50KTsKKyAgICAgICAgICAgIAorICAgICAgICAgICAgbUJsdWVQYWludC5zZXRDb2xvcigweGZmMDAwMGZmKTsKKyAgICAgICAgICAgIG1CbHVlUGFpbnQuc2V0QWxwaGEoMjU1KTsKKworICAgICAgICAgICAgY2FudmFzLnJlc3RvcmUoKTsKKyAgICAgICAgfQorCisgICAgICAgIHByaXZhdGUgdm9pZCBkcmF3UmVjdHMoQ2FudmFzIGNhbnZhcywgUG9ydGVyRHVmZi5Nb2RlIG1vZGUpIHsKKyAgICAgICAgICAgIGNhbnZhcy5kcmF3UmVjdCgwLjBmLCAwLjBmLCA1MC4wZiwgNTAuMGYsIG1CbHVlUGFpbnQpOworCisgICAgICAgICAgICBjYW52YXMuc2F2ZSgpOworICAgICAgICAgICAgY2FudmFzLnRyYW5zbGF0ZSgyNS4wZiwgMjUuMGY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7IGkgPCBiYXNlRmlsZXMuc2l6ZSgpOyBpKyspIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcmludGYoImJhc2VGaWxlICVsZCBoYXMgZmxhdm9yICVzXG4iLCBpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByaW50ZigiYmFzZUZpbGUgJWQgaGFzIGZsYXZvciAlc1xuIiwgaSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJhc2VGaWxlcy5rZXlBdChpKS50b1N0cmluZygpLnN0cmluZygpKTsKICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoc2l6ZV90IGk9MDsgaSA8IG92ZXJsYXlGaWxlcy5zaXplKCk7IGkrKykgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByaW50Zigib3ZlcmxheUZpbGUgJWxkIGhhcyBmbGF2b3IgJXNcbiIsIGksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJpbnRmKCJvdmVybGF5RmlsZSAlZCBoYXMgZmxhdm9yICVzXG4iLCBpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3ZlcmxheUZpbGVzLmtleUF0KGkpLnRvU3RyaW5nKCkuc3RyaW5nKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICB9CkBAIC01NjAsNyArNTYwLDcgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5QXQob3ZlcmxheUdyb3VwSW5kZXgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgIGlmKGJhc2VGaWxlSW5kZXggPCBVTktOT1dOX0VSUk9SKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGJ1bmRsZS0+Z2V0VmVyYm9zZSgpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByaW50ZigiZm91bmQgYSBtYXRjaCAoJWxkKSBmb3Igb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ICAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgIH0KQEAgLTUyNiw3ICs1MzksOCBAQAogICAgICAqLwogICAgIHB1YmxpYyBib29sZWFuIHJlY29ubmVjdCgpIHsKICAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgIHJldHVybiBtU2VydmljZS5yZWNvbm5lY3QoKTsKKyAgICAgICAgICAgIG1TZXJ2aWNlLnJlY29ubmVjdCgpOworICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBlKSB7CiAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgIH0KQEAgLTU0MCw3ICs1NTQsOCBAQAogICAgICAqLwogICAgIHB1YmxpYyBib29sZWFuIHJlYXNzb2NpYXRlKCkgewogICAgICAgICB0cnkgewotICAgICAgICAgICAgcmV0dXJuIG1TZXJ2aWNlLnJlYXNzb2NpYXRlKCk7CisgICAgICAgICAgICBtU2VydmljZS5yZWFzc29jaWF0ZSgpOworICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBlKSB7CiAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgIH0KQEAgLTU2OSw3ICs1ODQsOCBAQAogICAgICAqLwogICAgIHB1YmxpYyBib29sZWFuIHN0YXJ0U2NhbigpIHsKICAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgIHJldHVybiBtU2VydmljZS5zdGFydFNjYW4oZmFsc2UpOworICAgICAgICAgICAgbVNlcnZpY2Uuc3RhcnRTY2FuKGZhbHNlKTsKKyAgICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZSkgewogICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICB9CkBAIC01ODcsNyArNjAzLDggQEAKICAgICAgKi8KICAgICBwdWJsaWMgYm9vbGVhbiBzdGFydFNjYW5BY3RpdmUoKSB7CiAgICAgICAgIHRyeSB7Ci0gICAgICAgICAgICByZXR1cm4gbVNlcnZpY2Uuc3RhcnRTY2FuKHRydWUpOworICAgICAgICAgICAgbVNlcnZpY2Uuc3RhcnRTY2FuKHRydWUpOworICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBlKSB7CiAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgIH0KQEAgLTc1Myw4ICs3NzAsOSBAQAogICAgICAgICB9IGVsc2UgaWYgKHJzc2kgPj0gTUFYX1JTU0kpIHsKICAgICAgICAgICAgIHJldHVybiBudW1MZXZlbHMgLSAxOwogICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgaW50IHBhcnRpdGlvblNpemUgPSAoTUFYX1JTU0kgLSBNSU5fUlNTSSkgLyAobnVtTGV2ZWxzIC0gMSk7Ci0gICAgICAgICAgICByZXR1cm4gKHJzc2kgLSBNSU5fUlNTSSkgLyBwYXJ0aXRpb25TaXplOworICAgICAgICAgICAgZmxvYXQgaW5wdXRSYW5nZSA9IChNQVhfUlNTSSAtIE1JTl9SU1NJKTsKKyAgICAgICAgICAgIGZsb2F0IG91dHB1dFJhbmdlID0gKG51bUxldmVscyAtIDEpOworICAgICAgICAgICAgcmV0dXJuIChpbnQpKChmbG9hdCkocnNzaSAtIE1JTl9SU1NJKSAqIG91dHB1dFJhbmdlIC8gaW5wdXRSYW5nZSk7CiAgICAgICAgIH0KICAgICB9CiAgICAgCkBAIC04NDgsNiArODY2LDE2NiBAQAogICAgICAgICB9CiAgICAgfQogCisgICAvKioKKyAgICAgKiBTdGFydCB0aGUgZHJpdmVyIGFuZCBjb25uZWN0IHRvIG5ldHdvcmsuCisgICAgICoKKyAgICAgKiBUaGlzIGZ1bmN0aW9uIHdpbGwgb3Zlci1yaWRlIFdpZmlMb2NrIGFuZCBkZXZpY2UgaWRsZSBzdGF0dXMuIEZvciBleGFtcGxlLAorICAgICAqIGV2ZW4gaWYgdGhlIGRldmljZSBpcyBpZGxlIG9yIHRoZXJlIGlzIG9ubHkgYSBzY2FuLW9ubHkgbG9jayBoZWxkLAorICAgICAqIGEgc3RhcnQgd2lmaSB3b3VsZCBtZWFuIHRoYXQgd2lmaSBjb25uZWN0aW9uIGlzIGtlcHQgYWN0aXZlIHVudGlsCisgICAgICogYSBzdG9wV2lmaSgpIGlzIHNlbnQuCisgICAgICoKKyAgICAgKiBUaGlzIEFQSSBpcyB1c2VkIGJ5IFdpZmlTdGF0ZVRyYWNrZXIKKyAgICAgKgorICAgICAqIEByZXR1cm4ge0Bjb2RlIHRydWV9IGlmIHRoZSBvcGVyYXRpb24gc3VjY2VlZHMgZWxzZSB7QGNvZGUgZmFsc2V9CisgICAgICogQGhpZGUKKyAgICAgKi8KKyAgICBwdWJsaWMgYm9vbGVhbiBzdGFydFdpZmkoKSB7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBtU2VydmljZS5zdGFydFdpZmkoKTsKKyAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogRGlzY29ubmVjdCBmcm9tIGEgbmV0d29yayAoaWYgYW55KSBhbmQgc3RvcCB0aGUgZHJpdmVyLgorICAgICAqCisgICAgICogVGhpcyBmdW5jdGlvbiB3aWxsIG92ZXItcmlkZSBXaWZpTG9jayBhbmQgZGV2aWNlIGlkbGUgc3RhdHVzLiBXaS1GaQorICAgICAqIHN0YXlzIGluYWN0aXZlIHVudGlsIGEgc3RhcnRXaWZpKCkgaXMgaXNzdWVkLgorICAgICAqCisgICAgICogVGhpcyBBUEkgaXMgdXNlZCBieSBXaWZpU3RhdGVUcmFja2VyCisgICAgICoKKyAgICAgKiBAcmV0dXJuIHtAY29kZSB0cnVlfSBpZiB0aGUgb3BlcmF0aW9uIHN1Y2NlZWRzIGVsc2Uge0Bjb2RlIGZhbHNlfQorICAgICAqIEBoaWRlCisgICAgICovCisgICAgcHVibGljIGJvb2xlYW4gc3RvcFdpZmkoKSB7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBtU2VydmljZS5zdG9wV2lmaSgpOworICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBBZGQgYSBic3NpZCB0byB0aGUgc3VwcGxpY2FudCBibGFja2xpc3QKKyAgICAgKgorICAgICAqIFRoaXMgQVBJIGlzIHVzZWQgYnkgV2lmaVdhdGNoZG9nU2VydmljZQorICAgICAqCisgICAgICogQHJldHVybiB7QGNvZGUgdHJ1ZX0gaWYgdGhlIG9wZXJhdGlvbiBzdWNjZWVkcyBlbHNlIHtAY29kZSBmYWxzZX0KKyAgICAgKiBAaGlkZQorICAgICAqLworICAgIHB1YmxpYyBib29sZWFuIGFkZFRvQmxhY2tsaXN0KFN0cmluZyBic3NpZCkgeworICAgICAgICB0cnkgeworICAgICAgICAgICAgbVNlcnZpY2UuYWRkVG9CbGFja2xpc3QoYnNzaWQpOworICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBDbGVhciB0aGUgc3VwcGxpY2FudCBibGFja2xpc3QKKyAgICAgKgorICAgICAqIFRoaXMgQVBJIGlzIHVzZWQgYnkgV2lmaVdhdGNoZG9nU2VydmljZQorICAgICAqCisgICAgICogQHJldHVybiB7QGNvZGUgdHJ1ZX0gaWYgdGhlIG9wZXJhdGlvbiBzdWNjZWVkcyBlbHNlIHtAY29kZSBmYWxzZX0KKyAgICAgKiBAaGlkZQorICAgICAqLworICAgIHB1YmxpYyBib29sZWFuIGNsZWFyQmxhY2tsaXN0KCkgeworICAgICAgICB0cnkgeworICAgICAgICAgICAgbVNlcnZpY2UuY2xlYXJCbGFja2xpc3QoKTsKKyAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisgICAgfQorCisgICAgLyogVE9ETzogZGVwcmVjYXRlIHN5bmNocm9ub3VzIEFQSSBhbmQgb3BlbiB1cCB0aGUgZm9sbG93aW5nIEFQSSAqLworICAgIC8qKgorICAgICAqIENvbm5lY3QgdG8gYSBuZXR3b3JrIHdpdGggdGhlIGdpdmVuIGNvbmZpZ3VyYXRpb24uIFRoZSBuZXR3b3JrIGFsc28KKyAgICAgKiBnZXRzIGFkZGVkIHRvIHRoZSBzdXBwbGljYW50IGNvbmZpZ3VyYXRpb24uCisgICAgICoKKyAgICAgKiBGb3IgYSBuZXcgbmV0d29yaywgdGhpcyBmdW5jdGlvbiBpcyB1c2VkIGluc3RlYWQgb2YgYQorICAgICAqIHNlcXVlbmNlIG9mIGFkZE5ldHdvcmsoKSwgZW5hYmxlTmV0d29yaygpLCBzYXZlQ29uZmlndXJhdGlvbigpIGFuZAorICAgICAqIHJlY29ubmVjdCgpCisgICAgICoKKyAgICAgKiBAcGFyYW0gY29uZmlnIHRoZSBzZXQgb2YgdmFyaWFibGVzIHRoYXQgZGVzY3JpYmUgdGhlIGNvbmZpZ3VyYXRpb24sCisgICAgICogICAgICAgICAgICBjb250YWluZWQgaW4gYSB7QGxpbmsgV2lmaUNvbmZpZ3VyYXRpb259IG9iamVjdC4KKyAgICAgKiBAaGlkZQorICAgICAqLworICAgIHB1YmxpYyB2b2lkIGNvbm5lY3ROZXR3b3JrKFdpZmlDb25maWd1cmF0aW9uIGNvbmZpZykgeworICAgICAgICBpZiAoY29uZmlnID09IG51bGwpIHsKKyAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfQorICAgICAgICB0cnkgeworICAgICAgICAgICAgbVNlcnZpY2UuY29ubmVjdE5ldHdvcmtXaXRoQ29uZmlnKGNvbmZpZyk7CisgICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBlKSB7IH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBDb25uZWN0IHRvIGEgbmV0d29yayB3aXRoIHRoZSBnaXZlbiBuZXR3b3JrSWQuCisgICAgICoKKyAgICAgKiBUaGlzIGZ1bmN0aW9uIGlzIHVzZWQgaW5zdGVhZCBvZiBhIGVuYWJsZU5ldHdvcmsoKSwgc2F2ZUNvbmZpZ3VyYXRpb24oKSBhbmQKKyAgICAgKiByZWNvbm5lY3QoKQorICAgICAqCisgICAgICogQHBhcmFtIG5ldHdvcmtJZCB0aGUgbmV0d29yayBpZCBpZGVudGlmaXlpbmcgdGhlIG5ldHdvcmsgaW4gdGhlCisgICAgICogICAgICAgICAgICAgICAgc3VwcGxpY2FudCBjb25maWd1cmF0aW9uIGxpc3QKKyAgICAgKiBAaGlkZQorICAgICAqLworICAgIHB1YmxpYyB2b2lkIGNvbm5lY3ROZXR3b3JrKGludCBuZXR3b3JrSWQpIHsKKyAgICAgICAgaWYgKG5ldHdvcmtJZCA8IDApIHsKKyAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfQorICAgICAgICB0cnkgeworICAgICAgICAgICAgbVNlcnZpY2UuY29ubmVjdE5ldHdvcmtXaXRoSWQobmV0d29ya0lkKTsKKyAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGUpIHsgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIFNhdmUgdGhlIGdpdmVuIG5ldHdvcmsgaW4gdGhlIHN1cHBsaWNhbnQgY29uZmlnLiBJZiB0aGUgbmV0d29yayBhbHJlYWR5CisgICAgICogZXhpc3RzLCB0aGUgY29uZmlndXJhdGlvbiBpcyB1cGRhdGVkLiBBIG5ldyBuZXR3b3JrIGlzIGVuYWJsZWQKKyAgICAgKiBieSBkZWZhdWx0LgorICAgICAqCisgICAgICogRm9yIGEgbmV3IG5ldHdvcmssIHRoaXMgZnVuY3Rpb24gaXMgdXNlZCBpbnN0ZWFkIG9mIGEKKyAgICAgKiBzZXF1ZW5jZSBvZiBhZGROZXR3b3JrKCksIGVuYWJsZU5ldHdvcmsoKSBhbmQgc2F2ZUNvbmZpZ3VyYXRpb24oKS4KKyAgICAgKgorICAgICAqIEZvciBhbiBleGlzdGluZyBuZXR3b3JrLCBpdCBhY2NvbXBsaXNoZXMgdGhlIHRhc2sgb2YgdXBkYXRlTmV0d29yaygpCisgICAgICogYW5kIHNhdmVDb25maWd1cmF0aW9uKCkKKyAgICAgKgorICAgICAqIEBwYXJhbSBjb25maWcgdGhlIHNldCBvZiB2YXJpYWJsZXMgdGhhdCBkZXNjcmliZSB0aGUgY29uZmlndXJhdGlvbiwKKyAgICAgKiAgICAgICAgICAgIGNvbnRhaW5lZCBpbiBhIHtAbGluayBXaWZpQ29uZmlndXJhdGlvbn0gb2JqZWN0LgorICAgICAqIEBoaWRlCisgICAgICovCisgICAgcHVibGljIHZvaWQgc2F2ZU5ldHdvcmsoV2lmaUNvbmZpZ3VyYXRpb24gY29uZmlnKSB7CisgICAgICAgIGlmIChjb25maWcgPT0gbnVsbCkgeworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBtU2VydmljZS5zYXZlTmV0d29yayhjb25maWcpOworICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZSkgeyB9CisgICAgfQorCisgICAgLyoqCisgICAgICogRGVsZXRlIHRoZSBuZXR3b3JrIGluIHRoZSBzdXBwbGljYW50IGNvbmZpZy4KKyAgICAgKgorICAgICAqIFR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mluYWwgaW50IE1BWF9SRUNWX0VSUk9SUyAgICA9IDEwOwogCi0gICAgcHVibGljIFdpZmlNb25pdG9yKFdpZmlTdGF0ZVRyYWNrZXIgdHJhY2tlcikgewotICAgICAgICBtV2lmaVN0YXRlVHJhY2tlciA9IHRyYWNrZXI7CisgICAgcHVibGljIFdpZmlNb25pdG9yKFdpZmlTdGF0ZU1hY2hpbmUgd2lmaVN0YXRlTWFjaGluZSkgeworICAgICAgICBtV2lmaVN0YXRlTWFjaGluZSA9IHdpZmlTdGF0ZU1hY2hpbmU7CiAgICAgfQogCiAgICAgcHVibGljIHZvaWQgc3RhcnRNb25pdG9yaW5nKCkgewogICAgICAgICBuZXcgTW9uaXRvclRocmVhZCgpLnN0YXJ0KCk7CiAgICAgfQogCi0gICAgcHVibGljIE5ldHdvcmtTdGF0ZVRyYWNrZXIgZ2V0TmV0d29ya1N0YXRlVHJhY2tlcigpIHsKLSAgICAgICAgcmV0dXJuIG1XaWZpU3RhdGVUcmFja2VyOwotICAgIH0KLQogICAgIGNsYXNzIE1vbml0b3JUaHJlYWQgZXh0ZW5kcyBUaHJlYWQgewogICAgICAgICBwdWJsaWMgTW9uaXRvclRocmVhZCgpIHsKICAgICAgICAgICAgIHN1cGVyKCJXaWZpTW9uaXRvciIpOwogICAgICAgICB9Ci0gICAgICAgIAorCiAgICAgICAgIHB1YmxpYyB2b2lkIHJ1bigpIHsKIAogICAgICAgICAgICAgaWYgKGNvbm5lY3RUb1N1cHBsaWNhbnQoKSkgewogICAgICAgICAgICAgICAgIC8vIFNlbmQgYSBtZXNzYWdlIGluZGljYXRpbmcgdGhhdCBpdCBpcyBub3cgcG9zc2libGUgdG8gc2VuZCBjb21tYW5kcwogICAgICAgICAgICAgICAgIC8vIHRvIHRoZSBzdXBwbGljYW50Ci0gICAgICAgICAgICAgICAgbVdpZmlTdGF0ZVRyYWNrZXIubm90aWZ5U3VwcGxpY2FudENvbm5lY3Rpb24oKTsKKyAgICAgICAgICAgICAgICBtV2lmaVN0YXRlTWFjaGluZS5ub3RpZnlTdXBwbGljYW50Q29ubmVjdGlvbigpOwogICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBtV2lmaVN0YXRlVHJhY2tlci5ub3RpZnlTdXBwbGljYW50TG9zdCgpOworICAgICAgICAgICAgICAgIG1XaWZpU3RhdGVNYWNoaW5lLm5vdGlmeVN1cHBsaWNhbnRMb3N0KCk7CiAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgfQogCkBAIC0yNTksNyArMjU0LDcgQEAKICAgICAgICAgICAgICAgICAgICAgfQogCiAgICAgICAgICAgICAgICAgICAgIC8vIG5vdGlmeSBhbmQgZXhpdAotICAgICAgICAgICAgICAgICAgICBtV2lmaVN0YXRlVHJhY2tlci5ub3RpZnlTdXBwbGljYW50TG9zdCgpOworICAgICAgICAgICAgICAgICAgICBtV2lmaVN0YXRlTWFjaGluZS5ub3RpZnlTdXBwbGljYW50TG9zdCgpOwogICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICBoYW5kbGVFdmVudChldmVudCwgZXZlbnREYXRhKTsKQEAgLTI3Miw3ICsyNjcsNyBAQAogICAgICAgICAgICAgaW50IGNvbm5lY3RUcmllcyA9IDA7CiAKICAgICAgICAgICAgIHdoaWxlICh0cnVlKSB7Ci0gICAgICAgICAgICAgICAgaWYgKG1XaWZpU3RhdGVUcmFja2VyLmNvbm5lY3RUb1N1cHBsaWNhbnQoKSkgeworICAgICAgICAgICAgICAgIGlmIChXaWZpTmF0aXZlLmNvbm5lY3RUb1N1cHBsaWNhbnQoKSkgewogICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgaWYgKGNvbm5lY3RUcmllcysrIDwgMykgewpAQCAtMjg1LDcgKzI4MCw3IEBACiAgICAgICAgIH0KIAogICAgICAg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DcgQEAKICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAKICAgICAgICAgICAgICAgICBjYXNlIFNDQU5fUkVTVUxUUzoKLSAgICAgICAgICAgICAgICAgICAgbVdpZmlTdGF0ZVRyYWNrZXIubm90aWZ5U2NhblJlc3VsdHNBdmFpbGFibGUoKTsKKyAgICAgICAgICAgICAgICAgICAgbVdpZmlTdGF0ZU1hY2hpbmUubm90aWZ5U2NhblJlc3VsdHNBdmFpbGFibGUoKTsKICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAKICAgICAgICAgICAgICAgICBjYXNlIFVOS05PV046CkBAIC0zNzUsNyArMzcwLDcgQEAKICAgICAgICAgICAgIGlmIChuZXdTdXBwbGljYW50U3RhdGUgPT0gU3VwcGxpY2FudFN0YXRlLklOVkFMSUQpIHsKICAgICAgICAgICAgICAgICBMb2cudyhUQUcsICJJbnZhbGlkIHN1cHBsaWNhbnQgc3RhdGU6ICIgKyBuZXdTdGF0ZSk7CiAgICAgICAgICAgICB9Ci0gICAgICAgICAgICBtV2lmaVN0YXRlVHJhY2tlci5ub3RpZnlTdGF0ZUNoYW5nZShuZXR3b3JrSWQsIEJTU0lELCBuZXdTdXBwbGljYW50U3RhdGUpOworICAgICAgICAgICAgbVdpZmlTdGF0ZU1hY2hpbmUubm90aWZ5U3VwcGxpY2FudFN0YXRlQ2hhbmdlKG5ldHdvcmtJZCwgQlNTSUQsIG5ld1N1cHBsaWNhbnRTdGF0ZSk7CiAgICAgICAgIH0KICAgICB9CiAKQEAgLTM5NSw3ICszOTAsNyBAQAogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KICAgICAgICAgfQotICAgICAgICBtV2lmaVN0YXRlVHJhY2tlci5ub3RpZnlTdGF0ZUNoYW5nZShuZXdTdGF0ZSwgQlNTSUQsIG5ldHdvcmtJZCk7CisgICAgICAgIG1XaWZpU3RhdGVNYWNoaW5lLm5vdGlmeU5ldHdvcmtTdGF0ZUNoYW5nZShuZXdTdGF0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aW5hbCBpbnQgQ01EX1NUT1BfU1VQUExJQ0FOVCAgICAgICAgICAgICAgICAgID0gMTI7CisgICAgLyogU3RhcnQgdGhlIGRyaXZlciAqLworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBDTURfU1RBUlRfRFJJVkVSICAgICAgICAgICAgICAgICAgICAgPSAxMzsKKyAgICAvKiBTdGFydCB0aGUgZHJpdmVyICovCisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IENNRF9TVE9QX0RSSVZFUiAgICAgICAgICAgICAgICAgICAgICA9IDE0OworICAgIC8qIEluZGljYXRlcyBESENQIHN1Y2NlZGVkICovCisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IENNRF9JUF9DT05GSUdfU1VDQ0VTUyAgICAgICAgICAgICAgICA9IDE1OworICAgIC8qIEluZGljYXRlcyBESENQIGZhaWxlZCAqLworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBDTURfSVBfQ09ORklHX0ZBSUxVUkUgICAgICAgICAgICAgICAgPSAxNjsKKyAgICAvKiBSZS1jb25maWd1cmUgaW50ZXJmYWNlICovCisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IENNRF9SRUNPTkZJR1VSRV9JUCAgICAgICAgICAgICAgICAgICA9IDE3OworCisKKyAgICAvKiBTdGFydCB0aGUgc29mdCBhY2Nlc3MgcG9pbnQgKi8KKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgQ01EX1NUQVJUX0FQICAgICAgICAgICAgICAgICAgICAgICAgID0gMjE7CisgICAgLyogU3RvcCB0aGUgc29mdCBhY2Nlc3MgcG9pbnQgKi8KKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgQ01EX1NUT1BfQVAgICAgICAgICAgICAgICAgICAgICAgICAgID0gMjI7CisKKworICAgIC8qIFN1cHBsaWNhbnQgZXZlbnRzICovCisgICAgLyogQ29ubmVjdGlvbiB0byBzdXBwbGljYW50IGVzdGFibGlzaGVkICovCisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IFNVUF9DT05ORUNUSU9OX0VWRU5UICAgICAgICAgICAgICAgICA9IDMxOworICAgIC8qIENvbm5lY3Rpb24gdG8gc3VwcGxpY2FudCBsb3N0ICovCisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IFNVUF9ESVNDT05ORUNUSU9OX0VWRU5UICAgICAgICAgICAgICA9IDMyOworICAgIC8qIERyaXZlciBzdGFydCBjb21wbGV0ZWQgKi8KKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgRFJJVkVSX1NUQVJUX0VWRU5UICAgICAgICAgICAgICAgICAgID0gMzM7CisgICAgLyogRHJpdmVyIHN0b3AgY29tcGxldGVkICovCisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IERSSVZFUl9TVE9QX0VWRU5UICAgICAgICAgICAgICAgICAgICA9IDM0OworICAgIC8qIE5ldHdvcmsgY29ubmVjdGlvbiBjb21wbGV0ZWQgKi8KKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgTkVUV09SS19DT05ORUNUSU9OX0VWRU5UICAgICAgICAgICAgID0gMzY7CisgICAgLyogTmV0d29yayBkaXNjb25uZWN0aW9uIGNvbXBsZXRlZCAqLworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBORVRXT1JLX0RJU0NPTk5FQ1RJT05fRVZFTlQgICAgICAgICAgPSAzNzsKKyAgICAvKiBTY2FuIHJlc3VsdHMgYXJlIGF2YWlsYWJsZSAqLworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBTQ0FOX1JFU1VMVFNfRVZFTlQgICAgICAgICAgICAgICAgICAgPSAzODsKKyAgICAvKiBTdXBwbGljYXRlIHN0YXRlIGNoYW5nZWQgKi8KKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgU1VQUExJQ0FOVF9TVEFURV9DSEFOR0VfRVZFTlQgIC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0aXplcyB0aGUgZ2l2ZW4gQlNTSUQgZm9yIGNvbm5lY3Rpb24uICovCisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IENNRF9CTEFDS0xJU1RfTkVUV09SSyAgICAgICAgICAgICAgICA9IDU2OworICAgIC8qIENsZWFyIHRoZSBibGFja2xpc3QgbmV0d29yayBsaXN0ICovCisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IENNRF9DTEVBUl9CTEFDS0xJU1QgICAgICAgICAgICAgICAgICA9IDU3OworICAgIC8qIEdldCB0aGUgY29uZmlndXJlZCBuZXR3b3JrcyAqLworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBDTURfR0VUX05FVFdPUktfQ09ORklHICAgICAgICAgICAgICAgPSA1ODsKKyAgICAvKiBTYXZlIGNvbmZpZ3VyYXRpb24gKi8KKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgQ01EX1NBVkVfQ09ORklHICAgICAgICAgICAgICAgICAgICAgID0gNTk7CisgICAgLyogQ29ubmVjdGlvbiBzdGF0dXMgKi8KKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgQ01EX0NPTk5FQ1RJT05fU1RBVFVTICAgICAgICAgICAgICAgID0gNjA7CisKKyAgICAvKiBTdXBwbGljYW50IGNvbW1hbmRzIGFmdGVyIGRyaXZlciBzdGFydCovCisgICAgLyogSW5pdGlhdGUgYSBzY2FuICovCisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IENNRF9TVEFSVF9TQ0FOICAgICAgICAgICAgICAgICAgICAgICA9IDcxOworICAgIC8qIFNldCBzY2FuIG1vZGUuIENPTk5FQ1RfTU9ERSBvciBTQ0FOX09OTFlfTU9ERSAqLworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBDTURfU0VUX1NDQU5fTU9ERSAgICAgICAgICAgICAgICAgICAgPSA3MjsKKyAgICAvKiBTZXQgc2NhbiB0eXBlLiBTQ0FOX0FDVElWRSBvciBTQ0FOX1BBU1NJVkUgKi8KKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgQ01EX1NFVF9TQ0FOX1RZUEUgICAgICAgICAgICAgICAgICAgID0gNzM7CisgICAgLyogRGlzY29ubmVjdCBmcm9tIGEgbmV0d29yayAqLworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBDTURfRElTQ09OTkVDVCAgICAgICAgICAgICAgICAgICAgICAgPSA3NDsKKyAgICAvKiBSZWNvbm5lY3QgdG8gYSBuZXR3b3JrICovCisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IENNRF9SRUNPTk5FQ1QgICAgICAgICAgICAgICAgICAgICAgICA9IDc1OworICAgIC8qIFJlYXNzb2NpYXRlIHRvIGEgbmV0d29yayAqLworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBDTURfUkVBU1NPQ0lBVEUgICAgICAgICAgICAgICAgICAgICAgPSA3NjsKKyAgICAvKiBTZXQgcG93ZXIgbW9kZQorICAgICAqIFBPV0VSX01PREVfQUNUSVZFCisgICAgICogUE9XRVJfTU9ERV9BVVRPCisgICAgICovCisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IENNRF9TRVRfUE9XRVJfTU9ERSAgICAgICAgICAgICAgICAgICA9IDc3OworICAgIC8qIFNldCBibHVldG9vdGggY28tZXhpc3RlbmNlCisgICAgICogQkxVRVRPT1RIX0NPRVhJU1RFTkNFX01PREVfRU5BQkxFRAorICAgICAqIEJMVUVUT09USF9DT0VYSVNURU5DRV9NT0RFX0RJU0FCTEVECisgICAgICogQkxVRVRPT1RIX0NPRVhJU1RFTkNFX01PREVfU0VOU0UKKyAgICAgKi8KKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgQ01EX1NFVF9CTFVFVE9PVEhfQ09FWElTVEVOQ0UgICAgICAgID0gNzg7CisgICAgLyogRW5hYmxlL2Rpc2FibGUgYmx1ZXRvb3RoIHNjYW4gbW9kZQorICAgICAqIHRydWUoMSkKKyAgICAgKiBmYWxzZSgwKQorICAgICAqLworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBDTURfU0VUX0JMVUVUT09USF9TQ0FOX01PREUgICAgICAgICAgPSA3OTsKKyAgICAvKiBTZXQgbnVtYmVyIG9mIGFsbG93ZWQgY2hhbm5lbHMgKi8KKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgQ01EX1NFVF9OVU1fQUxMT1dFRF9DSEFOTkVMUyAgICAgICAgID0gODA7CisgICAgLyogUmVxdWVzdCBjb25uZWN0aXZpdHkgbWFuYWdlciB3YWtlIGxvY2sgYmVmb3JlIGRyaXZlciBzdG9wICovCisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IENNRF9SRVFVRVNUX0NNX1dBS0VMT0NLICAgICAgICAgICAgICA9IDgxOworICAgIC8qIEVuYWJsZXMgUlNTSSBwb2xsICovCisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IENNRF9FTkFCTEVfUlNTSV9QT0xMICAgICAgICAgICAgICAgICA9IDgyOworICAgIC8qIFJTU0kgcG9sbCAqLworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBDTURfUlNTSV9QT0xMICAgICAgICAgICAgICAgICAgICAgICAgPSA4MzsKKyAgICAvKiBHZXQgY3VycmVudCBSU1NJICovCisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IENNRF9HRVRfUlNTSSAgICAgICAgICAgICAgICAgICAgICAgICA9IDg0OworICAgIC8qIEdldCBhcHByb3ggY3VycmVudCBSU1NJICovCisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IENNRF9HRVRfUlNTSV9BUFBST1ggICAgICAgICAgICAgICAgICA9IDg1OworICAgIC8qIEdldCBsaW5rIHNwZWVkIG9uIGNvbm5lY3Rpb24gKi8KKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgQ01EX0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pZmllZCBuZXR3b3JrLiBUaGlzIGludm9sdmVzIGFkZGluZworICAgICAqIGFuIGVuYWJsZWQgbmV0d29yayAoaWYgbmV3KSBhbmQgdXBkYXRpbmcgdGhlCisgICAgICogY29uZmlnIGFuZCBpc3N1aW5nIGEgc2F2ZSBvbiBzdXBwbGljYW50IGNvbmZpZy4KKyAgICAgKi8KKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgQ01EX1NBVkVfTkVUV09SSyAgICAgICAgICAgICAgICAgICAgID0gOTE7CisgICAgLyogRGVsZXRlIHRoZSBzcGVjaWZpZWQgbmV0d29yay4gVGhpcyBpbnZvbHZlcworICAgICAqIHJlbW92aW5nIHRoZSBuZXR3b3JrIGFuZCBpc3N1aW5nIGEgc2F2ZSBvbgorICAgICAqIHN1cHBsaWNhbnQgY29uZmlnLgorICAgICAqLworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBDTURfRk9SR0VUX05FVFdPUksgICAgICAgICAgICAgICAgICAgPSA5MjsKKworCisKKyAgICAvKioKKyAgICAgKiBJbnRlcnZhbCBpbiBtaWxsaXNlY29uZHMgYmV0d2VlbiBwb2xsaW5nIGZvciBjb25uZWN0aW9uCisgICAgICogc3RhdHVzIGl0ZW1zIHRoYXQgYXJlIG5vdCBzZW50IHZpYSBhc3luY2hyb25vdXMgZXZlbnRzLgorICAgICAqIEFuIGV4YW1wbGUgaXMgUlNTSSAoc2lnbmFsIHN0cmVuZ3RoKS4KKyAgICAgKi8KKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgUE9MTF9SU1NJX0lOVEVSVkFMX01TRUNTID0gMzAwMDsKKworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBDT05ORUNUX01PREUgICA9IDE7CisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IFNDQU5fT05MWV9NT0RFID0gMjsKKworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBTQ0FOX0FDVElWRSA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ZXh0LCBnZXRIYW5kbGVyKCkpOworCisgICAgICAgIG1CbHVldG9vdGhIZWFkc2V0ID0gbmV3IEJsdWV0b290aEhlYWRzZXQobUNvbnRleHQsIG51bGwpOworICAgICAgICBtTmV0d29ya1Byb3BlcnRpZXMgPSBuZXcgTmV0d29ya1Byb3BlcnRpZXMoKTsKKworICAgICAgICBtTmV0d29ya0luZm8uc2V0SXNBdmFpbGFibGUoZmFsc2UpOworICAgICAgICBtTmV0d29ya1Byb3BlcnRpZXMuY2xlYXIoKTsKKyAgICAgICAgbUxhc3RCc3NpZCA9IG51bGw7CisgICAgICAgIG1MYXN0TmV0d29ya0lkID0gLTE7CisgICAgICAgIG1MYXN0U2lnbmFsTGV2ZWwgPSAtMTsKKworICAgICAgICBtU2NhblJlc3VsdENhY2hlID0gbmV3IExpbmtlZEhhc2hNYXA8U3RyaW5nLCBTY2FuUmVzdWx0PigKKyAgICAgICAgICAgIFNDQU5fUkVTVUxUX0NBQ0hFX1NJWkUsIDAuNzVmLCB0cnVlKSB7CisgICAgICAgICAgICAgICAgLyoKKyAgICAgICAgICAgICAgICAgKiBMaW1pdCB0aGUgY2FjaGUgc2l6ZSBieSBTQ0FOX1JFU1VMVF9DQUNIRV9TSVpFCisgICAgICAgICAgICAgICAgICogZWxlbWVudHMKKyAgICAgICAgICAgICAgICAgKi8KKyAgICAgICAgICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgICAgICAgICBwdWJsaWMgYm9vbGVhbiByZW1vdmVFbGRlc3RFbnRyeShNYXAuRW50cnkgZWxkZXN0KSB7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBTQ0FOX1JFU1VMVF9DQUNIRV9TSVpFIDwgdGhpcy5zaXplKCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICB9OworCisgICAgICAgIG1TZXR0aW5nc09ic2VydmVyID0gbmV3IFNldHRpbmdzT2JzZXJ2ZXIobmV3IEhhbmRsZXIoKSk7CisKKyAgICAgICAgUG93ZXJNYW5h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7CisgICAgICAgICAgICAgICAgICAgIGFkZFN0YXRlKG1TY2FuTW9kZVN0YXRlLCBtRHJpdmVyU3RhcnRlZFN0YXRlKTsKKyAgICAgICAgICAgICAgICAgICAgYWRkU3RhdGUobUNvbm5lY3RNb2RlU3RhdGUsIG1Ecml2ZXJTdGFydGVkU3RhdGUpOworICAgICAgICAgICAgICAgICAgICAgICAgYWRkU3RhdGUobUNvbm5lY3RpbmdTdGF0ZSwgbUNvbm5lY3RNb2RlU3RhdGUpOworICAgICAgICAgICAgICAgICAgICAgICAgYWRkU3RhdGUobUNvbm5lY3RlZFN0YXRlLCBtQ29ubmVjdE1vZGVTdGF0ZSk7CisgICAgICAgICAgICAgICAgICAgICAgICBhZGRTdGF0ZShtRGlzY29ubmVjdGluZ1N0YXRlLCBtQ29ubmVjdE1vZGVTdGF0ZSk7CisgICAgICAgICAgICAgICAgICAgICAgICBhZGRTdGF0ZShtRGlzY29ubmVjdGVkU3RhdGUsIG1Db25uZWN0TW9kZVN0YXRlKTsKKyAgICAgICAgICAgICAgICBhZGRTdGF0ZShtRHJpdmVyU3RvcHBpbmdTdGF0ZSwgbURyaXZlclN1cFJlYWR5U3RhdGUpOworICAgICAgICAgICAgICAgIGFkZFN0YXRlKG1Ecml2ZXJTdG9wcGVkU3RhdGUsIG1Ecml2ZXJTdXBSZWFkeVN0YXRlKTsKKyAgICAgICAgICAgIGFkZFN0YXRlKG1Tb2Z0QXBTdGFydGVkU3RhdGUsIG1EZWZhdWx0U3RhdGUpOworCisgICAgICAgIHNldEluaXRpYWxTdGF0ZShtSW5pdGlhbFN0YXRlKTsKKworICAgICAgICBpZiAoREJHKSBzZXREYmcodHJ1ZSk7CisKKyAgICAgICAgLy9zdGFydCB0aGUgc3RhdGUgbWFjaGluZQorICAgICAgICBzdGFydCgpOworICAgIH0KKworICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyAgICAgKiBNZXRob2RzIGV4cG9zZWQgZm9yIHB1YmxpYyB1c2UKKyAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKyAgICAvKioKKyAgICAgKiBUT0RPOiBkb2MKKyAgICAgKi8KKyAgICBwdWJsaWMgYm9vbGVhbiBwaW5nU3VwcGxpY2FudCgpIHsKKyAgICAgICAgcmV0dXJuIHNlbmRTeW5jTWVzc2FnZShDTURfUElOR19TVVBQTElDQU5UKS5ib29sVmFsdWU7CisgICAgfQorCisgICAgLyoqCisgICAgICogVE9ETzogZG9jCisgICAgICovCisgICAgcHVibGljIHZvaWQgc3RhcnRTY2FuKGJvb2xlYW4gZm9yY2VBY3RpdmUpIHsKKyAgICAgICAgc2VuZE1lc3NhZ2Uob2J0YWluTWVzc2FnZShDTURfU1RBUlRfU0NBTiwgZm9yY2VBY3RpdmUgPworICAgICAgICAgICAgICAgIFNDQU5fQUNUSVZFIDogU0NBTl9QQVNTSVZFLCAwKSk7CisgICAgfQorCisgICAgLyoqCisgICAgICogVE9ETzogZG9jCisgICAgICovCisgICAgcHVibGljIHZvaWQgc2V0V2lmaUVuYWJsZWQoYm9vbGVhbiBlbmFibGUpIHsKKyAgICAgICAgbUxhc3RFbmFibGVVaWQuc2V0KEJpbmRlci5nZXRDYWxsaW5nVWlkKCkpOworICAgICAgICBpZiAoZW5hYmxlKSB7CisgICAgICAgICAgICAvKiBBcmd1bWVudCBpcyB0aGUgc3RhdGUgdGhhdCBpcyBlbnRlcmVkIHByaW9yIHRvIGxvYWQgKi8KKyAgICAgICAgICAgIHNlbmRNZXNzYWdlKG9idGFpbk1lc3NhZ2UoQ01EX0xPQURfRFJJVkVSLCBXSUZJX1NUQVRFX0VOQUJMSU5HLCAwKSk7CisgICAgICAgICAgICBzZW5kTWVzc2FnZShDTURfU1RBUlRfU1VQUExJQ0FOVCk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBzZW5kTWVzc2FnZShDTURfU1RPU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orICAgIH0KKworICAgIC8qKgorICAgICAqIFRPRE86IGRvYworICAgICAqLworICAgIHB1YmxpYyBpbnQgZ2V0V2lmaVN0YXRlKCkgeworICAgICAgICByZXR1cm4gbVdpZmlTdGF0ZS5nZXQoKTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBUT0RPOiBkb2MKKyAgICAgKi8KKyAgICBwdWJsaWMgU3RyaW5nIGdldFdpZmlTdGF0ZUJ5TmFtZSgpIHsKKyAgICAgICAgc3dpdGNoIChtV2lmaVN0YXRlLmdldCgpKSB7CisgICAgICAgICAgICBjYXNlIFdJRklfU1RBVEVfRElTQUJMSU5HOgorICAgICAgICAgICAgICAgIHJldHVybiAiZGlzYWJsaW5nIjsKKyAgICAgICAgICAgIGNhc2UgV0lGSV9TVEFURV9ESVNBQkxFRDoKKyAgICAgICAgICAgICAgICByZXR1cm4gImRpc2FibGVkIjsKKyAgICAgICAgICAgIGNhc2UgV0lGSV9TVEFURV9FTkFCTElORzoKKyAgICAgICAgICAgICAgICByZXR1cm4gImVuYWJsaW5nIjsKKyAgICAgICAgICAgIGNhc2UgV0lGSV9TVEFURV9FTkFCTEVEOgorICAgICAgICAgICAgICAgIHJldHVybiAiZW5hYmxlZCI7CisgICAgICAgICAgICBjYXNlIFdJRklfU1RBVEVfVU5LTk9XTjoKKyAgICAgICAgICAgICAgICByZXR1cm4gInVua25vd24gc3RhdGUiOworICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICByZXR1cm4gIltpbnZhbGlkIHN0YXRlXSI7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBUT0RPOiBkb2MKKyAgICAgKi8KKyAgICBwdWJsaWMgaW50IGdldFdpZmlBcFN0YXRlKCkgeworICAgICAgICByZXR1cm4gbVdpZmlBcFN0YXRlLmdldCgpOworICAgIH0KKworICAgIC8qKgorICAgICAqIFRPRE86IGRvYworICAgICAqLworICAgIHB1YmxpYyBTdHJpbmcgZ2V0V2lmaUFwU3RhdGVCeU5hbWUoKSB7CisgICAgICAgIHN3aXRjaCAobVdpZmlBcFN0YXRlLmdldCgpKSB7CisgICAgICAgICAgICBjYXNlIFdJRklfQVBfU1RBVEVfRElTQUJMSU5HOgorICAgICAgICAgICAgICAgIHJldHVybiAiZGlzYWJsaW5nIjsKKyAgICAgICAgICAgIGNhc2UgV0lGSV9BUF9TVEFURV9ESVNBQkxFRDoKKyAgICAgICAgICAgICAgICByZXR1cm4gImRpc2FibGVkIjsKKyAgICAgICAgICAgIGNhc2UgV0lGSV9BUF9TVEFURV9FTkFCTElORzoKKyAgICAgICAgICAgICAgICByZXR1cm4gImVuYWJsaW5nIjsKKyAgICAgICAgICAgIGNhc2UgV0lGSV9BUF9TVEFURV9FTkFCTEVEOgorICAgICAgICAgICAgICAgIHJldHVybiAiZW5hYmxlZCI7CisgICAgICAgICAgICBjYXNlIFdJRklfQVBfU1RBVEVfRkFJTEVEOgorICAgICAgICAgICAgICAgIHJldHVybiAiZmFpbGVkIjsKKyAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgcmV0dXJuICJbaW52YWxpZCBzdGF0ZV0iOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogR2V0IHN0YXR1cyBpbmZvcm1hdGlvbiBmb3IgdGhlIGN1cnJlbnQgY29ubmVjdGlvbiwgaWYgYW55LgorICAgICAqIEByZXR1cm4gYSB7QGxpbmsgV2lmaUluZm99IG9iamVjdCBjb250YWluaW5nIGluZm9ybWF0aW9uIGFib3V0IHRoZSBjdXJyZW50IGNvbm5lY3Rpb24KKyAgICAgKgorICAgICAqLworICAgIHB1YmxpYyBXaWZpSW5mbyByZXF1ZXN0Q29ubmVjdGlvbkluZm8oKSB7CisgICAgICAgIHJldHVybiBtV2lmaUluZm87CisgICAgfQorCisgICAgcHVibGljIERoY3BJbmZvIGdldERoY3BJbmZvKCkgeworICAgICAgICByZXR1cm4gbURoY3BJbmZvOworICAgIH0KKworICAgIC8qKgorICAgICAqIFRPRE86IGRvYworICAgICAqLworICAgIHB1YmxpYyB2b2lkIHNldERyaXZlclN0YXJ0KGJvb2xlYW4gZW5hYmxlKSB7CisgICAgICBpZiAoZW5hYmxlKSB7CisgICAgICAgICAgc2VuZE1lc3NhZ2UoQ01EX1NUQVJUX0RSSVZFUik7CisgICAgICB9IGVsc2UgeworICAgICAgICAgIHNlbmRNZXNzYWdlKENNRF9TVE9QX0RSSVZFUik7CisgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogVE9ETzogZG9jCisgICAgICovCisgICAgcHVibGljIHZvaWQgc2V0U2Nhbk9ubHlNb2RlKGJvb2xlYW4gZW5hYmxlKSB7CisgICAgICBpZiAoZW5hYmxlKSB7CisgICAgICAgICAgc2VuZE1lc3NhZ2Uob2J0YWluTWVzc2FnZShDTURfU0VUX1NDQU5fTU9ERSwgU0NBTl9PTkxZX01PREUsIDApKTsKKyAgICAgIH0gZWxzZSB7CisgICAgICAgICAgc2VuZE1lc3NhZ2Uob2J0YWluTWVzc2FnZShDTURfU0VUX1NDQU5fTU9ERSwgQ09OTkVDVF9NT0RFLCAwKSk7CisgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogVE9ETzogZG9jCisgICAgICovCisgICAgcHVibGljIHZvaWQgc2V0U2NhblR5cGUoYm9vbGVhbiBhY3RpdmUpIHsKKyAgICAgIGlmIChhY3RpdmUpIHsKKyAgICAgICAgICBzZW5kTWVzc2FnZShvYnRhaW5NZXNzYWdlKENNRF9TRVRfU0NBTl9UWVBFLCBTQ0FOX0FDVElWRSwgMCkpOworICAgICAgfSBlbHNlIHsKKyAgICAgICAgICBzZW5kTWVzc2FnZShvYnRhaW5NZXNzYWdlKENNRF9TRVRfU0NBTl9UWVBFLCBTQ0FOX1BBU1NJVkUsIDApKTsKKyAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBUT0RPOiBkb2MKKyAgICAgKi8KKyAgICBwdWJsaWMgTGlzdDxTY2FuUmVzdWx0PiBnZXRTY2FuUmVzdWx0c0xpc3QoKSB7CisgICAgICAgIHJldHVybiBtU2NhblJlc3VsdHM7CisgICAgfQorCisgICAgLyoqCisgICAgICogRGlzY29ubmVjdCBmcm9tIEFjY2VzcyBQb2ludAorICAgICAqLworICAgIHB1YmxpYyB2b2lkIGRpc2Nvbm5lY3RDb21tYW5kKCkgeworICAgICAgICBzZW5kTWVzc2FnZShDTURfRElTQ09OTkVDVCk7CisgICAgfQorCisgICAgLyoqCisgICAgICogSW5pdGlhdGUgYSByZWNvbm5lY3Rpb24gdG8gQVAKKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCByZWNvbm5lY3RDb21tYW5kKCkgeworICAgICAgICBzZW5kTWVzc2FnZShDTURfUkVDT05ORUNUKTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBJbml0aWF0ZSBhIHJlLWFzc29jaWF0aW9uIHRvIEFQCisgICAgICovCisgICAgcHVibGljIHZvaWQgcmVhc3NvY2lhdGVDb21tYW5kKCkgeworICAgICAgICBzZW5kTWVzc2FnZShDTURfUkVBU1NPQ0lBVEUpOworICAgIH0KKworICAgIC8qKgorICAgICAqIEFkZCBhIG5ldHdvcmsgc3luY2hyb25vdXNseQorICAgICAqCisgICAgICogQHJldHVybiBuZXR3b3JrIGlkIG9mIHRoZSBuZXcgbmV0d29yaworICAgICAqLworICAgIHB1YmxpYyBpbnQgYWRkT3JVcGRhdGVOZXR3b3JrKFdpZmlDb25maWd1cmF0aW9uIGNvbmZpZykgeworICAgICAgICByZXR1cm4gc2VuZFN5bmNNZXNzYWdlKENNRF9BRERfT1JfVVBEQVRFX05FVFdPUkssIGNvbmZpZykuaW50VmFsdWU7CisgICAgfQorCisgICAgcHVibGljIExpc3Q8V2lmaUNvbmZpZ3VyYXRpb24+IGdldENvbmZpZ3VyZWROZXR3b3JrcygpIHsKKyAgICAgICAgcmV0dXJuIHNlbmRTeW5jTWVzc2FnZShDTURfR0VUX05FVFdPUktfQ09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IHJldHVybiBzZW5kU3luY01lc3NhZ2UoQ01EX0VOQUJMRV9ORVRXT1JLLAorICAgICAgICAgICAgICAgIG5ldyBFbmFibGVOZXRQYXJhbXMobmV0SWQsIGRpc2FibGVPdGhlcnMpKS5ib29sVmFsdWU7CisgICAgfQorCisgICAgLyoqCisgICAgICogRGlzYWJsZSBhIG5ldHdvcmsKKyAgICAgKgorICAgICAqIEBwYXJhbSBuZXRJZCBuZXR3b3JrIGlkIG9mIHRoZSBuZXR3b3JrCisgICAgICogQHJldHVybiB7QGNvZGUgdHJ1ZX0gaWYgdGhlIG9wZXJhdGlvbiBzdWNjZWVkcywge0Bjb2RlIGZhbHNlfSBvdGhlcndpc2UKKyAgICAgKi8KKyAgICBwdWJsaWMgYm9vbGVhbiBkaXNhYmxlTmV0d29yayhpbnQgbmV0SWQpIHsKKyAgICAgICAgcmV0dXJuIHNlbmRTeW5jTWVzc2FnZShvYnRhaW5NZXNzYWdlKENNRF9ESVNBQkxFX05FVFdPUkssIG5ldElkLCAwKSkuYm9vbFZhbHVlOworICAgIH0KKworICAgIC8qKgorICAgICAqIEJsYWNrbGlzdCBhIEJTU0lELiBUaGlzIHdpbGwgYXZvaWQgdGhlIEFQIGlmIHRoZXJlIGFyZQorICAgICAqIGFsdGVybmF0ZSBBUHMgdG8gY29ubmVjdAorICAgICAqCisgICAgICogQHBhcmFtIGJzc2lkIEJTU0lEIG9mIHRoZSBuZXR3b3JrCisgICAgICovCisgICAgcHVibGljIHZvaWQgYWRkVG9CbGFja2xpc3QoU3RyaW5nIGJzc2lkKSB7CisgICAgICAgIHNlbmRNZXNzYWdlKG9idGFpbk1lc3NhZ2UoQ01EX0JMQUNLTElTVF9ORVRXT1JLLCBic3NpZCkpOworICAgIH0KKworICAgIC8qKgorICAgICAqIENsZWFyIHRoZSBibGFja2xpc3QgbGlzdAorICAgICAqCisgICAgICovCisgICAgcHVibGljIHZvaWQgY2xlYXJCbGFja2xpc3QoKSB7CisgICAgICAgIHNlbmRNZXNzYWdlKG9idGFpbk1lc3NhZ2UoQ01EX0NMRUFSX0JMQUNLTElTVCkpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIGNvbm5lY3ROZXR3b3JrKGludCBuZXRJZCkgeworICAgICAgICBzZW5kTWVzc2FnZShvYnRhaW5NZXNzYWdlKENNRF9DT05ORUNUX05FVFdPUkssIG5ldElkLCAwKSk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgY29ubmVjdE5ldHdvcmsoV2lmaUNvbmZpZ3VyYXRpb24gd2lmaUNvbmZpZykgeworICAgICAgICBzZW5kTWVzc2FnZShvYnRhaW5NZXNzYWdlKENNRF9DT05ORUNUX05FVFdPUkssIHdpZmlDb25maWcpKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBzYXZlTmV0d29yayhXaWZpQ29uZmlndXJhdGlvbiB3aWZpQ29uZmlnKSB7CisgICAgICAgIHNlbmRNZXNzYWdlKG9idGFpbk1lc3NhZ2UoQ01EX1NBVkVfTkVUV09SSywgd2lmaUNvbmZpZykpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIGZvcmdldE5ldHdvcmsoaW50IG5ldElkKSB7CisgICAgICAgIHNlbmRNZXNzYWdlKG9idGFpbk1lc3NhZ2UoQ01EX0ZPUkdFVF9ORVRXT1JLLCBuZXRJZCwgMCkpOworICAgIH0KKworICAgIC8qKgorICAgICAqIEdldCBkZXRhaWxlZCBzdGF0dXMgb2YgdGhlIGNvbm5lY3Rpb24KKyAgICAgKgorICAgICAqIEByZXR1cm4gRXhhbXBsZSBzdGF0dXMgcmVzdWx0CisgICAgICogIGJzc2lkPWFhOmJiOmNjOmRkOmVlOmZmCisgICAgICogIHNzaWQ9VGVzdE5ldAorICAgICAqICBpZD0zCisgICAgICogIHBhaXJ3aXNlX2NpcGhlcj1OT05FCisgICAgICogIGdyb3VwX2NpcGhlcj1OT05FCisgICAgICogIGtleV9tZ210PU5PTkUKKyAgICAgKiAgd3BhX3N0YXRlPUNPTVB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QorICAgICAqLworICAgIHB1YmxpYyBpbnQgZ2V0TGlua1NwZWVkKCkgeworICAgICAgICByZXR1cm4gc2VuZFN5bmNNZXNzYWdlKENNRF9HRVRfTElOS19TUEVFRCkuaW50VmFsdWU7CisgICAgfQorCisgICAgLyoqCisgICAgICogR2V0IE1BQyBhZGRyZXNzIG9mIHJhZGlvCisgICAgICoKKyAgICAgKiBAcmV0dXJuIE1BQyBhZGRyZXNzLCBudWxsIG9uIGZhaWx1cmUKKyAgICAgKi8KKyAgICBwdWJsaWMgU3RyaW5nIGdldE1hY0FkZHJlc3MoKSB7CisgICAgICAgIHJldHVybiBzZW5kU3luY01lc3NhZ2UoQ01EX0dFVF9NQUNfQUREUikuc3RyaW5nVmFsdWU7CisgICAgfQorCisgICAgLyoqCisgICAgICogU3RhcnQgcGFja2V0IGZpbHRlcmluZworICAgICAqLworICAgIHB1YmxpYyB2b2lkIHN0YXJ0UGFja2V0RmlsdGVyaW5nKCkgeworICAgICAgICBzZW5kTWVzc2FnZShDTURfU1RBUlRfUEFDS0VUX0ZJTFRFUklORyk7CisgICAgfQorCisgICAgLyoqCisgICAgICogU3RvcCBwYWNrZXQgZmlsdGVyaW5nCisgICAgICovCisgICAgcHVibGljIHZvaWQgc3RvcFBhY2tldEZpbHRlcmluZygpIHsKKyAgICAgICAgc2VuZE1lc3NhZ2UoQ01EX1NUT1BfUEFDS0VUX0ZJTFRFUklORyk7CisgICAgfQorCisgICAgLyoqCisgICAgICogU2V0IHBvd2VyIG1vZGUKKyAgICAgKiBAcGFyYW0gbW9kZQorICAgICAqICAgICBEUklWRVJfUE9XRVJfTU9ERV9BVVRPCisgICAgICogICAgIERSSVZFUl9QT1dFUl9NT0RFX0FDVElWRQorICAgICAqLworICAgIHB1YmxpYyB2b2lkIHNldFBvd2VyTW9kZShpbnQgbW9kZSkgeworICAgICAgICBzZW5kTWVzc2FnZShvYnRhaW5NZXNzYWdlKENNRF9TRVRfUE9XRVJfTU9ERSwgbW9kZSwgMCkpOworICAgIH0KKworICAgIC8qKgorICAgICAqIFNldCB0aGUgbnVtYmVyIG9mIGFsbG93ZWQgcmFkaW8gZnJlcXVlbmN5IGNoYW5uZWxzIGZyb20gdGhlIHN5c3RlbQorICAgICAqIHNldHRpbmcgdmFsdWUsIGlmIGFueS4KKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBzZXROdW1BbGxvd2VkQ2hhbm5lbHMoKSB7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBzZXROdW1BbGxvd2VkQ2hhbm5lbHMoCisgICAgICAgICAgICAgICAgICAgIFNldHRpbmdzLlNlY3VyZS5nZXRJbnQobUNvbnRleHQuZ2V0Q29udGVudFJlc29sdmVyKCksCisgICAgICAgICAgICAgICAgICAgIFNldHRpbmdzLlNlY3VyZS5XSUZJX05VTV9BTExPV0VEX0NIQU5ORUxTKSk7CisgICAgICAgIH0gY2F0Y2ggKFNldHRpbmdzLlNldHRpbmdOb3RGb3VuZEV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICBpZiAobU51bUFsbG93ZWRDaGFubmVscyAhPSAwKSB7CisgICAgICAgICAgICAgICAgc2V0TnVtQWxsb3dlZENoYW5uZWxzKG1OdW1BbGxvd2VkQ2hhbm5lbHMpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgLy8gb3RoZXJ3aXNlLCB1c2UgdGhlIGRyaXZlciBkZWZhdWx0CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBTZXQgdGhlIG51bWJlciBvZiByYWRpbyBmcmVxdWVuY3kgY2hhbm5lbHMgdGhhdCBhcmUgYWxsb3dlZCB0byBiZSB1c2VkCisgICAgICogaW4gdGhlIGN1cnJlbnQgcmVndWxhdG9yeSBkb21haW4uCisgICAgICogQHBhcmFtIG51bUNoYW5uZWxzIHRoZSBudW1iZXIgb2YgYWxsb3dlZCBjaGFubmVscy4gTXVzdCBiZSBncmVhdGVyIHRoYW4gMAorICAgICAqIGFuZCBsZXNzIHRoYW4gb3IgZXF1YWwgdG8gMTYuCisgICAgICovCisgICAgcHVibGljIHZvaWQgc2V0TnVtQWxsb3dlZENoYW5uZWxzKGludCBudW1DaGFubmVscykgeworICAgICAgICBzZW5kTWVzc2FnZShvYnRhaW5NZXNzYWdlKENNRF9TRVRfTlVNX0FMTE9XRURfQ0hBTk5FTFMsIG51bUNoYW5uZWxzLCAwKSk7CisgICAgfQorCisgICAgLyoqCisgICAgICogR2V0IG51bWJlciBvZiBhbGxvd2VkIGNoYW5uZWxzCisgICAgICoKKyAgICAgKiBAcmV0dXJuIGNoYW5uZWwgY291bnQsIC0xIG9uIGZhaWx1cmUKKyAgICAgKgorICAgICAqIFRPRE86IHRoaXMgaXMgbm90IGEgcHVibGljIEFQSSBhbmQgbmVlZHMgdG8gYmUgcmVtb3ZlZCBpbiBmYXZvcgorICAgICAqIG9mIGFzeW5jaHJvbm91cyByZXBvcnRpbmcuIHVudXNlZCBmb3Igbm93LgorICAgICAqLworICAgIHB1YmxpYyBpbnQgZ2V0TnVtQWxsb3dlZENoYW5uZWxzKCkgeworICAgICAgICByZXR1cm4gLTE7CisgICAgfQorCisgICAgLyoqCisgICAgICogU2V0IGJsdWV0b290aCBjb2V4IG1vZGU6CisgICAgICoKKyAgICAgKiBAcGFyYW0gbW9kZQorICAgICAqICBCTFVFVE9PVEhfQ09FWElTVEVOQ0VfTU9ERV9FTkFCTEVECisgICAgICogIEJMVUVUT09USF9DT0VYSVNURU5DRV9NT0RFX0RJU0FCTEVECisgICAgICogIEJMVUVUT09USF9DT0VYSVNURU5DRV9NT0RFX1NFTlNFCisgICAgICovCisgICAgcHVibGljIHZvaWQgc2V0Qmx1ZXRvb3RoQ29leGlzdGVuY2VNb2RlKGludCBtb2RlKSB7CisgICAgICAgIHNlbmRNZXNzYWdlKG9idGFpbk1lc3NhZ2UoQ01EX1NFVF9CTFVFVE9PVEhfQ09FWElTVEVOQ0UsIG1vZGUsIDApKTsKKyAgICB9CisKKyAgICAvKioKKyAgICAg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aygpIHsKKyAgICAgICAgc2VuZE1lc3NhZ2UoQ01EX1JFUVVFU1RfQ01fV0FLRUxPQ0spOworICAgIH0KKworICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyAgICAgKiBJbnRlcm5hbCBwcml2YXRlIGZ1bmN0aW9ucworICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworICAgIGNsYXNzIFN5bmNSZXR1cm4geworICAgICAgICBib29sZWFuIGJvb2xWYWx1ZTsKKyAgICAgICAgaW50IGludFZhbHVlOworICAgICAgICBTdHJpbmcgc3RyaW5nVmFsdWU7CisgICAgICAgIE9iamVjdCBvYmpWYWx1ZTsKKyAgICAgICAgTGlzdDxXaWZpQ29uZmlndXJhdGlvbj4gY29uZmlnTGlzdDsKKyAgICB9CisKKyAgICBjbGFzcyBTeW5jUGFyYW1zIHsKKyAgICAgICAgT2JqZWN0IG1QYXJhbWV0ZXI7CisgICAgICAgIFN5bmNSZXR1cm4gbVN5bmNSZXR1cm47CisgICAgICAgIFN5bmNQYXJhbXMoKSB7CisgICAgICAgICAgICBtU3luY1JldHVybiA9IG5ldyBTeW5jUmV0dXJuKCk7CisgICAgICAgIH0KKyAgICAgICAgU3luY1BhcmFtcyhPYmplY3QgcCkgeworICAgICAgICAgICAgbVBhcmFtZXRlciA9IHA7CisgICAgICAgICAgICBtU3luY1JldHVybiA9IG5ldyBTeW5jUmV0dXJuKCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBtZXNzYWdlLmFyZzIgaXMgcmVzZXJ2ZWQgdG8gaW5kaWNhdGUgc3luY2hyb25pemVkCisgICAgICogbWVzc2FnZS5vYmogaXMgdXNlZCB0byBzdG9yZSBTeW5jUGFyYW1zCisgICAgICovCisgICAgcHJpdmF0ZSBTeW5jUmV0dXJuIHN5bmNlZFNlbmQoTWVzc2FnZSBtc2cpIHsKKyAgICAgICAgU3luY1BhcmFtcyBzeW5jUGFyYW1zID0gKFN5bmNQYXJhbXMpIG1zZy5vYmo7CisgICAgICAgIG1zZy5hcmcyID0gU1lOQ0hST05PVVNfQ0FMTDsKKyAgICAgICAgc3luY2hyb25pemVkKHN5bmNQYXJhbXMpIHsKKyAgICAgICAgICAgIGlmIChEQkcpIExvZy5kKFRBRywgInN5bmNlZFNlbmQgIiArIG1zZyk7CisgICAgICAgICAgICBzZW5kTWVzc2FnZShtc2cpOworICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICBzeW5jUGFyYW1zLndhaXQoKTsKKyAgICAgICAgICAgIH0gY2F0Y2ggKEludGVycnVwdGVkRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICBMb2cuZShUQUcsICJzZW5kU3luY01lc3NhZ2U6IHVuZXhwZWN0ZWQgaW50ZXJydXB0aW9uIG9mIHdhaXQoKSIpOworICAgICAgICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHJldHVybiBzeW5jUGFyYW1zLm1TeW5jUmV0dXJuOworICAgIH0KKworICAgIHByaXZhdGUgU3luY1JldHVybiBzZW5kU3luY01lc3NhZ2UoTWVzc2FnZSBtc2cpIHsKKyAgICAgICAgU3luY1BhcmFtcyBzeW5jUGFyYW1zID0gbmV3IFN5bmNQYXJhbXMoKTsKKyAgICAgICAgbXNnLm9iaiA9IHN5bmNQYXJhbXM7CisgICAgICAgIHJldHVybiBzeW5jZWRTZW5kKG1zZyk7CisgICAgfQorCisgICAgcHJpdmF0ZSBTeW5jUmV0dXJuIHNlbmRTeW5jTWVzc2FnZShpbnQgd2hhdCwgT2JqZWN0IHBhcmFtKSB7CisgICAgICAgIFN5bmNQYXJhbXMgc3luY1BhcmFtcyA9IG5ldyBTeW5jUGFyYW1zKHBhcmFtKTsKKyAgICAgICAgTWVzc2FnZSBtc2cgPSBvYnRhaW5NZXNzYWdlKHdoYXQsIHN5bmNQYXJhbXMpOworICAgICAgICByZXR1cm4gc3luY2VkU2VuZChtc2cpOworICAgIH0KKworCisgICAgcHJpdmF0ZSBTeW5jUmV0dXJuIHNlbmRTeW5jTWVzc2FnZShpbnQgd2hhdCkgeworICAgICAgICByZXR1cm4gc2VuZFN5bmNNZXNzYWdlKG9idGFpbk1lc3NhZ2Uod2hhdCkpOworICAgIH0KKworICAgIHByaXZhdGUgdm9pZCBub3RpZnlPbk1zZ09iamVjdChNZXNzYWdlIG1zZykgeworICAgICAgICBTeW5jUGFyYW1zIHN5bmNQYXJhbXMgPSAoU3luY1BhcmFtcykgbXNnLm9iajsKKyAgICAgICAgaWYgKHN5bmNQYXJhbXMgIT0gbnVsbCkgeworICAgICAgICAgICAgc3luY2hyb25pemVkKHN5bmNQYXJhbXMpIHsKKyAgICAgICAgICAgICAgICBpZiAoREJHKSBMb2cuZChUQUcsICJub3RpZnlPbk1zZ09iamVjdCAiICsgbXNnKTsKKyAgICAgICAgICAgICAgICBzeW5jUGFyYW1zLm5vdGlmeSgpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIGVsc2UgeworICAgICAgICAgICAgTG9nLmUoVEFHLCAiRXJyb3IhIHN5bmNQYXJhbXMgaW4gbm90aWZ5T25Nc2dPYmplY3QgaXMgbnVsbCIpOworICAgICAgICB9CisgICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIHNldFdpZmlTdGF0ZShpbnQgd2lmaVN0YXRlKSB7CisgICAgICAgIGZpbmFsIGludCBwcmV2aW91c1dpZmlTdGF0ZSA9IG1XaWZpU3RhdGUuZ2V0KCk7CisKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIGlmICh3aWZpU3RhdGUgPT0gV0lGSV9TVEFURV9FTkFCTEVEKSB7CisgICAgICAgICAgICAgICAgbUJhdHRlcnlTdGF0cy5ub3RlV2lmaU9uKG1MYXN0RW5hYmxlVWlkLmdldCgpKTsKKyAgICAgICAgICAgIH0gZWxzZ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QX1NUQVRFLCBwcmV2aW91c1dpZmlBcFN0YXRlKTsKKyAgICAgICAgbUNvbnRleHQuc2VuZFN0aWNreUJyb2FkY2FzdChpbnRlbnQpOworICAgIH0KKworICAgIC8qKgorICAgICAqIFBhcnNlIHRoZSBzY2FuIHJlc3VsdCBsaW5lIHBhc3NlZCB0byB1cyBieSB3cGFfc3VwcGxpY2FudCAoaGVscGVyKS4KKyAgICAgKiBAcGFyYW0gbGluZSB0aGUgbGluZSB0byBwYXJzZQorICAgICAqIEByZXR1cm4gdGhlIHtAbGluayBTY2FuUmVzdWx0fSBvYmplY3QKKyAgICAgKi8KKyAgICBwcml2YXRlIFNjYW5SZXN1bHQgcGFyc2VTY2FuUmVzdWx0KFN0cmluZyBsaW5lKSB7CisgICAgICAgIFNjYW5SZXN1bHQgc2NhblJlc3VsdCA9IG51bGw7CisgICAgICAgIGlmIChsaW5lICE9IG51bGwpIHsKKyAgICAgICAgICAgIC8qCisgICAgICAgICAgICAgKiBDYWNoZSBpbXBsZW1lbnRhdGlvbiAoTGlua2VkSGFzaE1hcCkgaXMgbm90IHN5bmNocm9uaXplZCwgdGh1cywKKyAgICAgICAgICAgICAqIG11c3Qgc3luY2hyb25pemVkIGhlcmUhCisgICAgICAgICAgICAgKi8KKyAgICAgICAgICAgIHN5bmNocm9uaXplZCAobVNjYW5SZXN1bHRDYWNoZSkgeworICAgICAgICAgICAgICAgIFN0cmluZ1tdIHJlc3VsdCA9IHNjYW5SZXN1bHRQYXR0ZXJuLnNwbGl0KGxpbmUpOworICAgICAgICAgICAgICAgIGlmICgzIDw9IHJlc3VsdC5sZW5ndGggJiYgcmVzdWx0Lmxlbmd0aCA8PSA1KSB7CisgICAgICAgICAgICAgICAgICAgIFN0cmluZyBic3NpZCA9IHJlc3VsdFswXTsKKyAgICAgICAgICAgICAgICAgICAgLy8gYnNzaWQgfCBmcmVxdWVuY3kgfCBsZXZlbCB8IGZsYWdzIHwgc3NpZAorICAgICAgICAgICAgICAgICAgICBpbnQgZnJlcXVlbmN5OworICAgICAgICAgICAgICAgICAgICBpbnQgbGV2ZWw7CisgICAgICAgICAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgICAgICAgICBmcmVxdWVuY3kgPSBJbnRlZ2VyLnBhcnNlSW50KHJlc3VsdFsxXSk7CisgICAgICAgICAgICAgICAgICAgICAgICBsZXZlbCA9IEludGVnZXIucGFyc2VJbnQocmVzdWx0WzJdKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIC8qIHNvbWUgaW1wbGVtZW50YXRpb25zIGF2b2lkIG5lZ2F0aXZlIHZhbHVlcyBieSBhZGRpbmcgMjU2CisgICAgICAgICAgICAgICAgICAgICAgICAgKiBzbyB3ZSBuZWVkIHRvIGFkanVzdCBmb3IgdGhhdCBoZXJlLgorICAgICAgICAgICAgICAgICAgICAgICAgICovCisgICAgICAgICAgICAgICAgICAgICAgICBpZiAobGV2ZWwgPiAwKSBsZXZlbCAtPSAyNTY7CisgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKE51bWJlckZvcm1hdEV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBmcmVxdWVuY3kgPSAwOworICAgICAgICAgICAgICAgICAgICAgICAgbGV2ZWwgPSAwOworICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgICAgLyoKKyAgICAgICAgICAgICAgICAgICAgICogVGhlIGZvcm1hdHRpbmcgb2YgdGhlIHJlc3VsdHMgcmV0dXJuZWQgYnkKKyAgICAgICAgICAgICAgICAgICAgICogd3BhX3N1cHBsaWNhbnQgaXMgaW50ZW5kZWQgdG8gbWFrZSB0aGUgZmllbGRzCisgICAgICAgICAgICAgICAgICAgICAqIGxpbmUgdXAgbmljZWx5IHdoZW4gcHJpbnRlZCwKKyAgICAgICAgICAgICAgICAgICAgICogbm90IHRvIG1ha2UgdGhlbSBlYXN5IHRvIHBhcnNlLiBTbyB3ZSBoYXZlIHRvCisgICAgICAgICAgICAgICAgICAgICAqIGFwcGx5IHNvbWUgaGV1cmlzdGljcyB0byBmaWd1cmUgb3V0IHdoaWNoIGZpZWxkCisgICAgICAgICAgICAgICAgICAgICAqIGlzIHRoZSBTU0lEIGFuZCB3aGljaCBmaWVsZCBpcyB0aGUgZmxhZ3MuCisgICAgICAgICAgICAgICAgICAgICAqLworICAgICAgICAgICAgICAgICAgICBTdHJpbmcgc3NpZDsKKyAgICAgICAgICAgICAgICAgICAgU3RyaW5nIGZsYWdzOworICAgICAgICAgICAgICAgICAgICBpZiAocmVzdWx0Lmxlbmd0aCA9PSA0KSB7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAocmVzdWx0WzNdLmNoYXJBdCgwKSA9PSAnWycpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbGFncyA9IHJlc3VsdFszXTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBzc2lkID0gIiI7CisgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsYWdzID0gIiI7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3NpZCA9IHJlc3VsdFszXTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChyZXN1bHQubGVuZ3RoID09IDUpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGZsYWdzID0gcmVzdWx0WzNdOworICAgICAgICAgICAgICAgICAgICAgICAgc3NpZCA9IHJlc3VsdFs0XTsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIEhlcmUsIHdlIG11c3QgaGF2ZSAzIGZpZWxkczogbm8gZmxhZ3MgYW5kIHNzaWQKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIHNldAorICAgICAgICAgICAgICAgICAgICAgICAgZmxhZ3MgPSAiIjsKKyAgICAgICAgICAgICAgICAgICAgICAgIHNzaWQgPSAiIjsKKyAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgIC8vIGJzc2lkICsgc3NpZCBpcyB0aGUgaGFzaCBrZXkKKyAgICAgICAgICAgICAgICAgICAgU3RyaW5nIGtleSA9IGJzc2lkICsgc3NpZDsKKyAgICAgICAgICAgICAgICAgICAgc2NhblJlc3VsdCA9IG1TY2FuUmVzdWx0Q2FjaGUuZ2V0KGtleSk7CisgICAgICAgICAgICAgICAgICAgIGlmIChzY2FuUmVzdWx0ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHNjYW5SZXN1bHQubGV2ZWwgPSBsZXZlbDsKKyAgICAgICAgICAgICAgICAgICAgICAgIHNjYW5SZXN1bHQuU1NJRCA9IHNzaWQ7CisgICAgICAgICAgICAgICAgICAgICAgICBzY2FuUmVzdWx0LmNhcGFiaWxpdGllcyA9IGZsYWdzOworICAgICAgICAgICAgICAgICAgICAgICAgc2NhblJlc3VsdC5mcmVxdWVuY3kgPSBmcmVxdWVuY3k7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICAvLyBEbyBub3QgYWRkIHNjYW4gcmVzdWx0cyB0aGF0IGhhdmUgbm8gU1NJRCBzZXQKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwIDwgc3NpZC50cmltKCkubGVuZ3RoKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY2FuUmVzdWx0ID0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV3IFNjYW5SZXN1bHQoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzc2lkLCBic3NpZCwgZmxhZ3MsIGxldmVsLCBmcmVxdWVuY3kpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1TY2FuUmVzdWx0Q2FjaGUucHV0KGtleSwgc2NhblJlc3VsdCk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICBMb2cudyhUQUcsICJNaXNmb3JtYXR0ZWQgc2NhbiByZXN1bHQgdGV4dCB3aXRoICIgKworICAgICAgICAgICAgICAgICAgICAgICAgICByZXN1bHQubGVuZ3RoICsgIiBmaWVsZHM6ICIgKyBsaW5lKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gc2NhblJlc3VsdDsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBzY2FuUmVzdWx0cyBpbnB1dCBmb3JtYXQKKyAgICAgKiAwMDpiYjpjYzpkZDpjYzplZSAgICAgICAyNDI3ICAgIDE2NiAgICAgW1dQQS1FQVAtVEtJUF1bV1BBMi1FQVAtQ0NNUF0gICBOZXQxCisgICAgICogMDA6YmI6Y2M6ZGQ6Y2M6ZmYgICAgICAgMjQxMiAgICAxNjUgICAgIFtXUEEtRUFQLVRLSVBdW1dQQTItRUFQLUNDTVBdICAgTmV0MgorICAgICAqLworICAgIHByaXZhdGUgdm9pZCBzZXRTY2FuUmVzdWx0cyhTdHJpbmcgc2NhblJlc3VsdHMpIHsKKyAgICAgICAgaWYgKHNjYW5SZXN1bHRzID09IG51bGwpIHsKKyAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfQorCisgICAgICAgIExpc3Q8U2NhblJlc3VsdD4gc2Nhbkxpc3QgPSBuZXcgQXJyYXlMaXN0PFNjYW5SZXN1bHQ+KCk7CisKKyAgICAgICAgaW50IGxpbmVDb3VudCA9IDA7CisKKyAgICAgICAgaW50IHNjYW5SZXN1bHRzTGVuID0gc2NhblJlc3VsdHMubGVuZ3RoKCk7CisgICAgICAgIC8vIFBhcnNlIHRoZSByZXN1bHQgc3RyaW5nLCBrZWVwaW5nIGluIG1pbmQgdGhhdCB0aGUgbGFzdCBsaW5lIGRvZXMKKyAgICAgICAgLy8gbm90IGVuZCB3aXRoIGEgbmV3bGluZS4KKyAgICAgICAgZm9yIChpbnQgbGluZUJlZyA9IDAsIGxpbmVFbmQgPSAwOyBsaW5lRW5kIDw9IHNjYW5SZXN1bHRzTGVuOyArK2xpbmVFbmQpIHsKKyAgICAgICAgICAgIGlmIChsaW5lRW5kID09IHNjYW5SZXN1bHRzTGVuIHx8IHNjYW5SZXN1bHRzLmNoYXJBdChsaW5lRW5kKSA9PSAnXG4nKSB7CisgICAgICAgICAgICAgICAgKytsaW5lQ291bnQ7CisKKyAgICAgICAgICAgICAgICBpZiAobGluZUNvdW50ID09IDEpIHsKKyAgICAgICAgICAgICAgICAgICAgbGluZUJlZyA9IGxpbmVFbmQgKyAxOworICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaWYgKGxpbmVFbmQgPiBsaW5lQmVnKSB7CisgICAgICAgICAgICAgICAgICAgIFN0cmluZyBsaW5lID0gc2NhblJlc3VsdHMuc3Vic3RyaW5nKGxpbmVCZWcsIGxpbmVFbmQpOworICAgICAgICAgICAgICAgICAgICBTY2FuUmVzdWx0IHNjYW5SZXN1bHQgPSBwYXJzZVNjYW5SZXN1bHQobGluZSk7CisgICAgICAgICAgICAgICAgICAgIGlmIChzY2FuUmVzdWx0ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHNjYW5MaXN0LmFkZChzY2FuUmVzdWx0KTsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIExvZy53KFRBRywgIm1pc2Zvcm1hdHRlZCBzY2FuIHJlc3VsdCBmb3I6ICIgKyBsaW5lKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBsaW5lQmVnID0gbGluZUVuZCArIDE7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBtU2NhblJlc3VsdHMgPSBzY2FuTGlzdDsKKyAgICB9CisKKyAgICBwcml2YXRlIFN0cmluZyBmZXRjaFNTSUQoKSB7CisgICAgICAgIFN0cmluZyBzdGF0dXMgPSBXaWZpTmF0aXZlLnN0YXR1c0NvbW1hbmQoKTsKKyAgICAgICAgaWYgKHN0YXR1cyA9PSBudWxsKSB7CisgICAgICAgICAgICByZXR1cm4gbnVsbDsKKyAgICAgICAgfQorICAgICAgICAvLyBleHRyYWN0IHNzaWQgZnJvbSBhIHNlcmllcyBvZiAibmFtZT12YWx1ZSIKKyAgICAgICAgU3RyaW5nW10gbGluZXMgPSBzdGF0dXMuc3BsaXQoIlxuIik7CisgICAgICAgIGZvciAoU3RyaW5nIGxpbmUgOiBsaW5lcykgeworICAgICAgICAgICAgU3RyaW5nW10gcHJvcCA9IGxpbmUuc3BsaXQoIiAqPSAqIik7CisgICAgICAgICAgICBpZiAocHJvcC5sZW5ndGggPCAyKSBjb250aW51ZTsKKyAgICAgICAgICAgIFN0cmluZyBuYW1lID0gcHJvcFswXTsKKyAgICAgICAgICAgIFN0cmluZyB2YWx1ZSA9IHByb3BbMV07CisgICAgICAgICAgICBpZiAobmFtZS5lcXVhbHNJZ25vcmVDYXNlKCJzc2lkIikpIHJldHVybiB2YWx1ZTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gbnVsbDsKKyAgICB9CisKKyAgICBwcml2YXRlIHZvaWQgY29uZmlndXJlTmV0d29ya1Byb3BlcnRpZXMoKSB7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBtTmV0d29ya1Byb3BlcnRpZXMuc2V0SW50ZXJmYWNlKE5ldHdvcmtJbnRlcmZhY2UuZ2V0QnlOYW1lKG1JbnRlcmZhY2VOYW1lKSk7CisgICAgICAgIH0gY2F0Y2ggKFNvY2tldEV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICBMb2cuZShUQUcsICJTb2NrZXRFeGNlcHRpb24gY3JlYXRpbmcgTmV0d29ya0ludGVyZmFjZSBmcm9tICIgKyBtSW50ZXJmYWNlTmFtZSArCisgICAgICAgICAgICAgICAgICAgICIuIGU9IiArIGUpOworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9IGNhdGNoIChOdWxsUG9pbnRlckV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICBMb2cuZShUQUcsICJOUEUgY3JlYXRpbmcgTmV0d29ya0ludGVyZmFjZS4gZT0iICsgZSk7CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKyAgICAgICAgLy8gVE9ETyAtIGZpeCB0aGlzIGZvciB2NgorICAgICAgICB0cnkgeworICAgICAgICAgICAgbU5ldHdvcmtQcm9wZXJ0aWVzLmFkZEFkZHJlc3MoSW5ldEFkZHJlc3MuZ2V0QnlBZGRyZXNzKAorICAgICAgICAgICAgICAgICAgICBOZXR3b3JrVXRpbHMudjRJbnRUb0FycmF5KG1EaGNwSW5mby5pcEFkZHJlc3MpKSk7CisgICAgICAgIH0gY2F0Y2ggKFVua25vd25Ib3N0RXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgIExvZy5lKFRBRywgIkV4Y2VwdGlvbiBzZXR0aW5nIElwQWRkcmVzcyB1c2luZyAiICsgbURoY3BJbmZvICsgIiwgZT0iICsgZSk7CisgICAgICAgIH0KKworICAgICAgICB0cnkgeworICAgICAgICAgICAgbU5ldHdvcmtQcm9wZXJ0aWVzLnNldEdhdGV3YXkoSW5ldEFkZHJlc3MuZ2V0QnlBZGRyZXNzKE5ldHdvcmtVdGlscy52NEludFRvQXJyYXkoCisgICAgICAgICAgICAgICAgICAgIG1EaGNwSW5mby5nYXRld2F5KSkpOworICAgICAgICB9IGNhdGNoIChVbmtub3duSG9zdEV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICBMb2cuZShUQUcsICJFeGNlcHRpb24gc2V0dGluZyBHYXRld2F5IHVzaW5nICIgKyBtRGhjcEluZm8gKyAiLCBlPSIgKyBlKTsKKyAgICAgICAgfQorCisgICAgICA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KSB7CisgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgfQorICAgICAgICB9IGNhdGNoIChTZXR0aW5ncy5TZXR0aW5nTm90Rm91bmRFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIFN0cmluZyBhZGRyID0gU2V0dGluZ3MuU3lzdGVtLmdldFN0cmluZyhjciwgU2V0dGluZ3MuU3lzdGVtLldJRklfU1RBVElDX0lQKTsKKyAgICAgICAgICAgIGlmIChhZGRyICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBtRGhjcEluZm8uaXBBZGRyZXNzID0gc3RyaW5nVG9JcEFkZHIoYWRkcik7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGFkZHIgPSBTZXR0aW5ncy5TeXN0ZW0uZ2V0U3RyaW5nKGNyLCBTZXR0aW5ncy5TeXN0ZW0uV0lGSV9TVEFUSUNfR0FURVdBWSk7CisgICAgICAgICAgICBpZiAoYWRkciAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgbURoY3BJbmZvLmdhdGV3YXkgPSBzdHJpbmdUb0lwQWRkcihhZGRyKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgfQorICAgICAgICAgICAgYWRkciA9IFNldHRpbmdzLlN5c3RlbS5nZXRTdHJpbmcoY3IsIFNldHRpbmdzLlN5c3RlbS5XSUZJX1NUQVRJQ19ORVRNQVNLKTsKKyAgICAgICAgICAgIGlmIChhZGRyICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBtRGhjcEluZm8ubmV0bWFzayA9IHN0cmluZ1RvSXBBZGRyKGFkZHIpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgICAgICB9CisgICAgICAgICAgICBhZGRyID0gU2V0dGluZ3MuU3lzdGVtLmdldFN0cmluZyhjciwgU2V0dGluZ3MuU3lzdGVtLldJRklfU1RBVElDX0ROUzEpOworICAgICAgICAgICAgaWYgKGFkZHIgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIG1EaGNwSW5mby5kbnMxID0gc3RyaW5nVG9JcEFkZHIoYWRkcik7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGFkZHIgPSBTZXR0aW5ncy5TeXN0ZW0uZ2V0U3RyaW5nKGNyLCBTZXR0aW5ncy5TeXN0ZW0uV0lGSV9TVEFUSUNfRE5TMik7CisgICAgICAgICAgICBpZiAoYWRkciAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgbURoY3BJbmZvLmRuczIgPSBzdHJpbmdUb0lwQWRkcihhZGRyKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgbURoY3BJbmZvLmRuczIgPSAwOworICAgICAgICAgICAgfQorICAgICAgICB9IGNhdGNoIChVbmtub3duSG9zdEV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKyAgICAgICAgbVVzZVN0YXRpY0lwID0gdHJ1ZTsKKyAgICB9CisKKyAgICBwcml2YXRlIHN0YXRpYyBpbnQgc3RyaW5nVG9JcEFkZHIoU3RyaW5nIGFkZHJTdHJpbmcpIHRocm93cyBVbmtub3duSG9zdEV4Y2VwdGlvbiB7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBTdHJpbmdbXSBwYXJ0cyA9IGFkZHJTdHJpbmcuc3BsaXQoIlxcLiIpOworICAgICAgICAgICAgaWYgKHBhcnRzLmxlbmd0aCAhPSA0KSB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFVua25vd25Ib3N0RXhjZXB0aW9uKGFkZHJTdHJpbmcpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpbnQgYSA9IEludGVnZXIucGFyc2VJbnQocGFydHNbMF0pICAgICAgOworICAgICAgICAgICAgaW50IGIgPSBJbnRlZ2VyLnBhcnNlSW50KHBhcnRzWzFdKSA8PCAgODsKKyAgICAgICAgICAgIGludCBjID0gSW50ZWdlci5wYXJzZUludChwYXJ0c1syXSkgPDwgMTY7CisgICAgICAgICAgICBpbnQgZCA9IEludGVnZXIucGFyc2VJbnQocGFydHNbM10pIDw8IDI0OworCisgICAgICAgICAgICByZXR1cm4gYSB8IGIgfCBjIHwgZDsKKyAgICAgICAgfSBjYXRjaCAoTnVtYmVyRm9ybWF0RXhjZXB0aW9uIGV4KSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgVW5rbm93bkhvc3RFeGNlcHRpb24oYWRkclN0cmluZyk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcml2YXRlIGludCBnZXRNYXhEaGNwUmV0cmllcygpIHsKKyAgICAgICAgcmV0dXJuIFNldHRpbmdzLlNlY3VyZS5nZXRJbnQobUNvbnRleHQuZ2V0Q29udGVudFJlc29sdmVyKCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNldHRpbmdzLlNlY3VyZS5XSUZJX01BWF9ESENQX1JFVFJZX0NPVU5ULAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBERUZBVUxUX01BWF9ESENQX1JFVFJJRVMpOworICAgIH0KKworICAgIHByaXZhdGUgY2xhc3MgU2V0dGluZ3NPYnNlcnZlciBleHRlbmRzIENvbnRlbnRPYnNlcnZlciB7CisgICAgICAgIHB1YmxpYyBTZXR0aW5nc09ic2VydmVyKEhhbmRsZXIgaGFuZGxlcikgeworICAgICAgICAgICAgc3VwZXIoaGFuZGxlcik7CisgICAgICAgICAgICBDb250ZW50UmVzb2x2ZXIgY3IgPSBtQ29udGV4dC5nZXRDb250ZW50UmVzb2x2ZXIoKTsKKyAgICAgICAgICAgIG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m9pZCBvbkNoYW5nZShib29sZWFuIHNlbGZDaGFuZ2UpIHsKKyAgICAgICAgICAgIHN1cGVyLm9uQ2hhbmdlKHNlbGZDaGFuZ2UpOworCisgICAgICAgICAgICBib29sZWFuIHdhc1N0YXRpY0lwID0gbVVzZVN0YXRpY0lwOworICAgICAgICAgICAgaW50IG9JcCwgb0d3LCBvTXNrLCBvRG5zMSwgb0RuczI7CisgICAgICAgICAgICBvSXAgPSBvR3cgPSBvTXNrID0gb0RuczEgPSBvRG5zMiA9IDA7CisgICAgICAgICAgICBpZiAod2FzU3RhdGljSXApIHsKKyAgICAgICAgICAgICAgICBvSXAgPSBtRGhjcEluZm8uaXBBZGRyZXNzOworICAgICAgICAgICAgICAgIG9HdyA9IG1EaGNwSW5mby5nYXRld2F5OworICAgICAgICAgICAgICAgIG9Nc2sgPSBtRGhjcEluZm8ubmV0bWFzazsKKyAgICAgICAgICAgICAgICBvRG5zMSA9IG1EaGNwSW5mby5kbnMxOworICAgICAgICAgICAgICAgIG9EbnMyID0gbURoY3BJbmZvLmRuczI7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjaGVja1VzZVN0YXRpY0lwKCk7CisKKyAgICAgICAgICAgIGlmIChtV2lmaUluZm8uZ2V0U3VwcGxpY2FudFN0YXRlKCkgPT0gU3VwcGxpY2FudFN0YXRlLlVOSU5JVElBTElaRUQpIHsKKyAgICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGJvb2xlYW4gY2hhbmdlZCA9CisgICAgICAgICAgICAgICAgKHdhc1N0YXRpY0lwICE9IG1Vc2VTdGF0aWNJcCkgfHwKKyAgICAgICAgICAgICAgICAgICAgKHdhc1N0YXRpY0lwICYmICgKKyAgICAgICAgICAgICAgICAgICAgICAgIG9JcCAgICE9IG1EaGNwSW5mby5pcEFkZHJlc3MgfHwKKyAgICAgICAgICAgICAgICAgICAgICAgIG9HdyAgICE9IG1EaGNwSW5mby5nYXRld2F5IHx8CisgICAgICAgICAgICAgICAgICAgICAgICBvTXNrICAhPSBtRGhjcEluZm8ubmV0bWFzayB8fAorICAgICAgICAgICAgICAgICAgICAgICAgb0RuczEgIT0gbURoY3BJbmZvLmRuczEgfHwKKyAgICAgICAgICAgICAgICAgICAgICAgIG9EbnMyICE9IG1EaGNwSW5mby5kbnMyKSk7CisKKyAgICAgICAgICAgIGlmIChjaGFuZ2VkKSB7CisgICAgICAgICAgICAgICAgc2VuZE1lc3NhZ2UoQ01EX1JFQ09ORklHVVJFX0lQKTsKKyAgICAgICAgICAgICAgICBtQ29uZmlnQ2hhbmdlZCA9IHRydWU7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBXaGV0aGVyIHRvIGRpc2FibGUgY29leGlzdGVuY2UgbW9kZSB3aGlsZSBvYnRhaW5pbmcgSVAgYWRkcmVzcy4gVGhpcworICAgICAqIGxvZ2ljIHdpbGwgcmV0dXJuIHRydWUgb25seSBpZiB0aGUgY3VycmVudCBibHVldG9vdGgKKyAgICAgKiBoZWFkc2V0L2hhbmRzZnJlZSBzdGF0ZSBpcyBkaXNjb25uZWN0ZWQuIFRoaXMgbWVhbnMgaWYgaXQgaXMgaW4gYW4KKyAgICAgKiBlcnJvciBzdGF0ZSwgd2Ugd2lsbCBOT1QgZGlzYWJsZSBjb2V4aXN0ZW5jZSBtb2RlIHRvIGVyciBvbiB0aGUgc2lkZQorICAgICAqIG9mIHNhZmV0eS4KKyAgICAgKgorICAgICAqIEByZXR1cm4gV2hldGhlciB0byBkaXNhYmxlIGNvZXhpc3RlbmNlIG1vZGUuCisgICAgICovCisgICAgcHJpdmF0ZSBib29sZWFuIHNob3VsZERpc2FibGVDb2V4aXN0ZW5jZU1vZGUoKSB7CisgICAgICAgIGludCBzdGF0ZSA9IG1CbHVldG9vdGhIZWFkc2V0LmdldFN0YXRlKG1CbHVldG9vdGhIZWFkc2V0LmdldEN1cnJlbnRIZWFkc2V0KCkpOworIC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BzZXQubmV4dFNldEJpdChuZXh0U2V0Qml0ICsgMSkpICE9IC0xKSB7CisgICAgICAgICAgICBidWYuYXBwZW5kKHN0cmluZ3NbbmV4dFNldEJpdF0ucmVwbGFjZSgnXycsICctJykpLmFwcGVuZCgnICcpOworICAgICAgICB9CisKKyAgICAgICAgLy8gcmVtb3ZlIHRyYWlsaW5nIHNwYWNlCisgICAgICAgIGlmIChzZXQuY2FyZGluYWxpdHkoKSA+IDApIHsKKyAgICAgICAgICAgIGJ1Zi5zZXRMZW5ndGgoYnVmLmxlbmd0aCgpIC0gMSk7CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gYnVmLnRvU3RyaW5nKCk7CisgICAgfQorCisgICAgcHJpdmF0ZSBzdGF0aWMgaW50IGxvb2t1cFN0cmluZyhTdHJpbmcgc3RyaW5nLCBTdHJpbmdbXSBzdHJpbmdzKSB7CisgICAgICAgIGludCBzaXplID0gc3RyaW5ncy5sZW5ndGg7CisKKyAgICAgICAgc3RyaW5nID0gc3RyaW5nLnJlcGxhY2UoJy0nLCAnXycpOworCisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgc2l6ZTsgaSsrKQorICAgICAgICAgICAgaWYgKHN0cmluZy5lcXVhbHMoc3RyaW5nc1tpXSkpCisgICAgICAgICAgICAgICAgcmV0dXJuIGk7CisKKyAgICAgICAgLy8gaWYgd2UgZXZlciBnZXQgaGVyZSwgd2Ugc2hvdWxkIHByb2JhYmx5IGFkZCB0aGUKKyAgICAgICAgLy8gdmFsdWUgdG8gV2lmaUNvbmZpZ3VyYXRpb24gdG8gcmVmbGVjdCB0aGF0IGl0J3MKKyAgICAgICAgLy8gc3VwcG9ydGVkIGJ5IHRoZSBXUEEgc3VwcGxpY2FudAorICAgICAgICBMb2cudyhUQUcsICJGYWlsZWQgdG8gbG9vay11cCBhIHN0cmluZzogIiArIHN0cmluZyk7CisKKyAgICAgICAgcmV0dXJuIC0xOworICAgIH0KKworICAgIHByaXZhdGUgdm9pZCBlbmFibGVBbGxOZXR3b3JrcygpIHsKKyAgICAgICAgaWYgKG1FbmFibGVBbGxOZXR3b3JrcykgeworICAgICAgICAgICAgbUVuYWJsZUFsbE5ldHdvcmtzID0gZmFsc2U7CisgICAgICAgICAgICBMaXN0PFdpZmlDb25maWd1cmF0aW9uPiBjb25maWdMaXN0ID0gZ2V0Q29uZmlndXJlZE5ldHdvcmtzTmF0aXZlKCk7CisgICAgICAgICAgICBmb3IgKFdpZmlDb25maWd1cmF0aW9uIGNvbmZpZyA6IGNvbmZpZ0xpc3QpIHsKKyAgICAgICAgICAgICAgICBpZihjb25maWcgIT0gbnVsbCAmJiBjb25maWcuc3RhdHVzID09IFN0YXR1cy5ESVNBQkxFRCkgeworICAgICAgICAgICAgICAgICAgICBXaWZpTmF0aXZlLmVuYWJsZU5ldHdvcmtDb21tYW5kKGNvbmZpZy5uZXR3b3JrSWQsIGZhbHNlKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBXaWZpTmF0aXZlLnNhdmVDb25maWdDb21tYW5kKCk7CisgICAgICAgICAgICBzZW5kU3VwcGxpY2FudENvbmZpZ0NoYW5nZWRCcm9hZGNhc3QoKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgaW50IGFkZE9yVXBkYXRlTmV0d29ya05hdGl2ZShXaWZpQ29uZmlndXJhdGlvbiBjb25maWcpIHsKKyAgICAgICAgLyoKKyAgICAgICAgICogSWYgdGhlIHN1cHBsaWVkIG5ldHdvcmtJZCBpcyAtMSwgd2UgY3JlYXRlIGEgbmV3IGVtcHR5CisgICAgICAgICAqIG5ldHdvcmsgY29uZmlndXJhdGlvbi4gT3RoZXJ3aXNlLCB0aGUgbmV0d29ya0lkIHNob3VsZAorICAgICAgICAgKiByZWZlciB0byBhbiBleGlzdGluZyBjb25maWd1cmF0aW9uLgorICAgICAgICAgKi8KKyAgICAgICAgaW50IG5ldElkID0gY29uZmlnLm5ldHdvcmtJZDsKKyAgICAgICAgYm9vbGVhbiBuZXdOZXR3b3JrID0gbmV0SWQgPT0gLTE7CisgICAgICAgIC8vIG5ldHdvcmtJZCBvZiAtMSBtZWFucyB3ZSB3YW50IHRvIGNyZWF0ZSBhIG5ldyBuZXR3b3JrCisKKyAgICAgICAgaWYgKG5ld05ldHdvcmspIHsKKyAgICAgICAgICAgIG5ldElkID0gV2lmaU5hdGl2ZS5hZGROZXR3b3JrQ29tbWFuZCgpOworICAgICAgICAgICAgaWYgKG5ldElkIDwgMCkgeworICAgICAgICAgICAgICAgIExvZy5lKFRBRywgIkZhaWxlZCB0byBhZGQgYSBuZXR3b3JrISIpOworICAgICAgICAgICAgICAgIHJldHVybiAtMTsKKyAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBzZXRWYXJpYWJsZXM6IHsKKworICAgICAgICAgICAgaWYgKGNvbmZpZy5TU0lEICE9IG51bGwgJiYKKyAgICAgICAgICAgICAgICAgICAgIVdpZmlOYXRpdmUuc2V0TmV0d29ya1ZhcmlhYmxlQ29tbWFuZCgKKyAgICAgICAgICAgICAgICAgICAgICAgIG5ldElkLAorICAgICAgICAgICAgICAgICAgICAgICAgV2lmaUNvbmZpZ3VyYXRpb24uc3NpZFZhck5hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICBjb25maWcuU1NJRCkpIHsKKyAgICAgICAgICAgICAgICBMb2cuZChUQUcsICJmYWlsZWQgdG8gc2V0IFNTSUQ6ICIrY29uZmlnLlNTSUQpOworICAgICAgICAgICAgICAgIGJyZWFrIHNldFZhcmlhYmxlczsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKGNvbmZpZy5CU1NJRCAhPSBudWxsICYmCisgICAgICAgICAgICAgICAgICAgICFXaWZpTmF0aXZlLnNldE5ldHdvcmtWYXJpYWJsZUNvbW1hbmQoCisgICAgICAgICAgICAgICAgICAgICAgICBuZXRJZCwKKyAgICAgICAgICAgICAgICAgICAgICAgIFdpZmlDb25maWd1cmF0aW9uLmJzc2lkVmFyTmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZy5CU1NJRCkpIHsKKyAgICAgICAgICAgICAgICBMb2cuZChUQUcsICJmYWlsZWQgdG8gc2V0IEJTU0lEOiAiK2NvbmZpZy5CU1NJRCk7CisgICAgICAgICAgICAgICAgYnJlYWsgc2V0VmFyaWFibGVzOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBTdHJpbmcgYWxsb3dlZEtleU1hbmFnZW1lbnRTdHJpbmcgPQorICAgICAgICAgICAgICAgIG1ha2VTdHJpbmcoY29uZmlnLmFsbG93ZWRLZXlNYW5hZ2VtZW50LCBXaWZpQ29uZmlndXJhdGlvbi5LZXlNZ210LnN0cmluZ3MpOworICAgICAgICAgICAgaWYgKGNvbmZpZy5hbGxvd2VkS2V5TWFuYWdlbWVudC5jYXJkaW5hbGl0eSgpICE9IDAgJiYKKyAgICAgICAgICAgICAgICAgICAgIVdpZmlOYXRpdmUuc2V0TmV0d29ya1ZhcmlhYmxlQ29tbWFuZCgKKyAgICAgICAgICAgICAgICAgICAgICAgIG5ldElkLAorICAgICAgICAgICAgICAgICAgICAgICAgV2lmaUNvbmZpZ3VyYXRpb24uS2V5TWdtdC52YXJOYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgYWxsb3dlZEtleU1hbmFnZW1lbnRTdHJpbmcpKSB7CisgICAgICAgICAgICAgICAgTG9nLmQoVEFHLCAiZmFpbGVkIHRvIHNldCBrZXlfbWdtdDogIisKKyAgICAgICAgICAgICAgICAgICAgICAgIGFsbG93ZWRLZXlNYW5hZ2VtZW50U3RyaW5nKTsKKyAgICAgICAgICAgICAgICBicmVhayBzZXRWYXJpYWJsZXM7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIFN0cmluZyBhbGxvd2VkUHJvdG9jb2xzU3RyaW5nID0KKyAgICAgICAgICAgICAgICBtYWtlU3RyaW5nKGNvbmZpZy5hbGxvd2VkUHJvdG9jb2xzLCBXaWZpQ29uZmlndXJhdGlvbi5Qcm90b2NvbC5zdHJpbmdzKTsKKyAgICAgICAgICAgIGlmIChjb25maWcuYWxsb3dlZFByb3RvY29scy5jYXJkaW5hbGl0eSgpICE9IDAgJiYKKyAgICAgICAgICAgICAgICAgICAgIVdpZmlOYXRpdmUuc2V0TmV0d29ya1ZhcmlhYmxlQ29tbWFuZCgKKyAgICAgICAgICAgICAgICAgICAgICAgIG5ldElkLAorICAgICAgICAgICAgICAgICAgICAgICAgV2lmaUNvbmZpZ3VyYXRpb24uUHJvdG9jb2wudmFyTmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgIGFsbG93ZWRQcm90b2NvbHNTdHJpbmcpKSB7CisgICAgICAgICAgICAgICAgTG9nLmQoVEFHLCAiZmFpbGVkIHRvIHNldCBwcm90bzogIisKKyAgICAgICAgICAgICAgICAgICAgICAgIGFsbG93ZWRQcm90b2NvbHNTdHJpbmcpOworICAgICAgICAgICAgICAgIGJyZWFrIHNldFZhcmlhYmxlczsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgU3RyaW5nIGFsbG93ZWRBdXRoQWxnb3JpdGhtc1N0cmluZyA9CisgICAgICAgICAgICAgICAgbWFrZVN0cmluZyhjb25maWcuYWxsb3dlZEF1dGhBbGdvcml0aG1zLCBXaWZpQ29uZmlndXJhdGlvbi5BdXRoQWxnb3JpdGhtLnN0cmluZ3MpOworICAgICAgICAgICAgaWYgKGNvbmZpZy5hbGxvd2VkQXV0aEFsZ29yaXRobXMuY2FyZGluYWxpdHkoKSAhPSAwICYmCisgICAgICAgICAgICAgICAgICAgICFXaWZpTmF0aXZlLnNldE5ldHdvcmtWYXJpYWJsZUNvbW1hbmQoCisgICAgICAgICAgICAgICAgICAgICAgICBuZXRJZCwKKyAgICAgICAgICAgICAgICAgICAgICAgIFdpZmlDb25maWd1cmF0aW9uLkF1dGhBbGdvcml0aG0udmFyTmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgIGFsbG93ZWRBdXRoQWxnb3JpdGhtc1N0cmluZykpIHsKKyAgICAgICAgICAgICAgICBMb2cuZChUQUcsICJmYWlsZWQgdG8gc2V0IGF1dGhfYWxnOiAiKworICAgICAgICAgICAgICAgICAgICAgICAgYWxsb3dlZEF1dGhBbGdvcml0aG1zU3RyaW5nKTsKKyAgICAgICAgICAgICAgICBicmVhayBzZXRWYXJpYWJsZXM7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIFN0cmluZyBhbGxvd2VkUGFpcndpc2VDaXBoZXJzU3RyaW5nID0KKyAgICAgICAgICAgICAgICAgICAgbWFrZVN0cmluZyhjb25maWcuYWxsb3dlZFBhaXJ3aXNlQ2lwaGVycywKKyAgICAgICAgICAgICAgICAgICAgV2lmaUNvbmZpZ3VyYXRpb24uUGFpcndpc2VDaXBoZXIuc3RyaW5ncyk7CisgICAgICAgICAgICBpZiAoY29uZmlnLmFsbG93ZWRQYWlyd2lzZUNpcGhlcnMuY2FyZGluYWxpdHkoKSAhPSAwICYmCisgICAgICAgICAgICAgICAgICAgICFXaWZpTmF0aXZlLnNldE5ldHdvcmtWYXJpYWJsZUNvbW1hbmQoCisgICAgICAgICAgICAgICAgICAgICAgICBuZXRJZCwKKyAgICAgICAgICAgICAgICAgICAgICAgIFdpZmlDb25maWd1cmF0aW9uLlBhaXJ3aXNlQ2lwaGVyLnZhck5hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICBhbGxvd2VkUGFpcndpc2VDaXBoZXJzU3RyaW5nKSkgeworICAgICAgICAgICAgICAgIExvZy5kKFRBRywgImZhaWxlZCB0byBzZXQgcGFpcndpc2U6ICIrCisgICAgICAgICAgICAgICAgICAgICAgICBhbGxvd2VkUGFpcndpc2VDaXBoZXJzU3RyaW5nKTsKKyAgICAgICAgICAgICAgICBicmVhayBzZXRWYXJpYWJsZXM7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIFN0cmluZyBhbGxvd2VkR3JvdXBDaXBoZXJzU3RyaW5nID0KKyAgICAgICAgICAgICAgICBtYWtlU3RyaW5nKGNvbmZpZy5hbGxvd2VkR3JvdXBDaXBoZXJzLCBXaWZpQ29uZmlndXJhdGlvbi5Hcm91cENpcGhlci5zdHJpbmdzKTsKKyAgICAgICAgICAgIGlmIChjb25maWcuYWxsb3dlZEdyb3VwQ2lwaGVycy5jYXJkaW5hbGl0eSgpICE9IDAgJiYKKyAgICAgICAgICAgICAgICAgICAgIVdpZmlOYXRpdmUuc2V0TmV0d29ya1ZhcmlhYmxlQ29tbWFuZCgKKyAgICAgICAgICAgICAgICAgICAgICAgIG5ldElkLAorICAgICAgICAgICAgICAgICAgICAgICAgV2lmaUNvbmZpZ3VyYXRpb24uR3JvdXBDaXBoZXIudmFyTmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgIGFsbG93ZWRHcm91cENpcGhlcnNTdHJpbmcpKSB7CisgICAgICAgICAgICAgICAgTG9nLmQoVEFHLCAiZmFpbGVkIHRvIHNldCBncm91cDogIisKKyAgICAgICAgICAgICAgICAgICAgICAgIGFsbG93ZWRHcm91cENpcGhlcnNTdHJpbmcpOworICAgICAgICAgICAgICAgIGJyZWFrIHNldFZhcmlhYmxlczsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgLy8gUHJldmVudCBjbGllbnQgc2NyZXctdXAgYnkgcGFzc2luZyBpbiBhIFdpZmlDb25maWd1cmF0aW9uIHdlIGdhdmUgaXQKKyAgICAgICAgICAgIC8vIGJ5IHByZXZlbnRpbmcgIioiIGFzIGEga2V5LgorICAgICAgICAgICAgaWYgKGNvbmZpZy5wcmVTaGFyZWRLZXkgIT0gbnVsbCAmJiAhY29uZmlnLnByZVNoYXJlZEtleS5lcXVhbHMoIioiKSAmJgorICAgICAgICAgICAgICAgICAgICAhV2lmaU5hdGl2ZS5zZXROZXR3b3JrVmFyaWFibGVDb21tYW5kKAorICAgICAgICAgICAgICAgICAgICAgICAgbmV0SWQsCisgICAgICAgICAgICAgICAgICAgICAgICBXaWZpQ29uZmlndXJhdGlvbi5wc2tWYXJOYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlnLnByZVNoYXJlZEtleSkpIHsKKyAgICAgICAgICAgICAgICBMb2cuZChUQUcsICJmYWlsZWQgdG8gc2V0IHBzazogIitjb25maWcucHJlU2hhcmVkS2V5KTsKKyAgICAgICAgICAgICAgICBicmVhayBzZXRWYXJpYWJsZXM7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGJvb2xlYW4gaGFzU2V0S2V5ID0gZmFsc2U7CisgICAgICAgICAgICBpZiAoY29uZmlnLndlcEtleXMgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgY29uZmlnLndlcEtleXMubGVuZ3RoOyBpKyspIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gUHJldmVudCBjbGllbnQgc2NyZXctdXAgYnkgcGFzc2luZyBpbiBhIFdpZmlDb25maWd1cmF0aW9uIHdlIGdhdmUgaXQKKyAgICAgICAgICAgICAgICAgICAgLy8gYnkgcHJldmVudGluZyAiKiIgYXMgYSBrZXkuCisgICAgICAgICAgICAgICAgICAgIGlmIChjb25maWcud2VwS2V5c1tpXSAhPSBudWxsICYmICFjb25maWcud2VwS2V5c1tpXS5lcXVhbHMoIioiKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFXaWZpTmF0aXZlLnNldE5ldHdvcmtWYXJpYWJsZUNvbW1hbmQoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXRJZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFdpZmlDb25maWd1cmF0aW9uLndlcEtleVZhck5hbWVzW2ldLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlnLndlcEtleXNbaV0pKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgTG9nLmQoVEFHLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImZhaWxlZCB0byBzZXQgd2VwX2tleSIraSsiOiAiICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZy53ZXBLZXlzW2ldKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayBzZXRWYXJpYWJsZXM7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBoYXNTZXRLZXkgPSB0cnVlOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpZiAoaGFzU2V0S2V5KSB7CisgICAgICAgICAgICAgICAgaWYgKCFXaWZpTmF0aXZlLnNldE5ldHdvcmtWYXJpYWJsZUNvbW1hbmQoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV0SWQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgV2lmaUNvbmZpZ3VyYXRpb24ud2VwVHhLZXlJZHhWYXJOYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIEludGVnZXIudG9TdHJpbmcoY29uZmlnLndlcFR4S2V5SW5kZXgpKSkgeworICAgICAgICAgICAgICAgICAgICBMb2cuZChUQUcsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgImZhaWxlZCB0byBzZXQgd2VwX3R4X2tleWlkeDogIisKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWcud2VwVHhLZXlJbmRleCk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrIHNldFZhcmlhYmxlczsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmICghV2lmaU5hdGl2ZS5zZXROZXR3b3JrVmFyaWFibGVDb21tYW5kKAorICAgICAgICAgICAgICAgICAgICAgICAgbmV0SWQsCisgICAgICAgICAgICAgICAgICAgICAgICBXaWZpQ29uZmlndXJhdGlvbi5wcmlvcml0eVZhck5hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICBJbnRlZ2VyLnRvU3RyaW5nKGNvbmZpZy5wcmlvcml0eSkpKSB7CisgICAgICAgICAgICAgICAgTG9nLmQoVEFHLCBjb25maWcuU1NJRCArICI6IGZhaWxlZCB0byBzZXQgcHJpb3JpdHk6ICIKKyAgICAgICAgICAgICAgICAgICAgICAgICtjb25maWcucHJpb3JpdHkpOworICAgICAgICAgICAgICAgIGJyZWFrIHNldFZhcmlhYmxlczsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKGNvbmZpZy5oaWRkZW5TU0lEICYmICFXaWZpTmF0aXZlLnNldE5ldHdvcmtWYXJpYWJsZUNvbW1hbmQoCisgICAgICAgICAgICAgICAgICAgICAgICBuZXRJZCwKKyAgICAgICAgICAgICAgICAgICAgICAgIFdpZmlDb25maWd1cmF0aW9uLmhpZGRlblNTSURWYXJOYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgSW50ZWdlci50b1N0cmluZyhjb25maWcuaGlkZGVuU1NJRCA/IDEgOiAwKSkpIHsKKyAgICAgICAgICAgICAgICBMb2cuZChUQUcsIGNvbmZpZy5TU0lEICsgIjogZmFpbGVkIHRvIHNldCBoaWRkZW5TU0lEOiAiKworICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlnLmhpZGRlblNTSUQpOworICAgICAgICAgICAgICAgIGJyZWFrIHNldFZhcmlhYmxlczsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgZm9yIChXaWZpQ29uZmlndXJhdGlvbi5FbnRlcnByaXNlRmllbGQgZmllbGQKKyAgICAgICAgICAgICAgICAgICAgOiBjb25maWcuZW50ZXJwcmlzZUZpZWxkcykgeworICAgICAgICAgICAgICAgIFN0cmluZyB2YXJOYW1lID0gZmllbGQudmFyTmFtZSgpOworICAgICAgICAgICAgICAgIFN0cmluZyB2YWx1ZSA9IGZpZWxkLnZhbHVlKCk7CisgICAgICAgICAgICAgICAgaWYgKHZhbHVlICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGZpZWxkICE9IGNvbmZpZy5lYXApIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlID0gKHZhbHVlLmxlbmd0aCgpID09IDApID8gIk5VTEwiIDogY29udmVydFRvUXVvdGVkU3RyaW5nKHZhbHVlKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBpZiAoIVdpZmlOYXRpdmUuc2V0TmV0d29ya1ZhcmlhYmxlQ29tbWFuZCgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV0SWQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhck5hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgTG9nLmQoVEFHLCBjb25maWcuU1NJRCArICI6IGZhaWxlZCB0byBzZXQgIiArIHZhck5hbWUgKworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiOiAiICsgdmFsdWUpOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgc2V0VmFyaWFibGVzOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuIG5ldElkOworICAgICAgICB9CisKKyAgICAgICAgaWYgKG5ld05ldHdvcmspIHsKKyAgICAgICAgICAgIFdpZmlOYXRpdmUucmVtb3ZlTmV0d29ya0NvbW1hbmQobmV0SWQpOworICAgICAgICAgICAgTG9nLmQoVEFHLAorICAgICAgICAgICAgICAgICAgICAiRmFpbGVkIHRvIHNldCBhIG5ldHdvcmsgdmFyaWFibGUsIHJlbW92ZWQgbmV0d29yazogIgorICAgICAgICAgICAgICAgICAgICArIG5ldElkKTsKKyAgICAgICAgfQorCisgICAgICAgIHJldHVybiAtMTsKKyAgICB9CisKKyAgICBwcml2YXRlIExpc3Q8V2lmaUNvbmZpZ3VyYXRpb24+IGdldENvbmZpZ3VyZWROZXR3b3Jrc05hdGl2ZSgpIHsKKyAgICAgICAgU3RyaW5nIGxpc3RTdHIgPSBXaWZpTmF0aXZlLmxpc3ROZXR3b3Jrc0NvbW1hbmQoKTsKKyAgICAgICAgbUxhc3RQcmlvcml0eSA9IDA7CisgICAgICAgIExpc3Q8V2lmaUNvbmZpZ3VyYXRpb24+IG5ldHdvcmtzID0KKyAgICAgICAgICAgIG5ldyBBcnJheUxpc3Q8V2lmaUNvbmZpZ3VyYXRpb24+KCk7CisgICAgICAgIGlmIChsaXN0U3RyID09IG51bGwpCisgICAgICAgICAgICByZXR1cm4gbmV0d29ya3M7CisKKyAgICAgICAgU3RyaW5nW10gbGluZXMgPSBsaXN0U3RyLnNwbGl0KCJcbiIpOworICAgICAgICAvLyBTa2lwIHRoZSBmaXJzdCBsaW5lLCB3aGljaCBpcyBhIGhlYWRlcgorICAgICAgICBmb3IgKGludCBpID0gMTsgaSA8IGxpbmVzLmxlbmd0aDsgaSsrKSB7CisgICAgICAgICAgICBTdHJpbmdbXSByZXN1bHQgPSBsaW5lc1tpXS5zcGxpdCgiXHQiKTsKKyAgICAgICAgICAgIC8vIG5ldHdvcmstaWQgfCBzc2lkIHwgYnNzaWQgfCBmbGFncworICAgICAgICAgICAgV2lmaUNvbmZpZ3VyYXRpb24gY29uZmlnID0gbmV3IFdpZmlDb25maWd1cmF0aW9uKCk7CisgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIGNvbmZpZy5uZXR3b3JrSWQgPSBJbnRlZ2VyLnBhcnNlSW50KHJlc3VsdFswXSk7CisgICAgICAgICAgICB9IGNhdGNoKE51bWJlckZvcm1hdEV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAocmVzdWx0Lmxlbmd0aCA+IDMpIHsKKyAgICAgICAgICAgICAgICBpZiAocmVzdWx0WzNdLmluZGV4T2YoIltDVVJSRU5UXSIpICE9IC0xKQorICAgICAgICAgICAgICAgICAgICBjb25maWcuc3RhdHVzID0gV2lmaUNvbmZpZ3VyYXRpb24uU3RhdHVzLkNVUlJFTlQ7CisgICAgICAgICAgICAgICAgZWxzZSBpZiAocmVzdWx0WzNdLmluZGV4T2YoIltESVNBQkxFRF0iKSAhPSAtMSkKKyAgICAgICAgICAgICAgICAgICAgY29uZmlnLnN0YXR1cyA9IFdpZmlDb25maWd1cmF0aW9uLlN0YXR1cy5ESVNBQkxFRDsKKyAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgICAgIGNvbmZpZy5zdGF0dXMgPSBXaWZpQ29uZmlndXJhdGlvbi5TdGF0dXMuRU5BQkxFRDsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgY29uZmlnLnN0YXR1cyA9IFdpZmlDb25maWd1cmF0aW9uLlN0YXR1cy5FTkFCTEVEOworICAgICAgICAgICAgfQorICAgICAgICAgICAgcmVhZE5ldHdvcmtWYXJpYWJsZXMoY29uZmlnKTsKKyAgICAgICAgICAgIGlmIChjb25maWcucHJpb3JpdHkgPiBtTGFzdFByaW9yaXR5KSB7CisgICAgICAgICAgICAgICAgbUxhc3RQcmlvcml0eSA9IGNvbmZpZy5wcmlvcml0eTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG5ldHdvcmtzLmFkZChjb25maWcpOworICAgICAgICB9CisgICAgICAgIHJldHVybiBuZXR3b3JrczsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBSZWFkIHRoZSB2YXJpYWJsZXMgZnJvbSB0aGUgc3VwcGxpY2FudCBkYWVtb24gdGhhdCBhcmUgbmVlZGVkIHRvCisgICAgICogZmlsbCBpbiB0aGUgV2lmaUNvbmZpZ3VyYXRpb24gb2JqZWN0LgorICAgICAqCisgICAgICogQHBhcmFtIGNvbmZpZyB0aGUge0BsaW5rIFdpZmlDb25maWd1cmF0aW9ufSBvYmplY3QgdG8gYmUgZmlsbGVkIGluLgorICAgICAqLworICAgIHByaXZhdGUgdm9pZCByZWFkTmV0d29ya1ZhcmlhYmxlcyhXaWZpQ29uZmlndXJhdGlvbiBjb25maWcpIHsKKworICAgICAgICBpbnQgbmV0SWQgPSBjb25maWcubmV0d29ya0lkOworICAgICAgICBpZiAobmV0SWQgPCAwKQorICAgICAgICAgICAgcmV0dXJuOworCisgICAgICAgIC8qCisgICAgICAgICAqIFRPRE86IG1heWJlIHNob3VsZCBoYXZlIGEgbmF0aXZlIG1ldGhvZCB0aGF0IHRha2VzIGFuIGFycmF5IG9mCisgICAgICAgICAqIHZhcmlhYmxlIG5hbWVzIGFuZCByZXR1cm5zIGFuIGFycmF5IG9mIHZhbHVlcy4gQnV0IHdlJ2Qgc3RpbGwKKyAgICAgICAgICogYmUgZG9pbmcgYSByb3VuZCB0cmlwIHRvIHRoZSBzdXBwbGljYW50IGRhZW1vbiBmb3IgZWFjaCB2YXJpYWJsZS4KKyAgICAgICAgICovCisgICAgICAgIFN0cmluZyB2YWx1ZTsKKworICAgICAgICB2YWx1ZSA9IFdpZmlOYXRpdmUuZ2V0TmV0d29ya1ZhcmlhYmxlQ29tbWFuZChuZXRJZCwgV2lmaUNvbmZpZ3VyYXRpb24uc3NpZFZhck5hbWUpOworICAgICAgICBpZiAoIVRleHRVdGlscy5pc0VtcHR5KHZhbHVlKSkgeworICAgICAgICAgICAgY29uZmlnLlNTSUQgPSByZW1vdmVEb3VibGVRdW90ZXModmFsdWUpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgY29uZmlnLlNTSUQgPSBudWxsOworICAgICAgICB9CisKKyAgICAgICAgdmFsdWUgPSBXaWZpTmF0aXZlLmdldE5ldHdvcmtWYXJpYWJsZUNvbW1hbmQobmV0SWQsIFdpZmlDb25maWd1cmF0aW9uLmJzc2lkVmFyTmFtZSk7CisgICAgICAgIGlmICghVGV4dFV0aWxzLmlzRW1wdHkodmFsdWUpKSB7CisgICAgICAgICAgICBjb25maWcuQlNTSUQgPSB2YWx1ZTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIGNvbmZpZy5CU1NJRCA9IG51bGw7CisgICAgICAgIH0KKworICAgICAgICB2YWx1ZSA9IFdpZmlOYXRpdmUuZ2V0TmV0d29ya1ZhcmlhYmxlQ29tbWFuZChuZXRJZCwgV2lmaUNvbmZpZ3VyYXRpb24ucHJpb3JpdHlWYXJOYW1lKTsKKyAgICAgICAgY29uZmlnLnByaW9yaXR5ID0gLTE7CisgICAgICAgIGlmICghVGV4dFV0aWxzLmlzRW1wdHkodmFsdWUpKSB7CisgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIGNvbmZpZy5wcmlvcml0eSA9IEludGVnZXIucGFyc2VJbnQodmFsdWUpOworICAgICAgICAgICAgfSBjYXRjaCAoTnVtYmVyRm9ybWF0RXhjZXB0aW9uIGlnbm9yZSkgeworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgdmFsdWUgPSBXaWZpTmF0aXZlLmdldE5ldHdvcmtWYXJpYWJsZUNvbW1hbmQobmV0SWQsIFdpZmlDb25maWd1cmF0aW9uLmhpZGRlblNTSURWYXJOYW1lKTsKKyAgICAgICAgY29uZmlnLmhpZGRlblNTSUQgPSBmYWxzZTsKKyAgICAgICAgaWYgKCFUZXh0VXRpbHMuaXNFbXB0eSh2YWx1ZSkpIHsKKyAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgY29uZmlnLmhpZGRlblNTSUQgPSBJbnRlZ2VyLnBhcnNlSW50KHZhbHVlKSAhPSAwOworICAgICAgICAgICAgfSBjYXRjaCAoTnVtYmVyRm9ybWF0RXhjZXB0aW9uIGlnbm9yZSkgeworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgdmFsdWUgPSBXaWZpTmF0aXZlLmdldE5ldHdvcmtWYXJpYWJsZUNvbW1hbmQobmV0SWQsIFdpZmlDb25maWd1cmF0aW9uLndlcFR4S2V5SWR4VmFyTmFtZSk7CisgICAgICAgIGNvbmZpZy53ZXBUeEtleUluZGV4ID0gLTE7CisgICAgICAgIGlmICghVGV4dFV0aWxzLmlzRW1wdHkodmFsdWUpKSB7CisgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIGNvbmZpZy53ZXBUeEtleUluZGV4ID0gSW50ZWdlci5wYXJzZUludCh2YWx1ZSk7CisgICAgICAgICAgICB9IGNhdGNoIChOdW1iZXJGb3JtYXRFeGNlcHRpb24gaWdub3JlKSB7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IDQ7IGkrKykgeworICAgICAgICAgICAgdmFsdWUgPSBXaWZpTmF0aXZlLmdldE5ldHdvcmtWYXJpYWJsZUNvbW1hbmQobmV0SWQsCisgICAgICAgICAgICAgICAgICAgIFdpZmlDb25maWd1cmF0aW9uLndlcEtleVZhck5hbWVzW2ldKTsKKyAgICAgICAgICAgIGlmICghVGV4dFV0aWxzLmlzRW1wdHkodmFsdWUpKSB7CisgICAgICAgICAgICAgICAgY29uZmlnLndlcEtleXNbaV0gPSB2YWx1ZTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgY29uZmlnLndlcEtleXNbaV0gPSBudWxsOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgdmFsdWUgPSBXaWZpTmF0aXZlLmdldE5ldHdvcmtWYXJpYWJsZUNvbW1hbmQobmV0SWQsIFdpZmlDb25maWd1cmF0aW9uLnBza1Zhck5hbWUpOworICAgICAgICBpZiAoIVRleHRVdGlscy5pc0VtcHR5KHZhbHVlKSkgeworICAgICAgICAgICAgY29uZmlnLnByZVNoYXJlZEtleSA9IHZhbHVlOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgY29uZmlnLnByZVNoYXJlZEtleSA9IG51bGw7CisgICAgICAgIH0KKworICAgICAgICB2YWx1ZSA9IFdpZmlOYXRpdmUuZ2V0TmV0d29ya1ZhcmlhYmxlQ29tbWFuZChjb25maWcubmV0d29ya0lkLAorICAgICAgICAgICAgICAgIFdpZmlDb25maWd1cmF0aW9uLlByb3RvY29sLnZhck5hbWUpOworICAgICAgICBpZiAoIVRleHRVdGlscy5pc0VtcHR5KHZhbHVlKSkgeworICAgICAgICAgICAgU3RyaW5nIHZhbHNbXSA9IHZhbHVlLnNwbGl0KCIgIik7CisgICAgICAgICAgICBmb3IgKFN0cmluZyB2YWwgOiB2YWxzKSB7CisgICAgICAgICAgICAgICAgaW50IGluZGV4ID0KKyAgICAgICAgICAgICAgICAgICAgbG9va3VwU3RyaW5nKHZhbCwgV2lmaUNvbmZpZ3VyYXRpb24uUHJvdG9jb2wuc3RyaW5ncyk7CisgICAgICAgICAgICAgICAgaWYgKDAgPD0gaW5kZXgpIHsKKyAgICAgICAgICAgICAgICAgICAgY29uZmlnLmFsbG93ZWRQcm90b2NvbHMuc2V0KGluZGV4KTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICB2YWx1ZSA9IFdpZmlOYXRpdmUuZ2V0TmV0d29ya1ZhcmlhYmxlQ29tbWFuZChjb25maWcubmV0d29ya0lkLAorICAgICAgICAgICAgICAgIFdpZmlDb25maWd1cmF0aW9uLktleU1nbXQudmFyTmFtZSk7CisgICAgICAgIGlmICghVGV4dFV0aWxzLmlzRW1wdHkodmFsdWUpKSB7CisgICAgICAgICAgICBTdHJpbmcgdmFsc1tdID0gdmFsdWUuc3BsaXQoIiAiKTsKKyAgICAgICAgICAgIGZvciAoU3RyaW5nIHZhbCA6IHZhbHMpIHsKKyAgICAgICAgICAgICAgICBpbnQgaW5kZXggPQorICAgICAgICAgICAgICAgICAgICBsb29rdXBTdHJpbmcodmFsLCBXaWZpQ29uZmlndXJhdGlvbi5LZXlNZ210LnN0cmluZ3MpOworICAgICAgICAgICAgICAgIGlmICgwIDw9IGluZGV4KSB7CisgICAgICAgICAgICAgICAgICAgIGNvbmZpZy5hbGxvd2VkS2V5TWFuYWdlbWVudC5zZXQoaW5kZXgpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHZhbHVlID0gV2lmaU5hdGl2ZS5nZXROZXR3b3JrVmFyaWFibGVDb21tYW5kKGNvbmZpZy5uZXR3b3JrSWQsCisgICAgICAgICAgICAgICAgV2lmaUNvbmZpZ3VyYXRpb24uQXV0aEFsZ29yaXRobS52YXJOYW1lKTsKKyAgICAgICAgaWYgKCFUZXh0VXRpbHMuaXNFbXB0eSh2YWx1ZSkpIHsKKyAgICAgICAgICAgIFN0cmluZyB2YWxzW10gPSB2YWx1ZS5zcGxpdCgiICIpOworICAgICAgICAgICAgZm9yIChTdHJpbmcgdmFsIDogdmFscykgeworICAgICAgICAgICAgICAgIGludCBpbmRleCA9CisgICAgICAgICAgICAgICAgICAgIGxvb2t1cFN0cmluZyh2YWwsIFdpZmlDb25maWd1cmF0aW9uLkF1dGhBbGdvcml0aG0uc3RyaW5ncyk7CisgICAgICAgICAgICAgICAgaWYgKDAgPD0gaW5kZXgpIHsKKyAgICAgICAgICAgICAgICAgICAgY29uZmlnLmFsbG93ZWRBdXRoQWxnb3JpdGhtcy5zZXQoaW5kZXgpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHZhbHVlID0gV2lmaU5hdGl2ZS5nZXROZXR3b3JrVmFyaWFibGVDb21tYW5kKGNvbmZpZy5uZXR3b3JrSWQsCisgICAgICAgICAgICAgICAgV2lmaUNvbmZpZ3VyYXRpb24uUGFpcndpc2VDaXBoZXIudmFyTmFtZSk7CisgICAgICAgIGlmICghVGV4dFV0aWxzLmlzRW1wdHkodmFsdWUpKSB7CisgICAgICAgICAgICBTdHJpbmcgdmFsc1tdID0gdmFsdWUuc3BsaXQoIiAiKTsKKyAgICAgICAgICAgIGZvciAoU3RyaW5nIHZhbCA6IHZhbHMpIHsKKyAgICAgICAgICAgICAgICBpbnQgaW5kZXggPQorICAgICAgICAgICAgICAgICAgICBsb29rdXBTdHJpbmcodmFsLCBXaWZpQ29uZmlndXJhdGlvbi5QYWlyd2lzZUNpcGhlci5zdHJpbmdzKTsKKyAgICAgICAgICAgICAgICBpZiAoMCA8PSBpbmRleCkgeworICAgICAgICAgICAgICAgICAgICBjb25maWcuYWxsb3dlZFBhaXJ3aXNlQ2lwaGVycy5zZXQoaW5kZXgpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHZhbHVlID0gV2lmaU5hdGl2ZS5nZXROZXR3b3JrVmFyaWFibGVDb21tYW5kKGNvbmZpZy5uZXR3b3JrSWQsCisgICAgICAgICAgICAgICAgV2lmaUNvbmZpZ3VyYXRpb24uR3JvdXBDaXBoZXIudmFyTmFtZSk7CisgICAgICAgIGlmICghVGV4dFV0aWxzLmlzRW1wdHkodmFsdWUpKSB7CisgICAgICAgICAgICBTdHJpbmcgdmFsc1tdID0gdmFsdWUuc3BsaXQoIiAiKTsKKyAgICAgICAgICAgIGZvciAoU3RyaW5nIHZhbCA6IHZhbHMpIHsKKyAgICAgICAgICAgICAgICBpbnQgaW5kZXggPQorICAgICAgICAgICAgICAgICAgICBsb29rdXBTdHJpbmcodmFsLCBXaWZpQ29uZmlndXJhdGlvbi5Hcm91cENpcGhlci5zdHJpbmdzKTsKKyAgICAgICAgICAgICAgICBpZiAoMCA8PSBpbmRleCkgeworICAgICAgICAgICAgICAgICAgICBjb25maWcuYWxsb3dlZEdyb3VwQ2lwaGVycy5zZXQoaW5kZXgpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIGZvciAoV2lmaUNvbmZpZ3VyYXRpb24uRW50ZXJwcmlzZUZpZWxkIGZpZWxkIDoKKyAgICAgICAgICAgICAgICBjb25maWcuZW50ZXJwcmlzZUZpZWxkcykgeworICAgICAgICAgICAgdmFsdWUgPSBXaWZpTmF0aXZlLmdldE5ldHdvcmtWYXJpYWJsZUNvbW1hbmQobmV0SWQsCisgICAgICAgICAgICAgICAgICAgIGZpZWxkLnZhck5hbWUoKSk7CisgICAgICAgICAgICBpZiAoIVRleHRVdGlscy5pc0VtcHR5KHZhbHVlKSkgeworICAgICAgICAgICAgICAgIGlmIChmaWVsZCAhPSBjb25maWcuZWFwKSB2YWx1ZSA9IHJlbW92ZURvdWJsZVF1b3Rlcyh2YWx1ZSk7CisgICAgICAgICAgICAgICAgZmllbGQuc2V0VmFsdWUodmFsdWUpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBQb2xsIGZvciBpbmZvIG5vdCByZXBvcnRlZCB2aWEgZXZlbnRzCisgICAgICogUlNTSSAmIExpbmtzcGVlZAorICAgICAqLworICAgIHByaXZhdGUgdm9pZCByZXF1ZXN0UG9sbGVkSW5mbygpIHsKKyAgICAgICAgaW50IG5ld1Jzc2kgPSBXaWZpTmF0aXZlLmdldFJzc2lDb21tYW5kKCk7CisgICAgICAgIGlmIChuZXdSc3NpICE9IC0xICYmIC0yMDAgPCBuZXdSc3NpICYmIG5ld1Jzc2kgPCAyNTYpIHsgLy8gc2NyZWVuIG91dCBpbnZhbGlkIHZhbHVlcworICAgICAgICAgICAgLyogc29tZSBpbXBsZW1lbnRhdGlvbnMgYXZvaWQgbmVnYXRpdmUgdmFsdWVzIGJ5IGFkZGluZyAyNTYKKyAgICAgICAgICAgICAqIHNvIHdlIG5lZWQgdG8gYWRqdXN0IGZvciB0aGF0IGhlcmUuCisgICAgICAgICAgICAgKi8KKyAgICAgICAgICAgIGlmIChuZXdSc3NpID4gMCkgbmV3UnNzaSAtPSAyNTY7CisgICAgICAgICAgICBtV2lmaUluZm8uc2V0UnNzaShuZXdSc3NpKTsKKyAgICAgICAgICAgIC8qCisgICAgICAgICAgICAgKiBSYXRoZXIgdGhlbiBzZW5kaW5nIHRoZSByYXcgUlNTSSBvdXQgZXZlcnkgdGltZSBpdAorICAgICAgICAgICAgICogY2hhbmdlcywgd2UgcHJlY2FsY3VsYXRlIHRoZSBzaWduYWwgbGV2ZWwgdGhhdCB3b3VsZAorICAgICAgICAgICAgICogYmUgZGlzcGxheWVkIGluIHRoZSBzdGF0dXMgYmFyLCBhbmQgb25seSBzZW5kIHRoZQorICAgICAgICAgICAgICogYnJvYWRjYXN0IGlmIHRoYXQgbXVjaCBtb3JlIGNvYXJzZS1ncmFpbmVkIG51bWJlcgorICAgICAgICAgICAgICogY2hhbmdlcy4gVGhpcyBjdXRzIGRvd24gZ3JlYXRseSBvbiB0aGUgbnVtYmVyIG9mCisgICAgICAgICAgICAgKiBicm9hZGNhc3RzLCBhdCB0aGUgY29zdCBvZiBub3QgbVdpZmlJbmZvcm1pbmcgb3RoZXJzCisgICAgICAgICAgICAgKiBpbnRlcmVzdGVkIGluIFJTU0kgb2YgYWxsIHRoZSBjaGFuZ2VzIGluIHNpZ25hbAorICAgICAgICAgICAgICogbGV2ZWwuCisgICAgICAgICAgICAgKi8KKyAgICAgICAgICAgIC8vIFRPRE86IFRoZSBzZWNvbmQgYXJnIHRvIHRoZSBjYWxsIGJlbG93IG5lZWRzIHRvIGJlIGEgc3ltYm9sIHNvbWV3aGVyZSwgYnV0CisgICAgICAgICAgICAvLyBpdCdzIGFjdHVhbGx5IHRoZSBzaXplIG9mIGFuIGFycmF5IG9mIGljb25zIHRoYXQncyBwcml2YXRlCisgICAgICAgICAgICAvLyB0byBTdGF0dXNCYXIgUG9saWN5LgorICAgICAgICAgICAgaW50IG5ld1NpZ25hbExldmVsID0gV2lmaU1hbmFnZXIuY2FsY3VsYXRlU2lnbmFsTGV2ZWwobmV3UnNzaSwgNCk7CisgICAgICAgICAgICBpZiAobmV3U2lnbmFsTGV2ZWwgIT0gbUxhc3RTaWduYWxMZXZlbCkgeworICAgICAgICAgICAgICAgIHNlbmRSc3NpQ2hhbmdlQnJvYWRjYXN0KG5ld1Jzc2kpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgbUxhc3RTaWduYWxMZXZlbCA9IG5ld1NpZ25hbExldmVsOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgbVdpZmlJbmZvLnNldFJzc2koLTIwMCk7CisgICAgICAgIH0KKyAgICAgICAgaW50IG5ld0xpbmtTcGVlZCA9IFdpZmlOYXRpdmUuZ2V0TGlua1NwZWVkQ29tbWFuZCgpOworICAgICAgICBpZiAobmV3TGlua1NwZWVkICE9IC0xKSB7CisgICAgICAgICAgICBtV2lmaUluZm8uc2V0TGlua1NwZWVkKG5ld0xpbmtTcGVlZCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBSZXNldHMgdGhlIFdpLUZpIENvbm5lY3Rpb25zIGJ5IGNsZWFyaW5nIGFueSBzdGF0ZSwgcmVzZXR0aW5nIGFueSBzb2NrZXRzCisgICAgICogdXNpbmcgdGhlIGludGVyZmFjZSwgc3RvcHBpbmcgREhDUCAmIGRpc2FibGluZyBpbnRlcmZhY2UKKyAgICAgKi8KKyAgICBwcml2YXRlIHZvaWQgaGFuZGxlTmV0d29ya0Rpc2Nvbm5lY3QoKSB7CisgICAgICAgIExvZy5kKFRBRywgIlJlc2V0IGNvbm5lY3Rpb25zIGFuZCBzdG9wcGluZyBESENQIik7CisKKyAgICAgICAgLyoKKyAgICAgICAgICogUmVzZXQgY29ubmVjdGlvbnMgJiBzdG9wIERIQ1AKKyAgICAgICAgICovCisgICAgICAgIE5ldHdvcmtVdGlscy5yZXNldENvbm5lY3Rpb25zKG1JbnRlcmZhY2VOYW1lKTsKKworICAgICAgICBpZiAoIU5ldHdvcmtVdGlscy5zdG9wRGhjcChtSW50ZXJmYWNlTmFtZSkpIHsKKyAgICAgICAgICAgIExvZy5lKFRBRywgIkNvdWxkIG5vdCBzdG9wIERIQ1AiKTsKKyAgICAgICAgfQorCisgICAgICAgIC8qIERpc2FibGUgaW50ZXJmYWNlICovCisgICAgICAgIE5ldHdvcmtVdGlscy5kaXNhYmxlSW50ZXJmYWNlKG1JbnRlcmZhY2VOYW1lKTsKKworICAgICAgICAvKiBzZW5kIGV2ZW50IHRvIENNICYgbmV0d29yayBjaGFuZ2UgYnJvYWRjYXN0ICovCisgICAgICAgIHNldERldGFpbGVkU3RhdGUoRGV0YWlsZWRTdGF0ZS5ESVNDT05ORUNURUQpOworICAgICAgICBzZW5kTmV0d29ya1N0YXRlQ2hhbmdlQnJvYWRjYXN0KG1MYXN0QnNzaWQpOworCisgICAgICAgIC8qIFJlc2V0IGRhdGEgc3RydWN0dXJlcyAqLworICAgICAgICBtV2lmaUluZm8uc2V0SXBBZGRyZXNzKDApOworICAgICAgICBtV2lmaUluZm8uc2V0QlNTSUQobnVsbCk7CisgICAgICAgIG1XaWZpSW5mby5zZXRTU0lEKG51bGwpOworICAgICAgICBtV2lmaUluZm8uc2V0TmV0d29ya0lkKC0xKTsKKworICAgICAgICAvKiBDbGVhciBuZXR3b3JrIHByb3BlcnRpZXMgKi8KKyAgICAgICAgbU5ldHdvcmtQcm9wZXJ0aWVzLmNsZWFyKCk7CisKKyAgICAgICAgbUxhc3RCc3NpZD0gbnVsbDsKKyAgICAgICAgbUxhc3ROZXR3b3JrSWQgPSAtMTsKKworICAgIH0KKworCisgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorICAgICAqIE5vdGlmaWNhdGlvbnMgZnJvbSBXaWZpTW9uaXRvcgorICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworICAgIC8qKgorICAgICAqIEEgc3RydWN0dXJlIGZvciBzdXBwbHlpbmcgaW5mb3JtYXRpb24gYWJvdXQgYSBzdXBwbGljYW50IHN0YXRlCisgICAgICogY2hhbmdlIGluIHRoZSBTVEFURV9DSEFOR0UgZXZlbnQgbWVzc2FnZSB0aGF0IGNvbWVzIGZyb20gdGhlCisgICAgICogV2lmaU1vbml0b3IKKyAgICAgKiB0a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HRoZSB0cmFja2VyIGEgbm90aWZpY2F0aW9uIHRoYXQgYSBzY2FuIGhhcyBjb21wbGV0ZWQsIGFuZCByZXN1bHRzCisgICAgICogYXJlIGF2YWlsYWJsZS4KKyAgICAgKi8KKyAgICB2b2lkIG5vdGlmeVNjYW5SZXN1bHRzQXZhaWxhYmxlKCkgeworICAgICAgICAvKioKKyAgICAgICAgICogU3dpdGNoIHNjYW4gbW9kZSBvdmVyIHRvIHBhc3NpdmUuCisgICAgICAgICAqIFR1cm5pbmcgb2ZmIHNjYW4tb25seSBtb2RlIGhhcHBlbnMgb25seSBpbiAiQ29ubmVjdCIgbW9kZQorICAgICAgICAgKi8KKyAgICAgICAgc2V0U2NhblR5cGUoZmFsc2UpOworICAgICAgICBzZW5kTWVzc2FnZShTQ0FOX1JFU1VMVFNfRVZFTlQpOworICAgIH0KKworICAgIHZvaWQgbm90aWZ5RHJpdmVyU3RhcnRlZCgpIHsKKyAgICAgICAgc2VuZE1lc3NhZ2UoRFJJVkVSX1NUQVJUX0VWRU5UKTsKKyAgICB9CisKKyAgICB2b2lkIG5vdGlmeURyaXZlclN0b3BwZWQoKSB7CisgICAgICAgIHNlbmRNZXNzYWdlKERSSVZFUl9TVE9QX0VWRU5UKTsKKyAgICB9CisKKyAgICB2b2lkIG5vdGlmeURyaXZlckh1bmcoKSB7CisgICAgICAgIHNldFdpZmlFbmFibGVkKGZhbHNlKTsKKyAgICAgICAgc2V0V2lmaUVuYWJsZWQodHJ1ZSk7CisgICAgfQorCisKKyAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyAgICAgKiBIU00gc3RhdGVzCisgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKyAgICBjbGFzcyBEZWZhdWx0U3RhdGUgZXh0ZW5kcyBIaWVyYXJjaGljYWxTdGF0ZSB7CisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgYm9vbGVhbiBwcm9jZXNzTWVzc2FnZShNZXNzYWdlIG1lc3NhZ2UpIHsKKyAgICAgICAgICAgIGlmIChEQkcpIExvZy5kKFRBRywgZ2V0TmFtZSgpICsgbWVzc2FnZS50b1N0cmluZygpICsgIlxuIik7CisgICAgICAgICAgICBTeW5jUGFyYW1zIHN5bmNQYXJhbXM7CisgICAgICAgICAgICBzd2l0Y2ggKG1lc3NhZ2Uud2hhdCkgeworICAgICAgICAgICAgICAgICAgICAvKiBTeW5jaHJvbm91cyBjYWxsIHJldHVybnMgKi8KKyAgICAgICAgICAgICAgICBjYXNlIENNRF9QSU5HX1NVUFBMSUNBTlQ6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfUkVNT1ZFX05FVFdPUks6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfRU5BQkxFX05FVFdPUks6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfRElTQUJMRV9ORVRXT1JLOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX0FERF9PUl9VUERBVEVfTkVUV09SSzoKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9HRVRfUlNTSToKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9HRVRfUlNTSV9BUFBST1g6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfR0VUX0xJTktfU1BFRUQ6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfR0VUX01BQ19BRERSOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NBVkVfQ09ORklHOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX0NPTk5FQ1RJT05fU1RBVFVTOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX0dFVF9ORVRXT1JLX0NPTkZJRzoKKyAgICAgICAgICAgICAgICAgICAgaWYgKG1lc3NhZ2UuYXJnMiA9PSBTWU5DSFJPTk9VU19DQUxMKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBzeW5jUGFyYW1zID0gKFN5bmNQYXJhbXMpIG1lc3NhZ2Uub2JqOworICAgICAgICAgICAgICAgICAgICAgICAgc3luY1BhcmFtcy5tU3luY1JldHVybi5ib29sVmFsdWUgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHN5bmNQYXJhbXMubVN5bmNSZXR1cm4uaW50VmFsdWUgPSAtMTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHN5bmNQYXJhbXMubVN5bmNSZXR1cm4uc3RyaW5nVmFsdWUgPSBudWxsOworICAgICAgICAgICAgICAgICAgICAgICAgc3luY1BhcmFtcy5tU3luY1JldHVybi5jb25maWdMaXN0ID0gbnVsbDsKKyAgICAgICAgICAgICAgICAgICAgICAgIG5vdGlmeU9uTXNnT2JqZWN0KG1lc3NhZ2UpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgQ01EX0VOQUJMRV9SU1NJX1BPTEw6CisgICAgICAgICAgICAgICAgICAgIG1FbmFibGVSc3NpUG9sbGluZyA9IChtZXNzYWdlLmFyZzEgPT0gMSk7CisgICAgICAgICAgICAgICAgICAgIG1TdXBwbGljYW50U3RhdGVUcmFja2VyLnNlbmRNZXNzYWdlKENNRF9FTkFCTEVfUlNTSV9QT0xMKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIC8qIERpc2NhcmQgKi8KKyAgICAgICAgICAgICAgICBjYXNlIENNRF9MT0FEX0RSSVZFUjoKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9VTkxPQURfRFJJVkVSOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NUQVJUX1NVUFBMSUNBTlQ6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU1RPUF9TVVBQTElDQU5UOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NUQVJUX0RSSVZFUjoKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TVE9QX0RSSVZFUjoKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TVEFSVF9BUDoKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TVE9QX0FQOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NUQVJUX1NDQU46CisgICAgICAgICAgICAgICAgY2FzZSBDTURfRElTQ09OTkVDVDoKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9SRUNPTk5FQ1Q6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfUkVBU1NPQ0lBVEU6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfUkVDT05GSUdVUkVfSVA6CisgICAgICAgICAgICAgICAgY2FzZSBTVVBfQ09OTkVDVElPTl9FVkVOVDoKKyAgICAgICAgICAgICAgICBjYXNlIFNVUF9ESVNDT05ORUNUSU9OX0VWRU5UOgorICAgICAgICAgICAgICAgIGNhc2UgRFJJVkVSX1NUQVJUX0VWRU5UOgorICAgICAgICAgICAgICAgIGNhc2UgRFJJVkVSX1NUT1BfRVZFTlQ6CisgICAgICAgICAgICAgICAgY2FzZSBORVRXT1JLX0NPTk5FQ1RJT05fRVZFTlQ6CisgICAgICAgICAgICAgICAgY2FzZSBORVRXT1JLX0RJU0NPTk5FQ1RJT05fRVZFTlQ6CisgICAgICAgICAgICAgICAgY2FzZSBTQ0FOX1JFU1VMVFNfRVZFTlQ6CisgICAgICAgICAgICAgICAgY2FzZSBTVVBQTElDQU5UX1NUQVRFX0NIQU5HRV9FVkVOVDoKKyAgICAgICAgICAgICAgICBjYXNlIFBBU1NXT1JEX01BWV9CRV9JTkNPUlJFQ1RfRVZFTlQ6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfQkxBQ0tMSVNUX05FVFdPUks6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfQ0xFQVJfQkxBQ0tMSVNUOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NFVF9TQ0FOX01PREU6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU0VUX1NDQU5fVFlQRToKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TRVRfUE9XRVJfTU9ERToKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TRVRfQkxVRVRPT1RIX0NPRVhJU1RFTkNFOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NFVF9CTFVFVE9PVEhfU0NBTl9NT0RFOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NFVF9OVU1fQUxMT1dFRF9DSEFOTkVMUzoKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9SRVFVRVNUX0NNX1dBS0VMT0NLOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX0NPTk5FQ1RfTkVUV09SSzoKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TQVZFX05FVFdPUks6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfRk9SR0VUX05FVFdPUks6CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgICAgIExvZy5lKFRBRywgIkVycm9yISB1bmhhbmRsZWQgbWVzc2FnZSIgKyBtZXNzYWdlKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gSEFORExFRDsKKyAgICAgICAgfQorICAgIH0KKworICAgIGNsYXNzIEluaXRpYWxTdGF0ZSBleHRlbmRzIEhpZXJhcmNoaWNhbFN0YXRlIHsKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIC8vVE9ETzogY291bGQgbW92ZSBsb2dnaW5nIGludG8gYSBjb21tb24gY2xhc3MKKyAgICAgICAgcHVibGljIHZvaWQgZW50ZXIoKSB7CisgICAgICAgICAgICBpZiAoREJHKSBMb2cuZChUQUcsIGdldE5hbWUoKSArICJcbiIpOworICAgICAgICAgICAgLy8gWzMxLThdIFJlc2VydmVkIGZvciBmdXR1cmUgdXNlCisgICAgICAgICAgICAvLyBbNyAtIDBdIEhTTSBzdGF0ZSBjaGFuZ2UKKyAgICAgICAgICAgIC8vIDUwMDIxIHdpZmlfc3RhdGVfY2hhbmdlZCAoY3VzdG9tfDF8NSkKKyAgICAgICAgICAgIEV2ZW50TG9nLndyaXRlRXZlbnQoRVZFTlRMT0dfV0lGSV9TVEFURV9DSEFOR0VELCBnZXROYW1lKCkpOworCisgICAgICAgICAgICBpZiAoV2lmaU5hdGl2ZS5pc0RyaXZlckxvYWRlZCgpKSB7CisgICAgICAgICAgICAgICAgdHJhbnNpdGlvblRvKG1Ecml2ZXJMb2FkZWRTdGF0ZSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBlbHNlIHsKKyAgICAgICAgICAgICAgICB0cmFuc2l0aW9uVG8obURyaXZlclVubG9hZGVkU3RhdGUpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgY2xhc3MgRHJpdmVyTG9hZGluZ1N0YXRlIGV4dGVuZHMgSGllcmFyY2hpY2FsU3RhdGUgeworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIHZvaWQgZW50ZXIoKSB7CisgICAgICAgICAgICBpZiAoREJHKSBMb2cuZChUQUcsIGdldE5hbWUoKSArICJcbiIpOworICAgICAgICAgICAgRXZlbnRMb2cud3JpdGVFdmVudChFVkVOVExPR19XSUZJX1NUQVRFX0NIQU5HRUQsIGdldE5hbWUoKSk7CisKKyAgICAgICAgICAgIGZpbmFsIE1lc3NhZ2UgbWVzc2FnZSA9IG5ldyBNZXNzYWdlKCk7CisgICAgICAgICAgICBtZXNzYWdlLmNvcHlGcm9tKGdldEN1cnJlbnRNZXNzYWdlKCkpOworICAgICAgICAgICAgLyogVE9ETzogYWRkIGEgdGltZW91dCB0byBmYWlsIHdoZW4gZHJpdmVyIGxvYWQgaXMgaHVuZy4KKyAgICAgICAgICAgICAqIFNpbWlsYXJseSBmb3IgZHJpdmVyIHVubG9hZC4KKyAgICAgICAgICAgICAqLworICAgICAgICAgICAgbmV3IFRocmVhZChuZXcgUnVubmFibGUoKSB7CisgICAgICAgICAgICAgICAgcHVibGljIHZvaWQgcnVuKCkgeworICAgICAgICAgICAgICAgICAgICBzV2FrZUxvY2suYWNxdWlyZSgpOworICAgICAgICAgICAgICAgICAgICAvL2VuYWJsaW5nIHN0YXRlCisgICAgICAgICAgICAgICAgICAgIHN3aXRjaChtZXNzYWdlLmFyZzEpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgV0lGSV9TVEFURV9FTkFCTElORzoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXRXaWZpU3RhdGUoV0lGSV9TVEFURV9FTkFCTElORyk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFdJRklfQVBfU1RBVEVfRU5BQkxJTkc6CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0V2lmaUFwU3RhdGUoV0lGSV9BUF9TVEFURV9FTkFCTElORyk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICBpZihXaWZpTmF0aXZlLmxvYWREcml2ZXIoKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgTG9nLmQoVEFHLCAiRHJpdmVyIGxvYWQgc3VjY2Vzc2Z1bCIpOworICAgICAgICAgICAgICAgICAgICAgICAgc2VuZE1lc3NhZ2UoQ01EX0xPQURfRFJJVkVSX1NVQ0NFU1MpOworICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAgICAgTG9nLmUoVEFHLCAiRmFpbGVkIHRvIGxvYWQgZHJpdmVyISIpOworICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoKG1lc3NhZ2UuYXJnMSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgV0lGSV9TVEFURV9FTkFCTElORzoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0V2lmaVN0YXRlKFdJRklfU1RBVEVfVU5LTk9XTik7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgV0lGSV9BUF9TVEFURV9FTkFCTElORzoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0V2lmaUFwU3RhdGUoV0lGSV9BUF9TVEFURV9GQUlMRUQpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIHNlbmRNZXNzYWdlKENNRF9MT0FEX0RSSVZFUl9GQUlMVVJFKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBzV2FrZUxvY2sucmVsZWFzZSgpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0pLnN0YXJ0KCk7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIGJvb2xlYW4gcHJvY2Vzc01lc3NhZ2UoTWVzc2FnZSBtZXNzYWdlKSB7CisgICAgICAgICAgICBpZiAoREJHKSBMb2cuZChUQUcsIGdldE5hbWUoKSArIG1lc3NhZ2UudG9TdHJpbmcoKSArICJcbiIpOworICAgICAgICAgICAgc3dpdGNoIChtZXNzYWdlLndoYXQpIHsKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9MT0FEX0RSSVZFUl9TVUNDRVNTOgorICAgICAgICAgICAgICAgICAgICB0cmFuc2l0aW9uVG8obURyaXZlckxvYWRlZFN0YXRlKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBDTURfTE9BRF9EUklWRVJfRkFJTFVSRToKKyAgICAgICAgICAgICAgICAgICAgdHJhbnNpdGlvblRvKG1Ecml2ZXJGYWlsZWRTdGF0ZSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgQ01EX0xPQURfRFJJVkVSOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1VOTE9BRF9EUklWRVI6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU1RBUlRfU1VQUExJQ0FOVDoKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TVE9QX1NVUFBMSUNBTlQ6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU1RBUlRfQVA6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU1RPUF9BUDoKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TVEFSVF9EUklWRVI6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU1RPUF9EUklWRVI6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU0VUX1NDQU5fTU9ERToKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TRVRfU0NBTl9UWVBFOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NFVF9QT1dFUl9NT0RFOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NFVF9CTFVFVE9PVEhfQ09FWElTVEVOQ0U6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU0VUX0JMVUVUT09USF9TQ0FOX01PREU6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU0VUX05VTV9BTExPV0VEX0NIQU5ORUxTOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NUQVJUX1BBQ0tFVF9GSUxURVJJTkc6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU1RPUF9QQUNLRVRfRklMVEVSSU5HOgorICAgICAgICAgICAgICAgICAgICBkZWZlck1lc3NhZ2UobWVzc2FnZSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBOT1RfSEFORExFRDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIEV2ZW50TG9nLndyaXRlRXZlbnQoRVZFTlRMT0dfV0lGSV9FVkVOVF9IQU5ETEVELCBtZXNzYWdlLndoYXQpOworICAgICAgICAgICAgcmV0dXJuIEhBTkRMRUQ7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBjbGFzcyBEcml2ZXJMb2FkZWRTdGF0ZSBleHRlbmRzIEhpZXJhcmNoaWNhbFN0YXRlIHsKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyB2b2lkIGVudGVyKCkgeworICAgICAgICAgICAgaWYgKERCRykgTG9nLmQoVEFHLCBnZXROYW1lKCkgKyAiXG4iKTsKKyAgICAgICAgICAgIEV2ZW50TG9nLndyaXRlRXZlbnQoRVZFTlRMT0dfV0lGSV9TVEFURV9DSEFOR0VELCBnZXROYW1lKCkpOworICAgICAgICB9CisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgYm9vbGVhbiBwcm9jZXNzTWVzc2FnZShNZXNzYWdlIG1lc3NhZ2UpIHsKKyAgICAgICAgICAgIGlmIChEQkcpIExvZy5kKFRBRywgZ2V0TmFtZSgpICsgbWVzc2FnZS50b1N0cmluZygpICsgIlxuIik7CisgICAgICAgICAgICBzd2l0Y2gobWVzc2FnZS53aGF0KSB7CisgICAgICAgICAgICAgICAgY2FzZSBDTURfVU5MT0FEX0RSSVZFUjoKKyAgICAgICAgICAgICAgICAgICAgdHJhbnNpdGlvblRvKG1Ecml2ZXJVbmxvYWRpbmdTdGF0ZSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NUQVJUX1NVUFBMSUNBTlQ6CisgICAgICAgICAgICAgICAgICAgIGlmKFdpZmlOYXRpdmUuc3RhcnRTdXBwbGljYW50KCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIExvZy5kKFRBRywgIlN1cHBsaWNhbnQgc3RhcnQgc3VjY2Vzc2Z1bCIpOworICAgICAgICAgICAgICAgICAgICAgICAgbVdpZmlNb25pdG9yLnN0YXJ0TW9uaXRvcmluZygpOworICAgICAgICAgICAgICAgICAgICAgICAgc2V0V2lmaVN0YXRlKFdJRklfU1RBVEVfRU5BQkxFRCk7CisgICAgICAgICAgICAgICAgICAgICAgICB0cmFuc2l0aW9uVG8obVdhaXRGb3JTdXBTdGF0ZSk7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICBMb2cuZShUQUcsICJGYWlsZWQgdG8gc3RhcnQgc3VwcGxpY2FudCEiKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHNlbmRNZXNzYWdlKG9idGFpbk1lc3NhZ2UoQ01EX1VOTE9BRF9EUklWRVIsIFdJRklfU1RBVEVfVU5LTk9XTiwgMCkpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NUQVJUX0FQOgorICAgICAgICAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgICAgICAgICAgbndTZXJ2aWNlLnN0YXJ0QWNjZXNzUG9pbnQoKFdpZmlDb25maWd1cmF0aW9uKSBtZXNzYWdlLm9iaiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1JbnRlcmZhY2VOYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgU09GVEFQX0lGQUNFKTsKKyAgICAgICAgICAgICAgICAgICAgfSBjYXRjaChFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgICAgICAgICAgTG9nLmUoVEFHLCAiRXhjZXB0aW9uIGluIHN0YXJ0QWNjZXNzUG9pbnQoKSIpOworICAgICAgICAgICAgICAgICAgICAgICAgc2VuZE1lc3NhZ2Uob2J0YWluTWVzc2FnZShDTURfVU5MT0FEX0RSSVZFUiwgV0lGSV9BUF9TVEFURV9GQUlMRUQsIDApKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIExvZy5kKFRBRywgIlNvZnQgQVAgc3RhcnQgc3VjY2Vzc2Z1bCIpOworICAgICAgICAgICAgICAgICAgICBzZXRXaWZpQXBTdGF0ZShXSUZJX0FQX1NUQVRFX0VOQUJMRUQpOworICAgICAgICAgICAgICAgICAgICB0cmFuc2l0aW9uVG8obVNvZnRBcFN0YXJ0ZWRTdGF0ZSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBOT1RfSEFORExFRDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIEV2ZW50TG9nLndyaXRlRXZlbnQoRVZFTlRMT0dfV0lGSV9FVkVOVF9IQU5ETEVELCBtZXNzYWdlLndoYXQpOworICAgICAgICAgICAgcmV0dXJuIEhBTkRMRUQ7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBjbGFzcyBEcml2ZXJVbmxvYWRpbmdTdGF0ZSBleHRlbmRzIEhpZXJhcmNoaWNhbFN0YXRlIHsKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyB2b2lkIGVudGVyKCkgeworICAgICAgICAgICAgaWYgKERCRykgTG9nLmQoVEFHLCBnZXROYW1lKCkgKyAiXG4iKTsKKyAgICAgICAgICAgIEV2ZW50TG9nLndyaXRlRXZlbnQoRVZFTlRMT0dfV0lGSV9TVEFURV9DSEFOR0VELCBnZXROYW1lKCkpOworCisgICAgICAgICAgICBmaW5hbCBNZXNzYWdlIG1lc3NhZ2UgPSBuZXcgTWVzc2FnZSgpOworICAgICAgICAgICAgbWVzc2FnZS5jb3B5RnJvbShnZXRDdXJyZW50TWVzc2FnZSgpKTsKKyAgICAgICAgICAgIG5ldyBUaHJlYWQobmV3IFJ1bm5hYmxlKCkgeworICAgICAgICAgICAgICAgIHB1YmxpYyB2b2lkIHJ1bigpIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKERCRykgTG9nLmQoVEFHLCBnZXROYW1lKCkgKyBtZXNzYWdlLnRvU3RyaW5nKCkgKyAiXG4iKTsKKyAgICAgICAgICAgICAgICAgICAgc1dha2VMb2NrLmFjcXVpcmUoKTsKKyAgICAgICAgICAgICAgICAgICAgaWYoV2lmaU5hdGl2ZS51bmxvYWREcml2ZXIoKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgTG9nLmQoVEFHLCAiRHJpdmVyIHVubG9hZCBzdWNjZXNzZnVsIik7CisgICAgICAgICAgICAgICAgICAgICAgICBzZW5kTWVzc2FnZShDTURfVU5MT0FEX0RSSVZFUl9TVUNDRVNTKTsKKworICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoKG1lc3NhZ2UuYXJnMSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgV0lGSV9TVEFURV9ESVNBQkxFRDoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFdJRklfU1RBVEVfVU5LTk9XTjoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0V2lmaVN0YXRlKG1lc3NhZ2UuYXJnMSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgV0lGSV9BUF9TVEFURV9ESVNBQkxFRDoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFdJRklfQVBfU1RBVEVfRkFJTEVEOgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXRXaWZpQXBTdGF0ZShtZXNzYWdlLmFyZzEpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIExvZy5lKFRBRywgIkZhaWxlZCB0byB1bmxvYWQgZHJpdmVyISIpOworICAgICAgICAgICAgICAgICAgICAgICAgc2VuZE1lc3NhZ2UoQ01EX1VOTE9BRF9EUklWRVJfRkFJTFVSRSk7CisKKyAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaChtZXNzYWdlLmFyZzEpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFdJRklfU1RBVEVfRElTQUJMRUQ6CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBXSUZJX1NUQVRFX1VOS05PV046CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldFdpZmlTdGF0ZShXSUZJX1NUQVRFX1VOS05PV04pOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFdJRklfQVBfU1RBVEVfRElTQUJMRUQ6CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBXSUZJX0FQX1NUQVRFX0ZBSUxFRDoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0V2lmaUFwU3RhdGUoV0lGSV9BUF9TVEFURV9GQUlMRUQpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBzV2FrZUxvY2sucmVsZWFzZSgpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0pLnN0YXJ0KCk7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIGJvb2xlYW4gcHJvY2Vzc01lc3NhZ2UoTWVzc2FnZSBtZXNzYWdlKSB7CisgICAgICAgICAgICBpZiAoREJHKSBMb2cuZChUQUcsIGdldE5hbWUoKSArIG1lc3NhZ2UudG9TdHJpbmcoKSArICJcbiIpOworICAgICAgICAgICAgc3dpdGNoIChtZXNzYWdlLndoYXQpIHsKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9VTkxPQURfRFJJVkVSX1NVQ0NFU1M6CisgICAgICAgICAgICAgICAgICAgIHRyYW5zaXRpb25UbyhtRHJpdmVyVW5sb2FkZWRTdGF0ZSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgQ01EX1VOTE9BRF9EUklWRVJfRkFJTFVSRToKKyAgICAgICAgICAgICAgICAgICAgdHJhbnNpdGlvblRvKG1Ecml2ZXJGYWlsZWRTdGF0ZSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgQ01EX0xPQURfRFJJVkVSOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1VOTE9BRF9EUklWRVI6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU1RBUlRfU1VQUExJQ0FOVDoKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TVE9QX1NVUFBMSUNBTlQ6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU1RBUlRfQVA6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU1RPUF9BUDoKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TVEFSVF9EUklWRVI6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU1RPUF9EUklWRVI6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU0VUX1NDQU5fTU9ERToKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TRVRfU0NBTl9UWVBFOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NFVF9QT1dFUl9NT0RFOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NFVF9CTFVFVE9PVEhfQ09FWElTVEVOQ0U6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU0VUX0JMVUVUT09USF9TQ0FOX01PREU6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU0VUX05VTV9BTExPV0VEX0NIQU5ORUxTOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NUQVJUX1BBQ0tFVF9GSUxURVJJTkc6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU1RPUF9QQUNLRVRfRklMVEVSSU5HOgorICAgICAgICAgICAgICAgICAgICBkZWZlck1lc3NhZ2UobWVzc2FnZSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBOT1RfSEFORExFRDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIEV2ZW50TG9nLndyaXRlRXZlbnQoRVZFTlRMT0dfV0lGSV9FVkVOVF9IQU5ETEVELCBtZXNzYWdlLndoYXQpOworICAgICAgICAgICAgcmV0dXJuIEhBTkRMRUQ7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBjbGFzcyBEcml2ZXJVbmxvYWRlZFN0YXRlIGV4dGVuZHMgSGllcmFyY2hpY2FsU3RhdGUgeworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIHZvaWQgZW50ZXIoKSB7CisgICAgICAgICAgICBpZiAoREJHKSBMb2cuZChUQUcsIGdldE5hbWUoKSArICJcbiIpOworICAgICAgICAgICAgRXZlbnRMb2cud3JpdGVFdmVudChFVkVOVExPR19XSUZJX1NUQVRFX0NIQU5HRUQsIGdldE5hbWUoKSk7CisgICAgICAgIH0KKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyBib29sZWFuIHByb2Nlc3NNZXNzYWdlKE1lc3NhZ2UgbWVzc2FnZSkgeworICAgICAgICAgICAgaWYgKERCRykgTG9nLmQoVEFHLCBnZXROYW1lKCkgKyBtZXNzYWdlLnRvU3RyaW5nKCkgKyAiXG4iKTsKKyAgICAgICAgICAgIHN3aXRjaCAobWVzc2FnZS53aGF0KSB7CisgICAgICAgICAgICAgICAgY2FzZSBDTURfTE9BRF9EUklWRVI6CisgICAgICAgICAgICAgICAgICAgIHRyYW5zaXRpb25UbyhtRHJpdmVyTG9hZGluZ1N0YXRlKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE5PVF9IQU5ETEVEOworICAgICAgICAgICAgfQorICAgICAgICAgICAgRXZlbnRMb2cud3JpdGVFdmVudChFVkVOVExPR19XSUZJX0VWRU5UX0hBTkRMRUQsIG1lc3NhZ2Uud2hhdCk7CisgICAgICAgICAgICByZXR1cm4gSEFORExFRDsKKyAgICAgICAgfQorICAgIH0KKworICAgIGNsYXNzIERyaXZlckZhaWxlZFN0YXRlIGV4dGVuZHMgSGllcmFyY2hpY2FsU3RhdGUgeworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIHZvaWQgZW50ZXIoKSB7CisgICAgICAgICAgICBMb2cuZShUQUcsIGdldE5hbWUoKSArICJcbiIpOworICAgICAgICAgICAgRXZlbnRMb2cud3JpdGVFdmVudChFVkVOVExPR19XSUZJX1NUQVRFX0NIQU5HRUQsIGdldE5hbWUoKSk7CisgICAgICAgIH0KKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyBib29sZWFuIHByb2Nlc3NNZXNzYWdlKE1lc3NhZ2UgbWVzc2FnZSkgeworICAgICAgICAgICAgaWYgKERCRykgTG9nLmQoVEFHLCBnZXROYW1lKCkgKyBtZXNzYWdlLnRvU3RyaW5nKCkgKyAiXG4iKTsKKyAgICAgICAgICAgIHJldHVybiBOT1RfSEFORExFRDsKKyAgICAgICAgfQorICAgIH0KKworCisgICAgY2xhc3MgV2FpdEZvclN1cFN0YXRlIGV4dGVuZHMgSGllcmFyY2hpY2FsU3RhdGUgeworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIHZvaWQgZW50ZXIoKSB7CisgICAgICAgICAgICBpZiAoREJHKSBMb2cuZChUQUcsIGdldE5hbWUoKSArICJcbiIpOworICAgICAgICAgICAgRXZlbnRMb2cud3JpdGVFdmVudChFVkVOVExPR19XSUZJX1NUQVRFX0NIQU5HRUQsIGdldE5hbWUoKSk7CisgICAgICAgIH0KKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyBib29sZWFuIHByb2Nlc3NNZXNzYWdlKE1lc3NhZ2UgbWVzc2FnZSkgeworICAgICAgICAgICAgaWYgKERCRykgTG9nLmQoVEFHLCBnZXROYW1lKCkgKyBtZXNzYWdlLnRvU3RyaW5nKCkgKyAiXG4iKTsKKyAgICAgICAgICAgIHN3aXRjaChtZXNzYWdlLndoYXQpIHsKKyAgICAgICAgICAgICAgICBjYXNlIFNVUF9DT05ORUNUSU9OX0VWRU5UOgorICAgICAgICAgICAgICAgICAgICBMb2cuZChUQUcsICJTdXBwbGljYW50IGNvbm5lY3Rpb24gZXN0YWJsaXNoZWQiKTsKKyAgICAgICAgICAgICAgICAgICAgbVN1cHBsaWNhbnRTdGF0ZVRyYWNrZXIucmVzZXRTdXBwbGljYW50U3RhdGUoKTsKKyAgICAgICAgICAgICAgICAgICAgLyogSW5pdGlhbGl6ZSBkYXRhIHN0cnVjdHVyZXMgKi8KKyAgICAgICAgICAgICAgICAgICAgbUxhc3RCc3NpZCA9IG51bGw7CisgICAgICAgICAgICAgICAgICAgIG1MYXN0TmV0d29ya0lkID0gLTE7CisgICAgICAgICAgICAgICAgICAgIG1MYXN0U2lnbmFsTGV2ZWwgPSAtMTsKKworICAgICAgICAgICAgICAgICAgICBtV2lmaUluZm8uc2V0TWFjQWRkcmVzcyhXaWZpTmF0aXZlLmdldE1hY0FkZHJlc3NDb21tYW5kKCkpOworCisgICAgICAgICAgICAgICAgICAgIC8vVE9ETzogaW5pdGlhbGl6ZSBhbmQgZml4IG11bHRpY2FzdCBmaWx0ZXJpbmcKKyAgICAgICAgICAgICAgICAgICAgLy9tV00uaW5pdGlhbGl6ZU11bHRpY2FzdEZpbHRlcmluZygpOworCisgICAgICAgICAgICAgICAgICAgIGlmIChtQmx1ZXRvb3RoQTJkcCA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBtQmx1ZXRvb3RoQTJkcCA9IG5ldyBCbHVldG9vdGhBMmRwKG1Db250ZXh0KTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBjaGVja0lzQmx1ZXRvb3RoUGxheWluZygpOworCisgICAgICAgICAgICAgICAgICAgIGNoZWNrVXNlU3RhdGljSXAoKTsKKyAgICAgICAgICAgICAgICAgICAgc2VuZFN1cHBsaWNhbnRDb25uZWN0aW9uQ2hhbmdlZEJyb2FkY2FzdCh0cnVlKTsKKyAgICAgICAgICAgICAgICAgICAgdHJhbnNpdGlvblRvKG1Ecml2ZXJTdXBSZWFkeVN0YXRlKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU1RPUF9TVVBQTElDQU5UOgorICAgICAgICAgICAgICAgICAgICBMb2cuZChUQUcsICJTdG9wIHN1cHBsaWNhbnQgcmVjZWl2ZWQiKTsKKyAgICAgICAgICAgICAgICAgICAgV2lmaU5hdGl2ZS5zdG9wU3VwcGxpY2FudCgpOworICAgICAgICAgICAgICAgICAgICB0cmFuc2l0aW9uVG8obURyaXZlckxvYWRlZFN0YXRlKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIC8qIEZhaWwgc29mdCBhcCB3aGVuIHdhaXRpbmcgZm9yIHN1cHBsaWNhbnQgc3RhcnQgKi8KKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TVEFSVF9BUDoKKyAgICAgICAgICAgICAgICAgICAgTG9nLmQoVEFHLCAiRmFpbGVkIHRvIHN0YXJ0IHNvZnQgQVAgd2l0aCBhIHJ1bm5pbmcgc3VwcGxpY2FudCIpOworICAgICAgICAgICAgICAgICAgICBzZXRXaWZpQXBTdGF0ZShXSUZJX0FQX1NUQVRFX0ZBSUxFRCk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NUQVJUX0RSSVZFUjoKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TVE9QX0RSSVZFUjoKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TRVRfU0NBTl9NT0RFOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NFVF9TQ0FOX1RZUEU6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU0VUX1BPV0VSX01PREU6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU0VUX0JMVUVUT09USF9DT0VYSVNURU5DRToKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TRVRfQkxVRVRPT1RIX1NDQU5fTU9ERToKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TRVRfTlVNX0FMTE9XRURfQ0hBTk5FTFM6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU1RBUlRfUEFDS0VUX0ZJTFRFUklORzoKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TVE9QX1BBQ0tFVF9GSUxURVJJTkc6CisgICAgICAgICAgICAgICAgICAgIGRlZmVyTWVzc2FnZShtZXNzYWdlKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU1RPUF9BUDoKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TVEFSVF9TVVBQTElDQU5UOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1VOTE9BRF9EUklWRVI6CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBOT1RfSEFORExFRDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIEV2ZW50TG9nLndyaXRlRXZlbnQoRVZFTlRMT0dfV0lGSV9FVkVOVF9IQU5ETEVELCBtZXNzYWdlLndoYXQpOworICAgICAgICAgICAgcmV0dXJuIEhBTkRMRUQ7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBjbGFzcyBEcml2ZXJTdXBSZWFkeVN0YXRlIGV4dGVuZHMgSGllcmFyY2hpY2FsU3RhdGUgeworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIHZvaWQgZW50ZXIoKSB7CisgICAgICAgICAgICBpZiAoREJHKSBMb2cuZChUQUcsIGdldE5hbWUoKSArICJcbiIpOworICAgICAgICAgICAgRXZlbnRMb2cud3JpdGVFdmVudChFVkVOVExPR19XSUZJX1NUQVRFX0NIQU5HRUQsIGdldE5hbWUoKSk7CisgICAgICAgICAgICAvKiBJbml0aWFsaXplIGZvciBjb25uZWN0IG1vZGUgb3BlcmF0aW9uIGF0IHN0YXJ0ICovCisgICAgICAgICAgICBtSXNTY2FuTW9kZSA9IGZhbHNlOworICAgICAgICB9CisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgYm9vbGVhbiBwcm9jZXNzTWVzc2FnZShNZXNzYWdlIG1lc3NhZ2UpIHsKKyAgICAgICAgICAgIGlmIChEQkcpIExvZy5kKFRBRywgZ2V0TmFtZSgpICsgbWVzc2FnZS50b1N0cmluZygpICsgIlxuIik7CisgICAgICAgICAgICBTeW5jUGFyYW1zIHN5bmNQYXJhbXM7CisgICAgICAgICAgICBXaWZpQ29uZmlndXJhdGlvbiBjb25maWc7CisgICAgICAgICAgICBzd2l0Y2gobWVzc2FnZS53aGF0KSB7CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU1RPUF9TVVBQTElDQU5UOiAgIC8qIFN1cHBsaWNhbnQgc3RvcHBlZCBieSB1c2VyICovCisgICAgICAgICAgICAgICAgICAgIExvZy5kKFRBRywgIlN0b3Agc3VwcGxpY2FudCByZWNlaXZlZCIpOworICAgICAgICAgICAgICAgICAgICBXaWZpTmF0aXZlLnN0b3BTdXBwbGljYW50KCk7CisgICAgICAgICAgICAgICAgICAgIC8vJEZBTEwtVEhST1VHSCQKKyAgICAgICAgICAgICAgICBjYXNlIFNVUF9ESVNDT05ORUNUSU9OX0VWRU5UOiAgLyogU3VwcGxpY2FudCBkaWVkICovCisgICAgICAgICAgICAgICAgICAgIEV2ZW50TG9nLndyaXRlRXZlbnQoRVZFTlRMT0dfV0lGSV9FVkVOVF9IQU5ETEVELCBtZXNzYWdlLndoYXQpOworICAgICAgICAgICAgICAgICAgICBXaWZpTmF0aXZlLmNsb3NlU3VwcGxpY2FudENvbm5lY3Rpb24oKTsKKyAgICAgICAgICAgICAgICAgICAgaGFuZGxlTmV0d29ya0Rpc2Nvbm5lY3QoKTsKKyAgICAgICAgICAgICAgICAgICAgc2VuZFN1cHBsaWNhbnRDb25uZWN0aW9uQ2hhbmdlZEJyb2FkY2FzdChmYWxzZSk7CisgICAgICAgICAgICAgICAgICAgIG1TdXBwbGljYW50U3RhdGVUcmFja2VyLnJlc2V0U3VwcGxpY2FudFN0YXRlKCk7CisgICAgICAgICAgICAgICAgICAgIHRyYW5zaXRpb25UbyhtRHJpdmVyTG9hZGVkU3RhdGUpOworCisgICAgICAgICAgICAgICAgICAgIC8qIFdoZW4gc3VwcGxpY2FudCBkaWVzLCB1bmxvYWQgZHJpdmVyIGFuZCBlbnRlciBmYWlsZWQgc3RhdGUgKi8KKyAgICAgICAgICAgICAgICAgICAgLy9UT0RPOiBjb25zaWRlciBicmluZ2luZyB1cCBzdXBwbGljYW50IGFnYWluCisgICAgICAgICAgICAgICAgICAgIGlmIChtZXNzYWdlLndoYXQgPT0gU1VQX0RJU0NPTk5FQ1RJT05fRVZFTlQpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIExvZy5kKFRBRywgIlN1cHBsaWNhbnQgZGllZCwgdW5sb2FkaW5nIGRyaXZlciIpOworICAgICAgICAgICAgICAgICAgICAgICAgc2VuZE1lc3NhZ2Uob2J0YWluTWVzc2FnZShDTURfVU5MT0FEX0RSSVZFUiwgV0lGSV9TVEFURV9VTktOT1dOLCAwKSk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU1RBUlRfRFJJVkVSOgorICAgICAgICAgICAgICAgICAgICBFdmVudExvZy53cml0ZUV2ZW50KEVWRU5UTE9HX1dJRklfRVZFTlRfSEFORExFRCwgbWVzc2FnZS53aGF0KTsKKyAgICAgICAgICAgICAgICAgICAgV2lmaU5hdGl2ZS5zdGFydERyaXZlckNvbW1hbmQoKTsKKyAgICAgICAgICAgICAgICAgICAgdHJhbnNpdGlvblRvKG1Ecml2ZXJTdGFydGluZ1N0YXRlKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBTQ0FOX1JFU1VMVFNfRVZFTlQ6CisgICAgICAgICAgICAgICAgICAgIHNldFNjYW5SZXN1bHRzKFdpZmlOYXRpdmUuc2NhblJlc3VsdHNDb21tYW5kKCkpOworICAgICAgICAgICAgICAgICAgICBzZW5kU2NhblJlc3VsdHNBdmFpbGFibGVCcm9hZGNhc3QoKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBDTURfUElOR19TVVBQTElDQU5UOgorICAgICAgICAgICAgICAgICAgICBzeW5jUGFyYW1zID0gKFN5bmNQYXJhbXMpIG1lc3NhZ2Uub2JqOworICAgICAgICAgICAgICAgICAgICBzeW5jUGFyYW1zLm1TeW5jUmV0dXJuLmJvb2xWYWx1ZSA9IFdpZmlOYXRpdmUucGluZ0NvbW1hbmQoKTsKKyAgICAgICAgICAgICAgICAgICAgbm90aWZ5T25Nc2dPYmplY3QobWVzc2FnZSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgQ01EX0FERF9PUl9VUERBVEVfTkVUV09SSzoKKyAgICAgICAgICAgICAgICAgICAgRXZlbnRMb2cud3JpdGVFdmVudChFVkVOVExPR19XSUZJX0VWRU5UX0hBTkRMRUQsIG1lc3NhZ2Uud2hhdCk7CisgICAgICAgICAgICAgICAgICAgIHN5bmNQYXJhbXMgPSAoU3luY1BhcmFtcykgbWVzc2FnZS5vYmo7CisgICAgICAgICAgICAgICAgICAgIGNvbmZpZyA9IChXaWZpQ29uZmlndXJhdGlvbikgc3luY1BhcmFtcy5tUGFyYW1ldGVyOworICAgICAgICAgICAgICAgICAgICBzeW5jUGFyYW1zLm1TeW5jUmV0dXJuLmludFZhbHVlID0gYWRkT3JVcGRhdGVOZXR3b3JrTmF0aXZlKGNvbmZpZyk7CisgICAgICAgICAgICAgICAgICAgIG5vdGlmeU9uTXNnT2JqZWN0KG1lc3NhZ2UpOworICAgICAgICAgICAgICAgICAgICBzZW5kU3VwcGxpY2FudENvbmZpZ0NoYW5nZWRCcm9hZGNhc3QoKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBDTURfUkVNT1ZFX05FVFdPUks6CisgICAgICAgICAgICAgICAgICAgIEV2ZW50TG9nLndyaXRlRXZlbnQoRVZFTlRMT0dfV0lGSV9FVkVOVF9IQU5ETEVELCBtZXNzYWdlLndoYXQpOworICAgICAgICAgICAgICAgICAgICBpZiAobWVzc2FnZS5hcmcyID09IFNZTkNIUk9OT1VTX0NBTEwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHN5bmNQYXJhbXMgPSAoU3luY1BhcmFtcykgbWVzc2FnZS5vYmo7CisgICAgICAgICAgICAgICAgICAgICAgICBzeW5jUGFyYW1zLm1TeW5jUmV0dXJuLmJvb2xWYWx1ZSA9IFdpZmlOYXRpdmUucmVtb3ZlTmV0d29ya0NvbW1hbmQoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYXJnMSk7CisgICAgICAgICAgICAgICAgICAgICAgICBub3RpZnlPbk1zZ09iamVjdChtZXNzYWdlKTsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIC8qIGFzeW5jaHJvbm91cyBoYW5kbGluZyAqLworICAgICAgICAgICAgICAgICAgICAgICAgV2lmaU5hdGl2ZS5yZW1vdmVOZXR3b3JrQ29tbWFuZChtZXNzYWdlLmFyZzEpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIHNlbmRTdXBwbGljYW50Q29uZmlnQ2hhbmdlZEJyb2FkY2FzdCgpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9FTkFCTEVfTkVUV09SSzoKKyAgICAgICAgICAgICAgICAgICAgRXZlbnRMb2cud3JpdGVFdmVudChFVkVOVExPR19XSUZJX0VWRU5UX0hBTkRMRUQsIG1lc3NhZ2Uud2hhdCk7CisgICAgICAgICAgICAgICAgICAgIGlmIChtZXNzYWdlLmFyZzIgPT0gU1lOQ0hST05PVVNfQ0FMTCkgeworICAgICAgICAgICAgICAgICAgICAgICAgc3luY1BhcmFtcyA9IChTeW5jUGFyYW1zKSBtZXNzYWdlLm9iajsKKyAgICAgICAgICAgICAgICAgICAgICAgIEVuYWJsZU5ldFBhcmFtcyBlbmFibGVOZXRQYXJhbXMgPSAoRW5hYmxlTmV0UGFyYW1zKSBzeW5jUGFyYW1zLm1QYXJhbWV0ZXI7CisgICAgICAgICAgICAgICAgICAgICAgICBzeW5jUGFyYW1zLm1TeW5jUmV0dXJuLmJvb2xWYWx1ZSA9IFdpZmlOYXRpdmUuZW5hYmxlTmV0d29ya0NvbW1hbmQoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVuYWJsZU5ldFBhcmFtcy5uZXRJZCwgZW5hYmxlTmV0UGFyYW1zLmRpc2FibGVPdGhlcnMpOworICAgICAgICAgICAgICAgICAgICAgICAgbm90aWZ5T25Nc2dPYmplY3QobWVzc2FnZSk7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICAvKiBhc3luY2hyb25vdXMgaGFuZGxpbmcgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgIFdpZmlOYXRpdmUuZW5hYmxlTmV0d29ya0NvbW1hbmQobWVzc2FnZS5hcmcxLCBtZXNzYWdlLmFyZzIgPT0gMSk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgc2VuZFN1cHBsaWNhbnRDb25maWdDaGFuZ2VkQnJvYWRjYXN0KCk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgQ01EX0RJU0FCTEVfTkVUV09SSzoKKyAgICAgICAgICAgICAgICAgICAgRXZlbnRMb2cud3JpdGVFdmVudChFVkVOVExPR19XSUZJX0VWRU5UX0hBTkRMRUQsIG1lc3NhZ2Uud2hhdCk7CisgICAgICAgICAgICAgICAgICAgIGlmIChtZXNzYWdlLmFyZzIgPT0gU1lOQ0hST05PVVNfQ0FMTCkgeworICAgICAgICAgICAgICAgICAgICAgICAgc3luY1BhcmFtcyA9IChTeW5jUGFyYW1zKSBtZXNzYWdlLm9iajsKKyAgICAgICAgICAgICAgICAgICAgICAgIHN5bmNQYXJhbXMubVN5bmNSZXR1cm4uYm9vbFZhbHVlID0gV2lmaU5hdGl2ZS5kaXNhYmxlTmV0d29ya0NvbW1hbmQoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYXJnMSk7CisgICAgICAgICAgICAgICAgICAgICAgICBub3RpZnlPbk1zZ09iamVjdChtZXNzYWdlKTsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIC8qIGFzeW5jaHJvbm91cyBoYW5kbGluZyAqLworICAgICAgICAgICAgICAgICAgICAgICAgV2lmaU5hdGl2ZS5kaXNhYmxlTmV0d29ya0NvbW1hbmQobWVzc2FnZS5hcmcxKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBzZW5kU3VwcGxpY2FudENvbmZpZ0NoYW5nZWRCcm9hZGNhc3QoKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBDTURfQkxBQ0tMSVNUX05FVFdPUks6CisgICAgICAgICAgICAgICAgICAgIEV2ZW50TG9nLndyaXRlRXZlbnQoRVZFTlRMT0dfV0lGSV9FVkVOVF9IQU5ETEVELCBtZXNzYWdlLndoYXQpOworICAgICAgICAgICAgICAgICAgICBXaWZpTmF0aXZlLmFkZFRvQmxhY2tsaXN0Q29tbWFuZCgoU3RyaW5nKW1lc3NhZ2Uub2JqKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBDTURfQ0xFQVJfQkxBQ0tMSVNUOgorICAgICAgICAgICAgICAgICAgICBXaWZpTmF0aXZlLmNsZWFyQmxhY2tsaXN0Q29tbWFuZCgpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9HRVRfTkVUV09SS19DT05GSUc6CisgICAgICAgICAgICAgICAgICAgIHN5bmNQYXJhbXMgPSAoU3luY1BhcmFtcykgbWVzc2FnZS5vYmo7CisgICAgICAgICAgICAgICAgICAgIHN5bmNQYXJhbXMubVN5bmNSZXR1cm4uY29uZmlnTGlzdCA9IGdldENvbmZpZ3VyZWROZXR3b3Jrc05hdGl2ZSgpOworICAgICAgICAgICAgICAgICAgICBub3RpZnlPbk1zZ09iamVjdChtZXNzYWdlKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU0FWRV9DT05GSUc6CisgICAgICAgICAgICAgICAgICAgIGlmIChtZXNzYWdlLmFyZzIgPT0gU1lOQ0hST05PVVNfQ0FMTCkgeworICAgICAgICAgICAgICAgICAgICAgICAgc3luY1BhcmFtcyA9IChTeW5jUGFyYW1zKSBtZXNzYWdlLm9iajsKKyAgICAgICAgICAgICAgICAgICAgICAgIHN5bmNQYXJhbXMubVN5bmNSZXR1cm4uYm9vbFZhbHVlID0gV2lmaU5hdGl2ZS5zYXZlQ29uZmlnQ29tbWFuZCgpOworICAgICAgICAgICAgICAgICAgICAgICAgbm90aWZ5T25Nc2dPYmplY3QobWVzc2FnZSk7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICAvKiBhc3luY2hyb25vdXMgaGFuZGxpbmcgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgIFdpZmlOYXRpdmUuc2F2ZUNvbmZpZ0NvbW1hbmQoKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAvLyBJbmZvcm0gdGhlIGJhY2t1cCBtYW5hZ2VyIGFib3V0IGEgZGF0YSBjaGFuZ2UKKyAgICAgICAgICAgICAgICAgICAgSUJhY2t1cE1hbmFnZXIgaWJtID0gSUJhY2t1cE1hbmFnZXIuU3R1Yi5hc0ludGVyZmFjZSgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBTZXJ2aWNlTWFuYWdlci5nZXRTZXJ2aWNlKENvbnRleHQuQkFDS1VQX1NFUlZJQ0UpKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGlibSAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlibS5kYXRhQ2hhbmdlZCgiY29tLmFuZHJvaWQucHJvdmlkZXJzLnNldHRpbmdzIik7CisgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIFRyeSBhZ2FpbiBsYXRlcgorICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgQ01EX0NPTk5FQ1RJT05fU1RBVFVTOgorICAgICAgICAgICAgICAgICAgICBzeW5jUGFyYW1zID0gKFN5bmNQYXJhbXMpIG1lc3NhZ2Uub2JqOworICAgICAgICAgICAgICAgICAgICBzeW5jUGFyYW1zLm1TeW5jUmV0dXJuLnN0cmluZ1ZhbHVlID0gV2lmaU5hdGl2ZS5zdGF0dXNDb21tYW5kKCk7CisgICAgICAgICAgICAgICAgICAgIG5vdGlmeU9uTXNnT2JqZWN0KG1lc3NhZ2UpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9HRVRfTUFDX0FERFI6CisgICAgICAgICAgICAgICAgICAgIHN5bmNQYXJhbXMgPSAoU3luY1BhcmFtcykgbWVzc2FnZS5vYmo7CisgICAgICAgICAgICAgICAgICAgIHN5bmNQYXJhbXMubVN5bmNSZXR1cm4uc3RyaW5nVmFsdWUgPSBXaWZpTmF0aXZlLmdldE1hY0FkZHJlc3NDb21tYW5kKCk7CisgICAgICAgICAgICAgICAgICAgIG5vdGlmeU9uTXNnT2JqZWN0KG1lc3NhZ2UpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgLyogQ2Fubm90IHN0YXJ0IHNvZnQgQVAgd2hpbGUgaW4gY2xpZW50IG1vZGUgKi8KKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TVEFSVF9BUDoKKyAgICAgICAgICAgICAgICAgICAgTG9nLmQoVEFHLCAiRmFpbGVkIHRvIHN0YXJ0IHNvZnQgQVAgd2l0aCBhIHJ1bm5pbmcgc3VwcGxpY2FudCIpOworICAgICAgICAgICAgICAgICAgICBFdmVudExvZy53cml0ZUV2ZW50KEVWRU5UTE9HX1dJRklfRVZFTlRfSEFORExFRCwgbWVzc2FnZS53aGF0KTsKKyAgICAgICAgICAgICAgICAgICAgc2V0V2lmaUFwU3RhdGUoV0lGSV9BUF9TVEFURV9GQUlMRUQpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TRVRfU0NBTl9NT0RFOgorICAgICAgICAgICAgICAgICAgICBtSXNTY2FuTW9kZSA9IChtZXNzYWdlLmFyZzEgPT0gU0NBTl9PTkxZX01PREUpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TQVZFX05FVFdPUks6CisgICAgICAgICAgICAgICAgICAgIGNvbmZpZyA9IChXaWZpQ29uZmlndXJhdGlvbikgbWVzc2FnZS5vYmo7CisgICAgICAgICAgICAgICAgICAgIGludCBuZXRJZCA9IGFkZE9yVXBkYXRlTmV0d29ya05hdGl2ZShjb25maWcpOworICAgICAgICAgICAgICAgICAgICAvKiBlbmFibGUgYSBuZXcgbmV0d29yayAqLworICAgICAgICAgICAgICAgICAgICBpZiAoY29uZmlnLm5ldHdvcmtJZCA8IDApIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIFdpZmlOYXRpdmUuZW5hYmxlTmV0d29ya0NvbW1hbmQobmV0SWQsIGZhbHNlKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBXaWZpTmF0aXZlLnNhdmVDb25maWdDb21tYW5kKCk7CisgICAgICAgICAgICAgICAgICAgIHNlbmRTdXBwbGljYW50Q29uZmlnQ2hhbmdlZEJyb2FkY2FzdCgpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9GT1JHRVRfTkVUV09SSzoKKyAgICAgICAgICAgICAgICAgICAgV2lmaU5hdGl2ZS5yZW1vdmVOZXR3b3JrQ29tbWFuZChtZXNzYWdlLmFyZzEpOworICAgICAgICAgICAgICAgICAgICBXaWZpTmF0aXZlLnNhdmVDb25maWdDb21tYW5kKCk7CisgICAgICAgICAgICAgICAgICAgIHNlbmRTdXBwbGljYW50Q29uZmlnQ2hhbmdlZEJyb2FkY2FzdCgpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgICAgICByZXR1cm4gTk9UX0hBTkRMRUQ7CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gSEFORExFRDsKKyAgICAgICAgfQorICAgIH0KKworICAgIGNsYXNzIERyaXZlclN0YXJ0aW5nU3RhdGUgZXh0ZW5kcyBIaWVyYXJjaGljYWxTdGF0ZSB7CisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgdm9pZCBlbnRlcigpIHsKKyAgICAgICAgICAgIGlmIChEQkcpIExvZy5kKFRBRywgZ2V0TmFtZSgpICsgIlxuIik7CisgICAgICAgICAgICBFdmVudExvZy53cml0ZUV2ZW50KEVWRU5UTE9HX1dJRklfU1RBVEVfQ0hBTkdFRCwgZ2V0TmFtZSgpKTsKKyAgICAgICAgfQorICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIGJvb2xlYW4gcHJvY2Vzc01lc3NhZ2UoTWVzc2FnZSBtZXNzYWdlKSB7CisgICAgICAgICAgICBpZiAoREJHKSBMb2cuZChUQUcsIGdldE5hbWUoKSArIG1lc3NhZ2UudG9TdHJpbmcoKSArICJcbiIpOworICAgICAgICAgICAgc3dpdGNoKG1lc3NhZ2Uud2hhdCkgeworICAgICAgICAgICAgICAgIGNhc2UgRFJJVkVSX1NUQVJUX0VWRU5UOgorICAgICAgICAgICAgICAgICAgICB0cmFuc2l0aW9uVG8obURyaXZlclN0YXJ0ZWRTdGF0ZSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICAvKiBRdWV1ZSBkcml2ZXIgY29tbWFuZHMgJiBjb25uZWN0aW9uIGV2ZW50cyAqLworICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NUQVJUX0RSSVZFUjoKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TVE9QX0RSSVZFUjoKKyAgICAgICAgICAgICAgICBjYXNlIFNVUFBMSUNBTlRfU1RBVEVfQ0hBTkdFX0VWRU5UOgorICAgICAgICAgICAgICAgIGNhc2UgTkVUV09SS19DT05ORUNUSU9OX0VWRU5UOgorICAgICAgICAgICAgICAgIGNhc2UgTkVUV09SS19ESVNDT05ORUNUSU9OX0VWRU5UOgorICAgICAgICAgICAgICAgIGNhc2UgUEFTU1dPUkRfTUFZX0JFX0lOQ09SUkVDVF9FVkVOVDoKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TRVRfU0NBTl9UWVBFOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NFVF9QT1dFUl9NT0RFOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NFVF9CTFVFVE9PVEhfQ09FWElTVEVOQ0U6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU0VUX0JMVUVUT09USF9TQ0FOX01PREU6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU0VUX05VTV9BTExPV0VEX0NIQU5ORUxTOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NUQVJUX1BBQ0tFVF9GSUxURVJJTkc6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU1RPUF9QQUNLRVRfRklMVEVSSU5HOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NUQVJUX1NDQU46CisgICAgICAgICAgICAgICAgY2FzZSBDTURfRElTQ09OTkVDVDoKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9SRUFTU09DSUFURToKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9SRUNPTk5FQ1Q6CisgICAgICAgICAgICAgICAgICAgIGRlZmVyTWVzc2FnZShtZXNzYWdlKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE5PVF9IQU5ETEVEOworICAgICAgICAgICAgfQorICAgICAgICAgICAgRXZlbnRMb2cud3JpdGVFdmVudChFVkVOVExPR19XSUZJX0VWRU5UX0hBTkRMRUQsIG1lc3NhZ2Uud2hhdCk7CisgICAgICAgICAgICByZXR1cm4gSEFORExFRDsKKyAgICAgICAgfQorICAgIH0KKworICAgIGNsYXNzIERyaXZlclN0YXJ0ZWRTdGF0ZSBleHRlbmRzIEhpZXJhcmNoaWNhbFN0YXRlIHsKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyB2b2lkIGVudGVyKCkgeworICAgICAgICAgICAgaWYgKERCRykgTG9nLmQoVEFHLCBnZXROYW1lKCkgKyAiXG4iKTsKKyAgICAgICAgICAgIEV2ZW50TG9nLndyaXRlRXZlbnQoRVZFTlRMT0dfV0lGSV9TVEFURV9DSEFOR0VELCBnZXROYW1lKCkpOworCisgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIG1CYXR0ZXJ5U3RhdHMubm90ZVdpZmlSdW5uaW5nKCk7CisgICAgICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gaWdub3JlKSB7fQorCisgICAgICAgICAgICAvKiBJbml0aWFsaXplIGNoYW5uZWwgY291bnQgKi8KKyAgICAgICAgICAgIHNldE51bUFsbG93ZWRDaGFubmVscygpOworCisgICAgICAgICAgICBpZiAobUlzU2Nhbk1vZGUpIHsKKyAgICAgICAgICAgICAgICBXaWZpTmF0aXZlLnNldFNjYW5SZXN1bHRIYW5kbGluZ0NvbW1hbmQoU0NBTl9PTkxZX01PREUpOworICAgICAgICAgICAgICAgIFdpZmlOYXRpdmUuZGlzY29ubmVjdENvbW1hbmQoKTsKKyAgICAgICAgICAgICAgICB0cmFuc2l0aW9uVG8obVNjYW5Nb2RlU3RhdGUpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBXaWZpTmF0aXZlLnNldFNjYW5SZXN1bHRIYW5kbGluZ0NvbW1hbmQoQ09OTkVDVF9NT0RFKTsKKyAgICAgICAgICAgICAgICAvKiBJZiBzdXBwbGljYW50IGhhcyBhbHJlYWR5IGNvbm5lY3RlZCwgYmVmb3JlIHdlIGNvdWxkIGZpbmlzaCBlc3RhYmxpc2hpbmcKKyAgICAgICAgICAgICAgICAgKiB0aGUgY29udHJvbCBjaGFubmVsIGNvbm5lY3Rpb24sIHdlIG1pc3MgYWxsIHRoZSBzdXBwbGljYW50IGV2ZW50cy4KKyAgICAgICAgICAgICAgICAgKiBEaXNjb25uZWN0IGFuZCByZWNvbm5lY3Qgd2hlbiBkcml2ZXIgaGFzIHN0YXJ0ZWQgdG8gZW5zdXJlIHdlIHJlY2VpdmUKKyAgICAgICAgICAgICAgICAgKiBhbGwgc3VwcGxpY2FudCBldmVudHMuCisgICAgICAgICAgICAgICAgICoKKyAgICAgICAgICAgICAgICAgKiBUT0RPOiBUaGlzIGlzIGEgYml0IHVuY2xlYW4sIGlkZWFsbHkgdGhlIHN1cHBsaWNhbnQgc2hvdWxkIG5ldmVyCisgICAgICAgICAgICAgICAgICogY29ubmVjdCB1bnRpbCB0b2xkIHRvIGRvIHNvIGJ5IHRoZSBmcmFtZXdvcmsKKyAgICAgICAgICAgICAgICAgKi8KKyAgICAgICAgICAgICAgICBXaWZpTmF0aXZlLmRpc2Nvbm5lY3RDb21tYW5kKCk7CisgICAgICAgICAgICAgICAgV2lmaU5hdGl2ZS5yZWNvbm5lY3RDb21tYW5kKCk7CisgICAgICAgICAgICAgICAgdHJhbnNpdGlvblRvKG1Db25uZWN0TW9kZVN0YXRlKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIGJvb2xlYW4gcHJvY2Vzc01lc3NhZ2UoTWVzc2FnZSBtZXNzYWdlKSB7CisgICAgICAgICAgICBpZiAoREJHKSBMb2cuZChUQUcsIGdldE5hbWUoKSArIG1lc3NhZ2UudG9TdHJpbmcoKSArICJcbiIpOworICAgICAgICAgICAgU3luY1BhcmFtcyBzeW5jUGFyYW1zOworICAgICAgICAgICAgc3dpdGNoKG1lc3NhZ2Uud2hhdCkgeworICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NFVF9TQ0FOX1RZUEU6CisgICAgICAgICAgICAgICAgICAgIGlmIChtZXNzYWdlLmFyZzEgPT0gU0NBTl9BQ1RJVkUpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIFdpZmlOYXRpdmUuc2V0U2Nhbk1vZGVDb21tYW5kKHRydWUpOworICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAgICAgV2lmaU5hdGl2ZS5zZXRTY2FuTW9kZUNvbW1hbmQoZmFsc2UpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NFVF9QT1dFUl9NT0RFOgorICAgICAgICAgICAgICAgICAgICBXaWZpTmF0aXZlLnNldFBvd2VyTW9kZUNvbW1hbmQobWVzc2FnZS5hcmcxKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU0VUX0JMVUVUT09USF9DT0VYSVNURU5DRToKKyAgICAgICAgICAgICAgICAgICAgV2lmaU5hdGl2ZS5zZXRCbHVldG9vdGhDb2V4aXN0ZW5jZU1vZGVDb21tYW5kKG1lc3NhZ2UuYXJnMSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NFVF9CTFVFVE9PVEhfU0NBTl9NT0RFOgorICAgICAgICAgICAgICAgICAgICBXaWZpTmF0aXZlLnNldEJsdWV0b290aENvZXhpc3RlbmNlU2Nhbk1vZGVDb21tYW5kKG1lc3NhZ2UuYXJnMSA9PSAxKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU0VUX05VTV9BTExPV0VEX0NIQU5ORUxTOgorICAgICAgICAgICAgICAgICAgICBtTnVtQWxsb3dlZENoYW5uZWxzID0gbWVzc2FnZS5hcmcxOworICAgICAgICAgICAgICAgICAgICBXaWZpTmF0aXZlLnNldE51bUFsbG93ZWRDaGFubmVsc0NvbW1hbmQobWVzc2FnZS5hcmcxKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU1RBUlRfRFJJVkVSOgorICAgICAgICAgICAgICAgICAgICAvKiBJZ25vcmUgYW5vdGhlciBkcml2ZXIgc3RhcnQgKi8KKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU1RPUF9EUklWRVI6CisgICAgICAgICAgICAgICAgICAgIFdpZmlOYXRpdmUuc3RvcERyaXZlckNvbW1hbmQoKTsKKyAgICAgICAgICAgICAgICAgICAgdHJhbnNpdGlvblRvKG1Ecml2ZXJTdG9wcGluZ1N0YXRlKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBDTURfUkVRVUVTVF9DTV9XQUtFTE9DSzoKKyAgICAgICAgICAgICAgICAgICAgaWYgKG1DbSA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBtQ20gPSAoQ29ubmVjdGl2aXR5TWFuYWdlciltQ29udGV4dC5nZXRTeXN0ZW1TZXJ2aWNlKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDb250ZXh0LkNPTk5FQ1RJVklUWV9TRVJWSUNFKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBtQ20ucmVxdWVzdE5ldHdvcmtUcmFuc2l0aW9uV2FrZWxvY2soVEFHKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU1RBUlRfUEFDS0VUX0ZJTFRFUklORzoKKyAgICAgICAgICAgICAgICAgICAgV2lmaU5hdGl2ZS5zdGFydFBhY2tldEZpbHRlcmluZygpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TVE9QX1BBQ0tFVF9GSUxURVJJTkc6CisgICAgICAgICAgICAgICAgICAgIFdpZmlOYXRpdmUuc3RvcFBhY2tldEZpbHRlcmluZygpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgICAgICByZXR1cm4gTk9UX0hBTkRMRUQ7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBFdmVudExvZy53cml0ZUV2ZW50KEVWRU5UTE9HX1dJRklfRVZFTlRfSEFORExFRCwgbWVzc2FnZS53aGF0KTsKKyAgICAgICAgICAgIHJldHVybiBIQU5ETEVEOworICAgICAgICB9CisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgdm9pZCBleGl0KCkgeworICAgICAgICAgICAgaWYgKERCRykgTG9nLmQoVEFHLCBnZXROYW1lKCkgKyAiXG4iKTsKKyAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgbUJhdHRlcnlTdGF0cy5ub3RlV2lmaVN0b3BwZWQoKTsKKyAgICAgICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBpZ25vcmUpIHsgfQorICAgICAgICAgICAgbVNjYW5SZXN1bHRzID0gbnVsbDsKKyAgICAgICAgfQorICAgIH0KKworICAgIGNsYXNzIERyaXZlclN0b3BwaW5nU3RhdGUgZXh0ZW5kcyBIaWVyYXJjaGljYWxTdGF0ZSB7CisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgdm9pZCBlbnRlcigpIHsKKyAgICAgICAgICAgIGlmIChEQkcpIExvZy5kKFRBRywgZ2V0TmFtZSgpICsgIlxuIik7CisgICAgICAgICAgICBFdmVudExvZy53cml0ZUV2ZW50KEVWRU5UTE9HX1dJRklfU1RBVEVfQ0hBTkdFRCwgZ2V0TmFtZSgpKTsKKyAgICAgICAgfQorICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIGJvb2xlYW4gcHJvY2Vzc01lc3NhZ2UoTWVzc2FnZSBtZXNzYWdlKSB7CisgICAgICAgICAgICBpZiAoREJHKSBMb2cuZChUQUcsIGdldE5hbWUoKSArIG1lc3NhZ2UudG9TdHJpbmcoKSArICJcbiIpOworICAgICAgICAgICAgc3dpdGNoKG1lc3NhZ2Uud2hhdCkgeworICAgICAgICAgICAgICAgIGNhc2UgRFJJVkVSX1NUT1BfRVZFTlQ6CisgICAgICAgICAgICAgICAgICAgIHRyYW5zaXRpb25UbyhtRHJpdmVyU3RvcHBlZFN0YXRlKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIC8qIFF1ZXVlIGRyaXZlciBjb21tYW5kcyAqLworICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NUQVJUX0RSSVZFUjoKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TVE9QX0RSSVZFUjoKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TRVRfU0NBTl9UWVBFOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NFVF9QT1dFUl9NT0RFOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NFVF9CTFVFVE9PVEhfQ09FWElTVEVOQ0U6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU0VUX0JMVUVUT09USF9TQ0FOX01PREU6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU0VUX05VTV9BTExPV0VEX0NIQU5ORUxTOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NUQVJUX1BBQ0tFVF9GSUxURVJJTkc6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU1RPUF9QQUNLRVRfRklMVEVSSU5HOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NUQVJUX1NDQU46CisgICAgICAgICAgICAgICAgY2FzZSBDTURfRElTQ09OTkVDVDoKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9SRUFTU09DSUFURToKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9SRUNPTk5FQ1Q6CisgICAgICAgICAgICAgICAgICAgIGRlZmVyTWVzc2FnZShtZXNzYWdlKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE5PVF9IQU5ETEVEOworICAgICAgICAgICAgfQorICAgICAgICAgICAgRXZlbnRMb2cud3JpdGVFdmVudChFVkVOVExPR19XSUZJX0VWRU5UX0hBTkRMRUQsIG1lc3NhZ2Uud2hhdCk7CisgICAgICAgICAgICByZXR1cm4gSEFORExFRDsKKyAgICAgICAgfQorICAgIH0KKworICAgIGNsYXNzIERyaXZlclN0b3BwZWRTdGF0ZSBleHRlbmRzIEhpZXJhcmNoaWNhbFN0YXRlIHsKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyB2b2lkIGVudGVyKCkgeworICAgICAgICAgICAgaWYgKERCRykgTG9nLmQoVEFHLCBnZXROYW1lKCkgKyAiXG4iKTsKKyAgICAgICAgICAgIEV2ZW50TG9nLndyaXRlRXZlbnQoRVZFTlRMT0dfV0lGSV9TVEFURV9DSEFOR0VELCBnZXROYW1lKCkpOworICAgICAgICB9CisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgYm9vbGVhbiBwcm9jZXNzTWVzc2FnZShNZXNzYWdlIG1lc3NhZ2UpIHsKKyAgICAgICAgICAgIGlmIChEQkcpIExvZy5kKFRBRywgZ2V0TmFtZSgpICsgbWVzc2FnZS50b1N0cmluZygpICsgIlxuIik7CisgICAgICAgICAgICByZXR1cm4gTk9UX0hBTkRMRUQ7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBjbGFzcyBTY2FuTW9kZVN0YXRlIGV4dGVuZHMgSGllcmFyY2hpY2FsU3RhdGUgeworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIHZvaWQgZW50ZXIoKSB7CisgICAgICAgICAgICBpZiAoREJHKSBMb2cuZChUQUcsIGdldE5hbWUoKSArICJcbiIpOworICAgICAgICAgICAgRXZlbnRMb2cud3JpdGVFdmVudChFVkVOVExPR19XSUZJX1NUQVRFX0NIQU5HRUQsIGdldE5hbWUoKSk7CisgICAgICAgIH0KKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyBib29sZWFuIHByb2Nlc3NNZXNzYWdlKE1lc3NhZ2UgbWVzc2FnZSkgeworICAgICAgICAgICAgaWYgKERCRykgTG9nLmQoVEFHLCBnZXROYW1lKCkgKyBtZXNzYWdlLnRvU3RyaW5nKCkgKyAiXG4iKTsKKyAgICAgICAgICAgIFN5bmNQYXJhbXMgc3luY1BhcmFtczsKKyAgICAgICAgICAgIHN3aXRjaChtZXNzYWdlLndoYXQpIHsKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TRVRfU0NBTl9NT0RFOgorICAgICAgICAgICAgICAgICAgICBpZiAobWVzc2FnZS5hcmcxID09IFNDQU5fT05MWV9NT0RFKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAvKiBJZ25vcmUgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBIQU5ETEVEOworICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAgICAgV2lmaU5hdGl2ZS5zZXRTY2FuUmVzdWx0SGFuZGxpbmdDb21tYW5kKG1lc3NhZ2UuYXJnMSk7CisgICAgICAgICAgICAgICAgICAgICAgICBXaWZpTmF0aXZlLnJlY29ubmVjdENvbW1hbmQoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1Jc1NjYW5Nb2RlID0gZmFsc2U7CisgICAgICAgICAgICAgICAgICAgICAgICB0cmFuc2l0aW9uVG8obURpc2Nvbm5lY3RlZFN0YXRlKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TVEFSVF9TQ0FOOgorICAgICAgICAgICAgICAgICAgICBXaWZpTmF0aXZlLnNjYW5Db21tYW5kKG1lc3NhZ2UuYXJnMSA9PSBTQ0FOX0FDVElWRSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICAvKiBJZ25vcmUgKi8KKyAgICAgICAgICAgICAgICBjYXNlIENNRF9ESVNDT05ORUNUOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1JFQ09OTkVDVDoKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9SRUFTU09DSUFURToKKyAgICAgICAgICAgICAgICBjYXNlIFNVUFBMSUNBTlRfU1RBVEVfQ0hBTkdFX0VWRU5UOgorICAgICAgICAgICAgICAgIGNhc2UgTkVUV09SS19DT05ORUNUSU9OX0VWRU5UOgorICAgICAgICAgICAgICAgIGNhc2UgTkVUV09SS19ESVNDT05ORUNUSU9OX0VWRU5UOgorICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgICAgICByZXR1cm4gTk9UX0hBTkRMRUQ7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBFdmVudExvZy53cml0ZUV2ZW50KEVWRU5UTE9HX1dJRklfRVZFTlRfSEFORExFRCwgbWVzc2FnZS53aGF0KTsKKyAgICAgICAgICAgIHJldHVybiBIQU5ETEVEOworICAgICAgICB9CisgICAgfQorCisgICAgY2xhc3MgQ29ubmVjdE1vZGVTdGF0ZSBleHRlbmRzIEhpZXJhcmNoaWNhbFN0YXRlIHsKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyB2b2lkIGVudGVyKCkgeworICAgICAgICAgICAgaWYgKERCRykgTG9nLmQoVEFHLCBnZXROYW1lKCkgKyAiXG4iKTsKKyAgICAgICAgICAgIEV2ZW50TG9nLndyaXRlRXZlbnQoRVZFTlRMT0dfV0lGSV9TVEFURV9DSEFOR0VELCBnZXROYW1lKCkpOworICAgICAgICB9CisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgYm9vbGVhbiBwcm9jZXNzTWVzc2FnZShNZXNzYWdlIG1lc3NhZ2UpIHsKKyAgICAgICAgICAgIGlmIChEQkcpIExvZy5kKFRBRywgZ2V0TmFtZSgpICsgbWVzc2FnZS50b1N0cmluZygpICsgIlxuIik7CisgICAgICAgICAgICBTeW5jUGFyYW1zIHN5bmNQYXJhbXM7CisgICAgICAgICAgICBTdGF0ZUNoYW5nZVJlc3VsdCBzdGF0ZUNoYW5nZVJlc3VsdDsKKyAgICAgICAgICAgIHN3aXRjaChtZXNzYWdlLndoYXQpIHsKKyAgICAgICAgICAgICAgICBjYXNlIFBBU1NXT1JEX01BWV9CRV9JTkNPUlJFQ1RfRVZFTlQ6CisgICAgICAgICAgICAgICAgICAgIG1QYXNzd29yZEtleU1heUJlSW5jb3JyZWN0ID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBTVVBQTElDQU5UX1NUQVRFX0NIQU5HRV9FVkVOVDoKKyAgICAgICAgICAgICAgICAgICAgc3RhdGVDaGFuZ2VSZXN1bHQgPSAoU3RhdGVDaGFuZ2VSZXN1bHQpIG1lc3NhZ2Uub2JqOworICAgICAgICAgICAgICAgICAgICBtU3VwcGxpY2FudFN0YXRlVHJhY2tlci5oYW5kbGVFdmVudChzdGF0ZUNoYW5nZVJlc3VsdCk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NUQVJUX1NDQU46CisgICAgICAgICAgICAgICAgICAgIC8qIFdlIG5lZWQgdG8gc2V0IHNjYW4gdHlwZSBpbiBjb21wbGV0ZWQgc3RhdGUgKi8KKyAgICAgICAgICAgICAgICAgICAgTWVzc2FnZSBuZXdNc2cgPSBvYnRhaW5NZXNzYWdlKCk7CisgICAgICAgICAgICAgICAgICAgIG5ld01zZy5jb3B5RnJvbShtZXNzYWdlKTsKKyAgICAgICAgICAgICAgICAgICAgbVN1cHBsaWNhbnRTdGF0ZVRyYWNrZXIuc2VuZE1lc3NhZ2UobmV3TXNnKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIC8qIERvIGEgcmVkdW5kYW50IGRpc2Nvbm5lY3Qgd2l0aG91dCB0cmFuc2l0aW9uICovCisgICAgICAgICAgICAgICAgY2FzZSBDTURfRElTQ09OTkVDVDoKKyAgICAgICAgICAgICAgICAgICAgV2lmaU5hdGl2ZS5kaXNjb25uZWN0Q29tbWFuZCgpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9SRUNPTk5FQ1Q6CisgICAgICAgICAgICAgICAgICAgIFdpZmlOYXRpdmUucmVjb25uZWN0Q29tbWFuZCgpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9SRUFTU09DSUFURToKKyAgICAgICAgICAgICAgICAgICAgV2lmaU5hdGl2ZS5yZWFzc29jaWF0ZUNvbW1hbmQoKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBDTURfQ09OTkVDVF9ORVRXT1JLOgorICAgICAgICAgICAgICAgICAgICBpbnQgbmV0SWQgPSBtZXNzYWdlLmFyZzE7CisgICAgICAgICAgICAgICAgICAgIFdpZmlDb25maWd1cmF0aW9uIGNvbmZpZyA9IChXaWZpQ29uZmlndXJhdGlvbikgbWVzc2FnZS5vYmo7CisgICAgICAgICAgICAgICAgICAgIGlmIChjb25maWcgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgbmV0SWQgPSBhZGRPclVwZGF0ZU5ldHdvcmtOYXRpdmUoY29uZmlnKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAvLyBSZXNldCB0aGUgcHJpb3JpdHkgb2YgZWFjaCBuZXR3b3JrIGF0IHN0YXJ0IG9yIGlmIGl0IGdvZXMgdG9vIGhpZ2guCisgICAgICAgICAgICAgICAgICAgIGlmIChtTGFzdFByaW9yaXR5ID09IC0xIHx8IG1MYXN0UHJpb3JpdHkgPiAxMDAwMDAwKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBMaXN0PFdpZmlDb25maWd1cmF0aW9uPiBjb25maWdMaXN0ID0gZ2V0Q29uZmlndXJlZE5ldHdvcmtzTmF0aXZlKCk7CisgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKFdpZmlDb25maWd1cmF0aW9uIGNvbmYgOiBjb25maWdMaXN0KSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNvbmYubmV0d29ya0lkICE9IC0xKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmYucHJpb3JpdHkgPSAwOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZGRPclVwZGF0ZU5ldHdvcmtOYXRpdmUoY29uZik7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgbUxhc3RQcmlvcml0eSA9IDA7CisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICAvLyBTZXQgdG8gdGhlIGhpZ2hlc3QgcHJpb3JpdHkgYW5kIHNhdmUgdGhlIGNvbmZpZ3VyYXRpb24uCisgICAgICAgICAgICAgICAgICAgIGNvbmZpZyA9IG5ldyBXaWZpQ29uZmlndXJhdGlvbigpOworICAgICAgICAgICAgICAgICAgICBjb25maWcubmV0d29ya0lkID0gbmV0SWQ7CisgICAgICAgICAgICAgICAgICAgIGNvbmZpZy5wcmlvcml0eSA9ICsrbUxhc3RQcmlvcml0eTsKKworICAgICAgICAgICAgICAgICAgICBhZGRPclVwZGF0ZU5ldHdvcmtOYXRpdmUoY29uZmlnKTsKKyAgICAgICAgICAgICAgICAgICAgV2lmaU5hdGl2ZS5zYXZlQ29uZmlnQ29tbWFuZCgpOworCisgICAgICAgICAgICAgICAgICAgIC8vIENvbm5lY3QgdG8gbmV0d29yayBieSBkaXNhYmxpbmcgb3RoZXJzLgorICAgICAgICAgICAgICAgICAgICBXaWZpTmF0aXZlLmVuYWJsZU5ldHdvcmtDb21tYW5kKG5ldElkLCB0cnVlKTsKKyAgICAgICAgICAgICAgICAgICAgV2lmaU5hdGl2ZS5yZWNvbm5lY3RDb21tYW5kKCk7CisgICAgICAgICAgICAgICAgICAgIG1FbmFibGVBbGxOZXR3b3JrcyA9IHRydWU7CisgICAgICAgICAgICAgICAgICAgIC8qIERvbnQgc2VuZCBhIHN1cHBsaWNhbnQgY29uZmlnIGNoYW5nZSBicm9hZGNhc3QgaGVyZQorICAgICAgICAgICAgICAgICAgICAgKiBhcyBpdCBpcyBiZXR0ZXIgdG8gbm90IGV4cG9zZSB0aGUgdGVtcG9yYXJ5IGRpc2FibGluZworICAgICAgICAgICAgICAgICAgICAgKiBvZiBhbGwgbmV0d29ya3MKKyAgICAgICAgICAgICAgICAgICAgICovCisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgU0NBTl9SRVNVTFRTX0VWRU5UOgorICAgICAgICAgICAgICAgICAgICAvKiBTZXQgdGhlIHNjYW4gc2V0dGluZyBiYWNrIHRvICJjb25uZWN0IiBtb2RlICovCisgICAgICAgICAgICAgICAgICAgIFdpZmlOYXRpdmUuc2V0U2NhblJlc3VsdEhhbmRsaW5nQ29tbWFuZChDT05ORUNUX01PREUpOworICAgICAgICAgICAgICAgICAgICAvKiBIYW5kbGUgc2NhbiByZXN1bHRzICovCisgICAgICAgICAgICAgICAgICAgIHJldHVybiBOT1RfSEFORExFRDsKKyAgICAgICAgICAgICAgICBjYXNlIE5FVFdPUktfQ09OTkVDVElPTl9FVkVOVDoKKyAgICAgICAgICAgICAgICAgICAgTG9nLmQoVEFHLCJOZXR3b3JrIGNvbm5lY3Rpb24gZXN0YWJsaXNoZWQiKTsKKyAgICAgICAgICAgICAgICAgICAgc3RhdGVDaGFuZ2VSZXN1bHQgPSAoU3RhdGVDaGFuZ2VSZXN1bHQpIG1lc3NhZ2Uub2JqOworCisgICAgICAgICAgICAgICAgICAgIC8vVE9ETzogbWFrZSBzdXBwbGljYW50IG1vZGlmaWNhdGlvbiB0byBwdXNoIHRoaXMgaW4gZXZlbnRzCisgICAgICAgICAgICAgICAgICAgIG1XaWZpSW5mby5zZXRTU0lEKGZldGNoU1NJRCgpKTsKKyAgICAgICAgICAgICAgICAgICAgbVdpZmlJbmZvLnNldEJTU0lEKG1MYXN0QnNzaWQgPSBzdGF0ZUNoYW5nZVJlc3VsdC5CU1NJRCk7CisgICAgICAgICAgICAgICAgICAgIG1XaWZpSW5mby5zZXROZXR3b3JrSWQoc3RhdGVDaGFuZ2VSZXN1bHQubmV0d29ya0lkKTsKKyAgICAgICAgICAgICAgICAgICAgbUxhc3ROZXR3b3JrSWQgPSBzdGF0ZUNoYW5nZVJlc3VsdC5uZXR3b3JrSWQ7CisgICAgICAgICAgICAgICAgICAgIGVuYWJsZUFsbE5ldHdvcmtzKCk7CisgICAgICAgICAgICAgICAgICAgIC8qIHNlbmQgZXZlbnQgdG8gQ00gJiBuZXR3b3JrIGNoYW5nZSBicm9hZGNhc3QgKi8KKyAgICAgICAgICAgICAgICAgICAgc2V0RGV0YWlsZWRTdGF0ZShEZXRhaWxlZFN0YXRlLk9CVEFJTklOR19JUEFERFIpOworICAgICAgICAgICAgICAgICAgICBzZW5kTmV0d29ya1N0YXRlQ2hhbmdlQnJvYWRjYXN0KG1MYXN0QnNzaWQpOworCisgICAgICAgICAgICAgICAgICAgIHRyYW5zaXRpb25UbyhtQ29ubmVjdGluZ1N0YXRlKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBORVRXT1JLX0RJU0NPTk5FQ1RJT05fRVZFTlQ6CisgICAgICAgICAgICAgICAgICAgIExvZy5kKFRBRywiTmV0d29yayBjb25uZWN0aW9uIGxvc3QiKTsKKyAgICAgICAgICAgICAgICAgICAgZW5hYmxlQWxsTmV0d29ya3MoKTsKKyAgICAgICAgICAgICAgICAgICAgaGFuZGxlTmV0d29ya0Rpc2Nvbm5lY3QoKTsKKyAgICAgICAgICAgICAgICAgICAgdHJhbnNpdGlvblRvKG1EaXNjb25uZWN0ZWRTdGF0ZSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgQ01EX0dFVF9SU1NJOgorICAgICAgICAgICAgICAgICAgICBzeW5jUGFyYW1zID0gKFN5bmNQYXJhbXMpIG1lc3NhZ2Uub2JqOworICAgICAgICAgICAgICAgICAgICBzeW5jUGFyYW1zLm1TeW5jUmV0dXJuLmludFZhbHVlID0gV2lmaU5hdGl2ZS5nZXRSc3NpQ29tbWFuZCgpOworICAgICAgICAgICAgICAgICAgICBub3RpZnlPbk1zZ09iamVjdChtZXNzYWdlKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBDTURfR0VUX1JTU0lfQVBQUk9YOgorICAgICAgICAgICAgICAgICAgICBzeW5jUGFyYW1zID0gKFN5bmNQYXJhbXMpIG1lc3NhZ2Uub2JqOworICAgICAgICAgICAgICAgICAgICBzeW5jUGFyYW1zLm1TeW5jUmV0dXJuLmludFZhbHVlID0gV2lmaU5hdGl2ZS5nZXRSc3NpQXBwcm94Q29tbWFuZCgpOworICAgICAgICAgICAgICAgICAgICBub3RpZnlPbk1zZ09iamVjdChtZXNzYWdlKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBDTURfR0VUX0xJTktfU1BFRUQ6CisgICAgICAgICAgICAgICAgICAgIHN5bmNQYXJhbXMgPSAoU3luY1BhcmFtcykgbWVzc2FnZS5vYmo7CisgICAgICAgICAgICAgICAgICAgIHN5bmNQYXJhbXMubVN5bmNSZXR1cm4uaW50VmFsdWUgPSBXaWZpTmF0aXZlLmdldExpbmtTcGVlZENvbW1hbmQoKTsKKyAgICAgICAgICAgICAgICAgICAgbm90aWZ5T25Nc2dPYmplY3QobWVzc2FnZSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBOT1RfSEFORExFRDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIEV2ZW50TG9nLndyaXRlRXZlbnQoRVZFTlRMT0dfV0lGSV9FVkVOVF9IQU5ETEVELCBtZXNzYWdlLndoYXQpOworICAgICAgICAgICAgcmV0dXJuIEhBTkRMRUQ7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBjbGFzcyBDb25uZWN0aW5nU3RhdGUgZXh0ZW5kcyBIaWVyYXJjaGljYWxTdGF0ZSB7CisgICAgICAgIGJvb2xlYW4gbW9kaWZpZWRCbHVldG9vdGhDb2V4aXN0ZW5jZU1vZGU7CisgICAgICAgIGludCBwb3dlck1vZGU7CisgICAgICAgIFRocmVhZCBtRGhjcFRocmVhZDsKKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIHZvaWQgZW50ZXIoKSB7CisgICAgICAgICAgICBpZiAoREJHKSBMb2cuZChUQUcsIGdldE5hbWUoKSArICJcbiIpOworICAgICAgICAgICAgRXZlbnRMb2cud3JpdGVFdmVudChFVkVOVExPR19XSUZJX1NUQVRFX0NIQU5HRUQsIGdldE5hbWUoKSk7CisKKyAgICAgICAgICAgIGlmICghbVVzZVN0YXRpY0lwKSB7CisKKyAgICAgICAgICAgICAgICBtRGhjcFRocmVhZCA9IG51bGw7CisgICAgICAgICAgICAgICAgbW9kaWZpZWRCbHVldG9vdGhDb2V4aXN0ZW5jZU1vZGUgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICBwb3dlck1vZGUgPSBEUklWRVJfUE9XRVJfTU9ERV9BVVRPOworCisgICAgICAgICAgICAgICAgaWYgKHNob3VsZERpc2FibGVDb2V4aXN0ZW5jZU1vZGUoKSkgeworICAgICAgICAgICAgICAgICAgICAvKgorICAgICAgICAgICAgICAgICAgICAgKiBUaGVyZSBhcmUgcHJvYmxlbXMgc2V0dGluZyB0aGUgV2ktRmkgZHJpdmVyJ3MgcG93ZXIKKyAgICAgICAgICAgICAgICAgICAgICogbW9kZSB0byBhY3RpdmUgd2hlbiBibHVldG9vdGggY29leGlzdGVuY2UgbW9kZSBpcworICAgICAgICAgICAgICAgICAgICAgKiBlbmFibGVkIG9yIHNlbnNlLgorICAgICAgICAgICAgICAgICAgICAgKiA8cD4KKyAgICAgICAgICAgICAgICAgICAgICogV2Ugc2V0IFdpLUZpIHRvIGFjdGl2ZSBtb2RlIHdoZW4KKyAgICAgICAgICAgICAgICAgICAgICogb2J0YWluaW5nIGFuIElQIGFkZHJlc3MgYmVjYXVzZSB3ZSd2ZSBmb3VuZAorICAgICAgICAgICAgICAgICAgICAgKiBjb21wYXRpYmlsaXR5IGlzc3VlcyB3aXRoIHNvbWUgcm91dGVycyB3aXRoIGxvdyBwb3dlcgorICAgICAgICAgICAgICAgICAgICAgKiBtb2RlLgorICAgICAgICAgICAgICAgICAgICAgKiA8cD4KKyAgICAgICAgICAgICAgICAgICAgICogSW4gb3JkZXIgZm9yIHRoaXMgYWN0aXZlIHBvd2VyIG1vZGUgdG8gcHJvcGVybHkgYmUgc2V0LAorICAgICAgICAgICAgICAgICAgICAgKiB3ZSBkaXNhYmxlIGNvZXhpc3RlbmNlIG1vZGUgdW50aWwgd2UncmUgZG9uZSB3aXRoCisgICAgICAgICAgICAgICAgICAgICAqIG9idGFpbmluZyBhbiBJUCBhZGRyZXNzLiAgT25lIGV4Y2VwdGlvbiBpcyBpZiB3ZQorICAgICAgICAgICAgICAgICAgICAgKiBhcmUgY3VycmVudGx5IGNvbm5lY3RlZCB0byBhIGhlYWRzZXQsIHNpbmNlIGRpc2FibGluZworICAgICAgICAgICAgICAgICAgICAgKiBjb2V4aXN0ZW5jZSB3b3VsZCBpbnRlcnJ1cHQgdGhhdCBjb25uZWN0aW9uLgorICAgICAgICAgICAgICAgICAgICAgKi8KKyAgICAgICAgICAgICAgICAgICAgbW9kaWZpZWRCbHVldG9vdGhDb2V4aXN0ZW5jZU1vZGUgPSB0cnVlOworCisgICAgICAgICAgICAgICAgICAgIC8vIERpc2FibGUgdGhlIGNvZXhpc3RlbmNlIG1vZGUKKyAgICAgICAgICAgICAgICAgICAgV2lmaU5hdGl2ZS5zZXRCbHVldG9vdGhDb2V4aXN0ZW5jZU1vZGVDb21tYW5kKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIFdpZmlOYXRpdmUuQkxVRVRPT1RIX0NPRVhJU1RFTkNFX01PREVfRElTQUJMRUQpOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIHBvd2VyTW9kZSA9ICBXaWZpTmF0aXZlLmdldFBvd2VyTW9kZUNvbW1hbmQoKTsKKyAgICAgICAgICAgICAgICBpZiAocG93ZXJNb2RlIDwgMCkgeworICAgICAgICAgICAgICAgICAgLy8gSGFuZGxlIHRoZSBjYXNlIHdoZXJlIHN1cHBsaWNhbnQgZHJpdmVyIGRvZXMgbm90IHN1cHBvcnQKKyAgICAgICAgICAgICAgICAgIC8vIGdldFBvd2VyTW9kZUNvbW1hbmQuCisgICAgICAgICAgICAgICAgICAgIHBvd2VyTW9kZSA9IERSSVZFUl9QT1dFUl9NT0RFX0FVVE87CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGlmIChwb3dlck1vZGUgIT0gRFJJVkVSX1BPV0VSX01PREVfQUNUSVZFKSB7CisgICAgICAgICAgICAgICAgICAgIFdpZmlOYXRpdmUuc2V0UG93ZXJNb2RlQ29tbWFuZChEUklWRVJfUE9XRVJfTU9ERV9BQ1RJVkUpOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIExvZy5kKFRBRywgIkRIQ1AgcmVxdWVzdCBzdGFydGVkIik7CisgICAgICAgICAgICAgICAgbURoY3BUaHJlYWQgPSBuZXcgVGhyZWFkKG5ldyBSdW5uYWJsZSgpIHsKKyAgICAgICAgICAgICAgICAgICAgcHVibGljIHZvaWQgcnVuKCkgeworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKE5ldHdvcmtVdGlscy5ydW5EaGNwKG1JbnRlcmZhY2VOYW1lLCBtRGhjcEluZm8pKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgTG9nLmQoVEFHLCAiREhDUCByZXF1ZXN0IHN1Y2NlZWRlZCIpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbmRNZXNzYWdlKENNRF9JUF9DT05GSUdfU1VDQ0VTUyk7CisgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIExvZy5kKFRBRywgIkRIQ1AgcmVxdWVzdCBmYWlsZWQ6ICIgKworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTmV0d29ya1V0aWxzLmdldERoY3BFcnJvcigpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZW5kTWVzc2FnZShDTURfSVBfQ09ORklHX0ZBSUxVUkUpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfSk7CisgICAgICAgICAgICAgICAgbURoY3BUaHJlYWQuc3RhcnQoKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgaWYgKE5ldHdvcmtVdGlscy5jb25maWd1cmVJbnRlcmZhY2UobUludGVyZmFjZU5hbWUsIG1EaGNwSW5mbykpIHsKKyAgICAgICAgICAgICAgICAgICAgTG9nLnYoVEFHLCAiU3RhdGljIElQIGNvbmZpZ3VyYXRpb24gc3VjY2VlZGVkIik7CisgICAgICAgICAgICAgICAgICAgIHNlbmRNZXNzYWdlKENNRF9JUF9DT05GSUdfU1VDQ0VTUyk7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgTG9nLnYoVEFHLCAiU3RhdGljIElQIGNvbmZpZ3VyYXRpb24gZmFpbGVkIik7CisgICAgICAgICAgICAgICAgICAgIHNlbmRNZXNzYWdlKENNRF9JUF9DT05GSUdfRkFJTFVSRSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgfQorICAgICAgQE92ZXJyaWRlCisgICAgICBwdWJsaWMgYm9vbGVhbiBwcm9jZXNzTWVzc2FnZShNZXNzYWdlIG1lc3NhZ2UpIHsKKyAgICAgICAgICBpZiAoREJHKSBMb2cuZChUQUcsIGdldE5hbWUoKSArIG1lc3NhZ2UudG9TdHJpbmcoKSArICJcbiIpOworCisgICAgICAgICAgc3dpdGNoKG1lc3NhZ2Uud2hhdCkgeworICAgICAgICAgICAgICBjYXNlIENNRF9JUF9DT05GSUdfU1VDQ0VTUzoKKyAgICAgICAgICAgICAgICAgIG1SZWNvbm5lY3RDb3VudCA9IDA7CisgICAgICAgICAgICAgICAgICBtTGFzdFNpZ25hbExldmVsID0gLTE7IC8vIGZvcmNlIHVwZGF0ZSBvZiBzaWduYWwgc3RyZW5ndGgKKyAgICAgICAgICAgICAgICAgIG1XaWZpSW5mby5zZXRJcEFkZHJlc3MobURoY3BJbmZvLmlwQWRkcmVzcyk7CisgICAgICAgICAgICAgICAgICBMb2cuZChUQUcsICJJUCBjb25maWd1cmF0aW9uOiAiICsgbURoY3BJbmZvKTsKKyAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyZU5ldHdvcmtQcm9wZXJ0aWVzKCk7CisgICAgICAgICAgICAgICAgICBzZXREZXRhaWxlZFN0YXRlKERldGFpbGVkU3RhdGUuQ09OTkVDVEVEKTsKKyAgICAgICAgICAgICAgICAgIHNlbmROZXR3b3JrU3RhdGVDaGFuZ2VCcm9hZGNhc3QobUxhc3RCc3NpZCk7CisgICAgICAgICAgICAgICAgICAvL1RPRE86IHdlIGNvdWxkIGFsc28gZGV0ZWN0IGFuIElQIGNvbmZpZyBjaGFuZ2UKKyAgICAgICAgICAgICAgICAgIC8vIGZyb20gYSBESENQIHJlbmV3YWwgYW5kIHNlbmQgb3V0IGEgY29uZmlnIGNoYW5nZQorICAgICAgICAgICAgICAgICAgLy8gYnJvYWRjYXN0CisgICAgICAgICAgICAgICAgICBpZiAobUNvbmZpZ0NoYW5nZWQpIHsKKyAgICAgICAgICAgICAgICAgICAgICBzZW5kQ29uZmlnQ2hhbmdlQnJvYWRjYXN0KCk7CisgICAgICAgICAgICAgICAgICAgICAgbUNvbmZpZ0NoYW5nZWQgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgIHRyYW5zaXRpb25UbyhtQ29ubmVjdGVkU3RhdGUpOworICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgIGNhc2UgQ01EX0lQX0NPTkZJR19GQUlMVVJFOgorICAgICAgICAgICAgICAgICAgbVdpZmlJbmZvLnNldElwQWRkcmVzcygwKTsKKworICAgICAgICAgICAgICAgICAgTG9nLmUoVEFHLCAiSVAgY29uZmlndXJhdGlvbiBmYWlsZWQiKTsKKyAgICAgICAgICAgICAgICAgIC8qKgorICAgICAgICAgICAgICAgICAgICogSWYgd2UndmUgZXhjZWVkZWQgdGhlIG1heGltdW0gbnVtYmVyIG9mIHJldHJpZXMgZm9yIERIQ1AKKyAgICAgICAgICAgICAgICAgICAqIHRvIGEgZ2l2ZW4gbmV0d29yaywgZGlzYWJsZSB0aGUgbmV0d29yaworICAgICAgICAgICAgICAgICAgICovCisgICAgICAgICAgICAgICAgICBpZiAoKyttUmVjb25uZWN0Q291bnQgPiBnZXRNYXhEaGNwUmV0cmllcygpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgIExvZy5lKFRBRywgIkZhaWxlZCAiICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtUmVjb25uZWN0Q291bnQgKyAiIHRpbWVzLCBEaXNhYmxpbmcgIiArIG1MYXN0TmV0d29ya0lkKTsKKyAgICAgICAgICAgICAgICAgICAgICBXaWZpTmF0aXZlLmRpc2FibGVOZXR3b3JrQ29tbWFuZChtTGFzdE5ldHdvcmtJZCk7CisgICAgICAgICAgICAgICAgICAgICAgc2VuZFN1cHBsaWNhbnRDb25maWdDaGFuZ2VkQnJvYWRjYXN0KCk7CisgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgIC8qIERIQ1AgdGltZXMgb3V0IGFmdGVyIGFib3V0IDMwIHNlY29uZHMsIHdlIGRvIGEKKyAgICAgICAgICAgICAgICAgICAqIGRpc2Nvbm5lY3QgYW5kIGFuIGltbWVkaWF0ZSByZWNvbm5lY3QgdG8gdHJ5IGFnYWluCisgICAgICAgICAgICAgICAgICAgKi8KKyAgICAgICAgICAgICAgICAgIFdpZmlOYXRpdmUuZGlzY29ubmVjdENvbW1hbmQoKTsKKyAgICAgICAgICAgICAgICAgIFdpZmlOYXRpdmUucmVjb25uZWN0Q29tbWFuZCgpOworICAgICAgICAgICAgICAgICAgdHJhbnNpdGlvblRvKG1EaXNjb25uZWN0aW5nU3RhdGUpOworICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgIGNhc2UgQ01EX0RJU0NPTk5FQ1Q6CisgICAgICAgICAgICAgICAgICBXaWZpTmF0aXZlLmRpc2Nvbm5lY3RDb21tYW5kKCk7CisgICAgICAgICAgICAgICAgICB0cmFuc2l0aW9uVG8obURpc2Nvbm5lY3RpbmdTdGF0ZSk7CisgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgIC8qIElnbm9yZSAqLworICAgICAgICAgICAgICBjYXNlIE5FVFdPUktfQ09OTkVDVElPTl9FVkVOVDoKKyAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICBjYXNlIENNRF9TVE9QX0RSSVZFUjoKKyAgICAgICAgICAgICAgICAgIHNlbmRNZXNzYWdlKENNRF9ESVNDT05ORUNUKTsKKyAgICAgICAgICAgICAgICAgIGRlZmVyTWVzc2FnZShtZXNzYWdlKTsKKyAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICBjYXNlIENNRF9TRVRfU0NBTl9NT0RFOgorICAgICAgICAgICAgICAgICAgaWYgKG1lc3NhZ2UuYXJnMSA9PSBTQ0FOX09OTFlfTU9ERSkgeworICAgICAgICAgICAgICAgICAgICAgIHNlbmRNZXNzYWdlKENNRF9ESVNDT05ORUNUKTsKKyAgICAgICAgICAgICAgICAgICAgICBkZWZlck1lc3NhZ2UobWVzc2FnZSk7CisgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgY2FzZSBDTURfUkVDT05GSUdVUkVfSVA6CisgICAgICAgICAgICAgICAgICBkZWZlck1lc3NhZ2UobWVzc2FnZSk7CisgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICByZXR1cm4gTk9UX0hBTkRMRUQ7CisgICAgICAgICAgfQorICAgICAgICAgIEV2ZW50TG9nLndyaXRlRXZlbnQoRVZFTlRMT0dfV0lGSV9FVkVOVF9IQU5ETEVELCBtZXNzYWdlLndoYXQpOworICAgICAgICAgIHJldHVybiBIQU5ETEVEOworICAgICAgfQorCisgICAgICBAT3ZlcnJpZGUKKyAgICAgIHB1YmxpYyB2b2lkIGV4aXQoKSB7CisgICAgICAgICAgLyogcmVzZXQgcG93ZXIgc3RhdGUgJiBibHVldG9vdGggY29leGlzdGVuY2UgaWYgb24gREhDUCAqLworICAgICAgICAgIGlmICghbVVzZVN0YXRpY0lwKSB7CisgICAgICAgICAgICAgIGlmIChwb3dlck1vZGUgIT0gRFJJVkVSX1BPV0VSX01PREVfQUNUSVZFKSB7CisgICAgICAgICAgICAgICAgICBXaWZpTmF0aXZlLnNldFBvd2VyTW9kZUNvbW1hbmQocG93ZXJNb2RlKTsKKyAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgIGlmIChtb2RpZmllZEJsdWV0b290aENvZXhpc3RlbmNlTW9kZSkgeworICAgICAgICAgICAgICAgICAgLy8gU2V0IHRoZSBjb2V4aXN0ZW5jZSBtb2RlIGJhY2sgdG8gaXRzIGRlZmF1bHQgdmFsdWUKKyAgICAgICAgICAgICAgICAgIFdpZmlOYXRpdmUuc2V0Qmx1ZXRvb3RoQ29leGlzdGVuY2VNb2RlQ29tbWFuZCgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgV2lmaU5hdGl2ZS5CTFVFVE9PVEhfQ09FWElTVEVOQ0VfTU9ERV9TRU5TRSk7CisgICAgICAgICAgICAgIH0KKyAgICAgICAgICB9CisKKyAgICAgIH0KKyAgICB9CisKKyAgICBjbGFzcyBDb25uZWN0ZWRTdGF0ZSBleHRlbmRzIEhpZXJhcmNoaWNhbFN0YXRlIHsKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyB2b2lkIGVudGVyKCkgeworICAgICAgICAgICAgaWYgKERCRykgTG9nLmQoVEFHLCBnZXROYW1lKCkgKyAiXG4iKTsKKyAgICAgICAgICAgIEV2ZW50TG9nLndyaXRlRXZlbnQoRVZFTlRMT0dfV0lGSV9TVEFURV9DSEFOR0VELCBnZXROYW1lKCkpOworICAgICAgICB9CisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgYm9vbGVhbiBwcm9jZXNzTWVzc2FnZShNZXNzYWdlIG1lc3NhZ2UpIHsKKyAgICAgICAgICAgIGlmIChEQkcpIExvZy5kKFRBRywgZ2V0TmFtZSgpICsgbWVzc2FnZS50b1N0cmluZygpICsgIlxuIik7CisgICAgICAgICAgICBzd2l0Y2ggKG1lc3NhZ2Uud2hhdCkgeworICAgICAgICAgICAgICAgIGNhc2UgQ01EX0RJU0NPTk5FQ1Q6CisgICAgICAgICAgICAgICAgICAgIFdpZmlOYXRpdmUuZGlzY29ubmVjdENvbW1hbmQoKTsKKyAgICAgICAgICAgICAgICAgICAgdHJhbnNpdGlvblRvKG1EaXNjb25uZWN0aW5nU3RhdGUpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9SRUNPTkZJR1VSRV9JUDoKKyAgICAgICAgICAgICAgICAgICAgTG9nLmQoVEFHLCJSZWNvbmZpZ3VyaW5nIElQIG9uIGNvbm5lY3Rpb24iKTsKKyAgICAgICAgICAgICAgICAgICAgTmV0d29ya1V0aWxzLnJlc2V0Q29ubmVjdGlvbnMobUludGVyZmFjZU5hbWUpOworICAgICAgICAgICAgICAgICAgICB0cmFuc2l0aW9uVG8obUNvbm5lY3RpbmdTdGF0ZSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NUT1BfRFJJVkVSOgorICAgICAgICAgICAgICAgICAgICBzZW5kTWVzc2FnZShDTURfRElTQ09OTkVDVCk7CisgICAgICAgICAgICAgICAgICAgIGRlZmVyTWVzc2FnZShtZXNzYWdlKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU0VUX1NDQU5fTU9ERToKKyAgICAgICAgICAgICAgICAgICAgaWYgKG1lc3NhZ2UuYXJnMSA9PSBTQ0FOX09OTFlfTU9ERSkgeworICAgICAgICAgICAgICAgICAgICAgICAgc2VuZE1lc3NhZ2UoQ01EX0RJU0NPTk5FQ1QpOworICAgICAgICAgICAgICAgICAgICAgICAgZGVmZXJNZXNzYWdlKG1lc3NhZ2UpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICAvKiBJZ25vcmUgKi8KKyAgICAgICAgICAgICAgICBjYXNlIE5FVFdPUktfQ09OTkVDVElPTl9FVkVOVDoKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE5PVF9IQU5ETEVEOworICAgICAgICAgICAgfQorICAgICAgICAgICAgRXZlbnRMb2cud3JpdGVFdmVudChFVkVOVExPR19XSUZJX0VWRU5UX0hBTkRMRUQsIG1lc3NhZ2Uud2hhdCk7CisgICAgICAgICAgICByZXR1cm4gSEFORExFRDsKKyAgICAgICAgfQorICAgIH0KKworICAgIGNsYXNzIERpc2Nvbm5lY3RpbmdTdGF0ZSBleHRlbmRzIEhpZXJhcmNoaWNhbFN0YXRlIHsKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyB2b2lkIGVudGVyKCkgeworICAgICAgICAgICAgaWYgKERCRykgTG9nLmQoVEFHLCBnZXROYW1lKCkgKyAiXG4iKTsKKyAgICAgICAgICAgIEV2ZW50TG9nLndyaXRlRXZlbnQoRVZFTlRMT0dfV0lGSV9TVEFURV9DSEFOR0VELCBnZXROYW1lKCkpOworICAgICAgICB9CisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgYm9vbGVhbiBwcm9jZXNzTWVzc2FnZShNZXNzYWdlIG1lc3NhZ2UpIHsKKyAgICAgICAgICAgIGlmIChEQkcpIExvZy5kKFRBRywgZ2V0TmFtZSgpICsgbWVzc2FnZS50b1N0cmluZygpICsgIlxuIik7CisgICAgICAgICAgICBzd2l0Y2ggKG1lc3NhZ2Uud2hhdCkgeworICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NUT1BfRFJJVkVSOiAvKiBTdG9wIGRyaXZlciBvbmx5IGFmdGVyIGRpc2Nvbm5lY3QgaGFuZGxlZCAqLworICAgICAgICAgICAgICAgICAgICBkZWZlck1lc3NhZ2UobWVzc2FnZSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NFVF9TQ0FOX01PREU6CisgICAgICAgICAgICAgICAgICAgIGlmIChtZXNzYWdlLmFyZzEgPT0gU0NBTl9PTkxZX01PREUpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGRlZmVyTWVzc2FnZShtZXNzYWdlKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgICAgICByZXR1cm4gTk9UX0hBTkRMRUQ7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBFdmVudExvZy53cml0ZUV2ZW50KEVWRU5UTE9HX1dJRklfRVZFTlRfSEFORExFRCwgbWVzc2FnZS53aGF0KTsKKyAgICAgICAgICAgIHJldHVybiBIQU5ETEVEOworICAgICAgICB9CisgICAgfQorCisgICAgY2xhc3MgRGlzY29ubmVjdGVkU3RhdGUgZXh0ZW5kcyBIaWVyYXJjaGljYWxTdGF0ZSB7CisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgdm9pZCBlbnRlcigpIHsKKyAgICAgICAgICAgIGlmIChEQkcpIExvZy5kKFRBRywgZ2V0TmFtZSgpICsgIlxuIik7CisgICAgICAgICAgICBFdmVudExvZy53cml0ZUV2ZW50KEVWRU5UTE9HX1dJRklfU1RBVEVfQ0hBTkdFRCwgZ2V0TmFtZSgpKTsKKyAgICAgICAgfQorICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIGJvb2xlYW4gcHJvY2Vzc01lc3NhZ2UoTWVzc2FnZSBtZXNzYWdlKSB7CisgICAgICAgICAgICBpZiAoREJHKSBMb2cuZChUQUcsIGdldE5hbWUoKSArIG1lc3NhZ2UudG9TdHJpbmcoKSArICJcbiIpOworICAgICAgICAgICAgc3dpdGNoIChtZXNzYWdlLndoYXQpIHsKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TRVRfU0NBTl9NT0RFOgorICAgICAgICAgICAgICAgICAgICBpZiAobWVzc2FnZS5hcmcxID09IFNDQU5fT05MWV9NT0RFKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBXaWZpTmF0aXZlLnNldFNjYW5SZXN1bHRIYW5kbGluZ0NvbW1hbmQobWVzc2FnZS5hcmcxKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vU3VwcGxpY2FudCBkaXNjb25uZWN0IHRvIHByZXZlbnQgZnVydGhlciBjb25uZWN0cworICAgICAgICAgICAgICAgICAgICAgICAgV2lmaU5hdGl2ZS5kaXNjb25uZWN0Q29tbWFuZCgpOworICAgICAgICAgICAgICAgICAgICAgICAgbUlzU2Nhbk1vZGUgPSB0cnVlOworICAgICAgICAgICAgICAgICAgICAgICAgdHJhbnNpdGlvblRvKG1TY2FuTW9kZVN0YXRlKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgLyogSWdub3JlIG5ldHdvcmsgZGlzY29ubmVjdCAqLworICAgICAgICAgICAgICAgIGNhc2UgTkVUV09SS19ESVNDT05ORUNUSU9OX0VWRU5UOgorICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgICAgICByZXR1cm4gTk9UX0hBTkRMRUQ7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBFdmVudExvZy53cml0ZUV2ZW50KEVWRU5UTE9HX1dJRklfRVZFTlRfSEFORExFRCwgbWVzc2FnZS53aGF0KTsKKyAgICAgICAgICAgIHJldHVybiBIQU5ETEVEOworICAgICAgICB9CisgICAgfQorCisgICAgY2xhc3MgU29mdEFwU3RhcnRlZFN0YXRlIGV4dGVuZHMgSGllcmFyY2hpY2FsU3RhdGUgeworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIHZvaWQgZW50ZXIoKSB7CisgICAgICAgICAgICBpZiAoREJHKSBMb2cuZChUQUcsIGdldE5hbWUoKSArICJcbiIpOworICAgICAgICAgICAgRXZlbnRMb2cud3JpdGVFdmVudChFVkVOVExPR19XSUZJX1NUQVRFX0NIQU5HRUQsIGdldE5hbWUoKSk7CisgICAgICAgIH0KKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyBib29sZWFuIHByb2Nlc3NNZXNzYWdlKE1lc3NhZ2UgbWVzc2FnZSkgeworICAgICAgICAgICAgaWYgKERCRykgTG9nLmQoVEFHLCBnZXROYW1lKCkgKyBtZXNzYWdlLnRvU3RyaW5nKCkgKyAiXG4iKTsKKyAgICAgICAgICAgIHN3aXRjaChtZXNzYWdlLndoYXQpIHsKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TVE9QX0FQOgorICAgICAgICAgICAgICAgICAgICBMb2cuZChUQUcsIlN0b3BwaW5nIFNvZnQgQVAiKTsKKyAgICAgICAgICAgICAgICAgICAgc2V0V2lmaUFwU3RhdGUoV0lGSV9BUF9TVEFURV9ESVNBQkxJTkcpOworICAgICAgICAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgICAgICAgICAgbndTZXJ2aWNlLnN0b3BBY2Nlc3NQb2ludCgpOworICAgICAgICAgICAgICAgICAgICB9IGNhdGNoKEV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBMb2cuZShUQUcsICJFeGNlcHRpb24gaW4gc3RvcEFjY2Vzc1BvaW50KCkiKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB0cmFuc2l0aW9uVG8obURyaXZlckxvYWRlZFN0YXRlKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU1RBUlRfQVA6CisgICAgICAgICAgICAgICAgICAgIExvZy5kKFRBRywiU29mdEFQIHNldCBvbiBhIHJ1bm5pbmcgYWNjZXNzIHBvaW50Iik7CisgICAgICAgICAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgICAgICAgICBud1NlcnZpY2Uuc2V0QWNjZXNzUG9pbnQoKFdpZmlDb25maWd1cmF0aW9uKSBtZXNzYWdlLm9iaiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1JbnRlcmZhY2VOYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgU09GVEFQX0lGQUNFKTsKKyAgICAgICAgICAgICAgICAgICAgfSBjYXRjaChFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgICAgICAgICAgTG9nLmUoVEFHLCAiRXhjZXB0aW9uIGluIG53U2VydmljZSBkdXJpbmcgc29mdCBBUCBzZXQiKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbndTZXJ2aWNlLnN0b3BBY2Nlc3NQb2ludCgpOworICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoRXhjZXB0aW9uIGVlKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgU2xvZy5lKFRBRywgIkNvdWxkIG5vdCBzdG9wIEFQLCA6IiArIGVlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIHNlbmRNZXNzYWdlKG9idGFpbk1lc3NhZ2UoQ01EX1VOTE9BRF9EUklWRVIsIFdJRklfQVBfU1RBVEVfRkFJTEVELCAwKSk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgLyogRmFpbCBjbGllbnQgbW9kZSBvcGVyYXRpb24gd2hlbiBzb2Z0IEFQIGlzIGVuYWJsZWQgKi8KKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TVEFSVF9TVVBQTElDQU5UOgorICAgICAgICAgICAgICAgICAgICBMb2cuZShUQUcsIkNhbm5vdCBzdGFydCBzdXBwbGljYW50IHdpdGggYSBydW5uaW5nIHNvZnQgQVAiKTsKKyAgICAgICAgICAgICAgICAgICAgc2V0V2lmaVN0YXRlKFdJRklfU1RBVEVfVU5LTk9XTik7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBOT1RfSEFORExFRDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIEV2ZW50TG9nLndyaXRlRXZlbnQoRVZFTlRMT0dfV0lGSV9FVkVOVF9IQU5ETEVELCBtZXNzYWdlLndoYXQpOworICAgICAgICAgICAgcmV0dXJuIEhBTkRMRUQ7CisgICAgICAgIH0KKyAgICB9CisKKworICAgIGNsYXNzIFN1cHBsaWNhbnRTdGF0ZVRyYWNrZXIgZXh0ZW5kcyBIaWVyYXJjaGljYWxTdGF0ZU1hY2hpbmUgeworCisgICAgICAgIHByaXZhdGUgaW50IG1Sc3NpUG9sbFRva2VuID0gMDsKKworICAgICAgICAvKioKKyAgICAgICAgICogVGhlIG1heCBudW1iZXIgb2YgdGhlIFdQQSBzdXBwbGljYW50IGxvb3AgaXRlcmF0aW9ucyBiZWZvcmUgd2UKKyAgICAgICAgICogZGVjaWRlIHRoYXQgdGhlIGxvb3Agc2hvdWxkIGJlIHRlcm1pbmF0ZWQ6CisgICAgICAgICAqLworICAgICAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgTUFYX1NVUFBMSUNBTlRfTE9PUF9JVEVSQVRJT05TID0gNDsKKyAgICAgICAgcHJpdmF0ZSBpbnQgbUxvb3BEZXRlY3RJbmRleCA9IDA7CisgICAgICAgIHByaXZhdGUgaW50IG1Mb29wRGV0ZWN0Q291bnQgPSAwOworCisgICAgICAgIC8qKgorICAgICAgICAgKiAgU3VwcGxpY2FudCBzdGF0ZSBjaGFuZ2UgY29tbWFuZHMgZm9sbG93CisgICAgICAgICAqICB0aGUgb3JkaW5hbCB2YWx1ZXMgZGVmaW5lZCBpbiBTdXBwbGljYW50U3RhdGUuamF2YQorICAgICAgICAgKi8KKyAgICAgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IERJU0NPTk5FQ1RFRCAgICAgICAgICAgPSAwOworICAgICAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgSU5BQ1RJVkUgICAgICAgICAgICAgICA9IDE7CisgICAgICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBTQ0FOTklORyAgICAgICAgICAgICAgID0gMjsKKyAgICAgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IEFTU09DSUFUSU5HICAgICAgICAgICAgPSAzOworICAgICAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgQVNTT0NJQVRFRCAgICAgICAgICAgICA9IDQ7CisgICAgICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBGT1VSX1dBWV9IQU5EU0hBS0UgICAgID0gNTsKKyAgICAgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IEdST1VQX0hBTkRTSEFLRSAgICAgICAgPSA2OworICAgICAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgQ09NUExFVEVEICAgICAgICAgICAgICA9IDc7CisgICAgICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBET1JNQU5UICAgICAgICAgICAgICAgID0gODsKKyAgICAgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IFVOSU5JVElBTElaRUQgICAgICAgICAgPSA5OworICAgICAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgSU5WQUxJRCAgICAgICAgICAgICAgICA9IDEwOworCisgICAgICAgIHByaXZhdGUgSGllcmFyY2hpY2FsU3RhdGUgbVVuaW5pdGlhbGl6ZWRTdGF0ZSA9IG5ldyBVbmluaXRpYWxpemVkU3RhdGUoKTsKKyAgICAgICAgcHJpdmF0ZSBIaWVyYXJjaGljYWxTdGF0ZSBtSW5pdGlhbGl6ZWRTdGF0ZSA9I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jaGFuZ2VkIChjdXN0b218MXw1KQorICAgICAgICAgICAgRXZlbnRMb2cud3JpdGVFdmVudChFVkVOVExPR19TVVBQTElDQU5UX1NUQVRFX0NIQU5HRUQsIG5ld1N0YXRlLm9yZGluYWwoKSk7CisKKyAgICAgICAgICAgIHNlbmRNZXNzYWdlKG9idGFpbk1lc3NhZ2UobmV3U3RhdGUub3JkaW5hbCgpLCBzdGF0ZUNoYW5nZVJlc3VsdCkpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgcmVzZXRTdXBwbGljYW50U3RhdGUoKSB7CisgICAgICAgICAgICB0cmFuc2l0aW9uVG8obVVuaW5pdGlhbGl6ZWRTdGF0ZSk7CisgICAgICAgIH0KKworICAgICAgICBwcml2YXRlIHZvaWQgcmVzZXRMb29wRGV0ZWN0aW9uKCkgeworICAgICAgICAgICAgbUxvb3BEZXRlY3RDb3VudCA9IDA7CisgICAgICAgICAgICBtTG9vcERldGVjdEluZGV4ID0gMDsKKyAgICAgICAgfQorCisgICAgICAgIHByaXZhdGUgYm9vbGVhbiBoYW5kbGVUcmFuc2l0aW9uKE1lc3NhZ2UgbXNnKSB7CisgICAgICAgICAgICBpZiAoREJHKSBMb2cuZChUQUcsIGdldE5hbWUoKSArIG1zZy50b1N0cmluZygpICsgIlxuIik7CisgICAgICAgICAgICBzd2l0Y2ggKG1zZy53aGF0KSB7CisgICAgICAgICAgICAgICAgY2FzZSBESVNDT05ORUNURUQ6CisgICAgICAgICAgICAgICAgICAgIHRyYW5zaXRpb25UbyhtRGlzY29ubmVjdFN0YXRlKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBTQ0FOTklORzoKKyAgICAgICAgICAgICAgICAgICAgdHJhbnNpdGlvblRvKG1TY2FuU3RhdGUpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIEFTU09DSUFUSU5HOgorICAgICAgICAgICAgICAgICAgICBTdGF0ZUNoYW5nZVJlc3VsdCBzdGF0ZUNoYW5nZVJlc3VsdCA9IChTdGF0ZUNoYW5nZVJlc3VsdCkgbXNnLm9iajsKKyAgICAgICAgICAgICAgICAgICAgLyogQlNTSUQgaXMgdmFsaWQgb25seSBpbiBBU1NPQ0lBVElORyBzdGF0ZSAqLworICAgICAgICAgICAgICAgICAgICBtV2lmaUluZm8uc2V0QlNTSUQoc3RhdGVDaGFuZ2VSZXN1bHQuQlNTSUQpOworICAgICAgICAgICAgICAgICAgICAvLyRGQUxMLVRIUk9VR0gkCisgICAgICAgICAgICAgICAgY2FzZSBBU1NPQ0lBVEVEOgorICAgICAgICAgICAgICAgIGNhc2UgRk9VUl9XQVlfSEFORFNIQUtFOgorICAgICAgICAgICAgICAgIGNhc2UgR1JPVVBfSEFORFNIQUtFOgorICAgICAgICAgICAgICAgICAgICB0cmFuc2l0aW9uVG8obUhhbmRzaGFrZVN0YXRlKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBDT01QTEVURUQ6CisgICAgICAgICAgICAgICAgICAgIHRyYW5zaXRpb25UbyhtQ29tcGxldGVkU3RhdGUpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIERPUk1BTlQ6CisgICAgICAgICAgICAgICAgICAgIHRyYW5zaXRpb25UbyhtRG9ybWFudFN0YXRlKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBJTkFDVElWRToKKyAgICAgICAgICAgICAgICAgICAgdHJhbnNpdGlvblRvKG1JbmFjdGl2ZVN0YXRlKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBVTklOSVRJQUxJWkVEOgorICAgICAgICAgICAgICAgIGNhc2UgSU5WQUxJRDoKKyAgICAgICAgICAgICAgICAgICAgdHJhbnNpdGlvblRvKG1VbmluaXRpYWxpemVkU3RhdGUpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgICAgICByZXR1cm4gTk9UX0hBTkRMRUQ7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBTdGF0ZUNoYW5nZVJlc3VsdCBzdGF0ZUNoYW5nZVJlc3VsdCA9IChTdGF0ZUNoYW5nZVJlc3VsdCkgbXNnLm9iajsKKyAgICAgICAgICAgIFN1cHBsaWNhbnRTdGF0ZSBzdXBTdGF0ZSA9IChTdXBwbGljYW50U3RhdGUpIHN0YXRlQ2hhbmdlUmVzdWx0LnN0YXRlOworICAgICAgICAgICAgc2V0RGV0YWlsZWRTdGF0ZShXaWZpSW5mby5nZXREZXRhaWxlZFN0YXRlT2Yoc3VwU3RhdGUpKTsKKyAgICAgICAgICAgIG1XaWZpSW5mby5zZXRTdXBwbGljYW50U3RhdGUoc3VwU3RhdGUpOworICAgICAgICAgICAgbVdpZmlJbmZvLnNldE5ldHdvcmtJZChzdGF0ZUNoYW5nZVJlc3VsdC5uZXR3b3JrSWQpOworICAgICAgICAgICAgcmV0dXJuIEhBTkRMRUQ7CisgICAgICAgIH0KKworICAgICAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyAgICAgICAgICogSFNNIHN0YXRlcworICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworICAgICAgICBjbGFzcyBJbml0aWFsaXplZFN0YXRlIGV4dGVuZHMgSGllcmFyY2hpY2FsU3RhdGUgeworICAgICAgICAgICAgQE92ZXJyaWRlCisgICAgICAgICAgICAgcHVibGljIHZvaWQgZW50ZXIoKSB7CisgICAgICAgICAgICAgICAgIGlmIChEQkcpIExvZy5kKFRBRywgZ2V0TmFtZSgpICsgIlxuIik7CisgICAgICAgICAgICAgfQorICAgICAgICAgICAgQE92ZXJyaWRlCisgICAgICAgICAgICBwdWJsaWMgYm9vbGVhbiBwcm9jZXNzTWVzc2FnZShNZXNzYWdlIG1lc3NhZ2UpIHsKKyAgICAgICAgICAgICAgICBpZiAoREJHKSBMb2cuZChUQUcsIGdldE5hbWUoKSArIG1lc3NhZ2UudG9TdHJpbmcoKSArICJcbiIpOworICAgICAgICAgICAgICAgIHN3aXRjaCAobWVzc2FnZS53aGF0KSB7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NUQVJUX1NDQU46CisgICAgICAgICAgICAgICAgICAgICAgICBXaWZpTmF0aXZlLnNjYW5Db21tYW5kKG1lc3NhZ2UuYXJnMSA9PSBTQ0FOX0FDVElWRSk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChEQkcpIExvZy53KFRBRywgIklnbm9yaW5nICIgKyBtZXNzYWdlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICByZXR1cm4gSEFORExFRDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIGNsYXNzIFVuaW5pdGlhbGl6ZWRTdGF0ZSBleHRlbmRzIEhpZXJhcmNoaWNhbFN0YXRlIHsKKyAgICAgICAgICAgIEBPdmVycmlkZQorICAgICAgICAgICAgIHB1YmxpYyB2b2lkIGVudGVyKCkgeworICAgICAgICAgICAgICAgICBpZiAoREJHKSBMb2cuZChUQUcsIGdldE5hbWUoKSArICJcbiIpOworICAgICAgICAgICAgICAgICBtTmV0d29ya0luZm8uc2V0SXNBdmFpbGFibGUoZmFsc2UpOworICAgICAgICAgICAgICAgICByZXNldExvb3BEZXRlY3Rpb24oKTsKKyAgICAgICAgICAgICAgICAgbVBhc3N3b3JkS2V5TWF5QmVJbmNvcnJlY3QgPSBmYWxzZTsKKyAgICAgICAgICAgICB9CisgICAgICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgICAgIHB1YmxpYyBib29sZWFuIHByb2Nlc3NNZXNzYWdlKE1lc3NhZ2UgbWVzc2FnZSkgeworICAgICAgICAgICAgICAgIHN3aXRjaChtZXNzYWdlLndoYXQpIHsKKyAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmICghaGFuZGxlVHJhbnNpdGlvbihtZXNzYWdlKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChEQkcpIExvZy53KFRBRywgIklnbm9yaW5nICIgKyBtZXNzYWdlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICByZXR1cm4gSEFORExFRDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIEBPdmVycmlkZQorICAgICAgICAgICAgcHVibGljIHZvaWQgZXhpdCgpIHsKKyAgICAgICAgICAgICAgICBtTmV0d29ya0luZm8uc2V0SXNBdmFpbGFibGUodHJ1ZSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBjbGFzcyBJbmFjdGl2ZVN0YXRlIGV4dGVuZHMgSGllcmFyY2hpY2FsU3RhdGUgeworICAgICAgICAgICAgQE92ZXJyaWRlCisgICAgICAgICAgICAgcHVibGljIHZvaWQgZW50ZXIoKSB7CisgICAgICAgICAgICAgICAgIGlmIChEQkcpIExvZy5kKFRBRywgZ2V0TmFtZSgpICsgIlxuIik7CisgICAgICAgICAgICAgICAgIE1lc3NhZ2UgbWVzc2FnZSA9IGdldEN1cnJlbnRNZXNzYWdlKCk7CisgICAgICAgICAgICAgICAgIFN0YXRlQ2hhbmdlUmVzdWx0IHN0YXRlQ2hhbmdlUmVzdWx0ID0gKFN0YXRlQ2hhbmdlUmVzdWx0KSBtZXNzYWdlLm9iajsKKworICAgICAgICAgICAgICAgICBtTmV0d29ya0luZm8uc2V0SXNBdmFpbGFibGUoZmFsc2UpOworICAgICAgICAgICAgICAgICByZXNldExvb3BEZXRlY3Rpb24oKTsKKyAgICAgICAgICAgICAgICAgbVBhc3N3b3JkS2V5TWF5QmVJbmNvcnJlY3QgPSBmYWxzZTsKKworICAgICAgICAgICAgICAgICBzZW5kU3VwcGxpY2FudFN0YXRlQ2hhbmdlZEJyb2FkY2FzdChzdGF0ZUNoYW5nZVJlc3VsdCwgZmFsc2UpOworICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIEBPdmVycmlkZQorICAgICAgICAgICAgcHVibGljIGJvb2xlYW4gcHJvY2Vzc01lc3NhZ2UoTWVzc2FnZSBtZXNzYWdlKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIGhhbmRsZVRyYW5zaXRpb24obWVzc2FnZSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgICAgIHB1YmxpYyB2b2lkIGV4aXQoKSB7CisgICAgICAgICAgICAgICAgbU5ldHdvcmtJbmZvLnNldElzQXZhaWxhYmxlKHRydWUpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKworICAgICAgICBjbGFzcyBEaXNjb25uZWN0ZWRTdGF0ZSBleHRlbmRzIEhpZXJhcmNoaWNhbFN0YXRlIHsKKyAgICAgICAgICAgIEBPdmVycmlkZQorICAgICAgICAgICAgIHB1YmxpYyB2b2lkIGVudGVyKCkgeworICAgICAgICAgICAgICAgICBpZiAoREJHKSBMb2cuZChUQUcsIGdldE5hbWUoKSArICJcbiIpOworICAgICAgICAgICAgICAgICBNZXNzYWdlIG1lc3NhZ2UgPSBnZXRDdXJyZW50TWVzc2FnZSgpOworICAgICAgICAgICAgICAgICBTdGF0ZUNoYW5nZVJlc3VsdCBzdGF0ZUNoYW5nZVJlc3VsdCA9IChTdGF0ZUNoYW5nZVJlc3VsdCkgbWVzc2FnZS5vYmo7CisKKyAgICAgICAgICAgICAgICAgcmVzZXRMb29wRGV0ZWN0aW9uKCk7CisKKyAgICAgICAgICAgICAgICAgLyogSWYgYSBkaXNjb25uZWN0IGV2ZW50IGhhcHBlbnMgYWZ0ZXIgYSBwYXNzd29yZCBrZXkgZmFpbHVyZQorICAgICAgICAgICAgICAgICAgKiBldmVudCwgZGlzYWJsZSB0aGUgbmV0d29yaworICAgICAgICAgICAgICAgICAgKi8KKyAgICAgICAgICAgICAgICAgaWYgKG1QYXNzd29yZEtleU1heUJlSW5jb3JyZWN0KSB7CisgICAgICAgICAgICAgICAgICAgICBMb2cuZChUQUcsICJGYWlsZWQgdG8gYXV0aGVudGljYXRlLCBkaXNhYmxpbmcgbmV0d29yayAiICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVdpZmlJbmZvLmdldE5ldHdvcmtJZCgpKTsKKyAgICAgICAgICAgICAgICAgICAgIFdpZmlOYXRpdmUuZGlzYWJsZU5ldHdvcmtDb21tYW5kKG1XaWZpSW5mby5nZXROZXR3b3JrSWQoKSk7CisgICAgICAgICAgICAgICAgICAgICBtUGFzc3dvcmRLZXlNYXlCZUluY29ycmVjdCA9IGZhbHNlOworICAgICAgICAgICAgICAgICAgICAgc2VuZFN1cHBsaWNhbnRTdGF0ZUNoYW5nZWRCcm9hZGNhc3Qoc3RhdGVDaGFuZ2VSZXN1bHQsIHRydWUpOworICAgICAgICAgICAgICAgICAgICAgc2VuZFN1cHBsaWNhbnRDb25maWdDaGFuZ2VkQnJvYWRjYXN0KCk7CisgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICBzZW5kU3VwcGxpY2FudFN0YXRlQ2hhbmdlZEJyb2FkY2FzdChzdGF0ZUNoYW5nZVJlc3VsdCwgZmFsc2UpOworICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgfQorICAgICAgICAgICAgQE92ZXJyaWRlCisgICAgICAgICAgICBwdWJsaWMgYm9vbGV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yAgICAgICAgICAgIEBPdmVycmlkZQorICAgICAgICAgICAgIHB1YmxpYyB2b2lkIGVudGVyKCkgeworICAgICAgICAgICAgICAgICBpZiAoREJHKSBMb2cuZChUQUcsIGdldE5hbWUoKSArICJcbiIpOworICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIEBPdmVycmlkZQorICAgICAgICAgICAgcHVibGljIGJvb2xlYW4gcHJvY2Vzc01lc3NhZ2UoTWVzc2FnZSBtZXNzYWdlKSB7CisgICAgICAgICAgICAgICAgc3dpdGNoIChtZXNzYWdlLndoYXQpIHsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBDTURfU1RBUlRfU0NBTjoKKyAgICAgICAgICAgICAgICAgICAgICAgIFdpZmlOYXRpdmUuc2V0U2NhblJlc3VsdEhhbmRsaW5nQ29tbWFuZChTQ0FOX09OTFlfTU9ERSk7CisgICAgICAgICAgICAgICAgICAgICAgICBXaWZpTmF0aXZlLnNjYW5Db21tYW5kKG1lc3NhZ2UuYXJnMSA9PSBTQ0FOX0FDVElWRSk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBOT1RfSEFORExFRDsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgcmV0dXJuIEhBTkRMRUQ7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBjbGFzcyBIYW5kc2hha2VTdGF0ZSBleHRlbmRzIEhpZXJhcmNoaWNhbFN0YXRlIHsKKyAgICAgICAgICAgIEBPdmVycmlkZQorICAgICAgICAgICAgIHB1YmxpYyB2b2lkIGVudGVyKCkgeworICAgICAgICAgICAgICAgICBpZiAoREJHKSBMb2cuZChUQUcsIGdldE5hbWUoKSArICJcbiIpOworICAgICAgICAgICAgICAgICBmaW5hbCBNZXNzYWdlIG1lc3NhZ2UgPSBnZXRDdXJyZW50TWVzc2FnZSgpOworICAgICAgICAgICAgICAgICBTdGF0ZUNoYW5nZVJlc3VsdCBzdGF0ZUNoYW5nZVJlc3VsdCA9IChTdGF0ZUNoYW5nZVJlc3VsdCkgbWVzc2FnZS5vYmo7CisKKyAgICAgICAgICAgICAgICAgaWYgKG1Mb29wRGV0ZWN0SW5kZXggPiBtZXNzYWdlLndoYXQpIHsKKyAgICAgICAgICAgICAgICAgICAgIG1Mb29wRGV0ZWN0Q291bnQrKzsKKyAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICBpZiAobUxvb3BEZXRlY3RDb3VudCA+IE1BWF9TVVBQTElDQU5UX0xPT1BfSVRFUkFUSU9OUykgeworICAgICAgICAgICAgICAgICAgICAgV2lmaU5hdGl2ZS5kaXNhYmxlTmV0d29ya0NvbW1hbmQoc3RhdGVDaGFuZ2VSZXN1bHQubmV0d29ya0lkKTsKKyAgICAgICAgICAgICAgICAgICAgIHNlbmRTdXBwbGljYW50Q29uZmlnQ2hhbmdlZEJyb2FkY2FzdCgpOworICAgICAgICAgICAgICAgICAgICAgbUxvb3BEZXRlY3RDb3VudCA9IDA7CisgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICBtTG9vcERldGVjdEluZGV4ID0gbWVzc2FnZS53aGF0OworCisgICAgICAgICAgICAgICAgIG1QYXNzd29yZEtleU1heUJlSW5jb3JyZWN0ID0gZmFsc2U7CisgICAgICAgICAgICAgICAgIHNlbmRTdXBwbGljYW50U3RhdGVDaGFuZ2VkQnJvYWRjYXN0KHN0YXRlQ2hhbmdlUmVzdWx0LCBmYWxzZSk7CisgICAgICAgICAgICAgfQorICAgICAgICAgICAgQE92ZXJyaWRlCisgICAgICAgICAgICBwdWJsaWMgYm9vbGVhbiBwcm9jZXNzTWVzc2FnZShNZXNzYWdlIG1lc3NhZ2UpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gaGFuZGxlVHJhbnNpdGlvbihtZXNzYWdlKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIGNsYXNzIENvbXBsZXRlZFN0YXRlIGV4dGVuZHMgSGllcmFyY2hpY2FsU3RhdGUgeworICAgICAgICAgICAgQE92ZXJyaWRlCisgICAgICAgICAgICAgcHVibGljIHZvaWQgZW50ZXIoKSB7CisgICAgICAgICAgICAgICAgIGlmIChEQkcpIExvZy5kKFRBRywgZ2V0TmFtZSgpICsgIlxuIik7CisgICAgICAgICAgICAgICAgIE1lc3NhZ2UgbWVzc2FnZSA9IGdldEN1cnJlbnRNZXNzYWdlKCk7CisgICAgICAgICAgICAgICAgIFN0YXRlQ2hhbmdlUmVzdWx0IHN0YXRlQ2hhbmdlUmVzdWx0ID0gKFN0YXRlQ2hhbmdlUmVzdWx0KSBtZXNzYWdlLm9iajsKKworICAgICAgICAgICAgICAgICBtUnNzaVBvbGxUb2tlbisrOworICAgICAgICAgICAgICAgICBpZiAobUVuYWJsZVJzc2lQb2xsaW5nKSB7CisgICAgICAgICAgICAgICAgICAgICBzZW5kTWVzc2FnZURlbGF5ZWQob2J0YWluTWVzc2FnZShDTURfUlNTSV9QT0xMLCBtUnNzaVBvbGxUb2tlbiwgMCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBPTExfUlNTSV9JTlRFUlZBTF9NU0VDUyk7CisgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICByZXNldExvb3BEZXRlY3Rpb24oKTsKKworICAgICAgICAgICAgICAgICBtUGFzc3dvcmRLZXlNYXlCZUluY29ycmVjdCA9IGZhbHNlOworICAgICAgICAgICAgICAgICBzZW5kU3VwcGxpY2FudFN0YXRlQ2hhbmdlZEJyb2FkY2FzdChzdGF0ZUNoYW5nZVJlc3VsdCwgZmFsc2UpOworICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIEBPdmVycmlkZQorICAgICAgICAgICAgcHVibGljIGJvb2xlYW4gcHJvY2Vzc01lc3NhZ2UoTWVzc2FnZSBtZXNzYWdlKSB7CisgICAgICAgICAgICAgICAgc3dpdGNoKG1lc3NhZ2Uud2hhdCkgeworICAgICAgICAgICAgICAgICAgICBjYXNlIEFTU09DSUFUSU5HOgorICAgICAgICAgICAgICAgICAgICBjYXNlIEFTU09DSUFURUQ6CisgICAgICAgICAgICAgICAgICAgIGNhc2UgRk9VUl9XQVlfSEFORFNIQUtFOgorICAgICAgICAgICAgICAgICAgICBjYXNlIEdST1VQX0hBTkRTSEFLRToKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBDT01QTEVURUQ6CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBDTURfUlNTSV9QT0xMOgorICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1lc3NhZ2UuYXJnMSA9PSBtUnNzaVBvbGxUb2tlbikgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIEdldCBJbmZvIGFuZCBjb250aW51ZSBwb2xsaW5nCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVxdWVzdFBvbGxlZEluZm8oKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZW5kTWVzc2FnZURlbGF5ZWQob2J0YWluTWVzc2FnZShDTURfUlNTSV9QT0xMLCBtUnNzaVBvbGxUb2tlbiwgMCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQT0xMX1JTU0lfSU5URVJWQUxfTVNFQ1MpOworICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBQb2xsaW5nIGhhcyBjb21wbGV0ZWQKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICBjYXNlIENNRF9FTkFCTEVfUlNTSV9QT0xMOgorICAgICAgICAgICAgICAgICAgICAgICAgbVJzc2lQb2xsVG9rZW4rKzsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtRW5hYmxlUnNzaVBvbGxpbmcpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBmaXJzdCBwb2xsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVxdWVzdFBvbGxlZEluZm8oKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZW5kTWVzc2FnZURlbGF5ZWQob2J0YWluTWVzc2FnZShDTURfUlNTSV9QT0xMLCBtUnNzaVBvbGxUb2tlbiwgMCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQT0xMX1JTU0lfSU5URVJWQUxfTVNFQ1MpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaGFuZGxlVHJhbnNpdGlvbihtZXNzYWdlKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgcmV0dXJuIEhBTkRMRUQ7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBjbGFzcyBEb3JtYW50U3RhdGUgZXh0ZW5kcyBIaWVyYXJjaGljYWxTdGF0ZSB7CisgICAgICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgICAgIHB1YmxpYyB2b2lkIGVudGVyKCkgeworICAgICAgICAgICAgICAgIGlmIChEQkcpIExvZy5kKFRBRywgZ2V0TmFtZSgpICsgIlxuIik7CisgICAgICAgICAgICAgICAgTWVzc2FnZSBtZXNzYWdlID0gZ2V0Q3VycmVudE1lc3NhZ2UoKTsKKyAgICAgICAgICAgICAgICBTdGF0ZUNoYW5nZVJlc3VsdCBzdGF0ZUNoYW5nZVJlc3VsdCA9IChTdGF0ZUNoYW5nZVJlc3VsdCkgbWVzc2FnZS5vYmo7CisKKyAgICAgICAgICAgICAgICByZXNldExvb3BEZXRlY3Rpb24oKTsKKyAgICAgICAgICAgICAgICBtUGFzc3dv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ICAgICAgICAvKgotICAgICAgICAgICAgICAgICAqIERIQ1AgcmVxdWVzdHMgYXJlIGJsb2NraW5nLCBzbyBydW4gdGhlbSBpbiBhIHNlcGFyYXRlIHRocmVhZC4KLSAgICAgICAgICAgICAgICAgKi8KLSAgICAgICAgICAgICAgICBIYW5kbGVyVGhyZWFkIGRoY3BUaHJlYWQgPSBuZXcgSGFuZGxlclRocmVhZCgiREhDUCBIYW5kbGVyIFRocmVhZCIpOwotICAgICAgICAgICAgICAgIGRoY3BUaHJlYWQuc3RhcnQoKTsKLSAgICAgICAgICAgICAgICBtRGhjcFRhcmdldCA9IG5ldyBEaGNwSGFuZGxlcihkaGNwVGhyZWFkLmdldExvb3BlcigpLCB0aGlzKTsKLSAgICAgICAgICAgICAgICBtSXNTY2FuTW9kZUFjdGl2ZSA9IHRydWU7Ci0gICAgICAgICAgICAgICAgbUlzSGlnaFBlcmZFbmFibGVkID0gZmFsc2U7Ci0gICAgICAgICAgICAgICAgbU9wdGltaXphdGlvbnNEaXNhYmxlZFJlZkNvdW50ID0gMDsKLSAgICAgICAgICAgICAgICBtUG93ZXJNb2RlUmVmQ291bnQgPSAwOwotICAgICAgICAgICAgICAgIG1Ub3JuRG93bkJ5Q29ubk1nciA9IGZhbHNlOwotICAgICAgICAgICAgICAgIG1MYXN0QnNzaWQgPSBudWxsOwotICAgICAgICAgICAgICAgIG1MYXN0U3NpZCA9IG51bGw7Ci0gICAgICAgICAgICAgICAgcmVxdWVzdENvbm5lY3Rpb25JbmZvKCk7Ci0gICAgICAgICAgICAgICAgU3VwcGxpY2FudFN0YXRlIHN1cHBsU3RhdGUgPSBtV2lmaUluZm8uZ2V0U3VwcGxpY2FudFN0YXRlKCk7Ci0gICAgICAgICAgICAgICAgLyoqCi0gICAgICAgICAgICAgICAgICogVGhlIE1BQyBhZGRyZXNzIGlzbid0IGdvaW5nIHRvIGNoYW5nZSwgc28ganVzdCByZXF1ZXN0IGl0Ci0gICAgICAgICAgICAgICAgICogb25jZSBoZXJlLgotICAgICAgICAgICAgICAgICAqLwotICAgICAgICAgICAgICAgIFN0cmluZyBtYWNhZGRyID0gZ2V0TWFjQWRkcmVzcygpOwotCi0gICAgICAgICAgICAgICAgaWYgKG1hY2FkZHIgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICBtV2lmaUluZm8uc2V0TWFjQWRkcmVzcyhtYWNhZGRyKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgaWYgKExPQ0FMX0xPR0QpIExvZy52KFRBRywgIkNvbm5lY3Rpb24gdG8gc3VwcGxpY2FudCBlc3RhYmxpc2hlZCwgc3RhdGU9IiArCi0gICAgICAgICAgICAgICAgICAgIHN1cHBsU3RhdGUpOwotICAgICAgICAgICAgICAgIC8vIFdpLUZpIHN1cHBsaWNhbnQgY29ubmVjdGlvbiBzdGF0ZSBjaGFuZ2VkOgotICAgICAgICAgICAgICAgIC8vIFszMS0gMl0gUmVzZXJ2ZWQgZm9yIGZ1dHVyZSB1c2UKLSAgICAgICAgICAgICAgICAvLyBbIDEtIDBdIENvbm5lY3RlZCB0byBzdXBwbGljYW50ICgxKSwgZGlzY29ubmVjdGVkIGZyb20gc3VwcGxpY2FudCAoMCkgLAotICAgICAgICAgICAgICAgIC8vICAgICAgICAgb3Igc3VwcGxpY2FudCBkaWVkICgyKQotICAgICAgICAgICAgICAgIEV2ZW50TG9nLndyaXRlRXZlbnQoRVZFTlRMT0dfU1VQUExJQ0FOVF9DT05ORUNUSU9OX1NUQVRFX0NIQU5HRUQsIDEpOwotICAgICAgICAgICAgICAgIC8qCi0gICAgICAgICAgICAgICAgICogVGhlIENPTVBMRVRFRCBzdGF0ZSBjaGFuZ2UgZnJvbSB0aGUgc3VwcGxpY2FudCBtYXkgaGF2ZSBvY2N1cnJlZAotICAgICAgICAgICAgICAgICAqIGluIGJldHdlZW4gcG9sbGluZyBmb3Igc3VwcGxpY2FudCBhdmFpbGFiaWxpdHksIGluIHdoaWNoIGNhc2UKLSAgICAgICAgICAgICAgICAgKiB3ZSBkaWRuJ3QgcGVyZm9ybSBhIERIQ1AgcmVxdWVzdCB0byBnZXQgYW4gSVAgYWRkcmVzcy4KLSAgICAgICAgICAgICAgICAgKi8KLSAgICAgICAgICAgICAgICBpZiAoc3VwcGxTdGF0ZSA9PSBTdXBwbGljYW50U3RhdGUuQ09NUExFVEVEKSB7Ci0gICAgICAgICAgICAgICAgICAgIG1MYXN0QnNzaWQgPSBtV2lmaUluZm8uZ2V0QlNTSUQoKTsKLSAgICAgICAgICAgICAgICAgICAgbUxhc3RTc2lkID0gbVdpZmlJbmZvLmdldFNTSUQoKTsKLSAgICAgICAgICAgICAgICAgICAgY29uZmlndXJlSW50ZXJmYWNlKCk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGlmIChBY3Rpdml0eU1hbmFnZXJOYXRpdmUuaXNTeXN0ZW1SZWFkeSgpKSB7Ci0gICAgICAgICAgICAgICAgICAgIGludGVudCA9IG5ldyBJbnRlbnQoV2lmaU1hbmFnZXIuU1VQUExJQ0FOVF9DT05ORUNUSU9OX0NIQU5HRV9BQ1RJT04pOwotICAgICAgICAgICAgICAgICAgICBpbnRlbnQucHV0RXh0cmEoV2lmaU1hbmFnZXIuRVhUUkFfU1VQUExJQ0FOVF9DT05ORUNURUQsIHRydWUpOwotICAgICAgICAgICAgICAgICAgICBtQ29udGV4dC5zZW5kQnJvYWRjYXN0KGludGVudCk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGlmIChzdXBwbFN0YXRlID09IFN1cHBsaWNhbnRTdGF0ZS5DT01QTEVURUQgJiYgbUhhdmVJcEFkZHJlc3MpIHsKLSAgICAgICAgICAgICAgICAgICAgc2V0RGV0YWlsZWRTdGF0ZShEZXRhaWxlZFN0YXRlLkNPTk5FQ1RFRCk7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgc2V0RGV0YWlsZWRTdGF0ZShXaWZpSW5mby5nZXREZXRhaWxlZFN0YXRlT2Yoc3VwcGxTdGF0ZSkpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAvKgotICAgICAgICAgICAgICAgICAqIEZpbHRlciBvdXQgbXVsdGljYXN0IHBhY2tldHMuIFRoaXMgc2F2ZXMgYmF0dGVyeSBwb3dlciwgc2luY2UKLSAgICAgICAgICAgICAgICAgKiB0aGUgQ1BVIGRvZXNuJ3QgaGF2ZSB0byBzcGVuZCB0aW1lIHByb2Nlc3NpbmcgcGFja2V0cyB0aGF0Ci0gICAgICAgICAgICAgICAgICogYXJlIGdvaW5nIHRvIGVuZCB1cCBiZWluZyB0aHJvd24gYXdheS4KLSAgICAgICAgICAgICAgICAgKi8KLSAgICAgICAgICAgICAgICBtV00uaW5pdGlhbGl6ZU11bHRpY2FzdEZpbHRlcmluZygpOwotCi0gICAgICAgICAgICAgICAgaWYgKG1CbHVldG9vdGhBMmRwID09IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgbUJsdWV0b290aEEyZHAgPSBuZXcgQmx1ZXRvb3RoQTJkcChtQ29udGV4dCk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGNoZWNrSXNCbHVldG9vdGhQbGF5aW5nKCk7Ci0KLSAgICAgICAgICAgICAgICAvLyBpbml0aWFsaXplIHRoaXMgYWZ0ZXIgdGhlIHN1cHBsaWNhbnQgaXMgYWxpdmUKLSAgICAgICAgICAgICAgICBzZXROdW1BbGxvd2VkQ2hhbm5lbHMoKTsKLSAgICAgICAgICAgICAgICBicmVhazsKLQotICAgICAgICAgICAgY2FzZSBFVkVOVF9TVVBQTElDQU5UX0RJU0NPTk5FQ1Q6Ci0gICAgICAgICAgICAgICAgbVJ1blN0YXRlID0gUlVOX1NUQVRFX1NUT1BQRUQ7Ci0gICAgICAgICAgICAgICAgbm90ZVJ1blN0YXRlKCk7Ci0gICAgICAgICAgICAgICAgYm9vbGVhbiBkaWVkID0gbVdpZmlTdGF0ZS5nZXQoKSAhPSBXSUZJX1NUQVRFX0RJU0FCTEVEICYmCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVdpZmlTdGF0ZS5nZXQoKSAhPSBXSUZJX1NUQVRFX0RJU0FCTElORzsKLSAgICAgICAgICAgICAgICBpZiAoZGllZCkgewotICAgICAgICAgICAgICAgICAgICBpZiAoTE9DQUxfTE9HRCkgTG9nLnYoVEFHLCAiU3VwcGxpY2FudCBkaWVkIHVuZXhwZWN0ZWRseSIpOwotICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChMT0NBTF9MT0dEKSBMb2cudihUQUcsICJDb25uZWN0aW9uIHRvIHN1cHBsaWNhbnQgbG9zdCIpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAvLyBXaS1GaSBzdXBwbGljYW50IGNvbm5lY3Rpb24gc3RhdGUgY2hhbmdlZDoKLSAgICAgICAgICAgICAgICAvLyBbMzEtIDJdIFJlc2VydmVkIGZvciBmdXR1cmUgdXNlCi0gICAgICAgICAgICAgICAgLy8gWyAxLSAwXSBDb25uZWN0ZWQgdG8gc3VwcGxpY2FudCAoMSksIGRpc2Nvbm5lY3RlZCBmcm9tIHN1cHBsaWNhbnQgKDApICwKLSAgICAgICAgICAgICAgICAvLyAgICAgICAgIG9yIHN1cHBsaWNhbnQgZGllZCAoMikKLSAgICAgICAgICAgICAgICBFdmVudExvZy53cml0ZUV2ZW50KEVWRU5UTE9HX1NVUFBMSUNBTlRfQ09OTkVDVElPTl9TVEFURV9DSEFOR0VELCBkaWVkID8gMiA6IDApOwotICAgICAgICAgICAgICAgIGNsb3NlU3VwcGxpY2FudENvbm5lY3Rpb24oKTsKLQotICAgICAgICAgICAgICAgIGlmIChkaWVkKSB7Ci0gICAgICAgICAgICAgICAgICAgIHJlc2V0Q29ubmVjdGlvbnModHJ1ZSk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIC8vIFdoZW4gc3VwcGxpY2FudCBkaWVzLCBraWxsIHRoZSBESENQIHRocmVhZAotICAgICAgICAgICAgICAgIGlmIChtRGhjcFRhcmdldCAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIG1EaGNwVGFyZ2V0LmdldExvb3BlcigpLnF1aXQoKTsKLSAgICAgICAgICAgICAgICAgICAgbURoY3BUYXJnZXQgPSBudWxsOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBtQ29udGV4dC5yZW1vdmVTdGlja3lCcm9hZGNhc3QobmV3IEludGVudChXaWZpTWFuYWdlci5ORVRXT1JLX1NUQVRFX0NIQU5HRURfQUNUSU9OKSk7Ci0gICAgICAgICAgICAgICAgaWYgKEFjdGl2aXR5TWFuYWdlck5hdGl2ZS5pc1N5c3RlbVJlYWR5KCkpIHsKLSAgICAgICAgICAgICAgICAgICAgaW50ZW50ID0gbmV3IEludGVudChXaWZpTWFuYWdlci5TVVBQTElDQU5UX0NPTk5FQ1RJT05fQ0hBTkdFX0FDVElPTik7Ci0gICAgICAgICAgICAgICAgICAgIGludGVudC5wdXRFeHRyYShXaWZpTWFuYWdlci5FWFRSQV9TVVBQTElDQU5UX0NPTk5FQ1RFRCwgZmFsc2UpOwotICAgICAgICAgICAgICAgICAgICBtQ29udGV4dC5zZW5kQnJvYWRjYXN0KGludGVudCk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIHNldERldGFpbGVkU3RhdGUoRGV0YWlsZWRTdGF0ZS5ESVNDT05ORUNURUQpOwotICAgICAgICAgICAgICAgIHNldFN1cHBsaWNhbnRTdGF0ZShTdXBwbGljYW50U3RhdGUuVU5JTklUSUFMSVpFRCk7Ci0gICAgICAgICAgICAgICAgbUhhdmVJcEFkZHJlc3MgPSBmYWxzZTsKLSAgICAgICAgICAgICAgICBtT2J0YWluaW5nSXBBZGRyZXNzID0gZmFsc2U7Ci0gICAgICAgICAgICAgICAgaWYgKGRpZW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Ly8gV2ktRmkgc3VwcGxpY2FudCBzdGF0ZSBjaGFuZ2VkOgotICAgICAgICAgICAgICAgIC8vIFszMS0gNl0gUmVzZXJ2ZWQgZm9yIGZ1dHVyZSB1c2UKLSAgICAgICAgICAgICAgICAvLyBbIDUtIDBdIFN1cHBsaWNhbnQgc3RhdGUgb3JkaW5hbCAoYXMgZGVmaW5lZCBieSBTdXBwbGljYW50U3RhdGUpCi0gICAgICAgICAgICAgICAgaW50IGV2ZW50TG9nUGFyYW0gPSAobmV3U3RhdGUub3JkaW5hbCgpICYgMHgzZik7Ci0gICAgICAgICAgICAgICAgRXZlbnRMb2cud3JpdGVFdmVudChFVkVOVExPR19TVVBQTElDQU5UX1NUQVRFX0NIQU5HRUQsIGV2ZW50TG9nUGFyYW0pOwotCi0gICAgICAgICAgICAgICAgaWYgKExPQ0FMX0xPR0QpIExvZy52KFRBRywgIkNoYW5naW5nIHN1cHBsaWNhbnQgc3RhdGU6ICIKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyBjdXJyZW50U3RhdGUgKwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiID09PiAiICsgbmV3U3RhdGUpOwotCi0gICAgICAgICAgICAgICAgaW50IG5ldHdvcmtJZCA9IHN1cHBsaWNhbnRTdGF0ZVJlc3VsdC5uZXR3b3JrSWQ7Ci0KLSAgICAgICAgICAgICAgICAvKioKLSAgICAgICAgICAgICAgICAgKiBUaGUgU3VwcGxpY2FudFN0YXRlIEJTU0lEIHZhbHVlIGlzIHZhbGlkIGluIEFTU09DSUFUSU5HIHN0YXRlIG9ubHkuCi0gICAgICAgICAgICAgICAgICogVGhlIE5ldHdvcmtTdGF0ZSBCU1NJRCB2YWx1ZSBjb21lcyB1cG9uIGEgc3VjY2Vzc2Z1bCBjb25uZWN0aW9uLgotICAgICAgICAgICAgICAgICAqLwotICAgICAgICAgICAgICAgIGlmIChzdXBwbGljYW50U3RhdGVSZXN1bHQuc3RhdGUgPT0gU3VwcGxpY2FudFN0YXRlLkFTU09DSUFUSU5HKSB7Ci0gICAgICAgICAgICAgICAgICAgIG1MYXN0QnNzaWQgPSBzdXBwbGljYW50U3RhdGVSZXN1bHQuQlNTSUQ7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIC8qCi0gICAgICAgICAgICAgICAgICogSWYgd2UgZ2V0IGRpc2Nvbm5lY3Qgb3IgaW5hY3RpdmUgd2UgbmVlZCB0byBzdGFydCBvdXIKLSAgICAgICAgICAgICAgICAgKiB3YXRjaGRvZyB0aW1lciB0byBzdGFydCBhIHNjYW4KLSAgICAgICAgICAgICAgICAgKi8KLSAgICAgICAgICAgICAgICBpZiAobmV3U3RhdGUgPT0gU3VwcGxpY2FudFN0YXRlLkRJU0NPTk5FQ1RFRCB8fAotICAgICAgICAgICAgICAgICAgICAgICAgbmV3U3RhdGUgPT0gU3VwcGxpY2FudFN0YXRlLklOQUNUSVZFKSB7Ci0gICAgICAgICAgICAgICAgICAgIHNlbmRNZXNzYWdlRGVsYXllZChvYnRhaW5NZXNzYWdlKEVWRU5UX01BWUJFX1NUQVJUX1NDQU5fUE9TVF9ESVNDT05ORUNULAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1OdW1TdXBwbGljYW50U3RhdGVDaGFuZ2VzLCAwKSwgS0lDS1NUQVJUX1NDQU5OSU5HX0RFTEFZX01TRUNTKTsKLSAgICAgICAgICAgICAgICB9Ci0KLQotICAgICAgICAgICAgICAgIC8qCi0gICAgICAgICAgICAgICAgICogRGlkIHdlIGdldCB0byBESVNDT05ORUNURUQgc3RhdGUgZHVlIHRvIGFuCi0gICAgICAgICAgICAgICAgICogYXV0aGVudGljYXRpb24gKHBhc3N3b3JkKSBmYWlsdXJlPwotICAgICAgICAgICAgICAgICAqLwotICAgICAgICAgICAgICAgIGJvb2xlYW4gZmFpbGVkVG9BdXRoZW50aWNhdGUgPSBmYWxzZTsKLSAgICAgICAgICAgICAgICBpZiAobmV3U3RhdGUgPT0gU3VwcGxpY2FudFN0YXRlLkRJU0NPTk5FQ1RFRCkgewotICAgICAgICAgICAgICAgICAgICBmYWlsZWRUb0F1dGhlbnRpY2F0ZSA9IG1QYXNzd29yZEtleU1heUJlSW5jb3JyZWN0OwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBtUGFzc3dvcmRLZXlNYXlCZUluY29ycmVjdCA9IGZhbHNlOwotCi0gICAgICAgICAgICAgICAgLyoKLSAgICAgICAgICAgICAgICAgKiBLZWVwIHRyYWNrIG9mIHRoZSBzdXBwbGljYW50IHN0YXRlIGFuZCBjaGVjayBpZiB3ZSBzaG91bGQKLSAgICAgICAgICAgICAgICAgKiBkaXNhYmxlIHRoZSBuZXR3b3JrCi0gICAgICAgICAgICAgICAgICovCi0gICAgICAgICAgICAgICAgYm9vbGVhbiBkaXNhYmxlZE5ldHdvcmsgPSBmYWxzZTsKLSAgICAgICAgICAgICAgICBpZiAoaXNTdXBwbGljYW50TG9vcGluZyhuZXdTdGF0ZSkpIHsKLSAgICAgICAgICAgICAgICAgICAgaWYgKExPQ0FMX0xPR0QpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIExvZy52KFRBRywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJTdG9wIFdQQSBzdXBwbGljYW50IGxvb3AgYW5kIGRpc2FibGUgbmV0d29yayIpOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIGRpc2FibGVkTmV0d29yayA9IHdpZmlNYW5hZ2VyRGlzYWJsZU5ldHdvcmsobmV0d29ya0lkKTsKLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICBpZiAoZGlzYWJsZWROZXR3b3JrKSB7Ci0gICAgICAgICAgICAgICAgICAgIC8qCi0gICAgICAgICAgICAgICAgICAgICAqIFJlc2V0IHRoZSBsb29wIHN0YXRlIGlmIHdlIGRpc2FibGVkIHRoZSBuZXR3b3JrCi0gICAgICAgICAgICAgICAgICAgICAqLwotICAgICAgICAgICAgICAgICAgICByZXNldFN1cHBsaWNhbnRMb29wU3RhdGUoKTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKG5ld1N0YXRlICE9IGN1cnJlbnRTdGF0ZSB8fAotICAgICAgICAgICAgICAgICAgICAgICAgKG5ld1N0YXRlID09IFN1cHBsaWNhbnRTdGF0ZS5ESVNDT05ORUNURUQgJiYgaXNEcml2ZXJTdG9wcGVkKCkpKSB7Ci0gICAgICAgICAgICAgICAgICAgIHNldFN1cHBsaWNhbnRTdGF0ZShuZXdTdGF0ZSk7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChuZXdTdGF0ZSA9PSBTdXBwbGljYW50U3RhdGUuRE9STUFOVCkgewotICAgICAgICAgICAgICAgICAgICAgICAgRGV0YWlsZWRTdGF0ZSBuZXdEZXRhaWxlZFN0YXRlOwotICAgICAgICAgICAgICAgICAgICAgICAgTWVzc2FnZSByZWNvbm5lY3RNc2cgPSBvYnRhaW5NZXNzYWdlKEVWRU5UX0RFRkVSUkVEX1JFQ09OTkVDVCwgbUxhc3RCc3NpZCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAobUlzU2Nhbk9ubHkgfHwgbVJ1blN0YXRlID09IFJVTl9TVEFURV9TVE9QUElORykgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5ld0RldGFpbGVkU3RhdGUgPSBEZXRhaWxlZFN0YXRlLklETEU7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5ld0RldGFpbGVkU3RhdGUgPSBEZXRhaWxlZFN0YXRlLkZBSUxFRDsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgIGhhbmRsZURpc2Nvbm5lY3RlZFN0YXRlKG5ld0RldGFpbGVkU3RhdGUsIHRydWUpOwotICAgICAgICAgICAgICAgICAgICAgICAgLyoqCi0gICAgICAgICAgICAgICAgICAgICAgICAgKiBJZiB3ZSB3ZXJlIGFzc29jaWF0ZWQgd2l0aCBhIG5ldHdvcmsgKG5ldHdvcmtJZCAhPSAtMSksCi0gICAgICAgICAgICAgICAgICAgICAgICAgKiBhc3N1bWUgd2UgcmVhY2hlZCB0aGlzIHN0YXRlIGJlY2F1c2Ugb2YgYSBmYWlsZWQgYXR0ZW1wdAotICAgICAgICAgICAgICAgICAgICAgICAgICogdG8gYWNxdWlyZSBhbiBJUCBhZGRyZXNzLCBhbmQgYXR0ZW1wdCBhbm90aGVyIGNvbm5lY3Rpb24KLSAgICAgICAgICAgICAgICAgICAgICAgICAqIGFuZCBJUCBhZGRyZXNzIGFjcXVpc2l0aW9uIGluIFJFQ09OTkVDVF9ERUxBWV9NU0VDUwotICAgICAgICAgICAgICAgICAgICAgICAgICogbWlsbGlzZWNvbmRzLgotICAgICAgICAgICAgICAgICAgICAgICAgICovCi0gICAgICAgICAgICAgICAgICAgICAgICBpZiAobVJ1blN0YXRlID09IFJVTl9TVEFURV9SVU5OSU5HICYmICFtSXNTY2FuT25seSAmJiBuZXR3b3JrSWQgIT0gLTEpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZW5kTWVzc2FnZURlbGF5ZWQocmVjb25uZWN0TXNnLCBSRUNPTk5FQ1RfREVMQVlfTVNFQ1MpOwotICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChtUnVuU3RhdGUgPT0gUlVOX1NUQVRFX1NUT1BQSU5HKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RvcERyaXZlcigpOwotICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChtUnVuU3RhdGUgPT0gUlVOX1NUQVRFX1NUQVJUSU5HICYmICFtSXNTY2FuT25seSkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlY29ubmVjdENvbW1hbmQoKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChuZXdTdGF0ZSA9PSBTdXBwbGljYW50U3RhdGUuRElTQ09OTkVDVEVEKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBtSGF2ZUlwQWRkcmVzcyA9IGZhbHNlOwotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGlzRHJpdmVyU3RvcHBlZCgpIHx8IG1EaXNjb25uZWN0RXhwZWN0ZWQpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYW5kbGVEaXNjb25uZWN0ZWRTdGF0ZShEZXRhaWxlZFN0YXRlLkRJU0NPTk5FQ1RFRCwgdHJ1ZSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjaGVkdWxlRGlzY29ubmVjdCgpOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKG5ld1N0YXRlICE9IFN1cHBsaWNhbnRTdGF0ZS5DT01QTEVURUQgJiYgIW1EaXNjb25uZWN0UGVuZGluZykgewotICAgICAgICAgICAgICAgICAgICAgICAgLyoqCi0gICAgICAgICAgICAgICAgICAgICAgICAgKiBJZ25vcmUgZXZlbnRzIHRoYXQgZG9uJ3QgY2hhbmdlIHRoZSBjb25uZWN0aXZpdHkgc3RhdGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgKiBzdWNoIGFzIFdQQSByZWtleWluZyBvcGVyYXRpb25zLgotICAgICAgICAgICAgICAgICAgICAgICAgICovCi0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoIShjdXJyZW50U3RhdGUgPT0gU3VwcGxpY2FudFN0YXRlLkNPTVBMRVRFRCAmJgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChuZXdTdGF0ZSA9PSBTdXBwbGljYW50U3RhdGUuQVNTT0NJQVRJTkcgfHwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV3U3RhdGUgPT0gU3VwcGxpY2FudFN0YXRlLkFTU09DSUFURUQgfHwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV3U3RhdGUgPT0gU3VwcGxpY2FudFN0YXRlLkZPVVJfV0FZX0hBTkRTSEFLRSB8fAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXdTdGF0ZSA9PSBTdXBwbGljYW50U3RhdGUuR1JPVVBfSEFORFNIQUtFKSkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXREZXRhaWxlZFN0YXRlKFdpZmlJbmZvLmdldERldGFpbGVkU3RhdGVPZihuZXdTdGF0ZSkpOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICAgICAgbURpc2Nvbm5lY3RFeHBlY3RlZCA9IGZhbHNlOwotICAgICAgICAgICAgICAgICAgICBpbnRlbnQgPSBuZXcgSW50ZW50KFdpZmlNYW5hZ2VyLlNVUFBMSUNBTlRfU1RBVEVfQ0hBTkdFRF9BQ1RJT04pOwotICAgICAgICAgICAgICAgICAgICBpbnRlbnQuYWRkRmxhZ3MoSW50ZW50LkZMQUdfUkVDRUlWRVJfUkVHSVNURVJFRF9PTkxZX0JFRk9SRV9CT09UCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgfCBJbnRlbnQuRkxBR19SRUNFSVZFUl9SRVBMQUNFX1BFTkRJTkcpOwotICAgICAgICAgICAgICAgICAgICBpbnRlbnQucHV0RXh0cmEoV2lmaU1hbmFnZXIuRVhUUkFfTkVXX1NUQVRFLCAoUGFyY2VsYWJsZSluZXdTdGF0ZSk7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChmYWlsZWRUb0F1dGhlbnRpY2F0ZSkgewotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKExPQ0FMX0xPR0QpIExvZy5kKFRBRywgIkZhaWxlZCB0byBhdXRoZW50aWNhdGUsIGRpc2FibGluZyBuZXR3b3JrICIgKyBuZXR3b3JrSWQpOwotICAgICAgICAgICAgICAgICAgICAgICAgd2lmaU1hbmFnZXJEaXNhYmxlTmV0d29yayhuZXR3b3JrSWQpOwotICAgICAgICAgICAgICAgICAgICAgICAgaW50ZW50LnB1dEV4dHJhKAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIFdpZmlNYW5hZ2VyLkVYVFJBX1NVUFBMSUNBTlRfRVJST1IsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgV2lmaU1hbmFnZXIuRVJST1JfQVVUSEVOVElDQVRJTkcpOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIG1Db250ZXh0LnNlbmRTdGlja3lCcm9hZGNhc3QoaW50ZW50KTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0KLSAgICAgICAgICAgIGNhc2UgRVZFTlRfTkVUV09SS19TVEFURV9DSEFOR0VEOgotICAgICAgICAgICAgICAgIC8qCi0gICAgICAgICAgICAgICAgICogRWFjaCBDT05ORUNUIG9yIERJU0NPTk5FQ1QgZ2VuZXJhdGVzIGEgcGFpciBvZiBldmVudHMuCi0gICAgICAgICAgICAgICAgICogT25lIGlzIGEgc3VwcGxpY2FudCBzdGF0ZSBjaGFuZ2UgZXZlbnQsIGFuZCB0aGUgb3RoZXIKLSAgICAgICAgICAgICAgICAgKiBpcyBhIG5ldHdvcmsgc3RhdGUgY2hhbmdlIGV2ZW50LiBGb3IgY29ubmVjdHMsIHRoZQotICAgICAgICAgICAgICAgICAqIHN1cHBsaWNhbnQgZXZlbnQgYWx3YXlzIGFycml2ZXMgZmlyc3QsIGZvbGxvd2VkIGJ5Ci0gICAgICAgICAgICAgICAgICogdGhlIG5ldHdvcmsgc3RhdGUgY2hhbmdlIGV2ZW50LiBPbmx5IHRoZSBsYXR0ZXIgZXZlbnQKLSAgICAgICAgICAgICAgICAgKiBoYXMgdGhlIEJTU0lELCB3aGljaCB3ZSBhcmUgaW50ZXJlc3RlZCBpbiBjYXB0dXJpbmcuCi0gICAgICAgICAgICAgICAgICogRm9yIGRpc2Nvbm5lY3RzLCB0aGUgb3JkZXIgaXMgdGhlIG9wcG9zaXRlIC0tIHRoZQotICAgICAgICAgICAgICAgICAqIG5ldHdvcmsgc3RhdGUgY2hhbmdlIGV2ZW50IGNvbWVzIGZpcnN0LCBmb2xsb3dlZCBieQotICAgICAgICAgICAgICAgICAqIHRoZSBzdXBwbGljYW50IHN0YXRlIGNoYW5nZSBldmVudC4KLSAgICAgICAgICAgICAgICAgKi8KLSAgICAgICAgICAgICAgICBOZXR3b3JrU3RhdGVDaGFuZ2VSZXN1bHQgcmVzdWx0ID0KLSAgICAgICAgICAgICAgICAgICAgKE5ldHdvcmtTdGF0ZUNoYW5nZVJlc3VsdCkgbXNnLm9iajsKLQotICAgICAgICAgICAgICAgIC8vIFdpLUZpIG5ldHdvcmsgc3RhdGUgY2hhbmdlZDoKLSAgICAgICAgICAgICAgICAvLyBbMzEtIDZdIFJlc2VydmVkIGZvciBmdXR1cmUgdXNlCi0gICAgICAgICAgICAgICAgLy8gWyA1LSAwXSBEZXRhaWxlZCBzdGF0ZSBvcmRpbmFsIChhcyBkZWZpbmVkIGJ5IE5ldHdvcmtJbmZvLkRldGFpbGVkU3RhdGUpICAgCi0gICAgICAgICAgICAgICAgZXZlbnRMb2dQYXJhbSA9IChyZXN1bHQuc3RhdGUub3JkaW5hbCgpICYgMHgzZik7Ci0gICAgICAgICAgICAgICAgRXZlbnRMb2cud3JpdGVFdmVudChFVkVOVExPR19ORVRXT1JLX1NUQVRFX0NIQU5HRUQsIGV2ZW50TG9nUGFyYW0pOwotICAgICAgICAgICAgICAgIAotICAgICAgICAgICAgICAgIGlmIChMT0NBTF9MT0dEKSBMb2cudihUQUcsICJOZXcgbmV0d29yayBzdGF0ZSBpcyAiICsgcmVzdWx0LnN0YXRlKTsKLSAgICAgICAgICAgICAgICAvKgotICAgICAgICAgICAgICAgICAqIElmIHdlJ3JlIGluIHNjYW4tb25seSBtb2RlLCBkb24ndCBhZHZhbmNlIHRoZSBzdGF0ZSBtYWNoaW5lLCBhbmQKLSAgICAgICAgICAgICAgICAgKiBkb24ndCByZXBvcnQgdGhlIHN0YXRlIGNoYW5nZSB0byBjbGllbnRzLgotICAgICAgICAgICAgICAgICAqLwotICAgICAgICAgICAgICAgIGlmIChtSXNTY2FuT25seSkgewotICAgICAgICAgICAgICAgICAgICBpZiAoTE9DQUxfTE9HRCkgTG9nLnYoVEFHLCAiRHJvcHBpbmcgZXZlbnQgaW4gc2Nhbi1vbmx5IG1vZGUiKTsKLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGlmIChyZXN1bHQuc3RhdGUgIT0gRGV0YWlsZWRTdGF0ZS5TQ0FOTklORykgewotICAgICAgICAgICAgICAgICAgICAvKgotICAgICAgICAgICAgICAgICAgICAgKiBSZXNldCB0aGUgc2NhbiBjb3VudCBzaW5jZSB0aGVyZSB3YXMgYSBuZXR3b3JrIHN0YXRlCi0gICAgICAgICAgICAgICAgICAgICAqIGNoYW5nZS4gVGhpcyBjb3VsZCBiZSBmcm9tIHN1cHBsaWNhbnQgdHJ5aW5nIHRvIGFzc29jaWF0ZQotICAgICAgICAgICAgICAgICAgICAgKiB3aXRoIGEgbmV0d29yay4KLSAgICAgICAgICAgICAgICAgICAgICovCi0gICAgICAgICAgICAgICAgICAgIG1OdW1TY2Fuc1NpbmNlTmV0d29ya1N0YXRlQ2hhbmdlID0gMDsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgLyoKLSAgICAgICAgICAgICAgICAgKiBJZiB0aGUgc3VwcGxpY2FudCBzZW50IHVzIGEgQ09OTkVDVEVEIGV2ZW50LCB3ZSBkb24ndAotICAgICAgICAgICAgICAgICAqIHdhbnQgdG8gc2VuZCBvdXQgYW4gaW5kaWNhdGlvbiBvZiBvdmVyYWxsIG5ldHdvcmsKLSAgICAgICAgICAgICAgICAgKiBjb25uZWN0aXZpdHkgdW50aWwgd2UgaGF2ZSBvdXIgSVAgYWRkcmVzcy4gSWYgdGhlCi0gICAgICAgICAgICAgICAgICogc3VwcGxpY2FudCBzZW50IHVzIGEgRElTQ09OTkVDVEVEIGV2ZW50LCB3ZSBkZWxheQotICAgICAgICAgICAgICAgICAqIHNlbmRpbmcgYSBub3RpZmljYXRpb24gaW4gY2FzZSBhIHJlY29ubmVjdGlvbiB0bwotICAgICAgICAgICAgICAgICAqIHRoZSBzYW1lIGFjY2VzcyBwb2ludCBvY2N1cnMgd2l0aGluIGEgc2hvcnQgdGltZS4KLSAgICAgICAgICAgICAgICAgKi8KLSAgICAgICAgICAgICAgICBpZiAocmVzdWx0LnN0YXRlID09IERldGFpbGVkU3RhdGUuRElTQ09OTkVDVEVEKSB7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChtV2lmaUluZm8uZ2V0U3VwcGxpY2FudFN0YXRlKCkgIT0gU3VwcGxpY2FudFN0YXRlLkRPUk1BTlQpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHNjaGVkdWxlRGlzY29ubmVjdCgpOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICByZXF1ZXN0Q29ubmVjdGlvblN0YXR1cyhtV2lmaUluZm8pOwotICAgICAgICAgICAgICAgIGlmICghKHJlc3VsdC5zdGF0ZSA9PSBEZXRhaWxlZFN0YXRlLkNPTk5FQ1RFRCAmJgotICAgICAgICAgICAgICAgICAgICAgICAgKCFtSGF2ZUlwQWRkcmVzcyB8fCBtRGlzY29ubmVjdFBlbmRpbmcpKSkgewotICAgICAgICAgICAgICAgICAgICBzZXREZXRhaWxlZFN0YXRlKHJlc3VsdC5zdGF0ZSk7Ci0gICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgaWYgKHJlc3VsdC5zdGF0ZSA9PSBEZXRhaWxlZFN0YXRlLkNPTk5FQ1RFRCkgewotICAgICAgICAgICAgICAgICAgICAvKgotICAgICAgICAgICAgICAgICAgICAgKiBSZW1vdmUgdGhlICdhdmFpbGFibGUgbmV0d29ya3MnIG5vdGlmaWNhdGlvbiB3aGVuIHdlCi0gICAgICAgICAgICAgICAgICAgICAqIHN1Y2Nlc3NmdWxseSBjb25uZWN0IHRvIGEgbmV0d29yay4KLSAgICAgICAgICAgICAgICAgICAgICovCi0gICAgICAgICAgICAgICAgICAgIHNldE5vdGlmaWNhdGlvblZpc2libGUoZmFsc2UsIDAsIGZhbHNlLCAwKTsKLSAgICAgICAgICAgICAgICAgICAgYm9vbGVhbiB3YXNEaXNjb25uZWN0UGVuZGluZyA9IG1EaXNjb25uZWN0UGVuZGluZzsKLSAgICAgICAgICAgICAgICAgICAgY2FuY2VsRGlzY29ubmVjdCgpOwotICAgICAgICAgICAgICAgICAgICAvKgotICAgICAgICAgICAgICAgICAgICAgKiBUaGUgY29ubmVjdGlvbiBpcyBmdWxseSBjb25maWd1cmVkIGFzIGZhciBhcyBsaW5rLWxldmVsCi0gICAgICAgICAgICAgICAgICAgICAqIGNvbm5lY3Rpdml0eSBpcyBjb25jZXJuZWQsIGJ1dCB3ZSBtYXkgc3RpbGwgbmVlZCB0byBvYnRhaW4KLSAgICAgICAgICAgICAgICAgICAgICogYW4gSVAgYWRkcmVzcy4KLSAgICAgICAgICAgICAgICAgICAgICovCi0gICAgICAgICAgICAgICAgICAgIGlmICh3YXNEaXNjb25uZWN0UGVuZGluZykgewotICAgICAgICAgICAgICAgICAgICAgICAgRGV0YWlsZWRTdGF0ZSBzYXZlU3RhdGUgPSBnZXROZXR3b3JrSW5mbygpLmdldERldGFpbGVkU3RhdGUoKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGhhbmRsZURpc2Nvbm5lY3RlZFN0YXRlKERldGFpbGVkU3RhdGUuRElTQ09OTkVDVEVELCBmYWxzZSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBzZXREZXRhaWxlZFN0YXRlSW50ZXJuYWwoc2F2ZVN0YXRlKTsKLSAgICAgICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyZUludGVyZmFjZSgpOwotICAgICAgICAgICAgICAgICAgICBtTGFzdEJzc2lkID0gcmVzdWx0LkJTU0lEOwotICAgICAgICAgICAgICAgICAgICBtTGFzdFNzaWQgPSBtV2lmaUluZm8uZ2V0U1NJRCgpOwotICAgICAgICAgICAgICAgICAgICBtTGFzdE5ldHdvcmtJZCA9IHJlc3VsdC5uZXR3b3JrSWQ7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChtSGF2ZUlwQWRkcmVzcykgewotICAgICAgICAgICAgICAgICAgICAgICAgc2V0RGV0YWlsZWRTdGF0ZShEZXRhaWxlZFN0YXRlLkNPTk5FQ1RFRCk7Ci0gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBzZXREZXRhaWxlZFN0YXRlKERldGFpbGVkU3RhdGUuT0JUQUlOSU5HX0lQQUREUik7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgc2VuZE5ldHdvcmtTdGF0ZUNoYW5nZUJyb2FkY2FzdChtV2lmaUluZm8uZ2V0QlNTSUQoKSk7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0KLSAgICAgICAgICAgIGNhc2UgRVZFTlRfU0NBTl9SRVNVTFRTX0FWQUlMQUJMRToKLSAgICAgICAgICAgICAgICBpZiAoQWN0aXZpdHlNYW5hZ2VyTmF0aXZlLmlzU3lzdGVtUmVhZHkoKSkgewotICAgICAgICAgICAgICAgICAgICBtQ29udGV4dC5zZW5kQnJvYWRjYXN0KG5ldyBJbnRlbnQoV2lmaU1hbmFnZXIuU0NBTl9SRVNVTFRTX0FWQUlMQUJMRV9BQ1RJT04pKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgc2VuZFNjYW5SZXN1bHRzQXZhaWxhYmxlKCk7Ci0gICAgICAgICAgICAgICAgLyoqCi0gICAgICAgICAgICAgICAgICogT24gcmVjZWl2aW5nIHRoZSBmaXJzdCBzY2FuIHJlc3VsdHMgYWZ0ZXIgY29ubmVjdGluZyB0bwotICAgICAgICAgICAgICAgICAqIHRoZSBzdXBwbGljYW50LCBzd2l0Y2ggc2NhbiBtb2RlIG92ZXIgdG8gcGFzc2l2ZS4KLSAgICAgICAgICAgICAgICAgKi8KLSAgICAgICAgICAgICAgICBzZXRTY2FuTW9kZShmYWxzZSk7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0KLSAgICAgICAgICAgIGNhc2UgRVZFTlRfUE9MTF9JTlRFUlZBTDoKLSAgICAgICAgICAgICAgICBpZiAobVdpZmlJbmZvLmdldFN1cHBsaWNhbnRTdGF0ZSgpICE9IFN1cHBsaWNhbnRTdGF0ZS5VTklOSVRJQUxJWkVEKSB7Ci0gICAgICAgICAgICAgICAgICAgIHJlcXVlc3RQb2xsZWRJbmZvKG1XaWZpSW5mbywgdHJ1ZSk7Ci0gICAgICAgICAgICAgICAgICAgIGNoZWNrUG9sbFRpbWVyKCk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgCi0gICAgICAgICAgICBjYXNlIEVWRU5UX0RFRkVSUkVEX0RJU0NPTk5FQ1Q6Ci0gICAgICAgICAgICAgICAgaWYgKG1XaWZpSW5mby5nZXRTdXBwbGljYW50U3RhdGUoKSAhPSBTdXBwbGljYW50U3RhdGUuVU5JTklUSUFMSVpFRCkgewotICAgICAgICAgICAgICAgICAgICBoYW5kbGVEaXNjb25uZWN0ZWRTdGF0ZShEZXRhaWxlZFN0YXRlLkRJU0NPTk5FQ1RFRCwgdHJ1ZSk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGJyZWFrOwotCi0gICAgICAgICAgICBjYXNlIEVWRU5UX0RFRkVSUkVEX1JFQ09OTkVDVDoKLSAgICAgICAgICAgICAgICAvKioKLSAgICAgICAgICAgICAgICAgKiBtTGFzdEJzc2lkIGNhbiBiZSBudWxsIHdoZW4gdGhlcmUgaXMgYSByZWNvbm5lY3QKLSAgICAgICAgICAgICAgICAgKiByZXF1ZXN0IG9uIHRoZSBmaXJzdCBCU1NJRCB3ZSBjb25uZWN0IHRvCi0gICAgICAgICAgICAgICAgICovCi0gICAgICAgICAgICAgICAgU3RyaW5nIEJTU0lEID0gKG1zZy5vYmogIT0gbnVsbCkgPyBtc2cub2JqLnRvU3RyaW5nKCkgOiBudWxsOwotICAgICAgICAgICAgICAgIC8qKgotICAgICAgICAgICAgICAgICAqIElmIHdlJ3ZlIGV4Y2VlZGVkIHRoZSBtYXhpbXVtIG51bWJlciBvZiByZXRyaWVzIGZvciByZWNvbm5lY3RpbmcKLSAgICAgICAgICAgICAgICAgKiB0byBhIGdpdmVuIG5ldHdvcmssIGRpc2FibGUgdGhlIG5ldHdvcmsKLSAgICAgICAgICAgICAgICAgKi8KLSAgICAgICAgICAgICAgICBpZiAobVdpZmlJbmZvLmdldFN1cHBsaWNhbnRTdGF0ZSgpICE9IFN1cHBsaWNhbnRTdGF0ZS5VTklOSVRJQUxJWkVEKSB7Ci0gICAgICAgICAgICAgICAgICAgIGlmICgrK21SZWNvbm5lY3RDb3VudCA+IGdldE1heERoY3BSZXRyaWVzKCkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChMT0NBTF9MT0dEKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgTG9nLmQoVEFHLCAiRmFpbGVkIHJlY29ubmVjdCBjb3VudDogIiArCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtUmVjb25uZWN0Q291bnQgKyAiIERpc2FibGluZyAiICsgQlNTSUQpOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgbVdNLmRpc2FibGVOZXR3b3JrKG1MYXN0TmV0d29ya0lkKTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICByZWNvbm5lY3RDb21tYW5kKCk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGJyZWFrOwotCi0gICAgICAgICAgICBjYXNlIEVWRU5UX0lOVEVSRkFDRV9DT05GSUdVUkFUSU9OX1NVQ0NFRURFRDoKLSAgICAgICAgICAgICAgICAvKioKLSAgICAgICAgICAgICAgICAgKiBTaW5jZSB0aGlzIGV2ZW50IGlzIHNlbnQgZnJvbSBhbm90aGVyIHRocmVhZCwgaXQgbWlnaHQgaGF2ZSBiZWVuCi0gICAgICAgICAgICAgICAgICogc2VudCBhZnRlciB3ZSBjbG9zZWQgb3VyIGNvbm5lY3Rpb24gdG8gdGhlIHN1cHBsaWNhbnQgaW4gdGhlIGNvdXJzZQotICAgICAgICAgICAgICAgICAqIG9mIGRpc2FibGluZyBXaS1GaS4gSW4gdGhhdCBjYXNlLCB3ZSBzaG91bGQganVzdCBpZ25vcmUgdGhlIGV2ZW50LgotICAgICAgICAgICAgICAgICAqLwotICAgICAgICAgICAgICAgIGlmIChtV2lmaUluZm8uZ2V0U3VwcGxpY2FudFN0YXRlKCkgPT0gU3VwcGxpY2FudFN0YXRlLlVOSU5JVElBTElaRUQpIHsKLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIG1SZWNvbm5lY3RDb3VudCA9IDA7Ci0gICAgICAgICAgICAgICAgbUhhdmVJcEFkZHJlc3MgPSB0cnVlOwotICAgICAgICAgICAgICAgIG1PYnRhaW5pbmdJcEFkZHJlc3MgPSBmYWxzZTsKLSAgICAgICAgICAgICAgICBtV2lmaUluZm8uc2V0SXBBZGRyZXNzKG1EaGNwSW5mby5pcEFkZHJlc3MpOwotICAgICAgICAgICA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gICAgICAgICAgICAvLyBXZSd2ZSBjb25uZWN0ZWQgc3VjY2Vzc2Z1bGx5LCBzbyBhbGxvdyB0aGUgbm90aWZpY2F0aW9uIGFnYWluIGluIHRoZSBmdXR1cmUKLSAgICAgICAgICAgICAgICByZXNldE5vdGlmaWNhdGlvblRpbWVyKCk7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0KLSAgICAgICAgICAgIGNhc2UgRVZFTlRfSU5URVJGQUNFX0NPTkZJR1VSQVRJT05fRkFJTEVEOgotICAgICAgICAgICAgICAgIGlmIChtV2lmaUluZm8uZ2V0U3VwcGxpY2FudFN0YXRlKCkgIT0gU3VwcGxpY2FudFN0YXRlLlVOSU5JVElBTElaRUQpIHsKLSAgICAgICAgICAgICAgICAgICAgLy8gV2ktRmkgaW50ZXJmYWNlIGNvbmZpZ3VyYXRpb24gc3RhdGUgY2hhbmdlZDoKLSAgICAgICAgICAgICAgICAgICAgLy8gWzMxLSAxXSBSZXNlcnZlZCBmb3IgZnV0dXJlIHVzZQotICAgICAgICAgICAgICAgICAgICAvLyBbIDAtIDBdIEludGVyZmFjZSBjb25maWd1cmF0aW9uIHN1Y2NlZWRlZCAoMSkgb3IgZmFpbGVkICgwKQotICAgICAgICAgICAgICAgICAgICBFdmVudExvZy53cml0ZUV2ZW50KEVWRU5UTE9HX0lOVEVSRkFDRV9DT05GSUdVUkFUSU9OX1NUQVRFX0NIQU5HRUQsIDApOwotICAgICAgICAgICAgICAgICAgICBtSGF2ZUlwQWRkcmVzcyA9IGZhbHNlOwotICAgICAgICAgICAgICAgICAgICBtV2lmaUluZm8uc2V0SXBBZGRyZXNzKDApOwotICAgICAgICAgICAgICAgICAgICBtT2J0YWluaW5nSXBBZGRyZXNzID0gZmFsc2U7Ci0gICAgICAgICAgICAgICAgICAgIGRpc2Nvbm5lY3QoKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0KLSAgICAgICAgICAgIGNhc2UgRVZFTlRfRFJJVkVSX1NUQVRFX0NIQU5HRUQ6Ci0gICAgICAgICAgICAgICAgLy8gV2ktRmkgZHJpdmVyIHN0YXRlIGNoYW5nZWQ6Ci0gICAgICAgICAgICAgICAgLy8gMCBTVEFSVEVECi0gICAgICAgICAgICAgICAgLy8gMSBTVE9QUEVECi0gICAgICAgICAgICAgICAgLy8gMiBIVU5HCi0gICAgICAgICAgICAgICAgRXZlbnRMb2cud3JpdGVFdmVudChFVkVOVExPR19EUklWRVJfU1RBVEVfQ0hBTkdFRCwgbXNnLmFyZzEpOwotCi0gICAgICAgICAgICAgICAgc3dpdGNoIChtc2cuYXJnMSkgewotICAgICAgICAgICAgICAgIGNhc2UgRFJJVkVSX1NUQVJURUQ6Ci0gICAgICAgICAgICAgICAgICAgIC8qKgotICAgICAgICAgICAgICAgICAgICAgKiBTZXQgdGhlIG51bWJlciBvZiBhbGxvd2VkIHJhZGlvIGNoYW5uZWxzIGFjY29yZGluZwotICAgICAgICAgICAgICAgICAgICAgKiB0byB0aGUgc3lzdGVtIHNldHRpbmcsIHNpbmNlIGl0IGdldHMgcmVzZXQgYnkgdGhlCi0gICAgICAgICAgICAgICAgICAgICAqIGRyaXZlciB1cG9uIGNoYW5naW5nIHRvIHRoZSBTVEFSVEVEIHN0YXRlLgotICAgICAgICAgICAgICAgICAgICAgKi8KLSAgICAgICAgICAgICAgICAgICAgc2V0TnVtQWxsb3dlZENoYW5uZWxzKCk7Ci0gICAgICAgICAgICAgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgewotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1SdW5TdGF0ZSA9PSBSVU5fU1RBVEVfU1RBUlRJTkcpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBtUnVuU3RhdGUgPSBSVU5fU1RBVEVfUlVOTklORzsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIW1Jc1NjYW5Pbmx5KSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlY29ubmVjdENvbW1hbmQoKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBJbiBzb21lIHNpdHVhdGlvbnMsIHN1cHBsaWNhbnQgbmVlZHMgdG8gYmUga2lja3N0YXJ0ZWQgdG8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gc3RhcnQgdGhlIGJhY2tncm91bmQgc2Nhbm5pbmcKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2Nhbih0cnVlKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgY2FzZSBEUklWRVJfSFVORzoKLSAgICAgICAgICAgICAgICAgICAgTG9nLmUoVEFHLCAiV2lmaSBEcml2ZXIgcmVwb3J0cyBIVU5HIC0gcmVsb2FkaW5nLiIpOwotICAgICAgICAgICAgICAgICAgICAvKioKLSAgICAgICAgICAgICAgICAgICAgICogcmVzdGFydCB0aGUgZHJpdmVyIC0gdG9nZ2xlIG9mZiBhbmQgb24KLSAgICAgICAgICAgICAgICAgICAgICovCi0gICAgICAgICAgICAgICAgICAgIG1XTS5zZXRXaWZpRW5hYmxlZChmYWxzZSk7Ci0gICAgICAgICAgICAgICAgICAgIG1XTS5zZXRXaWZpRW5hYmxlZCh0cnVlKTsKLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIG5vdGVSdW5TdGF0ZSgpOwotICAgICAgICAgICAgICAgIGJyZWFrOwotCi0gICAgICAgICAgICBjYXNlIEVWRU5UX1BBU1NXT1JEX0tFWV9NQVlfQkVfSU5DT1JSRUNUOgotICAgICAgICAgICAgICAgIG1QYXNzd29yZEtleU1heUJlSW5jb3JyZWN0ID0gdHJ1ZTsKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgfQotICAgIH0KLQotICAgIHByaXZhdGUgYm9vbGVhbiB3aWZpTWFuYWdlckRpc2FibGVOZXR3b3JrKGludCBuZXR3b3JrSWQpIHsKLSAgICAgICAgYm9vbGVhbiBkaXNhYmxlZE5ldHdvcmsgPSBmYWxzZTsKLSAgICAgICAgaWYgKDAgPD0gbmV0d29ya0lkKSB7Ci0gICAgICAgICAgICBkaXNhYmxlZE5ldHdvcmsgPSBtV00uZGlzYWJsZU5ldHdvcmsobmV0d29ya0lkKTsKLSAgICAgICAgICAgIGlmIChMT0NBTF9MT0dEKSB7Ci0gICAgICAgICAgICAgICAgaWYgKGRpc2FibGVkTmV0d29yaykgewotICAgICAgICAgICAgICAgICAgICBMb2cudihUQUcsICJEaXNhYmxlZCBuZXR3b3JrOiAiICsgbmV0d29ya0lkKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLSAgICAgICAgaWYgKExPQ0FMX0xPR0QpIHsKLSAgICAgICAgICAgIGlmICghZGlzYWJsZWROZXR3b3JrKSB7Ci0gICAgICAgICAgICAgICAgTG9nLmUoVEFHLCAiRmFpbGVkIHRvIGRpc2FibGUgbmV0d29yazoiICsKLSAgICAgICAgICAgICAgICAgICAgICAiIGludmFsaWQgbmV0d29yayBpZDogIiArIG5ldHdvcmtJZCk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLSAgICAgICAgcmV0dXJuIGRpc2FibGVkTmV0d29yazsKLSAgICB9Ci0KLSAgICBwcml2YXRlIHZvaWQgY29uZmlndXJlSW50ZXJmYWNlKCkgewotICAgICAgICBjaGVja1BvbGxUaW1lcigpOwotICAgICAgICBtTGFzdFNpZ25hbExldmVsID0gLTE7Ci0gICAgICAgIGlmICghbVVzZVN0YXRpY0lwKSB7Ci0gICAgICAgICAgICBpZiAoIW1IYXZlSXBBZGRyZXNzIC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25TdGF0dXMoV2lmaUluZm8gaW5mbykgewotICAgICAgICBTdHJpbmcgcmVwbHkgPSBzdGF0dXMoKTsKLSAgICAgICAgaWYgKHJlcGx5ID09IG51bGwpIHsKLSAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgfQotICAgICAgICAvKgotICAgICAgICAgKiBQYXJzZSB0aGUgcmVwbHkgZnJvbSB0aGUgc3VwcGxpY2FudCB0byB0aGUgc3RhdHVzIGNvbW1hbmQsIGFuZCB1cGRhdGUKLSAgICAgICAgICogbG9jYWwgc3RhdGUgYWNjb3JkaW5nbHkuIFRoZSByZXBseSBpcyBhIHNlcmllcyBvZiBsaW5lcyBvZiB0aGUgZm9ybQotICAgICAgICAgKiAibmFtZT12YWx1ZSIuCi0gICAgICAgICAqLwotICAgICAgICBTdHJpbmcgU1NJRCA9IG51bGw7Ci0gICAgICAgIFN0cmluZyBCU1NJRCA9IG51bGw7Ci0gICAgICAgIFN0cmluZyBzdXBwU3RhdGUgPSBudWxsOwotICAgICAgICBpbnQgbmV0SWQgPSAtMTsKLSAgICAgICAgU3RyaW5nW10gbGluZXMgPSByZXBseS5zcGxpdCgiXG4iKTsKLSAgICAgICAgZm9yIChTdHJpbmcgbGluZSA6IGxpbmVzKSB7Ci0gICAgICAgICAgICBTdHJpbmdbXSBwcm9wID0gbGluZS5zcGxpdCgiICo9ICoiLCAyKTsKLSAgICAgICAgICAgIGlmIChwcm9wLmxlbmd0aCA8IDIpCi0gICAgICAgICAgICAgICAgY29udGludWU7Ci0gICAgICAgICAgICBTdHJpbmcgbmFtZSA9IHByb3BbMF07Ci0gICAgICAgICAgICBTdHJpbmcgdmFsdWUgPSBwcm9wWzFdOwotICAgICAgICAgICAgaWYgKG5hbWUuZXF1YWxzSWdub3JlQ2FzZSgiaWQiKSkKLSAgICAgICAgICAgICAgICBuZXRJZCA9IEludGVnZXIucGFyc2VJbnQodmFsdWUpOwotICAgICAgICAgICAgZWxzZSBpZiAobmFtZS5lcXVhbHNJZ25vc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BX05FVFdPUktfSU5GTywgbU5ldHdvcmtJbmZvKTsKLSAgICAgICAgaWYgKGJzc2lkICE9IG51bGwpCi0gICAgICAgICAgICBpbnRlbnQucHV0RXh0cmEoV2lmaU1hbmFnZXIuRVhUUkFfQlNTSUQsIGJzc2lkKTsKLSAgICAgICAgbUNvbnRleHQuc2VuZFN0aWNreUJyb2FkY2FzdChpbnRlbnQpOwotICAgIH0KLQotICAgIC8qKgotICAgICAqIERpc2FibGUgV2ktRmkgY29ubmVjdGl2aXR5IGJ5IHN0b3BwaW5nIHRoZSBkcml2ZXIuCi0gICAgICovCi0gICAgcHVibGljIGJvb2xlYW4gdGVhcmRvd24oKSB7Ci0gICAgICAgIGlmICghbVRvcm5Eb3duQnlDb25uTWdyKSB7Ci0gICAgICAgICAgICBpZiAoZGlzY29ubmVjdEFuZFN0b3AoKSkgewotICAgICAgICAgICAgICAgIHNldFRvcm5Eb3duQnlDb25uTWdyKHRydWUpOwotICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICByZXR1cm4gdHJ1ZTsKLSAgICAgICAgfQotICAgIH0KLQotICAgIC8qKgotICAgICAqIFJlZW5hYmxlIFdpLUZpIGNvbm5lY3Rpdml0eSBieSByZXN0YXJ0aW5nIHRoZSBkcml2ZXIuCi0gICAgICovCi0gICAgcHVibGljIGJvb2xlYW4gcmVjb25uZWN0KCkgewotICAgICAgICBpZiAobVRvcm5Eb3duQnlDb25uTWdyKSB7Ci0gICAgICAgICAgICBpZiAocmVzdGFydCgpKSB7Ci0gICAgICAgICAgICAgICAgc2V0VG9ybkRvd25CeUNvbm5NZ3IoZmFsc2UpOwotICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgIC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QVRFX0VOQUJMRUQgfHwgaXNEcml2ZXJTdG9wcGVkKCkpIHsKLSAgICAgICAgICAgIHJldHVybiBmYWxzZTsKLSAgICAgICAgfQotICAgICAgICByZXR1cm4gV2lmaU5hdGl2ZS5yZWNvbm5lY3RDb21tYW5kKCk7Ci0gICAgfQotCi0gICAgLyoqCi0gICAgICogQWRkIGEgbmV0d29yawotICAgICAqCi0gICAgICogQHJldHVybiBuZXR3b3JrIGlkIG9mIHRoZSBuZXcgbmV0d29yawotICAgICAqLwotICAgIHB1YmxpYyBzeW5jaHJvbml6ZWQgaW50IGFkZE5ldHdvcmsoKSB7Ci0gICAgICAgIGlmIChtV2lmaVN0YXRlLmdldCgpICE9IFdJRklfU1RBVEVfRU5BQkxFRCkgewotICAgICAgICAgICAgcmV0dXJuIC0xOwotICAgICAgICB9Ci0gICAgICAgIHJldHVybiBXaWZpTmF0aXZlLmFkZE5ldHdvcmtDb21tYW5kKCk7Ci0gICAgfQotCi0gICAgLyoqCi0gICAgICogRGVsZXRlIGEgbmV0d29yawotICAgICAqCi0gICAgICogQHBhcmFtIG5ldHdvcmtJZCBpZCBvZiB0aGUgbmV0d29yayB0byBiZSByZW1vdmVkCi0gICAgICogQHJldHVybiB7QGNvZGUgdHJ1ZX0gaWYgdGhlIG9wZXJhdGlvbiBzdWNjZWVkcywge0Bjb2RlIGZhbHNlfSBvdGhlcndpc2UKLSAgICAgKi8KLSAgICBwdWJsaWMgc3luY2hyb25pemVkIGJvb2xlYW4gcmVtb3ZlTmV0d29yayhpbnQgbmV0d29ya0lkKSB7Ci0gICAgICAgIGlmIChtV2lmaVN0YXRlLmdldCgpICE9IFdJRklfU1RBVEVfRU5BQkxFRCkgewotICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwotICAgICAgICB9Ci0gICAgICAgIHJldHVybiBtRGlzY29ubmVjdEV4cGVjdGVkID0gV2lmaU5hdGl2ZS5yZW1vdmVOZXR3b3JrQ29tbWFuZChuZXR3b3JrSWQpOwotICAgI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JMRUQpIHsKLSAgICAgICAgICAgIHJldHVybiBmYWxzZTsKLSAgICAgICAgfQotICAgICAgICByZXR1cm4gV2lmaU5hdGl2ZS5hZGRUb0JsYWNrbGlzdENvbW1hbmQoYnNzaWQpOwotICAgIH0KLQotICAgIC8qKgotICAgICAqIENsZWFyIHRoZSBibGFja2xpc3QgbGlzdAotICAgICAqCi0gICAgICogQHJldHVybiB7QGNvZGUgdHJ1ZX0gaWYgdGhlIG9wZXJhdGlvbiBzdWNjZWVkcywge0Bjb2RlIGZhbHNlfSBvdGhlcndpc2UKLSAgICAgKi8KLSAgICBwdWJsaWMgc3luY2hyb25pemVkIGJvb2xlYW4gY2xlYXJCbGFja2xpc3QoKSB7Ci0gICAgICAgIGlmIChtV2lmaVN0YXRlLmdldCgpICE9IFdJRklfU1RBVEVfRU5BQkxFRCkgewotICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwotICAgICAgICB9Ci0gICAgICAgIHJldHVybiBXaWZpTmF0aXZlLmNsZWFyQmxhY2tsaXN0Q29tbWFuZCgpOwotICAgIH0KLQotICAgIC8qKgotICAgICAqIExpc3QgYWxsIGNvbmZpZ3VyZWQgbmV0d29ya3MKLSAgICAgKgotICAgICAqIEByZXR1cm4gbGlzdCBvZiBuZXR3b3JrcyBvciBudWxsIG9uIGZhaWx1cmUKLSAgICAgKi8KLSAgICBwdWJsaWMgc3luY2hyb25pemVkIFN0cmluZyBsaXN0TmV0d29ya3MoKSB7Ci0gICAgICAgIGlmIChtV2lmaVN0YXRlLmdldCgpICE9IFdJRklfU1RBVEVfRU5BQkxFRCkgewotICAgICAgICAgICAgcmV0dXJuIG51bGw7Ci0gICAgICAgIH0KLSAgICAgICAgcmV0dXJuIFdpZmlOYXRpdmUubGlzdE5ldHdvcmtzQ29tbWFuZCgpOwotICAgIH0KLQotICAgIC8qKgotICAgICAqIEdldCBuZXR3b3JrIHNldHRpbmcgYnkgbmFtZQotICAgICAqCi0gICAgICogQHBhcmFtIG5ldElkIG5ldH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iAtMTsKLSAgICAgICAgfQotICAgICAgICByZXR1cm4gV2lmaU5hdGl2ZS5nZXRSc3NpQXBwcm94Q29tbWFuZCgpOwotICAgIH0KLQotICAgIC8qKgotICAgICAqIEdldCBhcHByb3ggUlNTSSB0byBjdXJyZW50bHkgY29ubmVjdGVkIG5ldHdvcmsKLSAgICAgKgotICAgICAqIEByZXR1cm4gUlNTSSB2YWx1ZSwgLTEgb24gZmFpbHVyZQotICAgICAqLwotICAgIHB1YmxpYyBzeW5jaHJvbml6ZWQgaW50IGdldFJzc2lBcHByb3goKSB7Ci0gICAgICAgIGlmIChtV2lmaVN0YXRlLmdldCgpICE9IFdJRklfU1RBVEVfRU5BQkxFRCB8fCBpc0RyaXZlclN0b3BwZWQoKSkgewotICAgICAgICAgICAgcmV0dXJuIC0xOwotICAgICAgICB9Ci0gICAgICAgIHJldHVybiBXaWZpTmF0aXZlLmdldFJzc2lBcHByb3hDb21tYW5kKCk7Ci0gICAgfQotCi0gICAgLyoqCi0gICAgICogR2V0IGxpbmsgc3BlZWQgdG8gY3VycmVudGx5IGNvbm5lY3RlZCBuZXR3b3JrCi0gICAgICoKLSAgICAgKiBAcmV0dXJuIGxpbmsgc3BlZWQsIC0xIG9uIGZhaWx1cmUKLSAgICAgKi8KLSAgICBwdWJsaWMgc3luY2hyb25pemVkIGludCBnZXRMaW5rU3BlZWQoKSB7Ci0gICAgICAgIGlmIChtV2lmaVN0YXRlLmdldCgpICE9IFdJRklfU1RBVEVfRU5BQkxFRCB8fCBpc0RyaXZlclN0b3BwZWQoKSkgewotICAgICAgICAgICAgcmV0dXJuIC0xOwotICAgICAgICB9Ci0gICAgICAgIHJldHVybiBXaWZpTmF0aXZlLmdldExpbmtTcGVlZENvbW1hbmQoKTsKLSAgICB9Ci0KLSAgICAvKioKLSAgICAgKiBHZXQgTUFDIGFkZHJlc3Mgb2YgcmFkaW8KLSAgICAgKgotICAgICAqIEByZXR1cm4gTUFDIGFkZHJlc3MsIG51bGwgb24gZmFp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sZCBzdGF5IHRoYXQgd2F5Ci0gICAgICoKLSAgICAgKi8KLSAgICBwcml2YXRlIHN5bmNocm9uaXplZCB2b2lkIHNldFBvd2VyTW9kZShpbnQgbW9kZSkgewotCi0gICAgICAgIC8qIEl0IGlzIGdvb2QgdG8gcGx1bWIgcG93ZXIgbW9kZSBjaGFuZ2UKLSAgICAgICAgICogZXZlbiBpZiByZWYgY291bnQgaW5kaWNhdGVzIGFscmVhZHkgZG9uZQotICAgICAgICAgKiBzaW5jZSB3ZSBjb3VsZCBoYXZlIGEgY2FzZSBvZiBwcmV2aW91cyBmYWlsdXJlLgotICAgICAgICAgKi8KLSAgICAgICAgc3dpdGNoKG1vZGUpIHsKLSAgICAgICAgICAgIGNhc2UgRFJJVkVSX1BPV0VSX01PREVfQUNUSVZFOgotICAgICAgICAgICAgICAgIG1Qb3dlck1vZGVSZWZDb3VudCsrOwotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgY2FzZSBEUklWRVJfUE9XRVJfTU9ERV9BVVRPOgotICAgICAgICAgICAgICAgIG1Qb3dlck1vZGVSZWZDb3VudC0tOwotICAgICAgICAgICAgICAgIGlmIChtUG93ZXJNb2RlUmVmQ291bnQgPiAwKSB7Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICAvKiBLZWVwIHJlZmNvdW50IGZyb20gYmVjb21pbmcgbmVnYXRpdmUgKi8KLSAgICAgICAgICAgICAgICAgICAgbVBvd2VyTW9kZVJlZkNvdW50ID0gMDsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgIH0KLQotICAgICAgICBpZiAobVdpZmlTdGF0ZS5nZXQoKSAhPSBXSUZJX1NUQVRFX0VOQUJMRUQgfHwgaXNEcml2ZXJTdG9wcGVkKCkpIHsKLSAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgfQotCi0g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ICAgICAgTGlzdDxTY2FuUmVzdWx0PiBzY2FuUmVzdWx0cyA9IGdldFNjYW5SZXN1bHRzTGlzdCgpOwotICAgICAgICAgICAgaWYgKHNjYW5SZXN1bHRzICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICBpbnQgbnVtT3Blbk5ldHdvcmtzID0gMDsKLSAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gc2NhblJlc3VsdHMuc2l6ZSgpIC0gMTsgaSA+PSAwOyBpLS0pIHsKLSAgICAgICAgICAgICAgICAgICAgU2NhblJlc3VsdCBzY2FuUmVzdWx0ID0gc2NhblJlc3VsdHMuZ2V0KGkpOwotCi0gICAgICAgICAgICAgICAgICAgIGlmIChUZXh0VXRpbHMuaXNFbXB0eShzY2FuUmVzdWx0LmNhcGFiaWxpdGllcykpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIG51bU9wZW5OZXR3b3JrcysrOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgCi0gICAgICAgICAgICAgICAgaWYgKG51bU9wZW5OZXR3b3JrcyA+IDApIHsKLSAgICAgICAgICAgICAgICAgICAgaWYgKCsrbU51bVNjYW5zU2luY2VOZXR3b3JrU3RhdGVDaGFuZ2UgPj0gTlVNX1NDQU5TX0JFRk9SRV9BQ1RVQUxMWV9TQ0FOTklORykgewotICAgICAgICAgICAgICAgICAgICAgICAgLyoKLSAgICAgICAgICAgICAgICAgICAgICAgICAqIFdlJ3ZlIHNjYW5uZWQgY29udGludW91c2x5IGF0IGxlYXN0Ci0gICAgICAgICAgICAgICAgICAgICAgICAgKiBOVU1fU0NBTlNfQkVGT1JFX05PVElGSUNBVElPTiB0aW1lcy4gVGhlIHVzZXIKLSAgICAgICAgICAgICAgICAgICAgICAgICAqIHByb2JhYmx5IGRvZXMgbm90IGhhdmUgYSByZW1lbWJlcmVkIG5ldHdvcmsgaW4gcmFuZ2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgKiBzaW5jZSBvdGhlcndpc2Ugc3VwcGxpY2FudCB3b3VsZCBoYXZlIHRyaWVkIHRvCi0gICAgICAgICAgICAgICAgICAgICAgICAgKiBhc3NvY2lhdGUgYW5kIHRodXMgcmVzZXR0aW5nIHRoaXMgY291bnRlci4KLSAgICAgICAgICAgICAgICAgICAgICAgICAqLwotICAgICAgICAgICAgICAgICAgICAgICAgc2V0Tm90aWZpY2F0aW9uVmlzaWJsZSh0cnVlLCBudW1PcGVuTmV0d29ya3MsIGZhbHNlLCAwKTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICByZXR1cm47Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgICAgIAotICAgICAgICAvLyBObyBvcGVuIG5ldHdvcmtzIGluIHJhbmdlLCByZW1vdmUgdGhlIG5vdGlmaWNhdGlvbgotICAgICAgICBzZXROb3RpZmljYXRpb25WaXNpYmxlKGZhbHNlLCAwLCBmYWxzZSwgMCk7CisgICAgLyoqCisgICAgICogQ2hlY2sgaWYgcHJpdmF0ZSBETlMgcm91dGUgaXMgc2V0IGZvciB0aGUgbmV0d29yaworICAgICAqLworICAgIHB1YmxpYyBib29sZWFuIGlzUHJpdmF0ZURuc1JvdXRlU2V0KCkgeworICAgICAgICByZXR1cm4gbVByaXZhdGVEbnNSb3V0ZVNldC5nZXQoKTsKICAgICB9CiAKICAgICAvKioKLSAgICAgKiBEaXNwbGF5IG9yIGRvbid0IGRpc3BsYXkgYSBub3RpZmljYXRpb24gdGhhdCB0aGVyZSBhcmUgb3BlbiBXaS1GaSBuZXR3b3Jrcy4KLSAgICAgKiBAcGFyYW0gdmlzaWJsZSB7QGNvZGUgdHJ1ZX0gaWYgbm90aWZpY2F0aW9uIHNob3VsZCBiZSB2aXNpYmxlLCB7QGNvZGUgZmFsc2V9IG90aGVyd2lzZQotICAgICAqIEBwYXJhbSBudW1OZXR3b3JrcyB0aGUgbnVtYmVyIG5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GRlbiwgdGhlbiBub29wCi0gICAgICAgIGlmICghdmlzaWJsZSAmJiAhbU5vdGlmaWNhdGlvblNob3duICYmICFmb3JjZSkgewotICAgICAgICAgICAgcmV0dXJuOwotICAgICAgICB9Ci0KLSAgICAgICAgTWVzc2FnZSBtZXNzYWdlOwotICAgICAgICBpZiAodmlzaWJsZSkgewotICAgICAgICAgICAgCi0gICAgICAgICAgICAvLyBOb3QgZW5vdWdoIHRpbWUgaGFzIHBhc3NlZCB0byBzaG93IHRoZSBub3RpZmljYXRpb24gYWdhaW4KLSAgICAgICAgICAgIGlmIChTeXN0ZW0uY3VycmVudFRpbWVNaWxsaXMoKSA8IG1Ob3RpZmljYXRpb25SZXBlYXRUaW1lKSB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgCi0gICAgICAgICAgICBpZiAobU5vdGlmaWNhdGlvbiA9PSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgLy8gQ2FjaGUgdGhlIE5vdGlmaWNhdGlvbiBtYWlubHkgc28gd2UgY2FuIHJlbW92ZSB0aGUKLSAgICAgICAgICAgICAgICAvLyBFVkVOVF9OT1RJRklDQVRJT05fQ0hBTkdFRCBtZXNzYWdlIHdpdGggdGhpcyBOb3RpZmljYXRpb24gZnJvbQotICAgICAgICAgICAgICAgIC8vIHRoZSBxdWV1ZSBsYXRlcgotICAgICAgICAgICAgICAgIG1Ob3RpZmljYXRpb24gPSBuZXcgTm90aWZpY2F0aW9uKCk7Ci0gICAgICAgICAgICAgICAgbU5vdGlmaWNhdGlvbi53aGVuID0gMDsKLSAgICAgICAgICAgICAgICBtTm90aWZpY2F0aW9uLmljb24gPSBJQ09OX05FVFdPUktTX0FWQUlMQUJMRTsKLSAgICAgICAgICAgICAgICBtTm90aWZpY2F0aW9uLmZsYWdzID0gTm90aWZpY2F0aW9uLkZMQUdfQVVUT19DQU5DRUw7Ci0gICAgICAgICAgICAgICAgbU5vdGlmaWNhdGlvb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dpdGNoIChtc2cud2hhdCkgewotICAgICAgICAgICAgICAgIGNhc2UgRVZFTlRfREhDUF9TVEFSVDoKLSAgICAgICAgICAgICAgICAgICAgCi0gICAgICAgICAgICAgICAgICAgIGJvb2xlYW4gbW9kaWZpZWRCbHVldG9vdGhDb2V4aXN0ZW5jZU1vZGUgPSBmYWxzZTsKLSAgICAgICAgICAgICAgICAgICAgaW50IHBvd2VyTW9kZSA9IERSSVZFUl9QT1dFUl9NT0RFX0FVVE87Ci0KLSAgICAgICAgICAgICAgICAgICAgaWYgKHNob3VsZERpc2FibGVDb2V4aXN0ZW5jZU1vZGUoKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgLyoKLSAgICAgICAgICAgICAgICAgICAgICAgICAqIFRoZXJlIGFyZSBwcm9ibGVtcyBzZXR0aW5nIHRoZSBXaS1GaSBkcml2ZXIncyBwb3dlcgotICAgICAgICAgICAgICAgICAgICAgICAgICogbW9kZSB0byBhY3RpdmUgd2hlbiBibHVldG9vdGggY29leGlzdGVuY2UgbW9kZSBpcwotICAgICAgICAgICAgICAgICAgICAgICAgICogZW5hYmxlZCBvciBzZW5zZS4KLSAgICAgICAgICAgICAgICAgICAgICAgICAqIDxwPgotICAgICAgICAgICAgICAgICAgICAgICAgICogV2Ugc2V0IFdpLUZpIHRvIGFjdGl2ZSBtb2RlIHdoZW4KLSAgICAgICAgICAgICAgICAgICAgICAgICAqIG9idGFpbmluZyBhbiBJUCBhZGRyZXNzIGJlY2F1c2Ugd2UndmUgZm91bmQKLSAgICAgICAgICAgICAgICAgICAgICAgICAqIGNvbXBhdGliaWxpdHkgaXNzdWVzIHdpdGggc29tZSByb3V0ZXJzIHdpdGggbG93IHBvd2VyCi0gICAgICAgICAgICAgICAgICAgICAgICAgKiBtb2RlLgotICAgICAgICAgICAgICAgICAgICAgICAgICogPHA+Ci0gICAgICAgICAgICAgICAgICAgICAgICAgKiBJbiBvcmRlciBmb3IgdGhpcyBhY3RpdmUgcG93ZXIgbW9kZSB0byBwcm9wZXJseSBiZSBzZXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgKiB3ZSBkaXNhYmxlIGNvZXhpc3RlbmNlIG1vZGUgdW50aWwgd2UncmUgZG9uZSB3aXRoCi0gICAgICAgICAgICAgICAgICAgICAgICAgKiBvYnRhaW5pbmcgYW4gSVAgYWRkcmVzcy4gIE9uZSBleGNlcHRpb24gaXMgaWYgd2UKLSAgICAgICAgICAgICAgICAgICAgICAgICAqIGFyZSBjdXJyZW50bHkgY29ubmVjdGVkIHRvIGEgaGVhZHNldCwgc2luY2UgZGlzYWJsaW5nCi0gICAgICAgICAgICAgICAgICAgICAgICAgKiBjb2V4aXN0ZW5jZSB3b3VsZCBpbnRlcnJ1cHQgdGhhdCBjb25uZWN0aW9uLgotICAgICAgICAgICAgICAgICAgICAgICAgICovCi0gICAgICAgICAgICAgICAgICAgICAgICBtb2RpZmllZEJsdWV0b290aENvZXhpc3RlbmNlTW9kZSA9IHRydWU7Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgIC8vIERpc2FibGUgdGhlIGNvZXhpc3RlbmNlIG1vZGUKLSAgICAgICAgICAgICAgICAgICAgICAgIHNldEJsdWV0b290aENvZXhpc3RlbmNlTW9kZSgKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgV2lmaU5hdGl2ZS5CTFVFVE9PVEhfQ09FWElTVEVOQ0VfTU9ERV9ESVNBQkxFRCk7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgCi0gICAgICAgICAgICAgICAgICAgIHBvd2VyTW9kZSA9IGdldFBvd2VyTW9kZSgpOwotICAgICAgICAgICAgICAgICAgICBpZiAocG93ZXJNb2RlIDwgMCkgewotICAgICAgICAgICAgICAgICAgICAgIC8vIEhhbmRsZSB0aGUgY2FzZSB3aGVyZSBzdXBwbGljYW50IGRyaXZlciBkb2VzIG5vdCBzdXBwb3J0Ci0gICAgICAgICAgICAgICAgICAgICAgLy8gZ2V0UG93ZXJNb2RlQ29tbWFuZC4KLSAgICAgICAgICAgICAgICAgICAgICAgIHBvd2VyTW9kZSA9IERSSVZFUl9QT1dFUl9NT0RFX0FVVE87Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgaWYgKHBvd2VyTW9kZSAhPSBEUklWRVJfUE9XRVJfTU9ERV9BQ1RJVkUpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHNldFBvd2VyTW9kZShEUklWRVJfUE9XRVJfTU9ERV9BQ1RJVkUpOwotICAgICAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAvLyBBIG5ldyByZXF1ZXN0IGlzIGJlaW5nIG1hZGUsIHNvIGFzc3VtZSB3ZSB3aWxsIGNhbGxiYWNrCi0gICAgICAgICAgICAgICAgICAgICAgICBtQ2FuY2VsQ2FsbGJhY2sgPSBmYWxzZTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBMb2cuZChUQUcsICJEaGNwSGFuZGxlcjogREhDUCByZXF1ZXN0IHN0YXJ0ZWQiKTsKLSAgICAgICAgICAgICAgICAgICAgaWYgKE5ldHdvcmtVdGlscy5ydW5EaGNwKG1JbnRlcmZhY2VOYW1lLCBtRGhjcEluZm8pKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBldmVudCA9IEVWRU5UX0lOVEVSRkFDRV9DT05GSUdVUkFUSU9OX1NVQ0NFRURFRDsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChMT0NBTF9MT0dEKSBMb2cudihUQUcsICJEaGNwSGFuZGxlcjogREhDUCByZXF1ZXN0IHN1Y2NlZWRlZCIpOwotICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnQgPSBFVkVOVF9JTlRFUkZBQ0VfQ09ORklHVVJBVElPTl9GQUlMRUQ7Ci0gICAgICAgICAgICAgICAgICAgICAgICBMb2cuaShUQUcsICJEaGNwSGFuZGxlcjogREhDUCByZXF1ZXN0IGZhaWxlZDogIiArCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgTmV0d29ya1V0aWxzLmdldERoY3BFcnJvcigpKTsKLSAgICAgICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgICAgIGlmIChwb3dlck1vZGUgIT0gRFJJVkVSX1BPV0VSX01PREVfQUNUSVZFKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBzZXRQb3dlck1vZGUocG93ZXJNb2RlKTsKLSAgICAgICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgICAgIGlmIChtb2RpZmllZEJsdWV0b290aENvZXhpc3RlbmNlTW9kZSkgewotICAgICAgICAgICAgICAgICAgICAgICAgLy8gU2V0IHRoZSBjb2V4aXN0ZW5jZSBtb2RlIGJhY2sgdG8gaXRzIGRlZmF1bHQgdmFsdWUKLSAgICAgICAgICAgICAgICAgICAgICAgIHNldEJsdWV0b290aENvZXhpc3RlbmNlTW9kZSgKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgV2lmaU5hdGl2ZS5CTFVFVE9PVEhfQ09FWElTVEVOQ0VfTU9ERV9TRU5TRSk7Ci0gICAgICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmICghbUNhbmNlbENhbGxiYWNrKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgbVRhcmdldC5zZW5kRW1wdHlNZXNzYWdlKGV2ZW50KTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCi0gICAgICAgIHB1YmxpYyBzeW5jaHJv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HsKLSAgICAgICAgbVVzZVN0YXRpY0lwID0gZmFsc2U7Ci0gICAgICAgIGZpbmFsIENvbnRlbnRSZXNvbHZlciBjciA9IG1Db250ZXh0LmdldENvbnRlbnRSZXNvbHZlcigpOwotICAgICAgICB0cnkgewotICAgICAgICAgICAgaWYgKFNldHRpbmdzLlN5c3RlbS5nZXRJbnQoY3IsIFNldHRpbmdzLlN5c3RlbS5XSUZJX1VTRV9TVEFUSUNfSVApID09IDApIHsKLSAgICAgICAgICAgICAgICByZXR1cm47Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0gY2F0Y2ggKFNldHRpbmdzLlNldHRpbmdOb3RGb3VuZEV4Y2VwdGlvbiBlKSB7Ci0gICAgICAgICAgICByZXR1cm47Ci0gICAgICAgIH0KLQotICAgICAgICB0cnkgewotICAgICAgICAgICAgU3RyaW5nIGFkZHIgPSBTZXR0aW5ncy5TeXN0ZW0uZ2V0U3RyaW5nKGNyLCBTZXR0aW5ncy5TeXN0ZW0uV0lGSV9TVEFUSUNfSVApOwotICAgICAgICAgICAgaWYgKGFkZHIgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgIG1EaGNwSW5mby5pcEFkZHJlc3MgPSBzdHJpbmdUb0lwQWRkcihhZGRyKTsKLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgYWRkciA9IFNldHRpbmdzLlN5c3RlbS5nZXRTdHJpbmcoY3IsIFNldHRpbmdzLlN5c3RlbS5XSUZJX1NUQVRJQ19HQVRFV0FZKTsKLSAgICAgICAgICAgIGlmIChhZGRyICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICBtRGhjcEluZm8uZ2F0ZXdheSA9IHN0cmluZ1RvSXBBZGRyKGFkZHIpOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICByZXR1cm47Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBhZGRyID0gU2V0dGluZ3MuU3lzdGVtLmdldFN0cmluZyhjciwgU2V0dGluZ3MuU3lzdGVtLldJRklfU1RBVElDX05FVE1BU0spOwotICAgICAgICAgICAgaWYgKGFkZHIgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgIG1EaGNwSW5mby5uZXRtYXNrID0gc3RyaW5nVG9JcEFkZHIoYWRkcik7Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGFkZHIgPSBTZXR0aW5ncy5TeXN0ZW0uZ2V0U3RyaW5nKGNyLCBTZXR0aW5ncy5TeXN0ZW0uV0lGSV9TVEFUSUNfRE5TMSk7Ci0gICAgICAgICAgICBpZiAoYWRkciAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgbURoY3BJbmZvLmRuczEgPSBzdHJpbmdUb0lwQWRkcihhZGRyKTsKLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgYWRkciA9IFNldHRpbmdzLlN5c3RlbS5nZXRTdHJpbmcoY3IsIFNldHRpbmdzLlN5c3RlbS5XSUZJX1NUQVRJQ19ETlMyKTsKLSAgICAgICAgICAgIGlmIChhZGRyICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICBtRGhjcEluZm8uZG5zMiA9IHN0cmluZ1RvSXBBZGRyKGFkZHIpOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBtRGhjcEluZm8uZG5zMiA9IDA7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0gY2F0Y2ggKFVua25vd25Ib3N0RXhjZXB0aW9uIGUpIHsKLSAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgfQotICAgICAgICBtVXNlU3RhdGljSXAgPSB0cnVlOworICAgIC8qKgorICAgICAqIEZldGNoIE5ldHdvcmtQcm9wZXJ0aWVzIGZvciB0aGUgbmV0d29yaworICAgICAqLworICAgIHB1YmxpYyBOZXR3b3JrUHJvcGVydGllcyBnZXROZXR3b3JrUHJvcGVydGllcygpIHsKKyAgICAgICAgcmV0dXJuIG1OZXR3b3JrUHJvcGVydGllczsKICAgICB9CiAKLSAgICBwcml2YXRlIHN0YXRpYyBpbnQgc3RyaW5nVG9JcEFkZHIoU3RyaW5nIGFkZHJTdHJpbmcpIHRocm93cyBVbmtub3duSG9zdEV4Y2VwdGlvbiB7Ci0gICAgICAgIHRyeSB7Ci0gICAgICAgICAgICBTdHJpbmdbXSBwYXJ0cyA9IGFkZHJTdHJpbmcuc3BsaXQoIlxcLiIpOwotICAgICAgICAgICAgaWYgKHBhcnRzLmxlbmd0aCAhPSA0KSB7Ci0gICAgICAgICAgICAgICAgdGhyb3cgbmV3IFVua25vd25Ib3N0RXhjZXB0aW9uKGFkZHJTdHJpbmcpOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBpbnQgYSA9IEludGVnZXIucGFyc2VJbnQocGFydHNbMF0pICAgICAgOwotICAgICAgICAgICAgaW50IGIgPSBJbnRlZ2VyLnBhcnNlSW50KHBhcnRzWzFdKSA8PCAgODsKLSAgICAgICAgICAgIGludCBjID0gSW50ZWdlci5wYXJzZUludChwYXJ0c1syXSkgPDwgMTY7Ci0gICAgICAgICAgICBpbnQgZCA9IEludGVnZXIucGFyc2VJbnQocGFydHNbM10pIDw8IDI0OwotCi0gICAgICAgICAgICByZXR1cm4gYSB8IGIgfCBjIHwgZDsKLSAgICAgICAgfSBjYXRjaCAoTnVtYmVyRm9ybWF0RXhjZXB0aW9uIGV4KSB7Ci0gICAgICAgICAgICB0aHJvdyBuZXcgVW5rbm93bkhvc3RFeGNlcHRpb24oYWRkclN0cmluZyk7Ci0gICAgICAgIH0KKyAgICAvKioKKyAgICAgKiBGZXRjaCBkZWZhdWx0IGdhdGV3YXkgYWRkcmVzcyBmb3IgdGhlIG5ldHdvcmsKKyAgICAgKi8KKyAgIC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ICAgaW50IG9JcCwgb0d3LCBvTXNrLCBvRG5zMSwgb0RuczI7Ci0gICAgICAgICAgICBvSXAgPSBvR3cgPSBvTXNrID0gb0RuczEgPSBvRG5zMiA9IDA7Ci0gICAgICAgICAgICBpZiAod2FzU3RhdGljSXApIHsKLSAgICAgICAgICAgICAgICBvSXAgPSBtRGhjcEluZm8uaXBBZGRyZXNzOwotICAgICAgICAgICAgICAgIG9HdyA9IG1EaGNwSW5mby5nYXRld2F5OwotICAgICAgICAgICAgICAgIG9Nc2sgPSBtRGhjcEluZm8ubmV0bWFzazsKLSAgICAgICAgICAgICAgICBvRG5zMSA9IG1EaGNwSW5mby5kbnMxOwotICAgICAgICAgICAgICAgIG9EbnMyID0gbURoY3BJbmZvLmRuczI7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBjaGVja1VzZVN0YXRpY0lwKCk7Ci0KLSAgICAgICAgICAgIGlmIChtV2lmaUluZm8uZ2V0U3VwcGxpY2FudFN0YXRlKCkgPT0gU3VwcGxpY2FudFN0YXRlLlVOSU5JVElBTElaRUQpIHsKLSAgICAgICAgICAgICAgICByZXR1cm47Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIGJvb2xlYW4gY2hhbmdlZCA9Ci0gICAgICAgICAgICAgICAgKHdhc1N0YXRpY0lwICE9IG1Vc2VTdGF0aWNJcCkgfHwKLSAgICAgICAgICAgICAgICAgICAgKHdhc1N0YXRpY0lwICYmICgKLSAgICAgICAgICAgICAgICAgICAgICAgIG9JcCAgICE9IG1EaGNwSW5mby5pcEFkZHJlc3MgfHwKLSAgICAgICAgICAgICAgICAgICAgICAgIG9HdyAgICE9IG1EaGNwSW5mby5nYXRld2F5IHx8Ci0gICAgICAgICAgICAgICAgICAgICAgICBvTXNrICAhPSBtRGhjcEluZm8ubmV0bWFzayB8fAotICAgICAgICAgICAgICAgICAgICAgICAgb0RuczEgIT0gbURoY3BJbmZvLmRuczEgfHwKLSAgICAgICAgICAgICAgICAgICAgICAg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gICAgIHB1YmxpYyB2b2lkIG9uUmVjZWl2ZShDb250ZXh0IGNvbnRleHQsIEludGVudCBpbnRlbnQpIHsKKyAgICAgICAgICAgaWYgKGludGVudC5nZXRBY3Rpb24oKS5lcXVhbHMoV2lmaU1hbmFnZXIuTkVUV09SS19TVEFURV9DSEFOR0VEX0FDVElPTikpIHsKKyAgICAgICAgICAgICAgICBtTmV0d29ya0luZm8gPSAoTmV0d29ya0luZm8pIGludGVudC5nZXRQYXJjZWxhYmxlRXh0cmEoCisgICAgICAgICAgICAgICAgICAgICAgICBXaWZpTWFuYWdlci5FWFRSQV9ORVRXT1JLX0lORk8pOworICAgICAgICAgICAgICAgIG1OZXR3b3JrUHJvcGVydGllcyA9IChOZXR3b3JrUHJvcGVydGllcykgaW50ZW50LmdldFBhcmNlbGFibGVFeHRyYSgKKyAgICAgICAgICAgICAgICAgICAgICAgIFdpZmlNYW5hZ2VyLkVYVFJBX05FVFdPUktfUFJPUEVSVElFUyk7CisgICAgICAgICAgICAgICAgTWVzc2FnZSBtc2cgPSBtQ3NIYW5kbGVyLm9idGFpbk1lc3NhZ2UoRVZFTlRfU1RBVEVfQ0hBTkdFRCwgbU5ldHdvcmtJbmZvKTsKKyAgICAgICAgICAgICAgICBtc2cuc2VuZFRvVGFyZ2V0KCk7CisgICAgICAgICAgICB9IGVsc2UgaWYgKGludGVudC5nZXRBY3Rpb24oKS5lcXVhbHMoV2lmaU1hbmFnZXIuQ09ORklHX0NIQU5HRURfQUNUSU9OKSkgeworICAgICAgICAgICAgICAgIG1OZXR3b3JrUHJvcGVydGllcyA9IChOZXR3b3JrUHJvcGVydGllcykgaW50ZW50LmdldFBhcmNlbGFibGVFeHRyYSgKKyAgICAgICAgICAgICAgICAgICAgICAgIFdpZmlNYW5hZ2VyLkVYVFJBX05FVFdPUktfUFJPUEVSVElFUyk7CisgICAgICAgICAgICAgICAgTWVzc2FnZSBtc2cgPSBtQ3NIYW5kbGVyLm9idGFpbk1lc3NhZ2UoRVZFTlRfQ09ORklHVVJBVElPTl9DSEFOR0VELCBtTmV0d29ya0luZm8pOworICAgICAgICAgICAgICAgIG1zZy5zZW5kVG9UYXJnZXQoKTsKICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgcmVzZXROb3RpZmljYXRpb25UaW1lcigpOwotICAgICAgICB9Ci0KLSAgICAgICAgcHJpdmF0ZSBib29sZWFuIGdldFZhbHVlKCkgewotICAgICAgICAgICAgcmV0dXJuIFNldHRpbmdzLlNlY3VyZS5nZXRJbnQobUNvbnRleHQuZ2V0Q29udGVudFJlc29sdmVyKCksCi0gICAgICAgICAgICAgICAgICAgIFNldHRpbmdzLlNlY3VyZS5XSUZJX05FVFdPUktTX0FWQUlMQUJMRV9OT1RJRklDQVRJT05fT04sIDEpID09IDE7CiAgICAgICAgIH0KICAgICB9CisKIH0K