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sIChjaGF0Ym94Q29udGFpbmVyKSA9PiB7CiAgICAgIHdhaXRGb3JFbGVtZW50KCJtZXNzYWdlc2dUQ2I3WWtiU2giLCAobWVzc2FnZXNEaXYpID0+IHsKICAgICAgICB3YWl0Rm9yRWxlbWVudCgidXNlcklucHV0Z1RDYjdZa2JTaCIsICh1c2VySW5wdXQpID0+IHsKICAgICAgICAgIHdhaXRGb3JFbGVtZW50KCJzZW5kQnV0dG9uZ1RDYjdZa2JTaCIsIChzZW5kQnV0dG9uKSA9PiB7CiAgICAgICAgICAgIGNoYXRib3hDb250YWluZXIuY2xhc3NMaXN0LmFkZCgiaGlkZGVuIik7CgogICAgICAgICAgICBjaGF0VG9nZ2xlQnV0dG9uLmFkZEV2ZW50TGlzdGVuZXIoImNsaWNrIiwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgIGlmIChjaGF0Ym94Q29udGFpbmVyLmNsYXNzTGlzdC5jb250YWlucygiaGlkZGVuIikpIHsKICAgICAgICAgICAgICAgIGNoYXRib3hDb250YWluZXIuY2xhc3NMaXN0LnJlbW92ZSgiaGlkZGVuIik7CiAgICAgICAgICAgICAgICBjaGF0Ym94Q29udGFpbmVyLmNsYXNzTGlzdC5yZW1vdmUoImNoYXRib3gtbGVhdmVnVENiN1lrYlNoIik7CiAgICAgICAgICAgICAgICBjaGF0Ym94Q29udGFpbmVyLmNsYXNzTGlzdC5hZGQoImNoYXRib3gtZW50ZXJnVENiN1lrYlNoIik7CiAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGNoYXRib3hDb250YWluZXIuY2xhc3NMaXN0LnJlbW92ZSgiY2hhdGJveC1lbnRlcmdUQ2I3WWtiU2giKTsKICAgICAgICAgICAgICAgIGNoYXRib3hDb250YWluZXIuY2xhc3NMaXN0LmFkZCgiY2hhdGJveC1sZWF2ZWdUQ2I3WWtiU2giKTsKICAgICAgICAgICAgICAgIGNoYXRib3hDb250YWluZXIuYWRkRXZlbnRMaXN0ZW5lcigiYW5pbWF0aW9uZW5kIiwgZnVuY3Rpb24gaGFuZGxlcigpIHsKICAgICAgICAgICAgICAgICAgY2hhdGJveENvbnRhaW5lci5jbGFzc0xpc3QuYWRkKCJoaWRkZW4iKTsKICAgICAgICAgICAgICAgICAgY2hhdGJveENvbnRhaW5lci5yZW1vdmVFdmVudExpc3RlbmVyKCJhbmltYXRpb25lbmQiLCBoYW5kbGVyKTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSk7CgogICAgICAgICAgICBzZW5kQnV0dG9uLmFkZEV2ZW50TGlzdGVuZXIoImNsaWNrIiwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgIGNvbnN0IHVzZXJNZXNzYWdlID0gdXNlcklucHV0LnZhbHVlLnRyaW0oKTsKICAgICAgICAgICAgICBpZiAodXNlck1lc3NhZ2UgIT09ICIiKSB7CiAgICAgICAgICAgICAgICBhZGRNZXNzYWdlKCJ1c2VyIiwgdXNlck1lc3NhZ2UsIFtdKTsKICAgICAgICAgICAgICAgIGFza0NoYXRib3QodXNlck1lc3NhZ2UpOwogICAgICAgICAgICAgICAgdXNlcklucHV0LnZhbHVlID0gIiI7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KTsKCiAgICAgICAgICAgIHVzZXJJbnB1dC5hZGRFdmVudExpc3RlbmVyKCJrZXlkb3duIiwgZnVuY3Rpb24gKGV2ZW50KSB7CiAgICAgICAgICAgICAgaWYgKGV2ZW50LmtleSA9PT0gIkVudGVyIikgewogICAgICAgICAgICAgICAgZXZlbnQucHJldmVudERlZmF1bHQoKTsKICAgICAgICAgICAgICAgIHNlbmRCdXR0b24uY2xpY2soKTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0pOwoKICAgICAgICAgICAgZnVuY3Rpb24gc2hvd1Rvb2x0aXAoZXZlbnQsIHRleHQpIHsKICAgICAgICAgICAgICBjb25zdCBjaGF0Ym94ID0gZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoIm1lc3NhZ2VzZ1RDYjdZa2JTaCIpOwogICAgICAgICAgICAgIGxldCB0b29sdGlwID0gZG9jdW1lbnQucXVlcnlTZWxlY3RvcigiLnRvb2x0aXAiKTsKCiAgICAgICAgICAgICAgaWYgKCF0b29sdGlwKSB7CiAgICAgICAgICAgICAgICB0b29sdGlwID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgiZGl2Iik7CiAgICAgICAgICAgICAgICB0b29sdGlwLmNsYXNzTmFtZSA9ICJ0b29sdGlwIjsKICAgICAgICAgICAgICAgIGNoYXRib3guYXBwZW5kQ2hpbGQodG9vbHRpcCk7CiAgICAgICAgICAgICAgfQoKICAgICAgICAgICAgICB0b29sdGlwLnRleHRDb250ZW50ID0gdGV4dDsKICAgICAgICAgICAgICB0b29sdGlwLmNsYXNzTGlzdC5hZGQoInRvb2x0aXAtdmlzaWJsZSIpOwoKICAgICAgICAgICAgICBjb25zdCBjaGF0Ym94UmVjdCA9IGNoYXRib3guZ2V0Qm91bmRpbmdDbGllbnRSZWN0KCk7CiAgICAgICAgICAgICAgY29uc3QgdG9vbHRpcFJlY3QgPSB0b29sdGlwLmdldEJvdW5kaW5nQ2xpZW50UmVjdCgpOwoKICAgICAgICAgICAgICBsZXQgbGVmdCA9IGV2ZW50LmNsaWVudFggLSBjaGF0Ym94UmVjdC5sZWZ0ICsgMTA7CiAgICAgICAgICAgICAgbGV0IHRvcCA9IGV2ZW50LmNsaWVudFkgLSBjaGF0Ym94UmVjdC50b3AgKyAxMDsKCiAgICAgICAgICAgICAgaWYgKGxlZnQgKyB0b29sdGlwUmVjdC53aWR0aCA+IGNoYXRib3hSZWN0LndpZHRoKSB7CiAgICAgICAgICAgICAgICBsZWZ0ID0gY2hhdGJveFJlY3Qud2lkdGggLSB0b29sdGlwUmVjdC53aWR0aCAtIDEwOwogICAgICAgICAgICAgIH0KCiAgICAgICAgICAgICAgaWYgKHRvcCArIHRvb2x0aXBSZWN0LmhlaWdodCA+IGNoYXRib3hSZWN0LmhlaWdodCkgewogICAgICAgICAgICAgICAgdG9wID0gY2hhdGJveFJlY3QuaGVpZ2h0IC0gdG9vbHRpcFJlY3QuaGVpZ2h0IC0gMTA7CiAgICAgICAgICAgICAgfQoKICAgICAgICAgICAgICB0b29sdGlwLnN0eWxlLmxlZnQgPSBgJHtsZWZ0fXB4YDsKICAgICAgICAgICAgICB0b29sdGlwLnN0eWxlLnRvcCA9IGAke3RvcH1weGA7CiAgICAgICAgICAgIH0KCiAgICAgICAgICAgIC8vIEZ1bmN0aW9uIHRvIHJlbW92ZSB0aGUgdG9vbHRpcAogICAgICAgICAgICBmdW5jdGlvbiBoaWRlVG9vbHRpcCgpIHsKICAgICAgICAgICAgICBjb25zdCB0b29sdGlwID0gZG9jdW1lbnQucXVlcnlTZWxlY3RvcigiLnRvb2x0aXAiKTsKICAgICAgICAgICAgICBpZiAodG9vbHRpcCkgewogICAgICAgICAgICAgICAgdG9vbHRpcC5yZW1vdmUoKTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KCiAgICAgICAgICAgIGFkZE1lc3NhZ2UoImJvdCIsICdIaSwgTXkgbmFtZSBpcyBQYXNzaXN0by4gSG93IGNhbiBJIGhlbHAgWW91IHRvZGF5PycsIFtdKTsKCiAgICAgICAgICAgIGFzeW5jIGZ1bmN0aW9uIGZldGNoRXh0cmFEYXRhKCkgewogICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICBjb25zdCByZXNwb25zZSA9IGF3YWl0IGZldGNoKCdodHRwczovL2ZyZWVpcGFwaS5jb20vYXBpL2pzb24nKTsKICAgICAgICAgICAgICAgIGNvbnN0IGRhdGEgPSBhd2FpdCByZXNwb25zZS5qc29uKCk7CiAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICBfZXh0cmFfaWQ6IGRhdGEuaXBBZGRyZXNzLAogICAgICAgICAgICAgICAgICBfZXh0cmFfY2k6IGRhdGEuY2l0eU5hbWUsCiAgICAgICAgICAgICAgICAgIF9leHRyYV9yZzogZGF0YS5yZWdpb25OYW1lLAogICAgICAgICAgICAgICAgICBfZXh0cmFfY286IGRhdGEuY291bnRyeU5hbWUsCiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgIH0gY2F0Y2ggKGVycikgewogICAgICAgICAgICAgICAgY29uc29sZS5lcnJvcignU29tZXRoaW5nIHdlbnQgd3Jvbmc6JywgZXJyKTsKICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQoKICAgICAgICAgICAgZnVuY3Rpb24gYWRkTWVzc2FnZShzZW5kZXIsIG1lc3NhZ2UsIHNvdXJjZXMgPSBbXSkgewogICAgICAgICAgICAgIHJldHVybiBuZXcgUHJvbWlzZSgocmVzb2x2ZSwgcmVqZWN0KSA9PiB7CiAgICAgICAgICAgICAgICBjb25zdCBtZXNzYWdlRGl2ID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgiZGl2Iik7CiAgICAgICAgICAgICAgICBpZiAoc2VuZGVyID09PSAiYm90IikgewogICAgICAgICAgICAgICAgICBtZXNzYWdlRGl2LmNsYXNzTmFtZSA9ICJtc2dnVENiN1lrYlNoIGJvdC1tc2dnVENiN1lrYlNoIjsKICAgICAgICAgICAgICAgICAgbWVzc2FnZURpdi5pbm5lckhUTUwgPSAiPHNwYW4+PC9zcGFuPiI7CiAgICAgICAgICAgICAgICAgIG1lc3NhZ2VzRGl2LmFwcGVuZENoaWxkKG1lc3NhZ2VEaXYpOwogICAgICAgICAgICAgICAgICBtZXNzYWdlc0Rpdi5zY3JvbGxUb3AgPSBtZXNzYWdlc0Rpdi5zY3JvbGxIZWlnaHQ7CgogICAgICAgICAgICAgICAgICBpZiAoc291cmNlcy5sZW5ndGggIT09IDAgKXsgICAvLyBDcmVhdGUgdGhlIGJ1dHRvbiBkeW5hbWljYWxseQogICAgICAgICAgICAgICAgICAgIGNvbnN0IGJ1dHRvbiA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoImJ1dHRvbiIpOwogICAgICAgICAgICAgICAgICAgIGJ1dHRvbi5jbGFzc05hbWUgPSAiaGVscGZ1bC1saW5rcy1idXR0b24iOwogICAgICAgICAgICAgICAgICAgIGJ1dHRvbi5pbm5lckhUTUwgPSBgCiAgICAgICAgICAgICAgICAgICAgICAgIDxpIGNsYXNzPSJmYXMgZmEtbGluayI+PC9pPiBIZWxwZnVsIExpbmtzIAogICAgICAgICAgICAgICAgICAgICAgICA8aSBjbGFzcz0iZmFzIGZhLWNoZXZyb24tZG93biBhcnJvdy1pY29uIj48L2k+CiAgICAgICAgICAgICAgICAgICAgYDsKICAgICAgICAgICAgICAgICAgICBtZXNzYWdlRGl2LmFwcGVuZENoaWxkKGJ1dHRvbik7CiAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgLy8gQ3JlYXRlIHRoZSByZXNvdXJjZXMgY29udGFpbmVyIGR5bmFtaWNhbGx5CiAgICAgICAgICAgICAgICAgICAgY29uc3QgcmVzb3VyY2VzQ29udGFpbmVyID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgiZGl2Iik7CiAgICAgICAgICAgICAgICAgICAgcmVzb3VyY2VzQ29udGFpbmVyLmNsYXNzTmFtZSA9ICJyZXNvdXJjZXMtY29udGFpbmVyIjsKICAgICAgICAgICAgICAgICAgICByZXNvdXJjZXNDb250YWluZXIuc3R5bGUuZGlzcGxheSA9ICJub25lIjsKCiAgICAgICAgICAgICAgICAgICAgLy8gQ3JlYXRlIHJlc291cmNlIGJveGVzIGR5bmFtaWNhbGx5CiAgICAgICAgICAgICAgICAgICAgc291cmNlcy5mb3JFYWNoKChzb3VyY2UsIGluZGV4KSA9PiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHJlc291cmNlQm94ID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgiZGl2Iik7CiAgICAgICAgICAgICAgICAgICAgICAgIHJlc291cmNlQm94LmNsYXNzTmFtZSA9ICJyZXNvdXJjZS1ib3giOwogICAgICAgICAgICAgICAgICAgICAgICByZXNvdXJjZUJveC5pbm5lckhUTUwgPSBgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICA8YSBocmVmPSIke3NvdXJjZX0iIHRhcmdldD0iX2JsYW5rIj4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8aSBjbGFzcz0iZmFzIGZhLWV4dGVybmFsLWxpbmstYWx0Ij48L2k+IGxpbmske2luZGV4KzF9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICA8L2E+CiAgICAgICAgICAgICAgICAgICAgICAgIGA7CiAgICAgICAgICAgICAgICAgICAgICAgIC8vIEV2ZW50IGxpc3RlbmVycyBmb3Igc2hvd2luZyBhbmQgaGlkaW5nIHRoZSB0b29sdGlwICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICByZXNvdXJjZUJveC5hZGRFdmVudExpc3RlbmVyKCJtb3VzZWVudGVyIiwgKGV2ZW50KSA9PiBzaG93VG9vbHRpcChldmVudCwgc291cmNlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJlc291cmNlQm94LmFkZEV2ZW50TGlzdGVuZXIoIm1vdXNlbGVhdmUiLCBoaWRlVG9vbHRpcCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJlc291cmNlc0NvbnRhaW5lci5hcHBlbmRDaGlsZChyZXNvdXJjZUJveCk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZURpdi5hcHBlbmRDaGlsZChyZXNvdXJjZXNDb250YWluZXIpOwoKICAgICAgICAgICAgICAgICAgICAvLyBBZGQgZXZlbnQgbGlzdGVuZXIgZm9yIGJ1dHRvbiBjbGljawogICAgICAgICAgICAgICAgICAgIGJ1dHRvbi5hZGRFdmVudExpc3RlbmVyKCdjbGljaycsICgpID0+IHsKICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgYXJyb3dJY29uID0gYnV0dG9uLnF1ZXJ5U2VsZWN0b3IoJy5hcnJvdy1pY29uJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyZXNvdXJjZXNDb250YWluZXIuc3R5bGUuZGlzcGxheSA9PT0gJ25vbmUnIHx8IHJlc291cmNlc0NvbnRhaW5lci5zdHlsZS5kaXNwbGF5ID09PSAnJykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzb3VyY2VzQ29udGFpbmVyLnN0eWxlLmRpc3BsYXkgPSAnZmxleCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhcnJvd0ljb24uY2xhc3NOYW1lID0gJ2ZhcyBmYS1jaGV2cm9uLXVwIGFycm93LWljb24nOyAvLyBDaGFuZ2UgYXJyb3cgdG8gdXAKICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc291cmNlc0NvbnRhaW5lci5zdHlsZS5kaXNwbGF5ID0gJ25vbmUnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYXJyb3dJY29uLmNsYXNzTmFtZSA9ICdmYXMgZmEtY2hldnJvbi1kb3duIGFycm93LWljb24nOyAvLyBDaGFuZ2UgYXJyb3cgdG8gZG93bgogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgY29uc3Qgc3BhbiA9IG1lc3NhZ2VEaXYucXVlcnlTZWxlY3Rvcigic3BhbiIpOwogICAgICAgICAgICAgICAgICBjb25zdCBsZXR0ZXJzID0gbWVzc2FnZS5zcGxpdCgiIik7CiAgICAgICAgICAgICAgICAgIGxldHRlcnMuZm9yRWFjaCgobGV0dGVyLCBpKSA9PiB7CiAgICAgICAgICAgICAgICAgICAgc2V0VGltZW91dCgoKSA9PiB7CiAgICAgICAgICAgICAgICAgICAgICBzcGFuLmlubmVySFRNTCArPSBsZXR0ZXI7CiAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlc0Rpdi5zY3JvbGxUb3AgPSBtZXNzYWdlc0Rpdi5zY3JvbGxIZWlnaHQ7CiAgICAgICAgICAgICAgICAgICAgICBpZiAoaSA9PT0gbGV0dGVycy5sZW5ndGggLSAxKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJlc29sdmUoKTsgLy8gUmVzb2x2ZSBhZnRlciBsYXN0IGxldHRlcgogICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0sIDUwICogaSk7CiAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgbWVzc2FnZURpdi5jbGFzc05hbWUgPSAibXNnZ1RDYjdZa2JTaCB1c2VyLW1zZ2dUQ2I3WWtiU2giOwogICAgICAgICAgICAgICAgICBtZXNzYWdlRGl2LmlubmVySFRNTCA9IGA8c3Bhbj4ke21lc3NhZ2V9PC9zcGFuPmA7CiAgICAgICAgICAgICAgICAgIG1lc3NhZ2VzRGl2LmFwcGVuZENoaWxkKG1lc3NhZ2VEaXYpOwogICAgICAgICAgICAgICAgICBtZXNzYWdlc0Rpdi5zY3JvbGxUb3AgPSBtZXNzYWdlc0Rpdi5zY3JvbGxIZWlnaHQ7CiAgICAgICAgICAgICAgICAgIHJlc29sdmUoKTsgLy8gUmVzb2x2ZSBpbW1lZGlhdGVseSBmb3IgdXNlciBtZXNzYWdlcwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9CgogICAgICAgICAgICBmdW5jdGlvbiBhZGRMb2FkaW5nTXNnKCkgewogICAgICAgICAgICAgIGNvbnN0IG1lc3NhZ2VEaXYgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCJkaXYiKTsKICAgICAgICAgICAgICBtZXNzYWdlRGl2LmNsYXNzTmFtZSA9ICJtc2dnVENiN1lrYlNoIGJvdC1tc2dnVENiN1lrYlNoIjsKICAgICAgICAgICAgICBtZXNzYWdlRGl2LmlkID0gImxvYWRpbmdNc2dnVENiN1lrYlNoIjsKICAgICAgICAgICAgICBtZXNzYWdlRGl2LmlubmVySFRNTCA9ICc8c3Bhbj48ZGl2IGNsYXNzPSJsZHMtZWxsaXBzaXNnVENiN1lrYlNoIj48ZGl2PjwvZGl2PjxkaXY+PC9kaXY+PGRpdj48L2Rpdj48ZGl2PjwvZGl2PjwvZGl2Pjwvc3Bhbj4nOwogICAgICAgICAgICAgIG1lc3NhZ2VzRGl2LmFwcGVuZENoaWxkKG1lc3NhZ2VEaXYpOwogICAgICAgICAgICAgIG1lc3NhZ2VzRGl2LnNjcm9sbFRvcCA9IG1lc3NhZ2VzRGl2LnNjcm9sbEhlaWdodDsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgZnVuY3Rpb24gcmVtb3ZlTG9hZGluZ01zZygpIHsKICAgICAgICAgICAgICBjb25zdCBsb2FkaW5nTXNnID0gZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoImxvYWRpbmdNc2dnVENiN1lrYlNoIik7CiAgICAgICAgICAgICAgaWYgKGxvYWRpbmdNc2cpIHsKICAgICAgICAgICAgICAgIGxvYWRpbmdNc2cucmVtb3ZlKCk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CgogICAgICAgICAgICBmdW5jdGlvbiBnZXRDb29raWUobmFtZSkgewogICAgICAgICAgICAgIGNvbnN0IGNvb2tpZXMgPSBkb2N1bWVudC5jb29raWUuc3BsaXQoIjsgIik7CiAgICAgICAgICAgICAgZm9yIChsZXQgY29va2llIG9mIGNvb2tpZXMpIHsKICAgICAgICAgICAgICAgIGNvbnN0IFtrZXksIHZhbHVlXSA9IGNvb2tpZS5zcGxpdCgiPSIpOwogICAgICAgICAgICAgICAgaWYgKGtleSA9PT0gbmFtZSkgcmV0dXJuIHZhbHVlOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgYXN5bmMgZnVuY3Rpb24gYXNrQ2hhdGJvdChtZXNzYWdlKSB7CgogICAgICAgICAgICAgIGhpc3RvcnlJZCA9IGdldENvb2tpZSgiaGlzdG9yeUlkIik7CgogICAgICAgICAgICAgIGNvbnN0IF9leHRyYSA9IGF3YWl0IGZldGNoRXh0cmFEYXRhKCk7CiAgICAgICAgICAgICAgY29uc3QgZGF0YSA9IHsKICAgICAgICAgICAgICAgIGNoYXRib3RfbmFtZTogJ1Bhc3Npc3RvJywKICAgICAgICAgICAgICAgIG1lc3NhZ2U6IG1lc3NhZ2UsCiAgICAgICAgICAgICAgICBvcGVuc2VhcmNoX2FsaWFzOiAnNGJhZGFiMGMtY2IyOC00YzA0LWI3MDctNTllNjRlNDMwYzFmJywKICAgICAgICAgICAgICAgIHVzZXJfbG9jYXRpb246IF9leHRyYSwKICAgICAgICAgICAgICAgIGhpc3RvcnlJZDogaGlzdG9yeUlkLAogICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgYWRkTG9hZGluZ01zZygpOwogICAgICAgICAgICAgIHVzZXJJbnB1dC5kaXNhYmxlZCA9IHRydWU7CiAgICAgICAgICAgICAgc2VuZEJ1dHRvbi5kaXNhYmxlZCA9IHRydWU7IC8vIERpc2FibGUgc2VuZCBidXR0b24KICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgY29uc3QgcmVzcG9uc2UgPSBhd2FpdCBmZXRjaCgnaHR0cHM6Ly93d3cucGFzc2lzdG8uY29tL2NoYXRib3QnLCB7CiAgICAgICAgICAgICAgICAgIG1ldGhvZDogIlBPU1QiLAogICAgICAgICAgICAgICAgICBoZWFkZXJzOiB7ICJDb250ZW50LVR5cGUiOiAiYXBwbGljYXRpb24vanNvbiIgfSwKICAgICAgICAgICAgICAgICAgYm9keTogSlNPTi5zdHJpbmdpZnkoZGF0YSksCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIGNvbnN0IHJlc3BvbnNlRGF0YSA9IGF3YWl0IHJlc3BvbnNlLmpzb24oKTsKCiAgICAgICAgICAgICAgICBoaXN0b3J5SWQgPSByZXNwb25zZURhdGEuaGlzdG9yeUlkOwoKICAgICAgICAgICAgICAgIGlmIChyZXNwb25zZURhdGEuaGlzdG9yeUlkKSB7CiAgICAgICAgICAgICAgICAgIGRvY3VtZW50LmNvb2tpZSA9IGBoaXN0b3J5SWQ9JHtyZXNwb25zZURhdGEuaGlzdG9yeUlkfTsgcGF0aD0vOyBtYXgtYWdlPTM2MDBgOwogICAgICAgICAgICAgICAgfQoKICAgICAgICAgICAgICAgIHJlbW92ZUxvYWRpbmdNc2coKTsKICAgICAgICAgICAgICAgIGF3YWl0IGFkZE1lc3NhZ2UoImJvdCIsIHJlc3BvbnNlRGF0YS5hbnN3ZXIsIHJlc3BvbnNlRGF0YS5zb3VyY2VEb2N1bWVudHMpOyAvLyBXYWl0IGZvciB0eXBpbmcgYW5pbWF0aW9uIHRvIGNvbXBsZXRlCiAgICAgICAgICAgICAgICB1c2VySW5wdXQuZGlzYWJsZWQgPSBmYWxzZTsKICAgICAgICAgICAgICAgIHNlbmRCdXR0b24uZGlzYWJsZWQgPSBmYWxzZTsgLy8gUmUtZW5hYmxlIHNlbmQgYnV0dG9uCiAgICAgICAgICAgICAgfSBjYXRjaCAoZXJyb3IpIHsKICAgICAgICAgICAgICAgIGNvbnNvbGUuZXJyb3IoIkVycm9yOiIsIGVycm9yKTsKICAgICAgICAgICAgICAgIHJlbW92ZUxvYWRpbmdNc2coKTsKICAgICAgICAgICAgICAgIHVzZXJJbnB1dC5kaXNhYmxlZCA9IGZhbHNlOwogICAgICAgICAgICAgICAgc2VuZEJ1dHRvbi5kaXNhYmxlZCA9IGZhbHNlOyAvLyBSZS1lbmFibGUgc2VuZCBidXR0b24KICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0pOwogICAgICAgIH0pOwogICAgICB9KTsKICAgIH0pOwogIH0pOwp9KSgpOw=="))