From f73de31a17a31d0b2d44d33a520886c822659c60 Mon Sep 17 00:00:00 2001 From: Pedro Sanders Date: Wed, 3 Jul 2024 15:05:00 -0400 Subject: [PATCH] chore: set refreshFrequency to 70% and increase expire to 120 --- simplephone/dist/phone.js | 3 ++- simplephone/dist/phone.js.map | 2 +- simplephone/public/lib/phone.js | 5 +++-- simplephone/src/phone.ts | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/simplephone/dist/phone.js b/simplephone/dist/phone.js index a745880..0f42850 100644 --- a/simplephone/dist/phone.js +++ b/simplephone/dist/phone.js @@ -101,7 +101,8 @@ class Phone { }, }, registererOptions: { - expires: 15, + expires: 120, + refreshFrequency: 70, extraHeaders: this.getExtraHeaders() } }; diff --git a/simplephone/dist/phone.js.map b/simplephone/dist/phone.js.map index 91d3180..354d2ee 100644 --- a/simplephone/dist/phone.js.map +++ b/simplephone/dist/phone.js.map @@ -1 +1 @@ -{"version":3,"file":"phone.js","sourceRoot":"","sources":["../src/phone.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,mCAA6B;AAC7B,mCAA+D;AAE/D,MAAM,KAAK;IAeT;QAwBA,oBAAe,GAAG,GAAG,EAAE;YACrB,OAAO,IAAI,CAAC,iBAAiB,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC5F,CAAC,CAAA;QAzBC,IAAI,CAAC,aAAa,GAAG,IAAA,iBAAS,EAAC,eAAe,CAAC,CAAC;QAChD,IAAI,CAAC,cAAc,GAAG,IAAA,iBAAS,EAAC,gBAAgB,CAAC,CAAC;QAClD,IAAI,CAAC,UAAU,GAAG,IAAA,iBAAS,EAAC,YAAY,CAAC,CAAC;QAC1C,IAAI,CAAC,gBAAgB,GAAG,IAAA,gBAAQ,EAAC,kBAAkB,CAAC,CAAC;QACrD,IAAI,CAAC,aAAa,GAAG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AsB,CAAC,KAAK;YACpD,QAAQ,EAAE,IAAI,CAAC,aAAa,CAAC,KAAK;YAClC,MAAM,EAAE,IAAI,CAAC,WAAW,CAAC,KAAK;YAC9B,MAAM,EAAE,IAAI,CAAC,WAAW,CAAC,KAAK;YAC9B,SAAS,EAAE,IAAI,CAAC,cAAc,CAAC,KAAK;YACpC,eAAe,EAAE,IAAI,CAAC,eAAe,EAAE;SACxC,CAAC;QAEF,YAAY,CAAC,OAAO,CAAC,aAAa,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC;IACnE,CAAC;CACF;AAED,IAAI,KAAK,EAAE,CAAC"} \ No newline at end of file diff --git a/simplephone/public/lib/phone.js b/simplephone/public/lib/phone.js index 9825519..e24a819 100644 --- a/simplephone/public/lib/phone.js +++ b/simplephone/public/lib/phone.js @@ -111,7 +111,8 @@ class Phone { }, }, registererOptions: { - expires: 15, + expires: 120, + refreshFrequency: 70, extraHeaders: this.getExtraHeaders() } }; @@ -22452,4 +22453,4 @@ const LIBRARY_VERSION = "0.21.1"; /******/ /******/ })() ; -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGhvbmUuanMiLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7OztBQUFhO0FBQ2I7QUFDQSw0QkFBNEIsK0RBQStELGlCQUFpQjtBQUM1RztBQUNBLG9DQUFvQyxNQUFNLCtCQUErQixZQUFZO0FBQ3JGLG1DQUFtQyxNQUFNLG1DQUFtQyxZQUFZO0FBQ3hGLGdDQUFnQztBQUNoQztBQUNBLEtBQUs7QUFDTDtBQUNBLDhDQUE2QyxFQUFFLGFBQWEsRUFBQztBQUM3RCxpQkFBaUIsbUJBQU8sQ0FBQyxrREFBUTtBQUNqQyxnQkFBZ0IsbUJBQU8sQ0FBQyxnQ0FBUztBQUNqQztBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQ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dGhpcy5zaW1wbGVVc2VyLmRpc2Nvbm5lY3QoKTtcbiAgICAgICAgICAgICAgICB0aGlzLnNpbXBsZVVzZXIgPSBudWxsO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgY29uc3QgZGVsZWdhdGUgPSB7XG4gICAgICAgICAgICAgICAgb25DYWxsUmVjZWl2ZWQ6ICgpID0+IF9fYXdhaXRlcih0aGlzLCB2b2lkIDAsIHZvaWQgMCwgZnVuY3Rpb24qICgpIHtcbiAgICAgICAgICAgICAgICAgICAgY29uc29sZS5sb2coXCJJbmNvbWluZyBDYWxsIVwiKTtcbiAgICAgICAgICAgICAgICAgICAgeWllbGQgdGhpcy5zaW1wbGVVc2VyLmFuc3dlcigpO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmNhbGxCdXR0b24udGV4dENvbnRlbnQgPSBcIkhhbmd1cFwiO1xuICAgICAgICAgICAgICAgIH0pLFxuICAgICAgICAgICAgICAgIG9uQ2FsbEFuc3dlcmVkOiAoKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKFwiQ2FsbCBBbnN3ZXJlZCFcIik7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuY2FsbEJ1dHRvbi50ZXh0Q29udGVudCA9IFwiSGFuZ3VwXCI7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBvbkNhbGxIYW5ndXA6ICgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgY29uc29sZS5sb2coXCJDYWxsIEhhbmd1cCFcIik7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuY2FsbEJ1dHRvbi50ZXh0Q29udGVudCA9IFwiQ2FsbFwiO1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgb25SZWdpc3RlcmVkOiAoKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKFwiUmVnaXN0ZXJlZCFcIik7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMucmVnaXN0ZXJCdXR0b24udGV4dENvbnRlbnQgPSBcIlVucmVnaXN0ZXJcIjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIG9uVW5yZWdpc3RlcmVkOiAoKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKFwiVW5yZWdpc3RlcmVkIVwiKTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5yZWdpc3RlckJ1dHRvbi50ZXh0Q29udGVudCA9IFwiUmVnaXN0ZXJcIjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIG9uU2VydmVyRGlzY29ubmVjdDogKCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhcIlNlcnZlciBEaXNjb25uZWN0IVwiKTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5yZWdpc3RlckJ1dHRvbi5kaXNhYmxlZCA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuY2FsbEJ1dHRvbi5kaXNhYmxlZCA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuY29ubmVjdEJ1dHRvbi5kaXNhYmxlZCA9IGZhbHNlO1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgb25TZXJ2ZXJDb25uZWN0OiAoKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKFwiU2VydmVyIENvbm5lY3QhXCIpO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnJlZ2lzdGVyQnV0dG9uLmRpc2FibGVkID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuY2FsbEJ1dHRvbi5kaXNhYmxlZCA9IGZhbHNlO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmNvbm5lY3RCdXR0b24uZGlzYWJsZWQgPSB0cnVlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICBjb25zdCBvcHRpb25zID0ge1xuICAgICAgICAgICAgICAgIGFvcjogXCJzaXA6XCIgKyB0aGlzLnVzZXJuYW1lSW5wdXQudmFsdWUgKyBcIkBcIiArIHRoaXMuZG9tYWluSW5wdXQudmFsdWUsXG4gICAgICAgICAgICAgICAgZGVsZWdhdGU6IGRlbGVnYXRlLFxuICAgICAgICAgICAgICAgIG1lZGlhOiB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0cmFpbnRzOiB7IGF1ZGlvOiB0cnVlLCB2aWRlbzogZmFsc2UgfSxcbiAgICAgICAgICAgICAgICAgICAgcmVtb3RlOiB7XG4gICAgICAgICAgICAgICAgICAgICAgICBhdWRpbzogKDAsIHV0aWxzXzEuZ2V0QXVkaW9FbGVtZW50KShcInJlbW90ZUF1ZGlvXCIpXG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHVzZXJBZ2VudE9wdGlvbnM6IHtcbiAgICAgICAgICAgICAgICAgICAgZGlzcGxheU5hbWU6IHRoaXMuZGlzcGxheU5hbWVJbnB1dC52YWx1ZSB8fCBcIkFub255bW91c1wiLFxuICAgICAgICAgICAgICAgICAgICBhdXRob3JpemF0aW9uVXNlcm5hbWU6IHRoaXMuYXV0aG9yaXphdGlvblVzZXJJbnB1dC52YWx1ZSB8fCB0aGlzLnVzZXJuYW1lSW5wdXQudmFsdWUsXG4gICAgICAgICAgICAgICAgICAgIGF1dGhvcml6YXRpb25QYXNzd29yZDogdGhpcy5wYXNzd29yZElucHV0LnZhbHVlLFxuICAgICAgICAgICAgICAgICAgICBhbGxvd0xlZ2FjeU5vdGlmaWNhdGlvbnM6IGZhbHNlLFxuICAgICAgICAgICAgICAgICAgICB0cmFuc3BvcnRPcHRpb25zOiB7XG4gICAgICAgICAgICAgICAgICAgICAgICBzZXJ2ZXI6IHRoaXMuc2VydmVySW5wdXQudmFsdWUsXG4gICAgICAgICAgICAgICAgICAgICAgICBrZWVwQWxpdmVJbnRlcnZhbDogMTUsXG4gICAgICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICByZWdpc3RlcmVyT3B0aW9uczoge1xuICAgICAgICAgICAgICAgICAgICBleHBpcmVzOiAxNSxcbiAgICAgICAgICAgICAgICAgICAgZXh0cmFIZWFkZXJzOiB0aGlzLmdldEV4dHJhSGVhZGVycygpXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIGNvbnN0IHNlcnZlciA9IHRoaXMuc2VydmVySW5wdXQudmFsdWU7XG4gICAgICAgICAgICB0aGlzLnNpbXBsZVVzZXIgPSBuZXcgc2lwX2pzXzEuV2ViLlNpbXBsZVVzZXIoc2VydmVyLCBvcHRpb25zKTtcbiAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgICAgeWllbGQgdGhpcy5zaW1wbGVVc2VyLmNvbm5lY3QoKTtcbiAgICAgICAgICAgICAgICB0aGlzLmNvbm5lY3RCdXR0b24uZGlzYWJsZWQgPSB0cnVlO1xuICAgICAgICAgICAgICAgIHRoaXMucmVnaXN0ZXJCdXR0b24uZGlzYWJsZWQgPSBmYWxzZTtcbiAgICAgICAgICAgICAgICB0aGlzLmNhbGxCdXR0b24uZGlzYWJsZWQgPSBmYWxzZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGNhdGNoIChlcnJvcikge1xuICAgICAgICAgICAgICAgIHdpbmRvdy5hbGVydChcIkVycm9yOiBcIiArIGVycm9yKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSk7XG4gICAgfVxuICAgIHJlZ2lzdGVyKCkge1xuICAgICAgICByZXR1cm4gX19hd2FpdGVyKHRoaXMsIHZvaWQgMCwgdm9pZCAwLCBmdW5jdGlvbiogKCkge1xuICAgICAgICAgICAgY29uc29sZS5sb2coXCJSZWdpc3RlcmluZy4uLlwiKTtcbiAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgICAgLy8gQXR0ZW1wdCB0byBzYXZlIHRoZSBjdXJyZW50IGNvbmZpZ3VyYXRpb25cbiAgICAgICAgICAgICAgICB0aGlzLnNhdmVDb25maWcoKTtcbiAgICAgICAgICAgICAgICBpZiAodGhpcy5yZWdpc3RlckJ1dHRvbi50ZXh0Q29udGVudCA9PT0gXCJSZWdpc3RlclwiKSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIFJlZ2lzdGVyIHRvIHJlY2VpdmUgaW5ib3VuZCBjYWxsc1xuICAgICAgICAgICAgICAgICAgICB5aWVsZCB0aGlzLnNpbXBsZVVzZXIucmVnaXN0ZXIoKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHlpZWxkIHRoaXMuc2ltcGxlVXNlci51bnJlZ2lzdGVyKCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgY2F0Y2ggKGVycm9yKSB7XG4gICAgICAgICAgICAgICAgYWxlcnQoXCJFcnJvcjogXCIgKyBlcnJvcik7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuICAgIH1cbiAgICBjYWxsKCkge1xuICAgICAgICByZXR1cm4gX19hd2FpdGVyKHRoaXMsIHZvaWQgMCwgdm9pZCAwLCBmdW5jdGlvbiogKCkge1xuICAgICAgICAgICAgY29uc29sZS5sb2coXCJDYWxsaW5nLi4uXCIpO1xuICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICBpZiAodGhpcy5jYWxsQnV0dG9uLnRleHRDb250ZW50ID09PSBcIkNhbGxcIikge1xuICAgICAgICAgICAgICAgICAgICB5aWVsZCB0aGlzLnNpbXBsZVVzZXIuY2FsbCh0aGlzLnRhcmdldEFPUklucHV0LnZhbHVlLCB7XG4gICAgICAgICAgICAgICAgICAgICAgICBleHRyYUhlYWRlcnM6IHRoaXMuZ2V0RXh0cmFIZWFkZXJzKClcbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICB5aWVsZCB0aGlzLnNpbXBsZVVzZXIuaGFuZ3VwKCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgY2F0Y2ggKGVycm9yKSB7XG4gICAgICAgICAgICAgICAgYWxlcnQoXCJFcnJvcjogXCIgKyBlcnJvcik7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuICAgIH1cbiAgICBoYXNBbGxSZXF1aXJlZEZpZWxkcygpIHtcbiAgICAgICAgcmV0dXJuICh0aGlzLnVzZXJuYW1lSW5wdXQudmFsdWUgJiZcbiAgICAgICAgICAgIHRoaXMuZG9tYWluSW5wdXQudmFsdWUgJiZcbiAgICAgICAgICAgIHRoaXMuc2VydmVySW5wdXQudmFsdWUgJiZcbiAgICAgICAgICAgIHRoaXMudGFyZ2V0QU9SSW5wdXQudmFsdWUpO1xuICAgIH1cbiAgICBsb2FkQ29uZmlnKCkge1xuICAgICAgICB2YXIgX2E7XG4gICAgICAgIGNvbnN0IHBob25lQ29uZmlnU3RyaW5nID0gbG9jYWxTdG9yYWdlLmdldEl0ZW0oXCJwaG9uZUNvbmZpZ1wiKTtcbiAgICAgICAgaWYgKHBob25lQ29uZmlnU3RyaW5nKSB7XG4gICAgICAgICAgICBjb25zdCBwaG9uZUNvbmZpZyA9IEpTT04ucGFyc2UocGhvbmVDb25maWdTdHJpbmcpO1xuICAgICAgICAgICAgdGhpcy5kaXNwbGF5TmFtZUlucHV0LnZhbHVlID0gcGhvbmVDb25maWcuZGlzcGxheU5hbWU7XG4gICAgICAgICAgICB0aGlzLnVzZXJuYW1lSW5wdXQudmFsdWUgPSBwaG9uZUNvbmZpZy51c2VybmFtZTtcbiAgICAgICAgICAgIHRoaXMuYXV0aG9yaXphdGlvblVzZXJJbnB1dC52YWx1ZSA9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ICAgICAgICAgICB0aGlzLndhaXRpbmdGb3JQcmFjayA9IHRydWU7XG4gICAgICAgICAgICB0aGlzLmdlbmVyYXRlUmVzcG9uc2VPZmZlckFuc3dlcih0aGlzLmluY29taW5nSW52aXRlUmVxdWVzdCwgcmVzcG9uc2VPcHRpb25zKVxuICAgICAgICAgICAgICAgIC50aGVuKChvZmZlckFuc3dlcikgPT4ge1xuICAgICAgICAgICAgICAgIGJvZHkgPSBvZmZlckFuc3dlcjtcbiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5pbmNvbWluZ0ludml0ZVJlcXVlc3QucHJvZ3Jlc3MoeyBzdGF0dXNDb2RlLCByZWFzb25QaHJhc2UsIGV4dHJhSGVhZGVycywgYm9keSB9KTtcbiAgICAgICAgICAgIH0pXG4gICAgICAgICAgICAgICAgLnRoZW4oKHByb2dyZXNzUmVzcG9uc2UpID0+IHtcbiAgICAgICAgICAgICAgICB0aGlzLl9kaWFsb2cgPSBwcm9ncmVzc1Jlc3BvbnNlLnNlc3Npb247XG4gICAgICAgICAgICAgICAgbGV0IHByYWNrUmVxdWVzdDtcbiAgICAgICAgICAgICAgICBsZXQgcHJhY2tSZXNwb25zZTtcbiAgICAgICAgICAgICAgICBwcm9ncmVzc1Jlc3BvbnNlLnNlc3Npb24uZGVsZWdhdGUgPSB7XG4gICAgICAgICAgICAgICAgICAgIG9uUHJhY2s6IChyZXF1ZXN0KSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICBwcmFja1JlcXVlc3QgPSByZXF1ZXN0O1xuICAgICAgICAgICAgICAgICAgICAgICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIEB0eXBlc2NyaXB0LWVzbGludC9uby11c2UtYmVmb3JlLWRlZmluZVxuICAgICAgICAgICAgICAgICAgICAgICAgY2xlYXJUaW1lb3V0KHByYWNrV2FpdFRpbWVvdXRUaW1lcik7XG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgQHR5cGVzY3JpcHQtZXNsaW50L25vLXVzZS1iZWZvcmUtZGVmaW5lXG4gICAgICAgICAgICAgICAgICAgICAgICBjbGVhclRpbWVvdXQocmVsMXh4UmV0cmFuc21pc3Npb25UaW1lcik7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXRoaXMud2FpdGluZ0ZvclByYWNrKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy53YWl0aW5nRm9yUHJhY2sgPSBmYWxzZTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuaGFuZGxlUHJhY2tPZmZlckFuc3dlcihwcmFja1JlcXVlc3QpXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgLnRoZW4oKHByYWNrUmVzcG9uc2VCb2R5KSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJhY2tSZXNwb25zZSA9IHByYWNrUmVxdWVzdC5hY2NlcHQoeyBzdGF0dXNDb2RlOiAyMDAsIGJvZHk6IHByYWNrUmVzcG9uc2VCb2R5IH0pO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnByYWNrQXJyaXZlZCgpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXNvbHZlKHsgcHJhY2tSZXF1ZXN0LCBwcmFja1Jlc3BvbnNlLCBwcm9ncmVzc1Jlc3BvbnNlIH0pO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXRjaCAoZXJyb3IpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVqZWN0KGVycm9yKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5jYXRjaCgoZXJyb3IpID0+IHJlamVjdChlcnJvcikpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICAvLyBodHRwczovL3Rvb2xzLmlldGYub3JnL2h0bWwvcmZjMzI2MiNzZWN0aW9uLTNcbiAgICAgICAgICAgICAgICBjb25zdCBwcmFja1dhaXRUaW1lb3V0ID0gKCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICBpZiAoIXRoaXMud2FpdGluZ0ZvclByYWNrKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgdGhpcy53YWl0aW5nRm9yUHJhY2sgPSBmYWxzZTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIud2FybihcIk5vIFBSQUNLIHJlY2VpdmVkLCByZWplY3RpbmcgSU5WSVRFLlwiKTtcbiAgICAgICAgICAgICAgICAgICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIEB0eXBlc2NyaXB0LWVzbGludC9uby11c2UtYmVmb3JlLWRlZmluZVxuICAgICAgICAgICAgICAgICAgICBjbGVhclRpbWVvdXQocmVsMXh4UmV0cmFuc21pc3Npb25UaW1lcik7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMucmVqZWN0KHsgc3RhdHVzQ29kZTogNTA0IH0pXG4gICAgICAgICAgICAgICAgICAgICAgICAudGhlbigoKSA9PiByZWplY3QobmV3IFNlc3Npb25UZXJtaW5hdGVkRXJyb3IoKSkpXG4gICAgICAgICAgICAgICAgICAgICAgICAuY2F0Y2goKGVycm9yKSA9PiByZWplY3QoZXJyb3IpKTtcbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgIGNvbnN0IHByYWNrV2FpdFRpbWVvdXRUaW1lciA9IHNldFRpbWVvdXQocHJhY2tXYWl0VGltZW91dCwgVGltZXJzLlQxICogNjQpO1xuICAgICAgICAgICAgICAgIC8vIGh0dHBzOi8vdG9vbHMuaWV0Zi5vcmcvaHRtbC9yZmMzMjYyI3NlY3Rpb24tM1xuICAgICAgICAgICAgICAgIGNvbnN0IHJlbDF4eFJldHJhbnNtaXNzaW9uID0gKCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5pbmNvbWluZ0ludml0ZVJlcXVlc3QucHJvZ3Jlc3MoeyBzdGF0dXNDb2RlLCByZWFzb25QaHJhc2UsIGV4dHJhSGVhZGVycywgYm9keSB9KTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBjYXRjaCAoZXJyb3IpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMud2FpdGluZ0ZvclByYWNrID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgICAgICAgICByZWplY3QoZXJyb3IpO1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBAdHlwZXNjcmlwdC1lc2xpbnQvbm8tdXNlLWJlZm9yZS1kZWZpbmVcbiAgICAgICAgICAgICAgICAgICAgcmVsMXh4UmV0cmFuc21pc3Npb25UaW1lciA9IHNldFRpbWVvdXQocmVsMXh4UmV0cmFuc21pc3Npb24sICh0aW1lb3V0ICo9IDIpKTtcbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgIGxldCB0aW1lb3V0ID0gVGltZXJzLlQxO1xuICAgICAgICAgICAgICAgIGxldCByZWwxeHhSZXRyYW5zbWlzc2lvblRpbWVyID0gc2V0VGltZW91dChyZWwxeHhSZXRyYW5zbWlzc2lvbiwgdGltZW91dCk7XG4gICAgICAgICAgICB9KVxuICAgICAgICAgICAgICA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GFub255bW91cy5pbnZhbGlkXCI7XG4gICAgICAgIH1cbiAgICAgICAgbGV0IGZyb21VUkkgPSB1c2VyQWdlbnQudXNlckFnZW50Q29yZS5jb25maWd1cmF0aW9uLmFvcjtcbiAgICAgICAgaWYgKGludml0ZXJPcHRpb25zLnBhcmFtcy5mcm9tVXJpKSB7XG4gICAgICAgICAgICBmcm9tVVJJID1cbiAgICAgICAgICAgICAgICB0eXBlb2YgaW52aXRlck9wdGlvbnMucGFyYW1zLmZyb21VcmkgPT09IFwic3RyaW5nXCJcbiAgICAgICAgICAgICAgICAgICAgPyBHcmFtbWFyLlVSSVBhcnNlKGludml0ZXJPcHRpb25zLnBhcmFtcy5mcm9tVXJpKVxuICAgICAgICAgICAgICAgICAgICA6IGludml0ZXJPcHRpb25zLnBhcmFtcy5mcm9tVXJpO1xuICAgICAgICB9XG4gICAgICAgIGlmICghZnJvbVVSSSkge1xuICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcihcIkludmFsaWQgZnJvbSBVUkk6IFwiICsgaW52aXRlck9wdGlvbnMucGFyYW1zLmZyb21VcmkpO1xuICAgICAgICB9XG4gICAgICAgIGxldCB0b1VSSSA9IHRhcmdldFVSSTtcbiAgICAgICAgaWYgKGludml0ZXJPcHRpb25zLnBhcmFtcy50b1VyaSkge1xuICAgICAgICAgICAgdG9VUkkgPVxuICAgICAgICAgICAgICAgIHR5cGVvZiBpbnZpdGVyT3B0aW9ucy5wYXJhbXMudG9VcmkgPT09IFwic3RyaW5nXCJcbiAgICAgICAgICAgICAgICAgICAgPyBHcmFtbWFyLlVSSVBhcnNlKGludml0ZXJPcHRpb25zLnBhcmFtcy50b1VyaSlcbiAgICAgICAgICAgICAgICAgICAgOiBpbnZpdGVyT3B0aW9ucy5wYXJhbXMudG9Vcmk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKCF0b1VSSSkge1xuICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcihcIkludmFsaWQgdG8gV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xuICAgICAgICAgICAgICAgIGlmICh0aGlzLmlzQ2FuY2VsZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIubG9nKFwiQ2FuY2VsZWQgc2Vzc2lvbiBhY2NlcHRlZCwgc2VuZGluZyBBQ0sgYW5kIEJZRVwiKTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5hY2tBbmRCeWUoaW52aXRlUmVzcG9uc2UpO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnN0YXRlVHJhbnNpdGlvbihTZXNzaW9uU3RhdGUuVGVybWluYXRlZCk7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgdGhpcy5ub3RpZnlSZWZlcmVyKGludml0ZVJlc3BvbnNlKTtcbiAgICAgICAgICAgICAgICB0aGlzLm9uQWNjZXB0KGludml0ZVJlc3BvbnNlKVxuICAgICAgICAgICAgICAgICAgICAudGhlbigoKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZGlzcG9zZUVhcmx5TWVkaWEoKTtcbiAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgICAgICAgICAuY2F0Y2goKCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmRpc3Bvc2VFYXJseU1lZGlhKCk7XG4gICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgICAgICAgLnRoZW4oKCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICBpZiAob3B0aW9ucy5yZXF1ZXN0RGVsZWdhdGUgJiYgb3B0aW9ucy5yZXF1ZXN0RGVsZWdhdGUub25BY2NlcHQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG9wdGlvbnMucmVxdWVzdERlbGVnYXRlLm9uQWNjZXB0KGludml0ZVJlc3BvbnNlKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIG9uUHJvZ3Jlc3M6IChpbnZpdGVSZXNwb25zZSkgPT4ge1xuICAgICAgICAgICAgICAgIC8vIElmIHRoZSB1c2VyIHJlcXVlc3RlZCBjYW5jZWxsYXRpb24sIGlnbm9yZSByZXNwb25zZS5cbiAgICAgICAgICAgICAgICBpZiAodGhpcy5pc0NhbmNlbGVkKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgdGhpcy5ub3RpZnlSZWZlcmVyKGludml0ZVJlc3BvbnNlKTtcbiAgICAgICAgICAgICAgICB0aGlzLm9uUHJvZ3Jlc3MoaW52aXRlUmVzcG9uc2UpXG4gICAgICAgICAgICAgICAgICAgIC5jYXRjaCgoKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZGlzcG9zZUVhcmx5TWVkaWEoKTtcbiAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgICAgICAgICAudGhlbigoKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChvcHRpb25zLnJlcXVlc3REZWxlZ2F0ZSAmJiBvcHRpb25zLnJlcXVlc3REZWxlZ2F0ZS5vblByb2dyZXNzKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBvcHRpb25zLnJlcXVlc3REZWxlZ2F0ZS5vblByb2dyZXNzKGludml0ZVJlc3BvbnNlKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIG9uUmVkaXJlY3Q6IChpbnZpdGVSZXNwb25zZSkgPT4ge1xuICAgICAgICAgICAgICAgIHRoaXMubm90aWZ5UmVmZXJlcihpbnZpdGVSZXNwb25zZSk7XG4gICAgICAgICAgICAgICAgdGhpcy5vblJlZGlyZWN0KGludml0ZVJlc3BvbnNlKTtcbiAgICAgICAgICAgICAgICBpZiAob3B0aW9ucy5yZXF1ZXN0RGVsZWdhdGUgJiYgb3B0aW9ucy5yZXF1ZXN0RGVsZWdhdGUub25SZWRpcmVjdCkge1xuICAgICAgICAgICAgICAgICAgICBvcHRpb25zLnJlcXVlc3REZWxlZ2F0ZS5vblJlZGlyZWN0KGludml0ZVJlc3BvbnNlKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgb25SZWplY3Q6IChpbnZpdGVSZXNwb25zZSkgPT4ge1xuICAgICAgICAgICAgICAgIHRoaXMubm90aWZ5UmVmZXJlcihpbnZpdGVSZXNwb25zZSk7XG4gICAgICAgICAgICAgICAgdGhpcy5vblJlamVjdChpbnZpdGVSZXNwb25zZSk7XG4gICAgICAgICAgICAgICAgaWYgKG9wdGlvbnMucmVxdWVzdERlbGVnYXRlICYmIG9wdGlvbnMucmVxdWVzdERlbGVnYXRlLm9uUmVqZWN0KSB7XG4gICAgICAgICAgICAgICAgICAgIG9wdGlvbnMucmVxdWVzdERlbGVnYXRlLm9uUmVqZWN0KGludml0ZVJlc3BvbnNlKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgb25Ucnlpbmc6IChpbnZpdGVSZXNwb25zZSkgPT4ge1xuICAgICAgICAgICAgICAgIHRoaXMubm90aWZ5UmVmZXJlcihpbnZpdGVSZXNwb25zZSk7XG4gICAgICAgICAgICAgICAgdGhpcy5vblRyeWluZyhpbnZpdGVSZXNwb25zZSk7XG4gICAgICAgICAgICAgICAgaWYgKG9wdGlvbnMucmVxdWVzdERlbGVnYXRlICYmIG9wdGlvbnMucmVxdWVzdERlbGVnYXRlLm9uVHJ5aW5nKSB7XG4gICAgICAgICAgICAgICAgICAgIG9wdGlvbnMucmVxdWVzdERlbGVnYXRlLm9uVHJ5aW5nKGludml0ZVJlc3BvbnNlKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuICAgICAgICByZXR1cm4gdGhpcy5vdXRnb2luZ0ludml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RoaXMuX2RpYWxvZy5zaWduYWxpbmdTdGF0ZX0uYCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGNvbnN0IG9wdGlvbnMgPSB7XG4gICAgICAgICAgICAgICAgICAgIHNlc3Npb25EZXNjcmlwdGlvbkhhbmRsZXJNb2RpZmllcnM6IHRoaXMuc2Vzc2lvbkRlc2NyaXB0aW9uSGFuZGxlck1vZGlmaWVycyxcbiAgICAgICAgICAgICAgICAgICAgc2Vzc2lvbkRlc2NyaXB0aW9uSGFuZGxlck9wdGlvbnM6IHRoaXMuc2Vzc2lvbkRlc2NyaXB0aW9uSGFuZGxlck9wdGlvbnNcbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnNldE9mZmVyQW5kR2V0QW5zd2VyKHRoaXMuX2RpYWxvZy5vZmZlciwgb3B0aW9ucylcbiAgICAgICAgICAgICAgICAgICAgLnRoZW4oKGJvZHkpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgaW52aXRlUmVzcG9uc2UuYWNrKHsgYm9keSB9KTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5zdGF0ZVRyYW5zaXRpb24oU2Vzc2lvblN0YXRlLkVzdGFibGlzaGVkKTtcbiAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgICAgICAgICAuY2F0Y2goKGVycm9yKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuYWNrQW5kQnllKGludml0ZVJlc3BvbnNlLCA0ODgsIFwiSW52YWxpZCBzZXNzaW9uIGRlc2NyaXB0aW9uXCIpO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnN0YXRlVHJhbnNpdGlvbihTZXNzaW9uU3RhdGUuVGVybWluYXRlZCk7XG4gICAgICAgICAgICAgICAgICAgIHRocm93IGVycm9yO1xuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgY2FzZSBTaWduYWxpbmdTdGF0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9nKSBkb2VzIG5vdCBtYXRjaCB0aGUgZW5kIHBvaW50IHdpdGggXCIgK1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIndoaWNoIGVhcmx5IG1lZGlhIGhhcyBiZWVuIHNldHVwIChlYXJseSBkaWFsb2cpIGFuZCB0aHVzIHRoaXMgc2Vzc2lvbiBpcyB1bmFibGUgdG8gcHJvY2VlZC4gXCIgK1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIkluIGFjY29yZGFuY2Ugd2l0aCB0aGUgU0lQIHNwZWNpZmljYXRpb25zLCB0aGUgU0lQIHNlcnZlcnMgeW91ciBlbmQgcG9pbnQgaXMgY29ubmVjdGVkIHRvIFwiICtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJkZXRlcm1pbmUgaWYgYW4gSU5WSVRFIGZvcmtzIGFuZCB0aGUgZm9ya2luZyBiZWhhdmlvciBvZiB0aG9zZSBzZXJ2ZXJzIGNhbm5vdCBiZSBjb250cm9sbGVkIFwiICtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJieSB0aGlzIGxpYnJhcnkuIElmIHlvdSB3aXNoIHRvIHVzZSBlYXJseSBtZWRpYSB3aXRoIHRoaXMgbGlicmFyeSB5b3UgbXVzdCBjb25maWd1cmUgdGhvc2UgXCIgK1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcInNlcnZlcnMgYWNjb3JkaW5nbHkuIEFsdGVybmF0aXZlbHkgeW91IG1heSBzZXQgdGhlICdlYXJseU1lZGlhJyB0byAnZmFsc2UnIHdoaWNoIHdpbGwgYWxsb3cgXCIgK1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcInRoaXMgbGlicmFyeSB0byBmdW5jdGlvbiB3aXRoIGFueSBJTlZJVEUgcmVxdWVzdHMgd2hpY2ggZG8gZm9yay5cIjtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5lcnJvcihtZXNzYWdlKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGVycm9yID0gbmV3IEVycm9yKFwiRWFybHkgbWVkaWEgZGlhbG9nIGRvZXMgbm90IGVxdWFsIGNvbmZpcm1lZCBkaWFsb2csIHRlcm1pbmF0aW5nIHNlc3Npb25cIik7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5lcnJvcihlcnJvci5tZXNzYWdlKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuYWNrQW5kQnllKGludml0ZVJlc3BvbnNlLCA0ODgsIFwiTm90IEFjY2VwdGFibGUgSGVyZVwiKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc3RhdGVUcmFuc2l0aW9uKFNlc3Npb25TdGF0ZS5UZXJtaW5hdGVkKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBQcm9taXNlLnJlamVjdChlcnJvcik7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgLy8gT3RoZXJ3aXNlIHdlIGFyZSBnb29kIHRvIGdvLlxuICAgICAgICAgICAgICAgICAgICBpbnZpdGVSZXNwb25zZS5hY2soKTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5zdGF0ZVRyYW5zaXRpb24oU2Vzc2lvblN0YXRlLkVzdGFibGlzaGVkKTtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFByb21pc2UucmVzb2x2ZSgpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAvLyBJZiBJTlZJVEUgd2l0aCBvZmZlciBhbmQgd2UgaGF2ZSBiZWVuIHdhaXRpbmcgdGlsbCBub3cgdG8gYXBwbHkgdGhlIGFuc3dlci5cbiAgICAgICAgICAgICAgICBjb25zdCBhbnN3ZXIgPSBzZXNzaW9uLmFuc3dlcjtcbiAgICAgICAgICAgICAgICBpZiAoIWFuc3dlcikge1xuICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJBbnN3ZXIgaXMgdW5kZWZpbmVkLlwiKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgY29uc3Qgb3B0aW9ucyA9IHtcbiAgICAgICAgICAgICAgICAgICAgc2Vzc2lvbkRlc2NyaXB0aW9uSGFuZGxlck1vZGlmaWVyczogdGhpcy5zZXNzaW9uRGVzY3JpcHRpb25IYW5kbGVyTW9kaWZpZXJzLFxuICAgICAgICAgICAgICAgICAgICBzZXNzaW9uRGVzY3JpcHRpb25IYW5kbGVyT3B0aW9uczogdGhpcy5zZXNzaW9uRGVzY3JpcHRpb25IYW5kbGVyT3B0aW9uc1xuICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuc2V0QW5zd2VyKGFuc3dlciwgb3B0aW9ucylcbiAgICAgICAgICAgICAgICAgICAgLnRoZW4oKCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICAvLyBUaGlzIHNlc3Npb24gaGFzIGNvbXBsZXRlZCBhbiBpbml0aWFsIG9mZmVyL2Fuc3dlciBleGNoYW5nZS4uLlxuICAgICAgICAgICAgICAgICAgICBsZXQgYWNrT3B0aW9ucztcbiAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMuX3JlbmRlcmJvZHkgJiYgdGhpcy5fcmVuZGVydHlwZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgYWNrT3B0aW9ucyA9IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBib2R5OiB7IGNvbnRlbnREaXNwb3NpdGlvbjogXCJyZW5kZXJcIiwgY29udGVudFR5cGU6IHRoaXMuX3JlbmRlcnR5cGUsIGNvbnRlbnQ6IHRoaXMuX3JlbmRlcmJvZHkgfVxuICAgICAgICAgICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBpbnZpdGVSZXNwb25zZS5hY2soYWNrT3B0aW9ucyk7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuc3RhdGVUcmFuc2l0aW9uKFNlc3Npb25TdGF0ZS5Fc3RhYmxpc2hlZCk7XG4gICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgICAgICAgLmNhdGNoKChlcnJvcikgPT4ge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5lcnJvcihlcnJvci5tZXNzYWdlKTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5hY2tBbmRCeWUoaW52aXRlUmVzcG9uc2UsIDQ4OCwgXCJOb3QgQWNjZXB0YWJsZSBIZXJlXCIpO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnN0YXRlVHJhbnNpdGlvbihTZXNzaW9uU3RhdGUuVGVybWluYXRlZCk7XG4gICAgICAgICAgICAgICAgICAgIHRocm93IGVycm9yO1xuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgY2FzZSBTaWduYWxpbmdTdGF0ZS5DbG9zZWQ6XG4gICAgICAgICAgICAgICAgLy8gRGlhbG9nIGhhcyB0ZXJtaW5hdGVkLlxuICAgICAgICAgICAgICAgIHJldHVybiBQcm9taXNlLnJlamVjdChuZXcgRXJyb3IoXCJUZXJtaW5hdGVkLlwiKSk7XG4gICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcIlVua25vd24gc2Vzc2lvbiBzaWduYWxpbmcgc3RhdGUuXCIpO1xuICAgICAgICB9XG4gICAgfVxuICAgIC8qKlxuICAgICAqIEhhbmRsZSBwcm92aXNpb25hbCByZXNwb25zZSB0byBpbml0aWFsIElOVklURS5cbiAgICAgKiBAcGFyYW0gaW52aXRlUmVzcG9uc2UgLSAxeHggcmVzcG9uc2UuXG4gICAgICovXG4gICAgb25Qcm9ncmVzcyhpbnZpdGVSZXNwb25zZSkge1xuICAgICAgICB2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G9wdWxhciBVQSdzIGN1cnJlbnRseSBlbmQgdXAgaGVyZS4uLlxuICAgICAgICAgICAgICAgICAgICBpbnZpdGVSZXNwb25zZS5wcmFjayh7IGV4dHJhSGVhZGVycyB9KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgcmV0dXJuIFByb21pc2UucmVzb2x2ZSgpO1xuICAgICAgICAgICAgY2FzZSBTaWduYWxpbmdTdGF0ZS5IYXZlTG9jYWxPZmZlcjpcbiAgICAgICAgICAgICAgICAvLyBJTlZJVEUgd2l0aCBvZmZlciBhbmQgc2Vzc2lvbiBvbmx5IGhhcyB0aGF0IGluaXRpYWwgbG9jYWwgb2ZmZXIuXG4gICAgICAgICAgICAgICAgaWYgKHJlc3BvbnNlUmVsaWFibGUpIHtcbiAgICAgICAgICAgICAgICAgICAgaW52aXRlUmVzcG9uc2UucHJhY2soeyBleHRyYUhlYWRlcnMgfSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHJldHVybiBQcm9taXNlLnJlc29sdmUoKTtcbiAgICAgICAgICAgIGNhc2UgU2lnbmFsaW5nU3RhdGUuSGF2ZVJlbW90ZU9mZmVyOlxuICAgICAgICAgICAgICAgIGlmICghcmVzcG9uc2VSZWxpYWJsZSkge1xuICAgICAgICAgICAgICAgICAgICAvLyBUaGUgaW5pdGlhbCBvZmZlciBNVVNUIGJlIGluIGVpdGhlciBhbiBJTlZJVEUgb3IsIGlmIG5vdCB0aGVyZSxcbiAgICAgICAgICAgICAgICAgICAgLy8gaW4gdGhlIGZpcnN0IHJlbGlhYmxlIG5vbi1mYWlsdXJlIG1lc3NhZ2UgZnJvbSB0aGUgVUFTIGJhY2sgdG9cbiAgICAgICAgICAgICAgICAgICAgLy8gdGhlIFVBQy5cbiAgICAgICAgICAgICAgICAgICAgLy8gaHR0cHM6Ly90b29scy5pZXRmLm9yZy9odG1sL3JmYzMyNjEjc2VjdGlvbi0xMy4yLjFcbiAgICAgICAgICAgICAg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aXB0aW9uSGFuZGxlck9wdGlvbnMsIHRoaXMuc2Vzc2lvbkRlc2NyaXB0aW9uSGFuZGxlck1vZGlmaWVycylcbiAgICAgICAgICAgICAgICAgICAgICAgIC50aGVuKCgpID0+IHNkaC5nZXREZXNjcmlwdGlvbih0aGlzLnNlc3Npb25EZXNjcmlwdGlvbkhhbmRsZXJPcHRpb25zLCB0aGlzLnNlc3Npb25EZXNjcmlwdGlvbkhhbmRsZXJNb2RpZmllcnMpKVxuICAgICAgICAgICAgICAgICAgICAgICAgLnRoZW4oKGRlc2NyaXB0aW9uKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBib2R5ID0ge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRlbnREaXNwb3NpdGlvbjogXCJzZXNzaW9uXCIsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGVudFR5cGU6IGRlc2NyaXB0aW9uLmNvbnRlbnRUeXBlLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRlbnQ6IGRlc2NyaXB0aW9uLmJvZHlcbiAgICAgICAgICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgICAgICAgICBpbnZpdGVSZXNwb25zZS5wcmFjayh7IGV4dHJhSGVhZGVycywgYm9keSB9KTtcbiAgICAgICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgICAgICAgICAgIC5jYXRjaCgoZXJyb3IpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc3RhdGVUcmFuc2l0aW9uKFNlc3Npb25TdGF0ZS5UZXJtaW5hdGVkKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IGVycm9yO1xuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICBjYXNlIFNpZ25hbGluZ1N0YXRlLlN0YWJsZTpcbiAgICAgICAgICAgICAgICAvLyBUaGlzIHNlc3Npb24gaGFzIGNvbXBsZXRlZCBhbiBpbml0aWFsIG9mZmVyL2Fuc3dlciBleGNoYW5nZSwgc28uLi5cbiAgICAgICAgICAgICAgICAvLyAtIElOVklURSB3aXRoIFNEUCBhbmQgdGhpcyBwcm92aXNpb25hbCByZXNwb25zZSBNQVkgYmUgcmVsaWFibGVcbiAgICAgICAgICAgICAgICAvLyAtIElOVklURSB3aXRob3V0IFNEUCBhbmQgdGhpcyBwcm92aXNpb25hbCByZXNwb25zZSBNQVkgYmUgcmVsaWFibGVcbiAgICAgICAgICAgICAgICBpZiAocmVzcG9uc2VSZWxpYWJsZSkge1xuICAgICAgICAgICAgICAgICAgICBpbnZpdGVSZXNwb25zZS5wcmFjayh7IGV4dHJhSGVhZGVycyB9KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKHRoaXMuZWFybHlNZWRpYSAmJiAhdGhpcy5lYXJseU1lZGlhRGlhbG9nKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZWFybHlNZWRpYURpYWxvZyA9IHNlc3Npb247XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IGFuc3dlciA9IHNlc3Npb24uYW5zd2VyO1xuICAgICAgICAgICAgICAgICAgICBpZiAoIWFuc3dlcikge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwiQW5zd2VyIGlzIHVuZGVmaW5lZC5cIik7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgY29uc3Qgb3B0aW9ucyA9IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlc3Npb25EZXNjcmlwdGlvbkhhbmRsZXJNb2RpZmllcnM6IHRoaXMuc2Vzc2lvbkRlc2NyaXB0aW9uSGFuZGxlck1vZGlmaWVycyxcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlc3Npb25EZXNjcmlwdGlvbkhhbmRsZXJPcHRpb25zOiB0aGlzLnNlc3Npb25EZXNjcmlwdGlvbkhhbmRsZXJPcHRpb25zXG4gICAgICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnNldEFuc3dlcihhbnN3ZXIsIG9wdGlvbnMpLmNhdGNoKChlcnJvcikgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5zdGF0ZVRyYW5zaXRpb24oU2Vzc2lvblN0YXRlLlRlcm1pbmF0ZWQpO1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgZXJyb3I7XG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICByZXR1cm4gUHJvbWlzZS5yZXNvbHZlKCk7XG4gICAgICAgICAgICBjYXNlIFNpZ25hbGluZ1N0YXRlLkNsb3NlZDpcbiAgICAgICAgICAgICAgICAvLyBEaWFsb2cgaGFzIHRlcm1pbmF0ZWQuXG4gICAgICAgICAgICAgICAgcmV0dXJuIFByb21pc2UucmVqZWN0KG5ldyBFcnJvcihcIlRlcm1pbmF0ZWQuXCIpKTtcbiAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwiVW5rbm93biBzZXNzaW9uIHNpZ25hbGluZyBzdGF0ZS5cIik7XG4gICAgICAgIH1cbiAgICB9XG4gICAgLyoqXG4gICAgICogSGFuZGxlIGZpbmFsIHJlc3BvbnNlIHRvIGluaXRpYWwgSU5WSVRFLlxuICAgICAqIEBwYXJhbSBpbnZpdGVSZXNwb25zZSAtIDN4eCByZXNwb25zZS5cbiAgICAgKi9cbiAgICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgQHR5cGVzY3JpcHQtZXNsaW50L25vLXVudXNlZC12YXJzXG4gICAgb25SZWRpcmVjdChpbnZpdGVSZXNwb25zZSkge1xuICAgICAgICB0aGlzLmxvZ2dlci5sb2coXCJJbnZpdGVyLm9uUmVkaXJlY3RcIik7XG4gICAgIC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O1xuICAgIH1cbiAgICAvKiogQWNjZXB0IHRoZSByZXF1ZXN0LiAqL1xuICAgIGFjY2VwdChvcHRpb25zKSB7XG4gICAgICAgIHRoaXMuaW5jb21pbmdOb3RpZnlSZXF1ZXN0LmFjY2VwdChvcHRpb25zKTtcbiAgICAgICAgcmV0dXJuIFByb21pc2UucmVzb2x2ZSgpO1xuICAgIH1cbiAgICAvKiogUmVqZWN0IHRoZSByZXF1ZXN0LiAqL1xuICAgIHJlamVjdChvcHRpb25zKSB7XG4gICAgICAgIHRoaXMuaW5jb21pbmdOb3RpZnlSZXF1ZXN0LnJlamVjdChvcHRpb25zKTtcbiAgICAgICAgcmV0dXJuIFByb21pc2UucmVzb2x2ZSgpO1xuICAgIH1cbn1cbiIsIi8qKlxuICoge0BsaW5rIFB1Ymxpc2hlcn0gc3RhdGUuXG4gKiBAcmVtYXJrc1xuICogVGhlIHtAbGluayBQdWJsaXNoZXJ9IGJlaGF2ZXMgaW4gYSBkZXRlcm1pbmlzdGljIG1hbm5lciBhY2NvcmRpbmcgdG8gdGhlIGZvbGxvd2luZ1xuICogRmluaXRlIFN0YXRlIE1hY2hpbmUgKEZTTSkuXG4gKiBgYGB0eHRcbiAqICAgICAgICAgICAgICAgICAgX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fXG4gKiAgICAgICAgICAgICAgICAgfCAgX19fX19fX19fX19fX19fX19fX19fX19fX18gICAgICAgICAgICAgIHxcbiAqIFB1Ymxpc2hlciAgICAgICB8IHwgICAgICAgICAgICAgICAgICAgICAgICAgIHYgICAgICAgICAgICAgdlxuICogQ29uc3RydWN0ZWQgLT4gSW5pdGlhbCAtPiBQdWJsaXNoZWQgLT4gVW5wdWJsaXNoZWQgLT4gVGVybWluYXRlZFxuICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgXl9fX19fX19fX19fX3wgICAgICAgICAgICAgXlxuICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8X19fX19fX19fX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zID0gZXhwaXJlcztcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLndhcm4oXCJCYWQgRXhwaXJlcyBoZWFkZXIgaW4gYSAyMDAtY2xhc3MgcmVzcG9uc2UgdG8gUFVCTElTSFwiKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIud2FybihcIkV4cGlyZXMgaGVhZGVyIG1pc3NpbmcgaW4gYSAyMDAtY2xhc3MgcmVzcG9uc2UgdG8gUFVCTElTSFwiKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKHRoaXMucHViUmVxdWVzdEV4cGlyZXMgIT09IDApIHtcbiAgICAgICAgICAgICAgICAgICAgLy8gU2NoZWR1bGUgcmVmcmVzaFxuICAgICAgICAgICAgICAgICAgICB0aGlzLnB1Ymxpc2hSZWZyZXNoVGltZXIgPSBzZXRUaW1lb3V0KCgpID0+IHRoaXMucmVmcmVzaFJlcXVlc3QoKSwgdGhpcy5wdWJSZXF1ZXN0RXhwaXJlcyAqIDkwMCk7XG4gICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLl9zdGF0ZSAhPT0gUHVibGlzaGVyU3RhdGUuUHVibGlzaGVkKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnN0YXRlVHJhbnNpdGlvbihQdWJsaXNoZXJTdGF0ZS5QdWJsaXNoZWQpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnN0YXRlVHJhbnNpdGlvbihQdWJsaXNoZXJTdGF0ZS5VbnB1Ymxpc2hlZCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSAvXjQxMiQvLnRlc3Qoc3RhdHVzQ29kZS50b1N0cmluZygpKTpcbiAgICAgICAgICAgICAgICAvLyA0MTIgY29kZSBtZWFucyBubyBtYXRjaGluZyBFVGFnIC0gcG9zc2libHkgdGhlIFBVQkxJU0ggZXhwaXJlZFxuICAgICAgICAgICAgICAgIC8vIFJlc3VibWl0IGFzIG5ldyByZXF1ZXN0LCBpZiB0aGUgY3VycmVudCByZXF1ZXN0IGlzIG5vdCBhIFwicmVtb3ZlXCJcbiAgICAgICAgICAgICAgICBpZiAodGhpcy5wdWJSZXF1ZXN0RXRhZyAhPT0gdW5kZWZpbmVkICYmIHRoaXMucHViUmVxdWVzdEV4cGlyZXMgIT09IDApIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIud2FybihcIjQxMiByZXNwb25zZSB0byBQVUJMSVNILCByZWNvdmVyaW5nXCIpO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnB1YlJlcXVlc3RFdGFnID0gdW5kZWZpbmVkO1xuICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5vcHRpb25zLmJvZHkgPT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwiQm9keSB1bmRlZmluZWQuXCIpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIHRoaXMucHVibGlzaCh0aGlzLm9wdGlvbnMuYm9keSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci53YXJuKFwiNDEyIHJlc3BvbnNlIHRvIFBVQkxJU0gsIHJlY292ZXJ5IGZhaWxlZFwiKTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5wdWJSZXF1ZXN0RXhwaXJlcyA9IDA7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuc3RhdGVUcmFuc2l0aW9uKFB1Ymxpc2hlclN0YXRlLlVucHVibGlzaGVkKTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5zdGF0ZVRyYW5zaXRpb24oUHVibGlzaGVyU3RhdGUuVGVybWluYXRlZCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSAvXjQyMyQvLnRlc3Qoc3RhdHVzQ29kZS50b1N0cmluZygpKTpcbiAgICAgICAgICAgICAgICAvLyA0MjMgY29kZSBtZWFucyB3ZSBuZWVkIHRvIGFkanVzdCB0aGUgRXhwaXJlcyBpbnRlcnZhbCB1cFxuICAgICAgICAgICAgICAgIGlmICh0aGlzLnB1YlJlcXVlc3RFeHBpcmVzICE9PSAwICYmIHJlc3BvbnNlLmhhc0hlYWRlcihcIk1pbi1FeHBpcmVzXCIpKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IG1pbkV4cGlyZXMgPSBOdW1iZXIocmVzcG9uc2UuZ2V0SGVhZGVyKFwiTWluLUV4cGlyZXNcIikpO1xuICAgICAgICAgICAgICAgICAgICBpZiAodHlwZW9mIG1pbkV4cGlyZXMgPT09IFwibnVtYmVyXCIgfHwgbWluRXhwaXJlcyA+IHRoaXMucHViUmVxdWVzdEV4cGlyZXMpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLndhcm4oXCI0MjMgY29kZSBpbiByZXNwb25zZSB0byBQVUJMSVNILCBhZGp1c3RpbmcgdGhlIEV4cGlyZXMgdmFsdWUgYW5kIHRyeWluZyB0byByZWNvdmVyXCIpO1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5wdWJSZXF1ZXN0RXhwaXJlcyA9IG1pbkV4cGlyZXM7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5vcHRpb25zLmJvZHkgPT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcIkJvZHkgdW5kZWZpbmVkLlwiKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMucHVibGlzaCh0aGlzLm9wdGlvbnMuYm9keSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci53YXJuKFwiQmFkIDQyMyByZXNwb25zZSBNaW4tRXhwaXJlcyBoZWFkZXIgcmVjZWl2ZWQgZm9yIFBVQkxJU0hcIik7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnB1YlJlcXVlc3RFeHBpcmVzID0gMDtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc3RhdGVUcmFuc2l0aW9uKFB1Ymxpc2hlclN0YXRlLlVucHVibGlzaGVkKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc3RhdGVUcmFuc2l0aW9uKFB1Ymxpc2hlclN0YXRlLlRlcm1pbmF0ZWQpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci53YXJuKFwiNDIzIHJlc3BvbnNlIHRvIFBVQkxJU0gsIHJlY292ZXJ5IGZhaWxlZFwiKTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5wdWJSZXF1ZXN0RXhwaXJlcyA9IDA7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuc3RhdGVUcmFuc2l0aW9uKFB1Ymxpc2hlclN0YXRlLlVucHVibGlzaGVkKTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5zdGF0ZVRyYW5zaXRpb24oUHVibGlzaGVyU3RhdGUuVGVybWluYXRlZCk7XG4gICAgICAgICAgICAg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jYXNlIFB1Ymxpc2hlclN0YXRlLkluaXRpYWw6XG4gICAgICAgICAgICAgICAgaWYgKG5ld1N0YXRlICE9PSBQdWJsaXNoZXJTdGF0ZS5QdWJsaXNoZWQgJiZcbiAgICAgICAgICAgICAgICAgICAgbmV3U3RhdGUgIT09IFB1Ymxpc2hlclN0YXRlLlVucHVibGlzaGVkICYmXG4gICAgICAgICAgICAgICAgICAgIG5ld1N0YXRlICE9PSBQdWJsaXNoZXJTdGF0ZS5UZXJtaW5hdGVkKSB7XG4gICAgICAgICAgICAgICAgICAgIGludmFsaWRUcmFuc2l0aW9uKCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBQdWJsaXNoZXJTdGF0ZS5QdWJsaXNoZWQ6XG4gICAgICAgICAgICAgICAgaWYgKG5ld1N0YXRlICE9PSBQdWJsaXNoZXJTdGF0ZS5VbnB1Ymxpc2hlZCAmJiBuZXdTdGF0ZSAhPT0gUHVibGlzaGVyU3RhdGUuVGVybWluYXRlZCkge1xuICAgICAgICAgICAgICAgICAgICBpbnZhbGlkVHJhbnNpdGlvbigpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgUHVibGlzaGVyU3RhdGUuVW5wdWJsaXNoZWQ6XG4gICAgICAgICAgICAgICAgaWYgKG5ld1N0YXRlICE9PSBQdWJsaXNoZXJTdGF0ZS5QdWJsaXNoZWQgJiYgbmV3U3RhdGUgIT09IFB1Ymxpc2hlclN0YXRlLlRlcm1pbmF0ZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgaW52YWxpZFRyYW5zaXRpb24oKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIFB1Ymxpc2hlclN0YXRlLlRlcm1pbmF0ZWQ6XG4gICAgICAgICAgICAgICAgaW52YWxpZFRyYW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ZWQgPSB0aGlzLnNlc3Npb247XG4gICAgICAgIHRoaXMuc2Vzc2lvbi5fcmVmZXJyYWwgPSB0aGlzLmludml0ZXI7XG4gICAgICAgIHJldHVybiB0aGlzLmludml0ZXI7XG4gICAgfVxufVxuIiwiLyoqXG4gKiB7QGxpbmsgUmVnaXN0ZXJlcn0gc3RhdGUuXG4gKiBAcmVtYXJrc1xuICogVGhlIHtAbGluayBSZWdpc3RlcmVyfSBiZWhhdmVzIGluIGEgZGV0ZXJtaW5pc3RpYyBtYW5uZXIgYWNjb3JkaW5nIHRvIHRoZSBmb2xsb3dpbmdcbiAqIEZpbml0ZSBTdGF0ZSBNYWNoaW5lIChGU00pLlxuICogYGBgdHh0XG4gKiAgICAgICAgICAgICAgICAgICBfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19cbiAqICAgICAgICAgICAgICAgICAgfCAgX19fX19fX19fX19fX19fX19fX19fX19fX18gICAgICAgICAgICAgIHxcbiAqIFJlZ2lzdGVyZXIgICAgICAgfCB8ICAgICAgICAgICAgICAgICAgICAgICAgICB2ICAgICAgICAgICAgIHZcbiAqIENvbnN0cnVjdGVkIC0+IEluaXRpYWwgLT4gUmVnaXN0ZXJlZCAtPiBVbnJlZ2lzdGVyZWQgLT4gVGVybWluYXRlZFxuICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgXl9fX19fX19fX19fX3wgICAgICAgICAgICAgXlxuICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8X19fX19fX19fX19fX19fX19fX19fX19fX19fX19ffFxuICogYGBgXG4gKiBAcHVibGljXG4gKi9cbmV4cG9ydCB2YXIgUmVnaXN0ZXJlclN0YXRlO1xuKGZ1bmN0aW9uIChSZWdpc3RlcmVyU3RhdGUpIHtcbiAgICBSZWdpc3RlcmVyU3RhdGVbXCJJbml0aWFsXCJdID0gXCJJbml0aWFsXCI7XG4gICAgUmVnaXN0ZXJlclN0YXRlW1wiUmVnaXN0ZXJlZFwiX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ICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLmxvZyhcIsK3IFwiICsga2V5ICsgXCI6IFwiICsgSlNPTi5zdHJpbmdpZnkodmFsdWUpKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgICAgICAvLyBJZGVudGlmaWVyXG4gICAgICAgIHRoaXMuaWQgPSB0aGlzLnJlcXVlc3QuY2FsbElkICsgdGhpcy5yZXF1ZXN0LmZyb20ucGFyYW1ldGVycy50YWc7XG4gICAgICAgIC8vIEFkZCB0byB0aGUgdXNlciBhZ2VudCdzIHNlc3Npb24gY29sbGVjdGlvbi5cbiAgICAgICAgdGhpcy51c2VyQWdlbnQuX3JlZ2lzdGVyZXJzW3RoaXMuaWRdID0gdGhpcztcbiAgICB9XG4gICAgLyoqIERlZmF1bHQgcmVnaXN0ZXJlciBvcHRpb25zLiAqL1xuICAgIHN0YXRpYyBkZWZhdWx0T3B0aW9ucygpIHtcbiAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgIGV4cGlyZXM6IFJlZ2lzdGVyZXIuZGVmYXVsdEV4cGlyZXMsXG4gICAgICAgICAgICBleHRyYUNvbnRhY3RIZWFkZXJQYXJhbXM6IFtdLFxuICAgICAgICAgICAgZXh0cmFIZWFkZXJzOiBbXSxcbiAgICAgICAgICAgIGxvZ0NvbmZpZ3VyYXRpb246IHRydWUsXG4gICAgICAgICAgICBpbnN0YW5jZUlkOiBcIlwiLFxuICAgICAgICAgICAgcGFyYW1zOiB7fSxcbiAgICAgICAgICAgIHJlZ0lkOiAwLFxuICAgICAgICAgICAgcmVnaXN0cmFyOiBuZXcgVVJJKFwic2lwXCIsIFwiYW5vbnltb3VzXCIsIFwiYW5vbnltb3VzLmludmFsaWRcIiksXG4gICAgICAgICAgICByZWZyZXNoRnJlcXVlbmN5OiBSZWd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gICAgdGhpcy50ZXJtaW5hdGVkKCk7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXNvbHZlKCk7XG4gICAgICAgICAgICAgICAgICAgIH0sIHsgb25jZTogdHJ1ZSB9KTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy51bnJlZ2lzdGVyKCk7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgLy8gT3RoZXJ3aXNlIGp1c3QgcmVzb2x2ZVxuICAgICAgICAgICAgICAgIHRoaXMudGVybWluYXRlZCgpO1xuICAgICAgICAgICAgICAgIHJlc29sdmUoKTtcbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICAvLyBJZiB3ZSBhcmUgd2FpdGluZyBmb3IgYW4gb3V0c3RhbmRpbmcgcmVxdWVzdCwgd2FpdCBmb3IgaXQgdG8gZmluaXNoIGFuZCB0aGVuIHRyeSBjbG9zaW5nLlxuICAgICAgICAgICAgLy8gT3RoZXJ3aXNlIGp1c3QgdHJ5IGNsb3NpbmcuXG4gICAgICAgICAgICBpZiAodGhpcy53YWl0aW5nKSB7XG4gICAgICAgICAgICAgICAgdGhpcy53YWl0aW5nQ2hhbmdlLmFkZExpc3RlbmVyKCgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgZG9DbG9zZSgpO1xuICAgICAgICAgICAgICAgIH0sIHsgb25jZTogdHJ1ZSB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgIGRvQ2xvc2UoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSk7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIFNlbmRzIHRoZSBSRUdJU1RFUiByZXF1ZXN0LlxuICAgICAqIEByZW1hcmtzXG4gICAgICogSWYgc3VjY2Vzc2Z1bCwgc2VuZHMgcmUtUkVHSVNURVIgcmVxdWVzdHMgcHJpb3IgdG8gcmVnaXN0cmF0aW9uIG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i5vcmcvaHRtbC9yZmMzMjYxI3NlY3Rpb24tMTAuM1xuICAgICAgICAgICAgICAgIHRoaXMuX2NvbnRhY3RzID0gcmVzcG9uc2UubWVzc2FnZS5nZXRIZWFkZXJzKFwiY29udGFjdFwiKTtcbiAgICAgICAgICAgICAgICBsZXQgY29udGFjdHMgPSB0aGlzLl9jb250YWN0cy5sZW5ndGg7XG4gICAgICAgICAgICAgICAgaWYgKCFjb250YWN0cykge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5lcnJvcihcIk5vIENvbnRhY3QgaGVhZGVyIGluIHJlc3BvbnNlIHRvIFJFR0lTVEVSLCBkcm9wcGluZyByZXNwb25zZS5cIik7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMudW5yZWdpc3RlcmVkKCk7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgLy8gVGhlIDIwMCAoT0spIHJlc3BvbnNlIGZyb20gdGhlIHJlZ2lzdHJhciBjb250YWlucyBhIGxpc3Qgb2YgQ29udGFjdFxuICAgICAgICAgICAgICAgIC8vIGZpZWxkcyBlbnVtZXJhdGluZyBhbGwgY3VycmVudCBiaW5kaW5ncy4gIFRoZSBVQSBjb21wYXJlcyBlYWNoXG4gICAgICAgICAgICAgICAgLy8gY29udGFjdCBhZGRyZXNzIHRvIHNlZSBpZiBpdCBjcmVhdGVkIHRoZSBjb250YWN0IGFkZHJlc3MsIHVzaW5nXG4gICAgICAgICAgICAgICAgLy8gY29tcGFyaXNvbiBydWxlcyBpbiBTZWN0aW9uIDE5LjEuNC4gIElmIHNvLCBpdCB1cGRhdGVzIHRoZSBleHBpcmF0aW9uXG4gICAgICAgICAgICAgICAgLy8gdGltZSBpbnRlcnZhbCBhY2NvcmRpbmcgdG8gdGhlIGV4cGlyZXMgcGFyYW1ldGVyIG9yLCBpZiBhYnNlbnQsIHRoZVxuICAgICAgICAgICAgICAgIC8vIEV4cGlyZXMgZmllbGQgdmFsdWUuICBUaGUgVUEgdGhlbiBpc3N1ZXMgYSBSRUdJU1RFUiByZXF1ZXN0IGZvciBlYWNoXG4gICAgICAgICAgICAgICAgLy8gb2YgaXRzIGJpbmRpbmdzIGJlZm9yZSB0aGUgZXhwaXJhdGlvbiBpbnRlcnZhbCBoYXMgZWxhcHNlZC5cbiAgICAgICAgICAgICAgICAvLyBodHRwczovL3Rvb2xzLmlldGYub3JnL2h0bWwvcmZjMzI2MSNzZWN0aW9uLTEwLjIuNFxuICAgICAgICAgICAgICAgIGxldCBjb250YWN0O1xuICAgICAgICAgICAgICAgIHdoaWxlIChjb250YWN0cy0tKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnRhY3QgPSByZXNwb25zZS5tZXNzYWdlLnBhcnNlSGVhZGVyKFwiY29udGFjdFwiLCBjb250YWN0cyk7XG4gICAgICAgICAgICAgICAgICAgIGlmICghY29udGFjdCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwiQ29udGFjdCB1bmRlZmluZWRcIik7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMudXNlckFnZW50LmNvbnRhY3QucHViR3J1dSAmJiBlcXVpdmFsZW50VVJJKGNvbnRhY3QudXJpLCB0aGlzLnVzZXJBZ2VudC5jb250YWN0LnB1YkdydXUpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBleHBpcmVzID0gTnVtYmVyKGNvbnRhY3QuZ2V0UGFyYW0oXCJleHBpcmVzXCIpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIC8vIElmIHdlIGFyZSB1c2luZyBhIHJhbmRvbWx5IGdlbmVyYXRlZCB1c2VyIG5hbWUgKHdoaWNoIGlzIHRoZSBkZWZhdWx0IGJlaGF2aW9yKVxuICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy51c2VyQWdlbnQuY29uZmlndXJhdGlvbi5jb250YWN0TmFtZSA9PT0gXCJcIikge1xuICAgICAgICAgICAgICAgICAgICAgICAgLy8gY29tcGFyZSB0aGUgdXNlciBwb3J0aW9uIG9mIHRoZSBVUkkgdW5kZXIgdGhlIGFzc3VtcHRpb24gdGhhdCBpdCB3aWxsIGJlIHVuaXF1ZVxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNvbnRhY3QudXJpLnVzZXIgPT09IHRoaXMudXNlckFnZW50LmNvbnRhY3QudXJpLnVzZXIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBleHBpcmVzID0gTnVtYmVyKGNvbnRhY3QuZ2V0UGFyYW0oXCJleHBpcmVzXCIpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIG90aGVyd2lzZSB1c2UgY29tcGFyaXNpb24gcnVsZXMgaW4gU2VjdGlvbiAxOS4xLjRcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlcXVpdmFsZW50VVJJKGNvbnRhY3QudXJpLCB0aGlzLnVzZXJBZ2VudC5jb250YWN0LnVyaSkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBleHBpcmVzID0gTnVtYmVyKGNvbnRhY3QuZ2V0UGFyYW0oXCJleHBpcmVzXCIpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBjb250YWN0ID0gdW5kZWZpbmVkO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAvLyBUaGVyZSBtdXN0IGJlIGEgbWF0Y2hpbmcgY29udGFjdC5cbiAgICAgICAgICAgICAgICBpZiAoY29udGFjdCA9PT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLmVycm9yKFwiTm8gQ29udGFjdCBoZWFkZXIgcG9pbnRpbmcgdG8gdXMsIGRyb3BwaW5nIHJlc3BvbnNlXCIpO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnVucmVnaXN0ZXJlZCgpO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLndhaXRpbmdUb2dnbGUoZmFsc2UpO1xuICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIC8vIFRoZSBjb250YWN0IG11c3QgaGF2ZSBhbiBleHBpcmVzLlxuICAgICAgICAgICAgICAgIGlmIChleHBpcmVzID09PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIuZXJyb3IoXCJDb250YWN0IHBvaW50aW5nIHRvIHVzIGlzIG1pc3NpbmcgZXhwaXJlcyBwYXJhbWV0ZXIsIGRyb3BwaW5nIHJlc3BvbnNlXCIpO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnVucmVnaXN0ZXJlZCgpO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLndhaXRpbmdUb2dnbGUoZmFsc2UpO1xuICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIC8vIFNhdmUgZ3J1dSB2YWx1ZXNcbiAgICAgICAgICAgICAgICBpZiAoY29udGFjdC5oYXNQYXJhbShcInRlbXAtZ3J1dVwiKSkge1xuICAgICAgICAgICAgICAgICAgICBjb25zdCBncnV1ID0gY29udGFjdC5nZXRQYXJhbShcInRlbXAtZ3J1dVwiKTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGdydXUpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMudXNlckFnZW50LmNvbnRhY3QudGVtcEdydXUgPSBHcmFtbWFyLlVSSVBhcnNlKGdydXUucmVwbGFjZSgvXCIvZywgXCJcIikpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmIChjb250YWN0Lmhhc1BhcmFtKFwicHViLWdydXVcIikpIHtcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgZ3J1dSA9IGNvbnRhY3QuZ2V0UGFyYW0oXCJwdWItZ3J1dVwiKTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGdydXUpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMudXNlckFnZW50LmNvbnRhY3QucHViR3J1dSA9IEdyYW1tYXIuVVJJUGFyc2UoZ3J1dS5yZXBsYWNlKC9cIi9nLCBcIlwiKSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgdGhpcy5yZWdpc3RlcmVkKGV4cGlyZXMpO1xuICAgICAgICAgICAgICAgIGlmIChvcHRpb25zLnJlcXVlc3REZWxlZ2F0ZSAmJiBvcHRpb25zLnJlcXVlc3REZWxlZ2F0ZS5vbkFjY2VwdCkge1xuICAgICAgICAgICAgICAgICAgICBvcHRpb25zLnJlcXVlc3REZWxlZ2F0ZS5vbkFjY2VwdChyZXNwb25zZSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHRoaXMud2FpdGluZ1RvZ2dsZShmYWxzZSk7XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgb25Qcm9ncmVzczogKHJlc3BvbnNlKSA9PiB7XG4gICAgICAgICAgICAgICAgaWYgKG9wdGlvbnMucmVxdWVzdERlbGVnYXRlICYmIG9wdGlvbnMucmVxdWVzdERlbGVnYXRlLm9uUHJvZ3Jlc3MpIHtcbiAgICAgICAgICAgICAgICAgICAgb3B0aW9ucy5yZXF1ZXN0RGVsZWdhdGUub25Qcm9ncmVzcyhyZXNwb25zZSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIG9uUmVkaXJlY3Q6IChyZXNwb25zZSkgPT4ge1xuICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLmVycm9yKFwiUmVkaXJlY3QgcmVjZWl2ZWQuIE5vdCBzdXBwb3J0ZWQuXCIpO1xuICAgICAgICAgICAgICAgIHRoaXMudW5yZWdpc3RlcmVkKCk7XG4gICAgICAgICAgICAgICAgaWYgKG9wdGlvbnMucmVxdWVzdERlbGVnYXRlICYmIG9wdGlvbnMucmVxdWVzdERlbGVnYXRlLm9uUmVkaXJlY3QpIHtcbiAgICAgICAgICAgICAgICAgICAgb3B0aW9ucy5yZXF1ZXN0RGVsZWdhdGUub25SZWRpcmVjdChyZXNwb25zZSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHRoaXMud2FpdGluZ1RvZ2dsZShmYWxzZSk7XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgb25SZWplY3Q6IChyZXNwb25zZSkgPT4ge1xuICAgICAgICAgICAgICAgIGlmIChyZXNwb25zZS5tZXNzYWdlLnN0YXR1c0NvZGUgPT09IDQyMykge1xuICAgICAgICAgICAgICAgICAgICAvLyBJZiBhIFVBIHJlY2VpdmVzIGEgNDIzIChJbnRlcnZhbCBUb28gQnJpZWYpIHJlc3BvbnNlLCBpdCBNQVkgcmV0cnlcbiAgICAgICAgICAgICAgICAgICAgLy8gdGhlIHJlZ2lzdHJhdGlvbiBhZnRlciBtYWtpbmcgdGhlIGV4cGlyYXRpb24gaW50ZXJ2YWwgb2YgYWxsIGNvbnRhY3RcbiAgICAgICAgICAgICAgICAgICAgLy8gYWRkcmVzc2VzIGluIHRoZSBSRUdJU1RFUiByZXF1ZXN0IGVxdWFsIHRvIG9yIGdyZWF0ZXIgdGhhbiB0aGVcbiAgICAgICAgICAgICAgICAgICAgLy8gZXhwaXJhdGlvbiBpbnRlcnZhbCB3aXRoaW4gdGhlIE1pbi1FeHBpcmVzIGhlYWRlciBmaWVsZCBvZiB0aGUgNDIzXG4gICAgICAgICAgICAgICAgICAgIC8vIChJbnRlcnZhbCBUb28gQnJpZWYpIHJlc3BvbnNlLlxuICAgICAgICAgICAgICAgICAgICAvLyBodHRwczovL3Rvb2xzLmlldGYub3JnL2h0bWwvcmZjMzI2MSNzZWN0aW9uLTEwLjIuOFxuICAgICAgICAgICAgICAgICAgICAvL1xuICAgICAgICAgICAgICAgICAgICAvLyBUaGUgcmVnaXN0cmFyIE1BWSBjaG9vc2UgYW4gZXhwaXJhdGlvbiBsZXNzIHRoYW4gdGhlIHJlcXVlc3RlZFxuICAgICAgICAgICAgICAgICAgICAvLyBleHBpcmF0aW9uIGludGVydmFsLiAgSWYgYW5kIG9ubHkgaWYgdGhlIHJlcXVlc3RlZCBleHBpcmF0aW9uXG4gICAgICAgICAgICAgICAgICAgIC8vIGludGVydmFsIGlzIGdyZWF0ZXIgdGhhbiB6ZXJvIEFORCBzbWFsbGVyIHRoYW4gb25lIGhvdXIgQU5EXG4gICAgICAgICAgICAgICAgICAgIC8vIGxlc3MgdGhhbiBhIHJlZ2lzdHJhci1jb25maWd1cmVkIG1pbmltdW0sIHRoZSByZWdpc3RyYXIgTUFZXG4gICAgICAgICAgICAgICAgICAgIC8vIHJlamVjdCB0aGUgcmVnaXN0cmF0aW9uIHdpdGggYSByZXNwb25zZSBvZiA0MjMgKEludGVydmFsIFRvb1xuICAgICAgICAgICAgICAgICAgICAvLyBCcmllZikuICBUaGlzIHJlc3BvbnNlIE1VU1QgY29udGFpbiBhIE1pbi1FeHBpcmVzIGhlYWRlciBmaWVsZFxuICAgICAgICAgICAgICAgICAgICAvLyB0aGF0IHN0YXRlcyB0aGUgbWluaW11bSBleHBpcmF0aW9uIGludGVydmFsIHRoZSByZWdpc3RyYXIgaXNcbiAgICAgICAgICAgICAgICAgICAgLy8gd2lsbGluZyB0byBob25vci4gIEl0IHRoZW4gc2tpcHMgdGhlIHJlbWFpbmluZyBzdGVwcy5cbiAgICAgICAgICAgICAgICAgICAgLy8gaHR0cHM6Ly90b29scy5pZXRmLm9yZy9odG1sL3JmYzMyNjEjc2VjdGlvbi0xMC4zXG4gICAgICAgICAgICAgICAgICAgIGlmICghcmVzcG9uc2UubWVzc2FnZS5oYXNIZWFkZXIoXCJtaW4tZXhwaXJlc1wiKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgLy8gVGhpcyByZXNwb25zZSBNVVNUIGNvbnRhaW4gYSBNaW4tRXhwaXJlcyBoZWFkZXIgZmllbGRcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLmVycm9yKFwiNDIzIHJlc3BvbnNlIHJlY2VpdmVkIGZvciBSRUdJU1RFUiB3aXRob3V0IE1pbi1FeHBpcmVzLCBkcm9wcGluZyByZXNwb25zZVwiKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMudW5yZWdpc3RlcmVkKCk7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLndhaXRpbmdUb2dnbGUoZmFsc2UpO1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIC8vIEluY3JlYXNlIG91ciByZWdpc3RyYXRpb24gaW50ZXJ2YWwgdG8gdGhlIHN1Z2dlc3RlZCBtaW5pbXVtXG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZXhwaXJlcyA9IE51bWJlcihyZXNwb25zZS5tZXNzYWdlLmdldEhlYWRlcihcIm1pbi1leHBpcmVzXCIpKTtcbiAgICAgICAgICAgICAgICAgICAgLy8gQXR0ZW1wdCB0aGUgcmVnaXN0cmF0aW9uIGFnYWluIGltbWVkaWF0ZWx5XG4gICAgICAgICAgICAgICAgICAgIHRoaXMud2FpdGluZ1RvZ2dsZShmYWxzZSk7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMucmVnaXN0ZXIoKTtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci53YXJuKGBGYWlsZWQgdG8gcmVnaXN0ZXIsIHN0YXR1cyBjb2RlICR7cmVzcG9uc2UubWVzc2FnZS5zdGF0dXNDb2RlfWApO1xuICAgICAgICAgICAgICAgIC8vIFRoZSBSZXRyeS1BZnRlciBoZWFkZXIgZmllbGQgY2FuIGJlIHVzZWQgd2l0aCBhIDUwMCAoU2VydmVyIEludGVybmFsXG4gICAgICAgICAgICAgICAgLy8gRXJyb3IpIG9yIDUwMyAoU2VydmljZSBVbmF2YWlsYWJsZSkgcmVzcG9uc2UgdG8gaW5kaWNhdGUgaG93IGxvbmcgdGhlXG4gICAgICAgICAgICAgICAgLy8gc2VydmljZSBpcyBleHBlY3RlZCB0byBiZSB1bmF2YWlsYWJsZSB0byB0aGUgcmVxdWVzdGluZyBjbGllbnQuLi5cbiAgICAgICAgICAgICAgICAvLyBodHRwczovL3Rvb2xzLmlldGYub3JnL2h0bWwvcmZjMzI2MSNzZWN0aW9uLTIwLjMzXG4gICAgICAgICAgICAgICAgbGV0IHJldHJ5QWZ0ZXJEdXJhdGlvbiA9IE5hTjtcbiAgICAgICAgICAgICAgICBpZiAocmVzcG9uc2UubWVzc2FnZS5zdGF0dXNDb2RlID09PSA1MDAgfHwgcmVzcG9uc2UubWVzc2FnZS5zdGF0dXNDb2RlID09PSA1MDMpIHtcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgaGVhZGVyID0gcmVzcG9uc2UubWVzc2FnZS5nZXRIZWFkZXIoXCJyZXRyeS1hZnRlclwiKTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGhlYWRlcikge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0cnlBZnRlckR1cmF0aW9uID0gTnVtYmVyLnBhcnNlSW50KGhlYWRlciwgdW5kZWZpbmVkKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAvLyBTZXQgZm9yIHRoZSBzdGF0ZSBjaGFuZ2UgKGlmIGFueSkgYW5kIHRoZSBkZWxlZ2F0ZSBjYWxsYmFjayAoaWYgYW55KVxuICAgICAgICAgICAgICAgIHRoaXMuX3JldHJ5QWZ0ZXIgPSBpc05hTihyZXRyeUFmdGVyRHVyYXRpb24pID8gdW5kZWZpbmVkIDogcmV0cnlBZnRlckR1cmF0aW9uO1xuICAgICAgICAgICAgICAgIHRoaXMudW5yZWdpc3RlcmVkKCk7XG4gICAgICAgICAgICAgICAgaWYgKG9wdGlvbnMucmVxdWVzdERlbGVnYXRlICYmIG9wdGlvbnMucmVxdWVzdERlbGVnYXRlLm9uUmVqZWN0KSB7XG4gICAgICAgICAgICAgICAgICAgIG9wdGlvbnMucmVxdWVzdERlbGVnYXRlLm9uUmVqZWN0KHJlc3BvbnNlKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgdGhpcy5fcmV0cnlBZnRlciA9IHVuZGVmaW5lZDtcbiAgICAgICAgICAgICAgICB0aGlzLndhaXRpbmdUb2dnbGUoZmFsc2UpO1xuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIG9uVHJ5aW5nOiAocmVzcG9uc2UpID0+IHtcbiAgICAgICAgICAgICAgICBpZiAob3B0aW9ucy5yZXF1ZXN0RGVsZWdhdGUgJiYgb3B0aW9ucy5yZXF1ZXN0RGVsZWdhdGUub25UcnlpbmcpIHtcbiAgICAgICAgICAgICAgICAgICAgb3B0aW9ucy5yZXF1ZXN0RGVsZWdhdGUub25UcnlpbmcocmVzcG9uc2UpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfSk7XG4gICAgICAgIHJldHVybiBQcm9taXNlLnJlc29sdmUob3V0Z29pbmdSZWdpc3RlclJlcXVlc3QpO1xuICAgIH1cbiAgICAvKipcbiAgICAgKiBTZW5kcy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ICAgICAgICAgdGhpcy53YWl0aW5nVG9nZ2xlKGZhbHNlKTtcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBvblByb2dyZXNzOiAocmVzcG9uc2UpID0+IHtcbiAgICAgICAgICAgICAgICBpZiAob3B0aW9ucy5yZXF1ZXN0RGVsZWdhdGUgJiYgb3B0aW9ucy5yZXF1ZXN0RGVsZWdhdGUub25Qcm9ncmVzcykge1xuICAgICAgICAgICAgICAgICAgICBvcHRpb25zLnJlcXVlc3REZWxlZ2F0ZS5vblByb2dyZXNzKHJlc3BvbnNlKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgb25SZWRpcmVjdDogKHJlc3BvbnNlKSA9PiB7XG4gICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIuZXJyb3IoXCJVbnJlZ2lzdGVyIHJlZGlyZWN0ZWQuIE5vdCBjdXJyZW50bHkgc3VwcG9ydGVkLlwiKTtcbiAgICAgICAgICAgICAgICB0aGlzLnVucmVnaXN0ZXJlZCgpO1xuICAgICAgICAgICAgICAgIGlmIChvcHRpb25zLnJlcXVlc3REZWxlZ2F0ZSAmJiBvcHRpb25zLnJlcXVlc3REZWxlZ2F0ZS5vblJlZGlyZWN0KSB7XG4gICAgICAgICAgICAgICAgICAgIG9wdGlvbnMucmVxdWVzdERlbGVnYXRlLm9uUmVkaXJlY3QocmVzcG9uc2UpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB0aGlzLndhaXRpbmdUb2dnbGUoZmFsc2UpO1xuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIG9uUmVqZWN0OiAocmVzcG9uc2UpID0+IHtcbiAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5lcnJvcihgVW5yZWdpc3RlciByZWplY3RlZCB3aXRoIHN0YXR1cyBjb2RlICR7cmVzcG9uc2UubWVzc2FnZS5zdGF0dXNDb2RlfWApO1xuICAgICAgICAgICAgICAgIHRoaXMudW5yZWdpc3RlcmVkKCk7XG4gICAgICAgICAgICAgICAgaWYgKG9wdGlvbnMucmVxdWVzdERlbGVnYXRlICYmIG9wdGlvbnMucmVxdWVzdERlbGVnYXRlLm9uUmVqZWN0KSB7XG4gICAgICAgICAgICAgICAgICAgIG9wdGlvbnMucmVxdWVzdERlbGVnYXRlLm9uUmVqZWN0KHJlc3BvbnNlKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgdGhpcy53YWl0aW5nVG9nZ2xlKGZhbHNlKTtcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBvblRyeWluZzogKHJlc3BvbnNlKSA9PiB7XG4gICAgICAgICAgICAgICAgaWYgKG9wdGlvbnMucmVxdWVzdERlbGVnYXRlICYmIG9wdGlvbnMucmVxdWVzdERlbGVnYXRlLm9uVHJ5aW5nKSB7XG4gICAgICAgICAgICAgICAgICAgIG9wdGlvbnMucmVxdWVzdERlbGVnYXRlLm9uVHJ5aW5nKHJlc3BvbnNlKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuICAgICAgICByZXR1cm4gUHJvbWlzZS5yZXNvbHZlKG91dGdvaW5nUmVnaXN0ZXJSZXF1ZXN0KTtcbiAgICB9XG4gICAgLyoqXG4gICAgICogQ2xlYXIgcmVnaXN0cmF0aW9uIHRpbWVycy5cbiAgICAgKi9cbiAgICBjbGVhclRpbWVycygpIHtcbiAgICAgICAgaWYgKHRoaXMucmVnaXN0cmF0aW9uVGltZXIgIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgY2xlYXJUaW1lb3V0KHRoaXMucmVnaXN0cmF0aW9uVGltZXIpO1xuICAgICAgICAgICAgdGhpcy5yZWdpc3RyYXRpb25UaW1lciA9IHVuZGVmaW5lZDtcbiAgICAgICAgfVxuICAgICAgICBpZiAodGhpcy5yZWdpc3RyYXRpb25FeHBpcmVkVGltZXIgIT09IHVuZGVmaW5lZCkge1xuICAgICAg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RvcCgpIHdoaWNoIGRpcHNvc2VzIG9mIGFsbCBSZWdpc3RlcmVycz9cIjtcbiAgICAgICAgdGhpcy5sb2dnZXIuZXJyb3IobWVzc2FnZSk7XG4gICAgfVxufVxuUmVnaXN0ZXJlci5kZWZhdWx0RXhwaXJlcyA9IDYwMDtcblJlZ2lzdGVyZXIuZGVmYXVsdFJlZnJlc2hGcmVxdWVuY3kgPSA5OTtcbiIsIi8qKlxuICoge0BsaW5rIFNlc3Npb259IHN0YXRlLlxuICpcbiAqIEByZW1hcmtzXG4gKiBUaGUge0BsaW5rIFNlc3Npb259IGJlaGF2ZXMgaW4gYSBkZXRlcm1pbmlzdGljIG1hbm5lciBhY2NvcmRpbmcgdG8gdGhlIGZvbGxvd2luZ1xuICogRmluaXRlIFN0YXRlIE1hY2hpbmUgKEZTTSkuXG4gKiBgYGB0eHRcbiAqICAgICAgICAgICAgICAgICAgIF9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fXG4gKiAgICAgICAgICAgICAgICAgIHwgIF9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fICAgICAgICAgICAgIHxcbiAqICAgICAgICAgICAgICAgICAgfCB8ICAgICAgICAgICAgX19fX19fX19fX19fX19fX19fX19fX19fX19fXyAgICB8ICAgICAgICAgICAgfFxuICogU2Vzc2lvbiAgICAgICAgICB8IHwgICAgICAgICAgIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgdiAgIHYgICAgICAgICAgICB2XG4gKiBDb25zdHJ1Y3RlZCAtPiBJbml0aWFsIC0+IEVzdGFibGlzaGluZyAtPiBFc3RhYmxpc2hlZCAtPiBUZXJtaW5hdGluZyAtPiBUZXJtaW5hdGVkXG4gKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgICAgICAgICAgIHxfX19fX19fX19fX19fX19fX19fX19fX19fX19eICAgXlxuICogICAgICAgICAgICAgICAgICAgICAgICAg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CAodGhpcy5zdGF0ZSkge1xuICAgICAgICAgICAgY2FzZSBTZXNzaW9uU3RhdGUuSW5pdGlhbDpcbiAgICAgICAgICAgICAgICBicmVhazsgLy8gdGhlIEludml0ZXIvSW52aXRhdGlvbiBzdWIgY2xhc3MgZGlzcG9zZSBtZXRob2QgaGFuZGxlcyB0aGlzIGNhc2VcbiAgICAgICAgICAgIGNhc2UgU2Vzc2lvblN0YXRlLkVzdGFibGlzaGluZzpcbiAgICAgICAgICAgICAgICBicmVhazsgLy8gdGhlIEludml0ZXIvSW52aXRhdGlvbiBzdWIgY2xhc3MgZGlzcG9zZSBtZXRob2QgaGFuZGxlcyB0aGlzIGNhc2VcbiAgICAgICAgICAgIGNhc2UgU2Vzc2lvblN0YXRlLkVzdGFibGlzaGVkOlxuICAgICAgICAgICAgICAgIHJldHVybiBuZXcgUHJvbWlzZSgocmVzb2x2ZSkgPT4ge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLl9ieWUoe1xuICAgICAgICAgICAgICAgICAgICAgICAgLy8gd2FpdCBmb3IgdGhlIHJlc3BvbnNlIHRvIHRoZSBCWUUgYmVmb3JlIHJlc29sdmluZ1xuICAgICAgICAgICAgICAgICAgICAgICAgb25BY2NlcHQ6ICgpID0+IHJlc29sdmUoKSxcbiAgICAgICAgICAgICAgICAgICAgICAgIG9uUmVkaXJlY3Q6ICgpID0+IHJlc29sdmUoKSxcbiAgICAgICAgICAgICAgICAgICAgICAgIG9uUmVqZWN0OiAoKSA9PiByZXNvbHZlKClcbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICBjYXNlIFNlc3Npb25TdGF0ZS5UZXJtaW5hdGluZzpcbiAgICAgICAgICAgICAgICBicmVhazsgLy8gbm90aGluZyB0byBiZSBkb25lXG4gICAgICAgICAgICBjYXNlIFNlc3Npb25TdGF0ZS5UZXJtaW5hdGVkOlxuICAgICAgICAgICAgICAgIGJyZWFrOyAvLyBub3Ro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5cIjtcbiAgICAgICAgICAgICAgICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgQHR5cGVzY3JpcHQtZXNsaW50L25vLWV4cGxpY2l0LWFueVxuICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgdGhpcy5jYW5jZWwgPT09IFwiZnVuY3Rpb25cIikge1xuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlICs9IFwiIFBlcmhhcHMgeW91IGhhdmUgYWxyZWFkeSBjYWxsZWQgSW52aXRlci5jYW5jZWwoKT9cIjtcbiAgICAgICAgICAgICAgICAgICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIEB0eXBlc2NyaXB0LWVzbGludC9uby1leHBsaWNpdC1hbnlcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZWxzZSBpZiAodHlwZW9mIHRoaXMucmVqZWN0ID09PSBcImZ1bmN0aW9uXCIpIHtcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZSArPSBcIiBQZXJoYXBzIHlvdSBoYXZlIGFscmVhZHkgY2FsbGVkIFNlc3Npb24uYnllKCk/XCI7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBTZXNzaW9uU3RhdGUuVGVybWluYXRlZDpcbiAgICAgICAgICAgICAgICBtZXNzYWdlICs9IFwiIEhvd2V2ZXIgdGhpcyBzZXNzaW9uIGlzIGFscmVhZHkgdGVybWluYXRlZC5cIjtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwiVW5rbm93biBzdGF0ZVwiKTtcbiAgICAgICAgfVxuICAgICAgICB0aGlzLmxvZ2dlci5lcnJvcihtZXNzYWdlKTtcbiAgICAgICAgcmV0dXJuIFByb21pc2UucmVqZWN0KG5ldyBFcnJvcihgSW52YWxpZCBzZXNzaW9uIHN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ck9wdGlvbnM6IHRoaXMuc2Vzc2lvbkRlc2NyaXB0aW9uSGFuZGxlck9wdGlvbnNSZUludml0ZSxcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlc3Npb25EZXNjcmlwdGlvbkhhbmRsZXJNb2RpZmllcnM6IHRoaXMuc2Vzc2lvbkRlc2NyaXB0aW9uSGFuZGxlck1vZGlmaWVyc1JlSW52aXRlXG4gICAgICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuc2V0T2ZmZXJBbmRHZXRBbnN3ZXIoYm9keSwgYW5zd2VyT3B0aW9ucylcbiAgICAgICAgICAgICAgICAgICAgICAgIC50aGVuKChhbnN3ZXJCb2R5KSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXNwb25zZS5hY2soeyBib2R5OiBhbnN3ZXJCb2R5IH0pO1xuICAgICAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgICAgICAgICAgICAgLmNhdGNoKChlcnJvcikgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgLy8gTm8gd2F5IHRvIHJlY292ZXIsIHNvIHRlcm1pbmF0ZSBzZXNzaW9uIGFuZCBtYXJrIGFzIGZhaWxlZC5cbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLmVycm9yKFwiRmFpbGVkIHRvIGhhbmRsZSBvZmZlciBpbiAyeHggcmVzcG9uc2UgdG8gcmUtSU5WSVRFXCIpO1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIuZXJyb3IoZXJyb3IubWVzc2FnZSk7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5zdGF0ZSA9PT0gU2Vzc2lvblN0YXRlLlRlcm1pbmF0ZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBBIEJZRSBzaG91bGQgbm90IGJlIHNlbnQgaWYgYWxyZWFkeSB0ZXJtaW5hdGVkLlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIEZvciBleGFtcGxlLCBhIEJZRSBtYXkgYmUgc2VudC9yZWNlaXZlZCB3aGlsZSByZS1JTlZJVEUgaXMgb3V0c3RhbmRpbmcuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzcG9uc2UuYWNrKCk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmFja0FuZEJ5ZShyZXNwb25zZSwgNDg4LCBcIkJhZCBNZWRpYSBEZXNjcmlwdGlvblwiKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnN0YXRlVHJhbnNpdGlvbihTZXNzaW9uU3RhdGUuVGVybWluYXRlZCk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICAgICAgICAgICAgICAudGhlbigoKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnBlbmRpbmdSZWludml0ZSA9IGZhbHNlO1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG9wdGlvbnMucmVxdWVzdERlbGVnYXRlICYmIG9wdGlvbnMucmVxdWVzdERlbGVnYXRlLm9uQWNjZXB0KSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgb3B0aW9ucy5yZXF1ZXN0RGVsZWdhdGUub25BY2NlcHQocmVzcG9uc2UpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIElOVklURSB3aXRoIFNEUCAtIHNldCByZW1vdGUgYW5zd2VyIGFuZCBzZW5kIGFuIEFDS1xuICAgICAgICAgICAgICAgICAgICBjb25zdCBhbnN3ZXJPcHRpb25zID0ge1xuICAgICAgICAgICAgICAgICAgICAgICAgc2Vzc2lvbkRlc2NyaXB0aW9uSGFuZGxlck9wdGlvbnM6IHRoaXMuc2Vzc2lvbkRlc2NyaXB0aW9uSGFuZGxlck9wdGlvbnNSZUludml0ZSxcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlc3Npb25EZXNjcmlwdGlvbkhhbmRsZXJNb2RpZmllcnM6IHRoaXMuc2Vzc2lvbkRlc2NyaXB0aW9uSGFuZGxlck1vZGlmaWVyc1JlSW52aXRlXG4gICAgICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuc2V0QW5zd2VyKGJvZHksIGFuc3dlck9wdGlvbnMpXG4gICAgICAgICAgICAgICAgICAgICAgICAudGhlbigoKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXNwb25zZS5hY2soKTtcbiAgICAgICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgICAgICAgICAgIC5jYXRjaCgoZXJyb3IpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIE5vIHdheSB0byByZWNvdmVyLCBzbyB0ZXJtaW5hdGUgc2Vzc2lvbiBhbmQgbWFyayBhcyBmYWlsZWQuXG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5lcnJvcihcIkZhaWxlZCB0byBoYW5kbGUgYW5zd2VyIGluIDJ4eCByZXNwb25zZSB0byByZS1JTlZJVEVcIik7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5lcnJvcihlcnJvci5tZXNzYWdlKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIEEgQllFIHNob3VsZCBvbmx5IGJlIHNlbnQgaWYgc2Vzc2lvbiBpcyBub3QgYWxyZWFkeSB0ZXJtaW5hdGVkLlxuICAgICAgICAgICAgICAgICAgICAgICAgLy8gRm9yIGV4YW1wbGUsIGEgQllFIG1heSBiZSBzZW50L3JlY2VpdmVkIHdoaWxlIHJlLUlOVklURSBpcyBvdXRzdGFuZGluZy5cbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIFRoZSBBQ0sgbmVlZHMgdG8gYmUgc2VudCByZWdhcmRsZXNzIGFzIGl0IHdhcyBub3QgaGFuZGxlZCBieSB0aGUgdHJhbnNhY3Rpb24uXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5zdGF0ZSAhPT0gU2Vzc2lvblN0YXRlLlRlcm1pbmF0ZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmFja0FuZEJ5ZShyZXNwb25zZSwgNDg4LCBcIkJhZCBNZWRpYSBEZXNjcmlwdGlvblwiKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnN0YXRlVHJhbnNpdGlvbihTZXNzaW9uU3RhdGUuVGVybWluYXRlZCk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXNwb25zZS5hY2soKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgICAgICAgICAgIC50aGVuKCgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMucGVuZGluZ1JlaW52aXRlID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAob3B0aW9ucy5yZXF1ZXN0RGVsZWdhdGUgJiYgb3B0aW9ucy5yZXF1ZXN0RGVsZWdhdGUub25BY2NlcHQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcHRpb25zLnJlcXVlc3REZWxlZ2F0ZS5vbkFjY2VwdChyZXNwb25zZSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgQHR5cGVzY3JpcHQtZXNsaW50L25vLXVudXNlZC12YXJzXG4gICAgICAgICAgICBvblByb2dyZXNzOiAocmVzcG9uc2UpID0+IHtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIEB0eXBlc2NyaXB0LWVzbGludC9uby11bnVzZWQtdmFyc1xuICAgICAgICAgICAgb25SZWRpcmVjdDogKHJlc3BvbnNlKSA9PiB7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIG9uUmVqZWN0OiAocmVzcG9uc2UpID0+IHtcbiAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci53YXJuKFwiUmVjZWl2ZWQgYSBub24tMnh4IHJlc3BvbnNlIHRvIHJlLUlOVklURVwiKTtcbiAgICAgICAgICAgICAgICB0aGlzLnBlbmRpbmdSZWludml0ZSA9IGZhbHNlO1xuICAgICAgICAgICAgICAgIGlmIChvcHRpb25zLndpdGhvdXRTZHApIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKG9wdGlvbnMucmVxdWVzdERlbGVnYXRlICYmIG9wdGlvbnMucmVxdWVzdERlbGVnYXRlLm9uUmVqZWN0KSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBvcHRpb25zLnJlcXVlc3REZWxlZ2F0ZS5vblJlamVjdChyZXNwb25zZSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMucm9sbGJhY2tPZmZlcigpXG4gICAgICAgICAgICAgICAgICAgICAgICAuY2F0Y2goKGVycm9yKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBObyB3YXkgdG8gcmVjb3Zlciwgc28gdGVybWluYXRlIHNlc3Npb24gYW5kIG1hcmsgYXMgZmFpbGVkLlxuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIuZXJyb3IoXCJGYWlsZWQgdG8gcm9sbGJhY2sgb2ZmZXIgb24gbm9uLTJ4eCByZXNwb25zZSB0byByZS1JTlZJVEVcIik7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5lcnJvcihlcnJvci5tZXNzYWdlKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIEEgQllFIHNob3VsZCBvbmx5IGJlIHNlbnQgaWYgc2Vzc2lvbiBpcyBub3QgYWxyZWFkeSB0ZXJtaW5hdGVkLlxuICAgICAgICAgICAgICAgICAgICAgICAgLy8gRm9yIGV4YW1wbGUsIGEgQllFIG1heSBiZSBzZW50L3JlY2VpdmVkIHdoaWxlIHJlLUlOVklURSBpcyBvdXRzdGFuZGluZy5cbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIE5vdGUgdGhhdCB0aGUgQUNLIHdhcyBhbHJlYWR5IHNlbnQgYnkgdGhlIHRyYW5zYWN0aW9uLCBzbyBqdXN0IG5lZWQgdG8gc2VuZCBCWUUuXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5zdGF0ZSAhPT0gU2Vzc2lvblN0YXRlLlRlcm1pbmF0ZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXRoaXMuZGlhbG9nKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcIkRpYWxvZyB1bmRlZmluZWQuXCIpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBleHRyYUhlYWRlcnMgPSBbXTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBleHRyYUhlYWRlcnMucHVzaChcIlJlYXNvbjogXCIgKyB0aGlzLmdldFJlYXNvbkhlYWRlclZhbHVlKDUwMCwgXCJJbnRlcm5hbCBTZXJ2ZXIgRXJyb3JcIikpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZGlhbG9nLmJ5ZSh1bmRlZmluZWQsIHsgZXh0cmFIZWFkZXJzIH0pO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc3RhdGVUcmFuc2l0aW9uKFNlc3Npb25TdGF0ZS5UZXJtaW5hdGVkKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgICAgICAgICAgIC50aGVuKCgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChvcHRpb25zLnJlcXVlc3REZWxlZ2F0ZSAmJiBvcHRpb25zLnJlcXVlc3REZWxlZ2F0ZS5vblJlamVjdCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wdGlvbnMucmVxdWVzdERlbGVnYXRlLm9uUmVqZWN0KHJlc3BvbnNlKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBAdHlwZXNjcmlwdC1lc2xpbnQvbm8tdW51c2VkLXZhcnNcbiAgICAgICAgICAgIG9uVHJ5aW5nOiAocmVzcG9uc2UpID0+IHtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgIH07XG4gICAgICAgIGNvbnN0IHJlcXVlc3RPcHRpb25zID0gb3B0aW9ucy5yZXF1ZXN0T3B0aW9ucyB8fCB7fTtcbiAgICAgICAgcmVxdWVzdE9wdGlvbnMuZXh0cmFIZWFkZXJzID0gKHJlcXVlc3RPcHRpb25zLmV4dHJhSGVhZGVycyB8fCBbXSkuc2xpY2UoKTtcbiAgICAgICAgcmVxdWVz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Npb25TdGF0ZS5UZXJtaW5hdGVkKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXNvbHZlKHJlcXVlc3QpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBQcm9taXNlLnJlc29sdmUoKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBPciB0aGUgc2VydmVyIHRyYW5zYWN0aW9uIHRpbWVzIG91dCBiZWZvcmUgdGhlIEFDSyBhcnJpdmVzLlxuICAgICAgICAgICAgICAgICAgICAgICAgb25BY2tUaW1lb3V0OiAoKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgcmVxdWVzdCA9IGRpYWxvZy5ieWUoZGVsZWdhdGUsIG9wdGlvbnMpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc3RhdGVUcmFuc2l0aW9uKFNlc3Npb25TdGF0ZS5UZXJtaW5hdGVkKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXNvbHZlKHJlcXVlc3QpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgY2FzZSBTZXNzaW9uRGlhbG9nU3RhdGUuQ29uZmlybWVkOiB7XG4gICAgICAgICAgICAgICAgY29uc3QgcmVxdWVzdCA9IGRpYWxvZy5ieWUoZGVsZWdhdGUsIG9wdGlvbnMpO1xuICAgICAgICAgICAgICAgIHRoaXMuc3RhdGVUcmFuc2l0aW9uKFNlc3Npb25TdGF0ZS5UZXJtaW5hdGVkKTtcbiAgICAgICAgICAgICAgICByZXR1cm4gUHJvbWlzZS5yZXNvbHZlKHJlcXVlc3QpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgY2FzZSBTZXNzaW9uRGlhbG9nU3RhdGUuVGVybWluYXRlZDpcbiAgIC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Ym9keS5jb250ZW50RGlzcG9zaXRpb24gPT09IFwicmVuZGVyXCIpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5fcmVuZGVyYm9keSA9IGJvZHkuY29udGVudDtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5fcmVuZGVydHlwZSA9IGJvZHkuY29udGVudFR5cGU7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBQcm9taXNlLnJlc29sdmUoKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKGJvZHkuY29udGVudERpc3Bvc2l0aW9uICE9PSBcInNlc3Npb25cIikge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gUHJvbWlzZS5yZXNvbHZlKCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnNldEFuc3dlcihib2R5LCBhbnN3ZXJPcHRpb25zKS5jYXRjaCgoZXJyb3IpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIuZXJyb3IoZXJyb3IubWVzc2FnZSk7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IGV4dHJhSGVhZGVycyA9IFtcIlJlYXNvbjogXCIgKyB0aGlzLmdldFJlYXNvbkhlYWRlclZhbHVlKDQ4OCwgXCJCYWQgTWVkaWEgRGVzY3JpcHRpb25cIildO1xuICAgICAgICAgICAgICAgICAgICBkaWFsb2cuYnllKHVuZGVmaW5lZCwgeyBleHRyYUhlYWRlcnMgfSk7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuc3RhdGVUcmFuc2l0aW9uKFNlc3Npb25TdGF0ZS5UZXJtaW5hdGVkKTtcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGNhc2UgU2lnbmFsaW5nU3RhdGUuSGF2ZUxvY2FsT2ZmZXI6IHtcbiAgICAgICAgICAgICAgICAvLyBTdGF0ZSBzaG91bGQgbmV2ZXIgYmUgc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50aW9uYWxseSB3cml0dGVuIHZlcnkgZGVmZW5zaXZlbHkuIERvbid0IHRydXN0IFNESCB0byBiZWhhdmUuXG4gICAgICAgIHRyeSB7XG4gICAgICAgICAgICByZXR1cm4gc2RoXG4gICAgICAgICAgICAgICAgLmdldERlc2NyaXB0aW9uKHNkaE9wdGlvbnMsIHNkaE1vZGlmaWVycylcbiAgICAgICAgICAgICAgICAudGhlbigoYm9keUFuZENvbnRlbnRUeXBlKSA9PiBmcm9tQm9keUxlZ2FjeShib2R5QW5kQ29udGVudFR5cGUpKVxuICAgICAgICAgICAgICAgIC5jYXRjaCgoZXJyb3IpID0+IHtcbiAgICAgICAgICAgICAgICAvLyBkb24ndCB0cnVzdCBTREggdG8gcmVqZWN0IHdpdGggRXJyb3JcbiAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5lcnJvcihcIlNlc3Npb24uZ2V0T2ZmZXI6IFNESCBnZXREZXNjcmlwdGlvbiByZWplY3RlZC4uLlwiKTtcbiAgICAgICAgICAgICAgICBjb25zdCBlID0gZXJyb3IgaW5zdGFuY2VvZiBFcnJvciA/IGVycm9yIDogbmV3IEVycm9yKFwiU2Vzc2lvbi5nZXRPZmZlciB1bmtub3duIGVycm9yLlwiKTtcbiAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5lcnJvcihlLm1lc3NhZ2UpO1xuICAgICAgICAgICAgICAgIHRocm93IGU7XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgICAgICBjYXRjaCAoZXJyb3IpIHtcbiAgICAgICAgICAgIC8vIGRvbid0IHRydXN0IFNESCB0byB0aHJvdyBhbiBFcnJvclxuICAgICAgICAgICAgdGhpcy5sb2dnZXIuZXJyb3IoXCJTZXNzaW9uLmdldE9mZmVyOiBTREggZ2V0RGVzY3JpcHRpb24gdGhyZXcuLi5cIik7XG4gICAgICAgICAgICBjb25zdCBlID0gZXJyb3IgaW5zdGFuY2VvZiBFcnJvciA/IGVycm9yIDogbmV3IEVycm9y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mVycm9yKGUubWVzc2FnZSk7XG4gICAgICAgICAgICAgICAgdGhyb3cgZTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICAgIGNhdGNoIChlcnJvcikge1xuICAgICAgICAgICAgLy8gZG9uJ3QgdHJ1c3QgU0RIIHRvIHRocm93IGFuIEVycm9yXG4gICAgICAgICAgICB0aGlzLmxvZ2dlci5lcnJvcihcIlNlc3Npb24ucm9sbGJhY2tPZmZlcjogU0RIIHJvbGxiYWNrRGVzY3JpcHRpb24gdGhyZXcuLi5cIik7XG4gICAgICAgICAgICBjb25zdCBlID0gZXJyb3IgaW5zdGFuY2VvZiBFcnJvciA/IGVycm9yIDogbmV3IEVycm9yKGVycm9yKTtcbiAgICAgICAgICAgIHRoaXMubG9nZ2VyLmVycm9yKGUubWVzc2FnZSk7XG4gICAgICAgICAgICByZXR1cm4gUHJvbWlzZS5yZWplY3QoZSk7XG4gICAgICAgIH1cbiAgICB9XG4gICAgLyoqXG4gICAgICogU2V0IHJlbW90ZSBhbnN3ZXIuXG4gICAgICogQGludGVybmFsXG4gICAgICovXG4gICAgc2V0QW5zd2VyKGFuc3dlciwgb3B0aW9ucykge1xuICAgICAgICBjb25zdCBzZGggPSB0aGlzLnNldHVwU2Vzc2lvbkRlc2NyaXB0aW9uSGFuZGxlcigpO1xuICAgICAgICBjb25zdCBzZGhPcHRpb25zID0gb3B0aW9ucy5zZXNzaW9uRGVzY3JpcHRpb25IYW5kbGVyT3B0aW9ucztcbiAgICAgICAgY29uc3Qgc2RoTW9kaWZpZXJzID0gb3B0aW9ucy5zZXNzaW9uRGVzY3JpcHRpb25IYW5kbGVyTW9kaWZpZXJzO1xuICAgICAgICAvLyBUaGlzIGlzIGludGVudGlvbmFsbHkgd3JpdHRlbiB2ZXJ5IGRlZmVuc2l2ZWx5LiBEb24ndCB0cnVzdCBTREggdG8gYmVoYXZlLlxuICAgICAgICB0cnkge1xuICAgICAgICAgICAgaWYgKCFzZGguaGFzRGVzY3JpcHRpb24oYW5zd2VyLmNvbnRlbnRUeXBlKSkge1xuICAgICAgICAgICAgICAgIHJldHVybiBQcm9taXNlLnJlamVjdChuZXcgQ29udGVudFR5cGVVbnN1cHBvcnRlZEVycm9yKCkpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGNhdGNoIChlcnJvcikge1xuICAgICAgICAgICAgdGhpcy5sb2dnZXIuZXJyb3IoXCJTZXNzaW9uLnNldEFuc3dlcjogU0RIIGhhc0Rlc2NyaXB0aW9uIHRocmV3Li4uXCIpO1xuICAgICAgICAgICAgY29uc3QgZSA9IGVycm9yIGluc3RhbmNlb2YgRXJyb3IgPyBlcnJvciA6IG5ldyBFcnJvcihlcnJvcik7XG4gICAgICAgICAgICB0aGlzLmxvZ2dlci5lcnJvcihlLm1lc3NhZ2UpO1xuICAgICAgICAgICAgcmV0dXJuIFByb21pc2UucmVqZWN0KGUpO1xuICAgICAgICB9XG4gICAgICAgIHRyeSB7XG4gICAgICAgICAgICByZXR1cm4gc2RoLnNldERlc2NyaXB0aW9uKGFuc3dlci5jb250ZW50LCBzZGhPcHRpb25zLCBzZGhNb2RpZmllcnMpLmNhdGNoKChlcnJvcikgPT4ge1xuICAgICAgICAgICAgICAgIC8vIGRvbid0IHRydXN0IFNESCB0byByZWplY3Qgd2l0aCBFcnJvclxuICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLmVycm9yKFwiU2Vzc2lvbi5zZXRBbnN3ZXI6IFNESCBzZXREZXNjcmlwdGlvbiByZWplY3RlZC4uLlwiKTtcbiAgICAgICAgICAgICAgICBjb25zdCBlID0gZXJyb3IgaW5zdGFuY2VvZiBFcnJvciA/IGVycm9yIDogbmV3IEVycm9yKFwiU2Vzc2lvbi5zZXRBbnN3ZXIgdW5rbm93biBlcnJvci5cIik7XG4gICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIuZXJyb3IoZS5tZXNzYWdlKTtcbiAgICAgICAgICAgICAgICB0aHJvdyBlO1xuICA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Zlci5jb250ZW50VHlwZSkpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gUHJvbWlzZS5yZWplY3QobmV3IENvbnRlbnRUeXBlVW5zdXBwb3J0ZWRFcnJvcigpKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBjYXRjaCAoZXJyb3IpIHtcbiAgICAgICAgICAgIHRoaXMubG9nZ2VyLmVycm9yKFwiU2Vzc2lvbi5zZXRPZmZlckFuZEdldEFuc3dlcjogU0RIIGhhc0Rlc2NyaXB0aW9uIHRocmV3Li4uXCIpO1xuICAgICAgICAgICAgY29uc3QgZSA9IGVycm9yIGluc3RhbmNlb2YgRXJyb3IgPyBlcnJvciA6IG5ldyBFcnJvcihlcnJvcik7XG4gICAgICAgICAgICB0aGlzLmxvZ2dlci5lcnJvcihlLm1lc3NhZ2UpO1xuICAgICAgICAgICAgcmV0dXJuIFByb21pc2UucmVqZWN0KGUpO1xuICAgICAgICB9XG4gICAgICAgIHRyeSB7XG4gICAgICAgICAgICByZXR1cm4gc2RoXG4gICAgICAgICAgICAgICAgLnNldERlc2NyaXB0aW9uKG9mZmVyLmNvbnRlbnQsIHNkaE9wdGlvbnMsIHNkaE1vZGlmaWVycylcbiAgICAgICAgICAgICAgICAudGhlbigoKSA9PiBzZGguZ2V0RGVzY3JpcHRpb24oc2RoT3B0aW9ucywgc2RoTW9kaWZpZXJzKSlcbiAgICAgICAgICAgICAgICAudGhlbigoYm9keUFuZENvbnRlbnRUeXBlKSA9PiBmcm9tQm9keUxlZ2FjeShib2R5QW5kQ29udGVudFR5cGUpKVxuICAgICAgICAgICAgICAgIC5jYXRjaCgoZXJyb3IpID0+IHtcbiAgICAgICAgICAgICAgICAvLyBkb24ndCB0cnVzdCBTREggdG8gcmVqZWN0IHdpdGggRXJyb3JcbiAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5lcnJvcihcIlNlc3Npb24uc2V0T2ZmZXJBbmRHZXRBbnN3ZXI6IFNESCBzZXREZXNjcmlwdGlvbiBvciBnZXREZXNjcmlwdGlvbiByZWplY3RlZC4uLlwiKTtcbiAgICAgICAgICAgICAgICBjb25zdCBlID0gZXJyb3IgaW5zdGFuY2VvZiBFcnJvciA/IGVycm9yIDogbmV3IEVycm9yKFwiU2Vzc2lvbi5zZXRPZmZlckFuZEdldEFuc3dlciB1bmtub3duIGVycm9yLlwiKTtcbiAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5lcnJvcihlLm1lc3NhZ2UpO1xuICAgICAgICAgICAgICAgIHRocm93IGU7XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgICAgICBjYXRjaCAoZXJyb3IpIHtcbiAgICAgICAgICAgIC8vIGRvbid0IHRydXN0IFNESCB0byB0aHJvdyBhbiBFcnJvclxuICAgICAgICAgICAgdGhpcy5sb2dnZXIuZXJyb3IoXCJTZXNzaW9uLnNldE9mZmVyQW5kR2V0QW5zd2VyOiBTREggc2V0RGVzY3JpcHRpb24gb3IgZ2V0RGVzY3JpcHRpb24gdGhyZXcuLi5cIik7XG4gICAgICAgICAgICBjb25zdCBlID0gZXJyb3IgaW5zdGFuY2VvZiBFcnJvciA/IGVycm9yIDogbmV3IEVycm9yKGVycm9yKTtcbiAgICAgICAgICAgIHRoaXMubG9nZ2VyLmVycm9yKGUubWVzc2FnZSk7XG4gICAgICAgICAgICByZXR1cm4gUHJvbWlzZS5yZWplY3QoZSk7XG4gICAgICAgIH1cbiAgICB9XG4gICAgLyoqXG4gICAgICogU0RIIGZvciBjb25maXJtZWQgZGlhbG9nLlxuICAgICAqIEBpbnRlcm5hbFxuICAgICAqL1xuICAgIHNldFNlc3Npb25EZXNjcmlwdGlvbkhhbmRsZXIoc2RoKSB7XG4gICAgICAgIGlmICh0aGlzLl9zZXNzaW9uRGVzY3JpcHRpb25IYW5kbGVyKSB7XG4gICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJTZXNzaW9uIGRlc2NyaXB0aW9uIGhhbmRsZXIgZGVma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gICAgICAgICAgICAgICAgaW52YWxpZFRyYW5zaXRpb24oKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIFNlc3Npb25TdGF0ZS5Fc3RhYmxpc2hlZDpcbiAgICAgICAgICAgICAgICBpZiAobmV3U3RhdGUgIT09IFNlc3Npb25TdGF0ZS5UZXJtaW5hdGluZyAmJiBuZXdTdGF0ZSAhPT0gU2Vzc2lvblN0YXRlLlRlcm1pbmF0ZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgaW52YWxpZFRyYW5zaXRpb24oKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIFNlc3Npb25TdGF0ZS5UZXJtaW5hdGluZzpcbiAgICAgICAgICAgICAgICBpZiAobmV3U3RhdGUgIT09IFNlc3Npb25TdGF0ZS5UZXJtaW5hdGVkKSB7XG4gICAgICAgICAgICAgICAgICAgIGludmFsaWRUcmFuc2l0aW9uKCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBTZXNzaW9uU3RhdGUuVGVybWluYXRlZDpcbiAgICAgICAgICAgICAgICBpbnZhbGlkVHJhbnNpdGlvbigpO1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJVbnJlY29nbml6ZWQgc3RhdGUuXCIpO1xuICAgICAgICB9XG4gICAgICAgIC8vIFRyYW5zaXRpb25cbiAgICAgICAgdGhpcy5fc3RhdGUgPSBuZXdTdGF0ZTtcbiAgICAgICAgdGhpcy5sb2dnZXIubG9nKGBTZXNzaW9uICR7dGhpcy5pZH0gdHJhbnNpdGlvbmVkIHRvIHN0YXRlICR7dGhpcy5fc3RhdGV9YCk7XG4gICAgICAgIHRoaXMuX3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ZhcnNcbiAgICAgICAgICAgICAgICByZXR1cm4gbmV3IFByb21pc2UoKHJlc29sdmUsIHJlamVjdCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICBkaWFsb2cuZGVsZWdhdGUgPSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBvblRlcm1pbmF0ZWQ6ICgpID0+IHJlc29sdmUoKVxuICAgICAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgICAgICBkaWFsb2cudW5zdWJzY3JpYmUoKTtcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSk7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIFN1YnNjcmliZSB0byBldmVudCBub3RpZmljYXRpb25zLlxuICAgICAqXG4gICAgICogQHJlbWFya3NcbiAgICAgKiBTZW5kIGFuIGluaXRpYWwgU1VCU0NSSUJFIHJlcXVlc3QgaWYgbm8gc3Vic2NyaXB0aW9uIGFzIGJlZW4gZXN0YWJsaXNoZWQuXG4gICAgICogU2VuZHMgYSByZS1TVUJTQ1JJQkUgcmVxdWVzdCBpZiB0aGUgc3Vic2NyaXB0aW9uIGlzIFwiYWN0aXZlXCIuXG4gICAgICovXG4gICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIEB0eXBlc2NyaXB0LWVzbGludC9uby11bnVzZWQtdmFyc1xuICAgIHN1YnNjcmliZShvcHRpb25zID0ge30pIHtcbiAgICAgICAgc3dpdGNoICh0aGlzLnN1YnNjcmliZXJSZXF1ZXN0LnN0YXRlKSB7XG4gICAgICAgICAgICBjYXNlIFN1YnNjcmlwdGlvbkRpYWxvZ1N0YXRlLkluaXRpYWw6XG4gICAgICAgICAgICAgICAgLy8gd2UgY2FuIGVuZCB1cCBoZXJlIHdoZW4gcmV0cnlpbmcgc28gb25seSBzdGF0ZSB0cmFuc2l0aW9uIGlmIGluIFN1YnNjcmlwdGlvblN0YXRlLkluaXRpYWwgc3RhdGVcbiAgICAgICAgICAgICAgICBpZiAodGhpcy5zdGF0ZSA9PT0gU3Vic2NyaXB0aW9uU3RhdGUuSW5pdGlhbCkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnN0YXRlVHJhbnNpdGlvbihTdWJzY3JpcHRpb25TdGF0ZS5Ob3RpZnlXYWl0KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgdGhpcy5zdWJzY3JpYmVyUmVxdWVzdC5zdWJzY3JpYmUoKS50aGVuKChyZXN1bHQpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHJlc3VsdC5zdWNjZXNzKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAocmVzdWx0LnN1Y2Nlc3Muc3Vic2NyaXB0aW9uKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5fZGlhbG9nID0gcmVzdWx0LnN1Y2Nlc3Muc3Vic2NyaXB0aW9uO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX2RpYWxvZy5kZWxlZ2F0ZSA9IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb25Ob3RpZnk6IChyZXF1ZXN0KSA9PiB0aGlzLm9uTm90aWZ5KHJlcXVlc3QpLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvblJlZnJlc2g6IChyZXF1ZXN0KSA9PiB0aGlzLm9uUmVmcmVzaChyZXF1ZXN0KSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb25UZXJtaW5hdGVkOiAoKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBJZiBhIGNhbGwgdG8gdW5zdWJzY3JpYmUgd2lsbCBzdGF0ZSB0cmFuc2l0aW9uIHRvIFN1YnNjcmlwdGlvblN0YXRlLlRlcm1pbmF0ZWQsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBidXQgd2UgY2FuIGVuZCB1cCBoZXJlIGFmdGVyIHRoYXQgaWYgdGhlIE5PVElGWSBuZXZlciBhcnJpdmVzIGFuZCB0aW1lciBOIGZpcmVzLlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMuc3RhdGUgIT09IFN1YnNjcmlwdGlvblN0YXRlLlRlcm1pbmF0ZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnN0YXRlVHJhbnNpdGlvbihTdWJzY3JpcHRpb25TdGF0ZS5UZXJtaW5hdGVkKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLm9uTm90aWZ5KHJlc3VsdC5zdWNjZXNzLnJlcXVlc3QpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKHJlc3VsdC5mYWlsdXJlKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnVuc3Vic2NyaWJlKCk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgU3Vic2NyaXB0aW9uRGlhbG9nU3RhdGUuTm90aWZ5V2FpdDpcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgU3Vic2NyaXB0aW9uRGlhbG9nU3RhdGUuUGVuZGluZzpcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgU3Vic2NyaXB0aW9uRGlhbG9nU3RhdGUuQWN0aXZlOlxuICAgICAgICAgICAgICAgIGlmICh0aGlzLl9kaWFsb2cpIHtcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgcmVxdWVzdCA9IHRoaXMuX2RpYWxvZy5yZWZyZXNoKCk7XG4gICAgICAgICAgICAgICAgICAgIHJlcXVlc3QuZGVsZWdhdGUgPSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBvbkFjY2VwdDogKHJlc3BvbnNlKSA9PiB0aGlzLm9uQWNjZXB0ZWQocmVzcG9uc2UpLFxuICAgICAgICAgICAgICAgICAgICAgICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIEB0eXBlc2NyaXB0LWVzbGludC9uby11bnVzZWQtdmFyc1xuICAgICAgICAgICAgICAgICAgICAgICAgb25SZWRpcmVjdDogKHJlc3BvbnNlKSA9PiB0aGlzLnVuc3Vic2NyaWJlKCksXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgQHR5cGVzY3JpcHQtZXNsaW50L25vLXVudXNlZC12YXJzXG4gICAgICAgICAgICAgICAgICAgICAgICBvblJlamVjdDogKHJlc3BvbnNlKSA9PiB0aGlzLnVuc3Vic2NyaWJlKClcbiAgICAgICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIFN1YnNjcmlwdGlvbkRpYWxvZ1N0YXRlLlRlcm1pbmF0ZWQ6XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBQcm9taXNlLnJlc29sdmUoKTtcbiAgICB9XG4gICAgLyoqXG4gICAgICoge0Bpbmhlcml0RG9jIFN1YnNjcmlwdGlvbi51bnN1YnNjcmliZX1cbiAgICAgKi9cbiAgICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgQHR5cGVzY3JpcHQtZXNsaW50L25vLXVudXNlZC12YXJzXG4gICAgdW5zdWJzY3JpYmUob3B0aW9ucyA9IHt9KSB7XG4gICAgICAgIGlmICh0aGlzLmRpc3Bvc2VkKSB7XG4gICAgICAgICAgICByZXR1cm4gUHJvbWlzZS5yZXNvbHZlKCk7XG4gICAgICAgIH1cbiAgICAgICAgc3dpdGNoICh0aGlzLnN1YnNjcmliZXJSZXF1ZXN0LnN0YXRlKSB7XG4gICAgICAgICAgICBjYXNlIFN1YnNjcmlwdGlvbkRpYWxvZ1N0YXRlLkluaXRpYWw6XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIFN1YnNjcmlwdGlvbkRpYWxvZ1N0YXRlLk5vdGlmeVdhaXQ6XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIFN1YnNjcmlwdGlvbkRpYWxvZ1N0YXRlLlBlbmRpbmc6XG4gICAgICAgICAgICAgICAgaWYgKHRoaXMuX2RpYWxvZykge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLl9kaWFsb2cudW5zdWJzY3JpYmUoKTtcbiAgICAgICAgICAgICAgICAgICAgLy8gcmVzcG9uc2VzIGludGVudGlvbmFsbHkgaWdub3JlZFxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgU3Vic2NyaXB0aW9uRGlhbG9nU3RhdGUuQWN0aXZlOlxuICAgICAgICAgICAgICAgIGlmICh0aGlzLl9kaWFsb2cpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5fZGlhbG9nLnVuc3Vic2NyaWJlKCk7XG4gICAgICAgICAgICAgICAgICAgIC8vIHJlc3BvbnNlcyBpbnRlbnRpb25hbGx5IGlnbm9yZWRcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIFN1YnNjcmlwdGlvbkRpYWxvZ1N0YXRlLlRlcm1pbmF0ZWQ6XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4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AgICAgICAgICAgICAgICAgICAgICAgdGhpcy5zdWJzY3JpYmUoKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgXCJwcm9iYXRpb25cIjpcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFwiZ2l2ZXVwXCI6XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuaW5pdFN1YnNjcmliZXJSZXF1ZXN0KCk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzdWJzY3JpcHRpb25TdGF0ZS5wYXJhbXMgJiYgc3Vic2NyaXB0aW9uU3RhdGUucGFyYW1zW1wicmV0cnktYWZ0ZXJcIl0pIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMucmV0cnlBZnRlclRpbWVyID0gc2V0VGltZW91dCgoKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5zdWJzY3JpYmUoKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHN1YnNjcmlwdGlvblN0YXRlLnBhcmFtc1tcInJldHJ5LWFmdGVyXCJdKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc3Vic2NyaWJlKCk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgXCJyZWplY3RlZFwiOlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgXCJub3Jlc291cmNlXCI6XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBcImludmFyaWFudFwiOlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB0aGlzLnVuc3Vic2NyaWJlKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxuICAgIC8qKiBAaW50ZXJuYWwgKi9cbiAgICBvblJlZnJlc2gocmVxdWVzdCkge1xuICAgICAgICByZXF1ZXN0LmRlbGVnYXRlID0ge1xuICAgICAgICAgICAgb25BY2NlcHQ6IChyZXNwb25zZSkgPT4gdGhpcy5vbkFjY2VwdGVkKHJlc3BvbnNlKVxuICAgICAgICB9O1xuICAgIH1cbiAgICBpbml0U3Vic2NyaWJlclJlcXVlc3QoKSB7XG4gICAgICAgIGNvbnN0IG9wdGlvbnMgPSB7XG4gICAgICAgICAgICBleHRyYUhlYWRlcnM6IHRoaXMuZXh0cmFIZWFkZXJzLFxuICAgICAgICAgICAgYm9keTogdGhpcy5ib2R5ID8gZnJvbUJvZHlMZWdhY3kodGhpcy5ib2R5KSA6IHVuZGVmaW5lZFxuICAgICAgICB9O1xuICAgICAgICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgQHR5cGVzY3JpcHQtZXNsaW50L25vLXVzZS1iZWZvcmUtZGVmaW5lXG4gICAgICAgIHRoaXMuc3Vic2NyaWJlclJlcXVlc3QgPSBuZXcgU3Vic2NyaWJlclJlcXVlc3QodGhpcy5fdXNlckFnZW50LnVzZXJBZ2VudENvcmUsIHRoaXMudGFyZ2V0VVJJLCB0aGlzLmV2ZW50LCB0aGlzLmV4cGlyZXMsIG9wdGlvbnMpO1xuICAgICAgICB0aGlzLnN1YnNjcmliZXJSZXF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KSA9PiB7XG4gICAgICAgICAgICAgICAgICAgIHJlc29sdmUoeyBmYWlsdXJlOiB7IHJlc3BvbnNlIH0gfSk7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICAvLyBUaGlzIFNVQlNDUklCRSByZXF1ZXN0IHdpbGwgYmUgY29uZmlybWVkIHdpdGggYSBmaW5hbCByZXNwb25zZS5cbiAgICAgICAgICAgICAgICAvLyBOb24tMjAwLWNsYXNzIGZpbmFsIHJlc3BvbnNlcyBpbmRpY2F0ZSB0aGF0IG5vIHN1YnNjcmlwdGlvbiBvciBuZXdcbiAgICAgICAgICAgICAgICAvLyBkaWFsb2cgdXNhZ2UgaGFzIGJlZW4gY3JlYXRlZCwgYW5kIG5vIHN1YnNlcXVlbnQgTk9USUZZIHJlcXVlc3Qgd2lsbFxuICAgICAgICAgICAgICAgIC8vIGJlIHNlbnQuXG4gICAgICAgICAgICAgICAgLy8gaHR0cHM6Ly90b29scy5pZXRmLm9yZy9odG1sL3JmYzY2NjUjc2VjdGlvbi00LjEuMi4xXG4gICAgICAgICAgICAgICAgb25SZWplY3Q6IChyZXNwb25zZSkgPT4ge1xuICAgICAgICAgICAgICAgICAgICByZXNvbHZlKHsgZmFpbHVyZTogeyByZXNwb25zZSB9IH0pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9KTtcbiAgICB9XG59XG4iLCIvKipcbiAqIHtAbGluayBTdWJzY3JpcHRpb259IHN0YXRlLlxuICogQHJlbWFya3NcbiAqIFRoZSB7QGxpbmsgU3Vic2NyaXB0aW9ufSBiZWhhdmVzIGluIGEgZGV0ZXJtaW5pc3RpYyBtYW5uZXIgYWNjb3JkaW5nIHRvIHRoZSBmb2xsb3dpbmdcbiAqIEZpbml0ZSBTdGF0ZSBNYWNoaW5lIChGU00pLlxuICogYGBgdHh0XG4gKiAgICAgICAgICAgICAgICAgICAgX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f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yaXB0aW9uU3RhdGUuSW5pdGlhbDpcbiAgICAgICAgICAgICAgICBpZiAobmV3U3RhdGUgIT09IFN1YnNjcmlwdGlvblN0YXRlLk5vdGlmeVdhaXQgJiYgbmV3U3RhdGUgIT09IFN1YnNjcmlwdGlvblN0YXRlLlRlcm1pbmF0ZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgaW52YWxpZFRyYW5zaXRpb24oKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIFN1YnNjcmlwdGlvblN0YXRlLk5vdGlmeVdhaXQ6XG4gICAgICAgICAgICAgICAgaWYgKG5ld1N0YXRlICE9PSBTdWJzY3JpcHRpb25TdGF0ZS5TdWJzY3JpYmVkICYmIG5ld1N0YXRlICE9PSBTdWJzY3JpcHRpb25TdGF0ZS5UZXJtaW5hdGVkKSB7XG4gICAgICAgICAgICAgICAgICAgIGludmFsaWRUcmFuc2l0aW9uKCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBTdWJzY3JpcHRpb25TdGF0ZS5TdWJzY3JpYmVkOlxuICAgICAgICAgICAgICAgIGlmIChuZXdTdGF0ZSAhPT0gU3Vic2NyaXB0aW9uU3RhdGUuVGVybWluYXRlZCkge1xuICAgICAgICAgICAgICAgICAgICBpbnZhbGlkVHJhbnNpdGlvbigpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgU3Vic2NyaXB0aW9uU3RhdGUuVGVybWluYXRlZDpcbiAgICAgICAgICAgICAgICBpbnZhbGlkVHJhbnNpdGlvbigpO1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJVbnJlY29nbml6ZWQgc3RhdGUuXCIpO1xuICA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iAqIENvbnN0cnVjdGVkIC0+IERpc2Nvbm5lY3RlZCAtPiBDb25uZWN0aW5nIC0+IENvbm5lY3RlZCAtPiBEaXNjb25uZWN0aW5nXG4gKiAgICAgICAgICAgICAgICAgICAgIF4gICAgICAgICAgICBeICAgIHxfX19fX19fX19fX19fX19fX19fX19eICB8ICB8XG4gKiAgICAgICAgICAgICAgICAgICAgIHwgICAgICAgICAgICB8X19fX19fX19fX19fX19fX19fX19fX19fX19fX198ICB8XG4gKiAgICAgICAgICAgICAgICAgICAgIHxfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX198XG4gKiBgYGBcbiAqIEBwdWJsaWNcbiAqL1xuZXhwb3J0IHZhciBUcmFuc3BvcnRTdGF0ZTtcbihmdW5jdGlvbiAoVHJhbnNwb3J0U3RhdGUpIHtcbiAgICAvKipcbiAgICAgKiBUaGUgYGNvbm5lY3QoKWAgbWV0aG9kIHdhcyBjYWxsZWQuXG4gICAgICovXG4gICAgVHJhbnNwb3J0U3RhdGVbXCJDb25uZWN0aW5nXCJdID0gXCJDb25uZWN0aW5nXCI7XG4gICAgLyoqXG4gICAgICogVGhlIGBjb25uZWN0KClgIG1ldGhvZCByZXNvbHZlZC5cbiAgICAgKi9cbiAgICBUcmFuc3BvcnRTdGF0ZVtcIkNvbm5lY3RlZFwiXSA9IFwiQ29ubmVjdGVkXCI7XG4gICAgLyoqXG4gICAgICogVGhlIGBkaXNjb25uZWN0KClgIG1ldGhvZCB3YXMgY2FsbGVkLlxuICAgICAqL1xuICAgIFRyYW5zcG9ydFN0YXRlW1wiRGlzY29ubmVjdGluZ1wiXSA9IFwiRGlzY29ubmVjdGluZ1wiO1xuICAgIC8qKlxuICAgICAqIFRoZSBgY29ubmVjdCgpYCBtZXRob2Qgd2FzIHJlamVjdGVkLCBvclxuICAgICAqIHRoZSBgZGlzY29ubmVjdCgpYCBtZXRob2QgY29tcGxldGVkLCBvclxuICAgICAqIG5ldHdvcmsgY29ubmVjd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9wdGlvbnMubG9nQ29ubmVjdG9yO1xuICAgICAgICBzd2l0Y2ggKHRoaXMub3B0aW9ucy5sb2dMZXZlbCkge1xuICAgICAgICAgICAgY2FzZSBcImVycm9yXCI6XG4gICAgICAgICAgICAgICAgdGhpcy5sb2dnZXJGYWN0b3J5LmxldmVsID0gTGV2ZWxzLmVycm9yO1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBcIndhcm5cIjpcbiAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlckZhY3RvcnkubGV2ZWwgPSBMZXZlbHMud2FybjtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgXCJsb2dcIjpcbiAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlckZhY3RvcnkubGV2ZWwgPSBMZXZlbHMubG9nO1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBcImRlYnVnXCI6XG4gICAgICAgICAgICAgICAgdGhpcy5sb2dnZXJGYWN0b3J5LmxldmVsID0gTGV2ZWxzLmRlYnVnO1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgfVxuICAgICAgICBpZiAodGhpcy5vcHRpb25zLmxvZ0NvbmZpZ3VyYXRpb24pIHtcbiAgICAgICAgICAgIHRoaXMubG9nZ2VyLmxvZyhcIkNvbmZpZ3VyYXRpb246XCIpO1xuICAgICAgICAgICAgT2JqZWN0LmtleXModGhpcy5vcHRpb25zKS5mb3JFYWNoKChrZXkpID0+IHtcbiAgICAgICAgICAgICAgICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgQHR5cGVzY3JpcHQtZXNsaW50L25vLWV4cGxpY2l0LWFueVxuICAgICAgICAgICAgICAgIGNvbnN0IHZhbHVlID0gdGhpcy5vcHRpb25zW2tleV07XG4gICAgICAgICAgICAgICAgc3dpdGNoIChrZXkpIHtcbiAgICAgICAgICAgICAgICAgICAgY2FzZSBcInVyaVwiOlxuICAgICAgICAgICAgICAgICAgICBjYXNlIFwic2Vzc2lvbkRlc2NyaXB0aW9uSGFuZGxlckZhY3RvcnlcIjpcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLmxvZyhcIsK3IFwiICsga2V5ICsgXCI6IFwiICsgdmFsdWUpO1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgXCJhdXRob3JpemF0aW9uUGFzc3dvcmRcIjpcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLmxvZyhcIsK3IFwiICsga2V5ICsgXCI6IFwiICsgXCJOT1QgU0hPV05cIik7XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgY2FzZSBcInRyYW5zcG9ydENvbnN0cnVjdG9yXCI6XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5sb2coXCLCtyBcIiArIGtleSArIFwiOiBcIiArIHZhbHVlLm5hbWUpO1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5sb2coXCLCtyBcIiArIGtleSArIFwiOiBcIiArIEpTT04uc3RyaW5naWZ5KHZhbHVlKSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgICAgLy8gZ3VhcmQgZGVwcmVjYXRlZCB0cmFuc3BvcnQgb3B0aW9ucyAocmVtb3ZlIHRoaXMgaW4gdmVyc2lvbiAxNi54KVxuICAgICAgICBpZiAodGhpcy5vcHRpb25zLnRyYW5zcG9ydE9wdGlvbnMpIHtcbiAgICAgICAgICAgIC8vIGVzbGludC1kaXNhYmxlLW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GhlIFJGQy5cbiAgICAgKiAyNSBBdWdtZW50ZWQgQk5GIGZvciB0aGUgU0lQIFByb3RvY29sXG4gICAgICogaHR0cHM6Ly90b29scy5pZXRmLm9yZy9odG1sL3JmYzMyNjEjc2VjdGlvbi0yNVxuICAgICAqXG4gICAgICogQGV4YW1wbGVcbiAgICAgKiBgYGB0c1xuICAgICAqIGNvbnN0IHVyaSA9IFVzZXJBZ2VudC5tYWtlVVJJKFwic2lwOmVkZ2FyQGV4YW1wbGUuY29tXCIpO1xuICAgICAqIGBgYFxuICAgICAqL1xuICAgIHN0YXRpYyBtYWtlVVJJKHVyaSkge1xuICAgICAgICByZXR1cm4gR3JhbW1hci5VUklQYXJzZSh1cmkpO1xuICAgIH1cbiAgICAvKiogRGVmYXVsdCB1c2VyIGFnZW50IG9wdGlvbnMuICovXG4gICAgc3RhdGljIGRlZmF1bHRPcHRpb25zKCkge1xuICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgYWxsb3dMZWdhY3lOb3RpZmljYXRpb25zOiBmYWxzZSxcbiAgICAgICAgICAgIGF1dGhvcml6YXRpb25IYTE6IFwiXCIsXG4gICAgICAgICAgICBhdXRob3JpemF0aW9uUGFzc3dvcmQ6IFwiXCIsXG4gICAgICAgICAgICBhdXRob3JpemF0aW9uVXNlcm5hbWU6IFwiXCIsXG4gICAgICAgICAgICBkZWxlZ2F0ZToge30sXG4gICAgICAgICAgICBjb250YWN0TmFtZTogXCJcIixcbiAgICAgICAgICAgIGNvbnRhY3RQYXJhbXM6IHsgdHJhbnNwb3J0OiBcIndzXCIgfSxcbiAgICAgICAgICAgIGRpc3BsYXlOYW1lOiBcIlwiLFxuICAgICAgICAgICAgZm9yY2VScG9ydDogZmFsc2UsXG4gICAgICAgICAgICBncmFjZWZ1bFNodXRkb3duOiB0cnVlLFxuICAgICAgICAgICAgaGFja0FsbG93VW5yZWdpc3RlcmVkT3B0aW9uVGFnczogZmFsc2UsXG4gICAgICAgICAgICBoYWNrSXBJbkNv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1R5cGVTY3JpcHQvaXNzdWVzLzEzMTk1XG4gICAgICogQHBhcmFtIG9wdGlvbnMgLSBPcHRpb25zIHRvIHJlZHVjZVxuICAgICAqL1xuICAgIHN0YXRpYyBzdHJpcFVuZGVmaW5lZFByb3BlcnRpZXMob3B0aW9ucykge1xuICAgICAgICByZXR1cm4gT2JqZWN0LmtleXMob3B0aW9ucykucmVkdWNlKChvYmplY3QsIGtleSkgPT4ge1xuICAgICAgICAgICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIEB0eXBlc2NyaXB0LWVzbGludC9uby1leHBsaWNpdC1hbnlcbiAgICAgICAgICAgIGlmIChvcHRpb25zW2tleV0gIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBAdHlwZXNjcmlwdC1lc2xpbnQvbm8tZXhwbGljaXQtYW55XG4gICAgICAgICAgICAgICAgb2JqZWN0W2tleV0gPSBvcHRpb25zW2tleV07XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gb2JqZWN0O1xuICAgICAgICB9LCB7fSk7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIFVzZXIgYWdlbnQgY29uZmlndXJhdGlvbi5cbiAgICAgKi9cbiAgICBnZXQgY29uZmlndXJhdGlvbigpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMub3B0aW9ucztcbiAgICB9XG4gICAgLyoqXG4gICAgICogVXNlciBhZ2VudCBjb250YWN0LlxuICAgICAqL1xuICAgIGdldCBjb250YWN0KCkge1xuICAgICAgICByZXR1cm4gdGhpcy5fY29udGFjdDtcbiAgICB9XG4gICAgLyoqXG4gICAgICogVXNlciBhZ2VudCBpbnN0YW5jZSBpZC5cbiAgICAgKi9cbiAgICBnZXQgaW5zdGFuY2VJZCgpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMuX2luc3RhbmNlSWQ7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIFVzZXIg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gIHRoaXMubG9nZ2VyLmVycm9yKGVycm9yLm1lc3NhZ2UpO1xuICAgICAgICAgICAgICAgICAgICBkZWxldGUgdGhpcy5fc2Vzc2lvbnNbaWRdO1xuICAgICAgICAgICAgICAgICAgICB0aHJvdyBlcnJvcjtcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICAvLyBEaXNwb3NlIG9mIFN1YnNjcmlwdGlvbnNcbiAgICAgICAgdGhpcy5sb2dnZXIubG9nKGBEaXNwb3NlIG9mIHN1YnNjcmlwdGlvbnNgKTtcbiAgICAgICAgZm9yIChjb25zdCBpZCBpbiBzdWJzY3JpcHRpb25zKSB7XG4gICAgICAgICAgICBpZiAoc3Vic2NyaXB0aW9uc1tpZF0pIHtcbiAgICAgICAgICAgICAgICBhd2FpdCBzdWJzY3JpcHRpb25zW2lkXS5kaXNwb3NlKCkuY2F0Y2goKGVycm9yKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLmVycm9yKGVycm9yLm1lc3NhZ2UpO1xuICAgICAgICAgICAgICAgICAgICBkZWxldGUgdGhpcy5fc3Vic2NyaXB0aW9uc1tpZF07XG4gICAgICAgICAgICAgICAgICAgIHRocm93IGVycm9yO1xuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIC8vIERpc3Bvc2Ugb2YgUHVibGlzaGVyc1xuICAgICAgICB0aGlzLmxvZ2dlci5sb2coYERpc3Bvc2Ugb2YgcHVibGlzaGVyc2ApO1xuICAgICAgICBmb3IgKGNvbnN0IGlkIGluIHB1Ymxpc2hlcnMpIHtcbiAgICAgICAgICAgIGlmIChwdWJsaXNoZXJzW2lkXSkge1xuICAgICAgICAgICAgICAgIGF3YWl0IHB1Ymxpc2hlcnNbaWRdLmRpc3Bvc2UoKS5jYXRjaCgoZXJyb3IpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5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jaCgoZXJyb3IpID0+IHtcbiAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5lcnJvcihlcnJvci5tZXNzYWdlKTtcbiAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5sb2coYFJlY29ubmVjdGlvbiBhdHRlbXB0ICR7cmVjb25uZWN0aW9uQXR0ZW1wdH0gb2YgJHtyZWNvbm5lY3Rpb25BdHRlbXB0c30gLSBmYWlsZWRgKTtcbiAgICAgICAgICAgICAgICB0aGlzLmF0dGVtcHRSZWNvbm5lY3Rpb24oKytyZWNvbm5lY3Rpb25BdHRlbXB0KTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9LCByZWNvbm5lY3Rpb25BdHRlbXB0ID09PSAxID8gMCA6IHJlY29ubmVjdGlvbkRlbGF5ICogMTAwMCk7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIEluaXRpYWxpemUgY29udGFjdC5cbiAgICAgKi9cbiAgICBpbml0Q29udGFjdCgpIHtcbiAgICAgICAgY29uc3QgY29udGFjdE5hbWUgPSB0aGlzLm9wdGlvbnMuY29udGFjdE5hbWUgIT09IFwiXCIgPyB0aGlzLm9wdGlvbnMuY29udGFjdE5hbWUgOiBjcmVhdGVSYW5kb21Ub2tlbig4KTtcbiAgICAgICAgY29uc3QgY29udGFjdFBhcmFtcyA9IHRoaXMub3B0aW9ucy5jb250YWN0UGFyYW1zO1xuICAgICAgICBjb25zdCBjb250YWN0ID0ge1xuICAgICAgICAgICAgcHViR3J1dTogdW5kZWZpbmVkLFxuICAgICAgICAgICAgdGVtcEdydXU6IHVuZGVmaW5lZCxcbiAgICAgICAgICAgIHVyaTogbmV3IFVSSShcInNpcFwiLCBjb250YWN0TmFtZSwgdGhpcy5vcHRpb25zLnZpYUhvc3QsIHVuZGVmaW5lZCwgY29udGFjdFBhcmFtcyksXG4gICAgICAgICAgICB0b1N0cmluZzogKGNvbnRhY3RUb1N0cmluZ09wdGlvbnMgPSB7fSkgPT4ge1xuICAgICAgICAgICAgICAgIGNvbnN0IGFub255bW91cyA9IGNvbnRhY3RUb1N0cmluZ09wdGlvbnMuYW5vbnltb3VzIHx8IGZhbHNlO1xuICAgICAgICAgICAgICAgIGNvbnN0IG91dGJvdW5kID0gY29udGFjdFRvU3RyaW5nT3B0aW9ucy5vdXRib3VuZCB8fCBmYWxzZTtcbiAgICAgICAgICAgICAgICBjb25zdCByZWdpc3RlciA9IGNvbnRhY3RUb1N0cmluZ09wdGlvbnMucmVnaXN0ZXIgfHwgZmFsc2U7XG4gICAgICAgICAgICAgICAgbGV0IGNvbnRhY3RTdHJpbmcgPSBcIjxcIjtcbiAgICAgICAgICAgICAgICAvLyAzLjMuICBVc2luZyBhIEdSVVVcbiAgICAgICAgICAgICAgICAvLyBPbmNlIGEgdXNlciBhZ2VudCBvYnRhaW5zIEdSVVVzIGZyb20gdGhlIHJlZ2lzdHJhciwgaXQgdXNlcyB0aGVtIGluXG4gICAgICAgICAgICAgICAgLy8gc2V2ZXJhbCB3YXlzLiAgRmlyc3QsIGl0IHVzZXMgdGhlbSBhcyB0aGUgY29udGVudHMgb2YgdGhlIENvbnRhY3RcbiAgICAgICAgICAgICAgICAvLyBoZWFkZXIgZmllbGQgaW4gbm9uLVJFR0lTVEVSIHJlcXVlc3RzIGFuZCByZXNwb25zZXMgdGhhdCBpdCBlbWl0c1xuICAgICAgICAgICAgICAgIC8vIChmb3IgZXhhbXBsZSwgYW4gSU5WSVRFIHJlcXVlc3QgYW5kIDIwMCBPSyByZXNwb25zZSkuXG4gICAgICAgICAgICAgICAgLy8gaHR0cHM6Ly9kYXRhdHJhY2tlci5pZXRmLm9yZy9kb2MvaHRtbC9yZmM1NjI3I3NlY3Rpb24tMy4zXG4gICAgICAgICAgICAgICAgaWYgKGFub255bW91cykge1xuICAgICAgICAgICAgICAgICAgICBjb250YWN0U3RyaW5nICs9XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmNvbnRhY3QudGVtcEdydXUgfHxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBgc2lwOmFub255bW91c0Bhbm9ueW1vdXMuaW52YWxpZDt0cmFuc3BvcnQ9JHtjb250YWN0UGFyYW1zLnRyYW5zcG9ydCA/IGNvbnRhY3RQYXJhbXMudHJhbnNwb3J0IDogXCJ3c1wifWA7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGVsc2UgaWYgKHJlZ2lzdGVyKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnRhY3RTdHJpbmcgKz0gdGhpcy5jb250YWN0LnVyaTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnRhY3RTdHJpbmcgKz0gdGhpcy5jb250YWN0LnB1YkdydXUgfHwgdGhpcy5jb250YWN0LnVyaTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKG91dGJvdW5kKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnRhY3RTdHJpbmcgKz0gXCI7b2JcIjtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgY29udGFjdFN0cmluZyArPSBcIj5cIjtcbiAgICAgICAgICAgICAgICBpZiAodGhpcy5vcHRpb25zLmluc3RhbmNlSWRBbHdheXNBZGRlZCkge1xuICAgICAgICAgICAgICAgICAgICBjb250YWN0U3RyaW5nICs9ICc7K3NpcC5pbnN0YW5jZT1cIjx1cm46dXVpZDonICsgdGhpcy5faW5zdGFuY2VJZCArICc+XCInO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICByZXR1cm4gY29udGFjdFN0cmluZztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfTtcbiAgICAgICAgcmV0dXJuIGNvbnRhY3Q7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIEluaXRpYWxpemUgdXNlciBhZ2VudCBjb3JlLlxuICAgICAqL1xuICAgIGluaXRDb3JlKCkge1xuICAgICAgICAvLyBzdXBwb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XNlckFnZW50Q29yZURlbGVnYXRlID0ge1xuICAgICAgICAgICAgb25JbnZpdGU6IChpbmNvbWluZ0ludml0ZVJlcXVlc3QpID0+IHtcbiAgICAgICAgICAgICAgICB2YXIgX2E7XG4gICAgICAgICAgICAgICAgY29uc3QgaW52aXRhdGlvbiA9IG5ldyBJbnZpdGF0aW9uKHRoaXMsIGluY29taW5nSW52aXRlUmVxdWVzdCk7XG4gICAgICAgICAgICAgICAgaW5jb21pbmdJbnZpdGVSZXF1ZXN0LmRlbGVnYXRlID0ge1xuICAgICAgICAgICAgICAgICAgICBvbkNhbmNlbDogKGNhbmNlbCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgaW52aXRhdGlvbi5fb25DYW5jZWwoY2FuY2VsKTtcbiAgICAgICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICAgICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIEB0eXBlc2NyaXB0LWVzbGludC9uby11bnVzZWQtdmFyc1xuICAgICAgICAgICAgICAgICAgICBvblRyYW5zcG9ydEVycm9yOiAoZXJyb3IpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIEEgc2VydmVyIHRyYW5zYWN0aW9uIE1VU1QgTk9UIGRpc2NhcmQgdHJhbnNhY3Rpb24gc3RhdGUgYmFzZWQgb25seSBvblxuICAgICAgICAgICAgICAgICAgICAgICAgLy8gZW5jb3VudGVyaW5nIGEgbm9uLXJlY292ZXJhYmxlIHRyYW5zcG9ydCBlcnJvciB3aGVuIHNlbmRpbmcgYVxuICAgICAgICAgICAgICAgICAgICAgICAgLy8gcmVzcG9uc2UuICBJbnN0ZWFkLCB0aGUgYXNzb2NpYXRlZCBJTlZJVEUgc2VydmVyIHRyYW5zYWN0aW9uIHN0YXRlXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBtYWNoaW5lIE1VU1QgcmVtYWluIGluIGl0cyBjdXJyZW50IHN0YXRlLiAgKFRpbWVycyB3aWxsI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uc2lvbi5VbnN1cHBvcnRlZCkge1xuICAgICAgICAgICAgICAgICAgICBjb25zdCBtZXNzYWdlID0gaW5jb21pbmdJbnZpdGVSZXF1ZXN0Lm1lc3NhZ2U7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHJlcGxhY2VzID0gbWVzc2FnZS5wYXJzZUhlYWRlcihcInJlcGxhY2VzXCIpO1xuICAgICAgICAgICAgICAgICAgICBpZiAocmVwbGFjZXMpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGNhbGxJZCA9IHJlcGxhY2VzLmNhbGxfaWQ7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAodHlwZW9mIGNhbGxJZCAhPT0gXCJzdHJpbmdcIikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcIlR5cGUgb2YgY2FsbCBpZCBpcyBub3Qgc3RyaW5nXCIpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgdG9UYWcgPSByZXBsYWNlcy5yZXBsYWNlc190b190YWc7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAodHlwZW9mIHRvVGFnICE9PSBcInN0cmluZ1wiKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwiVHlwZSBvZiB0byB0YWcgaXMgbm90IHN0cmluZ1wiKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGZyb21UYWcgPSByZXBsYWNlcy5yZXBsYWNlc19mcm9tX3RhZztcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgZnJvbVRhZyAhPT0gXCJzdHJpbmdcIikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcInR5cGUgb2YgZnJvbSB0YWcgaXMgbm90IHN0cmluZ1wiKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHRhcmdldERpYWxvZ0lkID0gY2FsbElkICsgdG9UYWcgKyBmcm9tVGFnO1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgdGFyZ2V0RGlhbG9nID0gdGhpcy51c2VyQWdlbnRDb3JlLmRpYWxvZ3MuZ2V0KHRhcmdldERpYWxvZ0lkKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIElmIG5vIG1hdGNoIGlzIGZvdW5kLCB0aGUgVUFTIHJlamVjdHMgdGhlIElOVklURSBhbmQgcmV0dXJucyBhIDQ4MVxuICAgICAgICAgICAgICAgICAgICAgICAgLy8gQ2FsbC9UcmFuc2FjdGlvbiBEb2VzIE5vdCBFeGlzdCByZXNwb25zZS4gIExpa2V3aXNlLCBpZiB0aGUgUmVwbGFjZXNcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIGhlYWRlciBmaWVsZCBtYXRjaGVzIGEgZGlhbG9nIHdoaWNoIHdhcyBub3QgY3JlYXRlZCB3aXRoIGFuIElOVklURSxcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIHRoZSBVQVMgTVVTVCByZWplY3QgdGhlIHJlcXVlc3Qgd2l0aCBhIDQ4MSByZXNwb25zZS5cbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIGh0dHBzOi8vdG9vbHMuaWV0Zi5vcmcvaHRtbC9yZmMzODkxI3NlY3Rpb24tM1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF0YXJnZXREaWFsb2cpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnZpdGF0aW9uLnJlamVjdCh7IHN0YXR1c0NvZGU6IDQ4MSB9KTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBJZiB0aGUgUmVwbGFjZXMgaGVhZGVyIGZpZWxkIG1hdGNoZXMgYSBjb25maXJtZWQgZGlhbG9nLCBpdCBjaGVja3NcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIGZvciB0aGUgcHJlc2VuY2Ugb2YgdGhlIFwiZWFybHktb25seVwiIGZsYWcgaW4gdGhlIFJlcGxhY2VzIGhlYWRlclxuICAgICAgICAgICAgICAgICAgICAgICAgLy8gZmllbGQuICAoVGhpcyBmbGFnIGFsbG93cyB0aGUgVUFDIHRvIHByZXZlbnQgYSBwb3RlbnRpYWxseVxuICAgICAgICAgICAgICAgICAgICAgICAgLy8gdW5kZXNpcmFibGUgcmFjZSBjb25kaXRpb24gZGVzY3JpYmVkIGluIFNlY3Rpb24gNy4xLikgSWYgdGhlIGZsYWcgaXNcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIHByZXNlbnQsIHRoZSBVQSByZWplY3RzIHRoZSByZXF1ZXN0IHdpdGggYSA0ODYgQnVzeSByZXNwb25zZS5cbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIGh0dHBzOi8vdG9vbHMuaWV0Zi5vcmcvaHRtbC9yZmMzODkxI3NlY3Rpb24tM1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF0YXJnZXREaWFsb2cuZWFybHkgJiYgcmVwbGFjZXMuZWFybHlfb25seSA9PT0gdHJ1ZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludml0YXRpb24ucmVqZWN0KHsgc3RhdHVzQ29kZTogNDg2IH0pO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIFByb3ZpZGUgYSBoYW5kbGUgb24gdGhlIHNlc3Npb24gYmVpbmcgcmVwbGFjZWQuXG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCB0YXJnZXRTZXNzaW9uID0gdGhpcy5fc2Vzc2lvbnNbY2FsbElkICsgZnJvbVRhZ10gfHwgdGhpcy5fc2Vzc2lvbnNbY2FsbElkICsgdG9UYWddIHx8IHVuZGVmaW5lZDtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghdGFyZ2V0U2Vzc2lvbikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcIlNlc3Npb24gZG9lcyBub3QgZXhpc3QuXCIpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgaW52aXRhdGlvbi5fcmVwbGFjZWUgPSB0YXJnZXRTZXNzaW9uO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIC8vIERlbGVnYXRlIGludml0YXRpb24gaGFuZGxpbmcuXG4gICAgICAgICAgICAgICAgaWYgKChfYSA9IHRoaXMuZGVsZWdhdGUpID09PSBudWxsIHx8IF9hID09PSB2b2lkIDAgPyB2b2lkIDAgOiBfYS5vbkludml0ZSkge1xuICAgICAgICAgICAgICAgICAgICBpZiAoaW52aXRhdGlvbi5hdXRvU2VuZEFuSW5pdGlhbFByb3Zpc2lvbmFsUmVzcG9uc2UpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGludml0YXRpb24ucHJvZ3Jlc3MoKS50aGVuKCgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgX2E7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCgoX2EgPSB0aGlzLmRlbGVnYXRlKSA9PT0gbnVsbCB8fCBfYSA9PT0gdm9pZCAwID8gdm9pZCAwIDogX2Eub25JbnZpdGUpID09PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwib25JbnZpdGUgdW5kZWZpbmVkLlwiKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5kZWxlZ2F0ZS5vbkludml0ZShpbnZpdGF0aW9uKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZGVsZWdhdGUub25JbnZpdGUoaW52aXRhdGlvbik7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgLy8gQSBjb21tb24gc2NlbmFyaW8gb2NjdXJzIHdoZW4gdGhlIGNhbGxlZSBpcyBjdXJyZW50bHkgbm90IHdpbGxpbmcgb3JcbiAgICAgICAgICAgICAgICAvLyBhYmxlIHRvIHRha2UgYWRkaXRpb25hbCBjYWxscyBhdCB0aGlzIGVuZCBzeXN0ZW0uICBBIDQ4NiAoQnVzeSBIZXJlKVxuICAgICAgICAgICAgICAgIC8vIFNIT1VMRCBiZSByZXR1cm5lZCBpbiBzdWNoIGEgc2NlbmFyaW8uXG4gICAgICAgICAgICAgICAgLy8gaHR0cHM6Ly90b29scy5pZXRmLm9yZy9odG1sL3JmYzMyNjEjc2VjdGlvbi0xMy4zLjEuM1xuICAgICAgICAgICAgICAgIGludml0YXRpb24ucmVqZWN0KHsgc3RhdHVzQ29kZTogNDg2IH0pO1xuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIG9uTWVzc2FnZTogKGluY29taW5nTWVzc2FnZVJlcXVlc3QpID0+IHtcbiAgICAgICAgICAgICAgICBpZiAodGhpcy5kZWxlZ2F0ZSAmJiB0aGlzLmRlbGVnYXRlLm9uTWVzc2FnZSkge1xuICAgICAgICAgICAgICAgICAgICBjb25zdCBtZXNzYWdlID0gbmV3IE1lc3NhZ2UoaW5jb21pbmdNZXNzYWdlUmVxdWVzdCk7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZGVsZWdhdGUub25NZXNzYWdlKG1lc3NhZ2UpO1xuICA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AgICAgICAgICAgICAgICAvLyBodHRwczovL3Rvb2xzLmlldGYub3JnL2h0bWwvcmZjNjY2NSNzZWN0aW9uLTMuMlxuICAgICAgICAgICAgICAgIGlmICh0aGlzLmRlbGVnYXRlICYmIHRoaXMuZGVsZWdhdGUub25Ob3RpZnkpIHtcbiAgICAgICAgICAgICAgICAgICAgY29uc3Qgbm90aWZpY2F0aW9uID0gbmV3IE5vdGlmaWNhdGlvbihpbmNvbWluZ05vdGlmeVJlcXVlc3QpO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmRlbGVnYXRlLm9uTm90aWZ5KG5vdGlmaWNhdGlvbik7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAvLyBQZXIgdGhlIGFib3ZlIHdoaWNoIG9ic29sZXRlcyBodHRwczovL3Rvb2xzLmlldGYub3JnL2h0bWwvcmZjMzI2NSxcbiAgICAgICAgICAgICAgICAgICAgLy8gdGhlIHVzZSBvZiBvdXQgb2YgZGlhbG9nIE5PVElGWSBpcyBvYnNvbGV0ZSwgYnV0Li4uXG4gICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLm9wdGlvbnMuYWxsb3dMZWdhY3lOb3RpZmljYXRpb25zKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBpbmNvbWluZ05vdGlmeVJlcXVlc3QuYWNjZXB0KCk7IC8vIEFjY2VwdCB0aGUgTk9USUZZIHJlcXVlc3QsIGJ1dCBkbyBub3RoaW5nIHdpdGggaXQuXG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBpbmNvbWluZ05vdGlmeVJlcXVlc3QucmVqZWN0KHsgc3RhdHVzQ29kZTogNDgxIH0pO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIG9uUmV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gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIGluY29taW5nUmVnaXN0ZXJSZXF1ZXN0LnJlamVjdCh7IHN0YXR1c0NvZGU6IDQwNSB9KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgb25TdWJzY3JpYmU6IChpbmNvbWluZ1N1YnNjcmliZVJlcXVlc3QpID0+IHtcbiAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci53YXJuKFwiUmVjZWl2ZWQgYW4gb3V0IG9mIGRpYWxvZyBTVUJTQ1JJQkUgcmVxdWVzdFwiKTtcbiAgICAgICAgICAgICAgICAvLyBUT09EOiB0aGlzLmRlbGVnYXRlLm9uU3Vic2NyaWJlKC4uLilcbiAgICAgICAgICAgICAgICBpZiAodGhpcy5kZWxlZ2F0ZSAmJiB0aGlzLmRlbGVnYXRlLm9uU3Vic2NyaWJlUmVxdWVzdCkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmRlbGVnYXRlLm9uU3Vic2NyaWJlUmVxdWVzdChpbmNvbWluZ1N1YnNjcmliZVJlcXVlc3QpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgaW5jb21pbmdTdWJzY3JpYmVSZXF1ZXN0LnJlamVjdCh7IHN0YXR1c0NvZGU6IDQwNSB9KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH07XG4gICAgICAgIHJldHVybiBuZXcgVXNlckFnZW50Q29yZSh1c2VyQWdlbnRDb3JlQ29uZmlndXJhdGlvbiwgdXNlckFnZW50Q29yZURlbGVnYXRlKTtcbiAgICB9XG4gICAgaW5pdFRyYW5zcG9ydENhbGxiYWNrcygpIHtcbiAgICAgICAgdGhpcy50cmFuc3BvcnQub25Db25uZWN0ID0gKCkgPT4gdGhpcy5vblRyYW5zcG9ydENvbm5lY3QoKTtcbiAgICAgICAgdGhpcy50cmF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IZWFkZXJzID0gKCkgPT4ge1xuICAgICAgICAgICAgY29uc3QgbWFuZGF0b3J5SGVhZGVycyA9IFtcImZyb21cIiwgXCJ0b1wiLCBcImNhbGxfaWRcIiwgXCJjc2VxXCIsIFwidmlhXCJdO1xuICAgICAgICAgICAgZm9yIChjb25zdCBoZWFkZXIgb2YgbWFuZGF0b3J5SGVhZGVycykge1xuICAgICAgICAgICAgICAgIGlmICghbWVzc2FnZS5oYXNIZWFkZXIoaGVhZGVyKSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci53YXJuKGBNaXNzaW5nIG1hbmRhdG9yeSBoZWFkZXIgZmllbGQgOiAke2hlYWRlcn0uYCk7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gdHJ1ZTtcbiAgICAgICAgfTtcbiAgICAgICAgLy8gUmVxdWVzdCBDaGVja3NcbiAgICAgICAgaWYgKG1lc3NhZ2UgaW5zdGFuY2VvZiBJbmNvbWluZ1JlcXVlc3RNZXNzYWdlKSB7XG4gICAgICAgICAgICAvLyBUaGlzIGlzIHBvcnQgb2YgU2FuaXR5Q2hlY2subWluaW11bUhlYWRlcnMoKS5cbiAgICAgICAgICAgIGlmICghaGFzTWluaW11bUhlYWRlcnMoKSkge1xuICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLndhcm4oYFJlcXVlc3QgbWlzc2luZyBtYW5kYXRvcnkgaGVhZGVyIGZpZWxkLiBEcm9wcGluZy5gKTtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICAvLyBGSVhNRTogVGhpcyBpcyBub24tc3RhbmRhcmQgYW5kIHNob3VsZCBiZSBhIGNvbmZpZ3VyYWJsZSBiZWhhdmlvciAoZGVzaXJhYmxlIHJlZ2FyZGxlc3MpLlxuICAgICAgICAgICAgLy8gQ3VzdG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hwZWN0ZWQgJHttZXNzYWdlLm1ldGhvZH0gcmVxdWVzdCwgZHJvcHBpbmcuYCk7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgLy8gVXBkYXRlIGJlZm9yZSB0aGUgZGVsZWdhdGUgaGFzIGEgY2hhbmNlIHRvIGhhbmRsZSB0aGVcbiAgICAgICAgICAgICAgICAvLyBtZXNzYWdlIGFzIGRlbGVnYXRlIG1heSBjYWxsYmFjayBpbnRvIHRoaXMgZGlhbG9nLlxuICAgICAgICAgICAgICAgIHRoaXMuYWNrV2FpdCA9IGZhbHNlO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgaWYgKCF0aGlzLnJlaW52aXRlVXNlckFnZW50U2VydmVyKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLndhcm4oYElOVklURSBkaWFsb2cgJHt0aGlzLmlkfSByZWNlaXZlZCB1bmV4cGVjdGVkICR7bWVzc2FnZS5tZXRob2R9IHJlcXVlc3QsIGRyb3BwaW5nLmApO1xuICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmICh0aGlzLnJlaW52aXRlVXNlckFnZW50U2VydmVyLnRyYW5zYWN0aW9uLnJlcXVlc3QuY3NlcSAhPT0gbWVzc2FnZS5jc2VxKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLndhcm4oYElOVklURSBkaWFsb2cgJHt0aGlzLmlkfSByZWNlaXZlZCB1bmV4cGVjdGVkICR7bWVzc2FnZS5tZXRob2R9IHJlcXVlc3QsIGRyb3BwaW5nLmApO1xuICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHRoaXMucmVpbnZpdGVVc2VyQWdlbnRTZXJ2ZXIgPSB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WdlIHRoYXRcbiAgICAgICAgICAgICAgICAvLyB0aGUgVUEgaGFzIG5vdCBpbmRpY2F0ZWQgd2lsbGluZ25lc3MgdG8gcmVjZWl2ZSwgdGhlIFVBIE1VU1Qgc2VuZCBhXG4gICAgICAgICAgICAgICAgLy8gNDY5IChCYWQgSW5mbyBQYWNrYWdlKSByZXNwb25zZSAoc2VlIFNlY3Rpb24gMTEuNiksIHdoaWNoIGNvbnRhaW5zIGFcbiAgICAgICAgICAgICAgICAvLyBSZWN2LUluZm8gaGVhZGVyIGZpZWxkIHdpdGggSW5mbyBQYWNrYWdlcyBmb3Igd2hpY2ggdGhlIFVBIGlzIHdpbGxpbmdcbiAgICAgICAgICAgICAgICAvLyB0byByZWNlaXZlIElORk8gcmVxdWVzdHMuXG4gICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICBjb25zdCB1YXMgPSBuZXcgSW5mb1VzZXJBZ2VudFNlcnZlcih0aGlzLCBtZXNzYWdlKTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5kZWxlZ2F0ZSAmJiB0aGlzLmRlbGVnYXRlLm9uSW5mb1xuICAgICAgICAgICAgICAgICAgICAgICAgPyB0aGlzLmRlbGVnYXRlLm9uSW5mbyh1YXMpXG4gICAgICAgICAgICAgICAgICAgICAgICA6IHVhcy5yZWplY3Qoe1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXR1c0NvZGU6IDQ2OSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBleHRyYUhlYWRlcnM6IFtcIlJlY3YtSW5mbzpcIl1cbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgQy5JTlZJVEU6XG4gICAgICAgICAgICAgICAgLy8gSWYgdGhlIG5ldyBzZXNzaW9uIGRlc2NyaXB0aW9uIGlzIG5vdCBhY2NlcHRhYmxlLCB0aGUgVUFTI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oKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIEMuTk9USUZZOlxuICAgICAgICAgICAgICAgIC8vIGh0dHBzOi8vdG9vbHMuaWV0Zi5vcmcvaHRtbC9yZmMzNTE1I3NlY3Rpb24tMi40LjRcbiAgICAgICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHVhcyA9IG5ldyBOb3RpZnlVc2VyQWdlbnRTZXJ2ZXIodGhpcywgbWVzc2FnZSk7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZGVsZWdhdGUgJiYgdGhpcy5kZWxlZ2F0ZS5vbk5vdGlmeSA/IHRoaXMuZGVsZWdhdGUub25Ob3RpZnkodWFzKSA6IHVhcy5hY2NlcHQoKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIEMuUFJBQ0s6XG4gICAgICAgICAgICAgICAgLy8gaHR0cHM6Ly90b29scy5pZXRmLm9yZy9odG1sL3JmYzMyNjIjc2VjdGlvbi00XG4gICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICBjb25zdCB1YXMgPSBuZXcgUHJhY2tVc2VyQWdlbnRTZXJ2ZXIodGhpcywgbWVzc2FnZSk7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZGVsZWdhdGUgJiYgdGhpcy5kZWxlZ2F0ZS5vblByYWNrID8gdGhpcy5kZWxlZ2F0ZS5vblByYWNrKHVhcykgOiB1YXMuYWNjZXB0KCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBDLlJFRkVSOlxuICAgICAgICAgICAgICAgIC8vIGh0dHBzOi8vdG9vbHMuaWV0Zi5vcmcvaHRtbC9yZmMzNTE1I3NlY3Rpb24tMi40LjJcbiAgICAgICAgICAgICAgICB7XG4gICAgICAgICA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aWduYWxpbmdTdGF0ZSkge1xuICAgICAgICAgICAgICAgIGNhc2UgU2lnbmFsaW5nU3RhdGUuSW5pdGlhbDpcbiAgICAgICAgICAgICAgICBjYXNlIFNpZ25hbGluZ1N0YXRlLlN0YWJsZTpcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5fc2lnbmFsaW5nU3RhdGUgPSBTaWduYWxpbmdTdGF0ZS5IYXZlUmVtb3RlT2ZmZXI7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuX29mZmVyID0gYm9keTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5fYW5zd2VyID0gdW5kZWZpbmVkO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIFNpZ25hbGluZ1N0YXRlLkhhdmVMb2NhbE9mZmVyOlxuICAgICAgICAgICAgICAgICAgICB0aGlzLl9zaWduYWxpbmdTdGF0ZSA9IFNpZ25hbGluZ1N0YXRlLlN0YWJsZTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5fYW5zd2VyID0gYm9keTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSBTaWduYWxpbmdTdGF0ZS5IYXZlUmVtb3RlT2ZmZXI6XG4gICAgICAgICAgICAgICAgICAgIC8vIFlvdSBjYW5ub3QgbWFrZSBhIG5ldyBvZmZlciB3aGlsZSBvbmUgaXMgaW4gcHJvZ3Jlc3MuXG4gICAgICAgICAgICAgICAgICAgIC8vIGh0dHBzOi8vdG9vbHMuaWV0Zi5vcmcvaHRtbC9yZmMzMjYxI3NlY3Rpb24tMTMuMi4xXG4gICAgICAgICAgICAgICAgICAgIC8vIEZJWE1FOiBXaGF0IHRvIGRvIGhlcmU/XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgU2lnbmFsaW5nU3RhdGUuQ2xvc2VkOlxuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJVbmV4cGVjdGVkIHNpZ25hbGluZyBzdGF0ZS5cIik7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgLy8gV2UncmUgaW4gVUFDIHJvbGUsIHJlY2VpdmluZyBpbmNvbWluZyByZXNwb25zZSB3aXRoIHNlc3Npb24gZGVzY3JpcHRpb25cbiAgICAgICAgaWYgKG1lc3NhZ2UgaW5zdGFuY2VvZiBJbmNvbWluZ1Jlc3BvbnNlTWVzc2FnZSkge1xuICAgICAgICAgICAgc3dpdGNoICh0aGlzLl9zaWduYWxpbmdTdGF0ZSkge1xuICAgICAgICAgICAgICAgIGNhc2UgU2lnbmFsaW5nU3RhdGUuSW5pdGlhbDpcbiAgICAgICAgICAgICAgICBjYXNlIFNpZ25hbGluZ1N0YXRlLlN0YWJsZTpcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5fc2lnbmFsaW5nU3RhdGUgPSBTaWduYWxpbmdTdGF0ZS5IYXZlUmVtb3RlT2ZmZXI7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuX29mZmVyID0gYm9keTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5fYW5zd2VyID0gdW5kZWZpbmVkO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIFNpZ25hbGluZ1N0YXRlLkhhdmVMb2NhbE9mZmVyOlxuICAgICAgICAgICAgICAgICAgICB0aGlzLl9zaWduYWxpbmdTdGF0ZSA9IFNpZ25hbGluZ1N0YXRlLlN0YWJsZTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5fYW5zd2VyID0gYm9keTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSBTaWduYWxpbmdTdGF0ZS5IYXZlUmVtb3RlT2ZmZXI6XG4gICAgICAgICAgICA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ciA9IHVuZGVmaW5lZDtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSBTaWduYWxpbmdTdGF0ZS5IYXZlTG9jYWxPZmZlcjpcbiAgICAgICAgICAgICAgICAgICAgLy8gWW91IGNhbm5vdCBtYWtlIGEgbmV3IG9mZmVyIHdoaWxlIG9uZSBpcyBpbiBwcm9ncmVzcy5cbiAgICAgICAgICAgICAgICAgICAgLy8gaHR0cHM6Ly90b29scy5pZXRmLm9yZy9odG1sL3JmYzMyNjEjc2VjdGlvbi0xMy4yLjFcbiAgICAgICAgICAgICAgICAgICAgLy8gRklYTUU6IFdoYXQgdG8gZG8gaGVyZT9cbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSBTaWduYWxpbmdTdGF0ZS5IYXZlUmVtb3RlT2ZmZXI6XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuX3NpZ25hbGluZ1N0YXRlID0gU2lnbmFsaW5nU3RhdGUuU3RhYmxlO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLl9hbnN3ZXIgPSBib2R5O1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIFNpZ25hbGluZ1N0YXRlLkNsb3NlZDpcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwiVW5leHBlY3RlZCBzaWduYWxpbmcgc3RhdGUuXCIpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIC8vIFdlJ3JlIGluIFVBUyByb2xlLCBzZW5kaW5nIG91dGdvaW5nIHJlc3BvbnNlIHdpdGggc2Vzc2lvbiBkZXNjcmlwdGlvblxuICAgICAgICBpZiAoaXNCb2R5KG1lc3NhZ2UpKSB7XG4gICAgICAgICAgICBzd2l0Y2ggKHRoaXMuX3NpZ25hbGluZ1N0YXRlKSB7XG4gICAgICAgICAgICAgICAgY2FzZSBTaWduYWxpbmdTdGF0ZS5Jbml0aWFsOlxuICAgICAgICAgICAgICAgIGNhc2UgU2lnbmFsaW5nU3RhdGUuU3RhYmxlOlxuICAgICAgICAgICAgICAgICAgICB0aGlzLl9zaWduYWxpbmdTdGF0ZSA9IFNpZ25hbGluZ1N0YXRlLkhhdmVMb2NhbE9mZmVyO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLl9vZmZlciA9IGJvZHk7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuX2Fuc3dlciA9IHVuZGVmaW5lZDtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSBTaWduYWxpbmdTdGF0ZS5IYXZlTG9jYWxPZmZlcjpcbiAgICAgICAgICAgICAgICAgICAgLy8gWW91IGNhbm5vdCBtYWtlIGEgbmV3IG9mZmVyIHdoaWxlIG9uZSBpcyBpbiBwcm9ncmVzcy5cbiAgICAgICAgICAgICAgICAgICAgLy8gaHR0cHM6Ly90b29scy5pZXRmLm9yZy9odG1sL3JmYzMyNjEjc2VjdGlvbi0xMy4yLjFcbiAgICAgICAgICAgICAgICAgICAgLy8gRklYTUU6IFdoYXQgdG8gZG8gaGVyZT9cbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSBTaWduYWxpbmdTdGF0ZS5IYXZlUmVtb3RlT2ZmZXI6XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuX3NpZ25hbGluZ1N0YXRlID0gU2lnbmFsaW5nU3RhdGUuU3RhYmxlO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLl9hbnN3ZXIgPSBib2R5O1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIFNpZ25hbGluZ1N0YXRlLkNsb3NlZDpcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4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dGUgIT09IFN1YnNjcmlwdGlvblN0YXRlLlBlbmRpbmcpIHtcbiAgICAgICAgICAgICAgICAgICAgaW52YWxpZFN0YXRlVHJhbnNpdGlvbigpO1xuICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBTdWJzY3JpcHRpb25TdGF0ZS5BY3RpdmU6XG4gICAgICAgICAgICAgICAgaWYgKHRoaXMuc3Vic2NyaXB0aW9uU3RhdGUgIT09IFN1YnNjcmlwdGlvblN0YXRlLk5vdGlmeVdhaXQgJiZcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5zdWJzY3JpcHRpb25TdGF0ZSAhPT0gU3Vic2NyaXB0aW9uU3RhdGUuUGVuZGluZyAmJlxuICAgICAgICAgICAgICAgICAgICB0aGlzLnN1YnNjcmlwdGlvblN0YXRlICE9PSBTdWJzY3JpcHRpb25TdGF0ZS5BY3RpdmUpIHtcbiAgICAgICAgICAgICAgICAgICAgaW52YWxpZFN0YXRlVHJhbnNpdGlvbigpO1xuICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBTdWJzY3JpcHRpb25TdGF0ZS5UZXJtaW5hdGVkOlxuICAgICAgICAgICAgICAgIGlmICh0aGlzLnN1YnNjcmlwdGlvblN0YXRlICE9PSBTdWJzY3JpcHRpb25TdGF0ZS5Ob3RpZnlXYWl0ICYmXG4gICAgICAgICAgICAgICAgICAgIHRoaXMuc3Vic2NyaXB0aW9uU3RhdGUgIT09IFN1YnNjcmlwdGlvblN0YXRlLlBlbmRpbmcgJiZcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5zdWJzY3JpcHRpb25TdGF0ZSAhPT0gU3Vic2NyaXB0aW9uU3RhdGUuQWN0aXZlKSB7XG4gICAgICAgICAgICAgICAgICAgIG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ID0gW25ldyBEYXRlKCksIGNhdGVnb3J5XTtcbiAgICAgICAgICAgIGlmIChsYWJlbCkge1xuICAgICAgICAgICAgICAgIHByZWZpeC5wdXNoKGxhYmVsKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGNvbnRlbnQgPSBwcmVmaXguY29uY2F0KGNvbnRlbnQpLmpvaW4oXCIgfCBcIik7XG4gICAgICAgIH1cbiAgICAgICAgc3dpdGNoIChsZXZlbFRvTG9nKSB7XG4gICAgICAgICAgICBjYXNlIExldmVscy5lcnJvcjpcbiAgICAgICAgICAgICAgICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgbm8tY29uc29sZVxuICAgICAgICAgICAgICAgIGNvbnNvbGUuZXJyb3IoY29udGVudCk7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIExldmVscy53YXJuOlxuICAgICAgICAgICAgICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBuby1jb25zb2xlXG4gICAgICAgICAgICAgICAgY29uc29sZS53YXJuKGNvbnRlbnQpO1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBMZXZlbHMubG9nOlxuICAgICAgICAgICAgICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBuby1jb25zb2xlXG4gICAgICAgICAgICAgICAgY29uc29sZS5sb2coY29udGVudCk7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIExldmVscy5kZWJ1ZzpcbiAgICAgICAgICAgICAgICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgbm8tY29uc29sZVxuICAgICAgICAgICAgICAgIGNvbnNvbGUuZGVidWcoY29udGVudCk7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICB9XG4gICAgfVxufVxuIiwiaW1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G9uIHRoZSBnaXZlbiBpbmRleC5cbiAgICAgKiBAcGFyYW0gbmFtZSAtIGhlYWRlciBuYW1lXG4gICAgICogQHBhcmFtIGlkeCAtIGhlYWRlciBpbmRleFxuICAgICAqIEByZXR1cm5zIFBhcnNlZCBoZWFkZXIgb2JqZWN0LCB1bmRlZmluZWQgaWYgdGhlXG4gICAgICogICBoZWFkZXIgaXMgbm90IHByZXNlbnQgb3IgaW4gY2FzZSBvZiBhIHBhcnNpbmcgZXJyb3IuXG4gICAgICovXG4gICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIEB0eXBlc2NyaXB0LWVzbGludC9uby1leHBsaWNpdC1hbnlcbiAgICBwYXJzZUhlYWRlcihuYW1lLCBpZHggPSAwKSB7XG4gICAgICAgIG5hbWUgPSBoZWFkZXJpemUobmFtZSk7XG4gICAgICAgIGlmICghdGhpcy5oZWFkZXJzW25hbWVdKSB7XG4gICAgICAgICAgICAvLyB0aGlzLmxvZ2dlci5sb2coXCJoZWFkZXIgJ1wiICsgbmFtZSArIFwiJyBub3QgcHJlc2VudFwiKTtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuICAgICAgICBlbHNlIGlmIChpZHggPj0gdGhpcy5oZWFkZXJzW25hbWVdLmxlbmd0aCkge1xuICAgICAgICAgICAgLy8gdGhpcy5sb2dnZXIubG9nKFwibm90IHNvIG1hbnkgJ1wiICsgbmFtZSArIFwiJyBoZWFkZXJzIHByZXNlbnRcIik7XG4gICAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cbiAgICAgICAgY29uc3QgaGVhZGVyID0gdGhpcy5oZWFkZXJzW25hbWVdW2lkeF07XG4gICAgICAgIGNvbnN0IHZhbHVlID0gaGVhZGVyLnJhdztcbiAgICAgICAgaWYgKGhlYWRlci5wYXJzZWQpIHtcbiAgICAgICAgICAgIHJldHVybiBoZWFkZXIucGFyc2VkO1xuICAgICAgICB9XG4gICAgICAgIC8vIHN1YnN0aXR1dGUgJy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gIC5lbmQocmF3KTtcbiAgICB9XG4gICAgc3RhdGljIF9oZXgoeCkge1xuICAgICAgICBjb25zdCBoYyA9IE1kNS5oZXhDaGFycztcbiAgICAgICAgY29uc3QgaG8gPSBNZDUuaGV4T3V0O1xuICAgICAgICBsZXQgbjtcbiAgICAgICAgbGV0IG9mZnNldDtcbiAgICAgICAgbGV0IGo7XG4gICAgICAgIGxldCBpO1xuICAgICAgICBmb3IgKGkgPSAwOyBpIDwgNDsgaSArPSAxKSB7XG4gICAgICAgICAgICBvZmZzZXQgPSBpICogODtcbiAgICAgICAgICAgIG4gPSB4W2ldO1xuICAgICAgICAgICAgZm9yIChqID0gMDsgaiA8IDg7IGogKz0gMikge1xuICAgICAgICAgICAgICAgIGhvW29mZnNldCArIDEgKyBqXSA9IGhjLmNoYXJBdChuICYgMHgwRik7XG4gICAgICAgICAgICAgICAgbiA+Pj49IDQ7XG4gICAgICAgICAgICAgICAgaG9bb2Zmc2V0ICsgMCArIGpdID0gaGMuY2hhckF0KG4gJiAweDBGKTtcbiAgICAgICAgICAgICAgICBuID4+Pj0gNDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gaG8uam9pbignJyk7XG4gICAgfVxuICAgIHN0YXRpYyBfbWQ1Y3ljbGUoeCwgaykge1xuICAgICAgICBsZXQgYSA9IHhbMF07XG4gICAgICAgIGxldCBiID0geFsxXTtcbiAgICAgICAgbGV0IGMgPSB4WzJdO1xuICAgICAgICBsZXQgZCA9IHhbM107XG4gICAgICAgIC8vIGZmKClcbiAgICAgICAgYSArPSAoYiAmIGMgfCB+YiAmIGQpICsga1swXSAtIDY4MDg3NjkzNiB8IDA7XG4gICAgICAgIGEgPSAoYSA8PCA3IHwgYSA+Pj4gMjUpICsgYiB8IDA7XG4gICAgICAgIGQgKz0gKGEgJiBiIHwgfmEgJiBjKSArIGtbMV0gLSAzODk1NjQ1ODYgfCAwO1xuICAgICAgICBkID0gKGQgPDwgMTIgfCBkID4+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GFwcGVuZFN0cihzdHIpIHtcbiAgICAgICAgY29uc3QgYnVmOCA9IHRoaXMuX2J1ZmZlcjg7XG4gICAgICAgIGNvbnN0IGJ1ZjMyID0gdGhpcy5fYnVmZmVyMzI7XG4gICAgICAgIGxldCBidWZMZW4gPSB0aGlzLl9idWZmZXJMZW5ndGg7XG4gICAgICAgIGxldCBjb2RlO1xuICAgICAgICBsZXQgaTtcbiAgICAgICAgZm9yIChpID0gMDsgaSA8IHN0ci5sZW5ndGg7IGkgKz0gMSkge1xuICAgICAgICAgICAgY29kZSA9IHN0ci5jaGFyQ29kZUF0KGkpO1xuICAgICAgICAgICAgaWYgKGNvZGUgPCAxMjgpIHtcbiAgICAgICAgICAgICAgICBidWY4W2J1ZkxlbisrXSA9IGNvZGU7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIGlmIChjb2RlIDwgMHg4MDApIHtcbiAgICAgICAgICAgICAgICBidWY4W2J1ZkxlbisrXSA9IChjb2RlID4+PiA2KSArIDB4QzA7XG4gICAgICAgICAgICAgICAgYnVmOFtidWZMZW4rK10gPSBjb2RlICYgMHgzRiB8IDB4ODA7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIGlmIChjb2RlIDwgMHhEODAwIHx8IGNvZGUgPiAweERCRkYpIHtcbiAgICAgICAgICAgICAgICBidWY4W2J1ZkxlbisrXSA9IChjb2RlID4+PiAxMikgKyAweEUwO1xuICAgICAgICAgICAgICAgIGJ1ZjhbYnVmTGVuKytdID0gKGNvZGUgPj4+IDYgJiAweDNGKSB8IDB4ODA7XG4gICAgICAgICAgICAgICAgYnVmOFtidWZMZW4rK10gPSAoY29kZSAmIDB4M0YpIHwgMHg4MDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgIGNvZGUgPSAoKGNvZGUgLSAweEQ4MDApICogMHg0MDApICsgKHN0ci5jaGFyQ29kZUF0KCsraSkgLSAweERDMDApICsgMHgxMDAwMDtcbiAgICAgICAgICAgICAgICBpZiAoY29kZSA+IDB4MTBGRkZGKSB7XG4gICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignVW5pY29kZSBzdGFuZGFyZCBzdXBwb3J0cyBjb2RlIHBvaW50cyB1cCB0byBVKzEwRkZGRicpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBidWY4W2J1ZkxlbisrXSA9IChjb2RlID4+PiAxOCkgKyAweEYwO1xuICAgICAgICAgICAgICAgIGJ1ZjhbYnVmTGVuKytdID0gKGNvZGUgPj4+IDEyICYgMHgzRikgfCAweDgwO1xuICAgICAgICAgICAgICAgIGJ1ZjhbYnVmTGVuKytdID0gKGNvZGUgPj4+IDYgJiAweDNGKSB8IDB4ODA7XG4gICAgICAgICAgICAgICAgYnVmOFtidWZMZW4rK10gPSAoY29kZSAmIDB4M0YpIHwgMHg4MDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChidWZMZW4gPj0gNjQpIHtcbiAgICAgICAgICAgICAgICB0aGlzLl9kYXRhTGVuZ3RoICs9IDY0O1xuICAgICAgICAgICAgICAgIE1kNS5fbWQ1Y3ljbGUodGhpcy5fc3RhdGUsIGJ1ZjMyKTtcbiAgICAgICAgICAgICAgICBidWZMZW4gLT0gNjQ7XG4gICAgICAgICAgICAgICAgYnVmMzJbMF0gPSBidWYzMlsxNl07XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgdGhpcy5fYnVmZmVyTGVuZ3RoID0gYnVmTGVuO1xuICAgICAgICByZXR1cm4gdGhpcztcbiAgICB9XG4gICAgYXBwZW5kQXNjaWlTdHIoc3RyKSB7XG4gICAgICAgIGNvbnN0IGJ1ZjggPSB0aGlzLl9idWZmZXI4O1xuICAgICAgICBjb25zdCBidWYzMiA9IHRoaXMuX2J1ZmZlcjMyO1xuICAgICAgICBsZXQgYnVmTGVuID0gdGhpcy5fYnVmZmVyTGVuZ3RoO1xuICAgICAgICBsZXQgaTtcbiAgICAgICAgbGV0IGogPSAwO1xuICAgICAgICBmb3IgKDs7KSB7XG4gICAgICAgICAgICBpID0gTWF0aC5taW4oc3RyLmxlbmd0aCAtIGosIDY0IC0gYnVmTGVuKTtcbiAgICAgICAgICAgIHdoaWxlIChpLS0pIHtcbiAgICAgICAgICAgICAgICBidWY4W2J1ZkxlbisrXSA9IHN0ci5jaGFyQ29kZUF0KGorKyk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoYnVmTGVuIDwgNjQpIHtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHRoaXMuX2RhdGFMZW5ndGggKz0gNjQ7XG4gICAgICAgICAgICBNZDUuX21kNWN5Y2xlKHRoaXMuX3N0YXRlLCBidWYzMik7XG4gICAgICAgICAgICBidWZMZW4gPSAwO1xuICAgICAgICB9XG4gICAgICAgIHRoaXMuX2J1ZmZlckxlbmd0aCA9IGJ1ZkxlbjtcbiAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgfVxuICAgIGFwcGVuZEJ5dGVBcnJheShpbnB1dCkge1xuICAgICAgICBjb25zdCBidWY4ID0gdGhpcy5fYnVmZmVyODtcbiAgICAgICAgY29uc3QgYnVmMzIgPSB0aGlzLl9idWZmZXIzMjtcbiAgICAgICAgbGV0IGJ1ZkxlbiA9IHRoaXMuX2J1ZmZlckxlbmd0aDtcbiAgICAgICAgbGV0IGk7XG4gICAgICAgIGxldCBqID0gMDtcbiAgICAgICAgZm9yICg7Oykge1xuICAgICAgICAgICAgaSA9IE1hdGgubWluKGlucHV0Lmxlbmd0aCAtIGosIDY0IC0gYnVmTGVuKTtcbiAgICAgICAgICAgIHdoaWxlIChpLS0pIHtcbiAgICAgICAgICAgICAgICBidWY4W2J1ZkxlbisrXSA9IGlucHV0W2orK107XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoYnVmTGVuIDwgNjQpIHtcbiAgICAgICAgICA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CIgKyB0aGlzLm1ldGhvZCk7XG4gICAgICAgIHRoaXMuc2V0SGVhZGVyKFwiY2FsbC1pZFwiLCB0aGlzLmNhbGxJZCk7XG4gICAgICAgIHRoaXMuc2V0SGVhZGVyKFwibWF4LWZvcndhcmRzXCIsIFwiNzBcIik7XG4gICAgfVxuICAgIC8qKiBHZXQgYSBjb3B5IG9mIHRoZSBkZWZhdWx0IG9wdGlvbnMuICovXG4gICAgc3RhdGljIGdldERlZmF1bHRPcHRpb25zKCkge1xuICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgY2FsbElkOiBcIlwiLFxuICAgICAgICAgICAgY2FsbElkUHJlZml4OiBcIlwiLFxuICAgICAgICAgICAgY3NlcTogMSxcbiAgICAgICAgICAgIHRvRGlzcGxheU5hbWU6IFwiXCIsXG4gICAgICAgICAgICB0b1RhZzogXCJcIixcbiAgICAgICAgICAgIGZyb21EaXNwbGF5TmFtZTogXCJcIixcbiAgICAgICAgICAgIGZyb21UYWc6IFwiXCIsXG4gICAgICAgICAgICBmb3JjZVJwb3J0OiBmYWxzZSxcbiAgICAgICAgICAgIGhhY2tWaWFUY3A6IGZhbHNlLFxuICAgICAgICAgICAgb3B0aW9uVGFnczogW1wib3V0Ym91bmRcIl0sXG4gICAgICAgICAgICByb3V0ZVNldDogW10sXG4gICAgICAgICAgICB1c2VyQWdlbnRTdHJpbmc6IFwic2lwLmpzXCIsXG4gICAgICAgICAgICB2aWFIb3N0OiBcIlwiXG4gICAgICAgIH07XG4gICAgfVxuICAgIHN0YXRpYyBtYWtlTmFtZUFkZHJIZWFkZXIodXJpLCBkaXNwbGF5TmFtZSwgdGFnKSB7XG4gICAgICAgIGNvbnN0IHBhcmFtZXRlcnMgPSB7fTtcbiAgICAgICAgaWYgKHRhZykge1xuICAgICAgICAgICAgcGFyYW1ldGVycy50YWcgPSB0YWc7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG5ldyBOYW1lQWRkckhlYWRlcih1cmksIGRpc3BsY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hbSBuYW1lIC0gaGVhZGVyIG5hbWVcbiAgICAgKiBAcmV0dXJucyBBcnJheSB3aXRoIGFsbCB0aGUgaGVhZGVycyBvZiB0aGUgc3BlY2lmaWVkIG5hbWUuXG4gICAgICovXG4gICAgZ2V0SGVhZGVycyhuYW1lKSB7XG4gICAgICAgIGNvbnN0IHJlc3VsdCA9IFtdO1xuICAgICAgICBjb25zdCBoZWFkZXJBcnJheSA9IHRoaXMuaGVhZGVyc1toZWFkZXJpemUobmFtZSldO1xuICAgICAgICBpZiAoaGVhZGVyQXJyYXkpIHtcbiAgICAgICAgICAgIGZvciAoY29uc3QgaGVhZGVyUGFydCBvZiBoZWFkZXJBcnJheSkge1xuICAgICAgICAgICAgICAgIHJlc3VsdC5wdXNoKGhlYWRlclBhcnQpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgY29uc3QgcmVnZXhwID0gbmV3IFJlZ0V4cChcIl5cXFxccypcIiArIG5hbWUgKyBcIlxcXFxzKjpcIiwgXCJpXCIpO1xuICAgICAgICAgICAgZm9yIChjb25zdCBleEhlYWRlciBvZiB0aGlzLmV4dHJhSGVhZGVycykge1xuICAgICAgICAgICAgICAgIGlmIChyZWdleHAudGVzdChleEhlYWRlcikpIHtcbiAgICAgICAgICAgICAgICAgICAgcmVzdWx0LnB1c2goZXhIZWFkZXIuc3Vic3RyaW5nKGV4SGVhZGVyLmluZGV4T2YoXCI6XCIpICsgMSkudHJpbSgpKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHJlc3VsdDtcbiAgICB9XG4gICAgLyoqXG4gICAgICogVmVyaWZ5IHRoZSBleGlzdGVuY2Ugb2YgdGhlIGdpdmVuIGhlYWRlci5cbiAgICAgKiBAcGFyYW0gbmFtZSAtIGhlYWRlciBuYW1lXG4gICAgICogQHJldHVybnMgdHJ1ZSBpZiBoZWFkZXIg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gICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGZvciAoY29uc3QgaGVhZGVyIG9mIHRoaXMuZXh0cmFIZWFkZXJzKSB7XG4gICAgICAgICAgICBtc2cgKz0gaGVhZGVyLnRyaW0oKSArIFwiXFxyXFxuXCI7XG4gICAgICAgIH1cbiAgICAgICAgbXNnICs9IFwiU3VwcG9ydGVkOiBcIiArIHRoaXMub3B0aW9ucy5vcHRpb25UYWdzLmpvaW4oXCIsIFwiKSArIFwiXFxyXFxuXCI7XG4gICAgICAgIG1zZyArPSBcIlVzZXItQWdlbnQ6IFwiICsgdGhpcy5vcHRpb25zLnVzZXJBZ2VudFN0cmluZyArIFwiXFxyXFxuXCI7XG4gICAgICAgIGlmICh0aGlzLmJvZHkpIHtcbiAgICAgICAgICAgIGlmICh0eXBlb2YgdGhpcy5ib2R5ID09PSBcInN0cmluZ1wiKSB7XG4gICAgICAgICAgICAgICAgbXNnICs9IFwiQ29udGVudC1MZW5ndGg6IFwiICsgdXRmOExlbmd0aCh0aGlzLmJvZHkpICsgXCJcXHJcXG5cXHJcXG5cIjtcbiAgICAgICAgICAgICAgICBtc2cgKz0gdGhpcy5ib2R5O1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgaWYgKHRoaXMuYm9keS5ib2R5ICYmIHRoaXMuYm9keS5jb250ZW50VHlwZSkge1xuICAgICAgICAgICAgICAgICAgICBtc2cgKz0gXCJDb250ZW50LVR5cGU6IFwiICsgdGhpcy5ib2R5LmNvbnRlbnRUeXBlICsgXCJcXHJcXG5cIjtcbiAgICAgICAgICAgICAgICAgICAgbXNnICs9IFwiQ29udGVudC1MZW5ndGg6IFwiICsgdXRmOExlbmd0aCh0aGlzLmJvZHkuYm9keSkgKyBcIlxcclxcblxcclxcblwiO1xuICAgICAgICAgICAgICAgICAgICBtc2cgKz0gdGhpcy5ib2R5LmJvZHk7XG4gICAgICAgICAgICAg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DEsIGhlYWRlckVuZCkudHJpbSgpO1xuICAgICAgICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgQHR5cGVzY3JpcHQtZXNsaW50L25vLWV4cGxpY2l0LWFueVxuICAgICAgICBsZXQgcGFyc2VkO1xuICAgICAgICAvLyBJZiBoZWFkZXItZmllbGQgaXMgd2VsbC1rbm93biwgcGFyc2UgaXQuXG4gICAgICAgIHN3aXRjaCAoaGVhZGVyTmFtZS50b0xvd2VyQ2FzZSgpKSB7XG4gICAgICAgICAgICBjYXNlIFwidmlhXCI6XG4gICAgICAgICAgICBjYXNlIFwidlwiOlxuICAgICAgICAgICAgICAgIG1lc3NhZ2UuYWRkSGVhZGVyKFwidmlhXCIsIGhlYWRlclZhbHVlKTtcbiAgICAgICAgICAgICAgICBpZiAobWVzc2FnZS5nZXRIZWFkZXJzKFwidmlhXCIpLmxlbmd0aCA9PT0gMSkge1xuICAgICAgICAgICAgICAgICAgICBwYXJzZWQgPSBtZXNzYWdlLnBhcnNlSGVhZGVyKFwiVmlhXCIpO1xuICAgICAgICAgICAgICAgICAgICBpZiAocGFyc2VkKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnZpYSA9IHBhcnNlZDtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudmlhQnJhbmNoID0gcGFyc2VkLmJyYW5jaDtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgcGFyc2VkID0gMDtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIFwiZnJvbVwiOlxuICAgICAgICAgICAgY2FzZSBcImZcIjpcbiAgICAgICAgICAgICAgICBtZXNzYWdlLnNldEhlYWRlcihcImZyb21cIiwgaGVhZGVyVmFsdWUpO1xuICAgICAgICAgICAgICAgIHBhcnNlZCA9IG1lc3NhZ2UucGFyc2VIZWFkZXIoXCJmcm9tXCIpO1xuICAgICAgICAgICAgICAgIGlmIChwYXJzZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5mcm9tID0gcGFyc2VkO1xuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmZyb21UYWcgPSBwYXJzZWQuZ2V0UGFyYW0oXCJ0YWdcIik7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBcInRvXCI6XG4gICAgICAgICAgICBjYXNlIFwidFwiOlxuICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc2V0SGVhZGVyKFwidG9cIiwgaGVhZGVyVmFsdWUpO1xuICAgICAgICAgICAgICAgIHBhcnNlZCA9IG1lc3NhZ2UucGFyc2VIZWFkZXIoXCJ0b1wiKTtcbiAgICAgICAgICAgICAgICBpZiAocGFyc2VkKSB7XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudG8gPSBwYXJzZWQ7XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudG9UYWcgPSBwYXJzZWQuZ2V0UGFyYW0oXCJ0YWdcIik7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBcInJlY29yZC1yb3V0ZVwiOlxuICAgICAgICAgICAgICAgIHBhcnNlZCA9IEdyYW1tYXIucGFyc2UoaGVhZGVyVmFsdWUsIFwiUmVjb3JkX1JvdXRlXCIpO1xuICAgICAgICAgICAgICAgIGlmIChwYXJzZWQgPT09IC0xKSB7XG4gICAgICAgICAgICAgICAgICAgIHBhcnNlZCA9IHVuZGVmaW5lZDtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmICghKHBhcnNlZCBpbnN0YW5jZW9mIEFycmF5KSkge1xuICAgICAgICAgICAgICAgICAgICBwYXJzZWQgPSB1bmRlZmluZWQ7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBwYXJzZWQuZm9yRWFjaCgoaGVhZGVyKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYWRkSGVhZGVyKFwicmVjb3JkLXJvdXRlXCIsIGhlYWRlclZhbHVlLnN1YnN0cmluZyhoZWFkZXIucG9zaXRpb24sIGhlYWRlci5vZmZzZXQpKTtcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5oZWFkZXJzW1wiUmVjb3JkLVJvdXRlXCJdW21lc3NhZ2UuZ2V0SGVhZGVycyhcInJlY29yZC1yb3V0ZVwiKS5sZW5ndGggLSAxXS5wYXJzZWQgPSBoZWFkZXIucGFyc2VkO1xuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBcImNhbGwtaWRcIjpcbiAgICAgICAgICAgIGNhc2UgXCJpXCI6XG4gICAgICAgICAgICAgICAgbWVzc2FnZS5zZXRIZWFkZXIoXCJjYWxsLWlkXCIsIGhlYWRlclZhbHVlKTtcbiAgICAgICAgICAgICAgICBwYXJzZWQgPSBtZXNzYWdlLnBhcnNlSGVhZGVyKFwiY2FsbC1pZFwiKTtcbiAgICAgICAgICAgICAgICBpZiAocGFyc2VkKSB7XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY2FsbElkID0gaGVhZGVyVmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBcImNvbnRhY3RcIjpcbiAgICAgICAgICAgIGNhc2UgXCJtXCI6XG4gICAgICAgICAgICAgICAgcGFyc2VkID0gR3JhbW1hci5wYXJzZShoZWFkZXJWYWx1ZSwgXCJDb250YWN0XCIpO1xuICAgICAgICAgICAgICAgIGlmIChwYXJzZWQgPT09IC0xKSB7XG4gICAgICAgICAgICAgICAgICAgIHBhcnNlZCA9IHVuZGVmaW5lZDtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmICghKHBhcnNlZCBpbnN0YW5jZW9mIEFycmF5KSkge1xuICAgICAgICAgICAgICAgICAgICBwYXJzZWQgPSB1bmRlZmluZWQ7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBwYXJzZWQuZm9yRWFjaCgoaGVhZGVyKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYWRkSGVhZGVyKFwiY29udGFjdFwiLCBoZWFkZXJWYWx1ZS5zdWJzdHJpbmcoaGVhZGVyLnBvc2l0aW9uLCBoZWFkZXIub2Zmc2V0KSk7XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuaGVhZGVycy5Db250YWN0W21lc3NhZ2UuZ2V0SGVhZGVycyhcImNvbnRhY3RcIikubGVuZ3RoIC0gMV0ucGFyc2VkID0gaGVhZGVyLnBhcnNlZDtcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgXCJjb250ZW50LWxlbmd0aFwiOlxuICAgICAgICAgICAgY2FzZSBcImxcIjpcbiAgICAgICAgICAgICAgICBtZXNzYWdlLnNldEhlYWRlcihcImNvbnRlbnQtbGVuZ3RoXCIsIGhlYWRlclZhbHVlKTtcbiAgICAgICAgICAgICAgICBwYXJzZWQgPSBtZXNzYWdlLnBhcnNlSGVhZGVyKFwiY29udGVudC1sZW5ndGhcIik7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIFwiY29udGVudC10eXBlXCI6XG4gICAgICAgICAgICBjYXNlIFwiY1wiOlxuICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc2V0SGVhZGVyKFwiY29udGVudC10eXBlXCIsIGhlYWRlclZhbHVlKTtcbiAgICAgICAgICAgICAgICBwYXJzZWQgPSBtZXNzYWdlLnBhcnNlSGVhZGVyKFwiY29udGVudC10eXBlXCIpO1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBcImNzZXFcIjpcbiAgICAgICAgICAgICAgICBtZXNzYWdlLnNldEhlYWRlcihcImNzZXFcIiwgaGVhZGVyVmFsdWUpO1xuICAgICAgICAgICAgICAgIHBhcnNlZCA9IG1lc3NhZ2UucGFyc2VIZWFkZXIoXCJjc2VxXCIpO1xuICAgICAgICAgICAgICAgIGlmIChwYXJzZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jc2VxID0gcGFyc2VkLnZhbHVlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAobWVzc2FnZSBpbnN0YW5jZW9mIEluY29taW5nUmVzcG9uc2VNZXNzYWdlKSB7XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubWV0aG9kID0gcGFyc2VkLm1ldGhvZDtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIFwibWF4LWZvcndhcmRzXCI6XG4gICAgICAgICAgICAgICAgbWVzc2FnZS5zZXRIZWFkZXIoXCJtYXgtZm9yd2FyZHNcIiwgaGVhZGVyVmFsdWUpO1xuICAgICAgICAgICAgICAgIHBhcnNlZCA9IG1lc3NhZ2UucGFyc2VIZWFkZXIoXCJtYXgtZm9yd2FyZHNcIik7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIFwid3d3LWF1dGhlbnRpY2F0ZVwiOlxuICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc2V0SGVhZGVyKFwid3d3LWF1dGhlbnRpY2F0ZVwiLCBoZWFkZXJWYWx1ZSk7XG4gICAgICAgICAgICAgICAgcGFyc2VkID0gbWVzc2FnZS5wYXJzZUhlYWRlcihcInd3dy1hdXRoZW50aWNhdGVcIik7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIFwicHJveHktYXV0aGVudGljYXRlXCI6XG4gICAgICAgICAgICAgICAgbWVzc2FnZS5zZXRIZWFkZXIoXCJwcm94eS1hdXRoZW50aWNhdGVcIiwgaGVhZGVyVmFsdWUpO1xuICAgICAgICAgICAgICAgIHBhcnNlZCA9IG1lc3NhZ2UucGFyc2VIZWFkZXIoXCJwcm94eS1hdXRoZW50aWNhdGVcIik7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIFwicmVmZXItdG9cIjpcbiAgICAgICAgICAgIGNhc2UgXCJyXCI6XG4gICAgICAgICAgICAgICAgbWVzc2FnZS5zZXRIZWFkZXIoXCJyZWZlci10b1wiLCBoZWFkZXJWYWx1ZSk7XG4gICAgICAgICAgICAgICAgcGFyc2VkID0gbWVzc2FnZS5wYXJzZUhlYWRlcihcInJlZmVyLXRvXCIpO1xuICAgICAgICAgICAgICAgIGlmIChwYXJzZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5yZWZlclRvID0gcGFyc2VkO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgLy8gRG8gbm90IHBhcnNlIHRoaXMgaGVhZGVyLlxuICAgICAgICAgICAgICAgIG1lc3NhZ2UuYWRkSGVhZGVyKGhlYWRlck5hbWUudG9Mb3dlckNhc2UoKSwgaGVhZGVyVmFsdWUpO1xuICAgICAgICAgICAgICAgIHBhcnNlZCA9IDA7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHBhcnNlZCA9PT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgIGVycm9yOi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gc2VudC5cbiAgICAgICAgICAgICAgICAvLyBodHRwczovL3Rvb2xzLmlldGYub3JnL2h0bWwvcmZjNjAyNiNzZWN0aW9uLTguNFxuICAgICAgICAgICAgICAgIGlmIChzdGF0dXNDb2RlID49IDMwMCAmJiBzdGF0dXNDb2RlIDw9IDY5OSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnN0YXRlVHJhbnNpdGlvbihUcmFuc2FjdGlvblN0YXRlLkNvbXBsZXRlZCk7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuYWNrKHJlc3BvbnNlKTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMudXNlci5yZWNlaXZlUmVzcG9uc2UpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMudXNlci5yZWNlaXZlUmVzcG9uc2UocmVzcG9uc2UpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIFRyYW5zYWN0aW9uU3RhdGUuUHJvY2VlZGluZzpcbiAgICAgICAgICAgICAgICAvLyBJbiB0aGUgXCJQcm9jZWVkaW5nXCIgc3RhdGUsIHRoZSBjbGllbnQgdHJhbnNhY3Rpb24gU0hPVUxEIE5PVCByZXRyYW5zbWl0IHRoZVxuICAgICAgICAgICAgICAgIC8vIHJlcXVlc3QgYW55IGxvbmdlci4gRnVydGhlcm1vcmUsIHRoZSBwcm92aXNpb25hbCByZXNwb25zZSBNVVNUIGJlXG4gICAgICAgICAgICAgICAgLy8gcGFzc2VkIHRvIHRoZSBUVS4gIEFueSBmdXJ0aGVyIHByb3Zpc2lvbmFsIHJlc3BvbnNlcyBNVVNUIGJlIHBhc3NlZFxuICAgICAgICAgICAgICAgIC8vIHVwIHRvIHRoZSBUVSB3aGlsZSBpbiB0aGUgXCJQcm9jZWVkaW5nXCIgc3RhdGUuXG4gICAg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gdGhlIHJlc3BvbnNlIHRvIHRoZSBUVS5cbiAgICAgICAgICAgICAgICAgICAgaWYgKCF0aGlzLmFja1JldHJhbnNtaXNzaW9uQ2FjaGUuaGFzKHJlc3BvbnNlLnRvVGFnKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5hY2tSZXRyYW5zbWlzc2lvbkNhY2hlLnNldChyZXNwb25zZS50b1RhZywgdW5kZWZpbmVkKTsgLy8gUHJpbWUgdGhlIEFDSyBjYWNoZVxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMudXNlci5yZWNlaXZlUmVzcG9uc2UpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnVzZXIucmVjZWl2ZVJlc3BvbnNlKHJlc3BvbnNlKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAvLyBJZiB3ZSBoYXZlIGEgY2FjaGUgaGl0LCB0cnkgcHVsbGluZyB0aGUgQUNLIGZyb20gY2FjaGUgYW5kIHJldHJhbnNtaXR0aW5nIGl0LlxuICAgICAgICAgICAgICAgICAgICBjb25zdCBhY2sgPSB0aGlzLmFja1JldHJhbnNtaXNzaW9uQ2FjaGUuZ2V0KHJlc3BvbnNlLnRvVGFnKTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGFjaykge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5zZW5kKGFjay50b1N0cmluZygpKS5jYXRjaCgoZXJyb3IpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZ1RyYW5zcG9ydEVycm9yKGVycm9yLCBcIkZhaWxlZCB0byBzZW5kIHJldHJhbnNtaXNzaW9uIG9mIEFDSyB0byAyeHggcmVzcG9uc2UuXCIpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAg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VCBOT1QgYmUgcGFzc2VkIHVwIHRvIHRoZSBUVS5cbiAgICAgICAgICAgICAgICAvLyBodHRwczovL3Rvb2xzLmlldGYub3JnL2h0bWwvcmZjNjAyNiNzZWN0aW9uLTguNFxuICAgICAgICAgICAgICAgIGlmIChzdGF0dXNDb2RlID49IDMwMCAmJiBzdGF0dXNDb2RlIDw9IDY5OSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmFjayhyZXNwb25zZSk7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIFRyYW5zYWN0aW9uU3RhdGUuVGVybWluYXRlZDpcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKGBJbnZhbGlkIHN0YXRlICR7dGhpcy5zdGF0ZX1gKTtcbiAgICAgICAgfVxuICAgICAgICAvLyBBbnkgcmVzcG9uc2UgcmVjZWl2ZWQgdGhhdCBkb2VzIG5vdCBtYXRjaCBhbiBleGlzdGluZyBjbGllbnRcbiAgICAgICAgLy8gdHJhbnNhY3Rpb24gc3RhdGUgbWFjaGluZSBpcyBzaW1wbHkgZHJvcHBlZC4gKEltcGxlbWVudGF0aW9ucyBhcmUsXG4gICAgICAgIC8vIG9mIGNvdXJzZSwgZnJlZSB0byBsb2cgb3IgZG8gb3RoZXIgaW1wbGVtZW50YXRpb24tc3BlY2lmaWMgdGhpbmdzXG4gICAgICAgIC8vIHdpdGggc3VjaCByZXNwb25zZXMsIGJ1dCB0aGUgaW1wbGVtZW50ZXIgc2hvdWxkIGJlIHN1cmUgdG8gY29uc2lkZXJcbiAgICAgICAgLy8gdGhlIGltcGFjdCBvZiBsYXJnZSBudW1iZXJzIG9mIG1hbGljaW91cyBzdHJheSByZXNwb25zZXMuKVxuICAgICAgICAvLyBodHRwczovL3R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pcy5yZXF1ZXN0LmdldEhlYWRlcihcInZpYVwiKTtcbiAgICAgICAgY29uc3Qgcm91dGUgPSB0aGlzLnJlcXVlc3QuZ2V0SGVhZGVyKFwicm91dGVcIik7XG4gICAgICAgIGlmICghZnJvbSkge1xuICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwiRnJvbSB1bmRlZmluZWQuXCIpO1xuICAgICAgICB9XG4gICAgICAgIGlmICghdG8pIHtcbiAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcIlRvIHVuZGVmaW5lZC5cIik7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKCF2aWEpIHtcbiAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcIlZpYSB1bmRlZmluZWQuXCIpO1xuICAgICAgICB9XG4gICAgICAgIGxldCBhY2sgPSBgQUNLICR7cnVyaX0gU0lQLzIuMFxcclxcbmA7XG4gICAgICAgIGlmIChyb3V0ZSkge1xuICAgICAgICAgICAgYWNrICs9IGBSb3V0ZTogJHtyb3V0ZX1cXHJcXG5gO1xuICAgICAgICB9XG4gICAgICAgIGFjayArPSBgVmlhOiAke3ZpYX1cXHJcXG5gO1xuICAgICAgICBhY2sgKz0gYFRvOiAke3RvfVxcclxcbmA7XG4gICAgICAgIGFjayArPSBgRnJvbTogJHtmcm9tfVxcclxcbmA7XG4gICAgICAgIGFjayArPSBgQ2FsbC1JRDogJHtjYWxsSWR9XFxyXFxuYDtcbiAgICAgICAgYWNrICs9IGBDU2VxOiAke2NzZXF9IEFDS1xcclxcbmA7XG4gICAgICAgIGFjayArPSBgTWF4LUZvcndhcmRzOiA3MFxcclxcbmA7XG4gICAgICAgIGFjayArPSBgQ29udGVudC1MZW5ndGg6IDBcXHJcXG5cXHJcXG5gO1xuICAgICAgICAvLyBUT09POiBcIlVzZXItQWdlbnRcIiBoZWFkZXJcbiAgICAgICAgdGhpcy5zZW5kKGFjaykuY2F0Y2goKGVycm9yKSA9PiB7XG4gICAgICAgICAgICB0aGlzLm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JhbnNhY3Rpb24uXG4gICAgICovXG4gICAgcmVjZWl2ZVJlcXVlc3QocmVxdWVzdCkge1xuICAgICAgICBzd2l0Y2ggKHRoaXMuc3RhdGUpIHtcbiAgICAgICAgICAgIGNhc2UgVHJhbnNhY3Rpb25TdGF0ZS5Qcm9jZWVkaW5nOlxuICAgICAgICAgICAgICAgIC8vIElmIGEgcmVxdWVzdCByZXRyYW5zbWlzc2lvbiBpcyByZWNlaXZlZCB3aGlsZSBpbiB0aGUgXCJQcm9jZWVkaW5nXCIgc3RhdGUsIHRoZSBtb3N0XG4gICAgICAgICAgICAgICAgLy8gcmVjZW50IHByb3Zpc2lvbmFsIHJlc3BvbnNlIHRoYXQgd2FzIHJlY2VpdmVkIGZyb20gdGhlIFRVIE1VU1QgYmUgcGFzc2VkIHRvIHRoZVxuICAgICAgICAgICAgICAgIC8vIHRyYW5zcG9ydCBsYXllciBmb3IgcmV0cmFuc21pc3Npb24uXG4gICAgICAgICAgICAgICAgLy8gaHR0cHM6Ly90b29scy5pZXRmLm9yZy9odG1sL3JmYzMyNjEjc2VjdGlvbi0xNy4yLjFcbiAgICAgICAgICAgICAgICBpZiAocmVxdWVzdC5tZXRob2QgPT09IEMuSU5WSVRFKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLmxhc3RQcm92aXNpb25hbFJlc3BvbnNlKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnNlbmQodGhpcy5sYXN0UHJvdmlzaW9uYWxSZXNwb25zZSkuY2F0Y2goKGVycm9yKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2dUcmFuc3BvcnRFcnJvcihlcnJvciwgXCJGYWlsZWQgdG8gc2VuZCByZXRyYW5zbWlzc2lvbiBvZiBwcm92aXNpb25hbCByZXNwb25zZS5cIik7XG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBUcmFuc2FjdGlvblN0YXRlLkFjY2VwdGVkOlxuICAgICAgICAgICAgICAgIC8vIFdoaWxlIGluIHRoZSBcIkFjY2VwdGVkXCIgc3RhdGUsIGFueSByZXRyYW5zbWlzc2lvbnMgb2YgdGhlIElOVklURVxuICAgICAgICAgICAgICAgIC8vIHJlY2VpdmVkIHdpbGwgbWF0Y2ggdGhpcyB0cmFuc2FjdGlvbiBzdGF0ZSBtYWNoaW5lIGFuZCB3aWxsIGJlXG4gICAgICAgICAgICAgICAgLy8gYWJzb3JiZWQgYnkgdGhlIG1hY2hpbmUgd2l0aG91dCBjaGFuZ2luZyBpdHMgc3RhdGUuIFRoZXNlXG4gICAgICAgICAgICAgICAgLy8gcmV0cmFuc21pc3Npb25zIGFyZSBub3QgcGFzc2VkIG9udG8gdGhlIFRVLlxuICAgICAgICAgICAgICAgIC8vIGh0dHBzOi8vdG9vbHMuaWV0Zi5vcmcvaHRtbC9yZmM2MDI2I3NlY3Rpb24tNy4xXG4gICAgICAgICAgICAgICAgaWYgKHJlcXVlc3QubWV0aG9kID09PSBDLklOVklURSkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBUcmFuc2FjdGlvblN0YXRlLkNvbXBsZXRlZDpcbiAgICAgICAgICAgICAgICAvLyBGdXJ0aGVybW9yZSwgd2hpbGUgaW4gdGhlIFwiQ29tcGxldGVkXCIgc3RhdGUsIGlmIGEgcmVxdWVzdCByZXRyYW5zbWlzc2lvbiBpc1xuICAgICAgICAgICAgICAgIC8vIHJlY2VpdmVkLCB0aGUgc2VydmVyIFNIT1VMRCBwYXNzIHRoZSByZXNwb25zZSB0byB0aGUgdHJhbnNwb3J0IGZvciByZXRyYW5zbWlzc2lvbi5cbiAgICAgICAgICAgICAgICAvLyBodHRwczovL3Rvb2xzLmlldGYub3JnL2h0bWwvcmZjMzI2MSNzZWN0aW9uLTE3LjIuMVxuICAgICAgICAgICAgICAgIGlmIChyZXF1ZXN0Lm1ldGhvZCA9PT0gQy5JTlZJVEUpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKCF0aGlzLmxhc3RGaW5hbFJlc3BvbnNlKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJMYXN0IGZpbmFsIHJlc3BvbnNlIHVuZGVmaW5lZC5cIik7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgdGhpcy5zZW5kKHRoaXMubGFzdEZpbmFsUmVzcG9uc2UpLmNhdGNoKChlcnJvcikgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2dUcmFuc3BvcnRFcnJvcihlcnJvciwgXCJGYWlsZWQgdG8gc2VuZCByZXRyYW5zbWlzc2lvbiBvZiBmaW5hbCByZXNwb25zZS5cIik7XG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIC8vIElmIGFuIEFDSyBpcyByZWNlaXZlZCB3aGlsZSB0aGUgc2VydmVyIHRyYW5zYWN0aW9uIGlzIGluIHRoZSBcIkNvbXBsZXRlZFwiIHN0YXRlLFxuICAgICAgICAgICAgICAgIC8vIHRoZSBzZXJ2ZXIgdHJhbnNhY3Rpb24gTVVTVCB0cmFuc2l0aW9uIHRvIHRoZSBcIkNvbmZpcm1lZFwiIHN0YXRlLlxuICAgICAgICAgICAgICAgIC8vIGh0dHBzOi8vdG9vbHMuaWV0Zi5vcmcvaHRtbC9yZmMzMjYxI3NlY3Rpb24tMTcuMi4xXG4gICAgICAgICAgICAgICAgaWYgKHJlcXVlc3QubWV0aG9kID09PSBDLkFDSykge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnN0YXRlVHJhbnNpdGlvbihUcmFuc2FjdGlvblN0YXRlLkNvbmZpcm1lZCk7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIFRyYW5zYWN0aW9uU3RhdGUuQ29uZmlybWVkOlxuICAgICAgICAgICAgICAgIC8vIFRoZSBwdXJwb3NlIG9mIHRoZSBcIkNvbmZpcm1lZFwiIHN0YXRlIGlzIHRvIGFic29yYiBhbnkgYWRkaXRpb25hbCBBQ0sgbWVzc2FnZXMgdGhhdCBhcnJpdmUsXG4gICAgICAgICAgICAgICAgLy8gdHJpZ2dlcmVkIGZyb20gcmV0cmFuc21pc3Npb25zIG9mIHRoZSBmaW5hbCByZXNwb25zZS5cbiAgICAgICAgICAgICAgICAvLyBodHRwczovL3Rvb2xzLmlldGYub3JnL2h0bWwvcmZjMzI2MSNzZWN0aW9uLTE3LjIuMVxuICAgICAgICAgICAgICAgIGlmIChyZXF1ZXN0Lm1ldGhvZCA9PT0gQy5JTlZJVEUgfHwgcmVxdWVzdC5tZXRob2QgPT09IEMuQUNLKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIFRyYW5zYWN0aW9uU3RhdGUuVGVybWluYXRlZDpcbiAgICAgICAgICAgICAgICAvLyBGb3IgZ29vZCBtZWFzdXJlIGFic29yYiBhbnkgYWRkaXRpb25hbCBtZXNzYWdlcyB0aGF0IGFycml2ZSAoc2hvdWxkIG5vdCBoYXBwZW4pLlxuICAgICAgICAgICAgICAgIGlmIChyZXF1ZXN0Lm1ldGhvZCA9PT0gQy5JTlZJVEUgfHwgcmVxdWVzdC5tZXRob2QgPT09IEMuQUNLKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVyb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AgICAgICAgICAgICAgICAgICAgdGhpcy5sYXN0RmluYWxSZXNwb25zZSA9IHJlc3BvbnNlO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnN0YXRlVHJhbnNpdGlvbihUcmFuc2FjdGlvblN0YXRlLkNvbXBsZXRlZCk7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuc2VuZChyZXNwb25zZSkuY2F0Y2goKGVycm9yKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZ1RyYW5zcG9ydEVycm9yKGVycm9yLCBcIkZhaWxlZCB0byBzZW5kIG5vbi0yeHggZmluYWwgcmVzcG9uc2UuXCIpO1xuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgVHJhbnNhY3Rpb25TdGF0ZS5BY2NlcHRlZDpcbiAgICAgICAgICAgICAgICAvLyBXaGlsZSBpbiB0aGUgXCJBY2NlcHRlZFwiIHN0YXRlLCBpZiB0aGUgVFUgcGFzc2VzIGEgMnh4IHJlc3BvbnNlLFxuICAgICAgICAgICAgICAgIC8vIHRoZSBzZXJ2ZXIgdHJhbnNhY3Rpb24gTVVTVCBwYXNzIHRoZSByZXNwb25zZSB0byB0aGUgdHJhbnNwb3J0IGxheWVyIGZvciB0cmFuc21pc3Npb24uXG4gICAgICAgICAgICAgICAgLy8gaHR0cHM6Ly90b29scy5pZXRmLm9yZy9odG1sL3JmYzYwMjYjc2VjdGlvbi04LjdcbiAgICAgICAgICAgICAgICBpZiAoc3RhdHVzQ29kZSA+PSAyMDAgJiYgc3RhdHVzQ29kZSA8PSAyOTkpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5zZW5kKHJlc3BvbnNlKS5jYXRjaCgoZXJyb3IpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMubG9nVHJhbnN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aXRjaCAodGhpcy5zdGF0ZSkge1xuICAgICAgICAgICAgY2FzZSBUcmFuc2FjdGlvblN0YXRlLlRyeWluZzpcbiAgICAgICAgICAgICAgICAvLyBJZiBhIHByb3Zpc2lvbmFsIHJlc3BvbnNlIGlzIHJlY2VpdmVkIHdoaWxlIGluIHRoZSBcIlRyeWluZ1wiIHN0YXRlLCB0aGVcbiAgICAgICAgICAgICAgICAvLyByZXNwb25zZSBNVVNUIGJlIHBhc3NlZCB0byB0aGUgVFUsIGFuZCB0aGVuIHRoZSBjbGllbnQgdHJhbnNhY3Rpb25cbiAgICAgICAgICAgICAgICAvLyBTSE9VTEQgbW92ZSB0byB0aGUgXCJQcm9jZWVkaW5nXCIgc3RhdGUuXG4gICAgICAgICAgICAgICAgLy8gaHR0cHM6Ly90b29scy5pZXRmLm9yZy9odG1sL3JmYzMyNjEjc2VjdGlvbi0xNy4xLjIuMlxuICAgICAgICAgICAgICAgIGlmIChzdGF0dXNDb2RlID49IDEwMCAmJiBzdGF0dXNDb2RlIDw9IDE5OSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnN0YXRlVHJhbnNpdGlvbihUcmFuc2FjdGlvblN0YXRlLlByb2NlZWRpbmcpO1xuICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy51c2VyLnJlY2VpdmVSZXNwb25zZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy51c2VyLnJlY2VpdmVSZXNwb25zZShyZXNwb25zZSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAvLyBJZiBhIGZpbmFsIHJlc3BvbnNlIChzdGF0dXMgY29kZXMgMjAwLTY5OSkgaXMgcmVjZWl2ZWQgd2hpbGUgaW4gdGhlXG4gICAgICAgICAgICAgICAgLy8gXCJUcnlpbmdcIiBzdGF0ZSwgdGhlIHJlc3BvbnNlIE1VU1QgYmUgcGFzc2VkIHRvIHRoZSBUVSwgYW5kIHRoZVxuICAgICAgICAgICAgICAgIC8vIGNsaWVudCB0cmFuc2FjdGlvbiBNVVNUIHRyYW5zaXRpb24gdG8gdGhlIFwiQ29tcGxldGVkXCIgc3RhdGUuXG4gICAgICAgICAgICAgICAgLy8gaHR0cHM6Ly90b29scy5pZXRmLm9yZy9odG1sL3JmYzMyNjEjc2VjdGlvbi0xNy4xLjIuMlxuICAgICAgICAgICAgICAgIGlmIChzdGF0dXNDb2RlID49IDIwMCAmJiBzdGF0dXNDb2RlIDw9IDY5OSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnN0YXRlVHJhbnNpdGlvbihUcmFuc2FjdGlvblN0YXRlLkNvbXBsZXRlZCk7XG4gICAgICAgICAgICAgICAgICAgIGlmIChzdGF0dXNDb2RlID09PSA0MDgpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMub25SZXF1ZXN0VGltZW91dCgpO1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLnVzZXIucmVjZWl2ZVJlc3BvbnNlKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnVzZXIucmVjZWl2ZVJlc3BvbnNlKHJlc3BvbnNlKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBUcmFuc2FjdGlvblN0YXRlLlByb2NlZWRpbmc6XG4gICAgICAgICAgICAgICAgLy8gSWYgYSBwcm92aXNpb25hbCByZXNwb25zZSBpcyByZWNlaXZlZCB3aGlsZSBpbiB0aGUgXCJQcm9jZWVkaW5nXCIgc3RhdGUsXG4gICAgICAgICAgICAgICAgLy8gdGhlIHJlc3BvbnNlIE1VU1QgYmUgcGFzc2VkIHRvIHRoZSBUVS4gKEZyb20gRmlndXJlIDYpXG4gICAgICAgICAgICAgICAgLy8gaHR0cHM6Ly90b29scy5pZXRmLm9yZy9odG1sL3JmYzMyNjEjc2VjdGlvbi0xNy4xLjIuMlxuICAgICAgICAgICAgICAgIGlmIChzdGF0dXNDb2RlID49IDEwMCAmJiBzdGF0dXNDb2RlIDw9IDE5OSkge1xuICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy51c2VyLnJlY2VpdmVSZXNwb25zZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMudXNlci5yZWNlaXZlUmVzcG9uc2UocmVzcG9uc2UpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIC8vIElmIGEgZmluYWwgcmVzcG9uc2UgKHN0YXR1cyBjb2RlcyAyMDAtNjk5KSBpcyByZWNlaXZlZCB3aGlsZSBpbiB0aGVcbiAgICAgICAgICAgICAgICAvLyBcIlByb2NlZWRpbmdcIiBzdGF0ZSwgdGhlIHJlc3BvbnNlIE1VU1QgYmUgcGFzc2VkIHRvIHRoZSBUVSwgYW5kIHRoZVxuICAgICAgICAgICAgICAgIC8vIGNsaWVudCB0cmFuc2FjdGlvbiBNVVNUIHRyYW5zaXRpb24gdG8gdGhlIFwiQ29tcGxldGVkXCIgc3RhdGUuXG4gICAgICAgICAgICAgICAgLy8gaHR0cHM6Ly90b29scy5pZXRmLm9yZy9odG1sL3JmYzMyNjEjc2VjdGlvbi0xNy4xLjIuMlxuICAgICAgICAgICAgICAgIGlmIChzdGF0dXNDb2RlID49IDIwMCAmJiBzdGF0dXNDb2RlIDw9IDY5OSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnN0YXRlVHJhbnNpdGlvbihUcmFuc2FjdGlvblN0YXRlLkNvbXBsZXRlZCk7XG4gICAgICAgICAgICAgICAgICAgIGlmIChzdGF0dXNDb2RlID09PSA0MDgpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMub25SZXF1ZXN0VGltZW91dCgpO1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLnVzZXIucmVjZWl2ZVJlc3BvbnNlKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnVzZXIucmVjZWl2ZVJlc3BvbnNlKHJlc3BvbnNlKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBUcmFuc2FjdGlvblN0YXRlLkNvbXBsZXRlZDpcbiAgICAgICAgICAgICAgICAvLyBUaGUgXCJDb21wbGV0ZWRcIiBzdGF0ZSBleGlzdHMgdG8gYnVmZmVyIGFueSBhZGRpdGlvbmFsIHJlc3BvbnNlXG4gICAgICAgICAgICAgICAgLy8gcmV0cmFuc21pc3Npb25zIHRoYXQgbWF5IGJlIHJlY2VpdmVkICh3aGljaCBpcyB3aHkgdGhlIGNsaWVudFxuICAgICAgICAgICAgICAgIC8vIHRyYW5zYWN0aW9uIHJlbWFpbnMgdGhlcmUgb25seSBmb3IgdW5yZWxpYWJsZSB0cmFuc3BvcnRzKS5cbiAgICAgICAgICAgICAgICAvLyBodHRwczovL3Rvb2xzLmlldGYub3JnL2h0bWwvcmZjMzI2MSNzZWN0aW9uLTE3LjEuMi4yXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgY2FzZSBUcmFuc2FjdGlvblN0YXRlLlRlcm1pbmF0ZWQ6XG4gICAgICAgICAgICAgICAgLy8gRm9yIGdvb2QgbWVhc3VyZSBqdXN0IGFic29yYiBhZGRpdGlvbmFsIHJlc3BvbnNlIHJldHJhbnNtaXNzaW9ucy5cbiAgICAgICAgICAgICAgICByZXR1cm47XG4g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ICAgICBjYXNlIFRyYW5zYWN0aW9uU3RhdGUuQ29tcGxldGVkOlxuICAgICAgICAgICAgICAgIGlmICh0aGlzLnN0YXRlICE9PSBUcmFuc2FjdGlvblN0YXRlLlRyeWluZyAmJiB0aGlzLnN0YXRlICE9PSBUcmFuc2FjdGlvblN0YXRlLlByb2NlZWRpbmcpIHtcbiAgICAgICAgICAgICAgICAgICAgaW52YWxpZFN0YXRlVHJhbnNpdGlvbigpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgVHJhbnNhY3Rpb25TdGF0ZS5UZXJtaW5hdGVkOlxuICAgICAgICAgICAgICAgIGlmICh0aGlzLnN0YXRlICE9PSBUcmFuc2FjdGlvblN0YXRlLlRyeWluZyAmJlxuICAgICAgICAgICAgICAgICAgICB0aGlzLnN0YXRlICE9PSBUcmFuc2FjdGlvblN0YXRlLlByb2NlZWRpbmcgJiZcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5zdGF0ZSAhPT0gVHJhbnNhY3Rpb25TdGF0ZS5Db21wbGV0ZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFkdWVUb1RyYW5zcG9ydEVycm9yKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBpbnZhbGlkU3RhdGVUcmFuc2l0aW9uKCk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgIGludmFsaWRTdGF0ZVRyYW5zaXRpb24oKTtcbiAgICAgICAgfVxuICAgICAgICAvLyBPbmNlIHRoZSBjbGllbnQgdHJhbnNhY3Rpb24gZW50ZXJzIHRoZSBcIkNvbXBsZXRlZFwiIHN0YXRlLCBpdCBNVVNUIHNldFxuICAgICAgICAvLyBUaW1lciBLIHRvIGZpcmUgaW4gVDQgc2Vjb25kcyBmb3Igd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ICAgICAgICAgICAgIC8vIHRoZSBcIlByb2NlZWRpbmdcIiBzdGF0ZSwgdGhlIHRyYW5zYWN0aW9uIE1VU1QgZW50ZXIgdGhlIFwiQ29tcGxldGVkXCIgc3RhdGUsIGFuZFxuICAgICAgICAgICAgICAgIC8vIHRoZSByZXNwb25zZSBNVVNUIGJlIHBhc3NlZCB0byB0aGUgdHJhbnNwb3J0IGxheWVyIGZvciB0cmFuc21pc3Npb24uXG4gICAgICAgICAgICAgICAgLy8gaHR0cHM6Ly90b29scy5pZXRmLm9yZy9odG1sL3JmYzMyNjEjc2VjdGlvbi0xNy4yLjJcbiAgICAgICAgICAgICAgICB0aGlzLmxhc3RSZXNwb25zZSA9IHJlc3BvbnNlO1xuICAgICAgICAgICAgICAgIGlmIChzdGF0dXNDb2RlID49IDIwMCAmJiBzdGF0dXNDb2RlIDw9IDY5OSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnN0YXRlVHJhbnNpdGlvbihUcmFuc2FjdGlvblN0YXRlLkNvbXBsZXRlZCk7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuc2VuZChyZXNwb25zZSkuY2F0Y2goKGVycm9yKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZ1RyYW5zcG9ydEVycm9yKGVycm9yLCBcIkZhaWxlZCB0byBzZW5kIGZpbmFsIHJlc3BvbnNlLlwiKTtcbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIFRyYW5zYWN0aW9uU3RhdGUuQ29tcGxldGVkOlxuICAgICAgICAgICAgICAgIC8vIEFueSBvdGhlciBmaW5hbCByZXNwb25zZXMgcGFzc2VkIGJ5IHRoZSBUVSB0byB0aGUgc2VydmVyXG4gICAgICAgICAgICAgICAgLy8gdHJhbnNhY3Rpb24gTVVTVCBiZSBk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hdGUuUHJvY2VlZGluZzpcbiAgICAgICAgICAgICAgICBpZiAodGhpcy5zdGF0ZSAhPT0gVHJhbnNhY3Rpb25TdGF0ZS5UcnlpbmcpIHtcbiAgICAgICAgICAgICAgICAgICAgaW52YWxpZFN0YXRlVHJhbnNpdGlvbigpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgVHJhbnNhY3Rpb25TdGF0ZS5Db21wbGV0ZWQ6XG4gICAgICAgICAgICAgICAgaWYgKHRoaXMuc3RhdGUgIT09IFRyYW5zYWN0aW9uU3RhdGUuVHJ5aW5nICYmIHRoaXMuc3RhdGUgIT09IFRyYW5zYWN0aW9uU3RhdGUuUHJvY2VlZGluZykge1xuICAgICAgICAgICAgICAgICAgICBpbnZhbGlkU3RhdGVUcmFuc2l0aW9uKCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBUcmFuc2FjdGlvblN0YXRlLlRlcm1pbmF0ZWQ6XG4gICAgICAgICAgICAgICAgaWYgKHRoaXMuc3RhdGUgIT09IFRyYW5zYWN0aW9uU3RhdGUuUHJvY2VlZGluZyAmJiB0aGlzLnN0YXRlICE9PSBUcmFuc2FjdGlvblN0YXRlLkNvbXBsZXRlZCkge1xuICAgICAgICAgICAgICAgICAgICBpZiAoIWR1ZVRvVHJhbnNwb3J0RXJyb3IpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGludmFsaWRTdGF0ZVRyYW5zaXRpb24oKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgaW52YWxpZFN0YXRlVHJhbnNpdGlvbigpO1xuICAgICAgICB9XG4gICAgICAgIC8vIFdoZW4gdGhlIHNlcnZlciB0cmFuc2FjdGlvb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GVhZGVyID0gXCJBbGxvdzogXCIgKyBBbGxvd2VkTWV0aG9kcy50b1N0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBjb25zdCBhY2NlcHRIZWFkZXIgPSBcIkFjY2VwdDogXCIgKyBhY2NlcHRlZEJvZHlUeXBlcy50b1N0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnJlcGx5U3RhdGVsZXNzKG1lc3NhZ2UsIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHN0YXR1c0NvZGU6IDIwMCxcbiAgICAgICAgICAgICAgICAgICAgICAgIGV4dHJhSGVhZGVyczogW2FsbG93SGVhZGVyLCBhY2NlcHRIZWFkZXJdXG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgQy5SRUZFUjpcbiAgICAgICAgICAgICAgICAvLyBodHRwczovL3Rvb2xzLmlldGYub3JnL2h0bWwvcmZjMzUxNSNzZWN0aW9uLTIuNC4yXG4gICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICBjb25zdCB1YXMgPSBuZXcgUmVmZXJVc2VyQWdlbnRTZXJ2ZXIodGhpcywgbWVzc2FnZSk7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZGVsZWdhdGUub25SZWZlciA/IHRoaXMuZGVsZWdhdGUub25SZWZlcih1YXMpIDogdWFzLnJlamVjdCh7IHN0YXR1c0NvZGU6IDQwNSB9KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIEMuUkVHSVNURVI6XG4gICAgICAgICAgICAgICAgLy8gaHR0cHM6Ly90b29scy5pZXRmLm9yZy9odG1sL3JmYzMyNjEjc2VjdGlvbi0xMC4zXG4gICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICBjb25zdCB1YXMgPSBuZXcgUmVnaXN0ZXJ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ICAgICAgICAgLy8gSU5WSVRFLCB3aWxsIGVzdGFibGlzaCBhIGRpYWxvZy4gIEEgZGlhbG9nIGVzdGFibGlzaGVkIGJ5IGEgbm9uLWZpbmFsXG4gICAgICAgICAgICAgICAgICAgIC8vIHJlc3BvbnNlIHRvIGEgcmVxdWVzdCBpcyBpbiB0aGUgXCJlYXJseVwiIHN0YXRlIGFuZCBpdCBpcyBjYWxsZWQgYW5cbiAgICAgICAgICAgICAgICAgICAgLy8gZWFybHkgZGlhbG9nLlxuICAgICAgICAgICAgICAgICAgICAvLyBodHRwczovL3Rvb2xzLmlldGYub3JnL2h0bWwvcmZjMzI2MSNzZWN0aW9uLTEyLjFcbiAgICAgICAgICAgICAgICAgICAgLy8gUHJvdmlzaW9uYWwgd2l0aG91dCB0byB0YWcsIG5vIGRpYWxvZyB0byBjcmVhdGUuXG4gICAgICAgICAgICAgICAgICAgIGlmICghbWVzc2FnZS50b1RhZykge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIud2FybihcIk5vbi0xMDAgMXh4IElOVklURSByZXNwb25zZSByZWNlaXZlZCB3aXRob3V0IGEgdG8gdGFnLCBkcm9wcGluZy5cIik7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgLy8gV2hlbiBhIFVBUyByZXNwb25kcyB0byBhIHJlcXVlc3Qgd2l0aCBhIHJlc3BvbnNlIHRoYXQgZXN0YWJsaXNoZXMgYVxuICAgICAgICAgICAgICAgICAgICAvLyBkaWFsb2cgKHN1Y2ggYXMgYSAyeHggdG8gSU5WSVRFKSwgdGhlIFVBUyBNVVNUIGNvcHkgYWxsIFJlY29yZC1Sb3V0ZVxuICAgICAgICAgICAgICAgICAgICAvLyBoZWFkZXIgZmllbGQgdmFsdWVzIGZyb20gdGhlIHJlcXVlc3QgaW50byB0aGUgcmVzcG9uc2UgKGluY2x1ZGluZyB0aGVcbiAgICAgICAgICAgICAgICAgICAgLy8gVVJJcywgVVJJIHBhcmFtZXRlcnMsIGFuZCBhbnkgUmVjb3JkLVJvdXRlIGhlYWRlciBmaWVsZCBwYXJhbWV0ZXJzLFxuICAgICAgICAgICAgICAgICAgICAvLyB3aGV0aGVyIHRoZXkgYXJlIGtub3duIG9yIHVua25vd24gdG8gdGhlIFVBUykgYW5kIE1VU1QgbWFpbnRhaW4gdGhlXG4gICAgICAgICAgICAgICAgICAgIC8vIG9yZGVyIG9mIHRob3NlIHZhbHVlcy4gIFRoZSBVQVMgTVVTVCBhZGQgYSBDb250YWN0IGhlYWRlciBmaWVsZCB0b1xuICAgICAgICAgICAgICAgICAgICAvLyB0aGUgcmVzcG9uc2UuXG4gICAgICAgICAgICAgICAgICAgIC8vIGh0dHBzOi8vdG9vbHMuaWV0Zi5vcmcvaHRtbC9yZmMzMjYxI3NlY3Rpb24tMTIuMS4xXG4gICAgICAgICAgICAgICAgICAgIC8vIFByb3Zpc2lvbmFsIHdpdGhvdXQgQ29udGFjdCBoZWFkZXIgZmllbGQsIG1hbGZvcm1lZCByZXNwb25zZS5cbiAgICAgICAgICAgICAgICAgICAgY29uc3QgY29udGFjdCA9IG1lc3NhZ2UucGFyc2VIZWFkZXIoXCJjb250YWN0XCIpO1xuICAgICAgICAgICAgICAgICAgICBpZiAoIWNvbnRhY3QpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLmVycm9yKFwiTm9uLTEwMCAxeHggSU5WSVRFIHJlc3BvbnNlIHJlY2VpdmVkIHdpdGhvdXQgYSBDb250YWN0IGhlYWRlciBmaWVsZCwgZHJvcHBpbmcuXCIpO1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIC8vIENvbXB1dGUgZGlhbG9nIHN0YXRlLlxuICAgICAgICAgICAgICAgICAgICBjb25zdCBkaWFsb2dTdGF0ZSA9IERpYWxvZy5pbml0aWFsRGlhbG9nU3RhdGVGb3JVc2VyQWdlbnRDbGllbnQodGhpcy5tZXNzYWdlLCBtZXNzYWdlKTtcbiAgICAgICAgICAgICAgICAgICAgLy8gSGF2ZSBleGlzdGluZyBlYXJseSBkaWFsb2cgb3IgY3JlYXRlIGEgbmV3IG9uZS5cbiAgICAgICAgICAgICAgICAgICAgbGV0IGVhcmx5RGlhbG9nID0gdGhpcy5lYXJseURpYWxvZ3MuZ2V0KGRpYWxvZ1N0YXRlLmlkKTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFlYXJseURpYWxvZykge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgdHJhbnNhY3Rpb24gPSB0aGlzLnRyYW5zYWN0aW9uO1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEodHJhbnNhY3Rpb24gaW5zdGFuY2VvZiBJbnZpdGVDbGllbnRUcmFuc2FjdGlvbikpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJUcmFuc2FjdGlvbiBub3QgaW5zdGFuY2Ugb2YgSW52aXRlQ2xpZW50VHJhbnNhY3Rpb24uXCIpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgZWFybHlEaWFsb2cgPSBuZXcgU2Vzc2lvbkRpYWxvZyh0cmFuc2FjdGlvbiwgdGhpcy5jb3JlLCBkaWFsb2dTdGF0ZSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmVhcmx5RGlhbG9ncy5zZXQoZWFybHlEaWFsb2cuaWQsIGVhcmx5RGlhbG9nKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAvLyBHdWFyZCBhZ2FpbnN0IG91dCBvZiBvcmRlciByZWxpYWJsZSBwcm92aXNpb25hbCByZXNwb25zZXMuXG4gICAgICAgICAgICAgICAgICAgIC8vIE5vdGUgdGhhdCB0a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dCByZWNlaXZlcyBhcyB0aGUgYW5zd2VyLCBhbmQgTVVTVCBpZ25vcmUgYW55XG4gICAgICAgICAgICAgICAgICAgIC8vIHNlc3Npb24gZGVzY3JpcHRpb25zIGluIHN1YnNlcXVlbnQgcmVzcG9uc2VzIHRvIHRoZSBpbml0aWFsXG4gICAgICAgICAgICAgICAgICAgIC8vIElOVklURS5cbiAgICAgICAgICAgICAgICAgICAgLy8gaHR0cHM6Ly90b29scy5pZXRmLm9yZy9odG1sL3JmYzMyNjEjc2VjdGlvbi0xMy4yLjFcbiAgICAgICAgICAgICAgICAgICAgaWYgKGVhcmx5RGlhbG9nLnNpZ25hbGluZ1N0YXRlID09PSBTaWduYWxpbmdTdGF0ZS5Jbml0aWFsIHx8XG4gICAgICAgICAgICAgICAgICAgICAgICBlYXJseURpYWxvZy5zaWduYWxpbmdTdGF0ZSA9PT0gU2lnbmFsaW5nU3RhdGUuSGF2ZUxvY2FsT2ZmZXIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGVhcmx5RGlhbG9nLnNpZ25hbGluZ1N0YXRlVHJhbnNpdGlvbihtZXNzYWdlKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAvLyBQYXNzIHJlc3BvbnNlIHRvIGRlbGVnYXRlLlxuICAgICAgICAgICAgICAgICAgICBjb25zdCBzZXNzaW9uID0gZWFybHlEaWFsb2c7XG4gICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLmRlbGVnYXRlICYmIHRoaXMuZGVsZWdhdGUub25Qcm9ncmVzcykge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5kZWxlZ2F0ZS5vblByb2dyZXNzKHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlc3Npb24sXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJhY2s6IChvcHRpb25zKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IG91dGdvaW5nUHJhY2tSZXF1ZXN0ID0gc2Vzc2lvbi5wcmFjayh1bmRlZmluZWQsIG9wdGlvbnMpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gb3V0Z29pbmdQcmFja1JlcXVlc3Q7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgY2FzZSAvXjJbMC05XXsyfSQvLnRlc3Qoc3RhdHVzQ29kZSk6XG4gICAgICAgICAgICAgICAgLy8gTXVsdGlwbGUgMnh4IHJlc3BvbnNlcyBtYXkgYXJyaXZlIGF0IHRoZSBVQUMgZm9yIGEgc2luZ2xlIElOVklURVxuICAgICAgICAgICAgICAgIC8vIHJlcXVlc3QgZHVlIHRvIGEgZm9ya2luZyBwcm94eS4gIEVhY2ggcmVzcG9uc2UgaXMgZGlzdGluZ3Vpc2hlZCBieVxuICAgICAgICAgICAgICAgIC8vIHRoZSB0YWcgcGFyYW1ldGVyIGluIHRoZSBUbyBoZWFkZXIgZmllbGQsIGFuZCBlYWNoIHJlcHJlc2VudHMgYVxuICAgICAgICAgICAgICAgIC8vIGRpc3RpbmN0IGRpYWxvZywgd2l0aCBhIGRpc3RpbmN0IGRpYWxvZyBpZGVudGlmaWVyLlxuICAgICAgICAgICAgICAgIC8vXG4gICAgICAgICAgICAgICAgLy8gSWYgdGhlIGRpYWxvZyBpZGVudGlmaWVyIGluIHRoZSAyeHggcmVzcG9uc2UgbWF0Y2hlcyB0aGUgZGlhbG9nXG4gICAgICAgICAgICAgICAgLy8gaWRlbnRpZmllciBvZiBhbiBleGlzdGluZyBkaWFsb2csIHRoZSBkaWFsb2cgTVVTVCBiZSB0cmFuc2l0aW9uZWQgdG9cbiAgICA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25vd24gb3IgdW5rbm93biB0byB0aGUgVUFTKSBhbmQgTVVTVCBtYWludGFpbiB0aGVcbiAgICAgICAgICAgICAgICAgICAgLy8gb3JkZXIgb2YgdGhvc2UgdmFsdWVzLiAgVGhlIFVBUyBNVVNUIGFkZCBhIENvbnRhY3QgaGVhZGVyIGZpZWxkIHRvXG4gICAgICAgICAgICAgICAgICAgIC8vIHRoZSByZXNwb25zZS5cbiAgICAgICAgICAgICAgICAgICAgLy8gaHR0cHM6Ly90b29scy5pZXRmLm9yZy9odG1sL3JmYzMyNjEjc2VjdGlvbi0xMi4xLjFcbiAgICAgICAgICAgICAgICAgICAgLy8gRmluYWwgd2l0aG91dCBDb250YWN0IGhlYWRlciBmaWVsZCwgbWFsZm9ybWVkIHJlc3BvbnNlLlxuICAgICAgICAgICAgICAgICAgICBjb25zdCBjb250YWN0ID0gbWVzc2FnZS5wYXJzZUhlYWRlcihcImNvbnRhY3RcIik7XG4gICAgICAgICAgICAgICAgICAgIGlmICghY29udGFjdCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIuZXJyb3IoXCIyeHggSU5WSVRFIHJlc3BvbnNlIHJlY2VpdmVkIHdpdGhvdXQgYSBDb250YWN0IGhlYWRlciBmaWVsZCwgZHJvcHBpbmcuXCIpO1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIC8vIENvbXB1dGUgZGlhbG9nIHN0YXRlLlxuICAgICAgICAgICAgICAgICAgICBjb25zdCBkaWFsb2dTdGF0ZSA9IERpYWxvZy5pbml0aWFsRGlhbG9nU3RhdGVGb3JVc2VyQWdlbnRDbGllbnQodGhpcy5tZXNzYWdlLCBtZXNzYWdlKTtcbiAgICAgICAgICAgICAgICAgICAgLy8gTk9URTogQ3VycmVudGx5IG91ciB0cmFuc2FjdGlvbiBsYXllciBpcyBjYWNoaW5nIHRoZSAyeHggQUNLcyBhb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hbnNtaXNzaW9ucyBvZiB0aGUgQUNLLCBub3QgdGhlIHRyYW5zYWN0aW9uIGxheWVyLiAgVGhlXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBBQ0sgTVVTVCBiZSBwYXNzZWQgdG8gdGhlIGNsaWVudCB0cmFuc3BvcnQgZXZlcnkgdGltZSBhXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyByZXRyYW5zbWlzc2lvbiBvZiB0aGUgMnh4IGZpbmFsIHJlc3BvbnNlIHRoYXQgdHJpZ2dlcmVkIHRoZSBBQ0tcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIGFycml2ZXMuXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBodHRwczovL3Rvb2xzLmlldGYub3JnL2h0bWwvcmZjMzI2MSNzZWN0aW9uLTEzLjIuMi40XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBvdXRnb2luZ0Fja1JlcXVlc3QgPSB0aGlzLmNvbmZpcm1lZERpYWxvZ0Fja3MuZ2V0KGRpYWxvZ1N0YXRlLmlkKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChvdXRnb2luZ0Fja1JlcXVlc3QpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCB0cmFuc2FjdGlvbiA9IHRoaXMudHJhbnNhY3Rpb247XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEodHJhbnNhY3Rpb24gaW5zdGFuY2VvZiBJbnZpdGVDbGllbnRUcmFuc2FjdGlvbikpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwiQ2xpZW50IHRyYW5zYWN0aW9uIG5vdCBpbnN0YW5jZSBvZiBJbnZpdGVDbGllbnRUcmFuc2FjdGlvbi5cIik7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYW5zYWN0aW9uLmFja1Jlc3BvbnNlKG91dGdvaW5nQWNrUmVxdWVzdC5tZXNzYWdlKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIElmIHN0aWxsIHdhaXRpbmcgZm9yIGFuIEFDSywgZHJvcCB0aGUgcmV0cmFuc21pc3Npb24gb2YgdGhlIDJ4eCBmaW5hbCByZXNwb25zZS5cbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAvLyBJZiB0aGUgZGlhbG9nIGlkZW50aWZpZXIgaW4gdGhlIDJ4eCByZXNwb25zZSBtYXRjaGVzIHRoZSBkaWFsb2dcbiAgICAgICAgICAgICAgICAgICAgLy8gaWRlbnRpZmllciBvZiBhbiBleGlzdGluZyBkaWFsb2csIHRoZSBkaWFsb2cgTVVTVCBiZSB0cmFuc2l0aW9uZWQgdG9cbiAgICAgICAgICAgICAgICAgICAgLy8gdGhlIFwiY29uZmlybWVkXCIgc3RhdGUsIGFuZCB0aGUgcm91dGUgc2V0IGZvciB0aGUgZGlhbG9nIE1VU1QgYmVcbiAgICAgICAgICAgICAgICAgICAgLy8gcmVjb21wdXRlZCBiYXNlZCBvbiB0aGUgMnh4IHJlc3BvbnNlIHVzaW5nIHRoZSBwcm9jZWR1cmVzIG9mIFNlY3Rpb25cbiAgICAgICAgICAgICAgICAgICAgLy8gMTIuMi4xLjIuIE90aGVyd2lzZSwgYSBuZXcgZGlhbG9nIGluIHRoZSBcImNvbmZpcm1lZFwiIHN0YXRlIE1VU1QgYmVcbiAgICAgICAgICAgICAgICAgICAgLy8gY29uc3RydWN0ZWQgdXNpbmcgdGhlIHByb2NlZHVyZXMgb2YgU2VjdGlvbiAxMi4xLjIuXG4gICAgICAgICAgICAgICAgICAgIC8vIGh0dHBzOi8vdG9vbHMuaWV0Zi5vcmcvaHRtbC9yZmMzMjYxI3NlY3Rpb24tMTMuMi4yLjRcbiAgICAgICAgICAgICAgICAgICAgZGlhbG9nID0gdGhpcy5lYXJseURpYWxvZ3MuZ2V0KGRpYWxvZ1N0YXRlLmlkKTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGRpYWxvZykge1xuICAgICAgICAgICAgICAgICAgICAgICAgZGlhbG9nLmNvbmZpcm0oKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGRpYWxvZy5yZWNvbXB1dGVSb3V0ZVNldChtZXNzYWdlKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZWFybHlEaWFsb2dzLmRlbGV0ZShkaWFsb2cuaWQpO1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5jb25maXJtZWREaWFsb2dzLnNldChkaWFsb2cuaWQsIGRpYWxvZyk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCB0cmFuc2FjdGlvbiA9IHRoaXMudHJhbnNhY3Rpb247XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoISh0cmFuc2FjdGlvbiBpbnN0YW5jZW9mIEludml0ZUNsaWVudFRyYW5zYWN0aW9uKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcIlRyYW5zYWN0aW9uIG5vdCBpbnN0YW5jZSBvZiBJbnZpdGVDbGllbnRUcmFuc2FjdGlvbi5cIik7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICBkaWFsb2cgPSBuZXcgU2Vzc2lvbkRpYWxvZyh0cmFuc2FjdGlvbiwgdGhpcy5jb3JlLCBkaWFsb2dTdGF0ZSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmNvbmZpcm1lZERpYWxvZ3Muc2V0KGRpYWxvZy5pZ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gYWNrbm93bGVkZ2VkLCBidXQgdGhlIENTZXEgbWV0aG9kIE1VU1RcbiAgICAgICAgICAgICAgICAgICAgLy8gYmUgQUNLLiAgVGhlIEFDSyBNVVNUIGNvbnRhaW4gdGhlIHNhbWUgY3JlZGVudGlhbHMgYXMgdGhlIElOVklURS4gIElmXG4gICAgICAgICAgICAgICAgICAgIC8vIHRoZSAyeHggY29udGFpbnMgYW4gb2ZmZXIgKGJhc2VkIG9uIHRoZSBydWxlcyBhYm92ZSksIHRoZSBBQ0sgTVVTVFxuICAgICAgICAgICAgICAgICAgICAvLyBjYXJyeSBhbiBhbnN3ZXIgaW4gaXRzIGJvZHkuICBJZiB0aGUgb2ZmZXIgaW4gdGhlIDJ4eCByZXNwb25zZSBpcyBub3RcbiAgICAgICAgICAgICAgICAgICAgLy8gYWNjZXB0YWJsZSwgdGhlIFVBQyBjb3JlIE1VU1QgZ2VuZXJhdGUgYSB2YWxpZCBhbnN3ZXIgaW4gdGhlIEFDSyBhbmRcbiAgICAgICAgICAgICAgICAgICAgLy8gdGhlbiBzZW5kIGEgQllFIGltbWVkaWF0ZWx5LlxuICAgICAgICAgICAgICAgICAgICAvLyBodHRwczovL3Rvb2xzLmlldGYub3JnL2h0bWwvcmZjMzI2MSNzZWN0aW9uLTEzLjIuMi40XG4gICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLmRlbGVnYXRlICYmIHRoaXMuZGVsZWdhdGUub25BY2NlcHQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZGVsZWdhdGUub25BY2NlcHQoe1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2Vzc2lvbixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhY2s6IChvcHRpb25zKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IG91dGdvaW5nQWNrUmVxdWVzdCA9IHNlc3Npb24uYWNrKG9wdGlvbnMpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmNvbmZpcm1lZERpYWxvZ0Fja3Muc2V0KHNlc3Npb24uaWQsIG91dGdvaW5nQWNrUmVxdWVzdCk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvdXRnb2luZ0Fja1JlcXVlc3Q7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBvdXRnb2luZ0Fja1JlcXVlc3QgPSBzZXNzaW9uLmFjaygpO1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5jb25maXJtZWREaWFsb2dBY2tzLnNldChzZXNzaW9uLmlkLCBvdXRnb2luZ0Fja1JlcXVlc3QpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIGNhc2UgL14zWzAtOV17Mn0kLy50ZXN0KHN0YXR1c0NvZGUpOlxuICAgICAgICAgICAgICAgIC8vIDEyLjMgVGVybWluYXRpb24gb2YgYSBEaWFsb2dcbiAgICAgICAgICAgICAgICAvL1xuICAgICAgICAgICAgICAgIC8vIEluZGVwZW5kZW50IG9mIHRoZSBtZXRob2QsIGlmIGEgcmVxdWVzdCBvdXRzaWRlIG9mIGEgZGlhbG9nIGdlbmVyYXRlc1xuICAgICAgICAgICAgICAgIC8vIGEgbm9uLTJ4eCBmaW5hbCByZXNwb25zZSwgYW55IGVhcmx5IGRpYWxvZ3MgY3JlYXRlZCB0aHJvdWdoXG4gICAgICAgICAgICAgICAgLy8gcHJvdmlzaW9uYWwgcmVzcG9uc2VzIHRvIHRoYXQgcmVxdWVzdCBhcmUgdGVybWluYXRlZC4gIFRo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yxcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBAdHlwZXNjcmlwdC1lc2xpbnQvbm8tdW51c2VkLXZhcnNcbiAgICAgICAgICAgICAgICAgICAgICAgIHByYWNrOiAob3B0aW9ucykgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcIlVuaW1wbGVtZW50ZWQuXCIpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIC9eMlswLTldezJ9JC8udGVzdChzdGF0dXNDb2RlKTpcbiAgICAgICAgICAgICAgICAvLyBVcGRhdGUgZGlhbG9nIHNpZ25hbGluZyBzdGF0ZSB3aXRoIG9mZmVyL2Fuc3dlciBpbiBib2R5XG4gICAgICAgICAgICAgICAgdGhpcy5kaWFsb2cuc2lnbmFsaW5nU3RhdGVUcmFuc2l0aW9uKG1lc3NhZ2UpO1xuICAgICAgICAgICAgICAgIGlmICh0aGlzLmRlbGVnYXRlICYmIHRoaXMuZGVsZWdhdGUub25BY2NlcHQpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5kZWxlZ2F0ZS5vbkFjY2VwdCh7XG4gICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLFxuICAgICAgICAgICAgICAgICAgICAgICAgc2Vzc2lvbjogdGhpcy5kaWFsb2csXG4gICAgICAgICAgICAgICAgICAgICAgICBhY2s6IChvcHRpb25zKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgb3V0Z29pbmdBY2tSZXF1ZXN0ID0gdGhpcy5kaWFsb2cuYWNrKG9wdGlvbnMpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvdXRnb2luZ0Fja1JlcXVlc3Q7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgL14zWzAtOV17Mn0kLy50ZXN0KHN0YXR1c0NvZGUpOlxuICAgICAgICAgICAgICAgIHRoaXMuZGlhbG9nLnNpZ25hbGluZ1N0YXRlUm9sbGJhY2soKTtcbiAgICAgICAgICAgICAgICB0aGlzLmRpYWxvZy5yZWludml0ZVVzZXJBZ2VudENsaWVudCA9IHVuZGVmaW5lZDsgLy8gQUNLIHdhcyBoYW5kbGVkIGJ5IHRyYW5zYWN0aW9uXG4gICAgICAgICAgICAgICAgaWYgKHRoaXMuZGVsZWdhdGUgJiYgdGhpcy5kZWxlZ2F0ZS5vblJlZGlyZWN0KSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZGVsZWdhdGUub25SZWRpcmVjdCh7IG1lc3NhZ2UgfSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSAvXls0LTZdWzAtOV17Mn0kLy50ZXN0KHN0YXR1c0NvZGUpOlxuICAgICAgICAgICAgICAgIHRoaXMuZGlhbG9nLnNpZ25hbGluZ1N0YXRlUm9sbGJhY2soKTtcbiAgICAgICAgICAgICAgICB0aGlzLmRpYWxvZy5yZWludml0ZVVzZXJBZ2VudENsaWVudCA9IHVuZGVmaW5lZDsgLy8gQUNLIHdhcyBoYW5kbGVkIGJ5IHRyYW5zYWN0aW9uXG4gICAgICAgICAgICAgICAgaWYgKHRoaXMuZGVsZWdhdGUgJiYgdGhpcy5kZWxlZ2F0ZS5vblJlamVjdCkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmRlbGVnYXRlLm9uUmVqZWN0KHsgbWVzc2FnZSB9KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAg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MgdGhlIG93bmVyIG9mIHRoZSBDYWxsLUlEIG9mIHRoZSBkaWFsb2cgSURcbiAgICAgICAgICAgICAgICAgICAgLy8gICAgICAgKG1lYW5pbmcgaXQgZ2VuZXJhdGVkIHRoZSB2YWx1ZSksIFQgaGFzIGEgcmFuZG9tbHkgY2hvc2VuIHZhbHVlXG4gICAgICAgICAgICAgICAgICAgIC8vICAgICAgIGJldHdlZW4gMi4xIGFuZCA0IHNlY29uZHMgaW4gdW5pdHMgb2YgMTAgbXMuXG4gICAgICAgICAgICAgICAgICAgIC8vXG4gICAgICAgICAgICAgICAgICAgIC8vICAgIDIuIElmIHRoZSBVQUMgaXMgbm90IHRoZSBvd25lciBvZiB0aGUgQ2FsbC1JRCBvZiB0aGUgZGlhbG9nIElELCBUXG4gICAgICAgICAgICAgICAgICAgIC8vICAgICAgIGhhcyBhIHJhbmRvbWx5IGNob3NlbiB2YWx1ZSBvZiBiZXR3ZWVuIDAgYW5kIDIgc2Vjb25kcyBpbiB1bml0c1xuICAgICAgICAgICAgICAgICAgICAvLyAgICAgICBvZiAxMCBtcy5cbiAgICAgICAgICAgICAgICAgICAgLy9cbiAgICAgICAgICAgICAgICAgICAgLy8gV2hlbiB0aGUgdGltZXIgZmlyZXMsIHRoZSBVQUMgU0hPVUxEIGF0dGVtcHQgdGhlIHJlLUlOVklURSBvbmNlIG1vcmUsXG4gICAgICAgICAgICAgICAgICAgIC8vIGlmIGl0IHN0aWxsIGRlc2lyZXMgZm9yIHRoYXQgc2Vzc2lvbiBtb2RpZmljYXRpb24gdG8gdGFrZSBwbGFjZS4gIEZvclxuICAgICAgICAgICAgICAgICAgICAvLyBleGFtcGxlLCBpZiB0aGUgY2FsbCB3YXMgYWxyZWFkeSBodW5nIHVwIHdpdGggYSBCWUUsIHRoZSByZS1JTlZJVEVcbiAgICAgICAgICAgICAgICAgICAgLy8gd291bGQgbm90IHRha2UgcGxhY2UuXG4gICAgICAgICAgICAgICAgICAgIC8vIGh0dHBzOi8vdG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xuICAgICAgICAgICAgICAgICAgICB0aGlzLmRlbGVnYXRlLm9uUmVqZWN0KHsgbWVzc2FnZSB9KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihgSW52YWxpZCBzdGF0dXMgY29kZSAke3N0YXR1c0NvZGV9YCk7XG4gICAgICAgIH1cbiAgICB9XG4gICAgaW5pdCgpIHtcbiAgICAgICAgLy8gV2UgYXJlIHRoZSB0cmFuc2FjdGlvbiB1c2VyLlxuICAgICAgICBjb25zdCB1c2VyID0ge1xuICAgICAgICAgICAgbG9nZ2VyRmFjdG9yeTogdGhpcy5sb2dnZXJGYWN0b3J5LFxuICAgICAgICAgICAgb25SZXF1ZXN0VGltZW91dDogKCkgPT4gdGhpcy5vblJlcXVlc3RUaW1lb3V0KCksXG4gICAgICAgICAgICBvblN0YXRlQ2hhbmdlOiAobmV3U3RhdGUpID0+IHtcbiAgICAgICAgICAgICAgICBpZiAobmV3U3RhdGUgPT09IFRyYW5zYWN0aW9uU3RhdGUuVGVybWluYXRlZCkge1xuICAgICAgICAgICAgICAgICAgICAvLyBSZW1vdmUgdGhlIHRlcm1pbmF0ZWQgdHJhbnNhY3Rpb24gZnJvbSB0aGUgY29yZS5cbiAgICAgICAgICAgICAgICAgICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIEB0eXBlc2NyaXB0LWVzbGludC9uby11c2UtYmVmb3JlLWRlZmluZVxuICAgICAgICAgICAgICAgICAgICB0aGlzLmNvcmUudXNlckFnZW50Q2xpZW50cy5kZWxldGUodXNlckFnZW50Q2xpZW50SWQpO1xuICAgICAgICAgICAgICAgICAgICAvLyBGSVhNRTogSEFDSzogT3VyIHRyYW5zYWN0aW9uIG1heSBoYXZlIGJlZW4gc3dhcHBlZCBvdXQgd2l0aCBhIG5ldyBvbmVcbiAgICAgICAgICAgICAgICAg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dGUgPT09IFRyYW5zYWN0aW9uU3RhdGUuVGVybWluYXRlZCkge1xuICAgICAgICAgICAgICAgICAgICAvLyBSZW1vdmUgdGhlIHRlcm1pbmF0ZWQgdHJhbnNhY3Rpb24gZnJvbSB0aGUgY29yZS5cbiAgICAgICAgICAgICAgICAgICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIEB0eXBlc2NyaXB0LWVzbGludC9uby11c2UtYmVmb3JlLWRlZmluZVxuICAgICAgICAgICAgICAgICAgICB0aGlzLmNvcmUudXNlckFnZW50U2VydmVycy5kZWxldGUodXNlckFnZW50U2VydmVySWQpO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmRpc3Bvc2UoKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgb25UcmFuc3BvcnRFcnJvcjogKGVycm9yKSA9PiB7XG4gICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIuZXJyb3IoZXJyb3IubWVzc2FnZSk7XG4gICAgICAgICAgICAgICAgaWYgKHRoaXMuZGVsZWdhdGUgJiYgdGhpcy5kZWxlZ2F0ZS5vblRyYW5zcG9ydEVycm9yKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZGVsZWdhdGUub25UcmFuc3BvcnRFcnJvcihlcnJvcik7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5lcnJvcihcIlVzZXIgYWdlbnQgc2VydmVyIHJlc3BvbnNlIHRyYW5zcG9ydCBlcnJvci5cIik7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9O1xuICAgICAgICAvLyBDcmVhdGUgYSBuZXcgdHJhbnNhY3Rpb24gd2l0aCB1cyBhcyB0aGUgdXNlci5cbiAgICAgICAgY29uc3QgdHJhbnNhY3Rpb24gPSBuZXcgdGhpcy50cmFuc2FjdGlvbkNvbnN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Ym9keSArPSBcIjtcIiArIHBhcmFtZXRlcjtcbiAgICAgICAgICAgICAgICBpZiAodGhpcy5wYXJhbWV0ZXJzW3BhcmFtZXRlcl0gIT09IG51bGwpIHtcbiAgICAgICAgICAgICAgICAgICAgYm9keSArPSBcIj1cIiArIHRoaXMucGFyYW1ldGVyc1twYXJhbWV0ZXJdO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gYm9keTtcbiAgICB9XG59XG4iLCIvKipcbiAqIEBpbnRlcm5hbFxuICovXG5leHBvcnQgY2xhc3MgUGFyYW1ldGVycyB7XG4gICAgY29uc3RydWN0b3IocGFyYW1ldGVycykge1xuICAgICAgICB0aGlzLnBhcmFtZXRlcnMgPSB7fTtcbiAgICAgICAgLy8gZm9yIGluIGlzIHJlcXVpcmVkIGhlcmUgYXMgdGhlIEdyYW1tYXIgcGFyc2VyIGlzIGFkZGluZyB0byB0aGUgcHJvdG90eXBlIGNoYWluXG4gICAgICAgIGZvciAoY29uc3QgcGFyYW0gaW4gcGFyYW1ldGVycykge1xuICAgICAgICAgICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIG5vLXByb3RvdHlwZS1idWlsdGluc1xuICAgICAgICAgICAgaWYgKHBhcmFtZXRlcnMuaGFzT3duUHJvcGVydHkocGFyYW0pKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5zZXRQYXJhbShwYXJhbSwgcGFyYW1ldGVyc1twYXJhbV0pO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxuICAgIHNldFBhcmFtKGtleSwgdmFsdWUpIHtcbiAgICAgICAgaWYgKGtleSkge1xuICAgICAgICAgICAgdGhpcy5wYXJhbWV0ZXJzW2tleS50b0xvd2VyQ2FzZSgpXSA9ICh0eXBlb2YgdmFsdWUgPT09IFwidW5kZWZpbmVkXCIgfHwgdmFsdWUgPT09IG51bGwpID8gbnVsbCA6IHZhbHVlLnRvU3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AgIHJldHVybiBjaC5jaGFyQ29kZUF0KDApLnRvU3RyaW5nKDE2KS50b1VwcGVyQ2FzZSgpO1xuICAgICAgICB9XG4gICAgICAgIGZ1bmN0aW9uIGxpdGVyYWxFc2NhcGUocykge1xuICAgICAgICAgICAgcmV0dXJuIHNcbiAgICAgICAgICAgICAgICAucmVwbGFjZSgvXFxcXC9nLCBcIlxcXFxcXFxcXCIpXG4gICAgICAgICAgICAgICAgLnJlcGxhY2UoL1wiL2csIFwiXFxcXFxcXCJcIilcbiAgICAgICAgICAgICAgICAucmVwbGFjZSgvXFwwL2csIFwiXFxcXDBcIilcbiAgICAgICAgICAgICAgICAucmVwbGFjZSgvXFx0L2csIFwiXFxcXHRcIilcbiAgICAgICAgICAgICAgICAucmVwbGFjZSgvXFxuL2csIFwiXFxcXG5cIilcbiAgICAgICAgICAgICAgICAucmVwbGFjZSgvXFxyL2csIFwiXFxcXHJcIilcbiAgICAgICAgICAgICAgICAucmVwbGFjZSgvW1xceDAwLVxceDBGXS9nLCAoY2gpID0+IFwiXFxcXHgwXCIgKyBoZXgoY2gpKVxuICAgICAgICAgICAgICAgIC5yZXBsYWNlKC9bXFx4MTAtXFx4MUZcXHg3Ri1cXHg5Rl0vZywgKGNoKSA9PiBcIlxcXFx4XCIgKyBoZXgoY2gpKTtcbiAgICAgICAgfVxuICAgICAgICBmdW5jdGlvbiBjbGFzc0VzY2FwZShzKSB7XG4gICAgICAgICAgICByZXR1cm4gc1xuICAgICAgICAgICAgICAgIC5yZXBsYWNlKC9cXFxcL2csIFwiXFxcXFxcXFxcIilcbiAgICAgICAgICAgICAgICAucmVwbGFjZSgvXFxdL2csIFwiXFxcXF1cIilcbiAgICAgICAgICAgICAgICAucmVwbGFjZSgvXFxeL2csIFwiXFxcXF5cIilcbiAgICAgICAgICAgICAgICAucmVwbGFjZSgvLS9nLCBcIlxcXFwtXCIpXG4gICAgICAgICAgICAgICAgLnJlcGxhY2UoL1xcMC9nLCBcIlxcXFwwXCIpXG4gICAgICAgICAgICAgICAgLnJlcGxhY2UoL1xcdC9nLCBcIlxcXFx0XCIpXG4gICAgICAgICAgICAgICAgLnJlcGxhY2UoL1xcbi9nLCBcIlxcXFxuXCIpXG4gICAgICAgICAgICAgICAgLnJlcGxhY2UoL1xcci9nLCBcIlxcXFxyXCIpXG4gICAgICAgICAgICAgICAgLnJlcGxhY2UoL1tcXHgwMC1cXHgwRl0vZywgKGNoKSA9PiBcIlxcXFx4MFwiICsgaGV4KGNoKSlcbiAgICAgICAgICAgICAgICAucmVwbGFjZSgvW1xceDEwLVxceDFGXFx4N0YtXFx4OUZdL2csIChjaCkgPT4gXCJcXFxceFwiICsgaGV4KGNoKSk7XG4gICAgICAgIH1cbiAgICAgICAgZnVuY3Rpb24gZGVzY3JpYmVFeHBlY3RhdGlvbihleHBlY3RhdGlvbikge1xuICAgICAgICAgICAgc3dpdGNoIChleHBlY3RhdGlvbi50eXBlKSB7XG4gICAgICAgICAgICAgICAgY2FzZSBcImxpdGVyYWxcIjpcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFwiXFxcIlwiICsgbGl0ZXJhbEVzY2FwZShleHBlY3RhdGlvbi50ZXh0KSArIFwiXFxcIlwiO1xuICAgICAgICAgICAgICAgIGNhc2UgXCJjbGFzc1wiOlxuICAgICAgICAgICAgICAgICAgICBjb25zdCBlc2NhcGVkUGFydHMgPSBleHBlY3RhdGlvbi5wYXJ0cy5tYXAoKHBhcnQpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBcnJheS5pc0FycmF5KHBhcnQpXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgPyBjbGFzc0VzY2FwZShwYXJ0WzBdKSArIFwiLVwiICsgY2xhc3NFc2NhcGUocGFydFsxXSlcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICA6IGNsYXNzRXNjYXBlKHBhcnQpO1xuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFwiW1wiICsgKGV4cGVjdGF0aW9uLmludmVydGVkID8gXCJeXCIgOiBcIlwiKSArIGVzY2FwZWRQYXJ0cyArIFwiXVwiO1xuICAgICAgICAgICAgICAgIGNhc2UgXCJhbnlcIjpcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFwiYW55IGNoYXJhY3RlclwiO1xuICAgICAgICAgICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFwiZW5kIG9mIGlucHV0XCI7XG4gICAgICAgICAgICAgICAgY2FzZSBcIm90aGVyXCI6XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBleHBlY3RhdGlvbi5kZXNjcmlwdGlvbjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBmdW5jdGlvbiBkZXNjcmliZUV4cGVjdGVkKGV4cGVjdGVkMSkge1xuICAgICAgICAgICAgY29uc3QgZGVzY3JpcHRpb25zID0gZXhwZWN0ZWQxLm1hcChkZXNjcmliZUV4cGVjdGF0aW9uKTtcbiAgICAgICAgICAgIGxldCBpO1xuICAgICAgICAgICAgbGV0IGo7XG4gICAgICAgICAgICBkZXNjcmlwdGlvbnMuc29ydCgpO1xuICAgICAgICAgICAgaWYgKGRlc2NyaXB0aW9ucy5sZW5ndGggPiAwKSB7XG4gICAgICAgICAgICAgICAgZm9yIChpID0gMSwgaiA9IDE7IGkgPCBkZXNjcmlwdGlvbnMubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGRlc2NyaXB0aW9uc1tpIC0gMV0gIT09IGRlc2NyaXB0aW9uc1tpXSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgZGVzY3JpcHRpb25zW2pdID0gZGVzY3JpcHRpb25zW2ldO1xuICAgICAgICAgICAgICAgICAgICAgICAgaisrO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGRlc2NyaXB0aW9ucy5sZW5ndGggPSBqO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgc3dpdGNoIChkZXNjcmlwdGlvbnMubGVuZ3RoKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gZGVzY3JpcHRpb25zWzBdO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGRlc2NyaXB0aW9uc1swXSArIFwiIG9yIFwiICsgZGVzY3JpcHRpb25zWzFdO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBkZXNjcmlwdGlvbnMuc2xpY2UoMCwgLTEpLmpvaW4oXCIsIFwiKVxuICAgICAgICAgICAgICAgICAgICAgICAgKyBcIiwgb3IgXCJcbiAgICAgICAgICAgICAgICAgICAgICAgICsgZGVzY3JpcHRpb25zW2Rlc2NyaXB0aW9ucy5sZW5ndGggLSAxXTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBmdW5jdGlvbiBkZXNjcmliZUZvdW5kKGZvdW5kMSkge1xuICAgICAgICAgICAgcmV0dXJuIGZvdW5kMSA/IFwiXFxcIlwiICsgbGl0ZXJhbEVzY2FwZShmb3VuZDEpICsgXCJcXFwiXCIgOiBcImVuZCBvZiBpbnB1dFwiO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBcIkV4cGVjdGVkIFwiICsgZGVzY3JpYmVFeHBlY3RlZChleHBlY3RlZCkgKyBcIiBidXQgXCIgKyBkZXNjcmliZUZvdW5kKGZvdW5kKSArIFwiIGZvdW5kLlwiO1xuICAgIH1cbiAgICBmb3JtYXQoc291cmNlcykge1xuICAgICAgICBsZXQgc3RyID0gJ0Vycm9yOiAnICsgdGhpcy5tZXNzYWdlO1xuICAgICAgICBpZiAodGhpcy5sb2NhdGlvbikge1xuICAgICAgICAgICAgbGV0IHNyYyA9IG51bGw7XG4gICAgICAgICAgICBsZXQgaztcbiAgICAgICAgICAgIGZvciAoayA9IDA7IGsgPCBzb3VyY2VzLmxlbmd0aDsgaysrKSB7XG4gICAgICAgICAgICAgICAgaWYgKHNvdXJjZXNba10uc291cmNlID09PSB0aGlzLmxvY2F0aW9uLnNvdXJjZSkge1xuICAgICAgICAgICAgICAgICAgICBzcmMgPSBzb3VyY2VzW2tdLnRleHQuc3BsaXQoL1xcclxcbnxcXG58XFxyL2cpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBsZXQgcyA9IHRoaXMubG9jYXRpb24uc3RhcnQ7XG4gICAgICAgICAgICBsZXQgbG9jID0gdGhpcy5sb2NhdGlvbi5zb3VyY2UgKyAnOicgKyBzLmxpbmUgKyAnOicgKyBzLmNvbHVtbjtcbiAgICAgICAgICAgIGlmIChzcmMpIHtcbiAgICAgICAgICAgICAgICBsZXQgZSA9IHRoaXMubG9jYXRpb24uZW5kO1xuICAgICAgICAgICAgICAgIGxldCBmaWxsZXIgPSBwZWckcGFkRW5kKCcnLCBzLmxpbmUudG9TdHJpbmcoKS5sZW5ndGgsICcgJyk7XG4gICAgICAgICAgICAgICAgbGV0IGxpbmUgPSBzcmNbcy5saW5lIC0gMV07XG4gICAgICAgICAgICAgICAgbGV0IGxhc3QgPSBzLmxpbmUgPT09IGUubGluZSA/IGUuY29sdW1uIDogbGluZS5sZW5ndGggKyAxO1xuICAgICAgICAgICAgICAgIHN0ciArPSAnXFxuIC0tPiAnICsgbG9jICsgJ1xcbicgKyBmaWxsZXIgKyAnIHxcXG4nICsgcy5saW5lICsgJyB8ICcgKyBsaW5lICsgJ1xcbicgKyBmaWxsZXIgKyAnIHwgJyArXG4gICAgICAgICAgICAgICAgICAgIHBlZyRwYWRFbmQoJycsIHMuY29sdW1uIC0gMSwgJyAnKSArXG4gICAgICAgICAgICAgICAgICAgIHBlZyRwYWRFbmQoJycsIGxhc3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RhOiB7fSB9O1xuICAgICAgICAgICAgaWYgKCFvcHRpb25zLmRhdGEucGFyYW1zKVxuICAgICAgICAgICAgICAgIG9wdGlvbnMuZGF0YS5wYXJhbXMgPSB7fTtcbiAgICAgICAgICAgIG9wdGlvbnMuZGF0YS5wYXJhbXNbJ3R0bCddID0gdHRsO1xuICAgICAgICB9LFxuICAgICAgICBcIm1hZGRyPVwiLFxuICAgICAgICBwZWckbGl0ZXJhbEV4cGVjdGF0aW9uKFwibWFkZHI9XCIsIHRydWUpLFxuICAgICAgICBmdW5jdGlvbiAobWFkZHIpIHtcbiAgICAgICAgICAgIG9wdGlvbnMgPSBvcHRpb25zIHx8IHsgZGF0YToge30gfTtcbiAgICAgICAgICAgIGlmICghb3B0aW9ucy5kYXRhLnVyaV9wYXJhbXMpXG4gICAgICAgICAgICAgICAgb3B0aW9ucy5kYXRhLnVyaV9wYXJhbXMgPSB7fTtcbiAgICAgICAgICAgIG9wdGlvbnMuZGF0YS51cmlfcGFyYW1zWydtYWRkciddID0gbWFkZHI7XG4gICAgICAgIH0sXG4gICAgICAgIFwibHJcIixcbiAgICAgICAgcGVnJGxpdGVyYWxFeHBlY3RhdGlvbihcImxyXCIsIHRydWUpLFxuICAgICAgICBmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICBvcHRpb25zID0gb3B0aW9ucyB8fCB7IGRhdGE6IHt9IH07XG4gICAgICAgICAgICBpZiAoIW9wdGlvbnMuZGF0YS51cmlfcGFyYW1zKVxuICAgICAgICAgICAgICAgIG9wdGlvbnMuZGF0YS51cmlfcGFyYW1zID0ge307XG4gICAgICAgICAgICBvcHRpb25zLmRhdGEudXJpX3BhcmFtc1snbHInXSA9IHVuZGVmaW5lZDtcbiAgICAgICAgfSxcbiAgICAgICAgZnVuY3Rpb24gKHBhcmFtLCB2YWx1ZSkge1xuICAgICAgICAgICAgb3B0aW9ucyA9IG9wdGlvbnMgfHwgeyBkYXRhOiB7fSB9O1xuICAgICAgICAgICAgaWYgKCFvcHRpb25zLmRhdGEudXJpX3BhcmFtcylcbiAgICAgICAgICAgICAgICBvcHRpb25zLmRhdGEudXJpX3BhcmFtcyA9IHt9O1xuICAgICAgICAgICAgaWYgKHZhbHVlID09PSBudWxsKSB7XG4gICAgICAgICAgICAgICAgdmFsdWUgPSB1bmRlZmluZWQ7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICB2YWx1ZSA9IHZhbHVlWzFdO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgb3B0aW9ucy5kYXRhLnVyaV9wYXJhbXNbcGFyYW0udG9Mb3dlckNhc2UoKV0gPSB2YWx1ZTtcbiAgICAgICAgfSxcbiAgICAgICAgZnVuY3Rpb24gKGhuYW1lLCBodmFsdWUpIHtcbiAgICAgICAgICAgIGhuYW1lID0gaG5hbWUuam9pbignJykudG9Mb3dlckNhc2UoKTtcbiAgICAgICAgICAgIGh2YWx1ZSA9IGh2YWx1ZS5qb2luKCcnKTtcbiAgICAgICAgICAgIG9wdGlvbnMgPSBvcHRpb25zIHx8IHsgZGF0YToge30gfTtcbiAgICAgICAgICAgIGlmICghb3B0aW9ucy5kYXRhLnVyaV9oZWFkZXJzKVxuICAgICAgICAgICAgICAgIG9wdGlvbnMuZGF0YS51cmlfaGVhZGVycyA9IHt9O1xuICAgICAgICAgICAgaWYgKCFvcHRpb25zLmRhdGEudXJpX2hlYWRlcnNbaG5hbWVdKSB7XG4gICAgICAgICAgICAgICAgb3B0aW9ucy5kYXRhLnVyaV9oZWFkZXJzW2huYW1lXSA9IFtodmFsdWVdO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgb3B0aW9ucy5kYXRhLnVyaV9oZWFkZXJzW2huYW1lXS5wdXNoKGh2YWx1ZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgIG9wdGlvbn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dWx0aV9oZWFkZXIubGVuZ3RoO1xuICAgICAgICAgICAgZm9yIChpZHggPSAwOyBpZHggPCBsZW5ndGg7IGlkeCsrKSB7XG4gICAgICAgICAgICAgICAgaWYgKG9wdGlvbnMuZGF0YS5tdWx0aV9oZWFkZXJbaWR4XS5wYXJzZWQgPT09IG51bGwpIHtcbiAgICAgICAgICAgICAgICAgICAgb3B0aW9ucy5kYXRhID0gbnVsbDtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKG9wdGlvbnMuZGF0YSAhPT0gbnVsbCkge1xuICAgICAgICAgICAgICAgIG9wdGlvbnMuZGF0YSA9IG9wdGlvbnMuZGF0YS5tdWx0aV9oZWFkZXI7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICBvcHRpb25zLmRhdGEgPSAtMTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgdmFyIGhlYWRlcjtcbiAgICAgICAgICAgIG9wdGlvbnMgPSBvcHRpb25zIHx8IHsgZGF0YToge30gfTtcbiAgICAgICAgICAgIGlmICghb3B0aW9ucy5kYXRhLm11bHRpX2hlYWRlcilcbiAgICAgICAgICAgICAgICBvcHRpb25zLmRhdGEubXVsdGlfaGVhZGVyID0gW107XG4gICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgIGhlYWRlciA9IG5ldyBOYW1lQWRkckhlYWRlcihvcHRpb25zLmRhdGEudXJpLCBvcHRpb25zLmRhdGEuZGlzcGxheU5hbWUsIG9wdGlvbnMuZGF0YS5wYXJhbXMpO1xuICAgICAgICAgICAgICAgIGRlbGV0ZSBvcHRpb25zLmRhdGEudXJpO1xuICAgICAgICAgICAgICAgIGRlbGV0ZSBvcHRpb25zLmRhdGEuZGlzcGxheU5hbWU7XG4gICAgICAgICAgICAgICAgZGVsZXRlIG9wdGlvbnMuZGF0YS5wYXJhbXM7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBjYXRjaCAoZSkge1xuICAgICAgICAgICAgICAgIGhlYWRlciA9IG51bGw7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBvcHRpb25zLmRhdGEubXVsdGlfaGVhZGVyLnB1c2goeyAncG9zaXRpb24nOiBwZWckY3VyclBvcyxcbiAgICAgICAgICAgICAgICAnb2Zmc2V0JzogbG9jYXRpb24oKS5zdGFydC5vZmZzZXQsXG4gICAgICAgICAgICAgICAgJ3BhcnNlZCc6IGhlYWRlclxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH0sXG4gICAgICAgIGZ1bmN0aW9uIChkaXNwbGF5TmFtZSkge1xuICAgICAgICAgICAgZGlzcGxheU5hbWUgPSB0ZXh0KCkudHJpbSgpO1xuICAgICAgICAgICAgaWYgKGRpc3BsYXlOYW1lWzBdID09PSAnXFxcIicpIHtcbiAgICAgICAgICAgICAgICBkaXNwbGF5TmFtZSA9IGRpc3BsYXlOYW1lLnN1YnN0cmluZygxLCBkaXNwbGF5TmFtZS5sZW5ndGggLSAxKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIG9wdGlvbnMgPSBvcHRpb25zIHx8IHsgZGF0YToge30gfTtcbiAgICAgICAgICAgIG9wdGlvbnMuZGF0YS5kaXNwbGF5TmFtZSA9IGRpc3BsYXlOYW1lO1xuICAgICAgICB9LFxuICAgICAgICBcInFcIixcbiAgICAgICAgcGVnJGxpdGVyYWxFeHBlY3RhdGlvbihcInFcIiwgdHJ1ZSksXG4gICAgICAgIGZ1bmN0aW9uIChxKSB7XG4gICAgICAgICAgICBvcHRpb25zID0gb3B0aW9ucyB8fCB7IGRhdGE6IHt9IH07XG4gICAgICAgICAgICBpZiAoIW9wdGlvbnMuZGF0YS5wYXJhbXMpXG4gICAgICAgICAgICAgICAgb3B0aW9ucy5kYXRhLnBhcmFtcyA9IHt9O1xuICAgICAgICAgICAgb3B0aW9ucy5kYXRhLnBhcmFtc1sncSddID0gcTtcbiAgICAgICAgfSxcbiAgICAgICAgXCJleHBpcmVzXCIsXG4gICAgICAgIHBlZyRsaXRlcmFsRXhwZWN0YXRpb24oXCJleHBpcmVzXCIsIHRydWUpLFxuICAgICAgICBmdW5jdGlvbiAoZXhwaXJlcykge1xuICAgICAgICAgICAgb3B0aW9ucyA9IG9wdGlvbnMgfHwgeyBkYXRhOiB7fSB9O1xuICAgICAgICAgICAgaWYgKCFvcHRpb25zLmRhdGEucGFyYW1zKVxuICAgICAgICAgICAgICAgIG9wdGlvbnMuZGF0YS5wYXJhbXMgPSB7fTtcbiAgICAgICAgICAgIG9wdGlvbnMuZGF0YS5wYXJhbXNbJ2V4cGlyZXMnXSA9IGV4cGlyZXM7XG4gICAgICAgIH0sXG4gICAgICAgIGZ1bmN0aW9uIChkZWx0YV9zZWNvbmRzKSB7XG4gICAgICAgICAgICByZXR1cm4gcGFyc2VJbnQoZGVsdGFfc2Vjb25kcy5qb2luKCcnKSk7XG4gICAgICAgIH0sXG4gICAgICAgIFwiMFwiLFxuICAgICAgICBwZWckbGl0ZXJhbEV4cGVjdGF0aW9uKFwiMFwiLCBmYWxzZSksXG4gICAgICAgIGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgIHJldHVybiBwYXJzZUZsb2F0KHRleHQoKSk7XG4gICAgICAgIH0sXG4gICAgICAgIGZ1bmN0aW9uIChwYXJhbSwgdmFsdWUpIHtcbiAgICAgICAgICAgIG9wdGlvbnMgPSBvcHRpb25zIHx8IHsgZGF0YToge30gfTtcbiAgICAgICAgICAgIGlmICghb3B0aW9ucy5kYXRhLnBhcmFtcylcbiAgICAgICAgICAgICAgICBvcHRpb25zLmRhdGEucGFyYW1zID0ge307XG4gICAgICAgICAgICBpZiAodmFsdWUgPT09IG51bGwpIHtcbiAgICAgICAgICAgICAgICB2YWx1ZSA9IHVuZGVmaW5lZDtcbiAgICAgICAgICAgIH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ocmFja192YWx1ZS5qb2luKCcnKSk7XG4gICAgICAgIH0sXG4gICAgICAgIGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgIHZhciBpZHgsIGxlbmd0aDtcbiAgICAgICAgICAgIG9wdGlvbnMgPSBvcHRpb25zIHx8IHsgZGF0YToge30gfTtcbiAgICAgICAgICAgIGxlbmd0aCA9IG9wdGlvbnMuZGF0YS5tdWx0aV9oZWFkZXIubGVuZ3RoO1xuICAgICAgICAgICAgZm9yIChpZHggPSAwOyBpZHggPCBsZW5ndGg7IGlkeCsrKSB7XG4gICAgICAgICAgICAgICAgaWYgKG9wdGlvbnMuZGF0YS5tdWx0aV9oZWFkZXJbaWR4XS5wYXJzZWQgPT09IG51bGwpIHtcbiAgICAgICAgICAgICAgICAgICAgb3B0aW9ucy5kYXRhID0gbnVsbDtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKG9wdGlvbnMuZGF0YSAhPT0gbnVsbCkge1xuICAgICAgICAgICAgICAgIG9wdGlvbnMuZGF0YSA9IG9wdGlvbnMuZGF0YS5tdWx0aV9oZWFkZXI7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICBvcHRpb25zLmRhdGEgPSAtMTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgdmFyIGhlYWRlcjtcbiAgICAgICAgICAgIG9wdGlvbnMgPSBvcHRpb25zIHx8IHsgZGF0YToge30gfTtcbiAgICAgICAgICAgIGlmICghb3B0aW9ucy5kYXRhLm11bHRpX2hlYWRlcilcbiAgICAgICAgICAgICAgICBvcHRpb25zLmRhdGEubXVsdGlfaGVhZGVyID0gW107XG4gICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgIGhlYWRlciA9IG5ldyBOYW1lQWRkckhlYWRlcihvcHRpb25zLmRhdGEudXJpLCBvcHRpb25zLmRhdGEuZGlzcGxheU5hbWUsIG9wdGlvbnMuZGF0YS5wYXJhbXMpO1xuICAgICAgICAgICAgICAgIGRlbGV0ZSBvcHRpb25zLmRhdGEudXJpO1xuICAgICAgICAgICAgICAgIGRlbGV0ZSBvcHRpb25zLmRhdGEuZGlzcGxheU5hbWU7XG4gICAgICAgICAgICAgICAgZGVsZXRlIG9wdGlvbnMuZGF0YS5wYXJhbXM7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBjYXRjaCAoZSkge1xuICAgICAgICAgICAgICAgIGhlYWRlciA9IG51bGw7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBvcHRpb25zLmRhdGEubXVsdGlfaGVhZGVyLnB1c2goeyAncG9zaXRpb24nOiBwZWckY3VyclBvcyxcbiAgICAgICAgICAgICAgICAnb2Zmc2V0JzogbG9jYXRpb24oKS5zdGFydC5vZmZzZXQsXG4gICAgICAgICAgICAgICAgJ3BhcnNlZCc6IGhlYWRlclxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH0sXG4gICAgICAgIGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgIG9wdGlvbnMgPSBvcHRpb25zIHx8IHsgZGF0YToge30gfTtcbiAgICAgICAgICAgIG9wdGlvbnMuZGF0YSA9IG5ldyBOYW1lQWRkckhlYWRlcihvcHRpb25zLmRhdGEudXJpLCBvcHRpb25zLmRhdGEuZGlzcGxheU5hbWUsIG9wdGlvbnMuZGF0YS5wYXJhbXMpO1xuICAgICAgICB9LFxuICAgICAgICBmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICBvcHRpb25zID0gb3B0aW9ucyB8fCB7IGRhdGE6IHt9IH07XG4gICAgICAgICAgICBpZiAoIShvcHRpb25zLmRhdGEucmVwbGFjZXNfZnJvbV90YWcgJiYgb3B0aW9ucy5kYXRhLnJlcGxhY2VzX3RvX3RhZykpIHtcbiAgICAgICAgICAgICAgICBvcHRpb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46IGRldGFpbHMuY29sdW1uXG4gICAgICAgICAgICB9O1xuICAgICAgICAgICAgd2hpbGUgKHAgPCBwb3MpIHtcbiAgICAgICAgICAgICAgICBpZiAoaW5wdXQuY2hhckNvZGVBdChwKSA9PT0gMTApIHtcbiAgICAgICAgICAgICAgICAgICAgZGV0YWlscy5saW5lKys7XG4gICAgICAgICAgICAgICAgICAgIGRldGFpbHMuY29sdW1uID0gMTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIGRldGFpbHMuY29sdW1uKys7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHArKztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHBlZyRwb3NEZXRhaWxzQ2FjaGVbcG9zXSA9IGRldGFpbHM7XG4gICAgICAgICAgICByZXR1cm4gZGV0YWlscztcbiAgICAgICAgfVxuICAgIH1cbiAgICBmdW5jdGlvbiBwZWckY29tcHV0ZUxvY2F0aW9uKHN0YXJ0UG9zLCBlbmRQb3MpIHtcbiAgICAgICAgY29uc3Qgc3RhcnRQb3NEZXRhaWxzID0gcGVnJGNvbXB1dGVQb3NEZXRhaWxzKHN0YXJ0UG9zKTtcbiAgICAgICAgY29uc3QgZW5kUG9zRGV0YWlscyA9IHBlZyRjb21wdXRlUG9zRGV0YWlscyhlbmRQb3MpO1xuICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgc291cmNlOiBwZWckc291cmNlLFxuICAgICAgICAgICAgc3RhcnQ6IHtcbiAgICAgICAgICAgICAgICBvZmZzZXQ6IHN0YXJ0UG9zLFxuICAgICAgICAgICAgICAgIGxpbmU6IHN0YXJ0UG9zRGV0YWlscy5saW5lLFxuICAgICAgICAgICAgICAgIGNvbHVtbjogc3RhcnRQb3NEZXRhaWxzLmNvbHVtblxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGVuZDoge1xuICAgICAgICAgICAgICAgIG9mZnNldDogZW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XG4gICAgfVxuICAgIGZ1bmN0aW9uIHBlZyRwYXJzZVJ1bGUoaW5kZXgpIHtcbiAgICAgICAgY29uc3QgYmMgPSBwZWckYnl0ZWNvZGVbaW5kZXhdO1xuICAgICAgICBsZXQgaXAgPSAwO1xuICAgICAgICBjb25zdCBpcHMgPSBbXTtcbiAgICAgICAgbGV0IGVuZCA9IGJjLmxlbmd0aDtcbiAgICAgICAgY29uc3QgZW5kcyA9IFtdO1xuICAgICAgICBjb25zdCBzdGFjayA9IFtdO1xuICAgICAgICBsZXQgcGFyYW1zO1xuICAgICAgICB3aGlsZSAodHJ1ZSkge1xuICAgICAgICAgICAgd2hpbGUgKGlwIDwgZW5kKSB7XG4gICAgICAgICAgICAgICAgc3dpdGNoIChiY1tpcF0pIHtcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAwOlxuICAgICAgICAgICAgICAgICAgICAgICAgc3RhY2sucHVzaChwZWckY29uc3RzW2JjW2lwICsgMV1dKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlwICs9IDI7XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICAgICAgc3RhY2sucHVzaCh1bmRlZmluZWQpO1xuICAgICAgICAgICAgICAgICAgICAgICAgaXArKztcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgICAgICBzdGFjay5wdXNoKG51bGwpO1xuICAgICAgICAgICAgICAgICAgICAgICAgaXArKztcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgICAgICBzdGFjay5wdXNoKHBlZyRGQUlMRUQpO1xuICAgICAgICAgICAgICAgICAgICAgICAgaXArKztcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgICAgICBzdGFjay5wdXNoKFtdKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlwKys7XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICAgICAgc3RhY2sucHVzaChwZWckY3VyclBvcyk7XG4gICAgICAgICAgICAgICAgICAgICAgICBpcCsrO1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgICAgIHN0YWNrLnBvcCgpO1xuICAgICAgICAgICAgICAgICAgICAgICAgaXArKztcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICBjYXNlIDc6XG4gICAgICAgICAgICAgICAgICAgICAgICBwZWckY3VyclBvcyA9IHN0YWNrLnBvcCgpO1xuICAgICAgICAgICAgICAgICAgICAgICAgaXArKztcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICBjYXNlIDg6XG4gICAgICAgICAgICAgICAgICAgICAgICBzdGFjay5sZW5ndGggLT0gYmNbaXAgKyAxXTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlwICs9IDI7XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgY2FzZSA5OlxuICAgICAgICAgICAgICAgICAgICAgICAgc3RhY2suc3BsaWNlKC0yLCAxKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlwKys7XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAxMDpcbiAgICAgICAgICAgICAgICAgICAgICAgIHN0YWNrW3N0YWNrLmxlbmd0aCAtIDJdLnB1c2goc3RhY2sucG9wKCkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgaXArKztcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICBjYXNlIDExOlxuICAgICAgICAgICAgICAgICAgICAgICAgc3RhY2sucHVzaChzdGFjay5zcGxpY2Uoc3RhY2subGVuZ3RoIC0gYmNbaXAgKyAxXSwgYmNbaXAgKyAxXSkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgaXAgKz0gMjtcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICBjYXNlIDEyOlxuICAgICAgICAgICAgICAgICAgICAgICAgc3RhY2sucHVzaChpbnB1dC5zdWJzdHJpbmcoc3RhY2sucG9wKCksIHBlZyRjdXJyUG9zKSk7XG4gICAgICAgICAgICAgICAgICAgICAgICBpcCsrO1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgMTM6XG4gICAgICAgICAgICAgICAgICAgICAgICBlbmRzLnB1c2goZW5kKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlwcy5wdXNoKGlwICsgMyArIGJjW2lwICsgMV0gKyBiY1tpcCArIDJdKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzdGFja1tzdGFjay5sZW5ndGggLSAxXSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVuZCA9IGlwICsgMyArIGJjW2lwICsgMV07XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaXAgKz0gMztcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVuZCA9IGlwICsgMyArIGJjW2lwICsgMV0gKyBiY1tpcCArIDJdO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlwICs9IDMgKyBiY1tpcCArIDFdO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgMTQ6XG4gICAgICAgICAgICAgICAgICAgICAgICBlbmRzLnB1c2goZW5kKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlwcy5wdXNoKGlwICsgMyArIGJjW2lwICsgMV0gKyBiY1tpcCArIDJdKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzdGFja1tzdGFjay5sZW5ndGggLSAxXSA9PT0gcGVnJEZBSUxFRCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVuZCA9IGlwICsgMyArIGJjW2lwICsgMV07XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaXAgKz0gMztcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVuZCA9IGlwICsgMyArIGJjW2lwICsgMV0gKyBiY1tpcCArIDJdO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlwICs9IDMgKyBiY1tpcCArIDFdO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgMTU6XG4gICAgICAgICAgICAgICAgICAgICAgICBlbmRzLnB1c2goZW5kKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlwcy5wdXNoKGlwICsgMyArIGJjW2lwICsgMV0gKyBiY1tpcCArIDJdKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzdGFja1tzdGFjay5sZW5ndGggLSAxXSAhPT0gcGVnJEZBSUxFRCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVuZCA9IGlwICsgMyArIGJjW2lwICsgMV07XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaXAgKz0gMztcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVuZCA9IGlwICsgMyArIGJjW2lwICsgMV0gKyBiY1tpcCArIDJdO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlwICs9IDMgKyBiY1tpcCArIDFdO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgMTY6XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoc3RhY2tbc3RhY2subGVuZ3RoIC0gMV0gIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbmRzLnB1c2goZW5kKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpcHMucHVzaChpcCk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5kID0gaXAgKyAyICsgYmNbaXAgKyAxXTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpcCArPSAyO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaXAgKz0gMiArIGJjW2lwICsgMV07XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAxNzpcbiAgICAgICAgICAgICAgICAgICAgICAgIGVuZHMucHVzaChlbmQpO1xuICAgICAgICAgICAgICAgICAgICAgICAgaXBzLnB1c2goaXAgKyAzICsgYmNbaXAgKyAxXSArIGJjW2lwICsgMl0pO1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGlucHV0Lmxlbmd0aCA+IHBlZyRjdXJyUG9zKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5kID0gaXAgKyAzICsgYmNbaXAgKyAxXTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpcCArPSAzO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5kID0gaXAgKyAzICsgYmNbaXAgKyAxXSArIGJjW2lwICsgMl07XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaXAgKz0gMyArIGJjW2lwICsgMV07XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAxODpcbiAgICAgICAgICAgICAgICAgICAgICAgIGVuZHMucHVzaChlbmQpO1xuICAgICAgICAgICAgICAgICAgICAgICAgaXBzLnB1c2goaXAgKyA0ICsgYmNbaXAgKyAyXSArIGJjW2lwICsgM10pO1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGlucHV0LnN1YnN0cihwZWckY3VyclBvcywgcGVnJGNvbnN0c1tiY1tpcCArIDFdXS5sZW5ndGgpID09PSBwZWckY29uc3RzW2JjW2lwICsgMV1dKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5kID0gaXAgKyA0ICsgYmNbaXAgKyAyXTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpcCArPSA0O1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5kID0gaXAgKyA0ICsgYmNbaXAgKyAyXSArIGJjW2lwICsgM107XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaXAgKz0gNCArIGJjW2lwICsgMl07XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAxOTpcbiAgICAgICAgICAgICAgICAgICAgICAgIGVuZHMucHVzaChlbmQpO1xuICAgICAgICAgICAgICAgICAgICAgICAgaXBzLnB1c2goaXAgKyA0ICsgYmNbaXAgKyAyXSArIGJjW2lwICsgM10pO1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGlucHV0LnN1YnN0cihwZWckY3VyclBvcywgcGVnJGNvbnN0c1tiY1tpcCArIDFdXS5sZW5ndGgpLnRvTG93ZXJDYXNlKCkgPT09IHBlZyRjb25zdHNbYmNbaXAgKyAxXV0pIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbmQgPSBpcCArIDQgKyBiY1tpcCArIDJdO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlwICs9IDQ7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbmQgPSBpcCArIDQgKyBiY1tpcCArIDJdICsgYmNbaXAgKyAzXTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpcCArPSA0ICsgYmNbaXAgKyAyXTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICBjYXNlIDIwOlxuICAgICAgICAgICAgICAgICAgICAgICAgZW5kcy5wdXNoKGVuZCk7XG4gICAgICAgICAgICAgICAgICAgICAgICBpcHMucHVzaChpcCArIDQgKyBiY1tpcCArIDJdICsgYmNbaXAgKyAzXSk7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAocGVnJGNvbnN0c1tiY1tpcCArIDFdXS50ZXN0KGlucHV0LmNoYXJBdChwZWckY3VyclBvcykpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5kID0gaXAgKyA0ICsgYmNbaXAgKyAyXTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpcCArPSA0O1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5kID0gaXAgKyA0ICsgYmNbaXAgKyAyXSArIGJjW2lwICsgM107XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaXAgKz0gNCArIGJjW2lwICsgMl07XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAyMTpcbiAgICAgICAgICAgICAgICAgICAgICAgIHN0YWNrLnB1c2goaW5wdXQuc3Vic3RyKHBlZyRjdXJyUG9zLCBiY1tpcCArIDFdKSk7XG4gICAgICAgICAgICAgICAgICAgICAgICBwZWckY3VyclBvcyArPSBiY1tpcCArIDFdO1xuICAgICAgICAgICAgICAgICAgICAgICAgaXAgKz0gMjtcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICBjYXNlIDIyOlxuICAgICAgICAgICAgICAgICAgICAgICAgc3RhY2sucHVzaChwZWckY29uc3RzW2JjW2lwICsgMV1dKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zICs9IHBlZyRjb25zdHNbYmNbaXAgKyAxXV0ubGVuZ3RoO1xuICAgICAgICAgICAgICAgICAgICAgICAgaXAgKz0gMjtcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICBjYXNlIDIzOlxuICAgICAgICAgICAgICAgICAgICAgICAgc3RhY2sucHVzaChwZWckRkFJTEVEKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChwZWckc2lsZW50RmFpbHMgPT09IDApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwZWckZmFpbChwZWckY29uc3RzW2JjW2lwICsgMV1dKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIGlwICs9IDI7XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAyNDpcbiAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRzYXZlZFBvcyA9IHN0YWNrW3N0YWNrLmxlbmd0aCAtIDEgLSBiY1tpcCArIDFdXTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlwICs9IDI7XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAyNTpcbiAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRzYXZlZFBvcyA9IHBlZyRjdXJyUG9zO1xuICAgICAgICAgICAgICAgICAgICAgICAgaXArKztcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICBjYXNlIDI2OlxuICAgICAgICAgICAgICAgICAgICAgICAgcGFyYW1zID0gYmMuc2xpY2UoaXAgKyA0LCBpcCArIDQgKyBiY1tpcCArIDNdKVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5tYXAoZnVuY3Rpb24gKHApIHsgcmV0dXJuIHN0YWNrW3N0YWNrLmxlbmd0aCAtIDEgLSBwXTsgfSk7XG4gICAgICAgICAgICAgICAgICAgICAgICBzdGFjay5zcGxpY2Uoc3RhY2subGVuZ3RoIC0gYmNbaXAgKyAyXSwgYmNbaXAgKyAyXSwgcGVnJGNvbnN0c1tiY1tpcCArIDFdXS5hcHBseShudWxsLCBwYXJhbXMpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlwICs9IDQgKyBiY1tpcCArIDNdO1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgMjc6XG4gICAgICAgICAgICAgICAgICAgICAgICBzdGFjay5wdXNoKHBlZyRwYXJzZVJ1bGUoYmNbaXAgKyAxXSkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgaXAgKz0gMjtcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICBjYXNlIDI4OlxuICAgICAgICAgICAgICAgICAgICAgICAgcGVnJHNpbGVudEZhaWxzKys7XG4gICAgICAgICAgICAgICAgICAgICAgICBpcCsrO1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgMjk6XG4gICAgICAgICAgICAgICAgICAgICAgICBwZWckc2lsZW50RmFpbHMtLTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlwKys7XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcIkludmFsaWQgb3Bjb2RlOiBcIiArIGJjW2lwXSArIFwiLlwiKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoZW5kcy5sZW5ndGggPiAwKSB7XG4gICAgICAgICAgICAgICAgZW5kID0gZW5kcy5wb3AoKTtcbiAgICAgICAgICAgICAgICBpcCA9IGlwcy5wb3AoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBzdGFja1swXTtcbiAgICB9XG4gICAgb3B0aW9ucy5kYXRhID0ge307IC8vIE9iamVjdCB0byB3aGljaCBoZWFkZXIgYXR0cmlidXRlcyB3aWxsIGJlIGFzc2lnbmVkIGR1cmluZyBwYXJzaW5nXG4gICAgZnVuY3Rpb24gbGlzdChoZWFkLCB0YWlsKSB7XG4gICAgICAgIHJldHVybiBbaGVhZF0uY29uY2F0KHRhaWwpO1xuICAgIH1cbiAgICBwZWckcmVzdWx0ID0gcGVnJHBhcnNlUnVsZShwZWckc3RhcnRSdWxlSW5kZXgpO1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BAcGFyYW0gdXNlciAtXG4gICAgICogQHBhcmFtIGhvc3QgLVxuICAgICAqIEBwYXJhbSBwb3J0IC1cbiAgICAgKiBAcGFyYW0gcGFyYW1ldGVycyAtXG4gICAgICogQHBhcmFtIGhlYWRlcnMgLVxuICAgICAqL1xuICAgIGNvbnN0cnVjdG9yKHNjaGVtZSA9IFwic2lwXCIsIHVzZXIsIGhvc3QsIHBvcnQsIHBhcmFtZXRlcnMsIGhlYWRlcnMpIHtcbiAgICAgICAgc3VwZXIocGFyYW1ldGVycyB8fCB7fSk7XG4gICAgICAgIHRoaXMuaGVhZGVycyA9IHt9O1xuICAgICAgICAvLyBDaGVja3NcbiAgICAgICAgaWYgKCFob3N0KSB7XG4gICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdtaXNzaW5nIG9yIGludmFsaWQgXCJob3N0XCIgcGFyYW1ldGVyJyk7XG4gICAgICAgIH1cbiAgICAgICAgZm9yIChjb25zdCBoZWFkZXIgaW4gaGVhZGVycykge1xuICAgICAgICAgICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIG5vLXByb3RvdHlwZS1idWlsdGluc1xuICAgICAgICAgICAgaWYgKGhlYWRlcnMuaGFzT3duUHJvcGVydHkoaGVhZGVyKSkge1xuICAgICAgICAgICAgICAgIHRoaXMuc2V0SGVhZGVyKGhlYWRlciwgaGVhZGVyc1toZWFkZXJdKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICAvLyBSYXcgVVJJXG4gICAgICAgIHRoaXMucmF3ID0ge1xuICAgICAgICAgICAgc2NoZW1lLFxuICAgICAgICAgICAgdXNlcixcbiAgICAgICAgICAgIGhvc3QsXG4gICAgICAgICAgICBwb3J0XG4gICAgICAgIH07XG4gICAgICAgIC8vIE5vcm1hbGl6ZWQgVVJJXG4gICAgICAgIHRoaXMubm9ybWFsID0ge1xuICAgICAgICAgICAgc2NoZW1lOiBzY2hlbWUudG9Mb3dlckNhc2UoKSxc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8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIG5vLXByb3RvdHlwZS1idWlsdGluc1xuICAgICAgICAgICAgaWYgKHRoaXMucGFyYW1ldGVycy5oYXNPd25Qcm9wZXJ0eShwYXJhbWV0ZXIpKSB7XG4gICAgICAgICAgICAgICAgdXJpU3RyaW5nICs9IFwiO1wiICsgcGFyYW1ldGVyO1xuICAgICAgICAgICAgICAgIGlmICh0aGlzLnBhcmFtZXRlcnNbcGFyYW1ldGVyXSAhPT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICB1cmlTdHJpbmcgKz0gXCI9XCIgKyB0aGlzLnBhcmFtZXRlcnNbcGFyYW1ldGVyXTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgY29uc3QgaGVhZGVycyA9IFtdO1xuICAgICAgICBmb3IgKGNvbnN0IGhlYWRlciBpbiB0aGlzLmhlYWRlcnMpIHtcbiAgICAgICAgICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBuby1wcm90b3R5cGUtYnVpbHRpbnNcbiAgICAgICAgICAgIGlmICh0aGlzLmhlYWRlcnMuaGFzT3duUHJvcGVydHkoaGVhZGVyKSkge1xuICAgICAgICAgICAgICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBAdHlwZXNjcmlwdC1lc2xpbnQvbm8tZm9yLWluLWFycmF5XG4gICAgICAgICAgICAgICAgZm9yIChjb25zdCBpZHggaW4gdGhpcy5oZWFkZXJzW2hlYWRlcl0pIHtcbiAgICAgICAgICAgICAgICAgICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIG5vLXByb3RvdHlwZS1idWlsdGluc1xuICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5oZWFkZXJzW2hlYWRlcl0uaGFzT3duUHJvcGVydHkoaWR4KSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgaGVhZGVycy5wdXNoKGhlYWRlciArIFwiPV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2ggdGhlIGVycm9yIGJlZm9yZSB0aGUgVVJJIGlzIGNyZWF0ZWQgb3Igc29tZXN1Y2guXG4gICAgICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBuby11c2VsZXNzLWNhdGNoXG4gICAgICAgIHRyeSB7XG4gICAgICAgICAgICBkZWNvZGVkVXNlciA9IGRlY29kZVVSSUNvbXBvbmVudCh1c2VyKTtcbiAgICAgICAgfVxuICAgICAgICBjYXRjaCAoZXJyb3IpIHtcbiAgICAgICAgICAgIHRocm93IGVycm9yO1xuICAgICAgICB9XG4gICAgICAgIC8vIERvbid0IGhleC1lc2NhcGUgJzonICglM0EpLCAnKycgKCUyQiksICc/JyAoJTNGXCIpLCAnLycgKCUyRikuXG4gICAgICAgIHJldHVybiBlbmNvZGVVUklDb21wb25lbnQoZGVjb2RlZFVzZXIpXG4gICAgICAgICAgICAucmVwbGFjZSgvJTNBL2lnLCBcIjpcIilcbiAgICAgICAgICAgIC5yZXBsYWNlKC8lMkIvaWcsIFwiK1wiKVxuICAgICAgICAgICAgLnJlcGxhY2UoLyUzRi9pZywgXCI/XCIpXG4gICAgICAgICAgICAucmVwbGFjZSgvJTJGL2lnLCBcIi9cIik7XG4gICAgfVxuICAgIGhlYWRlcml6ZShzdHIpIHtcbiAgICAgICAgY29uc3QgZXhjZXB0aW9ucyA9IHtcbiAgICAgICAgICAgIFwiQ2FsbC1JZFwiOiBcIkNhbGwtSURcIixcbiAgICAgICAgICAgIFwiQ3NlcVwiOiBcIkNTZXFcIixcbiAgICAgICAgICAgIFwiTWluLVNlXCI6IFwiTWluLVNFXCIsXG4gICAgICAgICAgICBcIlJhY2tcIjogXCJSQWNrXCIsXG4gICAgICAgICAgICBcIlJzZXFcIjogXCJSU2VxXCIsXG4gICAgICAgICAgICBcIld3dy1BdXRoZW50aWNhdGVcIjogXCJXV1ctQXV0aGVudGljYXRlXCIsXG4gICAgICAgIH07XG4gICAgICAgIGNvbnN0IG5hbWUgPSBzdHIudG9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mVnRXhwLnRlc3Qoc2RwKSkge1xuICAgICAgICBsZXQgbWlkTGluZVRvUmVtb3ZlO1xuICAgICAgICBzZHAgPSBzZHAuc3BsaXQoL15tPS9nbSkuZmlsdGVyKChzZWN0aW9uKSA9PiB7XG4gICAgICAgICAgICBpZiAoc2VjdGlvbi5zdWJzdHIoMCwgZGVzY3JpcHRpb24ubGVuZ3RoKSA9PT0gZGVzY3JpcHRpb24pIHtcbiAgICAgICAgICAgICAgICBtaWRMaW5lVG9SZW1vdmUgPSBzZWN0aW9uLm1hdGNoKC9eYT1taWQ6LiokL2dtKTtcbiAgICAgICAgICAgICAgICBpZiAobWlkTGluZVRvUmVtb3ZlKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHN0ZXAgPSBtaWRMaW5lVG9SZW1vdmVbMF0ubWF0Y2goLzouKyQvZyk7XG4gICAgICAgICAgICAgICAgICAgIGlmIChzdGVwKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBtaWRMaW5lVG9SZW1vdmUgPSBzdGVwWzBdLnN1YnN0cigxKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gdHJ1ZTtcbiAgICAgICAgfSkuam9pbihcIm09XCIpO1xuICAgICAgICBjb25zdCBncm91cExpbmUgPSBzZHAubWF0Y2goZ3JvdXBSZWdFeHApO1xuICAgICAgICBpZiAoZ3JvdXBMaW5lICYmIGdyb3VwTGluZS5sZW5ndGggPT09IDEpIHtcbiAgICAgICAgICAgIGxldCBncm91cExpbmVQb3J0aW9uID0gZ3JvdXBMaW5lWzBdO1xuICAgICAgICAgICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIG5vLXVzZWxlc3MtZXNjYXBlXG4gICAgICAgICAgICBjb25zdCBncm91cFJlZ0V4cFJlcGxhY2UgPSBuZXcgUmVnRXh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JvcjtcbiAgICAgICAgfSk7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIEFwcGxpZXMgbW9kaWZpZXJzIHRvIFNEUCBwcmlvciB0byBzZXR0aW5nIHRoZSBsb2NhbCBvciByZW1vdGUgZGVzY3JpcHRpb24uXG4gICAgICogQHBhcmFtIHNkcCAtIFNEUCB0byBtb2RpZnkuXG4gICAgICogQHBhcmFtIG1vZGlmaWVycyAtIE1vZGlmaWVycyB0byBhcHBseS5cbiAgICAgKi9cbiAgICBhcHBseU1vZGlmaWVycyhzZHAsIG1vZGlmaWVycykge1xuICAgICAgICB0aGlzLmxvZ2dlci5kZWJ1ZyhcIlNlc3Npb25EZXNjcmlwdGlvbkhhbmRsZXIuYXBwbHlNb2RpZmllcnNcIik7XG4gICAgICAgIGlmICghbW9kaWZpZXJzIHx8IG1vZGlmaWVycy5sZW5ndGggPT09IDApIHtcbiAgICAgICAgICAgIHJldHVybiBQcm9taXNlLnJlc29sdmUoc2RwKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbW9kaWZpZXJzXG4gICAgICAgICAgICAucmVkdWNlKChjdXIsIG5leHQpID0+IGN1ci50aGVuKG5leHQpLCBQcm9taXNlLnJlc29sdmUoc2RwKSlcbiAgICAgICAgICAgIC50aGVuKChtb2RpZmllZCkgPT4ge1xuICAgICAgICAgICAgdGhpcy5sb2dnZXIuZGVidWcoXCJTZXNzaW9uRGVzY3JpcHRpb25IYW5kbGVyLmFwcGx5TW9kaWZpZXJzIC0gbW9kaWZpZWQgc2RwXCIpO1xuICAgICAgICAgICAgaWYgKCFtb2RpZmllZC5zZHAgfHwgIW1vZGlmaWVkLnR5cGUpIHtcbiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJJbnZhbGlkIFNEUC5cIik7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4geyBzZHA6IG1vZGlmaWVkLnNkcCwgdHlwZTogbW9kaWZpZWQudHlwZSB9O1xuICAgICAgIC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bm5lY3Rpb24pIHtcbiAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcIlBlZXIgY29ubmVjdGlvbiB1bmRlZmluZWQuXCIpO1xuICAgICAgICB9XG4gICAgICAgIGNvbnN0IHBjID0gdGhpcy5fcGVlckNvbm5lY3Rpb247XG4gICAgICAgIGNvbnN0IGxvY2FsU3RyZWFtID0gdGhpcy5fbG9jYWxNZWRpYVN0cmVhbTtcbiAgICAgICAgY29uc3QgdHJhY2tVcGRhdGVzID0gW107XG4gICAgICAgIGNvbnN0IHVwZGF0ZVRyYWNrID0gKG5ld1RyYWNrKSA9PiB7XG4gICAgICAgICAgICBjb25zdCBraW5kID0gbmV3VHJhY2sua2luZDtcbiAgICAgICAgICAgIGlmIChraW5kICE9PSBcImF1ZGlvXCIgJiYga2luZCAhPT0gXCJ2aWRlb1wiKSB7XG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKGBVbmtub3duIG5ldyB0cmFjayBraW5kICR7a2luZH0uYCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBjb25zdCBzZW5kZXIgPSBwYy5nZXRTZW5kZXJzKCkuZmluZCgoc2VuZGVyKSA9PiBzZW5kZXIudHJhY2sgJiYgc2VuZGVyLnRyYWNrLmtpbmQgPT09IGtpbmQpO1xuICAgICAgICAgICAgaWYgKHNlbmRlcikge1xuICAgICAgICAgICAgICAgIHRyYWNrVXBkYXRlcy5wdXNoKG5ldyBQcm9taXNlKChyZXNvbHZlKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLmRlYnVnKGBTZXNzaW9uRGVzY3JpcHRpb25IYW5kbGVyLnNldExvY2FsTWVkaWFTdHJlYW0gLSByZXBsYWNpbmcgc2VuZGVyICR7a2luZH0gdHJhY2tgKTtcbiAgICAgICAgICAgICAgICAgICAgcmVzb2x2ZSgpO1xuICAgICAgICAgICAgICAgIH0pLnRoZW4oKCkgPT4gc2VuZGVyXG4gICAgICAgICAgICAgICAgICAgIC5yZXBsYWNlVHJhY2sobmV3VHJhY2spXG4gICAgICAgICAgICAgICAgICAgIC50aGVuKCgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgY29uc3Qgb2xkVHJhY2sgPSBsb2NhbFN0cmVhbS5nZXRUcmFja3MoKS5maW5kKChsb2NhbFRyYWNrKSA9PiBsb2NhbFRyYWNrLmtpbmQgPT09IGtpbmQpO1xuICAgICAgICAgICAgICAgICAgICBpZiAob2xkVHJhY2spIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG9sZFRyYWNrLnN0b3AoKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGxvY2FsU3RyZWFtLnJlbW92ZVRyYWNrKG9sZFRyYWNrKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIFNlc3Npb25EZXNjcmlwdGlvbkhhbmRsZXIuZGlzcGF0Y2hSZW1vdmVUcmFja0V2ZW50KGxvY2FsU3RyZWFtLCBvbGRUcmFjayk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgbG9jYWxTdHJlYW0uYWRkVHJhY2sobmV3VHJhY2spO1xuICAgICAgICAgICAgICAgICAgICBTZXNzaW9uRGVzY3JpcHRpb25IYW5kbGVyLmRpc3BhdGNoQWRkVHJhY2tFdmVudChsb2NhbFN0cmVhbSwgbmV3VHJhY2spO1xuICAgICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICAgICAgICAgIC5jYXRjaCgoZXJyb3IpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIuZXJyb3IoYFNlc3Npb25EZXNjcmlwdGlvbkhhbmRsZXIuc2V0TG9jYWxNZWRpYVN0cmVhbSAtIGZhaWxlZCB0byByZXBsYWNlIHNlbmRlciAke2tpbmR9IHRyYWNrYCk7XG4gICAgICAgICAgICAgICAgICAgIHRocm93IGVycm9yO1xuICAgICAgICAgICAgICAgIH0pKSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICB0cmFja1VwZGF0ZXMucHVzaChuZXcgUHJvbWlzZSgocmVzb2x2ZSkgPT4ge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5kZWJ1ZyhgU2Vzc2lvbkRlc2NyaXB0aW9uSGFuZGxlci5zZXRMb2NhbE1lZGlhU3RyZWFtIC0gYWRkaW5nIHNlbmRlciAke2tpbmR9IHRyYWNrYCk7XG4gICAgICAgICAgICAgICAgICAgIHJlc29sdmUoKTtcbiAgICAgICAgICAgICAgICB9KS50aGVuKCgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgLy8gUmV2aWV3OiBjb3VsZCBtYWtlIHN0cmVhbWxlc3MgdHJhY2tzIGEgY29uZmlndXJhYmxlIG9wdGlvbj9cbiAgICAgICAgICAgICAgICAgICAgLy8gaHR0cHM6Ly9kZXZlbG9wZXIubW96aWxsYS5vcmcvZW4tVVMvZG9jcy9XZWIvQVBJL1JUQ1BlZXJDb25uZWN0aW9uL2FkZFRyYWNrI1VzYWdlX25vdGVzXG4gICAgICAgICAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBwYy5hZGRUcmFjayhuZXdUcmFjaywgbG9jYWxTdHJlYW0pO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGNhdGNoIChlcnJvcikge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIuZXJyb3IoYFNlc3Npb25EZXNjcmlwdGlvbkhhbmRsZXIuc2V0TG9jYWxNZWRpYVN0cmVhbSAtIGZhaWxlZCB0byBhZGQgc2VuZGVyICR7a2luZH0gdHJhY2tgKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IGVycm9yO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGxvY2FsU3RyZWFtLmFkZFRyYWNrKG5ld1RyYWNrKTtcbiAgICAgICAgICAgICAgIC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lY3Rpb24tNi4xXG4gICAgICAgIHN3aXRjaCAodGhpcy5fcGVlckNvbm5lY3Rpb24uc2lnbmFsaW5nU3RhdGUpIHtcbiAgICAgICAgICAgIGNhc2UgXCJzdGFibGVcIjpcbiAgICAgICAgICAgICAgICAvLyBpZiB3ZSBhcmUgc3RhYmxlLCBhc3N1bWUgd2UgYXJlIGNyZWF0aW5nIGEgbG9jYWwgb2ZmZXJcbiAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5kZWJ1ZyhcIlNlc3Npb25EZXNjcmlwdGlvbkhhbmRsZXIudXBkYXRlRGlyZWN0aW9uIC0gc2V0dGluZyBvZmZlciBkaXJlY3Rpb25cIik7XG4gICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICAvLyBkZXRlcm1pbmUgdGhlIGRpcmVjdGlvbiB0byBvZmZlciBnaXZlbiB0aGUgY3VycmVudCBkaXJlY3Rpb24gYW5kIGhvbGQgc3RhdGVcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgZGlyZWN0aW9uVG9PZmZlciA9IChjdXJyZW50RGlyZWN0aW9uKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGN1cnJlbnREaXJlY3Rpb24pIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFwiaW5hY3RpdmVcIjpcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChvcHRpb25zID09PSBudWxsIHx8IG9wdGlvbnMgPT09IHZvaWQgMCA/IHZvaWQgMCA6IG9wdGlvbnMuaG9sZCkgPyBcImluYWN0aXZlXCIgOiBcInJlY3Zvbmx5XCI7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBcInJlY3Zvbmx5XCI6XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAob3B0aW9ucyA9PT0gbnVsbCB8fCBvcHRpb25zID09PSB2b2lkIDAgPyB2b2lkIDAgOiBvcHRpb25zLmhvbGQpID8gXCJpbmFjdGl2ZVwiIDogXCJyZWN2b25seVwiO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgXCJzZW5kb25seVwiOlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKG9wdGlvbnMgPT09IG51bGwgfHwgb3B0aW9ucyA9PT0gdm9pZCAwID8gdm9pZCAwIDogb3B0aW9ucy5ob2xkKSA/IFwic2VuZG9ubHlcIiA6IFwic2VuZHJlY3ZcIjtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFwic2VuZHJlY3ZcIjpcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChvcHRpb25zID09PSBudWxsIHx8IG9wdGlvbnMgPT09IHZvaWQgMCA/IHZvaWQgMCA6IG9wdGlvbnMuaG9sZCkgPyBcInNlbmRvbmx5XCIgOiBcInNlbmRyZWN2XCI7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBcInN0b3BwZWRcIjpcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFwic3RvcHBlZFwiO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcIlNob3VsZCBuZXZlciBoYXBwZW5cIik7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgICAgIC8vIHNldCB0aGUgdHJhbnNjZWl2ZXIgZGlyZWN0aW9uIHRvIHRoZSBvZmZlciBkaXJlY3Rpb25cbiAgICAgICAgICAgICAgICAgICAgdGhpcy5fcGVlckNvbm5lY3Rpb24uZ2V0VHJhbnNjZWl2ZXJzKCkuZm9yRWFjaCgodHJhbnNjZWl2ZXIpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0cmFuc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W5nIHRoYXQgdG8gZGV0ZXJtaW5lIHRoZSBhbnN3ZXIgZGlyZWN0aW9uLlxuICAgICAgICAgICAgICAgIC8vIFdoaWxlIHRoYXQgbWF5IGJlIGZpbmUgZm9yIG91ciBjdXJyZW50IHVzZSBjYXNlcywgaXQgaXMgbm90IGEgZ2VuZXJhbGx5IGNvcnJlY3QgYXBwcm9hY2guXG4gICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICAvLyBkZXRlcm1pbmUgdGhlIG9mZmVyZWQgZGlyZWN0aW9uXG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IG9mZmVyZWREaXJlY3Rpb24gPSAoKCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZGVzY3JpcHRpb24gPSB0aGlzLl9wZWVyQ29ubmVjdGlvbi5yZW1vdGVEZXNjcmlwdGlvbjtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZGVzY3JpcHRpb24pIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJGYWlsZWQgdG8gcmVhZCByZW1vdGUgb2ZmZXJcIik7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzZWFyY2hSZXN1bHQgPSAvYT1zZW5kcmVjdlxcclxcbnxhPXNlbmRvbmx5XFxyXFxufGE9cmVjdm9ubHlcXHJcXG58YT1pbmFjdGl2ZVxcclxcbi8uZXhlYyhkZXNjcmlwdGlvbi5zZHApO1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHNlYXJjaFJlc3VsdCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoc2VhcmNoUmVzdWx0WzBdKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgXCJhPWluYWN0aXZlXFxyXFxuXCI6XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXCJpbmFjdGl2ZVwiO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFwiYT1yZWN2b25seVxcclxcblwiOlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFwicmVjdm9ubHlcIjtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBcImE9c2VuZG9ubHlcXHJcXG5cIjpcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcInNlbmRvbmx5XCI7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgXCJhPXNlbmRyZWN2XFxyXFxuXCI6XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXCJzZW5kcmVjdlwiO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwiU2hvdWxkIG5ldmVyIGhhcHBlblwiKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXCJzZW5kcmVjdlwiO1xuICAgICAgICAgICAgICAgICAgICB9KSgpO1xuICAgICAgICAgICAgICAgICAgICAvLyBkZXRlcm1pbmUgdGhlIGFuc3dlciBkaXJlY3Rpb24gYmFzZWQgb24gdGhlIG9mZmVyZWQgZGlyZWN0aW9uIGFuZCBvdXIgaG9sZCBzdGF0ZVxuICAgICAgICAgICAgICAgICAgICBjb25zdCBhbnN3ZXJEaXJlY3Rpb24gPSAoKCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChvZmZlcmVkRGlyZWN0aW9uKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBcImluYWN0aXZlXCI6XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcImluYWN0aXZlXCI7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBcInJlY3Zvbmx5XCI6XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcInNlbmRvbmx5XCI7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBcInNlbmRvbmx5XCI6XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAob3B0aW9ucyA9PT0gbnVsbCB8fCBvcHRpb25zID09PSB2b2lkIDAgPyB2b2lkIDAgOiBvcHRpb25zLmhvbGQpID8gXCJpbmFjdGl2ZVwiIDogXCJyZWN2b25seVwiO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgXCJzZW5kcmVjdlwiOlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKG9wdGlvbnMgPT09IG51bGwgfHwgb3B0aW9ucyA9PT0gdm9pZCAwID8gdm9pZCAwIDogb3B0aW9ucy5ob2xkKSA/IFwic2VuZG9ubHlcIiA6IFwic2VuZHJlY3ZcIjtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJTaG91bGQgbmV2ZXIgaGFwcGVuXCIpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9KSgpO1xuICAgICAgICAgICAgICAgICAgICAvLyBzZXQgdGhlIHRyYW5zY2VpdmVyIGRpcmVjdGlvbiB0byB0aGUgYW5zd2VyIGRpcmVjdGlvblxuICAgICAgICAgICAgICAgICAgICB0aGlzLl9wZWVyQ29ubmVjdGlvbi5nZXRUcmFuc2NlaXZlcnMoKS5mb3JFYWNoKCh0cmFuc2NlaXZlcikgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHRyYW5zY2VpdmVyLmRpcmVjdGlvbiAvKiBndWFyZGluZywgYnV0IHNob3VsZCBhbHdheXMgYmUgdHJ1ZSAqLykge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0cmFuc2NlaXZlci5kaXJlY3Rpb24gIT09IFwic3RvcHBlZFwiICYmIHRyYW5zY2VpdmVyLmRpcmVjdGlvbiAhPT0gYW5zd2VyRGlyZWN0aW9uKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYW5zY2VpdmVyLmRpcmVjdGlvbiA9IGFuc3dlckRpcmVjdGlvbjtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgXCJoYXZlLWxvY2FsLW9mZmVyXCI6XG4gICAgICAgICAgICBjYXNlIFwiaGF2ZS1sb2NhbC1wcmFuc3dlclwiOlxuICAgICAgICAgICAgY2FzZSBcImhhdmUtcmVtb3RlLXByYW5zd2VyXCI6XG4gICAgICAgICAgICBjYXNlIFwiY2xvc2VkXCI6XG4gICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgIHJldHVybiBQcm9taXNlLnJlamVjdChuZXcgRXJyb3IoXCJJbnZhbGlkIHNpZ25hbGluZyBzdGF0ZSBcIiArIHRoaXMuX3BlZXJDb25uZWN0aW9uLnNpZ25hbGluZ1N0YXRlKSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIFByb21pc2UucmVzb2x2ZSgpO1xuICAgIH1cbiAgICAvKipcbiAgICAgKiBXYWl0IGZvciBJQ0UgZ2F0aGVyaW5nIHRvIGNvbXBsZXRlLlxuICAgICAqIEBwYXJhbSByZXN0YXJ0IC0gSWYgdHJ1ZSwgd2FpdHMgaWYgY3VycmVudCBzdGF0ZSBpcyBcImNvbX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Ly8gVHJhbnNwb3J0XG4gICAgICAgIGlmICghdXNlckFnZW50T3B0aW9ucy50cmFuc3BvcnRDb25zdHJ1Y3Rvcikge1xuICAgICAgICAgICAgdXNlckFnZW50T3B0aW9ucy50cmFuc3BvcnRDb25zdHJ1Y3RvciA9IFRyYW5zcG9ydDtcbiAgICAgICAgfVxuICAgICAgICAvLyBUcmFuc3BvcnRPcHRpb25zXG4gICAgICAgIGlmICghdXNlckFnZW50T3B0aW9ucy50cmFuc3BvcnRPcHRpb25zKSB7XG4gICAgICAgICAgICB1c2VyQWdlbnRPcHRpb25zLnRyYW5zcG9ydE9wdGlvbnMgPSB7XG4gICAgICAgICAgICAgICAgc2VydmVyXG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG4gICAgICAgIC8vIFVSSVxuICAgICAgICBpZiAoIXVzZXJBZ2VudE9wdGlvbnMudXJpKSB7XG4gICAgICAgICAgICAvLyBJZiBhbiBBT1Igd2FzIHByb3ZpZGVkLCBjb252ZXJ0IGl0IHRvIGEgVVJJXG4gICAgICAgICAgICBpZiAob3B0aW9ucy5hb3IpIHtcbiAgICAgICAgICAgICAgICBjb25zdCB1cmkgPSBVc2VyQWdlbnQubWFrZVVSSShvcHRpb25zLmFvcik7XG4gICAgICAgICAgICAgICAgaWYgKCF1cmkpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKGBGYWlsZWQgdG8gY3JlYXRlIHZhbGlkIFVSSSBmcm9tICR7b3B0aW9ucy5hb3J9YCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHVzZXJBZ2VudE9wdGlvbnMudXJpID0gdXJpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIC8vIFVzZXJBZ2VudFxuICAgICAgICB0aGlzLnVzZXJBZ2VudCA9IG5ldyBVc2VyQWdlbnQodXNlckFnZW50T3B0aW9ucyk7XG4gICAgICAgIC8vIFVzZXJBZ2VudCdzIGRlbGVnYXRlX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ubmVjdGVkYCk7XG4gICAgICAgICAgICAgICAgLy8gU3RvcCBPUFRJT05TIHBpbmcgaWYgbmVlZCBiZS5cbiAgICAgICAgICAgICAgICBsZXQgb3B0aW9uc1BpbmdGYWlsdXJlID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgaWYgKHRoaXMub3B0aW9ucy5vcHRpb25zUGluZ0ludGVydmFsID4gMCkge1xuICAgICAgICAgICAgICAgICAgICBvcHRpb25zUGluZ0ZhaWx1cmUgPSB0aGlzLm9wdGlvbnNQaW5nRmFpbHVyZTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5vcHRpb25zUGluZ0ZhaWx1cmUgPSBmYWxzZTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5vcHRpb25zUGluZ1N0b3AoKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgLy8gTGV0IGRlbGdhdGUga25vdyB3ZSBoYXZlIGRpc2Nvbm5lY3RlZFxuICAgICAgICAgICAgICAgIGlmICh0aGlzLmRlbGVnYXRlICYmIHRoaXMuZGVsZWdhdGUub25TZXJ2ZXJEaXNjb25uZWN0KSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZGVsZWdhdGUub25TZXJ2ZXJEaXNjb25uZWN0KGVycm9yKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgLy8gSWYgdGhlIHVzZXIgY2FsbGVkIGBkaXNjb25uZWN0YCBhIGdyYWNlZnVsIGNsZWFudXAgd2lsbCBiZSBkb25lIHRoZXJlaW4uXG4gICAgICAgICAgICAgICAgLy8gT25seSBjbGVhbnVwIGlmIG5ldHdvcmsvc2VydmVyIGRyb3BwZWQgdGhlIGNvbm5lY3Rpb24uXG4gICAgICAgICAgICAgICAgLy8gT25seSByZWNvbm5lY3QgaWYgbmV0d29yay9zZXJ2ZXIgZHJvcHBlZCB0aGUgY29ubmVjdGlvblxuICAgICAgICAgICAgICAgIGlmIChlcnJvciB8fCBvcHRpb25zUGluZ0ZhaWx1cmUpIHtcbiAgICAgICAgICAgICAgICAgICAgLy8gVGhlcmUgaXMgbm8gdHJhbnNwb3J0IGF0IHRoaXMgcG9pbnQsIHNvIHdlIGFyZSBub3QgZXhwZWN0aW5nIHRvIGJlIGFibGUgdG9cbiAgICAgICAgICAgICAgICAgICAgLy8gc2VuZCBtZXNzYWdlcyBtdWNoIGxlc3MgZ2V0IHJlc3BvbnNlcy4gU28ganVzdCBkaXNwb3NlIG9mIGV2ZXJ5dGhpbmcgd2l0aG91dFxuICAgICAgICAgICAgICAgICAgICAvLyB3YWl0aW5nIGZvciBhbnl0aGluZyB0byBzdWNjZWVkLlxuICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5yZWdpc3RlcmVyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5sb2coYERpc3Bvc2luZyBvZiByZWdpc3RlcmVyLi4uYCk7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnJlZ2lzdGVyZXIuZGlzcG9zZSgpLmNhdGNoKChlKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIuZGVidWcoYEVycm9yIG9jY3VycmVkIGRpc3Bvc2luZyBvZiByZWdpc3RlcmVyIGFmdGVyIGNvbm5lY3Rpb24gd2l0aCBzZXJ2ZXIgd2FzIGxvc3QuYCk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIuZGVidWcoZS50b1N0cmluZygpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5yZWdpc3RlcmVyID0gdW5kZWZpbmVkO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIHRoaXMubWFuYWdlZFNlc3Npb25zXG4gICAgICAgICAgICAgICAgICAgICAgICAuc2xpY2UoKVxuICAgICAgICAgICAgICAgICAgICAgICAgLm1hcCgoZWwpID0+IGVsLnNlc3Npb24pXG4gICAgICAgICAgICAgICAgICAgICAgICAuZm9yRWFjaChhc3luYyAoc2Vzc2lvbikgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIubG9nKGBEaXNwb3Npbmcgb2Ygc2Vzc2lvbi4uLmApO1xuICAgICAgICAgICAgICAgICAgICAgICAgc2Vzc2lvbi5kaXNwb3NlKCkuY2F0Y2goKGUpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5kZWJ1ZyhgRXJyb3Igb2NjdXJyZWQgZGlzcG9zaW5nIG9mIGEgc2Vzc2lvbiBhZnRlciBjb25uZWN0aW9uIHdpdGggc2VydmVyIHdhcyBsb3N0LmApO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLmRlYnVnKGUudG9TdHJpbmcoKSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgICAgIC8vIEF0dGVtcHQgdG8gcmVjb25uZWN0IGlmIHdlIGFyZSBzdXBwb3NlZCB0byBiZSBjb25uZWN0ZWQuXG4gICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLnNob3VsZEJlQ29ubmVjdGVkKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmF0dGVtcHRSZWNvbm5lY3Rpb24oKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAvLyBIYW5kbGUgaW5jb21pbmcgaW52aXRhdGlvbnNcbiAgICAgICAgICAgIG9uSW52aXRlOiAoaW52aXRhdGlvbikgPT4ge1xuICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLmxvZyhgWyR7aW52aXRhdGlvbi5pZH1dIFJlY2VpdmVkIElOVklURWApO1xuICAgICAgICAgICAgICAgIC8vIEd1YXJkIGFnYWluc3QgYSBtYXhpbXVtIG51bWJlciBvZiBwcmUtZXhpc3Rpbmcgc2Vzc2lvbnMuXG4gICAgICAgICAgICAgICAgLy8gQW4gaW5jb21pbmcgSU5WSVRFIHJlcXVlc3QgbWF5IGJlIHJlY2VpdmVkIGF0IGFueSB0aW1lIGFuZC9vciB3aGlsZSBpbiB0aGUgcHJvY2Vzc1xuICAgICAgICAgICAgICAgIC8vIG9mIHNlbmRpbmcgYW4gb3V0Z29pbmcgSU5WSVRFIHJlcXVlc3QuIFNvIHdlIHJlamVjdCBhbnkgaW5jb21pbmcgSU5WSVRFIGluIHRob3NlIGNhc2VzLlxuICAgICAgICAgICAgICAgIGNvbnN0IG1heFNlc3Npb25zID0gdGhpcy5vcHRpb25zLm1heFNpbXVsdGFuZW91c1Nlc3Npb25zO1xuICAgICAgICAgICAgICAgIGlmIChtYXhTZXNzaW9ucyAhPT0gMCAmJiB0aGlzLm1hbmFnZWRTZXNzaW9ucy5sZW5ndGggPiBtYXhTZXNzaW9ucykge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci53YXJuKGBbJHtpbnZpdGF0aW9uLmlkfV0gU2Vzc2lvbiBhbHJlYWR5IGluIHByb2dyZXNzLCByZWplY3RpbmcgSU5WSVRFLi4uYCk7XG4gICAgICAgICAgICAgICAgICAgIGludml0YXRpb25cbiAgICAgICAgICAgICAgICAgICAgICAgIC5yZWplY3QoKVxuICAgICAgICAgICAgICAgICAgICAgICAgLnRoZW4oKCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIubG9nKGBbJHtpbnZpdGF0aW9uLmlkfV0gUmVqZWN0ZWQgSU5WSVRFYCk7XG4gICAgICAgICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICAgICAgICAgICAgICAuY2F0Y2goKGVycm9yKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5lcnJvcihgWyR7aW52aXRhdGlvbi5pZH1dIEZhaWxlZCB0byByZWplY3QgSU5WSVRFYCk7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5lcnJvcihlcnJvci50b1N0cmluZygpKTtcbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgLy8gVXNlIG91ciBjb25maWd1cmVkIGNvbnN0cmFpbnRzIGFzIG9wdGlvbnMgZm9yIGFueSBJbnZpdGVyIGNyZWF0ZWQgYXMgcmVzdWx0IG9mIGEgUkVGRVJcbiAgICAgICAgICAgICAgICBjb25zdCByZWZlcnJhbEludml0ZXJPcHRpb25zID0ge1xuICAgICAgICAgICAgICAgICAgICBzZXNzaW9uRGVzY3JpcHRpb25IYW5kbGVyT3B0aW9uczogeyBjb25zdHJhaW50czogdGhpcy5jb25zdHJhaW50cyB9XG4gICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICAvLyBJbml0aWFsaXplIG91ciBzZXNzaW9uXG4gICAgICAgICAgICAgICAgdGhpcy5pbml0U2Vzc2lvbihpbnZpdGF0aW9uLCByZWZlcnJhbEludml0ZXJPcHRpb25zKTtcbiAgICAgICAgICAgICAgICAvLyBEZWxlZ2F0ZVxuICAgICAgICAgICAgICAgIGlmICh0aGlzLmRlbGVnYXRlICYmIHRoaXMuZGVsZWdhdGUub25DYWxsUmVjZWl2ZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5kZWxlZ2F0ZS5vbkNhbGxSZWNlaXZlZChpbnZpdGF0aW9uKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLndhcm4oYFske2ludml0YXRpb24uaWR9XSBObyBoYW5kbGVyIGF2YWlsYWJsZSwgcmVqZWN0aW5nIElOVklURS4uLmApO1xuICAgICAgICAgICAgICAgICAgICBpbnZpdGF0aW9uXG4gICAgICAgICAgICAgICAgICAgICAgICAucmVqZWN0KClcbiAgICAgICAgICAgICAgICAgICAgICAgIC50aGVuKCgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLmxvZyhgWyR7aW52aXRhdGlvbi5pZH1dIFJlamVjdGVkIElOVklURWApO1xuICAgICAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgICAgICAgICAgICAgLmNhdGNoKChlcnJvcikgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIuZXJyb3IoYFske2ludml0YXRpb24uaWR9XSBGYWlsZWQgdG8gcmVqZWN0IElOVklURWApO1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIuZXJyb3IoZXJyb3IudG9TdHJpbmcoKSk7XG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAvLyBIYW5kbGUgaW5jb21pbmcgbWVzc2FnZXNcbiAgICAgICAgICAgIG9uTWVzc2FnZTogKG1lc3NhZ2UpID0+IHtcbiAgICAgICAgICAgICAgICBtZXNzYWdlLmFjY2VwdCgpLnRoZW4oKCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5kZWxlZ2F0ZSAmJiB0aGlzLmRlbGVnYXRlLm9uTWVzc2FnZVJlY2VpdmVkKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmRlbGVnYXRlLm9uTWVzc2FnZVJlY2VpdmVkKG1lc3NhZ2UpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgLy8gSGFuZGxlIGluY29taW5nIG5vdGlmaWNhdGlvbnNcbiAgICAgICAgICAgIG9uTm90aWZ5OiAobm90aWZpY2F0aW9uKSA9PiB7XG4gICAg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V3IFJlZ2lzdGVyZXIodGhpcy51c2VyQWdlbnQsIHRoaXMucmVnaXN0ZXJlck9wdGlvbnMpO1xuICAgICAgICAgICAgdGhpcy5yZWdpc3RlcmVyLnN0YXRlQ2hhbmdlLmFkZExpc3RlbmVyKChzdGF0ZSkgPT4ge1xuICAgICAgICAgICAgICAgIHN3aXRjaCAoc3RhdGUpIHtcbiAgICAgICAgICAgICAgICAgICAgY2FzZSBSZWdpc3RlcmVyU3RhdGUuSW5pdGlhbDpcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICBjYXNlIFJlZ2lzdGVyZXJTdGF0ZS5SZWdpc3RlcmVkOlxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMuZGVsZWdhdGUgJiYgdGhpcy5kZWxlZ2F0ZS5vblJlZ2lzdGVyZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmRlbGVnYXRlLm9uUmVnaXN0ZXJlZCgpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgUmVnaXN0ZXJlclN0YXRlLlVucmVnaXN0ZXJlZDpcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLmRlbGVnYXRlICYmIHRoaXMuZGVsZWdhdGUub25VbnJlZ2lzdGVyZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmRlbGVnYXRlLm9uVW5yZWdpc3RlcmVkKCk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBJZiB3ZSB0cmFuc2l0aW9uIHRvIGFuIHVucmVnaXN0ZXIgc3RhdGUsIGF0dGVtcHQgdG8gZ2V0IGJhY2sgdG8gYSByZWdpc3RlcmVkIHN0YXRlLlxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMuc2hvdWxkQmVSZWdpc3RlcmVkKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5hdHRlbXB0UmVnaXN0cmF0aW9uKCk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgY2FzZSBSZWdpc3RlcmVyU3RhdGUuVGVybWluYXRlZDpcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwiVW5rbm93biByZWdpc3RlcmVyIHN0YXRlLlwiKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gdGhpcy5hdHRlbXB0UmVnaXN0cmF0aW9uKHRydWUpO1xuICAgIH1cbiAgICAvKipcbiAgICAgKiBTdG9wIHJlY2VpdmluZyBpbmNvbWluZyBjYWxscy5cbiAgICAgKiBAcmVtYXJrc1xuICAgICAqIFNlbmQgYW4gdW4tUkVHSVNURVIgcmVxdWVzdCBmb3IgdGhlIFVzZXJBZ2VudCdzIEFPUi5cbiAgICAgKiBSZXNvbHZlcyB3aGVuIHRoZSB1bi1SRUdJU1RFUiByZXF1ZXN0IGlzIHNlbnQsIG90aGVyd2lzZSByZWplY3RzLlxuICAgICAqL1xuICAgIGFzeW5jIHVucmVnaXN0ZXIocmVnaXN0ZXJlclVucmVnaXN0ZXJPcHRpb25zKSB7XG4gICAgICAgIHRoaXMubG9nZ2VyLmxvZyhgVW5yZWdpc3RlcmluZyBVc2VyQWdlbnQuLi5gKTtcbiAgICAgICAgdGhpcy5zaG91bGRCZVJlZ2lzdGVyZWQgPSBmYWxzZTtcbiAgICAgICAgaWYgKCF0aGlzLnJlZ2lzdGVyZXIpIHtcbiAgICAgICAgICAgIHRoaXMubG9n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WRcbiAgICAgICAgaWYgKCFpbnZpdGVyT3B0aW9ucykge1xuICAgICAgICAgICAgaW52aXRlck9wdGlvbnMgPSB7fTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoIWludml0ZXJPcHRpb25zLnNlc3Npb25EZXNjcmlwdGlvbkhhbmRsZXJPcHRpb25zKSB7XG4gICAgICAgICAgICBpbnZpdGVyT3B0aW9ucy5zZXNzaW9uRGVzY3JpcHRpb25IYW5kbGVyT3B0aW9ucyA9IHt9O1xuICAgICAgICB9XG4gICAgICAgIGlmICghaW52aXRlck9wdGlvbnMuc2Vzc2lvbkRlc2NyaXB0aW9uSGFuZGxlck9wdGlvbnMuY29uc3RyYWludHMpIHtcbiAgICAgICAgICAgIGludml0ZXJPcHRpb25zLnNlc3Npb25EZXNjcmlwdGlvbkhhbmRsZXJPcHRpb25zLmNvbnN0cmFpbnRzID0gdGhpcy5jb25zdHJhaW50cztcbiAgICAgICAgfVxuICAgICAgICAvLyBJZiB1dGlsaXppbmcgZWFybHkgbWVkaWEsIGFkZCBhIGhhbmRsZXIgdG8gY2F0Y2ggMTgzIFNlc3Npb24gUHJvZ3Jlc3NcbiAgICAgICAgLy8gbWVzc2FnZXMgYW5kIHRoZW4gdG8gcGxheSB0aGUgYXNzb2NpYXRlZCByZW1vdGUgbWVkaWEgKHRoZSBlYXJseSBtZWRpYSkuXG4gICAgICAgIGlmIChpbnZpdGVyT3B0aW9ucy5lYXJseU1lZGlhKSB7XG4gICAgICAgICAgICBpbnZpdGVySW52aXRlT3B0aW9ucyA9IGludml0ZXJJbnZpdGVPcHRpb25zIHx8IHt9O1xuICAgICAgICAgICAgaW52aXRlckludml0ZU9wdGlvbnMucmVxdWVzdERlbGVnYXRlID0gaW52aXRlckludml0ZU9wdGlvbnMucmVxdWVzdERlbGVnYXRlIHx8IHt9O1xuICAgICAgICAgICAgY29uc3QgZXhpc3RpbmdPblByb2dyZXNzID0gaW52aXRlckludml0ZU9wdGlvbnMucmVxdWVzdERlbGVn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gICAgICAgIGludml0ZXJPcHRpb25zLmRlbGVnYXRlLm9uU2Vzc2lvbkRlc2NyaXB0aW9uSGFuZGxlciA9IChzZXNzaW9uRGVzY3JpcHRpb25IYW5kbGVyKSA9PiB7XG4gICAgICAgICAgICAgICAgaWYgKCEoc2Vzc2lvbkRlc2NyaXB0aW9uSGFuZGxlciBpbnN0YW5jZW9mIFNlc3Npb25EZXNjcmlwdGlvbkhhbmRsZXIpKSB7XG4gICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcIlNlc3Npb24gZGVzY3JpcHRpb24gaGFuZGxlciBub3QgaW5zdGFuY2Ugb2YgU2Vzc2lvbkRlc2NyaXB0aW9uSGFuZGxlclwiKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgc2Vzc2lvbkRlc2NyaXB0aW9uSGFuZGxlci5wZWVyQ29ubmVjdGlvbkRlbGVnYXRlID0ge1xuICAgICAgICAgICAgICAgICAgICBvbmljZWNhbmRpZGF0ZTogKGV2ZW50KSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgX2E7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoKChfYSA9IGV2ZW50LmNhbmRpZGF0ZSkgPT09IG51bGwgfHwgX2EgPT09IHZvaWQgMCA/IHZvaWQgMCA6IF9hLnR5cGUpID09PSBcInNyZmx4XCIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5sb2coYFske2ludml0ZXIuaWR9XSBGb3VuZCBzcmZseCBJQ0UgY2FuZGlkYXRlLCBzdG9wIHdhaXRpbmcuLi5gKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBJbiBzaXAuanMgPiAwLjIwLjEgdGhpcyBjYXN0IHNob3VsZCBiZSByZW1vdmVkIGFzIGljZUdhdGhlcmluZ0NvbXBsZXRlIHdpbGwgYmUgcHVibGljXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3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29uZHMsIHdoaWNoIGlzIHRoZSBtYXhpbXVtIGR1cmF0aW9uXG4gICAgICAgICAgICAvLyBzdXBwb3J0ZWQgYnkgdGhpcyBtZWNoYW5pc20sIHRoZSBVQSBzaG91bGQgZ2VuZXJhdGUgdGhlIElORk8gYXQgdGhhdFxuICAgICAgICAgICAgLy8gdGltZS5cbiAgICAgICAgICAgIC8vIGh0dHBzOi8vdG9vbHMuaWV0Zi5vcmcvaHRtbC9kcmFmdC1rYXBsYW4tZGlzcGF0Y2gtaW5mby1kdG1mLXBhY2thZ2UtMDAjc2VjdGlvbi01LjNcbiAgICAgICAgICAgIGNvbnN0IGR0bWYgPSB0b25lO1xuICAgICAgICAgICAgY29uc3QgZHVyYXRpb24gPSAyMDAwO1xuICAgICAgICAgICAgY29uc3QgYm9keSA9IHtcbiAgICAgICAgICAgICAgICBjb250ZW50RGlzcG9zaXRpb246IFwicmVuZGVyXCIsXG4gICAgICAgICAgICAgICAgY29udGVudFR5cGU6IFwiYXBwbGljYXRpb24vZHRtZi1yZWxheVwiLFxuICAgICAgICAgICAgICAgIGNvbnRlbnQ6IFwiU2lnbmFsPVwiICsgZHRtZiArIFwiXFxyXFxuRHVyYXRpb249XCIgKyBkdXJhdGlvblxuICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIGNvbnN0IHJlcXVlc3RPcHRpb25zID0geyBib2R5IH07XG4gICAgICAgICAgICByZXR1cm4gc2Vzc2lvbi5pbmZvKHsgcmVxdWVzdE9wdGlvbnMgfSkudGhlbigoKSA9PiB7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICB9XG4gICAgLyoqXG4gICAgICogVHJhbnNmZXIuXG4gICAgICogQHBhcmFtIHNlc3Npb24gLSBTZXNzaW9uIHdpdGggdGhlIHRyYW5zZmVyZWUgdG8gdHJhbnNmZXIuXG4gICAgICogQHBhcmFtIHRhcmdldCAtIFRoZSByZWZlcnJhbCB0YXJnZX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dlbnQgc3RvcHBlZGApO1xuICAgICAgICAgICAgICAgIHJldHVybiBQcm9taXNlLnJlc29sdmUoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIC8vIElmIG5vIGd1YXJkIGRlZmluZWQsIHdlIGFyZSBnb29kIHRvIHByb2NlZWQgd2l0aG91dCBhbnkgZnVydGhlciBhZG8uXG4gICAgICAgICAgICBpZiAoIXRoaXMub3B0aW9ucy5yZWdpc3Rlckd1YXJkKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMucmVnaXN0ZXJlci5yZWdpc3Rlcih0aGlzLnJlZ2lzdGVyZXJSZWdpc3Rlck9wdGlvbnMpLnRoZW4oKCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICAvLyBPdGhlcndpc2UgY2hlY2sgdG8gbWFrZSBzdXJlIHRoZSBndWFyZCBkb2VzIG5vdCB3YW50IHVzIGhhbHQuXG4gICAgICAgICAgICByZXR1cm4gdGhpcy5vcHRpb25zXG4gICAgICAgICAgICAgICAgLnJlZ2lzdGVyR3VhcmQoKVxuICAgICAgICAgICAgICAgIC5jYXRjaCgoZXJyb3IpID0+IHtcbiAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5sb2coYFJlZ2lzdGVyIGd1YXJkIHJlamVjdGVkIHdpbGwgbWFraW5nIHJlZ2lzdHJhdGlvbiBhdHRlbXB0YCk7XG4gICAgICAgICAgICAgICAgdGhyb3cgZXJyb3I7XG4gICAgICAgICAgICB9KVxuICAgICAgICAgICAgICAgIC50aGVuKChoYWx0KSA9PiB7XG4gICAgICAgICAgICAgICAgaWYgKGhhbHQgfHwgIXRoaXMucmVnaXN0ZXJlcikge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gUHJvbWlzZS5yZXNvbHZlKCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHJldHVyb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AgICAgIH07XG4gICAgICAgIC8vIFNlbmQgcmVnaXN0ZXIgcmVxdWVzdCBhZnRlciBhIGRlbGF5XG4gICAgICAgIHJldHVybiBuZXcgUHJvbWlzZSgocmVzb2x2ZSwgcmVqZWN0KSA9PiB7XG4gICAgICAgICAgICB0aGlzLnJlZ2lzdHJhdGlvbkF0dGVtcHRUaW1lb3V0ID0gc2V0VGltZW91dCgoKSA9PiB7XG4gICAgICAgICAgICAgICAgX3JlZ2lzdGVyKClcbiAgICAgICAgICAgICAgICAgICAgLnRoZW4oKCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnJlZ2lzdHJhdGlvbkF0dGVtcHRUaW1lb3V0ID0gdW5kZWZpbmVkO1xuICAgICAgICAgICAgICAgICAgICByZXNvbHZlKCk7XG4gICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgICAgICAgLmNhdGNoKChlcnJvcikgPT4ge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnJlZ2lzdHJhdGlvbkF0dGVtcHRUaW1lb3V0ID0gdW5kZWZpbmVkO1xuICAgICAgICAgICAgICAgICAgICBpZiAoZXJyb3IgaW5zdGFuY2VvZiBSZXF1ZXN0UGVuZGluZ0Vycm9yKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXNvbHZlKCk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZWplY3QoZXJyb3IpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9LCB3aXRob3V0RGVsYXkgPyAwIDogY29tcHV0ZVJlZ2lzdHJhdGlvblRpbWVvdXQodGhpcy5vcHRpb25zLnJlZ2lzdHJhdGlvblJldHJ5SW50ZXJ2YWwpKTtcbiAgICAgICAgfSk7XG4gICAgfVxuICAgIC8qKiBIZWxwZXIgZnVuY3Rpb24gdG8gcmVtb3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lvblN0YXRlLlRlcm1pbmF0aW5nOlxuICAgICAgICAgICAgICAgIC8vIGZhbGwgdGhyb3VnaFxuICAgICAgICAgICAgICAgIGNhc2UgU2Vzc2lvblN0YXRlLlRlcm1pbmF0ZWQ6XG4gICAgICAgICAgICAgICAgICAgIC8vIFRoaXMgd2lsbCBhbHJlYWR5IGhhdmUgZXhlY3V0ZWQgaWYvd2hlbiB3ZSBmYWxsXG4gICAgICAgICAgICAgICAgICAgIC8vIHRocm91Z2ggZnJvbSBUZXJtaW5hdGluZyBhbmQgdGh1cyB0aGUgbWFuYWdlZFxuICAgICAgICAgICAgICAgICAgICAvLyBzZXNzaW9uIG1heSBhbHJlYWR5IGhhdmUgYmVlbiBjbGVhbmVkIHVwLlxuICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5zZXNzaW9uRXhpc3RzKHNlc3Npb24pKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmNsZWFudXBNZWRpYShzZXNzaW9uKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc2Vzc2lvblJlbW92ZShzZXNzaW9uKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLmRlbGVnYXRlICYmIHRoaXMuZGVsZWdhdGUub25DYWxsSGFuZ3VwKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5kZWxlZ2F0ZS5vbkNhbGxIYW5ndXAoc2Vzc2lvbik7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwiVW5rbm93biBzZXNzaW9uIHN0YXRlLlwiKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSk7XG4gICAgICAgIC8vIFRPRE86IEFueSBleGlzdGluZyBvbkluZm8gb3Igb25SZW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50VHlwZSkpIHtcbiAgICAgICAgICAgICAgICBpbmZvLnJlamVjdCgpO1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIC8vIEludmFsaWQgYm9keVxuICAgICAgICAgICAgY29uc3QgYm9keSA9IGluZm8ucmVxdWVzdC5ib2R5LnNwbGl0KFwiXFxyXFxuXCIsIDIpO1xuICAgICAgICAgICAgaWYgKGJvZHkubGVuZ3RoICE9PSAyKSB7XG4gICAgICAgICAgICAgICAgaW5mby5yZWplY3QoKTtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICAvLyBJbnZhbGlkIHRvbmVcbiAgICAgICAgICAgIGxldCB0b25lO1xuICAgICAgICAgICAgY29uc3QgdG9uZVJlZ0V4cCA9IC9eKFNpZ25hbFxccyo/PVxccyo/KShbMC05QS1EIypdezF9KShcXHMpPy4qLztcbiAgICAgICAgICAgIGlmIChib2R5WzBdICE9PSB1bmRlZmluZWQgJiYgdG9uZVJlZ0V4cC50ZXN0KGJvZHlbMF0pKSB7XG4gICAgICAgICAgICAgICAgdG9uZSA9IGJvZHlbMF0ucmVwbGFjZSh0b25lUmVnRXhwLCBcIiQyXCIpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKCF0b25lKSB7XG4gICAgICAgICAgICAgICAgaW5mby5yZWplY3QoKTtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICAvLyBJbnZhbGlkIGR1cmF0aW9uXG4gICAgICAgICAgICBsZXQgZHVyYXRpb247XG4gICAgICAgICAgICBjb25zdCBkdXJhdGlvblJlZ0V4cCA9IC9eKER1cmF0aW9uXFxzPz1cXHM/KShbMC05XXsxLDR9KShcXHMpPy4qLztcbiAgICAgICAgICAgIGlmIChib2R5WzFdICE9PSB1bmRlZmluZWQgJiYgZHVyYXRpb25SZWdFeHAudGVzdChib2R5WzFdKSkge1xuICAgICAgICAgICAgICAgIGR1cmF0aW9uID0gcGFyc2VJbnQoYm9keVsxXS5yZXBsYWNlKGR1cmF0aW9uUmVnRXhwLCBcIiQyXCIpLCAxMCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoIWR1cmF0aW9uKSB7XG4gICAgICAgICAgICAgICAgaW5mby5yZWplY3QoKTtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpbmZvXG4gICAgICAgICAgICAgICAgLmFjY2VwdCgpXG4gICAgICAgICAgICAgICAgLnRoZW4oKCkgPT4ge1xuICAgICAgICAgICAgICAgIGlmICh0aGlzLmRlbGVnYXRlICYmIHRoaXMuZGVsZWdhdGUub25DYWxsRFRNRlJlY2VpdmVkKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmICghdG9uZSB8fCAhZHVyYXRpb24pIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcIlRvbmUgb3IgZHVyYXRpb24gdW5kZWZpbmVkLlwiKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB0aGlzLmRlbGVnYXRlLm9uQ2FsbERUTUZSZWNlaXZlZChzZXNzaW9uLCB0b25lLCBkdXJhdGlvbik7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgICAuY2F0Y2goKGVycm9yKSA9PiB7XG4gICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIuZXJyb3IoZXJyb3IubWVzc2FnZSk7XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfTtcbiAgICAgICAgc2Vzc2lvbi5kZWxlZ2F0ZS5vblJlZmVyID0gKHJlZmVycmFsKSA9PiB7XG4gICAgICAgICAgICByZWZlcnJhbFxuICAgICAgICAgICAgICAgIC5hY2NlcHQoKVxuICAgICAgICAgICAgICAgIC50aGVuKCgpID0+IHRoaXMuc2VuZEludml0ZShy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BwaW5nIHRvIHJ1biBpbiBmdXR1cmVcbiAgICAgICAgdGhpcy5vcHRpb25zUGluZ1RpbWVvdXQgPSBzZXRUaW1lb3V0KCgpID0+IHtcbiAgICAgICAgICAgIHRoaXMub3B0aW9uc1BpbmdUaW1lb3V0ID0gdW5kZWZpbmVkO1xuICAgICAgICAgICAgLy8gSWYgcGluZyBzdWNjZWVkcy4uLlxuICAgICAgICAgICAgY29uc3Qgb25QaW5nU3VjY2VzcyA9ICgpID0+IHtcbiAgICAgICAgICAgICAgICAvLyByZWNvcmQgc3VjY2VzcyBvciBmYWlsdXJlXG4gICAgICAgICAgICAgICAgdGhpcy5vcHRpb25zUGluZ0ZhaWx1cmUgPSBmYWxzZTtcbiAgICAgICAgICAgICAgICAvLyBpZiB3ZSBhcmUgc3RpbGwgcnVubmluZywgcXVldWUgdXAgdGhlIG5leHQgcGluZ1xuICAgICAgICAgICAgICAgIGlmICh0aGlzLm9wdGlvbnNQaW5nUnVubmluZykge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLm9wdGlvbnNQaW5nUnVubmluZyA9IGZhbHNlO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLm9wdGlvbnNQaW5nUnVuKHJlcXVlc3RVUkksIGZyb21VUkksIHRvVVJJKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9O1xuICAgICAgICAgICAgLy8gSWYgcGluZyBmYWlscy4uLlxuICAgICAgICAgICAgY29uc3Qgb25QaW5nRmFpbHVyZSA9ICgpID0+IHtcbiAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5lcnJvcihcIk9QVElPTlMgcGluZyBmYWlsZWRcIik7XG4gICAgICAgICAgICAgICAgLy8gcmVjb3JkIHN1Y2Nlc3Mgb3IgZmFpbHVyZVxuICAgICAgICAgICAgICAgIHRoaXMub3B0aW9uc1BpbmdGYWlsdXJlID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAvLyBzdG9wIHJ1bm5pbmdcbiAgICAgICAgICAgICAgICB0aGlzLm9wdGlvbnNQaW5nUnVubmluZyA9IGZhbHNlO1xuICAgICAgICAgICAgICAgIC8vIGRpc2Nvbm5lY3QgdGhlIHRyYW5zcG9ydFxuICAgICAgICAgICAgICAgIHRoaXMudXNlckFnZW50LnRyYW5zcG9ydC5kaXNjb25uZWN0KCkuY2F0Y2goKGVycm9yKSA9PiB0aGlzLmxvZ2dlci5lcnJvcihlcnJvcikpO1xuICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIC8vIENyZWF0ZSBhbiBPUFRJT05TIHJlcXVlc3QgbWVzc2FnZVxuICAgICAgICAgICAgY29uc3QgY29yZSA9IHRoaXMudXNlckFnZW50LnVzZXJBZ2VudENvcmU7XG4gICAgICAgICAgICBjb25zdCBtZXNzYWdlID0gY29yZS5tYWtlT3V0Z29pbmdSZXF1ZXN0TWVzc2FnZShcIk9QVElPTlNcIiwgcmVxdWVzdFVSSSwgZnJvbVVSSSwgdG9VUkksIHt9KTtcbiAgICAgICAgICAgIC8vIFNlbmQgdGhlIHJlcXVlc3QgbWVzc2FnZVxuICAgICAgICAgICAgdGhpcy5vcHRpb25zUGluZ1JlcXVlc3QgPSBjb3JlLnJlcXVlc3QobWVzc2FnZSwge1xuICAgICAgICAgICAgICAgIG9uQWNjZXB0OiAoKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMub3B0aW9uc1BpbmdSZXF1ZXN0ID0gdW5kZWZpbmVkO1xuICAgICAgICAgICAgICAgICAgICBvblBpbmdTdWNjZXNzKCk7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBvblJlamVjdDogKHJlc3BvbnNlKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMub3B0aW9uc1BpbmdSZXF1ZXN0ID0gdW5kZWZpbmVkO1xuICAgICAgICAgICAgICAgICAgICAvLyBQaW5nIGZhaWxzIG9uIGZvbGxvd2luZyByZXNwb25zZXMuLi5cbiAgICAgICAgICAgICAgICAgICAgLy8gLSA0MDggUmVxdWVzdCBUaW1lb3V0IChubyByZXNwb25zZSB3YXMgcmVjZWl2ZWQpXG4gICAgICAgICAgICAgICAgICAgIC8vIC0gNTAzIFNlcnZpY2UgVW5hdmFpbGFibGUgKGEgdHJhbnNwb3J0IGxheWVyIGVycm9yIG9jY3VyZWQpXG4gICAgICAgICAgICAgICAgICAgIGlmIChyZXNwb25zZS5tZXNzYWdlLnN0YXR1c0NvZGUgPT09IDQwOCB8fCByZXNwb25zZS5tZXNzYWdlLnN0YXR1c0NvZGUgPT09IDUwMykge1xuICAgICAgICAgICAgICAgICAgICAgICAgb25QaW5nRmFpbHVyZSgpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgb25QaW5nU3VjY2VzcygpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH0sIHRoaXMub3B0aW9ucy5vcHRpb25zUGluZ0ludGVydmFsICogMTAwMCk7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIFN0YXJ0IHNlbmRpbmcgT1BUSU9OUyBwaW5ncy5cbiAgICAgKi9cbiAgICBvcHRpb25zUGluZ1N0YXJ0KCkge1xuICAgICAgICB0aGlzLmxvZ2dlci5sb2coYE9QVElPTlMgcGluZ3Mgc3RhcnRlZGApO1xuICAgICAgICAvLyBDcmVhdGUgdGhlIFVSSXMgbmVlZGVkIHRvIHNlbmQgT1BUSU9OUyBwaW5nc1xuICAgICAgICBsZXQgcmVxdWVzdFVSSSwgZnJvbVVSSSwgdG9VUkk7XG4gICAgICAgIGlmICh0aGlzLm9wdGlvbnMub3B0aW9uc1BpbmdSZXF1ZXN0VVJJKSB7XG4gICAgICAgICAgICAvLyBVc2Ugd2hhdGV2ZXIgc3BlY2lmaWMgUlVSSSBpcyBwcm92aWRlZC5cbiAgICAgICAgICAgIHJlcXVlc3R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7c2Vzc2lvbi5pZH1dIEludml0YXRpb24gcmVqZWN0ZWQgKHNlbnQgNDgwKWApO1xuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcIlVua25vd24gc2Vzc2lvbiB0eXBlLlwiKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICBjYXNlIFNlc3Npb25TdGF0ZS5Fc3RhYmxpc2hpbmc6XG4gICAgICAgICAgICAgICAgaWYgKHNlc3Npb24gaW5zdGFuY2VvZiBJbnZpdGVyKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBzZXNzaW9uLmNhbmNlbCgpLnRoZW4oKCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIubG9nKGBbJHtzZXNzaW9uLmlkfV0gSW52aXRlciBjYW5jZWxlZCAoc2VudCBDQU5DRUwpYCk7XG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBlbHNlIGlmIChzZXNzaW9uIGluc3RhbmNlb2YgSW52aXRhdGlvbikge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gc2Vzc2lvbi5yZWplY3QoKS50aGVuKCgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLmxvZyhgWyR7c2Vzc2lvbi5pZH1dIEludml0YXRpb24gcmVqZWN0ZWQgKHNlbnQgNDgwKWApO1xuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcIlVua25vd24gc2Vzc2lvbiB0eXBlLlwiKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICBjYXNlIFNlc3Npb25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gIGlmICh0aGlzLnRyYW5zaXRpb25pbmdTdGF0ZSkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gUHJvbWlzZS5yZWplY3QodGhpcy50cmFuc2l0aW9uTG9vcERldGVjdGVkRXJyb3IoVHJhbnNwb3J0U3RhdGUuQ29ubmVjdGluZykpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAoIXRoaXMuY29ubmVjdFByb21pc2UpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwiQ29ubmVjdCBwcm9taXNlIG11c3QgYmUgZGVmaW5lZC5cIik7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmNvbm5lY3RQcm9taXNlOyAvLyBBbHJlYWR5IGNvbm5lY3RpbmdcbiAgICAgICAgICAgIGNhc2UgVHJhbnNwb3J0U3RhdGUuQ29ubmVjdGVkOlxuICAgICAgICAgICAgICAgIC8vIElmIGBzdGF0ZWAgaXMgXCJDb25uZWN0ZWRcIiwgYHN0YXRlYCBNVVNUIE5PVCB0cmFuc2l0aW9uIGJlZm9yZSByZXR1cm5pbmcuXG4gICAgICAgICAgICAgICAgaWYgKHRoaXMudHJhbnNpdGlvbmluZ1N0YXRlKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBQcm9taXNlLnJlamVjdCh0aGlzLnRyYW5zaXRpb25Mb29wRGV0ZWN0ZWRFcnJvcihUcmFuc3BvcnRTdGF0ZS5Db25uZWN0aW5nKSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmICh0aGlzLmNvbm5lY3RQcm9taXNlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcIkNvbm5lY3QgcHJvbWlzZSBtdXN0IG5vdCBiZSBkZWZpbmVkLlwiKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgcmV0dXJuIFByb21pc2UucmVzb2x2ZSgpOyAvLyBBbHJlYWR5IGNvbm5lY3RlZFxuICAgICAgICAgICAgY2FzZSBUcmFuc3BvcnRTdGF0ZS5EaXNjb25uZWN0aW5nOlxuICAgICAgICAgICAgICAgIC8vIElmIGBzdGF0ZWAgaXMgXCJEaXNjb25uZWN0aW5nXCIsIGBzdGF0ZWAgTVVTVCB0cmFuc2l0aW9uIHRvIFwiQ29ubmVjdGluZ1wiIGJlZm9yZSByZXR1cm5pbmdcbiAgICAgICAgICAgICAgICBpZiAodGhpcy5jb25uZWN0UHJvbWlzZSkge1xuICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJDb25uZWN0IHByb21pc2UgbXVzdCBub3QgYmUgZGVmaW5lZC5cIik7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMudHJhbnNpdGlvblN0YXRlKFRyYW5zcG9ydFN0YXRlLkNvbm5lY3RpbmcpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBjYXRjaCAoZSkge1xuICAgICAgICAgICAgICAgICAgICBpZiAoZSBpbnN0YW5jZW9mIFN0YXRlVHJhbnNpdGlvbkVycm9yKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gUHJvbWlzZS5yZWplY3QoZSk7IC8vIExvb3AgZGV0ZWN0ZWRcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB0aHJvdyBlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgVHJhbnNwb3J0U3RhdGUuRGlzY29ubmVjdGVkOlxuICAgICAgICAgICAgICAgIC8vIElmIGBzdGF0ZWAgaXMgXCJEaXNjb25uZWN0ZWRcIiBgc3RhdGVgIE1VU1QgdHJhbnNpdGlvbiB0byBcIkNvbm5lY3RpbmdcIiBiZWZvcmUgcmV0dXJuaW5nXG4gICAgICAgICAgICAgICAgaWYgKHRoaXMuY29ubmVjdFByb21pc2UpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwiQ29ubmVjdCBwcm9taXNlIG11c3Qgbm90IGJlIGRlZmluZWQuXCIpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnRyYW5zaXRpb25TdGF0ZShUcmFuc3BvcnRTdGF0ZS5Db25uZWN0aW5nKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgY2F0Y2ggKGUpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGUgaW5zdGFuY2VvZiBTdGF0ZVRyYW5zaXRpb25FcnJvcikge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFByb21pc2UucmVqZWN0KGUpOyAvLyBMb29wIGRldGVjdGVkXG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgdGhyb3cgZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcIlVua25vd24gc3RhdGVcIik7XG4gICAgICAgIH1cbiAgICAgICAgbGV0IHdzO1xuICAgICAgICB0cnkge1xuICAgICAgICAgICAgLy8gV2ViU29ja2V0KClcbiAgICAgICAgICAgIC8vIGh0dHBzOi8vZGV2ZWxvcGVyLm1vemlsbGEub3JnL2VuLVVTL2RvY3MvV2ViL0FQSS9XZWJTb2NrZXQvV2ViU29ja2V0XG4gICAgICAgICAgICB3cyA9IG5ldyBXZWJTb2NrZXQodGhpcy5zZXJ2ZXIsIFwic2lwXCIpO1xuICAgICAgICAgICAgd3MuYmluYXJ5VHlwZSA9IFwiYXJyYXlidWZmZXJcIjsgLy8gc2V0IGRhdGEgdHlwZSBvZi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l0Y2ggKHRoaXMuc3RhdGUpIHtcbiAgICAgICAgICAgIGNhc2UgVHJhbnNwb3J0U3RhdGUuQ29ubmVjdGluZzpcbiAgICAgICAgICAgICAgICAvLyBJZiBgc3RhdGVgIGlzIFwiQ29ubmVjdGluZ1wiLCBgc3RhdGVgIE1VU1QgdHJhbnNpdGlvbiB0byBcIkRpc2Nvbm5lY3RpbmdcIiBiZWZvcmUgcmV0dXJuaW5nLlxuICAgICAgICAgICAgICAgIGlmICh0aGlzLmRpc2Nvbm5lY3RQcm9taXNlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcIkRpc2Nvbm5lY3QgcHJvbWlzZSBtdXN0IG5vdCBiZSBkZWZpbmVkLlwiKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy50cmFuc2l0aW9uU3RhdGUoVHJhbnNwb3J0U3RhdGUuRGlzY29ubmVjdGluZyk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGNhdGNoIChlKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChlIGluc3RhbmNlb2YgU3RhdGVUcmFuc2l0aW9uRXJyb3IpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBQcm9taXNlLnJlamVjdChlKTsgLy8gTG9vcCBkZXRlY3RlZFxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIHRocm93IGU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBUcmFuc3BvcnRTdGF0ZS5Db25uZWN0ZWQ6XG4gICAgICAgICAgICAgICAgLy8gSWYgYHN0YXRlYCBpcyBcIkNvbm5lY3RlZFwiLCBgc3RhdGVgIE1VU1QgdHJhbnNpdGlvbiB0byBcIkRpc2Nvbm5lY3RpbmdcIiBiZWZvcmUgcmV0dXJuaW5nLlxuICAgICAgICAgICAgICAgIGlmICh0aGlzLmRpc2Nvbm5lY3RQcm9taXNlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcIkRpc2Nvbm5lY3QgcHJvbWlzZSBtdXN0IG5vdCBiZSBkZWZpbmVkLlwiKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy50cmFuc2l0aW9uU3RhdGUoVHJhbnNwb3J0U3RhdGUuRGlzY29ubmVjdGluZyk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGNhdGNoIChlKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChlIGluc3RhbmNlb2YgU3RhdGVUcmFuc2l0aW9uRXJyb3IpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBQcm9taXNlLnJlamVjdChlKTsgLy8gTG9vcCBkZXRlY3RlZFxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIHRocm93IGU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBUcmFuc3BvcnRTdGF0ZS5EaXNjb25uZWN0aW5nOlxuICAgICAgICAgICAgICAgIC8vIElmIGBzdGF0ZWAgaXMgXCJEaXNjb25uZWN0aW5nXCIsIGBzdGF0ZWAgTVVTVCBOT1QgdHJhbnNpdGlvbiBiZWZvcmUgcmV0dXJuaW5nLlxuICAgICAgICAgICAgICAgIGlmICh0aGlzLnRyYW5zaXRpb25pbmdTdGF0ZSkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gUHJvbWlzZS5yZWplY3QodGhpcy50cmFuc2l0aW9uTG9vcERldGVjdGVkRXJyb3IoVHJhbnNwb3J0U3RhdGUuRGlzY29ubmVjdGluZykpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB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KSk7XG4gICAgICAgICAgICAgICAgdGhyb3cgZXJyb3I7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuICAgICAgICByZXR1cm4gdGhpcy5kaXNjb25uZWN0UHJvbWlzZTtcbiAgICB9XG4gICAgX3NlbmQobWVzc2FnZSkge1xuICAgICAgICBpZiAodGhpcy5jb25maWd1cmF0aW9uLnRyYWNlU2lwID09PSB0cnVlKSB7XG4gICAgICAgICAgICB0aGlzLmxvZ2dlci5sb2coXCJTZW5kaW5nIFdlYlNvY2tldCBtZXNzYWdlOlxcblxcblwiICsgbWVzc2FnZSArIFwiXFxuXCIpO1xuICAgICAgICB9XG4gICAgICAgIGlmICh0aGlzLl9zdGF0ZSAhPT0gVHJhbnNwb3J0U3RhdGUuQ29ubmVjdGVkKSB7XG4gICAgICAgICAgICByZXR1cm4gUHJvbWlzZS5yZWplY3QobmV3IEVycm9yKFwiTm90IGNvbm5lY3RlZC5cIikpO1xuICAgICAgICB9XG4gICAgICAgIGlmICghdGhpcy5fd3MpIHtcbiAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcIldlYlNvY2tldCB1bmRlZmluZWQuXCIpO1xuICAgICAgICB9XG4gICAgICAgIHRyeSB7XG4gICAgICAgICAgICAvLyBXZWJTb2NrZXQuc2VuZCgpXG4gICAgICAgICAgICAvLyBodHRwczovL2RldmVsb3Blci5tb3ppbGxhLm9yZy9lbi1VUy9kb2NzL1dlYi9BUEkvV2ViU29ja2V0L3NlbmRcbiAgICAgICAgICAgIHRoaXMuX3dzLnNlbmQobWVzc2FnZSk7XG4gICAgICAgIH1cbiAgICAgICAgY2F0Y2ggKGVycm9yKSB7XG4gICAgICAgICAgICBpZiAoZXJyb3IgaW5zdGFuY2VvZiBFcnJvcikge1xuICAgICAgICAgICAgICAgIHJldHVybiBQcm9taXNlLnJlamVjdChlcnJvcik7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gUHJvbWlzZS5yZWplY3QobmV3IEVycm9yK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gbWVzc2FnZSB3aGlsZSBub3QgY29ubmVjdGVkLCBkaXNjYXJkaW5nLi4uXCIpO1xuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG4gICAgICAgIGlmICh0aGlzLm9uTWVzc2FnZSkge1xuICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICB0aGlzLm9uTWVzc2FnZShmaW5pc2hlZERhdGEpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgY2F0Y2ggKGUpIHtcbiAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5lcnJvcihlLnRvU3RyaW5nKCkpO1xuICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLmVycm9yKFwiRXhjZXB0aW9uIHRocm93biBieSBvbk1lc3NhZ2UgY2FsbGJhY2tcIik7XG4gICAgICAgICAgICAgICAgdGhyb3cgZTsgLy8gcmV0aHJvdyB1bmhhbmRsZWQgZXhjZXB0aW9uXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG4gICAgLyoqXG4gICAgICogV2ViU29ja2V0IFwib25vcGVuXCIgZXZlbnQgaGFuZGxlci5cbiAgICAgKiBAcGFyYW0gZXYgLSBFdmVudC5cbiAgICAgKi9cbiAgICBvbldlYlNvY2tldE9wZW4oZXYsIHdzKSB7XG4gICAgICAgIGlmICh3cyAhPT0gdGhpcy5fd3MpIHtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuICAgICAgICBpZiAodGhpcy5fc3RhdGUgPT09IFRyYW5zcG9ydFN0YXRlLkNvbm5lY3RpbmcpIHtcbiAgICAgICAgICAgIHRoaXMubG9nZ2VyLmxvZyhgV2ViU29ja2V0IG9wZW5lZCAke3RoaXMuc2VydmVyfWApO1xuICAgICAgICAgICAgdGhpcy50cmFuc2l0aW9uU3RhdGUoVHJhbnNwb3J0U3RhdGUuQ29ubmVjdGVkKTtcbiAgICAgICAgfVxuICAgIH1cbiAgICAvKipcbiAgICAgKiBIZWxwZXIg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YW55IG91dHN0YW5kaW5nIGNvbm5lY3QgdGltZW91dFxuICAgICAgICBpZiAodGhpcy5jb25uZWN0VGltZW91dCkge1xuICAgICAgICAgICAgY2xlYXJUaW1lb3V0KHRoaXMuY29ubmVjdFRpbWVvdXQpO1xuICAgICAgICAgICAgdGhpcy5jb25uZWN0VGltZW91dCA9IHVuZGVmaW5lZDtcbiAgICAgICAgfVxuICAgICAgICB0aGlzLmxvZ2dlci5sb2coYFRyYW5zaXRpb25lZCBmcm9tICR7b2xkU3RhdGV9IHRvICR7dGhpcy5fc3RhdGV9YCk7XG4gICAgICAgIHRoaXMuX3N0YXRlRXZlbnRFbWl0dGVyLmVtaXQodGhpcy5fc3RhdGUpO1xuICAgICAgICAvLyAgVHJhbnNpdGlvbiB0byBDb25uZWN0ZWRcbiAgICAgICAgaWYgKG5ld1N0YXRlID09PSBUcmFuc3BvcnRTdGF0ZS5Db25uZWN0ZWQpIHtcbiAgICAgICAgICAgIHRoaXMuc3RhcnRTZW5kaW5nS2VlcEFsaXZlcygpO1xuICAgICAgICAgICAgaWYgKHRoaXMub25Db25uZWN0KSB7XG4gICAgICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5vbkNvbm5lY3QoKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgY2F0Y2ggKGUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIuZXJyb3IoZS50b1N0cmluZygpKTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIuZXJyb3IoXCJFeGNlcHRpb24gdGhyb3duIGJ5IG9uQ29ubmVjdCBjYWxsYmFja1wiKTtcbiAgICAgICAgICAgICAgICAgICAgdGhyb3cgZTsgLy8gcmV0aHJvdyB1bmhhbmRsZWQgZXhjZXB0aW9uXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIC8vICBUcmFuc2l0aW9uIGZyb20gQ29ubmVjdGVkXG4gICAgICAgIGlmIChvbGRTdGF0ZSA9PT0gVHJhbnNwb3J0U3RhdGUuQ29ubmVjdGVkKSB7XG4gICAgICAgICAgICB0aGlzLnN0b3BTZW5kaW5nS2VlcEFsaXZlcygpO1xuICAgICAgICAgICAgaWYgKHRoaXMub25EaXNjb25uZWN0KSB7XG4gICAgICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGVycm9yKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLm9uRGlzY29ubmVjdChlcnJvcik7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLm9uRGlzY29ubmVjdCgpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGNhdGNoIChlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLmVycm9yKGUudG9TdHJpbmcoKSk7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLmVycm9yKFwiRXhjZXB0aW9uIHRocm93biBieSBvbkRpc2Nvbm5lY3QgY2FsbGJhY2tcIik7XG4gICAgICAgICAgICAgICAgICAgIHRocm93IGU7IC8vIHJldGhyb3cgdW5oYW5kbGVkIGV4Y2VwdGlvblxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICAvLyBDb21wbGV0ZSBjb25uZWN0IHByb21pc2VcbiAgICAgICAgaWYgKG9sZFN0YXRlID09PSBUcmFuc3BvcnRTdGF0ZS5Db25uZWN0aW5nKSB7XG4gICAgICAgICAgICBpZiAoIWNvbm5lY3RSZXNvbHZlKSB7XG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwiQ29ubmVjdCByZXNvbHZlIHVuZGVmaW5lZC5cIik7XG4gICAg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UuaGFzT3duUHJvcGVydHkuY2FsbChvYmosIHByb3ApKSIsIi8vIGRlZmluZSBfX2VzTW9kdWxlIG9uIGV4cG9ydHNcbl9fd2VicGFja19yZXF1aXJlX18uciA9IChleHBvcnRzKSA9PiB7XG5cdGlmKHR5cGVvZiBTeW1ib2wgIT09ICd1bmRlZmluZWQnICYmIFN5bWJvbC50b1N0cmluZ1RhZykge1xuXHRcdE9iamVjdC5kZWZpbmVQcm9wZXJ0eShleHBvcnRzLCBTeW1ib2wudG9TdHJpbmdUYWcsIHsgdmFsdWU6ICdNb2R1bGUnIH0pO1xuXHR9XG5cdE9iamVjdC5kZWZpbmVQcm9wZXJ0eShleHBvcnRzLCAnX19lc01vZHVsZScsIHsgdmFsdWU6IHRydWUgfSk7XG59OyIsIiIsIi8vIHN0YXJ0dXBcbi8vIExvYWQgZW50cnkgbW9kdWxlIGFuZCByZXR1cm4gZXhwb3J0c1xuLy8gVGhpcyBlbnRyeSBtb2R1bGUgaXMgcmVmZXJlbmNlZCBieSBvdGhlciBtb2R1bGVzIHNvIGl0IGNhbid0IGJlIGlubGluZWRcbnZhciBfX3dlYnBhY2tfZXhwb3J0c19fID0gX193ZWJwYWNrX3JlcXVpcmVfXyhcIi4vZGlzdC9waG9uZS5qc1wiKTtcbiIsIiJdLCJuYW1lcyI6W10sInNvdXJjZVJvb3QiOiIifQ== \ No newline at end of file +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGhvbmUuanMiLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7OztBQUFhO0FBQ2I7QUFDQSw0QkFBNEIsK0RBQStELGlCQUFpQjtBQUM1RztBQUNBLG9DQUFvQyxNQUFNLCtCQUErQixZQUFZO0FBQ3JGLG1DQUFtQyxNQUFNLG1DQUFtQyxZQUFZO0FBQ3hGLGdDQUFnQztBQUNoQztBQUNBLEtBQUs7QUFDTDtBQUNBLDhDQUE2QyxFQUFFLGFBQWEsRUFBQztB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WcoKTtcbiAgICAgICAgICAgIGlmICh0aGlzLnNpbXBsZVVzZXIpIHtcbiAgICAgICAgICAgICAgICAvLyBEaXNwb3NlIHRoZSBjdXJyZW50IHNpbXBsZSB1c2VyIGFuZCBjcmVhdGUgYSBuZXcgb25lXG4gICAgICAgICAgICAgICAgeWllbGQgdGhpcy5zaW1wbGVVc2VyLnVucmVnaXN0ZXIoKTtcbiAgICAgICAgICAgICAgICB5aWVsZCB0aGlzLnNpbXBsZVVzZXIuZGlzY29ubmVjdCgpO1xuICAgICAgICAgICAgICAgIHRoaXMuc2ltcGxlVXNlciA9IG51bGw7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBjb25zdCBkZWxlZ2F0ZSA9IHtcbiAgICAgICAgICAgICAgICBvbkNhbGxSZWNlaXZlZDogKCkgPT4gX19hd2FpdGVyKHRoaXMsIHZvaWQgMCwgdm9pZCAwLCBmdW5jdGlvbiogKCkge1xuICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhcIkluY29taW5nIENhbGwhXCIpO1xuICAgICAgICAgICAgICAgICAgICB5aWVsZCB0aGlzLnNpbXBsZVVzZXIuYW5zd2VyKCk7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuY2FsbEJ1dHRvbi50ZXh0Q29udGVudCA9IFwiSGFuZ3VwXCI7XG4gICAgICAgICAgICAgICAgfSksXG4gICAgICAgICAgICAgICAgb25DYWxsQW5zd2VyZWQ6ICgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgY29uc29sZS5sb2coXCJDYWxsIEFuc3dlcmVkIVwiKTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5jYWxsQnV0dG9uLnRleHRDb250ZW50ID0gXCJIYW5ndXBcIjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIG9uQ2FsbEhhbmd1cDogKCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhcIkNhbGwgSGFuZ3VwIVwiKTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5jYWxsQnV0dG9uLnRleHRDb250ZW50ID0gXCJDYWxsXCI7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBvblJlZ2lzdGVyZWQ6ICgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgY29uc29sZS5sb2coXCJSZWdpc3RlcmVkIVwiKTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5yZWdpc3RlckJ1dHRvbi50ZXh0Q29udGVudCA9IFwiVW5yZWdpc3RlclwiO1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgb25VbnJlZ2lzdGVyZWQ6ICgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgY29uc29sZS5sb2coXCJVbnJlZ2lzdGVyZWQhXCIpO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnJlZ2lzdGVyQnV0dG9uLnRleHRDb250ZW50ID0gXCJSZWdpc3RlclwiO1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgb25TZXJ2ZXJEaXNjb25uZWN0OiAoKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKFwiU2VydmVyIERpc2Nvbm5lY3QhXCIpO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnJlZ2lzdGVyQnV0dG9uLmRpc2FibGVkID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5jYWxsQnV0dG9uLmRpc2FibGVkID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5jb25uZWN0QnV0dG9uLmRpc2FibGVkID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBvblNlcnZlckNvbm5lY3Q6ICgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgY29uc29sZS5sb2coXCJTZXJ2ZXIgQ29ubmVjdCFcIik7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMucmVnaXN0ZXJCdXR0b24uZGlzYWJsZWQgPSBmYWxzZTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5jYWxsQnV0dG9uLmRpc2FibGVkID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuY29ubmVjdEJ1dHRvbi5kaXNhYmxlZCA9IHRydWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIGNvbnN0IG9wdGlvbnMgPSB7XG4gICAgICAgICAgICAgICAgYW9yOiBcInNpcDpcIiArIHRoaXMudXNlcm5hbWVJbnB1dC52YWx1ZSArIFwiQFwiICsgdGhpcy5kb21haW5JbnB1dC52YWx1ZSxcbiAgICAgICAgICAgICAgICBkZWxlZ2F0ZTogZGVsZWdhdGUsXG4gICAgICAgICAgICAgICAgbWVkaWE6IHtcbiAgICAgICAgICAgICAgICAgICAgY29uc3RyYWludHM6IHsgYXVkaW86IHRydWUsIHZpZGVvOiBmYWxzZSB9LFxuICAgICAgICAgICAgICAgICAgICByZW1vdGU6IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvOiAoMCwgdXRpbHNfMS5nZXRBdWRpb0VsZW1lbnQpKFwicmVtb3RlQXVkaW9cIilcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgdXNlckFnZW50T3B0aW9uczoge1xuICAgICAgICAgICAgICAgICAgICBkaXNwbGF5TmFtZTogdGhpcy5kaXNwbGF5TmFtZUlucHV0LnZhbHVlIHx8IFwiQW5vbnltb3VzXCIsXG4gICAgICAgICAgICAgICAgICAgIGF1dGhvcml6YXRpb25Vc2VybmFtZTogdGhpcy5hdXRob3JpemF0aW9uVXNlcklucHV0LnZhbHVlIHx8IHRoaXMudXNlcm5hbWVJbnB1dC52YWx1ZSxcbiAgICAgICAgICAgICAgICAgICAgYXV0aG9yaXphdGlvblBhc3N3b3JkOiB0aGlzLnBhc3N3b3JkSW5wdXQudmFsdWUsXG4gICAgICAgICAgICAgICAgICAgIGFsbG93TGVnYWN5Tm90aWZpY2F0aW9uczogZmFsc2UsXG4gICAgICAgICAgICAgICAgICAgIHRyYW5zcG9ydE9wdGlvbnM6IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlcnZlcjogdGhpcy5zZXJ2ZXJJbnB1dC52YWx1ZSxcbiAgICAgICAgICAgICAgICAgICAgICAgIGtlZXBBbGl2ZUludGVydmFsOiAxNSxcbiAgICAgICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHJlZ2lzdGVyZXJPcHRpb25zOiB7XG4gICAgICAgICAgICAgICAgICAgIGV4cGlyZXM6IDEyMCxcbiAgICAgICAgICAgICAgICAgICAgcmVmcmVzaEZyZXF1ZW5jeTogNzAsXG4gICAgICAgICAgICAgICAgICAgIGV4dHJhSGVhZGVyczogdGhpcy5nZXRFeHRyYUhlYWRlcnMoKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICBjb25zdCBzZXJ2ZXIgPSB0aGlzLnNlcnZlcklucHV0LnZhbHVlO1xuICAgICAgICAgICAgdGhpcy5zaW1wbGVVc2VyID0gbmV3IHNpcF9qc18xLldlYi5TaW1wbGVVc2VyKHNlcnZlciwgb3B0aW9ucyk7XG4gICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgIHlpZWxkIHRoaXMuc2ltcGxlVXNlci5jb25uZWN0KCk7XG4gICAgICAgICAgICAgICAgdGhpcy5jb25uZWN0QnV0dG9uLmRpc2FibGVkID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICB0aGlzLnJlZ2lzdGVyQnV0dG9uLmRpc2FibGVkID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgdGhpcy5jYWxsQnV0dG9uLmRpc2FibGVkID0gZmFsc2U7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBjYXRjaCAoZXJyb3IpIHtcbiAgICAgICAgICAgICAgICB3aW5kb3cuYWxlcnQoXCJFcnJvcjogXCIgKyBlcnJvcik7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuICAgIH1cbiAgICByZWdpc3RlcigpIHtcbiAgICAgICAgcmV0dXJuIF9fYXdhaXRlcih0aGlzLCB2b2lkIDAsIHZvaWQgMCwgZnVuY3Rpb24qICgpIHtcbiAgICAgICAgICAgIGNvbnNvbGUubG9nKFwiUmVnaXN0ZXJpbmcuLi5cIik7XG4gICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgIC8vIEF0dGVtcHQgdG8gc2F2ZSB0aGUgY3VycmVudCBjb25maWd1cmF0aW9uXG4gICAgICAgICAgICAgICAgdGhpcy5zYXZlQ29uZmlnKCk7XG4gICAgICAgICAgICAgICAgaWYgKHRoaXMucmVnaXN0ZXJCdXR0b24udGV4dENvbnRlbnQgPT09IFwiUmVnaXN0ZXJcIikge1xuICAgICAgICAgICAgICAgICAgICAvLyBSZWdpc3RlciB0byByZWNlaXZlIGluYm91bmQgY2FsbHNcbiAgICAgICAgICAgICAgICAgICAgeWllbGQgdGhpcy5zaW1wbGVVc2VyLnJlZ2lzdGVyKCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICB5aWVsZCB0aGlzLnNpbXBsZVVzZXIudW5yZWdpc3RlcigpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGNhdGNoIChlcnJvcikge1xuICAgICAgICAgICAgICAgIGFsZXJ0KFwiRXJyb3I6IFwiICsgZXJyb3IpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICB9XG4gICAgY2FsbCgpIHtcbiAgICAgICAgcmV0dXJuIF9fYXdhaXRlcih0aGlzLCB2b2lkIDAsIHZvaWQgMCwgZnVuY3Rpb24qICgpIHtcbiAgICAgICAgICAgIGNvbnNvbGUubG9nKFwiQ2FsbGluZy4uLlwiKTtcbiAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgICAgaWYgKHRoaXMuY2FsbEJ1dHRvbi50ZXh0Q29udGVudCA9PT0gXCJDYWxsXCIpIHtcbiAgICAgICAgICAgICAgICAgICAgeWllbGQgdGhpcy5zaW1wbGVVc2VyLmNhbGwodGhpcy50YXJnZXRBT1JJbnB1dC52YWx1ZSwge1xuICAgICAgICAgICAgICAgICAgICAgICAgZXh0cmFIZWFkZXJzOiB0aGlzLmdldEV4dHJhSGVhZGVycygpXG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgeWllbGQgdGhpcy5zaW1wbGVVc2VyLmhhbmd1cCgpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGNhdGNoIChlcnJvcikge1xuICAgICAgICAgICAgICAgIGFsZXJ0KFwiRXJyb3I6IFwiICsgZXJyb3IpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICB9XG4gICAgaGFzQWxsUmVxdWlyZWRGaWVsZHMoKSB7XG4gICAgICAgIHJldHVybiAodGhpcy51c2VybmFtZUlucHV0LnZhbHVlICYmXG4gICAgICAgICAgICB0aGlzLmRvbWFpbklucHV0LnZhbHVlICYmXG4gICAgICAgICAgICB0aGlzLnNlcnZlcklucHV0LnZhbHVlICYmXG4gICAgICAgICAgICB0aGlzLnRhcmdldEFPUklucHV0LnZhbHVlKTtcbiAgICB9XG4gICAgbG9hZENvbmZpZygpIHtcbiAgICAgICAgdmFyIF9hO1xuICAgICAgICBjb25zdCBwaG9uZUNvbmZpZ1N0cmluZyA9IGxvY2FsU3RvcmFnZS5nZXRJdGVtKFwicGhvbmVDb25maWdcIik7XG4gICAgICAgIGlmIChwaG9uZUNvbmZpZ1N0cmluZykge1xuICAgICAgICAgICAgY29uc3QgcGhvbm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ge1xuICAgICAgICAgICAgICAgIGlmICh0aGlzLnN0YXRlID09PSBTZXNzaW9uU3RhdGUuSW5pdGlhbCkge1xuICAgICAgICAgICAgICAgICAgICBpbmNvbWluZ0ludml0ZVJlcXVlc3QucmVqZWN0KHsgc3RhdHVzQ29kZTogNDg3IH0pO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnN0YXRlVHJhbnNpdGlvbihTZXNzaW9uU3RhdGUuVGVybWluYXRlZCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSwgZXhwaXJlcyk7XG4gICAgICAgIH1cbiAgICAgICAgLy8gU2Vzc2lvbiBwYXJlbnQgcHJvcGVydGllc1xuICAgICAgICBjb25zdCBhc3NlcnRlZElkZW50aXR5ID0gdGhpcy5yZXF1ZXN0LmdldEhlYWRlcihcIlAtQXNzZXJ0ZWQtSWRlbnRpdHlcIik7XG4gICAgICAgIGlmIChhc3NlcnRlZElkZW50aXR5KSB7XG4gICAgICAgICAgICB0aGlzLl9hc3NlcnRlZElkZW50aXR5ID0gR3JhbW1hci5uYW1lQWRkckhlYWRlclBhcnNlKGFzc2VydGVkSWRlbnRpdHkpO1xuICAgICAgICB9XG4gICAgICAgIHRoaXMuX2NvbnRhY3QgPSB0aGlzLnVzZXJBZ2VudC5jb250YWN0LnRvU3RyaW5nKCk7XG4gICAgICAgIGNvbnN0IGNvbnRlbnREaXNwb3NpdGlvbiA9IGluY29taW5nUmVxdWVzdE1lc3NhZ2UucGFyc2VIZWFkZXIoXCJDb250ZW50LURpc3Bvc2l0aW9uXCIpO1xuICAgICAgICBpZiAoY29udGVudERpc3Bvc2l0aW9uICYmIGNvbnRlbnREaXNwb3NpdGlvbi50eXBlID09PSBcInJlbmRlclwiKSB7XG4gICAgICAgICAgICB0aGlzLl9yZW5kZXJib2R5ID0gaW5jb21pbmdSZXF1ZXN0TWVzc2FnZS5ib2R5O1xuICAgICAgICAgICAgdGhpcy5fcmVuZGVydHlwZSA9IGluY29taW5nUmVx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vdmlzaW9uYWwgcmVzcG9uc2VcbiAgICAgICAgaWYgKCEodGhpcy5yZWwxMDAgPT09IFwicmVxdWlyZWRcIikgJiZcbiAgICAgICAgICAgICEodGhpcy5yZWwxMDAgPT09IFwic3VwcG9ydGVkXCIgJiYgb3B0aW9ucy5yZWwxMDApICYmXG4gICAgICAgICAgICAhKHRoaXMucmVsMTAwID09PSBcInN1cHBvcnRlZFwiICYmIHRoaXMudXNlckFnZW50LmNvbmZpZ3VyYXRpb24uc2lwRXh0ZW5zaW9uMTAwcmVsID09PSBTSVBFeHRlbnNpb24uUmVxdWlyZWQpKSB7XG4gICAgICAgICAgICByZXR1cm4gdGhpcy5zZW5kUHJvZ3Jlc3Mob3B0aW9ucylcbiAgICAgICAgICAgICAgICAudGhlbigoKSA9PiB7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgICAuY2F0Y2goKGVycm9yKSA9PiB0aGlzLmhhbmRsZVJlc3BvbnNlRXJyb3IoZXJyb3IpKTtcbiAgICAgICAgfVxuICAgICAgICAvLyBSZWxpYWJsZSBwcm92aXNpb25hbCByZXNwb25zZVxuICAgICAgICByZXR1cm4gdGhpcy5zZW5kUHJvZ3Jlc3NSZWxpYWJsZVdhaXRGb3JQcmFjayhvcHRpb25zKVxuICAgICAgICAgICAgLnRoZW4oKCkgPT4ge1xuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9KVxuICAgICAgICAgICAgLmNhdGNoKChlcnJvcikgPT4gdGhpcy5oYW5kbGVSZXNwb25zZUVycm9yKGVycm9yKSk7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIFJlamVjdCB0aGUgaW52aXRhdGlvbi5cbiAgICAgKlxuICAgICAqIEByZW1hcmtzXG4gICAgICogUmVwbGllcyB0byB0aGUgSU5WSVRFIHJlcXVlc3Qgd2l0aCBhIDR4eCwgNXh4LCBvciA2eHggZmluYWwgcmVzcG9uc2UuXG4gICAgICogUmV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gcmVxdWVzdDtcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBAdHlwZXNjcmlwdC1lc2xpbnQvbm8tdXNlLWJlZm9yZS1kZWZpbmVcbiAgICAgICAgICAgICAgICAgICAgICAgIGNsZWFyVGltZW91dChwcmFja1dhaXRUaW1lb3V0VGltZXIpO1xuICAgICAgICAgICAgICAgICAgICAgICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIEB0eXBlc2NyaXB0LWVzbGludC9uby11c2UtYmVmb3JlLWRlZmluZVxuICAgICAgICAgICAgICAgICAgICAgICAgY2xlYXJUaW1lb3V0KHJlbDF4eFJldHJhbnNtaXNzaW9uVGltZXIpO1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF0aGlzLndhaXRpbmdGb3JQcmFjaykge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMud2FpdGluZ0ZvclByYWNrID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmhhbmRsZVByYWNrT2ZmZXJBbnN3ZXIocHJhY2tSZXF1ZXN0KVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC50aGVuKChwcmFja1Jlc3BvbnNlQm9keSkgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByYWNrUmVzcG9uc2UgPSBwcmFja1JlcXVlc3QuYWNjZXB0KHsgc3RhdHVzQ29kZTogMjAwLCBib2R5OiBwcmFja1Jlc3BvbnNlQm9keSB9KTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5wcmFja0Fycml2ZWQoKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzb2x2ZSh7IHByYWNrUmVxdWVzdCwgcHJhY2tSZXNwb25zZSwgcHJvZ3Jlc3NSZXNwb25zZSB9KTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY2F0Y2ggKGVycm9yKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlamVjdChlcnJvcik7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAuY2F0Y2goKGVycm9yKSA9PiByZWplY3QoZXJyb3IpKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgLy8gaHR0cHM6Ly90b29scy5pZXRmLm9yZy9odG1sL3JmYzMyNjIjc2VjdGlvbi0zXG4gICAgICAgICAgICAgICAgY29uc3QgcHJhY2tXYWl0VGltZW91dCA9ICgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKCF0aGlzLndhaXRpbmdGb3JQcmFjaykge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIHRoaXMud2FpdGluZ0ZvclByYWNrID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLndhcm4oXCJObyBQUkFDSyByZWNlaXZlZCwgcmVqZWN0aW5nIElOVklURS5cIik7XG4gICAgICAgICAgICAgICAgICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBAdHlwZXNjcmlwdC1lc2xpbnQvbm8tdXNlLWJlZm9yZS1kZWZpbmVcbiAgICAgICAgICAgICAgICAgICAgY2xlYXJUaW1lb3V0KHJlbDF4eFJldHJhbnNtaXNzaW9uVGltZXIpO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnJlamVjdCh7IHN0YXR1c0NvZGU6IDUwNCB9KVxuICAgICAgICAgICAgICAgICAgICAgICAgLnRoZW4oKCkgPT4gcmVqZWN0KG5ldyBTZXNzaW9uVGVybWluYXRlZEVycm9yKCkpKVxuICAgICAgICAgICAgICAgICAgICAgICAgLmNhdGNoKChlcnJvcikgPT4gcmVqZWN0KGVycm9yKSk7XG4gICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICBjb25zdCBwcmFja1dhaXRUaW1lb3V0VGltZXIgPSBzZXRUaW1lb3V0KHByYWNrV2FpdFRpbWVvdXQsIFRpbWVycy5UMSAqIDY0KTtcbiAgICAgICAgICAgICAgICAvLyBodHRwczovL3Rvb2xzLmlldGYub3JnL2h0bWwvcmZjMzI2MiNzZWN0aW9uLTNcbiAgICAgICAgICAgICAgICBjb25zdCByZWwxeHhSZXRyYW5zbWlzc2lvbiA9ICgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuaW5jb21pbmdJbnZpdGVSZXF1ZXN0LnByb2dyZXNzKHsgc3RhdHVzQ29kZSwgcmVhc29uUGhyYXNlLCBleHRyYUhlYWRlcnMsIGJvZHkgfSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgY2F0Y2ggKGVycm9yKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLndhaXRpbmdGb3JQcmFjayA9IGZhbHNlO1xuICAgICAgICAgICAgICAgICAgICAgICAgcmVqZWN0KGVycm9yKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgQHR5cGVzY3JpcHQtZXNsaW50L25vLXVzZS1iZWZvcmUtZGVmaW5lXG4gICAgICAgICAgICAgICAgICAgIHJlbDF4eFJldHJhbnNtaXNzaW9uVGltZXIgPSBzZXRUaW1lb3V0KHJlbDF4eFJldHJhbnNtaXNzaW9uLCAodGltZW91dCAqPSAyKSk7XG4gICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICBsZXQgdGltZW91dCA9IFRpbWVycy5UMTtcbiAgICAgICAgICAgICAgICBsZXQgcmVsMXh4UmV0cmFuc21pc3Npb25UaW1lciA9IHNldFRpbWVvdXQocmVsMXh4UmV0cmFuc21pc3Npb24sIHRpbWVvdXQpO1xuICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgICAuY2F0Y2goKGVycm9yKSA9PiB7XG4gICAgICAgICAgICAgICAgdGhpcy53YWl0aW5nRm9yUHJhY2sgPSBmYWxzZTtcbiAgICAgICAgICAgICAgICByZWplY3QoZXJyb3IpO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH0pO1xuICAgIH1cbiAgICAvKipcbiAgICAgKiBBIHZlcnNpb24gb2YgYHByb2dyZXNzYCB3aGljaCByZXNvbHZlcyB3aGVuIGEgMTAwIFRyeWluZyBwcm92aXNpb25hbCByZXNwb25zZSBpcyBzZW50LlxuICAgICAqL1xuICAgIHNlbmRQcm9ncmVzc1RyeWluZygpIHtcbiAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgIGNvbnN0IHByb2dyZXNzUmVzcG9uc2UgPSB0aGlzLmluY29taW5nSW52aXRlUmVxdWVzdC50cnlpbmcoKTtcbiAgICAgICAgICAgIHJldHVybiBQcm9taXNlLnJlc29sdmUocHJvZ3Jlc3NSZXNwb25zZSk7XG4gICAgICAgIH1cbiAgICAgICAgY2F0Y2ggKGVycm9yKSB7XG4gICAgICAgICAgICByZXR1cm4gUHJvbWlzZS5yZWplY3QoZXJyb3IpO1xuICAgICAgICB9XG4gICAgfVxuICAgIC8qKlxuICAgICAqIFdoZW4gYXR0ZW1wdGluZyB0byBhY2NlcHQgdGhlIElOVklURSwgYW4gaW52aXRhdGlvbiB3YWl0c1xuICAgICAqIGZvciBhbnkgb3V0c3RhbmRpbmcgUFJBQ0sgdG8gYX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gICAgLy8gVVJJc1xuICAgICAgICBpZiAoYW5vbnltb3VzICYmIHVzZXJBZ2VudC5jb25maWd1cmF0aW9uLnVyaSkge1xuICAgICAgICAgICAgaW52aXRlck9wdGlvbnMucGFyYW1zLmZyb21EaXNwbGF5TmFtZSA9IFwiQW5vbnltb3VzXCI7XG4gICAgICAgICAgICBpbnZpdGVyT3B0aW9ucy5wYXJhbXMuZnJvbVVyaSA9IFwic2lwOmFub255bW91c0Bhbm9ueW1vdXMuaW52YWxpZFwiO1xuICAgICAgICB9XG4gICAgICAgIGxldCBmcm9tVVJJID0gdXNlckFnZW50LnVzZXJBZ2VudENvcmUuY29uZmlndXJhdGlvbi5hb3I7XG4gICAgICAgIGlmIChpbnZpdGVyT3B0aW9ucy5wYXJhbXMuZnJvbVVyaSkge1xuICAgICAgICAgICAgZnJvbVVSSSA9XG4gICAgICAgICAgICAgICAgdHlwZW9mIGludml0ZXJPcHRpb25zLnBhcmFtcy5mcm9tVXJpID09PSBcInN0cmluZ1wiXG4gICAgICAgICAgICAgICAgICAgID8gR3JhbW1hci5VUklQYXJzZShpbnZpdGVyT3B0aW9ucy5wYXJhbXMuZnJvbVVyaSlcbiAgICAgICAgICAgICAgICAgICAgOiBpbnZpdGVyT3B0aW9ucy5wYXJhbXMuZnJvbVVyaTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoIWZyb21VUkkpIHtcbiAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoXCJJbnZhbGlkIGZyb20gVVJJOiBcIiArIGludml0ZXJPcHRpb25zLnBhcmFtcy5mcm9tVXJpKTtcbiAgICAgICAgfVxuICAgICAgICBsZXQgdG9VUkkgPSB0YXJnZXRVUkk7XG4gICAgICAgIGlmIChpbnZpdGVyT3B0aW9ucy5wYXJhbXMudG9VcmkpIHtcbiAgICAgICAgICAgIHRvVVJJID1cbiAgICAgICAgICAgICAgICB0eXBlb2YgaW52aXRlck9wdGlvbnMucGFyYW1zLnRvVXJpID09PSBcInN0c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kIGNhbmNlbGxhdGlvbiwgYWNrICYgYnllIHRoaXMgc2Vzc2lvbi5cbiAgICAgICAgICAgICAgICBpZiAodGhpcy5pc0NhbmNlbGVkKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLmxvZyhcIkNhbmNlbGVkIHNlc3Npb24gYWNjZXB0ZWQsIHNlbmRpbmcgQUNLIGFuZCBCWUVcIik7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuYWNrQW5kQnllKGludml0ZVJlc3BvbnNlKTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5zdGF0ZVRyYW5zaXRpb24oU2Vzc2lvblN0YXRlLlRlcm1pbmF0ZWQpO1xuICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHRoaXMubm90aWZ5UmVmZXJlcihpbnZpdGVSZXNwb25zZSk7XG4gICAgICAgICAgICAgICAgdGhpcy5vbkFjY2VwdChpbnZpdGVSZXNwb25zZSlcbiAgICAgICAgICAgICAgICAgICAgLnRoZW4oKCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmRpc3Bvc2VFYXJseU1lZGlhKCk7XG4gICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgICAgICAgLmNhdGNoKCgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5kaXNwb3NlRWFybHlNZWRpYSgpO1xuICAgICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICAgICAgICAgIC50aGVuKCgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKG9wdGlvbnMucmVxdWVzdERlbGVnYXRlICYmIG9wdGlvbnMucmVxdWVzdERlbGVnYXRlLm9uQWNjZXB0KSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBvcHRpb25zLnJlcXVlc3REZWxlZ2F0ZS5vbkFjY2VwdChpbnZpdGVSZXNwb25zZSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBvblByb2dyZXNzOiAoaW52aXRlUmVzcG9uc2UpID0+IHtcbiAgICAgICAgICAgICAgICAvLyBJZiB0aGUgdXNlciByZXF1ZXN0ZWQgY2FuY2VsbGF0aW9uLCBpZ25vcmUgcmVzcG9uc2UuXG4gICAgICAgICAgICAgICAgaWYgKHRoaXMuaXNDYW5jZWxlZCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHRoaXMubm90aWZ5UmVmZXJlcihpbnZpdGVSZXNwb25zZSk7XG4gICAgICAgICAgICAgICAgdGhpcy5vblByb2dyZXNzKGludml0ZVJlc3BvbnNlKVxuICAgICAgICAgICAgICAgICAgICAuY2F0Y2goKCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmRpc3Bvc2VFYXJseU1lZGlhKCk7XG4gICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgICAgICAgLnRoZW4oKCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICBpZiAob3B0aW9ucy5yZXF1ZXN0RGVsZWdhdGUgJiYgb3B0aW9ucy5yZXF1ZXN0RGVsZWdhdGUub25Qcm9ncmVzcykge1xuICAgICAgICAgICAgICAgICAgICAgICAgb3B0aW9ucy5yZXF1ZXN0RGVsZWdhdGUub25Qcm9ncmVzcyhpbnZpdGVSZXNwb25zZSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBvblJlZGlyZWN0OiAoaW52aXRlUmVzcG9uc2UpID0+IHtcbiAgICAgICAgICAgICAgICB0aGlzLm5vdGlmeVJlZmVyZXIoaW52aXRlUmVzcG9uc2UpO1xuICAgICAgICAgICAgICAgIHRoaXMub25SZWRpcmVjdChpbnZpdGVSZXNwb25zZSk7XG4gICAgICAgICAgICAgICAgaWYgKG9wdGlvbnMucmVxdWVzdERlbGVnYXRlICYmIG9wdGlvbnMucmVxdWVzdERlbGVnYXRlLm9uUmVkaXJlY3QpIHtcbiAgICAgICAgICAgICAgICAgICAgb3B0aW9ucy5yZXF1ZXN0RGVsZWdhdGUub25SZWRpcmVjdChpbnZpdGVSZXNwb25zZSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIG9uUmVqZWN0OiAoaW52aXRlUmVzcG9uc2UpID0+IHtcbiAgICAgICAgICAgICAgICB0aGlzLm5vdGlmeVJlZmVyZXIoaW52aXRlUmVzcG9uc2UpO1xuICAgICAgICAgICAgICAgIHRoaXMub25SZWplY3QoaW52aXRlUmVzcG9uc2UpO1xuICAgICAgICAgICAgICAgIGlmIChvcHRpb25zLnJlcXVlc3REZWxlZ2F0ZSAmJiBvcHRpb25zLnJlcXVlc3REZWxlZ2F0ZS5vblJlamVjdCkge1xuICAgICAgICAgICAgICAgICAgICBvcHRpb25zLnJlcXVlc3REZWxlZ2F0ZS5vblJlamVjdChpbnZpdGVSZXNwb25zZSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIG9uVHJ5aW5nOiAoaW52aXRlUmVzcG9uc2UpID0+IHtcbiAgICAgICAgICAgICAgICB0aGlzLm5vdGlmeVJlZmVyZXIoaW52aXRlUmVzcG9uc2UpO1xuICAgICAgICAgICAgICAgIHRoaXMub25UcnlpbmcoaW52aXRlUmVzcG9uc2UpO1xuICAgICAgICAgICAgICAgIGlmIChvcHRpb25zLnJlcXVlc3REZWxlZ2F0ZSAmJiBvcHRpb25zLnJlcXVlc3REZWxlZ2F0ZS5vblRyeWluZykge1xuICAgICAgICAgICAgICAgICAgICBvcHRpb25zLnJlcXVlc3REZWxlZ2F0ZS5vblRyeWluZyhpbnZpdGVSZXNwb25zZSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICA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maW5lZCBpbiBzaWduYWxpbmcgc3RhdGUgJHt0aGlzLl9kaWFsb2cuc2lnbmFsaW5nU3RhdGV9LmApO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBjb25zdCBvcHRpb25zID0ge1xuICAgICAgICAgICAgICAgICAgICBzZXNzaW9uRGVzY3JpcHRpb25IYW5kbGVyTW9kaWZpZXJzOiB0aGlzLnNlc3Npb25EZXNjcmlwdGlvbkhhbmRsZXJNb2RpZmllcnMsXG4gICAgICAgICAgICAgICAgICAgIHNlc3Npb25EZXNjcmlwdGlvbkhhbmRsZXJPcHRpb25zOiB0aGlzLnNlc3Npb25EZXNjcmlwdGlvbkhhbmRsZXJPcHRpb25zXG4gICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5zZXRPZmZlckFuZEdldEFuc3dlcih0aGlzLl9kaWFsb2cub2ZmZXIsIG9wdGlvbnMpXG4gICAgICAgICAgICAgICAgICAgIC50aGVuKChib2R5KSA9PiB7XG4gICAgICAgICAgICAgICAgICAgIGludml0ZVJlc3BvbnNlLmFjayh7IGJvZHkgfSk7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuc3RhdGVUcmFuc2l0aW9uKFNlc3Npb25TdGF0ZS5Fc3RhYmxpc2hlZCk7XG4gICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgICAgICAgLmNhdGNoKChlcnJvcikgPT4ge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmFja0FuZEJ5ZShpbnZpdGVSZXNwb25zZSwgNDg4LCBcIkludmFsaWQgc2Vzc2lvbiBkZXNjcmlwdGlvblwiKTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5zdGF0ZVRyYW5zaXRpb24oU2Vzc2lvblN0YXRlLlRlcm1pbmF0ZWQpO1xuICAgICAgICAgICAgICAgICAgICB0aHJvdyBlcnJvcjtcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGNhc2UgU2lnbmFsaW5nU3RhdGUuU3RhYmxlOiB7XG4gICAgICAgICAgICAgICAgLy8gSWYgSU5WSVRFIHdpdGhvdXQgb2ZmZXIgYW5kIHdlIGhhdmUgYWxyZWFkeSBjb21wbGV0ZWQgdGhlIGluaXRpYWwgZXhjaGFuZ2UuXG4gICAgICAgICAgICAgICAgaWYgKHRoaXMuZWFybHlNZWRpYVNlc3Npb25EZXNjcmlwdGlvbkhhbmRsZXJzLnNpemUgPiAwKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHNkaCA9IHRoaXMuZWFybHlNZWRpYVNlc3Npb25EZXNjcmlwdGlvbkhhbmRsZXJzLmdldChzZXNzaW9uLmlkKTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFzZGgpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcIlNlc3Npb24gZGVzY3JpcHRpb24gaGFuZGxlciB1bmRlZmluZWQuXCIpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuc2V0U2Vzc2lvbkRlc2NyaXB0aW9uSGFuZGxlcihzZGgpO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmVhcmx5TWVkaWFTZXNzaW9uRGVzY3JpcHRpb25IYW5kbGVycy5kZWxldGUoc2Vzc2lvbi5pZCk7XG4gICAgICAgICAgICAgICAgICAgIGludml0ZVJlc3BvbnNlLmFjaygpO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnN0YXRlVHJhbnNpdGlvbihTZXNzaW9uU3RhdGUuRXN0YWJsaXNoZWQpO1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gUHJvbWlzZS5yZXNvbHZlKCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIC8vIElmIElOVklURSB3aXRoIG9mZmVyIGFuZCB3ZSB1c2VkIGFuIFwiZWFybHlcIiBhbnN3ZXIgaW4gYSB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AgICAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIuZXJyb3IobWVzc2FnZSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBlcnJvciA9IG5ldyBFcnJvcihcIkVhcmx5IG1lZGlhIGRpYWxvZyBkb2VzIG5vdCBlcXVhbCBjb25maXJtZWQgZGlhbG9nLCB0ZXJtaW5hdGluZyBzZXNzaW9uXCIpO1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIuZXJyb3IoZXJyb3IubWVzc2FnZSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmFja0FuZEJ5ZShpbnZpdGVSZXNwb25zZSwgNDg4LCBcIk5vdCBBY2NlcHRhYmxlIEhlcmVcIik7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnN0YXRlVHJhbnNpdGlvbihTZXNzaW9uU3RhdGUuVGVybWluYXRlZCk7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gUHJvbWlzZS5yZWplY3QoZXJyb3IpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIC8vIE90aGVyd2lzZSB3ZSBhcmUgZ29vZCB0byBnby5cbiAgICAgICAgICAgICAgICAgICAgaW52aXRlUmVzcG9uc2UuYWNrKCk7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuc3RhdGVUcmFuc2l0aW9uKFNlc3Npb25TdGF0ZS5Fc3RhYmxpc2hlZCk7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBQcm9taXNlLnJlc29sdmUoKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgLy8gSWYgSU5WSVRFIHdpdGggb2ZmZXIgYW5kIHdlIGhhdmUgYmVlbiB3YWl0aW5nIHRpbGwgbm93IHRvIGFwcGx5IHRoZSBhbnN3ZXIuXG4gICAgICAgICAgICAgICAgY29uc3QgYW5zd2VyID0gc2Vzc2lvbi5hbnN3ZXI7XG4gICAgICAgICAgICAgICAgaWYgKCFhbnN3ZXIpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwiQW5zd2VyIGlzIHVuZGVmaW5lZC5cIik7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGNvbnN0IG9wdGlvbnMgPSB7XG4gICAgICAgICAgICAgICAgICAgIHNlc3Npb25EZXNjcmlwdGlvbkhhbmRsZXJNb2RpZmllcnM6IHRoaXMuc2Vzc2lvbkRlc2NyaXB0aW9uSGFuZGxlck1vZGlmaWVycyxcbiAgICAgICAgICAgICAgICAgICAgc2Vzc2lvbkRlc2NyaXB0aW9uSGFuZGxlck9wdGlvbnM6IHRoaXMuc2Vzc2lvbkRlc2NyaXB0aW9uSGFuZGxlck9wdGlvbnNcbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnNldEFuc3dlcihhbnN3ZXIsIG9wdGlvbnMpXG4gICAgICAgICAgICAgICAgICAgIC50aGVuKCgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgLy8gVGhpcyBzZXNzaW9uIGhhcyBjb21wbGV0ZWQgYW4gaW5pdGlhbCBvZmZlci9hbnN3ZXIgZXhjaGFuZ2UuLi5cbiAgICAgICAgICAgICAgICAgICAgbGV0IGFja09wdGlvbnM7XG4gICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLl9yZW5kZXJib2R5ICYmIHRoaXMuX3JlbmRlcnR5cGUpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGFja09wdGlvbnMgPSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9keTogeyBjb250ZW50RGlzcG9zaXRpb246IFwicmVuZGVyXCIsIGNvbnRlbnRUeXBlOiB0aGlzLl9yZW5kZXJ0eXBlLCBjb250ZW50OiB0aGlzLl9yZW5kZXJib2R5IH1cbiAgICAgICAgICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgaW52aXRlUmVzcG9uc2UuYWNrKGFja09wdGlvbnMpO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnN0YXRlVHJhbnNpdGlvbihTZXNzaW9uU3RhdGUuRXN0YWJsaXNoZWQpO1xuICAgICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICAgICAgICAgIC5jYXRjaCgoZXJyb3IpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIuZXJyb3IoZXJyb3IubWVzc2FnZSk7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuYWNrQW5kQnllKGludml0ZVJlc3BvbnNlLCA0ODgsIFwiTm90IEFjY2VwdGFibGUgSGVyZVwiKTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5zdGF0ZVRyYW5zaXRpb24oU2Vzc2lvblN0YXRlLlRlcm1pbmF0ZWQpO1xuICAgICAgICAgICAgICAgICAgICB0aHJvdyBlcnJvcjtcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGNhc2UgU2lnbmFsaW5nU3RhdGUuQ2xvc2VkOlxuICAgICAgICAgICAgICAgIC8vIERpYWxvZyBoYXMgdGVybWluYXRlZC5cbiAgICAgICAgICAgICAgICByZXR1cm4gUHJvbWlzZS5yZWplY3QobmV3IEVycm9yKFwiVGVybWluYXRlZC5cIikpO1xuICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJVbmtub3duIHNlc3Npb24gc2lnbmFsaW5nIHN0YXRlLlwiKTtcbiAgICAgICAgfVxuICAgIH1cbiAgICAvKipcbiAgICAgKiBIYW5kbGUgcHJvdmlzaW9uYWwgcmVzcG9uc2UgdG8gaW5pdGlhbCBJTlZJVEUuXG4gICAgICogQHBhcmFtIGludml0ZVJlc3BvbnNlIC0gMXh4IHJlc3BvbnNlLlx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biAgICAgICAgICAgICAgICAgICAgLy8gRklYTUU6IEtub3duIHBvcHVsYXIgVUEncyBjdXJyZW50bHkgZW5kIHVwIGhlcmUuLi5cbiAgICAgICAgICAgICAgICAgICAgaW52aXRlUmVzcG9uc2UucHJhY2soeyBleHRyYUhlYWRlcnMgfSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHJldHVybiBQcm9taXNlLnJlc29sdmUoKTtcbiAgICAgICAgICAgIGNhc2UgU2lnbmFsaW5nU3RhdGUuSGF2ZUxvY2FsT2ZmZXI6XG4gICAgICAgICAgICAgICAgLy8gSU5WSVRFIHdpdGggb2ZmZXIgYW5kIHNlc3Npb24gb25seSBoYXMgdGhhdCBpbml0aWFsIGxvY2FsIG9mZmVyLlxuICAgICAgICAgICAgICAgIGlmIChyZXNwb25zZVJlbGlhYmxlKSB7XG4gICAgICAgICAgICAgICAgICAgIGludml0ZVJlc3BvbnNlLnByYWNrKHsgZXh0cmFIZWFkZXJzIH0pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICByZXR1cm4gUHJvbWlzZS5yZXNvbHZlKCk7XG4gICAgICAgICAgICBjYXNlIFNpZ25hbGluZ1N0YXRlLkhhdmVSZW1vdGVPZmZlcjpcbiAgICAgICAgICAgICAgICBpZiAoIXJlc3BvbnNlUmVsaWFibGUpIHtcbiAgICAgICAgICAgICAgICAgICAgLy8gVGhlIGluaXRpYWwgb2ZmZXIgTVVTVCBiZSBpbiBlaXRoZXIgYW4gSU5WSVRFIG9yLCBpZiBub3QgdGhlcmUsXG4gICAgICAgICAgICAgICAgICAgIC8vIGluIHRoZSBmaXJzdCByZWxpYWJsZSBub24tZmFpbHVyZSBtZXNzYWdlIGZyb20gdGhlIFVBUyBiYWNrIHRvXG4gICAgICAgICAgICAgICAgICAgIC8vIHRoZSBVQUMuXG4gICAgICAgICAgICAgICAgICAgIC8vIGh0dHBzOi8vdG9vbHMuaWV0Zi5vcmcvaHRtbC9yZmM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gICAgICAgICAgICAgICAgICAgcmV0dXJuIFByb21pc2UucmVzb2x2ZSgpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgICAgIC8vIElmIHRoZSBpbml0aWFsIG9mZmVyIGlzIGluIHRoZSBmaXJzdCByZWxpYWJsZSBub24tZmFpbHVyZVxuICAgICAgICAgICAgICAgICAgICAvLyBtZXNzYWdlIGZyb20gdGhlIFVBUyBiYWNrIHRvIFVBQywgdGhlIGFuc3dlciBNVVNUIGJlIGluIHRoZVxuICAgICAgICAgICAgICAgICAgICAvLyBhY2tub3dsZWRnZW1lbnQgZm9yIHRoYXQgbWVzc2FnZVxuICAgICAgICAgICAgICAgICAgICBjb25zdCBzZGggPSB0aGlzLnNlc3Npb25EZXNjcmlwdGlvbkhhbmRsZXJGYWN0b3J5KHRoaXMsIHRoaXMudXNlckFnZW50LmNvbmZpZ3VyYXRpb24uc2Vzc2lvbkRlc2NyaXB0aW9uSGFuZGxlckZhY3RvcnlPcHRpb25zIHx8IHt9KTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKChfYSA9IHRoaXMuZGVsZWdhdGUpID09PSBudWxsIHx8IF9hID09PSB2b2lkIDAgPyB2b2lkIDAgOiBfYS5vblNlc3Npb25EZXNjcmlwdGlvbkhhbmRsZXIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZGVsZWdhdGUub25TZXNzaW9uRGVzY3JpcHRpb25IYW5kbGVyKHNkaCwgdHJ1ZSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgdGhpcy5lYXJseU1lZGlhU2Vzc2lvbkRlc2NyaXB0aW9uSGFuZGxlcnMuc2V0KHNlc3Npb24uaWQsIHNkaCk7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBzZGhcbiAgICAgICAgICAgICAgICAgICAgICAgIC5zZXREZXNjcmlwdGlvbihyZXNwb25zZS5ib2R5LCB0aGlzLnNlc3Npb25EZXNjcmlwdGlvbkhhbmRsZXJPcHRpb25zLCB0aGlzLnNlc3Npb25EZXNjcmlwdGlvbkhhbmRsZXJNb2RpZmllcnMpXG4gICAgICAgICAgICAgICAgICAgICAgICAudGhlbigoKSA9PiBzZGguZ2V0RGVzY3JpcHRpb24odGhpcy5zZXNzaW9uRGVzY3JpcHRpb25IYW5kbGVyT3B0aW9ucywgdGhpcy5zZXNzaW9uRGVzY3JpcHRpb25IYW5kbGVyTW9kaWZpZXJzKSlcbiAgICAgICAgICAgICAgICAgICAgICAgIC50aGVuKChkZXNjcmlwdGlvbikgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgYm9keSA9IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250ZW50RGlzcG9zaXRpb246IFwic2Vzc2lvblwiLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRlbnRUeXBlOiBkZXNjcmlwdGlvbi5jb250ZW50VHlwZSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250ZW50OiBkZXNjcmlwdGlvbi5ib2R5XG4gICAgICAgICAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgICAgICAgICAgaW52aXRlUmVzcG9uc2UucHJhY2soeyBleHRyYUhlYWRlcnMsIGJvZHkgfSk7XG4gICAgICAgICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICAgICAgICAgICAgICAuY2F0Y2goKGVycm9yKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnN0YXRlVHJhbnNpdGlvbihTZXNzaW9uU3RhdGUuVGVybWluYXRlZCk7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBlcnJvcjtcbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgY2FzZSBTaWduYWxpbmdTdGF0ZS5TdGFibGU6XG4gICAgICAgICAgICAgICAgLy8gVGhpcyBzZXNzaW9uIGhhcyBjb21wbGV0ZWQgYW4gaW5pdGlhbCBvZmZlci9hbnN3ZXIgZXhjaGFuZ2UsIHNvLi4uXG4gICAgICAgICAgICAgICAgLy8gLSBJTlZJVEUgd2l0aCBTRFAgYW5kIHRoaXMgcHJvdmlzaW9uYWwgcmVzcG9uc2UgTUFZIGJlIHJlbGlhYmxlXG4gICAgICAgICAgICAgICAgLy8gLSBJTlZJVEUgd2l0aG91dCBTRFAgYW5kIHRoaXMgcHJvdmlzaW9uYWwgcmVzcG9uc2UgTUFZIGJlIHJlbGlhYmxlXG4gICAgICAgICAgICAgICAgaWYgKHJlc3BvbnNlUmVsaWFibGUpIHtcbiAgICAgICAgICAgICAgICAgICAgaW52aXRlUmVzcG9uc2UucHJhY2soeyBleHRyYUhlYWRlcnMgfSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmICh0aGlzLmVhcmx5TWVkaWEgJiYgIXRoaXMuZWFybHlNZWRpYURpYWxvZykge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmVhcmx5TWVkaWFEaWFsb2cgPSBzZXNzaW9uO1xuICAgICAgICAgICAgICAgICAgICBjb25zdCBhbnN3ZXIgPSBzZXNzaW9uLmFuc3dlcjtcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFhbnN3ZXIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcIkFuc3dlciBpcyB1bmRlZmluZWQuXCIpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IG9wdGlvbnMgPSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBzZXNzaW9uRGVzY3JpcHRpb25IYW5kbGVyTW9kaWZpZXJzOiB0aGlzLnNlc3Npb25EZXNjcmlwdGlvbkhhbmRsZXJNb2RpZmllcnMsXG4gICAgICAgICAgICAgICAgICAgICAgICBzZXNzaW9uRGVzY3JpcHRpb25IYW5kbGVyT3B0aW9uczogdGhpcy5zZXNzaW9uRGVzY3JpcHRpb25IYW5kbGVyT3B0aW9uc1xuICAgICAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5zZXRBbnN3ZXIoYW5zd2VyLCBvcHRpb25zKS5jYXRjaCgoZXJyb3IpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc3RhdGVUcmFuc2l0aW9uKFNlc3Npb25TdGF0ZS5UZXJtaW5hdGVkKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IGVycm9yO1xuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgcmV0dXJuIFByb21pc2UucmVzb2x2ZSgpO1xuICAgICAgICAgICAgY2FzZSBTaWduYWxpbmdTdGF0ZS5DbG9zZWQ6XG4gICAgICAgICAgICAgICAgLy8gRGlhbG9nIGhhcyB0ZXJtaW5hdGVkLlxuICAgICAgICAgICAgICAgIHJldHVybiBQcm9taXNlLnJlamVjdChuZXcgRXJyb3IoXCJUZXJtaW5hdGVkLlwiKSk7XG4gICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcIlVua25vd24gc2Vzc2lvbiBzaWduYWxpbmcgc3RhdGUuXCIpO1xuICAgICAgICB9XG4gICAgfVxuICAgIC8qKlxuICAgICAqIEhhbmRsZSBmaW5hbCByZXNwb25zZSB0byBpbml0aWFsIElOVklURS5cbiAgICAgKiBAcGFyYW0gaW52aXRlUmVzcG9uc2UgLSAzeHggcmVzcG9uc2UuXG4gICAgICovXG4gICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIEB0eXBlc2NyaXB0LWVzbGludC9uby11bnVzZWQtdmFyc1xuICAgIG9uUmVkaXJlY3QoaW52aXRlUmVzcG9uc2UpIHtcbiAgICAgICAgdGhpcy5sb2dnZXIubG9nKFwiSW52aXRlci5vblJlZGlyZ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LmZyb21VcmkpIDogb3B0aW9ucy5wYXJhbXMuZnJvbVVyaTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoIWZyb21VUkkpIHtcbiAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoXCJJbnZhbGlkIGZyb20gVVJJOiBcIiArIG9wdGlvbnMucGFyYW1zLmZyb21VcmkpO1xuICAgICAgICB9XG4gICAgICAgIGxldCB0b1VSSSA9IHRhcmdldFVSSTtcbiAgICAgICAgaWYgKG9wdGlvbnMucGFyYW1zLnRvVXJpKSB7XG4gICAgICAgICAgICB0b1VSSSA9IHR5cGVvZiBvcHRpb25zLnBhcmFtcy50b1VyaSA9PT0gXCJzdHJpbmdcIiA/IEdyYW1tYXIuVVJJUGFyc2Uob3B0aW9ucy5wYXJhbXMudG9VcmkpIDogb3B0aW9ucy5wYXJhbXMudG9Vcmk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKCF0b1VSSSkge1xuICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcihcIkludmFsaWQgdG8gVVJJOiBcIiArIG9wdGlvbnMucGFyYW1zLnRvVXJpKTtcbiAgICAgICAgfVxuICAgICAgICAvLyBNZXNzYWdlIHBhcmFtc1xuICAgICAgICBjb25zdCBwYXJhbXMgPSBvcHRpb25zLnBhcmFtcyA/IE9iamVjdC5hc3NpZ24oe30sIG9wdGlvbnMucGFyYW1zKSA6IHt9O1xuICAgICAgICAvLyBFeHRyYSBoZWFkZXJzXG4gICAgICAgIGNvbnN0IGV4dHJhSGVhZGVycyA9IChvcHRpb25zLmV4dHJhSGVhZGVycyB8fCBbXSkuc2xpY2UoKTtcbiAgICAgICAgLy8gQm9keVxuICAgICAgICBjb25zdCBjb250ZW50RGlzcG9zaXRpb24gPSBcInJlbmRlclwiO1xuICAgICAgICBjb25zdCBib2R5ID0ge1xuICAgICAgICAgICAgY29udGVudERpc3Bvc2l0aW9uLFxuICAgICAgICAgICAgY29udGVudFR5cGUsXG4gICAgICAg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AgICB9XG4gICAgLyoqIEFjY2VwdCB0aGUgcmVxdWVzdC4gKi9cbiAgICBhY2NlcHQob3B0aW9ucykge1xuICAgICAgICB0aGlzLmluY29taW5nTm90aWZ5UmVxdWVzdC5hY2NlcHQob3B0aW9ucyk7XG4gICAgICAgIHJldHVybiBQcm9taXNlLnJlc29sdmUoKTtcbiAgICB9XG4gICAgLyoqIFJlamVjdCB0aGUgcmVxdWVzdC4gKi9cbiAgICByZWplY3Qob3B0aW9ucykge1xuICAgICAgICB0aGlzLmluY29taW5nTm90aWZ5UmVxdWVzdC5yZWplY3Qob3B0aW9ucyk7XG4gICAgICAgIHJldHVybiBQcm9taXNlLnJlc29sdmUoKTtcbiAgICB9XG59XG4iLCIvKipcbiAqIHtAbGluayBQdWJsaXNoZXJ9IHN0YXRlLlxuICogQHJlbWFya3NcbiAqIFRoZSB7QGxpbmsgUHVibGlzaGVyfSBiZWhhdmVzIGluIGEgZGV0ZXJtaW5pc3RpYyBtYW5uZXIgYWNjb3JkaW5nIHRvIHRoZSBmb2xsb3dpbmdcbiAqIEZpbml0ZSBTdGF0ZSBNYWNoaW5lIChGU00pLlxuICogYGBgdHh0XG4gKiAgICAgICAgICAgICAgICAgIF9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX1xuICogICAgICAgICAgICAgICAgIHwgIF9fX19fX19fX19fX19fX19fX19fX19fX19fICAgICAgICAgICAgICB8XG4gKiBQdWJsaXNoZXIgICAgICAgfCB8ICAgICAgICAgICAgICAgICAgICAgICAgICB2ICAgICAgICAgICAgIHZcbiAqIENvbnN0cnVjdGVkIC0+IEluaXRpYWwgLT4gUHVibGlzaGVkIC0+IFVucHVibGlzaGVkIC0+IFRlcm1pbmF0ZWRcbiAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgIF5fX19fX19fX19fX198ICAgICAgICAgICAgIF5cbiAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfF9fX19fX19fX19fX19fX19fX19fX19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udFR5cGUgPSBvcHRpb25zLmNvbnRlbnRUeXBlO1xuICAgICAgICAgICAgY29uc3QgY29udGVudCA9IG9wdGlvbnMuYm9keTtcbiAgICAgICAgICAgIGJvZHkgPSB7XG4gICAgICAgICAgICAgICAgY29udGVudERpc3Bvc2l0aW9uLFxuICAgICAgICAgICAgICAgIGNvbnRlbnRUeXBlLFxuICAgICAgICAgICAgICAgIGNvbnRlbnRcbiAgICAgICAgICAgIH07XG4gICAgICAgIH1cbiAgICAgICAgY29uc3QgZXh0cmFIZWFkZXJzID0gKG9wdGlvbnMuZXh0cmFIZWFkZXJzIHx8IFtdKS5zbGljZSgpO1xuICAgICAgICAvLyBCdWlsZCB0aGUgcmVxdWVzdFxuICAgICAgICB0aGlzLnJlcXVlc3QgPSB1c2VyQWdlbnQudXNlckFnZW50Q29yZS5tYWtlT3V0Z29pbmdSZXF1ZXN0TWVzc2FnZShDLlBVQkxJU0gsIHRhcmdldFVSSSwgZnJvbVVSSSwgdG9VUkksIHBhcmFtcywgZXh0cmFIZWFkZXJzLCBib2R5KTtcbiAgICAgICAgLy8gSWRlbnRpZmllclxuICAgICAgICB0aGlzLmlkID0gdGhpcy50YXJnZXQudG9TdHJpbmcoKSArIFwiOlwiICsgdGhpcy5ldmVudDtcbiAgICAgICAgLy8gQWRkIHRvIHRoZSB1c2VyIGFnZW50J3MgcHVibGlzaGVyIGNvbGxlY3Rpb24uXG4gICAgICAgIHRoaXMudXNlckFnZW50Ll9wdWJsaXNoZXJzW3RoaXMuaWRdID0gdGhpcztcbiAgICB9XG4gICAgLyoqXG4gICAgICogRGVzdHJ1Y3Rvci5cbiAgICAgKi9cbiAgICBkaXNwb3NlKCkge1xuICAgICAgICBpZiAodGhpcy5kaXNwb3NlZCkge1xuICAgICAgICAgICAgcmV0dXJuIFByb21pc2UucmVzb2x2ZSgpO1xuICAgICAgICB9XG4gICAgICAgIHRoaXMuZGlzcG9zZWQgPSB0cnVlO1xuICAgICAgICB0aGlzLmxvZ2dlci5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gfHwgMDtcbiAgICAgICAgc3dpdGNoICh0cnVlKSB7XG4gICAgICAgICAgICBjYXNlIC9eMVswLTldezJ9JC8udGVzdChzdGF0dXNDb2RlLnRvU3RyaW5nKCkpOlxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSAvXjJbMC05XXsyfSQvLnRlc3Qoc3RhdHVzQ29kZS50b1N0cmluZygpKTpcbiAgICAgICAgICAgICAgICAvLyBTZXQgU0lQLUV0YWdcbiAgICAgICAgICAgICAgICBpZiAocmVzcG9uc2UuaGFzSGVhZGVyKFwiU0lQLUVUYWdcIikpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5wdWJSZXF1ZXN0RXRhZyA9IHJlc3BvbnNlLmdldEhlYWRlcihcIlNJUC1FVGFnXCIpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIud2FybihcIlNJUC1FVGFnIGhlYWRlciBtaXNzaW5nIGluIGEgMjAwLWNsYXNzIHJlc3BvbnNlIHRvIFBVQkxJU0hcIik7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIC8vIFVwZGF0ZSBFeHBpcmVcbiAgICAgICAgICAgICAgICBpZiAocmVzcG9uc2UuaGFzSGVhZGVyKFwiRXhwaXJlc1wiKSkge1xuICAgICAgICAgICAgICAgICAgICBjb25zdCBleHBpcmVzID0gTnVtYmVyKHJlc3BvbnNlLmdldEhlYWRlcihcIkV4cGlyZXNcIikpO1xuICAgICAgICAgICAgICAgICAgICBpZiAodHlwZW9mIGV4cGlyZXMgPT09IFwibnVtYmVyXCIgJiYgZXhwaXJlcyA+PSAwICYmIGV4cGlyZXMgPD0gdGhpcy5wdWJSZXF1ZXN0RXhwaXJlcykge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5wdWJSZXF1ZXN0RXhwaXJlcyA9IGV4cGlyZXM7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci53YXJuKFwiQmFkIEV4cGlyZXMgaGVhZGVyIGluIGEgMjAwLWNsYXNzIHJlc3BvbnNlIHRvIFBVQkxJU0hcIik7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLndhcm4oXCJFeHBpcmVzIGhlYWRlciBtaXNzaW5nIGluIGEgMjAwLWNsYXNzIHJlc3BvbnNlIHRvIFBVQkxJU0hcIik7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmICh0aGlzLnB1YlJlcXVlc3RFeHBpcmVzICE9PSAwKSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIFNjaGVkdWxlIHJlZnJlc2hcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5wdWJsaXNoUmVmcmVzaFRpbWVyID0gc2V0VGltZW91dCgoKSA9PiB0aGlzLnJlZnJlc2hSZXF1ZXN0KCksIHRoaXMucHViUmVxdWVzdEV4cGlyZXMgKiA5MDApO1xuICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5fc3RhdGUgIT09IFB1Ymxpc2hlclN0YXRlLlB1Ymxpc2hlZCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5zdGF0ZVRyYW5zaXRpb24oUHVibGlzaGVyU3RhdGUuUHVibGlzaGVkKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5zdGF0ZVRyYW5zaXRpb24oUHVibGlzaGVyU3RhdGUuVW5wdWJsaXNoZWQpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgL140MTIkLy50ZXN0KHN0YXR1c0NvZGUudG9TdHJpbmcoKSk6XG4gICAgICAgICAgICAgICAgLy8gNDEyIGNvZGUgbWVhbnMgbm8gbWF0Y2hpbmcgRVRhZyAtIHBvc3NpYmx5IHRoZSBQVUJMSVNIIGV4cGlyZWRcbiAgICAgICAgICAgICAgICAvLyBSZXN1Ym1pdCBhcyBuZXcgcmVxdWVzdCwgaWYgdGhlIGN1cnJlbnQgcmVxdWVzdCBpcyBub3QgYSBcInJlbW92ZVwiXG4gICAgICAgICAgICAgICAgaWYgKHRoaXMucHViUmVxdWVzdEV0YWcgIT09IHVuZGVmaW5lZCAmJiB0aGlzLnB1YlJlcXVlc3RFeHBpcmVzICE9PSAwKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLndhcm4oXCI0MTIgcmVzcG9uc2UgdG8gUFVCTElTSCwgcmVjb3ZlcmluZ1wiKTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5wdWJSZXF1ZXN0RXRhZyA9IHVuZGVmaW5lZDtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMub3B0aW9ucy5ib2R5ID09PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcIkJvZHkgdW5kZWZpbmVkLlwiKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB0aGlzLnB1Ymxpc2godGhpcy5vcHRpb25zLmJvZHkpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIud2FybihcIjQxMiByZXNwb25zZSB0byBQVUJMSVNILCByZWNvdmVyeSBmYWlsZWRcIik7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMucHViUmVxdWVzdEV4cGlyZXMgPSAwO1xuICAgICAgICAgICAgICAgICAgICB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AgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJCb2R5IHVuZGVmaW5lZC5cIik7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnB1Ymxpc2godGhpcy5vcHRpb25zLmJvZHkpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIud2FybihcIkJhZCA0MjMgcmVzcG9uc2UgTWluLUV4cGlyZXMgaGVhZGVyIHJlY2VpdmVkIGZvciBQVUJMSVNIXCIpO1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5wdWJSZXF1ZXN0RXhwaXJlcyA9IDA7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnN0YXRlVHJhbnNpdGlvbihQdWJsaXNoZXJTdGF0ZS5VbnB1Ymxpc2hlZCk7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnN0YXRlVHJhbnNpdGlvbihQdWJsaXNoZXJTdGF0ZS5UZXJtaW5hdGVkKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIud2FybihcIjQyMyByZXNwb25zZSB0byBQVUJMSVNILCByZWNvdmVyeSBmYWlsZWRcIik7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMucHViUmVxdWVzdEV4cGlyZXMgPSAwO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnN0YXRlVHJhbnNpdGlvbihQdWJsaXNoZXJTdGF0ZS5VbnB1Ymxpc2hlZCk7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuc3RhdGVUcmFuc2l0aW9uKFB1Ymxpc2hlclN0YXRlLlRlcm1pbmF0ZWQpO1xuICAgICAgICAgICAgICAgIH1c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iAgICB9XG4gICAgc2VuZFB1Ymxpc2hSZXF1ZXN0KCkge1xuICAgICAgICBjb25zdCByZXFPcHRpb25zID0gT2JqZWN0LmFzc2lnbih7fSwgdGhpcy5vcHRpb25zKTtcbiAgICAgICAgcmVxT3B0aW9ucy5leHRyYUhlYWRlcnMgPSAodGhpcy5vcHRpb25zLmV4dHJhSGVhZGVycyB8fCBbXSkuc2xpY2UoKTtcbiAgICAgICAgcmVxT3B0aW9ucy5leHRyYUhlYWRlcnMucHVzaChcIkV2ZW50OiBcIiArIHRoaXMuZXZlbnQpO1xuICAgICAgICByZXFPcHRpb25zLmV4dHJhSGVhZGVycy5wdXNoKFwiRXhwaXJlczogXCIgKyB0aGlzLnB1YlJlcXVlc3RFeHBpcmVzKTtcbiAgICAgICAgaWYgKHRoaXMucHViUmVxdWVzdEV0YWcgIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgcmVxT3B0aW9ucy5leHRyYUhlYWRlcnMucHVzaChcIlNJUC1JZi1NYXRjaDogXCIgKyB0aGlzLnB1YlJlcXVlc3RFdGFnKTtcbiAgICAgICAgfVxuICAgICAgICBjb25zdCBydXJpID0gdGhpcy50YXJnZXQ7XG4gICAgICAgIGNvbnN0IHBhcmFtcyA9IHRoaXMub3B0aW9ucy5wYXJhbXMgfHwge307XG4gICAgICAgIGxldCBib2R5QW5kQ29udGVudFR5cGU7XG4gICAgICAgIGlmICh0aGlzLnB1YlJlcXVlc3RCb2R5ICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgIGlmICh0aGlzLm9wdGlvbnMuY29udGVudFR5cGUgPT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcIkNvbnRlbnQgdHlwZSB1bmRlZmluZWQuXCIpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgYm9keUFuZENvbnRlbnRUeXBlID0ge1xuICAgICAgICAgICAgICAgIGJvZHk6IHRoaXMucHViUmVxdWVzdEJvZ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F0ZS5Jbml0aWFsOlxuICAgICAgICAgICAgICAgIGlmIChuZXdTdGF0ZSAhPT0gUHVibGlzaGVyU3RhdGUuUHVibGlzaGVkICYmXG4gICAgICAgICAgICAgICAgICAgIG5ld1N0YXRlICE9PSBQdWJsaXNoZXJTdGF0ZS5VbnB1Ymxpc2hlZCAmJlxuICAgICAgICAgICAgICAgICAgICBuZXdTdGF0ZSAhPT0gUHVibGlzaGVyU3RhdGUuVGVybWluYXRlZCkge1xuICAgICAgICAgICAgICAgICAgICBpbnZhbGlkVHJhbnNpdGlvbigpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgUHVibGlzaGVyU3RhdGUuUHVibGlzaGVkOlxuICAgICAgICAgICAgICAgIGlmIChuZXdTdGF0ZSAhPT0gUHVibGlzaGVyU3RhdGUuVW5wdWJsaXNoZWQgJiYgbmV3U3RhdGUgIT09IFB1Ymxpc2hlclN0YXRlLlRlcm1pbmF0ZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgaW52YWxpZFRyYW5zaXRpb24oKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIFB1Ymxpc2hlclN0YXRlLlVucHVibGlzaGVkOlxuICAgICAgICAgICAgICAgIGlmIChuZXdTdGF0ZSAhPT0gUHVibGlzaGVyU3RhdGUuUHVibGlzaGVkICYmIG5ld1N0YXRlICE9PSBQdWJsaXNoZXJTdGF0ZS5UZXJtaW5hdGVkKSB7XG4gICAgICAgICAgICAgICAgICAgIGludmFsaWRUcmFuc2l0aW9uKCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBQdWJsaXNoZXJTdGF0ZS5UZXJtaW5hdGVkOlxuICAgICAgICAgICAgICAgIGludmFsaWRUcmFuc2l0aW9uKCk7XG4gICAgICAgICAgICAgICAg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mVycmVkID0gdGhpcy5zZXNzaW9uO1xuICAgICAgICB0aGlzLnNlc3Npb24uX3JlZmVycmFsID0gdGhpcy5pbnZpdGVyO1xuICAgICAgICByZXR1cm4gdGhpcy5pbnZpdGVyO1xuICAgIH1cbn1cbiIsIi8qKlxuICoge0BsaW5rIFJlZ2lzdGVyZXJ9IHN0YXRlLlxuICogQHJlbWFya3NcbiAqIFRoZSB7QGxpbmsgUmVnaXN0ZXJlcn0gYmVoYXZlcyBpbiBhIGRldGVybWluaXN0aWMgbWFubmVyIGFjY29yZGluZyB0byB0aGUgZm9sbG93aW5nXG4gKiBGaW5pdGUgU3RhdGUgTWFjaGluZSAoRlNNKS5cbiAqIGBgYHR4dFxuICogICAgICAgICAgICAgICAgICAgX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fXG4gKiAgICAgICAgICAgICAgICAgIHwgIF9fX19fX19fX19fX19fX19fX19fX19fX19fICAgICAgICAgICAgICB8XG4gKiBSZWdpc3RlcmVyICAgICAgIHwgfCAgICAgICAgICAgICAgICAgICAgICAgICAgdiAgICAgICAgICAgICB2XG4gKiBDb25zdHJ1Y3RlZCAtPiBJbml0aWFsIC0+IFJlZ2lzdGVyZWQgLT4gVW5yZWdpc3RlcmVkIC0+IFRlcm1pbmF0ZWRcbiAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgIF5fX19fX19fX19fX198ICAgICAgICAgICAgIF5cbiAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfF9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX3xcbiAqIGBgYFxuICogQHB1YmxpY1xuICovXG5leHBvcnQgdmFyIFJlZ2lzdGVyZXJTdGF0ZTtcbihmdW5jdGlvbiAoUmVnaXN0ZXJlclN0YXRlKSB7XG4gICAgUmVnaXN0ZXJlclN0YXRlW1wiSW5pdGlhbFwiXSA9IFwiSW5pdGlhbFwiO1xuICAgIFJlZ2lzdGVyZXJTdGF0ZVtcIlJlZ2lzd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sga2V5ICsgXCI6IFwiICsgdmFsdWUpO1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5sb2coXCLCtyBcIiArIGtleSArIFwiOiBcIiArIEpTT04uc3RyaW5naWZ5KHZhbHVlKSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgICAgLy8gSWRlbnRpZmllclxuICAgICAgICB0aGlzLmlkID0gdGhpcy5yZXF1ZXN0LmNhbGxJZCArIHRoaXMucmVxdWVzdC5mcm9tLnBhcmFtZXRlcnMudGFnO1xuICAgICAgICAvLyBBZGQgdG8gdGhlIHVzZXIgYWdlbnQncyBzZXNzaW9uIGNvbGxlY3Rpb24uXG4gICAgICAgIHRoaXMudXNlckFnZW50Ll9yZWdpc3RlcmVyc1t0aGlzLmlkXSA9IHRoaXM7XG4gICAgfVxuICAgIC8qKiBEZWZhdWx0IHJlZ2lzdGVyZXIgb3B0aW9ucy4gKi9cbiAgICBzdGF0aWMgZGVmYXVsdE9wdGlvbnMoKSB7XG4gICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICBleHBpcmVzOiBSZWdpc3RlcmVyLmRlZmF1bHRFeHBpcmVzLFxuICAgICAgICAgICAgZXh0cmFDb250YWN0SGVhZGVyUGFyYW1zOiBbXSxcbiAgICAgICAgICAgIGV4dHJhSGVhZGVyczogW10sXG4gICAgICAgICAgICBsb2dDb25maWd1cmF0aW9uOiB0cnVlLFxuICAgICAgICAgICAgaW5zdGFuY2VJZDogXCJcIixcbiAgICAgICAgICAgIHBhcmFtczoge30sXG4gICAgICAgICAgICByZWdJZDogMCxcbiAgICAgICAgICAgIHJlZ2lzdHJhcjogbmV3IFVSSShcInNpcFwiLCBcImFub255bW91c1wiLCBcImFub255bW91cy5pbnZhbGlkXCIpLFxuICAgICAgICAgICAgcm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pID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMudGVybWluYXRlZCgpO1xuICAgICAgICAgICAgICAgICAgICAgICAgcmVzb2x2ZSgpO1xuICAgICAgICAgICAgICAgICAgICB9LCB7IG9uY2U6IHRydWUgfSk7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMudW5yZWdpc3RlcigpO1xuICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIC8vIE90aGVyd2lzZSBqdXN0IHJlc29sdmVcbiAgICAgICAgICAgICAgICB0aGlzLnRlcm1pbmF0ZWQoKTtcbiAgICAgICAgICAgICAgICByZXNvbHZlKCk7XG4gICAgICAgICAgICB9O1xuICAgICAgICAgICAgLy8gSWYgd2UgYXJlIHdhaXRpbmcgZm9yIGFuIG91dHN0YW5kaW5nIHJlcXVlc3QsIHdhaXQgZm9yIGl0IHRvIGZpbmlzaCBhbmQgdGhlbiB0cnkgY2xvc2luZy5cbiAgICAgICAgICAgIC8vIE90aGVyd2lzZSBqdXN0IHRyeSBjbG9zaW5nLlxuICAgICAgICAgICAgaWYgKHRoaXMud2FpdGluZykge1xuICAgICAgICAgICAgICAgIHRoaXMud2FpdGluZ0NoYW5nZS5hZGRMaXN0ZW5lcigoKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgIGRvQ2xvc2UoKTtcbiAgICAgICAgICAgICAgICB9LCB7IG9uY2U6IHRydWUgfSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICBkb0Nsb3NlKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuICAgIH1cbiAgICAvKipcbiAgICAgKiBTZW5kcyB0aGUgUkVHSVNURVIgcmVxdWVzdC5cbiAgICAgKiBAcmVtYXJrc1xuICAgICAqIElmIHN1Y2Nlc3NmdWwsIHNlbmRzIHJlLVJFR0lTVEVSIHJlcXVlc3RzIHByaW9yIHRvI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0bWwvcmZjMzI2MSNzZWN0aW9uLTEwLjNcbiAgICAgICAgICAgICAgICB0aGlzLl9jb250YWN0cyA9IHJlc3BvbnNlLm1lc3NhZ2UuZ2V0SGVhZGVycyhcImNvbnRhY3RcIik7XG4gICAgICAgICAgICAgICAgbGV0IGNvbnRhY3RzID0gdGhpcy5fY29udGFjdHMubGVuZ3RoO1xuICAgICAgICAgICAgICAgIGlmICghY29udGFjdHMpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIuZXJyb3IoXCJObyBDb250YWN0IGhlYWRlciBpbiByZXNwb25zZSB0byBSRUdJU1RFUiwgZHJvcHBpbmcgcmVzcG9uc2UuXCIpO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnVucmVnaXN0ZXJlZCgpO1xuICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIC8vIFRoZSAyMDAgKE9LKSByZXNwb25zZSBmcm9tIHRoZSByZWdpc3RyYXIgY29udGFpbnMgYSBsaXN0IG9mIENvbnRhY3RcbiAgICAgICAgICAgICAgICAvLyBmaWVsZHMgZW51bWVyYXRpbmcgYWxsIGN1cnJlbnQgYmluZGluZ3MuICBUaGUgVUEgY29tcGFyZXMgZWFjaFxuICAgICAgICAgICAgICAgIC8vIGNvbnRhY3QgYWRkcmVzcyB0byBzZWUgaWYgaXQgY3JlYXRlZCB0aGUgY29udGFjdCBhZGRyZXNzLCB1c2luZ1xuICAgICAgICAgICAgICAgIC8vIGNvbXBhcmlzb24gcnVsZXMgaW4gU2VjdGlvbiAxOS4xLjQuICBJZiBzbywgaXQgdXBkYXRlcyB0aGUgZXhwaXJhdGlvblxuICAgICAgICAgICAgICAgIC8vIHRpbWUgaW50ZXJ2YWwgYWNjb3JkaW5nIHRvIHRoZSBleHBpcmVzIHBhcmFtZXRlciBvciwgaWYgYWJzZW50LCB0aGVcbiAgICAgICAgICAgICAgICAvLyBFeHBpcmVzIGZpZWxkIHZhbHVlLiAgVGhlIFVBIHRoZW4gaXNzdWVzIGEgUkVHSVNURVIgcmVxdWVzdCBmb3IgZWFjaFxuICAgICAgICAgICAgICAgIC8vIG9mIGl0cyBiaW5kaW5ncyBiZWZvcmUgdGhlIGV4cGlyYXRpb24gaW50ZXJ2YWwgaGFzIGVsYXBzZWQuXG4gICAgICAgICAgICAgICAgLy8gaHR0cHM6Ly90b29scy5pZXRmLm9yZy9odG1sL3JmYzMyNjEjc2VjdGlvbi0xMC4yLjRcbiAgICAgICAgICAgICAgICBsZXQgY29udGFjdDtcbiAgICAgICAgICAgICAgICB3aGlsZSAoY29udGFjdHMtLSkge1xuICAgICAgICAgICAgICAgICAgICBjb250YWN0ID0gcmVzcG9uc2UubWVzc2FnZS5wYXJzZUhlYWRlcihcImNvbnRhY3RcIiwgY29udGFjdHMpO1xuICAgICAgICAgICAgICAgICAgICBpZiAoIWNvbnRhY3QpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcIkNvbnRhY3QgdW5kZWZpbmVkXCIpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLnVzZXJBZ2VudC5jb250YWN0LnB1YkdydXUgJiYgZXF1aXZhbGVudFVSSShjb250YWN0LnVyaSwgdGhpcy51c2VyQWdlbnQuY29udGFjdC5wdWJHcnV1KSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgZXhwaXJlcyA9IE51bWJlcihjb250YWN0LmdldFBhcmFtKFwiZXhwaXJlc1wiKSk7XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAvLyBJZiB3ZSBhcmUgdXNpbmcgYSByYW5kb21seSBnZW5lcmF0ZWQgdXNlciBuYW1lICh3aGljaCBpcyB0aGUgZGVmYXVsdCBiZWhhdmlvcilcbiAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMudXNlckFnZW50LmNvbmZpZ3VyYXRpb24uY29udGFjdE5hbWUgPT09IFwiXCIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIGNvbXBhcmUgdGhlIHVzZXIgcG9ydGlvbiBvZiB0aGUgVVJJIHVuZGVyIHRoZSBhc3N1bXB0aW9uIHRoYXQgaXQgd2lsbCBiZSB1bmlxdWVcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjb250YWN0LnVyaS51c2VyID09PSB0aGlzLnVzZXJBZ2VudC5jb250YWN0LnVyaS51c2VyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZXhwaXJlcyA9IE51bWJlcihjb250YWN0LmdldFBhcmFtKFwiZXhwaXJlc1wiKSk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBvdGhlcndpc2UgdXNlIGNvbXBhcmlzaW9uIHJ1bGVzIGluIFNlY3Rpb24gMTkuMS40XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoZXF1aXZhbGVudFVSSShjb250YWN0LnVyaSwgdGhpcy51c2VyQWdlbnQuY29udGFjdC51cmkpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZXhwaXJlcyA9IE51bWJlcihjb250YWN0LmdldFBhcmFtKFwiZXhwaXJlc1wiKSk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgY29udGFjdCA9IHVuZGVmaW5lZDtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgLy8gVGhlcmUgbXVzdCBiZSBhIG1hdGNoaW5nIGNvbnRhY3QuXG4gICAgICAgICAgICAgICAgaWYgKGNvbnRhY3QgPT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5lcnJvcihcIk5vIENvbnRhY3QgaGVhZGVyIHBvaW50aW5nIHRvIHVzLCBkcm9wcGluZyByZXNwb25zZVwiKTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy51bnJlZ2lzdGVyZWQoKTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy53YWl0aW5nVG9nZ2xlKGZhbHNlKTtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAvLyBUaGUgY29udGFjdCBtdXN0IGhhdmUgYW4gZXhwaXJlcy5cbiAgICAgICAgICAgICAgICBpZiAoZXhwaXJlcyA9PT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLmVycm9yKFwiQ29udGFjdCBwb2ludGluZyB0byB1cyBpcyBtaXNzaW5nIGV4cGlyZXMgcGFyYW1ldGVyLCBkcm9wcGluZyByZXNwb25zZVwiKTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy51bnJlZ2lzdGVyZWQoKTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy53YWl0aW5nVG9nZ2xlKGZhbHNlKTtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAvLyBTYXZlIGdydXUgdmFsdWVzXG4gICAgICAgICAgICAgICAgaWYgKGNvbnRhY3QuaGFzUGFyYW0oXCJ0ZW1wLWdydXVcIikpIHtcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgZ3J1dSA9IGNvbnRhY3QuZ2V0UGFyYW0oXCJ0ZW1wLWdydXVcIik7XG4gICAgICAgICAgICAgICAgICAgIGlmIChncnV1KSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnVzZXJBZ2VudC5jb250YWN0LnRlbXBHcnV1ID0gR3JhbW1hci5VUklQYXJzZShncnV1LnJlcGxhY2UoL1wiL2csIFwiXCIpKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAoY29udGFjdC5oYXNQYXJhbShcInB1Yi1ncnV1XCIpKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IGdydXUgPSBjb250YWN0LmdldFBhcmFtKFwicHViLWdydXVcIik7XG4gICAgICAgICAgICAgICAgICAgIGlmIChncnV1KSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnVzZXJBZ2VudC5jb250YWN0LnB1YkdydXUgPSBHcmFtbWFyLlVSSVBhcnNlKGdydXUucmVwbGFjZSgvXCIvZywgXCJcIikpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHRoaXMucmVnaXN0ZXJlZChleHBpcmVzKTtcbiAgICAgICAgICAgICAgICBpZiAob3B0aW9ucy5yZXF1ZXN0RGVsZWdhdGUgJiYgb3B0aW9ucy5yZXF1ZXN0RGVsZWdhdGUub25BY2NlcHQpIHtcbiAgICAgICAgICAgICAgICAgICAgb3B0aW9ucy5yZXF1ZXN0RGVsZWdhdGUub25BY2NlcHQocmVzcG9uc2UpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB0aGlzLndhaXRpbmdUb2dnbGUoZmFsc2UpO1xuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIG9uUHJvZ3Jlc3M6IChyZXNwb25zZSkgPT4ge1xuICAgICAgICAgICAgICAgIGlmIChvcHRpb25zLnJlcXVlc3REZWxlZ2F0ZSAmJiBvcHRpb25zLnJlcXVlc3REZWxlZ2F0ZS5vblByb2dyZXNzKSB7XG4gICAgICAgICAgICAgICAgICAgIG9wdGlvbnMucmVxdWVzdERlbGVnYXRlLm9uUHJvZ3Jlc3MocmVzcG9uc2UpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBvblJlZGlyZWN0OiAocmVzcG9uc2UpID0+IHtcbiAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5lcnJvcihcIlJlZGlyZWN0IHJlY2VpdmVkLiBOb3Qgc3VwcG9ydGVkLlwiKTtcbiAgICAgICAgICAgICAgICB0aGlzLnVucmVnaXN0ZXJlZCgpO1xuICAgICAgICAgICAgICAgIGlmIChvcHRpb25zLnJlcXVlc3REZWxlZ2F0ZSAmJiBvcHRpb25zLnJlcXVlc3REZWxlZ2F0ZS5vblJlZGlyZWN0KSB7XG4gICAgICAgICAgICAgICAgICAgIG9wdGlvbnMucmVxdWVzdERlbGVnYXRlLm9uUmVkaXJlY3QocmVzcG9uc2UpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB0aGlzLndhaXRpbmdUb2dnbGUoZmFsc2UpO1xuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIG9uUmVqZWN0OiAocmVzcG9uc2UpID0+IHtcbiAgICAgICAgICAgICAgICBpZiAocmVzcG9uc2UubWVzc2FnZS5zdGF0dXNDb2RlID09PSA0MjMpIHtcbiAgICAgICAgICAgICAgICAgICAgLy8gSWYgYSBVQSByZWNlaXZlcyBhIDQyMyAoSW50ZXJ2YWwgVG9vIEJyaWVmKSByZXNwb25zZSwgaXQgTUFZIHJldHJ5XG4gICAgICAgICAgICAgICAgICAgIC8vIHRoZSByZWdpc3RyYXRpb24gYWZ0ZXIgbWFraW5nIHRoZSBleHBpcmF0aW9uIGludGVydmFsIG9mIGFsbCBjb250YWN0XG4gICAgICAgICAgICAgICAgICAgIC8vIGFkZHJlc3NlcyBpbiB0aGUgUkVHSVNURVIgcmVxdWVzdCBlcXVhbCB0byBvciBncmVhdGVyIHRoYW4gdGhlXG4gICAgICAgICAgICAgICAgICAgIC8vIGV4cGlyYXRpb24gaW50ZXJ2YWwgd2l0a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JdCB0aGVuIHNraXBzIHRoZSByZW1haW5pbmcgc3RlcHMuXG4gICAgICAgICAgICAgICAgICAgIC8vIGh0dHBzOi8vdG9vbHMuaWV0Zi5vcmcvaHRtbC9yZmMzMjYxI3NlY3Rpb24tMTAuM1xuICAgICAgICAgICAgICAgICAgICBpZiAoIXJlc3BvbnNlLm1lc3NhZ2UuaGFzSGVhZGVyKFwibWluLWV4cGlyZXNcIikpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIFRoaXMgcmVzcG9uc2UgTVVTVCBjb250YWluIGEgTWluLUV4cGlyZXMgaGVhZGVyIGZpZWxkXG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5lcnJvcihcIjQyMyByZXNwb25zZSByZWNlaXZlZCBmb3IgUkVHSVNURVIgd2l0aG91dCBNaW4tRXhwaXJlcywgZHJvcHBpbmcgcmVzcG9uc2VcIik7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnVucmVnaXN0ZXJlZCgpO1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy53YWl0aW5nVG9nZ2xlKGZhbHNlKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAvLyBJbmNyZWFzZSBvdXIgcmVnaXN0cmF0aW9uIGludGVydmFsIHRvIHRoZSBzdWdnZXN0ZWQgbWluaW11bVxuICAgICAgICAgICAgICAgICAgICB0aGlzLmV4cGlyZXMgPSBOdW1iZXIocmVzcG9uc2UubWVzc2FnZS5nZXRIZWFkZXIoXCJtaW4tZXhwaXJlc1wiKSk7XG4gICAgICAgICAgICAgICAgICAgIC8vIEF0dGVtcHQgdGhlIHJlZ2lzdHJhdGlvbiBhZ2FpbiBpbW1lZGlhdGVseVxuICAgICAgICAgICAgICAgICAgICB0aGlzLndhaXRpbmdUb2dnbGUoZmFsc2UpO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLn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X1gKTtcbiAgICAgICAgICAgICAgICB0aGlzLnVucmVnaXN0ZXJlZCgpO1xuICAgICAgICAgICAgICAgIGlmIChvcHRpb25zLnJlcXVlc3REZWxlZ2F0ZSAmJiBvcHRpb25zLnJlcXVlc3REZWxlZ2F0ZS5vblJlamVjdCkge1xuICAgICAgICAgICAgICAgICAgICBvcHRpb25zLnJlcXVlc3REZWxlZ2F0ZS5vblJlamVjdChyZXNwb25zZSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHRoaXMud2FpdGluZ1RvZ2dsZShmYWxzZSk7XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgb25Ucnlpbmc6IChyZXNwb25zZSkgPT4ge1xuICAgICAgICAgICAgICAgIGlmIChvcHRpb25zLnJlcXVlc3REZWxlZ2F0ZSAmJiBvcHRpb25zLnJlcXVlc3REZWxlZ2F0ZS5vblRyeWluZykge1xuICAgICAgICAgICAgICAgICAgICBvcHRpb25zLnJlcXVlc3REZWxlZ2F0ZS5vblRyeWluZyhyZXNwb25zZSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICAgICAgcmV0dXJuIFByb21pc2UucmVzb2x2ZShvdXRnb2luZ1JlZ2lzdGVyUmVxdWVzdCk7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIENsZWFyIHJlZ2lzdHJhdGlvbiB0aW1lcnMuXG4gICAgICovXG4gICAgY2xlYXJUaW1lcnMoKSB7XG4gICAgICAgIGlmICh0aGlzLnJlZ2lzdHJhdGlvblRpbWVyICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgIGNsZWFyVGltZW91dCh0aGlzLnJlZ2lzdHJhdGlvblRpbWVyKTtcbiAgICAgICAgICAgIHRoaXMucmVnaXN0cmF0aW9uVGltZXIgPSB1bmRlZmluZWQ7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHRoaXMucmVnaXN0cmF0aW9uRXhwaXJlZFRpbWV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b3AoKSB3aGljaCBkaXBzb3NlcyBvZiBhbGwgUmVnaXN0ZXJlcnM/XCI7XG4gICAgICAgIHRoaXMubG9nZ2VyLmVycm9yKG1lc3NhZ2UpO1xuICAgIH1cbn1cblJlZ2lzdGVyZXIuZGVmYXVsdEV4cGlyZXMgPSA2MDA7XG5SZWdpc3RlcmVyLmRlZmF1bHRSZWZyZXNoRnJlcXVlbmN5ID0gOTk7XG4iLCIvKipcbiAqIHtAbGluayBTZXNzaW9ufSBzdGF0ZS5cbiAqXG4gKiBAcmVtYXJrc1xuICogVGhlIHtAbGluayBTZXNzaW9ufSBiZWhhdmVzIGluIGEgZGV0ZXJtaW5pc3RpYyBtYW5uZXIgYWNjb3JkaW5nIHRvIHRoZSBmb2xsb3dpbmdcbiAqIEZpbml0ZSBTdGF0ZSBNYWNoaW5lIChGU00pLlxuICogYGBgdHh0XG4gKiAgICAgICAgICAgICAgICAgICBfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX1xuICogICAgICAgICAgICAgICAgICB8ICBfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fXyAgICAgICAgICAgICB8XG4gKiAgICAgICAgICAgICAgICAgIHwgfCAgICAgICAgICAgIF9fX19fX19fX19fX19fX19fX19fX19fX19fX18gICAgfCAgICAgICAgICAgIHxcbiAqIFNlc3Npb24gICAgICAgICAgfCB8ICAgICAgICAgICB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgIHYgICB2ICAgICAgICAgICAgdlxuICogQ29uc3RydWN0ZWQgLT4gSW5pdGlhbCAtPiBFc3RhYmxpc2hpbmcgLT4gRXN0YWJsaXNoZWQgLT4gVGVybWluYXRpbmcgLT4gVGVybWluYXRlZFxuICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgICAgICAgICAgICAgICB8X19fX19fX19fX19fX19fX19fX19fX19fX19fXiAgIF5cbiAqICAgICAgICAgICAgICAgICAgICAgICA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IHtcbiAgICAgICAgICAgIGNhc2UgU2Vzc2lvblN0YXRlLkluaXRpYWw6XG4gICAgICAgICAgICAgICAgYnJlYWs7IC8vIHRoZSBJbnZpdGVyL0ludml0YXRpb24gc3ViIGNsYXNzIGRpc3Bvc2UgbWV0aG9kIGhhbmRsZXMgdGhpcyBjYXNlXG4gICAgICAgICAgICBjYXNlIFNlc3Npb25TdGF0ZS5Fc3RhYmxpc2hpbmc6XG4gICAgICAgICAgICAgICAgYnJlYWs7IC8vIHRoZSBJbnZpdGVyL0ludml0YXRpb24gc3ViIGNsYXNzIGRpc3Bvc2UgbWV0aG9kIGhhbmRsZXMgdGhpcyBjYXNlXG4gICAgICAgICAgICBjYXNlIFNlc3Npb25TdGF0ZS5Fc3RhYmxpc2hlZDpcbiAgICAgICAgICAgICAgICByZXR1cm4gbmV3IFByb21pc2UoKHJlc29sdmUpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5fYnllKHtcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIHdhaXQgZm9yIHRoZSByZXNwb25zZSB0byB0aGUgQllFIGJlZm9yZSByZXNvbHZpbmdcbiAgICAgICAgICAgICAgICAgICAgICAgIG9uQWNjZXB0OiAoKSA9PiByZXNvbHZlKCksXG4gICAgICAgICAgICAgICAgICAgICAgICBvblJlZGlyZWN0OiAoKSA9PiByZXNvbHZlKCksXG4gICAgICAgICAgICAgICAgICAgICAgICBvblJlamVjdDogKCkgPT4gcmVzb2x2ZSgpXG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgY2FzZSBTZXNzaW9uU3RhdGUuVGVybWluYXRpbmc6XG4gICAgICAgICAgICAgICAgYnJlYWs7IC8vIG5vdGhpbmcgdG8gYmUgZG9uZVxuICAgICAgICAgICAgY2FzZSBTZXNzaW9uU3RhdGUuVGVybWluYXRlZDpcbiAgICAgICAgICAgICAgICBicmVhazsgLy8gbm90aGluZyB0byBiZSBkb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gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UgKz0gXCIgUGVyaGFwcyB5b3Ugc2hvdWxkIGhhdmUgY2FsbGVkIEludml0ZXIuY2FuY2VsKCk/XCI7XG4gICAgICAgICAgICAgICAgICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBAdHlwZXNjcmlwdC1lc2xpbnQvbm8tZXhwbGljaXQtYW55XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGVsc2UgaWYgKHR5cGVvZiB0aGlzLnJlamVjdCA9PT0gXCJmdW5jdGlvblwiKSB7XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UgKz0gXCIgSG93ZXZlciBJbnZpdGF0aW9uLmFjY2VwdCgpIGhhcyBub3QgeWV0IGJlZW4gY2FsbGVkLlwiO1xuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlICs9IFwiIFBlcmhhcHMgeW91IHNob3VsZCBoYXZlIGNhbGxlZCBJbnZpdGF0aW9uLnJlamVjdCgpP1wiO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgU2Vzc2lvblN0YXRlLkVzdGFibGlzaGluZzpcbiAgICAgICAgICAgICAgICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgQHR5cGVzY3JpcHQtZXNsaW50L25vLWV4cGxpY2l0LWFueVxuICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgdGhpcy5jYW5jZWwgPT09IFwiZnVuY3Rpb25cIikge1xuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlICs9IFwiIEhvd2V2ZXIgYSBkaWFsb2cgZG9lcyBub3QgeWV0IGV4aXN0LlwiO1xuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlICs9IFwiIFBlcmhhcHMgeW91IHNob3VsZCBoYXZlIGNhbGxlZCBJbnZpdGVyLmNhbmNlbCgpP1wiO1xuICAgICAgICAgICAgICAgICAgICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgQHR5cGVzY3JpcHQtZXNsaW50L25vLWV4cGxpY2l0LWFueVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBlbHNlIGlmICh0eXBlb2YgdGhpcy5yZWplY3QgPT09IFwiZnVuY3Rpb25cIikge1xuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlICs9IFwiIEhvd2V2ZXIgSW52aXRhdGlvbi5hY2NlcHQoKSBoYXMgbm90IHlldCBiZWVuIGNhbGxlZCAob3Igbm90IHlldCByZXNvbHZlZCkuXCI7XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UgKz0gXCIgUGVyaGFwcyB5b3Ugc2hvdWxkIGhhdmUgY2FsbGVkIEludml0YXRpb24ucmVqZWN0KCk/XCI7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBTZXNzaW9uU3RhdGUuRXN0YWJsaXNoZWQ6IHtcbiAgICAgICAgICAgICAgICBjb25zdCByZXF1ZXN0RGVsZWdhdGUgPSBvcHRpb25zLnJlcXVlc3REZWxlZ2F0ZTtcbiAgICAgICAgICAgICAgICBjb25zdCByZXF1ZXN0T3B0aW9ucyA9IHRoaXMuY29weVJlcXVlc3RPcHRpb25zKG9wdGlvbnMucmVxdWVzdE9wdGlvbnMpO1xuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl9ieWUocmVxdWVzdERlbGVnYXRlLCByZXF1ZXN0T3B0aW9ucyk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBjYXNlIFNlc3Npb25TdGF0ZS5UZXJtaW5hdGluZzpcbiAgICAgICAgICAgICAgICBtZXNzYWdlICs9IFwiIEhvd2V2ZXIgdGhpcyBzZXNzaW9uIGlzIGFscmVhZHkgdGVybWluYXRpbmcuXCI7XG4gICAgICAgICAgICAgICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIEB0eXBlc2NyaXB0LWVzbGludC9uby1leHBsaWNpdC1hbnlcbiAgICAgICAgICAgICAgICBpZiAodHlwZW9mIHRoaXMuY2FuY2VsID09PSBcImZ1bmN0aW9uXCIpIHtcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZSArPSBcIiBQZXJoYXBzIHlvdSBoYXZlIGFscmVhZHkgY2FsbGVkIEludml0ZXIuY2FuY2VsKCk/XCI7XG4gICAgICAgICAgICAgICAgICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBAdHlwZXNjcmlwdC1lc2xpbnQvbm8tZXhwbGljaXQtYW55XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGVsc2UgaWYgKHR5cGVvZiB0aGlzLnJlamVjdCA9PT0gXCJmdW5jdGlvblwiKSB7XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UgKz0gXCIgUGVyaGFwcyB5b3UgaGF2ZSBhbHJlYWR5IGNhbGxlZCBTZXNzaW9uLmJ5ZSgpP1wiO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgU2Vzc2lvblN0YXRlLlRlcm1pbmF0ZWQ6XG4gICAgICAgICAgICAgICAgbWVzc2FnZSArPSBcIiBIb3dldmVyIHRoaXMgc2Vzc2lvbiBpcyBhbHJlYWR5IHRlcm1pbmF0ZWQuXCI7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcIlVua25vd24gc3RhdGVcIik7XG4gICAgICAgIH1cbiAgICAgICAgdGhpcy5sb2dnZXIuZXJyb3IobWVzc2FnZSk7XG4gICAgICAgIHJldHVybiBQcm9taXNlLnJlamVjdChuZXcgRXJyb3IoYEludmFsaWQgc2Vzc2lvbiBzdGF0ZSAke3RoaXMuc3RhdGV9YCkpO1xuICAgIH1cbiAgICAvKipcbiAg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AgLy8gaHR0cHM6Ly90b29scy5pZXRmLm9yZy9odG1sL3JmYzYxNDEjc2VjdGlvbi0xXG4gICAgICAgICAgICAgICAgY29uc3QgYm9keSA9IGdldEJvZHkocmVzcG9uc2UubWVzc2FnZSk7XG4gICAgICAgICAgICAgICAgaWYgKCFib2R5KSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIE5vIHdheSB0byByZWNvdmVyLCBzbyB0ZXJtaW5hdGUgc2Vzc2lvbiBhbmQgbWFyayBhcyBmYWlsZWQuXG4gICAgICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLmVycm9yKFwiUmVjZWl2ZWQgMnh4IHJlc3BvbnNlIHRvIHJlLUlOVklURSB3aXRob3V0IGEgc2Vzc2lvbiBkZXNjcmlwdGlvblwiKTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5hY2tBbmRCeWUocmVzcG9uc2UsIDQwMCwgXCJNaXNzaW5nIHNlc3Npb24gZGVzY3JpcHRpb25cIik7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuc3RhdGVUcmFuc2l0aW9uKFNlc3Npb25TdGF0ZS5UZXJtaW5hdGVkKTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5wZW5kaW5nUmVpbnZpdGUgPSBmYWxzZTtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAob3B0aW9ucy53aXRob3V0U2RwKSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIElOVklURSB3aXRob3V0IFNEUCAtIHNldCByZW1vdGUgb2ZmZXIgYW5kIHNlbmQgYW4gYW5zd2VyIGluIHRoZSBBQ0tcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgYW5zd2VyT3B0aW9ucyA9IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlc3Npb25EZXNjcmlwdGlvbkhhbmRsZXJPcHRpb25zOiB0aGlzLnNlc3Npb25EZXNjcmlwdGlvbkhhbmRsZXJPcHRpb25zUmVJbnZpdGUsXG4gICAgICAgICAgICAgICAgICAgICAgICBzZXNzaW9uRGVzY3JpcHRpb25IYW5kbGVyTW9kaWZpZXJzOiB0aGlzLnNlc3Npb25EZXNjcmlwdGlvbkhhbmRsZXJNb2RpZmllcnNSZUludml0ZVxuICAgICAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnNldE9mZmVyQW5kR2V0QW5zd2VyKGJvZHksIGFuc3dlck9wdGlvbnMpXG4gICAgICAgICAgICAgICAgICAgICAgICAudGhlbigoYW5zd2VyQm9keSkgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmVzcG9uc2UuYWNrKHsgYm9keTogYW5zd2VyQm9keSB9KTtcbiAgICAgICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgICAgICAgICAgIC5jYXRjaCgoZXJyb3IpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIE5vIHdheSB0byByZWNvdmVyLCBzbyB0ZXJtaW5hdGUgc2Vzc2lvbiBhbmQgbWFyayBhcyBmYWlsZWQuXG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5lcnJvcihcIkZhaWxlZCB0byBoYW5kbGUgb2ZmZXIgaW4gMnh4IHJlc3BvbnNlIHRvIHJlLUlOVklURVwiKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLmVycm9yKGVycm9yLm1lc3NhZ2UpO1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMuc3RhdGUgPT09IFNlc3Npb25TdGF0ZS5UZXJtaW5hdGVkKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gQSBCWUUgc2hvdWxkIG5vdCBiZSBzZW50IGlmIGFscmVhZHkgdGVybWluYXRlZC5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBGb3IgZXhhbXBsZSwgYSBCWUUgbWF5IGJlIHNlbnQvcmVjZWl2ZWQgd2hpbGUgcmUtSU5WSVRFIGlzIG91dHN0YW5kaW5nLlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc3BvbnNlLmFjaygpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5hY2tBbmRCeWUocmVzcG9uc2UsIDQ4OCwgXCJCYWQgTWVkaWEgRGVzY3JpcHRpb25cIik7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5zdGF0ZVRyYW5zaXRpb24oU2Vzc2lvblN0YXRlLlRlcm1pbmF0ZWQpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgICAgICAgICAgICAgLnRoZW4oKCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5wZW5kaW5nUmVpbnZpdGUgPSBmYWxzZTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChvcHRpb25zLnJlcXVlc3REZWxlZ2F0ZSAmJiBvcHRpb25zLnJlcXVlc3REZWxlZ2F0ZS5vbkFjY2VwdCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wdGlvbnMucmVxdWVzdERlbGVnYXRlLm9uQWNjZXB0KHJlc3BvbnNlKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAvLyBJTlZJVEUgd2l0aCBTRFAgLSBzZXQgcmVtb3RlIGFuc3dlciBhbmQgc2VuZCBhbiBBQ0tcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgYW5zd2VyT3B0aW9ucyA9IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlc3Npb25EZXNjcmlwdGlvbkhhbmRsZXJPcHRpb25zOiB0aGlzLnNlc3Npb25EZXNjcmlwdGlvbkhhbmRsZXJPcHRpb25zUmVJbnZpdGUsXG4gICAgICAgICAgICAgICAgICAgICAgICBzZXNzaW9uRGVzY3JpcHRpb25IYW5kbGVyTW9kaWZpZXJzOiB0aGlzLnNlc3Npb25EZXNjcmlwdGlvbkhhbmRsZXJNb2RpZmllcnNSZUludml0ZVxuICAgICAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnNldEFuc3dlcihib2R5LCBhbnN3ZXJPcHRpb25zKVxuICAgICAgICAgICAgICAgICAgICAgICAgLnRoZW4oKCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmVzcG9uc2UuYWNrKCk7XG4gICAgICAgICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICAgICAgICAgICAgICAuY2F0Y2goKGVycm9yKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBObyB3YXkgdG8gcmVjb3Zlciwgc28gdGVybWluYXRlIHNlc3Npb24gYW5kIG1hcmsgYXMgZmFpbGVkLlxuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIuZXJyb3IoXCJGYWlsZWQgdG8gaGFuZGxlIGFuc3dlciBpbiAyeHggcmVzcG9uc2UgdG8gcmUtSU5WSVRFXCIpO1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIuZXJyb3IoZXJyb3IubWVzc2FnZSk7XG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBBIEJZRSBzaG91bGQgb25seSBiZSBzZW50IGlmIHNlc3Npb24gaXMgbm90IGFscmVhZHkgdGVybWluYXRlZC5cbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIEZvciBleGFtcGxlLCBhIEJZRSBtYXkgYmUgc2VudC9yZWNlaXZlZCB3aGlsZSByZS1JTlZJVEUgaXMgb3V0c3RhbmRpbmcuXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBUaGUgQUNLIG5lZWRzIHRvIGJlIHNlbnQgcmVnYXJkbGVzcyBhcyBpdCB3YXMgbm90IGhhbmRsZWQgYnkgdGhlIHRyYW5zYWN0aW9uLlxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMuc3RhdGUgIT09IFNlc3Npb25TdGF0ZS5UZXJtaW5hdGVkKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5hY2tBbmRCeWUocmVzcG9uc2UsIDQ4OCwgXCJCYWQgTWVkaWEgRGVzY3JpcHRpb25cIik7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5zdGF0ZVRyYW5zaXRpb24oU2Vzc2lvblN0YXRlLlRlcm1pbmF0ZWQpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzcG9uc2UuYWNrKCk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICAgICAgICAgICAgICAudGhlbigoKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnBlbmRpbmdSZWludml0ZSA9IGZhbHNlO1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG9wdGlvbnMucmVxdWVzdERlbGVnYXRlICYmIG9wdGlvbnMucmVxdWVzdERlbGVnYXRlLm9uQWNjZXB0KSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgb3B0aW9ucy5yZXF1ZXN0RGVsZWdhdGUub25BY2NlcHQocmVzcG9uc2UpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIEB0eXBlc2NyaXB0LWVzbGludC9uby11bnVzZWQtdmFyc1xuICAgICAgICAgICAgb25Qcm9ncmVzczogKHJlc3BvbnNlKSA9PiB7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBAdHlwZXNjcmlwdC1lc2xpbnQvbm8tdW51c2VkLXZhcnNcbiAgICAgICAgICAgIG9uUmVkaXJlY3Q6IChyZXNwb25zZSkgPT4ge1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBvblJlamVjdDogKHJlc3BvbnNlKSA9PiB7XG4gICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIud2FybihcIlJlY2VpdmVkIGEgbm9uLTJ4eCByZXNwb25zZSB0byByZS1JTlZJVEVcIik7XG4gICAgICAgICAgICAgICAgdGhpcy5wZW5kaW5nUmVpbnZpdGUgPSBmYWxzZTtcbiAgICAgICAgICAgICAgICBpZiAob3B0aW9ucy53aXRob3V0U2RwKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChvcHRpb25zLnJlcXVlc3REZWxlZ2F0ZSAmJiBvcHRpb25zLnJlcXVlc3REZWxlZ2F0ZS5vblJlamVjdCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgb3B0aW9ucy5yZXF1ZXN0RGVsZWdhdGUub25SZWplY3QocmVzcG9uc2UpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnJvbGxiYWNrT2ZmZXIoKVxuICAgICAgICAgICAgICAgICAgICAgICAgLmNhdGNoKChlcnJvcikgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgLy8gTm8gd2F5IHRvIHJlY292ZXIsIHNvIHRlcm1pbmF0ZSBzZXNzaW9uIGFuZCBtYXJrIGFzIGZhaWxlZC5cbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLmVycm9yKFwiRmFpbGVkIHRvIHJvbGxiYWNrIG9mZmVyIG9uIG5vbi0yeHggcmVzcG9uc2UgdG8gcmUtSU5WSVRFXCIpO1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIuZXJyb3IoZXJyb3IubWVzc2FnZSk7XG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBBIEJZRSBzaG91bGQgb25seSBiZSBzZW50IGlmIHNlc3Npb24gaXMgbm90IGFscmVhZHkgdGVybWluYXRlZC5cbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIEZvciBleGFtcGxlLCBhIEJZRSBtYXkgYmUgc2VudC9yZWNlaXZlZCB3aGlsZSByZS1JTlZJVEUgaXMgb3V0c3RhbmRpbmcuXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBOb3RlIHRoYXQgdGhlIEFDSyB3YXMgYWxyZWFkeSBzZW50IGJ5IHRoZSB0cmFuc2FjdGlvbiwgc28ganVzdCBuZWVkIHRvIHNlbmQgQllFLlxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMuc3RhdGUgIT09IFNlc3Npb25TdGF0ZS5UZXJtaW5hdGVkKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF0aGlzLmRpYWxvZykge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJEaWFsb2cgdW5kZWZpbmVkLlwiKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZXh0cmFIZWFkZXJzID0gW107XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZXh0cmFIZWFkZXJzLnB1c2goXCJSZWFzb246IFwiICsgdGhpcy5nZXRSZWFzb25IZWFkZXJWYWx1ZSg1MDAsIFwiSW50ZXJuYWwgU2VydmVyIEVycm9yXCIpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmRpYWxvZy5ieWUodW5kZWZpbmVkLCB7IGV4dHJhSGVhZGVycyB9KTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnN0YXRlVHJhbnNpdGlvbihTZXNzaW9uU3RhdGUuVGVybWluYXRlZCk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICAgICAgICAgICAgICAudGhlbigoKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAob3B0aW9ucy5yZXF1ZXN0RGVsZWdhdGUgJiYgb3B0aW9ucy5yZXF1ZXN0RGVsZWdhdGUub25SZWplY3QpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcHRpb25zLnJlcXVlc3REZWxlZ2F0ZS5vblJlamVjdChyZXNwb25zZSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgQHR5cGVzY3JpcHQtZXNsaW50L25vLXVudXNlZC12YXJzXG4gICAgICAgICAgICBvblRyeWluZzogKHJlc3BvbnNlKSA9PiB7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfVxuICAgICAgICB9O1xuICAgICAgICBjb25zdCByZXF1ZXN0T3B0aW9ucyA9IG9wdGlvbnMucmVxdWVzdE9wdGlvbnMgfHwge307XG4gICAgICAgIHJlcXVlc3RPcHRpb25zLmV4dHJhSGVhZGVycyA9IChyZXF1ZXN0T3B0aW9ucy5leHRyYUhlYWRlcnMgfHwgW10pLnNsaWNlKCk7XG4gICAgICAgIHJlcXVlc3RPcHRpb25zLmV4dHJhSGVhZGVycy5wdXNoKFwiQWxsb3c6IFwiICsgQWxsb3d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lvbkRpYWxvZ1N0YXRlLkluaXRpYWw6XG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKGBJbnZhbGlkIGRpYWxvZyBzdGF0ZSAke2RpYWxvZy5zZXNzaW9uU3RhdGV9YCk7XG4gICAgICAgICAgICBjYXNlIFNlc3Npb25EaWFsb2dTdGF0ZS5FYXJseTogLy8gSW1wbGVtZW50YXRpb24gY2hvaWNlIC0gbm90IHNlbmRpbmcgQllFIGZvciBlYXJseSBkaWFsb2dzLlxuICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihgSW52YWxpZCBkaWFsb2cgc3RhdGUgJHtkaWFsb2cuc2Vzc2lvblN0YXRlfWApO1xuICAgICAgICAgICAgY2FzZSBTZXNzaW9uRGlhbG9nU3RhdGUuQWNrV2FpdDoge1xuICAgICAgICAgICAgICAgIC8vIFRoaXMgc3RhdGUgb25seSBvY2N1cnMgaWYgd2UgYXJlIHRoZSBjYWxsZWUuXG4gICAgICAgICAgICAgICAgdGhpcy5zdGF0ZVRyYW5zaXRpb24oU2Vzc2lvblN0YXRlLlRlcm1pbmF0aW5nKTsgLy8gV2UncmUgdGVybWluYXRpbmdcbiAgICAgICAgICAgICAgICByZXR1cm4gbmV3IFByb21pc2UoKHJlc29sdmUpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgZGlhbG9nLmRlbGVnYXRlID0ge1xuICAgICAgICAgICAgICAgICAgICAgICAgLy8gV2hlbiBBQ0sgc2hvd3MgdXAsIHNheSBCWUUuXG4gICAgICAgICAgICAgICAgICAgICAgICBvbkFjazogKCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHJlcXVlc3QgPSBkaWFsb2cuYnllKGRlbGVnYXRlLCBvcHRpb25zKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnN0YXRlVHJhbnNpdGlvbihTZXNzaW9uU3RhdGUuVGVybWluYXRlZCk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzb2x2ZShyZXF1ZXN0KTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gUHJvbWlzZS5yZXNvbHZlKCk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgICAgICAgICAgLy8gT3IgdGhlIHNlcnZlciB0cmFuc2FjdGlvbiB0aW1lcyBvdXQgYmVmb3JlIHRoZSBBQ0sgYXJyaXZlcy5cbiAgICAgICAgICAgICAgICAgICAgICAgIG9uQWNrVGltZW91dDogKCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHJlcXVlc3QgPSBkaWFsb2cuYnllKGRlbGVnYXRlLCBvcHRpb25zKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnN0YXRlVHJhbnNpdGlvbihTZXNzaW9uU3RhdGUuVGVybWluYXRlZCk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzb2x2ZShyZXF1ZXN0KTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGNhc2UgU2Vzc2lvbkRpYWxvZ1N0YXRlLkNvbmZpcm1lZDoge1xuICAgICAgICAgICAgICAgIGNvbnN0IHJlcXVlc3QgPSBkaWFsb2cuYnllKGRlbGVnYXRlLCBvcHRpb25zKTtcbiAgICAgICAgICAgICAgICB0aGlzLnN0YXRlVHJhbnNpdGlvbihTZXNzaW9uU3RhdGUuVGVybWluYXRlZCk7XG4gICAgICAgICAgICAgICAgcmV0dXJuIFByb21pc2UucmVzb2x2ZShyZXF1ZXN0KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGNhc2UgU2Vzc2lvbkRpYWxvZ1N0YXRlLlRlcm1pbmF0ZWQ6XG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKGBJbnZh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bvc2l0aW9uID09PSBcInJlbmRlclwiKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuX3JlbmRlcmJvZHkgPSBib2R5LmNvbnRlbnQ7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuX3JlbmRlcnR5cGUgPSBib2R5LmNvbnRlbnRUeXBlO1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gUHJvbWlzZS5yZXNvbHZlKCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmIChib2R5LmNvbnRlbnREaXNwb3NpdGlvbiAhPT0gXCJzZXNzaW9uXCIpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFByb21pc2UucmVzb2x2ZSgpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5zZXRBbnN3ZXIoYm9keSwgYW5zd2VyT3B0aW9ucykuY2F0Y2goKGVycm9yKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLmVycm9yKGVycm9yLm1lc3NhZ2UpO1xuICAgICAgICAgICAgICAgICAgICBjb25zdCBleHRyYUhlYWRlcnMgPSBbXCJSZWFzb246IFwiICsgdGhpcy5nZXRSZWFzb25IZWFkZXJWYWx1ZSg0ODgsIFwiQmFkIE1lZGlhIERlc2NyaXB0aW9uXCIpXTtcbiAgICAgICAgICAgICAgICAgICAgZGlhbG9nLmJ5ZSh1bmRlZmluZWQsIHsgZXh0cmFIZWFkZXJzIH0pO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnN0YXRlVHJhbnNpdGlvbihTZXNzaW9uU3RhdGUuVGVybWluYXRlZCk7XG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBjYXNlIFNpZ25hbGluZ1N0YXRlLkhhdmVMb2NhbE9mZmVyOiB7XG4gICAgICAgICAgICAgICAgLy8gU3RhdGUgc2hvdWxkIG5ldmVyIGJlIHJlYWNoZW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uICAgICAgICAgICAgcmV0dXJuIHNkaFxuICAgICAgICAgICAgICAgIC5nZXREZXNjcmlwdGlvbihzZGhPcHRpb25zLCBzZGhNb2RpZmllcnMpXG4gICAgICAgICAgICAgICAgLnRoZW4oKGJvZHlBbmRDb250ZW50VHlwZSkgPT4gZnJvbUJvZHlMZWdhY3koYm9keUFuZENvbnRlbnRUeXBlKSlcbiAgICAgICAgICAgICAgICAuY2F0Y2goKGVycm9yKSA9PiB7XG4gICAgICAgICAgICAgICAgLy8gZG9uJ3QgdHJ1c3QgU0RIIHRvIHJlamVjdCB3aXRoIEVycm9yXG4gICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIuZXJyb3IoXCJTZXNzaW9uLmdldE9mZmVyOiBTREggZ2V0RGVzY3JpcHRpb24gcmVqZWN0ZWQuLi5cIik7XG4gICAgICAgICAgICAgICAgY29uc3QgZSA9IGVycm9yIGluc3RhbmNlb2YgRXJyb3IgPyBlcnJvciA6IG5ldyBFcnJvcihcIlNlc3Npb24uZ2V0T2ZmZXIgdW5rbm93biBlcnJvci5cIik7XG4gICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIuZXJyb3IoZS5tZXNzYWdlKTtcbiAgICAgICAgICAgICAgICB0aHJvdyBlO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgICAgY2F0Y2ggKGVycm9yKSB7XG4gICAgICAgICAgICAvLyBkb24ndCB0cnVzdCBTREggdG8gdGhyb3cgYW4gRXJyb3JcbiAgICAgICAgICAgIHRoaXMubG9nZ2VyLmVycm9yKFwiU2Vzc2lvbi5nZXRPZmZlcjogU0RIIGdldERlc2NyaXB0aW9uIHRocmV3Li4uXCIpO1xuICAgICAgICAgICAgY29uc3QgZSA9IGVycm9yIGluc3RhbmNlb2YgRXJyb3IgPyBlcnJvciA6IG5ldyBFcnJvcihlcnJvcik7XG4gICAgICAgICAgICB0aGlzLmxvZ2dlci5lcnJvcihlLm1lc3NhZ2UpO1xuICAgICAgICAgICAgcmV0dXJuIFByb21pc2UucmVqZWN0KGUpO1xuICAgICAgICB9XG4gICAgfVxuICAgIC8qKlxuICAgICAqIFJvbGxiYWNrIGxvY2FsL3JlbW90ZSBvZmZlci5cbiAgICAgKiBAaW50ZXJuYWxcbiAgICAgKi9cbiAgICByb2xsYmFja09mZmVyKCkge1xuICAgICAgICBjb25zdCBzZGggPSB0aGlzLnNldHVwU2Vzc2lvbkRlc2NyaXB0aW9uSGFuZGxlcigpO1xuICAgICAgICBpZiAoc2RoLnJvbGxiYWNrRGVzY3JpcHRpb24gPT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgcmV0dXJuIFByb21pc2UucmVzb2x2ZSgpO1xuICAgICAgICB9XG4gICAgICAgIC8vIFRoaXMgaXMgaW50ZW50aW9uYWxseSB3cml0dGVuIHZlcnkgZGVmZW5zaXZlbHkuIERvbid0IHRydXN0IFNESCB0byBiZWhhdmUuXG4gICAgICAgIHRyeSB7XG4gICAgICAgICAgICByZXR1cm4gc2RoLnJvbGxiYWNrRGVzY3JpcHRpb24oKS5jYXRjaCgoZXJyb3IpID0+IHtcbiAgICAgICAgICAgICAgICAvLyBkb24ndCB0cnVzdCBTREggdG8gcmVqZWN0IHdpdGggRXJyb3JcbiAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5lcnJvcihcIlNlc3Npb24ucm9sbGJhY2tPZmZlcjogU0RIIHJvbGxiYWNrRGVzY3JpcHRpb24gcmVqZWN0ZWQuLi5cIik7XG4gICAgICAgICAgICAgICAgY29uc3QgZSA9IGVycm9yIGluc3RhbmNlb2YgRXJyb3IgPyBlcnJvciA6IG5ldyBFcnJvcihcIlNlc3Npb24ucm9sbGJhY2tPZmZlciB1bmtub3duIGVycm9yLlwiKTtcbiAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5lcnJvcihlLm1lc3NhZ2UpO1xuICAgICAgICAgICAgICAgIHRocm93IGU7XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgICAgICBj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zZS5yZWplY3QobmV3IENvbnRlbnRUeXBlVW5zdXBwb3J0ZWRFcnJvcigpKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBjYXRjaCAoZXJyb3IpIHtcbiAgICAgICAgICAgIHRoaXMubG9nZ2VyLmVycm9yKFwiU2Vzc2lvbi5zZXRBbnN3ZXI6IFNESCBoYXNEZXNjcmlwdGlvbiB0aHJldy4uLlwiKTtcbiAgICAgICAgICAgIGNvbnN0IGUgPSBlcnJvciBpbnN0YW5jZW9mIEVycm9yID8gZXJyb3IgOiBuZXcgRXJyb3IoZXJyb3IpO1xuICAgICAgICAgICAgdGhpcy5sb2dnZXIuZXJyb3IoZS5tZXNzYWdlKTtcbiAgICAgICAgICAgIHJldHVybiBQcm9taXNlLnJlamVjdChlKTtcbiAgICAgICAgfVxuICAgICAgICB0cnkge1xuICAgICAgICAgICAgcmV0dXJuIHNkaC5zZXREZXNjcmlwdGlvbihhbnN3ZXIuY29udGVudCwgc2RoT3B0aW9ucywgc2RoTW9kaWZpZXJzKS5jYXRjaCgoZXJyb3IpID0+IHtcbiAgICAgICAgICAgICAgICAvLyBkb24ndCB0cnVzdCBTREggdG8gcmVqZWN0IHdpdGggRXJyb3JcbiAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5lcnJvcihcIlNlc3Npb24uc2V0QW5zd2VyOiBTREggc2V0RGVzY3JpcHRpb24gcmVqZWN0ZWQuLi5cIik7XG4gICAgICAgICAgICAgICAgY29uc3QgZSA9IGVycm9yIGluc3RhbmNlb2YgRXJyb3IgPyBlcnJvciA6IG5ldyBFcnJvcihcIlNlc3Npb24uc2V0QW5zd2VyIHVua25vd24gZXJyb3IuXCIpO1xuICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLmVycm9yKGUubWVzc2FnZSk7XG4gICAgICAgICAgICAgICAgdGhyb3cgZTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICAgIGNhdGNoIChlcnJvcikge1xu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HJhbnNpdGlvbiA9ICgpID0+IHtcbiAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihgSW52YWxpZCBzdGF0ZSB0cmFuc2l0aW9uIGZyb20gJHt0aGlzLl9zdGF0ZX0gdG8gJHtuZXdTdGF0ZX1gKTtcbiAgICAgICAgfTtcbiAgICAgICAgLy8gVmFsaWRhdGUgdHJhbnNpdGlvblxuICAgICAgICBzd2l0Y2ggKHRoaXMuX3N0YXRlKSB7XG4gICAgICAgICAgICBjYXNlIFNlc3Npb25TdGF0ZS5Jbml0aWFsOlxuICAgICAgICAgICAgICAgIGlmIChuZXdTdGF0ZSAhPT0gU2Vzc2lvblN0YXRlLkVzdGFibGlzaGluZyAmJlxuICAgICAgICAgICAgICAgICAgICBuZXdTdGF0ZSAhPT0gU2Vzc2lvblN0YXRlLkVzdGFibGlzaGVkICYmXG4gICAgICAgICAgICAgICAgICAgIG5ld1N0YXRlICE9PSBTZXNzaW9uU3RhdGUuVGVybWluYXRpbmcgJiZcbiAgICAgICAgICAgICAgICAgICAgbmV3U3RhdGUgIT09IFNlc3Npb25TdGF0ZS5UZXJtaW5hdGVkKSB7XG4gICAgICAgICAgICAgICAgICAgIGludmFsaWRUcmFuc2l0aW9uKCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBTZXNzaW9uU3RhdGUuRXN0YWJsaXNoaW5nOlxuICAgICAgICAgICAgICAgIGlmIChuZXdTdGF0ZSAhPT0gU2Vzc2lvblN0YXRlLkVzdGFibGlzaGVkICYmXG4gICAgICAgICAgICAgICAgICAgIG5ld1N0YXRlICE9PSBTZXNzaW9uU3RhdGUuVGVybWluYXRpbmcgJiZcbiAgICAgICAgICAgICAgICAgICAgbmV3U3RhdGUgIT09IFNlc3Npb25TdGF0ZS5UZXJtaW5hdGVkKSB7XG4gICAgICAgICAgICAgICAgICAgIGludmFsaWRUcmFuc2l0aW9uKCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBTZXNzaW9uU3RhdGUuRXN0YWJsaXNoZWQ6XG4gICAgICAgICAgICAgICAgaWYgKG5ld1N0YXRlICE9PSBTZXNzaW9uU3RhdGUuVGVybWluYXRpbmcgJiYgbmV3U3RhdGUgIT09IFNlc3Npb25TdGF0ZS5UZXJtaW5hdGVkKSB7XG4gICAgICAgICAgICAgICAgICAgIGludmFsaWRUcmFuc2l0aW9uKCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBTZXNzaW9uU3RhdGUuVGVybWluYXRpbmc6XG4gICAgICAgICAgICAgICAgaWYgKG5ld1N0YXRlICE9PSBTZXNzaW9uU3RhdGUuVGVybWluYXRlZCkge1xuICAgICAgICAgICAgICAgICAgICBpbnZhbGlkVHJhbnNpdGlvbigpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgU2Vzc2lvblN0YXRlLlRlcm1pbmF0ZWQ6XG4gICAgICAgICAgICAgICAgaW52YWxpZFRyYW5zaXRpb24oKTtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwiVW5yZWNvZ25pemVkIHN0YXRlLlwiKTtcbiAgICAgICAgfVxuICAgICAgICAvLyBUcmFuc2l0aW9uXG4gICAgICAgIHRoaXMuX3N0YXRlID0gbmV3U3RhdGU7XG4gICAgICAgIHRoaXMubG9nZ2VyLmxvZyhgU2Vzc2lvbiAke3RoaXMuaWR9IHRyYW5zaXRpb25lZCB0byBzdGF0ZSAke3RoaXMuX3N0YXRlfWApO1xuICAgICAgICB0aGlzLl9zdGF0ZUV2ZW50RW1pdHRlci5lbWl0KHRoaXMuX3N0YXRlKTtcbiAgICAgICAgLy8gRGlzcG9zZVxuICAgICAgICBpZiAobmV3U3RhdGUgPT09IFNlc3Npb25TdGF0ZS5UZXJtaW5hdGVkKSB7XG4gICAgICAgICAgICB0aGlzLmRpc3Bvc2UoKTtcbiAgICAgICAgfVxuICAgIH1cbiAgICBjb3B5UmVxdWVzdE9wdGlvbnMocmVxdWVzdE9wdGlvbnMgPSB7fSkge1xuICAgICAgICBjb25zdCBleHRyYUhlYWRlcnMgPSByZXF1ZXN0T3B0aW9ucy5leHRyYUhlYWRlcnMgPyByZXF1ZXN0T3B0aW9ucy5leHRyYUhlYWRlcnMuc2xpY2UoKSA6IHVuZGVmaW5lZDtcbiAgICAgICAgY29uc3QgYm9keSA9IHJlcXVlc3RPcHRpb25zLmJvZHlcbiAgICAgICAgICAgID8ge1xuICAgICAgICAgICAgICAgIGNvbnRlbnREaXNwb3NpdGlvbjogcmVxdWVzdE9wdGlvbnMuYm9keS5jb250ZW50RGlzcG9zaXRpb24gfHwgXCJyZW5kZXJcIixcbiAgICAgICAgICAgICAgICBjb250ZW50VHlwZTogcmVxdWVzdE9wdGlvbnMuYm9keS5jb250ZW50VHlwZSB8fCBcInRleHQvcGxhaW5cIixcbiAgICAgICAgICAgICAgICBjb250ZW50OiByZXF1ZXN0T3B0aW9ucy5ib2R5LmNvbnRlbnQgfHwgXCJcIlxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgOiB1bmRlZmluZWQ7XG4gICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICBleHRyYUhlYWRlcnMsXG4gICAgICAgICAgICBib2R5XG4gICAgICAgIH07XG4gICAgfVxuICAgIGdldFJlYXNvbkhlYWRlclZhbHVlKGNvZGUsIHJlYXNvbikge1xuICAgICAgICBjb25zdCBjYXVzZSA9IGNvZGU7XG4gICAgICAgIGxldCB0ZXh0ID0gZ2V0UmVhc29uUGhyYXNlKGNvZGUpO1xuICAgICAgICBpZiAoIXRleHQgJiYgcmVhc29uKSB7XG4gICAgICAgICAgICB0ZXh0ID0gcmV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WwpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5zdGF0ZVRyYW5zaXRpb24oU3Vic2NyaXB0aW9uU3RhdGUuTm90aWZ5V2FpdCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHRoaXMuc3Vic2NyaWJlclJlcXVlc3Quc3Vic2NyaWJlKCkudGhlbigocmVzdWx0KSA9PiB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChyZXN1bHQuc3VjY2Vzcykge1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHJlc3VsdC5zdWNjZXNzLnN1YnNjcmlwdGlvbikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX2RpYWxvZyA9IHJlc3VsdC5zdWNjZXNzLnN1YnNjcmlwdGlvbjtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLl9kaWFsb2cuZGVsZWdhdGUgPSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9uTm90aWZ5OiAocmVxdWVzdCkgPT4gdGhpcy5vbk5vdGlmeShyZXF1ZXN0KSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb25SZWZyZXNoOiAocmVxdWVzdCkgPT4gdGhpcy5vblJlZnJlc2gocmVxdWVzdCksXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9uVGVybWluYXRlZDogKCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gSWYgYSBjYWxsIHRvIHVuc3Vic2NyaWJlIHdpbGwgc3RhdGUgdHJhbnNpdGlvbiB0byBTdWJzY3JpcHRpb25TdGF0ZS5UZXJtaW5hdGVkLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gYnV0IHdlIGNhbiBlbmQgdXAgaGVyZSBhZnRlciB0aGF0IGlmIHRoZSBOT1RJRlkgbmV2ZXIgYXJyaXZlcyBhbmQgdGltZXIgTiBmaXJlcy5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLnN0YXRlICE9PSBTdWJzY3JpcHRpb25TdGF0ZS5UZXJtaW5hdGVkKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5zdGF0ZVRyYW5zaXRpb24oU3Vic2NyaXB0aW9uU3RhdGUuVGVybWluYXRlZCk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5vbk5vdGlmeShyZXN1bHQuc3VjY2Vzcy5yZXF1ZXN0KTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChyZXN1bHQuZmFpbHVyZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy51bnN1YnNjcmliZSgpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIFN1YnNjcmlwdGlvbkRpYWxvZ1N0YXRlLk5vdGlmeVdhaXQ6XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIFN1YnNjcmlwdGlvbkRpYWxvZ1N0YXRlLlBlbmRpbmc6XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIFN1YnNjcmlwdGlvbkRpYWxvZ1N0YXRlLkFjdGl2ZTpcbiAgICAgICAgICAgICAgICBpZiAodGhpcy5fZGlhbG9nKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHJlcXVlc3QgPSB0aGlzLl9kaWFsb2cucmVmcmVzaCgpO1xuICAgICAgICAgICAgICAgICAgICByZXF1ZXN0LmRlbGVnYXRlID0ge1xuICAgICAgICAgICAgICAgICAgICAgICAgb25BY2NlcHQ6IChyZXNwb25zZSkgPT4gdGhpcy5vbkFjY2VwdGVkKHJlc3BvbnNlKSxcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBAdHlwZXNjcmlwdC1lc2xpbnQvbm8tdW51c2VkLXZhcnNcbiAgICAgICAgICAgICAgICAgICAgICAgIG9uUmVkaXJlY3Q6IChyZXNwb25zZSkgPT4gdGhpcy51bnN1YnNjcmliZSgpLFxuICAgICAgICAgICAgICAgICAgICAgICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIEB0eXBlc2NyaXB0LWVzbGludC9uby11bnVzZWQtdmFyc1xuICAgICAgICAgICAgICAgICAgICAgICAgb25SZWplY3Q6IChyZXNwb25zZSkgPT4gdGhpcy51bnN1YnNjcmliZSgpXG4gICAgICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBTdWJzY3JpcHRpb25EaWFsb2dTdGF0ZS5UZXJtaW5hdGVkOlxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gUHJvbWlzZS5yZXNvbHZlKCk7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIHtAaW5oZXJpdERvYyBTdWJzY3JpcHRpb24udW5zdWJzY3JpYmV9XG4gICAgICovXG4gICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIEB0eXBlc2NyaXB0LWVzbGludC9uby11bnVzZWQtdmFyc1xuICAgIHVuc3Vic2NyaWJlKG9wdGlvbnMgPSB7fSkge1xuICAgICAgICBpZiAodGhpcy5kaXNwb3NlZCkge1xuICAgICAgICAgICAgcmV0dXJuIFByb21pc2UucmVzb2x2ZSgpO1xuICAgICAgICB9XG4gICAgICAgIHN3aXRjaCAodGhpcy5zdWJzY3JpYmVyUmVxdWVzdC5zdGF0ZSkge1xuICAgICAgICAgICAgY2FzZSBTdWJzY3JpcHRpb25EaWFsb2dTdGF0ZS5Jbml0aWFsOlxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBTdWJzY3JpcHRpb25EaWFsb2dTdGF0ZS5Ob3RpZnlXYWl0OlxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBTdWJzY3JpcHRpb25EaWFsb2dTdGF0ZS5QZW5kaW5nOlxuICAgICAgICAgICAgICAgIGlmICh0aGlzLl9kaWFsb2cpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5fZGlhbG9nLnVuc3Vic2NyaWJlKCk7XG4gICAgICAgICAgICAgICAgICAgIC8vIHJlc3BvbnNlcyBpbnRlbnRpb25hbGx5IGlnbm9yZWRcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIFN1YnNjcmlwdGlvbkRpYWxvZ1N0YXRlLkFjdGl2ZTpcbiAgICAgICAgICAgICAgICBpZiAodGhpcy5fZGlhbG9nKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuX2RpYWxvZy51bnN1YnNjcmliZSgpO1xuICAgICAgICAgICAgICAgICAgICAvLyByZXNwb25zZXMgaW50ZW50aW9uYWxseSBpZ25vcmVkXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBTdWJzY3JpcHRpb25EaWFsb2dTdGF0ZS5UZXJtaW5hdGVkOlxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJVbmtub3duIHN0YXRlLlw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gICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFwicHJvYmF0aW9uXCI6XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBcImdpdmV1cFwiOlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmluaXRTdWJzY3JpYmVyUmVxdWVzdCgpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoc3Vic2NyaXB0aW9uU3RhdGUucGFyYW1zICYmIHN1YnNjcmlwdGlvblN0YXRlLnBhcmFtc1tcInJldHJ5LWFmdGVyXCJdKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnJldHJ5QWZ0ZXJUaW1lciA9IHNldFRpbWVvdXQoKCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc3Vic2NyaWJlKCk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBzdWJzY3JpcHRpb25TdGF0ZS5wYXJhbXNbXCJyZXRyeS1hZnRlclwiXSk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnN1YnNjcmliZSgpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFwicmVqZWN0ZWRcIjpcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFwibm9yZXNvdXJjZVwiOlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgXCJpbnZhcmlhbnRcIjpcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgdGhpcy51bnN1YnNjcmliZSgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cbiAgICAvKiogQGludGVybmFsICovXG4gICAgb25SZWZyZXNoKHJlcXVlc3QpIHtcbiAgICAgICAgcmVxdWVzdC5kZWxlZ2F0ZSA9IHtcbiAgICAgICAgICAgIG9uQWNjZXB0OiAocmVzcG9uc2UpID0+IHRoaXMub25BY2NlcHRlZChyZXNwb25zZSlcbiAgICAgICAgfTtcbiAgICB9XG4gICAgaW5pdFN1YnNjcmliZXJSZXF1ZXN0KCkge1xuICAgICAgICBjb25zdCBvcHRpb25zID0ge1xuICAgICAgICAgICAgZXh0cmFIZWFkZXJzOiB0aGlzLmV4dHJhSGVhZGVycyxcbiAgICAgICAgICAgIGJvZHk6IHRoaXMuYm9keSA/IGZyb21Cb2R5TGVnYWN5KHRoaXMuYm9keSkgOiB1bmRlZmluZWRcbiAgICAgICAgfTtcbiAgICAgICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIEB0eXBlc2NyaXB0LWVzbGludC9uby11c2UtYmVmb3JlLWRlZmluZVxuICAgICAgICB0aGlzLnN1YnNjcmliZXJSZXF1ZXN0ID0gbmV3IFN1YnNjcmliZXJSZXF1ZXN0KHRoaXMuX3VzZXJBZ2VudC51c2VyQWdlbnRDb3JlLCB0aGlzLnRhcmdldFVSSSwgdGhpcy5ldmVudCwgdGhpcy5leHBpcmVzLCBvcHRpb25zKTtcbiAgICAgICAgdGhpcy5zdWJzY3JpYmVyUmVxdWVzdC5kZWxlZ2F0ZSA9IHtcbiAgICAgICAgICAgIG9uQWNjZXB0OiAocmVzcG9uc2UpID0+IHRoaX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AgICAgIGlmICh0aGlzLmRlbGVnYXRlICYmIHRoaXMuZGVsZWdhdGUub25BY2NlcHQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZGVsZWdhdGUub25BY2NlcHQocmVzcG9uc2UpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICAvLyBEdWUgdG8gdGhlIHBvdGVudGlhbCBmb3Igb3V0LW9mLW9yZGVyIG1lc3NhZ2VzLCBwYWNrZXQgbG9zcywgYW5kXG4gICAgICAgICAgICAgICAgLy8gZm9ya2luZywgdGhlIHN1YnNjcmliZXIgTVVTVCBiZSBwcmVwYXJlZCB0byByZWNlaXZlIE5PVElGWSByZXF1ZXN0c1xuICAgICAgICAgICAgICAgIC8vIGJlZm9yZSB0aGUgU1VCU0NSSUJFIHRyYW5zYWN0aW9uIGhhcyBjb21wbGV0ZWQuXG4gICAgICAgICAgICAgICAgLy8gaHR0cHM6Ly90b29scy5pZXRmLm9yZy9odG1sL3JmYzY2NjUjc2VjdGlvbi00LjEuMi40XG4gICAgICAgICAgICAgICAgb25Ob3RpZnk6IChyZXF1ZXN0V2l0aFN1YnNjcmlwdGlvbikgPT4ge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnN1YnNjcmlwdGlvbiA9IHJlcXVlc3RXaXRoU3Vic2NyaXB0aW9uLnN1YnNjcmlwdGlvbjtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMuc3Vic2NyaXB0aW9uKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnN1YnNjcmlwdGlvbi5hdXRvUmVmcmVzaCA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgcmVzb2x2ZSh7IHN1Y2Nlc3M6IHJlcXVlc3RXaXRoU3Vic2NyaXB0aW9uIH0pO1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgLy8gSWYg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XG4gICAgICAgICAgICAgICAgaWYgKG5ld1N0YXRlICE9PSBTdWJzY3JpcHRpb25TdGF0ZS5Ob3RpZnlXYWl0ICYmIG5ld1N0YXRlICE9PSBTdWJzY3JpcHRpb25TdGF0ZS5UZXJtaW5hdGVkKSB7XG4gICAgICAgICAgICAgICAgICAgIGludmFsaWRUcmFuc2l0aW9uKCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBTdWJzY3JpcHRpb25TdGF0ZS5Ob3RpZnlXYWl0OlxuICAgICAgICAgICAgICAgIGlmIChuZXdTdGF0ZSAhPT0gU3Vic2NyaXB0aW9uU3RhdGUuU3Vic2NyaWJlZCAmJiBuZXdTdGF0ZSAhPT0gU3Vic2NyaXB0aW9uU3RhdGUuVGVybWluYXRlZCkge1xuICAgICAgICAgICAgICAgICAgICBpbnZhbGlkVHJhbnNpdGlvbigpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgU3Vic2NyaXB0aW9uU3RhdGUuU3Vic2NyaWJlZDpcbiAgICAgICAgICAgICAgICBpZiAobmV3U3RhdGUgIT09IFN1YnNjcmlwdGlvblN0YXRlLlRlcm1pbmF0ZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgaW52YWxpZFRyYW5zaXRpb24oKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIFN1YnNjcmlwdGlvblN0YXRlLlRlcm1pbmF0ZWQ6XG4gICAgICAgICAgICAgICAgaW52YWxpZFRyYW5zaXRpb24oKTtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwiVW5yZWNvZ25pemVkIHN0YXRlLlwiKTtcbiAgICAgICAgfVxuICAgICAgICAvL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yID0gdGhpcy5vcHRpb25zLmxvZ0Nvbm5lY3RvcjtcbiAgICAgICAgc3dpdGNoICh0aGlzLm9wdGlvbnMubG9nTGV2ZWwpIHtcbiAgICAgICAgICAgIGNhc2UgXCJlcnJvclwiOlxuICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyRmFjdG9yeS5sZXZlbCA9IExldmVscy5lcnJvcjtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgXCJ3YXJuXCI6XG4gICAgICAgICAgICAgICAgdGhpcy5sb2dnZXJGYWN0b3J5LmxldmVsID0gTGV2ZWxzLndhcm47XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIFwibG9nXCI6XG4gICAgICAgICAgICAgICAgdGhpcy5sb2dnZXJGYWN0b3J5LmxldmVsID0gTGV2ZWxzLmxvZztcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgXCJkZWJ1Z1wiOlxuICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyRmFjdG9yeS5sZXZlbCA9IExldmVscy5kZWJ1ZztcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHRoaXMub3B0aW9ucy5sb2dDb25maWd1cmF0aW9uKSB7XG4gICAgICAgICAgICB0aGlzLmxvZ2dlci5sb2coXCJDb25maWd1cmF0aW9uOlwiKTtcbiAgICAgICAgICAgIE9iamVjdC5rZXlzKHRoaXMub3B0aW9ucykuZm9yRWFjaCgoa2V5KSA9PiB7XG4gICAgICAgICAgICAgICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIEB0eXBlc2NyaXB0LWVzbGludC9uby1leHBsaWNpdC1hbnlcbiAgICAgICAgICAgICAgICBjb25zdCB2YWx1ZSA9IHRoaXMub3B0aW9uc1trZXldO1xuICAgICAgICAgICAgICAgIHN3aXRjaCAoa2V5KSB7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgXCJ1cmlcIjpcbiAgICAgICAgICAgICAgICAgICAgY2FzZSBcInNlc3Npb25EZXNjcmlwdGlvbkhhbmRsZXJGYWN0b3J5XCI6XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5sb2coXCLCtyBcIiArIGtleSArIFwiOiBcIiArIHZhbHVlKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICBjYXNlIFwiYXV0aG9yaXphdGlvblBhc3N3b3JkXCI6XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5sb2coXCLCtyBcIiArIGtleSArIFwiOiBcIiArIFwiTk9UIFNIT1dOXCIpO1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgXCJ0cmFuc3BvcnRDb25zdHJ1Y3RvclwiOlxuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIubG9nKFwiwrcgXCIgKyBrZXkgKyBcIjogXCIgKyB2YWx1ZS5uYW1lKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIubG9nKFwiwrcgXCIgKyBrZXkgKyBcIjogXCIgKyBKU09OLnN0cmluZ2lmeSh2YWx1ZSkpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICAgIC8vIGd1YXJkIGRlcHJlY2F0ZWQgdHJhbnNwb3J0IG9wdGlvbnMgKHJlbW92ZSB0aGlzIGluIHZlcnNpb24gMTYueClcbiAgICAgICAgaWYgKHRoaXMub3B0aW9ucy50cmFuc3BvcnRPcHRpb25zKSB7XG4gICAgICAgICAgICAv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NlLFxuICAgICAgICAgICAgaGFja0lwSW5Db250YWN0OiBmYWxzZSxcbiAgICAgICAgICAgIGhhY2tWaWFUY3A6IGZhbHNlLFxuICAgICAgICAgICAgaW5zdGFuY2VJZDogXCJcIixcbiAgICAgICAgICAgIGluc3RhbmNlSWRBbHdheXNBZGRlZDogZmFsc2UsXG4gICAgICAgICAgICBsb2dCdWlsdGluRW5hYmxlZDogdHJ1ZSxcbiAgICAgICAgICAgIGxvZ0NvbmZpZ3VyYXRpb246IHRydWUsXG4gICAgICAgICAgICBsb2dDb25uZWN0b3I6ICgpID0+IHtcbiAgICAgICAgICAgICAgICAvKiBub29wICovXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgbG9nTGV2ZWw6IFwibG9nXCIsXG4gICAgICAgICAgICBub0Fuc3dlclRpbWVvdXQ6IDYwLFxuICAgICAgICAgICAgcHJlbG9hZGVkUm91dGVTZXQ6IFtdLFxuICAgICAgICAgICAgcmVjb25uZWN0aW9uQXR0ZW1wdHM6IDAsXG4gICAgICAgICAgICByZWNvbm5lY3Rpb25EZWxheTogNCxcbiAgICAgICAgICAgIHNlbmRJbml0aWFsUHJvdmlzaW9uYWxSZXNwb25zZTogdHJ1ZSxcbiAgICAgICAgICAgIHNlc3Npb25EZXNjcmlwdGlvbkhhbmRsZXJGYWN0b3J5OiBkZWZhdWx0U2Vzc2lvbkRlc2NyaXB0aW9uSGFuZGxlckZhY3RvcnkoKSxcbiAgICAgICAgICAgIHNlc3Npb25EZXNjcmlwdGlvbkhhbmRsZXJGYWN0b3J5T3B0aW9uczoge30sXG4gICAgICAgICAgICBzaXBFeHRlbnNpb24xMDByZWw6IFNJUEV4dGVuc2lvbi5VbnN1cHBvcnRlZCxcbiAgICAgICAgICAgIHNpcEV4dGVuc2lvblJlcGxhY2VzOiBTSVBFeHRlbnNpb24uVW5zdXBwb3J0ZWQsXG4gICAgICAgICAgICBzaXBFeHRlbnNpb25FeHRyYVN1cHBvcnRlZDogW10sXG4gICAgICAgICAgICBzaXBqc0lkOiBcIlwiLFxuICAgICAgICAgICAgdHJhbnNwb3J0Q29uc3RydWN0b3I6IFdlYlRyYW5zcG9ydCxcbiAgICAgICAgICAgIHRyYW5zcG9ydE9wdGlvbnM6IHt9LFxuICAgICAgICAgICAgdXJpOiBuZXcgVVJJKFwic2lwXCIsIFwiYW5vbnltb3VzXCIsIFwiYW5vbnltb3VzLmludmFsaWRcIiksXG4gICAgICAgICAgICB1c2VyQWdlbnRTdHJpbmc6IFwiU0lQLmpzL1wiICsgTElCUkFSWV9WRVJTSU9OLFxuICAgICAgICAgICAgdmlhSG9zdDogXCJcIlxuICAgICAgICB9O1xuICAgIH1cbiAgICAvLyBodHRwOi8vc3RhY2tvdmVyZmxvdy5jb20vdXNlcnMvMTA5NTM4L2Jyb29mYVxuICAgIHN0YXRpYyBuZXdVVUlEKCkge1xuICAgICAgICBjb25zdCBVVUlEID0gXCJ4eHh4eHh4eC14eHh4LTR4eHgteXh4eC14eHh4eHh4eHh4eHhcIi5yZXBsYWNlKC9beHldL2csIChjKSA9PiB7XG4gICAgICAgICAgICBjb25zdCByID0gTWF0aC5mbG9vcihNYXRoLnJhbmRvbSgpICogMTYpO1xuICAgICAgICAgICAgY29uc3QgdiA9IGMgPT09IFwieFwiID8gciA6IChyICUgNCkgKyA4O1xuICAgICAgICAgICAgcmV0dXJuIHYudG9TdHJpbmcoMTYpO1xuICAgICAgICB9KTtcbiAgICAgICAgcmV0dXJuIFVVSUQ7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIFN0cmlwIHByb3BlcnRpZXMgd2l0aCB1bmRlZmluZWQgdmFsdWVzIGZyb20gb3B0aW9ucy5cbiAgICAgKiBUaGlzIGlzIGEgd29yayBhcm91bmQgd2hpbGUgd2FpdGluZyBmb3IgbWlzc2luZyB2cyB1bmRlZmluZWQgdG8gYmUgYWRkcmVzc2VkIChvciBub3QpLi4uXG4gICAgICogaHR0cHM6Ly9naXRodWIuY29tL01pY3Jvc29mdC9UeXBl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gICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5lcnJvcihlcnJvci5tZXNzYWdlKTtcbiAgICAgICAgICAgICAgICAgICAgZGVsZXRlIHRoaXMuX3Nlc3Npb25zW2lkXTtcbiAgICAgICAgICAgICAgICAgICAgdGhyb3cgZXJyb3I7XG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgLy8gRGlzcG9zZSBvZiBTdWJzY3JpcHRpb25zXG4gICAgICAgIHRoaXMubG9nZ2VyLmxvZyhgRGlzcG9zZSBvZiBzdWJzY3JpcHRpb25zYCk7XG4gICAgICAgIGZvciAoY29uc3QgaWQgaW4gc3Vic2NyaXB0aW9ucykge1xuICAgICAgICAgICAgaWYgKHN1YnNjcmlwdGlvbnNbaWRdKSB7XG4gICAgICAgICAgICAgICAgYXdhaXQgc3Vic2NyaXB0aW9uc1tpZF0uZGlzcG9zZSgpLmNhdGNoKChlcnJvcikgPT4ge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5lcnJvcihlcnJvci5tZXNzYWdlKTtcbiAgICAgICAgICAgICAgICAgICAgZGVsZXRlIHRoaXMuX3N1YnNjcmlwdGlvbnNbaWRdO1xuICAgICAgICAgICAgICAgICAgICB0aHJvdyBlcnJvcjtcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICAvLyBEaXNwb3NlIG9mIFB1Ymxpc2hlcnNcbiAgICAgICAgdGhpcy5sb2dnZXIubG9nKGBEaXNwb3NlIG9mIHB1Ymxpc2hlcnNgKTtcbiAgICAgICAgZm9yIChjb25zdCBpZCBpbiBwdWJsaXNoZXJzKSB7XG4gICAgICAgICAgICBpZiAocHVibGlzaGVyc1tpZF0pIHtcbiAgICAgICAgICAgICAgICBhd2FpdCBwdWJsaXNoZXJzW2lkXS5kaXNwb3NlKCkuY2F0Y2goKGVycm9yKSA9PiB7XG4gICAgICAgICAgICAg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Rpb25zID0ge30pID0+IHtcbiAgICAgICAgICAgICAgICBjb25zdCBhbm9ueW1vdXMgPSBjb250YWN0VG9TdHJpbmdPcHRpb25zLmFub255bW91cyB8fCBmYWxzZTtcbiAgICAgICAgICAgICAgICBjb25zdCBvdXRib3VuZCA9IGNvbnRhY3RUb1N0cmluZ09wdGlvbnMub3V0Ym91bmQgfHwgZmFsc2U7XG4gICAgICAgICAgICAgICAgY29uc3QgcmVnaXN0ZXIgPSBjb250YWN0VG9TdHJpbmdPcHRpb25zLnJlZ2lzdGVyIHx8IGZhbHNlO1xuICAgICAgICAgICAgICAgIGxldCBjb250YWN0U3RyaW5nID0gXCI8XCI7XG4gICAgICAgICAgICAgICAgLy8gMy4zLiAgVXNpbmcgYSBHUlVVXG4gICAgICAgICAgICAgICAgLy8gT25jZSBhIHVzZXIgYWdlbnQgb2J0YWlucyBHUlVVcyBmcm9tIHRoZSByZWdpc3RyYXIsIGl0IHVzZXMgdGhlbSBpblxuICAgICAgICAgICAgICAgIC8vIHNldmVyYWwgd2F5cy4gIEZpcnN0LCBpdCB1c2VzIHRoZW0gYXMgdGhlIGNvbnRlbnRzIG9mIHRoZSBDb250YWN0XG4gICAgICAgICAgICAgICAgLy8gaGVhZGVyIGZpZWxkIGluIG5vbi1SRUdJU1RFUiByZXF1ZXN0cyBhbmQgcmVzcG9uc2VzIHRoYXQgaXQgZW1pdHNcbiAgICAgICAgICAgICAgICAvLyAoZm9yIGV4YW1wbGUsIGFuIElOVklURSByZXF1ZXN0IGFuZCAyMDAgT0sgcmVzcG9uc2UpLlxuICAgICAgICAgICAgICAgIC8vIGh0dHBzOi8vZGF0YXRyYWNrZXIuaWV0Zi5vcmcvZG9jL2h0bWwvcmZjNTYyNyNzZWN0aW9uLTMuM1xuICAgICAgICAgICAgICAgIGlmIChhbm9ueW1vdXMpIHtcbiAgICAgICAgICAgICAgICAgICAgY29udGFjdFN0cmluZyArPVxuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5jb250YWN0LnRlbXBHcnV1IHx8XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYHNpcDphbm9ueW1vdXNAYW5vbnltb3VzLmludmFsaWQ7dHJhbnNwb3J0PSR7Y29udGFjdFBhcmFtcy50cmFuc3BvcnQgPyBjb250YWN0UGFyYW1zLnRyYW5zcG9ydCA6IFwid3NcIn1gO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBlbHNlIGlmIChyZWdpc3Rlcikge1xuICAgICAgICAgICAgICAgICAgICBjb250YWN0U3RyaW5nICs9IHRoaXMuY29udGFjdC51cmk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBjb250YWN0U3RyaW5nICs9IHRoaXMuY29udGFjdC5wdWJHcnV1IHx8IHRoaXMuY29udGFjdC51cmk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmIChvdXRib3VuZCkge1xuICAgICAgICAgICAgICAgICAgICBjb250YWN0U3RyaW5nICs9IFwiO29iXCI7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGNvbnRhY3RTdHJpbmcgKz0gXCI+XCI7XG4gICAgICAgICAgICAgICAgaWYgKHRoaXMub3B0aW9ucy5pbnN0YW5jZUlkQWx3YXlzQWRkZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgY29udGFjdFN0cmluZyArPSAnOytzaXAuaW5zdGFuY2U9XCI8dXJuOnV1aWQ6JyArIHRoaXMuX2luc3RhbmNlSWQgKyAnPlwiJztcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgcmV0dXJuIGNvbnRhY3RTdHJpbmc7XG4gICAgICAgICAgICB9XG4gICAgICAgIH07XG4gICAgICAgIHJldHVybiBjb250YWN0O1xuICAgIH1cbiAgICAvKipcbiAgICAgKiBJbml0aWFsaXplIHVzZXIgYWdlbnQgY29yZS5cbiAgICAgKi9cbiAgICBpbml0Q29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G4gICAgICAgIGNvbnN0IHVzZXJBZ2VudENvcmVEZWxlZ2F0ZSA9IHtcbiAgICAgICAgICAgIG9uSW52aXRlOiAoaW5jb21pbmdJbnZpdGVSZXF1ZXN0KSA9PiB7XG4gICAgICAgICAgICAgICAgdmFyIF9hO1xuICAgICAgICAgICAgICAgIGNvbnN0IGludml0YXRpb24gPSBuZXcgSW52aXRhdGlvbih0aGlzLCBpbmNvbWluZ0ludml0ZVJlcXVlc3QpO1xuICAgICAgICAgICAgICAgIGluY29taW5nSW52aXRlUmVxdWVzdC5kZWxlZ2F0ZSA9IHtcbiAgICAgICAgICAgICAgICAgICAgb25DYW5jZWw6IChjYW5jZWwpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGludml0YXRpb24uX29uQ2FuY2VsKGNhbmNlbCk7XG4gICAgICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBAdHlwZXNjcmlwdC1lc2xpbnQvbm8tdW51c2VkLXZhcnNcbiAgICAgICAgICAgICAgICAgICAgb25UcmFuc3BvcnRFcnJvcjogKGVycm9yKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBBIHNlcnZlciB0cmFuc2FjdGlvbiBNVVNUIE5PVCBkaXNjYXJkIHRyYW5zYWN0aW9uIHN0YXRlIGJhc2VkIG9ubHkgb25cbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIGVuY291bnRlcmluZyBhIG5vbi1yZWNvdmVyYWJsZSB0cmFuc3BvcnQgZXJyb3Igd2hlbiBzZW5kaW5nIGFcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIHJlc3BvbnNlLiAgSW5zdGVhZCwgdGhlIGFzc29jaWF0ZWQgSU5WSVRFIHNlcnZlciB0cmFuc2FjdGlvbiBzdGF0ZVxuICAgICAgICAgICAgICAgICAgICAgICAgLy8gbWFjaGluZSBNVVNUIHJlbWFpbiBpbiBpdHMgY3Vyc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4dGVuc2lvblJlcGxhY2VzICE9PSBTSVBFeHRlbnNpb24uVW5zdXBwb3J0ZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgbWVzc2FnZSA9IGluY29taW5nSW52aXRlUmVxdWVzdC5tZXNzYWdlO1xuICAgICAgICAgICAgICAgICAgICBjb25zdCByZXBsYWNlcyA9IG1lc3NhZ2UucGFyc2VIZWFkZXIoXCJyZXBsYWNlc1wiKTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHJlcGxhY2VzKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBjYWxsSWQgPSByZXBsYWNlcy5jYWxsX2lkO1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVvZiBjYWxsSWQgIT09IFwic3RyaW5nXCIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJUeXBlIG9mIGNhbGwgaWQgaXMgbm90IHN0cmluZ1wiKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHRvVGFnID0gcmVwbGFjZXMucmVwbGFjZXNfdG9fdGFnO1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVvZiB0b1RhZyAhPT0gXCJzdHJpbmdcIikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcIlR5cGUgb2YgdG8gdGFnIGlzIG5vdCBzdHJpbmdcIik7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBmcm9tVGFnID0gcmVwbGFjZXMucmVwbGFjZXNfZnJvbV90YWc7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAodHlwZW9mIGZyb21UYWcgIT09IFwic3RyaW5nXCIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJ0eXBlIG9mIGZyb20gdGFnIGlzIG5vdCBzdHJpbmdcIik7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCB0YXJnZXREaWFsb2dJZCA9IGNhbGxJZCArIHRvVGFnICsgZnJvbVRhZztcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHRhcmdldERpYWxvZyA9IHRoaXMudXNlckFnZW50Q29yZS5kaWFsb2dzLmdldCh0YXJnZXREaWFsb2dJZCk7XG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBJZiBubyBtYXRjaCBpcyBmb3VuZCwgdGhlIFVBUyByZWplY3RzIHRoZSBJTlZJVEUgYW5kIHJldHVybnMgYSA0ODFcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIENhbGwvVHJhbnNhY3Rpb24gRG9lcyBOb3QgRXhpc3QgcmVzcG9uc2UuICBMaWtld2lzZSwgaWYgdGhlIFJlcGxhY2VzXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBoZWFkZXIgZmllbGQgbWF0Y2hlcyBhIGRpYWxvZyB3aGljaCB3YXMgbm90IGNyZWF0ZWQgd2l0aCBhbiBJTlZJVEUsXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyB0aGUgVUFTIE1VU1QgcmVqZWN0IHRoZSByZXF1ZXN0IHdpdGggYSA0ODEgcmVzcG9uc2UuXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBodHRwczovL3Rvb2xzLmlldGYub3JnL2h0bWwvcmZjMzg5MSNzZWN0aW9uLTNcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghdGFyZ2V0RGlhbG9nKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaW52aXRhdGlvbi5yZWplY3QoeyBzdGF0dXNDb2RlOiA0ODEgfSk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgLy8gSWYgdGhlIFJlcGxhY2VzIGhlYWRlciBmaWVsZCBtYXRjaGVzIGEgY29uZmlybWVkIGRpYWxvZywgaXQgY2hlY2tzXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBmb3IgdGhlIHByZXNlbmNlIG9mIHRoZSBcImVhcmx5LW9ubHlcIiBmbGFnIGluIHRoZSBSZXBsYWNlcyBoZWFkZXJcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIGZpZWxkLiAgKFRoaXMgZmxhZyBhbGxvd3MgdGhlIFVBQyB0byBwcmV2ZW50IGEgcG90ZW50aWFsbHlcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIHVuZGVzaXJhYmxlIHJhY2UgY29uZGl0aW9uIGRlc2NyaWJlZCBpbiBTZWN0aW9uIDcuMS4pIElmIHRoZSBmbGFnIGlzXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBwcmVzZW50LCB0aGUgVUEgcmVqZWN0cyB0aGUgcmVxdWVzdCB3aXRoIGEgNDg2IEJ1c3kgcmVzcG9uc2UuXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBodHRwczovL3Rvb2xzLmlldGYub3JnL2h0bWwvcmZjMzg5MSNzZWN0aW9uLTNcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghdGFyZ2V0RGlhbG9nLmVhcmx5ICYmIHJlcGxhY2VzLmVhcmx5X29ubHkgPT09IHRydWUpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnZpdGF0aW9uLnJlamVjdCh7IHN0YXR1c0NvZGU6IDQ4NiB9KTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBQcm92aWRlIGEgaGFuZGxlIG9uIHRoZSBzZXNzaW9uIGJlaW5nIHJlcGxhY2VkLlxuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgdGFyZ2V0U2Vzc2lvbiA9IHRoaXMuX3Nlc3Npb25zW2NhbGxJZCArIGZyb21UYWddIHx8IHRoaXMuX3Nlc3Npb25zW2NhbGxJZCArIHRvVGFnXSB8fCB1bmRlZmluZWQ7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXRhcmdldFNlc3Npb24pIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJTZXNzaW9uIGRvZXMgbm90IGV4aXN0LlwiKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIGludml0YXRpb24uX3JlcGxhY2VlID0gdGFyZ2V0U2Vzc2lvbjtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAvLyBEZWxlZ2F0ZSBpbnZpdGF0aW9uIGhhbmRsaW5nLlxuICAgICAgICAgICAgICAgIGlmICgoX2EgPSB0aGlzLmRlbGVnYXRlKSA9PT0gbnVsbCB8fCBfYSA9PT0gdm9pZCAwID8gdm9pZCAwIDogX2Eub25JbnZpdGUpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGludml0YXRpb24uYXV0b1NlbmRBbkluaXRpYWxQcm92aXNpb25hbFJlc3BvbnNlKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBpbnZpdGF0aW9uLnByb2dyZXNzKCkudGhlbigoKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIF9hO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgoKF9hID0gdGhpcy5kZWxlZ2F0ZSkgPT09IG51bGwgfHwgX2EgPT09IHZvaWQgMCA/IHZvaWQgMCA6IF9hLm9uSW52aXRlKSA9PT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcIm9uSW52aXRlIHVuZGVmaW5lZC5cIik7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZGVsZWdhdGUub25JbnZpdGUoaW52aXRhdGlvbik7XG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB0aGlzLmRlbGVnYXRlLm9uSW52aXRlKGludml0YXRpb24pO1xuICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIC8vIEEgY29tbW9uIHNjZW5hcmlvIG9jY3VycyB3aGVuIHRoZSBjYWxsZWUgaXMgY3VycmVudGx5IG5vdCB3aWxsaW5nIG9yXG4gICAgICAgICAgICAgICAgLy8gYWJsZSB0byB0YWtlIGFkZGl0aW9uYWwgY2FsbHMgYXQgdGhpcyBlbmQgc3lzdGVtLiAgQSA0ODYgKEJ1c3kgSGVyZSlcbiAgICAgICAgICAgICAgICAvLyBTSE9VTEQgYmUgcmV0dXJuZWQgaW4gc3VjaCBhIHNjZW5hcmlvLlxuICAgICAgICAgICAgICAgIC8vIGh0dHBzOi8vdG9vbHMuaWV0Zi5vcmcvaHRtbC9yZmMzMjYxI3NlY3Rpb24tMTMuMy4xLjNcbiAgICAgICAgICAgICAgICBpbnZpdGF0aW9uLnJlamVjdCh7IHN0YXR1c0NvZGU6IDQ4NiB9KTtcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBvbk1lc3NhZ2U6IChpbmNvbWluZ01lc3NhZ2VSZXF1ZXN0KSA9PiB7XG4gICAgICAgICAgICAgICAgaWYgKHRoaXMuZGVsZWdhdGUgJiYgdGhpcy5kZWxlZ2F0ZS5vbk1lc3NhZ2UpIHtcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgbWVzc2FnZSA9IG5ldyBNZXNzYWdlKGluY29taW5nTWVzc2FnZVJlcXVlc3QpO1xu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gICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBvblJlZmVyOiAoaW5jb21pbmdSZWZlclJlcXVlc3QpID0+IHtcbiAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci53YXJuKFwiUmVjZWl2ZWQgYW4gb3V0IG9mIGRpYWxvZyBSRUZFUiByZXF1ZXN0XCIpO1xuICAgICAgICAgICAgICAgIC8vIFRPT0Q6IHRoaXMuZGVsZWdhdGUub25SZWZlciguLi4pXG4gICAgICAgICAgICAgICAgaWYgKHRoaXMuZGVsZWdhdGUgJiYgdGhpcy5kZWxlZ2F0ZS5vblJlZmVyUmVxdWVzdCkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmRlbGVnYXRlLm9uUmVmZXJSZXF1ZXN0KGluY29taW5nUmVmZXJSZXF1ZXN0KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIGluY29taW5nUmVmZXJSZXF1ZXN0LnJlamVjdCh7IHN0YXR1c0NvZGU6IDQwNSB9KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgb25SZWdpc3RlcjogKGluY29taW5nUmVnaXN0ZXJSZXF1ZXN0KSA9PiB7XG4gICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIud2FybihcIlJlY2VpdmVkIGFuIG91dCBvZiBkaWFsb2cgUkVHSVNURVIgcmVxdWVzdFwiKTtcbiAgICAgICAgICAgICAgICAvLyBUT09EOiB0aGlzLmRlbGVnYXRlLm9uUmVnaXN0ZXIoLi4uKVxuICAgICAgICAgICAgICAgIGlmICh0aGlzLmRlbGVnYXRlICYmIHRoaXMuZGVsZWdhdGUub25SZWdpc3RlclJlcXVlc3QpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5kZWxlZ2F0ZS5vblJlZ2lzdGVyUmVxdWVzdChp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ZW50TGVuZ3RoICYmIGxlbiA8IE51bWJlcihjb250ZW50TGVuZ3RoKSkge1xuICAgICAgICAgICAgICAgIHRoaXMudXNlckFnZW50Q29yZS5yZXBseVN0YXRlbGVzcyhtZXNzYWdlLCB7IHN0YXR1c0NvZGU6IDQwMCB9KTtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgLy8gUmVzcG9uc2UgQ2hlY2tzXG4gICAgICAgIGlmIChtZXNzYWdlIGluc3RhbmNlb2YgSW5jb21pbmdSZXNwb25zZU1lc3NhZ2UpIHtcbiAgICAgICAgICAgIC8vIFRoaXMgaXMgcG9ydCBvZiBTYW5pdHlDaGVjay5taW5pbXVtSGVhZGVycygpLlxuICAgICAgICAgICAgaWYgKCFoYXNNaW5pbXVtSGVhZGVycygpKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIud2FybihgUmVzcG9uc2UgbWlzc2luZyBtYW5kYXRvcnkgaGVhZGVyIGZpZWxkLiBEcm9wcGluZy5gKTtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICAvLyBDdXN0b20gU0lQLmpzIGNoZWNrIHRvIGRyb3AgcmVzcG9uc2VzIGlmIG11bHRpcGxlIFZpYSBoZWFkZXJzLlxuICAgICAgICAgICAgLy8gVGhpcyBpcyBwb3J0IG9mIFNhbml0eUNoZWNrLnJmYzMyNjFfOF8xXzNfMygpLlxuICAgICAgICAgICAgaWYgKG1lc3NhZ2UuZ2V0SGVhZGVycyhcInZpYVwiKS5sZW5ndGggPiAxKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIud2FybihcIk1vcmUgdGhhbiBvbmUgVmlhIGhlYWRlciBmaWVsZCBwcmVzZW50IGluIHRoZSByZXNwb25zZS4gRHJvcHBpbmcuXCIpO1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH1cbiAgICA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F0ZSwgZXJyb3IpIHtcbiAgICAgICAgY29uc3QgaW52YWxpZFRyYW5zaXRpb24gPSAoKSA9PiB7XG4gICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoYEludmFsaWQgc3RhdGUgdHJhbnNpdGlvbiBmcm9tICR7dGhpcy5fc3RhdGV9IHRvICR7bmV3U3RhdGV9YCk7XG4gICAgICAgIH07XG4gICAgICAgIC8vIFZhbGlkYXRlIHN0YXRlIHRyYW5zaXRpb25cbiAgICAgICAgc3dpdGNoICh0aGlzLl9zdGF0ZSkge1xuICAgICAgICAgICAgY2FzZSBVc2VyQWdlbnRTdGF0ZS5TdGFydGVkOlxuICAgICAgICAgICAgICAgIGlmIChuZXdTdGF0ZSAhPT0gVXNlckFnZW50U3RhdGUuU3RvcHBlZCkge1xuICAgICAgICAgICAgICAgICAgICBpbnZhbGlkVHJhbnNpdGlvbigpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgVXNlckFnZW50U3RhdGUuU3RvcHBlZDpcbiAgICAgICAgICAgICAgICBpZiAobmV3U3RhdGUgIT09IFVzZXJBZ2VudFN0YXRlLlN0YXJ0ZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgaW52YWxpZFRyYW5zaXRpb24oKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcIlVua25vd24gc3RhdGUuXCIpO1xuICAgICAgICB9XG4gICAgICAgIC8vIFVwZGF0ZSBzdGF0ZVxuICAgICAgICB0aGlzLmxvZ2dlci5sb2coYFRyYW5zaXRpb25lZCBmcm9tICR7dGhpcy5fc3RhdGV9IHRvICR7bmV3U3RhdGV9YCk7XG4gICAgICAgIHRoaXMuX3N0YXRlID0gbmV3U3RhdGU7XG4gICAgICAgIHRoaXMuX3N0YXRlRXZlb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Z2VyLndhcm4oYElOVklURSBkaWFsb2cgJHt0aGlzLmlkfSByZWNlaXZlZCB1bmV4cGVjdGVkICR7bWVzc2FnZS5tZXRob2R9IHJlcXVlc3QsIGRyb3BwaW5nLmApO1xuICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIC8vIFVwZGF0ZSBiZWZvcmUgdGhlIGRlbGVnYXRlIGhhcyBhIGNoYW5jZSB0byBoYW5kbGUgdGhlXG4gICAgICAgICAgICAgICAgLy8gbWVzc2FnZSBhcyBkZWxlZ2F0ZSBtYXkgY2FsbGJhY2sgaW50byB0aGlzIGRpYWxvZy5cbiAgICAgICAgICAgICAgICB0aGlzLmFja1dhaXQgPSBmYWxzZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgIGlmICghdGhpcy5yZWludml0ZVVzZXJBZ2VudFNlcnZlcikge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci53YXJuKGBJTlZJVEUgZGlhbG9nICR7dGhpcy5pZH0gcmVjZWl2ZWQgdW5leHBlY3RlZCAke21lc3NhZ2UubWV0aG9kfSByZXF1ZXN0LCBkcm9wcGluZy5gKTtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAodGhpcy5yZWludml0ZVVzZXJBZ2VudFNlcnZlci50cmFuc2FjdGlvbi5yZXF1ZXN0LmNzZXEgIT09IG1lc3NhZ2UuY3NlcSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci53YXJuKGBJTlZJVEUgZGlhbG9nICR7dGhpcy5pZH0gcmVjZWl2ZWQgdW5leHBlY3RlZCAke21lc3NhZ2UubWV0aG9kfSByZXF1ZXN0LCBkcm9wcGluZy5gKTtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgIC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lmZmljdWx0IHRvIGRldGVybWluZSB3aGF0IHRoZSByZWFsIHByb2JsZW0gd2FzLilcbiAgICAgICAgICAgICAgICAvLyBodHRwczovL3Rvb2xzLmlldGYub3JnL2h0bWwvcmZjNTQwNyNzZWN0aW9uLTMuMS41XG4gICAgICAgICAgICAgICAgLy8gVUFTLUlzSTogIFdoaWxlIGFuIElOVklURSBzZXJ2ZXIgdHJhbnNhY3Rpb24gaXMgaW5jb21wbGV0ZSBvciBBQ0tcbiAgICAgICAgICAgICAgICAvLyAgICAgICAgICAgdHJhbnNhY3Rpb24gYXNzb2NpYXRlZCB3aXRoIGFuIG9mZmVyL2Fuc3dlciBpcyBpbmNvbXBsZXRlLFxuICAgICAgICAgICAgICAgIC8vICAgICAgICAgICBhIFVBIG11c3QgcmVqZWN0IGFub3RoZXIgSU5WSVRFIHJlcXVlc3Qgd2l0aCBhIDUwMFxuICAgICAgICAgICAgICAgIC8vICAgICAgICAgICByZXNwb25zZS5cbiAgICAgICAgICAgICAgICAvLyBodHRwczovL3Rvb2xzLmlldGYub3JnL2h0bWwvcmZjNjMzNyNzZWN0aW9uLTQuM1xuICAgICAgICAgICAgICAgIHRoaXMuY29yZS5yZXBseVN0YXRlbGVzcyhtZXNzYWdlLCB7IHN0YXR1c0NvZGU6IDUwMCwgZXh0cmFIZWFkZXJzIH0pO1xuICAgICAgICAgICAgICAgIHdhcm5pbmcoKTtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICAvLyBBIFVBUyB0aGF0IHJlY2VpdmVzIGEgc2Vjb25kIElOVklURSBiZWZvcmUgaXQgc2VuZHMgdGhlIGZpbmFsXG4gICAgICAgICAgICAvLyByZXNwb25zZSB0byBhIGZpcnN0IElOVklURSB3aXRoIGEgbG93ZXIgQ1NlcSBzZXF1ZW5jZSBudW1iZXIgb24gdGhlXG4gICAgICAgICAgICAvLyBzYW1lIGRpYWxvZyBNVVNUIHJldHVybiBhIDUwMCAoU2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2NpYXRlZCB3aXRoIGFuIEluZm8gUGFja2FnZSB0aGF0XG4gICAgICAgICAgICAgICAgLy8gdGhlIFVBIGhhcyBub3QgaW5kaWNhdGVkIHdpbGxpbmduZXNzIHRvIHJlY2VpdmUsIHRoZSBVQSBNVVNUIHNlbmQgYVxuICAgICAgICAgICAgICAgIC8vIDQ2OSAoQmFkIEluZm8gUGFja2FnZSkgcmVzcG9uc2UgKHNlZSBTZWN0aW9uIDExLjYpLCB3aGljaCBjb250YWlucyBhXG4gICAgICAgICAgICAgICAgLy8gUmVjdi1JbmZvIGhlYWRlciBmaWVsZCB3aXRoIEluZm8gUGFja2FnZXMgZm9yIHdoaWNoIHRoZSBVQSBpcyB3aWxsaW5nXG4gICAgICAgICAgICAgICAgLy8gdG8gcmVjZWl2ZSBJTkZPIHJlcXVlc3RzLlxuICAgICAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgdWFzID0gbmV3IEluZm9Vc2VyQWdlbnRTZXJ2ZXIodGhpcywgbWVzc2FnZSk7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZGVsZWdhdGUgJiYgdGhpcy5kZWxlZ2F0ZS5vbkluZm9cbiAgICAgICAgICAgICAgICAgICAgICAgID8gdGhpcy5kZWxlZ2F0ZS5vbkluZm8odWFzKVxuICAgICAgICAgICAgICAgICAgICAgICAgOiB1YXMucmVqZWN0KHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0dXNDb2RlOiA0NjksXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZXh0cmFIZWFkZXJzOiBbXCJSZWN2LUluZm86XCJdXG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIEMuSU5WSVRFOlxuICAgICAgICAgICAgICAgIC8vIElmIHRoZSBuZXcgc2Vzc2lvbiBkZXNjcmlwdGlvbiBpcyBub3QgY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WdlKHVhcykgOiB1YXMuYWNjZXB0KCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBDLk5PVElGWTpcbiAgICAgICAgICAgICAgICAvLyBodHRwczovL3Rvb2xzLmlldGYub3JnL2h0bWwvcmZjMzUxNSNzZWN0aW9uLTIuNC40XG4gICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICBjb25zdCB1YXMgPSBuZXcgTm90aWZ5VXNlckFnZW50U2VydmVyKHRoaXMsIG1lc3NhZ2UpO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmRlbGVnYXRlICYmIHRoaXMuZGVsZWdhdGUub25Ob3RpZnkgPyB0aGlzLmRlbGVnYXRlLm9uTm90aWZ5KHVhcykgOiB1YXMuYWNjZXB0KCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBDLlBSQUNLOlxuICAgICAgICAgICAgICAgIC8vIGh0dHBzOi8vdG9vbHMuaWV0Zi5vcmcvaHRtbC9yZmMzMjYyI3NlY3Rpb24tNFxuICAgICAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgdWFzID0gbmV3IFByYWNrVXNlckFnZW50U2VydmVyKHRoaXMsIG1lc3NhZ2UpO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmRlbGVnYXRlICYmIHRoaXMuZGVsZWdhdGUub25QcmFjayA/IHRoaXMuZGVsZWdhdGUub25QcmFjayh1YXMpIDogdWFzLmFjY2VwdCgpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgQy5SRUZFUjpcbiAgICAgICAgICAgICAgICAvLyBodHRwczovL3Rvb2xzLmlldGYub3JnL2h0bWwvcmZjMzUxNSNzZWN0aW9uLTIuNC4yXG4gICAgICAgICAgICAgICAge1xuICAgICAgICA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cy5fc2lnbmFsaW5nU3RhdGUpIHtcbiAgICAgICAgICAgICAgICBjYXNlIFNpZ25hbGluZ1N0YXRlLkluaXRpYWw6XG4gICAgICAgICAgICAgICAgY2FzZSBTaWduYWxpbmdTdGF0ZS5TdGFibGU6XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuX3NpZ25hbGluZ1N0YXRlID0gU2lnbmFsaW5nU3RhdGUuSGF2ZVJlbW90ZU9mZmVyO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLl9vZmZlciA9IGJvZHk7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuX2Fuc3dlciA9IHVuZGVmaW5lZDtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSBTaWduYWxpbmdTdGF0ZS5IYXZlTG9jYWxPZmZlcjpcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5fc2lnbmFsaW5nU3RhdGUgPSBTaWduYWxpbmdTdGF0ZS5TdGFibGU7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuX2Fuc3dlciA9IGJvZHk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgU2lnbmFsaW5nU3RhdGUuSGF2ZVJlbW90ZU9mZmVyOlxuICAgICAgICAgICAgICAgICAgICAvLyBZb3UgY2Fubm90IG1ha2UgYSBuZXcgb2ZmZXIgd2hpbGUgb25lIGlzIGluIHByb2dyZXNzLlxuICAgICAgICAgICAgICAgICAgICAvLyBodHRwczovL3Rvb2xzLmlldGYub3JnL2h0bWwvcmZjMzI2MSNzZWN0aW9uLTEzLjIuMVxuICAgICAgICAgICAgICAgICAgICAvLyBGSVhNRTogV2hhdCB0byBkbyBoZXJlP1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIFNpZ25hbGluZ1N0YXRlLkNsb3NlZDpcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgIC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ICAgICAgICAvLyBZb3UgY2Fubm90IG1ha2UgYSBuZXcgb2ZmZXIgd2hpbGUgb25lIGlzIGluIHByb2dyZXNzLlxuICAgICAgICAgICAgICAgICAgICAvLyBodHRwczovL3Rvb2xzLmlldGYub3JnL2h0bWwvcmZjMzI2MSNzZWN0aW9uLTEzLjIuMVxuICAgICAgICAgICAgICAgICAgICAvLyBGSVhNRTogV2hhdCB0byBkbyBoZXJlP1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIFNpZ25hbGluZ1N0YXRlLkNsb3NlZDpcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwiVW5leHBlY3RlZCBzaWduYWxpbmcgc3RhdGUuXCIpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIC8vIFdlJ3JlIGluIFVBQyByb2xlLCBzZW5kaW5nIG91dGdvaW5nIHJlcXVlc3Qgd2l0aCBzZXNzaW9uIGRlc2NyaXB0aW9uXG4gICAgICAgIGlmIChtZXNzYWdlIGluc3RhbmNlb2YgT3V0Z29pbmdSZXF1ZXN0TWVzc2FnZSkge1xuICAgICAgICAgICAgc3dpdGNoICh0aGlzLl9zaWduYWxpbmdTdGF0ZSkge1xuICAgICAgICAgICAgICAgIGNhc2UgU2lnbmFsaW5nU3RhdGUuSW5pdGlhbDpcbiAgICAgICAgICAgICAgICBjYXNlIFNpZ25hbGluZ1N0YXRlLlN0YWJsZTpcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5fc2lnbmFsaW5nU3RhdGUgPSBTaWduYWxpbmdTdGF0ZS5IYXZlTG9jYWxPZmZlcjtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5fb2ZmZXIgPSBib2R5O1xuICAgICAgICAgICAgICAgICAgICB0aGlzLl9hbnN3ZXIgPSB1bmRlZmluZWQ7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgU2lnbmFsaW5nU3RhdGUuSGF2ZUxvY2FsT2ZmZXI6XG4gICAgICAgICAgICAgICAgICAgIC8vIFlvdSBjYW5ub3QgbWFrZSBhIG5ldyBvZmZlciB3aGlsZSBvbmUgaXMgaW4gcHJvZ3Jlc3MuXG4gICAgICAgICAgICAgICAgICAgIC8vIGh0dHBzOi8vdG9vbHMuaWV0Zi5vcmcvaHRtbC9yZmMzMjYxI3NlY3Rpb24tMTMuMi4xXG4gICAgICAgICAgICAgICAgICAgIC8vIEZJWE1FOiBXaGF0IHRvIGRvIGhlcmU/XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgU2lnbmFsaW5nU3RhdGUuSGF2ZVJlbW90ZU9mZmVyOlxuICAgICAgICAgICAgICAgICAgICB0aGlzLl9zaWduYWxpbmdTdGF0ZSA9IFNpZ25hbGluZ1N0YXRlLlN0YWJsZTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5fYW5zd2VyID0gYm9keTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSBTaWduYWxpbmdTdGF0ZS5DbG9zZWQ6XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcIlVuZXhwZWN0ZWQgc2lnbmFsaW5nIHN0YXRlLlwiKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICAvLyBXZSdyZSBpbiBVQVMgcm9sZSwgc2VuZGluZyBvdXRnb2luZyByZXNwb25zZSB3aXRoIHNlc3Npb24gZGVzY3JpcHRpb25cbiAgICAgICAgaWYgKGlzQm9keShtZXNzYWdlKSkge1xuICAgICAgICAgICAgc3dpdGNoICh0aGlzLl9zaWduYWx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ICAgICAgICAgaWYgKHRoaXMuZGVsZWdhdGUgJiYgdGhpcy5kZWxlZ2F0ZS5vbkFja1RpbWVvdXQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmRlbGVnYXRlLm9uQWNrVGltZW91dCgpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5ieWUoKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICB0cmFuc2FjdGlvbi5hZGRTdGF0ZUNoYW5nZUxpc3RlbmVyKHN0YXRlQ2hhbmdlZCk7XG4gICAgICAgIH1cbiAgICB9XG4gICAgLy8gRklYTUU6IFJlZmFjdG9yXG4gICAgc3RhcnRSZUludml0ZTJ4eFJldHJhbnNtaXNzaW9uVGltZXIoKSB7XG4gICAgICAgIGlmICh0aGlzLnJlaW52aXRlVXNlckFnZW50U2VydmVyICYmIHRoaXMucmVpbnZpdGVVc2VyQWdlbnRTZXJ2ZXIudHJhbnNhY3Rpb24gaW5zdGFuY2VvZiBJbnZpdGVTZXJ2ZXJUcmFuc2FjdGlvbikge1xuICAgICAgICAgICAgY29uc3QgdHJhbnNhY3Rpb24gPSB0aGlzLnJlaW52aXRlVXNlckFnZW50U2VydmVyLnRyYW5zYWN0aW9uO1xuICAgICAgICAgICAgLy8gT25jZSB0aGUgcmVzcG9uc2UgaGFzIGJlZW4gY29uc3RydWN0ZWQsIGl0IGlzIHBhc3NlZCB0byB0aGUgSU5WSVRFXG4gICAgICAgICAgICAvLyBzZXJ2ZXIgdHJhbnNhY3Rpb24uICBJbiBvcmRlciB0byBlbnN1cmUgcmVsaWFibGUgZW5kLXRvLWVuZFxuICAgICAgICAgICAgLy8gdHJhbnNwb3J0IG9mIHRoZSByZX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JlxuICAgICAgICAgICAgICAgICAgICB0aGlzLnN1YnNjcmlwdGlvblN0YXRlICE9PSBTdWJzY3JpcHRpb25TdGF0ZS5QZW5kaW5nKSB7XG4gICAgICAgICAgICAgICAgICAgIGludmFsaWRTdGF0ZVRyYW5zaXRpb24oKTtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgU3Vic2NyaXB0aW9uU3RhdGUuQWN0aXZlOlxuICAgICAgICAgICAgICAgIGlmICh0aGlzLnN1YnNjcmlwdGlvblN0YXRlICE9PSBTdWJzY3JpcHRpb25TdGF0ZS5Ob3RpZnlXYWl0ICYmXG4gICAgICAgICAgICAgICAgICAgIHRoaXMuc3Vic2NyaXB0aW9uU3RhdGUgIT09IFN1YnNjcmlwdGlvblN0YXRlLlBlbmRpbmcgJiZcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5zdWJzY3JpcHRpb25TdGF0ZSAhPT0gU3Vic2NyaXB0aW9uU3RhdGUuQWN0aXZlKSB7XG4gICAgICAgICAgICAgICAgICAgIGludmFsaWRTdGF0ZVRyYW5zaXRpb24oKTtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgU3Vic2NyaXB0aW9uU3RhdGUuVGVybWluYXRlZDpcbiAgICAgICAgICAgICAgICBpZiAodGhpcy5zdWJzY3JpcHRpb25TdGF0ZSAhPT0gU3Vic2NyaXB0aW9uU3RhdGUuTm90aWZ5V2FpdCAmJlxuICAgICAgICAgICAgICAgICAgICB0aGlzLnN1YnNjcmlwdGlvblN0YXRlICE9PSBTdWJzY3JpcHRpb25TdGF0ZS5QZW5kaW5nICYmXG4gICAgICAgICAgICAgICAgICAgIHRoaXMuc3Vic2NyaXB0aW9uU3RhdGUgIT09IFN1YnNjc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peCA9IFtuZXcgRGF0ZSgpLCBjYXRlZ29yeV07XG4gICAgICAgICAgICBpZiAobGFiZWwpIHtcbiAgICAgICAgICAgICAgICBwcmVmaXgucHVzaChsYWJlbCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBjb250ZW50ID0gcHJlZml4LmNvbmNhdChjb250ZW50KS5qb2luKFwiIHwgXCIpO1xuICAgICAgICB9XG4gICAgICAgIHN3aXRjaCAobGV2ZWxUb0xvZykge1xuICAgICAgICAgICAgY2FzZSBMZXZlbHMuZXJyb3I6XG4gICAgICAgICAgICAgICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIG5vLWNvbnNvbGVcbiAgICAgICAgICAgICAgICBjb25zb2xlLmVycm9yKGNvbnRlbnQpO1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBMZXZlbHMud2FybjpcbiAgICAgICAgICAgICAgICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgbm8tY29uc29sZVxuICAgICAgICAgICAgICAgIGNvbnNvbGUud2Fybihjb250ZW50KTtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgTGV2ZWxzLmxvZzpcbiAgICAgICAgICAgICAgICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgbm8tY29uc29sZVxuICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKGNvbnRlbnQpO1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBMZXZlbHMuZGVidWc6XG4gICAgICAgICAgICAgICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIG5vLWNvbnNvbGVcbiAgICAgICAgICAgICAgICBjb25zb2xlLmRlYnVnKGNvbnRlbnQpO1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgfVxuICAg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gICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGNvbnRlbnQgPSBtZXNzYWdlLmJvZHk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAvLyBGSVhNRTogT3V0Z29pbmdSZXF1ZXN0IHNob3VsZCBub3QgYWxsb3cgdGhlIFwiQ29udGVudC1UeXBlXCIgaGVhZGVyIG5vdCB0byBtYXRjaCB0aCBib2R5IGNvbnRlbnQgdHlwZVxuICAgICAgICAgICAgICAgIGlmIChjb250ZW50VHlwZSAmJiBjb250ZW50VHlwZSAhPT0gbWVzc2FnZS5ib2R5LmNvbnRlbnRUeXBlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcIkhlYWRlciBjb250ZW50IHR5cGUgaGVhZGVyIGRvZXMgbm90IGVxdWFsIGJvZHkgY29udGVudCB0eXBlLlwiKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgY29udGVudFR5cGUgPSBtZXNzYWdlLmJvZHkuY29udGVudFR5cGU7XG4gICAgICAgICAgICAgICAgY29udGVudCA9IG1lc3NhZ2UuYm9keS5ib2R5O1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxuICAgIC8vIFdlJ3JlIGluIFVBUyByb2xlLCBzZW5kaW5nIG91dGdvaW5nIHJlc3BvbnNlXG4gICAgaWYgKGlzQm9keShtZXNzYWdlKSkge1xuICAgICAgICBjb250ZW50RGlzcG9zaXRpb24gPSBtZXNzYWdlLmNvbnRlbnREaXNwb3NpdGlvbjtcbiAgICAgICAgY29udGVudFR5cGUgPSBtZXNzYWdlLmNvbnRlbnRUeXBlO1xuICAgICAgICBjb250ZW50ID0gbWVzc2FnZS5jb250ZW50O1xuICAgIH1cbiAgICAvLyBObyBjb250ZW50LCBubyBib2R5LlxuICAgIGlmICghY29udGVudCkge1xuICAgICAgICByZXR1cm4gdW5kZWZpbmVkO1xuICAgIH1cbiAgICB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AgICAgICAgaWYgKGNoYWxsZW5nZS5xb3AuaW5kZXhPZihcImF1dGhcIikgPiAtMSkge1xuICAgICAgICAgICAgICAgIHRoaXMucW9wID0gXCJhdXRoXCI7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIGlmIChjaGFsbGVuZ2UucW9wLmluZGV4T2YoXCJhdXRoLWludFwiKSA+IC0xKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5xb3AgPSBcImF1dGgtaW50XCI7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAvLyBPdGhlcndpc2UgJ3FvcCcgaXMgcHJlc2VudCBidXQgZG9lcyBub3QgY29udGFpbiAnYXV0aCcgb3IgJ2F1dGgtaW50Jywgc28gYWJvcnQgaGVyZS5cbiAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci53YXJuKFwiY2hhbGxlbmdlIHdpdGhvdXQgRGlnZXN0IHFvcCBkaWZmZXJlbnQgdGhhbiAnYXV0aCcgb3IgJ2F1dGgtaW50JywgYXV0aGVudGljYXRpb24gYWJvcnRlZFwiKTtcbiAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICB0aGlzLnFvcCA9IHVuZGVmaW5lZDtcbiAgICAgICAgfVxuICAgICAgICAvLyBGaWxsIG90aGVyIGF0dHJpYnV0ZXMuXG4gICAgICAgIHRoaXMubWV0aG9kID0gcmVxdWVzdC5tZXRob2Q7XG4gICAgICAgIHRoaXMudXJpID0gcmVxdWVzdC5ydXJpO1xuICAgICAgICB0aGlzLmNub25jZSA9IGNyZWF0ZVJhbmRvbVRva2VuKDEyKTtcbiAgICAgICAgdGhpcy5uYyArPSAxO1xuICAgICAgICB0aGlzLnVwZGF0ZU5jSGV4KCk7XG4gICAgICAgIC8vIG5jLXZhbHVlID0gOExIRVguIE1heCB2YWx1ZSA9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gfVxuICAgIHN0YXRpYyBfaGV4KHgpIHtcbiAgICAgICAgY29uc3QgaGMgPSBNZDUuaGV4Q2hhcnM7XG4gICAgICAgIGNvbnN0IGhvID0gTWQ1LmhleE91dDtcbiAgICAgICAgbGV0IG47XG4gICAgICAgIGxldCBvZmZzZXQ7XG4gICAgICAgIGxldCBqO1xuICAgICAgICBsZXQgaTtcbiAgICAgICAgZm9yIChpID0gMDsgaSA8IDQ7IGkgKz0gMSkge1xuICAgICAgICAgICAgb2Zmc2V0ID0gaSAqIDg7XG4gICAgICAgICAgICBuID0geFtpXTtcbiAgICAgICAgICAgIGZvciAoaiA9IDA7IGogPCA4OyBqICs9IDIpIHtcbiAgICAgICAgICAgICAgICBob1tvZmZzZXQgKyAxICsgal0gPSBoYy5jaGFyQXQobiAmIDB4MEYpO1xuICAgICAgICAgICAgICAgIG4gPj4+PSA0O1xuICAgICAgICAgICAgICAgIGhvW29mZnNldCArIDAgKyBqXSA9IGhjLmNoYXJBdChuICYgMHgwRik7XG4gICAgICAgICAgICAgICAgbiA+Pj49IDQ7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIGhvLmpvaW4oJycpO1xuICAgIH1cbiAgICBzdGF0aWMgX21kNWN5Y2xlKHgsIGspIHtcbiAgICAgICAgbGV0IGEgPSB4WzBdO1xuICAgICAgICBsZXQgYiA9IHhbMV07XG4gICAgICAgIGxldCBjID0geFsyXTtcbiAgICAgICAgbGV0IGQgPSB4WzNdO1xuICAgICAgICAvLyBmZigpXG4gICAgICAgIGEgKz0gKGIgJiBjIHwgfmIgJiBkKSArIGtbMF0gLSA2ODA4NzY5MzYgfCAwO1xuICAgICAgICBhID0gKGEgPDwgNyB8IGEgPj4+IDI1KSArIGIgfCAwO1xuICAgICAgICBkICs9IChhICYgYiB8IH5hICYgYykgKyBrWzFdIC0gMzg5NTY0NTg2IHwgMDtcbiAgICAgICAgZCA9IChkIDw8IDEyIHwgZCA+Pj4gMjApICsgYS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VfZWFybGllcl9pbl90aGVfc3RyaW5nX2lzX3Vua25vd25cbiAgICBhcHBlbmRTdHIoc3RyKSB7XG4gICAgICAgIGNvbnN0IGJ1ZjggPSB0aGlzLl9idWZmZXI4O1xuICAgICAgICBjb25zdCBidWYzMiA9IHRoaXMuX2J1ZmZlcjMyO1xuICAgICAgICBsZXQgYnVmTGVuID0gdGhpcy5fYnVmZmVyTGVuZ3RoO1xuICAgICAgICBsZXQgY29kZTtcbiAgICAgICAgbGV0IGk7XG4gICAgICAgIGZvciAoaSA9IDA7IGkgPCBzdHIubGVuZ3RoOyBpICs9IDEpIHtcbiAgICAgICAgICAgIGNvZGUgPSBzdHIuY2hhckNvZGVBdChpKTtcbiAgICAgICAgICAgIGlmIChjb2RlIDwgMTI4KSB7XG4gICAgICAgICAgICAgICAgYnVmOFtidWZMZW4rK10gPSBjb2RlO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSBpZiAoY29kZSA8IDB4ODAwKSB7XG4gICAgICAgICAgICAgICAgYnVmOFtidWZMZW4rK10gPSAoY29kZSA+Pj4gNikgKyAweEMwO1xuICAgICAgICAgICAgICAgIGJ1ZjhbYnVmTGVuKytdID0gY29kZSAmIDB4M0YgfCAweDgwO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSBpZiAoY29kZSA8IDB4RDgwMCB8fCBjb2RlID4gMHhEQkZGKSB7XG4gICAgICAgICAgICAgICAgYnVmOFtidWZMZW4rK10gPSAoY29kZSA+Pj4gMTIpICsgMHhFMDtcbiAgICAgICAgICAgICAgICBidWY4W2J1ZkxlbisrXSA9IChjb2RlID4+PiA2ICYgMHgzRikgfCAweDgwO1xuICAgICAgICAgICAgICAgIGJ1ZjhbYnVmTGVuKytdID0gKGNvZGUgJiAweDNGKSB8IDB4ODA7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICBjb2RlID0gKChjb2RlIC0gMHhEODAwKSAqIDB4NDAwKSArIChzdHIuY2hhckNvZGVBdCgrK2kpIC0gMHhEQzAwKSArIDB4MTAwMDA7XG4gICAgICAgICAgICAgICAgaWYgKGNvZGUgPiAweDEwRkZGRikge1xuICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ1VuaWNvZGUgc3RhbmRhcmQgc3VwcG9ydHMgY29kZSBwb2ludHMgdXAgdG8gVSsxMEZGRkYnKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgYnVmOFtidWZMZW4rK10gPSAoY29kZSA+Pj4gMTgpICsgMHhGMDtcbiAgICAgICAgICAgICAgICBidWY4W2J1ZkxlbisrXSA9IChjb2RlID4+PiAxMiAmIDB4M0YpIHwgMHg4MDtcbiAgICAgICAgICAgICAgICBidWY4W2J1ZkxlbisrXSA9IChjb2RlID4+PiA2ICYgMHgzRikgfCAweDgwO1xuICAgICAgICAgICAgICAgIGJ1ZjhbYnVmTGVuKytdID0gKGNvZGUgJiAweDNGKSB8IDB4ODA7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoYnVmTGVuID49IDY0KSB7XG4gICAgICAgICAgICAgICAgdGhpcy5fZGF0YUxlbmd0aCArPSA2NDtcbiAgICAgICAgICAgICAgICBNZDUuX21kNWN5Y2xlKHRoaXMuX3N0YXRlLCBidWYzMik7XG4gICAgICAgICAgICAgICAgYnVmTGVuIC09IDY0O1xuICAgICAgICAgICAgICAgIGJ1ZjMyWzBdID0gYnVmMzJbMTZdO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHRoaXMuX2J1ZmZlckxlbmd0aCA9IGJ1ZkxlbjtcbiAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgfVxuICAgIGFwcGVuZEFzY2lpU3RyKHN0cikge1xuICAgICAgICBjb25zdCBidWY4ID0gdGhpcy5fYnVmZmVyODtcbiAgICAgICAgY29uc3QgYnVmMzIgPSB0aGlzLl9idWZmZXIzMjtcbiAgICAgICAgbGV0IGJ1ZkxlbiA9IHRoaXMuX2J1ZmZlckxlbmd0aDtcbiAgICAgICAgbGV0IGk7XG4gICAgICAgIGxldCBqID0gMDtcbiAgICAgICAgZm9yICg7Oykge1xuICAgICAgICAgICAgaSA9IE1hdGgubWluKHN0ci5sZW5ndGggLSBqLCA2NCAtIGJ1Zkxlbik7XG4gICAgICAgICAgICB3aGlsZSAoaS0tKSB7XG4gICAgICAgICAgICAgICAgYnVmOFtidWZMZW4rK10gPSBzdHIuY2hhckNvZGVBdChqKyspO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKGJ1ZkxlbiA8IDY0KSB7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB0aGlzLl9kYXRhTGVuZ3RoICs9IDY0O1xuICAgICAgICAgICAgTWQ1Ll9tZDVjeWNsZSh0aGlzLl9zdGF0ZSwgYnVmMzIpO1xuICAgICAgICAgICAgYnVmTGVuID0gMDtcbiAgICAgICAgfVxuICAgICAgICB0aGlzLl9idWZmZXJMZW5ndGggPSBidWZMZW47XG4gICAgICAgIHJldHVybiB0aGlzO1xuICAgIH1cbiAgICBhcHBlbmRCeXRlQXJyYXkoaW5wdXQpIHtcbiAgICAgICAgY29uc3QgYnVmOCA9IHRoaXMuX2J1ZmZlcjg7XG4gICAgICAgIGNvbnN0IGJ1ZjMyID0gdGhpcy5fYnVmZmVyMzI7XG4gICAgICAgIGxldCBidWZMZW4gPSB0aGlzLl9idWZmZXJMZW5ndGg7XG4gICAgICAgIGxldCBpO1xuICAgICAgICBsZXQgaiA9IDA7XG4gICAgICAgIGZvciAoOzspIHtcbiAgICAgICAgICAgIGkgPSBNYXRoLm1pbihpbnB1dC5sZW5ndGggLSBqLCA2NCAtIGJ1Zkxlbik7XG4gICAgICAgICAgICB3aGlsZSAoaS0tKSB7XG4gICAgICAgICAgICAgICAgYnVmOFtidWZMZW4rK10gPSBpbnB1dFtqKytdO1xuICAgICAgICAgICA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2VxXCIsIHRoaXMuY3NlcSArIFwiIFwiICsgdGhpcy5tZXRob2QpO1xuICAgICAgICB0aGlzLnNldEhlYWRlcihcImNhbGwtaWRcIiwgdGhpcy5jYWxsSWQpO1xuICAgICAgICB0aGlzLnNldEhlYWRlcihcIm1heC1mb3J3YXJkc1wiLCBcIjcwXCIpO1xuICAgIH1cbiAgICAvKiogR2V0IGEgY29weSBvZiB0aGUgZGVmYXVsdCBvcHRpb25zLiAqL1xuICAgIHN0YXRpYyBnZXREZWZhdWx0T3B0aW9ucygpIHtcbiAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgIGNhbGxJZDogXCJcIixcbiAgICAgICAgICAgIGNhbGxJZFByZWZpeDogXCJcIixcbiAgICAgICAgICAgIGNzZXE6IDEsXG4gICAgICAgICAgICB0b0Rpc3BsYXlOYW1lOiBcIlwiLFxuICAgICAgICAgICAgdG9UYWc6IFwiXCIsXG4gICAgICAgICAgICBmcm9tRGlzcGxheU5hbWU6IFwiXCIsXG4gICAgICAgICAgICBmcm9tVGFnOiBcIlwiLFxuICAgICAgICAgICAgZm9yY2VScG9ydDogZmFsc2UsXG4gICAgICAgICAgICBoYWNrVmlhVGNwOiBmYWxzZSxcbiAgICAgICAgICAgIG9wdGlvblRhZ3M6IFtcIm91dGJvdW5kXCJdLFxuICAgICAgICAgICAgcm91dGVTZXQ6IFtdLFxuICAgICAgICAgICAgdXNlckFnZW50U3RyaW5nOiBcInNpcC5qc1wiLFxuICAgICAgICAgICAgdmlhSG9zdDogXCJcIlxuICAgICAgICB9O1xuICAgIH1cbiAgICBzdGF0aWMgbWFrZU5hbWVBZGRySGVhZGVyKHVyaSwgZGlzcGxheU5hbWUsIHRhZykge1xuICAgICAgICBjb25zdCBwYXJhbWV0ZXJzID0ge307XG4gICAgICAgIGlmICh0YWcpIHtcbiAgICAgICAgICAgIHBhcmFtZXRlcnMudGFnID0gdGFnO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBuZXcgTmFtZUFkZ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xcclxcblwiO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBmb3IgKGNvbnN0IGhlYWRlciBvZiB0aGlzLmV4dHJhSGVhZGVycykge1xuICAgICAgICAgICAgbXNnICs9IGhlYWRlci50cmltKCkgKyBcIlxcclxcblwiO1xuICAgICAgICB9XG4gICAgICAgIG1zZyArPSBcIlN1cHBvcnRlZDogXCIgKyB0aGlzLm9wdGlvbnMub3B0aW9uVGFncy5qb2luKFwiLCBcIikgKyBcIlxcclxcblwiO1xuICAgICAgICBtc2cgKz0gXCJVc2VyLUFnZW50OiBcIiArIHRoaXMub3B0aW9ucy51c2VyQWdlbnRTdHJpbmcgKyBcIlxcclxcblwiO1xuICAgICAgICBpZiAodGhpcy5ib2R5KSB7XG4gICAgICAgICAgICBpZiAodHlwZW9mIHRoaXMuYm9keSA9PT0gXCJzdHJpbmdcIikge1xuICAgICAgICAgICAgICAgIG1zZyArPSBcIkNvbnRlbnQtTGVuZ3RoOiBcIiArIHV0ZjhMZW5ndGgodGhpcy5ib2R5KSArIFwiXFxyXFxuXFxyXFxuXCI7XG4gICAgICAgICAgICAgICAgbXNnICs9IHRoaXMuYm9keTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgIGlmICh0aGlzLmJvZHkuYm9keSAmJiB0aGlzLmJvZHkuY29udGVudFR5cGUpIHtcbiAgICAgICAgICAgICAgICAgICAgbXNnICs9IFwiQ29udGVudC1UeXBlOiBcIiArIHRoaXMuYm9keS5jb250ZW50VHlwZSArIFwiXFxyXFxuXCI7XG4gICAgICAgICAgICAgICAgICAgIG1zZyArPSBcIkNvbnRlbnQtTGVuZ3RoOiBcIiArIHV0ZjhMZW5ndGgodGhpcy5ib2R5LmJvZHkpICsgXCJcXHJcXG5cXHJcXG5cIjtcbiAgICAgICAgICAgICAgICAgICAgbXNnICs9IHRoaXMuYm9keS5ib2R5O1xuICAgICA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ICAgICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIEB0eXBlc2NyaXB0LWVzbGludC9uby1leHBsaWNpdC1hbnlcbiAgICAgICAgbGV0IHBhcnNlZDtcbiAgICAgICAgLy8gSWYgaGVhZGVyLWZpZWxkIGlzIHdlbGwta25vd24sIHBhcnNlIGl0LlxuICAgICAgICBzd2l0Y2ggKGhlYWRlck5hbWUudG9Mb3dlckNhc2UoKSkge1xuICAgICAgICAgICAgY2FzZSBcInZpYVwiOlxuICAgICAgICAgICAgY2FzZSBcInZcIjpcbiAgICAgICAgICAgICAgICBtZXNzYWdlLmFkZEhlYWRlcihcInZpYVwiLCBoZWFkZXJWYWx1ZSk7XG4gICAgICAgICAgICAgICAgaWYgKG1lc3NhZ2UuZ2V0SGVhZGVycyhcInZpYVwiKS5sZW5ndGggPT09IDEpIHtcbiAgICAgICAgICAgICAgICAgICAgcGFyc2VkID0gbWVzc2FnZS5wYXJzZUhlYWRlcihcIlZpYVwiKTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHBhcnNlZCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS52aWEgPSBwYXJzZWQ7XG4gICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnZpYUJyYW5jaCA9IHBhcnNlZC5icmFuY2g7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHBhcnNlZCA9IDA7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBcImZyb21cIjpcbiAgICAgICAgICAgIGNhc2UgXCJmXCI6XG4gICAgICAgICAgICAgICAgbWVzc2FnZS5zZXRIZWFkZXIoXCJmcm9tXCIsIGhlYWRlclZhbHVlKTtcbiAgICAgICAgICAgICAgICBwYXJzZWQgPSBtZXNzYWdlLnBhcnNlSGVhZGVyKFwiZnJvbVwiKTtcbiAgICAgICAgICAgICAgICBpZiAocGFyc2VkKSB7XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZnJvbSA9IHBhcnNlZDtcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5mcm9tVGFnID0gcGFyc2VkLmdldFBhcmFtKFwidGFnXCIpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgXCJ0b1wiOlxuICAgICAgICAgICAgY2FzZSBcInRcIjpcbiAgICAgICAgICAgICAgICBtZXNzYWdlLnNldEhlYWRlcihcInRvXCIsIGhlYWRlclZhbHVlKTtcbiAgICAgICAgICAgICAgICBwYXJzZWQgPSBtZXNzYWdlLnBhcnNlSGVhZGVyKFwidG9cIik7XG4gICAgICAgICAgICAgICAgaWYgKHBhcnNlZCkge1xuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRvID0gcGFyc2VkO1xuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRvVGFnID0gcGFyc2VkLmdldFBhcmFtKFwidGFnXCIpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgXCJyZWNvcmQtcm91dGVcIjpcbiAgICAgICAgICAgICAgICBwYXJzZWQgPSBHcmFtbWFyLnBhcnNlKGhlYWRlclZhbHVlLCBcIlJlY29yZF9Sb3V0ZVwiKTtcbiAgICAgICAgICAgICAgICBpZiAocGFyc2VkID09PSAtMSkge1xuICAgICAgICAgICAgICAgICAgICBwYXJzZWQgPSB1bmRlZmluZWQ7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAoIShwYXJzZWQgaW5zdGFuY2VvZiBBcnJheSkpIHtcbiAgICAgICAgICAgICAgICAgICAgcGFyc2VkID0gdW5kZWZpbmVkO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgcGFyc2VkLmZvckVhY2goKGhlYWRlcikgPT4ge1xuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmFkZEhlYWRlcihcInJlY29yZC1yb3V0ZVwiLCBoZWFkZXJWYWx1ZS5zdWJzdHJpbmcoaGVhZGVyLnBvc2l0aW9uLCBoZWFkZXIub2Zmc2V0KSk7XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuaGVhZGVyc1tcIlJlY29yZC1Sb3V0ZVwiXVttZXNzYWdlLmdldEhlYWRlcnMoXCJyZWNvcmQtcm91dGVcIikubGVuZ3RoIC0gMV0ucGFyc2VkID0gaGVhZGVyLnBhcnNlZDtcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgXCJjYWxsLWlkXCI6XG4gICAgICAgICAgICBjYXNlIFwiaVwiOlxuICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc2V0SGVhZGVyKFwiY2FsbC1pZFwiLCBoZWFkZXJWYWx1ZSk7XG4gICAgICAgICAgICAgICAgcGFyc2VkID0gbWVzc2FnZS5wYXJzZUhlYWRlcihcImNhbGwtaWRcIik7XG4gICAgICAgICAgICAgICAgaWYgKHBhcnNlZCkge1xuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmNhbGxJZCA9IGhlYWRlclZhbHVlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgXCJjb250YWN0XCI6XG4gICAgICAgICAgICBjYXNlIFwibVwiOlxuICAgICAgICAgICAgICAgIHBhcnNlZCA9IEdyYW1tYXIucGFyc2UoaGVhZGVyVmFsdWUsIFwiQ29udGFjdFwiKTtcbiAgICAgICAgICAgICAgICBpZiAocGFyc2VkID09PSAtMSkge1xuICAgICAgICAgICAgICAgICAgICBwYXJzZWQgPSB1bmRlZmluZWQ7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAoIShwYXJzZWQgaW5zdGFuY2VvZiBBcnJheSkpIHtcbiAgICAgICAgICAgICAgICAgICAgcGFyc2VkID0gdW5kZWZpbmVkO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgcGFyc2VkLmZvckVhY2goKGhlYWRlcikgPT4ge1xuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmFkZEhlYWRlcihcImNvbnRhY3RcIiwgaGVhZGVyVmFsdWUuc3Vic3RyaW5nKGhlYWRlci5wb3NpdGlvbiwgaGVhZGVyLm9mZnNldCkpO1xuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmhlYWRlcnMuQ29udGFjdFttZXNzYWdlLmdldEhlYWRlcnMoXCJjb250YWN0XCIpLmxlbmd0aCAtIDFdLnBhcnNlZCA9IGhlYWRlci5wYXJzZWQ7XG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIFwiY29udGVudC1sZW5ndGhcIjpcbiAgICAgICAgICAgIGNhc2UgXCJsXCI6XG4gICAgICAgICAgICAgICAgbWVzc2FnZS5zZXRIZWFkZXIoXCJjb250ZW50LWxlbmd0aFwiLCBoZWFkZXJWYWx1ZSk7XG4gICAgICAgICAgICAgICAgcGFyc2VkID0gbWVzc2FnZS5wYXJzZUhlYWRlcihcImNvbnRlbnQtbGVuZ3RoXCIpO1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBcImNvbnRlbnQtdHlwZVwiOlxuICAgICAgICAgICAgY2FzZSBcImNcIjpcbiAgICAgICAgICAgICAgICBtZXNzYWdlLnNldEhlYWRlcihcImNvbnRlbnQtdHlwZVwiLCBoZWFkZXJWYWx1ZSk7XG4gICAgICAgICAgICAgICAgcGFyc2VkID0gbWVzc2FnZS5wYXJzZUhlYWRlcihcImNvbnRlbnQtdHlwZVwiKTtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgXCJjc2VxXCI6XG4gICAgICAgICAgICAgICAgbWVzc2FnZS5zZXRIZWFkZXIoXCJjc2VxXCIsIGhlYWRlclZhbHVlKTtcbiAgICAgICAgICAgICAgICBwYXJzZWQgPSBtZXNzYWdlLnBhcnNlSGVhZGVyKFwiY3NlcVwiKTtcbiAgICAgICAgICAgICAgICBpZiAocGFyc2VkKSB7XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY3NlcSA9IHBhcnNlZC52YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKG1lc3NhZ2UgaW5zdGFuY2VvZiBJbmNvbWluZ1Jlc3BvbnNlTWVzc2FnZSkge1xuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1ldGhvZCA9IHBhcnNlZC5tZXRob2Q7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBcIm1heC1mb3J3YXJkc1wiOlxuICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc2V0SGVhZGVyKFwibWF4LWZvcndhcmRzXCIsIGhlYWRlclZhbHVlKTtcbiAgICAgICAgICAgICAgICBwYXJzZWQgPSBtZXNzYWdlLnBhcnNlSGVhZGVyKFwibWF4LWZvcndhcmRzXCIpO1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBcInd3dy1hdXRoZW50aWNhdGVcIjpcbiAgICAgICAgICAgICAgICBtZXNzYWdlLnNldEhlYWRlcihcInd3dy1hdXRoZW50aWNhdGVcIiwgaGVhZGVyVmFsdWUpO1xuICAgICAgICAgICAgICAgIHBhcnNlZCA9IG1lc3NhZ2UucGFyc2VIZWFkZXIoXCJ3d3ctYXV0aGVudGljYXRlXCIpO1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBcInByb3h5LWF1dGhlbnRpY2F0ZVwiOlxuICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc2V0SGVhZGVyKFwicHJveHktYXV0aGVudGljYXRlXCIsIGhlYWRlclZhbHVlKTtcbiAgICAgICAgICAgICAgICBwYXJzZWQgPSBtZXNzYWdlLnBhcnNlSGVhZGVyKFwicHJveHktYXV0aGVudGljYXRlXCIpO1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBcInJlZmVyLXRvXCI6XG4gICAgICAgICAgICBjYXNlIFwiclwiOlxuICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc2V0SGVhZGVyKFwicmVmZXItdG9cIiwgaGVhZGVyVmFsdWUpO1xuICAgICAgICAgICAgICAgIHBhcnNlZCA9IG1lc3NhZ2UucGFyc2VIZWFkZXIoXCJyZWZlci10b1wiKTtcbiAgICAgICAgICAgICAgICBpZiAocGFyc2VkKSB7XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucmVmZXJUbyA9IHBhcnNlZDtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgIC8vIERvIG5vdCBwYXJzZSB0aGlzIGhlYWRlci5cbiAgICAgICAgICAgICAgICBtZXNzYWdlLmFkZEhlYWRlcihoZWFkZXJOYW1lLnRvTG93ZXJDYXNlKCksIGhlYWRlclZhbHVlKTtcbiAgICAgICAgICAgICAgICBwYXJzZWQgPSAwO1xuICAgICAgICB9XG4gICAgICAgIGlmIChwYXJzZWQgPT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICBlcnJvcjogXCJlcnJvciBwYXJzaW5nIGhlYWRlciAnXCIgKyBoZWFkZXJOYW1lICsgXCIn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wgZXZlbiBpZiB0aGUgdHJhbnNwb3J0IGlzXG4gICAgICAgICAgICAgICAgLy8gcmVsaWFibGUgKGd1aWRlbGluZXMgZm9yIGNvbnN0cnVjdGluZyB0aGUgQUNLIGZyb20gdGhlIHJlc3BvbnNlXG4gICAgICAgICAgICAgICAgLy8gYXJlIGdpdmVuIGluIFNlY3Rpb24gMTcuMS4xLjMpLCBhbmQgdGhlbiBwYXNzIHRoZSBBQ0sgdG8gdGhlXG4gICAgICAgICAgICAgICAgLy8gdHJhbnNwb3J0IGxheWVyIGZvciB0cmFuc21pc3Npb24uIFRoZSBBQ0sgTVVTVCBiZSBzZW50IHRvIHRoZVxuICAgICAgICAgICAgICAgIC8vIHNhbWUgYWRkcmVzcywgcG9ydCwgYW5kIHRyYW5zcG9ydCB0byB3aGljaCB0aGUgb3JpZ2luYWwgcmVxdWVzdCB3YXMgc2VudC5cbiAgICAgICAgICAgICAgICAvLyBodHRwczovL3Rvb2xzLmlldGYub3JnL2h0bWwvcmZjNjAyNiNzZWN0aW9uLTguNFxuICAgICAgICAgICAgICAgIGlmIChzdGF0dXNDb2RlID49IDMwMCAmJiBzdGF0dXNDb2RlIDw9IDY5OSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnN0YXRlVHJhbnNpdGlvbihUcmFuc2FjdGlvblN0YXRlLkNvbXBsZXRlZCk7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuYWNrKHJlc3BvbnNlKTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMudXNlci5yZWNlaXZlUmVzcG9uc2UpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMudXNlci5yZWNlaXZlUmVzcG9uc2UocmVzcG9uc2UpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIFRyYW5zYWN0aW9uU3R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gICAgIGlmICghdGhpcy5hY2tSZXRyYW5zbWlzc2lvbkNhY2hlLmhhcyhyZXNwb25zZS50b1RhZykpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuYWNrUmV0cmFuc21pc3Npb25DYWNoZS5zZXQocmVzcG9uc2UudG9UYWcsIHVuZGVmaW5lZCk7IC8vIFByaW1lIHRoZSBBQ0sgY2FjaGVcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLnVzZXIucmVjZWl2ZVJlc3BvbnNlKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy51c2VyLnJlY2VpdmVSZXNwb25zZShyZXNwb25zZSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgLy8gSWYgd2UgaGF2ZSBhIGNhY2hlIGhpdCwgdHJ5IHB1bGxpbmcgdGhlIEFDSyBmcm9tIGNhY2hlIGFuZCByZXRyYW5zbWl0dGluZyBpdC5cbiAgICAgICAgICAgICAgICAgICAgY29uc3QgYWNrID0gdGhpcy5hY2tSZXRyYW5zbWlzc2lvbkNhY2hlLmdldChyZXNwb25zZS50b1RhZyk7XG4gICAgICAgICAgICAgICAgICAgIGlmIChhY2spIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc2VuZChhY2sudG9TdHJpbmcoKSkuY2F0Y2goKGVycm9yKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2dUcmFuc3BvcnRFcnJvcihlcnJvciwgXCJGYWlsZWQgdG8gc2VuZCByZXRyYW5zbWlzc2lvbiBvZiBBQ0sgdG8gMnh4IHJlc3BvbnNlLlwiKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgICAgICB9XG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G4gICAgICAgIGNvbnN0IHJvdXRlID0gdGhpcy5yZXF1ZXN0LmdldEhlYWRlcihcInJvdXRlXCIpO1xuICAgICAgICBpZiAoIWZyb20pIHtcbiAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcIkZyb20gdW5kZWZpbmVkLlwiKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoIXRvKSB7XG4gICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJUbyB1bmRlZmluZWQuXCIpO1xuICAgICAgICB9XG4gICAgICAgIGlmICghdmlhKSB7XG4gICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJWaWEgdW5kZWZpbmVkLlwiKTtcbiAgICAgICAgfVxuICAgICAgICBsZXQgYWNrID0gYEFDSyAke3J1cml9IFNJUC8yLjBcXHJcXG5gO1xuICAgICAgICBpZiAocm91dGUpIHtcbiAgICAgICAgICAgIGFjayArPSBgUm91dGU6ICR7cm91dGV9XFxyXFxuYDtcbiAgICAgICAgfVxuICAgICAgICBhY2sgKz0gYFZpYTogJHt2aWF9XFxyXFxuYDtcbiAgICAgICAgYWNrICs9IGBUbzogJHt0b31cXHJcXG5gO1xuICAgICAgICBhY2sgKz0gYEZyb206ICR7ZnJvbX1cXHJcXG5gO1xuICAgICAgICBhY2sgKz0gYENhbGwtSUQ6ICR7Y2FsbElkfVxcclxcbmA7XG4gICAgICAgIGFjayArPSBgQ1NlcTogJHtjc2VxfSBBQ0tcXHJcXG5gO1xuICAgICAgICBhY2sgKz0gYE1heC1Gb3J3YXJkczogNzBcXHJcXG5gO1xuICAgICAgICBhY2sgKz0gYENvbnRlbnQtTGVuZ3RoOiAwXFxyXFxuXFxyXFxuYDtcbiAgICAgICAgLy8gVE9PTzogXCJVc2VyLUFnZW50XCIgaGVhZGVyXG4gICAgICAgIHRoaXMuc2VuZChhY2spLmNhdGNoKChlcnJvcikgPT4ge1xuICAgICAgICAgICAgdGhpcy5sb2dUcmFuc3BvcnRFcnJvcihlcnJvciwg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zZSBUcmFuc2FjdGlvblN0YXRlLkNvbXBsZXRlZDpcbiAgICAgICAgICAgICAgICBpZiAodGhpcy5zdGF0ZSAhPT0gVHJhbnNhY3Rpb25TdGF0ZS5DYWxsaW5nICYmIHRoaXMuc3RhdGUgIT09IFRyYW5zYWN0aW9uU3RhdGUuUHJvY2VlZGluZykge1xuICAgICAgICAgICAgICAgICAgICBpbnZhbGlkU3RhdGVUcmFuc2l0aW9uKCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBUcmFuc2FjdGlvblN0YXRlLlRlcm1pbmF0ZWQ6XG4gICAgICAgICAgICAgICAgaWYgKHRoaXMuc3RhdGUgIT09IFRyYW5zYWN0aW9uU3RhdGUuQ2FsbGluZyAmJlxuICAgICAgICAgICAgICAgICAgICB0aGlzLnN0YXRlICE9PSBUcmFuc2FjdGlvblN0YXRlLkFjY2VwdGVkICYmXG4gICAgICAgICAgICAgICAgICAgIHRoaXMuc3RhdGUgIT09IFRyYW5zYWN0aW9uU3RhdGUuQ29tcGxldGVkKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmICghZHVlVG9UcmFuc3BvcnRFcnJvcikge1xuICAgICAgICAgICAgICAgICAgICAgICAgaW52YWxpZFN0YXRlVHJhbnNpdGlvbigpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICBpbnZhbGlkU3RhdGVUcmFuc2l0aW9uKCk7XG4gICAgICAgIH1cbiAgICAgICAgLy8gV2hpbGUgbm90IHNwZWxsZWQgb3V0IGluIHRoZSBSRkMsIFRpbWVyIEIgaXMgdGhlIG1heGltdW0gYW1vdW50IG9mIHRpbWUgdGhhdCBhIHNlbmRlclxuICAgICAgICAvLyB3aWxsIHdhaXQgZm9yIGFuIElOVklURSBtZXNzYWd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QpIHtcbiAgICAgICAgc3dpdGNoICh0aGlzLnN0YXRlKSB7XG4gICAgICAgICAgICBjYXNlIFRyYW5zYWN0aW9uU3RhdGUuUHJvY2VlZGluZzpcbiAgICAgICAgICAgICAgICAvLyBJZiBhIHJlcXVlc3QgcmV0cmFuc21pc3Npb24gaXMgcmVjZWl2ZWQgd2hpbGUgaW4gdGhlIFwiUHJvY2VlZGluZ1wiIHN0YXRlLCB0aGUgbW9zdFxuICAgICAgICAgICAgICAgIC8vIHJlY2VudCBwcm92aXNpb25hbCByZXNwb25zZSB0aGF0IHdhcyByZWNlaXZlZCBmcm9tIHRoZSBUVSBNVVNUIGJlIHBhc3NlZCB0byB0aGVcbiAgICAgICAgICAgICAgICAvLyB0cmFuc3BvcnQgbGF5ZXIgZm9yIHJldHJhbnNtaXNzaW9uLlxuICAgICAgICAgICAgICAgIC8vIGh0dHBzOi8vdG9vbHMuaWV0Zi5vcmcvaHRtbC9yZmMzMjYxI3NlY3Rpb24tMTcuMi4xXG4gICAgICAgICAgICAgICAgaWYgKHJlcXVlc3QubWV0aG9kID09PSBDLklOVklURSkge1xuICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5sYXN0UHJvdmlzaW9uYWxSZXNwb25zZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5zZW5kKHRoaXMubGFzdFByb3Zpc2lvbmFsUmVzcG9uc2UpLmNhdGNoKChlcnJvcikgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMubG9nVHJhbnNwb3J0RXJyb3IoZXJyb3IsIFwiRmFpbGVkIHRvIHNlbmQgcmV0cmFuc21pc3Npb24gb2YgcHJvdmlzaW9uYWwgcmVzcG9uc2UuXCIpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBicmVhaztcbi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Lm9yZy9odG1sL3JmYzMyNjEjc2VjdGlvbi0xNy4yLjFcbiAgICAgICAgICAgICAgICBpZiAocmVxdWVzdC5tZXRob2QgPT09IEMuSU5WSVRFKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmICghdGhpcy5sYXN0RmluYWxSZXNwb25zZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwiTGFzdCBmaW5hbCByZXNwb25zZSB1bmRlZmluZWQuXCIpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuc2VuZCh0aGlzLmxhc3RGaW5hbFJlc3BvbnNlKS5jYXRjaCgoZXJyb3IpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMubG9nVHJhbnNwb3J0RXJyb3IoZXJyb3IsIFwiRmFpbGVkIHRvIHNlbmQgcmV0cmFuc21pc3Npb24gb2YgZmluYWwgcmVzcG9uc2UuXCIpO1xuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAvLyBJZiBhbiBBQ0sgaXMgcmVjZWl2ZWQgd2hpbGUgdGhlIHNlcnZlciB0cmFuc2FjdGlvbiBpcyBpbiB0aGUgXCJDb21wbGV0ZWRcIiBzdGF0ZSxcbiAgICAgICAgICAgICAgICAvLyB0aGUgc2VydmVyIHRyYW5zYWN0aW9uIE1VU1QgdHJhbnNpdGlvbiB0byB0aGUgXCJDb25maXJtZWRcIiBzdGF0ZS5cbiAgICAgICAgICAgICAgICAvLyBodHRwczovL3Rvb2xzLmlldGYub3JnL2h0bWwvcmZjMzI2MSNzZWN0aW9uLTE3LjIuMVxuICAgICAgICAgICAgICAgIGlmIChyZXF1ZXN0Lm1ldGhvZCA9PT0gQy5BQ0spIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5zdGF0ZVRyYW5zaXRpb24oVHJhbnNhY3Rpb25TdGF0ZS5Db25maXJtZWQpO1xuICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBUcmFuc2FjdGlvblN0YXRlLkNvbmZpcm1lZDpcbiAgICAgICAgICAgICAgICAvLyBUaGUgcHVycG9zZSBvZiB0aGUgXCJDb25maXJtZWRcIiBzdGF0ZSBpcyB0byBhYnNvcmIgYW55IGFkZGl0aW9uYWwgQUNLIG1lc3NhZ2VzIHRoYXQgYXJyaXZlLFxuICAgICAgICAgICAgICAgIC8vIHRyaWdnZXJlZCBmcm9tIHJldHJhbnNtaXNzaW9ucyBvZiB0aGUgZmluYWwgcmVzcG9uc2UuXG4gICAgICAgICAgICAgICAgLy8gaHR0cHM6Ly90b29scy5pZXRmLm9yZy9odG1sL3JmYzMyNjEjc2VjdGlvbi0xNy4yLjFcbiAgICAgICAgICAgICAgICBpZiAocmVxdWVzdC5tZXRob2QgPT09IEMuSU5WSVRFIHx8IHJlcXVlc3QubWV0aG9kID09PSBDLkFDSykge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBUcmFuc2FjdGlvblN0YXRlLlRlcm1pbmF0ZWQ6XG4gICAgICAgICAgICAgICAgLy8gRm9yIGdvb2QgbWVhc3VyZSBhYnNvcmIgYW55IGFkZGl0aW9uYWwgbWVzc2FnZXMgdGhhdCBhcnJpdmUgKHNob3VsZCBub3QgaGFwcGVuKS5cbiAgICAgICAgICAgICAgICBpZiAocmVxdWVzdC5tZXRob2QgPT09IEMuSU5WSVRFIHx8IHJlcXVlc3QubWV0aG9kID09PSBDLkFDSykge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgIC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4eCByZXNwb25zZS5cIik7XG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBUcmFuc2FjdGlvblN0YXRlLkNvbXBsZXRlZDpcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgVHJhbnNhY3Rpb25TdGF0ZS5Db25maXJtZWQ6XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIFRyYW5zYWN0aW9uU3RhdGUuVGVybWluYXRlZDpcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKGBJbnZhbGlkIHN0YXRlICR7dGhpcy5zdGF0ZX1gKTtcbiAgICAgICAgfVxuICAgICAgICBjb25zdCBtZXNzYWdlID0gYElOVklURSBzZXJ2ZXIgdHJhbnNhY3Rpb24gcmVjZWl2ZWQgdW5leHBlY3RlZCAke3N0YXR1c0NvZGV9IHJlc3BvbnNlIGZyb20gVFUgd2hpbGUgaW4gc3RhdGUgJHt0aGlzLnN0YXRlfS5gO1xuICAgICAgICB0aGlzLmxvZ2dlci5lcnJvcihtZXNzYWdlKTtcbiAgICAgICAgdGhyb3cgbmV3IEVycm9yKG1lc3NhZ2UpO1xuICAgIH1cbiAgICAvKipcbiAgICAgKiBSZXRyYW5zbWl0IHRoZSBsYXN0IDJ4eCByZXNwb25zZS4gVGhpcyBpcyBhIG5vb3AgaWYgbm90IGluIHRoZSBcImFjY2VwdGVkXCIgc3RhdGUuXG4gICAgICovXG4gICAgcmV0cmFuc21pdEFjY2VwdGVkUmVzcG9uc2UoKSB7XG4gICAgICAgIGlmICh0aGlzLnN0YXRlID09PSBUcmFuc2FjdGlvblN0YXRlLkFjY2VwdGVkICYmIHRoaXMubGFz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HBhc3NlZCB0byB0aGUgVFUsIGFuZCB0aGVcbiAgICAgICAgICAgICAgICAvLyBjbGllbnQgdHJhbnNhY3Rpb24gTVVTVCB0cmFuc2l0aW9uIHRvIHRoZSBcIkNvbXBsZXRlZFwiIHN0YXRlLlxuICAgICAgICAgICAgICAgIC8vIGh0dHBzOi8vdG9vbHMuaWV0Zi5vcmcvaHRtbC9yZmMzMjYxI3NlY3Rpb24tMTcuMS4yLjJcbiAgICAgICAgICAgICAgICBpZiAoc3RhdHVzQ29kZSA+PSAyMDAgJiYgc3RhdHVzQ29kZSA8PSA2OTkpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5zdGF0ZVRyYW5zaXRpb24oVHJhbnNhY3Rpb25TdGF0ZS5Db21wbGV0ZWQpO1xuICAgICAgICAgICAgICAgICAgICBpZiAoc3RhdHVzQ29kZSA9PT0gNDA4KSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLm9uUmVxdWVzdFRpbWVvdXQoKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy51c2VyLnJlY2VpdmVSZXNwb25zZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy51c2VyLnJlY2VpdmVSZXNwb25zZShyZXNwb25zZSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgVHJhbnNhY3Rpb25TdGF0ZS5Qcm9jZWVkaW5nOlxuICAgICAgICAgICAgICAgIC8vIElmIGEgcHJvdmlzaW9uYWwgcmVzcG9uc2UgaXMgcmVjZWl2ZWQgd2hpbGUgaW4gdGhlIFwiUHJvY2VlZGluZ1wiIHN0YXRlLFxuICAgICAgICAgICAgICAgIC8vIHRoZSByZXNwb25z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ICAgICAgICBpZiAoc3RhdHVzQ29kZSA9PT0gNDA4KSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLm9uUmVxdWVzdFRpbWVvdXQoKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy51c2VyLnJlY2VpdmVSZXNwb25zZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy51c2VyLnJlY2VpdmVSZXNwb25zZShyZXNwb25zZSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgVHJhbnNhY3Rpb25TdGF0ZS5Db21wbGV0ZWQ6XG4gICAgICAgICAgICAgICAgLy8gVGhlIFwiQ29tcGxldGVkXCIgc3RhdGUgZXhpc3RzIHRvIGJ1ZmZlciBhbnkgYWRkaXRpb25hbCByZXNwb25zZVxuICAgICAgICAgICAgICAgIC8vIHJldHJhbnNtaXNzaW9ucyB0aGF0IG1heSBiZSByZWNlaXZlZCAod2hpY2ggaXMgd2h5IHRoZSBjbGllbnRcbiAgICAgICAgICAgICAgICAvLyB0cmFuc2FjdGlvbiByZW1haW5zIHRoZXJlIG9ubHkgZm9yIHVucmVsaWFibGUgdHJhbnNwb3J0cykuXG4gICAgICAgICAgICAgICAgLy8gaHR0cHM6Ly90b29scy5pZXRmLm9yZy9odG1sL3JmYzMyNjEjc2VjdGlvbi0xNy4xLjIuMlxuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIGNhc2UgVHJhbnNhY3Rpb25TdGF0ZS5UZXJtaW5hdGVkOlxuICAgICAgICAgICAgICAgIC8vIEZvciBnb29kIG1lYXN1cmUganVzdCBhYnNvcmIgYWRkaXRpb25hbCByZXNwb25zZSByZXRyYW5zbWlz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ICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBUcmFuc2FjdGlvblN0YXRlLkNvbXBsZXRlZDpcbiAgICAgICAgICAgICAgICBpZiAodGhpcy5zdGF0ZSAhPT0gVHJhbnNhY3Rpb25TdGF0ZS5UcnlpbmcgJiYgdGhpcy5zdGF0ZSAhPT0gVHJhbnNhY3Rpb25TdGF0ZS5Qcm9jZWVkaW5nKSB7XG4gICAgICAgICAgICAgICAgICAgIGludmFsaWRTdGF0ZVRyYW5zaXRpb24oKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIFRyYW5zYWN0aW9uU3RhdGUuVGVybWluYXRlZDpcbiAgICAgICAgICAgICAgICBpZiAodGhpcy5zdGF0ZSAhPT0gVHJhbnNhY3Rpb25TdGF0ZS5UcnlpbmcgJiZcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5zdGF0ZSAhPT0gVHJhbnNhY3Rpb25TdGF0ZS5Qcm9jZWVkaW5nICYmXG4gICAgICAgICAgICAgICAgICAgIHRoaXMuc3RhdGUgIT09IFRyYW5zYWN0aW9uU3RhdGUuQ29tcGxldGVkKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmICghZHVlVG9UcmFuc3BvcnRFcnJvcikge1xuICAgICAgICAgICAgICAgICAgICAgICAgaW52YWxpZFN0YXRlVHJhbnNpdGlvbigpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICBpbnZhbGlkU3RhdGVUcmFuc2l0aW9uKCk7XG4gICAgICAgIH1cbiAgICAgICAgLy8gT25jZSB0aGUgY2xpZW50IHRyYW5zYWN0aW9uIGVudGVycyB0aGUgXCJDb21wbGV0ZWRcIiBzdGF0ZSwgaXQgTVVTVCBzZXRcbiAgIC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AgICAgICAgICAgICAgdGhpcy5sb2dUcmFuc3BvcnRFcnJvcihlcnJvciwgXCJGYWlsZWQgdG8gc2VuZCBwcm92aXNpb25hbCByZXNwb25zZS5cIik7XG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmIChzdGF0dXNDb2RlID49IDIwMCAmJiBzdGF0dXNDb2RlIDw9IDY5OSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnN0YXRlVHJhbnNpdGlvbihUcmFuc2FjdGlvblN0YXRlLkNvbXBsZXRlZCk7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuc2VuZChyZXNwb25zZSkuY2F0Y2goKGVycm9yKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZ1RyYW5zcG9ydEVycm9yKGVycm9yLCBcIkZhaWxlZCB0byBzZW5kIGZpbmFsIHJlc3BvbnNlLlwiKTtcbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIFRyYW5zYWN0aW9uU3RhdGUuUHJvY2VlZGluZzpcbiAgICAgICAgICAgICAgICAvLyBBbnkgZnVydGhlciBwcm92aXNpb25hbCByZXNwb25zZXMgdGhhdCBhcmUgcmVjZWl2ZWQgZnJvbSB0aGUgVFUgd2hpbGVcbiAgICAgICAgICAgICAgICAvLyBpbiB0aGUgXCJQcm9jZWVkaW5nXCIgc3RhdGUgTVVTVCBiZSBwYXNzZWQgdG8gdGhlIHRyYW5zcG9ydCBsYXllciBmb3IgdHJhbnNtaXNzaW9uLlxuICAgICAgICAgICAgICAgIC8vIElmIHRoZSBUVSBwYXNzZXMgYSBmaW5hbCByZXNwb25zZSAoc3RhdHVzIGNvZGVzIDIwMC02OTkpI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ICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBUcmFuc2FjdGlvblN0YXRlLlByb2NlZWRpbmc6XG4gICAgICAgICAgICAgICAgaWYgKHRoaXMuc3RhdGUgIT09IFRyYW5zYWN0aW9uU3RhdGUuVHJ5aW5nKSB7XG4gICAgICAgICAgICAgICAgICAgIGludmFsaWRTdGF0ZVRyYW5zaXRpb24oKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIFRyYW5zYWN0aW9uU3RhdGUuQ29tcGxldGVkOlxuICAgICAgICAgICAgICAgIGlmICh0aGlzLnN0YXRlICE9PSBUcmFuc2FjdGlvblN0YXRlLlRyeWluZyAmJiB0aGlzLnN0YXRlICE9PSBUcmFuc2FjdGlvblN0YXRlLlByb2NlZWRpbmcpIHtcbiAgICAgICAgICAgICAgICAgICAgaW52YWxpZFN0YXRlVHJhbnNpdGlvbigpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgVHJhbnNhY3Rpb25TdGF0ZS5UZXJtaW5hdGVkOlxuICAgICAgICAgICAgICAgIGlmICh0aGlzLnN0YXRlICE9PSBUcmFuc2FjdGlvblN0YXRlLlByb2NlZWRpbmcgJiYgdGhpcy5zdGF0ZSAhPT0gVHJhbnNhY3Rpb25TdGF0ZS5Db21wbGV0ZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFkdWVUb1RyYW5zcG9ydEVycm9yKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBpbnZhbGlkU3RhdGVUcmFuc2l0aW9uKCk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgIGludmFsaWRTdGF0ZVRyYW5zaXRpb24oKTtcbi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uc2FjdGlvbiAmJlxuICAgICAgICAgICAgICAgICAgICB1YXMudHJhbnNhY3Rpb24uc3RhdGUgPT09IFRyYW5zYWN0aW9uU3RhdGUuUHJvY2VlZGluZykge1xuICAgICAgICAgICAgICAgICAgICBpZiAodWFzIGluc3RhbmNlb2YgSW52aXRlVXNlckFnZW50U2VydmVyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB1YXMucmVjZWl2ZUNhbmNlbChtZXNzYWdlKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAvLyBBIENBTkNFTCByZXF1ZXN0IGhhcyBubyBpbXBhY3Qgb24gdGhlIHByb2Nlc3Npbmcgb2ZcbiAgICAgICAgICAgICAgICAgICAgLy8gdHJhbnNhY3Rpb25zIHdpdGggYW55IG90aGVyIG1ldGhvZCBkZWZpbmVkIGluIHRoaXMgc3BlY2lmaWNhdGlvbi5cbiAgICAgICAgICAgICAgICAgICAgLy8gaHR0cHM6Ly90b29scy5pZXRmLm9yZy9odG1sL3JmYzMyNjEjc2VjdGlvbi05LjJcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAvLyBJZiB0aGUgVUFTIGRpZCBub3QgZmluZCBhIG1hdGNoaW5nIHRyYW5zYWN0aW9uIGZvciB0aGUgQ0FOQ0VMXG4gICAgICAgICAgICAgICAgLy8gYWNjb3JkaW5nIHRvIHRoZSBwcm9jZWR1cmUgYWJvdmUsIGl0IFNIT1VMRCByZXNwb25kIHRvIHRoZSBDQU5DRUxcbiAgICAgICAgICAgICAgICAvLyB3aXRoIGEgNDgxIChDYWxsIExlZy9UcmFuc2FjdGlvbiBEb2VzIE5vdCBFeGlzdCkuXG4gICAgICAgICAgICAgICAgLy8gaHR0cHM6Ly90b29scy5pZXRmLm9yZy9odG1sL3JmYzMyNjEjc2VjdGlvbi05LjJcbiAgICAgICAgICAgICAgICB0aGlzLnJlcG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b29scy5pZXRmLm9yZy9odG1sL3JmYzMyNjEjc2VjdGlvbi0xMS4yXG4gICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICBjb25zdCBhbGxvd0hlYWRlciA9IFwiQWxsb3c6IFwiICsgQWxsb3dlZE1ldGhvZHMudG9TdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgYWNjZXB0SGVhZGVyID0gXCJBY2NlcHQ6IFwiICsgYWNjZXB0ZWRCb2R5VHlwZXMudG9TdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5yZXBseVN0YXRlbGVzcyhtZXNzYWdlLCB7XG4gICAgICAgICAgICAgICAgICAgICAgICBzdGF0dXNDb2RlOiAyMDAsXG4gICAgICAgICAgICAgICAgICAgICAgICBleHRyYUhlYWRlcnM6IFthbGxvd0hlYWRlciwgYWNjZXB0SGVhZGVyXVxuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIEMuUkVGRVI6XG4gICAgICAgICAgICAgICAgLy8gaHR0cHM6Ly90b29scy5pZXRmLm9yZy9odG1sL3JmYzM1MTUjc2VjdGlvbi0yLjQuMlxuICAgICAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgdWFzID0gbmV3IFJlZmVyVXNlckFnZW50U2VydmVyKHRoaXMsIG1lc3NhZ2UpO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmRlbGVnYXRlLm9uUmVmZXIgPyB0aGlzLmRlbGVnYXRlLm9uUmVmZXIodWFzKSA6IHVhcy5yZWplY3QoeyBzdGF0dXNDb2RlOiA0MDUgfSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBDLlJFR0lTVEVSOlxuICAgICAgICAgICAgICAgIC8vIGh0dHBzOi8vdG9vbHMuaW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4IHRvIElOVklURSksIHRoZSBVQVMgTVVTVCBjb3B5IGFsbCBSZWNvcmQtUm91dGVcbiAgICAgICAgICAgICAgICAgICAgLy8gaGVhZGVyIGZpZWxkIHZhbHVlcyBmcm9tIHRoZSByZXF1ZXN0IGludG8gdGhlIHJlc3BvbnNlIChpbmNsdWRpbmcgdGhlXG4gICAgICAgICAgICAgICAgICAgIC8vIFVSSXMsIFVSSSBwYXJhbWV0ZXJzLCBhbmQgYW55IFJlY29yZC1Sb3V0ZSBoZWFkZXIgZmllbGQgcGFyYW1ldGVycyxcbiAgICAgICAgICAgICAgICAgICAgLy8gd2hldGhlciB0aGV5IGFyZSBrbm93biBvciB1bmtub3duIHRvIHRoZSBVQVMpIGFuZCBNVVNUIG1haW50YWluIHRoZVxuICAgICAgICAgICAgICAgICAgICAvLyBvcmRlciBvZiB0aG9zZSB2YWx1ZXMuICBUaGUgVUFTIE1VU1QgYWRkIGEgQ29udGFjdCBoZWFkZXIgZmllbGQgdG9cbiAgICAgICAgICAgICAgICAgICAgLy8gdGhlIHJlc3BvbnNlLlxuICAgICAgICAgICAgICAgICAgICAvLyBodHRwczovL3Rvb2xzLmlldGYub3JnL2h0bWwvcmZjMzI2MSNzZWN0aW9uLTEyLjEuMVxuICAgICAgICAgICAgICAgICAgICAvLyBQcm92aXNpb25hbCB3aXRob3V0IENvbnRhY3QgaGVhZGVyIGZpZWxkLCBtYWxmb3JtZWQgcmVzcG9uc2UuXG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IGNvbnRhY3QgPSBtZXNzYWdlLnBhcnNlSGVhZGVyKFwiY29udGFjdFwiKTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFjb250YWN0KSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5lcnJvcihcIk5vbi0xMDAgMXh4IElOVklURSByZXNwb25zZSByZWNlaXZlZCB3aXRob3V0IGEgQ29udGFjdCBoZWFkZXIgZmllbGQsIGRyb3BwaW5nLlwiKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAvLyBDb21wdXRlIGRpYWxvZyBzdGF0ZS5cbiAgICAgICAgICAgICAgICAgICAgY29uc3QgZGlhbG9nU3RhdGUgPSBEaWFsb2cuaW5pdGlhbERpYWxvZ1N0YXRlRm9yVXNlckFnZW50Q2xpZW50KHRoaXMubWVzc2FnZSwgbWVzc2FnZSk7XG4gICAgICAgICAgICAgICAgICAgIC8vIEhhdmUgZXhpc3RpbmcgZWFybHkgZGlhbG9nIG9yIGNyZWF0ZSBhIG5ldyBvbmUuXG4gICAgICAgICAgICAgICAgICAgIGxldCBlYXJseURpYWxvZyA9IHRoaXMuZWFybHlEaWFsb2dzLmdldChkaWFsb2dTdGF0ZS5pZCk7XG4gICAgICAgICAgICAgICAgICAgIGlmICghZWFybHlEaWFsb2cpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHRyYW5zYWN0aW9uID0gdGhpcy50cmFuc2FjdGlvbjtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKHRyYW5zYWN0aW9uIGluc3RhbmNlb2YgSW52aXRlQ2xpZW50VHJhbnNhY3Rpb24pKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwiVHJhbnNhY3Rpb24gbm90IGluc3RhbmNlIG9mIEludml0ZUNsaWVudFRyYW5zYWN0aW9uLlwiKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIGVhcmx5RGlhbG9nID0gbmV3IFNlc3Npb25EaWFsb2codHJhbnNhY3Rpb24sIHRoaXMuY29yZSwgZGlhbG9nU3RhdGUpO1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5lYXJseURpYWxvZ3Muc2V0KGVhcmx5RGlhbG9nLmlkLCBlYXJseURpYWxvZyk7XG4gICAgICAgIC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GUub25Qcm9ncmVzcyh7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXNzaW9uLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByYWNrOiAob3B0aW9ucykgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBvdXRnb2luZ1ByYWNrUmVxdWVzdCA9IHNlc3Npb24ucHJhY2sodW5kZWZpbmVkLCBvcHRpb25zKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG91dGdvaW5nUHJhY2tSZXF1ZXN0O1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIGNhc2UgL14yWzAtOV17Mn0kLy50ZXN0KHN0YXR1c0NvZGUpOlxuICAgICAgICAgICAgICAgIC8vIE11bHRpcGxlIDJ4eCByZXNwb25zZXMgbWF5IGFycml2ZSBhdCB0aGUgVUFDIGZvciBhIHNpbmdsZSBJTlZJVEVcbiAgICAgICAgICAgICAgICAvLyByZXF1ZXN0IGR1ZSB0byBhIGZvcmtpbmcgcHJveHkuICBFYWNoIHJlc3BvbnNlIGlzIGRpc3Rpbmd1aXNoZWQgYnlcbiAgICAgICAgICAgICAgICAvLyB0aGUgdGFnIHBhcmFtZXRlciBpbiB0aGUgVG8gaGVhZGVyIGZpZWxkLCBhbmQgZWFjaCByZXByZXNlbnRzIGFcbiAgICAgICAgICAgICAgICAvLyBkaXN0aW5jdCBkaWFsb2csIHdpdGggYSBkaXN0aW5jdCBkaWFsb2cgaWRlbnRpZmllci5cbiAgICAgICAgICAgICAgICAvL1xuICAgICAgICAgICAgICAgIC8vIElmIHRoZSBkaWFsb2cgaWRlbnRpZmllciBpb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0IHdhc1xuICAgICAgICAgICAgICAgICAgICAvLyBJTlZJVEUsIHdpbGwgZXN0YWJsaXNoIGEgZGlhbG9nLiAgQSBkaWFsb2cgZXN0YWJsaXNoZWQgYnkgYSBub24tZmluYWxcbiAgICAgICAgICAgICAgICAgICAgLy8gcmVzcG9uc2UgdG8gYSByZXF1ZXN0IGlzIGluIHRoZSBcImVhcmx5XCIgc3RhdGUgYW5kIGl0IGlzIGNhbGxlZCBhblxuICAgICAgICAgICAgICAgICAgICAvLyBlYXJseSBkaWFsb2cuXG4gICAgICAgICAgICAgICAgICAgIC8vIGh0dHBzOi8vdG9vbHMuaWV0Zi5vcmcvaHRtbC9yZmMzMjYxI3NlY3Rpb24tMTIuMVxuICAgICAgICAgICAgICAgICAgICAvLyBGaW5hbCB3aXRob3V0IHRvIHRhZywgbWFsZm9ybWVkIHJlc3BvbnNlLlxuICAgICAgICAgICAgICAgICAgICBpZiAoIW1lc3NhZ2UudG9UYWcpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLmVycm9yKFwiMnh4IElOVklURSByZXNwb25zZSByZWNlaXZlZCB3aXRob3V0IGEgdG8gdGFnLCBkcm9wcGluZy5cIik7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgLy8gV2hlbiBhIFVBUyByZXNwb25kcyB0byBhIHJlcXVlc3Qgd2l0aCBhIHJlc3BvbnNlIHRoYXQgZXN0YWJsaXNoZXMgYVxuICAgICAgICAgICAgICAgICAgICAvLyBkaWFsb2cgKHN1Y2ggYXMgYSAyeHggdG8gSU5WSVRFKSwgdGhlIFVBUyBNVVNUIGNvcHkgYWxsIFJlY29yZC1Sb3V0ZVxuICAgICAgICAgICAgICAgICAgICAvLyBoZWFkZXIgZmllbGQgdmFsdWVzIGZyb20gdGhlIHJlcXVlc3QgaW50byB0aGUgcmVzcG9uc2UgKGluY2x1ZGluZyB0aGVcbiAgICAgICAgICAgICAgICAgICAgLy8gVVJJcywgVVJJIHBhcmFtZXRlcnMsIGFuZCBhbnkgUmVjb3JkLVJvdXRlIGhlYWRlciBmaWVsZCBwYXJhbWV0ZXJzLFxuICAgICAgICAgICAgICAgICAgICAvLyB3aGV0aGVyIHRoZXkgYXJlIGtub3duIG9yIHVua25vd24gdG8gdGhlIFVBUykgYW5kIE1VU1QgbWFpbnRhaW4gdGhlXG4gICAgICAgICAgICAgICAgICAgIC8vIG9yZGVyIG9mIHRob3NlIHZhbHVlcy4gIFRoZSBVQVMgTVVTVCBhZGQgYSBDb250YWN0IGhlYWRlciBmaWVsZCB0b1xuICAgICAgICAgICAgICAgICAgICAvLyB0aGUgcmVzcG9uc2UuXG4gICAgICAgICAgICAgICAgICAgIC8vIGh0dHBzOi8vdG9vbHMuaWV0Zi5vcmcvaHRtbC9yZmMzMjYxI3NlY3Rpb24tMTIuMS4xXG4gICAgICAgICAgICAgICAgICAgIC8vIEZpbmFsIHdpdGhvdXQgQ29udGFjdCBoZWFkZXIgZmllbGQsIG1hbGZvcm1lZCByZXNwb25zZS5cbiAgICAgICAgICAgICAgICAgICAgY29uc3QgY29udGFjdCA9IG1lc3NhZ2UucGFyc2VIZWFkZXIoXCJjb250YWN0XCIpO1xuICAgICAgICAgICAgICAgICAgICBpZiAoIWNvbnRhY3QpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLmVycm9yKFwiMnh4IElOVklURSByZXNwb25zZSByZWNlaXZlZCB3aXRob3V0IGEgQ29udGFjdCBoZWFkZXIgZmllbGQsIGRyb3BwaW5nLlwiKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAvLyBDb21wdXRlIGRpYWxvZyBzdGF0ZS5cbiAgICAgICAgICAgICAgICAgICAgY29uc3QgZGlhbG9nU3RhdGUgPSBEaWFsb2cuaW5pdG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gZGlyZWN0bHkgZm9yIHRyYW5zbWlzc2lvbixcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIHJhdGhlciB0aGFuIGEgY2xpZW50IHRyYW5zYWN0aW9uLiAgVGhpcyBpcyBiZWNhdXNlIHRoZSBVQUMgY29yZVxuICAgICAgICAgICAgICAgICAgICAgICAgLy8gaGFuZGxlcyByZXRyYW5zbWlzc2lvbnMgb2YgdGhlIEFDSywgbm90IHRoZSB0cmFuc2FjdGlvbiBsYXllci4gIFRoZVxuICAgICAgICAgICAgICAgICAgICAgICAgLy8gQUNLIE1VU1QgYmUgcGFzc2VkIHRvIHRoZSBjbGllbnQgdHJhbnNwb3J0IGV2ZXJ5IHRpbWUgYVxuICAgICAgICAgICAgICAgICAgICAgICAgLy8gcmV0cmFuc21pc3Npb24gb2YgdGhlIDJ4eCBmaW5hbCByZXNwb25zZSB0aGF0IHRyaWdnZXJlZCB0aGUgQUNLXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBhcnJpdmVzLlxuICAgICAgICAgICAgICAgICAgICAgICAgLy8gaHR0cHM6Ly90b29scy5pZXRmLm9yZy9odG1sL3JmYzMyNjEjc2VjdGlvbi0xMy4yLjIuNFxuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgb3V0Z29pbmdBY2tSZXF1ZXN0ID0gdGhpcy5jb25maXJtZWREaWFsb2dBY2tzLmdldChkaWFsb2dTdGF0ZS5pZCk7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAob3V0Z29pbmdBY2tSZXF1ZXN0KSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgdHJhbnNhY3Rpb24gPSB0aGlzLnRyYW5zYWN0aW9uO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKHRyYW5zYWN0aW9uIGluc3RhbmNlb2YgSW52aXRlQ2xpZW50VHJhbnNhY3Rpb24pKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcIkNsaWVudCB0cmFuc2FjdGlvbiBub3QgaW5zdGFuY2Ugb2YgSW52aXRlQ2xpZW50VHJhbnNhY3Rpb24uXCIpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFuc2FjdGlvbi5hY2tSZXNwb25zZShvdXRnb2luZ0Fja1JlcXVlc3QubWVzc2FnZSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBJZiBzdGlsbCB3YWl0aW5nIGZvciBhbiBBQ0ssIGRyb3AgdGhlIHJldHJhbnNtaXNzaW9uIG9mIHRoZSAyeHggZmluYWwgcmVzcG9uc2UuXG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgLy8gSWYgdGhlIGRpYWxvZyBpZGVudGlmaWVyIGluIHRoZSAyeHggcmVzcG9uc2UgbWF0Y2hlcyB0aGUgZGlhbG9nXG4gICAgICAgICAgICAgICAgICAgIC8vIGlkZW50aWZpZXIgb2YgYW4gZXhpc3RpbmcgZGlhbG9nLCB0aGUgZGlhbG9nIE1VU1QgYmUgdHJhbnNpdGlvbmVkIHRvXG4gICAgICAgICAgICAgICAgICAgIC8vIHRoZSBcImNvbmZpcm1lZFwiIHN0YXRlLCBhbmQgdGhlIHJvdXRlIHNldCBmb3IgdGhlIGRpYWxvZyBNVVNUIGJlXG4gICAgICAgICAgICAgICAgICAgIC8vIHJlY29tcHV0ZWQgYmFzZWQgb24gdGhlIDJ4eCByZXNwb25zZSB1c2luZyB0aGUgcHJvY2VkdXJlcyBvZiBTZWN0aW9uXG4gICAgICAgICAgICAgICAgICAgIC8vIDEyLjIuMS4yLiBPdGhlcndpc2UsIGEgbmV3IGRpYWxvZyBpbiB0aGUgXCJjb25maXJtZWRcIiBzdGF0ZSBNVVNUIGJlXG4gICAgICAgICAgICAgICAgICAgIC8vIGNvbnN0cnVjdGVkIHVzaW5nIHRoZSBwcm9jZWR1cmVzIG9mIFNlY3Rpb24gMTIuMS4yLlxuICAgICAgICAgICAgICAgICAgICAvLyBodHRwczovL3Rvb2xzLmlldGYub3JnL2h0bWwvcmZjMzI2MSNzZWN0aW9uLTEzLjIuMi40XG4gICAgICAgICAgICAgICAgICAgIGRpYWxvZyA9IHRoaXMuZWFybHlEaWFsb2dzLmdldChkaWFsb2dTdGF0ZS5pZCk7XG4gICAgICAgICAgICAgICAgICAgIGlmIChkaWFsb2cpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGRpYWxvZy5jb25maXJtKCk7XG4gICAgICAgICAgICAgICAgICAgICAgICBkaWFsb2cucmVjb21wdXRlUm91dGVTZXQobWVzc2FnZSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmVhcmx5RGlhbG9ncy5kZWxldGUoZGlhbG9nLmlkKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuY29uZmlybWVkRGlhbG9ncy5zZXQoZGlhbG9nLmlkLCBkaWFsb2cpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgdHJhbnNhY3Rpb24gPSB0aGlzLnRyYW5zYWN0aW9uO1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEodHJhbnNhY3Rpb24gaW5zdGFuY2VvZiBJbnZpdGVDbGllbnRUcmFuc2FjdGlvbikpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJUcmFuc2FjdGlvbiBub3QgaW5zdGFuY2Ugb2YgSW52aXRlQ2xpZW50VHJhbnNhY3Rpb24uXCIpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgZGlhbG9nID0gbmV3IFNlc3Npb25EaWFsb2codHJhbnNhY3Rpb24sIHRoaXMuY29yZSwgZGlhbG9nU3RhdGUpO1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5jb25maXJtZWREaWFsb2dzLnNldChkaWFsb2cuaWQsIGRpYWxvZyk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgLy8gSWYgdGhlIGluaXRpYWwgb2ZmZXIgaXMgaW4gYW4gSU5WSVRFLCB0aGUgYW5zd2VyIE1VU1QgYmUgaW4gYVxuICAgICAgICAgICAgICAgICAgICAvLyByZWxpYWJsZSBub24tZmFpbHVyZSBtZXNzYWdlIGZyb20gVUFTIGJhY2sgdG8gVUFDIHdoaWNoIGlzXG4gICAgICAgICAgICAgICAgICAgIC8vIGNvcnJlbGF0ZWQgdG8gdGhhdCBJTlZJVEUuICBGb3IgdGhpcyBzcGVjaWZpY2F0aW9uLCB0aGF0IGlzXG4gICAgICAgICAgICAgICAgICAgIC8vIG9ubHkgdGhlIGZpbmFsIDJ4eCByZXNwb25zZSB0byB0aGF0IElOVklURS4gIFRoYXQgc2FtZSBleGFjdFxuICAgICAgICAgICAgICAgICAgICAvLyBhbnN3ZXIgTUFZIGFsc28gYmUgcGxhY2VkIGluIGFueSBwcm92aXNpb25hbCByZXNwb25zZXMgc2VudFxuICAgICAgICAgICAgICAgICAgICAvLyBwcmlvciB0byB0aGUgYW5zd2VyLiAgVGhlIFVBQyBNVVNUIHRyZWF0IHRoZSBmaXJzdCBzZXNzaW9uXG4gICAgICAgICAgICAgICAgICAgIC8vIGRlc2NyaXB0aW9uIGl0IHJlY2VpdmVzIGFzIHRoZSBhbnN3ZXIsIGFuZCBNVVNUIGlnbm9yZSBhbnlcbiAgICAgICAgICAgICAgICAgICAgLy8gc2Vzc2lvbiBkZXNjcmlwdGlvbnMgaW4gc3Vic2VxdWVudCByZXNwb25zZXMgdG8g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ICAgICAgICAgICAgICAgICAgICAgICAgIHNlc3Npb24sXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYWNrOiAob3B0aW9ucykgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBvdXRnb2luZ0Fja1JlcXVlc3QgPSBzZXNzaW9uLmFjayhvcHRpb25zKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5jb25maXJtZWREaWFsb2dBY2tzLnNldChzZXNzaW9uLmlkLCBvdXRnb2luZ0Fja1JlcXVlc3QpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gb3V0Z29pbmdBY2tSZXF1ZXN0O1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgb3V0Z29pbmdBY2tSZXF1ZXN0ID0gc2Vzc2lvbi5hY2soKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuY29uZmlybWVkRGlhbG9nQWNrcy5zZXQoc2Vzc2lvbi5pZCwgb3V0Z29pbmdBY2tSZXF1ZXN0KTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICBjYXNlIC9eM1swLTldezJ9JC8udGVzdChzdGF0dXNDb2RlKTpcbiAgICAgICAgICAgICAgICAvLyAxMi4zIFRlcm1pbmF0aW9uIG9mIGEgRGlhbG9nXG4gICAgICAgICAgICAgICAgLy9cbiAgICAgICAgICAgICAgICAvLyBJbmRlcGVuZGVudCBvZiB0aGUgbWV0aG9kLCBpZiBhIHJlcXVlc3Qgb3V0c2lkZSBvZiBhIGRpYWxvZyBnZW5lcmF0ZXNcbiAgICAgICAgICAgICAgICAv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XG4gICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLFxuICAgICAgICAgICAgICAgICAgICAgICAgc2Vzc2lvbjogdGhpcy5kaWFsb2csXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgQHR5cGVzY3JpcHQtZXNsaW50L25vLXVudXNlZC12YXJzXG4gICAgICAgICAgICAgICAgICAgICAgICBwcmFjazogKG9wdGlvbnMpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJVbmltcGxlbWVudGVkLlwiKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSAvXjJbMC05XXsyfSQvLnRlc3Qoc3RhdHVzQ29kZSk6XG4gICAgICAgICAgICAgICAgLy8gVXBkYXRlIGRpYWxvZyBzaWduYWxpbmcgc3RhdGUgd2l0aCBvZmZlci9hbnN3ZXIgaW4gYm9keVxuICAgICAgICAgICAgICAgIHRoaXMuZGlhbG9nLnNpZ25hbGluZ1N0YXRlVHJhbnNpdGlvbihtZXNzYWdlKTtcbiAgICAgICAgICAgICAgICBpZiAodGhpcy5kZWxlZ2F0ZSAmJiB0aGlzLmRlbGVnYXRlLm9uQWNjZXB0KSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZGVsZWdhdGUub25BY2NlcHQoe1xuICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZSxcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlc3Npb246IHRoaXMuZGlhbG9nLFxuICAgICAgICAgICAgICAgICAgICAgICAgYWNrOiAob3B0aW9ucykgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IG91dGdvaW5nQWNrUmVxdWVzdCA9IHRoaXMuZGlhbG9nLmFjayhvcHRpb25zKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gb3V0Z29pbmdBY2tSZXF1ZXN0O1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIC9eM1swLTldezJ9JC8udGVzdChzdGF0dXNDb2RlKTpcbiAgICAgICAgICAgICAgICB0aGlzLmRpYWxvZy5zaWduYWxpbmdTdGF0ZVJvbGxiYWNrKCk7XG4gICAgICAgICAgICAgICAgdGhpcy5kaWFsb2cucmVpbnZpdGVVc2VyQWdlbnRDbGllbnQgPSB1bmRlZmluZWQ7IC8vIEFDSyB3YXMgaGFuZGxlZCBieSB0cmFuc2FjdGlvblxuICAgICAgICAgICAgICAgIGlmICh0aGlzLmRlbGVnYXRlICYmIHRoaXMuZGVsZWdhdGUub25SZWRpcmVjdCkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmRlbGVnYXRlLm9uUmVkaXJlY3QoeyBtZXNzYWdlIH0pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgL15bNC02XVswLTldezJ9JC8udGVzdChzdGF0dXNDb2RlKTpcbiAgICAgICAgICAgICAgICB0aGlzLmRpYWxvZy5zaWduYWxpbmdTdGF0ZVJvbGxiYWNrKCk7XG4gICAgICAgICAgICAgICAgdGhpcy5kaWFsb2cucmVpbnZpdGVVc2VyQWdlbnRDbGllbnQgPSB1bmRlZmluZWQ7IC8vIEFDSyB3YXMgaGFuZGxlZCBieSB0cmFuc2FjdGlvblxuICAgICAgICAgICAgICAgIGlmICh0aGlzLmRlbGVnYXRlICYmIHRoaXMuZGVsZWdhdGUub25SZWplY3QpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5kZWxlZ2F0ZS5vblJlamVjdCh7IG1lc3NhZ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ICAgICAgICAgICAgICAvL1xuICAgICAgICAgICAgICAgICAgICAvLyAgICAxLiBJZiB0aGUgVUFDIGlzIHRoZSBvd25lciBvZiB0aGUgQ2FsbC1JRCBvZiB0aGUgZGlhbG9nIElEXG4gICAgICAgICAgICAgICAgICAgIC8vICAgICAgIChtZWFuaW5nIGl0IGdlbmVyYXRlZCB0aGUgdmFsdWUpLCBUIGhhcyBhIHJhbmRvbWx5IGNob3NlbiB2YWx1ZVxuICAgICAgICAgICAgICAgICAgICAvLyAgICAgICBiZXR3ZWVuIDIuMSBhbmQgNCBzZWNvbmRzIGluIHVuaXRzIG9mIDEwIG1zLlxuICAgICAgICAgICAgICAgICAgICAvL1xuICAgICAgICAgICAgICAgICAgICAvLyAgICAyLiBJZiB0aGUgVUFDIGlzIG5vdCB0aGUgb3duZXIgb2YgdGhlIENhbGwtSUQgb2YgdGhlIGRpYWxvZyBJRCwgVFxuICAgICAgICAgICAgICAgICAgICAvLyAgICAgICBoYXMgYSByYW5kb21seSBjaG9zZW4gdmFsdWUgb2YgYmV0d2VlbiAwIGFuZCAyIHNlY29uZHMgaW4gdW5pdHNcbiAgICAgICAgICAgICAgICAgICAgLy8gICAgICAgb2YgMTAgbXMuXG4gICAgICAgICAgICAgICAgICAgIC8vXG4gICAgICAgICAgICAgICAgICAgIC8vIFdoZW4gdGhlIHRpbWVyIGZpcmVzLCB0aGUgVUFDIFNIT1VMRCBhdHRlbXB0IHRoZSByZS1JTlZJVEUgb25jZSBtb3JlLFxuICAgICAgICAgICAgICAgICAgICAvLyBpZiBpdCBzdGlsbCBkZXNpcmVzIGZvciB0aGF0IHNlc3Npb24gbW9kaWZpY2F0aW9uIHRvIHRha2UgcGxhY2UuICBGb3JcbiAgICAgICAgICAgICAgICAgICAgLy8gZXhhbXBsZSwgaWYgdGhlIGNhbGwgd2FzIGFscmVhZHkgaHVuZyB1cCB3aXRoIGEgQllFLCB0aGUgcmUtSU5WSVRFXG4gICAgICAgICAgICAgICAgICAgIC8vIH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LmRlbGVnYXRlLm9uVHJ5aW5nKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZGVsZWdhdGUub25UcnlpbmcoeyBtZXNzYWdlIH0pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgL14xWzAtOV17Mn0kLy50ZXN0KHN0YXR1c0NvZGUpOlxuICAgICAgICAgICAgICAgIGlmICh0aGlzLmRlbGVnYXRlICYmIHRoaXMuZGVsZWdhdGUub25Qcm9ncmVzcykge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmRlbGVnYXRlLm9uUHJvZ3Jlc3MoeyBtZXNzYWdlIH0pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgL14yWzAtOV17Mn0kLy50ZXN0KHN0YXR1c0NvZGUpOlxuICAgICAgICAgICAgICAgIGlmICh0aGlzLmRlbGVnYXRlICYmIHRoaXMuZGVsZWdhdGUub25BY2NlcHQpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5kZWxlZ2F0ZS5vbkFjY2VwdCh7IG1lc3NhZ2UgfSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSAvXjNbMC05XXsyfSQvLnRlc3Qoc3RhdHVzQ29kZSk6XG4gICAgICAgICAgICAgICAgaWYgKHRoaXMuZGVsZWdhdGUgJiYgdGhpcy5kZWxlZ2F0ZS5vblJlZGlyZWN0KSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZGVsZWdhdGUub25SZWRpcmVjdCh7IG1lc3NhZ2UgfSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSAvXls0LTZdWzAtOV17Mn0kLy50ZXN0KHN0YXR1c0NvZGUpOlxuICAgICAgICAgICAgICAgIGlmICh0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WN0b3J5LFxuICAgICAgICAgICAgb25TdGF0ZUNoYW5nZTogKG5ld1N0YXRlKSA9PiB7XG4gICAgICAgICAgICAgICAgaWYgKG5ld1N0YXRlID09PSBUcmFuc2FjdGlvblN0YXRlLlRlcm1pbmF0ZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgLy8gUmVtb3ZlIHRoZSB0ZXJtaW5hdGVkIHRyYW5zYWN0aW9uIGZyb20gdGhlIGNvcmUuXG4gICAgICAgICAgICAgICAgICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBAdHlwZXNjcmlwdC1lc2xpbnQvbm8tdXNlLWJlZm9yZS1kZWZpbmVcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5jb3JlLnVzZXJBZ2VudFNlcnZlcnMuZGVsZXRlKHVzZXJBZ2VudFNlcnZlcklkKTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5kaXNwb3NlKCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIG9uVHJhbnNwb3J0RXJyb3I6IChlcnJvcikgPT4ge1xuICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLmVycm9yKGVycm9yLm1lc3NhZ2UpO1xuICAgICAgICAgICAgICAgIGlmICh0aGlzLmRlbGVnYXRlICYmIHRoaXMuZGVsZWdhdGUub25UcmFuc3BvcnRFcnJvcikge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmRlbGVnYXRlLm9uVHJhbnNwb3J0RXJyb3IoZXJyb3IpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIuZXJyb3IoXCJVc2VyIGFnZW50IHNlcnZlciByZXNwb25zZSB0cmFuc3BvcnQgZXJyb3IuXCIpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfTtcbiAgICAgICAgLy8gQ3JlYXRlIG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hY2tUcmFjZSh0aGlzLCBTeW50YXhFcnJvcik7XG4gICAgICAgIH1cbiAgICB9XG4gICAgc3RhdGljIGJ1aWxkTWVzc2FnZShleHBlY3RlZCwgZm91bmQpIHtcbiAgICAgICAgZnVuY3Rpb24gaGV4KGNoKSB7XG4gICAgICAgICAgICByZXR1cm4gY2guY2hhckNvZGVBdCgwKS50b1N0cmluZygxNikudG9VcHBlckNhc2UoKTtcbiAgICAgICAgfVxuICAgICAgICBmdW5jdGlvbiBsaXRlcmFsRXNjYXBlKHMpIHtcbiAgICAgICAgICAgIHJldHVybiBzXG4gICAgICAgICAgICAgICAgLnJlcGxhY2UoL1xcXFwvZywgXCJcXFxcXFxcXFwiKVxuICAgICAgICAgICAgICAgIC5yZXBsYWNlKC9cIi9nLCBcIlxcXFxcXFwiXCIpXG4gICAgICAgICAgICAgICAgLnJlcGxhY2UoL1xcMC9nLCBcIlxcXFwwXCIpXG4gICAgICAgICAgICAgICAgLnJlcGxhY2UoL1xcdC9nLCBcIlxcXFx0XCIpXG4gICAgICAgICAgICAgICAgLnJlcGxhY2UoL1xcbi9nLCBcIlxcXFxuXCIpXG4gICAgICAgICAgICAgICAgLnJlcGxhY2UoL1xcci9nLCBcIlxcXFxyXCIpXG4gICAgICAgICAgICAgICAgLnJlcGxhY2UoL1tcXHgwMC1cXHgwRl0vZywgKGNoKSA9PiBcIlxcXFx4MFwiICsgaGV4KGNoKSlcbiAgICAgICAgICAgICAgICAucmVwbGFjZSgvW1xceDEwLVxceDFGXFx4N0YtXFx4OUZdL2csIChjaCkgPT4gXCJcXFxceFwiICsgaGV4KGNoKSk7XG4gICAgICAgIH1cbiAgICAgICAgZnVuY3Rpb24gY2xhc3NFc2NhcGUocykge1xuICAgICAgICAgICAgcmV0dXJuIHNcbiAgICAgICAgICAgICAgICAucmVwbGFjZSgvXFxcXC9nLCBcIlxcXFxcXFxcXCIpXG4gICAgICAgICAgICAgICAgLnJlcGxhY2UoL1xcXS9nLCBcIlxcXFxdXCIpXG4gICAgICAgICAgICAgICAgLnJlcGxhY2UoL1xcXi9nLCBcIlxcXFxeXCIpXG4gICAgICAgICAgICAgICAgLnJlcGxhY2UoLy0vZywgXCJcXFxcLVwiKVxuICAgICAgICAgICAgICAgIC5yZXBsYWNlKC9cXDAvZywgXCJcXFxcMFwiKVxuICAgICAgICAgICAgICAgIC5yZXBsYWNlKC9cXHQvZywgXCJcXFxcdFwiKVxuICAgICAgICAgICAgICAgIC5yZXBsYWNlKC9cXG4vZywgXCJcXFxcblwiKVxuICAgICAgICAgICAgICAgIC5yZXBsYWNlKC9cXHIvZywgXCJcXFxcclwiKVxuICAgICAgICAgICAgICAgIC5yZXBsYWNlKC9bXFx4MDAtXFx4MEZdL2csIChjaCkgPT4gXCJcXFxceDBcIiArIGhleChjaCkpXG4gICAgICAgICAgICAgICAgLnJlcGxhY2UoL1tcXHgxMC1cXHgxRlxceDdGLVxceDlGXS9nLCAoY2gpID0+IFwiXFxcXHhcIiArIGhleChjaCkpO1xuICAgICAgICB9XG4gICAgICAgIGZ1bmN0aW9uIGRlc2NyaWJlRXhwZWN0YXRpb24oZXhwZWN0YXRpb24pIHtcbiAgICAgICAgICAgIHN3aXRjaCAoZXhwZWN0YXRpb24udHlwZSkge1xuICAgICAgICAgICAgICAgIGNhc2UgXCJsaXRlcmFsXCI6XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcIlxcXCJcIiArIGxpdGVyYWxFc2NhcGUoZXhwZWN0YXRpb24udGV4dCkgKyBcIlxcXCJcIjtcbiAgICAgICAgICAgICAgICBjYXNlIFwiY2xhc3NcIjpcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgZXNjYXBlZFBhcnRzID0gZXhwZWN0YXRpb24ucGFydHMubWFwKChwYXJ0KSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQXJyYXkuaXNBcnJheShwYXJ0KVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgID8gY2xhc3NFc2NhcGUocGFydFswXSkgKyBcIi1cIiArIGNsYXNzRXNjYXBlKHBhcnRbMV0pXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgOiBjbGFzc0VzY2FwZShwYXJ0KTtcbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcIltcIiArIChleHBlY3RhdGlvbi5pbnZlcnRlZCA/IFwiXlwiIDogXCJcIikgKyBlc2NhcGVkUGFydHMgKyBcIl1cIjtcbiAgICAgICAgICAgICAgICBjYXNlIFwiYW55XCI6XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcImFueSBjaGFyYWN0ZXJcIjtcbiAgICAgICAgICAgICAgICBjYXNlIFwiZW5kXCI6XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcImVuZCBvZiBpbnB1dFwiO1xuICAgICAgICAgICAgICAgIGNhc2UgXCJvdGhlclwiOlxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gZXhwZWN0YXRpb24uZGVzY3JpcHRpb247XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgZnVuY3Rpb24gZGVzY3JpYmVFeHBlY3RlZChleHBlY3RlZDEpIHtcbiAgICAgICAgICAgIGNvbnN0IGRlc2NyaXB0aW9ucyA9IGV4cGVjdGVkMS5tYXAoZGVzY3JpYmVFeHBlY3RhdGlvbik7XG4gICAgICAgICAgICBsZXQgaTtcbiAgICAgICAgICAgIGxldCBqO1xuICAgICAgICAgICAgZGVzY3JpcHRpb25zLnNvcnQoKTtcbiAgICAgICAgICAgIGlmIChkZXNjcmlwdGlvbnMubGVuZ3RoID4gMCkge1xuICAgICAgICAgICAgICAgIGZvciAoaSA9IDEsIGogPSAxOyBpIDwgZGVzY3JpcHRpb25zLmxlbmd0aDsgaSsrKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChkZXNjcmlwdGlvbnNbaSAtIDFdICE9PSBkZXNjcmlwdGlvbnNbaV0pIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGRlc2NyaXB0aW9uc1tqXSA9IGRlc2NyaXB0aW9uc1tpXTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGorKztcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBkZXNjcmlwdGlvbnMubGVuZ3RoID0gajtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHN3aXRjaCAoZGVzY3JpcHRpb25zLmxlbmd0aCkge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGRlc2NyaXB0aW9uc1swXTtcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBkZXNjcmlwdGlvbnNbMF0gKyBcIiBvciBcIiArIGRlc2NyaXB0aW9uc1sxXTtcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gZGVzY3JpcHRpb25zLnNsaWNlKDAsIC0xKS5qb2luKFwiLCBcIilcbiAgICAgICAgICAgICAgICAgICAgICAgICsgXCIsIG9yIFwiXG4gICAgICAgICAgICAgICAgICAgICAgICArIGRlc2NyaXB0aW9uc1tkZXNjcmlwdGlvbnMubGVuZ3RoIC0gMV07XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgZnVuY3Rpb24gZGVzY3JpYmVGb3VuZChmb3VuZDEpIHtcbiAgICAgICAgICAgIHJldHVybiBmb3VuZDEgPyBcIlxcXCJcIiArIGxpdGVyYWxFc2NhcGUoZm91bmQxKSArIFwiXFxcIlwiIDogXCJlbmQgb2YgaW5wdXRcIjtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gXCJFeHBlY3RlZCBcIiArIGRlc2NyaWJlRXhwZWN0ZWQoZXhwZWN0ZWQpICsgXCIgYnV0IFwiICsgZGVzY3JpYmVGb3VuZChmb3VuZCkgKyBcIiBmb3VuZC5cIjtcbiAgICB9XG4gICAgZm9ybWF0KHNvdXJjZXMpIHtcbiAgICAgICAgbGV0IHN0ciA9ICdFcnJvcjogJyArIHRoaXMubWVzc2FnZTtcbiAgICAgICAgaWYgKHRoaXMubG9jYXRpb24pIHtcbiAgICAgICAgICAgIGxldCBzcmMgPSBudWxsO1xuICAgICAgICAgICAgbGV0IGs7XG4gICAgICAgICAgICBmb3IgKGsgPSAwOyBrIDwgc291cmNlcy5sZW5ndGg7IGsrKykge1xuICAgICAgICAgICAgICAgIGlmIChzb3VyY2VzW2tdLnNvdXJjZSA9PT0gdGhpcy5sb2NhdGlvbi5zb3VyY2UpIHtcbiAgICAgICAgICAgICAgICAgICAgc3JjID0gc291cmNlc1trXS50ZXh0LnNwbGl0KC9cXHJcXG58XFxufFxcci9nKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgbGV0IHMgPSB0aGlzLmxvY2F0aW9uLnN0YXJ0O1xuICAgICAgICAgICAgbGV0IGxvYyA9IHRoaXMubG9jYXRpb24uc291cmNlICsgJzonICsgcy5saW5lICsgJzonICsgcy5jb2x1bW47XG4gICAgICAgICAgICBpZiAoc3JjKSB7XG4gICAgICAgICAgICAgICAgbGV0IGUgPSB0aGlzLmxvY2F0aW9uLmVuZDtcbiAgICAgICAgICAgICAgICBsZXQgZmlsbGVyID0gcGVnJHBhZEVuZCgnJywgcy5saW5lLnRvU3RyaW5nKCkubGVuZ3RoLCAnICcpO1xuICAgICAgICAgICAgICAgIGxldCBsaW5lID0gc3JjW3MubGluZSAtIDFdO1xuICAgICAgICAgICAgICAgIGxldCBsYXN0ID0gcy5saW5lID09PSBlLmxpbmUgPyBlLmNvbHVtbiA6IGxpbmUubGVuZ3RoICsgMTtcbiAgICAgICAgICAgICAgICBzdHIgKz0gJ1xcbiAtLT4gJyArIGxvYyArICdcXG4nICsgZmlsbGVyICsgJyB8XFxuJyArIHMubGluZSArICc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ICAgICBcInR0bD1cIixcbiAgICAgICAgcGVnJGxpdGVyYWxFeHBlY3RhdGlvbihcInR0bD1cIiwgdHJ1ZSksXG4gICAgICAgIGZ1bmN0aW9uICh0dGwpIHtcbiAgICAgICAgICAgIG9wdGlvbnMgPSBvcHRpb25zIHx8IHsgZGF0YToge30gfTtcbiAgICAgICAgICAgIGlmICghb3B0aW9ucy5kYXRhLnBhcmFtcylcbiAgICAgICAgICAgICAgICBvcHRpb25zLmRhdGEucGFyYW1zID0ge307XG4gICAgICAgICAgICBvcHRpb25zLmRhdGEucGFyYW1zWyd0dGwnXSA9IHR0bDtcbiAgICAgICAgfSxcbiAgICAgICAgXCJtYWRkcj1cIixcbiAgICAgICAgcGVnJGxpdGVyYWxFeHBlY3RhdGlvbihcIm1hZGRyPVwiLCB0cnVlKSxcbiAgICAgICAgZnVuY3Rpb24gKG1hZGRyKSB7XG4gICAgICAgICAgICBvcHRpb25zID0gb3B0aW9ucyB8fCB7IGRhdGE6IHt9IH07XG4gICAgICAgICAgICBpZiAoIW9wdGlvbnMuZGF0YS51cmlfcGFyYW1zKVxuICAgICAgICAgICAgICAgIG9wdGlvbnMuZGF0YS51cmlfcGFyYW1zID0ge307XG4gICAgICAgICAgICBvcHRpb25zLmRhdGEudXJpX3BhcmFtc1snbWFkZHInXSA9IG1hZGRyO1xuICAgICAgICB9LFxuICAgICAgICBcImxyXCIsXG4gICAgICAgIHBlZyRsaXRlcmFsRXhwZWN0YXRpb24oXCJsclwiLCB0cnVlKSxcbiAgICAgICAgZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgb3B0aW9ucyA9IG9wdGlvbnMgfHwgeyBkYXRhOiB7fSB9O1xuICAgICAgICAgICAgaWYgKCFvcHRpb25zLmRhdGEudXJpX3BhcmFtcylcbiAgICAgICAgICAgICAgICBvcHRpb25zLmRhdGEudXJpX3BhcmFtcyA9IHt9O1xuICAgICAgICAgICAgb3B0aW9ucy5kYXRhLnVyaV9wYXJhbXNbJ2xyJ10gPSB1bmRlZmluZWQ7XG4gICAgICAgIH0sXG4gICAgICAgIGZ1bmN0aW9uIChwYXJhbSwgdmFsdWUpIHtcbiAgICAgICAgICAgIG9wdGlvbnMgPSBvcHRpb25zIHx8IHsgZGF0YToge30gfTtcbiAgICAgICAgICAgIGlmICghb3B0aW9ucy5kYXRhLnVyaV9wYXJhbXMpXG4gICAgICAgICAgICAgICAgb3B0aW9ucy5kYXRhLnVyaV9wYXJhbXMgPSB7fTtcbiAgICAgICAgICAgIGlmICh2YWx1ZSA9PT0gbnVsbCkge1xuICAgICAgICAgICAgICAgIHZhbHVlID0gdW5kZWZpbmVkO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgdmFsdWUgPSB2YWx1ZVsxXTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIG9wdGlvbnMuZGF0YS51cmlfcGFyYW1zW3BhcmFtLnRvTG93ZXJDYXNlKCldID0gdmFsdWU7XG4gICAgICAgIH0sXG4gICAgICAgIGZ1bmN0aW9uIChobmFtZSwgaHZhbHVlKSB7XG4gICAgICAgICAgICBobmFtZSA9IGhuYW1lLmpvaW4oJycpLnRvTG93ZXJDYXNlKCk7XG4gICAgICAgICAgICBodmFsdWUgPSBodmFsdWUuam9pbignJyk7XG4gICAgICAgICAgICBvcHRpb25zID0gb3B0aW9ucyB8fCB7IGRhdGE6IHt9IH07XG4gICAgICAgICAgICBpZiAoIW9wdGlvbnMuZGF0YS51cmlfaGVhZGVycylcbiAgICAgICAgICAgICAgICBvcHRpb25zLmRhdGEudXJpX2hlYWRlcnMgPSB7fTtcbiAgICAgICAgICAgIGlmICghb3B0aW9ucy5kYXRhLnVyaV9oZWFkZXJzW2huYW1lXSkge1xuICAgICAgICAgICAgICAgIG9wdGlvbnMuZGF0YS51cmlfaGVhZGVyc1tobmFtZV0gPSBbaHZhbHVlXTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgIG9wdGlvbnMuZGF0YS51cmlfaGVhZGVyc1tobmFtZV0ucHVzaChodmFsdWUpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICBvcHRpb25zID0gb3B0aW9ucyB8fCB7IGRhdGE6IHt9IH07XG4gICAgICAgICAgICAvLyBsb3RzIG9mIHRlc3RzIGZhaWwgaWYgdGhpcyBpc24ndCBndWFyZGVkLi4uXG4gICAgICAgICAgICBpZiAob3B0aW9ucy5zdGFydFJ1bGUgPT09ICdSZWZlcl9UbycpIHtcbiAgICAgICAgICAgICAgICBvcHRpb25zLmRhdGEudXJpID0gbmV3IFVSSShvcHRpb25zLmRhdGEuc2NoZW1lLCBvcHRpb25zLmRhdGEudXNlciwgb3B0aW9ucy5kYXRhLmhvc3QsIG9wdGlvbnMuZGF0YS5wb3J0LCBvcHRpb25zLmRhdGEudXJpX3BhcmFtcywgb3B0aW9ucy5kYXRhLnVyaV9oZWFkZXJzKTtcbiAgICAgICAgICAgICAgICBkZWxldGUgb3B0aW9ucy5kYXRhLnNjaGVtZTtcbiAgICAgICAgICAgICAgICBkZWxldGUgb3B0aW9ucy5kYXRhLnVzZXI7XG4gICAgICAgICAgICAgICAgZGVsZXRlIG9wdGlvbnMuZGF0YS5ob3N0O1xuICAgICAgICAgICAgICAgIGRlbGV0ZSBvcHRpb25zLmRhdGEuaG9zdF90eXBlO1xuICAgICAgICAgICAgICAgIGRlbGV0ZSBvcHRpb25zLmRhdGEucG9ydDtcbiAgICAgICAgICAgICAgICBkZWxldGUgb3B0aW9ucy5kYXRhLnVyaV9wYXJhbXM7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIFwiLy9cIixcbiAgICAgICAgcGVnJGxpdGVyYWxFeHBlY3RhdGlvbihcIi8vXCIsIGZhbHNlKSxcbiAgICAgICAgZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgb3B0aW9ucy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B7XG4gICAgICAgICAgICB2YXIgaWR4LCBsZW5ndGg7XG4gICAgICAgICAgICBvcHRpb25zID0gb3B0aW9ucyB8fCB7IGRhdGE6IHt9IH07XG4gICAgICAgICAgICBsZW5ndGggPSBvcHRpb25zLmRhdGEubXVsdGlfaGVhZGVyLmxlbmd0aDtcbiAgICAgICAgICAgIGZvciAoaWR4ID0gMDsgaWR4IDwgbGVuZ3RoOyBpZHgrKykge1xuICAgICAgICAgICAgICAgIGlmIChvcHRpb25zLmRhdGEubXVsdGlfaGVhZGVyW2lkeF0ucGFyc2VkID09PSBudWxsKSB7XG4gICAgICAgICAgICAgICAgICAgIG9wdGlvbnMuZGF0YSA9IG51bGw7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChvcHRpb25zLmRhdGEgIT09IG51bGwpIHtcbiAgICAgICAgICAgICAgICBvcHRpb25zLmRhdGEgPSBvcHRpb25zLmRhdGEubXVsdGlfaGVhZGVyO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgb3B0aW9ucy5kYXRhID0gLTE7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgIHZhciBoZWFkZXI7XG4gICAgICAgICAgICBvcHRpb25zID0gb3B0aW9ucyB8fCB7IGRhdGE6IHt9IH07XG4gICAgICAgICAgICBpZiAoIW9wdGlvbnMuZGF0YS5tdWx0aV9oZWFkZXIpXG4gICAgICAgICAgICAgICAgb3B0aW9ucy5kYXRhLm11bHRpX2hlYWRlciA9IFtdO1xuICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICBoZWFkZXIgPSBuZXcgTmFtZUFkZHJIZWFkZXIob3B0aW9ucy5kYXRhLnVyaSwgb3B0aW9ucy5kYXRhLmRpc3BsYXlOYW1lLCBvcHRpb25zLmRhdGEucGFyYW1zKTtcbiAgICAgICAgICAgICAgICBkZWxldGUgb3B0aW9ucy5kYXRhLnVyaTtcbiAgICAgICAgICAgICAgICBkZWxldGUgb3B0aW9ucy5kYXRhLmRpc3BsYXlOYW1lO1xuICAgICAgICAgICAgICAgIGRlbGV0ZSBvcHRpb25zLmRhdGEucGFyYW1zO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgY2F0Y2ggKGUpIHtcbiAgICAgICAgICAgICAgICBoZWFkZXIgPSBudWxsO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgb3B0aW9ucy5kYXRhLm11bHRpX2hlYWRlci5wdXNoKHsgJ3Bvc2l0aW9uJzogcGVnJGN1cnJQb3MsXG4gICAgICAgICAgICAgICAgJ29mZnNldCc6IGxvY2F0aW9uKCkuc3RhcnQub2Zmc2V0LFxuICAgICAgICAgICAgICAgICdwYXJzZWQnOiBoZWFkZXJcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9LFxuICAgICAgICBmdW5jdGlvbiAoZGlzcGxheU5hbWUpIHtcbiAgICAgICAgICAgIGRpc3BsYXlOYW1lID0gdGV4dCgpLnRyaW0oKTtcbiAgICAgICAgICAgIGlmIChkaXNwbGF5TmFtZVswXSA9PT0gJ1xcXCInKSB7XG4gICAgICAgICAgICAgICAgZGlzcGxheU5hbWUgPSBkaXNwbGF5TmFtZS5zdWJzdHJpbmcoMSwgZGlzcGxheU5hbWUubGVuZ3RoIC0gMSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBvcHRpb25zID0gb3B0aW9ucyB8fCB7IGRhdGE6IHt9IH07XG4gICAgICAgICAgICBvcHRpb25zLmRhdGEuZGlzcGxheU5hbWUgPSBkaXNwbGF5TmFtZTtcbiAgICAgICAgfSxcbiAgICAgICAgXCJxXCIsXG4gICAgICAgIHBlZyRsaXRlcmFsRXhwZWN0YXRpb24oXCJxXCIsIHRydWUpLFxuICAgICAgICBmdW5jdGlvbiAocSkge1xuICAgICAgICAgICAgb3B0aW9ucyA9IG9wdGlvbnMgfHwgeyBkYXRhOiB7fSB9O1xuICAgICAgICAgICAgaWYgKCFvcHRpb25zLmRhdGEucGFyYW1zKVxuICAgICAgICAgICAgICAgIG9wdGlvbnMuZGF0YS5wYXJhbXMgPSB7fTtcbiAgICAgICAgICAgIG9wdGlvbnMuZGF0YS5wYXJhbXNbJ3EnXSA9IHE7XG4gICAgICAgIH0sXG4gICAgICAgIFwiZXhwaXJlc1wiLFxuICAgICAgICBwZWckbGl0ZXJhbEV4cGVjdGF0aW9uKFwiZXhwaXJlc1wiLCB0cnVlKSxcbiAgICAgICAgZnVuY3Rpb24gKGV4cGlyZXMpIHtcbiAgICAgICAgICAgIG9wdGlvbnMgPSBvcHRpb25zIHx8IHsgZGF0YToge30gfTtcbiAgICAgICAgICAgIGlmICghb3B0aW9ucy5kYXRhLnBhcmFtcylcbiAgICAgICAgICAgICAgICBvcHRpb25zLmRhdGEucGFyYW1zID0ge307XG4gICAgICAgICAgICBvcHRpb25zLmRhdGEucGFyYW1zWydleHBpcmVzJ10gPSBleHBpcmVzO1xuICAgICAgICB9LFxuICAgICAgICBmdW5jdGlvbiAoZGVsdGFfc2Vjb25kcykge1xuICAgICAgICAgICAgcmV0dXJuIHBhcnNlSW50KGRlbHRhX3NlY29uZHMuam9pbignJykpO1xuICAgICAgICB9LFxuICAgICAgICBcIjBcIixcbiAgICAgICAgcGVnJGxpdGVyYWxFeHBlY3RhdGlvbihcIjBcIiwgZmFsc2UpLFxuICAgICAgICBmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICByZXR1cm4gcGFyc2VGbG9hdCh0ZXh0KCkpO1xuICAgICAgICB9LFxuICAgICAgICBmdW5jdGlvbiAocGFyYW0sIHZhbHVlKSB7XG4gICAgICAgICAgICBvcHRpb25zID0gb3B0aW9ucyB8fCB7IGRhdGE6IHt9IH07XG4gICAgICAgICAgICBpZiAoIW9wdGlvbnMuZGF0YS5wYXJhbXMpXG4gICAgICAg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iAgICAgICAgZnVuY3Rpb24gKHJhY2tfdmFsdWUpIHtcbiAgICAgICAgICAgIG9wdGlvbnMgPSBvcHRpb25zIHx8IHsgZGF0YToge30gfTtcbiAgICAgICAgICAgIG9wdGlvbnMuZGF0YS52YWx1ZSA9IHBhcnNlSW50KHJhY2tfdmFsdWUuam9pbignJykpO1xuICAgICAgICB9LFxuICAgICAgICBmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICB2YXIgaWR4LCBsZW5ndGg7XG4gICAgICAgICAgICBvcHRpb25zID0gb3B0aW9ucyB8fCB7IGRhdGE6IHt9IH07XG4gICAgICAgICAgICBsZW5ndGggPSBvcHRpb25zLmRhdGEubXVsdGlfaGVhZGVyLmxlbmd0aDtcbiAgICAgICAgICAgIGZvciAoaWR4ID0gMDsgaWR4IDwgbGVuZ3RoOyBpZHgrKykge1xuICAgICAgICAgICAgICAgIGlmIChvcHRpb25zLmRhdGEubXVsdGlfaGVhZGVyW2lkeF0ucGFyc2VkID09PSBudWxsKSB7XG4gICAgICAgICAgICAgICAgICAgIG9wdGlvbnMuZGF0YSA9IG51bGw7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChvcHRpb25zLmRhdGEgIT09IG51bGwpIHtcbiAgICAgICAgICAgICAgICBvcHRpb25zLmRhdGEgPSBvcHRpb25zLmRhdGEubXVsdGlfaGVhZGVyO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgb3B0aW9ucy5kYXRhID0gLTE7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgIHZhciBoZWFkZXI7XG4gICAgICAgICAgICBvcHRpb25zID0gb3B0aW9ucyB8fCB7IGRhdGE6IHt9IH07XG4gICAgICAgICAgICBpZiAoIW9wdGlvbnMuZGF0YS5tdWx0aV9oZWFkZXIpXG4gICAgICAgICAgICAgICAgb3B0aW9ucy5kYXRhLm11bHRpX2hlYWRlciA9IFtdO1xuICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICBoZWFkZXIgPSBuZXcgTmFtZUFkZHJIZWFkZXIob3B0aW9ucy5kYXRhLnVyaSwgb3B0aW9ucy5kYXRhLmRpc3BsYXlOYW1lLCBvcHRpb25zLmRhdGEucGFyYW1zKTtcbiAgICAgICAgICAgICAgICBkZWxldGUgb3B0aW9ucy5kYXRhLnVyaTtcbiAgICAgICAgICAgICAgICBkZWxldGUgb3B0aW9ucy5kYXRhLmRpc3BsYXlOYW1lO1xuICAgICAgICAgICAgICAgIGRlbGV0ZSBvcHRpb25zLmRhdGEucGFyYW1zO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgY2F0Y2ggKGUpIHtcbiAgICAgICAgICAgICAgICBoZWFkZXIgPSBudWxsO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgb3B0aW9ucy5kYXRhLm11bHRpX2hlYWRlci5wdXNoKHsgJ3Bvc2l0aW9uJzogcGVnJGN1cnJQb3MsXG4gICAgICAgICAgICAgICAgJ29mZnNldCc6IGxvY2F0aW9uKCkuc3RhcnQub2Zmc2V0LFxuICAgICAgICAgICAgICAgICdwYXJzZWQnOiBoZWFkZXJcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9LFxuICAgICAgICBmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICBvcHRpb25zID0gb3B0aW9ucyB8fCB7IGRhdGE6IHt9IH07XG4gICAgICAgICAgICBvcHRpb25zLmRhdGEgPSBuZXcgTmFtZUFkZHJIZWFkZXIob3B0aW9ucy5kYXRhLnVyaSwgb3B0aW9ucy5kYXRhLmRpc3BsYXlOYW1lLCBvcHRpb25zLmRhdGEucGFyYW1zKTtcbiAgICAgICAgfSxcbiAgICAgICAgZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgb3B0aW9ucyA9IG9wdGlvbnMgfHwgeyBkYXRhOiB7fSB9O1xuICAgICAgICAgICAgaWYgKCEob3B0aW9ucy5kYXRhLnJlcGxhY2VzX2Zyb21fdGFnICYmIG9wdGlvbnMuZGF0YS5yZXBsYWNlc190b190YWcpKSB7XG4gICAgICAgICAgICAgICAgb3B0aW9ucy5kYXRhID0gLTE7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgIG9wdGlvbnMgPSBvcHRpb25zIHx8IHsgZGF0YToge30gfTtcbiAgICAgICAgICAgIG9wdGlvbnMuZGF0YSA9IHtcbiAgICAgICAgICAgICAgICBjYWxsX2lkOiBvcHRpb25zLmRhdGFcbiAgICAgICAgICAgIH07XG4gICAgICAgIH0sXG4gICAgICAgIFwiZnJvbS10YWdcIixcbiAgICAgICAgcGVnJGxpdGVyYWxFeHBlY3RhdGlvbihcImZyb20tdGFnXCIsIHRydWUpLFxuICAgICAgICBmdW5jdGlvbiAoZnJvbV90YWcpIHtcbiAgICAgICAgICAgIG9wdGlvbnMgPSBvcHRpb25zIHx8IHsgZGF0YToge30gfTtcbiAgICAgICAgICAgIG9wdGlvbnMuZGF0YS5yZXBsYWNlc19mcm9tX3RhZyA9IGZyb21fdGFnO1xuICAgICAgICB9LFxuICAgICAgICBcInRvLXRhZ1wiLFxuICAgICAgICBwZWckbGl0ZXJhbEV4cGVjdGF0aW9uKFwidG8tdGFnXCIsIHRydWUpLFxuICAgICAgICBmdW5jdGlvbiAodG9fdGFnKSB7XG4gICAgICAgICAgICBvcHRpb25zID0gb3B0aW9ucyB8fCB7IGRhdGE6IHt9IH07XG4gICAgICAgICAgICBvcHRpb25zLmRhdGEucmVwbGFjZXNfdG9fdGFnID0gdG9fdGFnO1xuICAgICAgICB9LFxuICAgICAgICBcImVhcmx5LW9ubHlcIixcbiAgICAgICAgcGVnJGxpdGVyYWxFeHBlY3RhdGlvbihcImVhcmx5LW9ubHlcIiwgdHJ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gICAgICAgICAgIHdoaWxlICghcGVnJHBvc0RldGFpbHNDYWNoZVtwXSkge1xuICAgICAgICAgICAgICAgIHAtLTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGRldGFpbHMgPSBwZWckcG9zRGV0YWlsc0NhY2hlW3BdO1xuICAgICAgICAgICAgZGV0YWlscyA9IHtcbiAgICAgICAgICAgICAgICBsaW5lOiBkZXRhaWxzLmxpbmUsXG4gICAgICAgICAgICAgICAgY29sdW1uOiBkZXRhaWxzLmNvbHVtblxuICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIHdoaWxlIChwIDwgcG9zKSB7XG4gICAgICAgICAgICAgICAgaWYgKGlucHV0LmNoYXJDb2RlQXQocCkgPT09IDEwKSB7XG4gICAgICAgICAgICAgICAgICAgIGRldGFpbHMubGluZSsrO1xuICAgICAgICAgICAgICAgICAgICBkZXRhaWxzLmNvbHVtbiA9IDE7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBkZXRhaWxzLmNvbHVtbisrO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBwKys7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBwZWckcG9zRGV0YWlsc0NhY2hlW3Bvc10gPSBkZXRhaWxzO1xuICAgICAgICAgICAgcmV0dXJuIGRldGFpbHM7XG4gICAgICAgIH1cbiAgICB9XG4gICAgZnVuY3Rpb24gcGVnJGNvbXB1dGVMb2NhdGlvbihzdGFydFBvcywgZW5kUG9zKSB7XG4gICAgICAgIGNvbnN0IHN0YXJ0UG9zRGV0YWlscyA9IHBlZyRjb21wdXRlUG9zRGV0YWlscyhzdGFydFBvcyk7XG4gICAgICAgIGNvbnN0IGVuZFBvc0RldGFpbHMgPSBwZWckY29tcHV0ZVBvc0RldGFpbHMoZW5kUG9zKTtcbiAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgIHNvdXJjZTogcGVnJHNvdXJjZSxcbiAgICAgICAgICAgIHN0YXJ0OiB7XG4gICAgICAgICAgICAgICAgb2Zmc2V0OiBzdGFydFBvcyxcbiAgICAgICAgICAgICAgICBsaW5lOiBzdGFydFBvc0RldGFpbHMubGluZSxcbiAgICAgICAgICAgICAgICBjb2x1bW46IHN0YXJ0UG9zRGV0YWlscy5jb2x1bW5cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBlbmQ6IHtcbiAgICAgICAgICAgICAgICBvZmZzZXQ6IGVuZFBvcyxcbiAgICAgICAgICAgICAgICBsaW5lOiBlbmRQb3NEZXRhaWxzLmxpbmUsXG4gICAgICAgICAgICAgICAgY29sdW1uOiBlbmRQb3NEZXRhaWxzLmNvbHVtblxuICAgICAgICAgICAgfVxuICAgICAgICB9O1xuICAgIH1cbiAgICBmdW5jdGlvbiBwZWckZmFpbChleHBlY3RlZDEpIHtcbiAgICAgICAgaWYgKHBlZyRjdXJyUG9zIDwgcGVnJG1heEZhaWxQb3MpIHtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuICAgICAgICBpZiAocGVnJGN1cnJQb3MgPiBwZWckbWF4RmFpbFBvcykge1xuICAgICAgICAgICAgcGVnJG1heEZhaWxQb3MgPSBwZWckY3VyclBvcztcbiAgICAgICAgICAgIHBlZyRtYXhGYWlsRXhwZWN0ZWQgPSBbXTtcbiAgICAgICAgfVxuICAgICAgICBwZWckbWF4RmFpbEV4cGVjdGVkLnB1c2goZXhwZWN0ZWQxKTtcbiAgICB9XG4gICAgZnVuY3Rpb24gcGVnJGJ1aWxkU2ltcGxlRXJyb3IobWVzc2FnZSwgbG9jYXRpb24xKSB7XG4gICAgICAgIHJldHVybiBuZXcgU3ludGF4RXJyb3IobWVzc2FnZSwgW10sIFwiXCIsIGxvY2F0aW9uMSk7XG4gICAgfVxuICAgIGZ1bmN0aW9uIHBlZyRidWlsZFN0cnVjdHVyZWRFcnJvcihleHBlY3RlZDEsIGZvdW5kLCBsb2NhdGlvbjEpIHtcbiAgICAgICAgcmV0dXJuIG5ldyBTeW50YXhFcnJvcihTeW50YXhFcnJvci5idWlsZE1lc3NhZ2UoZXhwZWN0ZWQxLCBmb3VuZCksIGV4cGVjdGVkMSwgZm91bmQsIGxvY2F0aW9uMSk7XG4gICAgfVxuICAgIGZ1bmN0aW9uIHBlZyRkZWNvZGUocykge1xuICAgICAgICByZXR1cm4gcy5zcGxpdChcIlwiKS5tYXAoKGNoKSA9PiBjaC5jaGFyQ29kZUF0KDApIC0gMzIpO1xuICAgIH1cbiAgICBmdW5jdGlvbiBwZWckcGFyc2VSdWxlKGluZGV4KSB7XG4gICAgICAgIGNvbnN0IGJjID0gcGVnJGJ5dGVjb2RlW2luZGV4XTtcbiAgICAgICAgbGV0IGlwID0gMDtcbiAgICAgICAgY29uc3QgaXBzID0gW107XG4gICAgICAgIGxldCBlbmQgPSBiYy5sZW5ndGg7XG4gICAgICAgIGNvbnN0IGVuZHMgPSBbXTtcbiAgICAgICAgY29uc3Qgc3RhY2sgPSBbXTtcbiAgICAgICAgbGV0IHBhcmFtcztcbiAgICAgICAgd2hpbGUgKHRydWUpIHtcbiAgICAgICAgICAgIHdoaWxlIChpcCA8IGVuZCkge1xuICAgICAgICAgICAgICAgIHN3aXRjaCAoYmNbaXBdKSB7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgMDpcbiAgICAgICAgICAgICAgICAgICAgICAgIHN0YWNrLnB1c2gocGVnJGNvbnN0c1tiY1tpcCArIDFdXSk7XG4gICAgICAgICAgICAgICAgICAgICAgICBpcCArPSAyO1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgICAgIHN0YWNrLnB1c2godW5kZWZpbmVkKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlwKys7XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICAgICAgc3RhY2sucHVzaChudWxsKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlwKys7XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICAgICAgc3RhY2sucHVzaChwZWckRkFJTEVEKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlwKys7XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICAgICAgc3RhY2sucHVzaChbXSk7XG4gICAgICAgICAgICAgICAgICAgICAgICBpcCsrO1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgICAgICAgICAgIHN0YWNrLnB1c2gocGVnJGN1cnJQb3MpO1xuICAgICAgICAgICAgICAgICAgICAgICAgaXArKztcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICBjYXNlIDY6XG4gICAgICAgICAgICAgICAgICAgICAgICBzdGFjay5wb3AoKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlwKys7XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgY2FzZSA3OlxuICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzdGFjay5wb3AoKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlwKys7XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgY2FzZSA4OlxuICAgICAgICAgICAgICAgICAgICAgICAgc3RhY2subGVuZ3RoIC09IGJjW2lwICsgMV07XG4gICAgICAgICAgICAgICAgICAgICAgICBpcCArPSAyO1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgOTpcbiAgICAgICAgICAgICAgICAgICAgICAgIHN0YWNrLnNwbGljZSgtMiwgMSk7XG4gICAgICAgICAgICAgICAgICAgICAgICBpcCsrO1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgMTA6XG4gICAgICAgICAgICAgICAgICAgICAgICBzdGFja1tzdGFjay5sZW5ndGggLSAyXS5wdXNoKHN0YWNrLnBvcCgpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlwKys7XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAxMTpcbiAgICAgICAgICAgICAgICAgICAgICAgIHN0YWNrLnB1c2goc3RhY2suc3BsaWNlKHN0YWNrLmxlbmd0aCAtIGJjW2lwICsgMV0sIGJjW2lwICsgMV0pKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlwICs9IDI7XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAxMjpcbiAgICAgICAgICAgICAgICAgICAgICAgIHN0YWNrLnB1c2goaW5wdXQuc3Vic3RyaW5nKHN0YWNrLnBvcCgpLCBwZWckY3VyclBvcykpO1xuICAgICAgICAgICAgICAgICAgICAgICAgaXArKztcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICBjYXNlIDEzOlxuICAgICAgICAgICAgICAgICAgICAgICAgZW5kcy5wdXNoKGVuZCk7XG4gICAgICAgICAgICAgICAgICAgICAgICBpcHMucHVzaChpcCArIDMgKyBiY1tpcCArIDFdICsgYmNbaXAgKyAyXSk7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoc3RhY2tbc3RhY2subGVuZ3RoIC0gMV0pIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbmQgPSBpcCArIDMgKyBiY1tpcCArIDFdO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlwICs9IDM7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbmQgPSBpcCArIDMgKyBiY1tpcCArIDFdICsgYmNbaXAgKyAyXTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpcCArPSAzICsgYmNbaXAgKyAxXTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICBjYXNlIDE0OlxuICAgICAgICAgICAgICAgICAgICAgICAgZW5kcy5wdXNoKGVuZCk7XG4gICAgICAgICAgICAgICAgICAgICAgICBpcHMucHVzaChpcCArIDMgKyBiY1tpcCArIDFdICsgYmNbaXAgKyAyXSk7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoc3RhY2tbc3RhY2subGVuZ3RoIC0gMV0gPT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbmQgPSBpcCArIDMgKyBiY1tpcCArIDFdO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlwICs9IDM7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbmQgPSBpcCArIDMgKyBiY1tpcCArIDFdICsgYmNbaXAgKyAyXTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpcCArPSAzICsgYmNbaXAgKyAxXTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICBjYXNlIDE1OlxuICAgICAgICAgICAgICAgICAgICAgICAgZW5kcy5wdXNoKGVuZCk7XG4gICAgICAgICAgICAgICAgICAgICAgICBpcHMucHVzaChpcCArIDMgKyBiY1tpcCArIDFdICsgYmNbaXAgKyAyXSk7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoc3RhY2tbc3RhY2subGVuZ3RoIC0gMV0gIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbmQgPSBpcCArIDMgKyBiY1tpcCArIDFdO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlwICs9IDM7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbmQgPSBpcCArIDMgKyBiY1tpcCArIDFdICsgYmNbaXAgKyAyXTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpcCArPSAzICsgYmNbaXAgKyAxXTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICBjYXNlIDE2OlxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHN0YWNrW3N0YWNrLmxlbmd0aCAtIDFdICE9PSBwZWckRkFJTEVEKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5kcy5wdXNoKGVuZCk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaXBzLnB1c2goaXApO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVuZCA9IGlwICsgMiArIGJjW2lwICsgMV07XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaXAgKz0gMjtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlwICs9IDIgKyBiY1tpcCArIDFdO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgMTc6XG4gICAgICAgICAgICAgICAgICAgICAgICBlbmRzLnB1c2goZW5kKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlwcy5wdXNoKGlwICsgMyArIGJjW2lwICsgMV0gKyBiY1tpcCArIDJdKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpbnB1dC5sZW5ndGggPiBwZWckY3VyclBvcykge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVuZCA9IGlwICsgMyArIGJjW2lwICsgMV07XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaXAgKz0gMztcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVuZCA9IGlwICsgMyArIGJjW2lwICsgMV0gKyBiY1tpcCArIDJdO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlwICs9IDMgKyBiY1tpcCArIDFdO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgMTg6XG4gICAgICAgICAgICAgICAgICAgICAgICBlbmRzLnB1c2goZW5kKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlwcy5wdXNoKGlwICsgNCArIGJjW2lwICsgMl0gKyBiY1tpcCArIDNdKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpbnB1dC5zdWJzdHIocGVnJGN1cnJQb3MsIHBlZyRjb25zdHNbYmNbaXAgKyAxXV0ubGVuZ3RoKSA9PT0gcGVnJGNvbnN0c1tiY1tpcCArIDFdXSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVuZCA9IGlwICsgNCArIGJjW2lwICsgMl07XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaXAgKz0gNDtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVuZCA9IGlwICsgNCArIGJjW2lwICsgMl0gKyBiY1tpcCArIDNdO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlwICs9IDQgKyBiY1tpcCArIDJdO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgMTk6XG4gICAgICAgICAgICAgICAgICAgICAgICBlbmRzLnB1c2goZW5kKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlwcy5wdXNoKGlwICsgNCArIGJjW2lwICsgMl0gKyBiY1tpcCArIDNdKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpbnB1dC5zdWJzdHIocGVnJGN1cnJQb3MsIHBlZyRjb25zdHNbYmNbaXAgKyAxXV0ubGVuZ3RoKS50b0xvd2VyQ2FzZSgpID09PSBwZWckY29uc3RzW2JjW2lwICsgMV1dKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5kID0gaXAgKyA0ICsgYmNbaXAgKyAyXTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpcCArPSA0O1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5kID0gaXAgKyA0ICsgYmNbaXAgKyAyXSArIGJjW2lwICsgM107XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaXAgKz0gNCArIGJjW2lwICsgMl07XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAyMDpcbiAgICAgICAgICAgICAgICAgICAgICAgIGVuZHMucHVzaChlbmQpO1xuICAgICAgICAgICAgICAgICAgICAgICAgaXBzLnB1c2goaXAgKyA0ICsgYmNbaXAgKyAyXSArIGJjW2lwICsgM10pO1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHBlZyRjb25zdHNbYmNbaXAgKyAxXV0udGVzdChpbnB1dC5jaGFyQXQocGVnJGN1cnJQb3MpKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVuZCA9IGlwICsgNCArIGJjW2lwICsgMl07XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaXAgKz0gNDtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVuZCA9IGlwICsgNCArIGJjW2lwICsgMl0gKyBiY1tpcCArIDNdO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlwICs9IDQgKyBiY1tpcCArIDJdO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgMjE6XG4gICAgICAgICAgICAgICAgICAgICAgICBzdGFjay5wdXNoKGlucHV0LnN1YnN0cihwZWckY3VyclBvcywgYmNbaXAgKyAxXSkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgKz0gYmNbaXAgKyAxXTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlwICs9IDI7XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAyMjpcbiAgICAgICAgICAgICAgICAgICAgICAgIHN0YWNrLnB1c2gocGVnJGNvbnN0c1tiY1tpcCArIDFdXSk7XG4gICAgICAgICAgICAgICAgICAgICAgICBwZWckY3VyclBvcyArPSBwZWckY29uc3RzW2JjW2lwICsgMV1dLmxlbmd0aDtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlwICs9IDI7XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAyMzpcbiAgICAgICAgICAgICAgICAgICAgICAgIHN0YWNrLnB1c2gocGVnJEZBSUxFRCk7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAocGVnJHNpbGVudEZhaWxzID09PSAwKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGZhaWwocGVnJGNvbnN0c1tiY1tpcCArIDFdXSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICBpcCArPSAyO1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgMjQ6XG4gICAgICAgICAgICAgICAgICAgICAgICBwZWckc2F2ZWRQb3MgPSBzdGFja1tzdGFjay5sZW5ndGggLSAxIC0gYmNbaXAgKyAxXV07XG4gICAgICAgICAgICAgICAgICAgICAgICBpcCArPSAyO1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgMjU6XG4gICAgICAgICAgICAgICAgICAgICAgICBwZWckc2F2ZWRQb3MgPSBwZWckY3VyclBvcztcbiAgICAgICAgICAgICAgICAgICAgICAgIGlwKys7XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAyNjpcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtcyA9IGJjLnNsaWNlKGlwICsgNCwgaXAgKyA0ICsgYmNbaXAgKyAzXSlcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAubWFwKGZ1bmN0aW9uIChwKSB7IHJldHVybiBzdGFja1tzdGFjay5sZW5ndGggLSAxIC0gcF07IH0pO1xuICAgICAgICAgICAgICAgICAgICAgICAgc3RhY2suc3BsaWNlKHN0YWNrLmxlbmd0aCAtIGJjW2lwICsgMl0sIGJjW2lwICsgMl0sIHBlZyRjb25zdHNbYmNbaXAgKyAxXV0uYXBwbHkobnVsbCwgcGFyYW1zKSk7XG4gICAgICAgICAgICAgICAgICAgICAgICBpcCArPSA0ICsgYmNbaXAgKyAzXTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICBjYXNlIDI3OlxuICAgICAgICAgICAgICAgICAgICAgICAgc3RhY2sucHVzaChwZWckcGFyc2VSdWxlKGJjW2lwICsgMV0pKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlwICs9IDI7XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAyODpcbiAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRzaWxlbnRGYWlscysrO1xuICAgICAgICAgICAgICAgICAgICAgICAgaXArKztcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICBjYXNlIDI5OlxuICAgICAgICAgICAgICAgICAgICAgICAgcGVnJHNpbGVudEZhaWxzLS07XG4gICAgICAgICAgICAgICAgICAgICAgICBpcCsrO1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJJbnZhbGlkIG9wY29kZTogXCIgKyBiY1tpcF0gKyBcIi5cIik7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKGVuZHMubGVuZ3RoID4gMCkge1xuICAgICAgICAgICAgICAgIGVuZCA9IGVuZHMucG9wKCk7XG4gICAgICAgICAgICAgICAgaXAgPSBpcHMucG9wKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gc3RhY2tbMF07XG4gICAgfV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ICAgICAgICB1cmlTdHJpbmcgKz0gdGhpcy5lc2NhcGVVc2VyKHVyaS51c2VyKSArIFwiQFwiO1xuICAgICAgICB9XG4gICAgICAgIHVyaVN0cmluZyArPSB1cmkuaG9zdDtcbiAgICAgICAgaWYgKHVyaS5wb3J0IHx8IHVyaS5wb3J0ID09PSAwKSB7XG4gICAgICAgICAgICB1cmlTdHJpbmcgKz0gXCI6XCIgKyB1cmkucG9ydDtcbiAgICAgICAgfVxuICAgICAgICBmb3IgKGNvbnN0IHBhcmFtZXRlciBpbiB0aGlzLnBhcmFtZXRlcnMpIHtcbiAgICAgICAgICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBuby1wcm90b3R5cGUtYnVpbHRpbnNcbiAgICAgICAgICAgIGlmICh0aGlzLnBhcmFtZXRlcnMuaGFzT3duUHJvcGVydHkocGFyYW1ldGVyKSkge1xuICAgICAgICAgICAgICAgIHVyaVN0cmluZyArPSBcIjtcIiArIHBhcmFtZXRlcjtcbiAgICAgICAgICAgICAgICBpZiAodGhpcy5wYXJhbWV0ZXJzW3BhcmFtZXRlcl0gIT09IG51bGwpIHtcbiAgICAgICAgICAgICAgICAgICAgdXJpU3RyaW5nICs9IFwiPVwiICsgdGhpcy5wYXJhbWV0ZXJzW3BhcmFtZXRlcl07XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGNvbnN0IGhlYWRlcnMgPSBbXTtcbiAgICAgICAgZm9yIChjb25zdCBoZWFkZXIgaW4gdGhpcy5oZWFkZXJzKSB7XG4gICAgICAgICAgICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgbm8tcHJvdG90eXBlLWJ1aWx0aW5zXG4gICAgICAgICAgICBpZiAodGhpcy5oZWFkZXJzLmhhc093blByb3BlcnR5KGhlYWRlcikpIHtcbiAgICAgICAgICAgICAgICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgQHR5cGVzY3JpcHQtZXNsaW50L25vLWZvci1pbi1hcnJheVxuICAgICAgICAgICAgICAgIGZvciAoY29uc3QgaWR4IGluIHRoaXMuaGVhZGVyc1toZWFkZXJdKSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBuby1wcm90b3R5cGUtYnVpbHRpbnNcbiAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMuaGVhZGVyc1toZWFkZXJdLmhhc093blByb3BlcnR5KGlkeCkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGhlYWRlcnMucHVzaChoZWFkZXIgKyBcIj1cIiArIHRoaXMuaGVhZGVyc1toZWFkZXJdW2lkeF0pO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGlmIChoZWFkZXJzLmxlbmd0aCA+IDApIHtcbiAgICAgICAgICAgIHVyaVN0cmluZyArPSBcIj9cIiArIGhlYWRlcnMuam9pbihcIiZcIik7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHVyaVN0cmluZztcbiAgICB9XG4gICAgLypcbiAgICAgKiBIZXgtZXNjYXBlIGEgU0lQIFVSSSB1c2VyLlxuICAgICAqIEBwcml2YXRlXG4gICAgICogQHBhcmFtIHtTdHJpbmd9IHVzZXJcbiAgICAgKi9cbiAgICBlc2NhcGVVc2VyKHVzZXIpIHtcbiAgICAgICAgbGV0IGRlY29kZWRVc2VyO1xuICAgICAgICAvLyBGSVhNRTogVGhpcyBpcyBjYWxsZWQgYnkgdG9TdHJpbmcgYWJvdmUgd2hpY2ggc2hvdWxkIG5ldmVyIHRocm93LCBidXRcbiAgICAgICAgLy8gZGVjb2RlVVJJQ29tcG9uZW50IGNhbiB0aHJvdyBhbmQgSSd2ZSBzZWVuIG9uZSBjYXNlIGluIHByb2R1Y3Rpb24gd2hlcmVcbiAgICAgICAgLy8gaXQgZGlkIHRocm93IHJlc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AgICAgICAgfTtcbiAgICAgICAgICAgIG1lZGlhRGVzY3MucHVzaChjdXJyZW50TWVkaWFEZXNjKTtcbiAgICAgICAgfVxuICAgICAgICBlbHNlIGlmIChjdXJyZW50TWVkaWFEZXNjKSB7XG4gICAgICAgICAgICBjb25zdCBydHBtYXAgPSAvXmE9cnRwbWFwOihcXGQrKSAoW14vXSspXFwvLy5leGVjKGxpbmUpO1xuICAgICAgICAgICAgaWYgKHJ0cG1hcCAmJiBwYXlsb2FkID09PSBydHBtYXBbMl0pIHtcbiAgICAgICAgICAgICAgICBsaW5lcy5zcGxpY2UoaSwgMSk7XG4gICAgICAgICAgICAgICAgY3VycmVudE1lZGlhRGVzYy5zdHJpcHBlZC5wdXNoKHJ0cG1hcFsxXSk7XG4gICAgICAgICAgICAgICAgY29udGludWU7IC8vIERvbid0IGluY3JlbWVudCAnaSdcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBpKys7XG4gICAgfVxuICAgIGZvciAoY29uc3QgbWVkaWFEZXNjIG9mIG1lZGlhRGVzY3MpIHtcbiAgICAgICAgY29uc3QgbWxpbmUgPSBsaW5lc1ttZWRpYURlc2MuaW5kZXhdLnNwbGl0KFwiIFwiKTtcbiAgICAgICAgLy8gSWdub3JlIHRoZSBmaXJzdCAzIHBhcmFtZXRlcnMgb2YgdGhlIG1saW5lLiBUaGUgY29kZWMgaW5mb3JtYXRpb24gaXMgYWZ0ZXIgdGhhdFxuICAgICAgICBmb3IgKGxldCBqID0gMzsgaiA8IG1saW5lLmxlbmd0aDspIHtcbiAgICAgICAgICAgIGlmIChtZWRpYURlc2Muc3RyaXBwZWQuaW5kZXhPZihtbGluZVtqXSkgIT09IC0xKSB7XG4gICAgICAgICAgICAgICAgbWxpbmUuc3BsaWNlKGosIDEpO1xuICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaisrO1xuICAgICAgICB9XG4gICAgICAgIGxpbmVzW21lZGl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Rpb25zLmRhdGFDaGFubmVsTGFiZWwpIHx8IFwiXCIsIG9wdGlvbnMgPT09IG51bGwgfHwgb3B0aW9ucyA9PT0gdm9pZCAwID8gdm9pZCAwIDogb3B0aW9ucy5kYXRhQ2hhbm5lbE9wdGlvbnMpO1xuICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5vbkRhdGFDaGFubmVsKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLm9uRGF0YUNoYW5uZWwodGhpcy5fZGF0YUNoYW5uZWwpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBQcm9taXNlLnJlc29sdmUoKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgY2F0Y2ggKGVycm9yKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBQcm9taXNlLnJlamVjdChlcnJvcik7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgY2FzZSBcImhhdmUtcmVtb3RlLW9mZmVyXCI6XG4gICAgICAgICAgICAgICAgcmV0dXJuIFByb21pc2UucmVzb2x2ZSgpO1xuICAgICAgICAgICAgY2FzZSBcImhhdmUtbG9jYWwtb2ZmZXJcIjpcbiAgICAgICAgICAgIGNhc2UgXCJoYXZlLWxvY2FsLXByYW5zd2VyXCI6XG4gICAgICAgICAgICBjYXNlIFwiaGF2ZS1yZW1vdGUtcHJhbnN3ZXJcIjpcbiAgICAgICAgICAgIGNhc2UgXCJjbG9zZWRcIjpcbiAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgcmV0dXJuIFByb21pc2UucmVqZWN0KG5ldyBFcnJvcihcIkludmFsaWQgc2lnbmFsaW5nIHN0YXRlIFwiICsgdGhpcy5fcGVlckNvbm5lY3Rpb24uc2lnbmFsaW5nU3RhdGUpKTtcbiAgICAgICAgfVxuICAgIH1cbiAgICAvKipcbiAgICAgKiBEZXBlbmRpbmcgb24gY3VycmVudCBzaW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ycygpLmZpbmQoKHNlbmRlcikgPT4gc2VuZGVyLnRyYWNrICYmIHNlbmRlci50cmFjay5raW5kID09PSBraW5kKTtcbiAgICAgICAgICAgIGlmIChzZW5kZXIpIHtcbiAgICAgICAgICAgICAgICB0cmFja1VwZGF0ZXMucHVzaChuZXcgUHJvbWlzZSgocmVzb2x2ZSkgPT4ge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5kZWJ1ZyhgU2Vzc2lvbkRlc2NyaXB0aW9uSGFuZGxlci5zZXRMb2NhbE1lZGlhU3RyZWFtIC0gcmVwbGFjaW5nIHNlbmRlciAke2tpbmR9IHRyYWNrYCk7XG4gICAgICAgICAgICAgICAgICAgIHJlc29sdmUoKTtcbiAgICAgICAgICAgICAgICB9KS50aGVuKCgpID0+IHNlbmRlclxuICAgICAgICAgICAgICAgICAgICAucmVwbGFjZVRyYWNrKG5ld1RyYWNrKVxuICAgICAgICAgICAgICAgICAgICAudGhlbigoKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IG9sZFRyYWNrID0gbG9jYWxTdHJlYW0uZ2V0VHJhY2tzKCkuZmluZCgobG9jYWxUcmFjaykgPT4gbG9jYWxUcmFjay5raW5kID09PSBraW5kKTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKG9sZFRyYWNrKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBvbGRUcmFjay5zdG9wKCk7XG4gICAgICAgICAgICAgICAgICAgICAgICBsb2NhbFN0cmVhbS5yZW1vdmVUcmFjayhvbGRUcmFjayk7XG4gICAgICAgICAgICAgICAgICAgICAgICBTZXNzaW9uRGVzY3JpcHRpb25IYW5kbGVyLmRpc3BhdGNoUmVtb3ZlVHJhY2tFdmVudChsb2NhbFN0cmVhbSwgb2xkVHJhY2spO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGxvY2FsU3RyZWFtLmFkZFRyYWNrKG5ld1RyYWNrKTtcbiAgICAgICAgICAgICAgICAgICAgU2Vzc2lvbkRlc2NyaXB0aW9uSGFuZGxlci5kaXNwYXRjaEFkZFRyYWNrRXZlbnQobG9jYWxTdHJlYW0sIG5ld1RyYWNrKTtcbiAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgICAgICAgICAuY2F0Y2goKGVycm9yKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLmVycm9yKGBTZXNzaW9uRGVzY3JpcHRpb25IYW5kbGVyLnNldExvY2FsTWVkaWFTdHJlYW0gLSBmYWlsZWQgdG8gcmVwbGFjZSBzZW5kZXIgJHtraW5kfSB0cmFja2ApO1xuICAgICAgICAgICAgICAgICAgICB0aHJvdyBlcnJvcjtcbiAgICAgICAgICAgICAgICB9KSkpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgdHJhY2tVcGRhdGVzLnB1c2gobmV3IFByb21pc2UoKHJlc29sdmUpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIuZGVidWcoYFNlc3Npb25EZXNjcmlwdGlvbkhhbmRsZXIuc2V0TG9jYWxNZWRpYVN0cmVhbSAtIGFkZGluZyBzZW5kZXIgJHtraW5kfSB0cmFja2ApO1xuICAgICAgICAgICAgICAgICAgICByZXNvbHZlKCk7XG4gICAgICAgICAgICAgICAgfSkudGhlbigoKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgIC8vIFJldmlldzogY291bGQgbWFrZSBzdHJlYW1sZXNzIHRyYWNrcyBhIGNvbmZpZ3VyYWJsZSBvcHRpb24/XG4gICAgICAgICAgICAgICAgICAgIC8vIGh0dHBzOi8vZGV2ZWxvcGVyLm1vemlsbGEub3JnL2VuLVVTL2RvY3MvV2ViL0FQSS9SVENQZWVyQ29ubmVjdGlvbi9hZGRUcmFjayNVc2FnZV9ub3Rlc1xuICAgICAgICAgICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgICAgICAgICAgcGMuYWRkVHJhY2sobmV3VHJhY2ssIGxvY2FsU3RyZWFtKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBjYXRjaCAoZXJyb3IpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLmVycm9yKGBTZXNzaW9uRGVzY3JpcHRpb25IYW5kbGVyLnNldExvY2FsTWVkaWFTdHJlYW0gLSBmYWlsZWQgdG8gYWRkIHNlbmRlciAke2tpbmR9IHRyYWNrYCk7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBlcnJvcjtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBsb2NhbFN0cmVhbS5hZGRUcmFjayhuZXdUcmFjayk7XG4gICAgICAgICAgICAgICAgICAgIFNlc3Npb25EZXNjcmlwdGlvbkhhbmRsZXIuZGlzcGF0Y2hBZGRUcmFja0V2ZW50KGxvY2FsU3RyZWFtLCBuZXdUcmFjayk7XG4gICAgICAgICAgICAgICAgfSkpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9O1xuICAgICAgICAvLyB1cGRhdGUgcGVlciBjb25uZWN0aW9uIGF1ZGlvIHRyYWNrc1xuICAgICAgICBjb25zdCBhdWRpb1RyYWNrcyA9IHN0cmVhbS5nZXRBdWRpb1RyYWNrcygpO1xuICAgICAgICBpZiAoYXVkaW9UcmFja3MubGVuZ3RoKSB7XG4gICAgICAgICAgICB1cGRhdGVUcmFjayhhdWRpb1RyYWNrc1swXSk7XG4gICAgICAgIH1cbiAgICAgICAgLy8gdXBkYXRlIHBlZXIgY29ubmVjdGlvbiB2aWRlbyB0cmFja3NcbiAgICAgICAgY29uc3QgdmlkZW9UcmFja3MgPSBzdHJlYW0uZ2V0VmlkZW9UcmFja3MoKTtcbiAgICAgICAgaWYgKHZpZGVvVHJhY2tzLmxlbmd0aCkge1xuICAgICAgICAgICAgdXBkYXRlVHJhY2sodmlkZW9UcmFja3NbMF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dXJyZW50RGlyZWN0aW9uKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBcImluYWN0aXZlXCI6XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAob3B0aW9ucyA9PT0gbnVsbCB8fCBvcHRpb25zID09PSB2b2lkIDAgPyB2b2lkIDAgOiBvcHRpb25zLmhvbGQpID8gXCJpbmFjdGl2ZVwiIDogXCJyZWN2b25seVwiO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgXCJyZWN2b25seVwiOlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKG9wdGlvbnMgPT09IG51bGwgfHwgb3B0aW9ucyA9PT0gdm9pZCAwID8gdm9pZCAwIDogb3B0aW9ucy5ob2xkKSA/IFwiaW5hY3RpdmVcIiA6IFwicmVjdm9ubHlcIjtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFwic2VuZG9ubHlcIjpcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChvcHRpb25zID09PSBudWxsIHx8IG9wdGlvbnMgPT09IHZvaWQgMCA/IHZvaWQgMCA6IG9wdGlvbnMuaG9sZCkgPyBcInNlbmRvbmx5XCIgOiBcInNlbmRyZWN2XCI7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBcInNlbmRyZWN2XCI6XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAob3B0aW9ucyA9PT0gbnVsbCB8fCBvcHRpb25zID09PSB2b2lkIDAgPyB2b2lkIDAgOiBvcHRpb25zLmhvbGQpID8gXCJzZW5kb25seVwiIDogXCJzZW5kcmVjdlwiO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgXCJzdG9wcGVkXCI6XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcInN0b3BwZWRcIjtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJTaG91bGQgbmV2ZXIgaGFwcGVuXCIpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgICAgICAvLyBzZXQgdGhlIHRyYW5zY2VpdmVyIGRpcmVjdGlvbiB0byB0aGUgb2ZmZXIgZGlyZWN0aW9uXG4gICAgICAgICAgICAgICAgICAgIHRoaXMuX3BlZXJDb25uZWN0aW9uLmdldFRyYW5zY2VpdmVycygpLmZvckVhY2goKHRyYW5zY2VpdmVyKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAodHJhbnNjZWl2ZXIuZGlyZWN0aW9uIC8qIGd1YXJkaW5nLCBidXQgc2hvdWxkIGFsd2F5cyBiZSB0cnVlICovKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgb2ZmZXJEaXJlY3Rpb24gPSBkaXJlY3Rpb25Ub09mZmVyKHRyYW5zY2VpdmVyLmRpcmVjdGlvbik7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHRyYW5zY2VpdmVyLmRpcmVjdGlvbiAhPT0gb2ZmZXJEaXJlY3Rpb24pIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhbnNjZWl2ZXIuZGlyZWN0aW9uID0gb2ZmZXJEaXJlY3Rpb247XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIFwiaGF2ZS1yZW1vdGUtb2ZmZXJcIjpcbiAgICAgICAgICAgICAgICAvLyBpZiB3ZSBoYXZlIGEgcmVtb3RlIG9mZmVyLCBhc3N1b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AgICAgICAgICAgICAgICAgICAgY29uc3Qgc2VhcmNoUmVzdWx0ID0gL2E9c2VuZHJlY3ZcXHJcXG58YT1zZW5kb25seVxcclxcbnxhPXJlY3Zvbmx5XFxyXFxufGE9aW5hY3RpdmVcXHJcXG4vLmV4ZWMoZGVzY3JpcHRpb24uc2RwKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzZWFyY2hSZXN1bHQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKHNlYXJjaFJlc3VsdFswXSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFwiYT1pbmFjdGl2ZVxcclxcblwiOlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFwiaW5hY3RpdmVcIjtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBcImE9cmVjdm9ubHlcXHJcXG5cIjpcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcInJlY3Zvbmx5XCI7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgXCJhPXNlbmRvbmx5XFxyXFxuXCI6XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXCJzZW5kb25seVwiO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFwiYT1zZW5kcmVjdlxcclxcblwiOlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFwic2VuZHJlY3ZcIjtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcIlNob3VsZCBuZXZlciBoYXBwZW5cIik7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFwic2VuZHJlY3ZcIjtcbiAgICAgICAgICAgICAgICAgICAgfSkoKTtcbiAgICAgICAgICAgICAgICAgICAgLy8gZGV0ZXJtaW5lIHRoZSBhbnN3ZXIgZGlyZWN0aW9uIGJhc2VkIG9uIHRoZSBvZmZlcmVkIGRpcmVjdGlvbiBhbmQgb3VyIGhvbGQgc3RhdGVcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgYW5zd2VyRGlyZWN0aW9uID0gKCgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAob2ZmZXJlZERpcmVjdGlvbikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgXCJpbmFjdGl2ZVwiOlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXCJpbmFjdGl2ZVwiO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgXCJyZWN2b25seVwiOlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXCJzZW5kb25seVwiO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgXCJzZW5kb25seVwiOlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKG9wdGlvbnMgPT09IG51bGwgfHwgb3B0aW9ucyA9PT0gdm9pZCAwID8gdm9pZCAwIDogb3B0aW9ucy5ob2xkKSA/IFwiaW5hY3RpdmVcIiA6IFwicmVjdm9ubHlcIjtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFwic2VuZHJlY3ZcIjpcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChvcHRpb25zID09PSBudWxsIHx8IG9wdGlvbnMgPT09IHZvaWQgMCA/IHZvaWQgMCA6IG9wdGlvbnMuaG9sZCkgPyBcInNlbmRvbmx5XCIgOiBcInNlbmRyZWN2XCI7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwiU2hvdWxkIG5ldmVyIGhhcHBlblwiKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfSkoKTtcbiAgICAgICAgICAgICAgICAgICAgLy8gc2V0IHRoZSB0cmFuc2NlaXZlciBkaXJlY3Rpb24gdG8gdGhlIGFuc3dlciBkaXJlY3Rpb25cbiAgICAgICAgICAgICAgICAgICAgdGhpcy5fcGVlckNvbm5lY3Rpb24uZ2V0VHJhbnNjZWl2ZXJzKCkuZm9yRWFjaCgodHJhbnNjZWl2ZXIpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0cmFuc2NlaXZlci5kaXJlY3Rpb24gLyogZ3VhcmRpbmcsIGJ1dCBzaG91bGQgYWx3YXlzIGJlIHRydWUgKi8pIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodHJhbnNjZWl2ZXIuZGlyZWN0aW9uICE9PSBcInN0b3BwZWRcIiAmJiB0cmFuc2NlaXZlci5kaXJlY3Rpb24gIT09IGFuc3dlckRpcmVjdGlvbikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFuc2NlaXZlci5kaXJlY3Rpb24gPSBhbnN3ZXJEaXJlY3Rpb247XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIFwiaGF2ZS1sb2NhbC1vZmZlclwiOlxuICAgICAgICAgICAgY2FzZSBcImhhdmUtbG9jYWwtcHJhbnN3ZXJcIjpcbiAgICAgICAgICAgIGNhc2UgXCJoYXZlLXJlbW90ZS1wcmFuc3dlclwiOlxuICAgICAgICAgICAgY2FzZSB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25zOiB7fSxcbiAgICAgICAgICAgIHNlbmREVE1GVXNpbmdTZXNzaW9uRGVzY3JpcHRpb25IYW5kbGVyOiBmYWxzZSxcbiAgICAgICAgICAgIHVzZXJBZ2VudE9wdGlvbnM6IHt9XG4gICAgICAgIH0sIFNlc3Npb25NYW5hZ2VyLnN0cmlwVW5kZWZpbmVkUHJvcGVydGllcyhvcHRpb25zKSk7XG4gICAgICAgIC8vIFVzZXJBZ2VudE9wdGlvbnNcbiAgICAgICAgY29uc3QgdXNlckFnZW50T3B0aW9ucyA9IE9iamVjdC5hc3NpZ24oe30sIG9wdGlvbnMudXNlckFnZW50T3B0aW9ucyk7XG4gICAgICAgIC8vIFRyYW5zcG9ydFxuICAgICAgICBpZiAoIXVzZXJBZ2VudE9wdGlvbnMudHJhbnNwb3J0Q29uc3RydWN0b3IpIHtcbiAgICAgICAgICAgIHVzZXJBZ2VudE9wdGlvbnMudHJhbnNwb3J0Q29uc3RydWN0b3IgPSBUcmFuc3BvcnQ7XG4gICAgICAgIH1cbiAgICAgICAgLy8gVHJhbnNwb3J0T3B0aW9uc1xuICAgICAgICBpZiAoIXVzZXJBZ2VudE9wdGlvbnMudHJhbnNwb3J0T3B0aW9ucykge1xuICAgICAgICAgICAgdXNlckFnZW50T3B0aW9ucy50cmFuc3BvcnRPcHRpb25zID0ge1xuICAgICAgICAgICAgICAgIHNlcnZlclxuICAgICAgICAgICAgfTtcbiAgICAgICAgfVxuICAgICAgICAvLyBVUklcbiAgICAgICAgaWYgKCF1c2VyQWdlbnRPcHRpb25zLnVyaSkge1xuICAgICAgICAgICAgLy8gSWYgYW4gQU9SIHdhcyBwcm92aWRlZCwgY29udmVydCBpdCB0byBhIFVSSVxuICAgICAgICAgICAgaWYgKG9wdGlvbnMuYW9yKSB7XG4gICAgICAgICAgICAgICAgY29uc3QgdXJpID0gVXNlckFnZW50Lm1ha2VVUkkob3B0aW9ucy5hb3IpO1xuICAgICAgICAgICAgICAgIGlmICghdXJpKSB7XG4gICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihgRmFpbGVkIHRvIGNyZWF0ZSB2YWxpZCBVUkkgZnJvbSAke29wdGlvbnMuYW9yfWApO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB1c2VyQWdlbnRPcHRpb25zLnVyaSA9IHVyaTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICAvLyBVc2VyQWdlbnRcbiAgICAgICAgdGhpcy51c2VyQWdlbnQgPSBuZXcgVXNlckFnZW50KHVzZXJBZ2VudE9wdGlvbnMpO1xuICAgICAgICAvLyBVc2VyQWdlbnQncyBkZWxlZ2F0ZVxuICAgICAgICB0aGlzLnVzZXJBZ2VudC5kZWxlZ2F0ZSA9IHtcbiAgICAgICAgICAgIC8vIEhhbmRsZSBjb25uZWN0aW9uIHdpdGggc2VydmVyIGVzdGFibGlzaGVkXG4gICAgICAgICAgICBvbkNvbm5lY3Q6ICgpID0+IHtcbiAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5sb2coYENvbm5lY3RlZGApO1xuICAgICAgICAgICAgICAgIGlmICh0aGlzLmRlbGVnYXRlICYmIHRoaXMuZGVsZWdhdGUub25TZXJ2ZXJDb25uZWN0KSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZGVsZWdhdGUub25TZXJ2ZXJDb25uZWN0KCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIC8vIEF0dGVtcHQgdG8gcmVnaXN0ZXIgaWYgd2UgYXJlIHN1cHBvc2VkIHRvIGJlIHJlZ2lzdGVyZWRcbiAgICAgICAgICAgICAgICBpZiAodGhpcy5zaG91bGRCZVJlZ2lzdGVyZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5yZWdpc3RlcigpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAvLyBTdGFydCBPUFRJT05TIHBpbmdzIGlmIHdlIGFyZSB0byBiZSBwaW5naW5nXG4gICAgICAgICAgICAgICAgaWYgKHRoaXMub3B0aW9ucy5vcHRpb25zUGluZ0ludGVydmFsID4gMCkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLm9wdGlvbnNQaW5nU3RhcnQoKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgLy8gSGFuZGxlIGNvbm5lY3Rpb24gd2l0aCBzZXJ2ZXIgbG9zdFxuICAgICAgICAgICAgb25EaXNjb25uZWN0OiBhc3luYyAoZXJyb3IpID0+IHtcbiAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5sb2coYERpc2Nvbm5lY3RlZGApO1xuICAgICAgICAgICAgICAgIC8vIFN0b3AgT1BUSU9OUyBwaW5nIGlmIG5lZWQgYmUuXG4gICAgICAgICAgICAgICAgbGV0IG9wdGlvbnNQaW5nRmFpbHVyZSA9IGZhbHNlO1xuICAgICAgICAgICAgICAgIGlmICh0aGlzLm9wdGlvbnMub3B0aW9uc1BpbmdJbnRlcnZhbCA+IDApIHtcbiAgICAgICAgICAgICAgICAgICAgb3B0aW9uc1BpbmdGYWlsdXJlID0gdGhpcy5vcHRpb25zUGluZ0ZhaWx1cmU7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMub3B0aW9uc1BpbmdGYWlsdXJlID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMub3B0aW9uc1BpbmdTdG9wKCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIC8vIExldCBkZWxnYXRlIGtub3cgd2UgaGF2ZSBkaXNjb25uZWN0ZWRcbiAgICAgICAgICAgICAgICBpZiAodGhpcy5kZWxlZ2F0ZSAmJiB0aGlzLmRlbGVnYXRlLm9uU2VydmVyRGlzY29ubmVjdCkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmRlbGVnYXRlLm9uU2VydmVyRGlzY29ubmVjdChlcnJvcik7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICA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2VydmVyIHdhcyBsb3N0LmApO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLmRlYnVnKGUudG9TdHJpbmcoKSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMucmVnaXN0ZXJlciA9IHVuZGVmaW5lZDtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB0aGlzLm1hbmFnZWRTZXNzaW9uc1xuICAgICAgICAgICAgICAgICAgICAgICAgLnNsaWNlKClcbiAgICAgICAgICAgICAgICAgICAgICAgIC5tYXAoKGVsKSA9PiBlbC5zZXNzaW9uKVxuICAgICAgICAgICAgICAgICAgICAgICAgLmZvckVhY2goYXN5bmMgKHNlc3Npb24pID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLmxvZyhgRGlzcG9zaW5nIG9mIHNlc3Npb24uLi5gKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlc3Npb24uZGlzcG9zZSgpLmNhdGNoKChlKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIuZGVidWcoYEVycm9yIG9jY3VycmVkIGRpc3Bvc2luZyBvZiBhIHNlc3Npb24gYWZ0ZXIgY29ubmVjdGlvbiB3aXRoIHNlcnZlciB3YXMgbG9zdC5gKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5kZWJ1ZyhlLnRvU3RyaW5nKCkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgICAvLyBBdHRlbXB0IHRvIHJlY29ubmVjdCBpZiB3ZSBhcmUgc3VwcG9zZWQgdG8gYmUgY29ubmVjdGVkLlxuICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5zaG91bGRCZUNvbm5lY3RlZCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5hdHRlbXB0UmVjb25uZWN0aW9uKCk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgLy8gSGFuZGxlIGluY29taW5nIGludml0YXRpb25zXG4gICAgICAgICAgICBvbkludml0ZTogKGludml0YXRpb24pID0+IHtcbiAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5sb2coYFske2ludml0YXRpb24uaWR9XSBSZWNlaXZlZCBJTlZJVEVgKTtcbiAgICAgICAgICAgICAgICAvLyBHdWFyZCBhZ2FpbnN0IGEgbWF4aW11bSBudW1iZXIgb2YgcHJlLWV4aXN0aW5nIHNlc3Npb25zLlxuICAgICAgICAgICAgICAgIC8vIEFuIGluY29taW5nIElOVklURSByZXF1ZXN0IG1heSBiZSByZWNlaXZlZCBhdCBhbnkgdGltZSBhbmQvb3Igd2hpbGUgaW4gdGhlIHByb2Nlc3NcbiAgICAgICAgICAgICAgICAvLyBvZiBzZW5kaW5nIGFuIG91dGdvaW5nIElOVklURSByZXF1ZXN0LiBTbyB3ZSByZWplY3QgYW55IGluY29taW5nIElOVklURSBpbiB0aG9zZSBjYXNlcy5cbiAgICAgICAgICAgICAgICBjb25zdCBtYXhTZXNzaW9ucyA9IHRoaXMub3B0aW9ucy5tYXhTaW11bHRhbmVvdXNTZXNzaW9ucztcbiAgICAgICAgICAgICAgICBpZiAobWF4U2Vzc2lvbnMgIT09IDAgJiYgdGhpcy5tYW5hZ2VkU2Vzc2lvbnMubGVuZ3RoID4gbWF4U2Vzc2lvbnMpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIud2FybihgWyR7aW52aXRhdGlvbi5pZH1dIFNlc3Npb24gYWxyZWFkeSBpbiBwcm9ncmVzcywgcmVqZWN0aW5nIElOVklURS4uLmApO1xuICAgICAgICAgICAgICAgICAgICBpbnZpdGF0aW9uXG4gICAgICAgICAgICAgICAgICAgICAgICAucmVqZWN0KClcbiAgICAgICAgICAgICAgICAgICAgICAgIC50aGVuKCgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLmxvZyhgWyR7aW52aXRhdGlvbi5pZH1dIFJlamVjdGVkIElOVklURWApO1xuICAgICAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgICAgICAgICAgICAgLmNhdGNoKChlcnJvcikgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIuZXJyb3IoYFske2ludml0YXRpb24uaWR9XSBGYWlsZWQgdG8gcmVqZWN0IElOVklURWApO1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIuZXJyb3IoZXJyb3IudG9TdHJpbmcoKSk7XG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIC8vIFVzZSBvdXIgY29uZmlndXJlZCBjb25zdHJhaW50cyBhcyBvcHRpb25zIGZvciBhbnkgSW52aXRlciBjcmVhdGVkIGFzIHJlc3VsdCBvZiBhIFJFRkVSXG4gICAgICAgICAgICAgICAgY29uc3QgcmVmZXJyYWxJbnZpdGVyT3B0aW9ucyA9IHtcbiAgICAgICAgICAgICAgICAgICAgc2Vzc2lvbkRlc2NyaXB0aW9uSGFuZGxlck9wdGlvbnM6IHsgY29uc3RyYWludHM6IHRoaXMuY29uc3RyYWludHMgfVxuICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgLy8gSW5pdGlhbGl6ZSBvdXIgc2Vzc2lvblxuICAgICAgICAgICAgICAgIHRoaXMuaW5pdFNlc3Npb24oaW52aXRhdGlvbiwgcmVmZXJyYWxJbnZpdGVyT3B0aW9ucyk7XG4gICAgICAgICAgICAgICAgLy8gRGVsZWdhdGVcbiAgICAgICAgICAgICAgICBpZiAodGhpcy5kZWxlZ2F0ZSAmJiB0aGlzLmRlbGVnYXRlLm9uQ2FsbFJlY2VpdmVkKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZGVsZWdhdGUub25DYWxsUmVjZWl2ZWQoaW52aXRhdGlvbik7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci53YXJuKGBbJHtpbnZpdGF0aW9uLmlkfV0gTm8gaGFuZGxlciBhdmFpbGFibGUsIHJlamVjdGluZyBJTlZJVEUuLi5gKTtcbiAgICAgICAgICAgICAgICAgICAgaW52aXRhdGlvblxuICAgICAgICAgICAgICAgICAgICAgICAgLnJlamVjdCgpXG4gICAgICAgICAgICAgICAgICAgICAgICAudGhlbigoKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5sb2coYFske2ludml0YXRpb24uaWR9XSBSZWplY3RlZCBJTlZJVEVgKTtcbiAgICAgICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgICAgICAgICAgIC5jYXRjaCgoZXJyb3IpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLmVycm9yKGBbJHtpbnZpdGF0aW9uLmlkfV0gRmFpbGVkIHRvIHJlamVjdCBJTlZJVEVgKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLmVycm9yKGVycm9yLnRvU3RyaW5nKCkpO1xuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgLy8gSGFuZGxlIGluY29taW5nIG1lc3NhZ2VzXG4gICAgICAgICAgICBvbk1lc3NhZ2U6IChtZXNzYWdlKSA9PiB7XG4gICAgICAgICAgICAgICAgbWVzc2FnZS5hY2NlcHQoKS50aGVuKCgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMuZGVsZW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y5kZWxlZ2F0ZSAmJiB0aGlzLmRlbGVnYXRlLm9uVW5yZWdpc3RlcmVkKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5kZWxlZ2F0ZS5vblVucmVnaXN0ZXJlZCgpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgLy8gSWYgd2UgdHJhbnNpdGlvbiB0byBhbiB1bnJlZ2lzdGVyIHN0YXRlLCBhdHRlbXB0IHRvIGdldCBiYWNrIHRvIGEgcmVnaXN0ZXJlZCBzdGF0ZS5cbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLnNob3VsZEJlUmVnaXN0ZXJlZCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuYXR0ZW1wdFJlZ2lzdHJhdGlvbigpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgUmVnaXN0ZXJlclN0YXRlLlRlcm1pbmF0ZWQ6XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcIlVua25vd24gcmVnaXN0ZXJlciBzdGF0ZS5cIik7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHRoaXMuYXR0ZW1wdFJlZ2lzdHJhdGlvbih0cnVlKTtcbiAgICB9XG4gICAgLyoqXG4gICAgICogU3RvcCByZWNlaXZpbmcgaW5jb21pbmcgY2FsbHMuXG4gICAgICogQHJlbWFya3NcbiAgICAgKiBTZW5kIGFuIHVuLVJFR0lTVEVSIHJlcXVlc3QgZm9yIHRoZSBVc2VyQWdlbnQncyBBT1IuXG4gICAgICogUmVzb2x2ZXMgd2h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lkIDAgOiBfYS50eXBlKSA9PT0gXCJzcmZseFwiKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIubG9nKGBbJHtpbnZpdGVyLmlkfV0gRm91bmQgc3JmbHggSUNFIGNhbmRpZGF0ZSwgc3RvcCB3YWl0aW5nLi4uYCk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gSW4gc2lwLmpzID4gMC4yMC4xIHRoaXMgY2FzdCBzaG91bGQgYmUgcmVtb3ZlZCBhcyBpY2VHYXRoZXJpbmdDb21wbGV0ZSB3aWxsIGJlIHB1YmxpY1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHNkaCA9IHNlc3Npb25EZXNjcmlwdGlvbkhhbmRsZXI7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2RoLmljZUdhdGhlcmluZ0NvbXBsZXRlKCk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgfTtcbiAgICAgICAgfVxuICAgICAgICAvLyBDcmVhdGUgYSBuZXcgSW52aXRlciBmb3IgdGhlIG91dGdvaW5nIFNlc3Npb25cbiAgICAgICAgY29uc3QgaW52aXRlciA9IG5ldyBJbnZpdGVyKHRoaXMudXNlckFnZW50LCB0YXJnZXQsIGludml0ZXJPcHRpb25zKTtcbiAgICAgICAgLy8gU2VuZCBJTlZJVEVcbiAgICAgICAgcmV0dXJuIHRoaXMuc2VuZEludml0ZShpbnZpdGVyLCBpbnZpdGVyT3B0aW9ucywgaW52aXRlckludml0ZU9wdGlvbnMpLnRoZW4oKCkgPT4ge1xuICAgICAgICAgICAgcmV0dXJuIGludml0ZXI7XG4gICAgICAgIH0pO1xuICAgIH1cbiAgICAvKipcbiAgICAgKiBIYW5ndXAgYSBjYWxsLlxuICAgICAqIEBwYXJhbSBzZXNzaW9uIC0gU2Vzc2lvbiB0byBoYW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gICAgICAgIC5yZWdpc3Rlckd1YXJkKClcbiAgICAgICAgICAgICAgICAuY2F0Y2goKGVycm9yKSA9PiB7XG4gICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIubG9nKGBSZWdpc3RlciBndWFyZCByZWplY3RlZCB3aWxsIG1ha2luZyByZWdpc3RyYXRpb24gYXR0ZW1wdGApO1xuICAgICAgICAgICAgICAgIHRocm93IGVycm9yO1xuICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgICAudGhlbigoaGFsdCkgPT4ge1xuICAgICAgICAgICAgICAgIGlmIChoYWx0IHx8ICF0aGlzLnJlZ2lzdGVyZXIpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFByb21pc2UucmVzb2x2ZSgpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5yZWdpc3RlcmVyLnJlZ2lzdGVyKHRoaXMucmVnaXN0ZXJlclJlZ2lzdGVyT3B0aW9ucykudGhlbigoKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9O1xuICAgICAgICAvLyBDb21wdXRlIGFuIGFtb3VudCBvZiB0aW1lIGluIHNlY29uZHMgdG8gd2FpdCBiZWZvcmUgc2VuZGluZyBhbm90aGVyIHJlZ2lzdGVyIHJlcXVlc3QuXG4gICAgICAgIC8vIFRoaXMgaXMgYSBzbWFsbCBhdHRlbXB0IHRvIGF2b2lkIERPUyBhdHRhY2tpbmcgb3VyIG93biBiYWNrZW5kIGluIHRoZSBldmVudCB0aGF0IGFcbiAgICAgICAgLy8gcmVsYXRpdmVseSBsYXJnZSBudW1iZXIgb2YgY2xpZW50cyBzeWNob25vdXNseSBrZWVwIHJldHJ5aW5nIHJlZ2lzdGVyIHJlcWV1c3RzLlxuICAgICAgICAvLyBUaGlzIGlzIGtub3duIHRvIGhhcHBlbiB3aGVuIHRoZSBiYWNrZW5kIGdvZXMgZG93biBmb3IgYSBwZXJpb2QgYW5kIGFsbCBjbGllbnRzXG4gICAgICAgIC8vIGFyZSBhdHRlbXB0aW5nIHRvIHJlZ2lzdGVyIGFnYWluIC0gdGhlIGJhY2tlbmQgZ2V0cyBzbGFtbWVkIHdpdGggc3luY2VkIHJlcWV1c3RzLlxuICAgICAgICBjb25zdCBjb21wdXRlUmVnaXN0cmF0aW9uVGltZW91dCA9IChsb3dlckJvdW5kKSA9PiB7XG4gICAgICAgICAgICBjb25zdCB1cHBlckJvdW5kID0gbG93ZXJCb3VuZCAqIDI7XG4gICAgICAgICAgICByZXR1cm4gMTAwMCAqIChNYXRoLnJhbmRvbSgpICogKHVwcGVyQm91bmQgLSBsb3dlckJvdW5kKSArIGxvd2VyQm91bmQpO1xuICAgICAgICB9O1xuICAgICAgICAvLyBTZW5kIHJlZ2lzdGVyIHJlcXVlc3QgYWZ0ZXIgYSBkZWxheVxuICAgICAgICByZXR1cm4gbmV3IFByb21pc2UoKHJlc29sdmUsIHJlamVjdCkgPT4ge1xuICAgICAgICAgICAgdGhpcy5yZWdpc3RyYXRpb25BdHRlbXB0VGltZW91dCA9IHNldFRpbWVvdXQoKCkgPT4ge1xuICAgICAgICAgICAgICAgIF9yZWdpc3RlcigpXG4gICAgICAgICAgICAgICAgICAgIC50aGVuKCgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5yZWdpc3RyYXRpb25BdHRlbXB0VGltZW91dCA9IHVuZGVmaW5lZDtcbiAgICAgICAgICAgICAgICAgICAgcmVzb2x2ZSgpO1xuICAgICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICAgICAgICAgIC5jYXRjaCgoZXJyb3IpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5yZWdpc3RyYXRpb25BdHRlbXB0VGltZW91dCA9IHVuZGVmaW5lZDtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGVycm9yIGluc3RhbmNlb2YgUmVxdWVzdFBlbmRpbmdFcnJvcikge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmVzb2x2ZSgpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmVqZWN0KGVycm9yKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfSwgd2l0aG91dERlbGF5ID8gMCA6IGNvbXB1dGVSZWdpc3RyYXRpb25UaW1lb3V0KHRoaXMub3B0aW9ucy5yZWdpc3RyYXRpb25SZXRyeUludGVydmFsKSk7XG4gICAgICAgIH0pO1xuICAgIH1cbiAgICAvKiogSGVscGVyIGZ1bmN0aW9uIHRvIHJlbW92ZSBtZWRpYSBmcm9tIGh0bWwgZWxlbWVudHMuICovXG4gICAgY2xlYW51cE1lZGlhKHNlc3Npb24pIHtcbiAgICAgICAgY29uc3QgbWFuYWdlZFNlc3Npb24gPSB0aGlzLnNlc3Npb25NYW5hZ2VkKHNlc3Npb24pO1xuICAgICAgICBpZiAoIW1hbmFnZWRTZXNzaW9uKSB7XG4gICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJNYW5hZ2VkIHNlc3Npb24gZG9lcyBub3QgZXhpc3QuXCIpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtYW5hZ2VkU2Vzc2lvbi5tZWRpYUxvY2FsKSB7XG4gICAgICAgICAgICBpZiAobWFuYWdlZFNlc3Npb24ubWVkaWFMb2NhbC52aWRlbykge1xuICAgICAgICAgICAgICAgIG1hbmFnZWRTZXNzaW9uLm1lZGlhTG9jYWwudmlkZW8uc3JjT2JqZWN0ID0gbnVsbDtcbiAgICAgICAgICAgICAgICBtYW5hZ2VkU2Vzc2lvbi5tZWRpYUxvY2FsLnZpZGVvLnBhdXNlKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1hbmFnZWRTZXNzaW9u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IFNlc3Npb25TdGF0ZS5Fc3RhYmxpc2hlZDpcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5zZXR1cExvY2FsTWVkaWEoc2Vzc2lvbik7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuc2V0dXBSZW1vdGVNZWRpYShzZXNzaW9uKTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMuZGVsZWdhdGUgJiYgdGhpcy5kZWxlZ2F0ZS5vbkNhbGxBbnN3ZXJlZCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5kZWxlZ2F0ZS5vbkNhbGxBbnN3ZXJlZChzZXNzaW9uKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIFNlc3Npb25TdGF0ZS5UZXJtaW5hdGluZzpcbiAgICAgICAgICAgICAgICAvLyBmYWxsIHRocm91Z2hcbiAgICAgICAgICAgICAgICBjYXNlIFNlc3Npb25TdGF0ZS5UZXJtaW5hdGVkOlxuICAgICAgICAgICAgICAgICAgICAvLyBUaGlzIHdpbGwgYWxyZWFkeSBoYXZlIGV4ZWN1dGVkIGlmL3doZW4gd2UgZmFsbFxuICAgICAgICAgICAgICAgICAgICAvLyB0aHJvdWdoIGZyb20gVGVybWluYXRpbmcgYW5kIHRodXMgdGhlIG1hbmFnZWRcbiAgICAgICAgICAgICAgICAgICAgLy8gc2Vzc2lvbiBtYXkgYWxyZWFkeSBoYXZlIGJlZW4gY2xlYW5lZCB1cC5cbiAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMuc2Vzc2lvbkV4aXN0cyhzZXNzaW9uKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5jbGVhbnVwTWVkaWEoc2Vzc2lvbik7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnNlc3Npb25SZW1vdmUoc2Vzc2lvbik7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAodG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GUpID09PSBudWxsIHx8IF9hID09PSB2b2lkIDAgPyB2b2lkIDAgOiBfYS5vbkNhbGxEVE1GUmVjZWl2ZWQpID09PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICBpbmZvLnJlamVjdCgpO1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIC8vIEludmFsaWQgY29udGVudCB0eXBlXG4gICAgICAgICAgICBjb25zdCBjb250ZW50VHlwZSA9IGluZm8ucmVxdWVzdC5nZXRIZWFkZXIoXCJjb250ZW50LXR5cGVcIik7XG4gICAgICAgICAgICBpZiAoIWNvbnRlbnRUeXBlIHx8ICEvXmFwcGxpY2F0aW9uXFwvZHRtZi1yZWxheS9pLmV4ZWMoY29udGVudFR5cGUpKSB7XG4gICAgICAgICAgICAgICAgaW5mby5yZWplY3QoKTtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICAvLyBJbnZhbGlkIGJvZHlcbiAgICAgICAgICAgIGNvbnN0IGJvZHkgPSBpbmZvLnJlcXVlc3QuYm9keS5zcGxpdChcIlxcclxcblwiLCAyKTtcbiAgICAgICAgICAgIGlmIChib2R5Lmxlbmd0aCAhPT0gMikge1xuICAgICAgICAgICAgICAgIGluZm8ucmVqZWN0KCk7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLy8gSW52YWxpZCB0b25lXG4gICAgICAgICAgICBsZXQgdG9uZTtcbiAgICAgICAgICAgIGNvbnN0IHRvbmVSZWdFeHAgPSAvXihTaWduYWxcXHMqPz1cXHMqPykoWzAtOUEtRCMqXXsxfSkoXFxzKT8uKi87XG4gICAgICAgICAgICBpZiAoYm9keVswXSAhPT0gdW5kZWZpbmVkICYmIHRvbmVSZWdFeHAudGVzdChib2R5WzBdKSkge1xuICAgICAgICAgICAgICAgIHRvbmUgPSBib2R5WzBdLnJlcGxhY2UodG9uZVJlZ0V4cCwgXCIkMlwiKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmICghdG9uZSkge1xuICAgICAgICAgICAgICAgIGluZm8ucmVqZWN0KCk7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLy8gSW52YWxpZCBkdXJhdGlvblxuICAgICAgICAgICAgbGV0IGR1cmF0aW9uO1xuICAgICAgICAgICAgY29uc3QgZHVyYXRpb25SZWdFeHAgPSAvXihEdXJhdGlvblxccz89XFxzPykoWzAtOV17MSw0fSkoXFxzKT8uKi87XG4gICAgICAgICAgICBpZiAoYm9keVsxXSAhPT0gdW5kZWZpbmVkICYmIGR1cmF0aW9uUmVnRXhwLnRlc3QoYm9keVsxXSkpIHtcbiAgICAgICAgICAgICAgICBkdXJhdGlvbiA9IHBhcnNlSW50KGJvZHlbMV0ucmVwbGFjZShkdXJhdGlvblJlZ0V4cCwgXCIkMlwiKSwgMTApO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKCFkdXJhdGlvbikge1xuICAgICAgICAgICAgICAgIGluZm8ucmVqZWN0KCk7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaW5mb1xuICAgICAgICAgICAgICAgIC5hY2NlcHQoKVxuICAgICAgICAgICAgICAgIC50aGVuKCgpID0+IHtcbiAgICAgICAgICAgICAgICBpZiAodGhpcy5kZWxlZ2F0ZSAmJiB0aGlzLmRlbGVnYXRlLm9uQ2FsbERUTUZSZWNlaXZlZCkge1xuICAgICAgICAgICAgICAgICAgICBpZiAoIXRvbmUgfHwgIWR1cmF0aW9uKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJUb25lIG9yIGR1cmF0aW9uIHVuZGVmaW5lZC5cIik7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgdGhpcy5kZWxlZ2F0ZS5vbkNhbGxEVE1GUmVjZWl2ZWQoc2Vzc2lvbiwgdG9uZSwgZHVyYXRpb24pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0pXG4gICAgICAgICAgICAgICAgLmNhdGNoKChlcnJvcikgPT4ge1xuICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLmVycm9yKGVycm9yLm1lc3NhZ2UpO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH07XG4gICAgICAgIHNlc3Npb24uZGVsZWdhdGUub25SZWZlciA9IChyZWZlcnJhbCkgPT4ge1xuICAgICAgICAgICAgcmVmZXJyYWxcbiAgICAgICAgICAgICAgICAuYWNjZXB0KClcbiAgICAgICAgICAgICAgICAudGhlbigoKSA9PiB0aGlzLnNlbmRJbnZpdGUocmVmZXJyYWwubWFrZUludml0ZXIocmVmZXJyYWxJbnZpdGVyT3B0aW9ucyksIHJlZmVycmFsSW52aXRlck9wdGlvbnMpKVxuICAgICAgICAgICAgICAgIC5jYXRjaCgoZXJyb3IpID0+IHtcbiAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5lcnJvcihlcnJvci5tZXNzYWdlKTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9O1xuICAgIH1cbiAgICAvKipcbiAgICAgKiBQZXJpb2RpY2FsbHkgc2VuZCBPUFRJT05TIHBpbmdzIGFuZCBkaXNjb25uZWN0IHdoZW4gYSBwaW5nIGZhaWxzLlxuICAgICAqIEBwYXJhbSByZXF1ZXN0VVJJIC0gUmVxdWVzdCBVUkkgdG8gdGFyZ2V0XG4gICAgICogQHBhcmFtIGZyb21VUkkgLSBGcm9tIFVSSVxuICAgICAqIEBwYXJhbSB0b1VSSSAtIFRvIFVSSVxuICAgICAqL1xuICAgIG9wdGlvbnNQaW5nUnVuKHJlcXVlc3RVUkksIGZyb21VUkksIHRvVVJJKSB7XG4gICAgICAgIC8vIEd1YXJkIGFnYWluc3QgbnZhbGlkIGludGVydmFsXG4gIC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ZXN0ID0gY29yZS5yZXF1ZXN0KG1lc3NhZ2UsIHtcbiAgICAgICAgICAgICAgICBvbkFjY2VwdDogKCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLm9wdGlvbnNQaW5nUmVxdWVzdCA9IHVuZGVmaW5lZDtcbiAgICAgICAgICAgICAgICAgICAgb25QaW5nU3VjY2VzcygpO1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgb25SZWplY3Q6IChyZXNwb25zZSkgPT4ge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLm9wdGlvbnNQaW5nUmVxdWVzdCA9IHVuZGVmaW5lZDtcbiAgICAgICAgICAgICAgICAgICAgLy8gUGluZyBmYWlscyBvbiBmb2xsb3dpbmcgcmVzcG9uc2VzLi4uXG4gICAgICAgICAgICAgICAgICAgIC8vIC0gNDA4IFJlcXVlc3QgVGltZW91dCAobm8gcmVzcG9uc2Ugd2FzIHJlY2VpdmVkKVxuICAgICAgICAgICAgICAgICAgICAvLyAtIDUwMyBTZXJ2aWNlIFVuYXZhaWxhYmxlIChhIHRyYW5zcG9ydCBsYXllciBlcnJvciBvY2N1cmVkKVxuICAgICAgICAgICAgICAgICAgICBpZiAocmVzcG9uc2UubWVzc2FnZS5zdGF0dXNDb2RlID09PSA0MDggfHwgcmVzcG9uc2UubWVzc2FnZS5zdGF0dXNDb2RlID09PSA1MDMpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG9uUGluZ0ZhaWx1cmUoKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG9uUGluZ1N1Y2Nlc3MoKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9LCB0aGlzLm9wdGlvbnMub3B0aW9uc1BpbmdJbnRlcnZhbCAqIDEwMDApO1xuICAgIH1cbiAg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Z2F0ZToge1xuICAgICAgICAgICAgICAgIG9uQWNjZXB0OiAoKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IG1hbmFnZWRTZXNzaW9uID0gdGhpcy5zZXNzaW9uTWFuYWdlZChzZXNzaW9uKTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKG1hbmFnZWRTZXNzaW9uICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1hbmFnZWRTZXNzaW9uLmhlbGQgPSBob2xkO1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5lbmFibGVSZWNlaXZlclRyYWNrcyhzZXNzaW9uLCAhbWFuYWdlZFNlc3Npb24uaGVsZCk7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmVuYWJsZVNlbmRlclRyYWNrcyhzZXNzaW9uLCAhbWFuYWdlZFNlc3Npb24uaGVsZCAmJiAhbWFuYWdlZFNlc3Npb24ubXV0ZWQpO1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMuZGVsZWdhdGUgJiYgdGhpcy5kZWxlZ2F0ZS5vbkNhbGxIb2xkKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5kZWxlZ2F0ZS5vbkNhbGxIb2xkKHNlc3Npb24sIG1hbmFnZWRTZXNzaW9uLmhlbGQpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBvblJlamVjdDogKCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci53YXJuKGBbJHtzZXNzaW9uLmlkfV0gUmUtaW52aXRlIHJlcXVlc3Qgd2FzIHJlamVjdGVkYCk7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IG1hbmFnZWRTZXNzaW9uID0gdGhpcy5zZXNzaW9uTWFuYWdlZChzZXNzaW9uKTtcbiAgICAgICA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R1cm4gc2Vzc2lvbi5jYW5jZWwoKS50aGVuKCgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLmxvZyhgWyR7c2Vzc2lvbi5pZH1dIEludml0ZXIgbmV2ZXIgc2VudCBJTlZJVEUgKGNhbmNlbGVkKWApO1xuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZWxzZSBpZiAoc2Vzc2lvbiBpbnN0YW5jZW9mIEludml0YXRpb24pIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHNlc3Npb24ucmVqZWN0KCkudGhlbigoKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5sb2coYFske3Nlc3Npb24uaWR9XSBJbnZpdGF0aW9uIHJlamVjdGVkIChzZW50IDQ4MClgKTtcbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJVbmtub3duIHNlc3Npb24gdHlwZS5cIik7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgY2FzZSBTZXNzaW9uU3RhdGUuRXN0YWJsaXNoaW5nOlxuICAgICAgICAgICAgICAgIGlmIChzZXNzaW9uIGluc3RhbmNlb2YgSW52aXRlcikge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gc2Vzc2lvbi5jYW5jZWwoKS50aGVuKCgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLmxvZyhgWyR7c2Vzc2lvbi5pZH1dIEludml0ZXIgY2FuY2VsZWQgKHNlbnQgQ0FOQ0VMKWApO1xuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZWxzZSBpZiAoc2Vzc2lvbiBpbnN0YW5jZW9mIEludml0YXRpb24pIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHNlc3Npb24ucmVqZWN0KCkudGhlbigoKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5sb2coYFske3Nlc3Npb24uaWR9XSBJbnZpdGF0aW9uIHJlamVjdGVkIChzZW50IDQ4MClgKTtcbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJVbmtub3duIHNlc3Npb24gdHlwZS5cIik7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgY2FzZSBTZXNzaW9uU3RhdGUuRXN0YWJsaXNoZWQ6XG4gICAgICAgICAgICAgICAgcmV0dXJuIHNlc3Npb24uYnllKCkudGhlbigoKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLmxvZyhgWyR7c2Vzc2lvbi5pZH1dIFNlc3Npb24gZW5kZWQgKHNlbnQgQllFKWApO1xuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgY2FzZSBTZXNzaW9uU3RhdGUuVGVybWluYXRpbmc6XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIFNlc3Npb25TdGF0ZS5UZXJtaW5hdGVkOlxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJVbmtub3duIHN0YXRlXCIpO1xuICAgICAgICB9XG4gICAgICAgIHRoaXMubG9nZ2VyLmxvZyhgWyR7c2Vzc2lvbi5pZH1dIFRlcm1pbmF0aW5nIGluIHN0YXRlICR7c2Vzc2lvbi5zdGF0ZX0sIG5vIGFjdGlvbiB0YWtlbmApO1xuICAgICAgICByZXR1cm4gUHJvb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dzU2VydmVyc0RlcHJlY2F0ZWQgaW5zdGFuY2VvZiBBcnJheSkge1xuICAgICAgICAgICAgICAgICAgICBvcHRpb25zLnNlcnZlciA9IHdzU2VydmVyc0RlcHJlY2F0ZWRbMF07XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIC8vIGluaXRpYWxpemUgY29uZmlndXJhdGlvblxuICAgICAgICB0aGlzLmNvbmZpZ3VyYXRpb24gPSBPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30sIFRyYW5zcG9ydC5kZWZhdWx0T3B0aW9ucyksIG9wdGlvbnMpO1xuICAgICAgICAvLyB2YWxpZGF0ZSBzZXJ2ZXIgVVJMXG4gICAgICAgIGNvbnN0IHVybCA9IHRoaXMuY29uZmlndXJhdGlvbi5zZXJ2ZXI7XG4gICAgICAgIGNvbnN0IHBhcnNlZCA9IEdyYW1tYXIucGFyc2UodXJsLCBcImFic29sdXRlVVJJXCIpO1xuICAgICAgICBpZiAocGFyc2VkID09PSAtMSkge1xuICAgICAgICAgICAgdGhpcy5sb2dnZXIuZXJyb3IoYEludmFsaWQgV2ViU29ja2V0IFNlcnZlciBVUkwgXCIke3VybH1cImApO1xuICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwiSW52YWxpZCBXZWJTb2NrZXQgU2VydmVyIFVSTFwiKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoIVtcIndzc1wiLCBcIndzXCIsIFwidWRwXCJdLmluY2x1ZGVzKHBhcnNlZC5zY2hlbWUpKSB7XG4gICAgICAgICAgICB0aGlzLmxvZ2dlci5lcnJvcihgSW52YWxpZCBzY2hlbWUgaW4gV2ViU29ja2V0IFNlcnZlciBVUkwgXCIke3VybH1cImApO1xuICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwiSW52YWxpZCBzY2hlbWUgaW4gV2ViU29ja2V0IFNlcnZlciBVUkxcIik7XG4gICAgICAgIH1cbiAgICAgIC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mV0dXJuaW5nLlxuICAgICAgICAgICAgICAgIGlmICh0aGlzLnRyYW5zaXRpb25pbmdTdGF0ZSkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gUHJvbWlzZS5yZWplY3QodGhpcy50cmFuc2l0aW9uTG9vcERldGVjdGVkRXJyb3IoVHJhbnNwb3J0U3RhdGUuQ29ubmVjdGluZykpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAodGhpcy5jb25uZWN0UHJvbWlzZSkge1xuICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJDb25uZWN0IHByb21pc2UgbXVzdCBub3QgYmUgZGVmaW5lZC5cIik7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHJldHVybiBQcm9taXNlLnJlc29sdmUoKTsgLy8gQWxyZWFkeSBjb25uZWN0ZWRcbiAgICAgICAgICAgIGNhc2UgVHJhbnNwb3J0U3RhdGUuRGlzY29ubmVjdGluZzpcbiAgICAgICAgICAgICAgICAvLyBJZiBgc3RhdGVgIGlzIFwiRGlzY29ubmVjdGluZ1wiLCBgc3RhdGVgIE1VU1QgdHJhbnNpdGlvbiB0byBcIkNvbm5lY3RpbmdcIiBiZWZvcmUgcmV0dXJuaW5nXG4gICAgICAgICAgICAgICAgaWYgKHRoaXMuY29ubmVjdFByb21pc2UpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwiQ29ubmVjdCBwcm9taXNlIG11c3Qgbm90IGJlIGRlZmluZWQuXCIpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnRyYW5zaXRpb25TdGF0ZShUcmFuc3BvcnRTdGF0ZS5Db25uZWN0aW5nKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgY2F0Y2ggKGUpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGUgaW5zdGFuY2VvZiBTdGF0ZVRyYW5zaXRpb25FcnJvcikge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFByb21pc2UucmVqZWN0KGUpOyAvLyBMb29wIGRldGVjdGVkXG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgdGhyb3cgZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIFRyYW5zcG9ydFN0YXRlLkRpc2Nvbm5lY3RlZDpcbiAgICAgICAgICAgICAgICAvLyBJZiBgc3RhdGVgIGlzIFwiRGlzY29ubmVjdGVkXCIgYHN0YXRlYCBNVVNUIHRyYW5zaXRpb24gdG8gXCJDb25uZWN0aW5nXCIgYmVmb3JlIHJldHVybmluZ1xuICAgICAgICAgICAgICAgIGlmICh0aGlzLmNvbm5lY3RQcm9taXNlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcIkNvbm5lY3QgcHJvbWlzZSBtdXN0IG5vdCBiZSBkZWZpbmVkLlwiKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy50cmFuc2l0aW9uU3RhdGUoVHJhbnNwb3J0U3RhdGUuQ29ubmVjdGluZyk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGNhdGNoIChlKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChlIGluc3RhbmNlb2YgU3RhdGVUcmFuc2l0aW9uRXJyb3IpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBQcm9taXNlLnJlamVjdChlKTsgLy8gTG9vcCBkZXRlY3RlZFxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIHRocm93IGU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAg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wiV2ViU29ja2V0IGNvbnN0cnVjdGlvbiBmYWlsZWQuXCIpO1xuICAgICAgICAgICAgdGhpcy5sb2dnZXIuZXJyb3IoZXJyb3IudG9TdHJpbmcoKSk7XG4gICAgICAgICAgICByZXR1cm4gbmV3IFByb21pc2UoKHJlc29sdmUsIHJlamVjdCkgPT4ge1xuICAgICAgICAgICAgICAgIHRoaXMuY29ubmVjdFJlc29sdmUgPSByZXNvbHZlO1xuICAgICAgICAgICAgICAgIHRoaXMuY29ubmVjdFJlamVjdCA9IHJlamVjdDtcbiAgICAgICAgICAgICAgICAvLyBUaGUgYHN0YXRlYCBNVVNUIHRyYW5zaXRpb24gdG8gXCJEaXNjb25uZWN0aW5nXCIgb3IgXCJEaXNjb25uZWN0ZWRcIiBiZWZvcmUgcmVqZWN0aW5nXG4gICAgICAgICAgICAgICAgdGhpcy50cmFuc2l0aW9uU3RhdGUoVHJhbnNwb3J0U3RhdGUuRGlzY29ubmVjdGVkLCBlcnJvcik7XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgICAgICB0aGlzLmNvbm5lY3RQcm9taXNlID0gbmV3IFByb21pc2UoKHJlc29sdmUsIHJlamVjdCkgPT4ge1xuICAgICAgICAgICAgdGhpcy5jb25uZWN0UmVzb2x2ZSA9IHJlc29sdmU7XG4gICAgICAgICAgICB0aGlzLmNvbm5lY3RSZWplY3QgPSByZWplY3Q7XG4gICAgICAgICAgICB0aGlzLmNvbm5lY3RUaW1lb3V0ID0gc2V0VGltZW91dCgoKSA9PiB7XG4gICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIud2FybihcIkNvbm5lY3QgdGltZWQgb3V0LiBcIiArXG4gICAgICAgICAgICAgICAgICAgIFwiRXhjZWVkZWQgdGltZSBzZXQgaW4gY29uZmlndXJhdGlvbi5jb25uZWN0aW9uVGltZW91dDogXCIgK1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmNvbmZpZ3VyYXRpb24uY29ubmVjdGlvblRpbWVvdXQgK1xuICAgICAgICAgICAgICAgICAgICBcInMuXCIpO1xuICAgICAgICAgICAgICAgIHdzLmNsb3NlKDEwMDApOyAvLyBjYXJlZnVsIGhlcmUgdG8gdXNlIGEgbG9jYWwgcmVmZXJlbmNlIGluc3RlYWQgb2YgdGhpcy5fd3NcbiAgICAgICAgICAgIH0sIHRoaXMuY29uZmlndXJhdGlvbi5jb25uZWN0aW9uVGltZW91dCAqIDEwMDApO1xuICAgICAgICB9KTtcbiAgICAgICAgcmV0dXJuIHRoaXMuY29ubmVjdFByb21pc2U7XG4gICAgfVxuICAgIF9kaXNjb25uZWN0KCkge1xuICAgICAgICB0aGlzLmxvZ2dlci5sb2coYERpc2Nvbm5lY3RpbmcgJHt0aGlzLnNlcnZlcn1gKTtcbiAgICAgICAgc3dpdGNoICh0aGlzLnN0YXRlKSB7XG4gICAgICAgICAgICBjYXNlIFRyYW5zcG9ydFN0YXRlLkNvbm5lY3Rpbmc6XG4gICAgICAgICAgICAgICAgLy8gSWYgYHN0YXRlYCBpcyBcIkNvbm5lY3RpbmdcIiwgYHN0YXRlYCBNVVNUIHRyYW5zaXRpb24gdG8gXCJEaXNjb25uZWN0aW5nXCIgYmVmb3JlIHJldHVybmluZy5cbiAgICAgICAgICAgICAgICBpZiAodGhpcy5kaXNjb25uZWN0UHJvbWlzZSkge1xuICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJEaXNjb25uZWN0IHByb21pc2UgbXVzdCBub3QgYmUgZGVmaW5lZC5cIik7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMudHJhbnNpdGlvblN0YXRlKFRyYW5zcG9ydFN0YXRlLkRpc2Nvbm5lY3RpbmcpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBjYXRjaCAoZSkge1xuICAgICAgICAgICAgICAgICAgICBpZiAoZSBpbnN0YW5jZW9mIFN0YXRlVHJhbnNpdGlvbkVycm9yKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gUHJvbWlzZS5yZWplY3QoZSk7IC8vIExvb3AgZGV0ZWN0ZWRcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB0aHJvdyBlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgVHJhbnNwb3J0U3RhdGUuQ29ubmVjdGVkOlxuICAgICAgICAgICAgICAgIC8vIElmIGBzdGF0ZWAgaXMgXCJDb25uZWN0ZWRcIiwgYHN0YXRlYCBNVVNUIHRyYW5zaXRpb24gdG8gXCJEaXNjb25uZWN0aW5nXCIgYmVmb3JlIHJldHVybmluZy5cbiAgICAgICAgICAgICAgICBpZiAodGhpcy5kaXNjb25uZWN0UHJvbWlzZSkge1xuICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJEaXNjb25uZWN0IHByb21pc2UgbXVzdCBub3QgYmUgZGVmaW5lZC5cIik7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMudHJhbnNpdGlvblN0YXRlKFRyYW5zcG9ydFN0YXRlLkRpc2Nvbm5lY3RpbmcpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBjYXRjaCAoZSkge1xuICAgICAgICAgICAgICAgICAgICBpZiAoZSBpbnN0YW5jZW9mIFN0YXRlVHJhbnNpdGlvbkVycm9yKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gUHJvbWlzZS5yZWplY3QoZSk7IC8vIExvb3AgZGV0ZWN0ZWRcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB0aHJvdyBlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2Ug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H1cbiAgICAgICAgICAgICAgICBpZiAodGhpcy5kaXNjb25uZWN0UHJvbWlzZSkge1xuICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJEaXNjb25uZWN0IHByb21pc2UgbXVzdCBub3QgYmUgZGVmaW5lZC5cIik7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHJldHVybiBQcm9taXNlLnJlc29sdmUoKTsgLy8gQWxyZWFkeSBkaXNjb25uZWN0ZWRcbiAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwiVW5rbm93biBzdGF0ZVwiKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoIXRoaXMuX3dzKSB7XG4gICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJXZWJTb2NrZXQgbXVzdCBiZSBkZWZpbmVkLlwiKTtcbiAgICAgICAgfVxuICAgICAgICBjb25zdCB3cyA9IHRoaXMuX3dzO1xuICAgICAgICB0aGlzLmRpc2Nvbm5lY3RQcm9taXNlID0gbmV3IFByb21pc2UoKHJlc29sdmUsIHJlamVjdCkgPT4ge1xuICAgICAgICAgICAgdGhpcy5kaXNjb25uZWN0UmVzb2x2ZSA9IHJlc29sdmU7XG4gICAgICAgICAgICB0aGlzLmRpc2Nvbm5lY3RSZWplY3QgPSByZWplY3Q7XG4gICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgIC8vIFdlYlNvY2tldC5jbG9zZSgpXG4gICAgICAgICAgICAgICAgLy8gaHR0cHM6Ly9kZXZlbG9wZXIubW96aWxsYS5vcmcvZW4tVVMvZG9jcy9XZWIvQVBJL1dlYlNvY2tldC9jbG9zZVxuICAgICAgICAgICAgICAgIHdzLmNsb3NlKDEwMDApOyAvLyBjYXJlZnVsIGhlcmUgdG8gdXNlIGEgbG9jYWwgcmVmZXJlbmNlIGluc3RlYWQgb2YgdGhpcy5fd3NcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGNhdGNoIChlcnJvcikge1xuICAgICAgICAgICAgICAgIC8vIFRyZWF0aW5nIHRoaXMgYXMgYSBjb2RpbmcgZXJyb3IgYXMgaXQgYXBwYXJlbnRseSBjYW4gb25seSBoYXBwZW5cbiAgICAgICAgICAgICAgICAvLyBpZiB5b3UgcGFzcyBjbG9zZSgpIGludmFsaWQgcGFyYW1ldGVycyAoc28gaXQgc2hvdWxkIG5ldmVyIGhhcHBlbilcbiAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5lcnJvcihcIldlYlNvY2tldCBjbG9zZSBmYWlsZWQuXCIpO1xuICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLmVycm9yKGVycm9yLnRvU3RyaW5nKCkpO1xuICAgICAgICAgICAgICAgIHRocm93IGVycm9yO1xuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICAgICAgcmV0dXJuIHRoaXMuZGlzY29ubmVjdFByb21pc2U7XG4gICAgfVxuICAgIF9zZW5kKG1lc3NhZ2UpIHtcbiAgICAgICAgaWYgKHRoaXMuY29uZmlndXJhdGlvbi50cmFjZVNpcCA9PT0gdHJ1ZSkge1xuICAgICAgICAgICAgdGhpcy5sb2dnZXIubG9nKFwiU2VuZGluZyBXZWJTb2NrZXQgbWVzc2FnZTpcXG5cXG5cIiArIG1lc3NhZ2UgKyBcIlxcblwiKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAodGhpcy5fc3RhdGUgIT09IFRyYW5zcG9ydFN0YXRlLkNvbm5lY3RlZCkge1xuICAgICAgICAgICAgcmV0dXJuIFByb21pc2UucmVqZWN0KG5ldyBFcnJvcihcIk5vdCBjb25uZWN0ZWQuXCIpKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoIXRoaXMuX3dzKSB7XG4gICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJXZWJTb2NrZXQgdW5kZWZpbmVkLlwiKTtcbiAgICAgICAgfVxuICAgICAgICB0cnkge1xuICAgICAgICAgICAgLy8gV2ViU29ja2V0LnNlbmQoKVxuICAgICAgICAgICAgLy8gaHR0cHM6Ly9kZXZlbG9wZXIubW96aWxsYS5vcmcvZW4tVVMvZG9jcy9XZWIvQVBJL1dlYlNvY2tldC9zZW5kXG4gICAgICAgICAgICB0aGlzLl93cy5zZW5kKG1lc3NhZ2UpO1xuICAgICAgICB9XG4gICAgICAgIGNhdGNoIChlcnJvcikge1xuICAgICAgICAgICAgaWYgKGVycm9yIGluc3RhbmNlb2YgRXJyb3IpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gUHJvbWlzZS5yZWplY3QoZXJyb3IpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIFByb21pc2UucmVqZWN0KG5ldyBFcnJvcihcIldlYlNvY2tldCBzZW5kIGZhaWxlZC5cIikpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBQcm9taXNlLnJlc29sdmUoKTtcbiAgICB9XG4gICAgLyoqXG4gICAgICogV2ViU29ja2V0IFwib25jbG9zZVwiIGV2ZW50IGhhbmRsZXIuXG4gICAgICogQHBhcmFtIGV2IC0gRXZlbnQuXG4gICAgICovXG4gICAgb25XZWJTb2NrZXRDbG9zZShldiwgd3MpIHtcbiAgICAgICAgaWYgKHdzICE9PSB0aGlzLl93cykge1xuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBgV2ViU29ja2V0IGNsb3NlZCAke3RoaXMuc2VydmVyfSAoY29kZTogJHtldi5jb2RlfSlgO1xuICAgICAgICBjb25zdCBlcnJvciA9ICF0aGlzLmRpc2Nvbm5lY3RQcm9taXNlID8gbmV3IEVycm9yKG1lc3NhZ2UpIDogdW5kZWZpbmVkO1xuICAgICAgICBpZiAoZXJyb3IpIHtcbiAgICAgICAgICAgIHRoaXMubG9nZ2VyLndhcm4oXCJXZWJTb2NrZXQgY2xvc2VkIHVuZXhwZWN0ZWRseVwiKTtcbiA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mUgYmVsb3cgaXMgYW4gSVNPIDg4NTktMSAoTGF0aW4gMSkgZGVjb2Rlciwgc28ganVzdCBVVEYtOCBjb2RlIHBvaW50cyB0aGF0IGFyZSAxIGJ5dGUuXG4gICAgICAgICAgICAgICAgLy8gSXQncyBvbGQgY29kZSBhbmQgd29ya3MgaW4gb2xkIGJyb3dzZXJzIChJRSksIHNvIGxlYXZpbmcgaXQgaGVyZSBpbiBhIGNvbW1lbnQgaW4gY2FzZSBzb21lb25lIG5lZWRzIGl0LlxuICAgICAgICAgICAgICAgIC8vIGZpbmlzaGVkRGF0YSA9IFN0cmluZy5mcm9tQ2hhckNvZGUuYXBwbHkobnVsbCwgKG5ldyBVaW50OEFycmF5KGRhdGEpIGFzIHVua25vd24gYXMgQXJyYXk8bnVtYmVyPikpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgY2F0Y2ggKGVycikge1xuICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLmVycm9yKGVyci50b1N0cmluZygpKTtcbiAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5lcnJvcihcIlJlY2VpdmVkIFdlYlNvY2tldCBiaW5hcnkgbWVzc2FnZSBmYWlsZWQgdG8gYmUgY29udmVydGVkIGludG8gc3RyaW5nLCBtZXNzYWdlIGRpc2NhcmRlZFwiKTtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAodGhpcy5jb25maWd1cmF0aW9uLnRyYWNlU2lwID09PSB0cnVlKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIubG9nKFwiUmVjZWl2ZWQgV2ViU29ja2V0IGJpbmFyeSBtZXNzYWdlOlxcblxcblwiICsgZmluaXNoZWREYXRhICsgXCJcXG5cIik7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAvLyBXZWJTb2NrZXQgdGV4dCBtZXNzYWdlLlxuICAgICAgICAgICAgZmluaXNoZWREYXRhID0gZGF0YTtcbiAgICAgICAgICAgIGlmICh0aGlzLmNvbmZpZ3VyYXRpb24udHJhY2VTaXAgPT09IHRydWUpIHtcbiAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5sb2coXCJSZWNlaXZlZCBXZWJTb2NrZXQgdGV4dCBtZXNzYWdlOlxcblxcblwiICsgZmluaXNoZWREYXRhICsgXCJcXG5cIik7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHRoaXMuc3RhdGUgIT09IFRyYW5zcG9ydFN0YXRlLkNvbm5lY3RlZCkge1xuICAgICAgICAgICAgdGhpcy5sb2dnZXIud2FybihcIlJlY2VpdmVkIG1lc3NhZ2Ugd2hpbGUgbm90IGNvbm5lY3RlZCwgZGlzY2FyZGluZy4uLlwiKTtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuICAgICAgICBpZiAodGhpcy5vbk1lc3NhZ2UpIHtcbiAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgICAgdGhpcy5vbk1lc3NhZ2UoZmluaXNoZWREYXRhKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGNhdGNoIChlKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5sb2dnZXIuZXJyb3IoZS50b1N0cmluZygpKTtcbiAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5lcnJvcihcIkV4Y2VwdGlvbiB0aHJvd24gYnkgb25NZXNzYWdlIGNhbGxiYWNrXCIpO1xuICAgICAgICAgICAgICAgIHRocm93IGU7IC8vIHJldGhyb3cgdW5oYW5kbGVkIGV4Y2VwdGlvblxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxuICAgIC8qKlxuICAgICAqIFdlYlNvY2tldCBcIm9ub3BlblwiIGV2ZW50IGhhbmRsZXIuXG4gICAgICogQHBhcmFtIGV2IC0gRXZlbnQuXG4gICAgICovXG4gICAgb25XZWJTb2NrZXRPcGVu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XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGNhdGNoIChlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLmVycm9yKGUudG9TdHJpbmcoKSk7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMubG9nZ2VyLmVycm9yKFwiRXhjZXB0aW9uIHRocm93biBieSBvbkNvbm5lY3QgY2FsbGJhY2tcIik7XG4gICAgICAgICAgICAgICAgICAgIHRocm93IGU7IC8vIHJldGhyb3cgdW5oYW5kbGVkIGV4Y2VwdGlvblxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICAvLyAgVHJhbnNpdGlvbiBmcm9tIENvbm5lY3RlZFxuICAgICAgICBpZiAob2xkU3RhdGUgPT09IFRyYW5zcG9ydFN0YXRlLkNvbm5lY3RlZCkge1xuICAgICAgICAgICAgdGhpcy5zdG9wU2VuZGluZ0tlZXBBbGl2ZXMoKTtcbiAgICAgICAgICAgIGlmICh0aGlzLm9uRGlzY29ubmVjdCkge1xuICAgICAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChlcnJvcikge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5vbkRpc2Nvbm5lY3QoZXJyb3IpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5vbkRpc2Nvbm5lY3QoKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBjYXRjaCAoZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5lcnJvcihlLnRvU3RyaW5nKCkpO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZ2dlci5lcnJvcihcIkV4Y2VwdGlvbiB0aHJvd24gYnkgb25EaXNjb25uZWN0IGNhbGxiYWNrXCIpO1xuICAgICAgICAgICAgICAgICAgICB0aHJvdyBlOyAvLyByZXRocm93IHVuaGFuZGxlZCBleGNlcHRpb25cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgLy8gQ29tcGxldGUgY29ubmVjdCBwcm9taXNlXG4gICAgICAgIGlmIChvbGRTdGF0ZSA9PT0gVHJhbnNwb3J0U3RhdGUuQ29ubmVjdGluZykge1xuICAgICAgICAgICAgaWYgKCFjb25uZWN0UmVzb2x2ZSkge1xuICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcIkNvbm5lY3QgcmVzb2x2ZSB1bmRlZmluZWQuXCIpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKCFjb25uZWN0UmVqZWN0KSB7XG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwiQ29ubmVjdCByZWplY3QgdW5kZWZpbmVkLlwiKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIG5ld1N0YXRlID09PSBUcmFuc3BvcnRTdGF0ZS5Db25uZWN0ZWQgPyBjb25uZWN0UmVzb2x2ZSgpIDogY29ubmVjdFJlamVjdChlcnJvciB8fCBuZXcgRXJyb3IoXCJDb25uZWN0IGFib3J0ZWQuXCIpKTtcbiAgICAgICAgfVxuICAgICAgICAvLyBDb21wbGV0ZSBkaXNjb25uZWN0IHByb21pc2VcbiAgICAgICAgaWYgKG9sZFN0YXRlID09PSBUcmFuc3BvcnRTdGF0ZS5EaXNjb25uZWN0aW5nKSB7XG4gICAgICAgICAgICBpZiAoIWRpc2Nvbm5lY3RSZXNvbHZlKSB7XG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwiRGlzY29ubmVjdCByZXNvbHZlIHVuZGVmaW5lZC5cIik7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoIWRpc2Nvbm5lY3RSZWplY3QpIHtcbiAgICAgICAgICAgICAgIC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OltdLCJzb3VyY2VSb290IjoiIn0= \ No newline at end of file diff --git a/simplephone/src/phone.ts b/simplephone/src/phone.ts index a0b7559..b626f3f 100644 --- a/simplephone/src/phone.ts +++ b/simplephone/src/phone.ts @@ -113,7 +113,7 @@ class Phone { }, }, registererOptions: { - expires: 15, + expires: 120, refreshFrequency: 70, extraHeaders: this.getExtraHeaders() }