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ZXB0aW9uIGUpIAorCQl7CisJCWUucHJpbnRTdGFja1RyYWNlKCk7CisJCX0KKwkKKwl9IC8vIG1haW4KKwkKKwkvKiAqICogKiAqICogKiAqICogKiAqICogKiAqICogKiAqICogKiAqICogKiAqICogKiAqICogKiAqICogKiAqICogKiAqICogKiAqCisJICogc2ltdWxhdGVXb3JkZm9ybVNlcnZpY2VzOgorCSAqIAorCSAqIC0gY2FsbHMgc2FtZSBtZXRob2RlIHRvIHBhcnNlIGFuZCByZXdyaXRlIEtvcmFsUXVlcnkgdGhhdCB3b3JkZm9ybVNlcnZpY2VzIGRvLgorCSAqIAorCSAqIDI0LjA0LjIwL0ZCIAorCSAqICogKiAqICogKiAqICogKiAqICogKiAqICogKiAqICogKiAqICogKiAqICogKiAqICogKiAqICogKiAqICogKiAqICogKiAqICoKKwkgKi8KKwkKKwlzdGF0aWMgdm9pZCBzaW11bGF0ZVdvcmRmb3JtU2VydmljZXMoU3RyaW5nIGlucHV0RmlsZW5hbWUsIFN0cmluZyBvdXRwdXRGaWxlbmFtZSkgIAorCQorCXsKKwlmaW5hbCBTdHJpbmcgZnVuYyA9ICJzaW11bGF0ZVdvcmRmb3JtU2VydmljZXMiOworCVN0cmluZworCQlxdWVyeQkJPSBudWxsLAorCQluZXdRdWVyeQk9IG51bGw7CisKKyAgICB0cnkgeworCQlxdWVyeSA9IFV0aWxzLnJlYWRGcm9tSW5wdXRTdHJlYW0oIi4vIiArIGlucHV0RmlsZW5hbWUpOworCQl9IAorICAgIGNhdGNoIChJT0V4Y2VwdGlvbiBlMSkgeworCQllMS5wcmludFN0YWNrVHJhY2UoKTsKKwkJcmV0dXJuOworCQl9CisgICAgCisgICAgU3lzdGVtLm91dC5wcmludGYoIkRlYnVnOiAlczogc2VuZGluZyBxdWVyeSB0byBXb3JkZm9ybVNlcnZpY2VzLi4uXG4iLCAgZnVuYyk7CisgICAgCisJbmV3UXVlcnkgPSBXb3JkZm9ybVNlcnZpY2VzLmRvUE9TVF9oYW5k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